diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..dab07df1f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,83 @@ +# Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Projects\randd\randd_address_separator\dotnet\Sansan.RD.AddressSeparator.Tests\ codebase based on best match to current usage at 2022/08/18 +# You can modify the rules from these initially generated values to suit your own policies +# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference +[*.cs] + + +# IDE0160: Convert to file-scoped namespace +csharp_style_namespace_declarations = file_scoped:warning + +#Core editorconfig formatting - indentation + +#use soft tabs (spaces) for indentation +indent_style = space + +#Formatting - new line options + +#require braces to be on a new line for methods and types (also known as "Allman" style) +csharp_new_line_before_open_brace = all#methods, types + +#Formatting - organize using options + +#sort System.* using directives alphabetically, and place them before other usings +dotnet_sort_system_directives_first = true + +#Formatting - spacing options + +#remove space between method call name and opening parenthesis +csharp_space_between_method_call_name_and_opening_parenthesis = false +#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call +csharp_space_between_method_call_parameter_list_parentheses = false +#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. +csharp_space_between_method_declaration_parameter_list_parentheses = false + +#Style - expression bodied member options + +#prefer block bodies for methods +csharp_style_expression_bodied_methods = when_on_single_line:suggestion + +#Style - implicit and explicit types + +#prefer var over explicit type in all cases, unless overridden by another code style rule +csharp_style_var_elsewhere = true:suggestion +#prefer var is used to declare variables with built-in system types such as int +csharp_style_var_for_built_in_types = true:suggestion + +#Style - language keyword and framework type options + +#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion + +#Style - modifier options + +#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion + +#Style - Modifier preferences + +#when this rule is set to a list of modifiers, prefer the specified ordering. +csharp_preferred_modifier_order = public,internal:suggestion + + +# CA1711: Identifiers should not have incorrect suffix +dotnet_diagnostic.CA1711.severity = none + +# CA5393: Do not use unsafe DllImportSearchPath value +dotnet_diagnostic.CA5393.severity = none + +# https://docs.microsoft.com/ja-jp/dotnet/fundamentals/code-analysis/quality-rules/ca1051 +# TODO: not working?? +dotnet_diagnostic.ca1051.exclude_structs = true + +# CA1014: Mark assemblies with CLSCompliantAttribute +dotnet_diagnostic.CA1014.severity = none + +# IDE0079: Remove unnecessary suppression +dotnet_diagnostic.IDE0079.severity = none + + +[*.{cs,vb}] +dotnet_style_allow_statement_immediately_after_block_experimental=false:silent + +[*] +insert_final_newline = true diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..ab3791cf8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: shimat diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..fd8065d1a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,29 @@ +# Summary of your issue + + + +# Environment + +Write your environment. + +# What did you do when you faced the problem? + +Write here + +## Example code: + + +``` +paste your core code +``` + + +## Output: + + +``` +paste your output +``` + +## What did you intend to be? + diff --git a/.github/docker-appengine.yml b/.github/docker-appengine.yml new file mode 100644 index 000000000..305bc1114 --- /dev/null +++ b/.github/docker-appengine.yml @@ -0,0 +1,23 @@ +name: Docker gcr.io/google-appengine/aspnetcore + +on: + pull_request: + types: [synchronize, opened] + +env: + DEBIAN_FRONTEND: noninteractive + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: docker build + run: | + cd docker/appengine-aspnetcore3.1-opencv4.5.1 + docker build -t shimat/appengine-aspnetcore3.1-opencv4.5.1 . diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..c71e631de --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 180 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false \ No newline at end of file diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml new file mode 100644 index 000000000..3035fc5c6 --- /dev/null +++ b/.github/workflows/docfx.yml @@ -0,0 +1,56 @@ +name: DocFX + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Install .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v2 + + - name: DocFX + shell: cmd + run: | + choco install docfx -y + docfx docfx\docfx.json + + - name: Upload DocFX packages + uses: actions/upload-artifact@v4 + with: + name: docfx_site + path: ${{ github.workspace }}\docfx\_site + + - uses: actions/upload-pages-artifact@v3 + with: + path: docfx/_site + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/docker-deploy-ubuntu20.yml b/.github/workflows/docker-deploy-ubuntu20.yml new file mode 100644 index 000000000..77f98d595 --- /dev/null +++ b/.github/workflows/docker-deploy-ubuntu20.yml @@ -0,0 +1,48 @@ +name: Publish Ubuntu Docker Image + +on: + workflow_dispatch: + inputs: + docker_image_tag: + description: 'Docker Image Tag (yyyyMMdd)' + required: true + +env: + DEBIAN_FRONTEND: noninteractive + DOCKER_IMAGE_NAME1: "ubuntu22-dotnet6-opencv4.7.0" + DOCKER_IMAGE_NAME2: "ubuntu22-dotnet6sdk-opencv4.7.0" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: validate input + run: | + if [[ ! ${{ github.event.inputs.docker_image_tag }} =~ ^[0-9]{8}$ ]]; then + echo "::error Invalid tag name '${{ github.event.inputs.docker_image_tag }}'" + exit 1 + fi + + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: docker build 1 + run: | + cd docker/${DOCKER_IMAGE_NAME1} + docker build -t ghcr.io/shimat/opencvsharp/${DOCKER_IMAGE_NAME1}:${{ github.event.inputs.docker_image_tag }} . + + - name: docker build 2 + run: | + cd docker/${DOCKER_IMAGE_NAME2} + docker build -t ghcr.io/shimat/opencvsharp/${DOCKER_IMAGE_NAME2}:${{ github.event.inputs.docker_image_tag }} . + + - name: docker login + run: | + echo ${{secrets.GH_PACKAGES_PAT}} | docker login ghcr.io -u shimat --password-stdin + + - name: docker push + run: | + docker push ghcr.io/shimat/opencvsharp/${DOCKER_IMAGE_NAME1}:${{ github.event.inputs.docker_image_tag }} + docker push ghcr.io/shimat/opencvsharp/${DOCKER_IMAGE_NAME2}:${{ github.event.inputs.docker_image_tag }} diff --git a/.github/workflows/docker-ubuntu20.yml b/.github/workflows/docker-ubuntu20.yml new file mode 100644 index 000000000..3b8cb454b --- /dev/null +++ b/.github/workflows/docker-ubuntu20.yml @@ -0,0 +1,21 @@ +name: Docker mcr.microsoft.com/dotnet/sdk:6.0-focal + +on: + pull_request: + types: [synchronize, opened] + +env: + DEBIAN_FRONTEND: noninteractive + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: docker build + run: | + cd docker/ubuntu22-dotnet6sdk-opencv4.7.0 + docker build -t shimat/ubuntu22-dotnet6sdk-opencv4.7.0 . diff --git a/.github/workflows/linux-arm.yml b/.github/workflows/linux-arm.yml new file mode 100644 index 000000000..d21d7ee89 --- /dev/null +++ b/.github/workflows/linux-arm.yml @@ -0,0 +1,50 @@ +name: Linux ARM (Docker) + +on: + pull_request: + types: [synchronize, opened] + push: + branches: + - main + +env: + DEBIAN_FRONTEND: noninteractive + OPENCV_VERSION: 4.11.0 + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + with: + install: true + + - uses: docker/setup-qemu-action@v3 + + - name: Build with Docker + run: | + # Override OpenCV version in Dockerfile + docker build \ + -t opencvsharp-linux-arm:latest \ + --output=type=docker \ + --platform=linux/arm/v7 \ + --build-arg OPENCV_VERSION \ + ./docker/ubuntu22-dotnet6-opencv4.8.0 + + - name: Extract build files from Docker instance + run: | + docker create -ti --name opencvsharp-linux-arm-tmp opencvsharp-linux-arm bash + docker cp opencvsharp-linux-arm-tmp:/artifacts . + + - name: Patch nuspec with version and build NuGet package + run: | + sed -E --in-place=.bak "s/[0-9]\.[0-9]{1,2}\.[0-9]{1,2}.[0-9]{8}(-beta[0-9]*)?<\/version>/${OPENCV_VERSION}.$(date '+%Y%m%d')<\/version>/" nuget/OpenCvSharp4.runtime.linux-arm.nuspec + cp artifacts/libOpenCvSharpExtern.so nuget/ + dotnet pack nuget/OpenCvSharp4.runtime.linux-arm.csproj -o artifacts_arm + + - uses: actions/upload-artifact@v4 + with: + name: artifacts_linux_arm + path: artifacts_arm diff --git a/.github/workflows/macos10.yml.disabled b/.github/workflows/macos10.yml.disabled new file mode 100644 index 000000000..6335c77ca --- /dev/null +++ b/.github/workflows/macos10.yml.disabled @@ -0,0 +1,145 @@ +name: macOS 10.15 + +on: + pull_request: + types: [synchronize, opened] + push: + branches: + - main + +env: + DEBIAN_FRONTEND: noninteractive + OPENCV_VERSION: 4.8.0 + +jobs: + build: + + runs-on: macos-11 + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Install build dependencies + run: | + brew install wget pkg-config mono-libgdiplus gtk+ ffmpeg@4 glog yasm harfbuzz jpeg libpng libtiff openjpeg metis openblas opencore-amr protobuf tbb webp # openexr + +# - name: Cache OpenCV +# id: opencv-cache +# uses: actions/cache@v3 +# with: +# path: ${{ github.workspace }}/opencv_macos/ +# key: opencv-${{ env.OPENCV_VERSION }}-macos-rev1 + + - name: Build OpenCV + if: steps.opencv-cache.outputs.cache-hit != 'true' + run: | + pwd + wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -Oopencv-${OPENCV_VERSION}.zip && unzip opencv-${OPENCV_VERSION}.zip + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -Oopencv_contrib-${OPENCV_VERSION}.zip && unzip opencv_contrib-${OPENCV_VERSION}.zip + cd opencv-${OPENCV_VERSION} && mkdir build && cd build + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \ + -DBUILD_SHARED_LIBS=OFF \ + -DENABLE_CXX11=ON -DBUILD_TESTS=OFF \ + -DBUILD_PERF_TESTS=OFF \ + -DBUILD_DOCS=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_JAVA=OFF \ + -DBUILD_opencv_java_bindings_generator=OFF \ + -DBUILD_opencv_python_bindings_generator=OFF \ + -DBUILD_opencv_python_tests=OFF \ + -DBUILD_opencv_ts=OFF \ + -DBUILD_opencv_js=OFF \ + -DBUILD_opencv_js_bindings_generator=OFF \ + -DBUILD_opencv_apps=OFF \ + -DBUILD_opencv_barcode=OFF \ + -DBUILD_opencv_bioinspired=OFF \ + -DBUILD_opencv_ccalib=OFF \ + -DBUILD_opencv_datasets=OFF \ + -DBUILD_opencv_dnn_objdetect=OFF \ + -DBUILD_opencv_dpm=OFF \ + -DBUILD_opencv_fuzzy=OFF \ + -DBUILD_opencv_gapi=ON \ + -DBUILD_opencv_intensity_transform=OFF \ + -DBUILD_opencv_mcc=OFF \ + -DBUILD_opencv_objc_bindings_generator=OFF \ + -DBUILD_opencv_rapid=OFF \ + -DBUILD_opencv_reg=OFF \ + -DBUILD_opencv_stereo=OFF \ + -DBUILD_opencv_structured_light=OFF \ + -DBUILD_opencv_surface_matching=OFF \ + -DBUILD_opencv_wechat_qrcode=ON \ + -DBUILD_opencv_videostab=OFF \ + -DWITH_GSTREAMER=OFF \ + -DWITH_EIGEN=OFF \ + -DWITH_ADE=OFF \ + -DWITH_OPENEXR=OFF \ + -DOPENCV_ENABLE_NONFREE=ON \ + -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/opencv_macos .. + make -j2 + make install + cd ${GITHUB_WORKSPACE} + ls + + - name: Build OpenCvSharpExtern + run: | + pwd + mkdir src/build && cd $_ + cmake -DCMAKE_BUILD_TYPE=Release -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/opencv_macos .. + make -j2 + ls + ls OpenCvSharpExtern + cp OpenCvSharpExtern/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/nuget/ + + - name: Check OpenCvSharpExtern + run: | + cd ${GITHUB_WORKSPACE}/nuget/ + otool -L libOpenCvSharpExtern.dylib + nm libOpenCvSharpExtern.dylib + echo -ne "#include \n int core_Mat_sizeof(); int main(){ int i = core_Mat_sizeof(); printf(\"sizeof(Mat) = %d\", i); return 0; }" > test.c + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern + LD_LIBRARY_PATH=. ./test + + - name: Install .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + + - name: Create NuGet package + env: + BETA: "" + run: | + yyyymmdd=`date '+%Y%m%d'` + echo $yyyymmdd + sed -E -i=.bak "s/[0-9]\.[0-9]{1,2}\.[0-9]{1,2}.[0-9]{8}(-beta[0-9]*)?<\/version>/${OPENCV_VERSION}.${yyyymmdd}${BETA}<\/version>/" ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec + cat ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec + dotnet pack ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.osx.10.15-x64.csproj -o ${GITHUB_WORKSPACE}/artifacts_macos + ls ${GITHUB_WORKSPACE}/artifacts_macos + + - uses: actions/upload-artifact@v3 + with: + name: artifacts_macos_10 + path: artifacts_macos + + - name: Test + run: | + cd ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests + # ls + dotnet build -c Release -f net6.0 + cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/ + cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/ + # ls ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/ + # ls + sudo cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib /usr/local/lib/ + LD_LIBRARY_PATH=. + dotnet test OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime osx-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + ls + ls TestResults + + - uses: actions/upload-artifact@v1 + with: + name: artifacts_macos_10_test_results + path: test/OpenCvSharp.Tests/TestResults/test-results.trx diff --git a/.github/workflows/publish_nuget.yml b/.github/workflows/publish_nuget.yml new file mode 100644 index 000000000..21e0878ea --- /dev/null +++ b/.github/workflows/publish_nuget.yml @@ -0,0 +1,65 @@ +name: Publish NuGet + +on: + workflow_dispatch: + +jobs: + Publish: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Download windows artifact + uses: dawidd6/action-download-artifact@v6 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: windows.yml + name: packages_windows + + - name: Download ubuntu artifact + uses: dawidd6/action-download-artifact@v8 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: ubuntu22.yml + name: artifacts_ubuntu_22 + + - name: Download ubuntu arm artifact + uses: dawidd6/action-download-artifact@v8 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: linux-arm.yml + name: artifacts_linux_arm + + #- name: Download macos artifact + # uses: dawidd6/action-download-artifact@v6 + # with: + # github_token: ${{secrets.GITHUB_TOKEN}} + # workflow: macos10.yml + # name: artifacts_macos_10 + + - name: Download wasm artifact + uses: dawidd6/action-download-artifact@v8 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: wasm.yml + name: artifacts_wasm + + - run: | + ls -l + + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Rename + run: | + for f in $(find $PWD -maxdepth 1 -regex ".+\.s?nupkg"); do + dotnet run --project tool/OpenCvSharp.NupkgBetaRemover --configuration Release -- "$f" + done + + - name: Push to nuget.org + run: | + dotnet nuget push "*.nupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate + dotnet nuget push "*.snupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/.github/workflows/ubuntu22.yml b/.github/workflows/ubuntu22.yml new file mode 100644 index 000000000..cc61be85b --- /dev/null +++ b/.github/workflows/ubuntu22.yml @@ -0,0 +1,173 @@ +name: Ubuntu 22.04 + +on: + pull_request: + types: [synchronize, opened] + push: + branches: + - main + +env: + DEBIAN_FRONTEND: noninteractive + OPENCV_VERSION: 4.11.0 + OPENCV_CACHE_VERSION: 1 + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + path: opencvsharp + + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + ca-certificates \ + g++ \ + make \ + cmake \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + x264 \ + libtesseract-dev + + - name: Cache OpenCV + id: opencv-cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/opencv_artifacts/ + key: opencv-${{ env.OPENCV_VERSION }}-rev${{ env.OPENCV_CACHE_VERSION }} + + - name: Checkout OpenCV + if: steps.opencv-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: opencv/opencv + path: opencv + ref: ${{ env.OPENCV_VERSION }} + - name: Checkout OpenCV Contrib + if: steps.opencv-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: opencv/opencv_contrib + path: opencv_contrib + ref: ${{ env.OPENCV_VERSION }} + + - name: Build OpenCV + if: steps.opencv-cache.outputs.cache-hit != 'true' + run: | + mkdir opencv/build && cd opencv/build + cmake \ + -S . \ + -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_apps=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=ON \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D BUILD_opencv_videostab=OFF \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/opencv_artifacts .. + cmake --build build + cmake --install build + sudo ldconfig + cd ${GITHUB_WORKSPACE} + ls + + - name: Build OpenCvSharpExtern + run: | + mkdir opencvsharp/src/build && cd $_ + cmake -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/opencv_artifacts .. + make -j + ls OpenCvSharpExtern + cp OpenCvSharpExtern/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/opencvsharp/nuget/ + + - name: Check OpenCvSharpExtern + run: | + cd ${GITHUB_WORKSPACE}/opencvsharp/nuget/ + ldd libOpenCvSharpExtern.so + nm libOpenCvSharpExtern.so + echo -ne "#include \n int core_Mat_sizeof(); int main(){ int i = core_Mat_sizeof(); printf(\"sizeof(Mat) = %d\", i); return 0; }" > test.c + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern + LD_LIBRARY_PATH=. ./test + + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Create NuGet package + env: + BETA: "" + run: | + yyyymmdd=`date '+%Y%m%d'` + echo $yyyymmdd + cd ${GITHUB_WORKSPACE}/opencvsharp + sed -E --in-place=.bak \ + "s/[0-9]\.[0-9]{1,2}\.[0-9]{1,2}.[0-9]{8}(-beta[0-9]*)?<\/version>/${OPENCV_VERSION}.${yyyymmdd}${BETA}<\/version>/" \ + nuget/OpenCvSharp4.official.runtime.linux-x64.nuspec + cat nuget/OpenCvSharp4.official.runtime.linux-x64.nuspec + dotnet pack nuget/OpenCvSharp4.official.runtime.linux-x64.csproj -o ${GITHUB_WORKSPACE}/artifacts_ubuntu + ls ${GITHUB_WORKSPACE}/artifacts_ubuntu + + - uses: actions/upload-artifact@v4 + with: + name: artifacts_ubuntu_22 + path: artifacts_ubuntu + + - name: Test + run: | + cd ${GITHUB_WORKSPACE}/opencvsharp/test/OpenCvSharp.Tests + dotnet build -c Release -f net8.0 + cp ${GITHUB_WORKSPACE}/opencvsharp/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/opencvsharp/test/OpenCvSharp.Tests/bin/Release/net8.0/ + cp ${GITHUB_WORKSPACE}/opencvsharp/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/opencvsharp/test/OpenCvSharp.Tests/ + sudo cp ${GITHUB_WORKSPACE}/opencvsharp/nuget/libOpenCvSharpExtern.so /usr/lib/ + LD_LIBRARY_PATH=. dotnet test OpenCvSharp.Tests.csproj -c Release -f net8.0 --runtime linux-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml new file mode 100644 index 000000000..07826af59 --- /dev/null +++ b/.github/workflows/wasm.yml @@ -0,0 +1,176 @@ +name: Wasm + +on: + pull_request: + types: [synchronize, opened] + push: + branches: + - main + +env: + DEBIAN_FRONTEND: noninteractive + OPENCV_VERSION: 4.11.0 + EM_VERSION: 3.1.32 + EM_CACHE_FOLDER: 'emsdk-cache' + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Install dependencies + run: | + pwd + echo ${GITHUB_WORKSPACE} + current_path=$(pwd) + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + g++ \ + make \ + cmake \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + x264 \ + libtesseract-dev + + - name: Cache OpenCV + id: opencv-cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/opencv_wasm/ + key: opencv-${{ env.OPENCV_VERSION }}-wasm + + - name: Setup Emscripten cache + id: cache-system-libraries + uses: actions/cache@v4 + with: + path: ${{env.EM_CACHE_FOLDER}} + key: ${{env.EM_VERSION}}-${{ runner.os }} + - uses: mymindstorm/setup-emsdk@v14 + with: + version: ${{env.EM_VERSION}} + actions-cache-folder: ${{env.EM_CACHE_FOLDER}} + + - name: Build OpenCV + if: steps.opencv-cache.outputs.cache-hit != 'true' + run: | + wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -Oopencv-${OPENCV_VERSION}.zip && unzip opencv-${OPENCV_VERSION}.zip + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -Oopencv_contrib-${OPENCV_VERSION}.zip && unzip opencv_contrib-${OPENCV_VERSION}.zip + cd opencv-${OPENCV_VERSION} && mkdir build && cd build + emcmake cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \ + -DBUILD_SHARED_LIBS=OFF \ + -DENABLE_CXX11=ON -DBUILD_TESTS=OFF \ + -DBUILD_PERF_TESTS=OFF \ + -DBUILD_DOCS=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_JAVA=OFF \ + -DBUILD_opencv_java_bindings_generator=OFF \ + -DBUILD_opencv_python_bindings_generator=OFF \ + -DBUILD_opencv_python_tests=OFF \ + -DBUILD_opencv_ts=OFF \ + -DBUILD_opencv_js=OFF \ + -DBUILD_opencv_js_bindings_generator=OFF \ + -DBUILD_opencv_apps=OFF \ + -DBUILD_opencv_barcode=OFF \ + -DBUILD_opencv_bioinspired=OFF \ + -DBUILD_opencv_ccalib=OFF \ + -DBUILD_opencv_datasets=OFF \ + -DBUILD_opencv_dnn_objdetect=OFF \ + -DBUILD_opencv_dpm=OFF \ + -DBUILD_opencv_fuzzy=OFF \ + -DBUILD_opencv_gapi=ON \ + -DBUILD_opencv_intensity_transform=OFF \ + -DBUILD_opencv_mcc=OFF \ + -DBUILD_opencv_objc_bindings_generator=OFF \ + -DBUILD_opencv_rapid=OFF \ + -DBUILD_opencv_reg=OFF \ + -DBUILD_opencv_stereo=OFF \ + -DBUILD_opencv_structured_light=OFF \ + -DBUILD_opencv_surface_matching=OFF \ + -DBUILD_opencv_wechat_qrcode=ON \ + -DBUILD_opencv_videostab=OFF \ + -DWITH_GSTREAMER=OFF \ + -DWITH_EIGEN=OFF \ + -DWITH_ADE=OFF \ + -DOPENCV_ENABLE_NONFREE=ON \ + -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/opencv_wasm \ + -DCMAKE_C_FLAGS='-s WASM=1' -DCMAKE_CXX_FLAGS='-s WASM=1' \ + -DWITH_ITT=OFF \ + -DWITH_JPEG=OFF \ + -DWITH_TIFF=OFF \ + -DWITH_PNG=OFF \ + -DWITH_IPP=OFF \ + -DWITH_LAPACK=OFF \ + -DCV_ENABLE_INTRINSICS=OFF \ + -DBUILD_opencv_dnn=ON \ + .. + make -j + make install + em++ -r -o ${GITHUB_WORKSPACE}/opencv_wasm/libopencv.o \ + -Wl,--whole-archive ${GITHUB_WORKSPACE}/opencv_wasm/lib/*.a \ + ${GITHUB_WORKSPACE}/opencv_wasm/lib/opencv4/3rdparty/*.a + cd ${GITHUB_WORKSPACE} + ls + + - name: Build OpenCvSharpExtern + run: | + ls ${GITHUB_WORKSPACE}/opencv_wasm + echo "-----" + mkdir src/build && cd $_ + emcmake cmake -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=${GITHUB_WORKSPACE}/opencv_wasm/lib/cmake/opencv4 -DWASM_LIB=${GITHUB_WORKSPACE}/opencv_wasm/libopencv.o .. + make -j + ls OpenCvSharpExtern + cp OpenCvSharpExtern/libOpenCvSharpExtern.a ${GITHUB_WORKSPACE}/nuget/ + + - name: Check OpenCvSharpExtern + run: | + echo TODO + + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Create NuGet package + env: + BETA: "" + run: | + yyyymmdd=`date '+%Y%m%d'` + echo $yyyymmdd + sed -E --in-place=.bak "s/[0-9]\.[0-9]{1,2}\.[0-9]{1,2}.[0-9]{8}(-beta[0-9]*)?<\/version>/${OPENCV_VERSION}.${yyyymmdd}${BETA}<\/version>/" ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.wasm.nuspec + cat ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.wasm.nuspec + dotnet pack ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.wasm.csproj -o ${GITHUB_WORKSPACE}/artifacts_wasm + ls ${GITHUB_WORKSPACE}/artifacts_wasm + + - uses: actions/upload-artifact@v4 + with: + name: artifacts_wasm + path: artifacts_wasm + + - name: Test + run: | + echo TODO diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 000000000..082b09b7a --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,179 @@ +name: Windows Server 2022 + +on: + pull_request: + types: [synchronize, opened] + push: + branches: + - main + +env: + OPENCV_VERSION: "4.11.0" + OPENCV_FILES_TAG: "4.11.0.20250505" + TESSERACT_RELEASE_VERSION: "2024.08.19" + +jobs: + build: + + runs-on: windows-2022 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + submodules: true + +# - name: Cache restored NuGet packages +# uses: actions/cache@v2 +# with: +# path: ${{ github.workspace }}/.nuget/packages +# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} +# restore-keys: | +# ${{ runner.os }}-nuget- + + - name: Cache OpenCV binaries + id: cache_opencv + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/opencv_files + key: opencv-${{ env.OPENCV_VERSION }}-rev1 + + - name: Download OpenCV binaries + if: steps.cache_opencv.outputs.cache-hit != 'true' + shell: powershell + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download --repo shimat/opencv_files ${env:OPENCV_FILES_TAG} --pattern "opencv_win_x64.zip" + gh release download --repo shimat/opencv_files ${env:OPENCV_FILES_TAG} --pattern "opencv_win_x86.zip" + Expand-Archive -Path opencv_win_x64.zip -DestinationPath opencv_files/opencv_win_x64 -Force -ErrorAction Stop + Expand-Archive -Path opencv_win_x86.zip -DestinationPath opencv_files/opencv_win_x86 -Force -ErrorAction Stop + ls opencv_files + ls opencv_files/opencv_win_x64 + + - name: Cache Tesseract binaries + id: cache_tesseract + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/tesseract_files + key: tesseract-41-rev2 + + - name: Download Tesseract binaries + if: steps.cache_tesseract.outputs.cache-hit != 'true' + shell: powershell + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download --repo shimat/tesseract_vcpkg ${TESSERACT_RELEASE_VERSION} --pattern "*.zip" --output tesseract.zip + Expand-Archive -Path tesseract.zip -DestinationPath tesseract_files -Force -ErrorAction Stop + ls tesseract_files + Move-Item tesseract_files/tesseract_vcpkg.0.0.9-beta tesseract_files/tesseract_vcpkg + ls tesseract_files/tesseract_vcpkg + New-Item tesseract_files/tesseract_vcpkg -ItemType Directory -Force + Move-Item tesseract_files/tesseract_vcpkg/installed/* tesseract_files/tesseract_vcpkg/ + ls tesseract_files/tesseract_vcpkg + + - name: NuGet restore + shell: cmd + run: | + nuget restore + + - name: Install Server-Media-Foundation + shell: powershell + run: | + Install-WindowsFeature Server-Media-Foundation + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Build x64 + shell: cmd + run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=x64 -maxcpucount + + - name: Build x86 + shell: cmd + run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=x86 -maxcpucount + + #- name: Build ARM + # shell: cmd + # run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=ARM -maxcpucount + + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + + - name: Build + shell: cmd + run: | + dotnet build src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj -f net6.0 -p:configuration=Release -maxcpucount + dotnet build src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj -f net6.0-windows -p:configuration=Release -maxcpucount + + - name: Pack NuGet packages + shell: powershell + run: | + $ErrorActionPreference = "Stop" + + $date = Get-Date -Format "yyyyMMdd" + $version = "${env:OPENCV_VERSION}.${date}-beta" + Write-Host "version = ${version}" + + (Get-ChildItem $env:GITHUB_WORKSPACE -Recurse).Where{ $_.Extension -eq ".nuspec" }.ForEach{ + [xml]$xml = Get-Content $_.FullName + $xml.package.metadata.version = $version + $xml.Save($_.FullName) + } + + $windowsNuspec = "${env:GITHUB_WORKSPACE}\nuget\OpenCvSharp4.Windows.nuspec" + $extensionsNuspec = "${env:GITHUB_WORKSPACE}\nuget\OpenCvSharp4.Extensions.nuspec" + $wpfExtensionsNuspec = "${env:GITHUB_WORKSPACE}\nuget\OpenCvSharp4.WpfExtensions.nuspec" + $nuspecFiles = @($windowsNuspec, $extensionsNuspec, $wpfExtensionsNuspec) + foreach ( $nuspecFile in $nuspecFiles ) { + [xml]$xml = Get-Content $nuspecFile + foreach ($group in $xml.package.metadata.dependencies.ChildNodes){ + foreach ($dependency in $group.ChildNodes){ + $packageId = $dependency.GetAttribute("id") + if ($packageId.StartsWith("OpenCvSharp")){ + Write-Host "before: " $packageId "=" $dependency.GetAttribute("version") + $dependency.SetAttribute("version", $version) + Write-Host "after: " $packageId "=" $dependency.GetAttribute("version") + $xml.Save($nuspecFile) + } + else { + Write-Host "Skipped: " $packageId + } + } + } + } + + nuget pack nuget/OpenCvSharp4.nuspec -OutputDirectory artifacts -Symbols -SymbolPackageFormat snupkg + nuget pack nuget/OpenCvSharp4.Windows.nuspec -OutputDirectory artifacts + nuget pack nuget/OpenCvSharp4.Extensions.nuspec -OutputDirectory artifacts -Symbols -SymbolPackageFormat snupkg + nuget pack nuget/OpenCvSharp4.WpfExtensions.nuspec -OutputDirectory artifacts -Symbols -SymbolPackageFormat snupkg + nuget pack nuget/OpenCvSharp4.runtime.win.nuspec -OutputDirectory artifacts + + - name: Test + shell: powershell + run: | + cd ${env:GITHUB_WORKSPACE}\test\OpenCvSharp.Tests + dotnet test -c Release -f net48 --runtime win-x64 + + - name: Test Windows-only functions + shell: powershell + run: | + cd ${env:GITHUB_WORKSPACE}\test\OpenCvSharp.Tests.Windows + dotnet test -c Release -f net48 --runtime win-x64 + + - name: Run ReleaseMaker + shell: powershell + run: | + cd "${env:GITHUB_WORKSPACE}\tool\OpenCvSharp.ReleaseMaker" + dotnet run -c Release --runtime win-x64 -- "${env:GITHUB_WORKSPACE}" "${env:GITHUB_WORKSPACE}\artifacts" ${{env.OPENCV_VERSION}} + + - name: Upload NuGet packages and Release packages + uses: actions/upload-artifact@v4 + with: + name: packages_windows + path: ${{ github.workspace }}\artifacts diff --git a/.gitignore b/.gitignore index 9d6ec5301..6f087b356 100644 --- a/.gitignore +++ b/.gitignore @@ -114,11 +114,13 @@ UpgradeLog*.XML *.BAK /.vs /OpenCvSharp.VC.VC.opendb -/src/OpenCvSharp.Sandbox/foo.yml -/src/OpenCvSharp.Sandbox/dll/x64/OpenCvSharpExtern.dll -/src/OpenCvSharp.Sandbox/dll/x86/OpenCvSharpExtern.dll -/test/OpenCvSharp.Tests/dll/x64/OpenCvSharpExtern.dll -/test/OpenCvSharp.Tests/dll/x86/OpenCvSharpExtern.dll /nuget/nuget/*.nupkg /nuget/*.nupkg /Help +/myresults.xml +/opencv_files +/test/OpenCvSharp.Tests/dll/x64/*.dll +/test/OpenCvSharp.Tests/dll/x86/*.dll +/test/OpenCvSharp.Tests/*.dll +Help +/tesseract_files diff --git a/.gitmodules b/.gitmodules index 6b068abd2..ff83a6b21 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "opencv"] - path = opencv - url = https://github.com/shimat/opencv_files.git [submodule "samples"] path = samples url = https://github.com/shimat/opencvsharp_samples.git diff --git a/LICENSE b/LICENSE index f9101f445..434e92781 100644 --- a/LICENSE +++ b/LICENSE @@ -1,29 +1,201 @@ -BSD 3-Clause License - -Copyright (c) 2017, shimat -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2008 shimat + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/OpenCvSharp.shfbproj b/OpenCvSharp.shfbproj deleted file mode 100644 index 7cf3dae5b..000000000 --- a/OpenCvSharp.shfbproj +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Debug - AnyCPU - 2.0 - {5cbd22b4-2d40-4629-9138-cf3dd157ee3e} - 2015.6.5.0 - - Documentation - Documentation - Documentation - - .NET Framework 4.6 - .\Help\ - Documentation - en-US - OnlyWarningsAndErrors - Website - False - True - False - True - AutoDocumentCtors, AutoDocumentDispose - - - - - - - - - - - 1.0.0.0 - 2 - False - C#, Visual Basic, Managed C++, F#, JavaScript - Blank - True - VS2013 - False - Guid - A Sandcastle Documented Class Library - AboveNamespaces - 100 - Attributes, ExplicitInterfaceImplementations, InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected - Msdn - True - - - - - - - - - - - - - - - - - - - - - - - - - - - OnBuildSuccess - - \ No newline at end of file diff --git a/OpenCvSharp.sln b/OpenCvSharp.sln index 74ed2aa94..73ba676ab 100644 --- a/OpenCvSharp.sln +++ b/OpenCvSharp.sln @@ -1,252 +1,211 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DFC77F39-BE2A-459D-AC66-14B774665D78}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E048D213-B3B9-453F-9A41-29FDEB0D496B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{1F113DD0-E292-47A5-8EFF-3FB5D0869BF3}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp", "src\OpenCvSharp\OpenCvSharp.xproj", "{EB310923-197F-4E20-B123-3A3E7F1D5069}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp", "src\OpenCvSharp\OpenCvSharp.csproj", "{EB310923-197F-4E20-B123-3A3E7F1D5069}" ProjectSection(ProjectDependencies) = postProject {8E7279F8-F801-4672-B42F-1ED2C68B16A4} = {8E7279F8-F801-4672-B42F-1ED2C68B16A4} EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.Tests", "test\OpenCvSharp.Tests\OpenCvSharp.Tests.xproj", "{FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.Tests", "test\OpenCvSharp.Tests\OpenCvSharp.Tests.csproj", "{FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.Blob", "src\OpenCvSharp.Blob\OpenCvSharp.Blob.xproj", "{82AFDA65-515E-4EC0-A415-77D8A6711508}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.Extensions", "src\OpenCvSharp.Extensions\OpenCvSharp.Extensions.csproj", "{B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.Extensions", "src\OpenCvSharp.Extensions\OpenCvSharp.Extensions.xproj", "{B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenCvSharpExtern", "src\OpenCvSharpExtern\OpenCvSharpExtern.vcxproj", "{8E7279F8-F801-4672-B42F-1ED2C68B16A4}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.UserInterface", "src\OpenCvSharp.UserInterface\OpenCvSharp.UserInterface.xproj", "{FAD73716-92EC-4A0F-B594-286FF08EDE33}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenCvSharp.DebuggerVisualizers", "src\OpenCvSharp.DebuggerVisualizers\OpenCvSharp.DebuggerVisualizers.csproj", "{4232CB4A-DFE3-46CA-9503-C5F1798BAED3}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenCvSharpExtern", "src\OpenCvSharpExtern\OpenCvSharpExtern.vcxproj", "{8E7279F8-F801-4672-B42F-1ED2C68B16A4}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tool", "tool", "{A6E578C0-A34A-4CCF-A808-CBAC81CB48C0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenCvSharp.ReleaseMaker", "src\OpenCvSharp.ReleaseMaker\OpenCvSharp.ReleaseMaker.csproj", "{E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.NupkgBetaRemover", "tool\OpenCvSharp.NupkgBetaRemover\OpenCvSharp.NupkgBetaRemover.csproj", "{CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.DebuggerVisualizers2010", "src\OpenCvSharp.DebuggerVisualizers2010\OpenCvSharp.DebuggerVisualizers2010.xproj", "{7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.WpfExtensions", "src\OpenCvSharp.WpfExtensions\OpenCvSharp.WpfExtensions.csproj", "{01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.DebuggerVisualizers2012", "src\OpenCvSharp.DebuggerVisualizers2012\OpenCvSharp.DebuggerVisualizers2012.xproj", "{DF57CCCB-47F5-41E0-B6BA-1557E3605396}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.ReleaseMaker", "tool\OpenCvSharp.ReleaseMaker\OpenCvSharp.ReleaseMaker.csproj", "{1C399497-5240-439A-879A-4ACB34C409AE}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OpenCvSharp.DebuggerVisualizers2013", "src\OpenCvSharp.DebuggerVisualizers2013\OpenCvSharp.DebuggerVisualizers2013.xproj", "{AE1B5AA8-456E-4A6D-BACE-9EA571266037}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{47A5316C-49F2-402A-A04C-0A0AAA397F47}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenCvSharp.DebuggerVisualizers2015", "src\OpenCvSharp.DebuggerVisualizers2015\OpenCvSharp.DebuggerVisualizers2015.csproj", "{4232CB4A-DFE3-46CA-9503-C5F1798BAED3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenCvSharp.DebuggerVisualizers.Tester", "test\OpenCvSharp.DebuggerVisualizers.Tester\OpenCvSharp.DebuggerVisualizers.Tester.csproj", "{FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.Tests.Windows", "test\OpenCvSharp.Tests.Windows\OpenCvSharp.Tests.Windows.csproj", "{36F6A125-3633-441E-9794-97EB91E50F20}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM Release|x64 = Release|x64 Release|x86 = Release|x86 - Release-JP|Any CPU = Release-JP|Any CPU - Release-JP|x64 = Release-JP|x64 - Release-JP|x86 = Release-JP|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|ARM.ActiveCfg = Debug|Any CPU + {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|ARM.Build.0 = Debug|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|x64.ActiveCfg = Debug|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|x64.Build.0 = Debug|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|x86.ActiveCfg = Debug|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|x86.Build.0 = Debug|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|Any CPU.Build.0 = Release|Any CPU + {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|ARM.ActiveCfg = Release|Any CPU + {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|ARM.Build.0 = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x64.ActiveCfg = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x64.Build.0 = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x86.ActiveCfg = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x86.Build.0 = Release|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|Any CPU.ActiveCfg = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|Any CPU.Build.0 = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x64.ActiveCfg = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x64.Build.0 = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x86.ActiveCfg = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x86.Build.0 = Release-JP|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|ARM.Build.0 = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|x64.ActiveCfg = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|x64.Build.0 = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|x86.ActiveCfg = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|x86.Build.0 = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|Any CPU.Build.0 = Release|Any CPU + {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|ARM.ActiveCfg = Release|Any CPU + {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|ARM.Build.0 = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x64.ActiveCfg = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x64.Build.0 = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x86.ActiveCfg = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x86.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x64.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x64.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x86.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x86.Build.0 = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Debug|Any CPU.Build.0 = Debug|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Debug|x64.ActiveCfg = Debug|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Debug|x64.Build.0 = Debug|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Debug|x86.ActiveCfg = Debug|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Debug|x86.Build.0 = Debug|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release|Any CPU.ActiveCfg = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release|Any CPU.Build.0 = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release|x64.ActiveCfg = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release|x64.Build.0 = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release|x86.ActiveCfg = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release|x86.Build.0 = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release-JP|x64.ActiveCfg = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release-JP|x64.Build.0 = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release-JP|x86.ActiveCfg = Release|Any CPU - {82AFDA65-515E-4EC0-A415-77D8A6711508}.Release-JP|x86.Build.0 = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|ARM.Build.0 = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|x64.ActiveCfg = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|x64.Build.0 = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|x86.ActiveCfg = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|x86.Build.0 = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|Any CPU.Build.0 = Release|Any CPU + {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|ARM.ActiveCfg = Release|Any CPU + {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|ARM.Build.0 = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x64.ActiveCfg = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x64.Build.0 = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x86.ActiveCfg = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x86.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x64.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x64.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x86.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x86.Build.0 = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Debug|x64.ActiveCfg = Debug|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Debug|x64.Build.0 = Debug|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Debug|x86.ActiveCfg = Debug|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Debug|x86.Build.0 = Debug|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release|Any CPU.Build.0 = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release|x64.ActiveCfg = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release|x64.Build.0 = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release|x86.ActiveCfg = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release|x86.Build.0 = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release-JP|x64.ActiveCfg = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release-JP|x64.Build.0 = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release-JP|x86.ActiveCfg = Release|Any CPU - {FAD73716-92EC-4A0F-B594-286FF08EDE33}.Release-JP|x86.Build.0 = Release|Any CPU {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|ARM.ActiveCfg = Debug|Win32 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x64.ActiveCfg = Release|x64 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x64.Build.0 = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x86.ActiveCfg = Debug|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x86.Build.0 = Debug|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|Any CPU.ActiveCfg = Release|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|Any CPU.Build.0 = Release|Win32 + {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x86.ActiveCfg = Release|Win32 + {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x86.Build.0 = Release|Win32 + {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|Any CPU.ActiveCfg = Release|x64 + {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|Any CPU.Build.0 = Release|x64 + {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|ARM.ActiveCfg = Release|Win32 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x64.ActiveCfg = Release|x64 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x64.Build.0 = Release|x64 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x86.ActiveCfg = Release|Win32 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x86.Build.0 = Release|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|Any CPU.ActiveCfg = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|Any CPU.Build.0 = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x64.ActiveCfg = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x64.Build.0 = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x86.ActiveCfg = Release|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x86.Build.0 = Release|Win32 - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Debug|x64.ActiveCfg = Debug|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Debug|x64.Build.0 = Debug|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Debug|x86.ActiveCfg = Debug|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Debug|x86.Build.0 = Debug|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release|Any CPU.Build.0 = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release|x64.ActiveCfg = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release|x64.Build.0 = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release|x86.ActiveCfg = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release|x86.Build.0 = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release-JP|x64.ActiveCfg = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release-JP|x64.Build.0 = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release-JP|x86.ActiveCfg = Release|Any CPU - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23}.Release-JP|x86.Build.0 = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Debug|x64.ActiveCfg = Debug|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Debug|x64.Build.0 = Debug|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Debug|x86.ActiveCfg = Debug|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Debug|x86.Build.0 = Debug|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release|Any CPU.Build.0 = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release|x64.ActiveCfg = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release|x64.Build.0 = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release|x86.ActiveCfg = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release|x86.Build.0 = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release-JP|x64.ActiveCfg = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release-JP|x64.Build.0 = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release-JP|x86.ActiveCfg = Release|Any CPU - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D}.Release-JP|x86.Build.0 = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Debug|x64.ActiveCfg = Debug|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Debug|x64.Build.0 = Debug|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Debug|x86.ActiveCfg = Debug|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Debug|x86.Build.0 = Debug|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release|Any CPU.Build.0 = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release|x64.ActiveCfg = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release|x64.Build.0 = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release|x86.ActiveCfg = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release|x86.Build.0 = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release-JP|x64.ActiveCfg = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release-JP|x64.Build.0 = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release-JP|x86.ActiveCfg = Release|Any CPU - {DF57CCCB-47F5-41E0-B6BA-1557E3605396}.Release-JP|x86.Build.0 = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Debug|x64.ActiveCfg = Debug|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Debug|x64.Build.0 = Debug|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Debug|x86.ActiveCfg = Debug|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Debug|x86.Build.0 = Debug|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release|Any CPU.Build.0 = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release|x64.ActiveCfg = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release|x64.Build.0 = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release|x86.ActiveCfg = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release|x86.Build.0 = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release-JP|x64.ActiveCfg = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release-JP|x64.Build.0 = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release-JP|x86.ActiveCfg = Release|Any CPU - {AE1B5AA8-456E-4A6D-BACE-9EA571266037}.Release-JP|x86.Build.0 = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|ARM.ActiveCfg = Debug|Any CPU + {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|ARM.Build.0 = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|x64.ActiveCfg = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|x64.Build.0 = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|x86.ActiveCfg = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|x86.Build.0 = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|Any CPU.ActiveCfg = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|Any CPU.Build.0 = Release|Any CPU + {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|ARM.ActiveCfg = Release|Any CPU + {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|ARM.Build.0 = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x64.ActiveCfg = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x64.Build.0 = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x86.ActiveCfg = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x86.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x64.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x64.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x86.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x86.Build.0 = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|ARM.Build.0 = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|x64.ActiveCfg = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|x64.Build.0 = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|x86.ActiveCfg = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|x86.Build.0 = Debug|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|Any CPU.Build.0 = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|ARM.ActiveCfg = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|ARM.Build.0 = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x64.ActiveCfg = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x64.Build.0 = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x86.ActiveCfg = Release|Any CPU + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x86.Build.0 = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|ARM.ActiveCfg = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|ARM.Build.0 = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|x64.ActiveCfg = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|x64.Build.0 = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|x86.ActiveCfg = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|x86.Build.0 = Debug|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|Any CPU.Build.0 = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|ARM.ActiveCfg = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|ARM.Build.0 = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x64.ActiveCfg = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x64.Build.0 = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x86.ActiveCfg = Release|Any CPU + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x86.Build.0 = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|ARM.ActiveCfg = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|ARM.Build.0 = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|x64.ActiveCfg = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|x64.Build.0 = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|x86.ActiveCfg = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|x86.Build.0 = Debug|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|Any CPU.Build.0 = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|ARM.ActiveCfg = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|ARM.Build.0 = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x64.ActiveCfg = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x64.Build.0 = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x86.ActiveCfg = Release|Any CPU + {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x86.Build.0 = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|ARM.ActiveCfg = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|ARM.Build.0 = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|x64.ActiveCfg = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|x64.Build.0 = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|x86.ActiveCfg = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Debug|x86.Build.0 = Debug|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|Any CPU.Build.0 = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|ARM.ActiveCfg = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|ARM.Build.0 = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|x64.ActiveCfg = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|x64.Build.0 = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|x86.ActiveCfg = Release|Any CPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC}.Release|x86.Build.0 = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|ARM.ActiveCfg = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|ARM.Build.0 = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|x64.ActiveCfg = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|x64.Build.0 = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|x86.ActiveCfg = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Debug|x86.Build.0 = Debug|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|Any CPU.Build.0 = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|ARM.ActiveCfg = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|ARM.Build.0 = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|x64.ActiveCfg = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|x64.Build.0 = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|x86.ActiveCfg = Release|Any CPU + {36F6A125-3633-441E-9794-97EB91E50F20}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -254,14 +213,16 @@ Global GlobalSection(NestedProjects) = preSolution {EB310923-197F-4E20-B123-3A3E7F1D5069} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E} = {1F113DD0-E292-47A5-8EFF-3FB5D0869BF3} - {82AFDA65-515E-4EC0-A415-77D8A6711508} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} - {FAD73716-92EC-4A0F-B594-286FF08EDE33} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} {8E7279F8-F801-4672-B42F-1ED2C68B16A4} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} - {7BF35A9B-8D4A-4B5E-B231-D267D1FB670D} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} - {DF57CCCB-47F5-41E0-B6BA-1557E3605396} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} - {AE1B5AA8-456E-4A6D-BACE-9EA571266037} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} {4232CB4A-DFE3-46CA-9503-C5F1798BAED3} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} + {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A} = {A6E578C0-A34A-4CCF-A808-CBAC81CB48C0} + {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} + {1C399497-5240-439A-879A-4ACB34C409AE} = {A6E578C0-A34A-4CCF-A808-CBAC81CB48C0} + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC} = {1F113DD0-E292-47A5-8EFF-3FB5D0869BF3} + {36F6A125-3633-441E-9794-97EB91E50F20} = {1F113DD0-E292-47A5-8EFF-3FB5D0869BF3} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {60DD551B-ED40-447E-AABE-B408178D29D1} EndGlobalSection EndGlobal diff --git a/OpenCvSharp.sln.DotSettings b/OpenCvSharp.sln.DotSettings index 09860243c..63d9a7751 100644 --- a/OpenCvSharp.sln.DotSettings +++ b/OpenCvSharp.sln.DotSettings @@ -1,3 +1,159 @@  + <NamingElement Priority="6"><Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"><type Name="local variable" /></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></NamingElement> + <NamingElement Priority="5"><Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"><type Name="parameter" /></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></NamingElement> + LTRB + LUT + PCA + QR + RB + RNG SURF - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> \ No newline at end of file + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + True + True + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + True + True + True + True + + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + + True + True + True + True + True + True + True + True + True + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + True + True + True + True + True diff --git a/README.md b/README.md index e432b690d..0ebba09c2 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,82 @@ -# OpenCvSharp [![Build status](https://ci.appveyor.com/api/projects/status/dvjexft02s6b3re6/branch/master?svg=true)](https://ci.appveyor.com/project/shimat/opencvsharp/branch/master) -Cross platform wrapper of OpenCV for .NET Framework. +![opencvsharp](https://socialify.git.ci/shimat/opencvsharp/image?description=1&forks=1&language=1&owner=1&pattern=Plus&stargazers=1&theme=Light) -Old versions of OpenCvSharp is maintained in [opencvsharp_2410](https://github.com/shimat/opencvsharp_2410). +[![Github Actions Windows Status](https://github.com/shimat/opencvsharp/workflows/Windows%20Server%202022/badge.svg)](https://github.com/shimat/opencvsharp/actions) [![Github Actions Ubuntu Status](https://github.com/shimat/opencvsharp/workflows/Ubuntu%2022.04/badge.svg)](https://github.com/shimat/opencvsharp/actions) [![GitHub license](https://img.shields.io/github/license/shimat/opencvsharp.svg)](https://github.com/shimat/opencvsharp/blob/master/LICENSE) + +Old versions of OpenCvSharp are stored in [opencvsharp_2410](https://github.com/shimat/opencvsharp_2410). + +## NuGet + +### Managed libraries +| Package | Description | Link | +|---------|-------------|------| +|**OpenCvSharp4**| OpenCvSharp core libraries | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.svg)](https://badge.fury.io/nu/OpenCvSharp4) | +|**OpenCvSharp4.Extensions**| GDI+ Extensions | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.Extensions.svg)](https://badge.fury.io/nu/OpenCvSharp4.Extensions) | +|**OpenCvSharp4.WpfExtensions**| WPF Extensions | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.WpfExtensions.svg)](https://badge.fury.io/nu/OpenCvSharp4.WpfExtensions) | +|**OpenCvSharp4.Windows**| All-in-one package for Windows (except UWP) | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.Windows.svg)](https://badge.fury.io/nu/OpenCvSharp4.Windows) | + +### Native bindings +| Package | Description | Link | +|---------|-------------|------| +|**OpenCvSharp4.runtime.win**| Native bindings for Windows x64/x86 (except UWP) | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.runtime.win.svg)](https://badge.fury.io/nu/OpenCvSharp4.runtime.win) | +|**OpenCvSharp4.runtime.uwp**| Native bindings for UWP (Universal Windows Platform) x64/x86/ARM | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.runtime.uwp.svg)](https://badge.fury.io/nu/OpenCvSharp4.runtime.uwp) | +|**OpenCvSharp4.official.runtime.linux-x64**| Native bindings for Linux x64 | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.official.runtime.linux-x64.svg)](https://badge.fury.io/nu/OpenCvSharp4.official.runtime.linux-x64) | +|**OpenCvSharp4.runtime.linux-arm**| Native bindings for Linux Arm | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.runtime.linux-arm.svg)](https://www.nuget.org/packages/OpenCvSharp4.runtime.linux-arm/) | +|**OpenCvSharp4.runtime.wasm**| Native bindings for WebAssembly | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.runtime.wasm.svg)](https://www.nuget.org/packages/OpenCvSharp4.runtime.wasm/) | + +Native binding (OpenCvSharpExtern.dll / libOpenCvSharpExtern.so) is required to work OpenCvSharp. To use OpenCvSharp, you should add both `OpenCvSharp4` and `OpenCvSharp4.runtime.*` packages to your project. Currently, native bindings for Windows, UWP and Ubuntu are released. + +Packages named OpenCvSharp3-* and OpenCvSharp-* are deprecated. +> [OpenCvSharp3-AnyCPU](https://www.nuget.org/packages/OpenCvSharp3-AnyCPU/) / [OpenCvSharp3-WithoutDll](https://www.nuget.org/packages/OpenCvSharp3-WithoutDll/) / [OpenCvSharp-AnyCPU](https://www.nuget.org/packages/OpenCvSharp-AnyCPU/) / [OpenCvSharp-WithoutDll](https://www.nuget.org/packages/OpenCvSharp-WithoutDll/) + +## Docker images +https://github.com/shimat?tab=packages ## Installation -### NuGet -If you have Visual Studio 2012 or later, it is recommended to use [NuGet](http://www.nuget.org/). Search *'opencvsharp'* on the NuGet Package Manager. -| Package | NuGet | -|--------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| OpenCV3.2 All-in-one package - bundles native OpenCV DLLs | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp3-AnyCPU.svg)](https://badge.fury.io/nu/OpenCvSharp3-AnyCPU) | -| OpenCV3.2 Minimum package | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp3-WithoutDll.svg)](https://badge.fury.io/nu/OpenCvSharp3-WithoutDll) | +### Windows (except UWP) +Add `OpenCvSharp4` and `OpenCvSharp4.runtime.win` NuGet packages to your project. You can use `OpenCvSharp4.Windows` instead. + +### UWP +Add `OpenCvSharp4` and `OpenCvSharp4.runtime.uwp` NuGet packages to your project. Note that `OpenCvSharp4.runtime.win` and `OpenCvSharp4.Windows` don't work for UWP. + +### Ubuntu 22.04 +Add `OpenCvSharp4` and `OpenCvSharp4.runtime.ubuntu.22.04.x64` NuGet packages to your project. +``` +dotnet new console -n ConsoleApp01 +cd ConsoleApp01 +dotnet add package OpenCvSharp4 +dotnet add package OpenCvSharp4_.runtime.ubuntu.22.04-x64 +# -- edit Program.cs --- # +dotnet run +``` ### Downloads If you do not use NuGet, get DLL files from the [release page](https://github.com/shimat/opencvsharp/releases). +## Target OpenCV +* [OpenCV 4.10.0](http://opencv.org/) with [opencv_contrib](https://github.com/opencv/opencv_contrib) + ## Requirements -* [OpenCV 3.2](http://opencv.org/) -* [Visual C++ 2015 Redistributable Package](https://www.microsoft.com/en-US/download/details.aspx?id=53840) -* [.NET Framework 2.0](http://www.microsoft.com/ja-jp/download/details.aspx?id=1639) or later / [.NET Core](https://www.microsoft.com/net/core#windowsvs2015) / [Mono](http://www.mono-project.com/Main_Page) +* [.NET Framework 4.8](http://www.microsoft.com/ja-jp/download/details.aspx?id=1639) / [.NET 6](https://www.microsoft.com/net/download) or later / .NET Standard 2.0 +* (Windows) [Visual C++ 2022 Redistributable Package](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) +* (Windows Server) Media Foundation +``` +PS1> Install-WindowsFeature Server-Media-Foundation +``` +* (Ubuntu) You must pre-install all the dependency packages needed to build OpenCV. Many packages such as libjpeg must be installed in order to work OpenCV. +https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/ -OpenCvSharp may not work on Unity platform. Please consider using [OpenCV for Unity](https://www.assetstore.unity3d.com/en/#!/content/21088) -## Documents -https://shimat.github.io/opencvsharp_docs/index.html +**OpenCvSharp won't work on Unity and Xamarin platform.** For Unity, please consider using [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088) or some other solutions. + +**OpenCvSharp does not support CUDA.** If you want to use the CUDA features, you need to customize the native bindings yourself. ## Usage -For more details, see the **[Wiki](https://github.com/shimat/opencvsharp/wiki)** page. +For more details, see **[samples](https://github.com/shimat/opencvsharp_samples/)** and **[Wiki](https://github.com/shimat/opencvsharp/wiki)** pages. +**Always remember to release Mat instances! The `using` syntax is useful.** ```C# +// C# 8 // Edge detection by Canny algorithm using OpenCvSharp; @@ -36,9 +84,8 @@ class Program { static void Main() { - Mat src = new Mat("lenna.png", ImreadModes.GrayScale); -        // Mat src = Cv2.ImRead("lenna.png", ImreadModes.GrayScale); -        Mat dst = new Mat(); + using var src = new Mat("lenna.png", ImreadModes.Grayscale); +        using var dst = new Mat(); Cv2.Canny(src, dst, 50, 200); using (new Window("src image", src)) @@ -50,15 +97,98 @@ class Program } ``` +As mentioned above, objects of classes, such as Mat and MatExpr, have unmanaged resources and need to be manually released by calling the Dispose() method. Worst of all, the +, -, *, and other operators create new objects each time, and these objects need to be disposed, or there will be memory leaks. Despite having the using syntax, the code still looks very verbose. + +Therefore, a ResourcesTracker class is provided. The ResourcesTracker implements the IDisposable interface, and when the Dispose() method is called, all resources tracked by the ResourcesTracker are disposed. The T() method of ResourcesTracker can trace an object or an array of objects, and the method NewMat() is like T(new Mat(...). All the objects that need to be released can be wrapped with T().For example: t.T(255 - t.T(picMat * 0.8)) . Example code is as following: + +```csharp +using (var t = new ResourcesTracker()) +{ + Mat mat1 = t.NewMat(new Size(100, 100), MatType.CV_8UC3, new Scalar(0)); + Mat mat3 = t.T(255-t.T(mat1*0.8)); + Mat[] mats1 = t.T(mat3.Split()); + Mat mat4 = t.NewMat(); + Cv2.Merge(new Mat[] { mats1[0], mats1[1], mats1[2] }, mat4); +} + +using (var t = new ResourcesTracker()) +{ + var src = t.T(new Mat(@"lenna.png", ImreadModes.Grayscale)); + var dst = t.NewMat(); + Cv2.Canny(src, dst, 50, 200); + var blurredDst = t.T(dst.Blur(new Size(3, 3))); + t.T(new Window("src image", src)); + t.T(new Window("dst image", blurredDst)); + Cv2.WaitKey(); +} +``` + + ## Features * OpenCvSharp is modeled on the native OpenCV C/C++ API style as much as possible. * Many classes of OpenCvSharp implement IDisposable. There is no need to manage unsafe resources. * OpenCvSharp does not force object-oriented programming style on you. You can also call native-style OpenCV functions. -* OpenCvSharp provides functions for converting from Mat/IplImage into Bitmap(GDI+) or WriteableBitmap(WPF). -* OpenCvSharp can work on [Mono](http://www.mono-project.com/Main_Page). It can run on any platform which [Mono](http://www.mono-project.com/Main_Page) supports (e.g. Linux). +* OpenCvSharp provides functions for converting from `Mat` into `Bitmap`(GDI+) or `WriteableBitmap`(WPF). + +## Code samples +https://github.com/shimat/opencvsharp_samples/ + +## API Documents +http://shimat.github.io/opencvsharp/api/OpenCvSharp.html + +## OpenCvSharp Build Instructions +### Windows +- Install Visual Studio 2022 or later + - VC++ features are required. +- Run `download_opencv_windows.ps1` to download OpenCV libs and headers from https://github.com/shimat/opencv_files. Those lib files are precompiled by the owner of OpenCvSharp using GitHub Actions. +``` +.\download_opencv_windows.ps1 +``` +- Build OpenCvSharp + - Open `OpenCvSharp.sln` and build + +#### How to customize OpenCV binaries yourself +If you want to use some OpenCV features that are not provided by default in OpenCvSharp (e.g. GPU), you will have to build OpenCV yourself. The binary files of OpenCV for OpenCvSharp for Windows are created in the [opencv_files](https://github.com/shimat/opencv_files) repository. See the README. + +- `git clone --recursive https://github.com/shimat/opencv_files` +- Edit `build_windows.ps1` or `build_uwp.ps1` to customize the CMake parameters . +- Run the PowerShell script. + +### Ubuntu +- Build OpenCV with opencv_contrib. + - https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/ +- Install .NET Core SDK. https://learn.microsoft.com/ja-jp/dotnet/core/install/linux-ubuntu +- Get OpenCvSharp source files +``` +git clone https://github.com/shimat/opencvsharp.git +cd opencvsharp +git fetch --all --tags --prune && git checkout ${OPENCVSHARP_VERSION} +``` + +- Build native wrapper `OpenCvSharpExtern` +``` +cd opencvsharp/src +mkdir build +cd build +cmake -D CMAKE_INSTALL_PREFIX=${YOUR_OPENCV_INSTALL_PATH} .. +make -j +make install +``` +You should add reference to `opencvsharp/src/build/OpenCvSharpExtern/libOpenCvSharpExtern.so` +``` +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/home/shimat/opencvsharp/src/build/OpenCvSharpExtern" +``` + +- Add `OpenCvSharp4` NuGet package to your project +``` +dotnet new console -n ConsoleApp01 +cd ConsoleApp01 +dotnet add package OpenCvSharp4 +# -- edit Program.cs --- # +dotnet run +``` -## License -OpenCvSharp is licensed under the -**BSD 3-Clause License**. See [LICENSE](https://github.com/shimat/opencvsharp/blob/master/LICENSE). +## Donations +If you find the OpenCvSharp library useful and would like to show your gratitude by donating, here are some donation options. Thank you. -OpenCvSharp.Blob uses [cvBlob](https://code.google.com/p/cvblob/) to implement blob extraction. +https://github.com/sponsors/shimat diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e88a2a6a7..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,52 +0,0 @@ -version: '3.2.0-{build}' - -init: -- ps: | - $version = $env:APPVEYOR_BUILD_VERSION.Split('-')[0] - $date = Get-Date -Format "yyyyMMdd" - Update-AppveyorBuild -Version "$version.$date-beta-$env:APPVEYOR_BUILD_NUMBER" - Write-Host $env:APPVEYOR_BUILD_VERSION - iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -#on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -# Do not build feature branch with open Pull Requests -skip_branch_with_pr: true - -image: Visual Studio 2015 - -configuration: Release - -before_build: -- git submodule update --init --recursive -- nuget restore -- dotnet restore - -build_script: -- msbuild OpenCvSharp.sln /t:rebuild /p:configuration=%CONFIGURATION% /p:platform=x64 -- msbuild OpenCvSharp.sln /t:rebuild /p:configuration=%CONFIGURATION% /p:platform=x86 - -after_build: -- ps: | - (ls $env:APPVEYOR_BUILD_FOLDER -Recurse).Where{ $_.Extension -eq ".nuspec" }.ForEach{ - [xml]$xml = Get-Content $_.FullName - $xml.package.metadata.version = $env:APPVEYOR_BUILD_VERSION - $xml.Save($_.FullName) - } - nuget pack nuget/OpenCvSharp3-AnyCPU.nuspec -OutputDirectory artifacts - nuget pack nuget/OpenCvSharp3-WithoutDll.nuspec -OutputDirectory artifacts - -test_script: -- dotnet test ./test/OpenCvSharp.Tests -c %CONFIGURATION% - -artifacts: -- path: artifacts\**\*.* - -deploy: -- provider: NuGet - server: https://ci.appveyor.com/nuget/shimat - api_key: - secure: PW0F7tbGr+QLuLPUGy+32pNtMZUJeqjyikz9nKlpALA= - skip_symbols: true - artifact: /.*\.nupkg/ diff --git a/docfx/.gitignore b/docfx/.gitignore new file mode 100644 index 000000000..4378419e7 --- /dev/null +++ b/docfx/.gitignore @@ -0,0 +1,9 @@ +############### +# folder # +############### +/**/DROP/ +/**/TEMP/ +/**/packages/ +/**/bin/ +/**/obj/ +_site diff --git a/docfx/api/.gitignore b/docfx/api/.gitignore new file mode 100644 index 000000000..e8079a3be --- /dev/null +++ b/docfx/api/.gitignore @@ -0,0 +1,5 @@ +############### +# temp file # +############### +*.yml +.manifest diff --git a/docfx/api/index.md b/docfx/api/index.md new file mode 100644 index 000000000..eabc86fe1 --- /dev/null +++ b/docfx/api/index.md @@ -0,0 +1 @@ +# **[OpenCvSharp](https://github.com/shimat/opencvsharp) API Reference** diff --git a/docfx/articles/intro.md b/docfx/articles/intro.md new file mode 100644 index 000000000..c0478cede --- /dev/null +++ b/docfx/articles/intro.md @@ -0,0 +1 @@ +# Add your introductions here! diff --git a/docfx/articles/toc.yml b/docfx/articles/toc.yml new file mode 100644 index 000000000..ff89ef1fe --- /dev/null +++ b/docfx/articles/toc.yml @@ -0,0 +1,2 @@ +- name: Introduction + href: intro.md diff --git a/docfx/docfx.json b/docfx/docfx.json new file mode 100644 index 000000000..490f358a0 --- /dev/null +++ b/docfx/docfx.json @@ -0,0 +1,68 @@ +{ + "metadata": [ + { + "src": [ + { + "files": ["**/*.csproj"], + "exclude": [ "**/bin/**", "**/obj/**", "**/OpenCvSharp.DebuggerVisualizers/**" ], + "src": "../src" + } + ], + "dest": "api", + "disableGitFeatures": false, + "disableDefaultFilter": false, + "properties": { + "TargetFramework": "net6" + } + } + ], + "build": { + "content": [ + { + "files": [ + "api/**.yml", + "api/index.md" + ] + }, + { + "files": [ + "articles/**.md", + "articles/**/toc.yml", + "toc.yml", + "*.md", + "../*.md", + ] + } + ], + "resource": [ + { + "files": [ + "images/**" + ] + } + ], + "overwrite": [ + { + "files": [ + "apidoc/**.md" + ], + "exclude": [ + "obj/**", + "_site/**" + ] + } + ], + "dest": "_site", + "globalMetadataFiles": [], + "fileMetadataFiles": [], + "template": [ + "default" + ], + "postProcessors": [], + "markdownEngineName": "markdig", + "noLangKeyword": false, + "keepFileLink": false, + "cleanupCacheHistory": false, + "disableGitFeatures": false + } +} \ No newline at end of file diff --git a/docfx/index.md b/docfx/index.md new file mode 100644 index 000000000..eabc86fe1 --- /dev/null +++ b/docfx/index.md @@ -0,0 +1 @@ +# **[OpenCvSharp](https://github.com/shimat/opencvsharp) API Reference** diff --git a/docfx/toc.yml b/docfx/toc.yml new file mode 100644 index 000000000..d218707e7 --- /dev/null +++ b/docfx/toc.yml @@ -0,0 +1,3 @@ +- name: API Documentation + href: api/ + homepage: api/index.md diff --git a/docker/al2-dotnet5-opencv4.6.0/Dockerfile b/docker/al2-dotnet5-opencv4.6.0/Dockerfile new file mode 100644 index 000000000..ba2eddd39 --- /dev/null +++ b/docker/al2-dotnet5-opencv4.6.0/Dockerfile @@ -0,0 +1,90 @@ +FROM public.ecr.aws/lambda/dotnet:5.0 + +ENV OPENCV_VERSION=4.6.0 + +WORKDIR / + +RUN yum update -y && \ + yum groupinstall -y "Development Tools" && \ + yum install -y \ + wget openssl-devel cmake3 + +# Setup opencv and opencv-contrib source +RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake3 \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install + +# Download OpenCvSharp +RUN wget https://github.com/shimat/opencvsharp/archive/master.zip && \ + unzip master.zip && rm master.zip && \ + mv opencvsharp-master opencvsharp && \ + cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake3 -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib64/ +#RUN ldd /artifacts/libOpenCvSharpExtern.so + +# Test OpenCvSharpExtern +#RUN echo -e "\n\ +#int core_Mat_sizeof(); \n\ +#int main(){ \n\ +# int i = core_Mat_sizeof(); \n\ +# printf(\"sizeof(Mat) = %d\", i); \n\ +# return 0; \n\ +#}" > /test.c && \ +# gcc -I./ -L. test.c -o test -lOpenCvSharpExtern && \ +# ./test && \ +# rm -f /test* + +RUN rm -rf /opencvsharp diff --git a/docker/al2-opencv4.5.1/Dockerfile b/docker/al2-opencv4.5.1/Dockerfile new file mode 100644 index 000000000..c19270567 --- /dev/null +++ b/docker/al2-opencv4.5.1/Dockerfile @@ -0,0 +1,107 @@ +FROM amazonlinux:2.0.20200722.0 + +ENV OPENCV_VERSION=4.5.0 + +WORKDIR / + +RUN yum update -y && \ + yum groupinstall -y "Development Tools" && \ + yum install -y \ + wget openssl-devel cmake3 + +# Setup opencv and opencv-contrib source +RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake3 \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D WITH_GSTREAMER=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j8 && make install + +# Download OpenCvSharp +RUN wget https://github.com/shimat/opencvsharp/archive/master.zip && \ + unzip master.zip && rm master.zip && \ + mv opencvsharp-master opencvsharp && \ + cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake3 -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + mkdir /artifacts && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /artifacts/ && \ + cp /artifacts/libOpenCvSharpExtern.so /usr/lib64/ +#RUN ldd /artifacts/libOpenCvSharpExtern.so + +# Test OpenCvSharpExtern +RUN echo -e "\n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L. test.c -o test -lOpenCvSharpExtern && \ + ./test && \ + rm -f /test* + +RUN rm -rf /opencvsharp + +# Simple console app test using NuGet +RUN rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm && \ +yum install -y dotnet-sdk-3.1 +RUN dotnet --info +RUN dotnet new console -f netcoreapp3.1 -o "ConsoleApp01" && cd /ConsoleApp01 && \ + echo -e "\n\ +using System; \n\ +using OpenCvSharp; \n\ +class Program{ \n\ + static void Main(){ \n\ + Console.WriteLine(Cv2.GetTickCount()); \n\ + using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ + Console.WriteLine(mat.CvPtr); \n\ + } \n\ +}" > Program.cs && \ + dotnet add package OpenCvSharp4 && \ + dotnet run && \ + rm -rf /ConsoleApp01 diff --git a/docker/appengine-aspnetcore3.1-opencv4.5.1/Dockerfile b/docker/appengine-aspnetcore3.1-opencv4.5.1/Dockerfile new file mode 100644 index 000000000..ebc6a34b1 --- /dev/null +++ b/docker/appengine-aspnetcore3.1-opencv4.5.1/Dockerfile @@ -0,0 +1,135 @@ +FROM gcr.io/google-appengine/aspnetcore:3.1.9 + +ENV OPENCV_VERSION=4.5.1 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + wget \ + unzip \ + curl \ + ca-certificates \ + build-essential \ + cmake \ + git \ + gfortran \ + libjpeg8-dev \ + libpng-dev \ + software-properties-common +RUN add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && \ + apt-get update && apt-get -y install --no-install-recommends \ + libjasper1 \ + libtiff-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-22-dev \ + libxine2-dev \ + libv4l-dev +RUN cd /usr/include/linux && ln -s -f ../libv4l1-videodev.h videodev.h && cd ~ && \ + apt-get -y install --no-install-recommends \ + libgtk2.0-dev libtbb-dev qt5-default \ + libatlas-base-dev \ + libfaac-dev \ + libmp3lame-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + libavresample-dev \ + x264 \ + v4l-utils \ + libwebp-dev \ + tesseract-ocr libtesseract-dev libleptonica-dev + +# Setup opencv and opencv-contrib source +RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D WITH_GSTREAMER=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j6 && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ + +# Test OpenCvSharpExtern +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test && \ + rm -f /test* + +RUN rm -rf /opencvsharp + +# Simple console app test using NuGet +RUN dotnet new console -f netcoreapp3.1 -o "ConsoleApp01" && cd /ConsoleApp01 && \ + echo "\n\ +using System; \n\ +using OpenCvSharp; \n\ +class Program{ \n\ + static void Main(){ \n\ + Console.WriteLine(Cv2.GetTickCount()); \n\ + using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ + Console.WriteLine(mat.CvPtr); \n\ + } \n\ +}" > Program.cs && \ + dotnet add package OpenCvSharp4 && \ + dotnet run && \ + rm -rf /ConsoleApp01 diff --git a/docker/command_sample.txt b/docker/command_sample.txt new file mode 100644 index 000000000..a67064515 --- /dev/null +++ b/docker/command_sample.txt @@ -0,0 +1,4 @@ +docker build -t shimat/appengine-aspnetcore2.1-opencv4.2.0 . + +docker login +docker push shimat/appengine-aspnetcore2.1-opencv4.2.0 diff --git a/docker/ubuntu20-dotnet6-opencv4.6.0/Dockerfile b/docker/ubuntu20-dotnet6-opencv4.6.0/Dockerfile new file mode 100644 index 000000000..705a5f3ee --- /dev/null +++ b/docker/ubuntu20-dotnet6-opencv4.6.0/Dockerfile @@ -0,0 +1,160 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as builder + +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.6.0 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-22-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + libavresample-dev \ + x264 \ + libtesseract-dev \ + libgdiplus \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +# Setup opencv and opencv-contrib source +RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ + + +########## Test native .so file ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal +RUN apt-get update && apt-get -y install --no-install-recommends gcc +# /usr/lib/libOpenCvSharpExtern.so +# /usr/local/lib/libopencv_*.a +COPY --from=builder /usr/lib /usr/lib +#COPY --from=builder /usr/local/lib /usr/local/lib + +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test + + +########## Test .NET class libraries ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal +COPY --from=builder /usr/lib /usr/lib +# Install Build the C# part of OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp +RUN cd /opencvsharp/src/OpenCvSharp && \ + dotnet build -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build -c Release -f net6.0 + +RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + +# Simple console app test using NuGet +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# echo "\n\ +#using System; \n\ +#using OpenCvSharp; \n\ +#class Program{ \n\ +# static void Main(){ \n\ +# Console.WriteLine(Cv2.GetTickCount()); \n\ +# using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ +# Console.WriteLine(mat.CvPtr); \n\ +# } \n\ +#}" > Program.cs && \ +# dotnet add package OpenCvSharp4 && \ +# dotnet run && \ +# rm -rf /ConsoleApp01 + +#RUN ldd /artifacts/libOpenCvSharpExtern.so + + + +########## Final image ########## + +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as final +COPY --from=builder /usr/lib /usr/lib diff --git a/docker/ubuntu20-dotnet6-opencv4.7.0/Dockerfile b/docker/ubuntu20-dotnet6-opencv4.7.0/Dockerfile new file mode 100644 index 000000000..9acaef9e9 --- /dev/null +++ b/docker/ubuntu20-dotnet6-opencv4.7.0/Dockerfile @@ -0,0 +1,160 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as builder + +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.7.0 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-22-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + libavresample-dev \ + x264 \ + libtesseract-dev \ + libgdiplus \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +# Setup opencv and opencv-contrib source +RUN wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget -q https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ + + +########## Test native .so file ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal +RUN apt-get update && apt-get -y install --no-install-recommends gcc +# /usr/lib/libOpenCvSharpExtern.so +# /usr/local/lib/libopencv_*.a +COPY --from=builder /usr/lib /usr/lib +#COPY --from=builder /usr/local/lib /usr/local/lib + +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test + + +########## Test .NET class libraries ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal +COPY --from=builder /usr/lib /usr/lib +# Install Build the C# part of OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp +RUN cd /opencvsharp/src/OpenCvSharp && \ + dotnet build -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build -c Release -f net6.0 + +RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + +# Simple console app test using NuGet +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# echo "\n\ +#using System; \n\ +#using OpenCvSharp; \n\ +#class Program{ \n\ +# static void Main(){ \n\ +# Console.WriteLine(Cv2.GetTickCount()); \n\ +# using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ +# Console.WriteLine(mat.CvPtr); \n\ +# } \n\ +#}" > Program.cs && \ +# dotnet add package OpenCvSharp4 && \ +# dotnet run && \ +# rm -rf /ConsoleApp01 + +#RUN ldd /artifacts/libOpenCvSharpExtern.so + + + +########## Final image ########## + +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as final +COPY --from=builder /usr/lib /usr/lib diff --git a/docker/ubuntu20-dotnet6sdk-opencv4.6.0/Dockerfile b/docker/ubuntu20-dotnet6sdk-opencv4.6.0/Dockerfile new file mode 100644 index 000000000..e05302449 --- /dev/null +++ b/docker/ubuntu20-dotnet6sdk-opencv4.6.0/Dockerfile @@ -0,0 +1,160 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as builder + +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.6.0 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-22-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + libavresample-dev \ + x264 \ + libtesseract-dev \ + libgdiplus \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +# Setup opencv and opencv-contrib source +RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ + + +########## Test native .so file ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal +RUN apt-get update && apt-get -y install --no-install-recommends gcc +# /usr/lib/libOpenCvSharpExtern.so +# /usr/local/lib/libopencv_*.a +COPY --from=builder /usr/lib /usr/lib +#COPY --from=builder /usr/local/lib /usr/local/lib + +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test + + +########## Test .NET class libraries ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal +COPY --from=builder /usr/lib /usr/lib +# Install Build the C# part of OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp +RUN cd /opencvsharp/src/OpenCvSharp && \ + dotnet build -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build -c Release -f net6.0 + +RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + +# Simple console app test using NuGet +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# echo "\n\ +# using System; \n\ +# using OpenCvSharp; \n\ +# class Program{ \n\ +# static void Main(){ \n\ +# Console.WriteLine(Cv2.GetTickCount()); \n\ +# using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ +# Console.WriteLine(mat.CvPtr); \n\ +# } \n\ +# }" > Program.cs && \ +# dotnet add package OpenCvSharp4 && \ +# dotnet run && \ +# rm -rf /ConsoleApp01 + +#RUN ldd /artifacts/libOpenCvSharpExtern.so + + + +########## Final image ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-focal as final +COPY --from=builder /usr/lib /usr/lib diff --git a/docker/ubuntu22-dotnet6-opencv4.7.0/Dockerfile b/docker/ubuntu22-dotnet6-opencv4.7.0/Dockerfile new file mode 100644 index 000000000..4974f8c86 --- /dev/null +++ b/docker/ubuntu22-dotnet6-opencv4.7.0/Dockerfile @@ -0,0 +1,162 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy as builder + +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.7.0 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + x264 \ + libtesseract-dev \ + libgdiplus \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +# Setup opencv and opencv-contrib source +RUN wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget -q https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ && \ + mkdir /artifacts && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /artifacts/ + + +########## Test native .so file ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy +RUN apt-get update && apt-get -y install --no-install-recommends gcc +# /usr/lib/libOpenCvSharpExtern.so +# /usr/local/lib/libopencv_*.a +COPY --from=builder /usr/lib /usr/lib +#COPY --from=builder /usr/local/lib /usr/local/lib + +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test + + +########## Test .NET class libraries ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy +COPY --from=builder /usr/lib /usr/lib +# Install Build the C# part of OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp +RUN cd /opencvsharp/src/OpenCvSharp && \ + dotnet build -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build -c Release -f net6.0 + +RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + +# Simple console app test using NuGet +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# echo "\n\ +#using System; \n\ +#using OpenCvSharp; \n\ +#class Program{ \n\ +# static void Main(){ \n\ +# Console.WriteLine(Cv2.GetTickCount()); \n\ +# using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ +# Console.WriteLine(mat.CvPtr); \n\ +# } \n\ +#}" > Program.cs && \ +# dotnet add package OpenCvSharp4 && \ +# dotnet run && \ +# rm -rf /ConsoleApp01 + +#RUN ldd /artifacts/libOpenCvSharpExtern.so + + + +########## Final image ########## + +FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy as final +COPY --from=builder /usr/lib /usr/lib +COPY --from=builder /artifacts /artifacts diff --git a/docker/ubuntu22-dotnet6-opencv4.8.0/Dockerfile b/docker/ubuntu22-dotnet6-opencv4.8.0/Dockerfile new file mode 100644 index 000000000..fe9d4235b --- /dev/null +++ b/docker/ubuntu22-dotnet6-opencv4.8.0/Dockerfile @@ -0,0 +1,162 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy as builder + +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.8.0 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + x264 \ + libtesseract-dev \ + libgdiplus \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +# Setup opencv and opencv-contrib source +RUN wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget -q https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ && \ + mkdir /artifacts && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /artifacts/ + + +########## Test native .so file ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy +RUN apt-get update && apt-get -y install --no-install-recommends gcc +# /usr/lib/libOpenCvSharpExtern.so +# /usr/local/lib/libopencv_*.a +COPY --from=builder /usr/lib /usr/lib +#COPY --from=builder /usr/local/lib /usr/local/lib + +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test + + +########## Test .NET class libraries ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy +COPY --from=builder /usr/lib /usr/lib +# Install Build the C# part of OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp +RUN cd /opencvsharp/src/OpenCvSharp && \ + dotnet build -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build -c Release -f net6.0 + +RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + +# Simple console app test using NuGet +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# echo "\n\ +#using System; \n\ +#using OpenCvSharp; \n\ +#class Program{ \n\ +# static void Main(){ \n\ +# Console.WriteLine(Cv2.GetTickCount()); \n\ +# using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ +# Console.WriteLine(mat.CvPtr); \n\ +# } \n\ +#}" > Program.cs && \ +# dotnet add package OpenCvSharp4 && \ +# dotnet run && \ +# rm -rf /ConsoleApp01 + +#RUN ldd /artifacts/libOpenCvSharpExtern.so + + + +########## Final image ########## + +FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy as final +COPY --from=builder /usr/lib /usr/lib +COPY --from=builder /artifacts /artifacts diff --git a/docker/ubuntu22-dotnet6sdk-opencv4.7.0/Dockerfile b/docker/ubuntu22-dotnet6sdk-opencv4.7.0/Dockerfile new file mode 100644 index 000000000..ac6dac800 --- /dev/null +++ b/docker/ubuntu22-dotnet6sdk-opencv4.7.0/Dockerfile @@ -0,0 +1,159 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy as builder + +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.7.0 + +WORKDIR / + +# Install opencv dependencies +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + x264 \ + libtesseract-dev \ + libgdiplus \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* + +# Setup opencv and opencv-contrib source +RUN wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget -q https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib + +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=OFF \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_videostab=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + .. && make -j$(nproc) && make install && ldconfig + +# Download OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp + +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ + + +########## Test native .so file ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy +RUN apt-get update && apt-get -y install --no-install-recommends gcc +# /usr/lib/libOpenCvSharpExtern.so +# /usr/local/lib/libopencv_*.a +COPY --from=builder /usr/lib /usr/lib +#COPY --from=builder /usr/local/lib /usr/local/lib + +RUN echo "\n\ +#include \n\ +int core_Mat_sizeof(); \n\ +int main(){ \n\ + int i = core_Mat_sizeof(); \n\ + printf(\"sizeof(Mat) = %d\", i); \n\ + return 0; \n\ +}" > /test.c && \ + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ + LD_LIBRARY_PATH=. ./test + + +########## Test .NET class libraries ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy +COPY --from=builder /usr/lib /usr/lib +# Install Build the C# part of OpenCvSharp +RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp +RUN cd /opencvsharp/src/OpenCvSharp && \ + dotnet build -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build -c Release -f net6.0 + +RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + +# Simple console app test using NuGet +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# echo "\n\ +# using System; \n\ +# using OpenCvSharp; \n\ +# class Program{ \n\ +# static void Main(){ \n\ +# Console.WriteLine(Cv2.GetTickCount()); \n\ +# using var mat = new Mat(1, 1, MatType.CV_8UC1); \n\ +# Console.WriteLine(mat.CvPtr); \n\ +# } \n\ +# }" > Program.cs && \ +# dotnet add package OpenCvSharp4 && \ +# dotnet run && \ +# rm -rf /ConsoleApp01 + +#RUN ldd /artifacts/libOpenCvSharpExtern.so + + + +########## Final image ########## + +FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy as final +COPY --from=builder /usr/lib /usr/lib diff --git a/download_opencv_windows.ps1 b/download_opencv_windows.ps1 new file mode 100644 index 000000000..1efcabe2e --- /dev/null +++ b/download_opencv_windows.ps1 @@ -0,0 +1,27 @@ +$tag = "4.11.0.20250505" +$uriArray = @( + "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv_win_x64.zip" + "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv_win_x86.zip" +) + +function Download($uri, $outFile) { + Write-Host "Downloading ${uri}" + if (!(Test-Path $outFile)) { + Invoke-WebRequest -Uri $uri -OutFile $outFile -ErrorAction Stop + } +} + +New-Item opencv_files -Type directory -Force -ErrorAction Stop | Out-Null +cd opencv_files + +[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12) + +foreach ($uri in $uriArray) { + $outFile = [System.IO.Path]::GetFileName($uri) + $outFileWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($uri) + Download $uri $outFile + Expand-Archive -Path $outFile -DestinationPath $outFileWithoutExtension -Force -ErrorAction Stop + Remove-Item -Path $outFile -ErrorAction Stop +} + +cd .. diff --git a/download_tesseract_windows.ps1 b/download_tesseract_windows.ps1 new file mode 100644 index 000000000..515a685a1 --- /dev/null +++ b/download_tesseract_windows.ps1 @@ -0,0 +1,26 @@ +$uriArray = @( + "https://github.com/shimat/tesseract_vcpkg/releases/download/2023.07.06/tesseract_vcpkg.0.0.8-beta.nupkg" +) + +function Download($uri, $outFile) { + Write-Host "Downloading ${uri}" + if (!(Test-Path $outFile)) { + Invoke-WebRequest -Uri $uri -OutFile $outFile -ErrorAction Stop + } +} + +mkdir tesseract_files -Force -ErrorAction Stop | Out-Null +cd tesseract_files + +[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12) + +foreach ($uri in $uriArray) { + $outFile = "tesseract_vcpkg.zip" + $outFileWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($outFile) + Download $uri $outFile + Expand-Archive -Path $outFile -DestinationPath $outFileWithoutExtension -Force -ErrorAction Stop + Move-Item $outFileWithoutExtension\*\* $outFileWithoutExtension + Remove-Item -Path $outFile -ErrorAction Stop +} + +cd .. diff --git a/global.json b/global.json deleted file mode 100644 index 9a4d75a06..000000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src", "test" ], - "sdk": { - "version": "1.0.0-preview2-1-003177" - } -} \ No newline at end of file diff --git a/nuget/OpenCvSharp3-AnyCPU.nuspec b/nuget/OpenCvSharp3-AnyCPU.nuspec deleted file mode 100644 index 3b639fd96..000000000 --- a/nuget/OpenCvSharp3-AnyCPU.nuspec +++ /dev/null @@ -1,98 +0,0 @@ - - - - OpenCvSharp3-AnyCPU - 3.2.0.20170217-beta - OpenCvSharp3 - shimat - http://opensource.org/licenses/BSD-3-Clause - https://github.com/shimat/opencvsharp - https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/mandrill-ico.png - false - OpenCV wrapper for .NET Framework - OpenCV 3.x wrapper - - Fixed #331 - Copyright 2008-2017 - Image Processing OpenCV Wrapper FFI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nuget/OpenCvSharp3-AnyCPU.props b/nuget/OpenCvSharp3-AnyCPU.props deleted file mode 100644 index 367d53845..000000000 --- a/nuget/OpenCvSharp3-AnyCPU.props +++ /dev/null @@ -1,25 +0,0 @@ - - - $(MSBuildThisFileDirectory)\..\NativeDlls - - - - dll\x86\OpenCvSharpExtern.dll - PreserveNewest - - - dll\x86\opencv_ffmpeg320.dll - PreserveNewest - - - - - dll\x64\OpenCvSharpExtern.dll - PreserveNewest - - - dll\x64\opencv_ffmpeg320_64.dll - PreserveNewest - - - diff --git a/nuget/OpenCvSharp3-WithoutDll.nuspec b/nuget/OpenCvSharp3-WithoutDll.nuspec deleted file mode 100644 index 893bee0cb..000000000 --- a/nuget/OpenCvSharp3-WithoutDll.nuspec +++ /dev/null @@ -1,91 +0,0 @@ - - - - OpenCvSharp3-WithoutDll - 3.2.0.20170205-beta - OpenCvSharp3 (without DLLs) - shimat - http://opensource.org/licenses/BSD-3-Clause - https://github.com/shimat/opencvsharp - https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/mandrill-ico.png - false - OpenCV wrapper for .NET Framework - OpenCV 3.x wrapper - - Fixed #331 - Copyright 2008-2017 - Image Processing OpenCV Wrapper FFI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nuget/OpenCvSharp4.Extensions.nuspec b/nuget/OpenCvSharp4.Extensions.nuspec new file mode 100644 index 000000000..773924eb8 --- /dev/null +++ b/nuget/OpenCvSharp4.Extensions.nuspec @@ -0,0 +1,59 @@ + + + + OpenCvSharp4.Extensions + 4.6.0.20220607 + OpenCvSharp GDI+ extension library. + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + OpenCvSharp GDI+ extension library. + OpenCvSharp GDI+ extension library. + + Copyright 2008-2020 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/OpenCvSharp4.Windows.nuspec b/nuget/OpenCvSharp4.Windows.nuspec new file mode 100644 index 000000000..7218edb0c --- /dev/null +++ b/nuget/OpenCvSharp4.Windows.nuspec @@ -0,0 +1,47 @@ + + + + OpenCvSharp4.Windows + 4.6.0.20220607 + OpenCvSharp NuGet package for x64/x86 Windows (same as OpenCvSharp3-AnyCPU) + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + OpenCV 4.x wrapper. All-in-one package for Windows users. + OpenCV 4.x wrapper. All-in-one package for Windows users. + + Copyright 2008-2019 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/OpenCvSharp4.WpfExtensions.nuspec b/nuget/OpenCvSharp4.WpfExtensions.nuspec new file mode 100644 index 000000000..f4c0d2deb --- /dev/null +++ b/nuget/OpenCvSharp4.WpfExtensions.nuspec @@ -0,0 +1,46 @@ + + + + OpenCvSharp4.WpfExtensions + 4.6.0.20220607 + OpenCvSharp WPF extension library. + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + OpenCvSharp WPF extension library. + OpenCvSharp WPF extension library. + + Copyright 2008-2020 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/OpenCvSharp4.nuspec b/nuget/OpenCvSharp4.nuspec new file mode 100644 index 000000000..36593351c --- /dev/null +++ b/nuget/OpenCvSharp4.nuspec @@ -0,0 +1,57 @@ + + + + OpenCvSharp4 + 4.6.0.20220607 + OpenCvSharp core library. A package of separate native bindings for your OS is required. + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + OpenCV wrapper for .NET. Since this package includes only core managed libraries, another package of native bindings for your OS is required (OpenCvSharp4.runtime.*). + OpenCV wrapper for .NET. Since this package includes only core managed libraries, another package of native bindings for your OS is required (OpenCvSharp4.runtime.*). + + Copyright 2008-2020 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj new file mode 100644 index 000000000..a3a5cda26 --- /dev/null +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj @@ -0,0 +1,12 @@ + + + netstandard2.0;netstandard2.1;net6.0; + true + false + OpenCvSharp4.official.runtime.linux-x64.nuspec + + + + + diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.nuspec b/nuget/OpenCvSharp4.official.runtime.linux-x64.nuspec new file mode 100644 index 000000000..0bbafe720 --- /dev/null +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.nuspec @@ -0,0 +1,30 @@ + + + + OpenCvSharp4.official.runtime.linux-x64 + 4.6.0.20220608 + OpenCvSharp native bindings for Linux-x64 + shimat + Apache-2.0 + + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on Linux + Internal implementation package for OpenCvSharp to work on Linux + + Copyright 2008-2019 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/OpenCvSharp4.runtime.linux-arm.csproj b/nuget/OpenCvSharp4.runtime.linux-arm.csproj new file mode 100644 index 000000000..6b5b9573d --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.linux-arm.csproj @@ -0,0 +1,12 @@ + + + netstandard2.0;netstandard2.1;netcoreapp2.1; + true + false + OpenCvSharp4.runtime.linux-arm.nuspec + + + + + diff --git a/nuget/OpenCvSharp4.runtime.linux-arm.nuspec b/nuget/OpenCvSharp4.runtime.linux-arm.nuspec new file mode 100644 index 000000000..1f50b4061 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.linux-arm.nuspec @@ -0,0 +1,30 @@ + + + + OpenCvSharp4.runtime.linux-arm + 4.3.0.20191030 + OpenCvSharp native bindings for linux-arm + shimat + Apache-2.0 + + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on Ubuntu 18.04 for ARM + Internal implementation package for OpenCvSharp to work on Ubuntu 18.04 for ARM + + Copyright 2008-2019 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + diff --git a/nuget/OpenCvSharp4.runtime.osx.10.15-x64.csproj b/nuget/OpenCvSharp4.runtime.osx.10.15-x64.csproj new file mode 100644 index 000000000..322ffa6b1 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.osx.10.15-x64.csproj @@ -0,0 +1,12 @@ + + + netstandard2.0;netstandard2.1;netcoreapp2.1; + true + false + OpenCvSharp4.runtime.osx.10.15-x64.nuspec + + + + + diff --git a/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec b/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec new file mode 100644 index 000000000..5319b3cfb --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec @@ -0,0 +1,30 @@ + + + + OpenCvSharp4.runtime.osx.10.15-x64 + 4.3.0.20191030 + OpenCvSharp native bindings for macOS.10.15-x64 + shimat,vladkol + Apache-2.0 + + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on macOS 10 + Internal implementation package for OpenCvSharp to work on macOS 10.15 + + Copyright 2008-2020 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/OpenCvSharp4.runtime.uwp.nuspec b/nuget/OpenCvSharp4.runtime.uwp.nuspec new file mode 100644 index 000000000..88eafec93 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.uwp.nuspec @@ -0,0 +1,36 @@ + + + + OpenCvSharp4.runtime.uwp + 4.6.0.20220607 + OpenCvSharp4 native bindings for UWP x64/x86/ARM + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on UWP (Universal Windows Platform). + Internal implementation package for OpenCvSharp to work on UWP (Universal Windows Platform). + + Copyright 2008-2019 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/OpenCvSharp4.runtime.wasm.csproj b/nuget/OpenCvSharp4.runtime.wasm.csproj new file mode 100644 index 000000000..9640c42b7 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.wasm.csproj @@ -0,0 +1,12 @@ + + + net6.0; + true + false + OpenCvSharp4.runtime.wasm.nuspec + + + + + diff --git a/nuget/OpenCvSharp4.runtime.wasm.nuspec b/nuget/OpenCvSharp4.runtime.wasm.nuspec new file mode 100644 index 000000000..fef9e1803 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.wasm.nuspec @@ -0,0 +1,28 @@ + + + + OpenCvSharp4.runtime.wasm + 4.3.0.20191030 + OpenCvSharp native bindings for Wasm + shimat,vladkol + Apache-2.0 + + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on Wasm + Internal implementation package for OpenCvSharp to work on Wasm + + Copyright 2008-2020 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/OpenCvSharp4.runtime.wasm.props b/nuget/OpenCvSharp4.runtime.wasm.props new file mode 100644 index 000000000..71c05c474 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.wasm.props @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/nuget/OpenCvSharp4.runtime.win.nuspec b/nuget/OpenCvSharp4.runtime.win.nuspec new file mode 100644 index 000000000..07ae74dfb --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.win.nuspec @@ -0,0 +1,37 @@ + + + + OpenCvSharp4.runtime.win + 4.6.0.20220607 + OpenCvSharp4 native bindings for Windows x64/x86 (except UWP) + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on Windows except UWP. + Internal implementation package for OpenCvSharp to work on Windows except UWP. + + Copyright 2008-2020 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/OpenCvSharp4.runtime.win.props b/nuget/OpenCvSharp4.runtime.win.props new file mode 100644 index 000000000..af4e6a20e --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.win.props @@ -0,0 +1,25 @@ + + + $(MSBuildThisFileDirectory)..\..\runtimes + + + + dll\x86\OpenCvSharpExtern.dll + PreserveNewest + + + dll\x86\opencv_videoio_ffmpeg4110.dll + PreserveNewest + + + + + dll\x64\OpenCvSharpExtern.dll + PreserveNewest + + + dll\x64\opencv_videoio_ffmpeg4110_64.dll + PreserveNewest + + + diff --git a/nuget/icon/opencvsharp.png b/nuget/icon/opencvsharp.png new file mode 100644 index 000000000..7526392db Binary files /dev/null and b/nuget/icon/opencvsharp.png differ diff --git a/nuget/nuget/NuGet.Config b/nuget/nuget/NuGet.Config deleted file mode 100644 index 67f8ea046..000000000 --- a/nuget/nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/nuget/nuget/NuGet.exe b/nuget/nuget/NuGet.exe deleted file mode 100644 index 6bb79fe53..000000000 Binary files a/nuget/nuget/NuGet.exe and /dev/null differ diff --git a/nuget/nuget/NuGet.targets b/nuget/nuget/NuGet.targets deleted file mode 100644 index 3f8c37b22..000000000 --- a/nuget/nuget/NuGet.targets +++ /dev/null @@ -1,144 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - false - - - false - - - true - - - false - - - - - - - - - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - - - - - $(SolutionDir).nuget - - - - $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config - $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config - - - - $(MSBuildProjectDirectory)\packages.config - $(PackagesProjectConfig) - - - - - $(NuGetToolsPath)\NuGet.exe - @(PackageSource) - - "$(NuGetExePath)" - mono --runtime=v4.0.30319 "$(NuGetExePath)" - - $(TargetDir.Trim('\\')) - - -RequireConsent - -NonInteractive - - "$(SolutionDir) " - "$(SolutionDir)" - - - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) - $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nuget/old/OpenCvSharp-x64.nuspec b/nuget/old/OpenCvSharp-x64.nuspec deleted file mode 100644 index fd0b32c36..000000000 --- a/nuget/old/OpenCvSharp-x64.nuspec +++ /dev/null @@ -1,76 +0,0 @@ - - - - OpenCvSharp-x64 - 2.4.8.20140510 - OpenCvSharp x64 - shimat - http://www.gnu.org/licenses/lgpl-3.0.en.html - https://github.com/shimat/opencvsharp - https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/mandrill-ico.png - false - OpenCV wrapper for .NET Framework - - Fixed IplImage memory leak -- Upgraded C++ Compiler (vc100 -> vc110) -- Fixed crash bugs in x64 - Copyright 2008-2014 - Image Processing OpenCV Wrapper FFI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nuget/old/OpenCvSharp-x86.nuspec b/nuget/old/OpenCvSharp-x86.nuspec deleted file mode 100644 index 825baecf8..000000000 --- a/nuget/old/OpenCvSharp-x86.nuspec +++ /dev/null @@ -1,76 +0,0 @@ - - - - OpenCvSharp-x86 - 2.4.8.20140510 - OpenCvSharp x86 - shimat - http://www.gnu.org/licenses/lgpl-3.0.en.html - https://github.com/shimat/opencvsharp - https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/lenna-icon.png - false - OpenCV wrapper for .NET Framework - - Fixed IplImage memory leak -- Upgraded C++ Compiler (vc100 -> vc110) -- Fixed crash bugs in x64 - Copyright 2008-2014 - Image Processing OpenCV Wrapper FFI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nuget/old/tools-x64/init.ps1 b/nuget/old/tools-x64/init.ps1 deleted file mode 100644 index c766fb995..000000000 --- a/nuget/old/tools-x64/init.ps1 +++ /dev/null @@ -1 +0,0 @@ -param($installPath, $toolsPath, $package) \ No newline at end of file diff --git a/nuget/old/tools-x64/install.ps1 b/nuget/old/tools-x64/install.ps1 deleted file mode 100644 index 20e0cc377..000000000 --- a/nuget/old/tools-x64/install.ps1 +++ /dev/null @@ -1,78 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -$platform = "x64" - -# 指定したディレクトリを「新しい場合はコピー」にする -function MarkDirectoryAsCopy($item) -{ - $item.ProjectItems | ForEach-Object { MarkFileAsCopy($_) } -} -# 指定したファイルを「新しい場合はコピー」にする -function MarkFileAsCopy($item) -{ - Try - { - Write-Host Try set $item.Name - $item.Properties.Item("CopyToOutputDirectory").Value = 2 # copy if newer - } - Catch - { - Write-Host RecurseOn $item.Name - MarkDirectoryAsCopyToOutputRecursive($item) - } -} - -$copyFiles = @( - "msvcp110.dll"; - "msvcr110.dll"; - "OpenCvSharpExtern.dll"; - "opencv_calib3d248.dll"; - "opencv_contrib248.dll"; - "opencv_core248.dll"; - "opencv_features2d248.dll"; - "opencv_ffmpeg248_64.dll"; - "opencv_gpu248.dll"; - "opencv_flann248.dll"; - "opencv_highgui248.dll"; - "opencv_imgproc248.dll"; - "opencv_legacy248.dll"; - "opencv_ml248.dll"; - "opencv_nonfree248.dll"; - "opencv_objdetect248.dll"; - "opencv_ocl248.dll"; - "opencv_photo248.dll"; - "opencv_stitching248.dll"; - "opencv_superres248.dll"; - "opencv_video248.dll"; - "opencv_videostab248.dll"; -) -foreach ( $file in $copyFiles ) -{ - MarkFileAsCopy($project.ProjectItems.Item($file)) -} - - - -function HasPlatform($manager, $platformName) -{ - $platforms = [Array] $manager.PlatformNames - $index = [System.Array]::IndexOf($platforms, $platformName) - $index -ge 0 -} - -$manager = $project.ConfigurationManager -$configs = [Array] $manager.PlatformNames -$hasPlatform = HasPlatform $manager $platform -if(-not $hasPlatform) -{ - [void]$manager.AddPlatform($platform, "Any CPU", $true) -} - - - -#foreach ($config in $configs) -#{ -# [System.Windows.Forms.MessageBox]::Show(HasPlatform) -#} - - diff --git a/nuget/old/tools-x64/uninstall.ps1 b/nuget/old/tools-x64/uninstall.ps1 deleted file mode 100644 index d25f55729..000000000 --- a/nuget/old/tools-x64/uninstall.ps1 +++ /dev/null @@ -1 +0,0 @@ -param($installPath, $toolsPath, $package, $project) \ No newline at end of file diff --git a/nuget/old/tools-x86/init.ps1 b/nuget/old/tools-x86/init.ps1 deleted file mode 100644 index c766fb995..000000000 --- a/nuget/old/tools-x86/init.ps1 +++ /dev/null @@ -1 +0,0 @@ -param($installPath, $toolsPath, $package) \ No newline at end of file diff --git a/nuget/old/tools-x86/install.ps1 b/nuget/old/tools-x86/install.ps1 deleted file mode 100644 index 2a4492e70..000000000 --- a/nuget/old/tools-x86/install.ps1 +++ /dev/null @@ -1,118 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -# 指定したディレクトリを「新しい場合はコピー」にする -function MarkDirectoryAsCopy($item) -{ - $item.ProjectItems | ForEach-Object { MarkFileAsCopy($_) } -} -# 指定したファイルを「新しい場合はコピー」にする -function MarkFileAsCopy($item) -{ - Try - { - Write-Host Try set $item.Name - $item.Properties.Item("CopyToOutputDirectory").Value = 2 # copy if newer - } - Catch - { - Write-Host RecurseOn $item.Name - MarkDirectoryAsCopyToOutputRecursive($item) - } -} - -$platforms = @( - "x86"; - "x64"; -) -$copyFilesX86 = @( - "msvcp110.dll"; - "msvcr110.dll"; - "OpenCvSharpExtern.dll"; - "opencv_calib3d248.dll"; - "opencv_contrib248.dll"; - "opencv_core248.dll"; - "opencv_features2d248.dll"; - "opencv_ffmpeg248.dll"; - "opencv_gpu248.dll"; - "opencv_flann248.dll"; - "opencv_highgui248.dll"; - "opencv_imgproc248.dll"; - "opencv_legacy248.dll"; - "opencv_ml248.dll"; - "opencv_nonfree248.dll"; - "opencv_ocl248.dll"; - "opencv_objdetect248.dll"; - "opencv_photo248.dll"; - "opencv_stitching248.dll"; - "opencv_superres248.dll"; - "opencv_video248.dll"; - "opencv_videostab248.dll"; -) -$copyFilesX64 = @( - "msvcp110.dll"; - "msvcr110.dll"; - "OpenCvSharpExtern.dll"; - "opencv_calib3d248.dll"; - "opencv_contrib248.dll"; - "opencv_core248.dll"; - "opencv_features2d248.dll"; - "opencv_ffmpeg248_64.dll"; - "opencv_gpu248.dll"; - "opencv_flann248.dll"; - "opencv_highgui248.dll"; - "opencv_imgproc248.dll"; - "opencv_legacy248.dll"; - "opencv_ml248.dll"; - "opencv_nonfree248.dll"; - "opencv_ocl248.dll"; - "opencv_objdetect248.dll"; - "opencv_photo248.dll"; - "opencv_stitching248.dll"; - "opencv_superres248.dll"; - "opencv_video248.dll"; - "opencv_videostab248.dll"; -) - -# x86 -foreach ($file in $copyFilesX86) -{ - $dllDir = $project.ProjectItems.Item("dll") - $platFormDir = $dllDir.ProjectItems.Item("x86") - MarkFileAsCopy($platFormDir.ProjectItems.Item($file)) -} -# x64 -foreach ($file in $copyFilesX64) -{ - $dllDir = $project.ProjectItems.Item("dll") - $platFormDir = $dllDir.ProjectItems.Item("x64") - MarkFileAsCopy($platFormDir.ProjectItems.Item($file)) -} - - - -function HasPlatform($manager, $platformName) -{ - $myPlatforms = [Array] $manager.PlatformNames - $index = [System.Array]::IndexOf($myPlatforms, $platformName) - $index -ge 0 -} - -$manager = $project.ConfigurationManager -$configs = [Array] $manager.PlatformNames - -foreach ($p in $platforms) -{ - $hasPlatform = HasPlatform $manager $p - if(-not $hasPlatform) - { - [void]$manager.AddPlatform($p, "Any CPU", $true) - } -} - - -#foreach ($config in $configs) -#{ -# [System.Windows.Forms.MessageBox]::Show(HasPlatform) -#} - - diff --git a/nuget/old/tools-x86/uninstall.ps1 b/nuget/old/tools-x86/uninstall.ps1 deleted file mode 100644 index d25f55729..000000000 --- a/nuget/old/tools-x86/uninstall.ps1 +++ /dev/null @@ -1 +0,0 @@ -param($installPath, $toolsPath, $package, $project) \ No newline at end of file diff --git a/nuget/packages.config b/nuget/packages.config deleted file mode 100644 index 6b8deb9c9..000000000 --- a/nuget/packages.config +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/nuget/tools/init.ps1 b/nuget/tools/init.ps1 deleted file mode 100644 index c766fb995..000000000 --- a/nuget/tools/init.ps1 +++ /dev/null @@ -1 +0,0 @@ -param($installPath, $toolsPath, $package) \ No newline at end of file diff --git a/nuget/tools/install-AnyCPU.ps1 b/nuget/tools/install-AnyCPU.ps1 deleted file mode 100644 index e62049c30..000000000 --- a/nuget/tools/install-AnyCPU.ps1 +++ /dev/null @@ -1,118 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -# 指定したディレクトリを「新しい場合はコピー」にする -function MarkDirectoryAsCopy($item) -{ - $item.ProjectItems | ForEach-Object { MarkFileAsCopy($_) } -} -# 指定したファイルを「新しい場合はコピー」にする -function MarkFileAsCopy($item) -{ - Try - { - Write-Host Try set $item.Name - $item.Properties.Item("CopyToOutputDirectory").Value = 2 # copy if newer - } - Catch - { - Write-Host RecurseOn $item.Name - MarkDirectoryAsCopyToOutputRecursive($item) - } -} - -$platforms = @( - "x86"; - "x64"; -) -$copyFilesX86 = @( - "msvcp110.dll"; - "msvcr110.dll"; - "OpenCvSharpExtern.dll"; - "opencv_calib3d249.dll"; - "opencv_contrib249.dll"; - "opencv_core249.dll"; - "opencv_features2d249.dll"; - "opencv_ffmpeg249.dll"; - "opencv_gpu249.dll"; - "opencv_flann249.dll"; - "opencv_highgui249.dll"; - "opencv_imgproc249.dll"; - "opencv_legacy249.dll"; - "opencv_ml249.dll"; - "opencv_nonfree249.dll"; - "opencv_ocl249.dll"; - "opencv_objdetect249.dll"; - "opencv_photo249.dll"; - "opencv_stitching249.dll"; - "opencv_superres249.dll"; - "opencv_video249.dll"; - "opencv_videostab249.dll"; -) -$copyFilesX64 = @( - "msvcp110.dll"; - "msvcr110.dll"; - "OpenCvSharpExtern.dll"; - "opencv_calib3d249.dll"; - "opencv_contrib249.dll"; - "opencv_core249.dll"; - "opencv_features2d249.dll"; - "opencv_ffmpeg249_64.dll"; - "opencv_gpu249.dll"; - "opencv_flann249.dll"; - "opencv_highgui249.dll"; - "opencv_imgproc249.dll"; - "opencv_legacy249.dll"; - "opencv_ml249.dll"; - "opencv_nonfree249.dll"; - "opencv_ocl249.dll"; - "opencv_objdetect249.dll"; - "opencv_photo249.dll"; - "opencv_stitching249.dll"; - "opencv_superres249.dll"; - "opencv_video249.dll"; - "opencv_videostab249.dll"; -) - -# x86 -foreach ($file in $copyFilesX86) -{ - $dllDir = $project.ProjectItems.Item("dll") - $platFormDir = $dllDir.ProjectItems.Item("x86") - MarkFileAsCopy($platFormDir.ProjectItems.Item($file)) -} -# x64 -foreach ($file in $copyFilesX64) -{ - $dllDir = $project.ProjectItems.Item("dll") - $platFormDir = $dllDir.ProjectItems.Item("x64") - MarkFileAsCopy($platFormDir.ProjectItems.Item($file)) -} - - - -function HasPlatform($manager, $platformName) -{ - $myPlatforms = [Array] $manager.PlatformNames - $index = [System.Array]::IndexOf($myPlatforms, $platformName) - $index -ge 0 -} - -$manager = $project.ConfigurationManager -$configs = [Array] $manager.PlatformNames - -foreach ($p in $platforms) -{ - $hasPlatform = HasPlatform $manager $p - if(-not $hasPlatform) - { - [void]$manager.AddPlatform($p, "Any CPU", $true) - } -} - - -#foreach ($config in $configs) -#{ -# [System.Windows.Forms.MessageBox]::Show(HasPlatform) -#} - - diff --git a/nuget/tools/install-WithoutDll.ps1 b/nuget/tools/install-WithoutDll.ps1 deleted file mode 100644 index 167ccb684..000000000 --- a/nuget/tools/install-WithoutDll.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -$platforms = @( - "x86"; - "x64"; -) - -function HasPlatform($manager, $platformName) -{ - $myPlatforms = [Array] $manager.PlatformNames - $index = [System.Array]::IndexOf($myPlatforms, $platformName) - $index -ge 0 -} - -$manager = $project.ConfigurationManager -$configs = [Array] $manager.PlatformNames - -foreach ($p in $platforms) -{ - $hasPlatform = HasPlatform $manager $p - if(-not $hasPlatform) - { - [void]$manager.AddPlatform($p, "Any CPU", $true) - } -} diff --git a/nuget/tools/uninstall.ps1 b/nuget/tools/uninstall.ps1 deleted file mode 100644 index d25f55729..000000000 --- a/nuget/tools/uninstall.ps1 +++ /dev/null @@ -1 +0,0 @@ -param($installPath, $toolsPath, $package, $project) \ No newline at end of file diff --git a/opencv b/opencv deleted file mode 160000 index 92f0a4b45..000000000 --- a/opencv +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 92f0a4b451c043a68aa0ce59374304e1b7b036c0 diff --git a/samples b/samples index 66e571780..42322d297 160000 --- a/samples +++ b/samples @@ -1 +1 @@ -Subproject commit 66e5717805dab7cf7d744dea1c1171a75e27f352 +Subproject commit 42322d297b313d9f115cba80773f2496a8c9cd9f diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e552a310..4bee25b52 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.0) project(OpenCvSharpExtern) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + #set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +# remove MinSizeRel & RelWithDebInfo +SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE) + add_subdirectory(OpenCvSharpExtern) diff --git a/src/OpenCvSharp.Blob/BlobRenderer.cs b/src/OpenCvSharp.Blob/BlobRenderer.cs deleted file mode 100644 index e1b8f45ea..000000000 --- a/src/OpenCvSharp.Blob/BlobRenderer.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -namespace OpenCvSharp.Blob -{ - /// - /// - /// - internal static class BlobRenderer - { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static unsafe void PerformOne(LabelData labels, CvBlob blob, Mat imgSrc, Mat imgDst, - RenderBlobsMode mode, Scalar color, double alpha) - { - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - if (blob == null) - throw new ArgumentNullException(nameof(blob)); - if (imgSrc == null) - throw new ArgumentNullException(nameof(imgSrc)); - if (imgDst == null) - throw new ArgumentNullException(nameof(imgDst)); - if (imgDst.Type() != MatType.CV_8UC3) - throw new ArgumentException("'img' must be a 3-channel U8 image."); - - if ((mode & RenderBlobsMode.Color) == RenderBlobsMode.Color) - { - var pSrc = imgSrc.GetGenericIndexer(); - var pDst = imgDst.GetGenericIndexer(); - - for (int r = blob.MinY; r < blob.MaxY; r++) - { - for (int c = blob.MinX; c < blob.MaxX; c++) - { - if (labels[r, c] == blob.Label) - { - byte v0 = (byte) ((1.0 - alpha)*pSrc[r, c].Item0 + alpha*color.Val0); - byte v1 = (byte) ((1.0 - alpha)*pSrc[r, c].Item1 + alpha*color.Val1); - byte v2 = (byte) ((1.0 - alpha)*pSrc[r, c].Item2 + alpha*color.Val2); - pDst[r, c] = new Vec3b(v0, v1, v2); - } - } - } - } - - if (mode != RenderBlobsMode.None) - { - if ((mode & RenderBlobsMode.BoundingBox) == RenderBlobsMode.BoundingBox) - { - Cv2.Rectangle( - imgDst, - new Point(blob.MinX, blob.MinY), - new Point(blob.MaxX, blob.MaxY), - new Scalar(255, 0, 0)); - } - if ((mode & RenderBlobsMode.Angle) == RenderBlobsMode.Angle) - { - double angle = blob.Angle(); - double lengthLine = Math.Max(blob.MaxX - blob.MinX, blob.MaxY - blob.MinY) / 2.0; - double x1 = blob.Centroid.X - lengthLine * Math.Cos(angle); - double y1 = blob.Centroid.Y - lengthLine * Math.Sin(angle); - double x2 = blob.Centroid.X + lengthLine * Math.Cos(angle); - double y2 = blob.Centroid.Y + lengthLine * Math.Sin(angle); - Cv2.Line(imgDst, new Point((int)x1, (int)y1), new Point((int)x2, (int)y2), - new Scalar(0, 255, 0)); - } - if ((mode & RenderBlobsMode.Centroid) == RenderBlobsMode.Centroid) - { - Cv2.Line(imgDst, - new Point((int)blob.Centroid.X - 3, (int)blob.Centroid.Y), - new Point((int)blob.Centroid.X + 3, (int)blob.Centroid.Y), - new Scalar(255, 0, 0)); - Cv2.Line(imgDst, - new Point((int)blob.Centroid.X, (int)blob.Centroid.Y - 3), - new Point((int)blob.Centroid.X, (int)blob.Centroid.Y + 3), - new Scalar(255, 0, 0)); - } - } - } - - /// - /// - /// - /// - /// - /// - /// - /// - public static void PerformMany(CvBlobs blobs, Mat imgSrc, Mat imgDst, RenderBlobsMode mode, double alpha) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - if (imgSrc == null) - throw new ArgumentNullException(nameof(imgSrc)); - if (imgDst == null) - throw new ArgumentNullException(nameof(imgDst)); - if (imgDst.Type() != MatType.CV_8UC3) - throw new ArgumentException("'img' must be a 3-channel U8 image."); - - var palette = new Dictionary(); - if ((mode & RenderBlobsMode.Color) == RenderBlobsMode.Color) - { - int colorCount = 0; - foreach (var kv in blobs) - { - double r, g, b; - Hsv2Rgb((colorCount*77) % 360, 0.5, 1.0, out r, out g, out b); - colorCount++; - palette[kv.Key] = new Scalar(b, g, r); - } - } - - foreach (var kv in blobs) - { - Scalar color = default (Scalar); - if (palette.ContainsKey(kv.Key)) - color = palette[kv.Key]; - PerformOne(blobs.Labels, kv.Value, imgSrc, imgDst, mode, color, alpha); - } - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - private static void Hsv2Rgb(double h, double s, double v, out double r, out double g, out double b) - { - double hh = h / 60.0; - int hf = (int)Math.Floor(hh); - int hi = ((int)hh) % 6; - double f = hh - hf; - - double p = v * (1.0 - s); - double q = v * (1.0 - f * s); - double t = v * (1.0 - (1.0 - f) * s); - - switch (hi) - { - case 0: - r = 255.0 * v; - g = 255.0 * t; - b = 255.0 * p; - break; - case 1: - r = 255.0 * q; - g = 255.0 * v; - b = 255.0 * p; - break; - case 2: - r = 255.0 * p; - g = 255.0 * v; - b = 255.0 * t; - break; - case 3: - r = 255.0 * p; - g = 255.0 * q; - b = 255.0 * v; - break; - case 4: - r = 255.0 * t; - g = 255.0 * p; - b = 255.0 * v; - break; - case 5: - r = 255.0 * v; - g = 255.0 * p; - b = 255.0 * q; - break; - default: - throw new Exception(); - } - } - } -} diff --git a/src/OpenCvSharp.Blob/CvBlob.cs b/src/OpenCvSharp.Blob/CvBlob.cs deleted file mode 100644 index ae0ba8672..000000000 --- a/src/OpenCvSharp.Blob/CvBlob.cs +++ /dev/null @@ -1,292 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp.Blob -{ - /// - /// Struct that contain information about one blob. - /// - [Serializable] - public class CvBlob - { - #region Init - - /// - /// Constructor - /// - public CvBlob() - { - Contour = new CvContourChainCode(); - InternalContours = new List(); - } - - /// - /// - /// - /// - /// - /// - internal CvBlob(int label, int x, int y) : this() - { - Label = label; - Area = 1; - MinX = x; - MaxX = x; - MinY = y; - MaxY = y; - M10 = x; - M01 = y; - M11 = x*y; - M20 = x*x; - M02 = y*y; - } - - #endregion - - #region Properties - - /// - /// Label assigned to the blob - /// - public int Label { get; set; } - - /// - /// Area (moment 00) - /// - public int Area { get; set; } - - /// - /// Area (moment 00) - /// - public int M00 - { - get { return Area; } - set { Area = value; } - } - - /// - /// X min - /// - public int MinX { get; set; } - - /// - /// X max - /// - public int MaxX { get; set; } - - /// - /// Y min - /// - public int MinY { get; set; } - - /// - /// Y max - /// - public int MaxY { get; set; } - - /// - /// CvRect(MinX, MinY, MaxX - MinX, MaxY - MinY) - /// - public Rect Rect - { - get { return new Rect(MinX, MinY, MaxX - MinX + 1, MaxY - MinY + 1); } - set - { - MinX = value.Left; - MinY = value.Top; - MaxX = value.Right; - MaxY = value.Bottom; - } - } - - /// - /// Centroid - /// - public Point2d Centroid { get; internal set; } - - /// - /// Moment 10 - /// - public double M10 { get; set; } - - /// - /// Moment 01 - /// - public double M01 { get; set; } - - /// - /// Moment 11 - /// - public double M11 { get; set; } - - /// - /// Moment 20 - /// - public double M20 { get; set; } - - /// - /// Moment 02 - /// - public double M02 { get; set; } - - /// - /// True if central moments are being calculated - /// - public bool CentralMoments { get; set; } - - /// - /// Central moment 11 - /// - public double U11 { get; internal set; } - - /// - /// Central moment 20 - /// - public double U20 { get; internal set; } - - /// - /// Central moment 02 - /// - public double U02 { get; internal set; } - - /// - /// Normalized central moment 11. - /// - public double N11 { get; internal set; } - - /// - /// Normalized central moment 20. - /// - public double N20 { get; internal set; } - - /// - /// Normalized central moment 02. - /// - public double N02 { get; internal set; } - - /// - /// Hu moment 1. - /// - public double P1 { get; set; } - - /// - /// Hu moment 2. - /// - public double P2 { get; set; } - - /// - /// Contour - /// - public CvContourChainCode Contour { get; internal set; } - - /// - /// Internal contours - /// - public List InternalContours { get; internal set; } - - #endregion - - #region Methods - - /// - /// Calculates angle orientation of a blob. - /// This function uses central moments so cvCentralMoments should have been called before for this blob. (cvAngle) - /// - /// Angle orientation in radians. - public double Angle() - { - return 0.5*Math.Atan2(2.0*U11, (U20 - U02)); - } - - - /// - /// Calculates centroid. - /// Centroid will be returned and stored in the blob structure. (cvCentroid) - /// - /// Centroid. - public Point2d CalcCentroid() - { - Centroid = new Point2d(M10 / Area, M01 / Area); - return Centroid; - } - - /// - /// Save the image of a blob to a file. - /// The function uses an image (that can be the original pre-processed image or a processed one, or even the result of cvRenderBlobs, for example) and a blob structure. - /// Then the function saves a copy of the part of the image where the blob is. - /// - /// Name of the file. - /// Image. - public void SaveImage(string fileName, Mat img) - { - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); - if (img == null) - throw new ArgumentNullException(nameof(img)); - - using (var subMat = img.SubMat(Rect)) - { - subMat.SaveImage(fileName); - } - } - - /// - /// Set central/hu moments and centroid value from moment values (M**) - /// - public void SetMoments() - { - // 重心 - Centroid = new Point2d(M10/Area, M01/Area); - // 各モーメント - U11 = M11 - (M10*M01)/M00; - U20 = M20 - (M10*M10)/M00; - U02 = M02 - (M01*M01)/M00; - - double m00Pow2 = M00*M00; - N11 = U11/m00Pow2; - N20 = U20/m00Pow2; - N02 = U02/m00Pow2; - - P1 = N20 + N02; - double nn = N20 - N02; - P2 = nn*nn + 4.0*(N11*N11); - } - - /// - /// - /// - /// - public CvBlob Clone() - { - return new CvBlob - { - Area = Area, - CentralMoments = CentralMoments, - Centroid = Centroid, - Contour = Contour.Clone(), - InternalContours = new List(InternalContours), - Label = Label, - M00 = M00, - M01 = M01, - M02 = M02, - M10 = M10, - M11 = M11, - M20 = M20, - MaxX = MaxX, - MaxY = MaxY, - MinX = MinX, - MinY = MinY, - N02 = N02, - N11 = N11, - N20 = N20, - P1 = P1, - P2 = P2, - U02 = U02, - U11 = U11, - U20 = U20, - }; - } - - #endregion - } -} diff --git a/src/OpenCvSharp.Blob/CvBlobConst.cs b/src/OpenCvSharp.Blob/CvBlobConst.cs deleted file mode 100644 index 02d6bbebb..000000000 --- a/src/OpenCvSharp.Blob/CvBlobConst.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; - -namespace OpenCvSharp.Blob -{ - /// - /// Constants which are defined by cvblob - /// - public static class CvBlobConst - { - // ReSharper disable InconsistentNaming - - #region RenderBlobsMode - - /// - /// Render each blog with a different color. - /// - - public const ushort CV_BLOB_RENDER_COLOR = 0x0001; - - /// - /// Render centroid. - /// - public const ushort CV_BLOB_RENDER_CENTROID = 0x0002; - - /// - /// Render bounding box. - /// - public const ushort CV_BLOB_RENDER_BOUNDING_BOX = 0x0004; - - /// - /// Render angle. - /// - public const ushort CV_BLOB_RENDER_ANGLE = 0x0008; - - /// - /// Print blob data to log out. - /// - public const ushort CV_BLOB_RENDER_TO_LOG = 0x0010; - - /// - /// Print blob data to std out. - /// - public const ushort CV_BLOB_RENDER_TO_STD = 0x0020; - - #endregion - - #region CvChainCode - - /// - /// Up. - /// - public const byte CV_CHAINCODE_UP = 0; - - /// - /// Up and right. - /// - public const byte CV_CHAINCODE_UP_RIGHT = 1; - - /// - /// Right. - /// - public const byte CV_CHAINCODE_RIGHT = 2; - - /// - /// Down and right. - /// - public const byte CV_CHAINCODE_DOWN_RIGHT = 3; - - /// - /// Down. - /// - public const byte CV_CHAINCODE_DOWN = 4; - - /// - /// Down and left. - /// - public const byte CV_CHAINCODE_DOWN_LEFT = 5; - - /// - /// Left. - /// - public const byte CV_CHAINCODE_LEFT = 6; - - /// - /// Up and left. - /// - public const byte CV_CHAINCODE_UP_LEFT = 7; - - /// - /// Move vectors of chain codes. - /// - public static readonly sbyte[][] ChainCodeMoves = new sbyte[][] - { - new sbyte[] {0, -1}, - new sbyte[] {1, -1}, - new sbyte[] {1, 0}, - new sbyte[] {1, 1}, - new sbyte[] {0, 1}, - new sbyte[] {-1, 1}, - new sbyte[] {-1, 0}, - new sbyte[] {-1, -1} - }; - - #endregion - - #region RenderTracksMode - - // ReSharper disable InconsistentNaming - /// - /// Print the ID of each track in the image. - /// - public const ushort CV_TRACK_RENDER_ID = 0x0001; - - /// - /// Draw bounding box of each track in the image. \see cvRenderTracks - /// - public const ushort CV_TRACK_RENDER_BOUNDING_BOX = 0x0002; - - /// - /// Print track info to log out. - /// - public const ushort CV_TRACK_RENDER_TO_LOG = 0x0010; - - /// - /// Print track info to log out. - /// - public const ushort CV_TRACK_RENDER_TO_STD = 0x0020; - - // ReSharper restore InconsistentNaming - - #endregion - } -} diff --git a/src/OpenCvSharp.Blob/CvBlobLib.cs b/src/OpenCvSharp.Blob/CvBlobLib.cs deleted file mode 100644 index d1b8505dc..000000000 --- a/src/OpenCvSharp.Blob/CvBlobLib.cs +++ /dev/null @@ -1,512 +0,0 @@ -using System; - -//#pragma warning disable 1591 - -namespace OpenCvSharp.Blob -{ - /// - /// Functions of cvblob library - /// - public static class CvBlobLib - { - /// - /// Calculates angle orientation of a blob. - /// This function uses central moments so cvCentralMoments should have been called before for this blob. (cvAngle) - /// - /// Blob. - /// Angle orientation in radians. - public static double CalcAngle(CvBlob blob) - { - if (blob == null) - throw new ArgumentNullException(nameof(blob)); - return blob.Angle(); - } - - /// - /// Calculates centroid. - /// Centroid will be returned and stored in the blob structure. (cvCentroid) - /// - /// Blob whose centroid will be calculated. - /// Centroid. - public static Point2d CalcCentroid(CvBlob blob) - { - if (blob == null) - throw new ArgumentNullException(nameof(blob)); - return blob.CalcCentroid(); - } - - /// - /// Calculates area of a polygonal contour. - /// - /// Contour (polygon type). - /// Area of the contour. - public static double ContourPolygonArea(CvContourPolygon polygon) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - return polygon.Area(); - } - - /// - /// Calculates the circularity of a polygon (compactness measure). - /// - /// Contour (polygon type). - /// Circularity: a non-negative value, where 0 correspond with a circumference. - public static double ContourPolygonCircularity(CvContourPolygon polygon) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - return polygon.Circularity(); - } - - /// - /// Calculates perimeter of a chain code contour. - /// - /// Contour (polygon type). - /// Perimeter of the contour. - public static double ContourPolygonPerimeter(CvContourPolygon polygon) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - return polygon.Perimeter(); - } - - /// - /// Calculates perimeter of a chain code contour. - /// - /// Contour (chain code type). - /// Perimeter of the contour. - public static double ContourChainCodePerimeter(CvContourChainCode cc) - { - if (cc == null) - throw new ArgumentNullException(nameof(cc)); - return cc.Perimeter(); - } - - /// - /// Convert a chain code contour to a polygon. - /// - /// Chain code contour. - /// A polygon. - public static CvContourPolygon ConvertChainCodesToPolygon(CvContourChainCode cc) - { - if (cc == null) - throw new ArgumentNullException(nameof(cc)); - return cc.ConvertToPolygon(); - } - - /// - /// Filter blobs by area. - /// Those blobs whose areas are not in range will be erased from the input list of blobs. (cvFilterByArea) - /// - /// List of blobs. - /// Minimun area. - /// Maximun area. - public static void FilterByArea(CvBlobs blobs, int minArea, int maxArea) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - blobs.FilterByArea(minArea, maxArea); - } - - /// - /// Filter blobs by label. - /// Delete all blobs except those with label l. - /// - /// List of blobs. - /// Label to leave. - public static void FilterByLabel(CvBlobs blobs, int label) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - blobs.FilterByLabel(label); - } - - /// - /// Draw a binary image with the blobs that have been given. (cvFilterLabels) - /// - /// List of blobs to be drawn. - /// Output binary image (depth=IPL_DEPTH_8U and nchannels=1). - public static void FilterLabels(CvBlobs blobs, Mat imgOut) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - blobs.FilterLabels(imgOut); - } - - /// - /// Get the label value from a labeled image. - /// - /// Blob data. - /// X coordenate. - /// Y coordenate. - /// Label value. - public static int GetLabel(CvBlobs blobs, int x, int y) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - return blobs.GetLabel(x, y); - } - - /// - /// Find greater blob. (cvGreaterBlob) - /// - /// List of blobs. - /// The greater blob. - public static CvBlob GreaterBlob(CvBlobs blobs) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - return blobs.GreaterBlob(); - } - - /// - /// Find the largest blob. (cvLargestBlob) - /// - /// List of blobs. - /// The largest blob. - public static CvBlob LargestBlob(CvBlobs blobs) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - return blobs.LargestBlob(); - } - - /// - /// Label the connected parts of a binary image. (cvLabel) - /// - /// Input binary image (depth=IPL_DEPTH_8U and num. channels=1). - /// List of blobs. - /// Number of pixels that has been labeled. - public static int Label(Mat img, CvBlobs blobs) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - - return blobs.Label(img); - } - - /// - /// Calculates mean color of a blob in an image. - /// - /// Blob list - /// The target blob - /// Original image. - /// Average color. - public static Scalar BlobMeanColor(CvBlobs blobs, CvBlob targetBlob, Mat originalImage) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - return blobs.BlobMeanColor(targetBlob, originalImage); - } - - /// - /// Calculates convex hull of a contour. - /// Uses the Melkman Algorithm. Code based on the version in http://w3.impa.br/~rdcastan/Cgeometry/. - /// - /// Contour (polygon type). - /// Convex hull. - public static CvContourPolygon PolygonContourConvexHull(CvContourPolygon polygon) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - return polygon.ContourConvexHull(); - } - - /// - /// Draws or prints information about a blob. - /// - /// Label data. - /// Blob. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - public static void RenderBlob(LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest) - { - RenderBlob(labels, blob, imgSource, imgDest, (RenderBlobsMode) 0x000f, Scalar.White, 1.0); - } - - /// - /// Draws or prints information about a blob. - /// - /// Label data. - /// Blob. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE. - public static void RenderBlob(LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest, - RenderBlobsMode mode) - { - RenderBlob(labels, blob, imgSource, imgDest, mode, Scalar.White, 1.0); - } - - /// - /// Draws or prints information about a blob. - /// - /// Label data. - /// Blob. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE. - /// Color to render (if CV_BLOB_RENDER_COLOR is used). - /// If mode CV_BLOB_RENDER_COLOR is used. 1.0 indicates opaque and 0.0 translucent (1.0 by default). - public static void RenderBlob(LabelData labels, CvBlob blob, Mat imgSource, Mat imgDest, - RenderBlobsMode mode, Scalar color, double alpha = 1.0) - { - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - if (blob == null) - throw new ArgumentNullException(nameof(blob)); - if (imgSource == null) - throw new ArgumentNullException(nameof(imgSource)); - if (imgDest == null) - throw new ArgumentNullException(nameof(imgDest)); - - BlobRenderer.PerformOne(labels, blob, imgSource, imgDest, mode, color, alpha); - } - - /// - /// Draws or prints information about blobs. (cvRenderBlobs) - /// - /// List of blobs. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - public static void RenderBlobs(CvBlobs blobs, Mat imgSource, Mat imgDest) - { - RenderBlobs(blobs, imgSource, imgDest, (RenderBlobsMode) 0x000f, 1.0); - } - - /// - /// Draws or prints information about blobs. (cvRenderBlobs) - /// - /// List of blobs. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE. - /// If mode CV_BLOB_RENDER_COLOR is used. 1.0 indicates opaque and 0.0 translucent (1.0 by default). - public static void RenderBlobs(CvBlobs blobs, Mat imgSource, Mat imgDest, RenderBlobsMode mode, - double alpha = 1.0) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - if (imgSource == null) - throw new ArgumentNullException(nameof(imgSource)); - if (imgDest == null) - throw new ArgumentNullException(nameof(imgDest)); - - BlobRenderer.PerformMany(blobs, imgSource, imgDest, mode, alpha); - } - - /// - /// Draw a contour. - /// - /// Chain code contour. - /// Image to draw on. - public static void RenderContourChainCode(CvContourChainCode contour, Mat img) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.Render(img); - } - - /// - /// Draw a contour. - /// - /// Chain code contour. - /// Image to draw on. - /// Color to draw (default, white). - public static void RenderContourChainCode(CvContourChainCode contour, Mat img, Scalar color) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.Render(img, color); - } - - /// - /// Draw a polygon. - /// - /// Polygon contour. - /// Image to draw on. - public static void RenderContourPolygon(CvContourPolygon contour, Mat img) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.Render(img); - } - - /// - /// Draw a polygon. - /// - /// Polygon contour. - /// Image to draw on. - /// Color to draw (default, white). - public static void RenderContourPolygon(CvContourPolygon contour, Mat img, Scalar color) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.Render(img, color); - } - - /// - /// Prints tracks information. - /// - /// List of tracks. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest) - { - if (tracks == null) - throw new ArgumentNullException(nameof(tracks)); - tracks.Render(imgSource, imgDest); - } - - /// - /// Prints tracks information. - /// - /// List of tracks. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_TRACK_RENDER_ID. - public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode) - { - if (tracks == null) - throw new ArgumentNullException(nameof(tracks)); - tracks.Render(imgSource, imgDest, mode); - } - - /// - /// Prints tracks information. - /// - /// List of tracks. - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_TRACK_RENDER_ID. - /// - /// - /// - /// - public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode, - Scalar textColor, HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1) - { - if (tracks == null) - throw new ArgumentNullException(nameof(tracks)); - tracks.Render(imgSource, imgDest, mode, textColor, fontFace, fontScale, thickness); - } - - /// - /// Save the image of a blob to a file. - /// The function uses an image (that can be the original pre-processed image or a processed one, or even the result of cvRenderBlobs, for example) and a blob structure. - /// Then the function saves a copy of the part of the image where the blob is. - /// - /// Name of the file. - /// Image. - /// Blob. - public static void SaveImageBlob(string fileName, Mat img, CvBlob blob) - { - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); - if (blob == null) - throw new ArgumentNullException(nameof(blob)); - blob.SaveImage(fileName, img); - } - - /// - /// Simplify a polygon reducing the number of vertex according the distance "delta". - /// Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm). - /// - /// Contour (polygon type). - /// A simplify version of the original polygon. - public static CvContourPolygon SimplifyPolygon(CvContourPolygon polygon) - { - return polygon.Simplify(); - } - - /// - /// Simplify a polygon reducing the number of vertex according the distance "delta". - /// Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm). - /// - /// Contour (polygon type). - /// Minimun distance. - /// A simplify version of the original polygon. - public static CvContourPolygon SimplifyPolygon(CvContourPolygon polygon, double delta) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - return polygon.Simplify(delta); - } - - /// - /// Updates list of tracks based on current blobs. - /// - /// List of blobs. - /// List of tracks. - /// Max distance to determine when a track and a blob match. - /// Max number of frames a track can be inactive. - public static void UpdateTracks(CvBlobs blobs, CvTracks tracks, double thDistance, int thInactive) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - blobs.UpdateTracks(tracks, thDistance, thInactive); - } - - /// - /// Updates list of tracks based on current blobs. - /// - /// List of blobs. - /// List of tracks. - /// Max distance to determine when a track and a blob match. - /// Max number of frames a track can be inactive. - /// If a track becomes inactive but it has been active less than thActive frames, the track will be deleted. - /// - /// Tracking based on: - /// A. Senior, A. Hampapur, Y-L Tian, L. Brown, S. Pankanti, R. Bolle. Appearance Models for - /// Occlusion Handling. Second International workshop on Performance Evaluation of Tracking and - /// Surveillance Systems & CVPR'01. December, 2001. - /// (http://www.research.ibm.com/peoplevision/PETS2001.pdf) - /// - public static void UpdateTracks(CvBlobs blobs, CvTracks tracks, double thDistance, int thInactive, int thActive) - { - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - blobs.UpdateTracks(tracks, thDistance, thInactive, thActive); - } - - /// - /// Write a contour to a CSV (Comma-separated values) file. - /// - /// Polygon contour. - /// File name. - public static void WriteContourPolygonCsv(CvContourPolygon polygon, string filename) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - polygon.WriteAsCsv(filename); - } - - /// - /// Write a contour to a SVG file. - /// - /// Polygon contour. - /// File name. - public static void WriteContourPolygonSvg(CvContourPolygon polygon, string fileName) - { - polygon.WriteAsSvg(fileName); - } - - /// - /// Write a contour to a SVG file. - /// - /// Polygon contour. - /// File name. - /// Stroke color (black by default). - /// Fill color (white by default). - public static void WriteContourPolygonSvg(CvContourPolygon polygon, string fileName, - Scalar stroke, Scalar fill) - { - if (polygon == null) - throw new ArgumentNullException(nameof(polygon)); - polygon.WriteAsSvg(fileName, stroke, fill); - } - } -} diff --git a/src/OpenCvSharp.Blob/CvBlobs.cs b/src/OpenCvSharp.Blob/CvBlobs.cs deleted file mode 100644 index 9affb752c..000000000 --- a/src/OpenCvSharp.Blob/CvBlobs.cs +++ /dev/null @@ -1,705 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -namespace OpenCvSharp.Blob -{ - /// - /// Blob set - /// - public class CvBlobs : Dictionary - { - /// - /// Label values - /// - public LabelData Labels { get; set; } - - /// - /// Constructor (init only) - /// - public CvBlobs() - { - } - - /// - /// Constructor (copy) - /// - public CvBlobs(IEnumerable> blobData, int[,] labelData) - { - foreach (KeyValuePair pair in blobData) - { - Add(pair.Key, pair.Value); - } - Labels = new LabelData(labelData); - } - - /// - /// Constructor (copy) - /// - public CvBlobs(IEnumerable> blobData, LabelData labelData) - : this(blobData, labelData.Values) - { - } - - /// - /// Constructor (init and cvLabel) - /// - /// Input binary image (depth=IPL_DEPTH_8U and nchannels=1). - public CvBlobs(Mat img) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (img.IsDisposed) - throw new ArgumentException("img is disposed"); - if (img.Type() != MatType.CV_8UC1) - throw new ArgumentException("img.Depth == BitDepth.U8 && img.NChannels == 1"); - - Label(img); - } - - #region Methods - - #region BlobMeanColor - - /// - /// Calculates mean color of a blob in an image. (cvBlobMeanColor) - /// - /// The target blob - /// Original image. - public Scalar BlobMeanColor(CvBlob targetBlob, Mat originalImage) - { - if (targetBlob == null) - throw new ArgumentNullException(nameof(targetBlob)); - if (originalImage == null) - throw new ArgumentNullException(nameof(originalImage)); - if (originalImage.Type() != MatType.CV_8UC3) - throw new ArgumentException("imgOut.Depth != BitDepth.U8 || imgOut.NChannels != 3"); - if (Labels == null) - throw new ArgumentException("blobs.Labels == null"); - - int width = originalImage.Cols; - int height = originalImage.Rows; - int mb = 0; - int mg = 0; - int mr = 0; - - var indexer = originalImage.GetGenericIndexer(); - for (int r = 0; r < height; r++) - { - for (int c = 0; c < width; c++) - { - if (Labels[r, c] == targetBlob.Label) - { - var v = indexer[r, c]; - mb += v.Item0; - mg += v.Item1; - mr += v.Item2; - } - } - } - - GC.KeepAlive(originalImage); - - int pixels = targetBlob.Area; - return new Scalar((byte) (mb/pixels), (byte) (mg/pixels), (byte) (mr/pixels)); - } - - #endregion - - #region FilterByArea - - /// - /// Filter blobs by area. - /// Those blobs whose areas are not in range will be erased from the input list of blobs. (cvFilterByArea) - /// - /// Minimun area. - /// Maximun area. - public void FilterByArea(int minArea, int maxArea) - { - int[] keys = new int[Count]; - Keys.CopyTo(keys, 0); - - foreach (int key in keys) - { - int area = this[key].Area; - if (area < minArea || area > maxArea) - { - Remove(key); - } - } - } - - #endregion - - #region FilterByLabel - - /// - /// Filter blobs by label. - /// Delete all blobs except those with label l. - /// - /// Label to leave. - public void FilterByLabel(int label) - { - int[] keys = new int[Count]; - Keys.CopyTo(keys, 0); - - foreach (int key in keys) - { - if (this[key].Label != label) - { - Remove(key); - } - } - } - - #endregion - - #region FilterLabels - - /// - /// Draw a binary image with the blobs that have been given. (cvFilterLabels) - /// - /// Output binary image (depth=IPL_DEPTH_8U and nchannels=1). - public void FilterLabels(Mat imgOut) - { - if (imgOut == null) - throw new ArgumentNullException(nameof(imgOut)); - if (imgOut.Type() != MatType.CV_8UC1) - throw new ArgumentException("imgOut.Depth != BitDepth.U8 || imgOut.NChannels != 1"); - if (Labels == null) - throw new ArgumentException("blobs.Labels == null"); - - Size size = Labels.Size; - int w = size.Width; - int h = size.Height; - var indexer = imgOut.GetGenericIndexer(); - - for (int r = 0; r < h; r++) - { - for (int c = 0; c < w; c++) - { - int label = Labels[r, c]; - if (label != 0) - { - if (ContainsKey(label)) - indexer[r, c] = 0xff; - else - indexer[r, c] = 0x00; - } - else - { - indexer[r, c] = 0x00; - } - } - } - } - - #endregion - - #region GreaterBlob - - /// - /// Find greater blob. (cvGreaterBlob) - /// - /// The greater blob. - public CvBlob GreaterBlob() - { - return LargestBlob(); - } - - /// - /// Find the largest blob. (cvGreaterBlob) - /// - /// The largest blob. - public CvBlob LargestBlob() - { - if (Count == 0) - return null; - - var list = new List>(this); - // 降順ソート - list.Sort((kv1, kv2) => - { - CvBlob b1 = kv1.Value; - CvBlob b2 = kv2.Value; - if (b1 == null) - return -1; - if (b2 == null) - return 1; - return b2.Area - b1.Area; - }); - return list[0].Value; - } - - #endregion - - #region GetLabel - - /// - /// Label the connected parts of a binary image. (cvLabel) - /// - /// - /// - /// Number of pixels that has been labeled. - public int GetLabel(int x, int y) - { - return Labels[y, x]; - } - - #endregion - - #region Label - - /// - /// Label the connected parts of a binary image. (cvLabel) - /// - /// Input binary image (depth=IPL_DEPTH_8U and num. channels=1). - /// Number of pixels that has been labeled. - public int Label(Mat img) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - - Labels = new LabelData(img.Height, img.Width); - return Labeller.Perform(img, this); - } - - #endregion - - #region RenderBlobs - - /// - /// Draws or prints information about blobs. (cvRenderBlobs) - /// - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - public void RenderBlobs(Mat imgSource, Mat imgDest) - { - CvBlobLib.RenderBlobs(this, imgSource, imgDest); - } - - /// - /// Draws or prints information about blobs. (cvRenderBlobs) - /// - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE. - public void RenderBlobs(Mat imgSource, Mat imgDest, RenderBlobsMode mode) - { - CvBlobLib.RenderBlobs(this, imgSource, imgDest, mode); - } - - /// - /// Draws or prints information about blobs. (cvRenderBlobs) - /// - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_BLOB_RENDER_COLOR|CV_BLOB_RENDER_CENTROID|CV_BLOB_RENDER_BOUNDING_BOX|CV_BLOB_RENDER_ANGLE. - /// If mode CV_BLOB_RENDER_COLOR is used. 1.0 indicates opaque and 0.0 translucent (1.0 by default). - public void RenderBlobs(Mat imgSource, Mat imgDest, RenderBlobsMode mode, Double alpha) - { - CvBlobLib.RenderBlobs(this, imgSource, imgDest, mode, alpha); - } - - #endregion - - #region UpdateTracks - - /// - /// Updates list of tracks based on current blobs. - /// - /// List of tracks. - /// Max distance to determine when a track and a blob match. - /// Max number of frames a track can be inactive. - /// - /// Tracking based on: - /// A. Senior, A. Hampapur, Y-L Tian, L. Brown, S. Pankanti, R. Bolle. Appearance Models for - /// Occlusion Handling. Second International workshop on Performance Evaluation of Tracking and - /// Surveillance Systems & CVPR'01. December, 2001. - /// (http://www.research.ibm.com/peoplevision/PETS2001.pdf) - /// - public void UpdateTracks(CvTracks tracks, double thDistance, int thInactive) - { - UpdateTracks(tracks, thDistance, thInactive, 0); - } - - /// - /// Updates list of tracks based on current blobs. - /// - /// List of tracks. - /// Max distance to determine when a track and a blob match. - /// Max number of frames a track can be inactive. - /// If a track becomes inactive but it has been active less than thActive frames, the track will be deleted. - /// - /// Tracking based on: - /// A. Senior, A. Hampapur, Y-L Tian, L. Brown, S. Pankanti, R. Bolle. Appearance Models for - /// Occlusion Handling. Second International workshop on Performance Evaluation of Tracking and - /// Surveillance Systems & CVPR'01. December, 2001. - /// (http://www.research.ibm.com/peoplevision/PETS2001.pdf) - /// - public void UpdateTracks(CvTracks tracks, double thDistance, int thInactive, int thActive) - { - if (tracks == null) - throw new ArgumentNullException(nameof(tracks)); - - int nBlobs = this.Count; - int nTracks = tracks.Count; - - if (nBlobs == 0) - return; - - // Proximity matrix: - // Last row/column is for ID/label. - // Last-1 "/" is for accumulation. - var close = new ProximityMatrix(nBlobs, nTracks); - - // Initialization: - int i = 0; - foreach (CvBlob blob in Values) - { - close.AB[i] = 0; - close.IB[i] = blob.Label; - i++; - } - - int maxTrackId = 0; - int j = 0; - foreach (CvTrack track in tracks.Values) - { - close.AT[j] = 0; - close.IT[j] = track.Id; - if (track.Id > maxTrackId) - maxTrackId = track.Id; - j++; - } - - // Proximity matrix calculation and "used blob" list initialization: - for (i = 0; i < nBlobs; i++) - { - for (j = 0; j < nTracks; j++) - { - int ib = close.IB[i]; - int it = close.IT[j]; - CvBlob b = this[ib]; - CvTrack t = tracks[it]; - close[i, j] = (DistantBlobTrack(b, t) < thDistance) ? 1 : 0; - if (close[i, j] < thDistance) - { - close.AB[i]++; - close.AT[j]++; - } - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Detect inactive tracks - for (j = 0; j < nTracks; j++) - { - int c = close[nBlobs, j]; - if (c == 0) - { - //cout << "Inactive track: " << j << endl; - - // Inactive track. - CvTrack track = tracks[j]; - track.Inactive++; - track.Label = 0; - } - } - - // Detect new tracks - for (i = 0; i < nBlobs; i++) - { - int c = close.AB[i]; - if (c == 0) - { - //cout << "Blob (new track): " << maxTrackID+1 << endl; - //cout << *B(i) << endl; - - // New track. - maxTrackId++; - int ib = close.IB[i]; - CvBlob blob = this[ib]; - CvTrack track = new CvTrack - { - Id = maxTrackId, - Label = blob.Label, - MinX = blob.MinX, - MinY = blob.MinY, - MaxX = blob.MaxX, - MaxY = blob.MaxY, - Centroid = blob.Centroid, - LifeTime = 0, - Active = 0, - Inactive = 0, - }; - tracks[maxTrackId] = track; - //maxTrackId++; - } - } - - // Clustering - for (j = 0; j < nTracks; j++) - { - int c = close.AT[j]; - if (c != 0) - { - var tt = new List(); - var bb = new List(); - - int it = close.IT[j]; - tt.Add(tracks[it]); - - GetClusterForTrack(j, close, nBlobs, nTracks, this, tracks, bb, tt); - - // Select track - CvTrack track = null; - int area = 0; - foreach (CvTrack t in tt) - { - int a = (t.MaxX - t.MinX)*(t.MaxY - t.MinY); - if (a > area) - { - area = a; - track = t; - } - } - - // Select blob - CvBlob blob = null; - area = 0; - foreach (CvBlob b in Values) - { - if (b.Area > area) - { - area = b.Area; - blob = b; - } - } - - if (blob == null || track == null) - //throw new Exception(); - continue; - - // Update track - track.Label = blob.Label; - track.Centroid = blob.Centroid; - track.MinX = blob.MinX; - track.MinY = blob.MinY; - track.MaxX = blob.MaxX; - track.MaxY = blob.MaxY; - if (track.Inactive != 0) - track.Active = 0; - track.Inactive = 0; - - // Others to inactive - foreach (CvTrack t in tt) - { - if (t != track) - { - //cout << "Inactive: track=" << t->id << endl; - t.Inactive++; - t.Label = 0; - } - } - } - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - int[] trackKeys = new int[tracks.Count]; - tracks.Keys.CopyTo(trackKeys, 0); - foreach (int tkey in trackKeys) - { - CvTrack t = tracks[tkey]; - if ((t.Inactive >= thInactive) || - ((t.Inactive != 0) && (thActive != 0) && (t.Active < thActive))) - { - tracks.Remove(tkey); - } - else - { - t.LifeTime++; - if (t.Inactive == 0) - t.Active++; - } - } - } - - private double DistantBlobTrack(CvBlob b, CvTrack t) - { - double d1; - if (b.Centroid.X < t.MinX) - { - if (b.Centroid.Y < t.MinY) - d1 = Math.Max(t.MinX - b.Centroid.X, t.MinY - b.Centroid.Y); - else if (b.Centroid.Y > t.MaxY) - d1 = Math.Max(t.MinX - b.Centroid.X, b.Centroid.Y - t.MaxY); - else // if (t.MinY < b.Centroid.Y)&&(b.Centroid.Y < t.MaxY) - d1 = t.MinX - b.Centroid.X; - } - else if (b.Centroid.X > t.MaxX) - { - if (b.Centroid.Y < t.MinY) - d1 = Math.Max(b.Centroid.X - t.MaxX, t.MinY - b.Centroid.Y); - else if (b.Centroid.Y > t.MaxY) - d1 = Math.Max(b.Centroid.X - t.MaxX, b.Centroid.Y - t.MaxY); - else - d1 = b.Centroid.X - t.MaxX; - } - else // if (t.MinX =< b.Centroid.X) && (b.Centroid.X =< t.MaxX) - { - if (b.Centroid.Y < t.MinY) - d1 = t.MinY - b.Centroid.Y; - else if (b.Centroid.Y > t.MaxY) - d1 = b.Centroid.Y - t.MaxY; - else - return 0.0; - } - - double d2; - if (t.Centroid.X < b.MinX) - { - if (t.Centroid.Y < b.MinY) - d2 = Math.Max(b.MinX - t.Centroid.X, b.MinY - t.Centroid.Y); - else if (t.Centroid.Y > b.MaxY) - d2 = Math.Max(b.MinX - t.Centroid.X, t.Centroid.Y - b.MaxY); - else // if (b.MinY < t.Centroid.Y)&&(t.Centroid.Y < b.MaxY) - d2 = b.MinX - t.Centroid.X; - } - else if (t.Centroid.X > b.MaxX) - { - if (t.Centroid.Y < b.MinY) - d2 = Math.Max(t.Centroid.X - b.MaxX, b.MinY - t.Centroid.Y); - else if (t.Centroid.Y > b.MaxY) - d2 = Math.Max(t.Centroid.X - b.MaxX, t.Centroid.Y - b.MaxY); - else - d2 = t.Centroid.X - b.MaxX; - } - else // if (b.MinX =< t.Centroid.X) && (t.Centroid.X =< b.MaxX) - { - if (t.Centroid.Y < b.MinY) - d2 = b.MinY - t.Centroid.Y; - else if (t.Centroid.Y > b.MaxY) - d2 = t.Centroid.Y - b.MaxY; - else - return 0.0; - } - - return Math.Min(d1, d2); - } - - private static void GetClusterForBlob(int blobPos, ProximityMatrix close, - int nBlobs, int nTracks, CvBlobs blobs, CvTracks tracks, - List bb, List tt) - { - retry: - var retryList = new List(); - - for (int j = 0; j < nTracks; j++) - { - if (close[blobPos, j] != 0) - { - int it = close.IT[j]; - tt.Add(tracks[it]); - - int c = close.AT[j]; - - close[blobPos, j] = 0; - close.AB[blobPos]--; - close.AT[j]--; - - if (c > 1) - { - retryList.Add(j); - //GetClusterForTrack(j, close, nBlobs, nTracks, blobs, tracks, bb, tt); - } - } - } - - if (retryList.Count > 0) - { - foreach (int j in retryList) - { - GetClusterForTrack(j, close, nBlobs, nTracks, blobs, tracks, bb, tt); - } - goto retry; - } - } - - private static void GetClusterForTrack(int trackPos, ProximityMatrix close, - int nBlobs, int nTracks, CvBlobs blobs, - CvTracks tracks, List bb, List tt) - { - retry: - var retryList = new List(); - - for (int i = 0; i < nBlobs; i++) - { - if (close[i, trackPos] != 0) - { - int ib = close.IB[i]; - bb.Add(blobs[ib]); - - int c = close.AB[i]; - - close[i, trackPos] = 0; - close.AB[i]--; - close.AT[trackPos]--; - - if (c > 1) - { - retryList.Add(i); - //GetClusterForBlob(i, close, nBlobs, nTracks, blobs, tracks, bb, tt); - } - } - } - - if (retryList.Count > 0) - { - foreach (int i in retryList) - { - GetClusterForBlob(i, close, nBlobs, nTracks, blobs, tracks, bb, tt); - } - goto retry; - } - } - - #endregion - - /// - /// - /// - /// - public CvBlobs Clone() - { - var newBlobs = new CvBlobs(); - foreach (KeyValuePair pair in this) - { - newBlobs.Add(pair.Key, pair.Value); - } - newBlobs.Labels = Labels.Clone(); - - return newBlobs; - } - - #endregion - } -} diff --git a/src/OpenCvSharp.Blob/CvChainCode.cs b/src/OpenCvSharp.Blob/CvChainCode.cs deleted file mode 100644 index f020817b7..000000000 --- a/src/OpenCvSharp.Blob/CvChainCode.cs +++ /dev/null @@ -1,44 +0,0 @@ - -#pragma warning disable 1591 - -namespace OpenCvSharp.Blob -{ - /// - /// Chain code (direction) - /// - public enum CvChainCode : byte - { - /// - /// Up. - /// - Up = CvBlobConst.CV_CHAINCODE_UP, - /// - /// Up and right. - /// - UpRight = CvBlobConst.CV_CHAINCODE_UP_RIGHT, - /// - /// Right. - /// - Right = CvBlobConst.CV_CHAINCODE_RIGHT, - /// - /// Down and right. - /// - DownRight = CvBlobConst.CV_CHAINCODE_DOWN_RIGHT, - /// - /// Down. - /// - Down = CvBlobConst.CV_CHAINCODE_DOWN, - /// - /// Down and left. - /// - DownLeft = CvBlobConst.CV_CHAINCODE_DOWN_LEFT, - /// - /// Left. - /// - Left = CvBlobConst.CV_CHAINCODE_LEFT, - /// - /// Up and left. - /// - UpLeft = CvBlobConst.CV_CHAINCODE_UP_LEFT, - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.Blob/CvContourChainCode.cs b/src/OpenCvSharp.Blob/CvContourChainCode.cs deleted file mode 100644 index eaf294d79..000000000 --- a/src/OpenCvSharp.Blob/CvContourChainCode.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -using System; -using System.Collections.Generic; - -namespace OpenCvSharp.Blob -{ - /// - /// - /// - public class CvContourChainCode - { - /// - /// Point where contour begin. - /// - public Point StartingPoint { get; set; } - - /// - /// Polygon description based on chain codes. - /// - public List ChainCode { get; set; } - - /// - /// - /// - public CvContourChainCode() - { - StartingPoint = default(Point); - ChainCode = new List(); - } - - /// - /// Convert a chain code contour to a polygon. - /// - /// A polygon. - public CvContourPolygon ConvertToPolygon() - { - CvContourPolygon contour = new CvContourPolygon(); - - int x = StartingPoint.X; - int y = StartingPoint.Y; - contour.Add(new Point(x, y)); - - if (ChainCode.Count > 0) - { - CvChainCode lastCode = ChainCode[0]; - x += CvBlobConst.ChainCodeMoves[(int) ChainCode[0]][0]; - y += CvBlobConst.ChainCodeMoves[(int) ChainCode[0]][1]; - for (int i = 1; i < ChainCode.Count; i++) - { - if (lastCode != ChainCode[i]) - { - contour.Add(new Point(x, y)); - lastCode = ChainCode[i]; - } - x += CvBlobConst.ChainCodeMoves[(int) ChainCode[i]][0]; - y += CvBlobConst.ChainCodeMoves[(int) ChainCode[i]][1]; - } - } - - return contour; - } - - /// - /// Calculates perimeter of a polygonal contour. - /// - /// Perimeter of the contour. - public double Perimeter() - { - double perimeter = 0.0; - foreach (CvChainCode cc in ChainCode) - { - int type = (int) cc; - if (type%2 != 0) - perimeter += Math.Sqrt(1.0 + 1.0); - else - perimeter += 1.0; - } - return perimeter; - } - - /// - /// Draw a contour. - /// - /// Image to draw on. - public void Render(Mat img) - { - Render(img, new Scalar(255, 255, 255)); - } - - /// - /// Draw a contour. - /// - /// Image to draw on. - /// Color to draw (default, white). - public void Render(Mat img, Scalar color) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (img.Type() != MatType.CV_8UC3) - throw new ArgumentException("Invalid img format (U8 3-channels)"); - - var indexer = img.GetGenericIndexer(); - int x = StartingPoint.X; - int y = StartingPoint.Y; - foreach (CvChainCode cc in ChainCode) - { - indexer[y, x] = new Vec3b((byte) color.Val0, (byte) color.Val1, (byte) color.Val2); - x += CvBlobConst.ChainCodeMoves[(int) cc][0]; - y += CvBlobConst.ChainCodeMoves[(int) cc][1]; - } - } - - /// - /// - /// - /// - public CvContourChainCode Clone() - { - return new CvContourChainCode - { - ChainCode = new List(ChainCode), - StartingPoint = StartingPoint, - }; - } - } -} diff --git a/src/OpenCvSharp.Blob/CvContourPolygon.cs b/src/OpenCvSharp.Blob/CvContourPolygon.cs deleted file mode 100644 index 9d8b28f84..000000000 --- a/src/OpenCvSharp.Blob/CvContourPolygon.cs +++ /dev/null @@ -1,446 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -namespace OpenCvSharp.Blob -{ - /// - /// Polygon based contour. - /// - public class CvContourPolygon : List - { - /// - /// - /// - public CvContourPolygon() - { - } - - /// - /// - /// - /// - public CvContourPolygon(IEnumerable list) - : base(list) - { - } - - /// - /// Converts this to CSV string - /// - /// - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - foreach (Point p in this) - { - sb.AppendFormat("{0},{1}", p.X, p.Y).AppendLine(); - } - return sb.ToString(); - } - - #region Area - - /// - /// Calculates area of a polygonal contour. - /// - /// Area of the contour. - public double Area() - { - if (Count <= 2) - return 1.0; - - Point lastPoint = this[Count - 1]; - double area = 0.0; - foreach (Point point in this) - { - area += lastPoint.X*point.Y - lastPoint.Y*point.X; - lastPoint = point; - } - return area*0.5; - } - - #endregion - - #region Circularity - - /// - /// Calculates the circularity of a polygon (compactness measure). - /// - /// Circularity: a non-negative value, where 0 correspond with a circumference. - public double Circularity() - { - double l = Perimeter(); - double c = (l*l/Area()) - 4.0*Math.PI; - - if (c >= 0.0) - return c; - // This could happen if the blob it's only a pixel: the perimeter will be 0. Another solution would be to force "cvContourPolygonPerimeter" to be 1 or greater. - return 0.0; - } - - #endregion - - #region ContourConvexHull - - /// - /// Calculates convex hull of a contour. - /// Uses the Melkman Algorithm. Code based on the version in http://w3.impa.br/~rdcastan/Cgeometry/. - /// - /// Convex hull. - public CvContourPolygon ContourConvexHull() - { - if (Count <= 3) - return new CvContourPolygon(this); - - var dq = new List(); // instead of std::deq... - - if (CrossProductPoints(this[0], this[1], this[2]) > 0) - { - dq.Add(this[0]); - dq.Add(this[1]); - } - else - { - dq.Add(this[1]); - dq.Add(this[0]); - } - - dq.Add(this[2]); - dq.Insert(0, this[2]); - - for (int i = 3; i < Count; i++) - { - int s = dq.Count; - - if ((CrossProductPoints(this[i], dq[0], dq[1]) >= 0) && - (CrossProductPoints(dq[s - 2], dq[s - 1], this[i]) >= 0)) - continue; // TODO Optimize. - - while (CrossProductPoints(dq[s - 2], dq[s - 1], this[i]) < 0) - { - dq.RemoveAt(dq.Count - 1); - s = dq.Count; - } - - dq.Add(this[i]); - - while (CrossProductPoints(this[i], dq[0], dq[1]) < 0) - dq.RemoveAt(0); - - dq.Insert(0, this[i]); - } - - return new CvContourPolygon(dq); - } - - private static double CrossProductPoints(Point a, Point b, Point c) - { - double abx = b.X - a.X; - double aby = b.Y - a.Y; - double acx = c.X - a.X; - double acy = c.Y - a.Y; - return abx*acy - aby*acx; - } - - #endregion - - #region ContourPolygonPerimeter - - /// - /// Calculates perimeter of a chain code contour. - /// - /// Perimeter of the contour. - public double Perimeter() - { - double perimeter = DistancePointPoint(this[Count - 1], this[0]); - for (int i = 0; i < Count - 1; i++) - { - perimeter += DistancePointPoint(this[i], this[i + 1]); - } - return perimeter; - } - - private static double DistancePointPoint(Point a, Point b) - { - double abx = a.X - b.X; - double aby = a.Y - b.Y; - return Math.Sqrt(abx*abx + aby*aby); - } - - #endregion - - #region Render - - /// - /// Draw a polygon. - /// - /// Image to draw on. - public void Render(Mat img) - { - Render(img, new Scalar(255, 255, 255)); - } - - /// - /// Draw a polygon. - /// - /// Image to draw on. - /// Color to draw (default, white). - public void Render(Mat img, Scalar color) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (img.Type() != MatType.CV_8UC3) - throw new ArgumentException("Invalid img format (U8 3-channels)"); - - if (Count == 0) - return; - - int fx = this[Count - 1].X; - int fy = this[Count - 1].Y; - foreach (Point p in this) - { - Cv2.Line(img, fx, fy, p.X, p.Y, color); - fx = p.X; - fy = p.Y; - } - } - - #endregion - - #region SimplifyPolygon - - /// - /// Simplify a polygon reducing the number of vertex according the distance "delta". - /// Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm). - /// - /// A simplify version of the original polygon. - public CvContourPolygon Simplify() - { - return Simplify(1.0); - } - - /// - /// Simplify a polygon reducing the number of vertex according the distance "delta". - /// Uses a version of the Ramer-Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm). - /// - /// Minimun distance. - /// A simplify version of the original polygon. - public CvContourPolygon Simplify(double delta) - { - double furtherDistance = 0.0; - int furtherIndex = 0; - - if (Count == 0) - return new CvContourPolygon(); - - for (int i = 1; i < Count; i++) - { - double d = DistancePointPoint(this[i], this[0]); - if (d > furtherDistance) - { - furtherDistance = d; - furtherIndex = i; - } - } - - if (furtherDistance < delta) - { - CvContourPolygon result = new CvContourPolygon(); - result.Add(this[0]); - return result; - } - else - { - bool[] pnUseFlag = new bool[Count]; - for (int i = 1; i < Count; i++) - pnUseFlag[i] = false; - - pnUseFlag[0] = pnUseFlag[furtherIndex] = true; - - SimplifyPolygonRecursive(this, 0, furtherIndex, pnUseFlag, delta); - SimplifyPolygonRecursive(this, furtherIndex, -1, pnUseFlag, delta); - - CvContourPolygon result = new CvContourPolygon(); - - for (int i = 0; i < Count; i++) - { - if (pnUseFlag[i]) - result.Add(this[i]); - } - return result; - } - } - - private static void SimplifyPolygonRecursive(CvContourPolygon p, int i1, int i2, bool[] pnUseFlag, double delta) - { - int endIndex = (i2 < 0) ? p.Count : i2; - - if (Math.Abs(i1 - endIndex) <= 1) - return; - - Point firstPoint = p[i1]; - Point lastPoint = (i2 < 0) ? p[0] : p[i2]; - - double furtherDistance = 0.0; - int furtherIndex = 0; - - for (int i = i1 + 1; i < endIndex; i++) - { - double d = DistanceLinePoint(firstPoint, lastPoint, p[i]); - - if ((d >= delta) && (d > furtherDistance)) - { - furtherDistance = d; - furtherIndex = i; - } - } - - if (furtherIndex > 0) - { - pnUseFlag[furtherIndex] = true; - - SimplifyPolygonRecursive(p, i1, furtherIndex, pnUseFlag, delta); - SimplifyPolygonRecursive(p, furtherIndex, i2, pnUseFlag, delta); - } - } - - private static double DistanceLinePoint(Point a, Point b, Point c, bool isSegment = true) - { - if (isSegment) - { - double dot1 = DotProductPoints(a, b, c); - if (dot1 > 0) return DistancePointPoint(b, c); - - double dot2 = DotProductPoints(b, a, c); - if (dot2 > 0) return DistancePointPoint(a, c); - } - return Math.Abs(CrossProductPoints(a, b, c)/DistancePointPoint(a, b)); - } - - private static double DotProductPoints(Point a, Point b, Point c) - { - double abx = b.X - a.X; - double aby = b.Y - a.Y; - double bcx = c.X - b.X; - double bcy = c.Y - b.Y; - return abx*bcx + aby*bcy; - } - - #endregion - - #region WriteAsCsv - - /// - /// Write a contour to a CSV (Comma-separated values) file. - /// - /// File name. - public void WriteAsCsv(string fileName) - { -#if uwp - throw new NotImplementedException(); -#else - using (var stream = new FileStream(fileName, FileMode.Create)) - using (var writer = new StreamWriter(stream)) - { - writer.Write(ToString()); - } -#endif - } - -#endregion - -#region WriteAsSvg - - /// - /// Write a contour to a SVG file. - /// - /// File name - public void WriteAsSvg(string fileName) - { - WriteAsSvg(fileName, Scalar.Black, Scalar.White); - } - - /// - /// Write a contour to a SVG file. - /// - /// File name - /// Stroke color - /// Fill color - public void WriteAsSvg(string fileName, Scalar stroke, Scalar fill) - { -#if uwp - throw new NotImplementedException(); -#else - using (var stream = new FileStream(fileName, FileMode.Create)) - using (var writer = new StreamWriter(stream)) - { - writer.WriteLine(ToSvg(stroke, fill)); - } -#endif - } - - /// - /// - /// - /// - /// - /// - public string ToSvg(Scalar stroke, Scalar fill) - { - int minx = Int32.MaxValue; - int miny = Int32.MaxValue; - int maxx = Int32.MinValue; - int maxy = Int32.MinValue; - - var buffer = new StringBuilder(); - foreach (Point p in this) - { - if (p.X > maxx) - maxx = p.X; - if (p.X < minx) - minx = p.X; - if (p.Y > maxy) - maxy = p.Y; - if (p.Y < miny) - miny = p.Y; - buffer.AppendFormat("{0},{1} ", p.X, p.Y); - } - - var builder = new StringBuilder() - .AppendLine("") - .AppendLine( - "") - .AppendFormat( - "", - maxx - minx, maxy - miny, minx, miny, maxx, maxy).AppendLine() - .AppendFormat( - "", - fill.Val0, fill.Val1, fill.Val2, stroke.Val0, stroke.Val1, stroke.Val2, buffer).AppendLine() - .AppendLine(""); - return builder.ToString(); - } - -#endregion - } -} diff --git a/src/OpenCvSharp.Blob/CvTrack.cs b/src/OpenCvSharp.Blob/CvTrack.cs deleted file mode 100644 index 04fd0b242..000000000 --- a/src/OpenCvSharp.Blob/CvTrack.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -namespace OpenCvSharp.Blob -{ - /// - /// Struct that contain information about one track. - /// - public class CvTrack - { - /// - /// Track identification number. - /// - public int Id { get; set; } - - /// - /// Label assigned to the blob related to this track. - /// - public int Label { get; set; } - - /// - /// X min. - /// - public int MinX { get; set; } - /// - /// X max. - /// - public int MaxX { get; set; } - /// - /// Y min. - /// - public int MinY { get; set; } - /// - /// Y max. - /// - public int MaxY { get; set; } - - /// - /// Centroid. - /// - public Point2d Centroid { get; set; } - - /// - /// Indicates how much frames the object has been in scene. - /// - public int LifeTime { get; set; } - /// - /// Indicates number of frames that has been active from last inactive period. - /// - public int Active { get; set; } - /// - /// Indicates number of frames that has been missing. - /// - public int Inactive { get; set; } - } -} diff --git a/src/OpenCvSharp.Blob/CvTracks.cs b/src/OpenCvSharp.Blob/CvTracks.cs deleted file mode 100644 index 730fde991..000000000 --- a/src/OpenCvSharp.Blob/CvTracks.cs +++ /dev/null @@ -1,146 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -namespace OpenCvSharp.Blob -{ - /// - /// - /// - public class CvTracks : Dictionary - { - /// - /// - /// - public CvTracks() - { - } - - #region Render - - /// - /// Prints tracks information. - /// - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - public void Render(Mat imgSource, Mat imgDest) - { - Render(imgSource, imgDest, RenderTracksMode.Id, Scalar.Green); - } - - /// - /// Prints tracks information. - /// - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_TRACK_RENDER_ID. - public void Render(Mat imgSource, Mat imgDest, RenderTracksMode mode) - { - Render(imgSource, imgDest, mode, Scalar.Green); - } - - /// - /// Prints tracks information. - /// - /// Input image (depth=IPL_DEPTH_8U and num. channels=3). - /// Output image (depth=IPL_DEPTH_8U and num. channels=3). - /// Render mode. By default is CV_TRACK_RENDER_ID. - /// - /// - /// - /// - public void Render(Mat imgSource, Mat imgDest, RenderTracksMode mode, Scalar textColor, - HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1) - { - if (imgSource == null) - throw new ArgumentNullException(nameof(imgSource)); - if (imgDest == null) - throw new ArgumentNullException(nameof(imgDest)); - if (imgDest.Type() != MatType.CV_8UC3) - throw new ArgumentException("imgDest.Depth != U8 || imgDest.NChannels != 3"); - - if (mode != RenderTracksMode.None) - { - foreach (KeyValuePair kv in this) - { - int key = kv.Key; - CvTrack value = kv.Value; - - if ((mode & RenderTracksMode.Id) == RenderTracksMode.Id) - { - if (value.Inactive == 0) - { - Cv2.PutText(imgDest, key.ToString(), value.Centroid, - fontFace, fontScale, textColor, thickness); - } - } - if ((mode & RenderTracksMode.BoundingBox) == RenderTracksMode.BoundingBox) - { - if (value.Inactive > 0) - Cv2.Rectangle( - imgDest, - new Point(value.MinX, value.MinY), - new Point(value.MaxX - 1, value.MaxY - 1), - new Scalar(50, 0, 0)); - else - Cv2.Rectangle( - imgDest, - new Point(value.MinX, value.MinY), - new Point(value.MaxX - 1, value.MaxY - 1), - new Scalar(255, 0, 0)); - } - } - } - } - - #endregion - - #region ToString - - /// - /// - /// - /// - public override string ToString() - { - StringBuilder builder = new StringBuilder(); - foreach (KeyValuePair kv in this) - { - CvTrack value = kv.Value; - - builder.AppendFormat("Track {0}", value).AppendLine(); - if (value.Inactive > 0) - builder.AppendFormat(" - Inactive for {0} frames", value.Inactive).AppendLine(); - else - builder.AppendFormat(" - Associated with blobs {0}", value.Label).AppendLine(); - builder.AppendFormat(" - Lifetime {0}", value.LifeTime).AppendLine(); - builder.AppendFormat(" - Active {0}", value.Active).AppendLine(); - builder.AppendFormat(" - Bounding box: ({0},{1}) - ({2}, {3})", - value.MinX, value.MinY, value.MaxX, value.MaxY).AppendLine(); - builder.AppendFormat(" - Centroid: ({0}, {1})", value.Centroid.X, value.Centroid.Y).AppendLine(); - builder.AppendLine(); - } - return builder.ToString(); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.Blob/Key.snk b/src/OpenCvSharp.Blob/Key.snk deleted file mode 100644 index a1e033087..000000000 Binary files a/src/OpenCvSharp.Blob/Key.snk and /dev/null differ diff --git a/src/OpenCvSharp.Blob/LabelData.cs b/src/OpenCvSharp.Blob/LabelData.cs deleted file mode 100644 index 2b59b98b8..000000000 --- a/src/OpenCvSharp.Blob/LabelData.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; - -namespace OpenCvSharp.Blob -{ - /// - /// Label values for each pixel - /// - public class LabelData - { - private Size size; - private int[,] values; - - /// - /// Label value - /// - public int[,] Values - { - get { return values; } - } - - /// - /// Image sizw - /// - public Size Size - { - get { return size; } - } - - /// - /// Row length - /// - public int Rows - { - get { return Values.GetLength(0); } - } - - /// - /// Column Length - /// - public int Cols - { - get { return Values.GetLength(1); } - } - - /// - /// - /// - /// - /// - public LabelData(int rows, int cols) - { - values = new int[rows, cols]; - size = new Size(cols, rows); - } - - /// - /// - /// - /// - public LabelData(int[,] values) - { - values = (int[,]) values.Clone(); - size.Height = values.GetLength(0); - size.Width = values.GetLength(1); - } - - /// - /// - /// - /// - /// - public LabelData(int[,] values, Rect roi) - { - values = (int[,]) values.Clone(); - } - - /// - /// - /// - /// - /// - /// - public int RawGetLabel(int row, int col) - { - return Values[row, col]; - } - - /// - /// - /// - /// - /// - /// - public void RawSetLabel(int row, int col, int value) - { - Values[row, col] = value; - } - - /// - /// - /// - /// - /// - /// - public int this[int row, int col] - { - get { return Values[row, col]; } - set { Values[row, col] = value; } - } - - /// - /// - /// - public void DebugShow() - { - using (Mat img = Mat.Zeros(Rows, Cols, MatType.CV_8UC1)) - { - var indexer = img.GetGenericIndexer(); - for (int r = 0; r < Rows; r++) - { - for (int c = 0; c < Cols; c++) - { - if (Values[r, c] != 0) - indexer[r, c] = 255; - } - } - Window.ShowImages(img); - } - } - - /// - /// Returns deep copied instance of this - /// - /// - public LabelData Clone() - { - return new LabelData((int[,]) Values.Clone()); - } - } -} diff --git a/src/OpenCvSharp.Blob/Labeller.cs b/src/OpenCvSharp.Blob/Labeller.cs deleted file mode 100644 index 3a87c1dc2..000000000 --- a/src/OpenCvSharp.Blob/Labeller.cs +++ /dev/null @@ -1,360 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; - -// Copyright (C) 2007 by Cristóbal Carnero Liñán -// grendel.ccl@gmail.com -// -// This file is part of cvBlob. -// -// cvBlob is free software: you can redistribute it and/or modify -// it under the terms of the Lesser GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// cvBlob is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// Lesser GNU General Public License for more details. -// -// You should have received a copy of the Lesser GNU General Public License -// along with cvBlob. If not, see . - -namespace OpenCvSharp.Blob -{ - /// - /// - /// - internal static class Labeller - { - private static readonly int[,,] MovesE = new int[4, 3, 4] - { - { - {-1, -1, 3, CvBlobConst.CV_CHAINCODE_UP_LEFT}, {0, -1, 0, CvBlobConst.CV_CHAINCODE_UP}, - {1, -1, 0, CvBlobConst.CV_CHAINCODE_UP_RIGHT} - }, - { - {1, -1, 0, CvBlobConst.CV_CHAINCODE_UP_RIGHT}, {1, 0, 1, CvBlobConst.CV_CHAINCODE_RIGHT}, - {1, 1, 1, CvBlobConst.CV_CHAINCODE_DOWN_RIGHT} - }, - { - {1, 1, 1, CvBlobConst.CV_CHAINCODE_DOWN_RIGHT}, {0, 1, 2, CvBlobConst.CV_CHAINCODE_DOWN}, - {-1, 1, 2, CvBlobConst.CV_CHAINCODE_DOWN_LEFT} - }, - { - {-1, 1, 2, CvBlobConst.CV_CHAINCODE_DOWN_LEFT}, {-1, 0, 3, CvBlobConst.CV_CHAINCODE_LEFT}, - {-1, -1, 3, CvBlobConst.CV_CHAINCODE_UP_LEFT} - } - }; - - private static readonly int[,,] MovesI = new int[4, 3, 4] - { - { - {1, -1, 3, CvBlobConst.CV_CHAINCODE_UP_RIGHT}, {0, -1, 0, CvBlobConst.CV_CHAINCODE_UP}, - {-1, -1, 0, CvBlobConst.CV_CHAINCODE_UP_LEFT} - }, - { - {-1, -1, 0, CvBlobConst.CV_CHAINCODE_UP_LEFT}, {-1, 0, 1, CvBlobConst.CV_CHAINCODE_LEFT}, - {-1, 1, 1, CvBlobConst.CV_CHAINCODE_DOWN_LEFT} - }, - { - {-1, 1, 1, CvBlobConst.CV_CHAINCODE_DOWN_LEFT}, {0, 1, 2, CvBlobConst.CV_CHAINCODE_DOWN}, - {1, 1, 2, CvBlobConst.CV_CHAINCODE_DOWN_RIGHT} - }, - { - {1, 1, 2, CvBlobConst.CV_CHAINCODE_DOWN_RIGHT}, {1, 0, 3, CvBlobConst.CV_CHAINCODE_RIGHT}, - {1, -1, 3, CvBlobConst.CV_CHAINCODE_UP_RIGHT} - } - }; - - /// - /// Value of invalid pixel. - /// -1 == uint.MaxValue - /// - private const int MarkerValue = -1; - - /// - /// - /// - /// - /// - /// - public static int Perform(Mat img, CvBlobs blobs) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (blobs == null) - throw new ArgumentNullException(nameof(blobs)); - if (img.Type() != MatType.CV_8UC1) - throw new ArgumentException("'img' must be a 1-channel U8 image."); - - LabelData labels = blobs.Labels; - if (labels == null) - throw new ArgumentException(""); - //if(labels.GetLength(0) != h || labels.GetLength(1) != w) - if (labels.Rows != img.Height || labels.Cols != img.Width) - throw new ArgumentException("img.Size != labels' size"); - - int numPixels = 0; - blobs.Clear(); - - int w = img.Cols; - int h = img.Rows; - int step = (int)img.Step(); - byte[] imgIn; - unsafe - { - byte* imgInPtr = (byte*)img.Data; - if ((long) h * step > Int32.MaxValue) - throw new ArgumentException("Too big image (image data > 2^31)"); - int length = h * step; - imgIn = new byte[length]; - Marshal.Copy(new IntPtr(imgInPtr), imgIn, 0, imgIn.Length); - } - int label = 0; - int lastLabel = 0; - CvBlob lastBlob = null; - - - for (int y = 0; y < h; y++) - { - for (int x = 0; x < w; x++) - { - if (imgIn[x + y * step] == 0) - continue; - - bool labeled = labels[y, x] != 0; - if (!labeled && ((y == 0) || (imgIn[x + (y - 1) * step] == 0))) - { - labeled = true; - - // Label contour. - label++; - if (label == MarkerValue) - throw new Exception(); - - labels[y, x] = label; - numPixels++; - - // XXX This is not necessary at all. I only do this for consistency. - if (y > 0) - labels[y - 1, x] = MarkerValue; - - CvBlob blob = new CvBlob(label, x, y); - blobs.Add(label, blob); - lastLabel = label; - lastBlob = blob; - - blob.Contour.StartingPoint = new Point(x, y); - int direction = 1; - int xx = x; - int yy = y; - bool contourEnd = false; - - do - { - for (int numAttempts = 0; numAttempts < 3; numAttempts++) - { - bool found = false; - for (int i = 0; i < 3; i++) - { - int nx = xx + MovesE[direction, i, 0]; - int ny = yy + MovesE[direction, i, 1]; - if ((nx < w) && (nx >= 0) && (ny < h) && (ny >= 0)) - { - if (imgIn[nx + ny * step] != 0) - { - found = true; - blob.Contour.ChainCode.Add((CvChainCode)MovesE[direction, i, 3]); - xx = nx; - yy = ny; - direction = MovesE[direction, i, 2]; - break; - } - labels[ny, nx] = MarkerValue; - } - } - - if (!found) - direction = (direction + 1) % 4; - else - { - if (labels[yy, xx] != label) - { - labels[yy, xx] = label; - numPixels++; - - if (xx < blob.MinX) - blob.MinX = xx; - else if (xx > blob.MaxX) - blob.MaxX = xx; - if (yy < blob.MinY) - blob.MinY = yy; - else if (yy > blob.MaxY) - blob.MaxY = yy; - - blob.Area++; - blob.M10 += xx; - blob.M01 += yy; - blob.M11 += xx * yy; - blob.M20 += xx * xx; - blob.M02 += yy * yy; - } - break; - } - - contourEnd = ((xx == x) && (yy == y) && (direction == 1)); - if (contourEnd) - break; - } - } while (!contourEnd); - - } - - if ((y + 1 < h) && (imgIn[x + (y + 1) * step] == 0) && (labels[y + 1, x] == 0)) - { - labeled = true; - - // Label internal contour - int l; - CvBlob blob; - - if (labels[y, x] == 0) - { - l = labels[y, x - 1]; - labels[y, x] = l; - numPixels++; - - if (l == lastLabel) - blob = lastBlob; - else - { - blob = blobs[l]; - lastLabel = l; - lastBlob = blob; - } - if (blob == null) - throw new Exception(); - blob.Area++; - blob.M10 += x; - blob.M01 += y; - blob.M11 += x * y; - blob.M20 += x * x; - blob.M02 += y * y; - } - else - { - l = labels[y, x]; - if (l == lastLabel) - blob = lastBlob; - else - { - blob = blobs[l]; - lastLabel = l; - lastBlob = blob; - } - } - - if (blob == null) - throw new Exception(); - - // XXX This is not necessary (I believe). I only do this for consistency. - labels[y + 1, x] = MarkerValue; - var contour = new CvContourChainCode - { - StartingPoint = new Point(x, y) - }; - - int direction = 3; - int xx = x; - int yy = y; - - do - { - for (int numAttempts = 0; numAttempts < 3; numAttempts++) - { - bool found = false; - - for (int i = 0; i < 3; i++) - { - int nx = xx + MovesI[direction, i, 0]; - int ny = yy + MovesI[direction, i, 1]; - if (imgIn[nx + ny * step] != 0) - { - found = true; - contour.ChainCode.Add((CvChainCode)MovesI[direction, i, 3]); - xx = nx; - yy = ny; - direction = MovesI[direction, i, 2]; - break; - } - labels[ny, nx] = MarkerValue; - } - - if (!found) - direction = (direction + 1) % 4; - else - { - if (labels[yy, xx] == 0) - { - labels[yy, xx] = l; - numPixels++; - - blob.Area++; - blob.M10 += xx; - blob.M01 += yy; - blob.M11 += xx * yy; - blob.M20 += xx * xx; - blob.M02 += yy * yy; - } - break; - } - } - } while (!(xx == x && yy == y)); - - blob.InternalContours.Add(contour); - } - - //else if (!imageOut(x, y)) - if (!labeled) - { - // Internal pixel - int l = labels[y, x - 1]; - labels[y, x] = l; - numPixels++; - - CvBlob blob; - if (l == lastLabel) - blob = lastBlob; - else - { - blob = blobs[l]; - lastLabel = l; - lastBlob = blob; - } - if (blob == null) - throw new Exception(); - blob.Area++; - blob.M10 += x; - blob.M01 += y; - blob.M11 += x * y; - blob.M20 += x * x; - blob.M02 += y * y; - } - } - } - - - foreach (var kv in blobs) - { - kv.Value.SetMoments(); - } - - GC.KeepAlive(img); - - return numPixels; - } - } -} diff --git a/src/OpenCvSharp.Blob/OpenCvSharp.Blob.xproj b/src/OpenCvSharp.Blob/OpenCvSharp.Blob.xproj deleted file mode 100644 index 13e90b7e2..000000000 --- a/src/OpenCvSharp.Blob/OpenCvSharp.Blob.xproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 82afda65-515e-4ec0-a415-77d8a6711508 - OpenCvSharp.Blob - .\obj - .\bin\ - v4.5 - - - 2.0 - - - - - - - - \ No newline at end of file diff --git a/src/OpenCvSharp.Blob/Properties/AssemblyInfo.cs b/src/OpenCvSharp.Blob/Properties/AssemblyInfo.cs deleted file mode 100644 index 76cdbd357..000000000 --- a/src/OpenCvSharp.Blob/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.Blob")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("82afda65-515e-4ec0-a415-77d8a6711508")] diff --git a/src/OpenCvSharp.Blob/ProximityMatrix.cs b/src/OpenCvSharp.Blob/ProximityMatrix.cs deleted file mode 100644 index 686eda344..000000000 --- a/src/OpenCvSharp.Blob/ProximityMatrix.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Blob -{ - internal class ProximityMatrix - { - private readonly int[] close; - private readonly int nBlobs; - private readonly int nTtacks; - - public ProximityMatrix(int nBlobs, int nTracks) - { - this.nBlobs = nBlobs; - this.nTtacks = nTracks; - this.close = new int[(nBlobs + 2) * (nTracks + 2)]; - AB = new ABIndexer(this); - AT = new ATIndexer(this); - IB = new IBIndexer(this); - IT = new ITIndexer(this); - } - - public int this[int blob, int track] - { - get - { - return close[((blob) + (track) * (nBlobs + 2))]; - } - set - { - close[((blob) + (track) * (nBlobs + 2))] = value; - } - } - - #region Indexer - public abstract class Indexer - { - protected ProximityMatrix matrix; - protected Indexer(ProximityMatrix matrix) - { - this.matrix = matrix; - } - public abstract int this[int index] { get; set; } - } - public class ABIndexer : Indexer - { - internal ABIndexer(ProximityMatrix matrix) - : base(matrix) - { - } - public override int this[int label] - { - get { return matrix[label, matrix.nTtacks]; } - set { matrix[label, matrix.nTtacks] = value; } - } - } - public class ATIndexer : Indexer - { - internal ATIndexer(ProximityMatrix matrix) - : base(matrix) - { - } - public override int this[int id] - { - get { return matrix[matrix.nBlobs, id]; } - set { matrix[matrix.nBlobs, id] = value; } - } - } - public class IBIndexer : Indexer - { - internal IBIndexer(ProximityMatrix matrix) - : base(matrix) - { - } - public override int this[int label] - { - get { return matrix[label, matrix.nTtacks + 1]; } - set { matrix[label, matrix.nTtacks + 1] = value; } - } - } - public class ITIndexer : Indexer - { - internal ITIndexer(ProximityMatrix matrix) - : base(matrix) - { - } - public override int this[int id] - { - get { return matrix[matrix.nBlobs + 1, id]; } - set { matrix[matrix.nBlobs + 1, id] = value; } - } - } - - public ABIndexer AB { get; private set; } - public ATIndexer AT { get; private set; } - public IBIndexer IB { get; private set; } - public ITIndexer IT { get; private set; } - #endregion - } -} diff --git a/src/OpenCvSharp.Blob/ReadMe.txt b/src/OpenCvSharp.Blob/ReadMe.txt deleted file mode 100644 index 0c8268a9d..000000000 --- a/src/OpenCvSharp.Blob/ReadMe.txt +++ /dev/null @@ -1,3 +0,0 @@ -This project "OpenCvSharp.Blob" is a wrapper of cvblob (http://code.google.com/p/cvblob/). - -cvblob and OpenCvSharp are licensed using the LGPL (http://www.gnu.org/licenses/lgpl.html). diff --git a/src/OpenCvSharp.Blob/RenderBlobsMode.cs b/src/OpenCvSharp.Blob/RenderBlobsMode.cs deleted file mode 100644 index 4923cc2fe..000000000 --- a/src/OpenCvSharp.Blob/RenderBlobsMode.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Blob -{ - /// - /// Render mode of cvRenderBlobs - /// - [Flags] - public enum RenderBlobsMode : ushort - { - /// - /// No flags (=0) - /// - None = 0, - - /// - /// Render each blog with a different color. - /// [CV_BLOB_RENDER_COLOR] - /// - Color = CvBlobConst.CV_BLOB_RENDER_COLOR, - - /// - /// Render centroid. - /// CV_BLOB_RENDER_CENTROID] - /// - Centroid = CvBlobConst.CV_BLOB_RENDER_CENTROID, - - /// - /// Render bounding box. - /// [CV_BLOB_RENDER_BOUNDING_BOX] - /// - BoundingBox = CvBlobConst.CV_BLOB_RENDER_BOUNDING_BOX, - - /// - /// Render angle. - /// [CV_BLOB_RENDER_ANGLE] - /// - Angle = CvBlobConst.CV_BLOB_RENDER_ANGLE, - - /// - /// Print blob data to log out. - /// [CV_BLOB_RENDER_TO_LOG] - /// - ToLog = CvBlobConst.CV_BLOB_RENDER_TO_LOG, - - /// - /// Print blob data to std out. - /// [CV_BLOB_RENDER_TO_STD] - /// - ToStd = CvBlobConst.CV_BLOB_RENDER_TO_STD, - } -} diff --git a/src/OpenCvSharp.Blob/RenderTracksMode.cs b/src/OpenCvSharp.Blob/RenderTracksMode.cs deleted file mode 100644 index 1ce026257..000000000 --- a/src/OpenCvSharp.Blob/RenderTracksMode.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Blob -{ - /// - /// Render mode of cvRenderTracks - /// - [Flags] - public enum RenderTracksMode : ushort - { - /// - /// No flags - /// [0] - /// - None = 0, - - /// - /// Print the ID of each track in the image. - /// [CV_TRACK_RENDER_ID] - /// - Id = CvBlobConst.CV_TRACK_RENDER_ID, - - /// - /// Draw bounding box of each track in the image. \see cvRenderTracks - /// [CV_TRACK_RENDER_BOUNDING_BOX] - /// - BoundingBox = CvBlobConst.CV_TRACK_RENDER_BOUNDING_BOX, - } -} diff --git a/src/OpenCvSharp.Blob/project.json b/src/OpenCvSharp.Blob/project.json deleted file mode 100644 index d32a75842..000000000 --- a/src/OpenCvSharp.Blob/project.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*" - //"System.Runtime": "4.0.20" - }, - - "frameworkAssemblies": { - }, - - "frameworks": { - "netstandard1.6": { - "imports": "dnxcore50", - "dependencies": { - } - }, - "netcoreapp1.0": { - "dependencies": { - }, - "buildOptions": { - "define": [ "netcoreapp10" ] - } - },/* - "netcore50": { - "dependencies": { - }, - "buildOptions": { - "define": [ "netcore50" ] - } - }, - "portable45-net45+win8+wpa81": { - "dependencies": { - }, - "buildOptions": { - "define": [ "uwp" ] - } - },*/ - "uap10.0": { - "dependencies": { - }, - "buildOptions": { - "define": [ "uap10" ] - } - }, - "net20": { - "dependencies": { - }, - "frameworkAssemblies": { - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net20" ] - } - }, - "net40": { - "dependencies": { - }, - "frameworkAssemblies": { - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net40" ] - } - }, - "net46": { - "dependencies": { - }, - "frameworkAssemblies": { - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net46" ] - } - } - }, - "buildOptions": { - "xmlDoc": true, - "optimize": true, - "keyFile": "Key.snk", - "allowUnsafe": true - } -} diff --git a/src/OpenCvSharp.Blob/project.lock.json b/src/OpenCvSharp.Blob/project.lock.json deleted file mode 100644 index b7ed818c2..000000000 --- a/src/OpenCvSharp.Blob/project.lock.json +++ /dev/null @@ -1,10345 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETCoreApp,Version=v1.0": { - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "debian.8-x64" - } - } - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.23-x64" - } - } - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.24-x64" - } - } - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.13.2-x64" - } - } - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.42.1-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "rhel.7-x64" - } - } - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.14.04-x64" - } - } - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.04-x64" - } - } - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.10-x64" - } - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.dll": {} - } - } - }, - ".NETFramework,Version=v2.0": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v2.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net20/OpenCvSharp.dll": {} - }, - "runtime": { - "net20/OpenCvSharp.dll": {} - } - } - }, - ".NETFramework,Version=v4.0": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net40/OpenCvSharp.dll": {} - }, - "runtime": { - "net40/OpenCvSharp.dll": {} - } - } - }, - ".NETFramework,Version=v4.6": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net46/OpenCvSharp.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.dll": {} - } - } - }, - ".NETStandard,Version=v1.6": { - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "debian.8-x64" - } - } - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.23-x64" - } - } - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.24-x64" - } - } - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.13.2-x64" - } - } - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.42.1-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "rhel.7-x64" - } - } - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.14.04-x64" - } - } - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.04-x64" - } - } - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.10-x64" - } - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETStandard,Version=v1.6", - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "compile": { - "netstandard1.6/OpenCvSharp.dll": {} - }, - "runtime": { - "netstandard1.6/OpenCvSharp.dll": {} - } - } - }, - "UAP,Version=v10.0": { - "Microsoft.CSharp/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Dynamic.Runtime": "4.0.0", - "System.Globalization": "4.0.10", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.0", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/netcore50/Microsoft.CSharp.dll": {} - }, - "runtime": { - "lib/netcore50/Microsoft.CSharp.dll": {} - } - }, - "Microsoft.NETCore/5.0.0": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.0", - "Microsoft.NETCore.Targets": "1.0.0", - "Microsoft.VisualBasic": "10.0.0", - "System.AppContext": "4.0.0", - "System.Collections": "4.0.10", - "System.Collections.Concurrent": "4.0.10", - "System.Collections.Immutable": "1.1.37", - "System.ComponentModel": "4.0.0", - "System.ComponentModel.Annotations": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tools": "4.0.0", - "System.Diagnostics.Tracing": "4.0.20", - "System.Dynamic.Runtime": "4.0.10", - "System.Globalization": "4.0.10", - "System.Globalization.Calendars": "4.0.0", - "System.Globalization.Extensions": "4.0.0", - "System.IO": "4.0.10", - "System.IO.Compression": "4.0.0", - "System.IO.Compression.ZipFile": "4.0.0", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.IO.UnmanagedMemoryStream": "4.0.0", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.Linq.Parallel": "4.0.0", - "System.Linq.Queryable": "4.0.0", - "System.Net.Http": "4.0.0", - "System.Net.NetworkInformation": "4.0.0", - "System.Net.Primitives": "4.0.10", - "System.Numerics.Vectors": "4.1.0", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.DispatchProxy": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Metadata": "1.0.22", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.Numerics": "4.0.0", - "System.Security.Claims": "4.0.0", - "System.Security.Principal": "4.0.0", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10", - "System.Threading.Tasks.Dataflow": "4.5.25", - "System.Threading.Tasks.Parallel": "4.0.0", - "System.Threading.Timer": "4.0.0", - "System.Xml.ReaderWriter": "4.0.10", - "System.Xml.XDocument": "4.0.10" - } - }, - "Microsoft.NETCore.Platforms/1.0.0": { - "type": "package" - }, - "Microsoft.NETCore.Portable.Compatibility/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Runtime": "1.0.0" - }, - "compile": { - "ref/netcore50/System.ComponentModel.DataAnnotations.dll": {}, - "ref/netcore50/System.Core.dll": {}, - "ref/netcore50/System.Net.dll": {}, - "ref/netcore50/System.Numerics.dll": {}, - "ref/netcore50/System.Runtime.Serialization.dll": {}, - "ref/netcore50/System.ServiceModel.Web.dll": {}, - "ref/netcore50/System.ServiceModel.dll": {}, - "ref/netcore50/System.Windows.dll": {}, - "ref/netcore50/System.Xml.Linq.dll": {}, - "ref/netcore50/System.Xml.Serialization.dll": {}, - "ref/netcore50/System.Xml.dll": {}, - "ref/netcore50/System.dll": {}, - "ref/netcore50/mscorlib.dll": {} - }, - "runtime": { - "lib/netcore50/System.ComponentModel.DataAnnotations.dll": {}, - "lib/netcore50/System.Core.dll": {}, - "lib/netcore50/System.Net.dll": {}, - "lib/netcore50/System.Numerics.dll": {}, - "lib/netcore50/System.Runtime.Serialization.dll": {}, - "lib/netcore50/System.ServiceModel.Web.dll": {}, - "lib/netcore50/System.ServiceModel.dll": {}, - "lib/netcore50/System.Windows.dll": {}, - "lib/netcore50/System.Xml.Linq.dll": {}, - "lib/netcore50/System.Xml.Serialization.dll": {}, - "lib/netcore50/System.Xml.dll": {}, - "lib/netcore50/System.dll": {} - }, - "runtimeTargets": { - "runtimes/aot/lib/netcore50/System.ComponentModel.DataAnnotations.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Core.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Net.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Numerics.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Runtime.Serialization.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.ServiceModel.Web.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.ServiceModel.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Windows.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Xml.Linq.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Xml.Serialization.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Xml.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/mscorlib.dll": { - "assetType": "runtime", - "rid": "aot" - } - } - }, - "Microsoft.NETCore.Runtime/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.1", - "Microsoft.NETCore.Runtime.Native": "1.0.1" - } - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.1": { - "type": "package" - }, - "Microsoft.NETCore.Runtime.Native/1.0.1": { - "type": "package" - }, - "Microsoft.NETCore.Targets/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.0", - "Microsoft.NETCore.Targets.UniversalWindowsPlatform": "5.0.0" - } - }, - "Microsoft.NETCore.Targets.UniversalWindowsPlatform/5.0.0": { - "type": "package" - }, - "Microsoft.NETCore.UniversalWindowsPlatform/5.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore": "5.0.0", - "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "Microsoft.NETCore.Runtime": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.0", - "System.ComponentModel.EventBasedAsync": "4.0.10", - "System.Data.Common": "4.0.0", - "System.Diagnostics.Contracts": "4.0.0", - "System.Diagnostics.StackTrace": "4.0.0", - "System.IO.IsolatedStorage": "4.0.0", - "System.Net.Http.Rtc": "4.0.0", - "System.Net.Requests": "4.0.10", - "System.Net.Sockets": "4.0.0", - "System.Net.WebHeaderCollection": "4.0.0", - "System.Numerics.Vectors.WindowsRuntime": "4.0.0", - "System.Reflection.Context": "4.0.0", - "System.Runtime.InteropServices.WindowsRuntime": "4.0.0", - "System.Runtime.Serialization.Json": "4.0.1", - "System.Runtime.Serialization.Primitives": "4.1.0", - "System.Runtime.Serialization.Xml": "4.1.0", - "System.Runtime.WindowsRuntime": "4.0.10", - "System.Runtime.WindowsRuntime.UI.Xaml": "4.0.0", - "System.ServiceModel.Duplex": "4.0.0", - "System.ServiceModel.Http": "4.0.10", - "System.ServiceModel.NetTcp": "4.0.0", - "System.ServiceModel.Primitives": "4.0.0", - "System.ServiceModel.Security": "4.0.0", - "System.Text.Encoding.CodePages": "4.0.0", - "System.Xml.XmlSerializer": "4.0.10" - } - }, - "Microsoft.VisualBasic/10.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Dynamic.Runtime": "4.0.10", - "System.Globalization": "4.0.10", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/netcore50/Microsoft.VisualBasic.dll": {} - }, - "runtime": { - "lib/netcore50/Microsoft.VisualBasic.dll": {} - } - }, - "Microsoft.Win32.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20", - "System.Runtime.InteropServices": "4.0.20" - }, - "compile": { - "ref/dotnet/Microsoft.Win32.Primitives.dll": {} - }, - "runtime": { - "lib/dotnet/Microsoft.Win32.Primitives.dll": {} - } - }, - "System.AppContext/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.AppContext.dll": {} - }, - "runtime": { - "lib/netcore50/System.AppContext.dll": {} - } - }, - "System.Collections/4.0.10": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Collections.dll": {} - }, - "runtime": { - "lib/netcore50/System.Collections.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Collections.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Collections.Concurrent/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.Concurrent.dll": {} - } - }, - "System.Collections.Immutable/1.1.37": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.Immutable.dll": {} - } - }, - "System.Collections.NonGeneric/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Collections.NonGeneric.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.NonGeneric.dll": {} - } - }, - "System.Collections.Specialized/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections.NonGeneric": "4.0.0", - "System.Globalization": "4.0.10", - "System.Globalization.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Collections.Specialized.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.Specialized.dll": {} - } - }, - "System.ComponentModel/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ComponentModel.dll": {} - }, - "runtime": { - "lib/netcore50/System.ComponentModel.dll": {} - } - }, - "System.ComponentModel.Annotations/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.ComponentModel": "4.0.0", - "System.Globalization": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.ComponentModel.Annotations.dll": {} - }, - "runtime": { - "lib/dotnet/System.ComponentModel.Annotations.dll": {} - } - }, - "System.ComponentModel.EventBasedAsync/4.0.10": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.ComponentModel.EventBasedAsync.dll": {} - }, - "runtime": { - "lib/dotnet/System.ComponentModel.EventBasedAsync.dll": {} - } - }, - "System.Data.Common/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Collections.NonGeneric": "4.0.0", - "System.Globalization": "4.0.10", - "System.IO": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Data.Common.dll": {} - }, - "runtime": { - "lib/dotnet/System.Data.Common.dll": {} - } - }, - "System.Diagnostics.Contracts/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Diagnostics.Contracts.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Contracts.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Contracts.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.Debug/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Diagnostics.Debug.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Debug.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.StackTrace/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Diagnostics.StackTrace.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.StackTrace.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.StackTrace.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.Tools/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Diagnostics.Tools.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Tools.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tools.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.Tracing/4.0.20": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Globalization": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.0", - "System.Text.Encoding": "4.0.0", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Diagnostics.Tracing.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Tracing.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tracing.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Dynamic.Runtime/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.ObjectModel": "4.0.0", - "System.Reflection": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Dynamic.Runtime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Dynamic.Runtime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Dynamic.Runtime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Globalization/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Globalization.dll": {} - }, - "runtime": { - "lib/netcore50/System.Globalization.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Globalization.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Globalization.Calendars/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Globalization.Calendars.dll": {} - }, - "runtime": { - "lib/netcore50/System.Globalization.Calendars.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Globalization.Calendars.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Globalization.Extensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Globalization.Extensions.dll": {} - }, - "runtime": { - "lib/dotnet/System.Globalization.Extensions.dll": {} - } - }, - "System.IO/4.0.10": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Runtime": "4.0.20", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.0", - "System.Threading": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/dotnet/System.IO.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.IO.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.IO.Compression/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.IO": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.InteropServices": "4.0.0", - "System.Text.Encoding": "4.0.0", - "System.Threading": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/netcore50/System.IO.Compression.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.Compression.dll": {} - } - }, - "System.IO.Compression.ZipFile/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.10", - "System.IO.Compression": "4.0.0", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.Encoding": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/dotnet/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.IO": "4.0.10", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.WindowsRuntime": "4.0.0", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Overlapped": "4.0.0", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.FileSystem.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/dotnet/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.IO.IsolatedStorage/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.IsolatedStorage.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.IsolatedStorage.dll": {} - } - }, - "System.IO.UnmanagedMemoryStream/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.10", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.UnmanagedMemoryStream.dll": {} - }, - "runtime": { - "lib/dotnet/System.IO.UnmanagedMemoryStream.dll": {} - } - }, - "System.Linq/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Linq.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.IO": "4.0.0", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.Expressions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Linq.Expressions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Linq.Parallel/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Collections.Concurrent": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Linq.Parallel.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.Parallel.dll": {} - } - }, - "System.Linq.Queryable/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Linq.Queryable.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.Queryable.dll": {} - } - }, - "System.Net.Http/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Net.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.WindowsRuntime": "4.0.10", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Net.Http.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Http.dll": {} - } - }, - "System.Net.Http.Rtc/4.0.0": { - "type": "package", - "dependencies": { - "System.Net.Http": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Net.Http.Rtc.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Http.Rtc.dll": {} - } - }, - "System.Net.NetworkInformation/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Runtime.InteropServices.WindowsRuntime": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Net.NetworkInformation.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.NetworkInformation.dll": {} - } - }, - "System.Net.Primitives/4.0.10": { - "type": "package", - "dependencies": { - "System.Private.Networking": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Net.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Primitives.dll": {} - } - }, - "System.Net.Requests/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.IO": "4.0.10", - "System.Net.Http": "4.0.0", - "System.Net.Primitives": "4.0.10", - "System.Net.WebHeaderCollection": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Net.Requests.dll": {} - }, - "runtime": { - "lib/dotnet/System.Net.Requests.dll": {} - } - }, - "System.Net.Sockets/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.Networking": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Net.Sockets.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Sockets.dll": {} - } - }, - "System.Net.WebHeaderCollection/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections.NonGeneric": "4.0.0", - "System.Collections.Specialized": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Net.WebHeaderCollection.dll": {} - }, - "runtime": { - "lib/dotnet/System.Net.WebHeaderCollection.dll": {} - } - }, - "System.Numerics.Vectors/4.1.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/dotnet/System.Numerics.Vectors.dll": {} - } - }, - "System.Numerics.Vectors.WindowsRuntime/4.0.0": { - "type": "package", - "dependencies": { - "System.Numerics.Vectors": "4.1.0", - "System.Runtime": "4.0.20", - "System.Runtime.WindowsRuntime": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Numerics.Vectors.WindowsRuntime.dll": {} - }, - "runtime": { - "lib/dotnet/System.Numerics.Vectors.WindowsRuntime.dll": {} - } - }, - "System.ObjectModel/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/dotnet/System.ObjectModel.dll": {} - } - }, - "System.Private.DataContractSerialization/4.1.0": { - "type": "package", - "compile": { - "ref/netcore50/_._": {} - } - }, - "System.Private.Networking/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.Win32.Primitives": "4.0.0", - "System.Collections": "4.0.10", - "System.Collections.NonGeneric": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Overlapped": "4.0.0", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/_._": {} - }, - "runtime": { - "lib/netcore50/System.Private.Networking.dll": {} - } - }, - "System.Private.ServiceModel/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Collections.Concurrent": "4.0.10", - "System.Collections.NonGeneric": "4.0.0", - "System.Collections.Specialized": "4.0.0", - "System.ComponentModel.EventBasedAsync": "4.0.10", - "System.Diagnostics.Contracts": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.IO.Compression": "4.0.0", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.Linq.Queryable": "4.0.0", - "System.Net.Http": "4.0.0", - "System.Net.Primitives": "4.0.10", - "System.Net.WebHeaderCollection": "4.0.0", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.DispatchProxy": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.Serialization.Primitives": "4.0.10", - "System.Runtime.Serialization.Xml": "4.0.10", - "System.Runtime.WindowsRuntime": "4.0.10", - "System.Security.Claims": "4.0.0", - "System.Security.Principal": "4.0.0", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10", - "System.Threading.Timer": "4.0.0", - "System.Xml.ReaderWriter": "4.0.10", - "System.Xml.XmlDocument": "4.0.0", - "System.Xml.XmlSerializer": "4.0.10" - }, - "compile": { - "ref/netcore50/_._": {} - }, - "runtime": { - "lib/netcore50/System.Private.ServiceModel.dll": {} - } - }, - "System.Private.Uri/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/_._": {} - }, - "runtime": { - "lib/netcore50/System.Private.Uri.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Private.Uri.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection/4.0.10": { - "type": "package", - "dependencies": { - "System.IO": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Reflection.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.Context/4.0.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Reflection.Context.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.Context.dll": {} - } - }, - "System.Reflection.DispatchProxy/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Reflection.DispatchProxy.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.DispatchProxy.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.DispatchProxy.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.Extensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Reflection.Extensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.Metadata/1.0.22": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Collections.Immutable": "1.1.37", - "System.Diagnostics.Debug": "4.0.0", - "System.IO": "4.0.0", - "System.Reflection": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.InteropServices": "4.0.0", - "System.Text.Encoding": "4.0.0", - "System.Text.Encoding.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/dotnet/System.Reflection.Metadata.dll": {} - } - }, - "System.Reflection.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Reflection.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.Primitives.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.Primitives.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.TypeExtensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Contracts": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.TypeExtensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.TypeExtensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Resources.ResourceManager/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Reflection": "4.0.10", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Resources.ResourceManager.dll": {} - }, - "runtime": { - "lib/netcore50/System.Resources.ResourceManager.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Resources.ResourceManager.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime/4.0.20": { - "type": "package", - "dependencies": { - "System.Private.Uri": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Runtime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Extensions/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Runtime.Extensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Extensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Handles/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Runtime.Handles.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Handles.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Handles.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.InteropServices/4.0.20": { - "type": "package", - "dependencies": { - "System.Reflection": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Runtime.InteropServices.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.InteropServices.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.InteropServices.WindowsRuntime/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Numerics/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Numerics.dll": {} - } - }, - "System.Runtime.Serialization.Json/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.0.0", - "System.Private.DataContractSerialization": "4.1.0", - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Runtime.Serialization.Json.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Serialization.Json.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Json.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Serialization.Primitives/4.1.0": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Serialization.Xml/4.1.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.0", - "System.Private.DataContractSerialization": "4.1.0", - "System.Runtime": "4.0.0", - "System.Runtime.Serialization.Primitives": "4.1.0", - "System.Text.Encoding": "4.0.0", - "System.Xml.ReaderWriter": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Runtime.Serialization.Xml.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Serialization.Xml.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Xml.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.WindowsRuntime/4.0.10": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.0", - "System.IO": "4.0.10", - "System.ObjectModel": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Runtime.WindowsRuntime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.WindowsRuntime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.WindowsRuntime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.WindowsRuntime.UI.Xaml/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.WindowsRuntime": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll": {} - } - }, - "System.Security.Claims/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.IO": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Security.Principal": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Security.Claims.dll": {} - }, - "runtime": { - "lib/dotnet/System.Security.Claims.dll": {} - } - }, - "System.Security.Principal/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Security.Principal.dll": {} - }, - "runtime": { - "lib/netcore50/System.Security.Principal.dll": {} - } - }, - "System.ServiceModel.Duplex/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.Duplex.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Duplex.dll": {} - } - }, - "System.ServiceModel.Http/4.0.10": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.ServiceModel.Http.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Http.dll": {} - } - }, - "System.ServiceModel.NetTcp/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.NetTcp.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.NetTcp.dll": {} - } - }, - "System.ServiceModel.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Primitives.dll": {} - } - }, - "System.ServiceModel.Security/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.Security.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Security.dll": {} - } - }, - "System.Text.Encoding/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Text.Encoding.dll": {} - }, - "runtime": { - "lib/netcore50/System.Text.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Text.Encoding.CodePages/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Reflection": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Text.Encoding.CodePages.dll": {} - }, - "runtime": { - "lib/dotnet/System.Text.Encoding.CodePages.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Text.Encoding": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Text.Encoding.Extensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Text.Encoding.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.Extensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Text.RegularExpressions/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/dotnet/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Threading.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Threading.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Threading.Overlapped/4.0.0": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Threading.Overlapped.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Overlapped.dll": {} - } - }, - "System.Threading.Tasks/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Threading.Tasks.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Tasks.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Threading.Tasks.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Threading.Tasks.Dataflow/4.5.25": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Collections.Concurrent": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Diagnostics.Tracing": "4.0.0", - "System.Dynamic.Runtime": "4.0.0", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Threading.Tasks.Dataflow.dll": {} - }, - "runtime": { - "lib/dotnet/System.Threading.Tasks.Dataflow.dll": {} - } - }, - "System.Threading.Tasks.Parallel/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections.Concurrent": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Threading.Tasks.Parallel.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Tasks.Parallel.dll": {} - } - }, - "System.Threading.Timer/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Threading.Timer.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Timer.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Threading.Timer.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Xml.ReaderWriter/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/dotnet/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Reflection": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/dotnet/System.Xml.XDocument.dll": {} - } - }, - "System.Xml.XmlDocument/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Xml.XmlDocument.dll": {} - }, - "runtime": { - "lib/dotnet/System.Xml.XmlDocument.dll": {} - } - }, - "System.Xml.XmlSerializer/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.10", - "System.Xml.XmlDocument": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Xml.XmlSerializer.dll": {} - }, - "runtime": { - "lib/netcore50/System.Xml.XmlSerializer.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Xml.XmlSerializer.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": "UAP,Version=v10.0", - "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" - }, - "compile": { - "uap10.0/OpenCvSharp.dll": {} - }, - "runtime": { - "uap10.0/OpenCvSharp.dll": {} - } - } - } - }, - "libraries": { - "Microsoft.CSharp/4.0.0": { - "sha512": "oWqeKUxHXdK6dL2CFjgMcaBISbkk+AqEg+yvJHE4DElNzS4QaTsCflgkkqZwVlWby1Dg9zo9n+iCAMFefFdJ/A==", - "type": "package", - "path": "Microsoft.CSharp/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/Microsoft.CSharp.dll", - "lib/net45/_._", - "lib/netcore50/Microsoft.CSharp.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "microsoft.csharp.4.0.0.nupkg.sha512", - "microsoft.csharp.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/Microsoft.CSharp.dll", - "ref/dotnet/Microsoft.CSharp.xml", - "ref/dotnet/de/Microsoft.CSharp.xml", - "ref/dotnet/es/Microsoft.CSharp.xml", - "ref/dotnet/fr/Microsoft.CSharp.xml", - "ref/dotnet/it/Microsoft.CSharp.xml", - "ref/dotnet/ja/Microsoft.CSharp.xml", - "ref/dotnet/ko/Microsoft.CSharp.xml", - "ref/dotnet/ru/Microsoft.CSharp.xml", - "ref/dotnet/zh-hans/Microsoft.CSharp.xml", - "ref/dotnet/zh-hant/Microsoft.CSharp.xml", - "ref/net45/_._", - "ref/netcore50/Microsoft.CSharp.dll", - "ref/netcore50/Microsoft.CSharp.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._" - ] - }, - "Microsoft.NETCore/5.0.0": { - "sha512": "QQMp0yYQbIdfkKhdEE6Umh2Xonau7tasG36Trw/YlHoWgYQLp7T9L+ZD8EPvdj5ubRhtOuKEKwM7HMpkagB9ZA==", - "type": "package", - "path": "Microsoft.NETCore/5.0.0", - "files": [ - "_._", - "microsoft.netcore.5.0.0.nupkg.sha512", - "microsoft.netcore.nuspec" - ] - }, - "Microsoft.NETCore.Platforms/1.0.0": { - "sha512": "0N77OwGZpXqUco2C/ynv1os7HqdFYifvNIbveLDKqL5PZaz05Rl9enCwVBjF61aumHKueLWIJ3prnmdAXxww4A==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.0.0", - "files": [ - "microsoft.netcore.platforms.1.0.0.nupkg.sha512", - "microsoft.netcore.platforms.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.1.0", - "files": [ - "Microsoft.NETCore.Platforms.1.1.0.nupkg.sha512", - "Microsoft.NETCore.Platforms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Portable.Compatibility/1.0.0": { - "sha512": "5/IFqf2zN1jzktRJitxO+5kQ+0AilcIbPvSojSJwDG3cGNSMZg44LXLB5E9RkSETE0Wh4QoALdNh1koKoF7/mA==", - "type": "package", - "path": "Microsoft.NETCore.Portable.Compatibility/1.0.0", - "files": [ - "lib/dnxcore50/System.ComponentModel.DataAnnotations.dll", - "lib/dnxcore50/System.Core.dll", - "lib/dnxcore50/System.Net.dll", - "lib/dnxcore50/System.Numerics.dll", - "lib/dnxcore50/System.Runtime.Serialization.dll", - "lib/dnxcore50/System.ServiceModel.Web.dll", - "lib/dnxcore50/System.ServiceModel.dll", - "lib/dnxcore50/System.Windows.dll", - "lib/dnxcore50/System.Xml.Linq.dll", - "lib/dnxcore50/System.Xml.Serialization.dll", - "lib/dnxcore50/System.Xml.dll", - "lib/dnxcore50/System.dll", - "lib/net45/_._", - "lib/netcore50/System.ComponentModel.DataAnnotations.dll", - "lib/netcore50/System.Core.dll", - "lib/netcore50/System.Net.dll", - "lib/netcore50/System.Numerics.dll", - "lib/netcore50/System.Runtime.Serialization.dll", - "lib/netcore50/System.ServiceModel.Web.dll", - "lib/netcore50/System.ServiceModel.dll", - "lib/netcore50/System.Windows.dll", - "lib/netcore50/System.Xml.Linq.dll", - "lib/netcore50/System.Xml.Serialization.dll", - "lib/netcore50/System.Xml.dll", - "lib/netcore50/System.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "microsoft.netcore.portable.compatibility.1.0.0.nupkg.sha512", - "microsoft.netcore.portable.compatibility.nuspec", - "ref/dotnet/System.ComponentModel.DataAnnotations.dll", - "ref/dotnet/System.Core.dll", - "ref/dotnet/System.Net.dll", - "ref/dotnet/System.Numerics.dll", - "ref/dotnet/System.Runtime.Serialization.dll", - "ref/dotnet/System.ServiceModel.Web.dll", - "ref/dotnet/System.ServiceModel.dll", - "ref/dotnet/System.Windows.dll", - "ref/dotnet/System.Xml.Linq.dll", - "ref/dotnet/System.Xml.Serialization.dll", - "ref/dotnet/System.Xml.dll", - "ref/dotnet/System.dll", - "ref/dotnet/mscorlib.dll", - "ref/net45/_._", - "ref/netcore50/System.ComponentModel.DataAnnotations.dll", - "ref/netcore50/System.Core.dll", - "ref/netcore50/System.Net.dll", - "ref/netcore50/System.Numerics.dll", - "ref/netcore50/System.Runtime.Serialization.dll", - "ref/netcore50/System.ServiceModel.Web.dll", - "ref/netcore50/System.ServiceModel.dll", - "ref/netcore50/System.Windows.dll", - "ref/netcore50/System.Xml.Linq.dll", - "ref/netcore50/System.Xml.Serialization.dll", - "ref/netcore50/System.Xml.dll", - "ref/netcore50/System.dll", - "ref/netcore50/mscorlib.dll", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/aot/lib/netcore50/System.ComponentModel.DataAnnotations.dll", - "runtimes/aot/lib/netcore50/System.Core.dll", - "runtimes/aot/lib/netcore50/System.Net.dll", - "runtimes/aot/lib/netcore50/System.Numerics.dll", - "runtimes/aot/lib/netcore50/System.Runtime.Serialization.dll", - "runtimes/aot/lib/netcore50/System.ServiceModel.Web.dll", - "runtimes/aot/lib/netcore50/System.ServiceModel.dll", - "runtimes/aot/lib/netcore50/System.Windows.dll", - "runtimes/aot/lib/netcore50/System.Xml.Linq.dll", - "runtimes/aot/lib/netcore50/System.Xml.Serialization.dll", - "runtimes/aot/lib/netcore50/System.Xml.dll", - "runtimes/aot/lib/netcore50/System.dll", - "runtimes/aot/lib/netcore50/mscorlib.dll" - ] - }, - "Microsoft.NETCore.Runtime/1.0.1": { - "sha512": "WIblAPds88Mwvcu8OjmspmHLG9zyay//n1jMVxQlxikGzZBIeRDz/O7o9qBtOR+vDpfn+Y2EbzdCmPb3brMGRg==", - "type": "package", - "path": "Microsoft.NETCore.Runtime/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.runtime.1.0.1.nupkg.sha512", - "microsoft.netcore.runtime.nuspec" - ] - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.1": { - "sha512": "EQlk4pidS+VppUSjhCCMXYlw9mf/47BwyM5XIX/gQHp5/qedKG7jypSMy0SGwv80U5mr1juQC0YROqjr7j8nTA==", - "type": "package", - "path": "Microsoft.NETCore.Runtime.CoreCLR/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.runtime.coreclr.1.0.1.nupkg.sha512", - "microsoft.netcore.runtime.coreclr.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Runtime.Native/1.0.1": { - "sha512": "VeZR/qn/+FRH5rd1htnwBFIzSBW6xiA7Yu2UzaHKKlyf9Ev9xVXIOitWnkvb/tJMTKdmiCzmfi2TsAMajUHNZA==", - "type": "package", - "path": "Microsoft.NETCore.Runtime.Native/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.runtime.native.1.0.1.nupkg.sha512", - "microsoft.netcore.runtime.native.nuspec" - ] - }, - "Microsoft.NETCore.Targets/1.0.0": { - "sha512": "XfITpPjYLYRmAeZtb9diw6P7ylLQsSC1U2a/xj10iQpnHxkiLEBXop/psw15qMPuNca7lqgxWvzZGpQxphuXaw==", - "type": "package", - "path": "Microsoft.NETCore.Targets/1.0.0", - "files": [ - "microsoft.netcore.targets.1.0.0.nupkg.sha512", - "microsoft.netcore.targets.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets/1.1.0": { - "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", - "type": "package", - "path": "Microsoft.NETCore.Targets/1.1.0", - "files": [ - "Microsoft.NETCore.Targets.1.1.0.nupkg.sha512", - "Microsoft.NETCore.Targets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets.UniversalWindowsPlatform/5.0.0": { - "sha512": "jszcJ6okLlhqF4OQbhSbixLOuLUyVT3BP7Y7/i7fcDMwnHBd1Pmdz6M1Al9SMDKVLA2oSaItg4tq6C0ydv8lYQ==", - "type": "package", - "path": "Microsoft.NETCore.Targets.UniversalWindowsPlatform/5.0.0", - "files": [ - "microsoft.netcore.targets.universalwindowsplatform.5.0.0.nupkg.sha512", - "microsoft.netcore.targets.universalwindowsplatform.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.UniversalWindowsPlatform/5.1.0": { - "sha512": "6xdZAZALSJB65rRfOAfB6+aVBBc42Oz8jr8Cqy8J7A34zWVBV9l612lwbEsf6KJ1YdtocJsNcA8sLId3vJL/FA==", - "type": "package", - "path": "Microsoft.NETCore.UniversalWindowsPlatform/5.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.universalwindowsplatform.5.1.0.nupkg.sha512", - "microsoft.netcore.universalwindowsplatform.nuspec" - ] - }, - "Microsoft.VisualBasic/10.0.0": { - "sha512": "5BEm2/HAVd97whRlCChU7rmSh/9cwGlZ/NTNe3Jl07zuPWfKQq5TUvVNUmdvmEe8QRecJLZ4/e7WF1i1O8V42g==", - "type": "package", - "path": "Microsoft.VisualBasic/10.0.0", - "files": [ - "lib/dotnet/Microsoft.VisualBasic.dll", - "lib/net45/_._", - "lib/netcore50/Microsoft.VisualBasic.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "microsoft.visualbasic.10.0.0.nupkg.sha512", - "microsoft.visualbasic.nuspec", - "ref/dotnet/Microsoft.VisualBasic.dll", - "ref/dotnet/Microsoft.VisualBasic.xml", - "ref/dotnet/de/Microsoft.VisualBasic.xml", - "ref/dotnet/es/Microsoft.VisualBasic.xml", - "ref/dotnet/fr/Microsoft.VisualBasic.xml", - "ref/dotnet/it/Microsoft.VisualBasic.xml", - "ref/dotnet/ja/Microsoft.VisualBasic.xml", - "ref/dotnet/ko/Microsoft.VisualBasic.xml", - "ref/dotnet/ru/Microsoft.VisualBasic.xml", - "ref/dotnet/zh-hans/Microsoft.VisualBasic.xml", - "ref/dotnet/zh-hant/Microsoft.VisualBasic.xml", - "ref/net45/_._", - "ref/netcore50/Microsoft.VisualBasic.dll", - "ref/netcore50/Microsoft.VisualBasic.xml", - "ref/win8/_._", - "ref/wpa81/_._" - ] - }, - "Microsoft.Win32.Primitives/4.0.0": { - "sha512": "CypEz9/lLOup8CEhiAmvr7aLs1zKPYyEU1sxQeEr6G0Ci8/F0Y6pYR1zzkROjM8j8Mq0typmbu676oYyvErQvg==", - "type": "package", - "path": "Microsoft.Win32.Primitives/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/Microsoft.Win32.Primitives.dll", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "microsoft.win32.primitives.4.0.0.nupkg.sha512", - "microsoft.win32.primitives.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/Microsoft.Win32.Primitives.dll", - "ref/dotnet/Microsoft.Win32.Primitives.xml", - "ref/dotnet/de/Microsoft.Win32.Primitives.xml", - "ref/dotnet/es/Microsoft.Win32.Primitives.xml", - "ref/dotnet/fr/Microsoft.Win32.Primitives.xml", - "ref/dotnet/it/Microsoft.Win32.Primitives.xml", - "ref/dotnet/ja/Microsoft.Win32.Primitives.xml", - "ref/dotnet/ko/Microsoft.Win32.Primitives.xml", - "ref/dotnet/ru/Microsoft.Win32.Primitives.xml", - "ref/dotnet/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/dotnet/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._" - ] - }, - "Microsoft.Win32.Primitives/4.3.0": { - "sha512": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "type": "package", - "path": "Microsoft.Win32.Primitives/4.3.0", - "files": [ - "Microsoft.Win32.Primitives.4.3.0.nupkg.sha512", - "Microsoft.Win32.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "NETStandard.Library/1.6.1": { - "sha512": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "type": "package", - "path": "NETStandard.Library/1.6.1", - "files": [ - "NETStandard.Library.1.6.1.nupkg.sha512", - "NETStandard.Library.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt" - ] - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", - "type": "package", - "path": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", - "type": "package", - "path": "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", - "type": "package", - "path": "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.native.System/4.3.0": { - "sha512": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "type": "package", - "path": "runtime.native.System/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.4.3.0.nupkg.sha512", - "runtime.native.System.nuspec" - ] - }, - "runtime.native.System.IO.Compression/4.3.0": { - "sha512": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "type": "package", - "path": "runtime.native.System.IO.Compression/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.IO.Compression.4.3.0.nupkg.sha512", - "runtime.native.System.IO.Compression.nuspec" - ] - }, - "runtime.native.System.Net.Http/4.3.0": { - "sha512": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "type": "package", - "path": "runtime.native.System.Net.Http/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Net.Http.4.3.0.nupkg.sha512", - "runtime.native.System.Net.Http.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography.Apple/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.Apple.4.3.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.Apple.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.OpenSsl.nuspec" - ] - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", - "type": "package", - "path": "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", - "type": "package", - "path": "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib" - ] - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", - "type": "package", - "path": "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", - "type": "package", - "path": "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", - "type": "package", - "path": "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", - "type": "package", - "path": "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "System.AppContext/4.0.0": { - "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", - "type": "package", - "path": "System.AppContext/4.0.0", - "files": [ - "lib/DNXCore50/System.AppContext.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.AppContext.dll", - "ref/dotnet/System.AppContext.xml", - "ref/dotnet/de/System.AppContext.xml", - "ref/dotnet/es/System.AppContext.xml", - "ref/dotnet/fr/System.AppContext.xml", - "ref/dotnet/it/System.AppContext.xml", - "ref/dotnet/ja/System.AppContext.xml", - "ref/dotnet/ko/System.AppContext.xml", - "ref/dotnet/ru/System.AppContext.xml", - "ref/dotnet/zh-hans/System.AppContext.xml", - "ref/dotnet/zh-hant/System.AppContext.xml", - "ref/net46/System.AppContext.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.appcontext.4.0.0.nupkg.sha512", - "system.appcontext.nuspec" - ] - }, - "System.AppContext/4.3.0": { - "sha512": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "type": "package", - "path": "System.AppContext/4.3.0", - "files": [ - "System.AppContext.4.3.0.nupkg.sha512", - "System.AppContext.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/net463/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/netstandard1.6/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.AppContext.dll", - "ref/net463/System.AppContext.dll", - "ref/netstandard/_._", - "ref/netstandard1.3/System.AppContext.dll", - "ref/netstandard1.3/System.AppContext.xml", - "ref/netstandard1.3/de/System.AppContext.xml", - "ref/netstandard1.3/es/System.AppContext.xml", - "ref/netstandard1.3/fr/System.AppContext.xml", - "ref/netstandard1.3/it/System.AppContext.xml", - "ref/netstandard1.3/ja/System.AppContext.xml", - "ref/netstandard1.3/ko/System.AppContext.xml", - "ref/netstandard1.3/ru/System.AppContext.xml", - "ref/netstandard1.3/zh-hans/System.AppContext.xml", - "ref/netstandard1.3/zh-hant/System.AppContext.xml", - "ref/netstandard1.6/System.AppContext.dll", - "ref/netstandard1.6/System.AppContext.xml", - "ref/netstandard1.6/de/System.AppContext.xml", - "ref/netstandard1.6/es/System.AppContext.xml", - "ref/netstandard1.6/fr/System.AppContext.xml", - "ref/netstandard1.6/it/System.AppContext.xml", - "ref/netstandard1.6/ja/System.AppContext.xml", - "ref/netstandard1.6/ko/System.AppContext.xml", - "ref/netstandard1.6/ru/System.AppContext.xml", - "ref/netstandard1.6/zh-hans/System.AppContext.xml", - "ref/netstandard1.6/zh-hant/System.AppContext.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.AppContext.dll" - ] - }, - "System.Buffers/4.3.0": { - "sha512": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "type": "package", - "path": "System.Buffers/4.3.0", - "files": [ - "System.Buffers.4.3.0.nupkg.sha512", - "System.Buffers.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/.xml", - "lib/netstandard1.1/System.Buffers.dll" - ] - }, - "System.Collections/4.0.10": { - "sha512": "ux6ilcZZjV/Gp7JEZpe+2V1eTueq6NuoGRM3eZCFuPM25hLVVgCRuea6STW8hvqreIOE59irJk5/ovpA5xQipw==", - "type": "package", - "path": "System.Collections/4.0.10", - "files": [ - "lib/DNXCore50/System.Collections.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Collections.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.dll", - "ref/dotnet/System.Collections.xml", - "ref/dotnet/de/System.Collections.xml", - "ref/dotnet/es/System.Collections.xml", - "ref/dotnet/fr/System.Collections.xml", - "ref/dotnet/it/System.Collections.xml", - "ref/dotnet/ja/System.Collections.xml", - "ref/dotnet/ko/System.Collections.xml", - "ref/dotnet/ru/System.Collections.xml", - "ref/dotnet/zh-hans/System.Collections.xml", - "ref/dotnet/zh-hant/System.Collections.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Collections.dll", - "system.collections.4.0.10.nupkg.sha512", - "system.collections.nuspec" - ] - }, - "System.Collections/4.3.0": { - "sha512": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "type": "package", - "path": "System.Collections/4.3.0", - "files": [ - "System.Collections.4.3.0.nupkg.sha512", - "System.Collections.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.dll", - "ref/netcore50/System.Collections.xml", - "ref/netcore50/de/System.Collections.xml", - "ref/netcore50/es/System.Collections.xml", - "ref/netcore50/fr/System.Collections.xml", - "ref/netcore50/it/System.Collections.xml", - "ref/netcore50/ja/System.Collections.xml", - "ref/netcore50/ko/System.Collections.xml", - "ref/netcore50/ru/System.Collections.xml", - "ref/netcore50/zh-hans/System.Collections.xml", - "ref/netcore50/zh-hant/System.Collections.xml", - "ref/netstandard1.0/System.Collections.dll", - "ref/netstandard1.0/System.Collections.xml", - "ref/netstandard1.0/de/System.Collections.xml", - "ref/netstandard1.0/es/System.Collections.xml", - "ref/netstandard1.0/fr/System.Collections.xml", - "ref/netstandard1.0/it/System.Collections.xml", - "ref/netstandard1.0/ja/System.Collections.xml", - "ref/netstandard1.0/ko/System.Collections.xml", - "ref/netstandard1.0/ru/System.Collections.xml", - "ref/netstandard1.0/zh-hans/System.Collections.xml", - "ref/netstandard1.0/zh-hant/System.Collections.xml", - "ref/netstandard1.3/System.Collections.dll", - "ref/netstandard1.3/System.Collections.xml", - "ref/netstandard1.3/de/System.Collections.xml", - "ref/netstandard1.3/es/System.Collections.xml", - "ref/netstandard1.3/fr/System.Collections.xml", - "ref/netstandard1.3/it/System.Collections.xml", - "ref/netstandard1.3/ja/System.Collections.xml", - "ref/netstandard1.3/ko/System.Collections.xml", - "ref/netstandard1.3/ru/System.Collections.xml", - "ref/netstandard1.3/zh-hans/System.Collections.xml", - "ref/netstandard1.3/zh-hant/System.Collections.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Concurrent/4.0.10": { - "sha512": "ZtMEqOPAjAIqR8fqom9AOKRaB94a+emO2O8uOP6vyJoNswSPrbiwN7iH53rrVpvjMVx0wr4/OMpI7486uGZjbw==", - "type": "package", - "path": "System.Collections.Concurrent/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Collections.Concurrent.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.Concurrent.dll", - "ref/dotnet/System.Collections.Concurrent.xml", - "ref/dotnet/de/System.Collections.Concurrent.xml", - "ref/dotnet/es/System.Collections.Concurrent.xml", - "ref/dotnet/fr/System.Collections.Concurrent.xml", - "ref/dotnet/it/System.Collections.Concurrent.xml", - "ref/dotnet/ja/System.Collections.Concurrent.xml", - "ref/dotnet/ko/System.Collections.Concurrent.xml", - "ref/dotnet/ru/System.Collections.Concurrent.xml", - "ref/dotnet/zh-hans/System.Collections.Concurrent.xml", - "ref/dotnet/zh-hant/System.Collections.Concurrent.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.collections.concurrent.4.0.10.nupkg.sha512", - "system.collections.concurrent.nuspec" - ] - }, - "System.Collections.Concurrent/4.3.0": { - "sha512": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "type": "package", - "path": "System.Collections.Concurrent/4.3.0", - "files": [ - "System.Collections.Concurrent.4.3.0.nupkg.sha512", - "System.Collections.Concurrent.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Collections.Concurrent.dll", - "lib/netstandard1.3/System.Collections.Concurrent.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.Concurrent.dll", - "ref/netcore50/System.Collections.Concurrent.xml", - "ref/netcore50/de/System.Collections.Concurrent.xml", - "ref/netcore50/es/System.Collections.Concurrent.xml", - "ref/netcore50/fr/System.Collections.Concurrent.xml", - "ref/netcore50/it/System.Collections.Concurrent.xml", - "ref/netcore50/ja/System.Collections.Concurrent.xml", - "ref/netcore50/ko/System.Collections.Concurrent.xml", - "ref/netcore50/ru/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hans/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.1/System.Collections.Concurrent.dll", - "ref/netstandard1.1/System.Collections.Concurrent.xml", - "ref/netstandard1.1/de/System.Collections.Concurrent.xml", - "ref/netstandard1.1/es/System.Collections.Concurrent.xml", - "ref/netstandard1.1/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.1/it/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.3/System.Collections.Concurrent.dll", - "ref/netstandard1.3/System.Collections.Concurrent.xml", - "ref/netstandard1.3/de/System.Collections.Concurrent.xml", - "ref/netstandard1.3/es/System.Collections.Concurrent.xml", - "ref/netstandard1.3/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.3/it/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hant/System.Collections.Concurrent.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Immutable/1.1.37": { - "sha512": "fTpqwZYBzoklTT+XjTRK8KxvmrGkYHzBiylCcKyQcxiOM8k+QvhNBxRvFHDWzy4OEP5f8/9n+xQ9mEgEXY+muA==", - "type": "package", - "path": "System.Collections.Immutable/1.1.37", - "files": [ - "lib/dotnet/System.Collections.Immutable.dll", - "lib/dotnet/System.Collections.Immutable.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml", - "system.collections.immutable.1.1.37.nupkg.sha512", - "system.collections.immutable.nuspec" - ] - }, - "System.Collections.NonGeneric/4.0.0": { - "sha512": "rVgwrFBMkmp8LI6GhAYd6Bx+2uLIXjRfNg6Ie+ASfX8ESuh9e2HNxFy2yh1MPIXZq3OAYa+0mmULVwpnEC6UDA==", - "type": "package", - "path": "System.Collections.NonGeneric/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Collections.NonGeneric.dll", - "lib/net46/System.Collections.NonGeneric.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.NonGeneric.dll", - "ref/dotnet/System.Collections.NonGeneric.xml", - "ref/dotnet/de/System.Collections.NonGeneric.xml", - "ref/dotnet/es/System.Collections.NonGeneric.xml", - "ref/dotnet/fr/System.Collections.NonGeneric.xml", - "ref/dotnet/it/System.Collections.NonGeneric.xml", - "ref/dotnet/ja/System.Collections.NonGeneric.xml", - "ref/dotnet/ko/System.Collections.NonGeneric.xml", - "ref/dotnet/ru/System.Collections.NonGeneric.xml", - "ref/dotnet/zh-hans/System.Collections.NonGeneric.xml", - "ref/dotnet/zh-hant/System.Collections.NonGeneric.xml", - "ref/net46/System.Collections.NonGeneric.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.collections.nongeneric.4.0.0.nupkg.sha512", - "system.collections.nongeneric.nuspec" - ] - }, - "System.Collections.Specialized/4.0.0": { - "sha512": "poJFwQCUOoXqvdoGxx+3p8Z63yawcYKPBSFP67Z2jICeOINvEIQZN7mVOAnC7gsVF0WU+A2wtVwfhagC7UCgAg==", - "type": "package", - "path": "System.Collections.Specialized/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Collections.Specialized.dll", - "lib/net46/System.Collections.Specialized.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.Specialized.dll", - "ref/dotnet/System.Collections.Specialized.xml", - "ref/dotnet/de/System.Collections.Specialized.xml", - "ref/dotnet/es/System.Collections.Specialized.xml", - "ref/dotnet/fr/System.Collections.Specialized.xml", - "ref/dotnet/it/System.Collections.Specialized.xml", - "ref/dotnet/ja/System.Collections.Specialized.xml", - "ref/dotnet/ko/System.Collections.Specialized.xml", - "ref/dotnet/ru/System.Collections.Specialized.xml", - "ref/dotnet/zh-hans/System.Collections.Specialized.xml", - "ref/dotnet/zh-hant/System.Collections.Specialized.xml", - "ref/net46/System.Collections.Specialized.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.collections.specialized.4.0.0.nupkg.sha512", - "system.collections.specialized.nuspec" - ] - }, - "System.ComponentModel/4.0.0": { - "sha512": "BzpLdSi++ld7rJLOOt5f/G9GxujP202bBgKORsHcGV36rLB0mfSA2h8chTMoBzFhgN7TE14TmJ2J7Q1RyNCTAw==", - "type": "package", - "path": "System.ComponentModel/4.0.0", - "files": [ - "lib/dotnet/System.ComponentModel.dll", - "lib/net45/_._", - "lib/netcore50/System.ComponentModel.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.ComponentModel.dll", - "ref/dotnet/System.ComponentModel.xml", - "ref/dotnet/de/System.ComponentModel.xml", - "ref/dotnet/es/System.ComponentModel.xml", - "ref/dotnet/fr/System.ComponentModel.xml", - "ref/dotnet/it/System.ComponentModel.xml", - "ref/dotnet/ja/System.ComponentModel.xml", - "ref/dotnet/ko/System.ComponentModel.xml", - "ref/dotnet/ru/System.ComponentModel.xml", - "ref/dotnet/zh-hans/System.ComponentModel.xml", - "ref/dotnet/zh-hant/System.ComponentModel.xml", - "ref/net45/_._", - "ref/netcore50/System.ComponentModel.dll", - "ref/netcore50/System.ComponentModel.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.componentmodel.4.0.0.nupkg.sha512", - "system.componentmodel.nuspec" - ] - }, - "System.ComponentModel.Annotations/4.0.10": { - "sha512": "7+XGyEZx24nP1kpHxCB9e+c6D0fdVDvFwE1xujE9BzlXyNVcy5J5aIO0H/ECupx21QpyRvzZibGAHfL/XLL6dw==", - "type": "package", - "path": "System.ComponentModel.Annotations/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.ComponentModel.Annotations.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ComponentModel.Annotations.dll", - "ref/dotnet/System.ComponentModel.Annotations.xml", - "ref/dotnet/de/System.ComponentModel.Annotations.xml", - "ref/dotnet/es/System.ComponentModel.Annotations.xml", - "ref/dotnet/fr/System.ComponentModel.Annotations.xml", - "ref/dotnet/it/System.ComponentModel.Annotations.xml", - "ref/dotnet/ja/System.ComponentModel.Annotations.xml", - "ref/dotnet/ko/System.ComponentModel.Annotations.xml", - "ref/dotnet/ru/System.ComponentModel.Annotations.xml", - "ref/dotnet/zh-hans/System.ComponentModel.Annotations.xml", - "ref/dotnet/zh-hant/System.ComponentModel.Annotations.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.componentmodel.annotations.4.0.10.nupkg.sha512", - "system.componentmodel.annotations.nuspec" - ] - }, - "System.ComponentModel.EventBasedAsync/4.0.10": { - "sha512": "d6kXcHUgP0jSPXEQ6hXJYCO6CzfoCi7t9vR3BfjSQLrj4HzpuATpx1gkN7itmTW1O+wjuw6rai4378Nj6N70yw==", - "type": "package", - "path": "System.ComponentModel.EventBasedAsync/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.ComponentModel.EventBasedAsync.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ComponentModel.EventBasedAsync.dll", - "ref/dotnet/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/de/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/es/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/fr/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/it/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/ja/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/ko/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/ru/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/zh-hans/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/zh-hant/System.ComponentModel.EventBasedAsync.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.componentmodel.eventbasedasync.4.0.10.nupkg.sha512", - "system.componentmodel.eventbasedasync.nuspec" - ] - }, - "System.Console/4.3.0": { - "sha512": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "type": "package", - "path": "System.Console/4.3.0", - "files": [ - "System.Console.4.3.0.nupkg.sha512", - "System.Console.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Console.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Console.dll", - "ref/netstandard1.3/System.Console.dll", - "ref/netstandard1.3/System.Console.xml", - "ref/netstandard1.3/de/System.Console.xml", - "ref/netstandard1.3/es/System.Console.xml", - "ref/netstandard1.3/fr/System.Console.xml", - "ref/netstandard1.3/it/System.Console.xml", - "ref/netstandard1.3/ja/System.Console.xml", - "ref/netstandard1.3/ko/System.Console.xml", - "ref/netstandard1.3/ru/System.Console.xml", - "ref/netstandard1.3/zh-hans/System.Console.xml", - "ref/netstandard1.3/zh-hant/System.Console.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Data.Common/4.0.0": { - "sha512": "SA7IdoTWiImVr0exDM68r0mKmR4f/qFGxZUrJQKu4YS7F+3afWzSOCezHxWdevQ0ONi4WRQsOiv+Zf9p8H0Feg==", - "type": "package", - "path": "System.Data.Common/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Data.Common.dll", - "lib/net46/System.Data.Common.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Data.Common.dll", - "ref/dotnet/System.Data.Common.xml", - "ref/dotnet/de/System.Data.Common.xml", - "ref/dotnet/es/System.Data.Common.xml", - "ref/dotnet/fr/System.Data.Common.xml", - "ref/dotnet/it/System.Data.Common.xml", - "ref/dotnet/ja/System.Data.Common.xml", - "ref/dotnet/ko/System.Data.Common.xml", - "ref/dotnet/ru/System.Data.Common.xml", - "ref/dotnet/zh-hans/System.Data.Common.xml", - "ref/dotnet/zh-hant/System.Data.Common.xml", - "ref/net46/System.Data.Common.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.data.common.4.0.0.nupkg.sha512", - "system.data.common.nuspec" - ] - }, - "System.Diagnostics.Contracts/4.0.0": { - "sha512": "lMc7HNmyIsu0pKTdA4wf+FMq5jvouUd+oUpV4BdtyqoV0Pkbg9u/7lTKFGqpjZRQosWHq1+B32Lch2wf4AmloA==", - "type": "package", - "path": "System.Diagnostics.Contracts/4.0.0", - "files": [ - "lib/DNXCore50/System.Diagnostics.Contracts.dll", - "lib/net45/_._", - "lib/netcore50/System.Diagnostics.Contracts.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Diagnostics.Contracts.dll", - "ref/dotnet/System.Diagnostics.Contracts.xml", - "ref/dotnet/de/System.Diagnostics.Contracts.xml", - "ref/dotnet/es/System.Diagnostics.Contracts.xml", - "ref/dotnet/fr/System.Diagnostics.Contracts.xml", - "ref/dotnet/it/System.Diagnostics.Contracts.xml", - "ref/dotnet/ja/System.Diagnostics.Contracts.xml", - "ref/dotnet/ko/System.Diagnostics.Contracts.xml", - "ref/dotnet/ru/System.Diagnostics.Contracts.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Contracts.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Contracts.xml", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Contracts.dll", - "ref/netcore50/System.Diagnostics.Contracts.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Contracts.dll", - "system.diagnostics.contracts.4.0.0.nupkg.sha512", - "system.diagnostics.contracts.nuspec" - ] - }, - "System.Diagnostics.Debug/4.0.10": { - "sha512": "pi2KthuvI2LWV2c2V+fwReDsDiKpNl040h6DcwFOb59SafsPT/V1fCy0z66OKwysurJkBMmp5j5CBe3Um+ub0g==", - "type": "package", - "path": "System.Diagnostics.Debug/4.0.10", - "files": [ - "lib/DNXCore50/System.Diagnostics.Debug.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Diagnostics.Debug.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Diagnostics.Debug.dll", - "ref/dotnet/System.Diagnostics.Debug.xml", - "ref/dotnet/de/System.Diagnostics.Debug.xml", - "ref/dotnet/es/System.Diagnostics.Debug.xml", - "ref/dotnet/fr/System.Diagnostics.Debug.xml", - "ref/dotnet/it/System.Diagnostics.Debug.xml", - "ref/dotnet/ja/System.Diagnostics.Debug.xml", - "ref/dotnet/ko/System.Diagnostics.Debug.xml", - "ref/dotnet/ru/System.Diagnostics.Debug.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Debug.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Debug.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll", - "system.diagnostics.debug.4.0.10.nupkg.sha512", - "system.diagnostics.debug.nuspec" - ] - }, - "System.Diagnostics.Debug/4.3.0": { - "sha512": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "type": "package", - "path": "System.Diagnostics.Debug/4.3.0", - "files": [ - "System.Diagnostics.Debug.4.3.0.nupkg.sha512", - "System.Diagnostics.Debug.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Debug.dll", - "ref/netcore50/System.Diagnostics.Debug.xml", - "ref/netcore50/de/System.Diagnostics.Debug.xml", - "ref/netcore50/es/System.Diagnostics.Debug.xml", - "ref/netcore50/fr/System.Diagnostics.Debug.xml", - "ref/netcore50/it/System.Diagnostics.Debug.xml", - "ref/netcore50/ja/System.Diagnostics.Debug.xml", - "ref/netcore50/ko/System.Diagnostics.Debug.xml", - "ref/netcore50/ru/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/System.Diagnostics.Debug.dll", - "ref/netstandard1.0/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/System.Diagnostics.Debug.dll", - "ref/netstandard1.3/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "sha512": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", - "type": "package", - "path": "System.Diagnostics.DiagnosticSource/4.3.0", - "files": [ - "System.Diagnostics.DiagnosticSource.4.3.0.nupkg.sha512", - "System.Diagnostics.DiagnosticSource.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Diagnostics.DiagnosticSource.dll", - "lib/net46/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.xml", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.dll", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.xml" - ] - }, - "System.Diagnostics.StackTrace/4.0.0": { - "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", - "type": "package", - "path": "System.Diagnostics.StackTrace/4.0.0", - "files": [ - "lib/DNXCore50/System.Diagnostics.StackTrace.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.StackTrace.dll", - "lib/netcore50/System.Diagnostics.StackTrace.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Diagnostics.StackTrace.dll", - "ref/dotnet/System.Diagnostics.StackTrace.xml", - "ref/dotnet/de/System.Diagnostics.StackTrace.xml", - "ref/dotnet/es/System.Diagnostics.StackTrace.xml", - "ref/dotnet/fr/System.Diagnostics.StackTrace.xml", - "ref/dotnet/it/System.Diagnostics.StackTrace.xml", - "ref/dotnet/ja/System.Diagnostics.StackTrace.xml", - "ref/dotnet/ko/System.Diagnostics.StackTrace.xml", - "ref/dotnet/ru/System.Diagnostics.StackTrace.xml", - "ref/dotnet/zh-hans/System.Diagnostics.StackTrace.xml", - "ref/dotnet/zh-hant/System.Diagnostics.StackTrace.xml", - "ref/net46/System.Diagnostics.StackTrace.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.StackTrace.dll", - "system.diagnostics.stacktrace.4.0.0.nupkg.sha512", - "system.diagnostics.stacktrace.nuspec" - ] - }, - "System.Diagnostics.Tools/4.0.0": { - "sha512": "uw5Qi2u5Cgtv4xv3+8DeB63iaprPcaEHfpeJqlJiLjIVy6v0La4ahJ6VW9oPbJNIjcavd24LKq0ctT9ssuQXsw==", - "type": "package", - "path": "System.Diagnostics.Tools/4.0.0", - "files": [ - "lib/DNXCore50/System.Diagnostics.Tools.dll", - "lib/net45/_._", - "lib/netcore50/System.Diagnostics.Tools.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Diagnostics.Tools.dll", - "ref/dotnet/System.Diagnostics.Tools.xml", - "ref/dotnet/de/System.Diagnostics.Tools.xml", - "ref/dotnet/es/System.Diagnostics.Tools.xml", - "ref/dotnet/fr/System.Diagnostics.Tools.xml", - "ref/dotnet/it/System.Diagnostics.Tools.xml", - "ref/dotnet/ja/System.Diagnostics.Tools.xml", - "ref/dotnet/ko/System.Diagnostics.Tools.xml", - "ref/dotnet/ru/System.Diagnostics.Tools.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Tools.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Tools.xml", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tools.dll", - "system.diagnostics.tools.4.0.0.nupkg.sha512", - "system.diagnostics.tools.nuspec" - ] - }, - "System.Diagnostics.Tools/4.3.0": { - "sha512": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "type": "package", - "path": "System.Diagnostics.Tools/4.3.0", - "files": [ - "System.Diagnostics.Tools.4.3.0.nupkg.sha512", - "System.Diagnostics.Tools.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/netcore50/de/System.Diagnostics.Tools.xml", - "ref/netcore50/es/System.Diagnostics.Tools.xml", - "ref/netcore50/fr/System.Diagnostics.Tools.xml", - "ref/netcore50/it/System.Diagnostics.Tools.xml", - "ref/netcore50/ja/System.Diagnostics.Tools.xml", - "ref/netcore50/ko/System.Diagnostics.Tools.xml", - "ref/netcore50/ru/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/System.Diagnostics.Tools.dll", - "ref/netstandard1.0/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/de/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/es/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/it/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Tools.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Tracing/4.0.20": { - "sha512": "gn/wexGHc35Fv++5L1gYHMY5g25COfiZ0PGrL+3PfwzoJd4X2LbTAm/U8d385SI6BKQBI/z4dQfvneS9J27+Tw==", - "type": "package", - "path": "System.Diagnostics.Tracing/4.0.20", - "files": [ - "lib/DNXCore50/System.Diagnostics.Tracing.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Diagnostics.Tracing.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Diagnostics.Tracing.dll", - "ref/dotnet/System.Diagnostics.Tracing.xml", - "ref/dotnet/de/System.Diagnostics.Tracing.xml", - "ref/dotnet/es/System.Diagnostics.Tracing.xml", - "ref/dotnet/fr/System.Diagnostics.Tracing.xml", - "ref/dotnet/it/System.Diagnostics.Tracing.xml", - "ref/dotnet/ja/System.Diagnostics.Tracing.xml", - "ref/dotnet/ko/System.Diagnostics.Tracing.xml", - "ref/dotnet/ru/System.Diagnostics.Tracing.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Tracing.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Tracing.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tracing.dll", - "system.diagnostics.tracing.4.0.20.nupkg.sha512", - "system.diagnostics.tracing.nuspec" - ] - }, - "System.Diagnostics.Tracing/4.3.0": { - "sha512": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "type": "package", - "path": "System.Diagnostics.Tracing/4.3.0", - "files": [ - "System.Diagnostics.Tracing.4.3.0.nupkg.sha512", - "System.Diagnostics.Tracing.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Diagnostics.Tracing.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.xml", - "ref/netcore50/de/System.Diagnostics.Tracing.xml", - "ref/netcore50/es/System.Diagnostics.Tracing.xml", - "ref/netcore50/fr/System.Diagnostics.Tracing.xml", - "ref/netcore50/it/System.Diagnostics.Tracing.xml", - "ref/netcore50/ja/System.Diagnostics.Tracing.xml", - "ref/netcore50/ko/System.Diagnostics.Tracing.xml", - "ref/netcore50/ru/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/System.Diagnostics.Tracing.dll", - "ref/netstandard1.1/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/System.Diagnostics.Tracing.dll", - "ref/netstandard1.2/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/System.Diagnostics.Tracing.dll", - "ref/netstandard1.3/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/System.Diagnostics.Tracing.dll", - "ref/netstandard1.5/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hant/System.Diagnostics.Tracing.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Dynamic.Runtime/4.0.10": { - "sha512": "r10VTLdlxtYp46BuxomHnwx7vIoMOr04CFoC/jJJfY22f7HQQ4P+cXY2Nxo6/rIxNNqOxwdbQQwv7Gl88Jsu1w==", - "type": "package", - "path": "System.Dynamic.Runtime/4.0.10", - "files": [ - "lib/DNXCore50/System.Dynamic.Runtime.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Dynamic.Runtime.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Dynamic.Runtime.dll", - "ref/dotnet/System.Dynamic.Runtime.xml", - "ref/dotnet/de/System.Dynamic.Runtime.xml", - "ref/dotnet/es/System.Dynamic.Runtime.xml", - "ref/dotnet/fr/System.Dynamic.Runtime.xml", - "ref/dotnet/it/System.Dynamic.Runtime.xml", - "ref/dotnet/ja/System.Dynamic.Runtime.xml", - "ref/dotnet/ko/System.Dynamic.Runtime.xml", - "ref/dotnet/ru/System.Dynamic.Runtime.xml", - "ref/dotnet/zh-hans/System.Dynamic.Runtime.xml", - "ref/dotnet/zh-hant/System.Dynamic.Runtime.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Dynamic.Runtime.dll", - "system.dynamic.runtime.4.0.10.nupkg.sha512", - "system.dynamic.runtime.nuspec" - ] - }, - "System.Globalization/4.0.10": { - "sha512": "kzRtbbCNAxdafFBDogcM36ehA3th8c1PGiz8QRkZn8O5yMBorDHSK8/TGJPYOaCS5zdsGk0u9qXHnW91nqy7fw==", - "type": "package", - "path": "System.Globalization/4.0.10", - "files": [ - "lib/DNXCore50/System.Globalization.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Globalization.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Globalization.dll", - "ref/dotnet/System.Globalization.xml", - "ref/dotnet/de/System.Globalization.xml", - "ref/dotnet/es/System.Globalization.xml", - "ref/dotnet/fr/System.Globalization.xml", - "ref/dotnet/it/System.Globalization.xml", - "ref/dotnet/ja/System.Globalization.xml", - "ref/dotnet/ko/System.Globalization.xml", - "ref/dotnet/ru/System.Globalization.xml", - "ref/dotnet/zh-hans/System.Globalization.xml", - "ref/dotnet/zh-hant/System.Globalization.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Globalization.dll", - "system.globalization.4.0.10.nupkg.sha512", - "system.globalization.nuspec" - ] - }, - "System.Globalization/4.3.0": { - "sha512": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "type": "package", - "path": "System.Globalization/4.3.0", - "files": [ - "System.Globalization.4.3.0.nupkg.sha512", - "System.Globalization.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Globalization.dll", - "ref/netcore50/System.Globalization.xml", - "ref/netcore50/de/System.Globalization.xml", - "ref/netcore50/es/System.Globalization.xml", - "ref/netcore50/fr/System.Globalization.xml", - "ref/netcore50/it/System.Globalization.xml", - "ref/netcore50/ja/System.Globalization.xml", - "ref/netcore50/ko/System.Globalization.xml", - "ref/netcore50/ru/System.Globalization.xml", - "ref/netcore50/zh-hans/System.Globalization.xml", - "ref/netcore50/zh-hant/System.Globalization.xml", - "ref/netstandard1.0/System.Globalization.dll", - "ref/netstandard1.0/System.Globalization.xml", - "ref/netstandard1.0/de/System.Globalization.xml", - "ref/netstandard1.0/es/System.Globalization.xml", - "ref/netstandard1.0/fr/System.Globalization.xml", - "ref/netstandard1.0/it/System.Globalization.xml", - "ref/netstandard1.0/ja/System.Globalization.xml", - "ref/netstandard1.0/ko/System.Globalization.xml", - "ref/netstandard1.0/ru/System.Globalization.xml", - "ref/netstandard1.0/zh-hans/System.Globalization.xml", - "ref/netstandard1.0/zh-hant/System.Globalization.xml", - "ref/netstandard1.3/System.Globalization.dll", - "ref/netstandard1.3/System.Globalization.xml", - "ref/netstandard1.3/de/System.Globalization.xml", - "ref/netstandard1.3/es/System.Globalization.xml", - "ref/netstandard1.3/fr/System.Globalization.xml", - "ref/netstandard1.3/it/System.Globalization.xml", - "ref/netstandard1.3/ja/System.Globalization.xml", - "ref/netstandard1.3/ko/System.Globalization.xml", - "ref/netstandard1.3/ru/System.Globalization.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Calendars/4.0.0": { - "sha512": "cL6WrdGKnNBx9W/iTr+jbffsEO4RLjEtOYcpVSzPNDoli6X5Q6bAfWtJYbJNOPi8Q0fXgBEvKK1ncFL/3FTqlA==", - "type": "package", - "path": "System.Globalization.Calendars/4.0.0", - "files": [ - "lib/DNXCore50/System.Globalization.Calendars.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/netcore50/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Globalization.Calendars.dll", - "ref/dotnet/System.Globalization.Calendars.xml", - "ref/dotnet/de/System.Globalization.Calendars.xml", - "ref/dotnet/es/System.Globalization.Calendars.xml", - "ref/dotnet/fr/System.Globalization.Calendars.xml", - "ref/dotnet/it/System.Globalization.Calendars.xml", - "ref/dotnet/ja/System.Globalization.Calendars.xml", - "ref/dotnet/ko/System.Globalization.Calendars.xml", - "ref/dotnet/ru/System.Globalization.Calendars.xml", - "ref/dotnet/zh-hans/System.Globalization.Calendars.xml", - "ref/dotnet/zh-hant/System.Globalization.Calendars.xml", - "ref/net46/System.Globalization.Calendars.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Globalization.Calendars.dll", - "system.globalization.calendars.4.0.0.nupkg.sha512", - "system.globalization.calendars.nuspec" - ] - }, - "System.Globalization.Calendars/4.3.0": { - "sha512": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "type": "package", - "path": "System.Globalization.Calendars/4.3.0", - "files": [ - "System.Globalization.Calendars.4.3.0.nupkg.sha512", - "System.Globalization.Calendars.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.xml", - "ref/netstandard1.3/de/System.Globalization.Calendars.xml", - "ref/netstandard1.3/es/System.Globalization.Calendars.xml", - "ref/netstandard1.3/fr/System.Globalization.Calendars.xml", - "ref/netstandard1.3/it/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ja/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ko/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ru/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Calendars.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Extensions/4.0.0": { - "sha512": "rqbUXiwpBCvJ18ySCsjh20zleazO+6fr3s5GihC2sVwhyS0MUl6+oc5Rzk0z6CKkS4kmxbZQSeZLsK7cFSO0ng==", - "type": "package", - "path": "System.Globalization.Extensions/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Globalization.Extensions.dll", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Globalization.Extensions.dll", - "ref/dotnet/System.Globalization.Extensions.xml", - "ref/dotnet/de/System.Globalization.Extensions.xml", - "ref/dotnet/es/System.Globalization.Extensions.xml", - "ref/dotnet/fr/System.Globalization.Extensions.xml", - "ref/dotnet/it/System.Globalization.Extensions.xml", - "ref/dotnet/ja/System.Globalization.Extensions.xml", - "ref/dotnet/ko/System.Globalization.Extensions.xml", - "ref/dotnet/ru/System.Globalization.Extensions.xml", - "ref/dotnet/zh-hans/System.Globalization.Extensions.xml", - "ref/dotnet/zh-hant/System.Globalization.Extensions.xml", - "ref/net46/System.Globalization.Extensions.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.globalization.extensions.4.0.0.nupkg.sha512", - "system.globalization.extensions.nuspec" - ] - }, - "System.Globalization.Extensions/4.3.0": { - "sha512": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "type": "package", - "path": "System.Globalization.Extensions/4.3.0", - "files": [ - "System.Globalization.Extensions.4.3.0.nupkg.sha512", - "System.Globalization.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.xml", - "ref/netstandard1.3/de/System.Globalization.Extensions.xml", - "ref/netstandard1.3/es/System.Globalization.Extensions.xml", - "ref/netstandard1.3/fr/System.Globalization.Extensions.xml", - "ref/netstandard1.3/it/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ja/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ko/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ru/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Extensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll", - "runtimes/win/lib/net46/System.Globalization.Extensions.dll", - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll" - ] - }, - "System.IO/4.0.10": { - "sha512": "kghf1CeYT+W2lw8a50/GxFz5HR9t6RkL4BvjxtTp1NxtEFWywnMA9W8FH/KYXiDNThcw9u/GOViDON4iJFGXIQ==", - "type": "package", - "path": "System.IO/4.0.10", - "files": [ - "lib/DNXCore50/System.IO.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.IO.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.dll", - "ref/dotnet/System.IO.xml", - "ref/dotnet/de/System.IO.xml", - "ref/dotnet/es/System.IO.xml", - "ref/dotnet/fr/System.IO.xml", - "ref/dotnet/it/System.IO.xml", - "ref/dotnet/ja/System.IO.xml", - "ref/dotnet/ko/System.IO.xml", - "ref/dotnet/ru/System.IO.xml", - "ref/dotnet/zh-hans/System.IO.xml", - "ref/dotnet/zh-hant/System.IO.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.IO.dll", - "system.io.4.0.10.nupkg.sha512", - "system.io.nuspec" - ] - }, - "System.IO/4.3.0": { - "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "type": "package", - "path": "System.IO/4.3.0", - "files": [ - "System.IO.4.3.0.nupkg.sha512", - "System.IO.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.IO.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.IO.dll", - "ref/netcore50/System.IO.dll", - "ref/netcore50/System.IO.xml", - "ref/netcore50/de/System.IO.xml", - "ref/netcore50/es/System.IO.xml", - "ref/netcore50/fr/System.IO.xml", - "ref/netcore50/it/System.IO.xml", - "ref/netcore50/ja/System.IO.xml", - "ref/netcore50/ko/System.IO.xml", - "ref/netcore50/ru/System.IO.xml", - "ref/netcore50/zh-hans/System.IO.xml", - "ref/netcore50/zh-hant/System.IO.xml", - "ref/netstandard1.0/System.IO.dll", - "ref/netstandard1.0/System.IO.xml", - "ref/netstandard1.0/de/System.IO.xml", - "ref/netstandard1.0/es/System.IO.xml", - "ref/netstandard1.0/fr/System.IO.xml", - "ref/netstandard1.0/it/System.IO.xml", - "ref/netstandard1.0/ja/System.IO.xml", - "ref/netstandard1.0/ko/System.IO.xml", - "ref/netstandard1.0/ru/System.IO.xml", - "ref/netstandard1.0/zh-hans/System.IO.xml", - "ref/netstandard1.0/zh-hant/System.IO.xml", - "ref/netstandard1.3/System.IO.dll", - "ref/netstandard1.3/System.IO.xml", - "ref/netstandard1.3/de/System.IO.xml", - "ref/netstandard1.3/es/System.IO.xml", - "ref/netstandard1.3/fr/System.IO.xml", - "ref/netstandard1.3/it/System.IO.xml", - "ref/netstandard1.3/ja/System.IO.xml", - "ref/netstandard1.3/ko/System.IO.xml", - "ref/netstandard1.3/ru/System.IO.xml", - "ref/netstandard1.3/zh-hans/System.IO.xml", - "ref/netstandard1.3/zh-hant/System.IO.xml", - "ref/netstandard1.5/System.IO.dll", - "ref/netstandard1.5/System.IO.xml", - "ref/netstandard1.5/de/System.IO.xml", - "ref/netstandard1.5/es/System.IO.xml", - "ref/netstandard1.5/fr/System.IO.xml", - "ref/netstandard1.5/it/System.IO.xml", - "ref/netstandard1.5/ja/System.IO.xml", - "ref/netstandard1.5/ko/System.IO.xml", - "ref/netstandard1.5/ru/System.IO.xml", - "ref/netstandard1.5/zh-hans/System.IO.xml", - "ref/netstandard1.5/zh-hant/System.IO.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.Compression/4.0.0": { - "sha512": "S+ljBE3py8pujTrsOOYHtDg2cnAifn6kBu/pfh1hMWIXd8DoVh0ADTA6Puv4q+nYj+Msm6JoFLNwuRSmztbsDQ==", - "type": "package", - "path": "System.IO.Compression/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.Compression.dll", - "lib/net45/_._", - "lib/netcore50/System.IO.Compression.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.Compression.dll", - "ref/dotnet/System.IO.Compression.xml", - "ref/dotnet/de/System.IO.Compression.xml", - "ref/dotnet/es/System.IO.Compression.xml", - "ref/dotnet/fr/System.IO.Compression.xml", - "ref/dotnet/it/System.IO.Compression.xml", - "ref/dotnet/ja/System.IO.Compression.xml", - "ref/dotnet/ko/System.IO.Compression.xml", - "ref/dotnet/ru/System.IO.Compression.xml", - "ref/dotnet/zh-hans/System.IO.Compression.xml", - "ref/dotnet/zh-hant/System.IO.Compression.xml", - "ref/net45/_._", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "system.io.compression.4.0.0.nupkg.sha512", - "system.io.compression.nuspec" - ] - }, - "System.IO.Compression/4.3.0": { - "sha512": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "type": "package", - "path": "System.IO.Compression/4.3.0", - "files": [ - "System.IO.Compression.4.3.0.nupkg.sha512", - "System.IO.Compression.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.IO.Compression.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/netcore50/de/System.IO.Compression.xml", - "ref/netcore50/es/System.IO.Compression.xml", - "ref/netcore50/fr/System.IO.Compression.xml", - "ref/netcore50/it/System.IO.Compression.xml", - "ref/netcore50/ja/System.IO.Compression.xml", - "ref/netcore50/ko/System.IO.Compression.xml", - "ref/netcore50/ru/System.IO.Compression.xml", - "ref/netcore50/zh-hans/System.IO.Compression.xml", - "ref/netcore50/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.1/System.IO.Compression.dll", - "ref/netstandard1.1/System.IO.Compression.xml", - "ref/netstandard1.1/de/System.IO.Compression.xml", - "ref/netstandard1.1/es/System.IO.Compression.xml", - "ref/netstandard1.1/fr/System.IO.Compression.xml", - "ref/netstandard1.1/it/System.IO.Compression.xml", - "ref/netstandard1.1/ja/System.IO.Compression.xml", - "ref/netstandard1.1/ko/System.IO.Compression.xml", - "ref/netstandard1.1/ru/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.3/System.IO.Compression.dll", - "ref/netstandard1.3/System.IO.Compression.xml", - "ref/netstandard1.3/de/System.IO.Compression.xml", - "ref/netstandard1.3/es/System.IO.Compression.xml", - "ref/netstandard1.3/fr/System.IO.Compression.xml", - "ref/netstandard1.3/it/System.IO.Compression.xml", - "ref/netstandard1.3/ja/System.IO.Compression.xml", - "ref/netstandard1.3/ko/System.IO.Compression.xml", - "ref/netstandard1.3/ru/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll", - "runtimes/win/lib/net46/System.IO.Compression.dll", - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll" - ] - }, - "System.IO.Compression.ZipFile/4.0.0": { - "sha512": "pwntmtsJqtt6Lez4Iyv4GVGW6DaXUTo9Rnlsx0MFagRgX+8F/sxG5S/IzDJabBj68sUWViz1QJrRZL4V9ngWDg==", - "type": "package", - "path": "System.IO.Compression.ZipFile/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.Compression.ZipFile.dll", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.Compression.ZipFile.dll", - "ref/dotnet/System.IO.Compression.ZipFile.xml", - "ref/dotnet/de/System.IO.Compression.ZipFile.xml", - "ref/dotnet/es/System.IO.Compression.ZipFile.xml", - "ref/dotnet/fr/System.IO.Compression.ZipFile.xml", - "ref/dotnet/it/System.IO.Compression.ZipFile.xml", - "ref/dotnet/ja/System.IO.Compression.ZipFile.xml", - "ref/dotnet/ko/System.IO.Compression.ZipFile.xml", - "ref/dotnet/ru/System.IO.Compression.ZipFile.xml", - "ref/dotnet/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/dotnet/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.compression.zipfile.4.0.0.nupkg.sha512", - "system.io.compression.zipfile.nuspec" - ] - }, - "System.IO.Compression.ZipFile/4.3.0": { - "sha512": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "type": "package", - "path": "System.IO.Compression.ZipFile/4.3.0", - "files": [ - "System.IO.Compression.ZipFile.4.3.0.nupkg.sha512", - "System.IO.Compression.ZipFile.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/de/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/es/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/fr/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/it/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ja/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ko/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ru/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem/4.0.0": { - "sha512": "eo05SPWfG+54UA0wxgRIYOuOslq+2QrJLXZaJDDsfLXG15OLguaItW39NYZTqUb4DeGOkU4R0wpOLOW4ynMUDQ==", - "type": "package", - "path": "System.IO.FileSystem/4.0.0", - "files": [ - "lib/DNXCore50/System.IO.FileSystem.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/netcore50/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.FileSystem.dll", - "ref/dotnet/System.IO.FileSystem.xml", - "ref/dotnet/de/System.IO.FileSystem.xml", - "ref/dotnet/es/System.IO.FileSystem.xml", - "ref/dotnet/fr/System.IO.FileSystem.xml", - "ref/dotnet/it/System.IO.FileSystem.xml", - "ref/dotnet/ja/System.IO.FileSystem.xml", - "ref/dotnet/ko/System.IO.FileSystem.xml", - "ref/dotnet/ru/System.IO.FileSystem.xml", - "ref/dotnet/zh-hans/System.IO.FileSystem.xml", - "ref/dotnet/zh-hant/System.IO.FileSystem.xml", - "ref/net46/System.IO.FileSystem.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.filesystem.4.0.0.nupkg.sha512", - "system.io.filesystem.nuspec" - ] - }, - "System.IO.FileSystem/4.3.0": { - "sha512": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "type": "package", - "path": "System.IO.FileSystem/4.3.0", - "files": [ - "System.IO.FileSystem.4.3.0.nupkg.sha512", - "System.IO.FileSystem.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem.Primitives/4.0.0": { - "sha512": "7pJUvYi/Yq3A5nagqCCiOw3+aJp3xXc/Cjr8dnJDnER3/6kX3LEencfqmXUcPl9+7OvRNyPMNhqsLAcMK6K/KA==", - "type": "package", - "path": "System.IO.FileSystem.Primitives/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.FileSystem.Primitives.dll", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.FileSystem.Primitives.dll", - "ref/dotnet/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/de/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/es/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/fr/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/it/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/ja/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/ko/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/ru/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.filesystem.primitives.4.0.0.nupkg.sha512", - "system.io.filesystem.primitives.nuspec" - ] - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "sha512": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "type": "package", - "path": "System.IO.FileSystem.Primitives/4.3.0", - "files": [ - "System.IO.FileSystem.Primitives.4.3.0.nupkg.sha512", - "System.IO.FileSystem.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.IsolatedStorage/4.0.0": { - "sha512": "d5KimUbZ49Ki6A/uwU+Iodng+nhJvpRs7hr/828cfeXC02LxUiggnRnAu+COtWcKvJ2YbBmAGOcO4GLK4fX1+w==", - "type": "package", - "path": "System.IO.IsolatedStorage/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/netcore50/System.IO.IsolatedStorage.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.IsolatedStorage.dll", - "ref/dotnet/System.IO.IsolatedStorage.xml", - "ref/dotnet/de/System.IO.IsolatedStorage.xml", - "ref/dotnet/es/System.IO.IsolatedStorage.xml", - "ref/dotnet/fr/System.IO.IsolatedStorage.xml", - "ref/dotnet/it/System.IO.IsolatedStorage.xml", - "ref/dotnet/ja/System.IO.IsolatedStorage.xml", - "ref/dotnet/ko/System.IO.IsolatedStorage.xml", - "ref/dotnet/ru/System.IO.IsolatedStorage.xml", - "ref/dotnet/zh-hans/System.IO.IsolatedStorage.xml", - "ref/dotnet/zh-hant/System.IO.IsolatedStorage.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.isolatedstorage.4.0.0.nupkg.sha512", - "system.io.isolatedstorage.nuspec" - ] - }, - "System.IO.UnmanagedMemoryStream/4.0.0": { - "sha512": "i2xczgQfwHmolORBNHxV9b5izP8VOBxgSA2gf+H55xBvwqtR+9r9adtzlc7at0MAwiLcsk6V1TZlv2vfRQr8Sw==", - "type": "package", - "path": "System.IO.UnmanagedMemoryStream/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.UnmanagedMemoryStream.dll", - "lib/net46/System.IO.UnmanagedMemoryStream.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.UnmanagedMemoryStream.dll", - "ref/dotnet/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/de/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/es/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/fr/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/it/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/ja/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/ko/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/ru/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/zh-hans/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/zh-hant/System.IO.UnmanagedMemoryStream.xml", - "ref/net46/System.IO.UnmanagedMemoryStream.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.unmanagedmemorystream.4.0.0.nupkg.sha512", - "system.io.unmanagedmemorystream.nuspec" - ] - }, - "System.Linq/4.0.0": { - "sha512": "r6Hlc+ytE6m/9UBr+nNRRdoJEWjoeQiT3L3lXYFDHoXk3VYsRBCDNXrawcexw7KPLaH0zamQLiAb6avhZ50cGg==", - "type": "package", - "path": "System.Linq/4.0.0", - "files": [ - "lib/dotnet/System.Linq.dll", - "lib/net45/_._", - "lib/netcore50/System.Linq.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Linq.dll", - "ref/dotnet/System.Linq.xml", - "ref/dotnet/de/System.Linq.xml", - "ref/dotnet/es/System.Linq.xml", - "ref/dotnet/fr/System.Linq.xml", - "ref/dotnet/it/System.Linq.xml", - "ref/dotnet/ja/System.Linq.xml", - "ref/dotnet/ko/System.Linq.xml", - "ref/dotnet/ru/System.Linq.xml", - "ref/dotnet/zh-hans/System.Linq.xml", - "ref/dotnet/zh-hant/System.Linq.xml", - "ref/net45/_._", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.linq.4.0.0.nupkg.sha512", - "system.linq.nuspec" - ] - }, - "System.Linq/4.3.0": { - "sha512": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "type": "package", - "path": "System.Linq/4.3.0", - "files": [ - "System.Linq.4.3.0.nupkg.sha512", - "System.Linq.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.dll", - "lib/netcore50/System.Linq.dll", - "lib/netstandard1.6/System.Linq.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.dll", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/netcore50/de/System.Linq.xml", - "ref/netcore50/es/System.Linq.xml", - "ref/netcore50/fr/System.Linq.xml", - "ref/netcore50/it/System.Linq.xml", - "ref/netcore50/ja/System.Linq.xml", - "ref/netcore50/ko/System.Linq.xml", - "ref/netcore50/ru/System.Linq.xml", - "ref/netcore50/zh-hans/System.Linq.xml", - "ref/netcore50/zh-hant/System.Linq.xml", - "ref/netstandard1.0/System.Linq.dll", - "ref/netstandard1.0/System.Linq.xml", - "ref/netstandard1.0/de/System.Linq.xml", - "ref/netstandard1.0/es/System.Linq.xml", - "ref/netstandard1.0/fr/System.Linq.xml", - "ref/netstandard1.0/it/System.Linq.xml", - "ref/netstandard1.0/ja/System.Linq.xml", - "ref/netstandard1.0/ko/System.Linq.xml", - "ref/netstandard1.0/ru/System.Linq.xml", - "ref/netstandard1.0/zh-hans/System.Linq.xml", - "ref/netstandard1.0/zh-hant/System.Linq.xml", - "ref/netstandard1.6/System.Linq.dll", - "ref/netstandard1.6/System.Linq.xml", - "ref/netstandard1.6/de/System.Linq.xml", - "ref/netstandard1.6/es/System.Linq.xml", - "ref/netstandard1.6/fr/System.Linq.xml", - "ref/netstandard1.6/it/System.Linq.xml", - "ref/netstandard1.6/ja/System.Linq.xml", - "ref/netstandard1.6/ko/System.Linq.xml", - "ref/netstandard1.6/ru/System.Linq.xml", - "ref/netstandard1.6/zh-hans/System.Linq.xml", - "ref/netstandard1.6/zh-hant/System.Linq.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq.Expressions/4.0.10": { - "sha512": "qhFkPqRsTfXBaacjQhxwwwUoU7TEtwlBIULj7nG7i4qAkvivil31VvOvDKppCSui5yGw0/325ZeNaMYRvTotXw==", - "type": "package", - "path": "System.Linq.Expressions/4.0.10", - "files": [ - "lib/DNXCore50/System.Linq.Expressions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Linq.Expressions.dll", - "ref/dotnet/System.Linq.Expressions.xml", - "ref/dotnet/de/System.Linq.Expressions.xml", - "ref/dotnet/es/System.Linq.Expressions.xml", - "ref/dotnet/fr/System.Linq.Expressions.xml", - "ref/dotnet/it/System.Linq.Expressions.xml", - "ref/dotnet/ja/System.Linq.Expressions.xml", - "ref/dotnet/ko/System.Linq.Expressions.xml", - "ref/dotnet/ru/System.Linq.Expressions.xml", - "ref/dotnet/zh-hans/System.Linq.Expressions.xml", - "ref/dotnet/zh-hant/System.Linq.Expressions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Linq.Expressions.dll", - "system.linq.expressions.4.0.10.nupkg.sha512", - "system.linq.expressions.nuspec" - ] - }, - "System.Linq.Expressions/4.3.0": { - "sha512": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "type": "package", - "path": "System.Linq.Expressions/4.3.0", - "files": [ - "System.Linq.Expressions.4.3.0.nupkg.sha512", - "System.Linq.Expressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.Expressions.dll", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/netstandard1.6/System.Linq.Expressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.xml", - "ref/netcore50/de/System.Linq.Expressions.xml", - "ref/netcore50/es/System.Linq.Expressions.xml", - "ref/netcore50/fr/System.Linq.Expressions.xml", - "ref/netcore50/it/System.Linq.Expressions.xml", - "ref/netcore50/ja/System.Linq.Expressions.xml", - "ref/netcore50/ko/System.Linq.Expressions.xml", - "ref/netcore50/ru/System.Linq.Expressions.xml", - "ref/netcore50/zh-hans/System.Linq.Expressions.xml", - "ref/netcore50/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.0/System.Linq.Expressions.dll", - "ref/netstandard1.0/System.Linq.Expressions.xml", - "ref/netstandard1.0/de/System.Linq.Expressions.xml", - "ref/netstandard1.0/es/System.Linq.Expressions.xml", - "ref/netstandard1.0/fr/System.Linq.Expressions.xml", - "ref/netstandard1.0/it/System.Linq.Expressions.xml", - "ref/netstandard1.0/ja/System.Linq.Expressions.xml", - "ref/netstandard1.0/ko/System.Linq.Expressions.xml", - "ref/netstandard1.0/ru/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.3/System.Linq.Expressions.dll", - "ref/netstandard1.3/System.Linq.Expressions.xml", - "ref/netstandard1.3/de/System.Linq.Expressions.xml", - "ref/netstandard1.3/es/System.Linq.Expressions.xml", - "ref/netstandard1.3/fr/System.Linq.Expressions.xml", - "ref/netstandard1.3/it/System.Linq.Expressions.xml", - "ref/netstandard1.3/ja/System.Linq.Expressions.xml", - "ref/netstandard1.3/ko/System.Linq.Expressions.xml", - "ref/netstandard1.3/ru/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.6/System.Linq.Expressions.dll", - "ref/netstandard1.6/System.Linq.Expressions.xml", - "ref/netstandard1.6/de/System.Linq.Expressions.xml", - "ref/netstandard1.6/es/System.Linq.Expressions.xml", - "ref/netstandard1.6/fr/System.Linq.Expressions.xml", - "ref/netstandard1.6/it/System.Linq.Expressions.xml", - "ref/netstandard1.6/ja/System.Linq.Expressions.xml", - "ref/netstandard1.6/ko/System.Linq.Expressions.xml", - "ref/netstandard1.6/ru/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hant/System.Linq.Expressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Linq.Expressions.dll" - ] - }, - "System.Linq.Parallel/4.0.0": { - "sha512": "PtH7KKh1BbzVow4XY17pnrn7Io63ApMdwzRE2o2HnzsKQD/0o7X5xe6mxrDUqTm9ZCR3/PNhAlP13VY1HnHsbA==", - "type": "package", - "path": "System.Linq.Parallel/4.0.0", - "files": [ - "lib/dotnet/System.Linq.Parallel.dll", - "lib/net45/_._", - "lib/netcore50/System.Linq.Parallel.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Linq.Parallel.dll", - "ref/dotnet/System.Linq.Parallel.xml", - "ref/dotnet/de/System.Linq.Parallel.xml", - "ref/dotnet/es/System.Linq.Parallel.xml", - "ref/dotnet/fr/System.Linq.Parallel.xml", - "ref/dotnet/it/System.Linq.Parallel.xml", - "ref/dotnet/ja/System.Linq.Parallel.xml", - "ref/dotnet/ko/System.Linq.Parallel.xml", - "ref/dotnet/ru/System.Linq.Parallel.xml", - "ref/dotnet/zh-hans/System.Linq.Parallel.xml", - "ref/dotnet/zh-hant/System.Linq.Parallel.xml", - "ref/net45/_._", - "ref/netcore50/System.Linq.Parallel.dll", - "ref/netcore50/System.Linq.Parallel.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.linq.parallel.4.0.0.nupkg.sha512", - "system.linq.parallel.nuspec" - ] - }, - "System.Linq.Queryable/4.0.0": { - "sha512": "DIlvCNn3ucFvwMMzXcag4aFnFJ1fdxkQ5NqwJe9Nh7y8ozzhDm07YakQL/yoF3P1dLzY1T2cTpuwbAmVSdXyBA==", - "type": "package", - "path": "System.Linq.Queryable/4.0.0", - "files": [ - "lib/dotnet/System.Linq.Queryable.dll", - "lib/net45/_._", - "lib/netcore50/System.Linq.Queryable.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Linq.Queryable.dll", - "ref/dotnet/System.Linq.Queryable.xml", - "ref/dotnet/de/System.Linq.Queryable.xml", - "ref/dotnet/es/System.Linq.Queryable.xml", - "ref/dotnet/fr/System.Linq.Queryable.xml", - "ref/dotnet/it/System.Linq.Queryable.xml", - "ref/dotnet/ja/System.Linq.Queryable.xml", - "ref/dotnet/ko/System.Linq.Queryable.xml", - "ref/dotnet/ru/System.Linq.Queryable.xml", - "ref/dotnet/zh-hans/System.Linq.Queryable.xml", - "ref/dotnet/zh-hant/System.Linq.Queryable.xml", - "ref/net45/_._", - "ref/netcore50/System.Linq.Queryable.dll", - "ref/netcore50/System.Linq.Queryable.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.linq.queryable.4.0.0.nupkg.sha512", - "system.linq.queryable.nuspec" - ] - }, - "System.Net.Http/4.0.0": { - "sha512": "mZuAl7jw/mFY8jUq4ITKECxVBh9a8SJt9BC/+lJbmo7cRKspxE3PsITz+KiaCEsexN5WYPzwBOx0oJH/0HlPyQ==", - "type": "package", - "path": "System.Net.Http/4.0.0", - "files": [ - "lib/DNXCore50/System.Net.Http.dll", - "lib/net45/_._", - "lib/netcore50/System.Net.Http.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Net.Http.dll", - "ref/dotnet/System.Net.Http.xml", - "ref/dotnet/de/System.Net.Http.xml", - "ref/dotnet/es/System.Net.Http.xml", - "ref/dotnet/fr/System.Net.Http.xml", - "ref/dotnet/it/System.Net.Http.xml", - "ref/dotnet/ja/System.Net.Http.xml", - "ref/dotnet/ko/System.Net.Http.xml", - "ref/dotnet/ru/System.Net.Http.xml", - "ref/dotnet/zh-hans/System.Net.Http.xml", - "ref/dotnet/zh-hant/System.Net.Http.xml", - "ref/net45/_._", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.net.http.4.0.0.nupkg.sha512", - "system.net.http.nuspec" - ] - }, - "System.Net.Http/4.3.0": { - "sha512": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "type": "package", - "path": "System.Net.Http/4.3.0", - "files": [ - "System.Net.Http.4.3.0.nupkg.sha512", - "System.Net.Http.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/Xamarinmac20/_._", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/net46/System.Net.Http.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/Xamarinmac20/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/net46/System.Net.Http.dll", - "ref/net46/System.Net.Http.xml", - "ref/net46/de/System.Net.Http.xml", - "ref/net46/es/System.Net.Http.xml", - "ref/net46/fr/System.Net.Http.xml", - "ref/net46/it/System.Net.Http.xml", - "ref/net46/ja/System.Net.Http.xml", - "ref/net46/ko/System.Net.Http.xml", - "ref/net46/ru/System.Net.Http.xml", - "ref/net46/zh-hans/System.Net.Http.xml", - "ref/net46/zh-hant/System.Net.Http.xml", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/netcore50/de/System.Net.Http.xml", - "ref/netcore50/es/System.Net.Http.xml", - "ref/netcore50/fr/System.Net.Http.xml", - "ref/netcore50/it/System.Net.Http.xml", - "ref/netcore50/ja/System.Net.Http.xml", - "ref/netcore50/ko/System.Net.Http.xml", - "ref/netcore50/ru/System.Net.Http.xml", - "ref/netcore50/zh-hans/System.Net.Http.xml", - "ref/netcore50/zh-hant/System.Net.Http.xml", - "ref/netstandard1.1/System.Net.Http.dll", - "ref/netstandard1.1/System.Net.Http.xml", - "ref/netstandard1.1/de/System.Net.Http.xml", - "ref/netstandard1.1/es/System.Net.Http.xml", - "ref/netstandard1.1/fr/System.Net.Http.xml", - "ref/netstandard1.1/it/System.Net.Http.xml", - "ref/netstandard1.1/ja/System.Net.Http.xml", - "ref/netstandard1.1/ko/System.Net.Http.xml", - "ref/netstandard1.1/ru/System.Net.Http.xml", - "ref/netstandard1.1/zh-hans/System.Net.Http.xml", - "ref/netstandard1.1/zh-hant/System.Net.Http.xml", - "ref/netstandard1.3/System.Net.Http.dll", - "ref/netstandard1.3/System.Net.Http.xml", - "ref/netstandard1.3/de/System.Net.Http.xml", - "ref/netstandard1.3/es/System.Net.Http.xml", - "ref/netstandard1.3/fr/System.Net.Http.xml", - "ref/netstandard1.3/it/System.Net.Http.xml", - "ref/netstandard1.3/ja/System.Net.Http.xml", - "ref/netstandard1.3/ko/System.Net.Http.xml", - "ref/netstandard1.3/ru/System.Net.Http.xml", - "ref/netstandard1.3/zh-hans/System.Net.Http.xml", - "ref/netstandard1.3/zh-hant/System.Net.Http.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll", - "runtimes/win/lib/net46/System.Net.Http.dll", - "runtimes/win/lib/netcore50/System.Net.Http.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll" - ] - }, - "System.Net.Http.Rtc/4.0.0": { - "sha512": "PlE+oJgXdbxPmZYR6GBywRkyIPovjB1Y0SYHizj2Iflgu80uJQC4szl9gue4rKI2FgXiEbj9JL7wL5K3mp9HAQ==", - "type": "package", - "path": "System.Net.Http.Rtc/4.0.0", - "files": [ - "lib/netcore50/System.Net.Http.Rtc.dll", - "lib/win8/_._", - "ref/dotnet/System.Net.Http.Rtc.dll", - "ref/dotnet/System.Net.Http.Rtc.xml", - "ref/dotnet/de/System.Net.Http.Rtc.xml", - "ref/dotnet/es/System.Net.Http.Rtc.xml", - "ref/dotnet/fr/System.Net.Http.Rtc.xml", - "ref/dotnet/it/System.Net.Http.Rtc.xml", - "ref/dotnet/ja/System.Net.Http.Rtc.xml", - "ref/dotnet/ko/System.Net.Http.Rtc.xml", - "ref/dotnet/ru/System.Net.Http.Rtc.xml", - "ref/dotnet/zh-hans/System.Net.Http.Rtc.xml", - "ref/dotnet/zh-hant/System.Net.Http.Rtc.xml", - "ref/netcore50/System.Net.Http.Rtc.dll", - "ref/netcore50/System.Net.Http.Rtc.xml", - "ref/win8/_._", - "system.net.http.rtc.4.0.0.nupkg.sha512", - "system.net.http.rtc.nuspec" - ] - }, - "System.Net.NetworkInformation/4.0.0": { - "sha512": "D68KCf5VK1G1GgFUwD901gU6cnMITksOdfdxUCt9ReCZfT1pigaDqjJ7XbiLAM4jm7TfZHB7g5mbOf1mbG3yBA==", - "type": "package", - "path": "System.Net.NetworkInformation/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Net.NetworkInformation.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.NetworkInformation.dll", - "ref/dotnet/System.Net.NetworkInformation.xml", - "ref/dotnet/de/System.Net.NetworkInformation.xml", - "ref/dotnet/es/System.Net.NetworkInformation.xml", - "ref/dotnet/fr/System.Net.NetworkInformation.xml", - "ref/dotnet/it/System.Net.NetworkInformation.xml", - "ref/dotnet/ja/System.Net.NetworkInformation.xml", - "ref/dotnet/ko/System.Net.NetworkInformation.xml", - "ref/dotnet/ru/System.Net.NetworkInformation.xml", - "ref/dotnet/zh-hans/System.Net.NetworkInformation.xml", - "ref/dotnet/zh-hant/System.Net.NetworkInformation.xml", - "ref/net45/_._", - "ref/netcore50/System.Net.NetworkInformation.dll", - "ref/netcore50/System.Net.NetworkInformation.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.networkinformation.4.0.0.nupkg.sha512", - "system.net.networkinformation.nuspec" - ] - }, - "System.Net.Primitives/4.0.10": { - "sha512": "YQqIpmMhnKjIbT7rl6dlf7xM5DxaMR+whduZ9wKb9OhMLjoueAJO3HPPJI+Naf3v034kb+xZqdc3zo44o3HWcg==", - "type": "package", - "path": "System.Net.Primitives/4.0.10", - "files": [ - "lib/DNXCore50/System.Net.Primitives.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Net.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.Primitives.dll", - "ref/dotnet/System.Net.Primitives.xml", - "ref/dotnet/de/System.Net.Primitives.xml", - "ref/dotnet/es/System.Net.Primitives.xml", - "ref/dotnet/fr/System.Net.Primitives.xml", - "ref/dotnet/it/System.Net.Primitives.xml", - "ref/dotnet/ja/System.Net.Primitives.xml", - "ref/dotnet/ko/System.Net.Primitives.xml", - "ref/dotnet/ru/System.Net.Primitives.xml", - "ref/dotnet/zh-hans/System.Net.Primitives.xml", - "ref/dotnet/zh-hant/System.Net.Primitives.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.primitives.4.0.10.nupkg.sha512", - "system.net.primitives.nuspec" - ] - }, - "System.Net.Primitives/4.3.0": { - "sha512": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "type": "package", - "path": "System.Net.Primitives/4.3.0", - "files": [ - "System.Net.Primitives.4.3.0.nupkg.sha512", - "System.Net.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Net.Primitives.dll", - "ref/netcore50/System.Net.Primitives.xml", - "ref/netcore50/de/System.Net.Primitives.xml", - "ref/netcore50/es/System.Net.Primitives.xml", - "ref/netcore50/fr/System.Net.Primitives.xml", - "ref/netcore50/it/System.Net.Primitives.xml", - "ref/netcore50/ja/System.Net.Primitives.xml", - "ref/netcore50/ko/System.Net.Primitives.xml", - "ref/netcore50/ru/System.Net.Primitives.xml", - "ref/netcore50/zh-hans/System.Net.Primitives.xml", - "ref/netcore50/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.0/System.Net.Primitives.dll", - "ref/netstandard1.0/System.Net.Primitives.xml", - "ref/netstandard1.0/de/System.Net.Primitives.xml", - "ref/netstandard1.0/es/System.Net.Primitives.xml", - "ref/netstandard1.0/fr/System.Net.Primitives.xml", - "ref/netstandard1.0/it/System.Net.Primitives.xml", - "ref/netstandard1.0/ja/System.Net.Primitives.xml", - "ref/netstandard1.0/ko/System.Net.Primitives.xml", - "ref/netstandard1.0/ru/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.1/System.Net.Primitives.dll", - "ref/netstandard1.1/System.Net.Primitives.xml", - "ref/netstandard1.1/de/System.Net.Primitives.xml", - "ref/netstandard1.1/es/System.Net.Primitives.xml", - "ref/netstandard1.1/fr/System.Net.Primitives.xml", - "ref/netstandard1.1/it/System.Net.Primitives.xml", - "ref/netstandard1.1/ja/System.Net.Primitives.xml", - "ref/netstandard1.1/ko/System.Net.Primitives.xml", - "ref/netstandard1.1/ru/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.3/System.Net.Primitives.dll", - "ref/netstandard1.3/System.Net.Primitives.xml", - "ref/netstandard1.3/de/System.Net.Primitives.xml", - "ref/netstandard1.3/es/System.Net.Primitives.xml", - "ref/netstandard1.3/fr/System.Net.Primitives.xml", - "ref/netstandard1.3/it/System.Net.Primitives.xml", - "ref/netstandard1.3/ja/System.Net.Primitives.xml", - "ref/netstandard1.3/ko/System.Net.Primitives.xml", - "ref/netstandard1.3/ru/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Net.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.Requests/4.0.10": { - "sha512": "A6XBR7TztiIQg6hx7VGfbBKmRTAavUERm2E7pmNz/gZeGvwyP0lcKHZxylJtNVKj7DPwr91bD87oLY6zZYntcg==", - "type": "package", - "path": "System.Net.Requests/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Net.Requests.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.Requests.dll", - "ref/dotnet/System.Net.Requests.xml", - "ref/dotnet/de/System.Net.Requests.xml", - "ref/dotnet/es/System.Net.Requests.xml", - "ref/dotnet/fr/System.Net.Requests.xml", - "ref/dotnet/it/System.Net.Requests.xml", - "ref/dotnet/ja/System.Net.Requests.xml", - "ref/dotnet/ko/System.Net.Requests.xml", - "ref/dotnet/ru/System.Net.Requests.xml", - "ref/dotnet/zh-hans/System.Net.Requests.xml", - "ref/dotnet/zh-hant/System.Net.Requests.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.requests.4.0.10.nupkg.sha512", - "system.net.requests.nuspec" - ] - }, - "System.Net.Sockets/4.0.0": { - "sha512": "7bBNLdO6Xw0BGyFVSxjloGXMvsc3qQmW+70bYMLwHEAVivMK8zx+E7XO8CeJnAko2mFj6R402E798EGYUksFcQ==", - "type": "package", - "path": "System.Net.Sockets/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/netcore50/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.Sockets.dll", - "ref/dotnet/System.Net.Sockets.xml", - "ref/dotnet/de/System.Net.Sockets.xml", - "ref/dotnet/es/System.Net.Sockets.xml", - "ref/dotnet/fr/System.Net.Sockets.xml", - "ref/dotnet/it/System.Net.Sockets.xml", - "ref/dotnet/ja/System.Net.Sockets.xml", - "ref/dotnet/ko/System.Net.Sockets.xml", - "ref/dotnet/ru/System.Net.Sockets.xml", - "ref/dotnet/zh-hans/System.Net.Sockets.xml", - "ref/dotnet/zh-hant/System.Net.Sockets.xml", - "ref/net46/System.Net.Sockets.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.sockets.4.0.0.nupkg.sha512", - "system.net.sockets.nuspec" - ] - }, - "System.Net.Sockets/4.3.0": { - "sha512": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "type": "package", - "path": "System.Net.Sockets/4.3.0", - "files": [ - "System.Net.Sockets.4.3.0.nupkg.sha512", - "System.Net.Sockets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.xml", - "ref/netstandard1.3/de/System.Net.Sockets.xml", - "ref/netstandard1.3/es/System.Net.Sockets.xml", - "ref/netstandard1.3/fr/System.Net.Sockets.xml", - "ref/netstandard1.3/it/System.Net.Sockets.xml", - "ref/netstandard1.3/ja/System.Net.Sockets.xml", - "ref/netstandard1.3/ko/System.Net.Sockets.xml", - "ref/netstandard1.3/ru/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hans/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hant/System.Net.Sockets.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.WebHeaderCollection/4.0.0": { - "sha512": "IsIZAsHm/yK7R/XASnEc4EMffFLIMgYchG3/zJv6B4LwMnXZwrVlSPpNbPgEVb0lSXyztsn7A6sIPAACQQ2vTQ==", - "type": "package", - "path": "System.Net.WebHeaderCollection/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Net.WebHeaderCollection.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.WebHeaderCollection.dll", - "ref/dotnet/System.Net.WebHeaderCollection.xml", - "ref/dotnet/de/System.Net.WebHeaderCollection.xml", - "ref/dotnet/es/System.Net.WebHeaderCollection.xml", - "ref/dotnet/fr/System.Net.WebHeaderCollection.xml", - "ref/dotnet/it/System.Net.WebHeaderCollection.xml", - "ref/dotnet/ja/System.Net.WebHeaderCollection.xml", - "ref/dotnet/ko/System.Net.WebHeaderCollection.xml", - "ref/dotnet/ru/System.Net.WebHeaderCollection.xml", - "ref/dotnet/zh-hans/System.Net.WebHeaderCollection.xml", - "ref/dotnet/zh-hant/System.Net.WebHeaderCollection.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.webheadercollection.4.0.0.nupkg.sha512", - "system.net.webheadercollection.nuspec" - ] - }, - "System.Numerics.Vectors/4.1.0": { - "sha512": "jpubR06GWPoZA0oU5xLM7kHeV59/CKPBXZk4Jfhi0T3DafxbrdueHZ8kXlb+Fb5nd3DAyyMh2/eqEzLX0xv6Qg==", - "type": "package", - "path": "System.Numerics.Vectors/4.1.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Numerics.Vectors.dll", - "lib/net46/System.Numerics.Vectors.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Numerics.Vectors.dll", - "ref/net46/System.Numerics.Vectors.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.numerics.vectors.4.1.0.nupkg.sha512", - "system.numerics.vectors.nuspec" - ] - }, - "System.Numerics.Vectors.WindowsRuntime/4.0.0": { - "sha512": "Ly7GvoPFZq6GyfZpfS0E7uCk1cinl5BANAngXVuau3lD2QqZJMHitzlPv6n1FlIn6krfv99X2IPkIaVzUwDHXA==", - "type": "package", - "path": "System.Numerics.Vectors.WindowsRuntime/4.0.0", - "files": [ - "lib/dotnet/System.Numerics.Vectors.WindowsRuntime.dll", - "system.numerics.vectors.windowsruntime.4.0.0.nupkg.sha512", - "system.numerics.vectors.windowsruntime.nuspec" - ] - }, - "System.ObjectModel/4.0.10": { - "sha512": "Djn1wb0vP662zxbe+c3mOhvC4vkQGicsFs1Wi0/GJJpp3Eqp+oxbJ+p2Sx3O0efYueggAI5SW+BqEoczjfr1cA==", - "type": "package", - "path": "System.ObjectModel/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.ObjectModel.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ObjectModel.dll", - "ref/dotnet/System.ObjectModel.xml", - "ref/dotnet/de/System.ObjectModel.xml", - "ref/dotnet/es/System.ObjectModel.xml", - "ref/dotnet/fr/System.ObjectModel.xml", - "ref/dotnet/it/System.ObjectModel.xml", - "ref/dotnet/ja/System.ObjectModel.xml", - "ref/dotnet/ko/System.ObjectModel.xml", - "ref/dotnet/ru/System.ObjectModel.xml", - "ref/dotnet/zh-hans/System.ObjectModel.xml", - "ref/dotnet/zh-hant/System.ObjectModel.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.objectmodel.4.0.10.nupkg.sha512", - "system.objectmodel.nuspec" - ] - }, - "System.ObjectModel/4.3.0": { - "sha512": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "type": "package", - "path": "System.ObjectModel/4.3.0", - "files": [ - "System.ObjectModel.4.3.0.nupkg.sha512", - "System.ObjectModel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ObjectModel.dll", - "lib/netstandard1.3/System.ObjectModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ObjectModel.dll", - "ref/netcore50/System.ObjectModel.xml", - "ref/netcore50/de/System.ObjectModel.xml", - "ref/netcore50/es/System.ObjectModel.xml", - "ref/netcore50/fr/System.ObjectModel.xml", - "ref/netcore50/it/System.ObjectModel.xml", - "ref/netcore50/ja/System.ObjectModel.xml", - "ref/netcore50/ko/System.ObjectModel.xml", - "ref/netcore50/ru/System.ObjectModel.xml", - "ref/netcore50/zh-hans/System.ObjectModel.xml", - "ref/netcore50/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.0/System.ObjectModel.dll", - "ref/netstandard1.0/System.ObjectModel.xml", - "ref/netstandard1.0/de/System.ObjectModel.xml", - "ref/netstandard1.0/es/System.ObjectModel.xml", - "ref/netstandard1.0/fr/System.ObjectModel.xml", - "ref/netstandard1.0/it/System.ObjectModel.xml", - "ref/netstandard1.0/ja/System.ObjectModel.xml", - "ref/netstandard1.0/ko/System.ObjectModel.xml", - "ref/netstandard1.0/ru/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.3/System.ObjectModel.dll", - "ref/netstandard1.3/System.ObjectModel.xml", - "ref/netstandard1.3/de/System.ObjectModel.xml", - "ref/netstandard1.3/es/System.ObjectModel.xml", - "ref/netstandard1.3/fr/System.ObjectModel.xml", - "ref/netstandard1.3/it/System.ObjectModel.xml", - "ref/netstandard1.3/ja/System.ObjectModel.xml", - "ref/netstandard1.3/ko/System.ObjectModel.xml", - "ref/netstandard1.3/ru/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hant/System.ObjectModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Private.DataContractSerialization/4.1.0": { - "sha512": "jihi0lC7TMGx8QtMuz3tRFoXdP0BHbceAdd3gvRbNnxM3W93jSRE/cocQyGf64wlC/1etjHKPwnwdu+PDJkjnA==", - "type": "package", - "path": "System.Private.DataContractSerialization/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "runtime.json", - "system.private.datacontractserialization.4.1.0.nupkg.sha512", - "system.private.datacontractserialization.nuspec" - ] - }, - "System.Private.Networking/4.0.0": { - "sha512": "RUEqdBdJjISC65dO8l4LdN7vTdlXH+attUpKnauDUHVtLbIKdlDB9LKoLzCQsTQRP7vzUJHWYXznHJBkjAA7yA==", - "type": "package", - "path": "System.Private.Networking/4.0.0", - "files": [ - "lib/DNXCore50/System.Private.Networking.dll", - "lib/netcore50/System.Private.Networking.dll", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "system.private.networking.4.0.0.nupkg.sha512", - "system.private.networking.nuspec" - ] - }, - "System.Private.ServiceModel/4.0.0": { - "sha512": "cm2wEa1f9kuUq/2k8uIwepgZJi5HdxXSnjGQIeXmAb7RaWfZPEC/iamv9GJ67b5LPnCZHR0KvtFqh82e8AAYSw==", - "type": "package", - "path": "System.Private.ServiceModel/4.0.0", - "files": [ - "lib/DNXCore50/System.Private.ServiceModel.dll", - "lib/netcore50/System.Private.ServiceModel.dll", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "system.private.servicemodel.4.0.0.nupkg.sha512", - "system.private.servicemodel.nuspec" - ] - }, - "System.Private.Uri/4.0.0": { - "sha512": "CtuxaCKcRIvPcsqquVl3mPp79EDZPMr2UogfiFCxCs+t2z1VjbpQsKNs1GHZ8VQetqbk1mr0V1yAfMe6y8CHDA==", - "type": "package", - "path": "System.Private.Uri/4.0.0", - "files": [ - "lib/DNXCore50/System.Private.Uri.dll", - "lib/netcore50/System.Private.Uri.dll", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "runtimes/win8-aot/lib/netcore50/System.Private.Uri.dll", - "system.private.uri.4.0.0.nupkg.sha512", - "system.private.uri.nuspec" - ] - }, - "System.Reflection/4.0.10": { - "sha512": "WZ+4lEE4gqGx6mrqLhSiW4oi6QLPWwdNjzhhTONmhELOrW8Cw9phlO9tltgvRUuQUqYtBiliFwhO5S5fCJElVw==", - "type": "package", - "path": "System.Reflection/4.0.10", - "files": [ - "lib/DNXCore50/System.Reflection.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Reflection.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Reflection.dll", - "ref/dotnet/System.Reflection.xml", - "ref/dotnet/de/System.Reflection.xml", - "ref/dotnet/es/System.Reflection.xml", - "ref/dotnet/fr/System.Reflection.xml", - "ref/dotnet/it/System.Reflection.xml", - "ref/dotnet/ja/System.Reflection.xml", - "ref/dotnet/ko/System.Reflection.xml", - "ref/dotnet/ru/System.Reflection.xml", - "ref/dotnet/zh-hans/System.Reflection.xml", - "ref/dotnet/zh-hant/System.Reflection.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.dll", - "system.reflection.4.0.10.nupkg.sha512", - "system.reflection.nuspec" - ] - }, - "System.Reflection/4.3.0": { - "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "type": "package", - "path": "System.Reflection/4.3.0", - "files": [ - "System.Reflection.4.3.0.nupkg.sha512", - "System.Reflection.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Reflection.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Reflection.dll", - "ref/netcore50/System.Reflection.dll", - "ref/netcore50/System.Reflection.xml", - "ref/netcore50/de/System.Reflection.xml", - "ref/netcore50/es/System.Reflection.xml", - "ref/netcore50/fr/System.Reflection.xml", - "ref/netcore50/it/System.Reflection.xml", - "ref/netcore50/ja/System.Reflection.xml", - "ref/netcore50/ko/System.Reflection.xml", - "ref/netcore50/ru/System.Reflection.xml", - "ref/netcore50/zh-hans/System.Reflection.xml", - "ref/netcore50/zh-hant/System.Reflection.xml", - "ref/netstandard1.0/System.Reflection.dll", - "ref/netstandard1.0/System.Reflection.xml", - "ref/netstandard1.0/de/System.Reflection.xml", - "ref/netstandard1.0/es/System.Reflection.xml", - "ref/netstandard1.0/fr/System.Reflection.xml", - "ref/netstandard1.0/it/System.Reflection.xml", - "ref/netstandard1.0/ja/System.Reflection.xml", - "ref/netstandard1.0/ko/System.Reflection.xml", - "ref/netstandard1.0/ru/System.Reflection.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.xml", - "ref/netstandard1.3/System.Reflection.dll", - "ref/netstandard1.3/System.Reflection.xml", - "ref/netstandard1.3/de/System.Reflection.xml", - "ref/netstandard1.3/es/System.Reflection.xml", - "ref/netstandard1.3/fr/System.Reflection.xml", - "ref/netstandard1.3/it/System.Reflection.xml", - "ref/netstandard1.3/ja/System.Reflection.xml", - "ref/netstandard1.3/ko/System.Reflection.xml", - "ref/netstandard1.3/ru/System.Reflection.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.xml", - "ref/netstandard1.5/System.Reflection.dll", - "ref/netstandard1.5/System.Reflection.xml", - "ref/netstandard1.5/de/System.Reflection.xml", - "ref/netstandard1.5/es/System.Reflection.xml", - "ref/netstandard1.5/fr/System.Reflection.xml", - "ref/netstandard1.5/it/System.Reflection.xml", - "ref/netstandard1.5/ja/System.Reflection.xml", - "ref/netstandard1.5/ko/System.Reflection.xml", - "ref/netstandard1.5/ru/System.Reflection.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.Context/4.0.0": { - "sha512": "Gz4sUHHFd/52RjHccSHbOXdujJEWKfL3gIaA+ekxvQaQfJGbI2tPzA0Uv3WTCTDRGHgtoNq5WS9E007Dt4P/VQ==", - "type": "package", - "path": "System.Reflection.Context/4.0.0", - "files": [ - "lib/net45/_._", - "lib/netcore50/System.Reflection.Context.dll", - "lib/win8/_._", - "ref/dotnet/System.Reflection.Context.dll", - "ref/dotnet/System.Reflection.Context.xml", - "ref/dotnet/de/System.Reflection.Context.xml", - "ref/dotnet/es/System.Reflection.Context.xml", - "ref/dotnet/fr/System.Reflection.Context.xml", - "ref/dotnet/it/System.Reflection.Context.xml", - "ref/dotnet/ja/System.Reflection.Context.xml", - "ref/dotnet/ko/System.Reflection.Context.xml", - "ref/dotnet/ru/System.Reflection.Context.xml", - "ref/dotnet/zh-hans/System.Reflection.Context.xml", - "ref/dotnet/zh-hant/System.Reflection.Context.xml", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Context.dll", - "ref/netcore50/System.Reflection.Context.xml", - "ref/win8/_._", - "system.reflection.context.4.0.0.nupkg.sha512", - "system.reflection.context.nuspec" - ] - }, - "System.Reflection.DispatchProxy/4.0.0": { - "sha512": "Kd/4o6DqBfJA4058X8oGEu1KlT8Ej0A+WGeoQgZU2h+3f2vC8NRbHxeOSZvxj9/MPZ1RYmZMGL1ApO9xG/4IVA==", - "type": "package", - "path": "System.Reflection.DispatchProxy/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.DispatchProxy.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.DispatchProxy.dll", - "lib/netcore50/System.Reflection.DispatchProxy.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Reflection.DispatchProxy.dll", - "ref/dotnet/System.Reflection.DispatchProxy.xml", - "ref/dotnet/de/System.Reflection.DispatchProxy.xml", - "ref/dotnet/es/System.Reflection.DispatchProxy.xml", - "ref/dotnet/fr/System.Reflection.DispatchProxy.xml", - "ref/dotnet/it/System.Reflection.DispatchProxy.xml", - "ref/dotnet/ja/System.Reflection.DispatchProxy.xml", - "ref/dotnet/ko/System.Reflection.DispatchProxy.xml", - "ref/dotnet/ru/System.Reflection.DispatchProxy.xml", - "ref/dotnet/zh-hans/System.Reflection.DispatchProxy.xml", - "ref/dotnet/zh-hant/System.Reflection.DispatchProxy.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Reflection.DispatchProxy.dll", - "system.reflection.dispatchproxy.4.0.0.nupkg.sha512", - "system.reflection.dispatchproxy.nuspec" - ] - }, - "System.Reflection.Emit/4.3.0": { - "sha512": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "type": "package", - "path": "System.Reflection.Emit/4.3.0", - "files": [ - "System.Reflection.Emit.4.3.0.nupkg.sha512", - "System.Reflection.Emit.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.dll", - "lib/netstandard1.3/System.Reflection.Emit.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/net45/_._", - "ref/netstandard1.1/System.Reflection.Emit.dll", - "ref/netstandard1.1/System.Reflection.Emit.xml", - "ref/netstandard1.1/de/System.Reflection.Emit.xml", - "ref/netstandard1.1/es/System.Reflection.Emit.xml", - "ref/netstandard1.1/fr/System.Reflection.Emit.xml", - "ref/netstandard1.1/it/System.Reflection.Emit.xml", - "ref/netstandard1.1/ja/System.Reflection.Emit.xml", - "ref/netstandard1.1/ko/System.Reflection.Emit.xml", - "ref/netstandard1.1/ru/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", - "ref/xamarinmac20/_._" - ] - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "sha512": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "type": "package", - "path": "System.Reflection.Emit.ILGeneration/4.3.0", - "files": [ - "System.Reflection.Emit.ILGeneration.4.3.0.nupkg.sha512", - "System.Reflection.Emit.ILGeneration.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.ILGeneration.dll", - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.ILGeneration.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "sha512": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "type": "package", - "path": "System.Reflection.Emit.Lightweight/4.3.0", - "files": [ - "System.Reflection.Emit.Lightweight.4.3.0.nupkg.sha512", - "System.Reflection.Emit.Lightweight.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.Lightweight.dll", - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Extensions/4.0.0": { - "sha512": "dbYaZWCyFAu1TGYUqR2n+Q+1casSHPR2vVW0WVNkXpZbrd2BXcZ7cpvpu9C98CTHtNmyfMWCLpCclDqly23t6A==", - "type": "package", - "path": "System.Reflection.Extensions/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.Extensions.dll", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Extensions.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Reflection.Extensions.dll", - "ref/dotnet/System.Reflection.Extensions.xml", - "ref/dotnet/de/System.Reflection.Extensions.xml", - "ref/dotnet/es/System.Reflection.Extensions.xml", - "ref/dotnet/fr/System.Reflection.Extensions.xml", - "ref/dotnet/it/System.Reflection.Extensions.xml", - "ref/dotnet/ja/System.Reflection.Extensions.xml", - "ref/dotnet/ko/System.Reflection.Extensions.xml", - "ref/dotnet/ru/System.Reflection.Extensions.xml", - "ref/dotnet/zh-hans/System.Reflection.Extensions.xml", - "ref/dotnet/zh-hant/System.Reflection.Extensions.xml", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll", - "system.reflection.extensions.4.0.0.nupkg.sha512", - "system.reflection.extensions.nuspec" - ] - }, - "System.Reflection.Extensions/4.3.0": { - "sha512": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "type": "package", - "path": "System.Reflection.Extensions/4.3.0", - "files": [ - "System.Reflection.Extensions.4.3.0.nupkg.sha512", - "System.Reflection.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/netcore50/de/System.Reflection.Extensions.xml", - "ref/netcore50/es/System.Reflection.Extensions.xml", - "ref/netcore50/fr/System.Reflection.Extensions.xml", - "ref/netcore50/it/System.Reflection.Extensions.xml", - "ref/netcore50/ja/System.Reflection.Extensions.xml", - "ref/netcore50/ko/System.Reflection.Extensions.xml", - "ref/netcore50/ru/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hans/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hant/System.Reflection.Extensions.xml", - "ref/netstandard1.0/System.Reflection.Extensions.dll", - "ref/netstandard1.0/System.Reflection.Extensions.xml", - "ref/netstandard1.0/de/System.Reflection.Extensions.xml", - "ref/netstandard1.0/es/System.Reflection.Extensions.xml", - "ref/netstandard1.0/fr/System.Reflection.Extensions.xml", - "ref/netstandard1.0/it/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ja/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ko/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ru/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.Metadata/1.0.22": { - "sha512": "ltoL/teiEdy5W9fyYdtFr2xJ/4nHyksXLK9dkPWx3ubnj7BVfsSWxvWTg9EaJUXjhWvS/AeTtugZA1/IDQyaPQ==", - "type": "package", - "path": "System.Reflection.Metadata/1.0.22", - "files": [ - "lib/dotnet/System.Reflection.Metadata.dll", - "lib/dotnet/System.Reflection.Metadata.xml", - "lib/portable-net45+win8/System.Reflection.Metadata.dll", - "lib/portable-net45+win8/System.Reflection.Metadata.xml", - "system.reflection.metadata.1.0.22.nupkg.sha512", - "system.reflection.metadata.nuspec" - ] - }, - "System.Reflection.Primitives/4.0.0": { - "sha512": "n9S0XpKv2ruc17FSnaiX6nV47VfHTZ1wLjKZlAirUZCvDQCH71mVp+Ohabn0xXLh5pK2PKp45HCxkqu5Fxn/lA==", - "type": "package", - "path": "System.Reflection.Primitives/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.Primitives.dll", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Primitives.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Reflection.Primitives.dll", - "ref/dotnet/System.Reflection.Primitives.xml", - "ref/dotnet/de/System.Reflection.Primitives.xml", - "ref/dotnet/es/System.Reflection.Primitives.xml", - "ref/dotnet/fr/System.Reflection.Primitives.xml", - "ref/dotnet/it/System.Reflection.Primitives.xml", - "ref/dotnet/ja/System.Reflection.Primitives.xml", - "ref/dotnet/ko/System.Reflection.Primitives.xml", - "ref/dotnet/ru/System.Reflection.Primitives.xml", - "ref/dotnet/zh-hans/System.Reflection.Primitives.xml", - "ref/dotnet/zh-hant/System.Reflection.Primitives.xml", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.Primitives.dll", - "system.reflection.primitives.4.0.0.nupkg.sha512", - "system.reflection.primitives.nuspec" - ] - }, - "System.Reflection.Primitives/4.3.0": { - "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "type": "package", - "path": "System.Reflection.Primitives/4.3.0", - "files": [ - "System.Reflection.Primitives.4.3.0.nupkg.sha512", - "System.Reflection.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/netcore50/de/System.Reflection.Primitives.xml", - "ref/netcore50/es/System.Reflection.Primitives.xml", - "ref/netcore50/fr/System.Reflection.Primitives.xml", - "ref/netcore50/it/System.Reflection.Primitives.xml", - "ref/netcore50/ja/System.Reflection.Primitives.xml", - "ref/netcore50/ko/System.Reflection.Primitives.xml", - "ref/netcore50/ru/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", - "ref/netstandard1.0/System.Reflection.Primitives.dll", - "ref/netstandard1.0/System.Reflection.Primitives.xml", - "ref/netstandard1.0/de/System.Reflection.Primitives.xml", - "ref/netstandard1.0/es/System.Reflection.Primitives.xml", - "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", - "ref/netstandard1.0/it/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.TypeExtensions/4.0.0": { - "sha512": "YRM/msNAM86hdxPyXcuZSzmTO0RQFh7YMEPBLTY8cqXvFPYIx2x99bOyPkuU81wRYQem1c1HTkImQ2DjbOBfew==", - "type": "package", - "path": "System.Reflection.TypeExtensions/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.TypeExtensions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Reflection.TypeExtensions.dll", - "ref/dotnet/System.Reflection.TypeExtensions.xml", - "ref/dotnet/de/System.Reflection.TypeExtensions.xml", - "ref/dotnet/es/System.Reflection.TypeExtensions.xml", - "ref/dotnet/fr/System.Reflection.TypeExtensions.xml", - "ref/dotnet/it/System.Reflection.TypeExtensions.xml", - "ref/dotnet/ja/System.Reflection.TypeExtensions.xml", - "ref/dotnet/ko/System.Reflection.TypeExtensions.xml", - "ref/dotnet/ru/System.Reflection.TypeExtensions.xml", - "ref/dotnet/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/dotnet/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.TypeExtensions.dll", - "system.reflection.typeextensions.4.0.0.nupkg.sha512", - "system.reflection.typeextensions.nuspec" - ] - }, - "System.Reflection.TypeExtensions/4.3.0": { - "sha512": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "type": "package", - "path": "System.Reflection.TypeExtensions/4.3.0", - "files": [ - "System.Reflection.TypeExtensions.4.3.0.nupkg.sha512", - "System.Reflection.TypeExtensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/net462/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/net462/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.5/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.TypeExtensions.dll" - ] - }, - "System.Resources.ResourceManager/4.0.0": { - "sha512": "qmqeZ4BJgjfU+G2JbrZt4Dk1LsMxO4t+f/9HarNY6w8pBgweO6jT+cknUH7c3qIrGvyUqraBhU45Eo6UtA0fAw==", - "type": "package", - "path": "System.Resources.ResourceManager/4.0.0", - "files": [ - "lib/DNXCore50/System.Resources.ResourceManager.dll", - "lib/net45/_._", - "lib/netcore50/System.Resources.ResourceManager.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Resources.ResourceManager.dll", - "ref/dotnet/System.Resources.ResourceManager.xml", - "ref/dotnet/de/System.Resources.ResourceManager.xml", - "ref/dotnet/es/System.Resources.ResourceManager.xml", - "ref/dotnet/fr/System.Resources.ResourceManager.xml", - "ref/dotnet/it/System.Resources.ResourceManager.xml", - "ref/dotnet/ja/System.Resources.ResourceManager.xml", - "ref/dotnet/ko/System.Resources.ResourceManager.xml", - "ref/dotnet/ru/System.Resources.ResourceManager.xml", - "ref/dotnet/zh-hans/System.Resources.ResourceManager.xml", - "ref/dotnet/zh-hant/System.Resources.ResourceManager.xml", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Resources.ResourceManager.dll", - "system.resources.resourcemanager.4.0.0.nupkg.sha512", - "system.resources.resourcemanager.nuspec" - ] - }, - "System.Resources.ResourceManager/4.3.0": { - "sha512": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "type": "package", - "path": "System.Resources.ResourceManager/4.3.0", - "files": [ - "System.Resources.ResourceManager.4.3.0.nupkg.sha512", - "System.Resources.ResourceManager.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/netcore50/de/System.Resources.ResourceManager.xml", - "ref/netcore50/es/System.Resources.ResourceManager.xml", - "ref/netcore50/fr/System.Resources.ResourceManager.xml", - "ref/netcore50/it/System.Resources.ResourceManager.xml", - "ref/netcore50/ja/System.Resources.ResourceManager.xml", - "ref/netcore50/ko/System.Resources.ResourceManager.xml", - "ref/netcore50/ru/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/System.Resources.ResourceManager.dll", - "ref/netstandard1.0/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime/4.0.20": { - "sha512": "X7N/9Bz7jVPorqdVFO86ns1sX6MlQM+WTxELtx+Z4VG45x9+LKmWH0GRqjgKprUnVuwmfB9EJ9DQng14Z7/zwg==", - "type": "package", - "path": "System.Runtime/4.0.20", - "files": [ - "lib/DNXCore50/System.Runtime.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.dll", - "ref/dotnet/System.Runtime.xml", - "ref/dotnet/de/System.Runtime.xml", - "ref/dotnet/es/System.Runtime.xml", - "ref/dotnet/fr/System.Runtime.xml", - "ref/dotnet/it/System.Runtime.xml", - "ref/dotnet/ja/System.Runtime.xml", - "ref/dotnet/ko/System.Runtime.xml", - "ref/dotnet/ru/System.Runtime.xml", - "ref/dotnet/zh-hans/System.Runtime.xml", - "ref/dotnet/zh-hant/System.Runtime.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.dll", - "system.runtime.4.0.20.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Runtime/4.3.0": { - "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "type": "package", - "path": "System.Runtime/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.4.3.0.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Runtime.Extensions/4.0.10": { - "sha512": "5dsEwf3Iml7d5OZeT20iyOjT+r+okWpN7xI2v+R4cgd3WSj4DeRPTvPFjDpacbVW4skCAZ8B9hxXJYgkCFKJ1A==", - "type": "package", - "path": "System.Runtime.Extensions/4.0.10", - "files": [ - "lib/DNXCore50/System.Runtime.Extensions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.Extensions.dll", - "ref/dotnet/System.Runtime.Extensions.xml", - "ref/dotnet/de/System.Runtime.Extensions.xml", - "ref/dotnet/es/System.Runtime.Extensions.xml", - "ref/dotnet/fr/System.Runtime.Extensions.xml", - "ref/dotnet/it/System.Runtime.Extensions.xml", - "ref/dotnet/ja/System.Runtime.Extensions.xml", - "ref/dotnet/ko/System.Runtime.Extensions.xml", - "ref/dotnet/ru/System.Runtime.Extensions.xml", - "ref/dotnet/zh-hans/System.Runtime.Extensions.xml", - "ref/dotnet/zh-hant/System.Runtime.Extensions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Extensions.dll", - "system.runtime.extensions.4.0.10.nupkg.sha512", - "system.runtime.extensions.nuspec" - ] - }, - "System.Runtime.Extensions/4.3.0": { - "sha512": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "type": "package", - "path": "System.Runtime.Extensions/4.3.0", - "files": [ - "System.Runtime.Extensions.4.3.0.nupkg.sha512", - "System.Runtime.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.xml", - "ref/netcore50/de/System.Runtime.Extensions.xml", - "ref/netcore50/es/System.Runtime.Extensions.xml", - "ref/netcore50/fr/System.Runtime.Extensions.xml", - "ref/netcore50/it/System.Runtime.Extensions.xml", - "ref/netcore50/ja/System.Runtime.Extensions.xml", - "ref/netcore50/ko/System.Runtime.Extensions.xml", - "ref/netcore50/ru/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hans/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.0/System.Runtime.Extensions.dll", - "ref/netstandard1.0/System.Runtime.Extensions.xml", - "ref/netstandard1.0/de/System.Runtime.Extensions.xml", - "ref/netstandard1.0/es/System.Runtime.Extensions.xml", - "ref/netstandard1.0/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.0/it/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.3/System.Runtime.Extensions.dll", - "ref/netstandard1.3/System.Runtime.Extensions.xml", - "ref/netstandard1.3/de/System.Runtime.Extensions.xml", - "ref/netstandard1.3/es/System.Runtime.Extensions.xml", - "ref/netstandard1.3/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.3/it/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.5/System.Runtime.Extensions.dll", - "ref/netstandard1.5/System.Runtime.Extensions.xml", - "ref/netstandard1.5/de/System.Runtime.Extensions.xml", - "ref/netstandard1.5/es/System.Runtime.Extensions.xml", - "ref/netstandard1.5/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.5/it/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Handles/4.0.0": { - "sha512": "638VhpRq63tVcQ6HDb3um3R/J2BtR1Sa96toHo6PcJGPXEPEsleCuqhBgX2gFCz0y0qkutANwW6VPPY5wQu1XQ==", - "type": "package", - "path": "System.Runtime.Handles/4.0.0", - "files": [ - "lib/DNXCore50/System.Runtime.Handles.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.Handles.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.Handles.dll", - "ref/dotnet/System.Runtime.Handles.xml", - "ref/dotnet/de/System.Runtime.Handles.xml", - "ref/dotnet/es/System.Runtime.Handles.xml", - "ref/dotnet/fr/System.Runtime.Handles.xml", - "ref/dotnet/it/System.Runtime.Handles.xml", - "ref/dotnet/ja/System.Runtime.Handles.xml", - "ref/dotnet/ko/System.Runtime.Handles.xml", - "ref/dotnet/ru/System.Runtime.Handles.xml", - "ref/dotnet/zh-hans/System.Runtime.Handles.xml", - "ref/dotnet/zh-hant/System.Runtime.Handles.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Handles.dll", - "system.runtime.handles.4.0.0.nupkg.sha512", - "system.runtime.handles.nuspec" - ] - }, - "System.Runtime.Handles/4.3.0": { - "sha512": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "type": "package", - "path": "System.Runtime.Handles/4.3.0", - "files": [ - "System.Runtime.Handles.4.3.0.nupkg.sha512", - "System.Runtime.Handles.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Runtime.Handles.dll", - "ref/netstandard1.3/System.Runtime.Handles.xml", - "ref/netstandard1.3/de/System.Runtime.Handles.xml", - "ref/netstandard1.3/es/System.Runtime.Handles.xml", - "ref/netstandard1.3/fr/System.Runtime.Handles.xml", - "ref/netstandard1.3/it/System.Runtime.Handles.xml", - "ref/netstandard1.3/ja/System.Runtime.Handles.xml", - "ref/netstandard1.3/ko/System.Runtime.Handles.xml", - "ref/netstandard1.3/ru/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Handles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices/4.0.20": { - "sha512": "ZgDyBYfEnjWoz/viS6VOswA6XOkDSH2DzgbpczbW50RywhnCgTl+w3JEvtAiOGyIh8cyx1NJq80jsNBSUr8Pig==", - "type": "package", - "path": "System.Runtime.InteropServices/4.0.20", - "files": [ - "lib/DNXCore50/System.Runtime.InteropServices.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.InteropServices.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.InteropServices.dll", - "ref/dotnet/System.Runtime.InteropServices.xml", - "ref/dotnet/de/System.Runtime.InteropServices.xml", - "ref/dotnet/es/System.Runtime.InteropServices.xml", - "ref/dotnet/fr/System.Runtime.InteropServices.xml", - "ref/dotnet/it/System.Runtime.InteropServices.xml", - "ref/dotnet/ja/System.Runtime.InteropServices.xml", - "ref/dotnet/ko/System.Runtime.InteropServices.xml", - "ref/dotnet/ru/System.Runtime.InteropServices.xml", - "ref/dotnet/zh-hans/System.Runtime.InteropServices.xml", - "ref/dotnet/zh-hant/System.Runtime.InteropServices.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.dll", - "system.runtime.interopservices.4.0.20.nupkg.sha512", - "system.runtime.interopservices.nuspec" - ] - }, - "System.Runtime.InteropServices/4.3.0": { - "sha512": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "type": "package", - "path": "System.Runtime.InteropServices/4.3.0", - "files": [ - "System.Runtime.InteropServices.4.3.0.nupkg.sha512", - "System.Runtime.InteropServices.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.InteropServices.dll", - "lib/net463/System.Runtime.InteropServices.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.InteropServices.dll", - "ref/net463/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.xml", - "ref/netcore50/de/System.Runtime.InteropServices.xml", - "ref/netcore50/es/System.Runtime.InteropServices.xml", - "ref/netcore50/fr/System.Runtime.InteropServices.xml", - "ref/netcore50/it/System.Runtime.InteropServices.xml", - "ref/netcore50/ja/System.Runtime.InteropServices.xml", - "ref/netcore50/ko/System.Runtime.InteropServices.xml", - "ref/netcore50/ru/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hans/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hant/System.Runtime.InteropServices.xml", - "ref/netcoreapp1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/System.Runtime.InteropServices.dll", - "ref/netstandard1.2/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/System.Runtime.InteropServices.dll", - "ref/netstandard1.3/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/System.Runtime.InteropServices.dll", - "ref/netstandard1.5/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.InteropServices.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "sha512": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "type": "package", - "path": "System.Runtime.InteropServices.RuntimeInformation/4.3.0", - "files": [ - "System.Runtime.InteropServices.RuntimeInformation.4.3.0.nupkg.sha512", - "System.Runtime.InteropServices.RuntimeInformation.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/win8/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/wpa81/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll" - ] - }, - "System.Runtime.InteropServices.WindowsRuntime/4.0.0": { - "sha512": "K5MGSvw/sGPKQYdOVqSpsVbHBE8HccHIDEhUNjM1lui65KGF/slNZfijGU87ggQiVXTI802ebKiOYBkwiLotow==", - "type": "package", - "path": "System.Runtime.InteropServices.WindowsRuntime/4.0.0", - "files": [ - "lib/net45/_._", - "lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.InteropServices.WindowsRuntime.dll", - "ref/dotnet/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/de/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/es/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/fr/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/it/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/ja/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/ko/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/ru/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/zh-hans/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/zh-hant/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/net45/_._", - "ref/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll", - "ref/netcore50/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll", - "system.runtime.interopservices.windowsruntime.4.0.0.nupkg.sha512", - "system.runtime.interopservices.windowsruntime.nuspec" - ] - }, - "System.Runtime.Numerics/4.0.0": { - "sha512": "aAYGEOE01nabQLufQ4YO8WuSyZzOqGcksi8m1BRW8ppkmssR7en8TqiXcBkB2gTkCnKG/Ai2NQY8CgdmgZw/fw==", - "type": "package", - "path": "System.Runtime.Numerics/4.0.0", - "files": [ - "lib/dotnet/System.Runtime.Numerics.dll", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.Numerics.dll", - "ref/dotnet/System.Runtime.Numerics.xml", - "ref/dotnet/de/System.Runtime.Numerics.xml", - "ref/dotnet/es/System.Runtime.Numerics.xml", - "ref/dotnet/fr/System.Runtime.Numerics.xml", - "ref/dotnet/it/System.Runtime.Numerics.xml", - "ref/dotnet/ja/System.Runtime.Numerics.xml", - "ref/dotnet/ko/System.Runtime.Numerics.xml", - "ref/dotnet/ru/System.Runtime.Numerics.xml", - "ref/dotnet/zh-hans/System.Runtime.Numerics.xml", - "ref/dotnet/zh-hant/System.Runtime.Numerics.xml", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.runtime.numerics.4.0.0.nupkg.sha512", - "system.runtime.numerics.nuspec" - ] - }, - "System.Runtime.Numerics/4.3.0": { - "sha512": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "type": "package", - "path": "System.Runtime.Numerics/4.3.0", - "files": [ - "System.Runtime.Numerics.4.3.0.nupkg.sha512", - "System.Runtime.Numerics.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/netstandard1.3/System.Runtime.Numerics.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/netcore50/de/System.Runtime.Numerics.xml", - "ref/netcore50/es/System.Runtime.Numerics.xml", - "ref/netcore50/fr/System.Runtime.Numerics.xml", - "ref/netcore50/it/System.Runtime.Numerics.xml", - "ref/netcore50/ja/System.Runtime.Numerics.xml", - "ref/netcore50/ko/System.Runtime.Numerics.xml", - "ref/netcore50/ru/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hans/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hant/System.Runtime.Numerics.xml", - "ref/netstandard1.1/System.Runtime.Numerics.dll", - "ref/netstandard1.1/System.Runtime.Numerics.xml", - "ref/netstandard1.1/de/System.Runtime.Numerics.xml", - "ref/netstandard1.1/es/System.Runtime.Numerics.xml", - "ref/netstandard1.1/fr/System.Runtime.Numerics.xml", - "ref/netstandard1.1/it/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ja/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ko/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ru/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.Numerics.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Serialization.Json/4.0.1": { - "sha512": "MUqpQDHlwFAy3v+fVzLN26SMGCPW/J2n4vfsBfScPiut/+Kp77Pcy1nWX2FC83WskFMepvmjMcXwTYZ75FCK0Q==", - "type": "package", - "path": "System.Runtime.Serialization.Json/4.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/DNXCore50/System.Runtime.Serialization.Json.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Serialization.Json.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.1/System.Runtime.Serialization.Json.dll", - "ref/dotnet5.1/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/de/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/es/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/fr/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/it/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/ja/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/ko/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/ru/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/zh-hans/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/zh-hant/System.Runtime.Serialization.Json.xml", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Serialization.Json.dll", - "ref/netcore50/System.Runtime.Serialization.Json.xml", - "ref/netcore50/de/System.Runtime.Serialization.Json.xml", - "ref/netcore50/es/System.Runtime.Serialization.Json.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Json.xml", - "ref/netcore50/it/System.Runtime.Serialization.Json.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Json.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Json.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Json.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Json.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Json.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Json.dll", - "system.runtime.serialization.json.4.0.1.nupkg.sha512", - "system.runtime.serialization.json.nuspec" - ] - }, - "System.Runtime.Serialization.Primitives/4.1.0": { - "sha512": "2UBnpTwpEi5dzbNJ8KhbOZ7Te1XQNov9MrtJ+dcnqogjACPNzbOiGT2uU9XgZg+sdbPvr4VMvVjFwJ85uLLCuA==", - "type": "package", - "path": "System.Runtime.Serialization.Primitives/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet5.4/System.Runtime.Serialization.Primitives.dll", - "lib/net45/_._", - "lib/net46/System.Runtime.Serialization.Primitives.dll", - "lib/netcore50/System.Runtime.Serialization.Primitives.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.1/System.Runtime.Serialization.Primitives.dll", - "ref/dotnet5.1/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/de/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/es/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/fr/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/it/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/ja/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/ko/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/ru/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/System.Runtime.Serialization.Primitives.dll", - "ref/dotnet5.4/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/de/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/es/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/fr/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/it/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/ja/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/ko/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/ru/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/net45/_._", - "ref/net46/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/de/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/es/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/it/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll", - "system.runtime.serialization.primitives.4.1.0.nupkg.sha512", - "system.runtime.serialization.primitives.nuspec" - ] - }, - "System.Runtime.Serialization.Xml/4.1.0": { - "sha512": "7TvzeIeNvT2GLpmSy/3J1VIkT70MroNujIiBWBe0qeM6/QFPdCcF/1Zxx9Ohc/iZUPAANb1wMruCAiYY2HTTrg==", - "type": "package", - "path": "System.Runtime.Serialization.Xml/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/DNXCore50/System.Runtime.Serialization.Xml.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Runtime.Serialization.Xml.dll", - "lib/netcore50/System.Runtime.Serialization.Xml.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.1/System.Runtime.Serialization.Xml.dll", - "ref/dotnet5.1/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/de/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/es/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/fr/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/it/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/ja/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/ko/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/ru/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/zh-hans/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/zh-hant/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/System.Runtime.Serialization.Xml.dll", - "ref/dotnet5.4/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/de/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/es/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/fr/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/it/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/ja/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/ko/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/ru/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/zh-hans/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/zh-hant/System.Runtime.Serialization.Xml.xml", - "ref/net45/_._", - "ref/net46/System.Runtime.Serialization.Xml.dll", - "ref/netcore50/System.Runtime.Serialization.Xml.dll", - "ref/netcore50/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/de/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/es/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/it/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Xml.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Xml.dll", - "system.runtime.serialization.xml.4.1.0.nupkg.sha512", - "system.runtime.serialization.xml.nuspec" - ] - }, - "System.Runtime.WindowsRuntime/4.0.10": { - "sha512": "9w6ypdnEw8RrLRlxTbLAYrap4eL1xIQeNoOaumQVOQ8TTD/5g9FGrBtY3KLiGxAPieN9AwAAEIDkugU85Cwuvg==", - "type": "package", - "path": "System.Runtime.WindowsRuntime/4.0.10", - "files": [ - "lib/netcore50/System.Runtime.WindowsRuntime.dll", - "lib/win81/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.WindowsRuntime.dll", - "ref/dotnet/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/de/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/es/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/fr/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/it/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/ja/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/ko/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/ru/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/zh-hans/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/zh-hant/System.Runtime.WindowsRuntime.xml", - "ref/netcore50/System.Runtime.WindowsRuntime.dll", - "ref/netcore50/System.Runtime.WindowsRuntime.xml", - "ref/win81/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.WindowsRuntime.dll", - "system.runtime.windowsruntime.4.0.10.nupkg.sha512", - "system.runtime.windowsruntime.nuspec" - ] - }, - "System.Runtime.WindowsRuntime.UI.Xaml/4.0.0": { - "sha512": "2GY3fkXBMQOyyO9ovaH46CN6MD2ck/Gvk4VNAgVDvtmfO3HXYFNd+bB05WhVcJrHKbfKZNwfwZKpYZ+OsVFsLw==", - "type": "package", - "path": "System.Runtime.WindowsRuntime.UI.Xaml/4.0.0", - "files": [ - "lib/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.WindowsRuntime.UI.Xaml.dll", - "ref/dotnet/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/de/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/es/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/fr/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/it/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/ja/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/ko/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/ru/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/zh-hans/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/zh-hant/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll", - "ref/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.runtime.windowsruntime.ui.xaml.4.0.0.nupkg.sha512", - "system.runtime.windowsruntime.ui.xaml.nuspec" - ] - }, - "System.Security.Claims/4.0.0": { - "sha512": "94NFR/7JN3YdyTH7hl2iSvYmdA8aqShriTHectcK+EbizT71YczMaG6LuqJBQP/HWo66AQyikYYM9aw+4EzGXg==", - "type": "package", - "path": "System.Security.Claims/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Security.Claims.dll", - "lib/net46/System.Security.Claims.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Security.Claims.dll", - "ref/dotnet/System.Security.Claims.xml", - "ref/dotnet/de/System.Security.Claims.xml", - "ref/dotnet/es/System.Security.Claims.xml", - "ref/dotnet/fr/System.Security.Claims.xml", - "ref/dotnet/it/System.Security.Claims.xml", - "ref/dotnet/ja/System.Security.Claims.xml", - "ref/dotnet/ko/System.Security.Claims.xml", - "ref/dotnet/ru/System.Security.Claims.xml", - "ref/dotnet/zh-hans/System.Security.Claims.xml", - "ref/dotnet/zh-hant/System.Security.Claims.xml", - "ref/net46/System.Security.Claims.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.security.claims.4.0.0.nupkg.sha512", - "system.security.claims.nuspec" - ] - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "sha512": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "type": "package", - "path": "System.Security.Cryptography.Algorithms/4.3.0", - "files": [ - "System.Security.Cryptography.Algorithms.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Algorithms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Algorithms.dll", - "lib/net461/System.Security.Cryptography.Algorithms.dll", - "lib/net463/System.Security.Cryptography.Algorithms.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Algorithms.dll", - "ref/net461/System.Security.Cryptography.Algorithms.dll", - "ref/net463/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.3/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.4/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll" - ] - }, - "System.Security.Cryptography.Cng/4.3.0": { - "sha512": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "type": "package", - "path": "System.Security.Cryptography.Cng/4.3.0", - "files": [ - "System.Security.Cryptography.Cng.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Cng.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Cryptography.Cng.dll", - "lib/net461/System.Security.Cryptography.Cng.dll", - "lib/net463/System.Security.Cryptography.Cng.dll", - "ref/net46/System.Security.Cryptography.Cng.dll", - "ref/net461/System.Security.Cryptography.Cng.dll", - "ref/net463/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.3/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.4/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.4/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll" - ] - }, - "System.Security.Cryptography.Csp/4.3.0": { - "sha512": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "type": "package", - "path": "System.Security.Cryptography.Csp/4.3.0", - "files": [ - "System.Security.Cryptography.Csp.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Csp.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Csp.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Csp.dll", - "ref/netstandard1.3/System.Security.Cryptography.Csp.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll" - ] - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "sha512": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "type": "package", - "path": "System.Security.Cryptography.Encoding/4.3.0", - "files": [ - "System.Security.Cryptography.Encoding.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Encoding.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.Encoding.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll" - ] - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "type": "package", - "path": "System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "System.Security.Cryptography.OpenSsl.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "ref/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll" - ] - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "sha512": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "type": "package", - "path": "System.Security.Cryptography.Primitives/4.3.0", - "files": [ - "System.Security.Cryptography.Primitives.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Primitives.dll", - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Primitives.dll", - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "sha512": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "type": "package", - "path": "System.Security.Cryptography.X509Certificates/4.3.0", - "files": [ - "System.Security.Cryptography.X509Certificates.4.3.0.nupkg.sha512", - "System.Security.Cryptography.X509Certificates.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.X509Certificates.dll", - "lib/net461/System.Security.Cryptography.X509Certificates.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.X509Certificates.dll", - "ref/net461/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll" - ] - }, - "System.Security.Principal/4.0.0": { - "sha512": "FOhq3jUOONi6fp5j3nPYJMrKtSJlqAURpjiO3FaDIV4DJNEYymWW5uh1pfxySEB8dtAW+I66IypzNge/w9OzZQ==", - "type": "package", - "path": "System.Security.Principal/4.0.0", - "files": [ - "lib/dotnet/System.Security.Principal.dll", - "lib/net45/_._", - "lib/netcore50/System.Security.Principal.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Security.Principal.dll", - "ref/dotnet/System.Security.Principal.xml", - "ref/dotnet/de/System.Security.Principal.xml", - "ref/dotnet/es/System.Security.Principal.xml", - "ref/dotnet/fr/System.Security.Principal.xml", - "ref/dotnet/it/System.Security.Principal.xml", - "ref/dotnet/ja/System.Security.Principal.xml", - "ref/dotnet/ko/System.Security.Principal.xml", - "ref/dotnet/ru/System.Security.Principal.xml", - "ref/dotnet/zh-hans/System.Security.Principal.xml", - "ref/dotnet/zh-hant/System.Security.Principal.xml", - "ref/net45/_._", - "ref/netcore50/System.Security.Principal.dll", - "ref/netcore50/System.Security.Principal.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.security.principal.4.0.0.nupkg.sha512", - "system.security.principal.nuspec" - ] - }, - "System.ServiceModel.Duplex/4.0.0": { - "sha512": "JFeDn+IsiwAVJkNNnM7MLefJOnzYhovaHnjk3lzEnUWkYZJeAKrcgLdK6GE2GNjb5mEV8Pad/E0JcA8eCr3eWQ==", - "type": "package", - "path": "System.ServiceModel.Duplex/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.Duplex.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.Duplex.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.Duplex.dll", - "ref/dotnet/System.ServiceModel.Duplex.xml", - "ref/dotnet/de/System.ServiceModel.Duplex.xml", - "ref/dotnet/es/System.ServiceModel.Duplex.xml", - "ref/dotnet/fr/System.ServiceModel.Duplex.xml", - "ref/dotnet/it/System.ServiceModel.Duplex.xml", - "ref/dotnet/ja/System.ServiceModel.Duplex.xml", - "ref/dotnet/ko/System.ServiceModel.Duplex.xml", - "ref/dotnet/ru/System.ServiceModel.Duplex.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Duplex.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Duplex.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.Duplex.dll", - "ref/netcore50/System.ServiceModel.Duplex.xml", - "ref/win8/_._", - "system.servicemodel.duplex.4.0.0.nupkg.sha512", - "system.servicemodel.duplex.nuspec" - ] - }, - "System.ServiceModel.Http/4.0.10": { - "sha512": "Vyl7lmvMlXJamtnDugoXuAgAQGSqtA7omK3zDBYByhbYeBC2hRBchgyXox7e5vEO+29TeB1IpoLWQGb7tO9h6A==", - "type": "package", - "path": "System.ServiceModel.Http/4.0.10", - "files": [ - "lib/DNXCore50/System.ServiceModel.Http.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.ServiceModel.Http.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ServiceModel.Http.dll", - "ref/dotnet/System.ServiceModel.Http.xml", - "ref/dotnet/de/System.ServiceModel.Http.xml", - "ref/dotnet/es/System.ServiceModel.Http.xml", - "ref/dotnet/fr/System.ServiceModel.Http.xml", - "ref/dotnet/it/System.ServiceModel.Http.xml", - "ref/dotnet/ja/System.ServiceModel.Http.xml", - "ref/dotnet/ko/System.ServiceModel.Http.xml", - "ref/dotnet/ru/System.ServiceModel.Http.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Http.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Http.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.servicemodel.http.4.0.10.nupkg.sha512", - "system.servicemodel.http.nuspec" - ] - }, - "System.ServiceModel.NetTcp/4.0.0": { - "sha512": "lV2Cdcso9jOS0KBtgHZHzTLe/Lx/ERdPcvF4dlepUie6/+BOMYTOgg2C7OdpIjp3fwUNXq8nhU+IilmEyjuf/A==", - "type": "package", - "path": "System.ServiceModel.NetTcp/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.NetTcp.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.NetTcp.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.NetTcp.dll", - "ref/dotnet/System.ServiceModel.NetTcp.xml", - "ref/dotnet/de/System.ServiceModel.NetTcp.xml", - "ref/dotnet/es/System.ServiceModel.NetTcp.xml", - "ref/dotnet/fr/System.ServiceModel.NetTcp.xml", - "ref/dotnet/it/System.ServiceModel.NetTcp.xml", - "ref/dotnet/ja/System.ServiceModel.NetTcp.xml", - "ref/dotnet/ko/System.ServiceModel.NetTcp.xml", - "ref/dotnet/ru/System.ServiceModel.NetTcp.xml", - "ref/dotnet/zh-hans/System.ServiceModel.NetTcp.xml", - "ref/dotnet/zh-hant/System.ServiceModel.NetTcp.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.NetTcp.dll", - "ref/netcore50/System.ServiceModel.NetTcp.xml", - "ref/win8/_._", - "system.servicemodel.nettcp.4.0.0.nupkg.sha512", - "system.servicemodel.nettcp.nuspec" - ] - }, - "System.ServiceModel.Primitives/4.0.0": { - "sha512": "uF5VYQWR07LgiZkzUr8qjwvqOaIAfwU566MneD4WuC14d8FLJNsAgCJUYhBGB7COjH7HTqnP9ZFmr6c+L83Stg==", - "type": "package", - "path": "System.ServiceModel.Primitives/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.Primitives.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.Primitives.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.Primitives.dll", - "ref/dotnet/System.ServiceModel.Primitives.xml", - "ref/dotnet/de/System.ServiceModel.Primitives.xml", - "ref/dotnet/es/System.ServiceModel.Primitives.xml", - "ref/dotnet/fr/System.ServiceModel.Primitives.xml", - "ref/dotnet/it/System.ServiceModel.Primitives.xml", - "ref/dotnet/ja/System.ServiceModel.Primitives.xml", - "ref/dotnet/ko/System.ServiceModel.Primitives.xml", - "ref/dotnet/ru/System.ServiceModel.Primitives.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Primitives.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Primitives.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.Primitives.dll", - "ref/netcore50/System.ServiceModel.Primitives.xml", - "ref/win8/_._", - "system.servicemodel.primitives.4.0.0.nupkg.sha512", - "system.servicemodel.primitives.nuspec" - ] - }, - "System.ServiceModel.Security/4.0.0": { - "sha512": "sPVzsnd8w/TJsW/4sYA9eIGP+RtlpN0AhKLGKf9ywdGGmHPi0kkuX2mx412dM3GN0e4oifuISwvZqby/sI8Feg==", - "type": "package", - "path": "System.ServiceModel.Security/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.Security.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.Security.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.Security.dll", - "ref/dotnet/System.ServiceModel.Security.xml", - "ref/dotnet/de/System.ServiceModel.Security.xml", - "ref/dotnet/es/System.ServiceModel.Security.xml", - "ref/dotnet/fr/System.ServiceModel.Security.xml", - "ref/dotnet/it/System.ServiceModel.Security.xml", - "ref/dotnet/ja/System.ServiceModel.Security.xml", - "ref/dotnet/ko/System.ServiceModel.Security.xml", - "ref/dotnet/ru/System.ServiceModel.Security.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Security.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Security.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.Security.dll", - "ref/netcore50/System.ServiceModel.Security.xml", - "ref/win8/_._", - "system.servicemodel.security.4.0.0.nupkg.sha512", - "system.servicemodel.security.nuspec" - ] - }, - "System.Text.Encoding/4.0.10": { - "sha512": "fNlSFgy4OuDlJrP9SFFxMlaLazq6ipv15sU5TiEgg9UCVnA/OgoVUfymFp4AOk1jOkW5SVxWbeeIUptcM+m/Vw==", - "type": "package", - "path": "System.Text.Encoding/4.0.10", - "files": [ - "lib/DNXCore50/System.Text.Encoding.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Text.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.Encoding.dll", - "ref/dotnet/System.Text.Encoding.xml", - "ref/dotnet/de/System.Text.Encoding.xml", - "ref/dotnet/es/System.Text.Encoding.xml", - "ref/dotnet/fr/System.Text.Encoding.xml", - "ref/dotnet/it/System.Text.Encoding.xml", - "ref/dotnet/ja/System.Text.Encoding.xml", - "ref/dotnet/ko/System.Text.Encoding.xml", - "ref/dotnet/ru/System.Text.Encoding.xml", - "ref/dotnet/zh-hans/System.Text.Encoding.xml", - "ref/dotnet/zh-hant/System.Text.Encoding.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.dll", - "system.text.encoding.4.0.10.nupkg.sha512", - "system.text.encoding.nuspec" - ] - }, - "System.Text.Encoding/4.3.0": { - "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "type": "package", - "path": "System.Text.Encoding/4.3.0", - "files": [ - "System.Text.Encoding.4.3.0.nupkg.sha512", - "System.Text.Encoding.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.dll", - "ref/netcore50/System.Text.Encoding.xml", - "ref/netcore50/de/System.Text.Encoding.xml", - "ref/netcore50/es/System.Text.Encoding.xml", - "ref/netcore50/fr/System.Text.Encoding.xml", - "ref/netcore50/it/System.Text.Encoding.xml", - "ref/netcore50/ja/System.Text.Encoding.xml", - "ref/netcore50/ko/System.Text.Encoding.xml", - "ref/netcore50/ru/System.Text.Encoding.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.0/System.Text.Encoding.dll", - "ref/netstandard1.0/System.Text.Encoding.xml", - "ref/netstandard1.0/de/System.Text.Encoding.xml", - "ref/netstandard1.0/es/System.Text.Encoding.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.xml", - "ref/netstandard1.0/it/System.Text.Encoding.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.3/System.Text.Encoding.dll", - "ref/netstandard1.3/System.Text.Encoding.xml", - "ref/netstandard1.3/de/System.Text.Encoding.xml", - "ref/netstandard1.3/es/System.Text.Encoding.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.xml", - "ref/netstandard1.3/it/System.Text.Encoding.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.Encoding.CodePages/4.0.0": { - "sha512": "ZHBTr1AXLjY9OuYR7pKx5xfN6QFye1kgd5QAbGrvfCOu7yxRnJs3VUaxERe1fOlnF0mi/xD/Dvb3T3x3HNuPWQ==", - "type": "package", - "path": "System.Text.Encoding.CodePages/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Text.Encoding.CodePages.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.Encoding.CodePages.dll", - "ref/dotnet/System.Text.Encoding.CodePages.xml", - "ref/dotnet/de/System.Text.Encoding.CodePages.xml", - "ref/dotnet/es/System.Text.Encoding.CodePages.xml", - "ref/dotnet/fr/System.Text.Encoding.CodePages.xml", - "ref/dotnet/it/System.Text.Encoding.CodePages.xml", - "ref/dotnet/ja/System.Text.Encoding.CodePages.xml", - "ref/dotnet/ko/System.Text.Encoding.CodePages.xml", - "ref/dotnet/ru/System.Text.Encoding.CodePages.xml", - "ref/dotnet/zh-hans/System.Text.Encoding.CodePages.xml", - "ref/dotnet/zh-hant/System.Text.Encoding.CodePages.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.text.encoding.codepages.4.0.0.nupkg.sha512", - "system.text.encoding.codepages.nuspec" - ] - }, - "System.Text.Encoding.Extensions/4.0.10": { - "sha512": "TZvlwXMxKo3bSRIcsWZLCIzIhLbvlz+mGeKYRZv/zUiSoQzGOwkYeBu6hOw2XPQgKqT0F4Rv8zqKdvmp2fWKYg==", - "type": "package", - "path": "System.Text.Encoding.Extensions/4.0.10", - "files": [ - "lib/DNXCore50/System.Text.Encoding.Extensions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Text.Encoding.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.Encoding.Extensions.dll", - "ref/dotnet/System.Text.Encoding.Extensions.xml", - "ref/dotnet/de/System.Text.Encoding.Extensions.xml", - "ref/dotnet/es/System.Text.Encoding.Extensions.xml", - "ref/dotnet/fr/System.Text.Encoding.Extensions.xml", - "ref/dotnet/it/System.Text.Encoding.Extensions.xml", - "ref/dotnet/ja/System.Text.Encoding.Extensions.xml", - "ref/dotnet/ko/System.Text.Encoding.Extensions.xml", - "ref/dotnet/ru/System.Text.Encoding.Extensions.xml", - "ref/dotnet/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/dotnet/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.Extensions.dll", - "system.text.encoding.extensions.4.0.10.nupkg.sha512", - "system.text.encoding.extensions.nuspec" - ] - }, - "System.Text.Encoding.Extensions/4.3.0": { - "sha512": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "type": "package", - "path": "System.Text.Encoding.Extensions/4.3.0", - "files": [ - "System.Text.Encoding.Extensions.4.3.0.nupkg.sha512", - "System.Text.Encoding.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.Extensions.dll", - "ref/netcore50/System.Text.Encoding.Extensions.xml", - "ref/netcore50/de/System.Text.Encoding.Extensions.xml", - "ref/netcore50/es/System.Text.Encoding.Extensions.xml", - "ref/netcore50/fr/System.Text.Encoding.Extensions.xml", - "ref/netcore50/it/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ja/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ko/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ru/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.0/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.3/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.RegularExpressions/4.0.10": { - "sha512": "0vDuHXJePpfMCecWBNOabOKCvzfTbFMNcGgklt3l5+RqHV5SzmF7RUVpuet8V0rJX30ROlL66xdehw2Rdsn2DA==", - "type": "package", - "path": "System.Text.RegularExpressions/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Text.RegularExpressions.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.RegularExpressions.dll", - "ref/dotnet/System.Text.RegularExpressions.xml", - "ref/dotnet/de/System.Text.RegularExpressions.xml", - "ref/dotnet/es/System.Text.RegularExpressions.xml", - "ref/dotnet/fr/System.Text.RegularExpressions.xml", - "ref/dotnet/it/System.Text.RegularExpressions.xml", - "ref/dotnet/ja/System.Text.RegularExpressions.xml", - "ref/dotnet/ko/System.Text.RegularExpressions.xml", - "ref/dotnet/ru/System.Text.RegularExpressions.xml", - "ref/dotnet/zh-hans/System.Text.RegularExpressions.xml", - "ref/dotnet/zh-hant/System.Text.RegularExpressions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.text.regularexpressions.4.0.10.nupkg.sha512", - "system.text.regularexpressions.nuspec" - ] - }, - "System.Text.RegularExpressions/4.3.0": { - "sha512": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "type": "package", - "path": "System.Text.RegularExpressions/4.3.0", - "files": [ - "System.Text.RegularExpressions.4.3.0.nupkg.sha512", - "System.Text.RegularExpressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Text.RegularExpressions.dll", - "lib/netcore50/System.Text.RegularExpressions.dll", - "lib/netstandard1.6/System.Text.RegularExpressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.xml", - "ref/netcore50/de/System.Text.RegularExpressions.xml", - "ref/netcore50/es/System.Text.RegularExpressions.xml", - "ref/netcore50/fr/System.Text.RegularExpressions.xml", - "ref/netcore50/it/System.Text.RegularExpressions.xml", - "ref/netcore50/ja/System.Text.RegularExpressions.xml", - "ref/netcore50/ko/System.Text.RegularExpressions.xml", - "ref/netcore50/ru/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hans/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hant/System.Text.RegularExpressions.xml", - "ref/netcoreapp1.1/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/System.Text.RegularExpressions.dll", - "ref/netstandard1.3/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/System.Text.RegularExpressions.dll", - "ref/netstandard1.6/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hant/System.Text.RegularExpressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading/4.0.10": { - "sha512": "0w6pRxIEE7wuiOJeKabkDgeIKmqf4ER1VNrs6qFwHnooEE78yHwi/bKkg5Jo8/pzGLm0xQJw0nEmPXt1QBAIUA==", - "type": "package", - "path": "System.Threading/4.0.10", - "files": [ - "lib/DNXCore50/System.Threading.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Threading.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Threading.dll", - "ref/dotnet/System.Threading.xml", - "ref/dotnet/de/System.Threading.xml", - "ref/dotnet/es/System.Threading.xml", - "ref/dotnet/fr/System.Threading.xml", - "ref/dotnet/it/System.Threading.xml", - "ref/dotnet/ja/System.Threading.xml", - "ref/dotnet/ko/System.Threading.xml", - "ref/dotnet/ru/System.Threading.xml", - "ref/dotnet/zh-hans/System.Threading.xml", - "ref/dotnet/zh-hant/System.Threading.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Threading.dll", - "system.threading.4.0.10.nupkg.sha512", - "system.threading.nuspec" - ] - }, - "System.Threading/4.3.0": { - "sha512": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "type": "package", - "path": "System.Threading/4.3.0", - "files": [ - "System.Threading.4.3.0.nupkg.sha512", - "System.Threading.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.dll", - "lib/netstandard1.3/System.Threading.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.dll", - "ref/netcore50/System.Threading.xml", - "ref/netcore50/de/System.Threading.xml", - "ref/netcore50/es/System.Threading.xml", - "ref/netcore50/fr/System.Threading.xml", - "ref/netcore50/it/System.Threading.xml", - "ref/netcore50/ja/System.Threading.xml", - "ref/netcore50/ko/System.Threading.xml", - "ref/netcore50/ru/System.Threading.xml", - "ref/netcore50/zh-hans/System.Threading.xml", - "ref/netcore50/zh-hant/System.Threading.xml", - "ref/netstandard1.0/System.Threading.dll", - "ref/netstandard1.0/System.Threading.xml", - "ref/netstandard1.0/de/System.Threading.xml", - "ref/netstandard1.0/es/System.Threading.xml", - "ref/netstandard1.0/fr/System.Threading.xml", - "ref/netstandard1.0/it/System.Threading.xml", - "ref/netstandard1.0/ja/System.Threading.xml", - "ref/netstandard1.0/ko/System.Threading.xml", - "ref/netstandard1.0/ru/System.Threading.xml", - "ref/netstandard1.0/zh-hans/System.Threading.xml", - "ref/netstandard1.0/zh-hant/System.Threading.xml", - "ref/netstandard1.3/System.Threading.dll", - "ref/netstandard1.3/System.Threading.xml", - "ref/netstandard1.3/de/System.Threading.xml", - "ref/netstandard1.3/es/System.Threading.xml", - "ref/netstandard1.3/fr/System.Threading.xml", - "ref/netstandard1.3/it/System.Threading.xml", - "ref/netstandard1.3/ja/System.Threading.xml", - "ref/netstandard1.3/ko/System.Threading.xml", - "ref/netstandard1.3/ru/System.Threading.xml", - "ref/netstandard1.3/zh-hans/System.Threading.xml", - "ref/netstandard1.3/zh-hant/System.Threading.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Threading.dll" - ] - }, - "System.Threading.Overlapped/4.0.0": { - "sha512": "X5LuQFhM5FTqaez3eXKJ9CbfSGZ7wj6j4hSVtxct3zmwQXLqG95qoWdvILcgN7xtrDOBIFtpiyDg0vmoI0jE2A==", - "type": "package", - "path": "System.Threading.Overlapped/4.0.0", - "files": [ - "lib/DNXCore50/System.Threading.Overlapped.dll", - "lib/net46/System.Threading.Overlapped.dll", - "lib/netcore50/System.Threading.Overlapped.dll", - "ref/dotnet/System.Threading.Overlapped.dll", - "ref/dotnet/System.Threading.Overlapped.xml", - "ref/dotnet/de/System.Threading.Overlapped.xml", - "ref/dotnet/es/System.Threading.Overlapped.xml", - "ref/dotnet/fr/System.Threading.Overlapped.xml", - "ref/dotnet/it/System.Threading.Overlapped.xml", - "ref/dotnet/ja/System.Threading.Overlapped.xml", - "ref/dotnet/ko/System.Threading.Overlapped.xml", - "ref/dotnet/ru/System.Threading.Overlapped.xml", - "ref/dotnet/zh-hans/System.Threading.Overlapped.xml", - "ref/dotnet/zh-hant/System.Threading.Overlapped.xml", - "ref/net46/System.Threading.Overlapped.dll", - "system.threading.overlapped.4.0.0.nupkg.sha512", - "system.threading.overlapped.nuspec" - ] - }, - "System.Threading.Tasks/4.0.10": { - "sha512": "NOwJGDfk79jR0bnzosbXLVD/PdI8KzBeESoa3CofEM5v9R5EBfcI0Jyf18stx+0IYV9okmDIDxVtxq9TbnR9bQ==", - "type": "package", - "path": "System.Threading.Tasks/4.0.10", - "files": [ - "lib/DNXCore50/System.Threading.Tasks.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Threading.Tasks.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Threading.Tasks.dll", - "ref/dotnet/System.Threading.Tasks.xml", - "ref/dotnet/de/System.Threading.Tasks.xml", - "ref/dotnet/es/System.Threading.Tasks.xml", - "ref/dotnet/fr/System.Threading.Tasks.xml", - "ref/dotnet/it/System.Threading.Tasks.xml", - "ref/dotnet/ja/System.Threading.Tasks.xml", - "ref/dotnet/ko/System.Threading.Tasks.xml", - "ref/dotnet/ru/System.Threading.Tasks.xml", - "ref/dotnet/zh-hans/System.Threading.Tasks.xml", - "ref/dotnet/zh-hant/System.Threading.Tasks.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Threading.Tasks.dll", - "system.threading.tasks.4.0.10.nupkg.sha512", - "system.threading.tasks.nuspec" - ] - }, - "System.Threading.Tasks/4.3.0": { - "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "type": "package", - "path": "System.Threading.Tasks/4.3.0", - "files": [ - "System.Threading.Tasks.4.3.0.nupkg.sha512", - "System.Threading.Tasks.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.dll", - "ref/netcore50/System.Threading.Tasks.xml", - "ref/netcore50/de/System.Threading.Tasks.xml", - "ref/netcore50/es/System.Threading.Tasks.xml", - "ref/netcore50/fr/System.Threading.Tasks.xml", - "ref/netcore50/it/System.Threading.Tasks.xml", - "ref/netcore50/ja/System.Threading.Tasks.xml", - "ref/netcore50/ko/System.Threading.Tasks.xml", - "ref/netcore50/ru/System.Threading.Tasks.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.0/System.Threading.Tasks.dll", - "ref/netstandard1.0/System.Threading.Tasks.xml", - "ref/netstandard1.0/de/System.Threading.Tasks.xml", - "ref/netstandard1.0/es/System.Threading.Tasks.xml", - "ref/netstandard1.0/fr/System.Threading.Tasks.xml", - "ref/netstandard1.0/it/System.Threading.Tasks.xml", - "ref/netstandard1.0/ja/System.Threading.Tasks.xml", - "ref/netstandard1.0/ko/System.Threading.Tasks.xml", - "ref/netstandard1.0/ru/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.3/System.Threading.Tasks.dll", - "ref/netstandard1.3/System.Threading.Tasks.xml", - "ref/netstandard1.3/de/System.Threading.Tasks.xml", - "ref/netstandard1.3/es/System.Threading.Tasks.xml", - "ref/netstandard1.3/fr/System.Threading.Tasks.xml", - "ref/netstandard1.3/it/System.Threading.Tasks.xml", - "ref/netstandard1.3/ja/System.Threading.Tasks.xml", - "ref/netstandard1.3/ko/System.Threading.Tasks.xml", - "ref/netstandard1.3/ru/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Tasks.Dataflow/4.5.25": { - "sha512": "Y5/Dj+tYlDxHBwie7bFKp3+1uSG4vqTJRF7Zs7kaUQ3ahYClffCTxvgjrJyPclC+Le55uE7bMLgjZQVOQr3Jfg==", - "type": "package", - "path": "System.Threading.Tasks.Dataflow/4.5.25", - "files": [ - "lib/dotnet/System.Threading.Tasks.Dataflow.XML", - "lib/dotnet/System.Threading.Tasks.Dataflow.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Dataflow.XML", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Dataflow.dll", - "lib/portable-net45+win8+wpa81/System.Threading.Tasks.Dataflow.XML", - "lib/portable-net45+win8+wpa81/System.Threading.Tasks.Dataflow.dll", - "system.threading.tasks.dataflow.4.5.25.nupkg.sha512", - "system.threading.tasks.dataflow.nuspec" - ] - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "sha512": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", - "type": "package", - "path": "System.Threading.Tasks.Extensions/4.3.0", - "files": [ - "System.Threading.Tasks.Extensions.4.3.0.nupkg.sha512", - "System.Threading.Tasks.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml" - ] - }, - "System.Threading.Tasks.Parallel/4.0.0": { - "sha512": "GXDhjPhF3nE4RtDia0W6JR4UMdmhOyt9ibHmsNV6GLRT4HAGqU636Teo4tqvVQOFp2R6b1ffxPXiRaoqtzGxuA==", - "type": "package", - "path": "System.Threading.Tasks.Parallel/4.0.0", - "files": [ - "lib/dotnet/System.Threading.Tasks.Parallel.dll", - "lib/net45/_._", - "lib/netcore50/System.Threading.Tasks.Parallel.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Threading.Tasks.Parallel.dll", - "ref/dotnet/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/de/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/es/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/fr/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/it/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/ja/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/ko/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/ru/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/zh-hans/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/zh-hant/System.Threading.Tasks.Parallel.xml", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.Parallel.dll", - "ref/netcore50/System.Threading.Tasks.Parallel.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.threading.tasks.parallel.4.0.0.nupkg.sha512", - "system.threading.tasks.parallel.nuspec" - ] - }, - "System.Threading.Timer/4.0.0": { - "sha512": "BIdJH5/e4FnVl7TkRUiE3pWytp7OYiRUGtwUbyLewS/PhKiLepFetdtlW+FvDYOVn60Q2NMTrhHhJ51q+sVW5g==", - "type": "package", - "path": "System.Threading.Timer/4.0.0", - "files": [ - "lib/DNXCore50/System.Threading.Timer.dll", - "lib/net451/_._", - "lib/netcore50/System.Threading.Timer.dll", - "lib/win81/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Threading.Timer.dll", - "ref/dotnet/System.Threading.Timer.xml", - "ref/dotnet/de/System.Threading.Timer.xml", - "ref/dotnet/es/System.Threading.Timer.xml", - "ref/dotnet/fr/System.Threading.Timer.xml", - "ref/dotnet/it/System.Threading.Timer.xml", - "ref/dotnet/ja/System.Threading.Timer.xml", - "ref/dotnet/ko/System.Threading.Timer.xml", - "ref/dotnet/ru/System.Threading.Timer.xml", - "ref/dotnet/zh-hans/System.Threading.Timer.xml", - "ref/dotnet/zh-hant/System.Threading.Timer.xml", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/win81/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Threading.Timer.dll", - "system.threading.timer.4.0.0.nupkg.sha512", - "system.threading.timer.nuspec" - ] - }, - "System.Threading.Timer/4.3.0": { - "sha512": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "type": "package", - "path": "System.Threading.Timer/4.3.0", - "files": [ - "System.Threading.Timer.4.3.0.nupkg.sha512", - "System.Threading.Timer.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net451/_._", - "lib/portable-net451+win81+wpa81/_._", - "lib/win81/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/netcore50/de/System.Threading.Timer.xml", - "ref/netcore50/es/System.Threading.Timer.xml", - "ref/netcore50/fr/System.Threading.Timer.xml", - "ref/netcore50/it/System.Threading.Timer.xml", - "ref/netcore50/ja/System.Threading.Timer.xml", - "ref/netcore50/ko/System.Threading.Timer.xml", - "ref/netcore50/ru/System.Threading.Timer.xml", - "ref/netcore50/zh-hans/System.Threading.Timer.xml", - "ref/netcore50/zh-hant/System.Threading.Timer.xml", - "ref/netstandard1.2/System.Threading.Timer.dll", - "ref/netstandard1.2/System.Threading.Timer.xml", - "ref/netstandard1.2/de/System.Threading.Timer.xml", - "ref/netstandard1.2/es/System.Threading.Timer.xml", - "ref/netstandard1.2/fr/System.Threading.Timer.xml", - "ref/netstandard1.2/it/System.Threading.Timer.xml", - "ref/netstandard1.2/ja/System.Threading.Timer.xml", - "ref/netstandard1.2/ko/System.Threading.Timer.xml", - "ref/netstandard1.2/ru/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hans/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hant/System.Threading.Timer.xml", - "ref/portable-net451+win81+wpa81/_._", - "ref/win81/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.ReaderWriter/4.0.10": { - "sha512": "VdmWWMH7otrYV7D+cviUo7XjX0jzDnD/lTGSZTlZqfIQ5PhXk85j+6P0TK9od3PnOd5ZIM+pOk01G/J+3nh9/w==", - "type": "package", - "path": "System.Xml.ReaderWriter/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Xml.ReaderWriter.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.ReaderWriter.dll", - "ref/dotnet/System.Xml.ReaderWriter.xml", - "ref/dotnet/de/System.Xml.ReaderWriter.xml", - "ref/dotnet/es/System.Xml.ReaderWriter.xml", - "ref/dotnet/fr/System.Xml.ReaderWriter.xml", - "ref/dotnet/it/System.Xml.ReaderWriter.xml", - "ref/dotnet/ja/System.Xml.ReaderWriter.xml", - "ref/dotnet/ko/System.Xml.ReaderWriter.xml", - "ref/dotnet/ru/System.Xml.ReaderWriter.xml", - "ref/dotnet/zh-hans/System.Xml.ReaderWriter.xml", - "ref/dotnet/zh-hant/System.Xml.ReaderWriter.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.xml.readerwriter.4.0.10.nupkg.sha512", - "system.xml.readerwriter.nuspec" - ] - }, - "System.Xml.ReaderWriter/4.3.0": { - "sha512": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "type": "package", - "path": "System.Xml.ReaderWriter/4.3.0", - "files": [ - "System.Xml.ReaderWriter.4.3.0.nupkg.sha512", - "System.Xml.ReaderWriter.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Xml.ReaderWriter.dll", - "lib/netcore50/System.Xml.ReaderWriter.dll", - "lib/netstandard1.3/System.Xml.ReaderWriter.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.xml", - "ref/netcore50/de/System.Xml.ReaderWriter.xml", - "ref/netcore50/es/System.Xml.ReaderWriter.xml", - "ref/netcore50/fr/System.Xml.ReaderWriter.xml", - "ref/netcore50/it/System.Xml.ReaderWriter.xml", - "ref/netcore50/ja/System.Xml.ReaderWriter.xml", - "ref/netcore50/ko/System.Xml.ReaderWriter.xml", - "ref/netcore50/ru/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/System.Xml.ReaderWriter.dll", - "ref/netstandard1.0/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/System.Xml.ReaderWriter.dll", - "ref/netstandard1.3/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hant/System.Xml.ReaderWriter.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XDocument/4.0.10": { - "sha512": "+ej0g0INnXDjpS2tDJsLO7/BjyBzC+TeBXLeoGnvRrm4AuBH9PhBjjZ1IuKWOhCkxPkFognUOKhZHS2glIOlng==", - "type": "package", - "path": "System.Xml.XDocument/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Xml.XDocument.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.XDocument.dll", - "ref/dotnet/System.Xml.XDocument.xml", - "ref/dotnet/de/System.Xml.XDocument.xml", - "ref/dotnet/es/System.Xml.XDocument.xml", - "ref/dotnet/fr/System.Xml.XDocument.xml", - "ref/dotnet/it/System.Xml.XDocument.xml", - "ref/dotnet/ja/System.Xml.XDocument.xml", - "ref/dotnet/ko/System.Xml.XDocument.xml", - "ref/dotnet/ru/System.Xml.XDocument.xml", - "ref/dotnet/zh-hans/System.Xml.XDocument.xml", - "ref/dotnet/zh-hant/System.Xml.XDocument.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.xml.xdocument.4.0.10.nupkg.sha512", - "system.xml.xdocument.nuspec" - ] - }, - "System.Xml.XDocument/4.3.0": { - "sha512": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "type": "package", - "path": "System.Xml.XDocument/4.3.0", - "files": [ - "System.Xml.XDocument.4.3.0.nupkg.sha512", - "System.Xml.XDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Xml.XDocument.dll", - "lib/netstandard1.3/System.Xml.XDocument.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Xml.XDocument.dll", - "ref/netcore50/System.Xml.XDocument.xml", - "ref/netcore50/de/System.Xml.XDocument.xml", - "ref/netcore50/es/System.Xml.XDocument.xml", - "ref/netcore50/fr/System.Xml.XDocument.xml", - "ref/netcore50/it/System.Xml.XDocument.xml", - "ref/netcore50/ja/System.Xml.XDocument.xml", - "ref/netcore50/ko/System.Xml.XDocument.xml", - "ref/netcore50/ru/System.Xml.XDocument.xml", - "ref/netcore50/zh-hans/System.Xml.XDocument.xml", - "ref/netcore50/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.0/System.Xml.XDocument.dll", - "ref/netstandard1.0/System.Xml.XDocument.xml", - "ref/netstandard1.0/de/System.Xml.XDocument.xml", - "ref/netstandard1.0/es/System.Xml.XDocument.xml", - "ref/netstandard1.0/fr/System.Xml.XDocument.xml", - "ref/netstandard1.0/it/System.Xml.XDocument.xml", - "ref/netstandard1.0/ja/System.Xml.XDocument.xml", - "ref/netstandard1.0/ko/System.Xml.XDocument.xml", - "ref/netstandard1.0/ru/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.3/System.Xml.XDocument.dll", - "ref/netstandard1.3/System.Xml.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XDocument.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XmlDocument/4.0.0": { - "sha512": "H5qTx2+AXgaKE5wehU1ZYeYPFpp/rfFh69/937NvwCrDqbIkvJRmIFyKKpkoMI6gl9hGfuVizfIudVTMyowCXw==", - "type": "package", - "path": "System.Xml.XmlDocument/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Xml.XmlDocument.dll", - "lib/net46/System.Xml.XmlDocument.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.XmlDocument.dll", - "ref/dotnet/System.Xml.XmlDocument.xml", - "ref/dotnet/de/System.Xml.XmlDocument.xml", - "ref/dotnet/es/System.Xml.XmlDocument.xml", - "ref/dotnet/fr/System.Xml.XmlDocument.xml", - "ref/dotnet/it/System.Xml.XmlDocument.xml", - "ref/dotnet/ja/System.Xml.XmlDocument.xml", - "ref/dotnet/ko/System.Xml.XmlDocument.xml", - "ref/dotnet/ru/System.Xml.XmlDocument.xml", - "ref/dotnet/zh-hans/System.Xml.XmlDocument.xml", - "ref/dotnet/zh-hant/System.Xml.XmlDocument.xml", - "ref/net46/System.Xml.XmlDocument.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.xml.xmldocument.4.0.0.nupkg.sha512", - "system.xml.xmldocument.nuspec" - ] - }, - "System.Xml.XmlSerializer/4.0.10": { - "sha512": "OKhE6vruk88z/hl0lmfrMvXteTASgJUagu6PT6S10i9uLbvDR3pTwB6jVgiwa2D2qtTB+eneZbS9jljhPXhTtg==", - "type": "package", - "path": "System.Xml.XmlSerializer/4.0.10", - "files": [ - "lib/DNXCore50/System.Xml.XmlSerializer.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Xml.XmlSerializer.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.XmlSerializer.dll", - "ref/dotnet/System.Xml.XmlSerializer.xml", - "ref/dotnet/de/System.Xml.XmlSerializer.xml", - "ref/dotnet/es/System.Xml.XmlSerializer.xml", - "ref/dotnet/fr/System.Xml.XmlSerializer.xml", - "ref/dotnet/it/System.Xml.XmlSerializer.xml", - "ref/dotnet/ja/System.Xml.XmlSerializer.xml", - "ref/dotnet/ko/System.Xml.XmlSerializer.xml", - "ref/dotnet/ru/System.Xml.XmlSerializer.xml", - "ref/dotnet/zh-hans/System.Xml.XmlSerializer.xml", - "ref/dotnet/zh-hant/System.Xml.XmlSerializer.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Xml.XmlSerializer.dll", - "system.xml.xmlserializer.4.0.10.nupkg.sha512", - "system.xml.xmlserializer.nuspec" - ] - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../OpenCvSharp/project.json", - "msbuildProject": "../OpenCvSharp/OpenCvSharp.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "OpenCvSharp >= 1.0.0-*" - ], - ".NETCoreApp,Version=v1.0": [], - ".NETFramework,Version=v2.0": [], - ".NETFramework,Version=v4.0": [], - ".NETFramework,Version=v4.6": [], - ".NETStandard,Version=v1.6": [], - "UAP,Version=v10.0": [] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs new file mode 100644 index 000000000..4f7833ffd --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs @@ -0,0 +1,83 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace OpenCvSharp.DebuggerVisualizers +{ + public partial class ImageViewer : Form + { + private readonly Bitmap bitmap; + + public ImageViewer() + { + InitializeComponent(); + } + + public ImageViewer(MatProxy proxy) + : this() + { + bitmap = proxy.CreateBitmap(); + } + + /// + /// 仅仅用于开发目的。 + /// + /// + /// デバッグのみを目的としています。 + /// + /// + public ImageViewer(string imgFile) + : this() + { + bitmap = new Bitmap(imgFile); + } + + private void DisposeBitmap() + { + bitmap?.Dispose(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + var ratio = SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); + DisplayRatio(ratio); + + pictureBox.Image = bitmap; + } + + /// + /// ClientSizeを画面からはみ出ない大きさに調整して設定する. + /// + /// + private double SetClientSize(System.Drawing.Size size) + { + var screenSize = Screen.PrimaryScreen.Bounds.Size; + var ratioX = (double)screenSize.Width / size.Width; + var ratioY = (double)screenSize.Height / size.Height; + var ratio = Math.Max(ratioX, ratioY); + ratio = ReformRatio(ratio); + size.Width = Convert.ToInt32(size.Width * ratio); + size.Height = Convert.ToInt32(size.Height * ratio); + ClientSize = size; + pictureBox.Size = size; + return ratio; + } + + private double ReformRatio(double ratio) + { + var v1 = ratio; + var lg2 = Math.Log(v1, 2); + var lgz = Math.Floor(lg2); + var pw = lgz == lg2 ? lgz - 1 : lgz; + var r = Math.Pow(2, pw); + return r; + } + + private void DisplayRatio(double ratio) + { + Text = $@"ImageViewer Zoom: {ratio:P1}"; + } + } +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.designer.cs b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.designer.cs new file mode 100644 index 000000000..331890f0d --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.designer.cs @@ -0,0 +1,67 @@ +namespace OpenCvSharp.DebuggerVisualizers +{ + partial class ImageViewer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) + { + components?.Dispose(); + DisposeBitmap(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pictureBox = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox + // + this.pictureBox.BackColor = System.Drawing.Color.Black; + this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBox.Location = new System.Drawing.Point(0, 0); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(384, 263); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // ImageViewer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScroll = true; + this.ClientSize = new System.Drawing.Size(384, 263); + this.Controls.Add(this.pictureBox); + this.Name = "ImageViewer"; + this.Text = "ImageViewer"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox pictureBox; + + + } +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.resx b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers/MatDebuggerVisualizer.cs b/src/OpenCvSharp.DebuggerVisualizers/MatDebuggerVisualizer.cs new file mode 100644 index 000000000..26833207d --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/MatDebuggerVisualizer.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.VisualStudio.DebuggerVisualizers; + +namespace OpenCvSharp.DebuggerVisualizers +{ + /// + /// ビジュアライザでの視覚化処理 + /// + public class MatDebuggerVisualizer : DialogDebuggerVisualizer + { + protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) + { + // MatProxyが送られてくるはず + var proxy = objectProvider.GetObject() as MatProxy; + if (proxy is null) + { + throw new ArgumentException(); + } + + // Formに表示 + using (var form = new ImageViewer(proxy)) + { + windowService.ShowDialog(form); + } + } + } +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/MatObjectSource.cs b/src/OpenCvSharp.DebuggerVisualizers/MatObjectSource.cs new file mode 100644 index 000000000..160921786 --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/MatObjectSource.cs @@ -0,0 +1,18 @@ +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; +using Microsoft.VisualStudio.DebuggerVisualizers; + +namespace OpenCvSharp.DebuggerVisualizers +{ + /// + /// シリアライズ処理 + /// + public class MatObjectSource : VisualizerObjectSource + { + public override void GetData(object target, Stream outgoingData) + { + var bf = new BinaryFormatter(); + bf.Serialize(outgoingData, new MatProxy((Mat)target)); + } + } +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs b/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs new file mode 100644 index 000000000..c4109308f --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs @@ -0,0 +1,32 @@ +using System; +using System.Drawing; +using System.IO; + +namespace OpenCvSharp.DebuggerVisualizers +{ + /// + /// シリアライズ不可能なクラスをやり取りするために使うプロキシ。 + /// 送る際に、このProxyに表示に必要なシリアライズ可能なデータを詰めて送り、受信側で復元する。 + /// + [Serializable] + public class MatProxy + { + public byte[] ImageData { get; private set; } + + public MatProxy(Mat image) + { + ImageData = image.ToBytes(); + } + + public Bitmap CreateBitmap() + { + if (ImageData is null) + throw new Exception("ImageData is null"); + + using (var stream = new MemoryStream(ImageData)) + { + return new Bitmap(stream); + } + } + } +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj b/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj new file mode 100644 index 000000000..f632b1b3c --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {4232CB4A-DFE3-46CA-9503-C5F1798BAED3} + Library + Properties + OpenCvSharp.DebuggerVisualizers + OpenCvSharp.DebuggerVisualizers + v4.8 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + ..\..\packages\VSSDK.DebuggerVisualizers.12.0.4\lib\net20\Microsoft.VisualStudio.DebuggerVisualizers.dll + False + + + False + .\OpenCvSharp.dll + + + + + + + + + + + + + + + Form + + + ImageViewer.cs + + + + + + + + + + + + .editorconfig + + + + + + ImageViewer.cs + + + + + \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.dll b/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.dll new file mode 100644 index 000000000..bd7b397fe Binary files /dev/null and b/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.dll differ diff --git a/src/OpenCvSharp.DebuggerVisualizers/Properties/AssemblyInfo.cs b/src/OpenCvSharp.DebuggerVisualizers/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..e305adc6e --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/Properties/AssemblyInfo.cs @@ -0,0 +1,44 @@ +using System.Diagnostics; +using System.Reflection; +using System.Runtime.InteropServices; + +// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 +// アセンブリに関連付けられている情報を変更するには、 +// これらの属性値を変更してください。 +[assembly: AssemblyTitle("OpenCvSharp.DebuggerVisualizers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenCvSharp.DebuggerVisualizers")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから +// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 +// その型の ComVisible 属性を true に設定してください。 +[assembly: ComVisible(false)] + +// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります +[assembly: Guid("4232cb4a-dfe3-46ca-9503-c5f1798baed3")] + +// アセンブリのバージョン情報は次の 4 つの値で構成されています: +// +// メジャー バージョン +// マイナー バージョン +// ビルド番号 +// Revision +// +// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を +// 既定値にすることができます: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +// OpenCvSharp objects' debugger visualizer +[assembly: DebuggerVisualizer( + typeof(OpenCvSharp.DebuggerVisualizers.MatDebuggerVisualizer), + typeof(OpenCvSharp.DebuggerVisualizers.MatObjectSource), + Target = typeof(OpenCvSharp.Mat), + Description = "Mat Visualizer" +)] \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers/packages.config b/src/OpenCvSharp.DebuggerVisualizers/packages.config new file mode 100644 index 000000000..4b96a87b7 --- /dev/null +++ b/src/OpenCvSharp.DebuggerVisualizers/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/ImageViewer.Designer.cs b/src/OpenCvSharp.DebuggerVisualizers2010/ImageViewer.Designer.cs deleted file mode 100644 index 35deb5435..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/ImageViewer.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -namespace OpenCvSharp.DebuggerVisualizers2010 -{ - partial class ImageViewer - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BackColor = System.Drawing.Color.Black; - this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(384, 263); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // ImageViewer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(384, 263); - this.Controls.Add(this.pictureBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ImageViewer"; - this.Text = "ImageViewer"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/ImageViewer.cs b/src/OpenCvSharp.DebuggerVisualizers2010/ImageViewer.cs deleted file mode 100644 index e38b5722a..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/ImageViewer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace OpenCvSharp.DebuggerVisualizers2010 -{ - /// - /// - /// - public partial class ImageViewer : Form - { - private readonly Bitmap bitmap; - - /// - /// - /// - public ImageViewer() - { - InitializeComponent(); - } - - /// - /// - /// - /// - public ImageViewer(MatProxy proxy) - : this() - { - bitmap = proxy.CreateBitmap(); - } - - /// - /// - /// - /// - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); - pictureBox.Image = bitmap; - } - - /// - /// ClientSizeを画面からはみ出ない大きさに調整して設定する. - /// - /// - private void SetClientSize(System.Drawing.Size size) - { - var screenSize = Screen.PrimaryScreen.Bounds.Size; - if (size.Width > screenSize.Width) - { - double ratio = (double) screenSize.Width/size.Width; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - if (size.Height > screenSize.Height) - { - double ratio = (double) screenSize.Height/size.Height; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - ClientSize = size; - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/Key.snk b/src/OpenCvSharp.DebuggerVisualizers2010/Key.snk deleted file mode 100644 index 370daac05..000000000 Binary files a/src/OpenCvSharp.DebuggerVisualizers2010/Key.snk and /dev/null differ diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/MatDebuggerVisualizer.cs b/src/OpenCvSharp.DebuggerVisualizers2010/MatDebuggerVisualizer.cs deleted file mode 100644 index b1bbea01f..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/MatDebuggerVisualizer.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2010 -{ - /// - /// ビジュアライザでの視覚化処理 - /// - public class MatDebuggerVisualizer : DialogDebuggerVisualizer - { - protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) - { - // MatProxyが送られてくるはず - using (var proxy = objectProvider.GetObject() as MatProxy) - { - if (proxy == null) - { - throw new ArgumentException(); - } - // Formに表示 - using (var form = new ImageViewer(proxy)) - { - windowService.ShowDialog(form); - } - } - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/MatObjectSource.cs b/src/OpenCvSharp.DebuggerVisualizers2010/MatObjectSource.cs deleted file mode 100644 index 66d44998b..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/MatObjectSource.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2010 -{ - /// - /// VACY - /// - public class MatObjectSource : VisualizerObjectSource - { - public override void GetData(object target, Stream outgoingData) - { - var bf = new BinaryFormatter(); - bf.Serialize(outgoingData, new MatProxy((Mat)target)); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/MatProxy.cs b/src/OpenCvSharp.DebuggerVisualizers2010/MatProxy.cs deleted file mode 100644 index 525f5f0f0..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/MatProxy.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Drawing; -using System.IO; - -namespace OpenCvSharp.DebuggerVisualizers2010 -{ - /// - /// シリアライズ不可能なクラスをやり取りするために使うプロキシ。 - /// 送る際に、このProxyに表示に必要なシリアライズ可能なデータを詰めて送り、受信側で復元する。 - /// - [Serializable] - public class MatProxy : IDisposable - { - public byte[] ImageData { get; private set; } - - public MatProxy(Mat image) - { - ImageData = image.ToBytes(".png"); - } - - public void Dispose() - { - ImageData = null; - } - - public Bitmap CreateBitmap() - { - if (ImageData == null) - throw new Exception("ImageData == null"); - - using (var stream = new MemoryStream(ImageData)) - { - return new Bitmap(stream); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/OpenCvSharp.DebuggerVisualizers2010.xproj b/src/OpenCvSharp.DebuggerVisualizers2010/OpenCvSharp.DebuggerVisualizers2010.xproj deleted file mode 100644 index 8cfe263b9..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/OpenCvSharp.DebuggerVisualizers2010.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 7bf35a9b-8d4a-4b5e-b231-d267d1fb670d - OpenCvSharp.DebuggerVisualizers2010Z - .\obj - .\bin\ - v4.5 - - - - 2.0 - - - diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/Properties/AssemblyInfo.cs b/src/OpenCvSharp.DebuggerVisualizers2010/Properties/AssemblyInfo.cs deleted file mode 100644 index 2fd04ab7a..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.DebuggerVisualizers2010")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7bf35a9b-8d4a-4b5e-b231-d267d1fb670d")] - -// OpenCvSharp objects' debugger visualizer -[assembly: DebuggerVisualizer( - typeof(OpenCvSharp.DebuggerVisualizers2010.MatDebuggerVisualizer), - typeof(OpenCvSharp.DebuggerVisualizers2010.MatObjectSource), - Target = typeof(OpenCvSharp.Mat), - Description = "Mat Visualizer" -)] \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/project.json b/src/OpenCvSharp.DebuggerVisualizers2010/project.json deleted file mode 100644 index 4bc8d0088..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*", - "VSSDK.DebuggerVisualizers.10": "10.0.4" - }, - - "frameworks": { - "net20": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Drawing": "2.0.0.0", - "System.Windows.Forms": "2.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net20" ] - } - } - }, - "buildOptions": { - "optimize": true, - "keyFile": "Key.snk" - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2010/project.lock.json b/src/OpenCvSharp.DebuggerVisualizers2010/project.lock.json deleted file mode 100644 index 814ad2fe5..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2010/project.lock.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETFramework,Version=v2.0": { - "VSSDK.DebuggerVisualizers/10.0.4": { - "type": "package", - "dependencies": { - "VSSDK.IDE.10": "[10.0.4, 11.0.0)" - }, - "frameworkAssemblies": [ - "System.Windows.Forms" - ], - "compile": { - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll": {} - }, - "runtime": { - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll": {} - } - }, - "VSSDK.DebuggerVisualizers.10/10.0.4": { - "type": "package", - "dependencies": { - "VSSDK.DebuggerVisualizers": "[10.0.4, 11.0.0)", - "VSSDK.IDE.10": "[10.0.4, 11.0.0)" - } - }, - "VSSDK.IDE.10/10.0.4": { - "type": "package" - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v2.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net20/OpenCvSharp.dll": {} - }, - "runtime": { - "net20/OpenCvSharp.dll": {} - } - } - } - }, - "libraries": { - "VSSDK.DebuggerVisualizers/10.0.4": { - "sha512": "ZBSbv2qokVEkt9O1joOZrIt6cZPTQ8y1RVbJt3nkyr5ifX/Gcu15OX2+lcQ41K/Ih141i7b0MoP8MYzEuxQP6A==", - "type": "package", - "path": "VSSDK.DebuggerVisualizers/10.0.4", - "files": [ - "VSSDK.DebuggerVisualizers.10.0.4.nupkg.sha512", - "VSSDK.DebuggerVisualizers.nuspec", - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll", - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.xml", - "tools/install.ps1" - ] - }, - "VSSDK.DebuggerVisualizers.10/10.0.4": { - "sha512": "3tvSGHmSyGhmQ6AoIb6mj3c0WZf/XlAyx97uBJgWDfXJ9lkngC7jMB+ORJbNF+N130fTTRXcnhVOwqcwgv/ltw==", - "type": "package", - "path": "VSSDK.DebuggerVisualizers.10/10.0.4", - "files": [ - "VSSDK.DebuggerVisualizers.10.10.0.4.nupkg.sha512", - "VSSDK.DebuggerVisualizers.10.nuspec" - ] - }, - "VSSDK.IDE.10/10.0.4": { - "sha512": "DT+JlSUaObx8bln4XcvnaouLU4xgwXTgRXXFjdvmMQ5r/8uxmaAjIxTHPGpVAtxm3JQICGsTuetCDPdI0r7Nbg==", - "type": "package", - "path": "VSSDK.IDE.10/10.0.4", - "files": [ - "VSSDK.IDE.10.10.0.4.nupkg.sha512", - "VSSDK.IDE.10.nuspec" - ] - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../OpenCvSharp/project.json", - "msbuildProject": "../OpenCvSharp/OpenCvSharp.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "OpenCvSharp >= 1.0.0-*", - "VSSDK.DebuggerVisualizers.10 >= 10.0.4" - ], - ".NETFramework,Version=v2.0": [ - "System.Drawing >= 2.0.0", - "System.Windows.Forms >= 2.0.0" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/ImageViewer.Designer.cs b/src/OpenCvSharp.DebuggerVisualizers2012/ImageViewer.Designer.cs deleted file mode 100644 index 76197e374..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/ImageViewer.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -namespace OpenCvSharp.DebuggerVisualizers2012 -{ - partial class ImageViewer - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BackColor = System.Drawing.Color.Black; - this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(384, 263); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // ImageViewer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(384, 263); - this.Controls.Add(this.pictureBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ImageViewer"; - this.Text = "ImageViewer"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/ImageViewer.cs b/src/OpenCvSharp.DebuggerVisualizers2012/ImageViewer.cs deleted file mode 100644 index 010c5c49d..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/ImageViewer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace OpenCvSharp.DebuggerVisualizers2012 -{ - /// - /// - /// - public partial class ImageViewer : Form - { - private readonly Bitmap bitmap; - - /// - /// - /// - public ImageViewer() - { - InitializeComponent(); - } - - /// - /// - /// - /// - public ImageViewer(MatProxy proxy) - : this() - { - bitmap = proxy.CreateBitmap(); - } - - /// - /// - /// - /// - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); - pictureBox.Image = bitmap; - } - - /// - /// ClientSizeを画面からはみ出ない大きさに調整して設定する. - /// - /// - private void SetClientSize(System.Drawing.Size size) - { - var screenSize = Screen.PrimaryScreen.Bounds.Size; - if (size.Width > screenSize.Width) - { - double ratio = (double) screenSize.Width/size.Width; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - if (size.Height > screenSize.Height) - { - double ratio = (double) screenSize.Height/size.Height; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - ClientSize = size; - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/Key.snk b/src/OpenCvSharp.DebuggerVisualizers2012/Key.snk deleted file mode 100644 index 4ec932c07..000000000 Binary files a/src/OpenCvSharp.DebuggerVisualizers2012/Key.snk and /dev/null differ diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/MatDebuggerVisualizer.cs b/src/OpenCvSharp.DebuggerVisualizers2012/MatDebuggerVisualizer.cs deleted file mode 100644 index 2c2827b57..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/MatDebuggerVisualizer.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2012 -{ - /// - /// ビジュアライザでの視覚化処理 - /// - public class MatDebuggerVisualizer : DialogDebuggerVisualizer - { - protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) - { - // MatProxyが送られてくるはず - using (var proxy = objectProvider.GetObject() as MatProxy) - { - if (proxy == null) - { - throw new ArgumentException(); - } - // Formに表示 - using (var form = new ImageViewer(proxy)) - { - windowService.ShowDialog(form); - } - } - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/MatObjectSource.cs b/src/OpenCvSharp.DebuggerVisualizers2012/MatObjectSource.cs deleted file mode 100644 index ba0c21e00..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/MatObjectSource.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2012 -{ - /// - /// シリアライズ処理 - /// - public class MatObjectSource : VisualizerObjectSource - { - public override void GetData(object target, Stream outgoingData) - { - var bf = new BinaryFormatter(); - bf.Serialize(outgoingData, new MatProxy((Mat)target)); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/MatProxy.cs b/src/OpenCvSharp.DebuggerVisualizers2012/MatProxy.cs deleted file mode 100644 index c907a9f9a..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/MatProxy.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Drawing; -using System.IO; - -namespace OpenCvSharp.DebuggerVisualizers2012 -{ - /// - /// VACYs”\ȃNX肷邽߂ɎgvLVB - /// ۂɁAProxyɕ\ɕKvȃVACY”\ȃf[^l߂đAMŕB - /// - [Serializable] - public class MatProxy : IDisposable - { - public byte[] ImageData { get; private set; } - - public MatProxy(Mat image) - { - ImageData = image.ToBytes(".png"); - } - - public void Dispose() - { - ImageData = null; - } - - public Bitmap CreateBitmap() - { - if (ImageData == null) - throw new Exception("ImageData == null"); - - using (var stream = new MemoryStream(ImageData)) - { - return new Bitmap(stream); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/OpenCvSharp.DebuggerVisualizers2012.xproj b/src/OpenCvSharp.DebuggerVisualizers2012/OpenCvSharp.DebuggerVisualizers2012.xproj deleted file mode 100644 index 4c62bbbf2..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/OpenCvSharp.DebuggerVisualizers2012.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - df57cccb-47f5-41e0-b6ba-1557e3605396 - OpenCvSharp.DebuggerVisualizers2012 - .\obj - .\bin\ - v4.5 - - - 2.0 - - - \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/Properties/AssemblyInfo.cs b/src/OpenCvSharp.DebuggerVisualizers2012/Properties/AssemblyInfo.cs deleted file mode 100644 index fd93603a5..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.DebuggerVisualizers2012")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("df57cccb-47f5-41e0-b6ba-1557e3605396")] - -// OpenCvSharp objects' debugger visualizer -[assembly: DebuggerVisualizer( - typeof(OpenCvSharp.DebuggerVisualizers2012.MatDebuggerVisualizer), - typeof(OpenCvSharp.DebuggerVisualizers2012.MatObjectSource), - Target = typeof(OpenCvSharp.Mat), - Description = "Mat Visualizer" -)] \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/project.json b/src/OpenCvSharp.DebuggerVisualizers2012/project.json deleted file mode 100644 index 077cde619..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*", - "VSSDK.DebuggerVisualizers.11": "11.0.4" - }, - - "frameworks": { - "net20": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Drawing": "2.0.0.0", - "System.Windows.Forms": "2.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net20" ] - } - } - }, - "buildOptions": { - "optimize": true, - "keyFile": "Key.snk" - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2012/project.lock.json b/src/OpenCvSharp.DebuggerVisualizers2012/project.lock.json deleted file mode 100644 index 668975b5e..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2012/project.lock.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETFramework,Version=v2.0": { - "VSSDK.DebuggerVisualizers/11.0.4": { - "type": "package", - "dependencies": { - "VSSDK.IDE.11": "[11.0.4, 12.0.0)" - }, - "frameworkAssemblies": [ - "System.Windows.Forms" - ], - "compile": { - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll": {} - }, - "runtime": { - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll": {} - } - }, - "VSSDK.DebuggerVisualizers.11/11.0.4": { - "type": "package", - "dependencies": { - "VSSDK.DebuggerVisualizers": "[11.0.4, 12.0.0)", - "VSSDK.IDE.11": "[11.0.4, 12.0.0)" - } - }, - "VSSDK.IDE.11/11.0.4": { - "type": "package" - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v2.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net20/OpenCvSharp.dll": {} - }, - "runtime": { - "net20/OpenCvSharp.dll": {} - } - } - } - }, - "libraries": { - "VSSDK.DebuggerVisualizers/11.0.4": { - "sha512": "6JiCUGjeJRYENkwAmrK+VU0iHkMJX8C3WE8pQ5P4kXgAWkDB9siIQg6J7IucJXTxrV9LU/yzWLqsgpnMcF/JiQ==", - "type": "package", - "path": "VSSDK.DebuggerVisualizers/11.0.4", - "files": [ - "VSSDK.DebuggerVisualizers.11.0.4.nupkg.sha512", - "VSSDK.DebuggerVisualizers.nuspec", - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll", - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.xml", - "tools/install.ps1" - ] - }, - "VSSDK.DebuggerVisualizers.11/11.0.4": { - "sha512": "RJowVwGV0mo+GwVUjrftfJDesFEqlYO6BpZqkp3Y1coBzdZQ09w/dDb2ms5MeLKyzgfdDcqB8ljxPKpAyW8vIQ==", - "type": "package", - "path": "VSSDK.DebuggerVisualizers.11/11.0.4", - "files": [ - "VSSDK.DebuggerVisualizers.11.11.0.4.nupkg.sha512", - "VSSDK.DebuggerVisualizers.11.nuspec" - ] - }, - "VSSDK.IDE.11/11.0.4": { - "sha512": "U6sSnxiYdBu2yO/qSqe16nsuOm8LJaTmVDMqIgjKlgSUuUL9lNj0mIE34ZArd9kQrce+obaE/KSk4hiWYKSm+A==", - "type": "package", - "path": "VSSDK.IDE.11/11.0.4", - "files": [ - "VSSDK.IDE.11.11.0.4.nupkg.sha512", - "VSSDK.IDE.11.nuspec" - ] - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../OpenCvSharp/project.json", - "msbuildProject": "../OpenCvSharp/OpenCvSharp.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "OpenCvSharp >= 1.0.0-*", - "VSSDK.DebuggerVisualizers.11 >= 11.0.4" - ], - ".NETFramework,Version=v2.0": [ - "System.Drawing >= 2.0.0", - "System.Windows.Forms >= 2.0.0" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/ImageViewer.Designer.cs b/src/OpenCvSharp.DebuggerVisualizers2013/ImageViewer.Designer.cs deleted file mode 100644 index 65bf029bc..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/ImageViewer.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -namespace OpenCvSharp.DebuggerVisualizers2013 -{ - partial class ImageViewer - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BackColor = System.Drawing.Color.Black; - this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(384, 263); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // ImageViewer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(384, 263); - this.Controls.Add(this.pictureBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ImageViewer"; - this.Text = "ImageViewer"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/ImageViewer.cs b/src/OpenCvSharp.DebuggerVisualizers2013/ImageViewer.cs deleted file mode 100644 index fe17255fe..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/ImageViewer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace OpenCvSharp.DebuggerVisualizers2013 -{ - /// - /// - /// - public partial class ImageViewer : Form - { - private readonly Bitmap bitmap; - - /// - /// - /// - public ImageViewer() - { - InitializeComponent(); - } - - /// - /// - /// - /// - public ImageViewer(MatProxy proxy) - : this() - { - bitmap = proxy.CreateBitmap(); - } - - /// - /// - /// - /// - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); - pictureBox.Image = bitmap; - } - - /// - /// ClientSizeを画面からはみ出ない大きさに調整して設定する. - /// - /// - private void SetClientSize(System.Drawing.Size size) - { - var screenSize = Screen.PrimaryScreen.Bounds.Size; - if (size.Width > screenSize.Width) - { - double ratio = (double) screenSize.Width/size.Width; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - if (size.Height > screenSize.Height) - { - double ratio = (double) screenSize.Height/size.Height; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - ClientSize = size; - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/Key.snk b/src/OpenCvSharp.DebuggerVisualizers2013/Key.snk deleted file mode 100644 index a1e033087..000000000 Binary files a/src/OpenCvSharp.DebuggerVisualizers2013/Key.snk and /dev/null differ diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/MatDebuggerVisualizer.cs b/src/OpenCvSharp.DebuggerVisualizers2013/MatDebuggerVisualizer.cs deleted file mode 100644 index 5c9f929db..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/MatDebuggerVisualizer.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2013 -{ - /// - /// ビジュアライザでの視覚化処理 - /// - public class MatDebuggerVisualizer : DialogDebuggerVisualizer - { - protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) - { - // MatProxyが送られてくるはず - using (var proxy = objectProvider.GetObject() as MatProxy) - { - if (proxy == null) - { - throw new ArgumentException(); - } - // Formに表示 - using (var form = new ImageViewer(proxy)) - { - windowService.ShowDialog(form); - } - } - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/MatObjectSource.cs b/src/OpenCvSharp.DebuggerVisualizers2013/MatObjectSource.cs deleted file mode 100644 index bc65cbbc6..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/MatObjectSource.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2013 -{ - /// - /// シリアライズ処理 - /// - public class MatObjectSource : VisualizerObjectSource - { - public override void GetData(object target, Stream outgoingData) - { - var bf = new BinaryFormatter(); - bf.Serialize(outgoingData, new MatProxy((Mat)target)); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/MatProxy.cs b/src/OpenCvSharp.DebuggerVisualizers2013/MatProxy.cs deleted file mode 100644 index f994125c3..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/MatProxy.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Drawing; -using System.IO; - -namespace OpenCvSharp.DebuggerVisualizers2013 -{ - /// - /// シリアライズ不可能なクラスをやり取りするために使うプロキシ。 - /// 送る際に、このProxyに表示に必要なシリアライズ可能なデータを詰めて送り、受信側で復元する。 - /// - [Serializable] - public class MatProxy : IDisposable - { - public byte[] ImageData { get; private set; } - - public MatProxy(Mat image) - { - ImageData = image.ToBytes(".png"); - } - - public void Dispose() - { - ImageData = null; - } - - public Bitmap CreateBitmap() - { - if (ImageData == null) - throw new Exception("ImageData == null"); - - using (var stream = new MemoryStream(ImageData)) - { - return new Bitmap(stream); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/OpenCvSharp.DebuggerVisualizers2013.xproj b/src/OpenCvSharp.DebuggerVisualizers2013/OpenCvSharp.DebuggerVisualizers2013.xproj deleted file mode 100644 index fe792ddd9..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/OpenCvSharp.DebuggerVisualizers2013.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - ae1b5aa8-456e-4a6d-bace-9ea571266037 - OpenCvSharp.DebuggerVisualizers2013 - .\obj - .\bin\ - v4.5 - - - 2.0 - - - \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/Properties/AssemblyInfo.cs b/src/OpenCvSharp.DebuggerVisualizers2013/Properties/AssemblyInfo.cs deleted file mode 100644 index e5d547539..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.DebuggerVisualizers2013")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ae1b5aa8-456e-4a6d-bace-9ea571266037")] - -// OpenCvSharp objects' debugger visualizer -[assembly: DebuggerVisualizer( - typeof(OpenCvSharp.DebuggerVisualizers2013.MatDebuggerVisualizer), - typeof(OpenCvSharp.DebuggerVisualizers2013.MatObjectSource), - Target = typeof(OpenCvSharp.Mat), - Description = "Mat Visualizer" -)] \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/project.json b/src/OpenCvSharp.DebuggerVisualizers2013/project.json deleted file mode 100644 index 4dba1f14d..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*", - "VSSDK.DebuggerVisualizers.12": "12.0.4" - }, - - "frameworks": { - "net20": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Drawing": "2.0.0.0", - "System.Windows.Forms": "2.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net20" ] - } - } - }, - "buildOptions": { - "optimize": true, - "keyFile": "Key.snk" - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2013/project.lock.json b/src/OpenCvSharp.DebuggerVisualizers2013/project.lock.json deleted file mode 100644 index ad6c10203..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2013/project.lock.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETFramework,Version=v2.0": { - "VSSDK.DebuggerVisualizers/12.0.4": { - "type": "package", - "dependencies": { - "VSSDK.IDE.12": "[12.0.4, 13.0.0)" - }, - "frameworkAssemblies": [ - "System.Windows.Forms" - ], - "compile": { - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll": {} - }, - "runtime": { - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll": {} - } - }, - "VSSDK.DebuggerVisualizers.12/12.0.4": { - "type": "package", - "dependencies": { - "VSSDK.DebuggerVisualizers": "[12.0.4, 13.0.0)", - "VSSDK.IDE.12": "[12.0.4, 13.0.0)" - } - }, - "VSSDK.IDE.12/12.0.4": { - "type": "package" - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v2.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net20/OpenCvSharp.dll": {} - }, - "runtime": { - "net20/OpenCvSharp.dll": {} - } - } - } - }, - "libraries": { - "VSSDK.DebuggerVisualizers/12.0.4": { - "sha512": "P9wZZemQ617nXMTMzxXpj4NoveEhTBfplUZCafHo0UoedSZxLT3afS7l9T02tVSw7ifcvdwJUOj1eeV6qMnR0Q==", - "type": "package", - "path": "VSSDK.DebuggerVisualizers/12.0.4", - "files": [ - "VSSDK.DebuggerVisualizers.12.0.4.nupkg.sha512", - "VSSDK.DebuggerVisualizers.nuspec", - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.dll", - "lib/net20/Microsoft.VisualStudio.DebuggerVisualizers.xml", - "tools/install.ps1" - ] - }, - "VSSDK.DebuggerVisualizers.12/12.0.4": { - "sha512": "opVec3E8oRhQd3MvXggEhxZ6KvhjZ2X4CNn2N0bafZQqS6OUfccw4BYcTe/mGY/PA9uVBu9kENjnSgDglxI2GA==", - "type": "package", - "path": "VSSDK.DebuggerVisualizers.12/12.0.4", - "files": [ - "VSSDK.DebuggerVisualizers.12.12.0.4.nupkg.sha512", - "VSSDK.DebuggerVisualizers.12.nuspec" - ] - }, - "VSSDK.IDE.12/12.0.4": { - "sha512": "XYcSrKW9369JO1tOAuNxzZ6OOlx2QujDuboey4eYpp9GgA3Bd3mo0Fy2ZJd86sZqX27roBRzJfM1Ue/peyWOIg==", - "type": "package", - "path": "VSSDK.IDE.12/12.0.4", - "files": [ - "VSSDK.IDE.12.12.0.4.nupkg.sha512", - "VSSDK.IDE.12.nuspec" - ] - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../OpenCvSharp/project.json", - "msbuildProject": "../OpenCvSharp/OpenCvSharp.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "OpenCvSharp >= 1.0.0-*", - "VSSDK.DebuggerVisualizers.12 >= 12.0.4" - ], - ".NETFramework,Version=v2.0": [ - "System.Drawing >= 2.0.0", - "System.Windows.Forms >= 2.0.0" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/ImageViewer.Designer.cs b/src/OpenCvSharp.DebuggerVisualizers2015/ImageViewer.Designer.cs deleted file mode 100644 index da0b271c7..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/ImageViewer.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -namespace OpenCvSharp.DebuggerVisualizers2015 -{ - partial class ImageViewer - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BackColor = System.Drawing.Color.Black; - this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(384, 263); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // ImageViewer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(384, 263); - this.Controls.Add(this.pictureBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ImageViewer"; - this.Text = "ImageViewer"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/ImageViewer.cs b/src/OpenCvSharp.DebuggerVisualizers2015/ImageViewer.cs deleted file mode 100644 index 53b7fcc69..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/ImageViewer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace OpenCvSharp.DebuggerVisualizers2015 -{ - /// - /// - /// - public partial class ImageViewer : Form - { - private readonly Bitmap bitmap; - - /// - /// - /// - public ImageViewer() - { - InitializeComponent(); - } - - /// - /// - /// - /// - public ImageViewer(MatProxy proxy) - : this() - { - bitmap = proxy.CreateBitmap(); - } - - /// - /// - /// - /// - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); - pictureBox.Image = bitmap; - } - - /// - /// ClientSizeを画面からはみ出ない大きさに調整して設定する. - /// - /// - private void SetClientSize(System.Drawing.Size size) - { - var screenSize = Screen.PrimaryScreen.Bounds.Size; - if (size.Width > screenSize.Width) - { - double ratio = (double) screenSize.Width/size.Width; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - if (size.Height > screenSize.Height) - { - double ratio = (double) screenSize.Height/size.Height; - size.Width = Convert.ToInt32(size.Width*ratio); - size.Height = Convert.ToInt32(size.Height*ratio); - } - ClientSize = size; - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/MatDebuggerVisualizer.cs b/src/OpenCvSharp.DebuggerVisualizers2015/MatDebuggerVisualizer.cs deleted file mode 100644 index 4c014ae10..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/MatDebuggerVisualizer.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2015 -{ - /// - /// ビジュアライザでの視覚化処理 - /// - public class MatDebuggerVisualizer : DialogDebuggerVisualizer - { - protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) - { - // MatProxyが送られてくるはず - using (var proxy = objectProvider.GetObject() as MatProxy) - { - if (proxy == null) - { - throw new ArgumentException(); - } - // Formに表示 - using (var form = new ImageViewer(proxy)) - { - windowService.ShowDialog(form); - } - } - } - } -} diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/MatObjectSource.cs b/src/OpenCvSharp.DebuggerVisualizers2015/MatObjectSource.cs deleted file mode 100644 index 25de5939d..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/MatObjectSource.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using Microsoft.VisualStudio.DebuggerVisualizers; - -namespace OpenCvSharp.DebuggerVisualizers2015 -{ - /// - /// シリアライズ処理 - /// - public class MatObjectSource : VisualizerObjectSource - { - public override void GetData(object target, Stream outgoingData) - { - var bf = new BinaryFormatter(); - bf.Serialize(outgoingData, new MatProxy((Mat)target)); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/MatProxy.cs b/src/OpenCvSharp.DebuggerVisualizers2015/MatProxy.cs deleted file mode 100644 index 656031ef6..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/MatProxy.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Drawing; -using System.IO; - -namespace OpenCvSharp.DebuggerVisualizers2015 -{ - /// - /// シリアライズ不可能なクラスをやり取りするために使うプロキシ。 - /// 送る際に、このProxyに表示に必要なシリアライズ可能なデータを詰めて送り、受信側で復元する。 - /// - [Serializable] - public class MatProxy : IDisposable - { - public byte[] ImageData { get; private set; } - - public MatProxy(Mat image) - { - ImageData = image.ToBytes(".png"); - } - - public void Dispose() - { - ImageData = null; - } - - public Bitmap CreateBitmap() - { - if (ImageData == null) - throw new Exception("ImageData == null"); - - using (var stream = new MemoryStream(ImageData)) - { - return new Bitmap(stream); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/OpenCvSharp.DebuggerVisualizers2015.csproj b/src/OpenCvSharp.DebuggerVisualizers2015/OpenCvSharp.DebuggerVisualizers2015.csproj deleted file mode 100644 index 276a22250..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/OpenCvSharp.DebuggerVisualizers2015.csproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Debug - AnyCPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3} - Library - Properties - OpenCvSharp.DebuggerVisualizers2015 - OpenCvSharp.DebuggerVisualizers2015 - v4.6.1 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - False - .\OpenCvSharp.dll - - - - - - - - - - - - - - - Form - - - ImageViewer.cs - - - - - - - - - - - - \ No newline at end of file diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/OpenCvSharp.dll b/src/OpenCvSharp.DebuggerVisualizers2015/OpenCvSharp.dll deleted file mode 100644 index e5edaaa63..000000000 Binary files a/src/OpenCvSharp.DebuggerVisualizers2015/OpenCvSharp.dll and /dev/null differ diff --git a/src/OpenCvSharp.DebuggerVisualizers2015/Properties/AssemblyInfo.cs b/src/OpenCvSharp.DebuggerVisualizers2015/Properties/AssemblyInfo.cs deleted file mode 100644 index 0c4acc91e..000000000 --- a/src/OpenCvSharp.DebuggerVisualizers2015/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 -// アセンブリに関連付けられている情報を変更するには、 -// これらの属性値を変更してください。 -[assembly: AssemblyTitle("OpenCvSharp.DebuggerVisualizers2015")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.DebuggerVisualizers2015")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから -// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 -// その型の ComVisible 属性を true に設定してください。 -[assembly: ComVisible(false)] - -// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります -[assembly: Guid("4232cb4a-dfe3-46ca-9503-c5f1798baed3")] - -// アセンブリのバージョン情報は次の 4 つの値で構成されています: -// -// メジャー バージョン -// マイナー バージョン -// ビルド番号 -// Revision -// -// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を -// 既定値にすることができます: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -// OpenCvSharp objects' debugger visualizer -[assembly: DebuggerVisualizer( - typeof(OpenCvSharp.DebuggerVisualizers2015.MatDebuggerVisualizer), - typeof(OpenCvSharp.DebuggerVisualizers2015.MatObjectSource), - Target = typeof(OpenCvSharp.Mat), - Description = "Mat Visualizer" -)] \ No newline at end of file diff --git a/src/OpenCvSharp.Extensions/Binarizer.cs b/src/OpenCvSharp.Extensions/Binarizer.cs index d2b495bee..1f29ce482 100644 --- a/src/OpenCvSharp.Extensions/Binarizer.cs +++ b/src/OpenCvSharp.Extensions/Binarizer.cs @@ -1,381 +1,330 @@ -using System; +namespace OpenCvSharp.Extensions; -namespace OpenCvSharp.Extensions +/// +/// Various binarization methods (ATTENTION : The methods of this class is not implemented in OpenCV) +/// +[Obsolete("Use CvXImgProc.NiblackThreshold instead.")] +public static class Binarizer { -#if LANG_JP /// - /// 様々な二値化手法を集めたクラス (OpenCVの関数ではなく, OpenCvSharpが独自に実装したものである. 出来は保証しない.) + /// Binarizes by Niblack's method (This is faster but memory-hogging) /// -#else - /// - /// Various binarization methods (ATTENTION : The methods of this class is not implemented in OpenCV) - /// -#endif - public static class Binarizer + /// Input image + /// Output image + /// Window size + /// Adequate coefficient + public static void Niblack(Mat src, Mat dst, int kernelSize, double k) { -#if LANG_JP - /// - /// Niblackの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// 係数 -#else - /// - /// Binarizes by Niblack's method (This is faster but memory-hogging) - /// - /// Input image - /// Output image - /// Window size - /// Adequate coefficient -#endif - public static void Niblack(Mat src, Mat dst, int kernelSize, double k) + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + // グレースケールのみ + if (src.Type() != MatType.CV_8UC1) + throw new ArgumentException("src must be gray scale image"); + + // サイズのチェック + if (kernelSize < 3) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); + if (kernelSize % 2 == 0) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); + + int borderSize = kernelSize / 2; + int width = src.Width; + int height = src.Height; + dst.Create(src.Size(), src.Type()); + + using (var tempMat = new Mat(height + (borderSize * 2), width + (borderSize * 2), src.Type())) + using (var sumMat = new Mat()) + using (var sqSumMat = new Mat()) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - // グレースケールのみ - if (src.Type() != MatType.CV_8UC1) - throw new ArgumentException("src must be gray scale image"); - - // サイズのチェック - if (kernelSize < 3) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); - if (kernelSize % 2 == 0) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); - - int borderSize = kernelSize / 2; - int width = src.Width; - int height = src.Height; - dst.Create(src.Size(), src.Type()); - - using (var tempMat = new Mat(height + (borderSize * 2), width + (borderSize * 2), src.Type())) - using (var sumMat = new Mat()) - using (var sqSumMat = new Mat()) + Cv2.CopyMakeBorder(src, tempMat, borderSize, borderSize, borderSize, borderSize, BorderTypes.Replicate, Scalar.All(0)); + Cv2.Integral(tempMat, sumMat, sqSumMat, MatType.CV_64FC1); + + using (var tSrcMat = new Mat(src)) + using (var tDstMat = new Mat(dst)) + using (var tSumMat = new Mat(sumMat)) + using (var tSqSumMat = new Mat(sqSumMat)) { - Cv2.CopyMakeBorder(src, tempMat, borderSize, borderSize, borderSize, borderSize, BorderTypes.Replicate, Scalar.All(0)); - Cv2.Integral(tempMat, sumMat, sqSumMat, MatType.CV_64FC1); + var tSrc = tSrcMat.GetIndexer(); + var tDst = tDstMat.GetIndexer(); + var tSum = tSumMat.GetIndexer(); + var tSqSum = tSqSumMat.GetIndexer(); - using (var tSrcMat = new MatOfByte(src)) - using (var tDstMat = new MatOfByte(dst)) - using (var tSumMat = new MatOfDouble(sumMat)) - using (var tSqSumMat = new MatOfDouble(sqSumMat)) + int ylim = height + borderSize; + int xlim = width + borderSize; + int kernelPixels = kernelSize * kernelSize; + for (int y = borderSize; y < ylim; y++) { - var tSrc = tSrcMat.GetIndexer(); - var tDst = tDstMat.GetIndexer(); - var tSum = tSumMat.GetIndexer(); - var tSqSum = tSqSumMat.GetIndexer(); - - int ylim = height + borderSize; - int xlim = width + borderSize; - int kernelPixels = kernelSize * kernelSize; - for (int y = borderSize; y < ylim; y++) + for (int x = borderSize; x < xlim; x++) { - for (int x = borderSize; x < xlim; x++) - { - int x1 = x - borderSize; - int y1 = y - borderSize; - int x2 = x + borderSize + 1; - int y2 = y + borderSize + 1; - double sum = tSum[y2, x2] - tSum[y2, x1] - tSum[y1, x2] + tSum[y1, x1]; - double sqsum = tSqSum[y2, x2] - tSqSum[y2, x1] - tSqSum[y1, x2] + tSqSum[y1, x1]; - double mean = sum / kernelPixels; - double var = (sqsum / kernelPixels) - (mean * mean); - if (var < 0.0) var = 0.0; - double stddev = Math.Sqrt(var); - - double threshold = mean + k * stddev; - if (tSrc[y - borderSize, x - borderSize] < threshold) - tDst[y - borderSize, x - borderSize] = 0; - else - tDst[y - borderSize, x - borderSize] = 255; - } + int x1 = x - borderSize; + int y1 = y - borderSize; + int x2 = x + borderSize + 1; + int y2 = y + borderSize + 1; + double sum = tSum[y2, x2] - tSum[y2, x1] - tSum[y1, x2] + tSum[y1, x1]; + double sqsum = tSqSum[y2, x2] - tSqSum[y2, x1] - tSqSum[y1, x2] + tSqSum[y1, x1]; + double mean = sum / kernelPixels; + double var = (sqsum / kernelPixels) - (mean * mean); + if (var < 0.0) var = 0.0; + double stddev = Math.Sqrt(var); + + double threshold = mean + k * stddev; + if (tSrc[y - borderSize, x - borderSize] < threshold) + tDst[y - borderSize, x - borderSize] = 0; + else + tDst[y - borderSize, x - borderSize] = 255; } } } } + } -#if LANG_JP - /// - /// Sauvolaの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// 係数 - /// 係数 -#else - /// - /// Binarizes by Sauvola's method (This is faster but memory-hogging) - /// - /// Input image - /// Output image - /// Window size - /// Adequate coefficient - /// Adequate coefficient -#endif - public static void Sauvola(Mat src, Mat dst, int kernelSize, double k, double r) + /// + /// Binarizes by Sauvola's method (This is faster but memory-hogging) + /// + /// Input image + /// Output image + /// Window size + /// Adequate coefficient + /// Adequate coefficient + public static void Sauvola(Mat src, Mat dst, int kernelSize, double k, double r) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + // グレースケールのみ + if (src.Type() != MatType.CV_8UC1) + throw new ArgumentException("src must be gray scale image"); + + // サイズのチェック + if (kernelSize < 3) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); + if (kernelSize % 2 == 0) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); + if (Math.Abs(r) < 1e-9f) + throw new ArgumentOutOfRangeException(nameof(r), "r == 0"); + + int borderSize = kernelSize / 2; + int width = src.Width; + int height = src.Height; + dst.Create(src.Size(), src.Type()); + + using (var tempMat = new Mat(height + (borderSize * 2), width + (borderSize * 2), src.Type())) + using (var sumMat = new Mat()) + using (var sqSumMat = new Mat()) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - // グレースケールのみ - if (src.Type() != MatType.CV_8UC1) - throw new ArgumentException("src must be gray scale image"); - - // サイズのチェック - if (kernelSize < 3) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); - if (kernelSize % 2 == 0) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); - if (Math.Abs(r) < 1e-9f) - throw new ArgumentOutOfRangeException(nameof(r), "r == 0"); - - int borderSize = kernelSize / 2; - int width = src.Width; - int height = src.Height; - dst.Create(src.Size(), src.Type()); - - using (var tempMat = new Mat(height + (borderSize * 2), width + (borderSize * 2), src.Type())) - using (var sumMat = new Mat()) - using (var sqSumMat = new Mat()) + Cv2.CopyMakeBorder(src, tempMat, borderSize, borderSize, borderSize, borderSize, BorderTypes.Replicate, Scalar.All(0)); + Cv2.Integral(tempMat, sumMat, sqSumMat, MatType.CV_64FC1); + + using (var tSrcMat = new Mat(src)) + using (var tDstMat = new Mat(dst)) + using (var tSumMat = new Mat(sumMat)) + using (var tSqSumMat = new Mat(sqSumMat)) { - Cv2.CopyMakeBorder(src, tempMat, borderSize, borderSize, borderSize, borderSize, BorderTypes.Replicate, Scalar.All(0)); - Cv2.Integral(tempMat, sumMat, sqSumMat, MatType.CV_64FC1); + var tSrc = tSrcMat.GetIndexer(); + var tDst = tDstMat.GetIndexer(); + var tSum = tSumMat.GetIndexer(); + var tSqSum = tSqSumMat.GetIndexer(); - using (var tSrcMat = new MatOfByte(src)) - using (var tDstMat = new MatOfByte(dst)) - using (var tSumMat = new MatOfDouble(sumMat)) - using (var tSqSumMat = new MatOfDouble(sqSumMat)) + int ylim = height + borderSize; + int xlim = width + borderSize; + int kernelPixels = kernelSize * kernelSize; + for (int y = borderSize; y < ylim; y++) { - var tSrc = tSrcMat.GetIndexer(); - var tDst = tDstMat.GetIndexer(); - var tSum = tSumMat.GetIndexer(); - var tSqSum = tSqSumMat.GetIndexer(); - - int ylim = height + borderSize; - int xlim = width + borderSize; - int kernelPixels = kernelSize * kernelSize; - for (int y = borderSize; y < ylim; y++) + for (int x = borderSize; x < xlim; x++) { - for (int x = borderSize; x < xlim; x++) - { - int x1 = x - borderSize; - int y1 = y - borderSize; - int x2 = x + borderSize + 1; - int y2 = y + borderSize + 1; - double sum = tSum[y2, x2] - tSum[y2, x1] - tSum[y1, x2] + tSum[y1, x1]; - double sqsum = tSqSum[y2, x2] - tSqSum[y2, x1] - tSqSum[y1, x2] + tSqSum[y1, x1]; - double mean = sum / kernelPixels; - double var = (sqsum / kernelPixels) - (mean * mean); - if (var < 0.0) var = 0.0; - double stddev = Math.Sqrt(var); - - double threshold = mean * (1 + k * (stddev / r - 1)); - if (tSrc[y - borderSize, x - borderSize] < threshold) - tDst[y - borderSize, x - borderSize] = 0; - else - tDst[y - borderSize, x - borderSize] = 255; - } + int x1 = x - borderSize; + int y1 = y - borderSize; + int x2 = x + borderSize + 1; + int y2 = y + borderSize + 1; + double sum = tSum[y2, x2] - tSum[y2, x1] - tSum[y1, x2] + tSum[y1, x1]; + double sqsum = tSqSum[y2, x2] - tSqSum[y2, x1] - tSqSum[y1, x2] + tSqSum[y1, x1]; + double mean = sum / kernelPixels; + double var = (sqsum / kernelPixels) - (mean * mean); + if (var < 0.0) var = 0.0; + double stddev = Math.Sqrt(var); + + double threshold = mean * (1 + k * (stddev / r - 1)); + if (tSrc[y - borderSize, x - borderSize] < threshold) + tDst[y - borderSize, x - borderSize] = 0; + else + tDst[y - borderSize, x - borderSize] = 255; } } } } + } - -#if LANG_JP - /// - /// Bernsenの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// この数値以下のコントラストの領域は背景領域とみなす - /// 背景領域と見なされた領域に適用する閾値(背景領域以外では、適応的に閾値を求める) -#else - /// - /// Binarizes by Bernsen's method - /// - /// Input image - /// Output image - /// Window size - /// Adequate coefficient - /// Adequate coefficient -#endif - public static void Bernsen(Mat src, Mat dst, int kernelSize, byte constrastMin, byte bgThreshold) + /// + /// Binarizes by Bernsen's method + /// + /// Input image + /// Output image + /// Window size + /// Adequate coefficient + /// Adequate coefficient + public static void Bernsen(Mat src, Mat dst, int kernelSize, byte constrastMin, byte bgThreshold) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + // グレースケールのみ + if (src.Type() != MatType.CV_8UC1) + throw new ArgumentException("src must be gray scale image"); + + // サイズのチェック + if (kernelSize < 3) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); + if (kernelSize % 2 == 0) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); + + int width = src.Width; + int height = src.Height; + dst.Create(src.Size(), src.Type()); + + using (var tSrcMat = new Mat(src)) + using (var tDstMat = new Mat(dst)) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - // グレースケールのみ - if (src.Type() != MatType.CV_8UC1) - throw new ArgumentException("src must be gray scale image"); - - // サイズのチェック - if (kernelSize < 3) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); - if (kernelSize % 2 == 0) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); - - int width = src.Width; - int height = src.Height; - dst.Create(src.Size(), src.Type()); - - using (var tSrcMat = new MatOfByte(src)) - using (var tDstMat = new MatOfByte(dst)) - { - var tSrc = tSrcMat.GetIndexer(); - var tDst = tDstMat.GetIndexer(); + var tSrc = tSrcMat.GetIndexer(); + var tDst = tDstMat.GetIndexer(); - for (int y = 0; y < height; y++) + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) { - for (int x = 0; x < width; x++) - { - byte min, max; - MinMax(src, x, y, kernelSize, out min, out max); - - int contrast = max - min; - byte threshold; - if (contrast < constrastMin) - threshold = bgThreshold; - else - threshold = (byte)((max + min) / 2); - - if (tSrc[y, x] <= threshold) - tDst[y, x] = 0; - else - tDst[y, x] = 255; - } + byte min, max; + MinMax(src, x, y, kernelSize, out min, out max); + + int contrast = max - min; + byte threshold; + if (contrast < constrastMin) + threshold = bgThreshold; + else + threshold = (byte)((max + min) / 2); + + if (tSrc[y, x] <= threshold) + tDst[y, x] = 0; + else + tDst[y, x] = 255; } } - } -#if LANG_JP - /// - /// Nickの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// 係数 -#else - /// - /// Binarizes by Nick's method - /// - /// Input image - /// Output image - /// Window size - /// Adequate coefficient -#endif - public static void Nick(Mat src, Mat dst, int kernelSize, double k) + } + + /// + /// Binarizes by Nick's method + /// + /// Input image + /// Output image + /// Window size + /// Adequate coefficient + public static void Nick(Mat src, Mat dst, int kernelSize, double k) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + // グレースケールのみ + if (src.Type() != MatType.CV_8UC1) + throw new ArgumentException("src must be gray scale image"); + + // サイズのチェック + if (kernelSize < 3) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); + if (kernelSize % 2 == 0) + throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); + + int borderSize = kernelSize / 2; + int width = src.Width; + int height = src.Height; + dst.Create(src.Size(), src.Type()); + + using (var tempMat = new Mat(height + (borderSize * 2), width + (borderSize * 2), src.Type())) + using (var sumMat = new Mat()) + using (var sqSumMat = new Mat()) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - // グレースケールのみ - if (src.Type() != MatType.CV_8UC1) - throw new ArgumentException("src must be gray scale image"); - - // サイズのチェック - if (kernelSize < 3) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be 3 and above"); - if (kernelSize % 2 == 0) - throw new ArgumentOutOfRangeException(nameof(kernelSize), "size must be odd number"); - - int borderSize = kernelSize / 2; - int width = src.Width; - int height = src.Height; - dst.Create(src.Size(), src.Type()); - - using (var tempMat = new Mat(height + (borderSize * 2), width + (borderSize * 2), src.Type())) - using (var sumMat = new Mat()) - using (var sqSumMat = new Mat()) + Cv2.CopyMakeBorder(src, tempMat, borderSize, borderSize, borderSize, borderSize, BorderTypes.Replicate, Scalar.All(0)); + Cv2.Integral(tempMat, sumMat, sqSumMat, MatType.CV_64FC1); + + using (var tSrcMat = new Mat(src)) + using (var tDstMat = new Mat(dst)) + using (var tSumMat = new Mat(sumMat)) + using (var tSqSumMat = new Mat(sqSumMat)) { - Cv2.CopyMakeBorder(src, tempMat, borderSize, borderSize, borderSize, borderSize, BorderTypes.Replicate, Scalar.All(0)); - Cv2.Integral(tempMat, sumMat, sqSumMat, MatType.CV_64FC1); + var tSrc = tSrcMat.GetIndexer(); + var tDst = tDstMat.GetIndexer(); + var tSum = tSumMat.GetIndexer(); + var tSqSum = tSqSumMat.GetIndexer(); - using (var tSrcMat = new MatOfByte(src)) - using (var tDstMat = new MatOfByte(dst)) - using (var tSumMat = new MatOfDouble(sumMat)) - using (var tSqSumMat = new MatOfDouble(sqSumMat)) + int ylim = height + borderSize; + int xlim = width + borderSize; + int kernelPixels = kernelSize * kernelSize; + for (int y = borderSize; y < ylim; y++) { - var tSrc = tSrcMat.GetIndexer(); - var tDst = tDstMat.GetIndexer(); - var tSum = tSumMat.GetIndexer(); - var tSqSum = tSqSumMat.GetIndexer(); - - int ylim = height + borderSize; - int xlim = width + borderSize; - int kernelPixels = kernelSize * kernelSize; - for (int y = borderSize; y < ylim; y++) + for (int x = borderSize; x < xlim; x++) { - for (int x = borderSize; x < xlim; x++) - { - int x1 = x - borderSize; - int y1 = y - borderSize; - int x2 = x + borderSize + 1; - int y2 = y + borderSize + 1; - double sum = tSum[y2, x2] - tSum[y2, x1] - tSum[y1, x2] + tSum[y1, x1]; - double sqsum = tSqSum[y2, x2] - tSqSum[y2, x1] - tSqSum[y1, x2] + tSqSum[y1, x1]; - double mean = sum / kernelPixels; - double term = (sqsum - mean * mean) / kernelPixels; - if (term < 0.0) term = 0.0; - term = Math.Sqrt(term); - - double threshold = mean + k * term; - if (tSrc[y - borderSize, x - borderSize] < threshold) - tDst[y - borderSize, x - borderSize] = 0; - else - tDst[y - borderSize, x - borderSize] = 255; - } + int x1 = x - borderSize; + int y1 = y - borderSize; + int x2 = x + borderSize + 1; + int y2 = y + borderSize + 1; + double sum = tSum[y2, x2] - tSum[y2, x1] - tSum[y1, x2] + tSum[y1, x1]; + double sqsum = tSqSum[y2, x2] - tSqSum[y2, x1] - tSqSum[y1, x2] + tSqSum[y1, x1]; + double mean = sum / kernelPixels; + double term = (sqsum - mean * mean) / kernelPixels; + if (term < 0.0) term = 0.0; + term = Math.Sqrt(term); + + double threshold = mean + k * term; + if (tSrc[y - borderSize, x - borderSize] < threshold) + tDst[y - borderSize, x - borderSize] = 0; + else + tDst[y - borderSize, x - borderSize] = 255; } } } } + } - /// - /// 注目画素の周辺画素の最大値と最小値を求める - /// - /// 画像の画素データ - /// x座標 - /// y座標 - /// 周辺画素の探索サイズ。奇数でなければならない - /// 出力される最小値 - /// 出力される最大値 - private static void MinMax(Mat img, int x, int y, int size, out byte min, out byte max) + /// + /// 注目画素の周辺画素の最大値と最小値を求める + /// + /// 画像の画素データ + /// x座標 + /// y座標 + /// 周辺画素の探索サイズ。奇数でなければならない + /// 出力される最小値 + /// 出力される最大値 + private static void MinMax(Mat img, int x, int y, int size, out byte min, out byte max) + { + int size2 = size / 2; + min = byte.MaxValue; + max = byte.MinValue; + int xs = Math.Max(x - size2, 0); + int xe = Math.Min(x + size2, img.Width); + int ys = Math.Max(y - size2, 0); + int ye = Math.Min(y + size2, img.Height); + + using (var tImg = new Mat(img)) { - int size2 = size / 2; - min = byte.MaxValue; - max = byte.MinValue; - int xs = Math.Max(x - size2, 0); - int xe = Math.Min(x + size2, img.Width); - int ys = Math.Max(y - size2, 0); - int ye = Math.Min(y + size2, img.Height); - - using (var tImg = new MatOfByte(img)) - { - var indexer = tImg.GetIndexer(); + var indexer = tImg.GetIndexer(); - for (int xx = xs; xx < xe; xx++) + for (int xx = xs; xx < xe; xx++) + { + for (int yy = ys; yy < ye; yy++) { - for (int yy = ys; yy < ye; yy++) - { - byte v = indexer[yy, xx]; - if (max < v) - max = v; - else if (min > v) - min = v; - } + byte v = indexer[yy, xx]; + if (max < v) + max = v; + else if (min > v) + min = v; } } } diff --git a/src/OpenCvSharp.Extensions/BitmapConverter.cs b/src/OpenCvSharp.Extensions/BitmapConverter.cs index 41baaca38..db60bc3e6 100644 --- a/src/OpenCvSharp.Extensions/BitmapConverter.cs +++ b/src/OpenCvSharp.Extensions/BitmapConverter.cs @@ -1,429 +1,488 @@ -using System; -using System.Collections.Generic; -using System.Drawing; +using System.Drawing; using System.Drawing.Imaging; -using OpenCvSharp.Util; +using System.Runtime.InteropServices; -namespace OpenCvSharp.Extensions +namespace OpenCvSharp.Extensions; + +/// +/// static class which provides conversion between System.Drawing.Bitmap and Mat +/// +public static class BitmapConverter { -#if LANG_JP + #region ToMat + /// - /// System.Drawing.BitmapとMatの相互変換メソッドを提供するクラス + /// Converts System.Drawing.Bitmap to Mat /// -#else + /// System.Drawing.Bitmap object to be converted + /// A Mat object which is converted from System.Drawing.Bitmap +#if NET5_0_OR_GREATER + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif + public static Mat ToMat(this Bitmap src) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + throw new NotSupportedException("Non-Windows OS are not supported"); + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var w = src.Width; + var h = src.Height; + var channels = src.PixelFormat switch + { + PixelFormat.Format24bppRgb or PixelFormat.Format32bppRgb => 3, + PixelFormat.Format32bppArgb or PixelFormat.Format32bppPArgb => 4, + PixelFormat.Format8bppIndexed or PixelFormat.Format1bppIndexed => 1, + _ => throw new NotImplementedException(), + }; + var dst = new Mat(h, w, MatType.CV_8UC(channels)); + ToMat(src, dst); + return dst; + } + /// - /// static class which provides conversion between System.Drawing.Bitmap and Mat + /// Converts System.Drawing.Bitmap to Mat /// + /// System.Drawing.Bitmap object to be converted + /// A Mat object which is converted from System.Drawing.Bitmap +#if NET5_0_OR_GREATER + [System.Runtime.Versioning.SupportedOSPlatform("windows")] #endif - public static class BitmapConverter + public static unsafe void ToMat(this Bitmap src, Mat dst) { - #region ToMat -#if LANG_JP - /// - /// System.Drawing.BitmapからOpenCVのMatへ変換して返す. - /// - /// 変換するSystem.Drawing.Bitmap - /// 変換結果のMat -#else - /// - /// Converts System.Drawing.Bitmap to Mat - /// - /// System.Drawing.Bitmap object to be converted - /// A Mat object which is converted from System.Drawing.Bitmap -#endif - public static Mat ToMat(this Bitmap src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + throw new NotSupportedException("Non-Windows OS are not supported"); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (dst.IsDisposed) + throw new ArgumentException("The specified dst is disposed.", nameof(dst)); + if (dst.Depth() != MatType.CV_8U) + throw new NotSupportedException("Mat depth != CV_8U"); + if (dst.Dims != 2) + throw new NotSupportedException("Mat dims != 2"); + if (src.Width != dst.Width || src.Height != dst.Height) + throw new ArgumentException("src.Size != dst.Size"); - int w = src.Width; - int h = src.Height; - int channels; + var w = src.Width; + var h = src.Height; + var rect = new Rectangle(0, 0, w, h); + BitmapData? bd = null; + try + { + bd = src.LockBits(rect, ImageLockMode.ReadOnly, src.PixelFormat); + switch (src.PixelFormat) { + case PixelFormat.Format1bppIndexed: + Format1bppIndexed(); + break; + + case PixelFormat.Format8bppIndexed: + Format8bppIndexed(); + break; + case PixelFormat.Format24bppRgb: + Format24bppRgb(); + break; + case PixelFormat.Format32bppRgb: - channels = 3; break; case PixelFormat.Format32bppArgb: case PixelFormat.Format32bppPArgb: - channels = 4; break; - case PixelFormat.Format8bppIndexed: - case PixelFormat.Format1bppIndexed: - channels = 1; break; - default: - throw new NotImplementedException(); + Format32bppRgb(); + break; } - - Mat dst = new Mat(h, w, MatType.CV_8UC(channels)); - ToMat(src, dst); - return dst; } - -#if LANG_JP - /// - /// System.Drawing.BitmapからOpenCVのMatへ変換して返す. - /// - /// 変換するSystem.Drawing.Bitmap - /// 変換結果を格納するMat -#else - /// - /// Converts System.Drawing.Bitmap to Mat - /// - /// System.Drawing.Bitmap object to be converted - /// A Mat object which is converted from System.Drawing.Bitmap -#endif - public static unsafe void ToMat(this Bitmap src, Mat dst) + finally { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (dst.IsDisposed) - throw new ArgumentException("The specified dst is disposed.", nameof(dst)); - if (dst.Depth() != MatType.CV_8U) - throw new NotSupportedException("Mat depth != CV_8U"); - if (dst.Dims() != 2) - throw new NotSupportedException("Mat dims != 2"); - if (src.Width != dst.Width || src.Height != dst.Height) - throw new ArgumentException("src.Size != dst.Size"); - - int w = src.Width; - int h = src.Height; - Rectangle rect = new Rectangle(0, 0, w, h); - BitmapData bd = null; - try - { - bd = src.LockBits(rect, ImageLockMode.ReadOnly, src.PixelFormat); - - byte* p = (byte*)bd.Scan0.ToPointer(); - int sstep = bd.Stride; - int offset = sstep - (w / 8); - uint dstep = (uint)dst.Step(); - IntPtr dstData = dst.Data; - byte* dstPtr = (byte*)dstData.ToPointer(); - - bool submat = dst.IsSubmatrix(); - bool continuous = dst.IsContinuous(); + if (bd is not null) + src.UnlockBits(bd); + } + + // ReSharper disable once InconsistentNaming + void Format1bppIndexed() + { + if (dst.Channels() != 1) + throw new ArgumentException("Invalid nChannels"); + if (dst.IsSubmatrix()) + throw new NotImplementedException("submatrix not supported"); + if (bd is null) + throw new NotSupportedException("BitmapData is null (Format1bppIndexed)"); + + var srcPtr = (byte*)bd.Scan0.ToPointer(); + var dstPtr = dst.DataPointer; + var srcStep = bd.Stride; + var dstStep = (uint)dst.Step(); + var x = 0; - switch (src.PixelFormat) + for (var y = 0; y < h; y++) + { + // 横は必ず4byte幅に切り上げられる。 + // この行の各バイトを調べていく + for (var bytePos = 0; bytePos < srcStep; bytePos++) { - case PixelFormat.Format1bppIndexed: + if (x < w) + { + // 現在の位置のバイトからそれぞれのビット8つを取り出す + var b = srcPtr[bytePos]; + for (var i = 0; i < 8; i++) { - if (dst.Channels() != 1) - throw new ArgumentException("Invalid nChannels"); - if (submat) - throw new NotImplementedException("submatrix not supported"); - - int x = 0; - int y; - int bytePos; - byte b; - int i; - for (y = 0; y < h; y++) + if (x >= w) { - // 横は必ず4byte幅に切り上げられる。 - // この行の各バイトを調べていく - for (bytePos = 0; bytePos < sstep; bytePos++) - { - if (x < w) - { - // 現在の位置のバイトからそれぞれのビット8つを取り出す - b = p[bytePos]; - for (i = 0; i < 8; i++) - { - if (x >= w) - { - break; - } - // IplImageは8bit/pixel - dstPtr[dstep * y + x] = ((b & 0x80) == 0x80) ? (byte)255 : (byte)0; - b <<= 1; - x++; - } - } - } - // 次の行へ - x = 0; - p += sstep; + break; } + // IplImageは8bit/pixel + dstPtr[dstStep * y + x] = ((b & 0x80) == 0x80) ? (byte)255 : (byte)0; + b <<= 1; + x++; } - break; + } + } + // 次の行へ + x = 0; + srcPtr += srcStep; + } + } + + // ReSharper disable once InconsistentNaming + void Format8bppIndexed() + { + static void Ch1(Mat dst, int height, int srcStep, uint dstStep, IntPtr srcData, byte[] palette) + { + if (dstStep == srcStep && !dst.IsSubmatrix() && dst.IsContinuous()) + { + // Read Bitmap pixel data to managed array + var length = dst.DataEnd.ToInt64() - dst.Data.ToInt64(); + if (length > int.MaxValue) + throw new NotSupportedException("Too big dst Mat"); + var buffer = new byte[length]; + Marshal.Copy(srcData, buffer, 0, buffer.Length); + // Apply conversion by palette + buffer = buffer.Select(b => palette[b]).ToArray(); + // Write to dst Mat + Marshal.Copy(buffer, 0, dst.Data, buffer.Length); + } + else + { + // Copy line bytes from src to dst for each line + var sp = (byte*) srcData; + var dp = (byte*) dst.Data; + var buffer = new byte[srcStep]; + for (var y = 0; y < height; y++) + { + // Read Bitmap pixel data to managed array + Marshal.Copy(new IntPtr(sp), buffer, 0, buffer.Length); + // Apply conversion by palette + buffer = buffer.Select(b => palette[b]).ToArray(); + // Write to dst Mat + Marshal.Copy(buffer, 0, new IntPtr(dp), buffer.Length); - case PixelFormat.Format8bppIndexed: - case PixelFormat.Format24bppRgb: - { - if (src.PixelFormat == PixelFormat.Format8bppIndexed) - if (dst.Channels() != 1) - throw new ArgumentException("Invalid nChannels"); - if (src.PixelFormat == PixelFormat.Format24bppRgb) - if (dst.Channels() != 3) - throw new ArgumentException("Invalid nChannels"); - - // ステップが同じで連続なら、一気にコピー - if (dstep == sstep && !submat && continuous) - { - uint length = (uint)(dst.DataEnd.ToInt64() - dstData.ToInt64()); - MemoryHelper.CopyMemory(dstData, bd.Scan0, length); - } - else - { - // 各行ごとにdstの行バイト幅コピー - byte* sp = (byte*)bd.Scan0; - byte* dp = (byte*)dst.Data; - for (int y = 0; y < h; y++) - { - MemoryHelper.CopyMemory(dp, sp, dstep); - sp += sstep; - dp += dstep; - } - } - } - break; + sp += srcStep; + dp += dstStep; + } + } + } - case PixelFormat.Format32bppRgb: - case PixelFormat.Format32bppArgb: - case PixelFormat.Format32bppPArgb: - { - switch (dst.Channels()) - { - case 4: - if (!submat && continuous) - { - uint length = (uint)(dst.DataEnd.ToInt64() - dstData.ToInt64()); - MemoryHelper.CopyMemory(dstData, bd.Scan0, length); - } - else - { - byte* sp = (byte*)bd.Scan0; - byte* dp = (byte*)dst.Data; - for (int y = 0; y < h; y++) - { - MemoryHelper.CopyMemory(dp, sp, dstep); - sp += sstep; - dp += dstep; - } - } - break; - case 3: - for (int y = 0; y < h; y++) - { - for (int x = 0; x < w; x++) - { - dstPtr[y * dstep + x * 3 + 0] = p[y * sstep + x * 4 + 0]; - dstPtr[y * dstep + x * 3 + 1] = p[y * sstep + x * 4 + 1]; - dstPtr[y * dstep + x * 3 + 2] = p[y * sstep + x * 4 + 2]; - } - } - break; - default: - throw new ArgumentException("Invalid nChannels"); - } - } - break; + var srcStep = bd.Stride; + var dstStep = (uint)dst.Step(); + + var channels = dst.Channels(); + if (channels == 1) + { + var palette = new byte[256]; + var paletteLength = Math.Min(256, src.Palette.Entries.Length); + for (var i = 0; i < paletteLength; i++) + { + // TODO src.Palette.Flags & 2 == 2 + // https://docs.microsoft.com/ja-jp/dotnet/api/system.drawing.imaging.colorpalette.flags?view=netframework-4.8 + palette[i] = src.Palette.Entries[i].R; } + Ch1(dst, h, srcStep, dstStep, bd.Scan0, palette); } - finally + else if (channels == 3) { - if (bd != null) - src.UnlockBits(bd); + // Palette + var paletteR = new byte[256]; + var paletteG = new byte[256]; + var paletteB = new byte[256]; + var paletteLength = Math.Min(256, src.Palette.Entries.Length); + for (var i = 0; i < paletteLength; i++) + { + var c = src.Palette.Entries[i]; + paletteR[i] = c.R; + paletteG[i] = c.G; + paletteB[i] = c.B; + } + + using var dstR = new Mat(h, w, MatType.CV_8UC1); + using var dstG = new Mat(h, w, MatType.CV_8UC1); + using var dstB = new Mat(h, w, MatType.CV_8UC1); + + Ch1(dstR, h, srcStep, (uint)dstR.Step(), bd.Scan0, paletteR); + Ch1(dstG, h, srcStep, (uint)dstG.Step(), bd.Scan0, paletteG); + Ch1(dstB, h, srcStep, (uint)dstB.Step(), bd.Scan0, paletteB); + Cv2.Merge([dstB, dstG, dstR], dst); + } + else + { + throw new ArgumentException($"Invalid channels of dst Mat ({channels})"); } } - #endregion - - #region ToBitmap -#if LANG_JP - /// - /// OpenCVのMatをSystem.Drawing.Bitmapに変換する - /// - /// 変換するMat - /// System.Drawing.Bitmap -#else - /// - /// Converts Mat to System.Drawing.Bitmap - /// - /// Mat - /// -#endif - public static Bitmap ToBitmap(this Mat src) + + // ReSharper disable once InconsistentNaming + void Format24bppRgb() { - if (src == null) + if (dst.Channels() != 3) + throw new ArgumentException("Invalid nChannels"); + if (dst.Depth() != MatType.CV_8U && dst.Depth() != MatType.CV_8S) + throw new ArgumentException("Invalid depth of dst Mat"); + + var srcStep = bd.Stride; + var dstStep = dst.Step(); + if (dstStep == srcStep && !dst.IsSubmatrix() && dst.IsContinuous()) + { + var dstData = dst.Data; + var bytesToCopy = dst.DataEnd.ToInt64() - dstData.ToInt64(); + Buffer.MemoryCopy(bd.Scan0.ToPointer(), dstData.ToPointer(), bytesToCopy, bytesToCopy); + } + else { - throw new ArgumentNullException(nameof(src)); + // Copy line bytes from src to dst for each line + var sp = (byte*) bd.Scan0; + var dp = (byte*) dst.Data; + for (var y = 0; y < h; y++) + { + Buffer.MemoryCopy(sp, dp, dstStep, dstStep); + sp += srcStep; + dp += dstStep; + } } + } + + // ReSharper disable once InconsistentNaming + void Format32bppRgb() + { + var srcStep = bd.Stride; + var dstStep = dst.Step(); - PixelFormat pf; - switch (src.Channels()) + switch (dst.Channels()) { - case 1: - pf = PixelFormat.Format8bppIndexed; break; - case 3: - pf = PixelFormat.Format24bppRgb; break; case 4: - pf = PixelFormat.Format32bppArgb; break; + if (!dst.IsSubmatrix() && dst.IsContinuous()) + { + var dstData = dst.Data; + var bytesToCopy = dst.DataEnd.ToInt64() - dstData.ToInt64(); + Buffer.MemoryCopy(bd.Scan0.ToPointer(), dstData.ToPointer(), bytesToCopy, bytesToCopy); + } + else + { + var sp = (byte*) bd.Scan0; + var dp = (byte*) dst.Data; + for (var y = 0; y < h; y++) + { + Buffer.MemoryCopy(sp, dp, dstStep, dstStep); + sp += srcStep; + dp += dstStep; + } + } + + break; + case 3: + var srcPtr = (byte*)bd.Scan0.ToPointer(); + var dstPtr = (byte*)dst.Data.ToPointer(); + for (var y = 0; y < h; y++) + { + for (var x = 0; x < w; x++) + { + dstPtr[y * dstStep + x * 3 + 0] = srcPtr[y * srcStep + x * 4 + 0]; + dstPtr[y * dstStep + x * 3 + 1] = srcPtr[y * srcStep + x * 4 + 1]; + dstPtr[y * dstStep + x * 3 + 2] = srcPtr[y * srcStep + x * 4 + 2]; + } + } + + break; default: - throw new ArgumentException("Number of channels must be 1, 3 or 4.", nameof(src)); + throw new ArgumentException("Invalid nChannels"); } - return ToBitmap(src, pf); } -#if LANG_JP - /// - /// OpenCVのMatをSystem.Drawing.Bitmapに変換する - /// - /// 変換するMat - /// ピクセル深度 - /// System.Drawing.Bitmap -#else - /// - /// Converts Mat to System.Drawing.Bitmap - /// - /// Mat - /// Pixel Depth - /// + } + #endregion + + #region ToBitmap + + /// + /// Converts Mat to System.Drawing.Bitmap + /// + /// Mat + /// +#if NET5_0_OR_GREATER + [System.Runtime.Versioning.SupportedOSPlatform("windows")] #endif - public static Bitmap ToBitmap(this Mat src, PixelFormat pf) + public static Bitmap ToBitmap(this Mat src) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + throw new NotSupportedException("Non-Windows OS are not supported"); + if (src is null) + throw new ArgumentNullException(nameof(src)); + var pf = src.Channels() switch { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); + 1 => PixelFormat.Format8bppIndexed, + 3 => PixelFormat.Format24bppRgb, + 4 => PixelFormat.Format32bppArgb, + _ => throw new ArgumentException("Number of channels must be 1, 3 or 4.", nameof(src)), + }; + return ToBitmap(src, pf); + } - Bitmap bitmap = new Bitmap(src.Width, src.Height, pf); - ToBitmap(src, bitmap); - return bitmap; - } + /// + /// Converts Mat to System.Drawing.Bitmap + /// + /// Mat + /// Pixel Depth + /// +#if NET5_0_OR_GREATER + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif + public static Bitmap ToBitmap(this Mat src, PixelFormat pf) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + throw new NotSupportedException("Non-Windows OS are not supported"); + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + var bitmap = new Bitmap(src.Width, src.Height, pf); + ToBitmap(src, bitmap); + return bitmap; + } -#if LANG_JP - /// - /// OpenCVのMatを指定した出力先にSystem.Drawing.Bitmapとして変換する - /// - /// 変換するMat - /// 出力先のSystem.Drawing.Bitmap - /// Author: shimat, Gummo (ROI support) -#else - /// - /// Converts Mat to System.Drawing.Bitmap - /// - /// Mat - /// Mat - /// Author: shimat, Gummo (ROI support) + /// + /// Converts Mat to System.Drawing.Bitmap + /// + /// Mat + /// Mat + /// Author: shimat, Gummo (ROI support) +#if NET5_0_OR_GREATER + [System.Runtime.Versioning.SupportedOSPlatform("windows")] #endif - public static unsafe void ToBitmap(this Mat src, Bitmap dst) + public static unsafe void ToBitmap(this Mat src, Bitmap dst) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + throw new NotSupportedException("Non-Windows OS are not supported"); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (src.IsDisposed) + throw new ArgumentException("The image is disposed.", nameof(src)); + if (src.Depth() != MatType.CV_8U) + throw new ArgumentException("Depth of the image must be CV_8U"); + //if (src.IsSubmatrix()) + // throw new ArgumentException("Submatrix is not supported"); + if (src.Width != dst.Width || src.Height != dst.Height) + throw new ArgumentException(""); + + var pf = dst.PixelFormat; + + // 1プレーン用の場合、グレースケールのパレット情報を生成する + if (pf == PixelFormat.Format8bppIndexed) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (src.IsDisposed) - throw new ArgumentException("The image is disposed.", nameof(src)); - if (src.Depth() != MatType.CV_8U) - throw new ArgumentException("Depth of the image must be CV_8U"); - //if (src.IsSubmatrix()) - // throw new ArgumentException("Submatrix is not supported"); - if (src.Width != dst.Width || src.Height != dst.Height) - throw new ArgumentException(""); - - PixelFormat pf = dst.PixelFormat; - - // 1プレーン用の場合、グレースケールのパレット情報を生成する - if (pf == PixelFormat.Format8bppIndexed) + var plt = dst.Palette; + for (var x = 0; x < 256; x++) { - ColorPalette plt = dst.Palette; - for (int x = 0; x < 256; x++) - { - plt.Entries[x] = Color.FromArgb(x, x, x); - } - dst.Palette = plt; + plt.Entries[x] = Color.FromArgb(x, x, x); } + dst.Palette = plt; + } - int w = src.Width; - int h = src.Height; - Rectangle rect = new Rectangle(0, 0, w, h); - BitmapData bd = null; + var w = src.Width; + var h = src.Height; + var rect = new Rectangle(0, 0, w, h); + BitmapData? bd = null; - bool submat = src.IsSubmatrix(); - bool continuous = src.IsContinuous(); + var submat = src.IsSubmatrix(); + var continuous = src.IsContinuous(); - try - { - bd = dst.LockBits(rect, ImageLockMode.WriteOnly, pf); + try + { + bd = dst.LockBits(rect, ImageLockMode.WriteOnly, pf); - IntPtr srcData = src.Data; - byte* pSrc = (byte*)(srcData.ToPointer()); - byte* pDst = (byte*)(bd.Scan0.ToPointer()); - int ch = src.Channels(); - int sstep = (int)src.Step(); - int dstep = ((src.Width * ch) + 3) / 4 * 4; // 4の倍数に揃える - int stride = bd.Stride; + var srcData = src.Data; + var pSrc = (byte*)(srcData.ToPointer()); + var pDst = (byte*)(bd.Scan0.ToPointer()); + var ch = src.Channels(); + var srcStep = (int)src.Step(); + var dstStep = ((src.Width * ch) + 3) / 4 * 4; // 4の倍数に揃える + var stride = bd.Stride; - switch (pf) + switch (pf) + { + case PixelFormat.Format1bppIndexed: { - case PixelFormat.Format1bppIndexed: + if (submat) + throw new NotImplementedException("submatrix not supported"); + + // BitmapDataは4byte幅だが、IplImageは1byte幅 + // 手作業で移し替える + //int offset = stride - (w / 8); + int x = 0; + byte b = 0; + for (var y = 0; y < h; y++) + { + for (var bytePos = 0; bytePos < stride; bytePos++) { - if (submat) - throw new NotImplementedException("submatrix not supported"); - - // BitmapDataは4byte幅だが、IplImageは1byte幅 - // 手作業で移し替える - //int offset = stride - (w / 8); - int x = 0; - int y; - int bytePos; - byte mask; - byte b = 0; - int i; - for (y = 0; y < h; y++) + if (x < w) { - for (bytePos = 0; bytePos < stride; bytePos++) + for (int i = 0; i < 8; i++) { - if (x < w) - { - for (i = 0; i < 8; i++) - { - mask = (byte)(0x80 >> i); - if (x < w && pSrc[sstep * y + x] == 0) - b &= (byte)(mask ^ 0xff); - else - b |= mask; - - x++; - } - pDst[bytePos] = b; - } + var mask = (byte)(0x80 >> i); + if (x < w && pSrc[srcStep * y + x] == 0) + b &= (byte)(mask ^ 0xff); + else + b |= mask; + + x++; } - x = 0; - pDst += stride; + pDst[bytePos] = b; } - break; } + x = 0; + pDst += stride; + } + break; + } - case PixelFormat.Format8bppIndexed: - case PixelFormat.Format24bppRgb: - case PixelFormat.Format32bppArgb: - if (sstep == dstep && !submat && continuous) - { - uint imageSize = (uint)(src.DataEnd.ToInt64() - src.Data.ToInt64()); - MemoryHelper.CopyMemory(pDst, pSrc, imageSize); - } - else + case PixelFormat.Format8bppIndexed: + case PixelFormat.Format24bppRgb: + case PixelFormat.Format32bppArgb: + if (srcStep == dstStep && !submat && continuous) + { + long bytesToCopy = src.DataEnd.ToInt64() - src.Data.ToInt64(); + Buffer.MemoryCopy(pSrc, pDst, bytesToCopy, bytesToCopy); + } + else + { + for (int y = 0; y < h; y++) { - for (int y = 0; y < h; y++) - { - long offsetSrc = (y * sstep); - long offsetDst = (y * dstep); - // 一列ごとにコピー - MemoryHelper.CopyMemory(pDst + offsetDst, pSrc + offsetSrc, w * ch); - } + long offsetSrc = (y * srcStep); + long offsetDst = (y * dstStep); + long bytesToCopy = w * ch; + // 一列ごとにコピー + Buffer.MemoryCopy(pSrc + offsetSrc, pDst + offsetDst, bytesToCopy, bytesToCopy); } - break; + } + break; - default: - throw new NotImplementedException(); - } + default: + throw new NotImplementedException(); } - finally - { + } + finally + { + if (bd is not null) dst.UnlockBits(bd); - } } - #endregion } + #endregion } diff --git a/src/OpenCvSharp.Extensions/BitmapSourceConverter.cs b/src/OpenCvSharp.Extensions/BitmapSourceConverter.cs deleted file mode 100644 index d55a5a48f..000000000 --- a/src/OpenCvSharp.Extensions/BitmapSourceConverter.cs +++ /dev/null @@ -1,325 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Linq; -using System.Windows; -using System.Windows.Media.Imaging; -using System.Windows.Threading; -using PixelFormat = System.Windows.Media.PixelFormat; - -namespace OpenCvSharp.Extensions -{ -#if LANG_JP - /// - /// System.Windows.Media.Imaging.WriteableBitmapとOpenCVのIplImageとの間の相互変換メソッドを提供するクラス - /// -#else - /// - /// Static class which provides conversion between System.Windows.Media.Imaging.BitmapSource and IplImage - /// -#endif - public static class BitmapSourceConverter - { -#if LANG_JP - /// - /// MatをBitmapSourceに変換する. - /// - /// 変換するIplImage - /// WPFのBitmapSource -#else - /// - /// Converts Mat to BitmapSource. - /// - /// Input IplImage - /// BitmapSource -#endif - public static BitmapSource ToBitmapSource( - this Mat src) - { - return src.ToWriteableBitmap(); - } - -#if LANG_JP - /// - /// MatをBitmapSourceに変換する. - /// - /// 変換するIplImage - /// - /// - /// - /// - /// WPFのBitmapSource -#else - /// - /// Converts Mat to BitmapSource. - /// - /// Input IplImage - /// - /// - /// - /// - /// BitmapSource -#endif - public static BitmapSource ToBitmapSource( - this Mat src, - int horizontalResolution, - int verticalResolution, - PixelFormat pixelFormat, - BitmapPalette palette) - { - return src.ToWriteableBitmap(horizontalResolution, verticalResolution, pixelFormat, palette); - } - -#if LANG_JP - /// - /// System.Drawing.BitmapをBitmapSourceに変換する. - /// - /// 変換するBitmap - /// WPFのBitmapSource -#else - /// - /// Converts System.Drawing.Bitmap to BitmapSource. - /// - /// Input System.Drawing.Bitmap - /// http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource - /// BitmapSource -#endif - public static BitmapSource ToBitmapSource(this Bitmap src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - - if (Application.Current?.Dispatcher == null) - { - using (var memoryStream = new MemoryStream()) - { - src.Save(memoryStream, ImageFormat.Png); - return CreateBitmapSourceFromBitmap(memoryStream); - } - } - - try - { - using (var memoryStream = new MemoryStream()) - { - // You need to specify the image format to fill the stream. - // I'm assuming it is PNG - src.Save(memoryStream, ImageFormat.Png); - memoryStream.Seek(0, SeekOrigin.Begin); - - // Make sure to create the bitmap in the UI thread - if (IsInvokeRequired()) - return (BitmapSource)Application.Current.Dispatcher.Invoke( - new Func(CreateBitmapSourceFromBitmap), - DispatcherPriority.Normal, - memoryStream); - - return CreateBitmapSourceFromBitmap(memoryStream); - } - } - catch (Exception) - { - return null; - } - } - - // http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource - private static bool IsInvokeRequired() - { - return Dispatcher.CurrentDispatcher != Application.Current.Dispatcher; - } - - // http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource - private static BitmapSource CreateBitmapSourceFromBitmap(Stream stream) - { - var bitmapDecoder = BitmapDecoder.Create( - stream, - BitmapCreateOptions.PreservePixelFormat, - BitmapCacheOption.OnLoad); - - // This will disconnect the stream from the image completely... - var writable = new WriteableBitmap(bitmapDecoder.Frames.Single()); - writable.Freeze(); - - return writable; - } - - #region ToMat -#if LANG_JP - /// - /// BitmapSourceをMatに変換する - /// - /// 変換するBitmapSource - /// OpenCvSharpで扱えるMat -#else - /// - /// Converts BitmapSource to Mat - /// - /// Input BitmapSource - /// IplImage -#endif - public static Mat ToMat(this BitmapSource src) - { - if (src == null) - { - throw new ArgumentNullException(nameof(src)); - } - - int w = src.PixelWidth; - int h = src.PixelHeight; - MatType type = WriteableBitmapConverter.GetOptimumType(src.Format); - Mat dst = new Mat(h, w, type); - ToMat(src, dst); - return dst; - } -#if LANG_JP - /// - /// BitmapSourceをMatに変換する. - /// - /// 変換するBitmapSource - /// 出力先のMat -#else - /// - /// Converts BitmapSource to Mat - /// - /// Input BitmapSource - /// Output Mat -#endif - public static void ToMat(this BitmapSource src, Mat dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (src.PixelWidth != dst.Width || src.PixelHeight != dst.Height) - throw new ArgumentException("size of src must be equal to size of dst"); - if (dst.Dims() > 2) - throw new ArgumentException("Mat dimensions must be 2"); - - int w = src.PixelWidth; - int h = src.PixelHeight; - int bpp = src.Format.BitsPerPixel; - int channels = WriteableBitmapConverter.GetOptimumChannels(src.Format); - if (dst.Channels() != channels) - { - throw new ArgumentException("nChannels of dst is invalid", nameof(dst)); - } - - bool submat = dst.IsSubmatrix(); - bool continuous = dst.IsContinuous(); - - unsafe - { - byte* p = (byte*)(dst.Data); - long step = dst.Step(); - - // 1bppは手作業でコピー - if (bpp == 1) - { - if (submat) - throw new NotImplementedException("submatrix not supported"); - - // BitmapImageのデータを配列にコピー - // 要素1つに横8ピクセル分のデータが入っている。 - int stride = (w / 8) + 1; - byte[] pixels = new byte[h * stride]; - src.CopyPixels(pixels, stride, 0); - int x = 0; - for (int y = 0; y < h; y++) - { - int offset = y * stride; - // この行の各バイトを調べていく - for (int bytePos = 0; bytePos < stride; bytePos++) - { - if (x < w) - { - // 現在の位置のバイトからそれぞれのビット8つを取り出す - byte b = pixels[offset + bytePos]; - for (int i = 0; i < 8; i++) - { - if (x >= w) - { - break; - } - p[step * y + x] = ((b & 0x80) == 0x80) ? (byte)255 : (byte)0; - b <<= 1; - x++; - } - } - } - // 次の行へ - x = 0; - } - - } - // 8bpp - /*else if (bpp == 8) - { - int stride = w; - byte[] pixels = new byte[h * stride]; - src.CopyPixels(pixels, stride, 0); - for (int y = 0; y < h; y++) - { - for (int x = 0; x < w; x++) - { - p[step * y + x] = pixels[y * stride + x]; - } - } - }*/ - // 24bpp, 32bpp, ... - else - { - int stride = w * ((bpp + 7) / 8); - if (!submat && continuous) - { - long imageSize = dst.DataEnd.ToInt64() - dst.Data.ToInt64(); - if (imageSize < 0) - throw new OpenCvSharpException("The mat has invalid data pointer"); - if (imageSize > Int32.MaxValue) - throw new OpenCvSharpException("Too big mat data"); - src.CopyPixels(Int32Rect.Empty, dst.Data, (int)imageSize, stride); - } - else - { - // 高さ1pxの矩形ごと(≒1行ごと)にコピー - var roi = new Int32Rect { X = 0, Y = 0, Width = w, Height = 1 }; - IntPtr dstData = dst.Data; - for (int y = 0; y < h; y++) - { - roi.Y = y; - src.CopyPixels(roi, dstData, stride, stride); - dstData = new IntPtr(dstData.ToInt64() + stride); - } - } - } - - } - } - -#if LANG_JP - /// - /// System.Windows.Media.Imaging.BitmapSource から Mat へピクセルデータをコピーする - /// - /// - /// - /// -#else - /// - /// Copies pixel data from System.Windows.Media.Imaging.BitmapSource to IplImage instance - /// - /// - /// - /// -#endif - public static void CopyFrom(this Mat mat, BitmapSource wb) - { - if (wb == null) - throw new ArgumentNullException(nameof(wb)); - - ToMat(wb, mat); - } - - #endregion - } -} diff --git a/src/OpenCvSharp.Extensions/CvExtensions.cs b/src/OpenCvSharp.Extensions/CvExtensions.cs index 2d2f69f1d..7ad7faaf5 100644 --- a/src/OpenCvSharp.Extensions/CvExtensions.cs +++ b/src/OpenCvSharp.Extensions/CvExtensions.cs @@ -1,188 +1,213 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -//using System.Threading.Tasks; +#pragma warning disable CA5394 // Do not use insecure randomness -#pragma warning disable 1591 +namespace OpenCvSharp.Extensions; -namespace OpenCvSharp.Extensions +/// +/// +/// +public static class CvExtensions { -#if LANG_JP - /// - /// - /// -#else + #region HoughLinesProbabilisticEx + /// /// /// -#endif - public static class CvExtensions + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static LineSegmentPoint[] HoughLinesProbabilisticEx(this Mat img, double rho, double theta, int threshold, double minLineLength, double maxLineGap, + double thetaMin = 0, double thetaMax = Math.PI) { - #region HoughLinesProbabilisticEx -#if LANG_JP - /// - /// 検出する線分の角度を指定できる確率的ハフ変換 - /// - /// 入力画像 - /// 距離解像度(1ピクセル当たりの単位) - /// 角度解像度(ラジアン単位) - /// 閾値パラメータ.対応する投票数がthresholdより大きい場合のみ,抽出された線が返される. - /// 最小の線の長さ - /// 同一線上に存在する線分として扱う,二つの線分の最大の間隔. - /// 検出する線分の角度の範囲の最小値 [0 <= θ <= π] - /// 検出する線分の角度の範囲の最大値 [0 <= θ <= π] - /// -#else - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// -#endif - public static LineSegmentPoint[] HoughLinesProbabilisticEx(this Mat img, double rho, double theta, int threshold, double minLineLength, double maxLineGap, - double thetaMin = 0, double thetaMax = Math.PI) + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (img.Type() != MatType.CV_8UC1) + throw new ArgumentException("The source matrix must be 8-bit, single-channel image."); + if (rho <= 0) + throw new ArgumentOutOfRangeException(nameof(rho)); + if (theta <= 0) + throw new ArgumentOutOfRangeException(nameof(theta)); + if (threshold <= 0) + throw new ArgumentOutOfRangeException(nameof(threshold)); + if (minLineLength <= 0) + throw new ArgumentOutOfRangeException(nameof(minLineLength)); + if (thetaMax < thetaMin) + throw new ArgumentException("thetaMax < thetaMin"); + if (thetaMax > Math.PI) + throw new ArgumentOutOfRangeException(nameof(thetaMax), "thetaMax <= pi"); + if (thetaMin < 0) + throw new ArgumentOutOfRangeException(nameof(thetaMin), "thetaMin >= 0"); + + unsafe { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (img.Type() != MatType.CV_8UC1) - throw new ArgumentException("The source matrix must be 8-bit, single-channel image."); - if (rho <= 0) - throw new ArgumentOutOfRangeException(nameof(rho)); - if (theta <= 0) - throw new ArgumentOutOfRangeException(nameof(theta)); - if (threshold <= 0) - throw new ArgumentOutOfRangeException(nameof(threshold)); - if (minLineLength <= 0) - throw new ArgumentOutOfRangeException(nameof(minLineLength)); - if (thetaMax < thetaMin) - throw new ArgumentException(); - if (thetaMax > Math.PI) - throw new ArgumentOutOfRangeException(nameof(thetaMax), "thetaMax <= pi"); - if (thetaMin < 0) - throw new ArgumentOutOfRangeException(nameof(thetaMin), "thetaMin >= 0"); + // 画像パラメータの収集 + byte* data = (byte*)img.DataStart; + int width = img.Cols; + int height = img.Rows; + int step = (int)img.Step(); - unsafe - { - // 画像パラメータの収集 - byte* data = (byte*)img.DataStart; - int width = img.Cols; - int height = img.Rows; - int step = (int)img.Step(); + // sin, cosのLUTを作っておく + double numAngleAll = Math.PI / theta; + int angleMin = (int)Math.Round(numAngleAll * (thetaMin / Math.PI)); //(int)Math.Round(thetaMin * 180 / Cv.PI); + int angleMax = (int)Math.Round(numAngleAll * (thetaMax / Math.PI)); + int numAngle = angleMax - angleMin; + int numRho = (int)Math.Round(((width + height) * 2 + 1) / rho); + double[] sin = new double[angleMax]; // 大きめに作成。angleMinより手前の要素は使わない + double[] cos = new double[angleMax]; + { + double rad = thetaMin; + double irho = 1 / rho; + for (int t = angleMin; t < angleMax; t++, rad += theta) + { + sin[t] = Math.Sin(rad * irho); + cos[t] = Math.Cos(rad * irho); + } + } - // sin, cosのLUTを作っておく - double numAngleAll = Math.PI / theta; - int angleMin = (int)Math.Round(numAngleAll * (thetaMin / Math.PI)); //(int)Math.Round(thetaMin * 180 / Cv.PI); - int angleMax = (int)Math.Round(numAngleAll * (thetaMax / Math.PI)); - int numAngle = angleMax - angleMin; - int numRho = (int)Math.Round(((width + height) * 2 + 1) / rho); - double[] sin = new double[angleMax]; // 大きめに作成。angleMinより手前の要素は使わない - double[] cos = new double[angleMax]; + // 1. 非0の点を収集 + Point[] points = new Point[Cv2.CountNonZero(img)]; + bool[] mask = new bool[width * height]; + int i = 0; + for (int y = 0; y < height; y++) + { + byte* p = data + y * step; + int offset = y * width; + for (int x = 0; x < width; x++) { - double rad = thetaMin; - double irho = 1 / rho; - for (int t = angleMin; t < angleMax; t++, rad += theta) + if (p[x] != 0) { - sin[t] = Math.Sin(rad * irho); - cos[t] = Math.Cos(rad * irho); + mask[offset + x] = true; + points[i++] = new Point(x, y); + } + else + { + mask[offset + x] = false; } } + } + + // ランダムな順に並び変え + Shuffle(points); - // 1. 非0の点を収集 - Point[] points = new Point[Cv2.CountNonZero(img)]; - bool[] mask = new bool[width * height]; - int i = 0; - for (int y = 0; y < height; y++) + // 2. 画素をランダムに選択し処理 + var accum = new int[numAngle * numRho]; + var result = new List(); + for (int count = 0; count < points.Length; count++) + { + Point pt = points[count]; + + // 画素データが更新されているのは除外 + if (!mask[pt.Y * width + pt.X]) + continue; + + // 2.1 [θ,ρ]空間で投票し、投票値が最大値となるθを求める + int maxR = threshold - 1; + int maxT = 0; + fixed (int* paccum = accum) { - byte* p = data + y * step; - int offset = y * width; - for (int x = 0; x < width; x++) + int* adata = paccum; + for (int t = angleMin; t < angleMax; t++, adata += numRho) { - if (p[x] != 0) - { - mask[offset + x] = true; - points[i++] = new Point(x, y); - } - else + int r = (int)Math.Round(pt.X * cos[t] + pt.Y * sin[t]); + r += (numRho - 1) / 2; + int val = ++adata[r]; + if (maxR < val) { - mask[offset + x] = false; + maxR = val; + maxT = t; } } } - // ランダムな順に並び変え - Shuffle(points); + if (maxR < threshold) + continue; - // 2. 画素をランダムに選択し処理 - var accum = new int[numAngle * numRho]; - var result = new List(); - for (int count = 0; count < points.Length; count++) + // 2.2 追尾用の増分値 (dx0,dy0) の設定 + double a = -sin[maxT]; + double b = cos[maxT]; + int x0 = pt.X; + int y0 = pt.Y; + int dx0, dy0; + bool xflag; + const int shift = 16; + if (Math.Abs(a) > Math.Abs(b)) + { + xflag = true; + dx0 = a > 0 ? 1 : -1; + dy0 = (int)Math.Round(b * (1 << shift) / Math.Abs(a)); + y0 = (y0 << shift) + (1 << (shift - 1)); + } + else { - Point pt = points[count]; + xflag = false; + dy0 = b > 0 ? 1 : -1; + dx0 = (int)Math.Round(a * (1 << shift) / Math.Abs(b)); + x0 = (x0 << shift) + (1 << (shift - 1)); + } - // 画素データが更新されているのは除外 - if (!mask[pt.Y * width + pt.X]) - continue; + // 2.3 線分画素を両端方向に追尾し、線分を抽出 + Point[] lineEnd = { new Point(), new Point() }; + for (int k = 0; k < 2; k++) + { + int gap = 0; + int x = x0, y = y0, dx = dx0, dy = dy0; - // 2.1 [θ,ρ]空間で投票し、投票値が最大値となるθを求める - int maxR = threshold - 1; - int maxT = 0; - fixed (int* paccum = accum) + if (k > 0) { - int* adata = paccum; - for (int t = angleMin; t < angleMax; t++, adata += numRho) + dx = -dx; + dy = -dy; + } + + // walk along the line using fixed-point arithmetics, + // stop at the image border or in case of too big gap + for (; ; x += dx, y += dy) + { + int x1, y1; + + if (xflag) { - int r = (int)Math.Round(pt.X * cos[t] + pt.Y * sin[t]); - r += (numRho - 1) / 2; - int val = ++adata[r]; - if (maxR < val) - { - maxR = val; - maxT = t; - } + x1 = x; + y1 = y >> shift; + } + else + { + x1 = x >> shift; + y1 = y; } - } - if (maxR < threshold) - continue; + if (x1 < 0 || x1 >= width || y1 < 0 || y1 >= height) + break; - // 2.2 追尾用の増分値 (dx0,dy0) の設定 - double a = -sin[maxT]; - double b = cos[maxT]; - int x0 = pt.X; - int y0 = pt.Y; - int dx0, dy0; - bool xflag; - const int shift = 16; - if (Math.Abs(a) > Math.Abs(b)) - { - xflag = true; - dx0 = a > 0 ? 1 : -1; - dy0 = (int)Math.Round(b * (1 << shift) / Math.Abs(a)); - y0 = (y0 << shift) + (1 << (shift - 1)); - } - else - { - xflag = false; - dy0 = b > 0 ? 1 : -1; - dx0 = (int)Math.Round(a * (1 << shift) / Math.Abs(b)); - x0 = (x0 << shift) + (1 << (shift - 1)); + // for each non-zero point: + // update line end, + // clear the mask element + // reset the gap + if (mask[y1 * width + x1]) + { + gap = 0; + lineEnd[k].X = x1; + lineEnd[k].Y = y1; + } + else if (++gap > maxLineGap) + break; } + } + + // lineLengthより長いものを線分候補とする + bool goodLine = Math.Abs(lineEnd[1].X - lineEnd[0].X) >= minLineLength || + Math.Abs(lineEnd[1].Y - lineEnd[0].Y) >= minLineLength; - // 2.3 線分画素を両端方向に追尾し、線分を抽出 - Point[] lineEnd = { new Point(), new Point() }; + // 2.4 追尾した画素を削除し、次回以降は処理されないようにする + //if (processOnce) + { for (int k = 0; k < 2; k++) { - int gap = 0; int x = x0, y = y0, dx = dx0, dy = dy0; if (k > 0) @@ -208,111 +233,58 @@ public static LineSegmentPoint[] HoughLinesProbabilisticEx(this Mat img, double y1 = y; } - if (x1 < 0 || x1 >= width || y1 < 0 || y1 >= height) - break; - // for each non-zero point: // update line end, // clear the mask element // reset the gap if (mask[y1 * width + x1]) { - gap = 0; - lineEnd[k].X = x1; - lineEnd[k].Y = y1; - } - else if (++gap > maxLineGap) - break; - } - } - - // lineLengthより長いものを線分候補とする - bool goodLine = Math.Abs(lineEnd[1].X - lineEnd[0].X) >= minLineLength || - Math.Abs(lineEnd[1].Y - lineEnd[0].Y) >= minLineLength; - - // 2.4 追尾した画素を削除し、次回以降は処理されないようにする - //if (processOnce) - { - for (int k = 0; k < 2; k++) - { - int x = x0, y = y0, dx = dx0, dy = dy0; - - if (k > 0) - { - dx = -dx; - dy = -dy; - } - - // walk along the line using fixed-point arithmetics, - // stop at the image border or in case of too big gap - for (; ; x += dx, y += dy) - { - int x1, y1; - - if (xflag) - { - x1 = x; - y1 = y >> shift; - } - else + if (goodLine) { - x1 = x >> shift; - y1 = y; - } - - // for each non-zero point: - // update line end, - // clear the mask element - // reset the gap - if (mask[y1 * width + x1]) - { - if (goodLine) + fixed (int* paccum = accum) { - fixed (int* paccum = accum) + int* adata = paccum; + for (int t = angleMin; t < angleMax; t++, adata += numRho) { - int* adata = paccum; - for (int t = angleMin; t < angleMax; t++, adata += numRho) - { - int r = (int)Math.Round(x1 * cos[t] + y1 * sin[t]); - r += (numRho - 1) / 2; - adata[r]--; - } + int r = (int)Math.Round(x1 * cos[t] + y1 * sin[t]); + r += (numRho - 1) / 2; + adata[r]--; } } - mask[y1 * width + x1] = false; } - - if (y1 == lineEnd[k].Y && x1 == lineEnd[k].X) - break; + mask[y1 * width + x1] = false; } - } - } - if (goodLine) - { - result.Add(new LineSegmentPoint(lineEnd[0], lineEnd[1])); + if (y1 == lineEnd[k].Y && x1 == lineEnd[k].X) + break; + } } } - return result.ToArray(); + if (goodLine) + { + result.Add(new LineSegmentPoint(lineEnd[0], lineEnd[1])); + } } - } - private static void Shuffle(IList list) - { - var rand = new Random(); - for (int i = list.Count; i > 1; i--) - { - int j = rand.Next(i); - Swap(list, j, i - 1); - } + return result.ToArray(); } - private static void Swap(IList list, int i1, int i2) + } + + private static void Shuffle(IList list) + { + var rand = new Random(); + for (int i = list.Count; i > 1; i--) { - T temp = list[i1]; - list[i1] = list[i2]; - list[i2] = temp; + int j = rand.Next(i); + Swap(list, j, i - 1); } - #endregion } + private static void Swap(IList list, int i1, int i2) + { + T temp = list[i1]; + list[i1] = list[i2]; + list[i2] = temp; + } + #endregion } diff --git a/src/OpenCvSharp.Extensions/MyParallel.cs b/src/OpenCvSharp.Extensions/MyParallel.cs deleted file mode 100644 index 235d22930..000000000 --- a/src/OpenCvSharp.Extensions/MyParallel.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; - -namespace OpenCvSharp.Extensions -{ - /// - /// Task Parallel Library for .NET 2.0 - /// - internal static class MyParallel - { - /// - /// Number of Threads - /// - private static readonly int NumThread = Environment.ProcessorCount; - - /// - /// Executes a for loop in which iterations may run in parallel. - /// - /// The start index, inclusive. - /// The end index, exclusive. - /// The delegate that is invoked once per iteration. - public static void For(int fromInclusive, int toExclusive, Action body) - { - Thread[] threads = new Thread[NumThread]; - for (int i = 0; i < NumThread; i++) - { - threads[i] = new Thread(delegate(object arg) - { - ForRange range = (ForRange)arg; - for (int j = range.Start; j < range.End; j++) - { - body(j); - } - }); - } - for (int i = 0; i < NumThread; i++) - threads[i].Start(new ForRange(fromInclusive, toExclusive, i)); - for (int i = 0; i < NumThread; i++) - threads[i].Join(); - } - - private struct ForRange - { - public int Start; - public int End; - - public ForRange(int fromInclusive, int toExclusive, int threadID) - { - Start = DividingPoint(fromInclusive, toExclusive, threadID); - End = DividingPoint(fromInclusive, toExclusive, threadID + 1); - } - - private static int DividingPoint(int fromInclusive, int toExclusive, int threadID) - { - return fromInclusive + (toExclusive - fromInclusive) * threadID / NumThread; - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj b/src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj new file mode 100644 index 000000000..caea99cd8 --- /dev/null +++ b/src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj @@ -0,0 +1,59 @@ + + + + net48;netstandard2.0;netstandard2.1;net6.0; + true + true + OpenCvSharp.Extensions + Key.snk + true + true + OpenCvSharp.Extensions + false + false + false + 12 + enable + enable + true + true + https://github.com/shimat/opencvsharp.git + git + snupkg + + + AllEnabledByDefault + + + + + + + + + $(DefineConstants);DOTNET_FRAMEWORK; + + + + $(DefineConstants);WINDOWS; + + + + + + + + + 8.0.11 + + + + + + + + + CA1303; + + + diff --git a/src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.xproj b/src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.xproj deleted file mode 100644 index f46705a9f..000000000 --- a/src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - b4b78bb2-1b7c-4cf2-bc72-43789eedce00 - OpenCvSharp.Extensions - .\obj - .\bin\ - v4.5 - - - 2.0 - - - \ No newline at end of file diff --git a/src/OpenCvSharp.Extensions/Platform.cs b/src/OpenCvSharp.Extensions/Platform.cs index 03d3228c0..d72d636fe 100644 --- a/src/OpenCvSharp.Extensions/Platform.cs +++ b/src/OpenCvSharp.Extensions/Platform.cs @@ -1,49 +1,47 @@ -using System; -using System.Collections.Generic; -using System.Text; +#pragma warning disable 1591 -#pragma warning disable 1591 +namespace OpenCvSharp.Extensions; -namespace OpenCvSharp.Extensions +/// +/// +/// +internal enum OS { - /// - /// - /// - internal enum OS - { - Windows, - Unix - } + Windows, + Unix +} +/// +/// +/// +internal enum Runtime +{ + DotNet, + Mono +} + +/// +/// Provides information for the platform which the user is using +/// +internal static class Platform +{ /// - /// + /// OS type /// - internal enum Runtime - { - DotNet, - Mono - } + public static readonly OS OS; /// - /// Provides information for the platform which the user is using + /// Runtime type /// - internal static class Platform - { - /// - /// OS type - /// - public static readonly OS OS; - /// - /// Runtime type - /// - public static readonly Runtime Runtime; + public static readonly Runtime Runtime; - static Platform() - { - int p = (int)Environment.OSVersion.Platform; - OS = ((p == 4) || (p == 6) || (p == 128)) ? OS.Unix : OS.Windows; +#pragma warning disable CA1810 + static Platform() +#pragma warning restore CA1810 + { + int p = (int)Environment.OSVersion.Platform; + OS = ((p == 4) || (p == 6) || (p == 128)) ? OS.Unix : OS.Windows; - Runtime = (Type.GetType("Mono.Runtime") == null) ? Runtime.Mono : Runtime.DotNet; - } + Runtime = (Type.GetType("Mono.Runtime") is null) ? Runtime.Mono : Runtime.DotNet; } } diff --git a/src/OpenCvSharp.Extensions/Properties/AssemblyInfo.cs b/src/OpenCvSharp.Extensions/Properties/AssemblyInfo.cs index f612bd51f..26696a5f0 100644 --- a/src/OpenCvSharp.Extensions/Properties/AssemblyInfo.cs +++ b/src/OpenCvSharp.Extensions/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OpenCvSharp.Extensions/WriteableBitmapConverter.cs b/src/OpenCvSharp.Extensions/WriteableBitmapConverter.cs deleted file mode 100644 index 1278506e8..000000000 --- a/src/OpenCvSharp.Extensions/WriteableBitmapConverter.cs +++ /dev/null @@ -1,371 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using OpenCvSharp.Util; - -namespace OpenCvSharp.Extensions -{ - /// - /// Static class which provides conversion between System.Windows.Media.Imaging.WriteableBitmap and Mat - /// - public static class WriteableBitmapConverter - { - private static readonly Dictionary optimumChannels; - private static readonly Dictionary optimumTypes; - - static WriteableBitmapConverter() - { - optimumChannels = new Dictionary(); - optimumChannels[PixelFormats.Indexed1] = - optimumChannels[PixelFormats.Indexed8] = - optimumChannels[PixelFormats.Gray2] = - optimumChannels[PixelFormats.Gray4] = - optimumChannels[PixelFormats.Gray8] = - optimumChannels[PixelFormats.Gray16] = - optimumChannels[PixelFormats.Gray32Float] = - optimumChannels[PixelFormats.Indexed1] = - optimumChannels[PixelFormats.Indexed2] = - optimumChannels[PixelFormats.Indexed4] = - optimumChannels[PixelFormats.Indexed8] = - optimumChannels[PixelFormats.BlackWhite] = 1; - optimumChannels[PixelFormats.Bgr24] = - optimumChannels[PixelFormats.Bgr555] = - optimumChannels[PixelFormats.Bgr565] = - optimumChannels[PixelFormats.Rgb24] = - optimumChannels[PixelFormats.Rgb48] = - optimumChannels[PixelFormats.Rgb128Float] = 3; - optimumChannels[PixelFormats.Bgr32] = - optimumChannels[PixelFormats.Bgra32] = - optimumChannels[PixelFormats.Cmyk32] = - optimumChannels[PixelFormats.Pbgra32] = - optimumChannels[PixelFormats.Prgba64] = - optimumChannels[PixelFormats.Prgba128Float] = - optimumChannels[PixelFormats.Rgba64] = - optimumChannels[PixelFormats.Rgba128Float] = 4; - - optimumTypes = new Dictionary(); - optimumTypes[PixelFormats.Indexed1] = - optimumTypes[PixelFormats.Indexed8] = - optimumTypes[PixelFormats.Gray2] = - optimumTypes[PixelFormats.Gray4] = - optimumTypes[PixelFormats.Gray8] = - optimumTypes[PixelFormats.Indexed1] = - optimumTypes[PixelFormats.Indexed2] = - optimumTypes[PixelFormats.Indexed4] = - optimumTypes[PixelFormats.Indexed8] = - optimumTypes[PixelFormats.BlackWhite] = MatType.CV_8UC1; - optimumTypes[PixelFormats.Gray16] = MatType.CV_16UC1; - optimumTypes[PixelFormats.Rgb48] = MatType.CV_16UC3; - optimumTypes[PixelFormats.Rgba64] = MatType.CV_16UC4; - optimumTypes[PixelFormats.Pbgra32] = - optimumTypes[PixelFormats.Prgba64] = MatType.CV_32SC4; - optimumTypes[PixelFormats.Gray32Float] = MatType.CV_32FC1; - optimumTypes[PixelFormats.Rgb128Float] = MatType.CV_32FC3; - optimumTypes[PixelFormats.Prgba128Float] = - optimumTypes[PixelFormats.Rgba128Float] = MatType.CV_32FC4; - optimumTypes[PixelFormats.Bgr24] = - optimumTypes[PixelFormats.Rgb24] = - optimumTypes[PixelFormats.Bgr555] = - optimumTypes[PixelFormats.Bgr565] = MatType.CV_8UC3; - optimumTypes[PixelFormats.Bgr32] = - optimumTypes[PixelFormats.Bgra32] = - optimumTypes[PixelFormats.Cmyk32] = MatType.CV_8UC4; - } - - /// - /// 指定したPixelFormatに適合するMatのチャンネル数を返す - /// - /// - /// - internal static int GetOptimumChannels(PixelFormat f) - { - try - { - return optimumChannels[f]; - } - catch (KeyNotFoundException) - { - throw new ArgumentException("Not supported PixelFormat"); - } - } - - /// - /// 指定したPixelFormatに適合するMatTypeを返す - /// - /// - /// - internal static MatType GetOptimumType(PixelFormat f) - { - try - { - return optimumTypes[f]; - } - catch (KeyNotFoundException) - { - throw new ArgumentException("Not supported PixelFormat"); - } - } - - /// - /// 指定したMatのビット深度・チャンネル数に適合するPixelFormatを返す - /// - /// - /// - private static PixelFormat GetOptimumPixelFormats(MatType type) - { - if (type == MatType.CV_8UC1 || type == MatType.CV_8SC1) - return PixelFormats.Gray8; - if (type == MatType.CV_8UC3 || type == MatType.CV_8SC3) - return PixelFormats.Bgr24; - if (type == MatType.CV_8UC4 || type == MatType.CV_8SC4) - return PixelFormats.Bgra32; - - if (type == MatType.CV_16UC1 || type == MatType.CV_16SC1) - return PixelFormats.Gray16; - if (type == MatType.CV_16UC3 || type == MatType.CV_16SC3) - return PixelFormats.Rgb48; - if (type == MatType.CV_16UC4 || type == MatType.CV_16SC4) - return PixelFormats.Rgba64; - - if (type == MatType.CV_32SC4) - return PixelFormats.Prgba64; - - if (type == MatType.CV_32FC1) - return PixelFormats.Gray32Float; - if (type == MatType.CV_32FC3) - return PixelFormats.Rgb128Float; - if (type == MatType.CV_32FC4) - return PixelFormats.Rgba128Float; - - throw new ArgumentOutOfRangeException(nameof(type), "Not supported MatType"); - } - - /// - /// BGR -> RGB - /// - /// - /// - private static Mat SwapChannelsIfNeeded(Mat src) - { - var type = src.Type(); - if (type == MatType.CV_16UC3 || type == MatType.CV_16SC3) // PixelFormats.Rgb48 - { - var dst = new Mat(); - Cv2.CvtColor(src, dst, ColorConversionCodes.BGR2RGB); - return dst; - } - if (type == MatType.CV_16UC4 || type == MatType.CV_16SC4) // PixelFormats.Rgba64 - { - var dst = new Mat(); - Cv2.CvtColor(src, dst, ColorConversionCodes.BGRA2RGBA); - return dst; - } - return src; - } - - #region ToWriteableBitmap - -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する. 引数はWriteableBitmapのコンストラクタに相当する. - /// - /// 変換するMat - /// ビットマップの水平ドット/インチ (dpi) - /// ビットマップの垂直ドット/インチ (dpi) - /// ビットマップの PixelFormat - /// ビットマップの BitmapPalette - /// WPFのWriteableBitmap -#else - /// - /// Converts Mat to WriteableBitmap. - /// The arguments of this method corresponds the consructor of WriteableBitmap. - /// - /// Input Mat - /// Horizontal dots per inch - /// Vertical dots per inch - /// Pixel format of output WriteableBitmap - /// Bitmap pallette - /// WriteableBitmap -#endif - public static WriteableBitmap ToWriteableBitmap(this Mat src, double dpiX, double dpiY, PixelFormat pf, - BitmapPalette bp) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - - var wb = new WriteableBitmap(src.Width, src.Height, dpiX, dpiY, pf, bp); - ToWriteableBitmap(src, wb); - return wb; - } - -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する (dpi=96, BitmapPalette=null) - /// - /// 変換するMat - /// ビットマップの PixelFormat - /// WPFのWriteableBitmap -#else - /// - /// Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) - /// - /// Input Mat - /// Pixel format of output WriteableBitmap - /// WriteableBitmap -#endif - public static WriteableBitmap ToWriteableBitmap(this Mat src, PixelFormat pf) - { - return ToWriteableBitmap(src, 96, 96, pf, null); - } - -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する (dpi=96, BitmapPalette=null) - /// - /// 変換するMat - /// WPFのWriteableBitmap -#else - /// - /// Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) - /// - /// Input Mat - /// WriteableBitmap -#endif - public static WriteableBitmap ToWriteableBitmap(this Mat src) - { - PixelFormat pf = GetOptimumPixelFormats(src.Type()); - Mat swappedMat = SwapChannelsIfNeeded(src); - try - { - return ToWriteableBitmap(swappedMat, 96, 96, pf, null); - } - finally - { - if (src != swappedMat) - swappedMat.Dispose(); - } - } - -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する. - /// 返却値を新たに生成せず引数で指定したWriteableBitmapに格納するので、メモリ効率が良い。 - /// - /// 変換するMat - /// 変換結果を設定するWriteableBitmap -#else - /// - /// Converts Mat to WriteableBitmap. - /// This method is more efficient because new instance of WriteableBitmap is not allocated. - /// - /// Input Mat - /// Output WriteableBitmap -#endif - public static void ToWriteableBitmap(Mat src, WriteableBitmap dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (src.Width != dst.PixelWidth || src.Height != dst.PixelHeight) - throw new ArgumentException("size of src must be equal to size of dst"); - //if (src.Depth != BitDepth.U8) - //throw new ArgumentException("bit depth of src must be BitDepth.U8", "src"); - if (src.Dims() > 2) - throw new ArgumentException("Mat dimensions must be 2"); - - int w = src.Width; - int h = src.Height; - int bpp = dst.Format.BitsPerPixel; - - int channels = GetOptimumChannels(dst.Format); - if (src.Channels() != channels) - { - throw new ArgumentException("channels of dst != channels of PixelFormat", nameof(dst)); - } - - bool submat = src.IsSubmatrix(); - bool continuous = src.IsContinuous(); - unsafe - { - byte* pSrc = (byte*)(src.Data); - int sstep = (int)src.Step(); - - if (bpp == 1) - { - if (submat) - throw new NotImplementedException("submatrix not supported"); - - // 手作業で移し替える - int stride = w / 8 + 1; - if (stride < 2) - stride = 2; - - byte[] pixels = new byte[h * stride]; - - for (int x = 0, y = 0; y < h; y++) - { - int offset = y * stride; - for (int bytePos = 0; bytePos < stride; bytePos++) - { - if (x < w) - { - byte b = 0; - // 現在の位置から横8ピクセル分、ビットがそれぞれ立っているか調べ、1つのbyteにまとめる - for (int i = 0; i < 8; i++) - { - b <<= 1; - if (x < w && pSrc[sstep * y + x] != 0) - { - b |= 1; - } - x++; - } - pixels[offset + bytePos] = b; - } - } - x = 0; - } - dst.WritePixels(new Int32Rect(0, 0, w, h), pixels, stride, 0); - return; - } - - // 一気にコピー - if (!submat && continuous) - { - long imageSize = src.DataEnd.ToInt64() - src.Data.ToInt64(); - if (imageSize < 0) - throw new OpenCvSharpException("The mat has invalid data pointer"); - if (imageSize > Int32.MaxValue) - throw new OpenCvSharpException("Too big mat data"); - dst.WritePixels(new Int32Rect(0, 0, w, h), src.Data, (int)imageSize, sstep); - return; - } - - // 一列ごとにコピー - try - { - dst.Lock(); - - int dstep = dst.BackBufferStride; - byte* pDst = (byte*)dst.BackBuffer; - - for (int y = 0; y < h; y++) - { - long offsetSrc = (y * sstep); - long offsetDst = (y * dstep); - MemoryHelper.CopyMemory(pDst + offsetDst, pSrc + offsetSrc, w * channels); - } - } - finally - { - dst.Unlock(); - } - } - } - - #endregion - } -} diff --git a/src/OpenCvSharp.Extensions/project.json b/src/OpenCvSharp.Extensions/project.json deleted file mode 100644 index 949639317..000000000 --- a/src/OpenCvSharp.Extensions/project.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*" - }, - - "frameworks": { - "net40": { - "dependencies": { - }, - "frameworkAssemblies": { - "PresentationCore": "4.0.0.0", - "PresentationFramework": "4.0.0.0", - "System.Drawing": "4.0.0.0", - "System.Windows.Forms": "4.0.0.0", - "System.Xaml": "4.0.0.0", - "WindowsBase": "4.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net40" ] - } - }, - "net46": { - "dependencies": { - }, - "frameworkAssemblies": { - "PresentationCore": "4.0.0.0", - "PresentationFramework": "4.0.0.0", - "System.Drawing": "4.0.0.0", - "System.Windows.Forms": "4.0.0.0", - "System.Xaml": "4.0.0.0", - "System.Runtime": "4.0.20.0", - "WindowsBase": "4.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net46" ] - } - } - }, - "buildOptions": { - "xmlDoc": true, - "optimize": true, - "keyFile": "Key.snk", - "allowUnsafe": true - } -} diff --git a/src/OpenCvSharp.Extensions/project.lock.json b/src/OpenCvSharp.Extensions/project.lock.json deleted file mode 100644 index bfa29ee2e..000000000 --- a/src/OpenCvSharp.Extensions/project.lock.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETFramework,Version=v4.0": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net40/OpenCvSharp.dll": {} - }, - "runtime": { - "net40/OpenCvSharp.dll": {} - } - } - }, - ".NETFramework,Version=v4.6": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net46/OpenCvSharp.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.dll": {} - } - } - } - }, - "libraries": { - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../OpenCvSharp/project.json", - "msbuildProject": "../OpenCvSharp/OpenCvSharp.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "OpenCvSharp >= 1.0.0-*" - ], - ".NETFramework,Version=v4.0": [ - "PresentationCore >= 4.0.0", - "PresentationFramework >= 4.0.0", - "System.Drawing >= 4.0.0", - "System.Windows.Forms >= 4.0.0", - "System.Xaml >= 4.0.0", - "WindowsBase >= 4.0.0" - ], - ".NETFramework,Version=v4.6": [ - "PresentationCore >= 4.0.0", - "PresentationFramework >= 4.0.0", - "System.Drawing >= 4.0.0", - "System.Runtime >= 4.0.20", - "System.Windows.Forms >= 4.0.0", - "System.Xaml >= 4.0.0", - "WindowsBase >= 4.0.0" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharp.ReleaseMaker/Ionic.Zip.dll b/src/OpenCvSharp.ReleaseMaker/Ionic.Zip.dll deleted file mode 100644 index 7b11577fa..000000000 Binary files a/src/OpenCvSharp.ReleaseMaker/Ionic.Zip.dll and /dev/null differ diff --git a/src/OpenCvSharp.ReleaseMaker/MainForm.Designer.cs b/src/OpenCvSharp.ReleaseMaker/MainForm.Designer.cs deleted file mode 100644 index 6c3abf74a..000000000 --- a/src/OpenCvSharp.ReleaseMaker/MainForm.Designer.cs +++ /dev/null @@ -1,203 +0,0 @@ -namespace OpenCvSharp.ReleaseMaker -{ - partial class MainForm - { - /// - /// 必要なデザイナ変数です。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 使用中のリソースをすべてクリーンアップします。 - /// - /// マネージ リソースが破棄される場合 true、破棄されない場合は false です。 - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows フォーム デザイナで生成されたコード - - /// - /// デザイナ サポートに必要なメソッドです。このメソッドの内容を - /// コード エディタで変更しないでください。 - /// - private void InitializeComponent() - { - this.textBox_Src = new System.Windows.Forms.TextBox(); - this.label_Src = new System.Windows.Forms.Label(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.toolStripMenuItem_File = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem_Exit = new System.Windows.Forms.ToolStripMenuItem(); - this.button_Src = new System.Windows.Forms.Button(); - this.button_Dst = new System.Windows.Forms.Button(); - this.label_Dst = new System.Windows.Forms.Label(); - this.textBox_Dst = new System.Windows.Forms.TextBox(); - this.button_Make = new System.Windows.Forms.Button(); - this.folderBrowserDialog_Src = new System.Windows.Forms.FolderBrowserDialog(); - this.folderBrowserDialog_Dst = new System.Windows.Forms.FolderBrowserDialog(); - this.label_Version = new System.Windows.Forms.Label(); - this.textBox_Version = new System.Windows.Forms.TextBox(); - this.menuStrip.SuspendLayout(); - this.SuspendLayout(); - // - // textBox_Src - // - this.textBox_Src.Location = new System.Drawing.Point(64, 47); - this.textBox_Src.Name = "textBox_Src"; - this.textBox_Src.Size = new System.Drawing.Size(377, 19); - this.textBox_Src.TabIndex = 0; - // - // label_Src - // - this.label_Src.AutoSize = true; - this.label_Src.Location = new System.Drawing.Point(12, 50); - this.label_Src.Name = "label_Src"; - this.label_Src.Size = new System.Drawing.Size(24, 12); - this.label_Src.TabIndex = 1; - this.label_Src.Text = "Src:"; - // - // menuStrip - // - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem_File}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(494, 24); - this.menuStrip.TabIndex = 3; - this.menuStrip.Text = "menuStrip1"; - // - // toolStripMenuItem_File - // - this.toolStripMenuItem_File.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem_Exit}); - this.toolStripMenuItem_File.Name = "toolStripMenuItem_File"; - this.toolStripMenuItem_File.Size = new System.Drawing.Size(51, 20); - this.toolStripMenuItem_File.Text = "File(&F)"; - // - // toolStripMenuItem_Exit - // - this.toolStripMenuItem_Exit.Name = "toolStripMenuItem_Exit"; - this.toolStripMenuItem_Exit.Size = new System.Drawing.Size(108, 22); - this.toolStripMenuItem_Exit.Text = "Exit(&X)"; - this.toolStripMenuItem_Exit.Click += new System.EventHandler(this.toolStripMenuItem_Exit_Click); - // - // button_Src - // - this.button_Src.Location = new System.Drawing.Point(447, 43); - this.button_Src.Name = "button_Src"; - this.button_Src.Size = new System.Drawing.Size(35, 23); - this.button_Src.TabIndex = 4; - this.button_Src.Text = "..."; - this.button_Src.UseVisualStyleBackColor = true; - this.button_Src.Click += new System.EventHandler(this.button_Src_Click); - // - // button_Dst - // - this.button_Dst.Location = new System.Drawing.Point(447, 75); - this.button_Dst.Name = "button_Dst"; - this.button_Dst.Size = new System.Drawing.Size(35, 23); - this.button_Dst.TabIndex = 5; - this.button_Dst.Text = "..."; - this.button_Dst.UseVisualStyleBackColor = true; - this.button_Dst.Click += new System.EventHandler(this.button_Dst_Click); - // - // label_Dst - // - this.label_Dst.AutoSize = true; - this.label_Dst.Location = new System.Drawing.Point(11, 80); - this.label_Dst.Name = "label_Dst"; - this.label_Dst.Size = new System.Drawing.Size(25, 12); - this.label_Dst.TabIndex = 6; - this.label_Dst.Text = "Dst:"; - // - // textBox_Dst - // - this.textBox_Dst.Location = new System.Drawing.Point(64, 77); - this.textBox_Dst.Name = "textBox_Dst"; - this.textBox_Dst.Size = new System.Drawing.Size(377, 19); - this.textBox_Dst.TabIndex = 7; - // - // button_Make - // - this.button_Make.Location = new System.Drawing.Point(140, 145); - this.button_Make.Name = "button_Make"; - this.button_Make.Size = new System.Drawing.Size(232, 51); - this.button_Make.TabIndex = 8; - this.button_Make.Text = "Make"; - this.button_Make.UseVisualStyleBackColor = true; - this.button_Make.Click += new System.EventHandler(this.button_Make_Click); - // - // folderBrowserDialog_Src - // - this.folderBrowserDialog_Src.ShowNewFolderButton = false; - // - // label_Version - // - this.label_Version.AutoSize = true; - this.label_Version.Location = new System.Drawing.Point(12, 110); - this.label_Version.Name = "label_Version"; - this.label_Version.Size = new System.Drawing.Size(46, 12); - this.label_Version.TabIndex = 9; - this.label_Version.Text = "Version:"; - // - // textBox_Version - // - this.textBox_Version.Location = new System.Drawing.Point(64, 107); - this.textBox_Version.Name = "textBox_Version"; - this.textBox_Version.Size = new System.Drawing.Size(50, 19); - this.textBox_Version.TabIndex = 10; - this.textBox_Version.Text = "3.2.0"; - // - // MainForm - // - this.AcceptButton = this.button_Make; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(494, 213); - this.Controls.Add(this.textBox_Version); - this.Controls.Add(this.label_Version); - this.Controls.Add(this.button_Make); - this.Controls.Add(this.textBox_Dst); - this.Controls.Add(this.label_Dst); - this.Controls.Add(this.button_Dst); - this.Controls.Add(this.button_Src); - this.Controls.Add(this.menuStrip); - this.Controls.Add(this.label_Src); - this.Controls.Add(this.textBox_Src); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MainMenuStrip = this.menuStrip; - this.MaximizeBox = false; - this.Name = "MainForm"; - this.Text = "OpenCvSharp.ReleaseMaker"; - this.Load += new System.EventHandler(this.MainForm_Load); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox textBox_Src; - private System.Windows.Forms.Label label_Src; - private System.Windows.Forms.MenuStrip menuStrip; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_File; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_Exit; - private System.Windows.Forms.Button button_Src; - private System.Windows.Forms.Button button_Dst; - private System.Windows.Forms.Label label_Dst; - private System.Windows.Forms.TextBox textBox_Dst; - private System.Windows.Forms.Button button_Make; - private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog_Src; - private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog_Dst; - private System.Windows.Forms.Label label_Version; - private System.Windows.Forms.TextBox textBox_Version; - } -} - diff --git a/src/OpenCvSharp.ReleaseMaker/MainForm.cs b/src/OpenCvSharp.ReleaseMaker/MainForm.cs deleted file mode 100644 index b361e9933..000000000 --- a/src/OpenCvSharp.ReleaseMaker/MainForm.cs +++ /dev/null @@ -1,330 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using System.IO; -using System.Linq; -using Ionic.Zip; - -namespace OpenCvSharp.ReleaseMaker -{ - /// - /// - /// - public partial class MainForm : Form - { - private const string VisualStudioVersion = "2015"; - - private static readonly IReadOnlyDictionary dllFiles = new Dictionary - { - { - "net20", new[] - { - @"OpenCvSharp\bin\Release\net20\OpenCvSharp.dll", - @"OpenCvSharp\bin\Release\net20\OpenCvSharp.dll.config", - @"OpenCvSharp.Blob\bin\Release\net20\OpenCvSharp.Blob.dll", - } - },{ - "net40", new[] - { - @"OpenCvSharp\bin\Release\net40\OpenCvSharp.dll", - @"OpenCvSharp\bin\Release\net40\OpenCvSharp.dll.config", - @"OpenCvSharp.Blob\bin\Release\net40\OpenCvSharp.Blob.dll", - @"OpenCvSharp.Extensions\bin\Release\net40\OpenCvSharp.Extensions.dll", - @"OpenCvSharp.UserInterface\bin\Release\net40\OpenCvSharp.UserInterface.dll", - } - },{ - "net46", new[] - { - @"OpenCvSharp\bin\Release\net46\OpenCvSharp.dll", - @"OpenCvSharp\bin\Release\net46\OpenCvSharp.dll.config", - @"OpenCvSharp.Blob\bin\Release\net46\OpenCvSharp.Blob.dll", - @"OpenCvSharp.Extensions\bin\Release\net46\OpenCvSharp.Extensions.dll", - @"OpenCvSharp.UserInterface\bin\Release\net46\OpenCvSharp.UserInterface.dll", - } - },{ - "netstandard1.6", new[] - { - @"OpenCvSharp\bin\Release\netstandard1.6\OpenCvSharp.dll", - @"OpenCvSharp\bin\Release\netstandard1.6\OpenCvSharp.dll.config", - @"OpenCvSharp.Blob\bin\Release\netstandard1.6\OpenCvSharp.Blob.dll", - } - } - }; - - private static readonly string debuggerVisualizerPath = - @"OpenCvSharp.DebuggerVisualizers{0}\bin\Release\net20\OpenCvSharp.DebuggerVisualizers{0}.dll"; - - private static readonly string debuggerVisualizerPath2015 = - @"OpenCvSharp.DebuggerVisualizers{0}\bin\Release\OpenCvSharp.DebuggerVisualizers{0}.dll"; - - private static readonly string[] debuggerVisualizerVersions = - { - "2010", "2012", "2013", "2015", - }; - - private static readonly string[] xmlFiles = { - @"OpenCvSharp\bin\{0}\net46\OpenCvSharp.xml", - @"OpenCvSharp.Blob\bin\{0}\net46\OpenCvSharp.Blob.xml", - @"OpenCvSharp.Extensions\bin\{0}\net46\OpenCvSharp.Extensions.xml", - @"OpenCvSharp.UserInterface\bin\{0}\net46\OpenCvSharp.UserInterface.xml", - }; - - private static readonly string[] platforms = { - "x86", - "x64" - }; - private static readonly string[] languages = { - "Release", - "Release-JP" - }; - - private static readonly string[] ignoredExt = { - ".pdb", - ".bak", - ".user", - ".suo", - ".git", - ".gitignore", - }; - private static readonly string[] ignoredDir = { - ".svn", - ".git", - "bin", - "obj", - }; - - /// - /// Constructor - /// - public MainForm() - { - InitializeComponent(); - } - - /// - /// OnLoad - /// - /// - /// - private void MainForm_Load(object sender, EventArgs e) - { - textBox_Src.Text = Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), - @"Visual Studio " + VisualStudioVersion + @"\Projects\OpenCvSharp"); - textBox_Dst.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); - } - - /// - /// Exit - /// - /// - /// - private void toolStripMenuItem_Exit_Click(object sender, EventArgs e) - { - Application.Exit(); - } - - /// - /// Src - /// - /// - /// - private void button_Src_Click(object sender, EventArgs e) - { - folderBrowserDialog_Src.SelectedPath = textBox_Src.Text; - if (folderBrowserDialog_Src.ShowDialog(this) == DialogResult.OK) - { - textBox_Src.Text = folderBrowserDialog_Src.SelectedPath; - } - } - - /// - /// Dst - /// - /// - /// - private void button_Dst_Click(object sender, EventArgs e) - { - folderBrowserDialog_Dst.SelectedPath = textBox_Dst.Text; - if (folderBrowserDialog_Dst.ShowDialog(this) == DialogResult.OK) - { - textBox_Dst.Text = folderBrowserDialog_Dst.SelectedPath; - } - } - - /// - /// Make - /// - /// - /// - private void button_Make_Click(object sender, EventArgs e) - { - Button b = (Button)sender; - b.Enabled = false; - - MakeBinaryPackage(textBox_Src.Text, textBox_Dst.Text, textBox_Version.Text); - MakeSamplePackage(textBox_Src.Text, textBox_Dst.Text, textBox_Version.Text); - MessageBox.Show(@"Packages created successfully."); - - b.Enabled = true; - } - - /// - /// バイナリのzipパッケージを作成 - /// - /// - /// - /// - private void MakeBinaryPackage(string dir, string dirDst, string opencvVersion) - { - string dirSrc = Path.Combine(dir, "src"); - - foreach (string pf in platforms) - { - using (ZipFile zf = new ZipFile()) - { - // net20, net40といったplatformごとにDLLを選択 - foreach (var framework in dllFiles) - { - var frameworkName = framework.Key; - foreach (var dllFileName in framework.Value) - { - string dllPath = Path.Combine(dirSrc, dllFileName); - ZipEntry e = zf.AddFile(dllPath); - e.FileName = Path.Combine(frameworkName, Path.GetFileName(dllPath)); - } - } - - // XMLドキュメントコメントを選択 - foreach (string lang in languages) - { - foreach (string f in xmlFiles) - { - string xml = Path.Combine(dirSrc, String.Format(f, lang)); - if (!File.Exists(xml)) - continue; - ZipEntry e = zf.AddFile(xml); - string lg = lang.Contains("JP") ? "Japanese" : "English"; - e.FileName = Path.Combine("XmlDoc-" + lg, Path.GetFileName(xml)); - } - } - - // OpenCvSharpExtern.dllを選択 - { - string pfExtern = (pf == "x86") ? "Win32" : "x64"; - { - string externDir = Path.Combine(dirSrc, Path.Combine("Release", pfExtern)); - string externFile = Path.Combine(externDir, "OpenCvSharpExtern.dll"); - ZipEntry e = zf.AddFile(externFile); - e.FileName = Path.GetFileName(externFile); - } - } - - // Debugger Visualizerを選択 - foreach (string version in debuggerVisualizerVersions) - { - var dvPath = (version == "2015") - ? String.Format(debuggerVisualizerPath2015, version) - : String.Format(debuggerVisualizerPath, version); - string dllFileName = Path.Combine(dirSrc, dvPath); - string zipFileName = Path.Combine( - "DebuggerVisualizers", version, Path.GetFileName(dvPath)); - ZipEntry e = zf.AddFile(dllFileName); - e.FileName = zipFileName; - } - - // テキストを選択 - { - ZipEntry e1 = zf.AddFile(Path.Combine(dir, "LICENSE")); - e1.FileName = Path.GetFileName("LICENSE"); - ZipEntry e2 = zf.AddFile(Path.Combine(dir, "README.md")); - e2.FileName = Path.GetFileName("README.md"); - } - - string dst = Path.Combine( - dirDst, GetBinaryDstDirName(pf, opencvVersion)) + ".zip"; - zf.Save(dst); - } - } - } - - /// - /// Sampleのzipアーカイブを作成 - /// - /// - /// - /// - private void MakeSamplePackage(string dirSrc, string dirDst, string version) - { - dirSrc = Path.Combine(dirSrc, "samples"); - dirDst = Path.Combine(dirDst, GetSampleDstDirName(version)); - - CopyDirectory(dirSrc, dirDst); - - using (var zf = new ZipFile()) - { - zf.AddDirectory(dirDst); - zf.Save(dirDst + ".zip"); - } - - Directory.Delete(dirDst, true); - } - - private string GetBinaryDstDirName(string pf, string version) - { - string date = DateTime.Now.ToString("yyyyMMdd"); - return $"OpenCvSharp-{version}-{pf}-{date}"; - } - private string GetSampleDstDirName(string version) - { - string date = DateTime.Now.ToString("yyyyMMdd"); - return $"Sample-{version}-{date}"; - } - - /// - /// ディレクトリをコピーする。 - /// .svn bin obj は除外。 - /// - /// コピーするディレクトリ - /// コピー先のディレクトリ - /// http://dobon.net/vb/dotnet/file/copyfolder.html から拝借 - private static void CopyDirectory( - string sourceDirName, string destDirName) - { - // コピー先のディレクトリがあれば削除 - if (Directory.Exists(destDirName)) - { - Directory.Delete(destDirName, true); - } - - // コピー先のディレクトリを作る - Directory.CreateDirectory(destDirName); - File.SetAttributes(destDirName, File.GetAttributes(sourceDirName)); - - // コピー先のディレクトリ名の末尾に"\"をつける - if (destDirName[destDirName.Length - 1] != Path.DirectorySeparatorChar) - { - destDirName = destDirName + Path.DirectorySeparatorChar; - } - - // コピー元のディレクトリにあるファイルをコピー - var files = from f in Directory.GetFiles(sourceDirName) - where !ignoredExt.Contains(Path.GetExtension(f)?.ToLower()) && Path.GetFileName(f) != "OpenCvSharp.DebuggerVisualizers.dll" - select f; - foreach (string file in files) - { - File.Copy(file, destDirName + Path.GetFileName(file), true); - } - - // コピー元のディレクトリにあるディレクトリについて、再帰的に呼び出す - var dirs = from d in Directory.GetDirectories(sourceDirName) - where !ignoredDir.Contains(Path.GetFileName(d)) - select d; - foreach (string dir in dirs) - { - CopyDirectory(dir, destDirName + Path.GetFileName(dir)); - } - } - - } -} diff --git a/src/OpenCvSharp.ReleaseMaker/MainForm.resx b/src/OpenCvSharp.ReleaseMaker/MainForm.resx deleted file mode 100644 index ca2228f4a..000000000 --- a/src/OpenCvSharp.ReleaseMaker/MainForm.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 16, 14 - - - 130, 14 - - - 330, 14 - - \ No newline at end of file diff --git a/src/OpenCvSharp.ReleaseMaker/OpenCvSharp.ReleaseMaker.csproj b/src/OpenCvSharp.ReleaseMaker/OpenCvSharp.ReleaseMaker.csproj deleted file mode 100644 index 045df3efd..000000000 --- a/src/OpenCvSharp.ReleaseMaker/OpenCvSharp.ReleaseMaker.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {E2C8C528-B7C7-40AF-BB7F-1147A41E2E23} - WinExe - Properties - OpenCvSharp.ReleaseMaker - OpenCvSharp.ReleaseMaker - v4.6.1 - 512 - - - 3.5 - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - false - bin\Release\ - TRACE - prompt - 4 - false - - - - - - 3.5 - - - - - - - - Form - - - MainForm.cs - - - - - MainForm.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - \ No newline at end of file diff --git a/src/OpenCvSharp.ReleaseMaker/Program.cs b/src/OpenCvSharp.ReleaseMaker/Program.cs deleted file mode 100644 index 362a598d9..000000000 --- a/src/OpenCvSharp.ReleaseMaker/Program.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace OpenCvSharp.ReleaseMaker -{ - static class Program - { - /// - /// アプリケーションのメイン エントリ ポイントです。 - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - } -} diff --git a/src/OpenCvSharp.ReleaseMaker/Properties/AssemblyInfo.cs b/src/OpenCvSharp.ReleaseMaker/Properties/AssemblyInfo.cs deleted file mode 100644 index ed2093f61..000000000 --- a/src/OpenCvSharp.ReleaseMaker/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 -// アセンブリに関連付けられている情報を変更するには、 -// これらの属性値を変更してください。 -[assembly: AssemblyTitle("OpenCvSharp.ReleaseMaker")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.ReleaseMaker")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから -// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 -// その型の ComVisible 属性を true に設定してください。 -[assembly: ComVisible(false)] - -// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です -[assembly: Guid("4af74c3c-4d5c-44e6-9175-af009d755dec")] - -// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を -// 既定値にすることができます: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/OpenCvSharp.ReleaseMaker/Properties/Resources.Designer.cs b/src/OpenCvSharp.ReleaseMaker/Properties/Resources.Designer.cs deleted file mode 100644 index 6ca03c1bf..000000000 --- a/src/OpenCvSharp.ReleaseMaker/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// このコードはツールによって生成されました。 -// ランタイム バージョン:4.0.30319.42000 -// -// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 -// コードが再生成されるときに損失したりします。 -// -//------------------------------------------------------------------------------ - -namespace OpenCvSharp.ReleaseMaker.Properties { - using System; - - - /// - /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 - /// - // このクラスは StronglyTypedResourceBuilder クラスが ResGen - // または Visual Studio のようなツールを使用して自動生成されました。 - // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に - // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenCvSharp.ReleaseMaker.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、 - /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/src/OpenCvSharp.ReleaseMaker/Properties/Resources.resx b/src/OpenCvSharp.ReleaseMaker/Properties/Resources.resx deleted file mode 100644 index af7dbebba..000000000 --- a/src/OpenCvSharp.ReleaseMaker/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/OpenCvSharp.ReleaseMaker/Properties/Settings.Designer.cs b/src/OpenCvSharp.ReleaseMaker/Properties/Settings.Designer.cs deleted file mode 100644 index 8b34f1ab4..000000000 --- a/src/OpenCvSharp.ReleaseMaker/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// このコードはツールによって生成されました。 -// ランタイム バージョン:4.0.30319.42000 -// -// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 -// コードが再生成されるときに損失したりします。 -// -//------------------------------------------------------------------------------ - -namespace OpenCvSharp.ReleaseMaker.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/src/OpenCvSharp.ReleaseMaker/Properties/Settings.settings b/src/OpenCvSharp.ReleaseMaker/Properties/Settings.settings deleted file mode 100644 index 39645652a..000000000 --- a/src/OpenCvSharp.ReleaseMaker/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/OpenCvSharp.ReleaseMaker/app.config b/src/OpenCvSharp.ReleaseMaker/app.config deleted file mode 100644 index 3dbff35f4..000000000 --- a/src/OpenCvSharp.ReleaseMaker/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/OpenCvSharp.UserInterface/CvWindowEx.Designer.cs b/src/OpenCvSharp.UserInterface/CvWindowEx.Designer.cs deleted file mode 100644 index 148d05d35..000000000 --- a/src/OpenCvSharp.UserInterface/CvWindowEx.Designer.cs +++ /dev/null @@ -1,75 +0,0 @@ -namespace OpenCvSharp.UserInterface -{ - partial class CvWindowEx - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this._panelTrackbar = new System.Windows.Forms.Panel(); - this._pictureBox = new OpenCvSharp.UserInterface.PictureBoxIpl(); - ((System.ComponentModel.ISupportInitialize)(this._pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // _panelTrackbar - // - this._panelTrackbar.Dock = System.Windows.Forms.DockStyle.Top; - this._panelTrackbar.Location = new System.Drawing.Point(0, 0); - this._panelTrackbar.Name = "_panelTrackbar"; - this._panelTrackbar.Size = new System.Drawing.Size(584, 0); - this._panelTrackbar.TabIndex = 0; - // - // _pictureBox - // - this._pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this._pictureBox.Location = new System.Drawing.Point(0, 0); - this._pictureBox.Name = "_pictureBox"; - this._pictureBox.Size = new System.Drawing.Size(584, 443); - this._pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this._pictureBox.TabIndex = 2; - this._pictureBox.TabStop = false; - // - // CvWindowEx - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(584, 443); - this.Controls.Add(this._pictureBox); - this.Controls.Add(this._panelTrackbar); - this.KeyPreview = true; - this.Name = "CvWindowEx"; - this.Text = "CvWindowEx"; - this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CvWindowEx_KeyDown); - ((System.ComponentModel.ISupportInitialize)(this._pictureBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel _panelTrackbar; - private PictureBoxIpl _pictureBox; - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.UserInterface/CvWindowEx.cs b/src/OpenCvSharp.UserInterface/CvWindowEx.cs deleted file mode 100644 index 6669b73e2..000000000 --- a/src/OpenCvSharp.UserInterface/CvWindowEx.cs +++ /dev/null @@ -1,398 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading; -using System.Windows.Forms; - -namespace OpenCvSharp.UserInterface -{ -#if LANG_JP - /// - /// highguiを用いない、System.Windows.FormsによるCvWindowの実装 - /// -#else - /// - /// Original CvWindow implementation without highgui - /// -#endif - public partial class CvWindowEx : Form, IDisposable - { - #region Fields - private List pressedKeys; - private static readonly List windows; - #endregion - - #region Initialization and dispose - /// - /// static constructor - /// - static CvWindowEx() - { - windows = new List(); - } - -#if LANG_JP - /// - /// 既定の初期化 - /// -#else - /// - /// Default Constructor - /// -#endif - public CvWindowEx() - { - InitializeComponent(); - pressedKeys = null; - _pictureBox.Image = null; - this.Show(); - windows.Add(this); - } -#if LANG_JP - /// - /// 初期化 - /// - /// -#else - /// - /// Constructor - /// - /// -#endif - public CvWindowEx(Mat image) : this() - { - Image = image; - } -#if LANG_JP - /// - /// 初期化 - /// - /// -#else - /// - /// Constructor - /// - /// -#endif - public CvWindowEx(PictureBoxSizeMode sizeMode) - : this() - { - _pictureBox.SizeMode = sizeMode; - } -#if LANG_JP - /// - /// 初期化 - /// - /// - /// -#else - /// - /// Constructor - /// - /// - /// -#endif - public CvWindowEx(Mat image, PictureBoxSizeMode sizeMode) - : this() - { - Image = image; - _pictureBox.SizeMode = sizeMode; - } - -#if LANG_JP - /// - /// リソースの解放 - /// -#else - /// - /// Finalizer - /// -#endif - public new void Dispose() - { - base.Dispose(); - windows.Remove(this); - } - #endregion - - #region Event handlers - private void CvWindowEx_KeyDown(object sender, KeyEventArgs e) - { - if (pressedKeys != null) - { - pressedKeys.Add(e.KeyCode); - } - } - #endregion - - #region Properties -#if LANG_JP - /// - /// 表示するIplImageを取得・設定する - /// -#else - /// - /// Gets or sets an image to be shown - /// -#endif - public Mat Image - { - get { return _pictureBox.ImageIpl; } - set - { - if (value != null) - { - Size size = value.Size(); - size.Height += _panelTrackbar.ClientSize.Height; - SetClientSize(new System.Drawing.Size(size.Width, size.Height)); - } - _pictureBox.ImageIpl = value; - } - } -#if LANG_JP - /// - /// 画像を表示しているPictureBoxコントロールを取得する - /// -#else - /// - /// Gets Picturebox control - /// -#endif - public PictureBox PictureBox - { - get - { - return _pictureBox; - } - } -#if LANG_JP - /// - /// CreateTrackbarで作成したトラックバーのリストを取得する - /// -#else - /// - /// Gets all created trackbars - /// -#endif - public TrackbarWithLabel[] Trackbars - { - get - { - TrackbarWithLabel[] result = new TrackbarWithLabel[_panelTrackbar.Controls.Count]; - _panelTrackbar.Controls.CopyTo(result, 0); - return result; - } - } - #endregion - - #region Public methods -#if LANG_JP - /// - /// 指定したIplImageを表示する - /// - /// -#else - /// - /// Shows the image in this window - /// - /// Image to be shown. -#endif - public void ShowImage(Mat image) - { - Image = image; - } -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート - /// -#else - /// - /// Creates the trackbar and attaches it to this window - /// - /// Name of created trackbar. - /// The position of the slider - /// Maximal position of the slider. Minimal position is always 0. - /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); - /// -#endif - public TrackbarWithLabel CreateTrackbar(string name, int value, int count, CvTrackbarCallback onChange) - { - var t = new TrackbarWithLabel(name, value, count, 0); - t.Dock = DockStyle.Top; - t.Trackbar.ValueChanged += (o, e) => - { - int pos = ((TrackBar)o).Value; - onChange(pos); - }; - SetClientSize(new System.Drawing.Size(ClientSize.Width, ClientSize.Height + t.Height)); - _panelTrackbar.Height += t.Height; - _panelTrackbar.Controls.Add(t); - return t; - } - -#if LANG_JP - /// - /// 何かキーが押されるまで待機する. - /// -#else - /// - /// Waits for a pressed key - /// -#endif - public static Keys WaitKey() - { - return WaitKey(0); - } -#if LANG_JP - /// - /// 何かキーが押されるまで待機する. - /// - /// 押されたキーのキーコード -#else - /// - /// Waits for a pressed key - /// - /// Key code -#endif - public static Keys WaitKey(int delay) - { - Keys result = Keys.None; - Stopwatch watch = Stopwatch.StartNew(); - - foreach (CvWindowEx w in windows) - { - w.StartKeyCheck(); - } - while (!ClosedAllWindows() && (delay <= 0 || watch.ElapsedMilliseconds < delay)) - { - Application.DoEvents(); - Thread.Sleep(1); - foreach (CvWindowEx w in windows) - { - if (!w.Created) - { - continue; - } - Keys key = w.GetPressedKey(); - if (key != Keys.None) - { - result = key; - goto END_WHILE; - } - } - } - END_WHILE: - foreach (CvWindowEx w in windows) - { - w.EndKeyCheck(); - } - - return result; - } - -#if LANG_JP - /// - /// 引数に指定した画像をそれぞれ別のウィンドウで表示し、キー入力待ち状態にする。 - /// - /// 表示させる画像。任意の個数を指定できる。 -#else - /// - /// - /// - /// -#endif - static public void ShowImages(params Mat[] images) - { - if (images == null) - { - throw new ArgumentNullException(nameof(images)); - } - if (images.Length == 0) - { - return; - } - var windows = new List(); - foreach (Mat img in images) - { - windows.Add(new CvWindowEx(img)); - } - WaitKey(); - foreach (CvWindowEx w in windows) - { - w.Close(); - } - } - #endregion - - #region Private Methods - /// - /// - /// - private void StartKeyCheck() - { - pressedKeys = new List(); - } - /// - /// - /// - private void EndKeyCheck() - { - pressedKeys = null; - } - /// - /// - /// - /// - private static bool ClosedAllWindows() - { - foreach (CvWindowEx w in windows) - { - if (w.Created) - { - return false; - } - } - return true; - } - /// - /// - /// - /// - private Keys GetPressedKey() - { - if (pressedKeys == null || pressedKeys.Count == 0) - return Keys.None; - else - return pressedKeys[0]; - } - - /// - /// ClientSizeを画面からはみ出ない大きさに調整して設定する. - /// - /// - private void SetClientSize(System.Drawing.Size size) - { - var screenSize = Screen.PrimaryScreen.Bounds.Size; - if (size.Width > screenSize.Width) - { - double ratio = (double)screenSize.Width / size.Width; - size.Width = Convert.ToInt32(size.Width * ratio); - size.Height = Convert.ToInt32(size.Height * ratio); - } - if (size.Height > screenSize.Height) - { - double ratio = (double)screenSize.Height / size.Height; - size.Width = Convert.ToInt32(size.Width * ratio); - size.Height = Convert.ToInt32(size.Height * ratio); - } - ClientSize = new System.Drawing.Size(size.Width, size.Height); - } - #endregion - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.UserInterface/Key.snk b/src/OpenCvSharp.UserInterface/Key.snk deleted file mode 100644 index a1e033087..000000000 Binary files a/src/OpenCvSharp.UserInterface/Key.snk and /dev/null differ diff --git a/src/OpenCvSharp.UserInterface/OpenCvSharp.UserInterface.xproj b/src/OpenCvSharp.UserInterface/OpenCvSharp.UserInterface.xproj deleted file mode 100644 index d0b834b34..000000000 --- a/src/OpenCvSharp.UserInterface/OpenCvSharp.UserInterface.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - fad73716-92ec-4a0f-b594-286ff08ede33 - OpenCvSharp.UserInterface - .\obj - .\bin\ - v4.5 - - - 2.0 - - - \ No newline at end of file diff --git a/src/OpenCvSharp.UserInterface/PictureBoxIpl.cs b/src/OpenCvSharp.UserInterface/PictureBoxIpl.cs deleted file mode 100644 index 488785699..000000000 --- a/src/OpenCvSharp.UserInterface/PictureBoxIpl.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using OpenCvSharp.Extensions; - -namespace OpenCvSharp.UserInterface -{ -#if LANG_JP - /// - /// IplImageの表示をサポートしたPictureBox - /// -#else - /// - /// PictureBox control which supports IplImage - /// -#endif - public class PictureBoxIpl : PictureBox - { - private Mat imageIpl; - - -#if LANG_JP - /// - /// 初期化 - /// -#else - /// - /// Constructor - /// -#endif - public PictureBoxIpl() : base() - { - imageIpl = null; - } - - -#if LANG_JP - /// - /// 表示するIplImageを取得・設定する - /// - [Description("表示するIplImageを取得・設定する")] -#else - /// - /// Gets or sets the IplImage instance to be shown - /// - [Description("Gets or sets the IplImage instance to be shown")] -#endif - [Browsable(false)] - [Category()] - [DefaultValue(null)] - public Mat ImageIpl - { - get { return imageIpl; } - set - { - if (value != null && value.IsDisposed) - { - throw new ArgumentException("the image is disposed.", nameof(value)); - } - - imageIpl = value; - if (Image != null) - { - Image.Dispose(); - } - if (value == null) - { - Image = null; - } - else - { - Image = BitmapConverter.ToBitmap(value); - } - } - } - -#if LANG_JP - /// - /// 表示されているIplImageを更新する - /// -#else - /// - /// Refreshes the shown image - /// -#endif - public void RefreshIplImage() - { - if (ImageIpl == null) - { - return; - } - if (Image.Width != ImageIpl.Width || Image.Height != ImageIpl.Height) - { - Image = BitmapConverter.ToBitmap(ImageIpl); - } - else - { - BitmapConverter.ToBitmap(ImageIpl, (Bitmap)Image); - } - } - -#if LANG_JP - /// - /// 表示されているIplImageを更新する - /// - /// -#else - /// - /// Refreshes the shown image - /// - /// -#endif - public void RefreshIplImage(Mat img) - { - if (img == null || Image == null) - { - ImageIpl = img; - } - else if (Image.Width != img.Width || Image.Height != img.Height) - { - ImageIpl = img; - } - else - { - imageIpl = img; - BitmapConverter.ToBitmap(img, (Bitmap)Image); - } - Refresh(); - } - } -} diff --git a/src/OpenCvSharp.UserInterface/Properties/AssemblyInfo.cs b/src/OpenCvSharp.UserInterface/Properties/AssemblyInfo.cs deleted file mode 100644 index 35543c520..000000000 --- a/src/OpenCvSharp.UserInterface/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenCvSharp.UserInterface")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fad73716-92ec-4a0f-b594-286ff08ede33")] diff --git a/src/OpenCvSharp.UserInterface/TrackbarWithLabel.Designer.cs b/src/OpenCvSharp.UserInterface/TrackbarWithLabel.Designer.cs deleted file mode 100644 index 911b108ee..000000000 --- a/src/OpenCvSharp.UserInterface/TrackbarWithLabel.Designer.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace OpenCvSharp.UserInterface -{ - partial class TrackbarWithLabel - { - /// - /// 必要なデザイナ変数です。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 使用中のリソースをすべてクリーンアップします。 - /// - /// マネージ リソースが破棄される場合 true、破棄されない場合は false です。 - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region コンポーネント デザイナで生成されたコード - - /// - /// デザイナ サポートに必要なメソッドです。このメソッドの内容を - /// コード エディタで変更しないでください。 - /// - private void InitializeComponent() - { - this.trackBar = new System.Windows.Forms.TrackBar(); - this.label = new System.Windows.Forms.Label(); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - this.SuspendLayout(); - // - // _trackBar - // - this.trackBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.trackBar.Location = new System.Drawing.Point(0, 0); - this.trackBar.Name = "_trackBar"; - this.trackBar.Size = new System.Drawing.Size(403, 49); - this.trackBar.TabIndex = 0; - this.trackBar.TickStyle = System.Windows.Forms.TickStyle.Both; - this.trackBar.ValueChanged += new System.EventHandler(this._trackBar_ValueChanged); - // - // _label - // - this.label.Dock = System.Windows.Forms.DockStyle.Fill; - this.label.Font = new System.Drawing.Font("MS UI Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); - this.label.Location = new System.Drawing.Point(0, 0); - this.label.Name = "_label"; - this.label.Size = new System.Drawing.Size(139, 49); - this.label.TabIndex = 1; - this.label.Text = "Label"; - this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // _splitContainer - // - this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer.Location = new System.Drawing.Point(0, 0); - this.splitContainer.Name = "_splitContainer"; - // - // _splitContainer.Panel1 - // - this.splitContainer.Panel1.Controls.Add(this.label); - this.splitContainer.Panel1MinSize = 100; - // - // _splitContainer.Panel2 - // - this.splitContainer.Panel2.Controls.Add(this.trackBar); - this.splitContainer.Size = new System.Drawing.Size(546, 49); - this.splitContainer.SplitterDistance = 139; - this.splitContainer.TabIndex = 2; - // - // TrackbarWithLabel - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.splitContainer); - this.Name = "TrackbarWithLabel"; - this.Size = new System.Drawing.Size(546, 49); - ((System.ComponentModel.ISupportInitialize)(this.trackBar)).EndInit(); - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - this.splitContainer.Panel2.PerformLayout(); - this.splitContainer.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TrackBar trackBar; - private System.Windows.Forms.Label label; - private System.Windows.Forms.SplitContainer splitContainer; - } -} \ No newline at end of file diff --git a/src/OpenCvSharp.UserInterface/TrackbarWithLabel.cs b/src/OpenCvSharp.UserInterface/TrackbarWithLabel.cs deleted file mode 100644 index f53c611e0..000000000 --- a/src/OpenCvSharp.UserInterface/TrackbarWithLabel.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace OpenCvSharp.UserInterface -{ -#if LANG_JP - /// - /// ラベルがセットになったトラックバー - /// -#else - /// - /// A Trackbar come with label - /// -#endif - public partial class TrackbarWithLabel : UserControl - { - private readonly string labelText; - - /// - /// Constructor - /// - public TrackbarWithLabel() - { - InitializeComponent(); - } - - /// - /// Constructor - /// - /// - /// - /// - /// - public TrackbarWithLabel(string labelText, int pos, int max, int min) : this() - { - this.labelText = labelText; - trackBar.Maximum = max; - trackBar.Minimum = min; - trackBar.Value = pos; - trackBar.TickFrequency = (max - min) / 10; - SetLabelText(); - } - -#if LANG_JP - /// - /// TrackBarコントロール - /// -#else - /// - /// TrackBar control - /// -#endif - public TrackBar Trackbar - { - get { return trackBar; } - } -#if LANG_JP - /// - /// Labelコントロール - /// -#else - /// - /// Label control - /// -#endif - public Label Label - { - get { return label; } - } - - /// - /// - /// - private void SetLabelText() - { - string text = string.Format("{0} : {1}", labelText, trackBar.Value); - label.Text = text; - } - - /// - /// - /// - /// - /// - private void _trackBar_ValueChanged(object sender, EventArgs e) - { - SetLabelText(); - } - } -} diff --git a/src/OpenCvSharp.UserInterface/project.json b/src/OpenCvSharp.UserInterface/project.json deleted file mode 100644 index f1090e8d3..000000000 --- a/src/OpenCvSharp.UserInterface/project.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*", - "OpenCvSharp.Extensions": "1.0.0-*" - }, - - "frameworks": { - "net40": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Drawing": "4.0.0.0", - "System.Windows.Forms": "4.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net40" ] - } - }, - "net46": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Drawing": "4.0.0.0", - "System.Windows.Forms": "4.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net46" ] - } - } - }, - "buildOptions": { - "xmlDoc": true, - "optimize": true, - "keyFile": "Key.snk", - "allowUnsafe": true - } -} diff --git a/src/OpenCvSharp.UserInterface/project.lock.json b/src/OpenCvSharp.UserInterface/project.lock.json deleted file mode 100644 index 042b57b45..000000000 --- a/src/OpenCvSharp.UserInterface/project.lock.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETFramework,Version=v4.0": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.0", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net40/OpenCvSharp.dll": {} - }, - "runtime": { - "net40/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.0", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "frameworkAssemblies": [ - "PresentationCore", - "PresentationFramework", - "System.Drawing", - "System.Windows.Forms", - "System.Xaml", - "WindowsBase" - ], - "compile": { - "net40/OpenCvSharp.Extensions.dll": {} - }, - "runtime": { - "net40/OpenCvSharp.Extensions.dll": {} - } - } - }, - ".NETFramework,Version=v4.6": { - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net46/OpenCvSharp.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "frameworkAssemblies": [ - "PresentationCore", - "PresentationFramework", - "System.Drawing", - "System.Runtime", - "System.Windows.Forms", - "System.Xaml", - "WindowsBase" - ], - "compile": { - "net46/OpenCvSharp.Extensions.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Extensions.dll": {} - } - } - } - }, - "libraries": { - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../OpenCvSharp/project.json", - "msbuildProject": "../OpenCvSharp/OpenCvSharp.xproj" - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "path": "../OpenCvSharp.Extensions/project.json", - "msbuildProject": "../OpenCvSharp.Extensions/OpenCvSharp.Extensions.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "OpenCvSharp >= 1.0.0-*", - "OpenCvSharp.Extensions >= 1.0.0-*" - ], - ".NETFramework,Version=v4.0": [ - "System.Drawing >= 4.0.0", - "System.Windows.Forms >= 4.0.0" - ], - ".NETFramework,Version=v4.6": [ - "System.Drawing >= 4.0.0", - "System.Windows.Forms >= 4.0.0" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs b/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs new file mode 100644 index 000000000..c77e57130 --- /dev/null +++ b/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs @@ -0,0 +1,252 @@ +#if WINDOWS && (NET48 || NETCOREAPP3_1_OR_GREATER) +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Windows; +using System.Windows.Media.Imaging; +using System.Windows.Threading; +using PixelFormat = System.Windows.Media.PixelFormat; + +namespace OpenCvSharp.WpfExtensions; + +/// +/// Static class which provides conversion between System.Windows.Media.Imaging.BitmapSource and IplImage +/// +public static class BitmapSourceConverter +{ + /// + /// Converts Mat to BitmapSource. + /// + /// Input IplImage + /// BitmapSource + public static BitmapSource ToBitmapSource( + this Mat src) => + src.ToWriteableBitmap(); + + /// + /// Converts Mat to BitmapSource. + /// + /// Input IplImage + /// + /// + /// + /// + /// BitmapSource + public static BitmapSource ToBitmapSource( + this Mat src, + int horizontalResolution, + int verticalResolution, + PixelFormat pixelFormat, + BitmapPalette palette) => + src.ToWriteableBitmap(horizontalResolution, verticalResolution, pixelFormat, palette); + + /// + /// Converts System.Drawing.Bitmap to BitmapSource. + /// + /// Input System.Drawing.Bitmap + /// http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource + /// BitmapSource + public static BitmapSource ToBitmapSource(this Bitmap src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + if (Application.Current?.Dispatcher is null) + { + using var memoryStream = new MemoryStream(); + src.Save(memoryStream, ImageFormat.Png); + return CreateBitmapSourceFromBitmap(memoryStream); + } + + using (var memoryStream = new MemoryStream()) + { + // You need to specify the image format to fill the stream. + // I'm assuming it is PNG + src.Save(memoryStream, ImageFormat.Png); + memoryStream.Seek(0, SeekOrigin.Begin); + + // Make sure to create the bitmap in the UI thread + if (IsInvokeRequired()) + return (BitmapSource) Application.Current.Dispatcher.Invoke( + new Func(CreateBitmapSourceFromBitmap), + DispatcherPriority.Normal, + memoryStream); + + return CreateBitmapSourceFromBitmap(memoryStream); + } + } + + // http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource + private static bool IsInvokeRequired() + => Dispatcher.CurrentDispatcher != Application.Current.Dispatcher; + + // http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource + private static BitmapSource CreateBitmapSourceFromBitmap(Stream stream) + { + var bitmapDecoder = BitmapDecoder.Create( + stream, + BitmapCreateOptions.PreservePixelFormat, + BitmapCacheOption.OnLoad); + + // This will disconnect the stream from the image completely... + var writable = new WriteableBitmap(bitmapDecoder.Frames.Single()); + writable.Freeze(); + + return writable; + } + + #region ToMat + + /// + /// Converts BitmapSource to Mat + /// + /// Input BitmapSource + /// IplImage + public static Mat ToMat(this BitmapSource src) + { + if (src is null) + { + throw new ArgumentNullException(nameof(src)); + } + + int w = src.PixelWidth; + int h = src.PixelHeight; + MatType type = WriteableBitmapConverter.GetOptimumType(src.Format); + Mat dst = new Mat(h, w, type); + ToMat(src, dst); + return dst; + } + + /// + /// Converts BitmapSource to Mat + /// + /// Input BitmapSource + /// Output Mat + public static void ToMat(this BitmapSource src, Mat dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (src.PixelWidth != dst.Width || src.PixelHeight != dst.Height) + throw new ArgumentException("size of src must be equal to size of dst"); + if (dst.Dims > 2) + throw new ArgumentException("Mat dimensions must be 2"); + + int w = src.PixelWidth; + int h = src.PixelHeight; + int bpp = src.Format.BitsPerPixel; + int channels = WriteableBitmapConverter.GetOptimumChannels(src.Format); + if (dst.Channels() != channels) + { + throw new ArgumentException("nChannels of dst is invalid", nameof(dst)); + } + + bool submat = dst.IsSubmatrix(); + bool continuous = dst.IsContinuous(); + + unsafe + { + byte* p = (byte*)(dst.Data); + long step = dst.Step(); + + // 1bppは手作業でコピー + if (bpp == 1) + { + if (submat) + throw new NotImplementedException("submatrix not supported"); + + // BitmapImageのデータを配列にコピー + // 要素1つに横8ピクセル分のデータが入っている。 + int stride = (w / 8) + 1; + byte[] pixels = new byte[h * stride]; + src.CopyPixels(pixels, stride, 0); + int x = 0; + for (int y = 0; y < h; y++) + { + int offset = y * stride; + // この行の各バイトを調べていく + for (int bytePos = 0; bytePos < stride; bytePos++) + { + if (x < w) + { + // 現在の位置のバイトからそれぞれのビット8つを取り出す + byte b = pixels[offset + bytePos]; + for (int i = 0; i < 8; i++) + { + if (x >= w) + { + break; + } + p[step * y + x] = ((b & 0x80) == 0x80) ? (byte)255 : (byte)0; + b <<= 1; + x++; + } + } + } + // 次の行へ + x = 0; + } + + } + // 8bpp + /*else if (bpp == 8) + { + int stride = w; + byte[] pixels = new byte[h * stride]; + src.CopyPixels(pixels, stride, 0); + for (int y = 0; y < h; y++) + { + for (int x = 0; x < w; x++) + { + p[step * y + x] = pixels[y * stride + x]; + } + } + }*/ + // 24bpp, 32bpp, ... + else + { + int stride = w * ((bpp + 7) / 8); + if (!submat && continuous) + { + long imageSize = dst.DataEnd.ToInt64() - dst.Data.ToInt64(); + if (imageSize < 0) + throw new OpenCvSharpException("The mat has invalid data pointer"); + if (imageSize > int.MaxValue) + throw new OpenCvSharpException("Too big mat data"); + src.CopyPixels(Int32Rect.Empty, dst.Data, (int)imageSize, stride); + } + else + { + // 高さ1pxの矩形ごと(≒1行ごと)にコピー + var roi = new Int32Rect { X = 0, Y = 0, Width = w, Height = 1 }; + IntPtr dstData = dst.Data; + for (int y = 0; y < h; y++) + { + roi.Y = y; + src.CopyPixels(roi, dstData, stride, stride); + dstData = new IntPtr(dstData.ToInt64() + stride); + } + } + } + + } + } + + /// + /// Copies pixel data from System.Windows.Media.Imaging.BitmapSource to IplImage instance + /// + /// + /// + /// + public static void CopyFrom(this Mat mat, BitmapSource wb) + { + if (wb is null) + throw new ArgumentNullException(nameof(wb)); + + ToMat(wb, mat); + } + + #endregion +} +#endif diff --git a/src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj b/src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj new file mode 100644 index 000000000..a6ca2c9ba --- /dev/null +++ b/src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj @@ -0,0 +1,57 @@ + + + + + + net48;net6.0-windows + true + 12 + enable + enable + https://github.com/shimat/opencvsharp.git + git + + + AllEnabledByDefault + + + + true + + + + + + + + + + + $(DefineConstants);DOTNET_FRAMEWORK; + + + + $(DefineConstants);WINDOWS; + + + + + + + + + + + + + + CA1303; + + + + C:\Projects\opencvsharp\src\OpenCvSharp.WpfExtensions\OpenCvSharp.WpfExtensions.xml + + + + + diff --git a/src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.xml b/src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.xml new file mode 100644 index 000000000..66bc7cca0 --- /dev/null +++ b/src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.xml @@ -0,0 +1,143 @@ + + + + OpenCvSharp.WpfExtensions + + + + + Static class which provides conversion between System.Windows.Media.Imaging.BitmapSource and IplImage + + + + + Converts Mat to BitmapSource. + + Input IplImage + BitmapSource + + + + Converts Mat to BitmapSource. + + Input IplImage + + + + + BitmapSource + + + + Converts System.Drawing.Bitmap to BitmapSource. + + Input System.Drawing.Bitmap + http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource + BitmapSource + + + + Converts BitmapSource to Mat + + Input BitmapSource + IplImage + + + + Converts BitmapSource to Mat + + Input BitmapSource + Output Mat + + + + Copies pixel data from System.Windows.Media.Imaging.BitmapSource to IplImage instance + + + + + + + + Static class which provides conversion between System.Windows.Media.Imaging.WriteableBitmap and Mat + + + + + 指定したPixelFormatに適合するMatのチャンネル数を返す + + + + + + + 指定したPixelFormatに適合するMatTypeを返す + + + + + + + 指定したMatのビット深度・チャンネル数に適合するPixelFormatを返す + + + + + + + BGR -> RGB + + + + + + + Converts Mat to WriteableBitmap. + The arguments of this method corresponds the consructor of WriteableBitmap. + + Input Mat + Horizontal dots per inch + Vertical dots per inch + Pixel format of output WriteableBitmap + Bitmap palette + WriteableBitmap + + + + Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) + + Input Mat + Pixel format of output WriteableBitmap + WriteableBitmap + + + + Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) + + Input Mat + WriteableBitmap + + + + Converts Mat to WriteableBitmap. + This method is more efficient because new instance of WriteableBitmap is not allocated. + + Input Mat + Output WriteableBitmap + + + + Converts WriteableBitmap to IplImage + + Input WriteableBitmap + IplImage + + + + Converts WriteableBitmap to Mat + + Input WriteableBitmap + Output Mat + + + diff --git a/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs b/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs new file mode 100644 index 000000000..86a760148 --- /dev/null +++ b/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs @@ -0,0 +1,437 @@ +#if WINDOWS && (NET48 || NETCOREAPP3_1_OR_GREATER) +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace OpenCvSharp.WpfExtensions; + +/// +/// Static class which provides conversion between System.Windows.Media.Imaging.WriteableBitmap and Mat +/// +public static class WriteableBitmapConverter +{ + private static readonly Dictionary optimumChannels; + private static readonly Dictionary optimumTypes; + +#pragma warning disable CA1810 + static WriteableBitmapConverter() +#pragma warning restore CA1810 + { + optimumChannels = new Dictionary(); + optimumChannels[PixelFormats.Gray2] = + optimumChannels[PixelFormats.Gray4] = + optimumChannels[PixelFormats.Gray8] = + optimumChannels[PixelFormats.Gray16] = + optimumChannels[PixelFormats.Gray32Float] = + optimumChannels[PixelFormats.Indexed1] = + optimumChannels[PixelFormats.Indexed2] = + optimumChannels[PixelFormats.Indexed4] = + optimumChannels[PixelFormats.Indexed8] = + optimumChannels[PixelFormats.BlackWhite] = 1; + optimumChannels[PixelFormats.Bgr24] = + optimumChannels[PixelFormats.Bgr555] = + optimumChannels[PixelFormats.Bgr565] = + optimumChannels[PixelFormats.Rgb24] = + optimumChannels[PixelFormats.Rgb48] = + optimumChannels[PixelFormats.Rgb128Float] = 3; + optimumChannels[PixelFormats.Bgr32] = + optimumChannels[PixelFormats.Bgra32] = + optimumChannels[PixelFormats.Cmyk32] = + optimumChannels[PixelFormats.Pbgra32] = + optimumChannels[PixelFormats.Prgba64] = + optimumChannels[PixelFormats.Prgba128Float] = + optimumChannels[PixelFormats.Rgba64] = + optimumChannels[PixelFormats.Rgba128Float] = 4; + + optimumTypes = new Dictionary(); + optimumTypes[PixelFormats.Gray2] = + optimumTypes[PixelFormats.Gray4] = + optimumTypes[PixelFormats.Gray8] = + optimumTypes[PixelFormats.Indexed1] = + optimumTypes[PixelFormats.Indexed2] = + optimumTypes[PixelFormats.Indexed4] = + optimumTypes[PixelFormats.Indexed8] = + optimumTypes[PixelFormats.BlackWhite] = MatType.CV_8UC1; + optimumTypes[PixelFormats.Gray16] = MatType.CV_16UC1; + optimumTypes[PixelFormats.Rgb48] = MatType.CV_16UC3; + optimumTypes[PixelFormats.Rgba64] = MatType.CV_16UC4; + optimumTypes[PixelFormats.Pbgra32] = + optimumTypes[PixelFormats.Prgba64] = MatType.CV_32SC4; + optimumTypes[PixelFormats.Gray32Float] = MatType.CV_32FC1; + optimumTypes[PixelFormats.Rgb128Float] = MatType.CV_32FC3; + optimumTypes[PixelFormats.Prgba128Float] = + optimumTypes[PixelFormats.Rgba128Float] = MatType.CV_32FC4; + optimumTypes[PixelFormats.Bgr24] = + optimumTypes[PixelFormats.Rgb24] = + optimumTypes[PixelFormats.Bgr555] = + optimumTypes[PixelFormats.Bgr565] = MatType.CV_8UC3; + optimumTypes[PixelFormats.Bgr32] = + optimumTypes[PixelFormats.Bgra32] = + optimumTypes[PixelFormats.Cmyk32] = MatType.CV_8UC4; + } + + /// + /// 指定したPixelFormatに適合するMatのチャンネル数を返す + /// + /// + /// + internal static int GetOptimumChannels(PixelFormat f) + { + if (optimumChannels.TryGetValue(f, out var ret)) + return ret; + throw new ArgumentException("Not supported PixelFormat"); + } + + /// + /// 指定したPixelFormatに適合するMatTypeを返す + /// + /// + /// + internal static MatType GetOptimumType(PixelFormat f) + { + if (optimumTypes.TryGetValue(f, out var ret)) + return ret; + throw new ArgumentException("Not supported PixelFormat"); + } + + /// + /// 指定したMatのビット深度・チャンネル数に適合するPixelFormatを返す + /// + /// + /// + private static PixelFormat GetOptimumPixelFormats(MatType type) + { + if (type == MatType.CV_8UC1 || type == MatType.CV_8SC1) + return PixelFormats.Gray8; + if (type == MatType.CV_8UC3 || type == MatType.CV_8SC3) + return PixelFormats.Bgr24; + if (type == MatType.CV_8UC4 || type == MatType.CV_8SC4) + return PixelFormats.Bgra32; + + if (type == MatType.CV_16UC1 || type == MatType.CV_16SC1) + return PixelFormats.Gray16; + if (type == MatType.CV_16UC3 || type == MatType.CV_16SC3) + return PixelFormats.Rgb48; + if (type == MatType.CV_16UC4 || type == MatType.CV_16SC4) + return PixelFormats.Rgba64; + + if (type == MatType.CV_32SC4) + return PixelFormats.Prgba64; + + if (type == MatType.CV_32FC1) + return PixelFormats.Gray32Float; + if (type == MatType.CV_32FC3) + return PixelFormats.Rgb128Float; + if (type == MatType.CV_32FC4) + return PixelFormats.Rgba128Float; + + throw new ArgumentOutOfRangeException(nameof(type), "Not supported MatType"); + } + + /// + /// BGR -> RGB + /// + /// + /// + private static Mat SwapChannelsIfNeeded(Mat src) + { + var type = src.Type(); + if (type == MatType.CV_16UC3 || type == MatType.CV_16SC3) // PixelFormats.Rgb48 + { + var dst = new Mat(); + Cv2.CvtColor(src, dst, ColorConversionCodes.BGR2RGB); + return dst; + } + if (type == MatType.CV_16UC4 || type == MatType.CV_16SC4) // PixelFormats.Rgba64 + { + var dst = new Mat(); + Cv2.CvtColor(src, dst, ColorConversionCodes.BGRA2RGBA); + return dst; + } + return src; + } + + #region ToWriteableBitmap + + /// + /// Converts Mat to WriteableBitmap. + /// The arguments of this method corresponds the consructor of WriteableBitmap. + /// + /// Input Mat + /// Horizontal dots per inch + /// Vertical dots per inch + /// Pixel format of output WriteableBitmap + /// Bitmap palette + /// WriteableBitmap + public static WriteableBitmap ToWriteableBitmap(this Mat src, double dpiX, double dpiY, PixelFormat pf, + BitmapPalette? bp) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var wb = new WriteableBitmap(src.Width, src.Height, dpiX, dpiY, pf, bp); + ToWriteableBitmap(src, wb); + return wb; + } + + /// + /// Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) + /// + /// Input Mat + /// Pixel format of output WriteableBitmap + /// WriteableBitmap + public static WriteableBitmap ToWriteableBitmap(this Mat src, PixelFormat pf) + { + return ToWriteableBitmap(src, 96, 96, pf, null); + } + + /// + /// Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) + /// + /// Input Mat + /// WriteableBitmap + public static WriteableBitmap ToWriteableBitmap(this Mat src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + PixelFormat pf = GetOptimumPixelFormats(src.Type()); + Mat swappedMat = SwapChannelsIfNeeded(src); + try + { + return ToWriteableBitmap(swappedMat, 96, 96, pf, null); + } + finally + { + if (src != swappedMat) + swappedMat.Dispose(); + } + } + + /// + /// Converts Mat to WriteableBitmap. + /// This method is more efficient because new instance of WriteableBitmap is not allocated. + /// + /// Input Mat + /// Output WriteableBitmap + public static void ToWriteableBitmap(Mat src, WriteableBitmap dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (src.Width != dst.PixelWidth || src.Height != dst.PixelHeight) + throw new ArgumentException("size of src must be equal to size of dst"); + //if (src.Depth != BitDepth.U8) + //throw new ArgumentException("bit depth of src must be BitDepth.U8", "src"); + if (src.Dims > 2) + throw new ArgumentException("Mat dimensions must be 2"); + + int w = src.Width; + int h = src.Height; + int bpp = dst.Format.BitsPerPixel; + + int channels = GetOptimumChannels(dst.Format); + if (src.Channels() != channels) + { + throw new ArgumentException("channels of dst != channels of PixelFormat", nameof(dst)); + } + + bool submat = src.IsSubmatrix(); + bool continuous = src.IsContinuous(); + unsafe + { + byte* pSrc = (byte*)(src.Data); + int srcStep = (int)src.Step(); + + if (bpp == 1) + { + if (submat) + throw new NotImplementedException("submatrix not supported"); + + // 手作業で移し替える + int stride = w / 8 + 1; + if (stride < 2) + stride = 2; + + byte[] pixels = new byte[h * stride]; + + for (int x = 0, y = 0; y < h; y++) + { + int offset = y * stride; + for (int bytePos = 0; bytePos < stride; bytePos++) + { + if (x < w) + { + byte b = 0; + // 現在の位置から横8ピクセル分、ビットがそれぞれ立っているか調べ、1つのbyteにまとめる + for (int i = 0; i < 8; i++) + { + b <<= 1; + if (x < w && pSrc[srcStep * y + x] != 0) + { + b |= 1; + } + x++; + } + pixels[offset + bytePos] = b; + } + } + x = 0; + } + dst.WritePixels(new Int32Rect(0, 0, w, h), pixels, stride, 0); + return; + } + + // 一気にコピー + if (!submat && continuous) + { + long imageSize = src.DataEnd.ToInt64() - src.Data.ToInt64(); + if (imageSize < 0) + throw new OpenCvSharpException("The mat has invalid data pointer"); + if (imageSize > int.MaxValue) + throw new OpenCvSharpException("Too big mat data"); + dst.WritePixels(new Int32Rect(0, 0, w, h), src.Data, (int)imageSize, srcStep); + return; + } + + // 一列ごとにコピー + try + { + dst.Lock(); + dst.AddDirtyRect(new Int32Rect(0, 0, dst.PixelWidth, dst.PixelHeight)); + + int dstStep = dst.BackBufferStride; + byte* pDst = (byte*)dst.BackBuffer; + + for (int y = 0; y < h; y++) + { + long offsetSrc = (y * srcStep); + long offsetDst = (y * dstStep); + long bytesInCopy = w * channels; + Buffer.MemoryCopy(pSrc + offsetSrc, pDst + offsetDst, bytesInCopy, bytesInCopy); + } + } + finally + { + dst.Unlock(); + } + } + } + + #endregion + + #region ToMat + + // https://github.com/shimat/opencvsharp_2410/blob/master/src/OpenCvSharp.Extensions/WriteableBitmapConverter_IplImage.cs#L167 + + /// + /// Converts WriteableBitmap to IplImage + /// + /// Input WriteableBitmap + /// IplImage + public static Mat ToMat(this WriteableBitmap src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var w = src.PixelWidth; + var h = src.PixelHeight; + var matType = GetOptimumType(src.Format); + var dst = new Mat(new Size(w, h), matType); + ToMat(src, dst); + return dst; + } + + /// + /// Converts WriteableBitmap to Mat + /// + /// Input WriteableBitmap + /// Output Mat + public static void ToMat(this WriteableBitmap src, Mat dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (src.PixelWidth != dst.Width || src.PixelHeight != dst.Height) + throw new ArgumentException("size of src must be equal to size of dst"); + //if (dst.Depth != BitDepth.U8) + // throw new ArgumentException("bit depth of dst must be BitDepth.U8", "dst"); + + int w = src.PixelWidth; + int h = src.PixelHeight; + int bpp = src.Format.BitsPerPixel; + int channels = GetOptimumChannels(src.Format); + if (dst.Channels() != channels) + throw new ArgumentException("nChannels of dst is invalid", nameof(dst)); + + unsafe + { + byte* p = (byte*)dst.Data.ToPointer(); + int widthStep = (int)dst.Step(); + + // 1bppは手作業でコピー + if (bpp == 1) + { + // BitmapImageのデータを配列にコピー + // 要素1つに横8ピクセル分のデータが入っている。 + int stride = (w / 8) + 1; + byte[] pixels = new byte[h * stride]; + src.CopyPixels(pixels, stride, 0); + + int x = 0; + for (int y = 0; y < h; y++) + { + int offset = y * stride; + // この行の各バイトを調べていく + for (int bytePos = 0; bytePos < stride; bytePos++) + { + if (x < w) + { + // 現在の位置のバイトからそれぞれのビット8つを取り出す + byte b = pixels[offset + bytePos]; + for (int i = 0; i < 8; i++) + { + if (x >= w) + { + break; + } + // IplImageは8bit/pixel + p[widthStep * y + x] = ((b & 0x80) == 0x80) ? (byte)255 : (byte)0; + b <<= 1; + x++; + } + } + } + // 次の行へ + x = 0; + } + + } + // 8bpp + else if (bpp == 8) + { + int stride = w; + byte[] pixels = new byte[h * stride]; + src.CopyPixels(pixels, stride, 0); + for (int y = 0; y < h; y++) + { + for (int x = 0; x < w; x++) + { + p[widthStep * y + x] = pixels[y * stride + x]; + } + } + } + // 24bpp, 32bpp, ... + else + { + int stride = w * ((bpp + 7) / 8); + src.CopyPixels(Int32Rect.Empty, dst.Data, (int)(dst.Step() * dst.Rows), stride); + } + } + } + + #endregion +} +#endif diff --git a/src/OpenCvSharp/Cv2/Cv2.cs b/src/OpenCvSharp/Cv2/Cv2.cs index d7b284b8c..86b30c1e5 100644 --- a/src/OpenCvSharp/Cv2/Cv2.cs +++ b/src/OpenCvSharp/Cv2/Cv2.cs @@ -1,34 +1,36 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; + // ReSharper disable InconsistentNaming -namespace OpenCvSharp +namespace OpenCvSharp; + +/// +/// OpenCV Functions of C++ I/F (cv::xxx) +/// +public static partial class Cv2 { /// - /// OpenCV Functions of C++ I/F (cv::xxx) + /// The ratio of a circle's circumference to its diameter /// - public static partial class Cv2 - { - /// - /// The ratio of a circle's circumference to its diameter - /// - public const double PI = 3.1415926535897932384626433832795; + public const double PI = 3.1415926535897932384626433832795; - /// - /// - /// - public const double LOG2 = 0.69314718055994530941723212145818; + /// + /// + /// + public const double LOG2 = 0.69314718055994530941723212145818; - /// - /// 引数がnullの時はIntPtr.Zeroに変換する - /// - /// - /// - internal static IntPtr ToPtr(ICvPtrHolder obj) - { - return obj?.CvPtr ?? IntPtr.Zero; - } + /// + /// + /// + public const int FILLED = -1; + + /// + /// 引数がnullの時はIntPtr.Zeroに変換する + /// + /// + /// + internal static IntPtr ToPtr(ICvPtrHolder? obj) + { + return obj?.CvPtr ?? IntPtr.Zero; } } diff --git a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs index 51e5450b8..53eab1921 100644 --- a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs +++ b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs @@ -1,2574 +1,4552 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo +// ReSharper disable UnusedMember.Global +using FeatureDetector = Feature2D; + +static partial class Cv2 { - // ReSharper disable InconsistentNaming + /// + /// converts rotation vector to rotation matrix or vice versa using Rodrigues transformation + /// + /// Input rotation vector (3x1 or 1x3) or rotation matrix (3x3). + /// Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively. + /// Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial derivatives of the output array components with respect to the input array components. + public static void Rodrigues(InputArray src, OutputArray dst, OutputArray? jacobian = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_Rodrigues(src.CvPtr, dst.CvPtr, ToPtr(jacobian))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(jacobian); + dst.Fix(); + jacobian?.Fix(); + } - using FeatureDetector = Feature2D; + /// + /// converts rotation vector to rotation matrix using Rodrigues transformation + /// + /// Input rotation vector (3x1). + /// Output rotation matrix (3x3). + /// Optional output Jacobian matrix, 3x9, which is a matrix of partial derivatives of the output array components with respect to the input array components. + public static void Rodrigues(double[] vector, out double[,] matrix, out double[,] jacobian) + { + if (vector is null) + throw new ArgumentNullException(nameof(vector)); + if (vector.Length != 3) + throw new ArgumentException("Length != 3", nameof(vector)); + + using var vectorM = Mat.FromPixelData(3, 1, MatType.CV_64FC1, vector); + using var matrixM = new Mat(); + using var jacobianM = new Mat(); + using var vectorInputArray = InputArray.Create(vectorM); + using var matrixOutputArray = OutputArray.Create(matrixM); + using var jacobianOutputArray = OutputArray.Create(jacobianM); + Rodrigues(vectorInputArray, matrixOutputArray, jacobianOutputArray); + matrix = matrixM.ToRectangularArray(); + jacobian = jacobianM.ToRectangularArray(); + } - static partial class Cv2 + /// + /// converts rotation matrix to rotation vector using Rodrigues transformation + /// + /// Input rotation matrix (3x3). + /// Output rotation vector (3x1). + /// Optional output Jacobian matrix, 3x9, which is a matrix of partial derivatives of the output array components with respect to the input array components. + public static void Rodrigues(double[,] matrix, out double[] vector, out double[,] jacobian) { - #region Rodrigues - /// - /// converts rotation vector to rotation matrix or vice versa using Rodrigues transformation - /// - /// Input rotation vector (3x1 or 1x3) or rotation matrix (3x3). - /// Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively. - /// Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial derivatives of the output array components with respect to the input array components. - public static void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian = null) + if (matrix is null) + throw new ArgumentNullException(nameof(matrix)); + if (matrix.GetLength(0) != 3 || matrix.GetLength(1) != 3) + throw new ArgumentException("matrix must be double[3,3]"); + + using var matrixM = Mat.FromPixelData(3, 3, MatType.CV_64FC1, matrix); + using var vectorM = new Mat(); + using var jacobianM = new Mat(); + using var matrixOutputArray = InputArray.Create(matrixM); + using var vectorInputArray = OutputArray.Create(vectorM); + using var jacobianOutputArray = OutputArray.Create(jacobianM); + Rodrigues(matrixOutputArray, vectorInputArray, jacobianOutputArray); + vector = vectorM.ToArray(); + jacobian = jacobianM.ToRectangularArray(); + } + + /// + /// computes the best-fit perspective transformation mapping srcPoints to dstPoints. + /// + /// Coordinates of the points in the original plane, a matrix of the type CV_32FC2 + /// Coordinates of the points in the target plane, a matrix of the type CV_32FC2 + /// Method used to computed a homography matrix. + /// Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only) + /// Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored. + /// The maximum number of RANSAC iterations. + /// Confidence level, between 0 and 1. + /// + public static Mat FindHomography( + InputArray srcPoints, + InputArray dstPoints, + HomographyMethods method = HomographyMethods.None, + double ransacReprojThreshold = 3, + OutputArray? mask = null, + int maxIters = 2000, + double confidence = 0.995) + { + if (srcPoints is null) + throw new ArgumentNullException(nameof(srcPoints)); + if (dstPoints is null) + throw new ArgumentNullException(nameof(dstPoints)); + srcPoints.ThrowIfDisposed(); + dstPoints.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findHomography_InputArray( + srcPoints.CvPtr, dstPoints.CvPtr, (int)method, + ransacReprojThreshold, ToPtr(mask), maxIters, confidence, + out var ret)); + + GC.KeepAlive(srcPoints); + GC.KeepAlive(dstPoints); + GC.KeepAlive(mask); + mask?.Fix(); + return new Mat(ret); + } + + /// + /// computes the best-fit perspective transformation mapping srcPoints to dstPoints. + /// + /// Coordinates of the points in the original plane + /// Coordinates of the points in the target plane + /// Method used to computed a homography matrix. + /// Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only) + /// Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored. + /// The maximum number of RANSAC iterations. + /// Confidence level, between 0 and 1. + /// + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Mat FindHomography( + IEnumerable srcPoints, + IEnumerable dstPoints, + HomographyMethods method = HomographyMethods.None, + double ransacReprojThreshold = 3, + OutputArray? mask = null, + int maxIters = 2000, + double confidence = 0.995) + { + if (srcPoints is null) + throw new ArgumentNullException(nameof(srcPoints)); + if (dstPoints is null) + throw new ArgumentNullException(nameof(dstPoints)); + + var srcPointsArray = srcPoints as Point2d[] ?? srcPoints.ToArray(); + var dstPointsArray = dstPoints as Point2d[] ?? dstPoints.ToArray(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findHomography_vector( + srcPointsArray, srcPointsArray.Length, + dstPointsArray, dstPointsArray.Length, + (int)method, ransacReprojThreshold, ToPtr(mask), maxIters, confidence, + out var ret)); + + GC.KeepAlive(mask); + mask?.Fix(); + return new Mat(ret); + } + + /// + /// computes the best-fit perspective transformation mapping srcPoints to dstPoints. + /// + /// Coordinates of the points in the original plane, a matrix of the type CV_32FC2 + /// Coordinates of the points in the target plane, a matrix of the type CV_32FC2 + /// Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored. + /// + /// + /// + public static Mat FindHomography( + InputArray srcPoints, + InputArray dstPoints, + OutputArray mask, + UsacParams? @params) + { + if (srcPoints is null) + throw new ArgumentNullException(nameof(srcPoints)); + if (dstPoints is null) + throw new ArgumentNullException(nameof(dstPoints)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + srcPoints.ThrowIfDisposed(); + dstPoints.ThrowIfDisposed(); + mask.ThrowIfNotReady(); + + var p = (@params ?? new UsacParams()).ToNativeStruct(); + NativeMethods.HandleException( + NativeMethods.calib3d_findHomography_UsacParams( + srcPoints.CvPtr, dstPoints.CvPtr, ToPtr(mask), ref p, + out var ret)); + + GC.KeepAlive(srcPoints); + GC.KeepAlive(dstPoints); + GC.KeepAlive(mask); + mask.Fix(); + return new Mat(ret); + } + + /// + /// Computes RQ decomposition of 3x3 matrix + /// + /// 3x3 input matrix. + /// Output 3x3 upper-triangular matrix. + /// Output 3x3 orthogonal matrix. + /// Optional output 3x3 rotation matrix around x-axis. + /// Optional output 3x3 rotation matrix around y-axis. + /// Optional output 3x3 rotation matrix around z-axis. + /// + public static Vec3d RQDecomp3x3(InputArray src, OutputArray mtxR, OutputArray mtxQ, + OutputArray? qx = null, OutputArray? qy = null, OutputArray? qz = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (mtxR is null) + throw new ArgumentNullException(nameof(mtxR)); + if (mtxQ is null) + throw new ArgumentNullException(nameof(mtxQ)); + src.ThrowIfDisposed(); + mtxR.ThrowIfNotReady(); + mtxQ.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_RQDecomp3x3_InputArray( + src.CvPtr, mtxR.CvPtr, mtxQ.CvPtr, + ToPtr(qx), ToPtr(qy), ToPtr(qz), out var ret)); + + GC.KeepAlive(src); + GC.KeepAlive(mtxR); + GC.KeepAlive(mtxQ); + qx?.Fix(); + qy?.Fix(); + qz?.Fix(); + return ret; + } + + /// + /// Computes RQ decomposition of 3x3 matrix + /// + /// 3x3 input matrix. + /// Output 3x3 upper-triangular matrix. + /// Output 3x3 orthogonal matrix. + /// + public static Vec3d RQDecomp3x3(double[,] src, out double[,] mtxR, out double[,] mtxQ) + { + return RQDecomp3x3(src, out mtxR, out mtxQ, out _, out _, out _); + } + + /// + /// Computes RQ decomposition of 3x3 matrix + /// + /// 3x3 input matrix. + /// Output 3x3 upper-triangular matrix. + /// Output 3x3 orthogonal matrix. + /// Optional output 3x3 rotation matrix around x-axis. + /// Optional output 3x3 rotation matrix around y-axis. + /// Optional output 3x3 rotation matrix around z-axis. + /// + public static Vec3d RQDecomp3x3(double[,] src, out double[,] mtxR, out double[,] mtxQ, + out double[,] qx, out double[,] qy, out double[,] qz) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (src.GetLength(0) != 3 || src.GetLength(1) != 3) + throw new ArgumentException("src must be double[3,3]"); + + using var srcM = Mat.FromPixelData(3, 3, MatType.CV_64FC1, src); + using var mtxRM = new Mat(); + using var mtxQM = new Mat(); + using var qxM = new Mat(); + using var qyM = new Mat(); + using var qzM = new Mat(); + NativeMethods.HandleException( + NativeMethods.calib3d_RQDecomp3x3_Mat( + srcM.CvPtr, mtxRM.CvPtr, mtxQM.CvPtr, qxM.CvPtr, qyM.CvPtr, qzM.CvPtr, + out var ret)); + mtxR = mtxRM.ToRectangularArray(); + mtxQ = mtxQM.ToRectangularArray(); + qx = qxM.ToRectangularArray(); + qy = qyM.ToRectangularArray(); + qz = qzM.ToRectangularArray(); + return ret; + } + + /// + /// Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector + /// + /// 3x4 input projection matrix P. + /// Output 3x3 camera matrix K. + /// Output 3x3 external rotation matrix R. + /// Output 4x1 translation vector T. + /// Optional 3x3 rotation matrix around x-axis. + /// Optional 3x3 rotation matrix around y-axis. + /// Optional 3x3 rotation matrix around z-axis. + /// ptional three-element vector containing three Euler angles of rotation in degrees. + public static void DecomposeProjectionMatrix( + InputArray projMatrix, + OutputArray cameraMatrix, + OutputArray rotMatrix, + OutputArray transVect, + OutputArray? rotMatrixX = null, + OutputArray? rotMatrixY = null, + OutputArray? rotMatrixZ = null, + OutputArray? eulerAngles = null) + { + if (projMatrix is null) + throw new ArgumentNullException(nameof(projMatrix)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (rotMatrix is null) + throw new ArgumentNullException(nameof(rotMatrix)); + if (transVect is null) + throw new ArgumentNullException(nameof(transVect)); + projMatrix.ThrowIfDisposed(); + cameraMatrix.ThrowIfNotReady(); + rotMatrix.ThrowIfNotReady(); + transVect.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_decomposeProjectionMatrix_InputArray( + projMatrix.CvPtr, cameraMatrix.CvPtr, rotMatrix.CvPtr, transVect.CvPtr, + ToPtr(rotMatrixX), ToPtr(rotMatrixY), ToPtr(rotMatrixZ), ToPtr(eulerAngles))); + + GC.KeepAlive(projMatrix); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(rotMatrix); + GC.KeepAlive(transVect); + GC.KeepAlive(rotMatrixX); + GC.KeepAlive(rotMatrixY); + GC.KeepAlive(rotMatrixZ); + GC.KeepAlive(eulerAngles); + + cameraMatrix.Fix(); + rotMatrix.Fix(); + transVect.Fix(); + rotMatrixX?.Fix(); + rotMatrixY?.Fix(); + rotMatrixZ?.Fix(); + eulerAngles?.Fix(); + } + + /// + /// Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector + /// + /// 3x4 input projection matrix P. + /// Output 3x3 camera matrix K. + /// Output 3x3 external rotation matrix R. + /// Output 4x1 translation vector T. + /// Optional 3x3 rotation matrix around x-axis. + /// Optional 3x3 rotation matrix around y-axis. + /// Optional 3x3 rotation matrix around z-axis. + /// ptional three-element vector containing three Euler angles of rotation in degrees. + public static void DecomposeProjectionMatrix( + double[,] projMatrix, + out double[,] cameraMatrix, + out double[,] rotMatrix, + out double[] transVect, + out double[,] rotMatrixX, + out double[,] rotMatrixY, + out double[,] rotMatrixZ, + out double[] eulerAngles) + { + if (projMatrix is null) + throw new ArgumentNullException(nameof(projMatrix)); + var dim0 = projMatrix.GetLength(0); + var dim1 = projMatrix.GetLength(1); + if (!((dim0 == 3 && dim1 == 4) || (dim0 == 4 && dim1 == 3))) + throw new ArgumentException("projMatrix must be double[3,4] or double[4,3]"); + + using var projMatrixM = Mat.FromPixelData(3, 4, MatType.CV_64FC1, projMatrix); + using var cameraMatrixM = new Mat(); + using var rotMatrixM = new Mat(); + using var transVectM = new Mat(); + using var rotMatrixXM = new Mat(); + using var rotMatrixYM = new Mat(); + using var rotMatrixZM = new Mat(); + using var eulerAnglesM = new Mat(); + NativeMethods.HandleException( + NativeMethods.calib3d_decomposeProjectionMatrix_Mat( + projMatrixM.CvPtr, + cameraMatrixM.CvPtr, rotMatrixM.CvPtr, transVectM.CvPtr, + rotMatrixXM.CvPtr, rotMatrixYM.CvPtr, rotMatrixZM.CvPtr, + eulerAnglesM.CvPtr)); + + cameraMatrix = cameraMatrixM.ToRectangularArray(); + rotMatrix = rotMatrixM.ToRectangularArray(); + transVect = transVectM.ToArray(); + rotMatrixX = rotMatrixXM.ToRectangularArray(); + rotMatrixY = rotMatrixYM.ToRectangularArray(); + rotMatrixZ = rotMatrixZM.ToRectangularArray(); + eulerAngles = eulerAnglesM.ToArray(); + } + + /// + /// Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector + /// + /// 3x4 input projection matrix P. + /// Output 3x3 camera matrix K. + /// Output 3x3 external rotation matrix R. + /// Output 4x1 translation vector T. + public static void DecomposeProjectionMatrix(double[,] projMatrix, + out double[,] cameraMatrix, + out double[,] rotMatrix, + out double[] transVect) + { + DecomposeProjectionMatrix(projMatrix, out cameraMatrix, out rotMatrix, out transVect, + out _, out _, out _, out _); + } + + /// + /// computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients + /// + /// First multiplied matrix. + /// Second multiplied matrix. + /// First output derivative matrix d(A*B)/dA of size A.rows*B.cols X A.rows*A.cols . + /// Second output derivative matrix d(A*B)/dB of size A.rows*B.cols X B.rows*B.cols . + public static void MatMulDeriv( + InputArray a, InputArray b, + OutputArray dABdA, OutputArray dABdB) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + if (dABdA is null) + throw new ArgumentNullException(nameof(dABdA)); + if (dABdB is null) + throw new ArgumentNullException(nameof(dABdB)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + dABdA.ThrowIfNotReady(); + dABdB.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.calib3d_matMulDeriv(a.CvPtr, b.CvPtr, dABdA.CvPtr, dABdB.CvPtr)); + GC.KeepAlive(a); + GC.KeepAlive(b); + dABdA.Fix(); + dABdB.Fix(); + } + + /// + /// composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments + /// + /// First rotation vector. + /// First translation vector. + /// Second rotation vector. + /// Second translation vector. + /// Output rotation vector of the superposition. + /// Output translation vector of the superposition. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + public static void ComposeRT( + InputArray rvec1, InputArray tvec1, + InputArray rvec2, InputArray tvec2, + OutputArray rvec3, OutputArray tvec3, + OutputArray? dr3dr1 = null, OutputArray? dr3dt1 = null, + OutputArray? dr3dr2 = null, OutputArray? dr3dt2 = null, + OutputArray? dt3dr1 = null, OutputArray? dt3dt1 = null, + OutputArray? dt3dr2 = null, OutputArray? dt3dt2 = null) + { + if (rvec1 is null) + throw new ArgumentNullException(nameof(rvec1)); + if (tvec1 is null) + throw new ArgumentNullException(nameof(tvec1)); + if (rvec2 is null) + throw new ArgumentNullException(nameof(rvec2)); + if (tvec2 is null) + throw new ArgumentNullException(nameof(tvec2)); + if (rvec3 is null) + throw new ArgumentNullException(nameof(rvec3)); + if (tvec3 is null) + throw new ArgumentNullException(nameof(tvec3)); + rvec1.ThrowIfDisposed(); + tvec1.ThrowIfDisposed(); + rvec2.ThrowIfDisposed(); + tvec2.ThrowIfDisposed(); + rvec3.ThrowIfNotReady(); + tvec3.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_composeRT_InputArray( + rvec1.CvPtr, tvec1.CvPtr, rvec2.CvPtr, tvec2.CvPtr, rvec3.CvPtr, tvec3.CvPtr, + ToPtr(dr3dr1), ToPtr(dr3dt1), ToPtr(dr3dr2), ToPtr(dr3dt2), + ToPtr(dt3dr1), ToPtr(dt3dt1), ToPtr(dt3dr2), ToPtr(dt3dt2))); + + GC.KeepAlive(rvec1); + GC.KeepAlive(tvec1); + GC.KeepAlive(rvec2); + GC.KeepAlive(tvec2); + GC.KeepAlive(rvec3); + GC.KeepAlive(tvec3); + GC.KeepAlive(dr3dr1); + GC.KeepAlive(dr3dt1); + GC.KeepAlive(dr3dr2); + GC.KeepAlive(dr3dt2); + GC.KeepAlive(dt3dr1); + GC.KeepAlive(dt3dt1); + GC.KeepAlive(dt3dr2); + GC.KeepAlive(dt3dt2); + } + + /// + /// composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments + /// + /// First rotation vector. + /// First translation vector. + /// Second rotation vector. + /// Second translation vector. + /// Output rotation vector of the superposition. + /// Output translation vector of the superposition. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. + public static void ComposeRT( + double[] rvec1, double[] tvec1, + double[] rvec2, double[] tvec2, + out double[] rvec3, out double[] tvec3, + out double[,] dr3dr1, out double[,] dr3dt1, + out double[,] dr3dr2, out double[,] dr3dt2, + out double[,] dt3dr1, out double[,] dt3dt1, + out double[,] dt3dr2, out double[,] dt3dt2) + { + if (rvec1 is null) + throw new ArgumentNullException(nameof(rvec1)); + if (tvec1 is null) + throw new ArgumentNullException(nameof(tvec1)); + if (rvec2 is null) + throw new ArgumentNullException(nameof(rvec2)); + if (tvec2 is null) + throw new ArgumentNullException(nameof(tvec2)); + + using var rvec1M = Mat.FromPixelData(3, 1, MatType.CV_64FC1, rvec1); + using var tvec1M = Mat.FromPixelData(3, 1, MatType.CV_64FC1, tvec1); + using var rvec2M = Mat.FromPixelData(3, 1, MatType.CV_64FC1, rvec2); + using var tvec2M = Mat.FromPixelData(3, 1, MatType.CV_64FC1, tvec2); + using var rvec3M = new Mat(); + using var tvec3M = new Mat(); + using var dr3dr1M = new Mat(); + using var dr3dt1M = new Mat(); + using var dr3dr2M = new Mat(); + using var dr3dt2M = new Mat(); + using var dt3dr1M = new Mat(); + using var dt3dt1M = new Mat(); + using var dt3dr2M = new Mat(); + using var dt3dt2M = new Mat(); + + NativeMethods.HandleException( + NativeMethods.calib3d_composeRT_Mat( + rvec1M.CvPtr, tvec1M.CvPtr, rvec2M.CvPtr, tvec2M.CvPtr, + rvec3M.CvPtr, tvec3M.CvPtr, + dr3dr1M.CvPtr, dr3dt1M.CvPtr, dr3dr2M.CvPtr, dr3dt2M.CvPtr, + dt3dr1M.CvPtr, dt3dt1M.CvPtr, dt3dr2M.CvPtr, dt3dt2M.CvPtr)); + + rvec3 = rvec3M.ToArray(); + tvec3 = tvec3M.ToArray(); + dr3dr1 = dr3dr1M.ToRectangularArray(); + dr3dt1 = dr3dt1M.ToRectangularArray(); + dr3dr2 = dr3dr2M.ToRectangularArray(); + dr3dt2 = dr3dt2M.ToRectangularArray(); + dt3dr1 = dt3dr1M.ToRectangularArray(); + dt3dt1 = dt3dt1M.ToRectangularArray(); + dt3dr2 = dt3dr2M.ToRectangularArray(); + dt3dt2 = dt3dt2M.ToRectangularArray(); + } + + /// + /// composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments + /// + /// First rotation vector. + /// First translation vector. + /// Second rotation vector. + /// Second translation vector. + /// Output rotation vector of the superposition. + /// Output translation vector of the superposition. + public static void ComposeRT(double[] rvec1, double[] tvec1, + double[] rvec2, double[] tvec2, + out double[] rvec3, out double[] tvec3) + { + ComposeRT(rvec1, tvec1, rvec2, tvec2, out rvec3, out tvec3, + out _, out _, out _, out _, + out _, out _, out _, out _); + } + + /// + /// projects points from the model coordinate space to the image coordinates. + /// Also computes derivatives of the image coordinates w.r.t the intrinsic + /// and extrinsic camera parameters + /// + /// Array of object points, 3xN/Nx3 1-channel or + /// 1xN/Nx1 3-channel, where N is the number of points in the view. + /// Rotation vector (3x1). + /// Translation vector (3x1). + /// Camera matrix (3x3) + /// Input vector of distortion coefficients + /// (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output array of image points, 2xN/Nx2 1-channel + /// or 1xN/Nx1 2-channel + /// Optional output 2Nx(10 + numDistCoeffs) jacobian matrix + /// of derivatives of image points with respect to components of the rotation vector, + /// translation vector, focal lengths, coordinates of the principal point and + /// the distortion coefficients. In the old interface different components of + /// the jacobian are returned via different output parameters. + /// Optional “fixed aspect ratio” parameter. + /// If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) + /// is fixed and correspondingly adjusts the jacobian matrix. + public static void ProjectPoints( + InputArray objectPoints, + InputArray rvec, + InputArray tvec, + InputArray cameraMatrix, + InputArray distCoeffs, + OutputArray imagePoints, + OutputArray? jacobian = null, + double aspectRatio = 0) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + objectPoints.ThrowIfDisposed(); + rvec.ThrowIfDisposed(); + tvec.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + imagePoints.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_projectPoints_InputArray( + objectPoints.CvPtr, + rvec.CvPtr, tvec.CvPtr, cameraMatrix.CvPtr, ToPtr(distCoeffs), + imagePoints.CvPtr, ToPtr(jacobian), aspectRatio)); + + GC.KeepAlive(objectPoints); + GC.KeepAlive(rvec); + GC.KeepAlive(tvec); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(imagePoints); + GC.KeepAlive(jacobian); + } + + /// + /// projects points from the model coordinate space to the image coordinates. + /// Also computes derivatives of the image coordinates w.r.t the intrinsic + /// and extrinsic camera parameters + /// + /// Array of object points, 3xN/Nx3 1-channel or + /// 1xN/Nx1 3-channel, where N is the number of points in the view. + /// Rotation vector (3x1). + /// Translation vector (3x1). + /// Camera matrix (3x3) + /// Input vector of distortion coefficients + /// (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output array of image points, 2xN/Nx2 1-channel + /// or 1xN/Nx1 2-channel + /// Optional output 2Nx(10 + numDistCoeffs) jacobian matrix + /// of derivatives of image points with respect to components of the rotation vector, + /// translation vector, focal lengths, coordinates of the principal point and + /// the distortion coefficients. In the old interface different components of + /// the jacobian are returned via different output parameters. + /// Optional “fixed aspect ratio” parameter. + /// If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) + /// is fixed and correspondingly adjusts the jacobian matrix. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void ProjectPoints( + IEnumerable objectPoints, + double[] rvec, double[] tvec, + double[,] cameraMatrix, double[] distCoeffs, + out Point2f[] imagePoints, + out double[,] jacobian, + double aspectRatio = 0) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (rvec.Length != 3) + throw new ArgumentException($"{nameof(rvec)}.Length != 3"); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + if (tvec.Length != 3) + throw new ArgumentException($"{nameof(tvec)}.Length != 3"); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) + throw new ArgumentException("cameraMatrix must be double[3,3]"); + + var objectPointsArray = objectPoints as Point3f[] ?? objectPoints.ToArray(); + using var objectPointsM = Mat.FromPixelData(objectPointsArray.Length, 1, MatType.CV_32FC3, objectPointsArray); + using var rvecM = Mat.FromPixelData(3, 1, MatType.CV_64FC1, rvec); + using var tvecM = Mat.FromPixelData(3, 1, MatType.CV_64FC1, tvec); + using var cameraMatrixM = Mat.FromPixelData(3, 3, MatType.CV_64FC1, cameraMatrix); + using var distCoeffsM = (distCoeffs is null) + ? new Mat() + : Mat.FromPixelData(distCoeffs.Length, 1, MatType.CV_64FC1, distCoeffs); + using var imagePointsM = new Mat(); + using var jacobianM = new Mat(); + NativeMethods.HandleException( + NativeMethods.calib3d_projectPoints_Mat( + objectPointsM.CvPtr, rvecM.CvPtr, tvecM.CvPtr, cameraMatrixM.CvPtr, distCoeffsM.CvPtr, + imagePointsM.CvPtr, jacobianM.CvPtr, aspectRatio)); + + imagePoints = imagePointsM.ToArray(); + jacobian = jacobianM.ToRectangularArray(); + } + + /// + /// Finds an object pose from 3D-2D point correspondences. + /// + /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, + /// where N is the number of points. vector<Point3f> can be also passed here. + /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, + /// where N is the number of points. vector<Point2f> can be also passed here. + /// Input camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output rotation vector that, together with tvec , brings points from the model coordinate system to the + /// camera coordinate system. + /// Output translation vector. + /// If true, the function uses the provided rvec and tvec values as initial approximations of + /// the rotation and translation vectors, respectively, and further optimizes them. + /// Method for solving a PnP problem: + public static void SolvePnP( + InputArray objectPoints, + InputArray imagePoints, + InputArray cameraMatrix, + InputArray distCoeffs, + OutputArray rvec, OutputArray tvec, + bool useExtrinsicGuess = false, + SolvePnPFlags flags = SolvePnPFlags.Iterative) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + objectPoints.ThrowIfDisposed(); + imagePoints.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + distCoeffs.ThrowIfDisposed(); + rvec.ThrowIfDisposed(); + tvec.ThrowIfDisposed(); + var distCoeffsPtr = ToPtr(distCoeffs); + + NativeMethods.HandleException(NativeMethods.calib3d_solvePnP_InputArray( + objectPoints.CvPtr, imagePoints.CvPtr, cameraMatrix.CvPtr, distCoeffsPtr, + rvec.CvPtr, tvec.CvPtr, useExtrinsicGuess ? 1 : 0, (int) flags)); + + rvec.Fix(); + tvec.Fix(); + GC.KeepAlive(objectPoints); + GC.KeepAlive(imagePoints); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + } + + /// + /// Finds an object pose from 3D-2D point correspondences. + /// + /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, + /// where N is the number of points. vector<Point3f> can be also passed here. + /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, + /// where N is the number of points. vector<Point2f> can be also passed here. + /// Input camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output rotation vector that, together with tvec , brings points from the model coordinate system to the + /// camera coordinate system. + /// Output translation vector. + /// If true, the function uses the provided rvec and tvec values as initial approximations of + /// the rotation and translation vectors, respectively, and further optimizes them. + /// Method for solving a PnP problem + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void SolvePnP( + IEnumerable objectPoints, + IEnumerable imagePoints, + double[,] cameraMatrix, + IEnumerable? distCoeffs, + ref double[] rvec, + ref double[] tvec, + bool useExtrinsicGuess = false, + SolvePnPFlags flags = SolvePnPFlags.Iterative) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) + throw new ArgumentException(""); + + var objectPointsArray = objectPoints as Point3f[] ?? objectPoints.ToArray(); + var imagePointsArray = imagePoints as Point2f[] ?? imagePoints.ToArray(); + var distCoeffsArray = distCoeffs as double[] ?? distCoeffs?.ToArray(); + + if (!useExtrinsicGuess) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.calib3d_Rodrigues(src.CvPtr, dst.CvPtr, ToPtr(jacobian)); - dst.Fix(); - if (jacobian != null) - jacobian.Fix(); + rvec = new double[3]; + tvec = new double[3]; } - /// - /// converts rotation vector to rotation matrix using Rodrigues transformation - /// - /// Input rotation vector (3x1). - /// Output rotation matrix (3x3). - /// Optional output Jacobian matrix, 3x9, which is a matrix of partial derivatives of the output array components with respect to the input array components. - public static void Rodrigues(double[] vector, out double[,] matrix, out double[,] jacobian) + unsafe { - if (vector == null) - throw new ArgumentNullException(nameof(vector)); - if (vector.Length != 3) - throw new ArgumentException("vector.Length != 3"); - - using (var vectorM = new Mat(3, 1, MatType.CV_64FC1, vector)) - using (var matrixM = new MatOfDouble()) - using (var jacobianM = new MatOfDouble()) + fixed (double* cameraMatrixPtr = cameraMatrix) { - NativeMethods.calib3d_Rodrigues_VecToMat(vectorM.CvPtr, matrixM.CvPtr, jacobianM.CvPtr); - matrix = matrixM.ToRectangularArray(); - jacobian = jacobianM.ToRectangularArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_solvePnP_vector( + objectPointsArray, objectPointsArray.Length, + imagePointsArray, imagePointsArray.Length, + cameraMatrixPtr, distCoeffsArray, distCoeffsArray?.Length ?? 0, + rvec, tvec, useExtrinsicGuess ? 1 : 0, (int) flags)); } } - /// - /// converts rotation vector to rotation matrix using Rodrigues transformation - /// - /// Input rotation vector (3x1). - /// Output rotation matrix (3x3). - public static void Rodrigues(double[] vector, out double[,] matrix) - { - double[,] jacobian; - Rodrigues(vector, out matrix, out jacobian); - } + } - /// - /// converts rotation matrix to rotation vector using Rodrigues transformation - /// - /// Input rotation matrix (3x3). - /// Output rotation vector (3x1). - /// Optional output Jacobian matrix, 3x9, which is a matrix of partial derivatives of the output array components with respect to the input array components. - public static void Rodrigues(double[,] matrix, out double[] vector, out double[,] jacobian) + /// + /// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. + /// + /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, + /// where N is the number of points. List<Point3f> can be also passed here. + /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. + /// List<Point2f> can be also passed here. + /// Input 3x3 camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output rotation vector that, together with tvec , brings points from the model coordinate system + /// to the camera coordinate system. + /// Output translation vector. + /// If true, the function uses the provided rvec and tvec values as initial approximations + /// of the rotation and translation vectors, respectively, and further optimizes them. + /// Number of iterations. + /// Inlier threshold value used by the RANSAC procedure. + /// The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier. + /// The probability that the algorithm produces a useful result. + /// Output vector that contains indices of inliers in objectPoints and imagePoints . + /// Method for solving a PnP problem + public static void SolvePnPRansac( + InputArray objectPoints, + InputArray imagePoints, + InputArray cameraMatrix, + InputArray distCoeffs, + OutputArray? rvec, + OutputArray? tvec, + bool useExtrinsicGuess = false, + int iterationsCount = 100, + float reprojectionError = 8.0f, + double confidence = 0.99, + OutputArray? inliers = null, + SolvePnPFlags flags = SolvePnPFlags.Iterative) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + objectPoints.ThrowIfDisposed(); + imagePoints.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + distCoeffs.ThrowIfDisposed(); + rvec.ThrowIfDisposed(); + tvec.ThrowIfDisposed(); + var distCoeffsPtr = ToPtr(distCoeffs); + + NativeMethods.HandleException( + NativeMethods.calib3d_solvePnPRansac_InputArray( + objectPoints.CvPtr, imagePoints.CvPtr, cameraMatrix.CvPtr, distCoeffsPtr, + rvec.CvPtr, tvec.CvPtr, useExtrinsicGuess ? 1 : 0, iterationsCount, + reprojectionError, confidence, ToPtr(inliers), (int) flags)); + + GC.KeepAlive(objectPoints); + GC.KeepAlive(imagePoints); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + rvec.Fix(); + tvec.Fix(); + inliers?.Fix(); + } + + /// + /// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. + /// + /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, + /// where N is the number of points. List<Point3f> can be also passed here. + /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. + /// List<Point2f> can be also passed here. + /// Input 3x3 camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output rotation vector that, together with tvec , brings points from the model coordinate system + /// to the camera coordinate system. + /// Output translation vector. + public static void SolvePnPRansac( + IEnumerable objectPoints, + IEnumerable imagePoints, + double[,] cameraMatrix, + IEnumerable distCoeffs, + out double[] rvec, out double[] tvec) + { + SolvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, out rvec, out tvec, out _); + } + + /// + /// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. + /// + /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, + /// where N is the number of points. List<Point3f> can be also passed here. + /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. + /// List<Point2f> can be also passed here. + /// Input 3x3 camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Output rotation vector that, together with tvec , brings points from the model coordinate system + /// to the camera coordinate system. + /// Output translation vector. + /// If true, the function uses the provided rvec and tvec values as initial approximations + /// of the rotation and translation vectors, respectively, and further optimizes them. + /// Number of iterations. + /// Inlier threshold value used by the RANSAC procedure. + /// The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier. + /// The probability that the algorithm produces a useful result. + /// Output vector that contains indices of inliers in objectPoints and imagePoints . + /// Method for solving a PnP problem + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void SolvePnPRansac( + IEnumerable objectPoints, + IEnumerable imagePoints, + double[,] cameraMatrix, + IEnumerable? distCoeffs, + out double[] rvec, + out double[] tvec, + out int[] inliers, + bool useExtrinsicGuess = false, + int iterationsCount = 100, + float reprojectionError = 8.0f, + double confidence = 0.99, + SolvePnPFlags flags = SolvePnPFlags.Iterative) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + + if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) + throw new ArgumentException($"Size of {nameof(cameraMatrix)} must be 3x3"); + + var objectPointsArray = objectPoints as Point3f[] ?? objectPoints.ToArray(); + var imagePointsArray = imagePoints as Point2f[] ?? imagePoints.ToArray(); + var distCoeffsArray = distCoeffs as double[] ?? distCoeffs?.ToArray(); + rvec = new double[3]; + tvec = new double[3]; + + using var inliersVec = new VectorOfInt32(); + unsafe { - if (matrix == null) - throw new ArgumentNullException(nameof(matrix)); - if (matrix.GetLength(0) != 3 || matrix.GetLength(1) != 3) - throw new ArgumentException("matrix must be double[3,3]"); - - using (var matrixM = new Mat(3, 3, MatType.CV_64FC1, matrix)) - using (var vectorM = new MatOfDouble()) - using (var jacobianM = new MatOfDouble()) + fixed (double* cameraMatrixPtr = cameraMatrix) { - NativeMethods.calib3d_Rodrigues_MatToVec(matrixM.CvPtr, vectorM.CvPtr, jacobianM.CvPtr); - vector = vectorM.ToArray(); - jacobian = jacobianM.ToRectangularArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_solvePnPRansac_vector( + objectPointsArray, objectPointsArray.Length, + imagePointsArray, imagePointsArray.Length, + cameraMatrixPtr, distCoeffsArray, distCoeffsArray?.Length ?? 0, + rvec, tvec, useExtrinsicGuess ? 1 : 0, iterationsCount, + reprojectionError, confidence, inliersVec.CvPtr, (int) flags)); + inliers = inliersVec.ToArray(); } } - /// - /// converts rotation matrix to rotation vector using Rodrigues transformation - /// - /// Input rotation matrix (3x3). - /// Output rotation vector (3x1). - public static void Rodrigues(double[,] matrix, out double[] vector) - { - double[,] jacobian; - Rodrigues(matrix, out vector, out jacobian); - } - #endregion - #region FindHomography - /// - /// computes the best-fit perspective transformation mapping srcPoints to dstPoints. - /// - /// Coordinates of the points in the original plane, a matrix of the type CV_32FC2 - /// Coordinates of the points in the target plane, a matrix of the type CV_32FC2 - /// Method used to computed a homography matrix. - /// Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only) - /// Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored. - /// - public static Mat FindHomography(InputArray srcPoints, InputArray dstPoints, - HomographyMethods method = HomographyMethods.None, double ransacReprojThreshold = 3, - OutputArray mask = null) - { - if (srcPoints == null) - throw new ArgumentNullException(nameof(srcPoints)); - if (dstPoints == null) - throw new ArgumentNullException(nameof(dstPoints)); - srcPoints.ThrowIfDisposed(); - dstPoints.ThrowIfDisposed(); - - IntPtr mat = NativeMethods.calib3d_findHomography_InputArray(srcPoints.CvPtr, dstPoints.CvPtr, (int)method, - ransacReprojThreshold, ToPtr(mask)); - - if (mask != null) - mask.Fix(); - return new Mat(mat); - } - /// - /// computes the best-fit perspective transformation mapping srcPoints to dstPoints. - /// - /// Coordinates of the points in the original plane - /// Coordinates of the points in the target plane - /// Method used to computed a homography matrix. - /// Maximum allowed reprojection error to treat a point pair as an inlier (used in the RANSAC method only) - /// Optional output mask set by a robust method ( CV_RANSAC or CV_LMEDS ). Note that the input mask values are ignored. - /// - public static Mat FindHomography(IEnumerable srcPoints, IEnumerable dstPoints, - HomographyMethods method = HomographyMethods.None, double ransacReprojThreshold = 3, - OutputArray mask = null) - { - if (srcPoints == null) - throw new ArgumentNullException(nameof(srcPoints)); - if (dstPoints == null) - throw new ArgumentNullException(nameof(dstPoints)); + } - Point2d[] srcPointsArray = EnumerableEx.ToArray(srcPoints); - Point2d[] dstPointsArray = EnumerableEx.ToArray(dstPoints); + /// + /// initializes camera matrix from a few 3D points and the corresponding projections. + /// + /// Vector of vectors (vector<vector<Point3d>>) of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated. + /// Vector of vectors (vector<vector<Point2d>>) of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated. + /// Image size in pixels used to initialize the principal point. + /// If it is zero or negative, both f_x and f_y are estimated independently. Otherwise, f_x = f_y * aspectRatio . + /// + public static Mat InitCameraMatrix2D( + IEnumerable objectPoints, + IEnumerable imagePoints, + Size imageSize, + double aspectRatio = 1.0) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + + var objectPointsPtrs = objectPoints.Select(x => x.CvPtr).ToArray(); + var imagePointsPtrs = imagePoints.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.calib3d_initCameraMatrix2D_Mat( + objectPointsPtrs, objectPointsPtrs.Length, + imagePointsPtrs, imagePointsPtrs.Length, imageSize, aspectRatio, + out var matPtr)); + return new Mat(matPtr); + } - IntPtr mat = NativeMethods.calib3d_findHomography_vector(srcPointsArray, srcPointsArray.Length, - dstPointsArray, dstPointsArray.Length, (int)method, ransacReprojThreshold, ToPtr(mask)); + /// + /// initializes camera matrix from a few 3D points and the corresponding projections. + /// + /// Vector of vectors of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated. + /// Vector of vectors of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated. + /// Image size in pixels used to initialize the principal point. + /// If it is zero or negative, both f_x and f_y are estimated independently. Otherwise, f_x = f_y * aspectRatio . + /// + public static Mat InitCameraMatrix2D( + IEnumerable> objectPoints, + IEnumerable> imagePoints, + Size imageSize, + double aspectRatio = 1.0) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + + using var opArray = new ArrayAddress2(objectPoints); + using var ipArray = new ArrayAddress2(imagePoints); + NativeMethods.HandleException( + NativeMethods.calib3d_initCameraMatrix2D_array( + opArray.GetPointer(), opArray.GetDim1Length(), opArray.GetDim2Lengths(), + ipArray.GetPointer(), ipArray.GetDim1Length(), ipArray.GetDim2Lengths(), + imageSize, aspectRatio, out var matPtr)); + return new Mat(matPtr); + } - if (mask != null) - mask.Fix(); - return new Mat(mat); - } - #endregion - #region RQDecomp3x3 - /// - /// Computes RQ decomposition of 3x3 matrix - /// - /// 3x3 input matrix. - /// Output 3x3 upper-triangular matrix. - /// Output 3x3 orthogonal matrix. - /// Optional output 3x3 rotation matrix around x-axis. - /// Optional output 3x3 rotation matrix around y-axis. - /// Optional output 3x3 rotation matrix around z-axis. - /// - public static Vec3d RQDecomp3x3(InputArray src, OutputArray mtxR, OutputArray mtxQ, - OutputArray qx = null, OutputArray qy = null, OutputArray qz = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (mtxR == null) - throw new ArgumentNullException(nameof(mtxR)); - if (mtxQ == null) - throw new ArgumentNullException(nameof(mtxQ)); - src.ThrowIfDisposed(); - mtxR.ThrowIfNotReady(); - mtxQ.ThrowIfNotReady(); - Vec3d ret; - NativeMethods.calib3d_RQDecomp3x3_InputArray(src.CvPtr, mtxR.CvPtr, mtxQ.CvPtr, - ToPtr(qx), ToPtr(qy), ToPtr(qz), out ret); - if (qx != null) - qx.Fix(); - if (qy != null) - qy.Fix(); - if (qz != null) - qz.Fix(); - return ret; - } + /// + /// Finds the positions of internal corners of the chessboard. + /// + /// Source chessboard view. It must be an 8-bit grayscale or color image. + /// Number of inner corners per a chessboard row and column + /// ( patternSize = Size(points_per_row,points_per_colum) = Size(columns, rows) ). + /// Output array of detected corners. + /// Various operation flags that can be zero or a combination of the ChessboardFlag values + /// The function returns true if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). + /// Otherwise, if the function fails to find all the corners or reorder them, it returns false. + public static bool FindChessboardCorners( + InputArray image, + Size patternSize, + OutputArray corners, + ChessboardFlags flags = ChessboardFlags.AdaptiveThresh | ChessboardFlags.NormalizeImage) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + image.ThrowIfDisposed(); + corners.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findChessboardCorners_InputArray( + image.CvPtr, patternSize, corners.CvPtr, (int) flags, out var ret)); + GC.KeepAlive(image); + corners.Fix(); + return ret != 0; + } + /// + /// Finds the positions of internal corners of the chessboard. + /// + /// Source chessboard view. It must be an 8-bit grayscale or color image. + /// Number of inner corners per a chessboard row and column + /// ( patternSize = Size(points_per_row,points_per_colum) = Size(columns, rows) ). + /// Output array of detected corners. + /// Various operation flags that can be zero or a combination of the ChessboardFlag values + /// The function returns true if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). + /// Otherwise, if the function fails to find all the corners or reorder them, it returns false. + public static bool FindChessboardCorners( + InputArray image, + Size patternSize, + out Point2f[] corners, + ChessboardFlags flags = ChessboardFlags.AdaptiveThresh | ChessboardFlags.NormalizeImage) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using var cornersVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.calib3d_findChessboardCorners_vector( + image.CvPtr, patternSize, cornersVec.CvPtr, (int) flags, out var ret)); + GC.KeepAlive(image); + corners = cornersVec.ToArray(); + return ret != 0; + } - /// - /// Computes RQ decomposition of 3x3 matrix - /// - /// 3x3 input matrix. - /// Output 3x3 upper-triangular matrix. - /// Output 3x3 orthogonal matrix. - /// - public static Vec3d RQDecomp3x3(double[,] src, out double[,] mtxR, out double[,] mtxQ) + /// + /// Checks whether the image contains chessboard of the specific size or not. + /// + /// + /// + /// + public static bool CheckChessboard(InputArray img, Size size) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_checkChessboard(img.CvPtr, size, out var ret)); + GC.KeepAlive(img); + return ret != 0; + } + + /// + /// Finds the positions of internal corners of the chessboard using a sector based approach. + /// + /// image Source chessboard view. It must be an 8-bit grayscale or color image. + /// Number of inner corners per a chessboard row and column + /// (patternSize = Size(points_per_row, points_per_column) = Size(columns, rows) ). + /// Output array of detected corners. + /// flags Various operation flags that can be zero or a combination of the ChessboardFlags values. + /// + public static bool FindChessboardCornersSB( + InputArray image, Size patternSize, OutputArray corners, ChessboardFlags flags = 0) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + image.ThrowIfDisposed(); + corners.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findChessboardCornersSB_OutputArray( + image.CvPtr, patternSize, corners.CvPtr, (int) flags, out var ret)); + + GC.KeepAlive(image); + GC.KeepAlive(corners); + return ret != 0; + } + + /// + /// Finds the positions of internal corners of the chessboard using a sector based approach. + /// + /// image Source chessboard view. It must be an 8-bit grayscale or color image. + /// Number of inner corners per a chessboard row and column + /// (patternSize = Size(points_per_row, points_per_column) = Size(columns, rows) ). + /// Output array of detected corners. + /// flags Various operation flags that can be zero or a combination of the ChessboardFlags values. + /// + public static bool FindChessboardCornersSB( + InputArray image, Size patternSize, out Point2f[] corners, ChessboardFlags flags = 0) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using var cornersVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.calib3d_findChessboardCornersSB_vector( + image.CvPtr, patternSize, cornersVec.CvPtr, (int) flags, out var ret)); + + corners = cornersVec.ToArray(); + GC.KeepAlive(image); + return ret != 0; + } + + /// + /// finds subpixel-accurate positions of the chessboard corners + /// + /// + /// + /// + /// + public static bool Find4QuadCornerSubpix(InputArray img, InputOutputArray corners, Size regionSize) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + img.ThrowIfDisposed(); + corners.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_find4QuadCornerSubpix_InputArray( + img.CvPtr, corners.CvPtr, regionSize, out var ret)); + GC.KeepAlive(img); + corners.Fix(); + return ret != 0; + } + /// + /// finds subpixel-accurate positions of the chessboard corners + /// + /// + /// + /// + /// + public static bool Find4QuadCornerSubpix(InputArray img, Point2f[] corners, Size regionSize) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + img.ThrowIfDisposed(); + + using var cornersVec = new VectorOfPoint2f(corners); + NativeMethods.HandleException( + NativeMethods.calib3d_find4QuadCornerSubpix_vector( + img.CvPtr, cornersVec.CvPtr, regionSize, out var ret)); + GC.KeepAlive(img); + + var newCorners = cornersVec.ToArray(); + for (var i = 0; i < corners.Length; i++) { - double[,] qx, qy, qz; - return RQDecomp3x3(src, out mtxR, out mtxQ, out qx, out qy, out qz); + corners[i] = newCorners[i]; } - /// - /// Computes RQ decomposition of 3x3 matrix - /// - /// 3x3 input matrix. - /// Output 3x3 upper-triangular matrix. - /// Output 3x3 orthogonal matrix. - /// Optional output 3x3 rotation matrix around x-axis. - /// Optional output 3x3 rotation matrix around y-axis. - /// Optional output 3x3 rotation matrix around z-axis. - /// - public static Vec3d RQDecomp3x3(double[,] src, out double[,] mtxR, out double[,] mtxQ, - out double[,] qx, out double[,] qy, out double[,] qz) + + return ret != 0; + } + + /// + /// Renders the detected chessboard corners. + /// + /// Destination image. It must be an 8-bit color image. + /// Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)). + /// Array of detected corners, the output of findChessboardCorners. + /// Parameter indicating whether the complete board was found or not. The return value of findChessboardCorners() should be passed here. + public static void DrawChessboardCorners(InputOutputArray image, Size patternSize, + InputArray corners, bool patternWasFound) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + image.ThrowIfNotReady(); + corners.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_drawChessboardCorners_InputArray( + image.CvPtr, patternSize, corners.CvPtr, patternWasFound ? 1 : 0)); + GC.KeepAlive(corners); + image.Fix(); + } + + /// + /// Renders the detected chessboard corners. + /// + /// Destination image. It must be an 8-bit color image. + /// Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)). + /// Array of detected corners, the output of findChessboardCorners. + /// Parameter indicating whether the complete board was found or not. The return value of findChessboardCorners() should be passed here. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void DrawChessboardCorners(InputOutputArray image, Size patternSize, + IEnumerable corners, bool patternWasFound) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + image.ThrowIfNotReady(); + + var cornersArray = corners as Point2f[] ?? corners.ToArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_drawChessboardCorners_array( + image.CvPtr, patternSize, cornersArray, cornersArray.Length, + patternWasFound ? 1 : 0)); + image.Fix(); + } + + /// + /// Draw axes of the world/object coordinate system from pose estimation. + /// + /// Input/output image. It must have 1 or 3 channels. The number of channels is not altered. + /// Input 3x3 floating-point matrix of camera intrinsic parameters. + /// Input vector of distortion coefficients + /// \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of + /// 4, 5, 8, 12 or 14 elements.If the vector is empty, the zero distortion coefficients are assumed. + /// Rotation vector (see @ref Rodrigues ) that, together with tvec , brings points from + /// the model coordinate system to the camera coordinate system. + /// Translation vector. + /// Length of the painted axes in the same unit than tvec (usually in meters). + /// Line thickness of the painted axes. + /// This function draws the axes of the world/object coordinate system w.r.t. to the camera frame. + /// OX is drawn in red, OY in green and OZ in blue. + public static void DrawFrameAxes( + InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs, + InputArray rvec, InputArray tvec, float length, int thickness = 3) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + image.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + distCoeffs.ThrowIfDisposed(); + rvec.ThrowIfDisposed(); + tvec.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_drawFrameAxes( + image.CvPtr, cameraMatrix.CvPtr, distCoeffs.CvPtr, rvec.CvPtr, tvec.CvPtr, length, thickness)); + + GC.KeepAlive(image); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(rvec); + GC.KeepAlive(tvec); + } + + /// + /// Finds centers in the grid of circles. + /// + /// grid view of input circles; it must be an 8-bit grayscale or color image. + /// number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ). + /// output array of detected centers. + /// various operation flags that can be one of the FindCirclesGridFlag values + /// feature detector that finds blobs like dark circles on light background. + /// + public static bool FindCirclesGrid( + InputArray image, + Size patternSize, + OutputArray centers, + FindCirclesGridFlags flags = FindCirclesGridFlags.SymmetricGrid, + FeatureDetector? blobDetector = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (centers is null) + throw new ArgumentNullException(nameof(centers)); + image.ThrowIfDisposed(); + centers.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findCirclesGrid_InputArray( + image.CvPtr, patternSize, centers.CvPtr, (int) flags, ToPtr(blobDetector), out var ret)); + GC.KeepAlive(image); + GC.KeepAlive(centers); + GC.KeepAlive(blobDetector); + centers.Fix(); + return ret != 0; + } + + /// + /// Finds centers in the grid of circles. + /// + /// grid view of input circles; it must be an 8-bit grayscale or color image. + /// number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ). + /// output array of detected centers. + /// various operation flags that can be one of the FindCirclesGridFlag values + /// feature detector that finds blobs like dark circles on light background. + /// + public static bool FindCirclesGrid( + InputArray image, + Size patternSize, + out Point2f[] centers, + FindCirclesGridFlags flags = FindCirclesGridFlags.SymmetricGrid, + FeatureDetector? blobDetector = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using var centersVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.calib3d_findCirclesGrid_vector( + image.CvPtr, patternSize, centersVec.CvPtr, (int) flags, ToPtr(blobDetector), out var ret)); + GC.KeepAlive(image); + GC.KeepAlive(blobDetector); + centers = centersVec.ToArray(); + return ret != 0; + } + + /// + /// finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern. + /// + /// In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. + /// The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and + /// it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns + /// in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, + /// if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. + /// In the old interface all the vectors of object points from different views are concatenated together. + /// In the new interface it is a vector of vectors of the projections of calibration pattern points. + /// imagePoints.Count() and objectPoints.Count() and imagePoints[i].Count() must be equal to objectPoints[i].Count() for each i. + /// Size of the image used only to initialize the intrinsic camera matrix. + /// Output 3x3 floating-point camera matrix. + /// If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be + /// initialized before calling the function. + /// Output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// Output vector of rotation vectors (see Rodrigues() ) estimated for each pattern view. That is, each k-th rotation vector + /// together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern + /// from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the + /// calibration pattern in the k-th pattern view (k=0.. M -1) + /// Output vector of translation vectors estimated for each pattern view. + /// Different flags that may be zero or a combination of the CalibrationFlag values + /// Termination criteria for the iterative optimization algorithm. + /// Root mean square (RMS) re-projection error. A value below 1.0 is generally considered acceptable for a good calibration. + public static double CalibrateCamera( + IEnumerable objectPoints, + IEnumerable imagePoints, + Size imageSize, + InputOutputArray cameraMatrix, + InputOutputArray distCoeffs, + out Mat[] rvecs, + out Mat[] tvecs, + CalibrationFlags flags = CalibrationFlags.None, + TermCriteria? criteria = null) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + cameraMatrix.ThrowIfNotReady(); + distCoeffs.ThrowIfNotReady(); + + var criteria0 = criteria.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, Double.Epsilon)); + + var objectPointsPtrs = objectPoints.Select(x => x.CvPtr).ToArray(); + var imagePointsPtrs = imagePoints.Select(x => x.CvPtr).ToArray(); + + using var rvecsVec = new VectorOfMat(); + using var tvecsVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.calib3d_calibrateCamera_InputArray( + objectPointsPtrs, objectPointsPtrs.Length, + imagePointsPtrs, objectPointsPtrs.Length, + imageSize, cameraMatrix.CvPtr, distCoeffs.CvPtr, + rvecsVec.CvPtr, tvecsVec.CvPtr, (int) flags, criteria0, out var ret)); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(objectPoints); + GC.KeepAlive(imagePoints); + rvecs = rvecsVec.ToArray(); + tvecs = tvecsVec.ToArray(); + + cameraMatrix.Fix(); + distCoeffs.Fix(); + return ret; + } + + /// + /// finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern. + /// + /// In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. + /// The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and + /// it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns + /// in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, + /// if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. + /// In the old interface all the vectors of object points from different views are concatenated together. + /// In the new interface it is a vector of vectors of the projections of calibration pattern points. + /// imagePoints.Count() and objectPoints.Count() and imagePoints[i].Count() must be equal to objectPoints[i].Count() for each i. + /// Size of the image used only to initialize the intrinsic camera matrix. + /// Output 3x3 floating-point camera matrix. + /// If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be + /// initialized before calling the function. + /// Output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// Output vector of rotation vectors (see Rodrigues() ) estimated for each pattern view. That is, each k-th rotation vector + /// together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern + /// from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the + /// calibration pattern in the k-th pattern view (k=0.. M -1) + /// Output vector of translation vectors estimated for each pattern view. + /// Different flags that may be zero or a combination of the CalibrationFlag values + /// Termination criteria for the iterative optimization algorithm. + /// Root mean square (RMS) re-projection error. A value below 1.0 is generally considered acceptable for a good calibration. + public static double CalibrateCamera( + IEnumerable> objectPoints, + IEnumerable> imagePoints, + Size imageSize, + double[,] cameraMatrix, + double[] distCoeffs, + out Vec3d[] rvecs, + out Vec3d[] tvecs, + CalibrationFlags flags = CalibrationFlags.None, + TermCriteria? criteria = null) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + + var criteria0 = criteria.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, Double.Epsilon)); + + using var op = new ArrayAddress2(objectPoints); + using var ip = new ArrayAddress2(imagePoints); + using var rvecsVec = new VectorOfMat(); + using var tvecsVec = new VectorOfMat(); + unsafe { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (src.GetLength(0) != 3 || src.GetLength(1) != 3) - throw new ArgumentException("src must be double[3,3]"); - - using (var srcM = new Mat(3, 3, MatType.CV_64FC1)) - using (var mtxRM = new MatOfDouble()) - using (var mtxQM = new MatOfDouble()) - using (var qxM = new MatOfDouble()) - using (var qyM = new MatOfDouble()) - using (var qzM = new MatOfDouble()) + fixed (double* cameraMatrixPtr = cameraMatrix) { - Vec3d ret; - NativeMethods.calib3d_RQDecomp3x3_Mat(srcM.CvPtr, - mtxRM.CvPtr, mtxQM.CvPtr, qxM.CvPtr, qyM.CvPtr, qzM.CvPtr, - out ret); - mtxR = mtxRM.ToRectangularArray(); - mtxQ = mtxQM.ToRectangularArray(); - qx = qxM.ToRectangularArray(); - qy = qyM.ToRectangularArray(); - qz = qzM.ToRectangularArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_calibrateCamera_vector( + op.GetPointer(), op.GetDim1Length(), op.GetDim2Lengths(), + ip.GetPointer(), ip.GetDim1Length(), ip.GetDim2Lengths(), + imageSize, cameraMatrixPtr, distCoeffs, distCoeffs.Length, + rvecsVec.CvPtr, tvecsVec.CvPtr, (int) flags, criteria0, out var ret)); + var rvecsM = rvecsVec.ToArray(); + var tvecsM = tvecsVec.ToArray(); + rvecs = rvecsM.Select(m => m.Get(0)).ToArray(); + tvecs = tvecsM.Select(m => m.Get(0)).ToArray(); return ret; } } - #endregion - #region DecomposeProjectionMatrix - /// - /// Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector - /// - /// 3x4 input projection matrix P. - /// Output 3x3 camera matrix K. - /// Output 3x3 external rotation matrix R. - /// Output 4x1 translation vector T. - /// Optional 3x3 rotation matrix around x-axis. - /// Optional 3x3 rotation matrix around y-axis. - /// Optional 3x3 rotation matrix around z-axis. - /// ptional three-element vector containing three Euler angles of rotation in degrees. - public static void DecomposeProjectionMatrix(InputArray projMatrix, - OutputArray cameraMatrix, - OutputArray rotMatrix, - OutputArray transVect, - OutputArray rotMatrixX = null, - OutputArray rotMatrixY = null, - OutputArray rotMatrixZ = null, - OutputArray eulerAngles = null) - { - if (projMatrix == null) - throw new ArgumentNullException(nameof(projMatrix)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (rotMatrix == null) - throw new ArgumentNullException(nameof(rotMatrix)); - projMatrix.ThrowIfDisposed(); - cameraMatrix.ThrowIfNotReady(); - rotMatrix.ThrowIfNotReady(); - transVect.ThrowIfNotReady(); + } - NativeMethods.calib3d_decomposeProjectionMatrix_InputArray( - projMatrix.CvPtr, cameraMatrix.CvPtr, rotMatrix.CvPtr, transVect.CvPtr, - ToPtr(rotMatrixX), ToPtr(rotMatrixY), ToPtr(rotMatrixZ), ToPtr(eulerAngles)); - - cameraMatrix.Fix(); - rotMatrix.Fix(); - transVect.Fix(); - if (rotMatrixX != null) - rotMatrixX.Fix(); - if (rotMatrixY != null) - rotMatrixY.Fix(); - if (rotMatrixZ != null) - rotMatrixZ.Fix(); - if (eulerAngles != null) - eulerAngles.Fix(); - } + /// + /// computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size. + /// + /// Input camera matrix that can be estimated by calibrateCamera() or stereoCalibrate() . + /// Input image size in pixels. + /// Physical width of the sensor. + /// Physical height of the sensor. + /// Output field of view in degrees along the horizontal sensor axis. + /// Output field of view in degrees along the vertical sensor axis. + /// Focal length of the lens in mm. + /// Principal point in pixels. + /// fy / fx + public static void CalibrationMatrixValues( + InputArray cameraMatrix, Size imageSize, + double apertureWidth, double apertureHeight, + out double fovx, out double fovy, out double focalLength, + out Point2d principalPoint, out double aspectRatio) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + cameraMatrix.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_calibrationMatrixValues_InputArray( + cameraMatrix.CvPtr, imageSize, apertureWidth, apertureHeight, + out fovx, out fovy, out focalLength, out principalPoint, out aspectRatio)); + GC.KeepAlive(cameraMatrix); + } - /// - /// Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector - /// - /// 3x4 input projection matrix P. - /// Output 3x3 camera matrix K. - /// Output 3x3 external rotation matrix R. - /// Output 4x1 translation vector T. - /// Optional 3x3 rotation matrix around x-axis. - /// Optional 3x3 rotation matrix around y-axis. - /// Optional 3x3 rotation matrix around z-axis. - /// ptional three-element vector containing three Euler angles of rotation in degrees. - public static void DecomposeProjectionMatrix(double[,] projMatrix, - out double[,] cameraMatrix, - out double[,] rotMatrix, - out double[] transVect, - out double[,] rotMatrixX, - out double[,] rotMatrixY, - out double[,] rotMatrixZ, - out double[] eulerAngles) + /// + /// computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size. + /// + /// Input camera matrix that can be estimated by calibrateCamera() or stereoCalibrate() . + /// Input image size in pixels. + /// Physical width of the sensor. + /// Physical height of the sensor. + /// Output field of view in degrees along the horizontal sensor axis. + /// Output field of view in degrees along the vertical sensor axis. + /// Focal length of the lens in mm. + /// Principal point in pixels. + /// fy / fx + public static void CalibrationMatrixValues( + double[,] cameraMatrix, Size imageSize, + double apertureWidth, double apertureHeight, + out double fovx, out double fovy, out double focalLength, + out Point2d principalPoint, out double aspectRatio) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) + throw new ArgumentException("cameraMatrix must be 3x3"); + + unsafe { - if (projMatrix == null) - throw new ArgumentNullException(nameof(projMatrix)); - int dim0 = projMatrix.GetLength(0); - int dim1 = projMatrix.GetLength(1); - if (!((dim0 == 3 && dim1 == 4) || (dim0 == 4 && dim1 == 3))) - throw new ArgumentException("projMatrix must be double[3,4] or double[4,3]"); - - using (var projMatrixM = new Mat(3, 4, MatType.CV_64FC1, projMatrix)) - using (var cameraMatrixM = new MatOfDouble()) - using (var rotMatrixM = new MatOfDouble()) - using (var transVectM = new MatOfDouble()) - using (var rotMatrixXM = new MatOfDouble()) - using (var rotMatrixYM = new MatOfDouble()) - using (var rotMatrixZM = new MatOfDouble()) - using (var eulerAnglesM = new MatOfDouble()) + fixed (double* cameraMatrixPtr = cameraMatrix) { - NativeMethods.calib3d_decomposeProjectionMatrix_Mat( - projMatrixM.CvPtr, - cameraMatrixM.CvPtr, rotMatrixM.CvPtr, transVectM.CvPtr, - rotMatrixXM.CvPtr, rotMatrixYM.CvPtr, rotMatrixZM.CvPtr, - eulerAnglesM.CvPtr); - - cameraMatrix = cameraMatrixM.ToRectangularArray(); - rotMatrix = rotMatrixM.ToRectangularArray(); - transVect = transVectM.ToArray(); - rotMatrixX = rotMatrixXM.ToRectangularArray(); - rotMatrixY = rotMatrixYM.ToRectangularArray(); - rotMatrixZ = rotMatrixZM.ToRectangularArray(); - eulerAngles = eulerAnglesM.ToArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_calibrationMatrixValues_array( + cameraMatrixPtr, + imageSize, apertureWidth, apertureHeight, out fovx, out fovy, out focalLength, + out principalPoint, out aspectRatio)); } } - /// - /// Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector - /// - /// 3x4 input projection matrix P. - /// Output 3x3 camera matrix K. - /// Output 3x3 external rotation matrix R. - /// Output 4x1 translation vector T. - public static void DecomposeProjectionMatrix(double[,] projMatrix, - out double[,] cameraMatrix, - out double[,] rotMatrix, - out double[] transVect) - { - double[,] rotMatrixX, rotMatrixY, rotMatrixZ; - double[] eulerAngles; - DecomposeProjectionMatrix(projMatrix, out cameraMatrix, out rotMatrix, out transVect, - out rotMatrixX, out rotMatrixY, out rotMatrixZ, out eulerAngles); - } - #endregion - #region MatMulDeriv + } - /// - /// computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients - /// - /// First multiplied matrix. - /// Second multiplied matrix. - /// First output derivative matrix d(A*B)/dA of size A.rows*B.cols X A.rows*A.cols . - /// Second output derivative matrix d(A*B)/dB of size A.rows*B.cols X B.rows*B.cols . - public static void MatMulDeriv(InputArray a, InputArray b, - OutputArray dABdA, - OutputArray dABdB) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - if (dABdA == null) - throw new ArgumentNullException(nameof(dABdA)); - if (dABdB == null) - throw new ArgumentNullException(nameof(dABdB)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - dABdA.ThrowIfNotReady(); - dABdB.ThrowIfNotReady(); - NativeMethods.calib3d_matMulDeriv(a.CvPtr, b.CvPtr, dABdA.CvPtr, dABdB.CvPtr); - dABdA.Fix(); - dABdB.Fix(); - } - #endregion - #region ComposeRT - /// - /// composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments - /// - /// First rotation vector. - /// First translation vector. - /// Second rotation vector. - /// Second translation vector. - /// Output rotation vector of the superposition. - /// Output translation vector of the superposition. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - public static void ComposeRT(InputArray rvec1, InputArray tvec1, - InputArray rvec2, InputArray tvec2, - OutputArray rvec3, OutputArray tvec3, - OutputArray dr3dr1 = null, OutputArray dr3dt1 = null, - OutputArray dr3dr2 = null, OutputArray dr3dt2 = null, - OutputArray dt3dr1 = null, OutputArray dt3dt1 = null, - OutputArray dt3dr2 = null, OutputArray dt3dt2 = null) - { - if (rvec1 == null) - throw new ArgumentNullException(nameof(rvec1)); - if (tvec1 == null) - throw new ArgumentNullException(nameof(tvec1)); - if (rvec2 == null) - throw new ArgumentNullException(nameof(rvec2)); - if (tvec2 == null) - throw new ArgumentNullException(nameof(tvec2)); - rvec1.ThrowIfDisposed(); - tvec1.ThrowIfDisposed(); - rvec2.ThrowIfDisposed(); - tvec2.ThrowIfDisposed(); - rvec3.ThrowIfNotReady(); - tvec3.ThrowIfNotReady(); - NativeMethods.calib3d_composeRT_InputArray(rvec1.CvPtr, tvec1.CvPtr, rvec2.CvPtr, tvec2.CvPtr, - rvec3.CvPtr, tvec3.CvPtr, - ToPtr(dr3dr1), ToPtr(dr3dt1), ToPtr(dr3dr2), ToPtr(dr3dt2), - ToPtr(dt3dr1), ToPtr(dt3dt1), ToPtr(dt3dr2), ToPtr(dt3dt2)); - } + /// + /// finds intrinsic and extrinsic parameters of a stereo camera + /// + /// Vector of vectors of the calibration pattern points. + /// Vector of vectors of the projections of the calibration pattern points, observed by the first camera. + /// Vector of vectors of the projections of the calibration pattern points, observed by the second camera. + /// Input/output first camera matrix + /// Input/output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// The output vector length depends on the flags. + /// Input/output second camera matrix. The parameter is similar to cameraMatrix1 . + /// Input/output lens distortion coefficients for the second camera. The parameter is similar to distCoeffs1 . + /// Size of the image used only to initialize intrinsic camera matrix. + /// Output rotation matrix between the 1st and the 2nd camera coordinate systems. + /// Output translation vector between the coordinate systems of the cameras. + /// Output essential matrix. + /// Output fundamental matrix. + /// Termination criteria for the iterative optimization algorithm. + /// Different flags that may be zero or a combination of the CalibrationFlag values + /// + public static double StereoCalibrate( + IEnumerable objectPoints, + IEnumerable imagePoints1, + IEnumerable imagePoints2, + InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, + InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, + Size imageSize, OutputArray R, + OutputArray T, OutputArray E, OutputArray F, + CalibrationFlags flags = CalibrationFlags.FixIntrinsic, + TermCriteria? criteria = null) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints1 is null) + throw new ArgumentNullException(nameof(imagePoints1)); + if (imagePoints2 is null) + throw new ArgumentNullException(nameof(imagePoints2)); + if (cameraMatrix1 is null) + throw new ArgumentNullException(nameof(cameraMatrix1)); + if (distCoeffs1 is null) + throw new ArgumentNullException(nameof(distCoeffs1)); + if (cameraMatrix2 is null) + throw new ArgumentNullException(nameof(cameraMatrix2)); + if (distCoeffs2 is null) + throw new ArgumentNullException(nameof(distCoeffs2)); + cameraMatrix1.ThrowIfDisposed(); + distCoeffs1.ThrowIfDisposed(); + cameraMatrix2.ThrowIfDisposed(); + distCoeffs2.ThrowIfDisposed(); + cameraMatrix1.ThrowIfNotReady(); + cameraMatrix2.ThrowIfNotReady(); + distCoeffs1.ThrowIfNotReady(); + distCoeffs2.ThrowIfNotReady(); + + var opPtrs = objectPoints.Select(x => x.CvPtr).ToArray(); + var ip1Ptrs = imagePoints1.Select(x => x.CvPtr).ToArray(); + var ip2Ptrs = imagePoints2.Select(x => x.CvPtr).ToArray(); + + var criteria0 = criteria.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, 1e-6)); + + NativeMethods.HandleException( + NativeMethods.calib3d_stereoCalibrate_InputArray( + opPtrs, opPtrs.Length, + ip1Ptrs, ip1Ptrs.Length, ip2Ptrs, ip2Ptrs.Length, + cameraMatrix1.CvPtr, distCoeffs1.CvPtr, + cameraMatrix2.CvPtr, distCoeffs2.CvPtr, + imageSize, ToPtr(R), ToPtr(T), ToPtr(E), ToPtr(F), + (int) flags, criteria0, out var ret)); + + GC.KeepAlive(cameraMatrix1); + GC.KeepAlive(distCoeffs1); + GC.KeepAlive(cameraMatrix2); + GC.KeepAlive(distCoeffs2); + GC.KeepAlive(R); + GC.KeepAlive(T); + GC.KeepAlive(E); + GC.KeepAlive(F); + GC.KeepAlive(objectPoints); + GC.KeepAlive(imagePoints1); + GC.KeepAlive(imagePoints2); + cameraMatrix1.Fix(); + distCoeffs1.Fix(); + cameraMatrix2.Fix(); + distCoeffs2.Fix(); + R.Fix(); + T.Fix(); + E.Fix(); + F.Fix(); + + return ret; + } - /// - /// composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments - /// - /// First rotation vector. - /// First translation vector. - /// Second rotation vector. - /// Second translation vector. - /// Output rotation vector of the superposition. - /// Output translation vector of the superposition. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - /// Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and tvec2, respectively. - public static void ComposeRT(double[] rvec1, double[] tvec1, - double[] rvec2, double[] tvec2, - out double[] rvec3, out double[] tvec3, - out double[,] dr3dr1, out double[,] dr3dt1, - out double[,] dr3dr2, out double[,] dr3dt2, - out double[,] dt3dr1, out double[,] dt3dt1, - out double[,] dt3dr2, out double[,] dt3dt2) + /// + /// finds intrinsic and extrinsic parameters of a stereo camera + /// + /// Vector of vectors of the calibration pattern points. + /// Vector of vectors of the projections of the calibration pattern points, observed by the first camera. + /// Vector of vectors of the projections of the calibration pattern points, observed by the second camera. + /// Input/output first camera matrix + /// Input/output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// The output vector length depends on the flags. + /// Input/output second camera matrix. The parameter is similar to cameraMatrix1 . + /// Input/output lens distortion coefficients for the second camera. The parameter is similar to distCoeffs1 . + /// Size of the image used only to initialize intrinsic camera matrix. + /// Output rotation matrix between the 1st and the 2nd camera coordinate systems. + /// Output translation vector between the coordinate systems of the cameras. + /// Output essential matrix. + /// Output fundamental matrix. + /// Termination criteria for the iterative optimization algorithm. + /// Different flags that may be zero or a combination of the CalibrationFlag values + /// + public static double StereoCalibrate( + IEnumerable> objectPoints, + IEnumerable> imagePoints1, + IEnumerable> imagePoints2, + double[,] cameraMatrix1, double[] distCoeffs1, + double[,] cameraMatrix2, double[] distCoeffs2, + Size imageSize, OutputArray R, + OutputArray T, OutputArray E, OutputArray F, + CalibrationFlags flags = CalibrationFlags.FixIntrinsic, + TermCriteria? criteria = null) + { + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints1 is null) + throw new ArgumentNullException(nameof(imagePoints1)); + if (imagePoints2 is null) + throw new ArgumentNullException(nameof(imagePoints2)); + if (cameraMatrix1 is null) + throw new ArgumentNullException(nameof(cameraMatrix1)); + if (distCoeffs1 is null) + throw new ArgumentNullException(nameof(distCoeffs1)); + if (cameraMatrix2 is null) + throw new ArgumentNullException(nameof(cameraMatrix2)); + if (distCoeffs2 is null) + throw new ArgumentNullException(nameof(distCoeffs2)); + + var criteria0 = criteria.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, 1e-6)); + + using var op = new ArrayAddress2(objectPoints); + using var ip1 = new ArrayAddress2(imagePoints1); + using var ip2 = new ArrayAddress2(imagePoints2); + unsafe { - if (rvec1 == null) - throw new ArgumentNullException(nameof(rvec1)); - if (tvec1 == null) - throw new ArgumentNullException(nameof(tvec1)); - if (rvec2 == null) - throw new ArgumentNullException(nameof(rvec2)); - if (tvec2 == null) - throw new ArgumentNullException(nameof(tvec2)); - - using (var rvec1M = new Mat(3, 1, MatType.CV_64FC1, rvec1)) - using (var tvec1M = new Mat(3, 1, MatType.CV_64FC1, tvec1)) - using (var rvec2M = new Mat(3, 1, MatType.CV_64FC1, rvec2)) - using (var tvec2M = new Mat(3, 1, MatType.CV_64FC1, tvec2)) - using (var rvec3M = new MatOfDouble()) - using (var tvec3M = new MatOfDouble()) - using (var dr3dr1M = new MatOfDouble()) - using (var dr3dt1M = new MatOfDouble()) - using (var dr3dr2M = new MatOfDouble()) - using (var dr3dt2M = new MatOfDouble()) - using (var dt3dr1M = new MatOfDouble()) - using (var dt3dt1M = new MatOfDouble()) - using (var dt3dr2M = new MatOfDouble()) - using (var dt3dt2M = new MatOfDouble()) + fixed (double* cameraMatrix1Ptr = cameraMatrix1) + fixed (double* cameraMatrix2Ptr = cameraMatrix2) { - NativeMethods.calib3d_composeRT_Mat(rvec1M.CvPtr, tvec1M.CvPtr, rvec2M.CvPtr, tvec2M.CvPtr, - rvec3M.CvPtr, tvec3M.CvPtr, - dr3dr1M.CvPtr, dr3dt1M.CvPtr, dr3dr2M.CvPtr, dr3dt2M.CvPtr, - dt3dr1M.CvPtr, dt3dt1M.CvPtr, dt3dr2M.CvPtr, dt3dt2M.CvPtr); - rvec3 = rvec3M.ToArray(); - tvec3 = tvec3M.ToArray(); - dr3dr1 = dr3dr1M.ToRectangularArray(); - dr3dt1 = dr3dt1M.ToRectangularArray(); - dr3dr2 = dr3dr2M.ToRectangularArray(); - dr3dt2 = dr3dt2M.ToRectangularArray(); - dt3dr1 = dt3dr1M.ToRectangularArray(); - dt3dt1 = dt3dt1M.ToRectangularArray(); - dt3dr2 = dt3dr2M.ToRectangularArray(); - dt3dt2 = dt3dt2M.ToRectangularArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_stereoCalibrate_array( + op.GetPointer(), op.GetDim1Length(), op.GetDim2Lengths(), + ip1.GetPointer(), ip1.GetDim1Length(), ip1.GetDim2Lengths(), + ip2.GetPointer(), ip2.GetDim1Length(), ip2.GetDim2Lengths(), + cameraMatrix1Ptr, distCoeffs1, distCoeffs1.Length, + cameraMatrix2Ptr, distCoeffs2, distCoeffs2.Length, + imageSize, ToPtr(R), ToPtr(T), ToPtr(E), ToPtr(F), + (int) flags, criteria0, out var ret)); + GC.KeepAlive(R); + GC.KeepAlive(T); + GC.KeepAlive(E); + GC.KeepAlive(F); + return ret; } } + } - /// - /// composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments - /// - /// First rotation vector. - /// First translation vector. - /// Second rotation vector. - /// Second translation vector. - /// Output rotation vector of the superposition. - /// Output translation vector of the superposition. - public static void ComposeRT(double[] rvec1, double[] tvec1, - double[] rvec2, double[] tvec2, - out double[] rvec3, out double[] tvec3) - { - double[,] dr3dr1, dr3dt1, - dr3dr2, dr3dt2, - dt3dr1, dt3dt1, - dt3dr2, dt3dt2; - ComposeRT(rvec1, tvec2, rvec2, tvec2, out rvec3, out tvec3, - out dr3dr1, out dr3dt1, out dr3dr2, out dr3dt2, - out dt3dr1, out dt3dt1, out dt3dr2, out dt3dt2); - } + /// + /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters + /// + /// First camera matrix. + /// First camera distortion parameters. + /// Second camera matrix. + /// Second camera distortion parameters. + /// Size of the image used for stereo calibration. + /// Rotation matrix between the coordinate systems of the first and the second cameras. + /// Translation vector between coordinate systems of the cameras. + /// Output 3x3 rectification transform (rotation matrix) for the first camera. + /// Output 3x3 rectification transform (rotation matrix) for the second camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. + /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). + /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. + /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. + /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. + /// Free scaling parameter. + /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. + /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). + /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained + /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. + /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . + /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. + public static void StereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, + InputArray cameraMatrix2, InputArray distCoeffs2, + Size imageSize, InputArray R, InputArray T, + OutputArray R1, OutputArray R2, + OutputArray P1, OutputArray P2, + OutputArray Q, + StereoRectificationFlags flags = StereoRectificationFlags.ZeroDisparity, + double alpha = -1, Size? newImageSize = null) + { + var newImageSize0 = newImageSize.GetValueOrDefault(new Size(0, 0)); + StereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, + imageSize, R, T, R1, R2, P1, P2, Q, flags, alpha, newImageSize0, + out _, out _); + } - #endregion - #region ProjectPoints - /// - /// projects points from the model coordinate space to the image coordinates. - /// Also computes derivatives of the image coordinates w.r.t the intrinsic - /// and extrinsic camera parameters - /// - /// Array of object points, 3xN/Nx3 1-channel or - /// 1xN/Nx1 3-channel, where N is the number of points in the view. - /// Rotation vector (3x1). - /// Translation vector (3x1). - /// Camera matrix (3x3) - /// Input vector of distortion coefficients - /// (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output array of image points, 2xN/Nx2 1-channel - /// or 1xN/Nx1 2-channel - /// Optional output 2Nx(10 + numDistCoeffs) jacobian matrix - /// of derivatives of image points with respect to components of the rotation vector, - /// translation vector, focal lengths, coordinates of the principal point and - /// the distortion coefficients. In the old interface different components of - /// the jacobian are returned via different output parameters. - /// Optional “fixed aspect ratio” parameter. - /// If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) - /// is fixed and correspondingly adjusts the jacobian matrix. - public static void ProjectPoints(InputArray objectPoints, - InputArray rvec, InputArray tvec, - InputArray cameraMatrix, InputArray distCoeffs, - OutputArray imagePoints, - OutputArray jacobian = null, - double aspectRatio = 0) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (rvec == null) - throw new ArgumentNullException(nameof(rvec)); - if (tvec == null) - throw new ArgumentNullException(nameof(tvec)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); - objectPoints.ThrowIfDisposed(); - rvec.ThrowIfDisposed(); - tvec.ThrowIfDisposed(); - cameraMatrix.ThrowIfDisposed(); - imagePoints.ThrowIfNotReady(); + /// + /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters + /// + /// First camera matrix. + /// First camera distortion parameters. + /// Second camera matrix. + /// Second camera distortion parameters. + /// Size of the image used for stereo calibration. + /// Rotation matrix between the coordinate systems of the first and the second cameras. + /// Translation vector between coordinate systems of the cameras. + /// Output 3x3 rectification transform (rotation matrix) for the first camera. + /// Output 3x3 rectification transform (rotation matrix) for the second camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. + /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). + /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. + /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. + /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. + /// Free scaling parameter. + /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. + /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). + /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained + /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. + /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . + /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. + /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. + /// Otherwise, they are likely to be smaller. + /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. + /// Otherwise, they are likely to be smaller. + public static void StereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, + InputArray cameraMatrix2, InputArray distCoeffs2, + Size imageSize, InputArray R, InputArray T, + OutputArray R1, OutputArray R2, + OutputArray P1, OutputArray P2, + OutputArray Q, StereoRectificationFlags flags, + double alpha, Size newImageSize, + out Rect validPixROI1, out Rect validPixROI2) + { + if (cameraMatrix1 is null) + throw new ArgumentNullException(nameof(cameraMatrix1)); + if (distCoeffs1 is null) + throw new ArgumentNullException(nameof(distCoeffs1)); + if (cameraMatrix2 is null) + throw new ArgumentNullException(nameof(cameraMatrix2)); + if (distCoeffs2 is null) + throw new ArgumentNullException(nameof(distCoeffs2)); + if (R is null) + throw new ArgumentNullException(nameof(R)); + if (T is null) + throw new ArgumentNullException(nameof(T)); + if (R1 is null) + throw new ArgumentNullException(nameof(R1)); + if (R2 is null) + throw new ArgumentNullException(nameof(R2)); + if (P1 is null) + throw new ArgumentNullException(nameof(P1)); + if (P2 is null) + throw new ArgumentNullException(nameof(P2)); + if (Q is null) + throw new ArgumentNullException(nameof(Q)); + cameraMatrix1.ThrowIfDisposed(); + distCoeffs1.ThrowIfDisposed(); + cameraMatrix2.ThrowIfDisposed(); + distCoeffs2.ThrowIfDisposed(); + R.ThrowIfDisposed(); + T.ThrowIfDisposed(); + R1.ThrowIfNotReady(); + R2.ThrowIfNotReady(); + P1.ThrowIfNotReady(); + P2.ThrowIfNotReady(); + Q.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_stereoRectify_InputArray( + cameraMatrix1.CvPtr, distCoeffs1.CvPtr, + cameraMatrix2.CvPtr, distCoeffs2.CvPtr, + imageSize, R.CvPtr, T.CvPtr, + R1.CvPtr, R2.CvPtr, P1.CvPtr, P2.CvPtr, Q.CvPtr, + (int) flags, alpha, newImageSize, out validPixROI1, out validPixROI2)); + + GC.KeepAlive(cameraMatrix1); + GC.KeepAlive(distCoeffs1); + GC.KeepAlive(cameraMatrix2); + GC.KeepAlive(distCoeffs2); + GC.KeepAlive(R); + GC.KeepAlive(T); + GC.KeepAlive(R1); + GC.KeepAlive(R2); + GC.KeepAlive(P1); + GC.KeepAlive(P2); + GC.KeepAlive(Q); + + R1.Fix(); + R2.Fix(); + P1.Fix(); + P2.Fix(); + Q.Fix(); + } - NativeMethods.calib3d_projectPoints_InputArray(objectPoints.CvPtr, - rvec.CvPtr, tvec.CvPtr, cameraMatrix.CvPtr, ToPtr(distCoeffs), - imagePoints.CvPtr, ToPtr(jacobian), aspectRatio); - } - /// - /// projects points from the model coordinate space to the image coordinates. - /// Also computes derivatives of the image coordinates w.r.t the intrinsic - /// and extrinsic camera parameters - /// - /// Array of object points, 3xN/Nx3 1-channel or - /// 1xN/Nx1 3-channel, where N is the number of points in the view. - /// Rotation vector (3x1). - /// Translation vector (3x1). - /// Camera matrix (3x3) - /// Input vector of distortion coefficients - /// (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output array of image points, 2xN/Nx2 1-channel - /// or 1xN/Nx1 2-channel - /// Optional output 2Nx(10 + numDistCoeffs) jacobian matrix - /// of derivatives of image points with respect to components of the rotation vector, - /// translation vector, focal lengths, coordinates of the principal point and - /// the distortion coefficients. In the old interface different components of - /// the jacobian are returned via different output parameters. - /// Optional “fixed aspect ratio” parameter. - /// If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) - /// is fixed and correspondingly adjusts the jacobian matrix. - public static void ProjectPoints(IEnumerable objectPoints, - double[] rvec, double[] tvec, - double[,] cameraMatrix, double[] distCoeffs, - out Point2f[] imagePoints, - out double[,] jacobian, - double aspectRatio = 0) + /// + /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters + /// + /// First camera matrix. + /// First camera distortion parameters. + /// Second camera matrix. + /// Second camera distortion parameters. + /// Size of the image used for stereo calibration. + /// Rotation matrix between the coordinate systems of the first and the second cameras. + /// Translation vector between coordinate systems of the cameras. + /// Output 3x3 rectification transform (rotation matrix) for the first camera. + /// Output 3x3 rectification transform (rotation matrix) for the second camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. + /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). + /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. + /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. + /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. + /// Free scaling parameter. + /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. + /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). + /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained + /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. + /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . + /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. + public static void StereoRectify(double[,] cameraMatrix1, double[] distCoeffs1, + double[,] cameraMatrix2, double[] distCoeffs2, + Size imageSize, double[,] R, double[] T, + out double[,] R1, out double[,] R2, + out double[,] P1, out double[,] P2, + out double[,] Q, + StereoRectificationFlags flags = StereoRectificationFlags.ZeroDisparity, + double alpha = -1, Size? newImageSize = null) + { + var newImageSize0 = newImageSize.GetValueOrDefault(new Size(0, 0)); + StereoRectify( + cameraMatrix1, distCoeffs1, + cameraMatrix2, distCoeffs2, + imageSize, R, T, + out R1, out R2, out P1, out P2, out Q, + flags, alpha, newImageSize0, out _, out _); + } + + /// + /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters + /// + /// First camera matrix. + /// First camera distortion parameters. + /// Second camera matrix. + /// Second camera distortion parameters. + /// Size of the image used for stereo calibration. + /// Rotation matrix between the coordinate systems of the first and the second cameras. + /// Translation vector between coordinate systems of the cameras. + /// Output 3x3 rectification transform (rotation matrix) for the first camera. + /// Output 3x3 rectification transform (rotation matrix) for the second camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. + /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). + /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. + /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. + /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. + /// Free scaling parameter. + /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. + /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). + /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained + /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. + /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . + /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. + /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. + /// Otherwise, they are likely to be smaller. + /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. + /// Otherwise, they are likely to be smaller. + public static void StereoRectify(double[,] cameraMatrix1, double[] distCoeffs1, + double[,] cameraMatrix2, double[] distCoeffs2, + Size imageSize, double[,] R, double[] T, + out double[,] R1, out double[,] R2, + out double[,] P1, out double[,] P2, + out double[,] Q, StereoRectificationFlags flags, + double alpha, Size newImageSize, + out Rect validPixROI1, out Rect validPixROI2) + { + if (cameraMatrix1 is null) + throw new ArgumentNullException(nameof(cameraMatrix1)); + if (distCoeffs1 is null) + throw new ArgumentNullException(nameof(distCoeffs1)); + if (cameraMatrix2 is null) + throw new ArgumentNullException(nameof(cameraMatrix2)); + if (distCoeffs2 is null) + throw new ArgumentNullException(nameof(distCoeffs2)); + if (R is null) + throw new ArgumentNullException(nameof(R)); + if (T is null) + throw new ArgumentNullException(nameof(T)); + + R1 = new double[3, 3]; + R2 = new double[3, 3]; + P1 = new double[3, 4]; + P2 = new double[3, 4]; + Q = new double[4, 4]; + + unsafe { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (rvec == null) - throw new ArgumentNullException(nameof(rvec)); - if (rvec.Length != 3) - throw new ArgumentException("rvec.Length != 3"); - if (tvec == null) - throw new ArgumentNullException(nameof(tvec)); - if (tvec.Length != 3) - throw new ArgumentException("tvec.Length != 3"); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) - throw new ArgumentException("cameraMatrix must be double[3,3]"); - - Point3f[] objectPointsArray = EnumerableEx.ToArray(objectPoints); - using (var objectPointsM = new Mat(objectPointsArray.Length, 1, MatType.CV_32FC3, objectPointsArray)) - using (var rvecM = new Mat(3, 1, MatType.CV_64FC1, rvec)) - using (var tvecM = new Mat(3, 1, MatType.CV_64FC1, tvec)) - using (var cameraMatrixM = new Mat(3, 3, MatType.CV_64FC1, cameraMatrix)) - using (var imagePointsM = new MatOfPoint2f()) + fixed (double* cameraMatrix1Ptr = cameraMatrix1) + fixed (double* cameraMatrix2Ptr = cameraMatrix2) + fixed (double* RPtr = R) + fixed (double* R1Ptr = R1) + fixed (double* R2Ptr = R2) + fixed (double* P1Ptr = P1) + fixed (double* P2Ptr = P2) + fixed (double* QPtr = Q) { - var distCoeffsM = new Mat(); - if (distCoeffs != null) - distCoeffsM = new Mat(distCoeffs.Length, 1, MatType.CV_64FC1, distCoeffs); - var jacobianM = new MatOfDouble(); - - NativeMethods.calib3d_projectPoints_Mat(objectPointsM.CvPtr, - rvecM.CvPtr, tvecM.CvPtr, cameraMatrixM.CvPtr, distCoeffsM.CvPtr, - imagePointsM.CvPtr, jacobianM.CvPtr, aspectRatio); - - imagePoints = imagePointsM.ToArray(); - jacobian = jacobianM.ToRectangularArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_stereoRectify_array( + cameraMatrix1Ptr, distCoeffs1, distCoeffs1.Length, + cameraMatrix2Ptr, distCoeffs2, distCoeffs2.Length, + imageSize, RPtr, T, + R1Ptr, R2Ptr, P1Ptr, P2Ptr, QPtr, + (int) flags, alpha, newImageSize, out validPixROI1, out validPixROI2)); } } - #endregion - #region SolvePnP + } - /// - /// Finds an object pose from 3D-2D point correspondences. - /// - /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, - /// where N is the number of points. vector<Point3f> can be also passed here. - /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, - /// where N is the number of points. vector<Point2f> can be also passed here. - /// Input camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output rotation vector that, together with tvec , brings points from the model coordinate system to the - /// camera coordinate system. - /// Output translation vector. - /// If true, the function uses the provided rvec and tvec values as initial approximations of - /// the rotation and translation vectors, respectively, and further optimizes them. - /// Method for solving a PnP problem: - public static void SolvePnP( - InputArray objectPoints, - InputArray imagePoints, - InputArray cameraMatrix, - InputArray distCoeffs, - OutputArray rvec, OutputArray tvec, - bool useExtrinsicGuess = false, - SolvePnPFlags flags = SolvePnPFlags.Iterative) + /// + /// computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed) + /// + /// Array of feature points in the first image. + /// The corresponding points in the second image. + /// The same formats as in findFundamentalMat() are supported. + /// Input fundamental matrix. It can be computed from the same set + /// of point pairs using findFundamentalMat() . + /// Size of the image. + /// Output rectification homography matrix for the first image. + /// Output rectification homography matrix for the second image. + /// Optional threshold used to filter out the outliers. + /// If the parameter is greater than zero, all the point pairs that do not comply + /// with the epipolar geometry (that is, the points for which |points2[i]^T * F * points1[i]| > threshold ) + /// are rejected prior to computing the homographies. Otherwise, all the points are considered inliers. + /// + public static bool StereoRectifyUncalibrated(InputArray points1, InputArray points2, + InputArray F, Size imgSize, + OutputArray H1, OutputArray H2, + double threshold = 5) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (H1 is null) + throw new ArgumentNullException(nameof(H1)); + if (H2 is null) + throw new ArgumentNullException(nameof(H2)); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + F.ThrowIfDisposed(); + H1.ThrowIfNotReady(); + H2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_stereoRectifyUncalibrated_InputArray( + points1.CvPtr, points2.CvPtr, F.CvPtr, imgSize, H1.CvPtr, H2.CvPtr, threshold, out var ret)); + + GC.KeepAlive(points1); + GC.KeepAlive(points2); + GC.KeepAlive(F); + GC.KeepAlive(H1); + GC.KeepAlive(H2); + H1.Fix(); + H2.Fix(); + return ret != 0; + } + + /// + /// computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed) + /// + /// Array of feature points in the first image. + /// The corresponding points in the second image. + /// The same formats as in findFundamentalMat() are supported. + /// Input fundamental matrix. It can be computed from the same set + /// of point pairs using findFundamentalMat() . + /// Size of the image. + /// Output rectification homography matrix for the first image. + /// Output rectification homography matrix for the second image. + /// Optional threshold used to filter out the outliers. + /// If the parameter is greater than zero, all the point pairs that do not comply + /// with the epipolar geometry (that is, the points for which |points2[i]^T * F * points1[i]| > threshold ) + /// are rejected prior to computing the homographies. Otherwise, all the points are considered inliers. + /// + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static bool StereoRectifyUncalibrated( + IEnumerable points1, + IEnumerable points2, + double[,] F, Size imgSize, + out double[,] H1, out double[,] H2, + double threshold = 5) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (F.GetLength(0) != 3 || F.GetLength(1) != 3) + throw new ArgumentException("F != double[3,3]"); + + var points1Array = points1 as Point2d[] ?? points1.ToArray(); + var points2Array = points2 as Point2d[] ?? points2.ToArray(); + + H1 = new double[3, 3]; + H2 = new double[3, 3]; + + unsafe { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (rvec == null) - throw new ArgumentNullException(nameof(rvec)); - if (tvec == null) - throw new ArgumentNullException(nameof(tvec)); - objectPoints.ThrowIfDisposed(); - imagePoints.ThrowIfDisposed(); - cameraMatrix.ThrowIfDisposed(); - distCoeffs.ThrowIfDisposed(); - rvec.ThrowIfDisposed(); - tvec.ThrowIfDisposed(); - IntPtr distCoeffsPtr = ToPtr(distCoeffs); - NativeMethods.calib3d_solvePnP_InputArray( - objectPoints.CvPtr, imagePoints.CvPtr, cameraMatrix.CvPtr, distCoeffsPtr, - rvec.CvPtr, tvec.CvPtr, useExtrinsicGuess ? 1 : 0, (int)flags); - rvec.Fix(); - tvec.Fix(); + fixed (double* FPtr = F) + fixed (double* H1Ptr = H1) + fixed (double* H2Ptr = H1) + { + NativeMethods.HandleException( + NativeMethods.calib3d_stereoRectifyUncalibrated_array( + points1Array, points1Array.Length, + points2Array, points2Array.Length, + FPtr, imgSize, H1Ptr, H2Ptr, threshold, out var ret)); + return ret != 0; + } } + } - /// - /// Finds an object pose from 3D-2D point correspondences. - /// - /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, - /// where N is the number of points. vector<Point3f> can be also passed here. - /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, - /// where N is the number of points. vector<Point2f> can be also passed here. - /// Input camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output rotation vector that, together with tvec , brings points from the model coordinate system to the - /// camera coordinate system. - /// Output translation vector. - /// If true, the function uses the provided rvec and tvec values as initial approximations of - /// the rotation and translation vectors, respectively, and further optimizes them. - /// Method for solving a PnP problem: - public static void SolvePnP( - IEnumerable objectPoints, - IEnumerable imagePoints, - double[,] cameraMatrix, - IEnumerable distCoeffs, - out double[] rvec, out double[] tvec, - bool useExtrinsicGuess = false, - SolvePnPFlags flags = SolvePnPFlags.Iterative) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) - throw new ArgumentException(""); - - Point3f[] objectPointsArray = EnumerableEx.ToArray(objectPoints); - Point2f[] imagePointsArray = EnumerableEx.ToArray(imagePoints); - double[] distCoeffsArray = EnumerableEx.ToArray(distCoeffs); - int distCoeffsLength = (distCoeffs == null) ? 0 : distCoeffsArray.Length; - rvec = new double[3]; - tvec = new double[3]; + /// + /// computes the rectification transformations for 3-head camera, where all the heads are on the same line. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static float Rectify3Collinear( + InputArray cameraMatrix1, InputArray distCoeffs1, + InputArray cameraMatrix2, InputArray distCoeffs2, + InputArray cameraMatrix3, InputArray distCoeffs3, + IEnumerable imgpt1, IEnumerable imgpt3, + Size imageSize, InputArray R12, InputArray T12, + InputArray R13, InputArray T13, + OutputArray R1, OutputArray R2, OutputArray R3, + OutputArray P1, OutputArray P2, OutputArray P3, + OutputArray Q, double alpha, Size newImgSize, + out Rect roi1, out Rect roi2, StereoRectificationFlags flags) + { + if (cameraMatrix1 is null) + throw new ArgumentNullException(nameof(cameraMatrix1)); + if (distCoeffs1 is null) + throw new ArgumentNullException(nameof(distCoeffs1)); + if (cameraMatrix2 is null) + throw new ArgumentNullException(nameof(cameraMatrix2)); + if (distCoeffs2 is null) + throw new ArgumentNullException(nameof(distCoeffs2)); + if (cameraMatrix3 is null) + throw new ArgumentNullException(nameof(cameraMatrix3)); + if (distCoeffs3 is null) + throw new ArgumentNullException(nameof(distCoeffs3)); + if (imgpt1 is null) + throw new ArgumentNullException(nameof(imgpt1)); + if (imgpt3 is null) + throw new ArgumentNullException(nameof(imgpt3)); + if (R12 is null) + throw new ArgumentNullException(nameof(R12)); + if (T12 is null) + throw new ArgumentNullException(nameof(T12)); + if (R13 is null) + throw new ArgumentNullException(nameof(R13)); + if (T13 is null) + throw new ArgumentNullException(nameof(T13)); + if (R1 is null) + throw new ArgumentNullException(nameof(R1)); + if (R2 is null) + throw new ArgumentNullException(nameof(R2)); + if (R3 is null) + throw new ArgumentNullException(nameof(R3)); + if (P1 is null) + throw new ArgumentNullException(nameof(P1)); + if (P2 is null) + throw new ArgumentNullException(nameof(P2)); + if (P3 is null) + throw new ArgumentNullException(nameof(P3)); + if (Q is null) + throw new ArgumentNullException(nameof(Q)); + cameraMatrix1.ThrowIfDisposed(); + distCoeffs1.ThrowIfDisposed(); + cameraMatrix2.ThrowIfDisposed(); + distCoeffs2.ThrowIfDisposed(); + cameraMatrix3.ThrowIfDisposed(); + distCoeffs3.ThrowIfDisposed(); + R12.ThrowIfDisposed(); + T12.ThrowIfDisposed(); + R13.ThrowIfDisposed(); + T13.ThrowIfDisposed(); + R1.ThrowIfNotReady(); + R2.ThrowIfNotReady(); + R3.ThrowIfNotReady(); + P1.ThrowIfNotReady(); + P2.ThrowIfNotReady(); + P3.ThrowIfNotReady(); + Q.ThrowIfNotReady(); + + var imgpt1Ptrs = imgpt1.Select(x => x.CvPtr).ToArray(); + var imgpt3Ptrs = imgpt3.Select(x => x.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_rectify3Collinear_InputArray( + cameraMatrix1.CvPtr, distCoeffs1.CvPtr, + cameraMatrix2.CvPtr, distCoeffs2.CvPtr, + cameraMatrix3.CvPtr, distCoeffs3.CvPtr, + imgpt1Ptrs, imgpt1Ptrs.Length, imgpt3Ptrs, imgpt3Ptrs.Length, + imageSize, R12.CvPtr, T12.CvPtr, R13.CvPtr, T13.CvPtr, + R1.CvPtr, R2.CvPtr, R3.CvPtr, P1.CvPtr, P2.CvPtr, P3.CvPtr, + Q.CvPtr, alpha, newImgSize, out roi1, out roi2, (int) flags, out var ret)); + + GC.KeepAlive(cameraMatrix1); + GC.KeepAlive(distCoeffs1); + GC.KeepAlive(cameraMatrix2); + GC.KeepAlive(distCoeffs2); + GC.KeepAlive(cameraMatrix3); + GC.KeepAlive(distCoeffs3); + GC.KeepAlive(imgpt1); + GC.KeepAlive(imgpt3); + GC.KeepAlive(R12); + GC.KeepAlive(T12); + GC.KeepAlive(R13); + GC.KeepAlive(T13); + GC.KeepAlive(R1); + GC.KeepAlive(R2); + GC.KeepAlive(R3); + GC.KeepAlive(P1); + GC.KeepAlive(P2); + GC.KeepAlive(P3); + GC.KeepAlive(Q); + R1.Fix(); + R2.Fix(); + R3.Fix(); + P1.Fix(); + P2.Fix(); + P3.Fix(); + Q.Fix(); + return ret; + } - NativeMethods.calib3d_solvePnP_vector( - objectPointsArray, objectPointsArray.Length, - imagePointsArray, imagePointsArray.Length, - cameraMatrix, distCoeffsArray, distCoeffsLength, - rvec, tvec, useExtrinsicGuess ? 1 : 0, (int)flags); - } - #endregion - #region SolvePnPRansac - /// - /// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. - /// - /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, - /// where N is the number of points. List<Point3f> can be also passed here. - /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. - /// List<Point2f> can be also passed here. - /// Input 3x3 camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output rotation vector that, together with tvec , brings points from the model coordinate system - /// to the camera coordinate system. - /// Output translation vector. - /// If true, the function uses the provided rvec and tvec values as initial approximations - /// of the rotation and translation vectors, respectively, and further optimizes them. - /// Number of iterations. - /// Inlier threshold value used by the RANSAC procedure. - /// The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier. - /// The probability that the algorithm produces a useful result. - /// Output vector that contains indices of inliers in objectPoints and imagePoints . - /// Method for solving a PnP problem - public static void SolvePnPRansac( - InputArray objectPoints, - InputArray imagePoints, - InputArray cameraMatrix, - InputArray distCoeffs, - OutputArray rvec, - OutputArray tvec, - bool useExtrinsicGuess = false, - int iterationsCount = 100, - float reprojectionError = 8.0f, - double confidence = 0.99, - OutputArray inliers = null, - SolvePnPFlags flags = SolvePnPFlags.Iterative) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (rvec == null) - throw new ArgumentNullException(nameof(rvec)); - if (tvec == null) - throw new ArgumentNullException(nameof(tvec)); - objectPoints.ThrowIfDisposed(); - imagePoints.ThrowIfDisposed(); - cameraMatrix.ThrowIfDisposed(); - distCoeffs.ThrowIfDisposed(); - rvec.ThrowIfDisposed(); - tvec.ThrowIfDisposed(); - IntPtr distCoeffsPtr = ToPtr(distCoeffs); + /// + /// Returns the new camera matrix based on the free scaling parameter. + /// + /// Input camera matrix. + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the array is null, the zero distortion coefficients are assumed. + /// Original image size. + /// Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) + /// and 1 (when all the source image pixels are retained in the undistorted image). + /// Image size after rectification. By default,it is set to imageSize . + /// Optional output rectangle that outlines all-good-pixels region in the undistorted image. See roi1, roi2 description in stereoRectify() . + /// Optional flag that indicates whether in the new camera matrix the principal point + /// should be at the image center or not. By default, the principal point is chosen to best fit a + /// subset of the source image (determined by alpha) to the corrected image. + /// optimal new camera matrix + public static Mat GetOptimalNewCameraMatrix( + InputArray cameraMatrix, + InputArray? distCoeffs, + Size imageSize, + double alpha, + Size newImgSize, + out Rect validPixROI, + bool centerPrincipalPoint = false) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + cameraMatrix.ThrowIfDisposed(); - NativeMethods.calib3d_solvePnPRansac_InputArray( - objectPoints.CvPtr, imagePoints.CvPtr, cameraMatrix.CvPtr, distCoeffsPtr, - rvec.CvPtr, tvec.CvPtr, useExtrinsicGuess ? 1 : 0, iterationsCount, - reprojectionError, confidence, ToPtr(inliers), (int)flags); + NativeMethods.HandleException( + NativeMethods.calib3d_getOptimalNewCameraMatrix_InputArray( + cameraMatrix.CvPtr, ToPtr(distCoeffs), imageSize, alpha, newImgSize, + out validPixROI, centerPrincipalPoint ? 1 : 0, out var ret)); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + return new Mat(ret); + } - rvec.Fix(); - tvec.Fix(); - inliers?.Fix(); - } + /// + /// Returns the new camera matrix based on the free scaling parameter. + /// + /// Input camera matrix. + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the array is null, the zero distortion coefficients are assumed. + /// Original image size. + /// Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) + /// and 1 (when all the source image pixels are retained in the undistorted image). + /// Image size after rectification. By default,it is set to imageSize . + /// Optional output rectangle that outlines all-good-pixels region in the undistorted image. See roi1, roi2 description in stereoRectify() . + /// Optional flag that indicates whether in the new camera matrix the principal point + /// should be at the image center or not. By default, the principal point is chosen to best fit a + /// subset of the source image (determined by alpha) to the corrected image. + /// optimal new camera matrix + public static double[,]? GetOptimalNewCameraMatrix( + double[,] cameraMatrix, double[] distCoeffs, + Size imageSize, double alpha, Size newImgSize, + out Rect validPixROI, bool centerPrincipalPoint = false) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); - /// - /// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. - /// - /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, - /// where N is the number of points. List<Point3f> can be also passed here. - /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. - /// List<Point2f> can be also passed here. - /// Input 3x3 camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output rotation vector that, together with tvec , brings points from the model coordinate system - /// to the camera coordinate system. - /// Output translation vector. - public static void SolvePnPRansac( - IEnumerable objectPoints, - IEnumerable imagePoints, - double[,] cameraMatrix, - IEnumerable distCoeffs, - out double[] rvec, out double[] tvec) + IntPtr matPtr; + unsafe { - int[] inliers; - SolvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, out rvec, out tvec, out inliers); + fixed (double* cameraMatrixPtr = cameraMatrix) + { + NativeMethods.HandleException( + NativeMethods.calib3d_getOptimalNewCameraMatrix_array( + cameraMatrixPtr, distCoeffs, distCoeffs.Length, + imageSize, alpha, newImgSize, + out validPixROI, centerPrincipalPoint ? 1 : 0, out matPtr)); + if (matPtr == IntPtr.Zero) + return null; + } } - /// - /// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. - /// - /// Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, - /// where N is the number of points. List<Point3f> can be also passed here. - /// Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. - /// List<Point2f> can be also passed here. - /// Input 3x3 camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Output rotation vector that, together with tvec , brings points from the model coordinate system - /// to the camera coordinate system. - /// Output translation vector. - /// If true, the function uses the provided rvec and tvec values as initial approximations - /// of the rotation and translation vectors, respectively, and further optimizes them. - /// Number of iterations. - /// Inlier threshold value used by the RANSAC procedure. - /// The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier. - /// The probability that the algorithm produces a useful result. - /// Output vector that contains indices of inliers in objectPoints and imagePoints . - /// Method for solving a PnP problem - public static void SolvePnPRansac( - IEnumerable objectPoints, - IEnumerable imagePoints, - double[,] cameraMatrix, - IEnumerable distCoeffs, - out double[] rvec, out double[] tvec, - out int[] inliers, - bool useExtrinsicGuess = false, - int iterationsCount = 100, - float reprojectionError = 8.0f, - double confidence = 0.99, - SolvePnPFlags flags = SolvePnPFlags.Iterative) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); + using var mat = Mat.FromNativePointer(matPtr); + return mat.ToRectangularArray(); + } - if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) - throw new ArgumentException(""); + /// + /// Computes Hand-Eye calibration. + /// + /// The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the + /// rotation then the translation(separable solutions) and the following methods are implemented: + /// - R.Tsai, R.Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89 + /// - F.Park, B.Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94 + /// - R.Horaud, F.Dornaika Hand-Eye Calibration \cite Horaud95 + /// + /// Another approach consists in estimating simultaneously the rotation and the translation(simultaneous solutions), + /// with the following implemented method: + /// - N.Andreff, R.Horaud, B.Espiau On-line Hand-Eye Calibration \cite Andreff99 + /// - K.Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98 + /// + /// Rotation part extracted from the homogeneous matrix that + /// transforms a pointexpressed in the gripper frame to the robot base frame that contains the rotation + /// matrices for all the transformationsfrom gripper frame to robot base frame. + /// Translation part extracted from the homogeneous matrix that transforms a point + /// expressed in the gripper frame to the robot base frame. + /// This is a vector(`vector<Mat>`) that contains the translation vectors for all the transformations + /// from gripper frame to robot base frame. + /// Rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the target frame to the camera frame. + /// This is a vector(`vector<Mat>`) that contains the rotation matrices for all the transformations + /// from calibration target frame to camera frame. + /// Rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the target frame to the camera frame. + /// This is a vector(`vector<Mat>`) that contains the translation vectors for all the transformations + /// from calibration target frame to camera frame. + /// Estimated rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the camera frame to the gripper frame. + /// Estimated translation part extracted from the homogeneous matrix that transforms a point + /// expressed in the camera frame to the gripper frame. + /// One of the implemented Hand-Eye calibration method + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void CalibrateHandEye( + IEnumerable R_gripper2base, + IEnumerable t_gripper2base, + IEnumerable R_target2cam, + IEnumerable t_target2cam, + OutputArray R_cam2gripper, + OutputArray t_cam2gripper, + HandEyeCalibrationMethod method = HandEyeCalibrationMethod.TSAI) + { + if (R_gripper2base is null) + throw new ArgumentNullException(nameof(R_gripper2base)); + if (t_gripper2base is null) + throw new ArgumentNullException(nameof(t_gripper2base)); + if (R_target2cam is null) + throw new ArgumentNullException(nameof(R_target2cam)); + if (t_target2cam is null) + throw new ArgumentNullException(nameof(t_target2cam)); + if (R_cam2gripper is null) + throw new ArgumentNullException(nameof(R_cam2gripper)); + if (t_cam2gripper is null) + throw new ArgumentNullException(nameof(t_cam2gripper)); + R_cam2gripper.ThrowIfNotReady(); + t_cam2gripper.ThrowIfNotReady(); + + var R_gripper2baseArray = R_gripper2base as Mat[] ?? R_gripper2base.ToArray(); + var t_gripper2baseArray = t_gripper2base as Mat[] ?? t_gripper2base.ToArray(); + var R_target2camArray = R_target2cam as Mat[] ?? R_target2cam.ToArray(); + var t_target2camArray = t_target2cam as Mat[] ?? t_target2cam.ToArray(); + if (R_gripper2baseArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(R_gripper2base)); + if (t_gripper2baseArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(t_gripper2base)); + if (R_target2camArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(R_target2cam)); + if (t_target2camArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(t_target2cam)); + + var R_gripper2basePtrArray = R_gripper2baseArray.Select(m => m.CvPtr).ToArray(); + var t_gripper2basePtrArray = t_gripper2baseArray.Select(m => m.CvPtr).ToArray(); + var R_target2camPtrArray = R_target2camArray.Select(m => m.CvPtr).ToArray(); + var t_target2camPtrArray = t_target2camArray.Select(m => m.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_calibrateHandEye( + R_gripper2basePtrArray, R_gripper2basePtrArray.Length, + t_gripper2basePtrArray, t_gripper2basePtrArray.Length, + R_target2camPtrArray, R_target2camPtrArray.Length, + t_target2camPtrArray, t_target2camPtrArray.Length, + R_cam2gripper.CvPtr, t_cam2gripper.CvPtr, (int)method)); + + GC.KeepAlive(R_gripper2base); + GC.KeepAlive(t_gripper2base); + GC.KeepAlive(R_target2cam); + GC.KeepAlive(t_target2cam); + R_cam2gripper.Fix(); + t_cam2gripper.Fix(); + + foreach (var mat in R_gripper2baseArray) GC.KeepAlive(mat); + foreach (var mat in t_gripper2baseArray) GC.KeepAlive(mat); + foreach (var mat in R_target2camArray) GC.KeepAlive(mat); + foreach (var mat in t_target2camArray) GC.KeepAlive(mat); + } - Point3f[] objectPointsArray = EnumerableEx.ToArray(objectPoints); - Point2f[] imagePointsArray = EnumerableEx.ToArray(imagePoints); - double[] distCoeffsArray = EnumerableEx.ToArray(distCoeffs); - int distCoeffsLength = (distCoeffs == null) ? 0 : distCoeffsArray.Length; - rvec = new double[3]; - tvec = new double[3]; + /// + /// Computes Robot-World/Hand-Eye calibration. + /// The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the + /// rotation then the translation(separable solutions): + /// - M.Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR + /// + /// [in] R_world2cam Rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the world frame to the camera frame. This is a vector of Mat that contains the rotation, + /// `(3x3)` rotation matrices or `(3x1)` rotation vectors,for all the transformations from world frame to the camera frame. + /// [in] Translation part extracted from the homogeneous matrix that transforms a point + /// expressed in the world frame to the camera frame. This is a vector (`vector<Mat>`) that contains the `(3x1)` + /// translation vectors for all the transformations from world frame to the camera frame. + /// [in] Rotation part extracted from the homogeneous matrix that transforms a point expressed + /// in the robot base frame to the gripper frame. This is a vector (`vector<Mat>`) that contains the rotation, + /// `(3x3)` rotation matrices or `(3x1)` rotation vectors, for all the transformations from robot base frame to the gripper frame. + /// [in] Rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the robot base frame to the gripper frame. This is a vector (`vector<Mat>`) that contains the + /// `(3x1)` translation vectors for all the transformations from robot base frame to the gripper frame. + /// [out] R_base2world Estimated `(3x3)` rotation part extracted from the homogeneous matrix + /// that transforms a point expressed in the robot base frame to the world frame. + /// [out] t_base2world Estimated `(3x1)` translation part extracted from the homogeneous matrix + /// that transforms a point expressed in the robot base frame to the world frame. + /// [out] R_gripper2cam Estimated `(3x3)` rotation part extracted from the homogeneous matrix + /// that transforms a point expressed in the gripper frame to the camera frame. + /// [out] Estimated `(3x1)` translation part extracted from the homogeneous matrix that + /// transforms a pointexpressed in the gripper frame to the camera frame. + /// One of the implemented Robot-World/Hand-Eye calibration method + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void CalibrateRobotWorldHandEye( + IEnumerable R_world2cam, + IEnumerable t_world2cam, + IEnumerable R_base2gripper, + IEnumerable t_base2gripper, + OutputArray R_base2world, + OutputArray t_base2world, + OutputArray R_gripper2cam, + OutputArray t_gripper2cam, + RobotWorldHandEyeCalibrationMethod method = RobotWorldHandEyeCalibrationMethod.SHAH) + { + if (R_world2cam is null) + throw new ArgumentNullException(nameof(R_world2cam)); + if (t_world2cam is null) + throw new ArgumentNullException(nameof(t_world2cam)); + if (R_base2gripper is null) + throw new ArgumentNullException(nameof(R_base2gripper)); + if (t_base2gripper is null) + throw new ArgumentNullException(nameof(t_base2gripper)); + if (R_base2world is null) + throw new ArgumentNullException(nameof(R_base2world)); + if (t_base2world is null) + throw new ArgumentNullException(nameof(t_base2world)); + if (R_gripper2cam is null) + throw new ArgumentNullException(nameof(R_gripper2cam)); + if (t_gripper2cam is null) + throw new ArgumentNullException(nameof(t_gripper2cam)); + R_base2world.ThrowIfNotReady(); + t_base2world.ThrowIfNotReady(); + R_gripper2cam.ThrowIfNotReady(); + t_gripper2cam.ThrowIfNotReady(); + var R_world2camArray = R_world2cam as Mat[] ?? R_world2cam.ToArray(); + var t_world2camArray = t_world2cam as Mat[] ?? t_world2cam.ToArray(); + var R_base2gripperArray = R_base2gripper as Mat[] ?? R_base2gripper.ToArray(); + var t_base2gripperArray = t_base2gripper as Mat[] ?? t_base2gripper.ToArray(); + if (R_world2camArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(R_world2cam)); + if (t_world2camArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(t_world2cam)); + if (R_base2gripperArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(R_base2gripper)); + if (t_base2gripperArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(t_base2gripper)); + + var R_base2worldPtrArray = R_world2camArray.Select(m => m.CvPtr).ToArray(); + var t_world2camPtrArray = t_world2camArray.Select(m => m.CvPtr).ToArray(); + var R_base2gripperPtrArray = R_base2gripperArray.Select(m => m.CvPtr).ToArray(); + var t_base2gripperPtrArray = t_base2gripperArray.Select(m => m.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.calib3d_calibrateRobotWorldHandEye_OutputArray( + R_base2worldPtrArray, R_base2worldPtrArray.Length, + t_world2camPtrArray, t_world2camPtrArray.Length, + R_base2gripperPtrArray, R_base2gripperPtrArray.Length, + t_base2gripperPtrArray, t_base2gripperPtrArray.Length, + R_base2world.CvPtr, t_base2world.CvPtr, R_gripper2cam.CvPtr, t_gripper2cam.CvPtr, + (int)method)); + + R_base2world.Fix(); + t_base2world.Fix(); + R_gripper2cam.Fix(); + t_gripper2cam.Fix(); + foreach (var mat in R_world2camArray) GC.KeepAlive(mat); + foreach (var mat in t_world2camArray) GC.KeepAlive(mat); + foreach (var mat in R_base2gripperArray) GC.KeepAlive(mat); + foreach (var mat in t_base2gripperArray) GC.KeepAlive(mat); + } - using (var inliersVec = new VectorOfInt32()) - { - NativeMethods.calib3d_solvePnPRansac_vector( - objectPointsArray, objectPointsArray.Length, - imagePointsArray, imagePointsArray.Length, - cameraMatrix, distCoeffsArray, distCoeffsLength, - rvec, tvec, useExtrinsicGuess ? 1 : 0, iterationsCount, - reprojectionError, confidence, inliersVec.CvPtr, (int)flags); - inliers = inliersVec.ToArray(); - } - } - #endregion - #region InitCameraMatrix2D - /// - /// initializes camera matrix from a few 3D points and the corresponding projections. - /// - /// Vector of vectors (vector<vector<Point3d>>) of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated. - /// Vector of vectors (vector<vector<Point2d>>) of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated. - /// Image size in pixels used to initialize the principal point. - /// If it is zero or negative, both f_x and f_y are estimated independently. Otherwise, f_x = f_y * aspectRatio . - /// - public static Mat InitCameraMatrix2D( - IEnumerable objectPoints, - IEnumerable imagePoints, - Size imageSize, - double aspectRatio = 1.0) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); + /// + /// omputes Robot-World/Hand-Eye calibration. + /// The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the + /// rotation then the translation(separable solutions): + /// - M.Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR + /// + /// [in] R_world2cam Rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the world frame to the camera frame. This is a vector of Mat that contains the rotation, + /// `(3x3)` rotation matrices or `(3x1)` rotation vectors,for all the transformations from world frame to the camera frame. + /// [in] Translation part extracted from the homogeneous matrix that transforms a point + /// expressed in the world frame to the camera frame. This is a vector (`vector<Mat>`) that contains the `(3x1)` + /// translation vectors for all the transformations from world frame to the camera frame. + /// [in] Rotation part extracted from the homogeneous matrix that transforms a point expressed + /// in the robot base frame to the gripper frame. This is a vector (`vector<Mat>`) that contains the rotation, + /// `(3x3)` rotation matrices or `(3x1)` rotation vectors, for all the transformations from robot base frame to the gripper frame. + /// [in] Rotation part extracted from the homogeneous matrix that transforms a point + /// expressed in the robot base frame to the gripper frame. This is a vector (`vector<Mat>`) that contains the + /// `(3x1)` translation vectors for all the transformations from robot base frame to the gripper frame. + /// [out] R_base2world Estimated `(3x3)` rotation part extracted from the homogeneous matrix + /// that transforms a point expressed in the robot base frame to the world frame. + /// [out] t_base2world Estimated `(3x1)` translation part extracted from the homogeneous matrix + /// that transforms a point expressed in the robot base frame to the world frame. + /// [out] R_gripper2cam Estimated `(3x3)` rotation part extracted from the homogeneous matrix + /// that transforms a point expressed in the gripper frame to the camera frame. + /// [out] Estimated `(3x1)` translation part extracted from the homogeneous matrix that + /// transforms a pointexpressed in the gripper frame to the camera frame. + /// One of the implemented Robot-World/Hand-Eye calibration method + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void CalibrateRobotWorldHandEye( + IEnumerable R_world2cam, + IEnumerable t_world2cam, + IEnumerable R_base2gripper, + IEnumerable t_base2gripper, + out double[,] R_base2world, + out double[] t_base2world, + out double[,] R_gripper2cam, + out double[] t_gripper2cam, + RobotWorldHandEyeCalibrationMethod method = RobotWorldHandEyeCalibrationMethod.SHAH) + { + if (R_world2cam is null) + throw new ArgumentNullException(nameof(R_world2cam)); + if (t_world2cam is null) + throw new ArgumentNullException(nameof(t_world2cam)); + if (R_base2gripper is null) + throw new ArgumentNullException(nameof(R_base2gripper)); + if (t_base2gripper is null) + throw new ArgumentNullException(nameof(t_base2gripper)); + var R_world2camArray = R_world2cam as Mat[] ?? R_world2cam.ToArray(); + var t_world2camArray = t_world2cam as Mat[] ?? t_world2cam.ToArray(); + var R_base2gripperArray = R_base2gripper as Mat[] ?? R_base2gripper.ToArray(); + var t_base2gripperArray = t_base2gripper as Mat[] ?? t_base2gripper.ToArray(); + if (R_world2camArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(R_world2cam)); + if (t_world2camArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(t_world2cam)); + if (R_base2gripperArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(R_base2gripper)); + if (t_base2gripperArray.Length == 0) + throw new ArgumentException("Empty sequence", nameof(t_base2gripper)); + + var R_base2worldPtrArray = R_world2camArray.Select(m => m.CvPtr).ToArray(); + var t_world2camPtrArray = t_world2camArray.Select(m => m.CvPtr).ToArray(); + var R_base2gripperPtrArray = R_base2gripperArray.Select(m => m.CvPtr).ToArray(); + var t_base2gripperPtrArray = t_base2gripperArray.Select(m => m.CvPtr).ToArray(); + R_base2world = new double[3, 3]; + t_base2world = new double[3]; + R_gripper2cam = new double[3, 3]; + t_gripper2cam = new double[3]; + NativeMethods.HandleException( + NativeMethods.calib3d_calibrateRobotWorldHandEye_Pointer( + R_base2worldPtrArray, R_base2worldPtrArray.Length, + t_world2camPtrArray, t_world2camPtrArray.Length, + R_base2gripperPtrArray, R_base2gripperPtrArray.Length, + t_base2gripperPtrArray, t_base2gripperPtrArray.Length, + R_base2world, t_base2world, R_gripper2cam, t_gripper2cam, + (int) method)); + + foreach (var mat in R_world2camArray) GC.KeepAlive(mat); + foreach (var mat in t_world2camArray) GC.KeepAlive(mat); + foreach (var mat in R_base2gripperArray) GC.KeepAlive(mat); + foreach (var mat in t_base2gripperArray) GC.KeepAlive(mat); + } + + /// + /// converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) + /// + /// Input vector of N-dimensional points. + /// Output vector of N+1-dimensional points. + public static void ConvertPointsToHomogeneous(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsToHomogeneous_InputArray(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } - IntPtr[] objectPointsPtrs = EnumerableEx.SelectPtrs(objectPoints); - IntPtr[] imagePointsPtrs = EnumerableEx.SelectPtrs(imagePoints); + /// + /// converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) + /// + /// Input vector of N-dimensional points. + /// Output vector of N+1-dimensional points. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Vec3f[] ConvertPointsToHomogeneous(IEnumerable src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var srcA = src as Vec2f[] ?? src.ToArray(); + var dstA = new Vec3f[srcA.Length]; + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsToHomogeneous_array1(srcA, dstA, srcA.Length)); + return dstA; + } - IntPtr matPtr = NativeMethods.calib3d_initCameraMatrix2D_Mat(objectPointsPtrs, objectPointsPtrs.Length, - imagePointsPtrs, imagePointsPtrs.Length, imageSize, aspectRatio); - return new Mat(matPtr); - } - /// - /// initializes camera matrix from a few 3D points and the corresponding projections. - /// - /// Vector of vectors of the calibration pattern points in the calibration pattern coordinate space. In the old interface all the per-view vectors are concatenated. - /// Vector of vectors of the projections of the calibration pattern points. In the old interface all the per-view vectors are concatenated. - /// Image size in pixels used to initialize the principal point. - /// If it is zero or negative, both f_x and f_y are estimated independently. Otherwise, f_x = f_y * aspectRatio . - /// - public static Mat InitCameraMatrix2D( - IEnumerable> objectPoints, - IEnumerable> imagePoints, - Size imageSize, - double aspectRatio = 1.0) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints == null) - throw new ArgumentNullException(nameof(imagePoints)); + /// + /// converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) + /// + /// Input vector of N-dimensional points. + /// Output vector of N+1-dimensional points. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Vec4f[] ConvertPointsToHomogeneous(IEnumerable src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var srcA = src as Vec3f[] ?? src.ToArray(); + var dstA = new Vec4f[srcA.Length]; + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsToHomogeneous_array2(srcA, dstA, srcA.Length)); + return dstA; + } - using (var opArray = new ArrayAddress2(objectPoints)) - using (var ipArray = new ArrayAddress2(imagePoints)) - { - IntPtr matPtr = NativeMethods.calib3d_initCameraMatrix2D_array( - opArray, opArray.Dim1Length, opArray.Dim2Lengths, - ipArray, ipArray.Dim1Length, ipArray.Dim2Lengths, - imageSize, aspectRatio); - return new Mat(matPtr); - } - } - #endregion - #region FindChessboardCorners - /// - /// Finds the positions of internal corners of the chessboard. - /// - /// Source chessboard view. It must be an 8-bit grayscale or color image. - /// Number of inner corners per a chessboard row and column - /// ( patternSize = Size(points_per_row,points_per_colum) = Size(columns, rows) ). - /// Output array of detected corners. - /// Various operation flags that can be zero or a combination of the ChessboardFlag values - /// The function returns true if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). - /// Otherwise, if the function fails to find all the corners or reorder them, it returns false. - public static bool FindChessboardCorners( - InputArray image, - Size patternSize, - OutputArray corners, - ChessboardFlags flags = ChessboardFlags.AdaptiveThresh | ChessboardFlags.NormalizeImage) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (corners == null) - throw new ArgumentNullException(nameof(corners)); - image.ThrowIfDisposed(); - corners.ThrowIfNotReady(); - - int ret = NativeMethods.calib3d_findChessboardCorners_InputArray( - image.CvPtr, patternSize, corners.CvPtr, (int)flags); - corners.Fix(); - return ret != 0; - } - /// - /// Finds the positions of internal corners of the chessboard. - /// - /// Source chessboard view. It must be an 8-bit grayscale or color image. - /// Number of inner corners per a chessboard row and column - /// ( patternSize = Size(points_per_row,points_per_colum) = Size(columns, rows) ). - /// Output array of detected corners. - /// Various operation flags that can be zero or a combination of the ChessboardFlag values - /// The function returns true if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). - /// Otherwise, if the function fails to find all the corners or reorder them, it returns false. - public static bool FindChessboardCorners( - InputArray image, - Size patternSize, - out Point2f[] corners, - ChessboardFlags flags = ChessboardFlags.AdaptiveThresh | ChessboardFlags.NormalizeImage) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); + /// + /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) + /// + /// Input vector of N-dimensional points. + /// Output vector of N-1-dimensional points. + public static void ConvertPointsFromHomogeneous(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsFromHomogeneous_InputArray(src.CvPtr, dst.CvPtr)); + GC.KeepAlive(src); + dst.Fix(); + } - using (var cornersVec = new VectorOfPoint2f()) - { - int ret = NativeMethods.calib3d_findChessboardCorners_vector( - image.CvPtr, patternSize, cornersVec.CvPtr, (int)flags); - corners = cornersVec.ToArray(); - return ret != 0; - } - } - #endregion - #region Find4QuadCornerSubpix - /// - /// finds subpixel-accurate positions of the chessboard corners - /// - /// - /// - /// - /// - public static bool Find4QuadCornerSubpix(InputArray img, InputOutputArray corners, Size regionSize) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (corners == null) - throw new ArgumentNullException(nameof(corners)); - img.ThrowIfDisposed(); - corners.ThrowIfNotReady(); - - int ret = NativeMethods.calib3d_find4QuadCornerSubpix_InputArray( - img.CvPtr, corners.CvPtr, regionSize); - corners.Fix(); - return ret != 0; - } - /// - /// finds subpixel-accurate positions of the chessboard corners - /// - /// - /// - /// - /// - public static bool Find4QuadCornerSubpix(InputArray img, [In, Out] Point2f[] corners, Size regionSize) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (corners == null) - throw new ArgumentNullException(nameof(corners)); - img.ThrowIfDisposed(); + /// + /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) + /// + /// Input vector of N-dimensional points. + /// Output vector of N-1-dimensional points. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Vec2f[] ConvertPointsFromHomogeneous(IEnumerable src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var srcA = src as Vec3f[] ?? src.ToArray(); + var dstA = new Vec2f[srcA.Length]; + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsFromHomogeneous_array1(srcA, dstA, srcA.Length)); + return dstA; + } - using (var cornersVec = new VectorOfPoint2f(corners)) - { - int ret = NativeMethods.calib3d_find4QuadCornerSubpix_vector( - img.CvPtr, cornersVec.CvPtr, regionSize); + /// + /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) + /// + /// Input vector of N-dimensional points. + /// Output vector of N-1-dimensional points. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Vec3f[] ConvertPointsFromHomogeneous(IEnumerable src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + + var srcA = src as Vec4f[] ?? src.ToArray(); + var dstA = new Vec3f[srcA.Length]; + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsFromHomogeneous_array2(srcA, dstA, srcA.Length)); + return dstA; + } - Point2f[] newCorners = cornersVec.ToArray(); - for (int i = 0; i < corners.Length; i++) - { - corners[i] = newCorners[i]; - } + /// + /// Converts points to/from homogeneous coordinates. + /// + /// Input array or vector of 2D, 3D, or 4D points. + /// Output vector of 2D, 3D, or 4D points. + public static void ConvertPointsHomogeneous(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.calib3d_convertPointsHomogeneous(src.CvPtr, dst.CvPtr)); + GC.KeepAlive(src); + dst.Fix(); + } - return ret != 0; - } - } - #endregion - #region DrawChessboardCorners - /// - /// Renders the detected chessboard corners. - /// - /// Destination image. It must be an 8-bit color image. - /// Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)). - /// Array of detected corners, the output of findChessboardCorners. - /// Parameter indicating whether the complete board was found or not. The return value of findChessboardCorners() should be passed here. - public static void DrawChessboardCorners(InputOutputArray image, Size patternSize, - InputArray corners, bool patternWasFound) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (corners == null) - throw new ArgumentNullException(nameof(corners)); - image.ThrowIfNotReady(); - corners.ThrowIfDisposed(); + /// + /// Calculates a fundamental matrix from the corresponding points in two images. + /// + /// Array of N points from the first image. + /// The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1 . + /// Method for computing a fundamental matrix. + /// Parameter used for RANSAC. + /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is + /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to + /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise. + /// Parameter used for the RANSAC or LMedS methods only. + /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. + /// Output array of N elements, every element of which is set to 0 for outliers and + /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s. + /// fundamental matrix + public static Mat FindFundamentalMat( + InputArray points1, InputArray points2, + FundamentalMatMethods method = FundamentalMatMethods.Ransac, + double param1 = 3.0, double param2 = 0.99, + OutputArray? mask = null) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findFundamentalMat_InputArray( + points1.CvPtr, points2.CvPtr, (int) method, + param1, param2, ToPtr(mask), out var ret)); + mask?.Fix(); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + return new Mat(ret); + } - NativeMethods.calib3d_drawChessboardCorners_InputArray( - image.CvPtr, patternSize, corners.CvPtr, patternWasFound ? 1 : 0); - image.Fix(); - } - /// - /// Renders the detected chessboard corners. - /// - /// Destination image. It must be an 8-bit color image. - /// Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)). - /// Array of detected corners, the output of findChessboardCorners. - /// Parameter indicating whether the complete board was found or not. The return value of findChessboardCorners() should be passed here. - public static void DrawChessboardCorners(InputOutputArray image, Size patternSize, - IEnumerable corners, bool patternWasFound) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (corners == null) - throw new ArgumentNullException(nameof(corners)); - image.ThrowIfNotReady(); + /// + /// Calculates a fundamental matrix from the corresponding points in two images. + /// + /// Array of N points from the first image. + /// The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1 . + /// Method for computing a fundamental matrix. + /// Parameter used for RANSAC. + /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is + /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to + /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise. + /// Parameter used for the RANSAC or LMedS methods only. + /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. + /// Output array of N elements, every element of which is set to 0 for outliers and + /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s. + /// fundamental matrix + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Mat FindFundamentalMat( + IEnumerable points1, + IEnumerable points2, + FundamentalMatMethods method = FundamentalMatMethods.Ransac, + double param1 = 3.0, + double param2 = 0.99, + OutputArray? mask = null) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); - Point2f[] cornersArray = EnumerableEx.ToArray(corners); - NativeMethods.calib3d_drawChessboardCorners_array( - image.CvPtr, patternSize, cornersArray, cornersArray.Length, - patternWasFound ? 1 : 0); - image.Fix(); - } - #endregion - #region FindCirclesGrid - /// - /// Finds centers in the grid of circles. - /// - /// grid view of input circles; it must be an 8-bit grayscale or color image. - /// number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ). - /// output array of detected centers. - /// various operation flags that can be one of the FindCirclesGridFlag values - /// feature detector that finds blobs like dark circles on light background. - /// - public static bool FindCirclesGrid( - InputArray image, - Size patternSize, - OutputArray centers, - FindCirclesGridFlags flags = FindCirclesGridFlags.SymmetricGrid, - FeatureDetector blobDetector = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (centers == null) - throw new ArgumentNullException(nameof(centers)); - image.ThrowIfDisposed(); - centers.ThrowIfNotReady(); - - int ret = NativeMethods.calib3d_findCirclesGrid_InputArray( - image.CvPtr, patternSize, centers.CvPtr, (int)flags, ToPtr(blobDetector)); - centers.Fix(); - return ret != 0; - } - /// - /// Finds centers in the grid of circles. - /// - /// grid view of input circles; it must be an 8-bit grayscale or color image. - /// number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ). - /// output array of detected centers. - /// various operation flags that can be one of the FindCirclesGridFlag values - /// feature detector that finds blobs like dark circles on light background. - /// - public static bool FindCirclesGrid( - InputArray image, - Size patternSize, - out Point2f[] centers, - FindCirclesGridFlags flags = FindCirclesGridFlags.SymmetricGrid, - FeatureDetector blobDetector = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); + var points1Array = points1 as Point2f[] ?? points1.ToArray(); + var points2Array = points2 as Point2f[] ?? points2.ToArray(); - using (var centersVec = new VectorOfPoint2f()) - { - int ret = NativeMethods.calib3d_findCirclesGrid_vector( - image.CvPtr, patternSize, centersVec.CvPtr, (int)flags, ToPtr(blobDetector)); - centers = centersVec.ToArray(); - return ret != 0; - } - } - #endregion - #region CalibrateCamera - /// - /// finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern. - /// - /// In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. - /// The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and - /// it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns - /// in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, - /// if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. - /// In the old interface all the vectors of object points from different views are concatenated together. - /// In the new interface it is a vector of vectors of the projections of calibration pattern points. - /// imagePoints.Count() and objectPoints.Count() and imagePoints[i].Count() must be equal to objectPoints[i].Count() for each i. - /// Size of the image used only to initialize the intrinsic camera matrix. - /// Output 3x3 floating-point camera matrix. - /// If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be - /// initialized before calling the function. - /// Output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// Output vector of rotation vectors (see Rodrigues() ) estimated for each pattern view. That is, each k-th rotation vector - /// together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern - /// from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the - /// calibration pattern in the k-th pattern view (k=0.. M -1) - /// Output vector of translation vectors estimated for each pattern view. - /// Different flags that may be zero or a combination of the CalibrationFlag values - /// Termination criteria for the iterative optimization algorithm. - /// - public static double CalibrateCamera( - IEnumerable objectPoints, - IEnumerable imagePoints, - Size imageSize, - InputOutputArray cameraMatrix, - InputOutputArray distCoeffs, - out Mat[] rvecs, - out Mat[] tvecs, - CalibrationFlags flags = CalibrationFlags.None, - TermCriteria? criteria = null) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (distCoeffs == null) - throw new ArgumentNullException(nameof(distCoeffs)); - cameraMatrix.ThrowIfNotReady(); - distCoeffs.ThrowIfNotReady(); - - TermCriteria criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, Double.Epsilon)); - - IntPtr[] objectPointsPtrs = EnumerableEx.SelectPtrs(objectPoints); - IntPtr[] imagePointsPtrs = EnumerableEx.SelectPtrs(imagePoints); - - double ret; - using (var rvecsVec = new VectorOfMat()) - using (var tvecsVec = new VectorOfMat()) - { - ret = NativeMethods.calib3d_calibrateCamera_InputArray( - objectPointsPtrs, objectPointsPtrs.Length, - imagePointsPtrs, objectPointsPtrs.Length, - imageSize, cameraMatrix.CvPtr, distCoeffs.CvPtr, - rvecsVec.CvPtr, tvecsVec.CvPtr, (int)flags, criteria0); - rvecs = rvecsVec.ToArray(); - tvecs = tvecsVec.ToArray(); - } + NativeMethods.HandleException( + NativeMethods.calib3d_findFundamentalMat_arrayF32( + points1Array, points1Array.Length, + points2Array, points2Array.Length, (int) method, + param1, param2, ToPtr(mask), out var ret)); + mask?.Fix(); + return new Mat(ret); + } - cameraMatrix.Fix(); - distCoeffs.Fix(); - return ret; - } + /// + /// Calculates a fundamental matrix from the corresponding points in two images. + /// + /// Array of N points from the first image. + /// The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1 . + /// Method for computing a fundamental matrix. + /// Parameter used for RANSAC. + /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is + /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to + /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise. + /// Parameter used for the RANSAC or LMedS methods only. + /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. + /// Output array of N elements, every element of which is set to 0 for outliers and + /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s. + /// fundamental matrix + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Mat FindFundamentalMat( + IEnumerable points1, + IEnumerable points2, + FundamentalMatMethods method = FundamentalMatMethods.Ransac, + double param1 = 3.0, + double param2 = 0.99, + OutputArray? mask = null) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); - /// - /// finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern. - /// - /// In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. - /// The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and - /// it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns - /// in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, - /// if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. - /// In the old interface all the vectors of object points from different views are concatenated together. - /// In the new interface it is a vector of vectors of the projections of calibration pattern points. - /// imagePoints.Count() and objectPoints.Count() and imagePoints[i].Count() must be equal to objectPoints[i].Count() for each i. - /// Size of the image used only to initialize the intrinsic camera matrix. - /// Output 3x3 floating-point camera matrix. - /// If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be - /// initialized before calling the function. - /// Output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// Output vector of rotation vectors (see Rodrigues() ) estimated for each pattern view. That is, each k-th rotation vector - /// together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern - /// from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the - /// calibration pattern in the k-th pattern view (k=0.. M -1) - /// Output vector of translation vectors estimated for each pattern view. - /// Different flags that may be zero or a combination of the CalibrationFlag values - /// Termination criteria for the iterative optimization algorithm. - /// - public static double CalibrateCamera( - IEnumerable> objectPoints, - IEnumerable> imagePoints, - Size imageSize, - double[,] cameraMatrix, - double[] distCoeffs, - out Vec3d[] rvecs, - out Vec3d[] tvecs, - CalibrationFlags flags = CalibrationFlags.None, - TermCriteria? criteria = null) + var points1Array = points1 as Point2d[] ?? points1.ToArray(); + var points2Array = points2 as Point2d[] ?? points2.ToArray(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findFundamentalMat_arrayF64( + points1Array, points1Array.Length, + points2Array, points2Array.Length, (int) method, + param1, param2, ToPtr(mask), out var ret)); + mask?.Fix(); + return new Mat(ret); + } + + /// + /// For points in an image of a stereo pair, computes the corresponding epilines in the other image. + /// + /// Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2. + /// Index of the image (1 or 2) that contains the points . + /// Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() . + /// Output vector of the epipolar lines corresponding to the points in the other image. + /// Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) . + public static void ComputeCorrespondEpilines(InputArray points, + int whichImage, + InputArray F, + OutputArray lines) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + points.ThrowIfDisposed(); + F.ThrowIfDisposed(); + lines.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_computeCorrespondEpilines_InputArray( + points.CvPtr, whichImage, F.CvPtr, lines.CvPtr)); + + GC.KeepAlive(F); + GC.KeepAlive(points); + lines.Fix(); + } + + /// + /// For points in an image of a stereo pair, computes the corresponding epilines in the other image. + /// + /// Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2. + /// Index of the image (1 or 2) that contains the points . + /// Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() . + /// Output vector of the epipolar lines corresponding to the points in the other image. + /// Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) . + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Point3f[] ComputeCorrespondEpilines(IEnumerable points, + int whichImage, double[,] F) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (F.GetLength(0) != 3 && F.GetLength(1) != 3) + throw new ArgumentException("F != double[3,3]"); + + var pointsArray = points as Point2d[] ?? points.ToArray(); + var lines = new Point3f[pointsArray.Length]; + + unsafe { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (distCoeffs == null) - throw new ArgumentNullException(nameof(distCoeffs)); - - TermCriteria criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, Double.Epsilon)); - - using (var op = new ArrayAddress2(objectPoints)) - using (var ip = new ArrayAddress2(imagePoints)) - using (var rvecsVec = new VectorOfMat()) - using (var tvecsVec = new VectorOfMat()) + fixed (double* FPtr = F) { - double ret = NativeMethods.calib3d_calibrateCamera_vector( - op.Pointer, op.Dim1Length, op.Dim2Lengths, - ip.Pointer, ip.Dim1Length, ip.Dim2Lengths, - imageSize, cameraMatrix, distCoeffs, distCoeffs.Length, - rvecsVec.CvPtr, tvecsVec.CvPtr, (int)flags, criteria0); - Mat[] rvecsM = rvecsVec.ToArray(); - Mat[] tvecsM = tvecsVec.ToArray(); - rvecs = EnumerableEx.SelectToArray(rvecsM, m => m.Get(0)); - tvecs = EnumerableEx.SelectToArray(tvecsM, m => m.Get(0)); - return ret; + NativeMethods.HandleException( + NativeMethods.calib3d_computeCorrespondEpilines_array2d( + pointsArray, pointsArray.Length, + whichImage, FPtr, lines)); } } - #endregion - #region CalibrationMatrixValues - /// - /// computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size. - /// - /// Input camera matrix that can be estimated by calibrateCamera() or stereoCalibrate() . - /// Input image size in pixels. - /// Physical width of the sensor. - /// Physical height of the sensor. - /// Output field of view in degrees along the horizontal sensor axis. - /// Output field of view in degrees along the vertical sensor axis. - /// Focal length of the lens in mm. - /// Principal point in pixels. - /// fy / fx - public static void CalibrationMatrixValues( - InputArray cameraMatrix, Size imageSize, - double apertureWidth, double apertureHeight, - out double fovx, out double fovy, out double focalLength, - out Point2d principalPoint, out double aspectRatio) - { - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - cameraMatrix.ThrowIfDisposed(); - NativeMethods.calib3d_calibrationMatrixValues_InputArray(cameraMatrix.CvPtr, - imageSize, apertureWidth, apertureHeight, out fovx, out fovy, out focalLength, - out principalPoint, out aspectRatio); - } - /// - /// computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size. - /// - /// Input camera matrix that can be estimated by calibrateCamera() or stereoCalibrate() . - /// Input image size in pixels. - /// Physical width of the sensor. - /// Physical height of the sensor. - /// Output field of view in degrees along the horizontal sensor axis. - /// Output field of view in degrees along the vertical sensor axis. - /// Focal length of the lens in mm. - /// Principal point in pixels. - /// fy / fx - public static void CalibrationMatrixValues( - double[,] cameraMatrix, Size imageSize, - double apertureWidth, double apertureHeight, - out double fovx, out double fovy, out double focalLength, - out Point2d principalPoint, out double aspectRatio) + return lines; + } + /// + /// For points in an image of a stereo pair, computes the corresponding epilines in the other image. + /// + /// Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2. + /// Index of the image (1 or 2) that contains the points . + /// Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() . + /// Output vector of the epipolar lines corresponding to the points in the other image. + /// Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) . + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Point3f[] ComputeCorrespondEpilines(IEnumerable points, + int whichImage, double[,] F) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (F.GetLength(0) != 3 && F.GetLength(1) != 3) + throw new ArgumentException("F != double[3,3]"); + + var pointsArray = points as Point3d[] ?? points.ToArray(); + var lines = new Point3f[pointsArray.Length]; + + unsafe { - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (cameraMatrix.GetLength(0) != 3 || cameraMatrix.GetLength(1) != 3) - throw new ArgumentException("cameraMatrix must be 3x3"); - - NativeMethods.calib3d_calibrationMatrixValues_array(cameraMatrix, - imageSize, apertureWidth, apertureHeight, out fovx, out fovy, out focalLength, - out principalPoint, out aspectRatio); + fixed (double* FPtr = F) + { + NativeMethods.HandleException( + NativeMethods.calib3d_computeCorrespondEpilines_array3d( + pointsArray, pointsArray.Length, + whichImage, FPtr, lines)); + } } - #endregion - #region StereoCalibrate - /// - /// finds intrinsic and extrinsic parameters of a stereo camera - /// - /// Vector of vectors of the calibration pattern points. - /// Vector of vectors of the projections of the calibration pattern points, observed by the first camera. - /// Vector of vectors of the projections of the calibration pattern points, observed by the second camera. - /// Input/output first camera matrix - /// Input/output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// The output vector length depends on the flags. - /// Input/output second camera matrix. The parameter is similar to cameraMatrix1 . - /// Input/output lens distortion coefficients for the second camera. The parameter is similar to distCoeffs1 . - /// Size of the image used only to initialize intrinsic camera matrix. - /// Output rotation matrix between the 1st and the 2nd camera coordinate systems. - /// Output translation vector between the coordinate systems of the cameras. - /// Output essential matrix. - /// Output fundamental matrix. - /// Termination criteria for the iterative optimization algorithm. - /// Different flags that may be zero or a combination of the CalibrationFlag values - /// - public static double StereoCalibrate(IEnumerable objectPoints, - IEnumerable imagePoints1, - IEnumerable imagePoints2, - InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, - InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, - Size imageSize, OutputArray R, - OutputArray T, OutputArray E, OutputArray F, - CalibrationFlags flags = CalibrationFlags.FixIntrinsic, - TermCriteria? criteria = null) - { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints1 == null) - throw new ArgumentNullException(nameof(imagePoints1)); - if (imagePoints2 == null) - throw new ArgumentNullException(nameof(imagePoints2)); - if (cameraMatrix1 == null) - throw new ArgumentNullException(nameof(cameraMatrix1)); - if (distCoeffs1 == null) - throw new ArgumentNullException(nameof(distCoeffs1)); - if (cameraMatrix2 == null) - throw new ArgumentNullException(nameof(cameraMatrix2)); - if (distCoeffs2 == null) - throw new ArgumentNullException(nameof(distCoeffs2)); - cameraMatrix1.ThrowIfDisposed(); - distCoeffs1.ThrowIfDisposed(); - cameraMatrix2.ThrowIfDisposed(); - distCoeffs2.ThrowIfDisposed(); - cameraMatrix1.ThrowIfNotReady(); - cameraMatrix2.ThrowIfNotReady(); - distCoeffs1.ThrowIfNotReady(); - distCoeffs2.ThrowIfNotReady(); - - IntPtr[] opPtrs = EnumerableEx.SelectPtrs(objectPoints); - IntPtr[] ip1Ptrs = EnumerableEx.SelectPtrs(imagePoints1); - IntPtr[] ip2Ptrs = EnumerableEx.SelectPtrs(imagePoints2); - - TermCriteria criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, 1e-6)); - - double result = - NativeMethods.calib3d_stereoCalibrate_InputArray( - opPtrs, opPtrs.Length, - ip1Ptrs, ip1Ptrs.Length, ip2Ptrs, ip2Ptrs.Length, - cameraMatrix1.CvPtr, distCoeffs1.CvPtr, - cameraMatrix2.CvPtr, distCoeffs2.CvPtr, - imageSize, ToPtr(R), ToPtr(T), ToPtr(E), ToPtr(F), - (int)flags, criteria0); - - cameraMatrix1.Fix(); - distCoeffs1.Fix(); - cameraMatrix2.Fix(); - distCoeffs2.Fix(); - if (R != null) - R.Fix(); - if (T != null) - T.Fix(); - if (E != null) - E.Fix(); - if (F != null) - F.Fix(); + return lines; + } - return result; - } + /// + /// Reconstructs points by triangulation. + /// + /// 3x4 projection matrix of the first camera. + /// 3x4 projection matrix of the second camera. + /// 2xN array of feature points in the first image. In case of c++ version + /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. + /// 2xN array of corresponding points in the second image. In case of c++ version + /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. + /// 4xN array of reconstructed points in homogeneous coordinates. + public static void TriangulatePoints( + InputArray projMatr1, InputArray projMatr2, + InputArray projPoints1, InputArray projPoints2, + OutputArray points4D) + { + if (projMatr1 is null) + throw new ArgumentNullException(nameof(projMatr1)); + if (projMatr2 is null) + throw new ArgumentNullException(nameof(projMatr2)); + if (projPoints1 is null) + throw new ArgumentNullException(nameof(projPoints1)); + if (projPoints2 is null) + throw new ArgumentNullException(nameof(projPoints2)); + if (points4D is null) + throw new ArgumentNullException(nameof(points4D)); + projMatr1.ThrowIfDisposed(); + projMatr2.ThrowIfDisposed(); + projPoints1.ThrowIfDisposed(); + projPoints2.ThrowIfDisposed(); + points4D.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_triangulatePoints_InputArray( + projMatr1.CvPtr, projMatr2.CvPtr, + projPoints1.CvPtr, projPoints2.CvPtr, points4D.CvPtr)); - /// - /// finds intrinsic and extrinsic parameters of a stereo camera - /// - /// Vector of vectors of the calibration pattern points. - /// Vector of vectors of the projections of the calibration pattern points, observed by the first camera. - /// Vector of vectors of the projections of the calibration pattern points, observed by the second camera. - /// Input/output first camera matrix - /// Input/output vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// The output vector length depends on the flags. - /// Input/output second camera matrix. The parameter is similar to cameraMatrix1 . - /// Input/output lens distortion coefficients for the second camera. The parameter is similar to distCoeffs1 . - /// Size of the image used only to initialize intrinsic camera matrix. - /// Output rotation matrix between the 1st and the 2nd camera coordinate systems. - /// Output translation vector between the coordinate systems of the cameras. - /// Output essential matrix. - /// Output fundamental matrix. - /// Termination criteria for the iterative optimization algorithm. - /// Different flags that may be zero or a combination of the CalibrationFlag values - /// - public static double StereoCalibrate(IEnumerable> objectPoints, - IEnumerable> imagePoints1, - IEnumerable> imagePoints2, - double[,] cameraMatrix1, double[] distCoeffs1, - double[,] cameraMatrix2, double[] distCoeffs2, - Size imageSize, OutputArray R, - OutputArray T, OutputArray E, OutputArray F, - CalibrationFlags flags = CalibrationFlags.FixIntrinsic, - TermCriteria? criteria = null) + GC.KeepAlive(projMatr1); + GC.KeepAlive(projMatr2); + GC.KeepAlive(projPoints1); + GC.KeepAlive(projPoints2); + points4D.Fix(); + } + + + /// + /// Reconstructs points by triangulation. + /// + /// 3x4 projection matrix of the first camera. + /// 3x4 projection matrix of the second camera. + /// 2xN array of feature points in the first image. In case of c++ version + /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. + /// 2xN array of corresponding points in the second image. In case of c++ version + /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. + /// 4xN array of reconstructed points in homogeneous coordinates. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Vec4d[] TriangulatePoints( + double[,] projMatr1, + double[,] projMatr2, + IEnumerable projPoints1, + IEnumerable projPoints2) + { + if (projMatr1 is null) + throw new ArgumentNullException(nameof(projMatr1)); + if (projMatr2 is null) + throw new ArgumentNullException(nameof(projMatr2)); + if (projPoints1 is null) + throw new ArgumentNullException(nameof(projPoints1)); + if (projPoints2 is null) + throw new ArgumentNullException(nameof(projPoints2)); + if (projMatr1.GetLength(0) != 3 && projMatr1.GetLength(1) != 4) + throw new ArgumentException($"{nameof(projMatr1)} != double[3,4]"); + if (projMatr2.GetLength(0) != 3 && projMatr2.GetLength(1) != 4) + throw new ArgumentException($"{nameof(projMatr2)} != double[3,4]"); + + var projPoints1Array = projPoints1 as Point2d[] ?? projPoints1.ToArray(); + var projPoints2Array = projPoints2 as Point2d[] ?? projPoints2.ToArray(); + var points4D = new Vec4d[projPoints1Array.Length]; + + unsafe { - if (objectPoints == null) - throw new ArgumentNullException(nameof(objectPoints)); - if (imagePoints1 == null) - throw new ArgumentNullException(nameof(imagePoints1)); - if (imagePoints2 == null) - throw new ArgumentNullException(nameof(imagePoints2)); - if (cameraMatrix1 == null) - throw new ArgumentNullException(nameof(cameraMatrix1)); - if (distCoeffs1 == null) - throw new ArgumentNullException(nameof(distCoeffs1)); - if (cameraMatrix2 == null) - throw new ArgumentNullException(nameof(cameraMatrix2)); - if (distCoeffs2 == null) - throw new ArgumentNullException(nameof(distCoeffs2)); - - TermCriteria criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, 1e-6)); - - using (var op = new ArrayAddress2(objectPoints)) - using (var ip1 = new ArrayAddress2(imagePoints1)) - using (var ip2 = new ArrayAddress2(imagePoints2)) + fixed (double* projMatr1Ptr = projMatr1) + fixed (double* projMatr2Ptr = projMatr2) { - return NativeMethods.calib3d_stereoCalibrate_array( - op.Pointer, op.Dim1Length, op.Dim2Lengths, - ip1.Pointer, ip1.Dim1Length, ip1.Dim2Lengths, - ip2.Pointer, ip2.Dim1Length, ip2.Dim2Lengths, - cameraMatrix1, distCoeffs1, distCoeffs1.Length, - cameraMatrix2, distCoeffs2, distCoeffs2.Length, - imageSize, ToPtr(R), ToPtr(T), ToPtr(E), ToPtr(F), - (int)flags, criteria0); + NativeMethods.HandleException( + NativeMethods.calib3d_triangulatePoints_array( + projMatr1Ptr, projMatr2Ptr, + projPoints1Array, projPoints1Array.Length, + projPoints2Array, projPoints2Array.Length, + points4D)); } } - #endregion - #region StereoRectify + return points4D; + } - /// - /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters - /// - /// First camera matrix. - /// First camera distortion parameters. - /// Second camera matrix. - /// Second camera distortion parameters. - /// Size of the image used for stereo calibration. - /// Rotation matrix between the coordinate systems of the first and the second cameras. - /// Translation vector between coordinate systems of the cameras. - /// Output 3x3 rectification transform (rotation matrix) for the first camera. - /// Output 3x3 rectification transform (rotation matrix) for the second camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. - /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). - /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. - /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. - /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. - /// Free scaling parameter. - /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. - /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). - /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained - /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. - /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . - /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. - public static void StereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, - InputArray cameraMatrix2, InputArray distCoeffs2, - Size imageSize, InputArray R, InputArray T, - OutputArray R1, OutputArray R2, - OutputArray P1, OutputArray P2, - OutputArray Q, - StereoRectificationFlags flags = StereoRectificationFlags.ZeroDisparity, - double alpha = -1, Size? newImageSize = null) + /// + /// Refines coordinates of corresponding points. + /// + /// 3x3 fundamental matrix. + /// 1xN array containing the first set of points. + /// 1xN array containing the second set of points. + /// The optimized points1. + /// The optimized points2. + public static void CorrectMatches( + InputArray F, InputArray points1, InputArray points2, + OutputArray newPoints1, OutputArray newPoints2) + { + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (newPoints1 is null) + throw new ArgumentNullException(nameof(newPoints1)); + if (newPoints2 is null) + throw new ArgumentNullException(nameof(newPoints2)); + F.ThrowIfDisposed(); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + newPoints1.ThrowIfNotReady(); + newPoints2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_correctMatches_InputArray( + F.CvPtr, points1.CvPtr, points2.CvPtr, + newPoints1.CvPtr, newPoints2.CvPtr)); + + GC.KeepAlive(F); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + newPoints1.Fix(); + newPoints2.Fix(); + } + + /// + /// Refines coordinates of corresponding points. + /// + /// 3x3 fundamental matrix. + /// 1xN array containing the first set of points. + /// 1xN array containing the second set of points. + /// The optimized points1. + /// The optimized points2. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void CorrectMatches( + double[,] F, + IEnumerable points1, + IEnumerable points2, + out Point2d[] newPoints1, + out Point2d[] newPoints2) + { + if (F is null) + throw new ArgumentNullException(nameof(F)); + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + + var points1Array = points1 as Point2d[] ?? points1.ToArray(); + var points2Array = points2 as Point2d[] ?? points2.ToArray(); + newPoints1 = new Point2d[points1Array.Length]; + newPoints2 = new Point2d[points2Array.Length]; + + unsafe { - Size newImageSize0 = newImageSize.GetValueOrDefault(new Size(0, 0)); - Rect validPixROI1, validPixROI2; - StereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, - imageSize, R, T, R1, R2, P1, P2, Q, flags, alpha, newImageSize0, - out validPixROI1, out validPixROI2); + fixed (double* FPtr = F) + { + NativeMethods.HandleException( + NativeMethods.calib3d_correctMatches_array( + FPtr, points1Array, points1Array.Length, + points2Array, points2Array.Length, + newPoints1, newPoints2)); + } } - /// - /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters - /// - /// First camera matrix. - /// First camera distortion parameters. - /// Second camera matrix. - /// Second camera distortion parameters. - /// Size of the image used for stereo calibration. - /// Rotation matrix between the coordinate systems of the first and the second cameras. - /// Translation vector between coordinate systems of the cameras. - /// Output 3x3 rectification transform (rotation matrix) for the first camera. - /// Output 3x3 rectification transform (rotation matrix) for the second camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. - /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). - /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. - /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. - /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. - /// Free scaling parameter. - /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. - /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). - /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained - /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. - /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . - /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. - /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. - /// Otherwise, they are likely to be smaller. - /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. - /// Otherwise, they are likely to be smaller. - public static void StereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, - InputArray cameraMatrix2, InputArray distCoeffs2, - Size imageSize, InputArray R, InputArray T, - OutputArray R1, OutputArray R2, - OutputArray P1, OutputArray P2, - OutputArray Q, StereoRectificationFlags flags, - double alpha, Size newImageSize, - out Rect validPixROI1, out Rect validPixROI2) - { - if (cameraMatrix1 == null) - throw new ArgumentNullException(nameof(cameraMatrix1)); - if (distCoeffs1 == null) - throw new ArgumentNullException(nameof(distCoeffs1)); - if (cameraMatrix2 == null) - throw new ArgumentNullException(nameof(cameraMatrix2)); - if (distCoeffs2 == null) - throw new ArgumentNullException(nameof(distCoeffs2)); - if (R == null) - throw new ArgumentNullException(nameof(R)); - if (T == null) - throw new ArgumentNullException(nameof(T)); - if (R1 == null) - throw new ArgumentNullException(nameof(R1)); - if (R2 == null) - throw new ArgumentNullException(nameof(R2)); - if (P1 == null) - throw new ArgumentNullException(nameof(P1)); - if (P2 == null) - throw new ArgumentNullException(nameof(P2)); - if (Q == null) - throw new ArgumentNullException(nameof(Q)); - cameraMatrix1.ThrowIfDisposed(); - distCoeffs1.ThrowIfDisposed(); - cameraMatrix2.ThrowIfDisposed(); - distCoeffs2.ThrowIfDisposed(); - R.ThrowIfDisposed(); - T.ThrowIfDisposed(); - R1.ThrowIfNotReady(); - R2.ThrowIfNotReady(); - P1.ThrowIfNotReady(); - P2.ThrowIfNotReady(); - Q.ThrowIfNotReady(); + } - NativeMethods.calib3d_stereoRectify_InputArray( - cameraMatrix1.CvPtr, distCoeffs1.CvPtr, - cameraMatrix2.CvPtr, distCoeffs2.CvPtr, - imageSize, R.CvPtr, T.CvPtr, - R1.CvPtr, R2.CvPtr, P1.CvPtr, P2.CvPtr, Q.CvPtr, - (int)flags, alpha, newImageSize, out validPixROI1, out validPixROI2); - - R1.Fix(); - R2.Fix(); - P1.Fix(); - P2.Fix(); - Q.Fix(); - } + /// + /// Recover relative camera rotation and translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. + /// Returns the number of inliers which pass the check. + /// + /// The input essential matrix. + /// Array of N 2D points from the first image. The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1. + /// Camera matrix K=⎡⎣⎢fx000fy0cxcy1⎤⎦⎥ . Note that this function assumes that points1 and points2 are feature points from cameras with the same camera matrix. + /// Recovered relative rotation. + /// Recovered relative translation. + /// Input/output mask for inliers in points1 and points2. : + /// If it is not empty, then it marks inliers in points1 and points2 for then given essential matrix E. + /// Only these inliers will be used to recover pose. In the output mask only inliers which pass the cheirality check. + /// This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. + /// The cheirality check basically means that the triangulated 3D points should have positive depth. + public static int RecoverPose( + InputArray E, InputArray points1, InputArray points2, InputArray cameraMatrix, + OutputArray R, OutputArray t, + InputOutputArray? mask = null) + { + if (E is null) + throw new ArgumentNullException(nameof(E)); + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (R is null) + throw new ArgumentNullException(nameof(R)); + if (t is null) + throw new ArgumentNullException(nameof(t)); + E.ThrowIfDisposed(); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + R.ThrowIfNotReady(); + t.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_recoverPose_InputArray1( + E.CvPtr, points1.CvPtr, points2.CvPtr, cameraMatrix.CvPtr, + R.CvPtr, t.CvPtr, ToPtr(mask), out var ret)); + + GC.KeepAlive(E); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + GC.KeepAlive(cameraMatrix); + R.Fix(); + t.Fix(); + mask?.Fix(); + + return ret; + } + /// + /// Recover relative camera rotation and translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. + /// Returns the number of inliers which pass the check. + /// + /// The input essential matrix. + /// Array of N 2D points from the first image. The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1. + /// Recovered relative rotation. + /// Recovered relative translation. + /// Focal length of the camera. Note that this function assumes that points1 and points2 are feature points from cameras with same focal length and principal point. + /// principal point of the camera. + /// Input/output mask for inliers in points1 and points2. : + /// If it is not empty, then it marks inliers in points1 and points2 for then given essential matrix E. + /// Only these inliers will be used to recover pose. In the output mask only inliers which pass the cheirality check. + /// This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. + /// The cheirality check basically means that the triangulated 3D points should have positive depth. + public static int RecoverPose( + InputArray E, InputArray points1, InputArray points2, + OutputArray R, OutputArray t, double focal, Point2d pp, + InputOutputArray? mask = null) + { + if (E is null) + throw new ArgumentNullException(nameof(E)); + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (R is null) + throw new ArgumentNullException(nameof(R)); + if (t is null) + throw new ArgumentNullException(nameof(t)); + E.ThrowIfDisposed(); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + R.ThrowIfNotReady(); + t.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_recoverPose_InputArray2( + E.CvPtr, points1.CvPtr, points2.CvPtr, + R.CvPtr, t.CvPtr, focal, pp, ToPtr(mask), out var ret)); + + GC.KeepAlive(E); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + GC.KeepAlive(pp); + R.Fix(); + t.Fix(); + mask?.Fix(); + + return ret; + } - /// - /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters - /// - /// First camera matrix. - /// First camera distortion parameters. - /// Second camera matrix. - /// Second camera distortion parameters. - /// Size of the image used for stereo calibration. - /// Rotation matrix between the coordinate systems of the first and the second cameras. - /// Translation vector between coordinate systems of the cameras. - /// Output 3x3 rectification transform (rotation matrix) for the first camera. - /// Output 3x3 rectification transform (rotation matrix) for the second camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. - /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). - /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. - /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. - /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. - /// Free scaling parameter. - /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. - /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). - /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained - /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. - /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . - /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. - public static void StereoRectify(double[,] cameraMatrix1, double[] distCoeffs1, - double[,] cameraMatrix2, double[] distCoeffs2, - Size imageSize, double[,] R, double[] T, - out double[,] R1, out double[,] R2, - out double[,] P1, out double[,] P2, - out double[,] Q, - StereoRectificationFlags flags = StereoRectificationFlags.ZeroDisparity, - double alpha = -1, Size? newImageSize = null) - { - Size newImageSize0 = newImageSize.GetValueOrDefault(new Size(0, 0)); - Rect validPixROI1, validPixROI2; - StereoRectify( - cameraMatrix1, distCoeffs1, - cameraMatrix2, distCoeffs2, - imageSize, R, T, - out R1, out R2, out P1, out P2, out Q, - flags, alpha, newImageSize0, out validPixROI1, out validPixROI2); - } + /// + /// Recover relative camera rotation and translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. + /// Returns the number of inliers which pass the check. + /// + /// The input essential matrix. + /// Array of N 2D points from the first image. The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1. + /// Camera matrix K=⎡⎣⎢fx000fy0cxcy1⎤⎦⎥ . Note that this function assumes that points1 and points2 are feature points from cameras with the same camera matrix. + /// Recovered relative rotation. + /// Recovered relative translation. + /// threshold distance which is used to filter out far away points (i.e. infinite points). + /// Input/output mask for inliers in points1 and points2. : + /// If it is not empty, then it marks inliers in points1 and points2 for then given essential matrix E. + /// Only these inliers will be used to recover pose. In the output mask only inliers which pass the cheirality check. + /// This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. + /// The cheirality check basically means that the triangulated 3D points should have positive depth. + /// 3d points which were reconstructed by triangulation. + public static int RecoverPose( + InputArray E, InputArray points1, InputArray points2, InputArray cameraMatrix, + OutputArray R, OutputArray t, double distanceTresh, + InputOutputArray? mask = null, OutputArray? triangulatedPoints = null) + { + if (E is null) + throw new ArgumentNullException(nameof(E)); + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (R is null) + throw new ArgumentNullException(nameof(R)); + if (t is null) + throw new ArgumentNullException(nameof(t)); + E.ThrowIfDisposed(); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + R.ThrowIfNotReady(); + t.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_recoverPose_InputArray3( + E.CvPtr, points1.CvPtr, points2.CvPtr, cameraMatrix.CvPtr, + R.CvPtr, t.CvPtr, distanceTresh, ToPtr(mask), ToPtr(triangulatedPoints), out var ret)); + + GC.KeepAlive(E); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + GC.KeepAlive(cameraMatrix); + R.Fix(); + t.Fix(); + mask?.Fix(); + triangulatedPoints?.Fix(); + + return ret; + } - /// - /// computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters - /// - /// First camera matrix. - /// First camera distortion parameters. - /// Second camera matrix. - /// Second camera distortion parameters. - /// Size of the image used for stereo calibration. - /// Rotation matrix between the coordinate systems of the first and the second cameras. - /// Translation vector between coordinate systems of the cameras. - /// Output 3x3 rectification transform (rotation matrix) for the first camera. - /// Output 3x3 rectification transform (rotation matrix) for the second camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. - /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. - /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D() ). - /// Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY. - /// If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. - /// And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area. - /// Free scaling parameter. - /// If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. - /// alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). - /// alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained - /// in the rectified images (no source image pixels are lost). Obviously, any intermediate value yields an intermediate result between those two extreme cases. - /// New image resolution after rectification. The same size should be passed to initUndistortRectifyMap(). When (0,0) is passed (default), it is set to the original imageSize . - /// Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion. - /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. - /// Otherwise, they are likely to be smaller. - /// Optional output rectangles inside the rectified images where all the pixels are valid. If alpha=0 , the ROIs cover the whole images. - /// Otherwise, they are likely to be smaller. - public static void StereoRectify(double[,] cameraMatrix1, double[] distCoeffs1, - double[,] cameraMatrix2, double[] distCoeffs2, - Size imageSize, double[,] R, double[] T, - out double[,] R1, out double[,] R2, - out double[,] P1, out double[,] P2, - out double[,] Q, StereoRectificationFlags flags, - double alpha, Size newImageSize, - out Rect validPixROI1, out Rect validPixROI2) - { - if (cameraMatrix1 == null) - throw new ArgumentNullException(nameof(cameraMatrix1)); - if (distCoeffs1 == null) - throw new ArgumentNullException(nameof(distCoeffs1)); - if (cameraMatrix2 == null) - throw new ArgumentNullException(nameof(cameraMatrix2)); - if (distCoeffs2 == null) - throw new ArgumentNullException(nameof(distCoeffs2)); - if (R == null) - throw new ArgumentNullException(nameof(R)); - if (T == null) - throw new ArgumentNullException(nameof(T)); - - R1 = new double[3, 3]; - R2 = new double[3, 3]; - P1 = new double[3, 4]; - P2 = new double[3, 4]; - Q = new double[4, 4]; - NativeMethods.calib3d_stereoRectify_array( - cameraMatrix1, distCoeffs1, distCoeffs1.Length, - cameraMatrix2, distCoeffs2, distCoeffs2.Length, - imageSize, R, T, - R1, R2, P1, P2, Q, - (int)flags, alpha, newImageSize, out validPixROI1, out validPixROI2); - } + /// + /// Calculates an essential matrix from the corresponding points in two images. + /// + /// Array of N (N >= 5) 2D points from the first image. + /// The point coordinates should be floating-point (single or double precision). + /// Array of the second image points of the same size and format as points1 . + /// Camera matrix K=⎡⎣⎢fx000fy0cxcy1⎤⎦⎥ . Note that this function assumes that points1 and points2 are feature points from cameras with the same camera matrix. + /// Method for computing an essential matrix. + /// RANSAC for the RANSAC algorithm. + /// LMEDS for the LMedS algorithm. + /// Parameter used for the RANSAC or LMedS methods only. + /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. + /// Parameter used for RANSAC. + /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. + /// It can be set to something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise. + /// Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. + /// essential matrix + public static Mat FindEssentialMat( + InputArray points1, InputArray points2, InputArray cameraMatrix, + EssentialMatMethod method = EssentialMatMethod.Ransac, + double prob = 0.999, double threshold = 1.0, + OutputArray? mask = null) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + cameraMatrix.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findEssentialMat_InputArray1( + points1.CvPtr, points2.CvPtr, cameraMatrix.CvPtr, + (int) method, prob, threshold, ToPtr(mask), out var ret)); + + mask?.Fix(); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + GC.KeepAlive(cameraMatrix); + return new Mat(ret); + } + /// + /// Calculates an essential matrix from the corresponding points in two images. + /// + /// Array of N (N >= 5) 2D points from the first image. + /// The point coordinates should be floating-point (single or double precision). + /// Array of the second image por LMedS methods only. + /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. + /// Parameter used for RANSAC. + /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. + /// It can be set to something like 1-3, depending on ints of the same size and format as points1 . + /// Focal length of the camera. Note that this function assumes that points1 and points2 are feature points from cameras with same focal length and principal point. + /// principal point of the camera. + /// Method for computing an essential matrix. + /// RANSAC for the RANSAC algorithm. + /// LMEDS for the LMedS algorithm. + /// Parameter used for the RANSAC othe accuracy of the point localization, image resolution, and the image noise. + /// Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. + /// essential matrix + public static Mat FindEssentialMat( + InputArray points1, InputArray points2, double focal, Point2d pp, + EssentialMatMethod method = EssentialMatMethod.Ransac, + double prob = 0.999, double threshold = 1.0, + OutputArray? mask = null) + { + if (points1 is null) + throw new ArgumentNullException(nameof(points1)); + if (points2 is null) + throw new ArgumentNullException(nameof(points2)); + points1.ThrowIfDisposed(); + points2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_findEssentialMat_InputArray2( + points1.CvPtr, points2.CvPtr, focal, pp, + (int) method, prob, threshold, ToPtr(mask), out var ret)); + + mask?.Fix(); + GC.KeepAlive(points1); + GC.KeepAlive(points2); + return new Mat(ret); + } - #endregion - #region StereoRectifyUncalibrated + /// + /// filters off speckles (small regions of incorrectly computed disparity) + /// + /// The input 16-bit signed disparity image + /// The disparity value used to paint-off the speckles + /// The maximum speckle size to consider it a speckle. Larger blobs are not affected by the algorithm + /// Maximum difference between neighbor disparity pixels to put them into the same blob. + /// Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point disparity map, where disparity values + /// are multiplied by 16, this scale factor should be taken into account when specifying this parameter value. + /// The optional temporary buffer to avoid memory allocation within the function. + public static void FilterSpeckles(InputOutputArray img, double newVal, int maxSpeckleSize, double maxDiff, + InputOutputArray? buf = null) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_filterSpeckles(img.CvPtr, newVal, maxSpeckleSize, maxDiff, ToPtr(buf))); + GC.KeepAlive(img); + GC.KeepAlive(buf); + img.Fix(); + } - /// - /// computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed) - /// - /// Array of feature points in the first image. - /// The corresponding points in the second image. - /// The same formats as in findFundamentalMat() are supported. - /// Input fundamental matrix. It can be computed from the same set - /// of point pairs using findFundamentalMat() . - /// Size of the image. - /// Output rectification homography matrix for the first image. - /// Output rectification homography matrix for the second image. - /// Optional threshold used to filter out the outliers. - /// If the parameter is greater than zero, all the point pairs that do not comply - /// with the epipolar geometry (that is, the points for which |points2[i]^T * F * points1[i]| > threshold ) - /// are rejected prior to computing the homographies. Otherwise, all the points are considered inliers. - /// - public static bool StereoRectifyUncalibrated(InputArray points1, InputArray points2, - InputArray F, Size imgSize, - OutputArray H1, OutputArray H2, - double threshold = 5) - { - if (points1 == null) - throw new ArgumentNullException(nameof(points1)); - if (points2 == null) - throw new ArgumentNullException(nameof(points2)); - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (H1 == null) - throw new ArgumentNullException(nameof(H1)); - if (H2 == null) - throw new ArgumentNullException(nameof(H2)); - points1.ThrowIfDisposed(); - points2.ThrowIfDisposed(); - F.ThrowIfDisposed(); - H1.ThrowIfNotReady(); - H2.ThrowIfNotReady(); - - int ret = NativeMethods.calib3d_stereoRectifyUncalibrated_InputArray( - points1.CvPtr, points2.CvPtr, F.CvPtr, imgSize, H1.CvPtr, H2.CvPtr, threshold); - H1.Fix(); - H2.Fix(); - return ret != 0; - } + /// + /// computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify()) + /// + /// + /// + /// + /// + /// + /// + public static Rect GetValidDisparityROI(Rect roi1, Rect roi2, + int minDisparity, int numberOfDisparities, int SADWindowSize) + { + NativeMethods.HandleException( + NativeMethods.calib3d_getValidDisparityROI( + roi1, roi2, minDisparity, numberOfDisparities, SADWindowSize, out var ret)); + return ret; + } - /// - /// computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed) - /// - /// Array of feature points in the first image. - /// The corresponding points in the second image. - /// The same formats as in findFundamentalMat() are supported. - /// Input fundamental matrix. It can be computed from the same set - /// of point pairs using findFundamentalMat() . - /// Size of the image. - /// Output rectification homography matrix for the first image. - /// Output rectification homography matrix for the second image. - /// Optional threshold used to filter out the outliers. - /// If the parameter is greater than zero, all the point pairs that do not comply - /// with the epipolar geometry (that is, the points for which |points2[i]^T * F * points1[i]| > threshold ) - /// are rejected prior to computing the homographies. Otherwise, all the points are considered inliers. - /// - public static bool StereoRectifyUncalibrated(IEnumerable points1, - IEnumerable points2, - double[,] F, Size imgSize, - out double[,] H1, out double[,] H2, - double threshold = 5 - ) - { - if (points1 == null) - throw new ArgumentNullException(nameof(points1)); - if (points2 == null) - throw new ArgumentNullException(nameof(points2)); - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (F.GetLength(0) != 3 || F.GetLength(1) != 3) - throw new ArgumentException("F != double[3,3]"); - - Point2d[] points1Array = EnumerableEx.ToArray(points1); - Point2d[] points2Array = EnumerableEx.ToArray(points2); - - H1 = new double[3, 3]; - H2 = new double[3, 3]; - - int ret = NativeMethods.calib3d_stereoRectifyUncalibrated_array( - points1Array, points1Array.Length, - points2Array, points2Array.Length, - F, imgSize, H1, H2, threshold); - return ret != 0; - } + /// + /// validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm + /// + /// + /// + /// + /// + /// + public static void ValidateDisparity(InputOutputArray disparity, InputArray cost, + int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1) + { + if (disparity is null) + throw new ArgumentNullException(nameof(disparity)); + if (cost is null) + throw new ArgumentNullException(nameof(cost)); + disparity.ThrowIfNotReady(); + cost.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_validateDisparity( + disparity.CvPtr, cost.CvPtr, minDisparity, numberOfDisparities, disp12MaxDisp)); - #endregion - #region Rectify3Collinear - /// - /// computes the rectification transformations for 3-head camera, where all the heads are on the same line. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static float Rectify3Collinear(InputArray cameraMatrix1, InputArray distCoeffs1, - InputArray cameraMatrix2, InputArray distCoeffs2, - InputArray cameraMatrix3, InputArray distCoeffs3, - IEnumerable imgpt1, IEnumerable imgpt3, - Size imageSize, InputArray R12, InputArray T12, - InputArray R13, InputArray T13, - OutputArray R1, OutputArray R2, OutputArray R3, - OutputArray P1, OutputArray P2, OutputArray P3, - OutputArray Q, double alpha, Size newImgSize, - out Rect roi1, out Rect roi2, StereoRectificationFlags flags) - { - if (cameraMatrix1 == null) - throw new ArgumentNullException(nameof(cameraMatrix1)); - if (distCoeffs1 == null) - throw new ArgumentNullException(nameof(distCoeffs1)); - if (cameraMatrix2 == null) - throw new ArgumentNullException(nameof(cameraMatrix2)); - if (distCoeffs2 == null) - throw new ArgumentNullException(nameof(distCoeffs2)); - if (cameraMatrix3 == null) - throw new ArgumentNullException(nameof(cameraMatrix3)); - if (distCoeffs3 == null) - throw new ArgumentNullException(nameof(distCoeffs3)); - if (imgpt1 == null) - throw new ArgumentNullException(nameof(imgpt1)); - if (imgpt3 == null) - throw new ArgumentNullException(nameof(imgpt3)); - if (R12 == null) - throw new ArgumentNullException(nameof(R12)); - if (T12 == null) - throw new ArgumentNullException(nameof(T12)); - if (R13 == null) - throw new ArgumentNullException(nameof(R13)); - if (T13 == null) - throw new ArgumentNullException(nameof(T13)); - if (R1 == null) - throw new ArgumentNullException(nameof(R1)); - if (R2 == null) - throw new ArgumentNullException(nameof(R2)); - if (R3 == null) - throw new ArgumentNullException(nameof(R3)); - if (P1 == null) - throw new ArgumentNullException(nameof(P1)); - if (P2 == null) - throw new ArgumentNullException(nameof(P2)); - if (P3 == null) - throw new ArgumentNullException(nameof(P3)); - if (Q == null) - throw new ArgumentNullException(nameof(Q)); - cameraMatrix1.ThrowIfDisposed(); - distCoeffs1.ThrowIfDisposed(); - cameraMatrix2.ThrowIfDisposed(); - distCoeffs2.ThrowIfDisposed(); - cameraMatrix3.ThrowIfDisposed(); - distCoeffs3.ThrowIfDisposed(); - R12.ThrowIfDisposed(); - T12.ThrowIfDisposed(); - R13.ThrowIfDisposed(); - T13.ThrowIfDisposed(); - R1.ThrowIfNotReady(); - R2.ThrowIfNotReady(); - R3.ThrowIfNotReady(); - P1.ThrowIfNotReady(); - P2.ThrowIfNotReady(); - P3.ThrowIfNotReady(); - Q.ThrowIfNotReady(); - - IntPtr[] imgpt1Ptrs = EnumerableEx.SelectPtrs(imgpt1); - IntPtr[] imgpt3Ptrs = EnumerableEx.SelectPtrs(imgpt3); - float ret = NativeMethods.calib3d_rectify3Collinear_InputArray( - cameraMatrix1.CvPtr, distCoeffs1.CvPtr, - cameraMatrix2.CvPtr, distCoeffs2.CvPtr, - cameraMatrix3.CvPtr, distCoeffs3.CvPtr, - imgpt1Ptrs, imgpt1Ptrs.Length, imgpt3Ptrs, imgpt3Ptrs.Length, - imageSize, R12.CvPtr, T12.CvPtr, R13.CvPtr, T13.CvPtr, - R1.CvPtr, R2.CvPtr, R3.CvPtr, P1.CvPtr, P2.CvPtr, P3.CvPtr, - Q.CvPtr, alpha, newImgSize, out roi1, out roi2, (int)flags); - R1.Fix(); - R2.Fix(); - R3.Fix(); - P1.Fix(); - P2.Fix(); - P3.Fix(); - Q.Fix(); - return ret; - } - #endregion - #region GetOptimalNewCameraMatrix + disparity.Fix(); + GC.KeepAlive(disparity); + GC.KeepAlive(cost); + } - /// - /// Returns the new camera matrix based on the free scaling parameter. - /// - /// Input camera matrix. - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the array is null, the zero distortion coefficients are assumed. - /// Original image size. - /// Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) - /// and 1 (when all the source image pixels are retained in the undistorted image). - /// Image size after rectification. By default,it is set to imageSize . - /// Optional output rectangle that outlines all-good-pixels region in the undistorted image. See roi1, roi2 description in stereoRectify() . - /// Optional flag that indicates whether in the new camera matrix the principal point - /// should be at the image center or not. By default, the principal point is chosen to best fit a - /// subset of the source image (determined by alpha) to the corrected image. - /// optimal new camera matrix - public static Mat GetOptimalNewCameraMatrix(InputArray cameraMatrix, InputArray distCoeffs, - Size imageSize, double alpha, Size newImgSize, - out Rect validPixROI, bool centerPrincipalPoint = false) - { - if (cameraMatrix == null) - throw new ArgumentNullException(); - cameraMatrix.ThrowIfDisposed(); + /// + /// reprojects disparity image to 3D: (x,y,d)->(X,Y,Z) using the matrix Q returned by cv::stereoRectify + /// + /// Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image. + /// Output 3-channel floating-point image of the same size as disparity. + /// Each element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. + /// 4 x 4 perspective transformation matrix that can be obtained with stereoRectify(). + /// Indicates, whether the function should handle missing values (i.e. points where the disparity was not computed). + /// If handleMissingValues=true, then pixels with the minimal disparity that corresponds to the outliers (see StereoBM::operator() ) are + /// transformed to 3D points with a very large Z value (currently set to 10000). + /// he optional output array depth. If it is -1, the output image will have CV_32F depth. + /// ddepth can also be set to CV_16S, CV_32S or CV_32F. + public static void ReprojectImageTo3D(InputArray disparity, + OutputArray _3dImage, InputArray Q, + bool handleMissingValues = false, int ddepth = -1) + { + if (disparity is null) + throw new ArgumentNullException(nameof(disparity)); + if (_3dImage is null) + throw new ArgumentNullException(nameof(_3dImage)); + if (Q is null) + throw new ArgumentNullException(nameof(Q)); + disparity.ThrowIfDisposed(); + _3dImage.ThrowIfNotReady(); + Q.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_reprojectImageTo3D( + disparity.CvPtr, _3dImage.CvPtr, Q.CvPtr, handleMissingValues ? 1 : 0, ddepth)); - IntPtr mat = NativeMethods.calib3d_getOptimalNewCameraMatrix_InputArray( - cameraMatrix.CvPtr, ToPtr(distCoeffs), imageSize, alpha, newImgSize, - out validPixROI, centerPrincipalPoint ? 1 : 0); - return new Mat(mat); - } - /// - /// Returns the new camera matrix based on the free scaling parameter. - /// - /// Input camera matrix. - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the array is null, the zero distortion coefficients are assumed. - /// Original image size. - /// Free scaling parameter between 0 (when all the pixels in the undistorted image are valid) - /// and 1 (when all the source image pixels are retained in the undistorted image). - /// Image size after rectification. By default,it is set to imageSize . - /// Optional output rectangle that outlines all-good-pixels region in the undistorted image. See roi1, roi2 description in stereoRectify() . - /// Optional flag that indicates whether in the new camera matrix the principal point - /// should be at the image center or not. By default, the principal point is chosen to best fit a - /// subset of the source image (determined by alpha) to the corrected image. - /// optimal new camera matrix - public static double[,] GetOptimalNewCameraMatrix(double[,] cameraMatrix, double[] distCoeffs, - Size imageSize, double alpha, Size newImgSize, - out Rect validPixROI, bool centerPrincipalPoint = false) - { - if (cameraMatrix == null) - throw new ArgumentNullException(); - - var newCameraMatrix = new double[3, 3]; - NativeMethods.calib3d_getOptimalNewCameraMatrix_array( - cameraMatrix, distCoeffs, distCoeffs.Length, - imageSize, alpha, newImgSize, - out validPixROI, centerPrincipalPoint ? 1 : 0, - newCameraMatrix); - return newCameraMatrix; - } - #endregion - #region ConvertPointsHomogeneous - /// - /// converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) - /// - /// Input vector of N-dimensional points. - /// Output vector of N+1-dimensional points. - public static void ConvertPointsToHomogeneous(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.calib3d_convertPointsToHomogeneous_InputArray(src.CvPtr, dst.CvPtr); - dst.Fix(); - } - /// - /// converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) - /// - /// Input vector of N-dimensional points. - /// Output vector of N+1-dimensional points. - public static Vec3f[] ConvertPointsToHomogeneous(IEnumerable src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); + _3dImage.Fix(); + GC.KeepAlive(disparity); + GC.KeepAlive(_3dImage); + GC.KeepAlive(Q); + } - Vec2f[] srcA = EnumerableEx.ToArray(src); - Vec3f[] dstA = new Vec3f[srcA.Length]; - NativeMethods.calib3d_convertPointsToHomogeneous_array1(srcA, dstA, srcA.Length); - return dstA; - } - /// - /// converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) - /// - /// Input vector of N-dimensional points. - /// Output vector of N+1-dimensional points. - public static Vec4f[] ConvertPointsToHomogeneous(IEnumerable src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); + /// + /// Computes an optimal affine transformation between two 3D point sets. + /// + /// First input 3D point set. + /// Second input 3D point set. + /// Output 3D affine transformation matrix 3 x 4 . + /// Output vector indicating which points are inliers. + /// Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier. + /// Confidence level, between 0 and 1, for the estimated transformation. + /// Anything between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation significantly. + /// Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. + /// + public static int EstimateAffine3D(InputArray src, InputArray dst, + OutputArray outVal, OutputArray inliers, + double ransacThreshold = 3, double confidence = 0.99) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (outVal is null) + throw new ArgumentNullException(nameof(outVal)); + if (inliers is null) + throw new ArgumentNullException(nameof(inliers)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + outVal.ThrowIfNotReady(); + inliers.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_estimateAffine3D( + src.CvPtr, dst.CvPtr, outVal.CvPtr, inliers.CvPtr, ransacThreshold, confidence, out var ret)); + + outVal.Fix(); + inliers.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(dst); + return ret; + } - Vec3f[] srcA = EnumerableEx.ToArray(src); - Vec4f[] dstA = new Vec4f[srcA.Length]; - NativeMethods.calib3d_convertPointsToHomogeneous_array2(srcA, dstA, srcA.Length); - return dstA; - } + /// + /// Calculates the Sampson Distance between two points. + /// + /// first homogeneous 2d point + /// second homogeneous 2d point + /// F fundamental matrix + /// The computed Sampson distance. + /// https://github.com/opencv/opencv/blob/master/modules/calib3d/src/fundam.cpp#L1109 + public static double SampsonDistance(InputArray pt1, InputArray pt2, InputArray f) + { + if (pt1 is null) + throw new ArgumentNullException(nameof(pt1)); + if (pt2 is null) + throw new ArgumentNullException(nameof(pt2)); + if (f is null) + throw new ArgumentNullException(nameof(f)); + pt1.ThrowIfDisposed(); + pt2.ThrowIfDisposed(); + f.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_sampsonDistance_InputArray(pt1.CvPtr, pt2.CvPtr, f.CvPtr, out var ret)); + + GC.KeepAlive(pt1); + GC.KeepAlive(pt2); + + return ret; + } - /// - /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) - /// - /// Input vector of N-dimensional points. - /// Output vector of N-1-dimensional points. - public static void ConvertPointsFromHomogeneous(InputArray src, OutputArray dst) + /// + /// Calculates the Sampson Distance between two points. + /// + /// first homogeneous 2d point + /// second homogeneous 2d point + /// F fundamental matrix + /// The computed Sampson distance. + /// https://github.com/opencv/opencv/blob/master/modules/calib3d/src/fundam.cpp#L1109 + public static double SampsonDistance(Point3d pt1, Point3d pt2, double[,] f) + { + if (f is null) + throw new ArgumentNullException(nameof(f)); + if (f.GetLength(0) != 3 || f.GetLength(1) != 3) + throw new ArgumentException("f should be 3x3 matrix", nameof(f)); + + unsafe { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.calib3d_convertPointsFromHomogeneous_InputArray(src.CvPtr, dst.CvPtr); - dst.Fix(); + fixed (double* fPtr = f) + { + NativeMethods.HandleException( + NativeMethods.calib3d_sampsonDistance_Point3d(pt1, pt2, fPtr, out var ret)); + GC.KeepAlive(f); + return ret; + } } - /// - /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) - /// - /// Input vector of N-dimensional points. - /// Output vector of N-1-dimensional points. - public static Vec2f[] ConvertPointsFromHomogeneous(IEnumerable src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); + } + + /// + /// Computes an optimal affine transformation between two 2D point sets. + /// + /// First input 2D point set containing (X,Y). + /// Second input 2D point set containing (x,y). + /// Output vector indicating which points are inliers (1-inlier, 0-outlier). + /// Robust method used to compute transformation. + /// Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier.Applies only to RANSAC. + /// The maximum number of robust method iterations. + /// Confidence level, between 0 and 1, for the estimated transformation. + /// Anything between 0.95 and 0.99 is usually good enough.Values too close to 1 can slow down the estimation + /// significantly.Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. + /// Maximum number of iterations of refining algorithm (Levenberg-Marquardt). + /// Passing 0 will disable refining, so the output matrix will be output of robust method. + /// Output 2D affine transformation matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated. + public static Mat? EstimateAffine2D( + InputArray from, InputArray to, OutputArray? inliers = null, + RobustEstimationAlgorithms method = RobustEstimationAlgorithms.RANSAC, double ransacReprojThreshold = 3, + ulong maxIters = 2000, double confidence = 0.99, + ulong refineIters = 10) + { + if (from is null) + throw new ArgumentNullException(nameof(from)); + if (to is null) + throw new ArgumentNullException(nameof(to)); + from.ThrowIfDisposed(); + to.ThrowIfDisposed(); + inliers?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_estimateAffine2D( + from.CvPtr, to.CvPtr, ToPtr(inliers), + (int) method, ransacReprojThreshold, maxIters, confidence, refineIters, out var matPtr)); + + GC.KeepAlive(from); + GC.KeepAlive(to); + GC.KeepAlive(inliers); + + return (matPtr == IntPtr.Zero) ? null : new Mat(matPtr); + } - Vec3f[] srcA = EnumerableEx.ToArray(src); - Vec2f[] dstA = new Vec2f[srcA.Length]; - NativeMethods.calib3d_convertPointsFromHomogeneous_array1(srcA, dstA, srcA.Length); - return dstA; - } - /// - /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) - /// - /// Input vector of N-dimensional points. - /// Output vector of N-1-dimensional points. - public static Vec3f[] ConvertPointsFromHomogeneous(IEnumerable src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); + /// + /// Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets. + /// + /// First input 2D point set. + /// Second input 2D point set. + /// Output vector indicating which points are inliers. + /// Robust method used to compute transformation. + /// Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier.Applies only to RANSAC. + /// The maximum number of robust method iterations. + /// Confidence level, between 0 and 1, for the estimated transformation. + /// Anything between 0.95 and 0.99 is usually good enough.Values too close to 1 can slow down the estimation + /// significantly.Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. + /// + /// Output 2D affine transformation (4 degrees of freedom) matrix 2x3 or empty matrix if transformation could not be estimated. + public static Mat? EstimateAffinePartial2D( + InputArray from, InputArray to, OutputArray? inliers = null, + RobustEstimationAlgorithms method = RobustEstimationAlgorithms.RANSAC, double ransacReprojThreshold = 3, + ulong maxIters = 2000, double confidence = 0.99, + ulong refineIters = 10) + { + if (from is null) + throw new ArgumentNullException(nameof(from)); + if (to is null) + throw new ArgumentNullException(nameof(to)); + from.ThrowIfDisposed(); + to.ThrowIfDisposed(); + inliers?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_estimateAffinePartial2D( + from.CvPtr, to.CvPtr, ToPtr(inliers), + (int) method, ransacReprojThreshold, maxIters, confidence, refineIters, out var matPtr)); + + GC.KeepAlive(from); + GC.KeepAlive(to); + GC.KeepAlive(inliers); + + return (matPtr == IntPtr.Zero) ? null : new Mat(matPtr); + } - Vec4f[] srcA = EnumerableEx.ToArray(src); - Vec3f[] dstA = new Vec3f[srcA.Length]; - NativeMethods.calib3d_convertPointsFromHomogeneous_array2(srcA, dstA, srcA.Length); - return dstA; - } + /// + /// Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). + /// + /// The input homography matrix between two images. + /// The input intrinsic camera calibration matrix. + /// Array of rotation matrices. + /// Array of translation matrices. + /// Array of plane normal matrices. + /// + public static int DecomposeHomographyMat( + InputArray h, + InputArray k, + out Mat[] rotations, + out Mat[] translations, + out Mat[] normals) + { + if (h is null) + throw new ArgumentNullException(nameof(h)); + if (k is null) + throw new ArgumentNullException(nameof(k)); - /// - /// Converts points to/from homogeneous coordinates. - /// - /// Input array or vector of 2D, 3D, or 4D points. - /// Output vector of 2D, 3D, or 4D points. - public static void ConvertPointsHomogeneous(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.calib3d_convertPointsHomogeneous(src.CvPtr, dst.CvPtr); - dst.Fix(); - } - #endregion - #region FindFundamentalMat - /// - /// Calculates a fundamental matrix from the corresponding points in two images. - /// - /// Array of N points from the first image. - /// The point coordinates should be floating-point (single or double precision). - /// Array of the second image points of the same size and format as points1 . - /// Method for computing a fundamental matrix. - /// Parameter used for RANSAC. - /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is - /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to - /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise. - /// Parameter used for the RANSAC or LMedS methods only. - /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. - /// Output array of N elements, every element of which is set to 0 for outliers and - /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s. - /// fundamental matrix - public static Mat FindFundamentalMat( - InputArray points1, InputArray points2, - FundamentalMatMethod method = FundamentalMatMethod.Ransac, - double param1 = 3.0, double param2 = 0.99, - OutputArray mask = null) - { - if (points1 == null) - throw new ArgumentNullException(nameof(points1)); - if (points2 == null) - throw new ArgumentNullException(nameof(points2)); - points1.ThrowIfDisposed(); - points2.ThrowIfDisposed(); - - IntPtr mat = NativeMethods.calib3d_findFundamentalMat_InputArray( - points1.CvPtr, points2.CvPtr, (int)method, - param1, param2, ToPtr(mask)); - mask?.Fix(); - GC.KeepAlive(points1); - GC.KeepAlive(points2); - return new Mat(mat); - } + h.ThrowIfDisposed(); + k.ThrowIfDisposed(); - /// - /// Calculates a fundamental matrix from the corresponding points in two images. - /// - /// Array of N points from the first image. - /// The point coordinates should be floating-point (single or double precision). - /// Array of the second image points of the same size and format as points1 . - /// Method for computing a fundamental matrix. - /// Parameter used for RANSAC. - /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is - /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to - /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise. - /// Parameter used for the RANSAC or LMedS methods only. - /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct. - /// Output array of N elements, every element of which is set to 0 for outliers and - /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s. - /// fundamental matrix - public static Mat FindFundamentalMat( - IEnumerable points1, IEnumerable points2, - FundamentalMatMethod method = FundamentalMatMethod.Ransac, - double param1 = 3.0, double param2 = 0.99, - OutputArray mask = null) - { - if (points1 == null) - throw new ArgumentNullException(nameof(points1)); - if (points2 == null) - throw new ArgumentNullException(nameof(points2)); + using var rotationsVec = new VectorOfMat(); + using var translationsVec = new VectorOfMat(); + using var normalsVec = new VectorOfMat(); - Point2d[] points1Array = EnumerableEx.ToArray(points1); - Point2d[] points2Array = EnumerableEx.ToArray(points2); + NativeMethods.HandleException( + NativeMethods.calib3d_decomposeHomographyMat( + h.CvPtr, k.CvPtr, rotationsVec.CvPtr, translationsVec.CvPtr, normalsVec.CvPtr, out var ret)); - IntPtr mat = NativeMethods.calib3d_findFundamentalMat_array( - points1Array, points1Array.Length, - points2Array, points2Array.Length, (int)method, - param1, param2, ToPtr(mask)); - mask?.Fix(); - return new Mat(mat); - } - #endregion - #region ComputeCorrespondEpilines - /// - /// For points in an image of a stereo pair, computes the corresponding epilines in the other image. - /// - /// Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2. - /// Index of the image (1 or 2) that contains the points . - /// Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() . - /// Output vector of the epipolar lines corresponding to the points in the other image. - /// Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) . - public static void ComputeCorrespondEpilines(InputArray points, - int whichImage, - InputArray F, - OutputArray lines) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (lines == null) - throw new ArgumentNullException(nameof(lines)); - points.ThrowIfDisposed(); - F.ThrowIfDisposed(); - lines.ThrowIfNotReady(); + rotations = rotationsVec.ToArray(); + translations = translationsVec.ToArray(); + normals = normalsVec.ToArray(); - NativeMethods.calib3d_computeCorrespondEpilines_InputArray( - points.CvPtr, whichImage, F.CvPtr, lines.CvPtr); + GC.KeepAlive(h); + GC.KeepAlive(k); + GC.KeepAlive(rotations); + GC.KeepAlive(translations); + GC.KeepAlive(normals); - GC.KeepAlive(points); - lines.Fix(); - } + return ret; + } - /// - /// For points in an image of a stereo pair, computes the corresponding epilines in the other image. - /// - /// Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2. - /// Index of the image (1 or 2) that contains the points . - /// Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() . - /// Output vector of the epipolar lines corresponding to the points in the other image. - /// Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) . - public static Point3f[] ComputeCorrespondEpilines(IEnumerable points, - int whichImage, double[,] F) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (F.GetLength(0) != 3 && F.GetLength(1) != 3) - throw new ArgumentException("F != double[3,3]"); + /// + /// Filters homography decompositions based on additional information. + /// + /// Vector of rotation matrices. + /// Vector of plane normal matrices. + /// Vector of (rectified) visible reference points before the homography is applied + /// Vector of (rectified) visible reference points after the homography is applied + /// Vector of int indices representing the viable solution set after filtering + /// optional Mat/Vector of 8u type representing the mask for the inliers as given by the findHomography function + public static void FilterHomographyDecompByVisibleRefpoints( + IEnumerable rotations, + IEnumerable normals, + InputArray beforePoints, + InputArray afterPoints, + OutputArray possibleSolutions, + InputArray? pointsMask = null) + { + if (rotations is null) + throw new ArgumentNullException(nameof(rotations)); + if (normals is null) + throw new ArgumentNullException(nameof(normals)); + if (beforePoints is null) + throw new ArgumentNullException(nameof(beforePoints)); + if (afterPoints is null) + throw new ArgumentNullException(nameof(afterPoints)); + if (possibleSolutions is null) + throw new ArgumentNullException(nameof(possibleSolutions)); + beforePoints.ThrowIfDisposed(); + afterPoints.ThrowIfDisposed(); + possibleSolutions.ThrowIfNotReady(); + pointsMask?.ThrowIfDisposed(); + + using var rotationsVec = new VectorOfMat(rotations); + using var normalsVec = new VectorOfMat(normals); + NativeMethods.HandleException( + NativeMethods.calib3d_filterHomographyDecompByVisibleRefpoints( + rotationsVec.CvPtr, normalsVec.CvPtr, beforePoints.CvPtr, afterPoints.CvPtr, + possibleSolutions.CvPtr, ToPtr(pointsMask))); + + GC.KeepAlive(rotations); + GC.KeepAlive(normals); + GC.KeepAlive(beforePoints); + GC.KeepAlive(afterPoints); + GC.KeepAlive(possibleSolutions); + GC.KeepAlive(pointsMask); + } - Point2d[] pointsArray = EnumerableEx.ToArray(points); - Point3f[] lines = new Point3f[pointsArray.Length]; + /// + /// corrects lens distortion for the given camera matrix and distortion coefficients + /// + /// Input (distorted) image. + /// Output (corrected) image that has the same size and type as src . + /// Input camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, + /// or 8 elements. If the vector is null, the zero distortion coefficients are assumed. + /// Camera matrix of the distorted image. + /// By default, it is the same as cameraMatrix but you may additionally scale + /// and shift the result by using a different matrix. + public static void Undistort(InputArray src, OutputArray dst, + InputArray cameraMatrix, + InputArray distCoeffs, + InputArray? newCameraMatrix = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + cameraMatrix.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_undistort(src.CvPtr, dst.CvPtr, cameraMatrix.CvPtr, + ToPtr(distCoeffs), ToPtr(newCameraMatrix))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(newCameraMatrix); + dst.Fix(); + } - NativeMethods.calib3d_computeCorrespondEpilines_array2d( - pointsArray, pointsArray.Length, - whichImage, F, lines); + /// + /// initializes maps for cv::remap() to correct lens distortion and optionally rectify the image + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void InitUndistortRectifyMap( + InputArray cameraMatrix, InputArray distCoeffs, + InputArray r, InputArray newCameraMatrix, + Size size, MatType m1Type, OutputArray map1, OutputArray map2) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + if (r is null) + throw new ArgumentNullException(nameof(r)); + if (newCameraMatrix is null) + throw new ArgumentNullException(nameof(newCameraMatrix)); + if (map1 is null) + throw new ArgumentNullException(nameof(map1)); + if (map2 is null) + throw new ArgumentNullException(nameof(map2)); + cameraMatrix.ThrowIfDisposed(); + distCoeffs.ThrowIfDisposed(); + r.ThrowIfDisposed(); + newCameraMatrix.ThrowIfDisposed(); + map1.ThrowIfNotReady(); + map2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_initUndistortRectifyMap( + cameraMatrix.CvPtr, distCoeffs.CvPtr, r.CvPtr, newCameraMatrix.CvPtr, size, m1Type, map1.CvPtr, map2.CvPtr)); + + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(r); + GC.KeepAlive(newCameraMatrix); + GC.KeepAlive(map1); + GC.KeepAlive(map2); + map1.Fix(); + map2.Fix(); + } - return lines; - } - /// - /// For points in an image of a stereo pair, computes the corresponding epilines in the other image. - /// - /// Input points. N \times 1 or 1 x N matrix of type CV_32FC2 or CV_64FC2. - /// Index of the image (1 or 2) that contains the points . - /// Fundamental matrix that can be estimated using findFundamentalMat() or stereoRectify() . - /// Output vector of the epipolar lines corresponding to the points in the other image. - /// Each line ax + by + c=0 is encoded by 3 numbers (a, b, c) . - public static Point3f[] ComputeCorrespondEpilines(IEnumerable points, - int whichImage, double[,] F) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (F.GetLength(0) != 3 && F.GetLength(1) != 3) - throw new ArgumentException("F != double[3,3]"); + /// + /// initializes maps for cv::remap() for wide-angle + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static float InitWideAngleProjMap( + InputArray cameraMatrix, InputArray distCoeffs, + Size imageSize, int destImageWidth, MatType m1Type, + OutputArray map1, OutputArray map2, + ProjectionType projType, double alpha = 0) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + if (map1 is null) + throw new ArgumentNullException(nameof(map1)); + if (map2 is null) + throw new ArgumentNullException(nameof(map2)); + cameraMatrix.ThrowIfDisposed(); + distCoeffs.ThrowIfDisposed(); + map1.ThrowIfNotReady(); + map2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_initWideAngleProjMap( + cameraMatrix.CvPtr, distCoeffs.CvPtr, imageSize, + destImageWidth, m1Type, map1.CvPtr, map2.CvPtr, (int) projType, alpha, out var ret)); + + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(map1); + GC.KeepAlive(map2); + map1.Fix(); + map2.Fix(); + return ret; + } - Point3d[] pointsArray = EnumerableEx.ToArray(points); - Point3f[] lines = new Point3f[pointsArray.Length]; + /// + /// returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true) + /// + /// Input camera matrix. + /// Camera view image size in pixels. + /// Location of the principal point in the new camera matrix. + /// The parameter indicates whether this location should be at the image center or not. + /// the camera matrix that is either an exact copy of the input cameraMatrix + /// (when centerPrinicipalPoint=false), or the modified one (when centerPrincipalPoint=true). + public static Mat GetDefaultNewCameraMatrix( + InputArray cameraMatrix, Size? imgSize = null, bool centerPrincipalPoint = false) + { + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + cameraMatrix.ThrowIfDisposed(); + var imgSize0 = imgSize.GetValueOrDefault(new Size()); + + NativeMethods.HandleException( + NativeMethods.calib3d_getDefaultNewCameraMatrix( + cameraMatrix.CvPtr, imgSize0, centerPrincipalPoint ? 1 : 0, out var matPtr)); + GC.KeepAlive(cameraMatrix); + return new Mat(matPtr); + } - NativeMethods.calib3d_computeCorrespondEpilines_array3d( - pointsArray, pointsArray.Length, - whichImage, F, lines); + /// + /// Computes the ideal point coordinates from the observed point coordinates. + /// + /// Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). + /// Output ideal point coordinates after undistortion and reverse perspective transformation. + /// If matrix P is identity or omitted, dst will contain normalized point coordinates. + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Rectification transformation in the object space (3x3 matrix). + /// R1 or R2 computed by stereoRectify() can be passed here. + /// If the matrix is empty, the identity transformation is used. + /// New camera matrix (3x3) or new projection matrix (3x4). + /// P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, + /// the identity new camera matrix is used. + public static void UndistortPoints( + InputArray src, + OutputArray dst, + InputArray cameraMatrix, + InputArray distCoeffs, + InputArray? r = null, + InputArray? p = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + cameraMatrix.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_undistortPoints( + src.CvPtr, dst.CvPtr, cameraMatrix.CvPtr, + ToPtr(distCoeffs), ToPtr(r), ToPtr(p))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(r); + GC.KeepAlive(p); + dst.Fix(); + } - return lines; - } - #endregion - #region TriangulatePoints + /// + /// Computes the ideal point coordinates from the observed point coordinates. + /// + /// Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). + /// Output ideal point coordinates after undistortion and reverse perspective transformation. + /// If matrix P is identity or omitted, dst will contain normalized point coordinates. + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Rectification transformation in the object space (3x3 matrix). + /// R1 or R2 computed by stereoRectify() can be passed here. + /// If the matrix is empty, the identity transformation is used. + /// New camera matrix (3x3) or new projection matrix (3x4). + /// P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, + /// the identity new camera matrix is used. + /// + public static void UndistortPointsIter( + InputArray src, + OutputArray dst, + InputArray cameraMatrix, + InputArray distCoeffs, + InputArray? r = null, + InputArray? p = null, + TermCriteria? termCriteria = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + cameraMatrix.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_undistortPointsIter( + src.CvPtr, dst.CvPtr, cameraMatrix.CvPtr, + ToPtr(distCoeffs), ToPtr(r), ToPtr(p), termCriteria.GetValueOrDefault())); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distCoeffs); + GC.KeepAlive(r); + GC.KeepAlive(p); + dst.Fix(); + } + + /// + /// The methods in this class use a so-called fisheye camera model. + /// +#pragma warning disable CA1034 // Nested types should not be visible + public static class FishEye +#pragma warning restore CA1034 + { /// - /// Reconstructs points by triangulation. + /// Projects points using fisheye model. + /// + /// The function computes projections of 3D points to the image plane given intrinsic and extrinsic + /// camera parameters.Optionally, the function computes Jacobians - matrices of partial derivatives of + /// image points coordinates(as functions of all the input parameters) with respect to the particular + /// parameters, intrinsic and/or extrinsic. /// - /// 3x4 projection matrix of the first camera. - /// 3x4 projection matrix of the second camera. - /// 2xN array of feature points in the first image. In case of c++ version - /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. - /// 2xN array of corresponding points in the second image. In case of c++ version - /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. - /// 4xN array of reconstructed points in homogeneous coordinates. - public static void TriangulatePoints( - InputArray projMatr1, InputArray projMatr2, - InputArray projPoints1, InputArray projPoints2, - OutputArray points4D) + /// Array of object points, 1xN/Nx1 3-channel (or vector<Point3f> ), + /// where N is the number of points in the view. + /// Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, + /// or vector<Point2f>. + /// + /// + /// Camera matrix + /// Input vector of distortion coefficients + /// The skew coefficient. + /// Optional output 2Nx15 jacobian matrix of derivatives of image points with respect + /// to components of the focal lengths, coordinates of the principal point, distortion coefficients, + /// rotation vector, translation vector, and the skew.In the old interface different components of + /// the jacobian are returned via different output parameters. + public static void ProjectPoints( + InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec, + InputArray k, InputArray d, double alpha = 0, OutputArray? jacobian = null) { - if (projMatr1 == null) - throw new ArgumentNullException(nameof(projMatr1)); - if (projMatr2 == null) - throw new ArgumentNullException(nameof(projMatr2)); - if (projPoints1 == null) - throw new ArgumentNullException(nameof(projPoints1)); - if (projPoints2 == null) - throw new ArgumentNullException(nameof(projPoints2)); - if (points4D == null) - throw new ArgumentNullException(nameof(points4D)); - projMatr1.ThrowIfDisposed(); - projMatr2.ThrowIfDisposed(); - projPoints1.ThrowIfDisposed(); - projPoints2.ThrowIfDisposed(); - points4D.ThrowIfNotReady(); - - NativeMethods.calib3d_triangulatePoints_InputArray( - projMatr1.CvPtr, projMatr2.CvPtr, - projPoints1.CvPtr, projPoints2.CvPtr, points4D.CvPtr); - - GC.KeepAlive(projMatr1); - GC.KeepAlive(projMatr2); - GC.KeepAlive(projPoints1); - GC.KeepAlive(projPoints2); - points4D.Fix(); + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + objectPoints.ThrowIfDisposed(); + rvec.ThrowIfDisposed(); + tvec.ThrowIfDisposed(); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + jacobian?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_projectPoints2( + objectPoints.CvPtr, + imagePoints.CvPtr, + rvec.CvPtr, tvec.CvPtr, + k.CvPtr, d.CvPtr, + alpha, ToPtr(jacobian))); + + GC.KeepAlive(objectPoints); + GC.KeepAlive(rvec); + GC.KeepAlive(tvec); + GC.KeepAlive(k); + GC.KeepAlive(d); + GC.KeepAlive(imagePoints); + GC.KeepAlive(jacobian); } + /// - /// Reconstructs points by triangulation. + /// Distorts 2D points using fisheye model. /// - /// 3x4 projection matrix of the first camera. - /// 3x4 projection matrix of the second camera. - /// 2xN array of feature points in the first image. In case of c++ version - /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. - /// 2xN array of corresponding points in the second image. In case of c++ version - /// it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1. - /// 4xN array of reconstructed points in homogeneous coordinates. - public static Vec4d[] TriangulatePoints( - double[,] projMatr1, double[,] projMatr2, - IEnumerable projPoints1, IEnumerable projPoints2) + /// Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), + /// where N is the number of points in the view. + /// Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> . + /// Camera matrix + /// Input vector of distortion coefficients + /// The skew coefficient. + public static void DistortPoints( + InputArray undistorted, OutputArray distorted, InputArray k, InputArray d, double alpha = 0) { - if (projMatr1 == null) - throw new ArgumentNullException(nameof(projMatr1)); - if (projMatr2 == null) - throw new ArgumentNullException(nameof(projMatr2)); - if (projPoints1 == null) - throw new ArgumentNullException(nameof(projPoints1)); - if (projPoints2 == null) - throw new ArgumentNullException(nameof(projPoints2)); - if (projMatr1.GetLength(0) != 3 && projMatr1.GetLength(1) != 4) - throw new ArgumentException("projMatr1 != double[3,4]"); - if (projMatr2.GetLength(0) != 3 && projMatr2.GetLength(1) != 4) - throw new ArgumentException("projMatr2 != double[3,4]"); - - Point2d[] projPoints1Array = EnumerableEx.ToArray(projPoints1); - Point2d[] projPoints2Array = EnumerableEx.ToArray(projPoints2); - var points4D = new Vec4d[projPoints1Array.Length]; - - NativeMethods.calib3d_triangulatePoints_array( - projMatr1, projMatr2, - projPoints1Array, projPoints1Array.Length, - projPoints2Array, projPoints2Array.Length, - points4D); - - return points4D; + if (undistorted is null) + throw new ArgumentNullException(nameof(undistorted)); + if (distorted is null) + throw new ArgumentNullException(nameof(distorted)); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + undistorted.ThrowIfDisposed(); + distorted.ThrowIfNotReady(); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_distortPoints( + undistorted.CvPtr, distorted.CvPtr, k.CvPtr, d.CvPtr, alpha)); + + GC.KeepAlive(undistorted); + GC.KeepAlive(distorted); + GC.KeepAlive(k); + GC.KeepAlive(d); } - #endregion - #region CorrectMatches + /// - /// Refines coordinates of corresponding points. + /// Undistorts 2D points using fisheye model /// - /// 3x3 fundamental matrix. - /// 1xN array containing the first set of points. - /// 1xN array containing the second set of points. - /// The optimized points1. - /// The optimized points2. - public static void CorrectMatches( - InputArray F, InputArray points1, InputArray points2, - OutputArray newPoints1, OutputArray newPoints2) + /// Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), + /// where N is the number of points in the view. + /// Output array of image points, 1xN/Nx1 2-channel, or vector>Point2f> . + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, k_3, k_4). + /// Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel + /// New camera matrix (3x3) or new projection matrix (3x4) + // ReSharper disable once MemberHidesStaticFromOuterClass + public static void UndistortPoints( + InputArray distorted, OutputArray undistorted, + InputArray k, InputArray d, InputArray? r = null, InputArray? p = null) { - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (points1 == null) - throw new ArgumentNullException(nameof(points1)); - if (points2 == null) - throw new ArgumentNullException(nameof(points2)); - if (newPoints1 == null) - throw new ArgumentNullException(nameof(newPoints1)); - if (newPoints2 == null) - throw new ArgumentNullException(nameof(newPoints2)); - F.ThrowIfDisposed(); - points1.ThrowIfDisposed(); - points2.ThrowIfDisposed(); - newPoints1.ThrowIfNotReady(); - newPoints2.ThrowIfNotReady(); - - NativeMethods.calib3d_correctMatches_InputArray( - F.CvPtr, points1.CvPtr, points2.CvPtr, - newPoints1.CvPtr, newPoints2.CvPtr); - - GC.KeepAlive(F); - GC.KeepAlive(points1); - GC.KeepAlive(points2); - newPoints1.Fix(); - newPoints2.Fix(); + if (distorted is null) + throw new ArgumentNullException(nameof(distorted)); + if (undistorted is null) + throw new ArgumentNullException(nameof(undistorted)); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + distorted.ThrowIfDisposed(); + undistorted.ThrowIfNotReady(); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + r?.ThrowIfDisposed(); + p?.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_undistortPoints( + distorted.CvPtr, undistorted.CvPtr, k.CvPtr, d.CvPtr, ToPtr(r), ToPtr(p))); + + GC.KeepAlive(distorted); + GC.KeepAlive(undistorted); + GC.KeepAlive(k); + GC.KeepAlive(d); + GC.KeepAlive(r); + GC.KeepAlive(p); } /// - /// Refines coordinates of corresponding points. + /// Computes undistortion and rectification maps for image transform by cv::remap(). + /// If D is empty zero distortion is used, if R or P is empty identity matrixes are used. /// - /// 3x3 fundamental matrix. - /// 1xN array containing the first set of points. - /// 1xN array containing the second set of points. - /// The optimized points1. - /// The optimized points2. - public static void CorrectMatches( - double[,] F, IEnumerable points1, IEnumerable points2, - out Point2d[] newPoints1, out Point2d[] newPoints2) + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, k_3, k_4). + /// Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel + /// New camera matrix (3x3) or new projection matrix (3x4) + /// Undistorted image size. + /// Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps() for details. + /// The first output map. + /// The second output map. + public static void InitUndistortRectifyMap( + InputArray k, InputArray d, InputArray r, InputArray p, + Size size, int m1type, OutputArray map1, OutputArray map2) { - if (F == null) - throw new ArgumentNullException(nameof(F)); - if (points1 == null) - throw new ArgumentNullException(nameof(points1)); - if (points2 == null) - throw new ArgumentNullException(nameof(points2)); - - Point2d[] points1Array = EnumerableEx.ToArray(points1); - Point2d[] points2Array = EnumerableEx.ToArray(points2); - newPoints1 = new Point2d[points1Array.Length]; - newPoints2 = new Point2d[points2Array.Length]; - - NativeMethods.calib3d_correctMatches_array( - F, points1Array, points1Array.Length, - points2Array, points2Array.Length, - newPoints1, newPoints2); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + if (r is null) + throw new ArgumentNullException(nameof(r)); + if (p is null) + throw new ArgumentNullException(nameof(p)); + if (map1 is null) + throw new ArgumentNullException(nameof(map1)); + if (map2 is null) + throw new ArgumentNullException(nameof(map2)); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + r.ThrowIfDisposed(); + p.ThrowIfDisposed(); + map1.ThrowIfNotReady(); + map2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_initUndistortRectifyMap( + k.CvPtr, d.CvPtr, r.CvPtr, p.CvPtr, size, m1type, map1.CvPtr, map2.CvPtr)); + + GC.KeepAlive(k); + GC.KeepAlive(d); + GC.KeepAlive(r); + GC.KeepAlive(p); + GC.KeepAlive(map1); + GC.KeepAlive(map2); } - #endregion /// - /// filters off speckles (small regions of incorrectly computed disparity) + /// Transforms an image to compensate for fisheye lens distortion. /// - /// The input 16-bit signed disparity image - /// The disparity value used to paint-off the speckles - /// The maximum speckle size to consider it a speckle. Larger blobs are not affected by the algorithm - /// Maximum difference between neighbor disparity pixels to put them into the same blob. - /// Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point disparity map, where disparity values - /// are multiplied by 16, this scale factor should be taken into account when specifying this parameter value. - /// The optional temporary buffer to avoid memory allocation within the function. - public static void FilterSpeckles(InputOutputArray img, double newVal, int maxSpeckleSize, double maxDiff, - InputOutputArray buf = null) + /// image with fisheye lens distortion. + /// Output image with compensated fisheye lens distortion. + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, k_3, k_4). + /// Camera matrix of the distorted image. By default, it is the identity matrix but you + /// may additionally scale and shift the result by using a different matrix. + /// + public static void UndistortImage( + InputArray distorted, OutputArray undistorted, + InputArray k, InputArray d, InputArray? knew = null, Size newSize = default) { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfNotReady(); - - NativeMethods.calib3d_filterSpeckles(img.CvPtr, newVal, maxSpeckleSize, maxDiff, ToPtr(buf)); - img.Fix(); + if (distorted is null) + throw new ArgumentNullException(nameof(distorted)); + if (undistorted is null) + throw new ArgumentNullException(nameof(undistorted)); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + distorted.ThrowIfDisposed(); + undistorted.ThrowIfNotReady(); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + knew?.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_undistortImage( + distorted.CvPtr, undistorted.CvPtr, k.CvPtr, d.CvPtr, ToPtr(knew), newSize)); + + GC.KeepAlive(distorted); + GC.KeepAlive(undistorted); + GC.KeepAlive(k); + GC.KeepAlive(d); + GC.KeepAlive(knew); } /// - /// computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify()) + /// Estimates new camera matrix for undistortion or rectification. /// - /// - /// - /// - /// - /// - /// - public static Rect GetValidDisparityROI(Rect roi1, Rect roi2, - int minDisparity, int numberOfDisparities, int SADWindowSize) + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, k_3, k_4). + /// + /// Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 + /// 1-channel or 1x1 3-channel + /// New camera matrix (3x3) or new projection matrix (3x4) + /// Sets the new focal length in range between the min focal length and the max focal + /// length.Balance is in range of[0, 1]. + /// + /// Divisor for new focal length. + public static void EstimateNewCameraMatrixForUndistortRectify( + InputArray k, InputArray d, Size imageSize, InputArray r, + OutputArray p, double balance = 0.0, Size newSize = default, double fovScale = 1.0) { - return NativeMethods.calib3d_getValidDisparityROI( - roi1, roi2, minDisparity, numberOfDisparities, SADWindowSize); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + if (r is null) + throw new ArgumentNullException(nameof(r)); + if (p is null) + throw new ArgumentNullException(nameof(p)); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + r.ThrowIfDisposed(); + p.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_estimateNewCameraMatrixForUndistortRectify( + k.CvPtr, d.CvPtr, imageSize, r.CvPtr, p.CvPtr, balance, newSize, fovScale)); + + GC.KeepAlive(k); + GC.KeepAlive(d); + GC.KeepAlive(r); + GC.KeepAlive(p); } /// - /// validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm + /// Performs camera calibaration /// - /// - /// - /// - /// - /// - public static void ValidateDisparity(InputOutputArray disparity, InputArray cost, - int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1) + /// vector of vectors of calibration pattern points in the calibration pattern coordinate space. + /// vector of vectors of the projections of calibration pattern points. + /// imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to + /// objectPoints[i].size() for each i. + /// Size of the image used only to initialize the intrinsic camera matrix. + /// Output 3x3 floating-point camera matrix + /// Output vector of distortion coefficients (k_1, k_2, k_3, k_4). + /// Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view. + /// That is, each k-th rotation vector together with the corresponding k-th translation vector(see + /// the next output parameter description) brings the calibration pattern from the model coordinate + /// space(in which object points are specified) to the world coordinate space, that is, a real + /// position of the calibration pattern in the k-th pattern view(k= 0.. * M * -1). + /// Output vector of translation vectors estimated for each pattern view. + /// Different flags that may be zero or a combination of flag values + /// Termination criteria for the iterative optimization algorithm. + /// + public static double Calibrate( + IEnumerable objectPoints, IEnumerable imagePoints, + Size imageSize, InputOutputArray k, InputOutputArray d, + out IEnumerable rvecs, out IEnumerable tvecs, + FishEyeCalibrationFlags flags = 0, TermCriteria? criteria = null) { - if (disparity == null) - throw new ArgumentNullException(nameof(disparity)); - if (cost == null) - throw new ArgumentNullException(nameof(cost)); - disparity.ThrowIfNotReady(); - cost.ThrowIfDisposed(); + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints is null) + throw new ArgumentNullException(nameof(imagePoints)); + if (k is null) + throw new ArgumentNullException(nameof(k)); + if (d is null) + throw new ArgumentNullException(nameof(d)); + k.ThrowIfDisposed(); + d.ThrowIfDisposed(); + + var criteriaVal = criteria.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 100, double.Epsilon)); + + using var objectPointsVec = new VectorOfMat(objectPoints); + using var imagePointsVec = new VectorOfMat(imagePoints); + using var rvecsVec = new VectorOfMat(); + using var tvecsVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_calibrate( + objectPointsVec.CvPtr, imagePointsVec.CvPtr, imageSize, + k.CvPtr, d.CvPtr, rvecsVec.CvPtr, tvecsVec.CvPtr, (int) flags, criteriaVal, out var result)); + + rvecs = rvecsVec.ToArray(); + tvecs = tvecsVec.ToArray(); + + GC.KeepAlive(objectPoints); + GC.KeepAlive(imagePoints); + GC.KeepAlive(k); + GC.KeepAlive(d); - NativeMethods.calib3d_validateDisparity( - disparity.CvPtr, cost.CvPtr, minDisparity, numberOfDisparities, disp12MaxDisp); - disparity.Fix(); - GC.KeepAlive(cost); + return result; } /// - /// reprojects disparity image to 3D: (x,y,d)->(X,Y,Z) using the matrix Q returned by cv::stereoRectify + /// Stereo rectification for fisheye camera model /// - /// Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image. - /// Output 3-channel floating-point image of the same size as disparity. - /// Each element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. - /// 4 x 4 perspective transformation matrix that can be obtained with stereoRectify(). - /// Indicates, whether the function should handle missing values (i.e. points where the disparity was not computed). - /// If handleMissingValues=true, then pixels with the minimal disparity that corresponds to the outliers (see StereoBM::operator() ) are - /// transformed to 3D points with a very large Z value (currently set to 10000). - /// he optional output array depth. If it is -1, the output image will have CV_32F depth. - /// ddepth can also be set to CV_16S, CV_32S or CV_32F. - public static void ReprojectImageTo3D(InputArray disparity, - OutputArray _3dImage, InputArray Q, - bool handleMissingValues = false, int ddepth = -1) + /// First camera matrix. + /// First camera distortion parameters. + /// Second camera matrix. + /// Second camera distortion parameters. + /// Size of the image used for stereo calibration. + /// Rotation matrix between the coordinate systems of the first and the second cameras. + /// Translation vector between coordinate systems of the cameras. + /// Output 3x3 rectification transform (rotation matrix) for the first camera. + /// Output 3x3 rectification transform (rotation matrix) for the second camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. + /// Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera. + /// Output 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D ). + /// Operation flags that may be zero or CALIB_ZERO_DISPARITY . If the flag is set, + /// the function makes the principal points of each camera have the same pixel coordinates in the + /// rectified views.And if the flag is not set, the function may still shift the images in the + /// horizontal or vertical direction(depending on the orientation of epipolar lines) to maximize the + /// useful image area. + /// New image resolution after rectification. The same size should be passed to + /// initUndistortRectifyMap(see the stereo_calib.cpp sample in OpenCV samples directory). When(0,0) + /// is passed(default), it is set to the original imageSize.Setting it to larger value can help you + /// preserve details in the original image, especially when there is a big radial distortion. + /// Sets the new focal length in range between the min focal length and the max focal + /// length.Balance is in range of[0, 1]. + /// Divisor for new focal length. + public static void StereoRectify( + InputArray k1, InputArray d1, InputArray k2, InputArray d2, + Size imageSize, InputArray r, InputArray tvec, OutputArray r1, OutputArray r2, + OutputArray p1, OutputArray p2, OutputArray q, FishEyeCalibrationFlags flags, Size newImageSize = default, + double balance = 0.0, double fovScale = 1.0) { - if (disparity == null) - throw new ArgumentNullException(nameof(disparity)); - if (_3dImage == null) - throw new ArgumentNullException(nameof(_3dImage)); - if (Q == null) - throw new ArgumentNullException(nameof(Q)); - disparity.ThrowIfDisposed(); - _3dImage.ThrowIfNotReady(); - Q.ThrowIfDisposed(); - - NativeMethods.calib3d_reprojectImageTo3D( - disparity.CvPtr, _3dImage.CvPtr, Q.CvPtr, handleMissingValues ? 1 : 0, ddepth); - - _3dImage.Fix(); - GC.KeepAlive(disparity); - GC.KeepAlive(Q); + if (k1 is null) + throw new ArgumentNullException(nameof(k1)); + if (d1 is null) + throw new ArgumentNullException(nameof(d1)); + if (k2 is null) + throw new ArgumentNullException(nameof(k2)); + if (d2 is null) + throw new ArgumentNullException(nameof(d2)); + if (r is null) + throw new ArgumentNullException(nameof(r)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + if (r1 is null) + throw new ArgumentNullException(nameof(r1)); + if (r2 is null) + throw new ArgumentNullException(nameof(r2)); + if (p1 is null) + throw new ArgumentNullException(nameof(p1)); + if (p2 is null) + throw new ArgumentNullException(nameof(p2)); + if (q is null) + throw new ArgumentNullException(nameof(q)); + k1.ThrowIfDisposed(); + d1.ThrowIfDisposed(); + k2.ThrowIfDisposed(); + d2.ThrowIfDisposed(); + r.ThrowIfDisposed(); + tvec.ThrowIfDisposed(); + r1.ThrowIfNotReady(); + r2.ThrowIfNotReady(); + p1.ThrowIfNotReady(); + p2.ThrowIfNotReady(); + q.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_stereoRectify( + k1.CvPtr, d1.CvPtr, k2.CvPtr, d2.CvPtr, + imageSize, r.CvPtr, tvec.CvPtr, r1.CvPtr, r2.CvPtr, + p1.CvPtr, p2.CvPtr, q.CvPtr, (int) flags, newImageSize, balance, fovScale)); + + GC.KeepAlive(k1); + GC.KeepAlive(d1); + GC.KeepAlive(k2); + GC.KeepAlive(d2); + GC.KeepAlive(r); + GC.KeepAlive(tvec); + GC.KeepAlive(r1); + GC.KeepAlive(r2); + GC.KeepAlive(p1); + GC.KeepAlive(p2); + GC.KeepAlive(q); } /// - /// Computes an optimal affine transformation between two 3D point sets. + /// Performs stereo calibration /// - /// First input 3D point set. - /// Second input 3D point set. - /// Output 3D affine transformation matrix 3 x 4 . - /// Output vector indicating which points are inliers. - /// Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier. - /// Confidence level, between 0 and 1, for the estimated transformation. - /// Anything between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation significantly. - /// Values lower than 0.8-0.9 can result in an incorrectly estimated transformation. + /// Vector of vectors of the calibration pattern points. + /// Vector of vectors of the projections of the calibration pattern points, + /// observed by the first camera. + /// Vector of vectors of the projections of the calibration pattern points, + /// observed by the second camera. + /// Input/output first camera matrix + /// Input/output vector of distortion coefficients (k_1, k_2, k_3, k_4) of 4 elements. + /// Input/output second camera matrix. The parameter is similar to K1 . + /// Input/output lens distortion coefficients for the second camera. The parameter is + /// similar to D1. + /// Size of the image used only to initialize intrinsic camera matrix. + /// Output rotation matrix between the 1st and the 2nd camera coordinate systems. + /// Output translation vector between the coordinate systems of the cameras. + /// Different flags that may be zero or a combination of the FishEyeCalibrationFlags values + /// Termination criteria for the iterative optimization algorithm. /// - public static int EstimateAffine3D(InputArray src, InputArray dst, - OutputArray outVal, OutputArray inliers, - double ransacThreshold = 3, double confidence = 0.99) + public static double StereoCalibrate( + IEnumerable objectPoints, IEnumerable imagePoints1, IEnumerable imagePoints2, + InputOutputArray k1, InputOutputArray d1, InputOutputArray k2, InputOutputArray d2, Size imageSize, + OutputArray r, OutputArray t, FishEyeCalibrationFlags flags = FishEyeCalibrationFlags.FixIntrinsic, + TermCriteria? criteria = null) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (outVal == null) - throw new ArgumentNullException(nameof(outVal)); - if (inliers == null) - throw new ArgumentNullException(nameof(inliers)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - outVal.ThrowIfNotReady(); - inliers.ThrowIfNotReady(); - - int ret = NativeMethods.calib3d_estimateAffine3D( - src.CvPtr, dst.CvPtr, outVal.CvPtr, inliers.CvPtr, ransacThreshold, confidence); - - outVal.Fix(); - inliers.Fix(); - GC.KeepAlive(src); - GC.KeepAlive(dst); - return ret; + if (objectPoints is null) + throw new ArgumentNullException(nameof(objectPoints)); + if (imagePoints1 is null) + throw new ArgumentNullException(nameof(imagePoints1)); + if (imagePoints2 is null) + throw new ArgumentNullException(nameof(imagePoints2)); + if (k1 is null) + throw new ArgumentNullException(nameof(k1)); + if (d1 is null) + throw new ArgumentNullException(nameof(d1)); + if (k2 is null) + throw new ArgumentNullException(nameof(k2)); + if (d2 is null) + throw new ArgumentNullException(nameof(d2)); + if (r is null) + throw new ArgumentNullException(nameof(r)); + if (t is null) + throw new ArgumentNullException(nameof(t)); + k1.ThrowIfNotReady(); + d1.ThrowIfNotReady(); + k2.ThrowIfNotReady(); + d2.ThrowIfNotReady(); + r.ThrowIfNotReady(); + t.ThrowIfNotReady(); + + var criteriaVal = criteria.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 100, double.Epsilon)); + + using var objectPointsVec = new VectorOfMat(objectPoints); + using var imagePoints1Vec = new VectorOfMat(imagePoints1); + using var imagePoints2Vec = new VectorOfMat(imagePoints2); + NativeMethods.HandleException( + NativeMethods.calib3d_fisheye_stereoCalibrate( + objectPointsVec.CvPtr, imagePoints1Vec.CvPtr, imagePoints2Vec.CvPtr, + k1.CvPtr, d1.CvPtr, k2.CvPtr, d2.CvPtr, imageSize, + r.CvPtr, t.CvPtr, (int) flags, criteriaVal, out var result)); + + GC.KeepAlive(objectPoints); + GC.KeepAlive(imagePoints1); + GC.KeepAlive(imagePoints2); + GC.KeepAlive(k1); + GC.KeepAlive(d1); + GC.KeepAlive(k2); + GC.KeepAlive(d2); + GC.KeepAlive(r); + GC.KeepAlive(t); + + return result; } } } diff --git a/src/OpenCvSharp/Cv2/Cv2_core.cs b/src/OpenCvSharp/Cv2/Cv2_core.cs index e2c283333..a14ff5c7e 100644 --- a/src/OpenCvSharp/Cv2/Cv2_core.cs +++ b/src/OpenCvSharp/Cv2/Cv2_core.cs @@ -1,3006 +1,3712 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenCvSharp.Util; +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp +// ReSharper disable CommentTypo +// ReSharper disable IdentifierTypo +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +public static partial class Cv2 { - static partial class Cv2 + #region core.hpp + + /// + /// Computes the source location of an extrapolated pixel. + /// + /// 0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= len + /// Length of the array along the corresponding axis. + /// Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and BORDER_ISOLATED. + /// When borderType==BORDER_CONSTANT, the function always returns -1, regardless + /// + public static int BorderInterpolate(int p, int len, BorderTypes borderType) { - #region Miscellaneous + NativeMethods.HandleException( + NativeMethods.core_borderInterpolate(p, len, (int)borderType, out var ret)); + return ret; + } - /// - /// - /// - /// - public static void SetNumThreads(int nthreads) - { - NativeMethods.core_setNumThreads(nthreads); - } + /// + /// Forms a border around the image + /// + /// The source image + /// The destination image; will have the same type as src and + /// the size Size(src.cols+left+right, src.rows+top+bottom) + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// The border type + /// The border value if borderType == Constant + public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, + BorderTypes borderType, Scalar? value = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var value0 = value.GetValueOrDefault(new Scalar()); + NativeMethods.HandleException( + NativeMethods.core_copyMakeBorder( + src.CvPtr, dst.CvPtr, top, bottom, left, right, (int)borderType, value0)); + + GC.KeepAlive(src); + dst.Fix(); + } - /// - /// - /// - /// - public static int GetNumThreads() - { - return NativeMethods.core_getNumThreads(); - } - /// - /// - /// - /// - public static int GetThreadNum() - { - return NativeMethods.core_getThreadNum(); - } + /// + /// Computes the per-element sum of two arrays or an array and a scalar. + /// + /// The first source array + /// The second source array. It must have the same size and same type as src1 + /// The destination array; it will have the same size and same type as src1 + /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] + /// + public static void Add(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null, + int dtype = -1) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_add( + src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask), dtype)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(mask); + dst.Fix(); + } - /// - /// - /// - /// - public static string GetBuildInformation() - { - int length = NativeMethods.core_getBuildInformation_length(); - var buf = new StringBuilder(length + 1); - NativeMethods.core_getBuildInformation(buf, buf.Capacity); - return buf.ToString(); - } + /// + /// Calculates per-element difference between two arrays or array and a scalar + /// + /// The first source array + /// The second source array. It must have the same size and same type as src1 + /// The destination array; it will have the same size and same type as src1 + /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] + /// + public static void Subtract(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null, + int dtype = -1) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_subtract_InputArray2( + src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask), dtype)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + dst.Fix(); + GC.KeepAlive(mask); + } - /// - /// - /// - /// - public static long GetTickCount() - { - return NativeMethods.core_getTickCount(); - } + /// + /// Calculates per-element difference between two arrays or array and a scalar + /// + /// The first source array + /// The second source array. It must have the same size and same type as src1 + /// The destination array; it will have the same size and same type as src1 + /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] + /// + public static void Subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray? mask = null, + int dtype = -1) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_subtract_InputArrayScalar( + src1.CvPtr, src2, dst.CvPtr, ToPtr(mask), dtype)); + + GC.KeepAlive(src1); + dst.Fix(); + GC.KeepAlive(mask); + } - /// - /// - /// - /// - public static double GetTickFrequency() - { - return NativeMethods.core_getTickFrequency(); - } + /// + /// Calculates per-element difference between two arrays or array and a scalar + /// + /// The first source array + /// The second source array. It must have the same size and same type as src1 + /// The destination array; it will have the same size and same type as src1 + /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] + /// + public static void Subtract(Scalar src1, InputArray src2, OutputArray dst, InputArray? mask = null, + int dtype = -1) + { + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_subtract_ScalarInputArray( + src1, src2.CvPtr, dst.CvPtr, ToPtr(mask), dtype)); + + GC.KeepAlive(src2); + dst.Fix(); + GC.KeepAlive(mask); + } + + /// + /// Calculates the per-element scaled product of two arrays + /// + /// The first source array + /// The second source array of the same size and the same type as src1 + /// The destination array; will have the same size and the same type as src1 + /// The optional scale factor. [By default this is 1] + /// + public static void Multiply(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, int dtype = -1) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_multiply( + src1.CvPtr, src2.CvPtr, dst.CvPtr, scale, dtype)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + dst.Fix(); + } - /// - /// - /// - /// - public static long GetCpuTickCount() - { - return NativeMethods.core_getCPUTickCount(); - } + /// + /// Performs per-element division of two arrays or a scalar by an array. + /// + /// The first source array + /// The second source array; should have the same size and same type as src1 + /// The destination array; will have the same size and same type as src2 + /// Scale factor [By default this is 1] + /// + public static void Divide(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, MatType? dtype = null) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_divide2( + src1.CvPtr, src2.CvPtr, dst.CvPtr, scale, dtype?.Value ?? -1)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + dst.Fix(); + } - /// - /// - /// - /// - /// - public static bool CheckHardwareSupport(CpuFeatures feature) - { - return NativeMethods.core_checkHardwareSupport((int)feature) != 0; - } + /// + /// Performs per-element division of two arrays or a scalar by an array. + /// + /// Scale factor + /// The first source array + /// The destination array; will have the same size and same type as src2 + /// + public static void Divide(double scale, InputArray src2, OutputArray dst, int dtype = -1) + { + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_divide1(scale, src2.CvPtr, dst.CvPtr, dtype)); + + GC.KeepAlive(src2); + dst.Fix(); + } - /// - /// - /// - /// - public static int GetNumberOfCpus() - { - return NativeMethods.core_getNumberOfCPUs(); - } + /// + /// adds scaled array to another one (dst = alpha*src1 + src2) + /// + /// + /// + /// + /// + public static void ScaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_scaleAdd(src1.CvPtr, alpha, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + dst.Fix(); + } - /// - /// - /// - /// - /// - public static IntPtr FastMalloc(long bufSize) - { - return NativeMethods.core_fastMalloc(new IntPtr(bufSize)); - } + /// + /// computes weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma) + /// + /// + /// + /// + /// + /// + /// + /// + public static void AddWeighted(InputArray src1, double alpha, InputArray src2, + double beta, double gamma, OutputArray dst, int dtype = -1) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_addWeighted( + src1.CvPtr, alpha, src2.CvPtr, beta, gamma, dst.CvPtr, dtype)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + dst.Fix(); + } - /// - /// - /// - /// - public static void FastFree(IntPtr ptr) - { - NativeMethods.core_fastFree(ptr); - } + /// + /// Scales, computes absolute values and converts the result to 8-bit. + /// + /// The source array + /// The destination array + /// The optional scale factor. [By default this is 1] + /// The optional delta added to the scaled values. [By default this is 0] + public static void ConvertScaleAbs(InputArray src, OutputArray dst, double alpha = 1, double beta = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_convertScaleAbs(src.CvPtr, dst.CvPtr, alpha, beta)); + + GC.KeepAlive(src); + dst.Fix(); + } - /// - /// Turns on/off available optimization. - /// The function turns on or off the optimized code in OpenCV. Some optimization can not be enabled - /// or disabled, but, for example, most of SSE code in OpenCV can be temporarily turned on or off this way. - /// - /// - public static void SetUseOptimized(bool onoff) - { - NativeMethods.core_setUseOptimized(onoff ? 1 : 0); - } + /// + /// Converts an array to half precision floating number. + /// + /// This function converts FP32(single precision floating point) from/to FP16(half precision floating point). CV_16S format is used to represent FP16 data. + /// There are two use modes(src -> dst) : CV_32F -> CV_16S and CV_16S -> CV_32F.The input array has to have type of CV_32F or + /// CV_16S to represent the bit depth.If the input array is neither of them, the function will raise an error. + /// The format of half precision floating point is defined in IEEE 754-2008. + /// + /// input array. + /// output array. + public static void ConvertFp16(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_convertFp16(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + dst.Fix(); + } - /// - /// Returns the current optimization status. - /// The function returns the current optimization status, which is controlled by cv::setUseOptimized(). - /// - /// - public static bool UseOptimized() - { - return NativeMethods.core_useOptimized() != 0; - } + /// + /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) + /// + /// Source array of 8-bit elements + /// Look-up table of 256 elements. + /// In the case of multi-channel source array, the table should either have + /// a single channel (in this case the same table is used for all channels) + /// or the same number of channels as in the source array + /// Destination array; + /// will have the same size and the same number of channels as src, + /// and the same depth as lut + public static void LUT(InputArray src, InputArray lut, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (lut is null) + throw new ArgumentNullException(nameof(lut)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + lut.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_LUT(src.CvPtr, lut.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(lut); + GC.KeepAlive(dst); + dst.Fix(); + } - /// - /// Aligns buffer size by the certain number of bytes - /// This small inline function aligns a buffer size by - /// the certian number of bytes by enlarging it. - /// - /// - /// - /// - public static int AlignSize(int sz, int n) - { - bool assert = ((n & (n - 1)) == 0); // n is a power of 2 - if(!assert) - throw new ArgumentException(); - return (sz + n - 1) & -n; - } + /// + /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) + /// + /// Source array of 8-bit elements + /// Look-up table of 256 elements. + /// In the case of multi-channel source array, the table should either have + /// a single channel (in this case the same table is used for all channels) + /// or the same number of channels as in the source array + /// Destination array; + /// will have the same size and the same number of channels as src, + /// and the same depth as lut + public static void LUT(InputArray src, byte[] lut, OutputArray dst) + { + if (lut is null) + throw new ArgumentNullException(nameof(lut)); + if (lut.Length != 256) + throw new ArgumentException("lut.Length != 256"); - #endregion + using var lutMat = Mat.FromPixelData(256, 1, MatType.CV_8UC1, lut); + LUT(src, lutMat, dst); + } - #region Abs - /// - /// Computes absolute value of each matrix element - /// - /// matrix - /// - public static MatExpr Abs(Mat src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_abs_Mat(src.CvPtr); - GC.KeepAlive(src); - return new MatExpr(retPtr); - } - /// - /// Computes absolute value of each matrix element - /// - /// matrix expression - /// - public static MatExpr Abs(MatExpr src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_abs_MatExpr(src.CvPtr); - GC.KeepAlive(src); - return new MatExpr(retPtr); - } - #endregion - #region Add -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の和を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列. - /// 8ビット,シングルチャンネル配列のオプションの処理マスク.出力配列内の変更される要素を表します. [既定値はnull] - /// -#else - /// - /// Computes the per-element sum of two arrays or an array and a scalar. - /// - /// The first source array - /// The second source array. It must have the same size and same type as src1 - /// The destination array; it will have the same size and same type as src1 - /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] - /// -#endif - public static void Add(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null, int dtype = -1) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_add(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask), dtype); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region Subtract -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の差を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列. - /// オプション.8ビット,シングルチャンネル配列の処理マスク.出力配列内の変更される要素を表します. [既定値はnull] - /// -#else - /// - /// Calculates per-element difference between two arrays or array and a scalar - /// - /// The first source array - /// The second source array. It must have the same size and same type as src1 - /// The destination array; it will have the same size and same type as src1 - /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] - /// -#endif - public static void Subtract(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null, int dtype = -1) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_subtract(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask), dtype); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region Multiply -#if LANG_JP - /// - /// 2つの配列同士の,要素毎のスケーリングされた積を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列 - /// オプションであるスケールファクタ. [既定値は1] - /// -#else - /// - /// Calculates the per-element scaled product of two arrays - /// - /// The first source array - /// The second source array of the same size and the same type as src1 - /// The destination array; will have the same size and the same type as src1 - /// The optional scale factor. [By default this is 1] - /// -#endif - public static void Multiply(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, int dtype = -1) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_multiply(src1.CvPtr, src2.CvPtr, dst.CvPtr, scale, dtype); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); + /// + /// computes sum of array elements + /// + /// The source array; must have 1 to 4 channels + /// + public static Scalar Sum(InputArray src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); - } - #endregion - #region Divide -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の商を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src2 と同じサイズ,同じ型である出力配列 - /// スケールファクタ [既定値は1] - /// -#else - /// - /// Performs per-element division of two arrays or a scalar by an array. - /// - /// The first source array - /// The second source array; should have the same size and same type as src1 - /// The destination array; will have the same size and same type as src2 - /// Scale factor [By default this is 1] - /// -#endif - public static void Divide(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, int dtype = -1) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_divide2(src1.CvPtr, src2.CvPtr, dst.CvPtr, scale, dtype); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の商を求めます. - /// - /// スケールファクタ - /// 1番目の入力配列 - /// src2 と同じサイズ,同じ型である出力配列 - /// -#else - /// - /// Performs per-element division of two arrays or a scalar by an array. - /// - /// Scale factor - /// The first source array - /// The destination array; will have the same size and same type as src2 - /// -#endif - public static void Divide(double scale, InputArray src2, OutputArray dst, int dtype = -1) - { - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_divide1(scale, src2.CvPtr, dst.CvPtr, dtype); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region ScaleAdd - /// - /// adds scaled array to another one (dst = alpha*src1 + src2) - /// - /// - /// - /// - /// - public static void ScaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_scaleAdd(src1.CvPtr, alpha, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region AddWeighted - /// - /// computes weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma) - /// - /// - /// - /// - /// - /// - /// - /// - public static void AddWeighted(InputArray src1, double alpha, InputArray src2, - double beta, double gamma, OutputArray dst, int dtype = -1) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_addWeighted(src1.CvPtr, alpha, src2.CvPtr, beta, gamma, dst.CvPtr, dtype); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - - #region ConvertScaleAbs -#if LANG_JP - /// - /// スケーリング後,絶対値を計算し,結果を結果を 8 ビットに変換します. - /// - /// 入力配列 - /// 出力配列 - /// オプションのスケールファクタ. [既定値は1] - /// スケーリングされた値に加えられるオプション値. [既定値は0] -#else - /// - /// Scales, computes absolute values and converts the result to 8-bit. - /// - /// The source array - /// The destination array - /// The optional scale factor. [By default this is 1] - /// The optional delta added to the scaled values. [By default this is 0] -#endif - public static void ConvertScaleAbs(InputArray src, OutputArray dst, double alpha = 1, double beta = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_convertScaleAbs(src.CvPtr, dst.CvPtr, alpha, beta); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region LUT - /// - /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) - /// - /// Source array of 8-bit elements - /// Look-up table of 256 elements. - /// In the case of multi-channel source array, the table should either have - /// a single channel (in this case the same table is used for all channels) - /// or the same number of channels as in the source array - /// Destination array; - /// will have the same size and the same number of channels as src, - /// and the same depth as lut - /// - public static void LUT(InputArray src, InputArray lut, OutputArray dst, int interpolation = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (lut == null) - throw new ArgumentNullException(nameof(lut)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - lut.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_LUT(src.CvPtr, lut.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - GC.KeepAlive(lut); - dst.Fix(); - } - /// - /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) - /// - /// Source array of 8-bit elements - /// Look-up table of 256 elements. - /// In the case of multi-channel source array, the table should either have - /// a single channel (in this case the same table is used for all channels) - /// or the same number of channels as in the source array - /// Destination array; - /// will have the same size and the same number of channels as src, - /// and the same depth as lut - /// - public static void LUT(InputArray src, byte[] lut, OutputArray dst, int interpolation = 0) - { - if (lut == null) - throw new ArgumentNullException(nameof(lut)); - if (lut.Length != 256) - throw new ArgumentException("lut.Length != 256"); - using (Mat lutMat = new Mat(256, 1, MatType.CV_8UC1, lut)) - { - LUT(src, lutMat, dst, interpolation); - } - } - #endregion - #region Sum - /// - /// computes sum of array elements - /// - /// The source array; must have 1 to 4 channels - /// - public static Scalar Sum(InputArray src) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - var ret = NativeMethods.core_sum(src.CvPtr); - GC.KeepAlive(src); - return ret; - } - #endregion - #region CountNonZero - /// - /// computes the number of nonzero array elements - /// - /// Single-channel array - /// number of non-zero elements in mtx - public static int CountNonZero(InputArray mtx) - { - if (mtx == null) - throw new ArgumentNullException(nameof(mtx)); - mtx.ThrowIfDisposed(); - var ret = NativeMethods.core_countNonZero(mtx.CvPtr); - GC.KeepAlive(mtx); - return ret; - } - #endregion - #region FindNonZero - /// - /// returns the list of locations of non-zero pixels - /// - /// - /// - public static void FindNonZero(InputArray src, OutputArray idx) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (idx == null) - throw new ArgumentNullException(nameof(idx)); - src.ThrowIfDisposed(); - idx.ThrowIfNotReady(); - NativeMethods.core_findNonZero(src.CvPtr, idx.CvPtr); - GC.KeepAlive(src); - idx.Fix(); - } - #endregion - #region Mean - /// - /// computes mean value of selected array elements - /// - /// The source array; it should have 1 to 4 channels - /// (so that the result can be stored in Scalar) - /// The optional operation mask - /// - public static Scalar Mean(InputArray src, InputArray mask = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - var ret = NativeMethods.core_mean(src.CvPtr, ToPtr(mask)); - GC.KeepAlive(src); - GC.KeepAlive(mask); - return ret; - } - #endregion - #region MeanStdDev - /// - /// computes mean value and standard deviation of all or selected array elements - /// - /// The source array; it should have 1 to 4 channels - /// (so that the results can be stored in Scalar's) - /// The output parameter: computed mean value - /// The output parameter: computed standard deviation - /// The optional operation mask - public static void MeanStdDev( - InputArray src, OutputArray mean, OutputArray stddev, InputArray mask = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - if (stddev == null) - throw new ArgumentNullException(nameof(stddev)); - src.ThrowIfDisposed(); - mean.ThrowIfNotReady(); - stddev.ThrowIfNotReady(); - - NativeMethods.core_meanStdDev_OutputArray(src.CvPtr, mean.CvPtr, stddev.CvPtr, ToPtr(mask)); - - mean.Fix(); - stddev.Fix(); - GC.KeepAlive(src); - GC.KeepAlive(mask); - } + NativeMethods.HandleException( + NativeMethods.core_sum(src.CvPtr, out var ret)); - /// - /// computes mean value and standard deviation of all or selected array elements - /// - /// The source array; it should have 1 to 4 channels - /// (so that the results can be stored in Scalar's) - /// The output parameter: computed mean value - /// The output parameter: computed standard deviation - /// The optional operation mask - public static void MeanStdDev( - InputArray src, out Scalar mean, out Scalar stddev, InputArray mask = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); + GC.KeepAlive(src); + return ret; + } + + /// + /// computes the number of nonzero array elements + /// + /// Single-channel array + /// number of non-zero elements in mtx + public static int CountNonZero(InputArray mtx) + { + if (mtx is null) + throw new ArgumentNullException(nameof(mtx)); + mtx.ThrowIfDisposed(); - src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_countNonZero(mtx.CvPtr, out var ret)); - NativeMethods.core_meanStdDev_Scalar(src.CvPtr, out mean, out stddev, ToPtr(mask)); + GC.KeepAlive(mtx); + return ret; + } - GC.KeepAlive(src); - GC.KeepAlive(mask); - } - #endregion - #region Norm - /// - /// Calculates absolute array norm, absolute difference norm, or relative difference norm. - /// - /// The first source array - /// Type of the norm - /// The optional operation mask - /// - public static double Norm(InputArray src1, - NormTypes normType = NormTypes.L2, InputArray mask = null) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - src1.ThrowIfDisposed(); - var ret = NativeMethods.core_norm1(src1.CvPtr, (int)normType, ToPtr(mask)); - GC.KeepAlive(src1); - GC.KeepAlive(mask); - return ret; - } - /// - /// computes norm of selected part of the difference between two arrays - /// - /// The first source array - /// The second source array of the same size and the same type as src1 - /// Type of the norm - /// The optional operation mask - /// - public static double Norm(InputArray src1, InputArray src2, - NormTypes normType = NormTypes.L2, InputArray mask = null) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - var ret = NativeMethods.core_norm2(src1.CvPtr, src2.CvPtr, (int)normType, ToPtr(mask)); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - GC.KeepAlive(mask); - return ret; - } - #endregion - #region BatchDistance - /// - /// naive nearest neighbor finder - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void BatchDistance(InputArray src1, InputArray src2, - OutputArray dist, int dtype, OutputArray nidx, - NormTypes normType = NormTypes.L2, - int k = 0, InputArray mask = null, - int update = 0, bool crosscheck = false) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dist == null) - throw new ArgumentNullException(nameof(dist)); - if (nidx == null) - throw new ArgumentNullException(nameof(nidx)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dist.ThrowIfNotReady(); - nidx.ThrowIfNotReady(); - NativeMethods.core_batchDistance(src1.CvPtr, src2.CvPtr, dist.CvPtr, dtype, nidx.CvPtr, - (int)normType, k, ToPtr(mask), update, crosscheck ? 1 : 0); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dist.Fix(); - nidx.Fix(); - } - #endregion - #region Normalize - /// - /// scales and shifts array elements so that either the specified norm (alpha) - /// or the minimum (alpha) and maximum (beta) array values get the specified values - /// - /// The source array - /// The destination array; will have the same size as src - /// The norm value to normalize to or the lower range boundary - /// in the case of range normalization - /// The upper range boundary in the case of range normalization; - /// not used for norm normalization - /// The normalization type - /// When the parameter is negative, - /// the destination array will have the same type as src, - /// otherwise it will have the same number of channels as src and the depth =CV_MAT_DEPTH(rtype) - /// The optional operation mask - public static void Normalize( InputArray src, InputOutputArray dst, double alpha=1, double beta=0, - NormTypes normType=NormTypes.L2, int dtype=-1, InputArray mask=null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_normalize(src.CvPtr, dst.CvPtr, alpha, beta, (int)normType, dtype, ToPtr(mask)); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region MinMaxLoc - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// The source single-channel array - /// Pointer to returned minimum value - /// Pointer to returned maximum value - public static void MinMaxLoc(InputArray src, out double minVal, out double maxVal) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - NativeMethods.core_minMaxLoc1(src.CvPtr, out minVal, out maxVal); - GC.KeepAlive(src); - } + /// + /// returns the list of locations of non-zero pixels + /// + /// + /// + public static void FindNonZero(InputArray src, OutputArray idx) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (idx is null) + throw new ArgumentNullException(nameof(idx)); + src.ThrowIfDisposed(); + idx.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_findNonZero(src.CvPtr, idx.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(idx); + idx.Fix(); + } - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// The source single-channel array - /// Pointer to returned minimum location - /// Pointer to returned maximum location - public static void MinMaxLoc(InputArray src, out Point minLoc, out Point maxLoc) - { - double minVal, maxVal; - MinMaxLoc(src, out minVal, out maxVal, out minLoc, out maxLoc); - } + /// + /// computes mean value of selected array elements + /// + /// The source array; it should have 1 to 4 channels + /// (so that the result can be stored in Scalar) + /// The optional operation mask + /// + public static Scalar Mean(InputArray src, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// The source single-channel array - /// Pointer to returned minimum value - /// Pointer to returned maximum value - /// Pointer to returned minimum location - /// Pointer to returned maximum location - /// The optional mask used to select a sub-array - public static void MinMaxLoc(InputArray src, out double minVal, out double maxVal, - out Point minLoc, out Point maxLoc, InputArray mask = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_mean(src.CvPtr, ToPtr(mask), out var ret)); - NativeMethods.core_minMaxLoc2(src.CvPtr, out minVal, out maxVal, out minLoc, out maxLoc, ToPtr(mask)); - GC.KeepAlive(src); - } + GC.KeepAlive(src); + GC.KeepAlive(mask); + return ret; + } - #endregion - #region MinMaxIdx - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// The source single-channel array - /// Pointer to returned minimum value - /// Pointer to returned maximum value - public static void MinMaxIdx(InputArray src, out double minVal, out double maxVal) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - NativeMethods.core_minMaxIdx1(src.CvPtr, out minVal, out maxVal); - GC.KeepAlive(src); - } + /// + /// computes mean value and standard deviation of all or selected array elements + /// + /// The source array; it should have 1 to 4 channels + /// (so that the results can be stored in Scalar's) + /// The output parameter: computed mean value + /// The output parameter: computed standard deviation + /// The optional operation mask + public static void MeanStdDev( + InputArray src, OutputArray mean, OutputArray stddev, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (stddev is null) + throw new ArgumentNullException(nameof(stddev)); + src.ThrowIfDisposed(); + mean.ThrowIfNotReady(); + stddev.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_meanStdDev_OutputArray( + src.CvPtr, mean.CvPtr, stddev.CvPtr, ToPtr(mask))); + + mean.Fix(); + stddev.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(mean); + GC.KeepAlive(stddev); + GC.KeepAlive(mask); + } - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// The source single-channel array - /// - /// - public static void MinMaxIdx(InputArray src, out int minIdx, out int maxIdx) - { - double minVal, maxVal; - MinMaxIdx(src, out minVal, out maxVal, out minIdx, out maxIdx, null); - } + /// + /// computes mean value and standard deviation of all or selected array elements + /// + /// The source array; it should have 1 to 4 channels + /// (so that the results can be stored in Scalar's) + /// The output parameter: computed mean value + /// The output parameter: computed standard deviation + /// The optional operation mask + public static void MeanStdDev( + InputArray src, out Scalar mean, out Scalar stddev, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// The source single-channel array - /// Pointer to returned minimum value - /// Pointer to returned maximum value - /// - /// - /// - public static void MinMaxIdx(InputArray src, out double minVal, out double maxVal, - out int minIdx, out int maxIdx, InputArray mask = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - NativeMethods.core_minMaxIdx2(src.CvPtr, out minVal, out maxVal, out minIdx, out maxIdx, ToPtr(mask)); - GC.KeepAlive(src); - } - #endregion - #region Reduce - /// - /// transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows - /// - /// The source 2D matrix - /// The destination vector. - /// Its size and type is defined by dim and dtype parameters - /// The dimension index along which the matrix is reduced. - /// 0 means that the matrix is reduced to a single row and 1 means that the matrix is reduced to a single column - /// - /// When it is negative, the destination vector will have - /// the same type as the source matrix, otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels()) - public static void Reduce(InputArray src, OutputArray dst, ReduceDimension dim, ReduceTypes rtype, int dtype) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_reduce(src.CvPtr, dst.CvPtr, (int)dim, (int)rtype, dtype); - dst.Fix(); - GC.KeepAlive(src); - } - #endregion - #region Merge - /// - /// makes multi-channel array out of several single-channel arrays - /// - /// - /// - public static void Merge(Mat[] mv, Mat dst) - { - if (mv == null) - throw new ArgumentNullException(nameof(mv)); - if (mv.Length == 0) - throw new ArgumentException("mv.Length == 0"); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - foreach (Mat m in mv) - { - if(m == null) - throw new ArgumentException("mv contains null element"); - m.ThrowIfDisposed(); - } - dst.ThrowIfDisposed(); + src.ThrowIfDisposed(); - var mvPtr = new IntPtr[mv.Length]; - for (int i = 0; i < mv.Length; i++) - { - mvPtr[i] = mv[i].CvPtr; - } - NativeMethods.core_merge(mvPtr, (uint)mvPtr.Length, dst.CvPtr); - GC.KeepAlive(mv); - GC.KeepAlive(dst); - } - #endregion - #region Split - /// - /// Copies each plane of a multi-channel array to a dedicated array - /// - /// The source multi-channel array - /// The destination array or vector of arrays; - /// The number of arrays must match mtx.channels() . - /// The arrays themselves will be reallocated if needed - public static void Split(Mat src, out Mat[] mv) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_meanStdDev_Scalar( + src.CvPtr, out mean, out stddev, ToPtr(mask))); - IntPtr mvPtr; - NativeMethods.core_split(src.CvPtr, out mvPtr); + GC.KeepAlive(src); + GC.KeepAlive(mask); + } - using (var vec = new VectorOfMat(mvPtr)) - { - mv = vec.ToArray(); - } - GC.KeepAlive(src); - } - /// - /// Copies each plane of a multi-channel array to a dedicated array - /// - /// The source multi-channel array - /// The number of arrays must match mtx.channels() . - /// The arrays themselves will be reallocated if needed - public static Mat[] Split(Mat src) - { - Mat[] mv; - Split(src, out mv); - return mv; - } - #endregion - #region MixChannels - /// - /// copies selected channels from the input arrays to the selected channels of the output arrays - /// - /// - /// - /// - public static void MixChannels(Mat[] src, Mat[] dst, int[] fromTo) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (fromTo == null) - throw new ArgumentNullException(nameof(fromTo)); - if (src.Length == 0) - throw new ArgumentException("src.Length == 0"); - if (dst.Length == 0) - throw new ArgumentException("dst.Length == 0"); - if (fromTo.Length == 0 || fromTo.Length % 2 != 0) - throw new ArgumentException("fromTo.Length == 0"); - IntPtr[] srcPtr = new IntPtr[src.Length]; - IntPtr[] dstPtr = new IntPtr[dst.Length]; - for (int i = 0; i < src.Length; i++) - { - src[i].ThrowIfDisposed(); - srcPtr[i] = src[i].CvPtr; - } - for (int i = 0; i < dst.Length; i++) - { - dst[i].ThrowIfDisposed(); - dstPtr[i] = dst[i].CvPtr; - } - NativeMethods.core_mixChannels(srcPtr, (uint)src.Length, dstPtr, (uint)dst.Length, - fromTo, (uint)(fromTo.Length / 2)); + /// + /// Calculates absolute array norm, absolute difference norm, or relative difference norm. + /// + /// The first source array + /// Type of the norm + /// The optional operation mask + /// + public static double Norm(InputArray src1, + NormTypes normType = NormTypes.L2, InputArray? mask = null) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + src1.ThrowIfDisposed(); - GC.KeepAlive(src); - GC.KeepAlive(dst); - } - #endregion - #region ExtractChannel - /// - /// extracts a single channel from src (coi is 0-based index) - /// - /// - /// - /// - public static void ExtractChannel(InputArray src, OutputArray dst, int coi) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_extractChannel(src.CvPtr, dst.CvPtr, coi); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region InsertChannel - /// - /// inserts a single channel to dst (coi is 0-based index) - /// - /// - /// - /// - public static void InsertChannel(InputArray src, InputOutputArray dst, int coi) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_insertChannel(src.CvPtr, dst.CvPtr, coi); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Flip - /// - /// reverses the order of the rows, columns or both in a matrix - /// - /// The source array - /// The destination array; will have the same size and same type as src - /// Specifies how to flip the array: - /// 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, - /// and negative (e.g., -1) means flipping around both axes. See also the discussion below for the formulas. - public static void Flip(InputArray src, OutputArray dst, FlipMode flipCode) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_flip(src.CvPtr, dst.CvPtr, (int)flipCode); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Repeat - /// - /// replicates the input matrix the specified number of times in the horizontal and/or vertical direction - /// - /// The source array to replicate - /// How many times the src is repeated along the vertical axis - /// How many times the src is repeated along the horizontal axis - /// The destination array; will have the same type as src - public static void Repeat(InputArray src, int ny, int nx, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_repeat1(src.CvPtr, ny, nx, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - /// - /// replicates the input matrix the specified number of times in the horizontal and/or vertical direction - /// - /// The source array to replicate - /// How many times the src is repeated along the vertical axis - /// How many times the src is repeated along the horizontal axis - /// - public static Mat Repeat(Mat src, int ny, int nx) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_repeat2(src.CvPtr, ny, nx); - GC.KeepAlive(src); - return new Mat(matPtr); - } - #endregion - #region HConcat - /// - /// - /// - /// - /// - public static void HConcat(Mat[] src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (src.Length == 0) - throw new ArgumentException("src.Length == 0"); - IntPtr[] srcPtr = new IntPtr[src.Length]; - for (int i = 0; i < src.Length; i++) - { - src[i].ThrowIfDisposed(); - srcPtr[i] = src[i].CvPtr; - } - NativeMethods.core_hconcat1(srcPtr, (uint)src.Length, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - /// - /// - /// - /// - /// - /// - public static void HConcat(InputArray src1, InputArray src2, OutputArray dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_hconcat2(src1.CvPtr, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region VConcat - /// - /// - /// - /// - /// - public static void VConcat(Mat[] src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (src.Length == 0) - throw new ArgumentException("src.Length == 0"); - IntPtr[] srcPtr = new IntPtr[src.Length]; - for (int i = 0; i < src.Length; i++) - { - src[i].ThrowIfDisposed(); - srcPtr[i] = src[i].CvPtr; - } - NativeMethods.core_vconcat1(srcPtr, (uint)src.Length, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - /// - /// - /// - /// - /// - /// - public static void VConcat(InputArray src1, InputArray src2, OutputArray dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_vconcat2(src1.CvPtr, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region BitwiseAnd - /// - /// computes bitwise conjunction of the two arrays (dst = src1 & src2) - /// - /// - /// - /// - /// - public static void BitwiseAnd(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_bitwise_and(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask)); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region BitwiseOr - /// - /// computes bitwise disjunction of the two arrays (dst = src1 | src2) - /// - /// - /// - /// - /// - public static void BitwiseOr(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_bitwise_or(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask)); - dst.Fix(); - } - #endregion - #region BitwiseXor - /// - /// computes bitwise exclusive-or of the two arrays (dst = src1 ^ src2) - /// - /// - /// - /// - /// - public static void BitwiseXor(InputArray src1, InputArray src2, OutputArray dst, InputArray mask = null) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_bitwise_xor(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask)); - dst.Fix(); + NativeMethods.HandleException( + NativeMethods.core_norm1(src1.CvPtr, (int)normType, ToPtr(mask), out var ret)); + + GC.KeepAlive(src1); + GC.KeepAlive(mask); + return ret; + } + + /// + /// computes norm of selected part of the difference between two arrays + /// + /// The first source array + /// The second source array of the same size and the same type as src1 + /// Type of the norm + /// The optional operation mask + /// + public static double Norm(InputArray src1, InputArray src2, + NormTypes normType = NormTypes.L2, InputArray? mask = null) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_norm2(src1.CvPtr, src2.CvPtr, (int)normType, ToPtr(mask), out var ret)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(mask); + return ret; + } + + /// + /// Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric. + /// + /// This function calculates the Peak Signal-to-Noise Ratio(PSNR) image quality metric in decibels(dB), + /// between two input arrays src1 and src2.The arrays must have the same type. + /// + /// first input array. + /// second input array of the same size as src1. + /// the maximum pixel value (255 by default) + /// + // ReSharper disable once InconsistentNaming + public static double PSNR(InputArray src1, InputArray src2, double r = 255.0) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_PSNR(src1.CvPtr, src2.CvPtr, r, out var ret)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + return ret; + } + + /// + /// naive nearest neighbor finder + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void BatchDistance(InputArray src1, InputArray src2, + // ReSharper disable once IdentifierTypo + OutputArray dist, int dtype, OutputArray nidx, + NormTypes normType = NormTypes.L2, + int k = 0, InputArray? mask = null, + int update = 0, bool crosscheck = false) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dist is null) + throw new ArgumentNullException(nameof(dist)); + if (nidx is null) + throw new ArgumentNullException(nameof(nidx)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dist.ThrowIfNotReady(); + nidx.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_batchDistance( + src1.CvPtr, src2.CvPtr, dist.CvPtr, dtype, nidx.CvPtr, + (int) normType, k, ToPtr(mask), update, crosscheck ? 1 : 0)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dist); + GC.KeepAlive(nidx); + dist.Fix(); + nidx.Fix(); + GC.KeepAlive(mask); + } + + /// + /// scales and shifts array elements so that either the specified norm (alpha) + /// or the minimum (alpha) and maximum (beta) array values get the specified values + /// + /// The source array + /// The destination array; will have the same size as src + /// The norm value to normalize to or the lower range boundary + /// in the case of range normalization + /// The upper range boundary in the case of range normalization; + /// not used for norm normalization + /// The normalization type + /// When the parameter is negative, + /// the destination array will have the same type as src, + /// otherwise it will have the same number of channels as src and the depth =CV_MAT_DEPTH(rtype) + /// The optional operation mask + public static void Normalize(InputArray src, InputOutputArray dst, double alpha = 1, double beta = 0, + NormTypes normType = NormTypes.L2, int dtype = -1, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_normalize( + src.CvPtr, dst.CvPtr, alpha, beta, (int)normType, dtype, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + GC.KeepAlive(mask); + } + + /// + /// Finds indices of max elements along provided axis + /// + /// Input single-channel array + /// Output array of type CV_32SC1 with the same dimensionality as src, + /// except for axis being reduced - it should be set to 1. + /// Axis to reduce along + /// Whether to get the index of first or last occurrence of max + public static void ReduceArgMax(InputArray src, OutputArray dst, int axis, bool lastIndex = false) + { + if (src == null) + throw new ArgumentNullException(nameof(src)); + if (dst == null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_reduceArgMax(src.CvPtr, dst.CvPtr, axis, lastIndex)); + + dst.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// Finds indices of min elements along provided axis + /// + /// Input single-channel array + /// Output array of type CV_32SC1 with the same dimensionality as src, + /// except for axis being reduced - it should be set to 1. + /// Axis to reduce along + /// Whether to get the index of first or last occurrence of min + public static void ReduceArgMin(InputArray src, OutputArray dst, int axis, bool lastIndex = false) + { + if (src == null) + throw new ArgumentNullException(nameof(src)); + if (dst == null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_reduceArgMin(src.CvPtr, dst.CvPtr, axis, lastIndex)); + + dst.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// The source single-channel array + /// Pointer to returned minimum value + /// Pointer to returned maximum value + public static void MinMaxLoc(InputArray src, out double minVal, out double maxVal) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_minMaxLoc1(src.CvPtr, out minVal, out maxVal)); + + GC.KeepAlive(src); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// The source single-channel array + /// Pointer to returned minimum location + /// Pointer to returned maximum location + public static void MinMaxLoc(InputArray src, out Point minLoc, out Point maxLoc) + { + MinMaxLoc(src, out _, out _, out minLoc, out maxLoc); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// The source single-channel array + /// Pointer to returned minimum value + /// Pointer to returned maximum value + /// Pointer to returned minimum location + /// Pointer to returned maximum location + /// The optional mask used to select a sub-array + public static void MinMaxLoc(InputArray src, out double minVal, out double maxVal, + out Point minLoc, out Point maxLoc, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_minMaxLoc2( + src.CvPtr, out minVal, out maxVal, out minLoc, out maxLoc, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(mask); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// The source single-channel array + /// Pointer to returned minimum value + /// Pointer to returned maximum value + public static void MinMaxIdx(InputArray src, out double minVal, out double maxVal) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_minMaxIdx1(src.CvPtr, out minVal, out maxVal)); + + GC.KeepAlive(src); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// The source single-channel array + /// + /// + public static void MinMaxIdx(InputArray src, int[] minIdx, int[] maxIdx) + { + MinMaxIdx(src, out _, out _, minIdx, maxIdx); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// The source single-channel array + /// Pointer to returned minimum value + /// Pointer to returned maximum value + /// + /// + /// + public static void MinMaxIdx(InputArray src, out double minVal, out double maxVal, + int[] minIdx, int[] maxIdx, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (minIdx is null) + throw new ArgumentNullException(nameof(minIdx)); + if (maxIdx is null) + throw new ArgumentNullException(nameof(maxIdx)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_minMaxIdx2( + src.CvPtr, out minVal, out maxVal, minIdx, maxIdx, ToPtr(mask))); + + GC.KeepAlive(src); + } + + /// + /// transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows + /// + /// The source 2D matrix + /// The destination vector. + /// Its size and type is defined by dim and dtype parameters + /// The dimension index along which the matrix is reduced. + /// 0 means that the matrix is reduced to a single row and 1 means that the matrix is reduced to a single column + /// + /// When it is negative, the destination vector will have + /// the same type as the source matrix, otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels()) + public static void Reduce(InputArray src, OutputArray dst, ReduceDimension dim, ReduceTypes rtype, int dtype) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_reduce(src.CvPtr, dst.CvPtr, (int)dim, (int)rtype, dtype)); + + dst.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// makes multi-channel array out of several single-channel arrays + /// + /// + /// + public static void Merge(Mat[] mv, Mat dst) + { + if (mv is null) + throw new ArgumentNullException(nameof(mv)); + if (mv.Length == 0) + throw new ArgumentException("mv is empty", nameof(mv)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + foreach (var m in mv) + { + if (m is null) + throw new ArgumentException("mv contains null element"); + m.ThrowIfDisposed(); } - #endregion - #region BitwiseNot - /// - /// inverts each bit of array (dst = ~src) - /// - /// - /// - /// - public static void BitwiseNot(InputArray src, OutputArray dst, InputArray mask = null) + + dst.ThrowIfDisposed(); + + var mvPtr = new IntPtr[mv.Length]; + for (var i = 0; i < mv.Length; i++) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_bitwise_not(src.CvPtr, dst.CvPtr, ToPtr(mask)); - dst.Fix(); + mvPtr[i] = mv[i].CvPtr; } - #endregion - #region Absdiff - /// - /// computes element-wise absolute difference of two arrays (dst = abs(src1 - src2)) - /// - /// - /// - /// - public static void Absdiff(InputArray src1, InputArray src2, OutputArray dst) + + NativeMethods.HandleException( + NativeMethods.core_merge(mvPtr, (uint)mvPtr.Length, dst.CvPtr)); + + GC.KeepAlive(mv); + GC.KeepAlive(dst); + } + + /// + /// Copies each plane of a multi-channel array to a dedicated array + /// + /// The source multi-channel array + /// The destination array or vector of arrays; + /// The number of arrays must match mtx.channels() . + /// The arrays themselves will be reallocated if needed + public static void Split(Mat src, out Mat[] mv) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + using var vec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.core_split(src.CvPtr, vec.CvPtr)); + mv = vec.ToArray(); + + GC.KeepAlive(src); + } + + /// + /// Copies each plane of a multi-channel array to a dedicated array + /// + /// The source multi-channel array + /// The number of arrays must match mtx.channels() . + /// The arrays themselves will be reallocated if needed + public static Mat[] Split(Mat src) + { + Split(src, out var mv); + return mv; + } + + /// + /// copies selected channels from the input arrays to the selected channels of the output arrays + /// + /// + /// + /// + public static void MixChannels(Mat[] src, Mat[] dst, int[] fromTo) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (fromTo is null) + throw new ArgumentNullException(nameof(fromTo)); + if (src.Length == 0) + throw new ArgumentException("Length == 0", nameof(src)); + if (dst.Length == 0) + throw new ArgumentException("Length == 0", nameof(dst)); + if (fromTo.Length == 0 || fromTo.Length % 2 != 0) + throw new ArgumentException("Invalid length", nameof(fromTo)); + var srcPtr = new IntPtr[src.Length]; + var dstPtr = new IntPtr[dst.Length]; + for (var i = 0; i < src.Length; i++) + { + src[i].ThrowIfDisposed(); + srcPtr[i] = src[i].CvPtr; + } + + for (var i = 0; i < dst.Length; i++) + { + dst[i].ThrowIfDisposed(); + dstPtr[i] = dst[i].CvPtr; + } + NativeMethods.HandleException( + NativeMethods.core_mixChannels( + srcPtr, (uint)src.Length, dstPtr, (uint)dst.Length, + fromTo, (uint)(fromTo.Length / 2))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// extracts a single channel from src (coi is 0-based index) + /// + /// + /// + /// + public static void ExtractChannel(InputArray src, OutputArray dst, int coi) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_extractChannel(src.CvPtr, dst.CvPtr, coi)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// inserts a single channel to dst (coi is 0-based index) + /// + /// + /// + /// + public static void InsertChannel(InputArray src, InputOutputArray dst, int coi) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_insertChannel(src.CvPtr, dst.CvPtr, coi)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// reverses the order of the rows, columns or both in a matrix + /// + /// The source array + /// The destination array; will have the same size and same type as src + /// Specifies how to flip the array: + /// 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, + /// and negative (e.g., -1) means flipping around both axes. See also the discussion below for the formulas. + public static void Flip(InputArray src, OutputArray dst, FlipMode flipCode) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_flip(src.CvPtr, dst.CvPtr, (int) flipCode)); + + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Rotates a 2D array in multiples of 90 degrees. + /// + /// input array. + /// output array of the same type as src. + /// The size is the same with ROTATE_180, and the rows and cols are switched for + /// ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE. + /// an enum to specify how to rotate the array. + public static void Rotate(InputArray src, OutputArray dst, RotateFlags rotateCode) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_rotate(src.CvPtr, dst.CvPtr, (int)rotateCode)); + + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// replicates the input matrix the specified number of times in the horizontal and/or vertical direction + /// + /// The source array to replicate + /// How many times the src is repeated along the vertical axis + /// How many times the src is repeated along the horizontal axis + /// The destination array; will have the same type as src + public static void Repeat(InputArray src, int ny, int nx, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_repeat1(src.CvPtr, ny, nx, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// replicates the input matrix the specified number of times in the horizontal and/or vertical direction + /// + /// The source array to replicate + /// How many times the src is repeated along the vertical axis + /// How many times the src is repeated along the horizontal axis + /// + public static Mat Repeat(Mat src, int ny, int nx) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_repeat2(src.CvPtr, ny, nx, out var matPtr)); + + GC.KeepAlive(src); + return new Mat(matPtr); + } + + /// + /// Applies horizontal concatenation to given matrices. + /// + /// input array or vector of matrices. all of the matrices must have the same number of rows and the same depth. + /// output array. It has the same number of rows and depth as the src, and the sum of cols of the src. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void HConcat(IEnumerable src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + var srcArray = src as Mat[] ?? src.ToArray(); + if (srcArray.Length == 0) + throw new ArgumentException("src is empty", nameof(src)); + var srcPtr = new IntPtr[srcArray.Length]; + for (var i = 0; i < srcArray.Length; i++) { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_absdiff(src1.CvPtr, src2.CvPtr, dst.CvPtr); - dst.Fix(); + srcArray[i].ThrowIfDisposed(); + srcPtr[i] = srcArray[i].CvPtr; } - #endregion - #region InRange - /// - /// set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb) - /// - /// The first source array - /// The inclusive lower boundary array of the same size and type as src - /// The exclusive upper boundary array of the same size and type as src - /// The destination array, will have the same size as src and CV_8U type - public static void InRange(InputArray src, InputArray lowerb, InputArray upperb, OutputArray dst) + + NativeMethods.HandleException( + NativeMethods.core_hconcat1(srcPtr, (uint) srcArray.Length, dst.CvPtr)); + + GC.KeepAlive(srcArray); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies horizontal concatenation to given matrices. + /// + /// first input array to be considered for horizontal concatenation. + /// second input array to be considered for horizontal concatenation. + /// output array. It has the same number of rows and depth as the src1 and src2, and the sum of cols of the src1 and src2. + public static void HConcat(InputArray src1, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_hconcat2(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies vertical concatenation to given matrices. + /// + /// input array or vector of matrices. all of the matrices must have the same number of cols and the same depth. + /// output array. It has the same number of cols and depth as the src, and the sum of rows of the src. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void VConcat(IEnumerable src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + var srcArray = src as Mat[] ?? src.ToArray(); + if (srcArray.Length == 0) + throw new ArgumentException("src.Count == 0", nameof(src)); + var srcPtr = new IntPtr[srcArray.Length]; + for (var i = 0; i < srcArray.Length; i++) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (lowerb == null) - throw new ArgumentNullException(nameof(lowerb)); - if (upperb == null) - throw new ArgumentNullException(nameof(upperb)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - lowerb.ThrowIfDisposed(); - upperb.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_inRange_InputArray(src.CvPtr, lowerb.CvPtr, upperb.CvPtr, dst.CvPtr); - dst.Fix(); + srcArray[i].ThrowIfDisposed(); + srcPtr[i] = srcArray[i].CvPtr; } - /// - /// set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb) - /// - /// The first source array - /// The inclusive lower boundary array of the same size and type as src - /// The exclusive upper boundary array of the same size and type as src - /// The destination array, will have the same size as src and CV_8U type - public static void InRange(InputArray src, Scalar lowerb, Scalar upperb, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_inRange_Scalar(src.CvPtr, lowerb, upperb, dst.CvPtr); - dst.Fix(); - } - #endregion - #region Compare - /// - /// Performs the per-element comparison of two arrays or an array and scalar value. - /// - /// first input array or a scalar; when it is an array, it must have a single channel. - /// second input array or a scalar; when it is an array, it must have a single channel. - /// output array of type ref CV_8U that has the same size and the same number of channels as the input arrays. - /// a flag, that specifies correspondence between the arrays (cv::CmpTypes) - public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpTypes cmpop) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_compare(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int)cmpop); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - #endregion - #region Min - /// - /// computes per-element minimum of two arrays (dst = min(src1, src2)) - /// - /// - /// - /// - public static void Min(InputArray src1, InputArray src2, OutputArray dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_min1(src1.CvPtr, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - /// - /// computes per-element minimum of two arrays (dst = min(src1, src2)) - /// - /// - /// - /// - public static void Min(Mat src1, Mat src2, Mat dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - NativeMethods.core_min_MatMat(src1.CvPtr, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - GC.KeepAlive(dst); - } - /// - /// computes per-element minimum of array and scalar (dst = min(src1, src2)) - /// - /// - /// - /// - public static void Min(Mat src1, double src2, Mat dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - NativeMethods.core_min_MatDouble(src1.CvPtr, src2, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(dst); - } - #endregion - #region Max - /// - /// computes per-element maximum of two arrays (dst = max(src1, src2)) - /// - /// - /// - /// - public static void Max(InputArray src1, InputArray src2, OutputArray dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_max1(src1.CvPtr, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - /// - /// computes per-element maximum of two arrays (dst = max(src1, src2)) - /// - /// - /// - /// - public static void Max(Mat src1, Mat src2, Mat dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - NativeMethods.core_max_MatMat(src1.CvPtr, src2.CvPtr, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - GC.KeepAlive(dst); - } - /// - /// computes per-element maximum of array and scalar (dst = max(src1, src2)) - /// - /// - /// - /// - public static void Max(Mat src1, double src2, Mat dst) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - NativeMethods.core_max_MatDouble(src1.CvPtr, src2, dst.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(dst); - } - #endregion - #region Sqrt - /// - /// computes square root of each matrix element (dst = src**0.5) - /// - /// The source floating-point array - /// The destination array; will have the same size and the same type as src - public static void Sqrt(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_sqrt(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Pow - /// - /// raises the input matrix elements to the specified power (b = a**power) - /// - /// The source array - /// The exponent of power - /// The destination array; will have the same size and the same type as src - public static void Pow(InputArray src, double power, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_pow_Mat(src.CvPtr, power, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Exp - /// - /// computes exponent of each matrix element (dst = e**src) - /// - /// The source array - /// The destination array; will have the same size and same type as src - public static void Exp(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_exp_Mat(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Log - /// - /// computes natural logarithm of absolute value of each matrix element: dst = log(abs(src)) - /// - /// The source array - /// The destination array; will have the same size and same type as src - public static void Log(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_log_Mat(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } + NativeMethods.HandleException( + NativeMethods.core_vconcat1(srcPtr, (uint)srcArray.Length, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies vertical concatenation to given matrices. + /// + /// first input array to be considered for vertical concatenation. + /// second input array to be considered for vertical concatenation. + /// output array. It has the same number of cols and depth as the src1 and src2, and the sum of rows of the src1 and src2. + public static void VConcat(InputArray src1, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_vconcat2(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes bitwise conjunction of the two arrays (dst = src1 & src2) + /// + /// first input array or a scalar. + /// second input array or a scalar. + /// output array that has the same size and type as the input + /// optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed. + public static void BitwiseAnd(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_bitwise_and(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + GC.KeepAlive(mask); + } + + /// + /// computes bitwise disjunction of the two arrays (dst = src1 | src2) + /// + /// first input array or a scalar. + /// second input array or a scalar. + /// output array that has the same size and type as the input + /// optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed. + public static void BitwiseOr(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_bitwise_or(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// computes bitwise exclusive-or of the two arrays (dst = src1 ^ src2) + /// + /// first input array or a scalar. + /// second input array or a scalar. + /// output array that has the same size and type as the input + /// optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed. + public static void BitwiseXor(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_bitwise_xor(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// inverts each bit of array (dst = ~src) + /// + /// input array. + /// output array that has the same size and type as the input + /// optional operation mask, 8-bit single channel array, that specifies elements of the output array to be changed. + public static void BitwiseNot(InputArray src, OutputArray dst, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_bitwise_not(src.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// Calculates the per-element absolute difference between two arrays or between an array and a scalar. + /// + /// first input array or a scalar. + /// second input array or a scalar. + /// output array that has the same size and type as input arrays. + public static void Absdiff(InputArray src1, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_absdiff(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Copies the matrix to another one. + /// When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data. + /// + /// Source matrix. + /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. + /// Operation mask of the same size as \*this. Its non-zero elements indicate which matrix + /// elements need to be copied.The mask has to be of type CV_8U and can have 1 or multiple channels. + public static void CopyTo(InputArray src, OutputArray dst, InputArray? mask = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_copyTo(src.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// Checks if array elements lie between the elements of two other arrays. + /// + /// first input array. + /// inclusive lower boundary array or a scalar. + /// inclusive upper boundary array or a scalar. + /// output array of the same size as src and CV_8U type. + public static void InRange(InputArray src, InputArray lowerb, InputArray upperb, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (lowerb is null) + throw new ArgumentNullException(nameof(lowerb)); + if (upperb is null) + throw new ArgumentNullException(nameof(upperb)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + lowerb.ThrowIfDisposed(); + upperb.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_inRange_InputArray(src.CvPtr, lowerb.CvPtr, upperb.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(lowerb); + GC.KeepAlive(upperb); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Checks if array elements lie between the elements of two other arrays. + /// + /// first input array. + /// inclusive lower boundary array or a scalar. + /// inclusive upper boundary array or a scalar. + /// output array of the same size as src and CV_8U type. + public static void InRange(InputArray src, Scalar lowerb, Scalar upperb, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_inRange_Scalar(src.CvPtr, lowerb, upperb, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Performs the per-element comparison of two arrays or an array and scalar value. + /// + /// first input array or a scalar; when it is an array, it must have a single channel. + /// second input array or a scalar; when it is an array, it must have a single channel. + /// output array of type ref CV_8U that has the same size and the same number of channels as the input arrays. + /// a flag, that specifies correspondence between the arrays (cv::CmpTypes) + // ReSharper disable once IdentifierTypo + public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpType cmpop) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_compare(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int) cmpop)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes per-element minimum of two arrays (dst = min(src1, src2)) + /// + /// + /// + /// + public static void Min(InputArray src1, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_min1(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes per-element minimum of two arrays (dst = min(src1, src2)) + /// + /// + /// + /// + public static void Min(Mat src1, Mat src2, Mat dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_min_MatMat(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + } + + /// + /// computes per-element minimum of array and scalar (dst = min(src1, src2)) + /// + /// + /// + /// + public static void Min(Mat src1, double src2, Mat dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_min_MatDouble(src1.CvPtr, src2, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(dst); + } + + /// + /// computes per-element maximum of two arrays (dst = max(src1, src2)) + /// + /// + /// + /// + public static void Max(InputArray src1, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_max1(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes per-element maximum of two arrays (dst = max(src1, src2)) + /// + /// + /// + /// + public static void Max(Mat src1, Mat src2, Mat dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_max_MatMat(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + } + + /// + /// computes per-element maximum of array and scalar (dst = max(src1, src2)) + /// + /// + /// + /// + public static void Max(Mat src1, double src2, Mat dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_max_MatDouble(src1.CvPtr, src2, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(dst); + } + + /// + /// computes square root of each matrix element (dst = src**0.5) + /// + /// The source floating-point array + /// The destination array; will have the same size and the same type as src + public static void Sqrt(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_sqrt(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// raises the input matrix elements to the specified power (b = a**power) + /// + /// The source array + /// The exponent of power + /// The destination array; will have the same size and the same type as src + public static void Pow(InputArray src, double power, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_pow_Mat(src.CvPtr, power, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes exponent of each matrix element (dst = e**src) + /// + /// The source array + /// The destination array; will have the same size and same type as src + public static void Exp(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_exp_Mat(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes natural logarithm of absolute value of each matrix element: dst = log(abs(src)) + /// + /// The source array + /// The destination array; will have the same size and same type as src + public static void Log(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_log_Mat(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + + /// + /// Calculates x and y coordinates of 2D vectors from their magnitude and angle. + /// + /// input floating-point array of magnitudes of 2D vectors; + /// it can be an empty matrix(=Mat()), in this case, the function assumes that all the magnitudes are = 1; if it is not empty, + /// it must have the same size and type as angle. + /// input floating-point array of angles of 2D vectors. + /// output array of x-coordinates of 2D vectors; it has the same size and type as angle. + /// output array of y-coordinates of 2D vectors; it has the same size and type as angle. + /// when true, the input angles are measured in degrees, otherwise, they are measured in radians. + public static void PolarToCart(InputArray magnitude, InputArray angle, + OutputArray x, OutputArray y, bool angleInDegrees = false) + { + if (magnitude is null) + throw new ArgumentNullException(nameof(magnitude)); + if (angle is null) + throw new ArgumentNullException(nameof(angle)); + if (x is null) + throw new ArgumentNullException(nameof(x)); + if (y is null) + throw new ArgumentNullException(nameof(y)); + magnitude.ThrowIfDisposed(); + angle.ThrowIfDisposed(); + x.ThrowIfNotReady(); + y.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_polarToCart(magnitude.CvPtr, angle.CvPtr, x.CvPtr, y.CvPtr, angleInDegrees ? 1 : 0)); + + GC.KeepAlive(magnitude); + GC.KeepAlive(angle); + GC.KeepAlive(x); + GC.KeepAlive(y); + x.Fix(); + y.Fix(); + } + + /// + /// Calculates the magnitude and angle of 2D vectors. + /// + /// array of x-coordinates; this must be a single-precision or double-precision floating-point array. + /// array of y-coordinates, that must have the same size and same type as x. + /// output array of magnitudes of the same size and type as x. + /// output array of angles that has the same size and type as x; + /// the angles are measured in radians(from 0 to 2\*Pi) or in degrees(0 to 360 degrees). + /// a flag, indicating whether the angles are measured in radians(which is by default), or in degrees. + public static void CartToPolar(InputArray x, InputArray y, + OutputArray magnitude, OutputArray angle, bool angleInDegrees = false) + { + if (x is null) + throw new ArgumentNullException(nameof(x)); + if (y is null) + throw new ArgumentNullException(nameof(y)); + if (magnitude is null) + throw new ArgumentNullException(nameof(magnitude)); + if (angle is null) + throw new ArgumentNullException(nameof(angle)); + x.ThrowIfDisposed(); + y.ThrowIfDisposed(); + magnitude.ThrowIfNotReady(); + angle.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_cartToPolar(x.CvPtr, y.CvPtr, magnitude.CvPtr, angle.CvPtr, angleInDegrees ? 1 : 0)); + + GC.KeepAlive(x); + GC.KeepAlive(y); + GC.KeepAlive(magnitude); + GC.KeepAlive(angle); + magnitude.Fix(); + angle.Fix(); + } + + /// + /// Calculates the rotation angle of 2D vectors. + /// + /// input floating-point array of x-coordinates of 2D vectors. + /// input array of y-coordinates of 2D vectors; it must have the same size and the same type as x. + /// output array of vector angles; it has the same size and same type as x. + /// when true, the function calculates the angle in degrees, otherwise, they are measured in radians. + public static void Phase(InputArray x, InputArray y, OutputArray angle, bool angleInDegrees = false) + { + if (x is null) + throw new ArgumentNullException(nameof(x)); + if (y is null) + throw new ArgumentNullException(nameof(y)); + if (angle is null) + throw new ArgumentNullException(nameof(angle)); + x.ThrowIfDisposed(); + y.ThrowIfDisposed(); + angle.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_phase(x.CvPtr, y.CvPtr, angle.CvPtr, angleInDegrees ? 1 : 0)); + + GC.KeepAlive(x); + GC.KeepAlive(y); + GC.KeepAlive(angle); + angle.Fix(); + } + + /// + /// Calculates the magnitude of 2D vectors. + /// + /// floating-point array of x-coordinates of the vectors. + /// floating-point array of y-coordinates of the vectors; it must have the same size as x. + /// output array of the same size and type as x. + public static void Magnitude(InputArray x, InputArray y, OutputArray magnitude) + { + if (x is null) + throw new ArgumentNullException(nameof(x)); + if (y is null) + throw new ArgumentNullException(nameof(y)); + if (magnitude is null) + throw new ArgumentNullException(nameof(magnitude)); + x.ThrowIfDisposed(); + y.ThrowIfDisposed(); + magnitude.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_magnitude_Mat(x.CvPtr, y.CvPtr, magnitude.CvPtr)); + + GC.KeepAlive(x); + GC.KeepAlive(y); + GC.KeepAlive(magnitude); + magnitude.Fix(); + } + + /// + /// checks that each matrix element is within the specified range. + /// + /// The array to check + /// The flag indicating whether the functions quietly + /// return false when the array elements are out of range, + /// or they throw an exception. + /// + public static bool CheckRange(InputArray src, bool quiet = true) + { + return CheckRange(src, quiet, out _); + } + + /// + /// checks that each matrix element is within the specified range. + /// + /// The array to check + /// The flag indicating whether the functions quietly + /// return false when the array elements are out of range, + /// or they throw an exception. + /// The optional output parameter, where the position of + /// the first outlier is stored. + /// The inclusive lower boundary of valid values range + /// The exclusive upper boundary of valid values range + /// + public static bool CheckRange(InputArray src, bool quiet, out Point pos, + double minVal = double.MinValue, double maxVal = double.MaxValue) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_checkRange(src.CvPtr, quiet ? 1 : 0, out pos, minVal, maxVal, out var ret)); + GC.KeepAlive(src); + return ret != 0; + } + + /// + /// converts NaN's to the given number + /// + /// + /// + public static void PatchNaNs(InputOutputArray a, double val = 0) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_patchNaNs(a.CvPtr, val)); + + GC.KeepAlive(a); + } + + /// + /// implements generalized matrix product algorithm GEMM from BLAS + /// + /// + /// + /// + /// + /// + /// + /// + // ReSharper disable once IdentifierTypo + public static void Gemm(InputArray src1, InputArray src2, double alpha, + InputArray src3, double gamma, OutputArray dst, GemmFlags flags = GemmFlags.None) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (src3 is null) + throw new ArgumentNullException(nameof(src3)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + src3.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_gemm(src1.CvPtr, src2.CvPtr, alpha, src3.CvPtr, gamma, dst.CvPtr, (int) flags)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(src3); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// multiplies matrix by its transposition from the left or from the right + /// + /// The source matrix + /// The destination square matrix + /// Specifies the multiplication ordering; see the description below + /// The optional delta matrix, subtracted from src before the + /// multiplication. When the matrix is empty ( delta=Mat() ), it’s assumed to be + /// zero, i.e. nothing is subtracted, otherwise if it has the same size as src, + /// then it’s simply subtracted, otherwise it is "repeated" to cover the full src + /// and then subtracted. Type of the delta matrix, when it's not empty, must be the + /// same as the type of created destination matrix, see the rtype description + /// The optional scale factor for the matrix product + /// When it’s negative, the destination matrix will have the + /// same type as src . Otherwise, it will have type=CV_MAT_DEPTH(rtype), + /// which should be either CV_32F or CV_64F + public static void MulTransposed(InputArray src, OutputArray dst, bool aTa, + InputArray? delta = null, double scale = 1, int dtype = -1) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_mulTransposed(src.CvPtr, dst.CvPtr, aTa ? 1 : 0, ToPtr(delta), scale, dtype)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(delta); + dst.Fix(); + } + + /// + /// transposes the matrix + /// + /// The source array + /// The destination array of the same type as src + public static void Transpose(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + + NativeMethods.HandleException( + NativeMethods.core_transpose(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// performs affine transformation of each element of multi-channel input matrix + /// + /// The source array; must have as many channels (1 to 4) as mtx.cols or mtx.cols-1 + /// The destination array; will have the same size and depth as src and as many channels as mtx.rows + /// The transformation matrix + public static void Transform(InputArray src, OutputArray dst, InputArray m) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_transform(src.CvPtr, dst.CvPtr, m.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(m); + dst.Fix(); + } + + /// + /// performs perspective transformation of each element of multi-channel input matrix + /// + /// The source two-channel or three-channel floating-point array; + /// each element is 2D/3D vector to be transformed + /// The destination array; it will have the same size and same type as src + /// 3x3 or 4x4 transformation matrix + public static void PerspectiveTransform(InputArray src, OutputArray dst, InputArray m) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_perspectiveTransform(src.CvPtr, dst.CvPtr, m.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(m); + dst.Fix(); + } + + /// + /// performs perspective transformation of each element of multi-channel input matrix + /// + /// The source two-channel or three-channel floating-point array; + /// each element is 2D/3D vector to be transformed + /// 3x3 or 4x4 transformation matrix + /// The destination array; it will have the same size and same type as src + public static Point2f[] PerspectiveTransform(IEnumerable src, Mat m) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + using var srcMat = Mat.FromArray(src); + using var dstMat = new Mat(); + + NativeMethods.HandleException( + NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr)); + + GC.KeepAlive(m); + return dstMat.ToArray(); + } + + /// + /// performs perspective transformation of each element of multi-channel input matrix + /// + /// The source two-channel or three-channel floating-point array; + /// each element is 2D/3D vector to be transformed + /// 3x3 or 4x4 transformation matrix + /// The destination array; it will have the same size and same type as src + public static Point2d[] PerspectiveTransform(IEnumerable src, Mat m) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + using var srcMat = Mat.FromArray(src); + using var dstMat = new Mat(); + + NativeMethods.HandleException( + NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr)); + + GC.KeepAlive(m); + return dstMat.ToArray(); + } + + /// + /// performs perspective transformation of each element of multi-channel input matrix + /// + /// The source two-channel or three-channel floating-point array; + /// each element is 2D/3D vector to be transformed + /// 3x3 or 4x4 transformation matrix + /// The destination array; it will have the same size and same type as src + public static Point3f[] PerspectiveTransform(IEnumerable src, Mat m) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + using var srcMat = Mat.FromArray(src); + using var dstMat = new Mat(); + + NativeMethods.HandleException( + NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr)); + + GC.KeepAlive(m); + return dstMat.ToArray(); + } + + /// + /// performs perspective transformation of each element of multi-channel input matrix + /// + /// The source two-channel or three-channel floating-point array; + /// each element is 2D/3D vector to be transformed + /// 3x3 or 4x4 transformation matrix + /// The destination array; it will have the same size and same type as src + public static Point3d[] PerspectiveTransform(IEnumerable src, Mat m) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + using var srcMat = Mat.FromArray(src); + using var dstMat = new Mat(); + + NativeMethods.HandleException( + NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr)); + + GC.KeepAlive(m); + return dstMat.ToArray(); + } + + /// + /// extends the symmetrical matrix from the lower half or from the upper half + /// + /// Input-output floating-point square matrix + /// If true, the lower half is copied to the upper half, + /// otherwise the upper half is copied to the lower half + // ReSharper disable once IdentifierTypo + public static void CompleteSymm(InputOutputArray mtx, bool lowerToUpper = false) + { + if (mtx is null) + throw new ArgumentNullException(nameof(mtx)); + mtx.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_completeSymm(mtx.CvPtr, lowerToUpper ? 1 : 0)); + + GC.KeepAlive(mtx); + mtx.Fix(); + } + + /// + /// initializes scaled identity matrix + /// + /// The matrix to initialize (not necessarily square) + /// The value to assign to the diagonal elements + public static void SetIdentity(InputOutputArray mtx, Scalar? s = null) + { + if (mtx is null) + throw new ArgumentNullException(nameof(mtx)); + mtx.ThrowIfNotReady(); + + var s0 = s.GetValueOrDefault(new Scalar(1)); + NativeMethods.HandleException( + NativeMethods.core_setIdentity(mtx.CvPtr, s0)); + + GC.KeepAlive(mtx); + mtx.Fix(); + } + + /// + /// computes determinant of a square matrix + /// + /// The input matrix; must have CV_32FC1 or CV_64FC1 type and square size + /// determinant of the specified matrix. + public static double Determinant(InputArray mtx) + { + if (mtx is null) + throw new ArgumentNullException(nameof(mtx)); + mtx.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_determinant(mtx.CvPtr, out var ret)); + + GC.KeepAlive(mtx); + return ret; + } + + /// + /// computes trace of a matrix + /// + /// The source matrix + /// + public static Scalar Trace(InputArray mtx) + { + if (mtx is null) + throw new ArgumentNullException(nameof(mtx)); + mtx.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_trace(mtx.CvPtr, out var ret)); + + GC.KeepAlive(mtx); + return ret; + } + + /// + /// computes inverse or pseudo-inverse matrix + /// + /// The source floating-point MxN matrix + /// The destination matrix; will have NxM size and the same type as src + /// The inversion method + /// + public static double Invert(InputArray src, OutputArray dst, + DecompTypes flags = DecompTypes.LU) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_invert(src.CvPtr, dst.CvPtr, (int) flags, out var ret)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + return ret; + } + + /// + /// solves linear system or a least-square problem + /// + /// + /// + /// + /// + /// + public static bool Solve(InputArray src1, InputArray src2, OutputArray dst, + DecompTypes flags = DecompTypes.LU) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_solve(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int) flags, out var ret)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + return ret != 0; + } + + /// + /// Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method). + /// + /// This row-vector corresponds to \f$c\f$ in the LP problem formulation (see above). + /// It should contain 32- or 64-bit floating point numbers.As a convenience, column-vector may be also submitted, + /// in the latter case it is understood to correspond to \f$c^T\f$. + /// `m`-by-`n+1` matrix, whose rightmost column corresponds to \f$b\f$ in formulation above + /// and the remaining to \f$A\f$. It should containt 32- or 64-bit floating point numbers. + /// The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the + /// formulation above.It will contain 64-bit floating point numbers. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public static SolveLPResult SolveLP(InputArray func, InputArray constr, OutputArray z) + { + if (func is null) + throw new ArgumentNullException(nameof(func)); + if (constr is null) + throw new ArgumentNullException(nameof(constr)); + if (z is null) + throw new ArgumentNullException(nameof(z)); + func.ThrowIfDisposed(); + constr.ThrowIfDisposed(); + z.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_solveLP(func.CvPtr, constr.CvPtr, z.CvPtr, out var ret)); + + GC.KeepAlive(func); + GC.KeepAlive(constr); + z.Fix(); + return (SolveLPResult) ret; + } + + /// + /// sorts independently each matrix row or each matrix column + /// + /// The source single-channel array + /// The destination array of the same size and the same type as src + /// The operation flags, a combination of the SortFlag values + public static void Sort(InputArray src, OutputArray dst, SortFlags flags) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_sort(src.CvPtr, dst.CvPtr, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// sorts independently each matrix row or each matrix column + /// + /// The source single-channel array + /// The destination integer array of the same size as src + /// The operation flags, a combination of SortFlag values + public static void SortIdx(InputArray src, OutputArray dst, SortFlags flags) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_sortIdx(src.CvPtr, dst.CvPtr, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// finds real roots of a cubic polynomial + /// + /// The equation coefficients, an array of 3 or 4 elements + /// The destination array of real roots which will have 1 or 3 elements + /// + public static int SolveCubic(InputArray coeffs, OutputArray roots) + { + if (coeffs is null) + throw new ArgumentNullException(nameof(coeffs)); + if (roots is null) + throw new ArgumentNullException(nameof(roots)); + coeffs.ThrowIfDisposed(); + roots.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_solveCubic(coeffs.CvPtr, roots.CvPtr, out var ret)); + + GC.KeepAlive(coeffs); + GC.KeepAlive(roots); + roots.Fix(); + return ret; + } + + /// + /// finds real and complex roots of a polynomial + /// + /// The array of polynomial coefficients + /// The destination (complex) array of roots + /// The maximum number of iterations the algorithm does + /// + public static double SolvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300) + { + if (coeffs is null) + throw new ArgumentNullException(nameof(coeffs)); + if (roots is null) + throw new ArgumentNullException(nameof(roots)); + coeffs.ThrowIfDisposed(); + roots.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_solvePoly(coeffs.CvPtr, roots.CvPtr, maxIters, out var ret)); + + GC.KeepAlive(coeffs); + GC.KeepAlive(roots); + roots.Fix(); + return ret; + } + + /// + /// Computes eigenvalues and eigenvectors of a symmetric matrix. + /// + /// The input matrix; must have CV_32FC1 or CV_64FC1 type, + /// square size and be symmetric: src^T == src + /// The output vector of eigenvalues of the same type as src; + /// The eigenvalues are stored in the descending order. + /// The output matrix of eigenvectors; + /// It will have the same size and the same type as src; The eigenvectors are stored + /// as subsequent matrix rows, in the same order as the corresponding eigenvalues + /// + public static bool Eigen(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (eigenvalues is null) + throw new ArgumentNullException(nameof(eigenvalues)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + src.ThrowIfDisposed(); + eigenvalues.ThrowIfNotReady(); + eigenvectors.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_eigen(src.CvPtr, eigenvalues.CvPtr, eigenvectors.CvPtr, out var ret)); + + eigenvalues.Fix(); + eigenvectors.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(eigenvalues); + GC.KeepAlive(eigenvectors); + return ret != 0; + } + + /// + /// Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). + /// + /// input matrix (CV_32FC1 or CV_64FC1 type). + /// output vector of eigenvalues (type is the same type as src). + /// output matrix of eigenvectors (type is the same type as src). The eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding eigenvalues. + public static void EigenNonSymmetric(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (eigenvalues is null) + throw new ArgumentNullException(nameof(eigenvalues)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + src.ThrowIfDisposed(); + eigenvalues.ThrowIfNotReady(); + eigenvectors.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_eigenNonSymmetric(src.CvPtr, eigenvalues.CvPtr, eigenvectors.CvPtr)); + + eigenvalues.Fix(); + eigenvectors.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(eigenvalues); + GC.KeepAlive(eigenvectors); + } + + + /// + /// computes covariation matrix of a set of samples + /// + /// samples stored as separate matrices + /// output covariance matrix of the type ctype and square size. + /// input or output (depending on the flags) array as the average value of the input vectors. + /// operation flags as a combination of CovarFlags + /// type of the matrixl; it equals 'CV_64F' by default. + public static void CalcCovarMatrix( + Mat[] samples, Mat covar, Mat mean, + CovarFlags flags, MatType? ctype = null) + { + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + if (covar is null) + throw new ArgumentNullException(nameof(covar)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + covar.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + var samplesPtr = samples.Select(x => x.CvPtr).ToArray(); + + var ctypeValue = ctype.GetValueOrDefault(MatType.CV_64F); + NativeMethods.HandleException( + NativeMethods.core_calcCovarMatrix_Mat(samplesPtr, samples.Length, covar.CvPtr, mean.CvPtr, (int) flags, ctypeValue.Value)); + + GC.KeepAlive(samples); + GC.KeepAlive(covar); + GC.KeepAlive(mean); + } + + /// + /// computes covariation matrix of a set of samples + /// + /// samples stored as rows/columns of a single matrix. + /// output covariance matrix of the type ctype and square size. + /// input or output (depending on the flags) array as the average value of the input vectors. + /// operation flags as a combination of CovarFlags + /// type of the matrixl; it equals 'CV_64F' by default. + public static void CalcCovarMatrix( + InputArray samples, OutputArray covar, + InputOutputArray mean, CovarFlags flags, MatType? ctype = null) + { + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + if (covar is null) + throw new ArgumentNullException(nameof(covar)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + samples.ThrowIfDisposed(); + covar.ThrowIfNotReady(); + mean.ThrowIfNotReady(); + + var ctypeValue = ctype.GetValueOrDefault(MatType.CV_64F); + NativeMethods.HandleException( + NativeMethods.core_calcCovarMatrix_InputArray(samples.CvPtr, covar.CvPtr, mean.CvPtr, (int) flags, ctypeValue.Value)); + + GC.KeepAlive(samples); + GC.KeepAlive(covar); + GC.KeepAlive(mean); + covar.Fix(); + mean.Fix(); + } + + /// + /// PCA of the supplied dataset. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// eigenvectors of the covariation matrix + /// maximum number of components that PCA should + /// retain; by default, all the components are retained. + public static void PCACompute( + InputArray data, InputOutputArray mean, + OutputArray eigenvectors, int maxComponents = 0) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + data.ThrowIfDisposed(); + mean.ThrowIfNotReady(); + eigenvectors.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_PCACompute(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, maxComponents)); + + GC.KeepAlive(data); + mean.Fix(); + eigenvectors.Fix(); + } + + /// + /// PCA of the supplied dataset. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// eigenvectors of the covariation matrix + /// eigenvalues of the covariation matrix + /// maximum number of components that PCA should + /// retain; by default, all the components are retained. + public static void PCACompute( + InputArray data, InputOutputArray mean, + OutputArray eigenvectors, OutputArray eigenvalues, int maxComponents = 0) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + if (eigenvalues is null) + throw new ArgumentNullException(nameof(eigenvalues)); + data.ThrowIfDisposed(); + mean.ThrowIfNotReady(); + eigenvectors.ThrowIfNotReady(); + eigenvalues.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_PCACompute2(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, eigenvalues.CvPtr, maxComponents)); + + GC.KeepAlive(data); + mean.Fix(); + eigenvectors.Fix(); + eigenvalues.Fix(); + } + + /// + /// PCA of the supplied dataset. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// eigenvectors of the covariation matrix + /// Percentage of variance that PCA should retain. + /// Using this parameter will let the PCA decided how many components to retain but it will always keep at least 2. + public static void PCAComputeVar( + InputArray data, InputOutputArray mean, + OutputArray eigenvectors, double retainedVariance) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + data.ThrowIfDisposed(); + mean.ThrowIfNotReady(); + eigenvectors.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_PCAComputeVar(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, retainedVariance)); + + GC.KeepAlive(data); + GC.KeepAlive(mean); + GC.KeepAlive(eigenvectors); + mean.Fix(); + eigenvectors.Fix(); + } + + /// + /// PCA of the supplied dataset. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// eigenvectors of the covariation matrix + /// eigenvalues of the covariation matrix + /// Percentage of variance that PCA should retain. + /// Using this parameter will let the PCA decided how many components to retain but it will always keep at least 2. + public static void PCAComputeVar( + InputArray data, InputOutputArray mean, + OutputArray eigenvectors, OutputArray eigenvalues, double retainedVariance) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + if (eigenvalues is null) + throw new ArgumentNullException(nameof(eigenvalues)); + data.ThrowIfDisposed(); + mean.ThrowIfNotReady(); + eigenvectors.ThrowIfNotReady(); + eigenvalues.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_PCAComputeVar2(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, eigenvalues.CvPtr, retainedVariance)); + + GC.KeepAlive(data); + mean.Fix(); + eigenvectors.Fix(); + eigenvalues.Fix(); + } + + /// + /// Projects vector(s) to the principal component subspace. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// eigenvectors of the covariation matrix + /// output vectors + public static void PCAProject(InputArray data, InputArray mean, + InputArray eigenvectors, OutputArray result) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + data.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + eigenvectors.ThrowIfDisposed(); + result.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_PCAProject(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, result.CvPtr)); + + GC.KeepAlive(data); + GC.KeepAlive(mean); + GC.KeepAlive(eigenvectors); + GC.KeepAlive(result); + result.Fix(); + } + + /// + /// Reconstructs vectors from their PC projections. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// eigenvectors of the covariation matrix + /// output vectors + public static void PCABackProject(InputArray data, InputArray mean, + InputArray eigenvectors, OutputArray result) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (eigenvectors is null) + throw new ArgumentNullException(nameof(eigenvectors)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + data.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + eigenvectors.ThrowIfDisposed(); + result.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_PCABackProject(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, result.CvPtr)); + + GC.KeepAlive(data); + GC.KeepAlive(mean); + GC.KeepAlive(eigenvectors); + GC.KeepAlive(result); + result.Fix(); + } + + /// + /// decomposes matrix and stores the results to user-provided matrices + /// + /// decomposed matrix. The depth has to be CV_32F or CV_64F. + /// calculated singular values + /// calculated left singular vectors + /// transposed matrix of right singular vectors + /// peration flags - see SVD::Flags. + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public static void SVDecomp( + InputArray src, OutputArray w, + OutputArray u, OutputArray vt, SVD.Flags flags = SVD.Flags.None) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (w is null) + throw new ArgumentNullException(nameof(w)); + if (u is null) + throw new ArgumentNullException(nameof(u)); + if (vt is null) + throw new ArgumentNullException(nameof(vt)); + src.ThrowIfDisposed(); + w.ThrowIfNotReady(); + u.ThrowIfNotReady(); + vt.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_SVDecomp(src.CvPtr, w.CvPtr, u.CvPtr, vt.CvPtr, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(w); + GC.KeepAlive(u); + GC.KeepAlive(vt); + w.Fix(); + u.Fix(); + vt.Fix(); + } + + /// + /// performs back substitution for the previously computed SVD + /// + /// calculated singular values + /// calculated left singular vectors + /// transposed matrix of right singular vectors + /// right-hand side of a linear system (u*w*v')*dst = rhs to be solved, where A has been previously decomposed. + /// output + // ReSharper disable once InconsistentNaming + public static void SVBackSubst( + InputArray w, InputArray u, InputArray vt, + InputArray rhs, OutputArray dst) + { + if (w is null) + throw new ArgumentNullException(nameof(w)); + if (u is null) + throw new ArgumentNullException(nameof(u)); + if (vt is null) + throw new ArgumentNullException(nameof(vt)); + if (rhs is null) + throw new ArgumentNullException(nameof(rhs)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + w.ThrowIfDisposed(); + u.ThrowIfDisposed(); + vt.ThrowIfDisposed(); + rhs.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_SVBackSubst(w.CvPtr, u.CvPtr, vt.CvPtr, rhs.CvPtr, dst.CvPtr)); + + GC.KeepAlive(w); + GC.KeepAlive(u); + GC.KeepAlive(vt); + GC.KeepAlive(rhs); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates the Mahalanobis distance between two vectors. + /// + /// first 1D input vector. + /// second 1D input vector. + /// inverse covariance matrix. + /// + public static double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar) + { + if (v1 is null) + throw new ArgumentNullException(nameof(v1)); + if (v2 is null) + throw new ArgumentNullException(nameof(v2)); + if (icovar is null) + throw new ArgumentNullException(nameof(icovar)); + v1.ThrowIfDisposed(); + v2.ThrowIfDisposed(); + icovar.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mahalanobis(v1.CvPtr, v2.CvPtr, icovar.CvPtr, out var ret)); + + GC.KeepAlive(v1); + GC.KeepAlive(v2); + GC.KeepAlive(icovar); + return ret; + } + + /// + /// Performs a forward Discrete Fourier transform of 1D or 2D floating-point array. + /// + /// The source array, real or complex + /// The destination array, which size and type depends on the flags + /// Transformation flags, a combination of the DftFlag2 values + /// When the parameter != 0, the function assumes that + /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) + /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, + /// thus the function can handle the rest of the rows more efficiently and + /// thus save some time. This technique is very useful for computing array cross-correlation + /// or convolution using DFT + public static void Dft(InputArray src, OutputArray dst, DftFlags flags = DftFlags.None, int nonzeroRows = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_dft(src.CvPtr, dst.CvPtr, (int) flags, nonzeroRows)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Performs an inverse Discrete Fourier transform of 1D or 2D floating-point array. + /// + /// The source array, real or complex + /// The destination array, which size and type depends on the flags + /// Transformation flags, a combination of the DftFlag2 values + /// When the parameter != 0, the function assumes that + /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) + /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, + /// thus the function can handle the rest of the rows more efficiently and + /// thus save some time. This technique is very useful for computing array cross-correlation + /// or convolution using DFT + public static void Idft(InputArray src, OutputArray dst, DftFlags flags = DftFlags.None, int nonzeroRows = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_idft(src.CvPtr, dst.CvPtr, (int) flags, nonzeroRows)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Performs forward or inverse 1D or 2D Discrete Cosine Transformation + /// + /// The source floating-point array + /// The destination array; will have the same size and same type as src + /// Transformation flags, a combination of DctFlag2 values + public static void Dct(InputArray src, OutputArray dst, DctFlags flags = DctFlags.None) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_dct(src.CvPtr, dst.CvPtr, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Performs inverse 1D or 2D Discrete Cosine Transformation + /// + /// The source floating-point array + /// The destination array; will have the same size and same type as src + /// Transformation flags, a combination of DctFlag2 values + public static void Idct(InputArray src, OutputArray dst, DctFlags flags = DctFlags.None) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_idct(src.CvPtr, dst.CvPtr, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Performs the per-element multiplication of two Fourier spectrums. + /// + /// first input array. + /// second input array of the same size and type as src1. + /// output array of the same size and type as src1. + /// operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that + /// each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value. + /// optional flag that conjugates the second input array before the multiplication (true) or not (false). + public static void MulSpectrums( + InputArray a, InputArray b, OutputArray c, + DftFlags flags, bool conjB = false) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + if (c is null) + throw new ArgumentNullException(nameof(c)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + c.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_mulSpectrums(a.CvPtr, b.CvPtr, c.CvPtr, (int) flags, conjB ? 1 : 0)); + + GC.KeepAlive(a); + GC.KeepAlive(b); + GC.KeepAlive(c); + c.Fix(); + } + + /// + /// Returns the optimal DFT size for a given vector size. + /// + /// vector size. + /// + // ReSharper disable once InconsistentNaming + public static int GetOptimalDFTSize(int vecSize) + { + NativeMethods.HandleException( + NativeMethods.core_getOptimalDFTSize(vecSize, out var ret)); + return ret; + } + + /// + /// Returns the thread-local Random number generator + /// + /// + public static RNG GetTheRNG() + { + NativeMethods.HandleException( + NativeMethods.core_theRNG_get(out var state)); + return new RNG(state); + } + + /// + /// Sets the thread-local Random number generator + /// + /// + public static RNG SetTheRNG(ulong state) + { + NativeMethods.HandleException( + NativeMethods.core_theRNG_set(state)); + return new RNG(state); + } + + /// + /// fills array with uniformly-distributed random numbers from the range [low, high) + /// + /// The output array of random numbers. + /// The array must be pre-allocated and have 1 to 4 channels + /// The inclusive lower boundary of the generated random numbers + /// The exclusive upper boundary of the generated random numbers + public static void Randu(InputOutputArray dst, InputArray low, InputArray high) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (low is null) + throw new ArgumentNullException(nameof(low)); + if (high is null) + throw new ArgumentNullException(nameof(high)); + dst.ThrowIfNotReady(); + low.ThrowIfDisposed(); + high.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_randu_InputArray(dst.CvPtr, low.CvPtr, high.CvPtr)); + + GC.KeepAlive(dst); + GC.KeepAlive(low); + GC.KeepAlive(high); + dst.Fix(); + } + + /// + /// fills array with uniformly-distributed random numbers from the range [low, high) + /// + /// The output array of random numbers. + /// The array must be pre-allocated and have 1 to 4 channels + /// The inclusive lower boundary of the generated random numbers + /// The exclusive upper boundary of the generated random numbers + // ReSharper disable once IdentifierTypo + public static void Randu(InputOutputArray dst, Scalar low, Scalar high) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_randu_Scalar(dst.CvPtr, low, high)); + + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// fills array with normally-distributed random numbers with the specified mean and the standard deviation + /// + /// The output array of random numbers. + /// The array must be pre-allocated and have 1 to 4 channels + /// The mean value (expectation) of the generated random numbers + /// The standard deviation of the generated random numbers + // ReSharper disable once IdentifierTypo + public static void Randn(InputOutputArray dst, InputArray mean, InputArray stddev) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (stddev is null) + throw new ArgumentNullException(nameof(stddev)); + dst.ThrowIfNotReady(); + mean.ThrowIfDisposed(); + stddev.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_randn_InputArray(dst.CvPtr, mean.CvPtr, stddev.CvPtr)); + + GC.KeepAlive(dst); + GC.KeepAlive(mean); + GC.KeepAlive(stddev); + dst.Fix(); + } + + /// + /// fills array with normally-distributed random numbers with the specified mean and the standard deviation + /// + /// The output array of random numbers. + /// The array must be pre-allocated and have 1 to 4 channels + /// The mean value (expectation) of the generated random numbers + /// The standard deviation of the generated random numbers + public static void Randn(InputOutputArray dst, Scalar mean, Scalar stddev) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); - #endregion - #region CubeRoot - /// - /// computes cube root of the argument - /// - /// - /// - public static float CubeRoot(float val) - { - return NativeMethods.core_cubeRoot(val); - } - #endregion - #region FastAtan2 - /// - /// computes the angle in degrees (0..360) of the vector (x,y) - /// - /// - /// - /// - public static float FastAtan2(float y, float x) - { - return NativeMethods.core_fastAtan2(y, x); - } - #endregion - #region PolarToCart - /// - /// converts polar coordinates to Cartesian - /// - /// - /// - /// - /// - /// - public static void PolarToCart(InputArray magnitude, InputArray angle, - OutputArray x, OutputArray y, bool angleInDegrees = false) - { - if (magnitude == null) - throw new ArgumentNullException(nameof(magnitude)); - if (angle == null) - throw new ArgumentNullException(nameof(angle)); - if (x == null) - throw new ArgumentNullException(nameof(x)); - if (y == null) - throw new ArgumentNullException(nameof(y)); - magnitude.ThrowIfDisposed(); - angle.ThrowIfDisposed(); - x.ThrowIfNotReady(); - y.ThrowIfNotReady(); - NativeMethods.core_polarToCart(magnitude.CvPtr, angle.CvPtr, x.CvPtr, y.CvPtr, angleInDegrees ? 1 : 0); - GC.KeepAlive(magnitude); - GC.KeepAlive(angle); - x.Fix(); - y.Fix(); - } - #endregion - #region CartToPolar - /// - /// converts Cartesian coordinates to polar - /// - /// - /// - /// - /// - /// - public static void CartToPolar(InputArray x, InputArray y, - OutputArray magnitude, OutputArray angle, bool angleInDegrees = false) - { - if (x == null) - throw new ArgumentNullException(nameof(x)); - if (y == null) - throw new ArgumentNullException(nameof(y)); - if (magnitude == null) - throw new ArgumentNullException(nameof(magnitude)); - if (angle == null) - throw new ArgumentNullException(nameof(angle)); - x.ThrowIfDisposed(); - y.ThrowIfDisposed(); - magnitude.ThrowIfNotReady(); - angle.ThrowIfNotReady(); - NativeMethods.core_cartToPolar(x.CvPtr, y.CvPtr, magnitude.CvPtr, angle.CvPtr, angleInDegrees ? 1 : 0); - GC.KeepAlive(x); - GC.KeepAlive(y); - magnitude.Fix(); - angle.Fix(); - } - #endregion - #region Phase - /// - /// computes angle (angle(i)) of each (x(i), y(i)) vector - /// - /// - /// - /// - /// - public static void Phase(InputArray x, InputArray y, OutputArray angle, bool angleInDegrees = false) - { - if (x == null) - throw new ArgumentNullException(nameof(x)); - if (y == null) - throw new ArgumentNullException(nameof(y)); - if (angle == null) - throw new ArgumentNullException(nameof(angle)); - x.ThrowIfDisposed(); - y.ThrowIfDisposed(); - angle.ThrowIfNotReady(); - NativeMethods.core_phase(x.CvPtr, y.CvPtr, angle.CvPtr, angleInDegrees ? 1 : 0); - GC.KeepAlive(x); - GC.KeepAlive(y); - angle.Fix(); - } - #endregion - #region Magnitude - /// - /// computes magnitude (magnitude(i)) of each (x(i), y(i)) vector - /// - /// - /// - /// - public static void Magnitude(InputArray x, InputArray y, OutputArray magnitude) - { - if (x == null) - throw new ArgumentNullException(nameof(x)); - if (y == null) - throw new ArgumentNullException(nameof(y)); - if (magnitude == null) - throw new ArgumentNullException(nameof(magnitude)); - x.ThrowIfDisposed(); - y.ThrowIfDisposed(); - magnitude.ThrowIfNotReady(); - NativeMethods.core_magnitude_Mat(x.CvPtr, y.CvPtr, magnitude.CvPtr); - GC.KeepAlive(x); - GC.KeepAlive(y); - magnitude.Fix(); - } - #endregion - #region CheckRange - /// - /// checks that each matrix element is within the specified range. - /// - /// The array to check - /// The flag indicating whether the functions quietly - /// return false when the array elements are out of range, - /// or they throw an exception. - /// - public static bool CheckRange(InputArray src, bool quiet = true) - { - Point pos; - return CheckRange(src, quiet, out pos); - } - /// - /// checks that each matrix element is within the specified range. - /// - /// The array to check - /// The flag indicating whether the functions quietly - /// return false when the array elements are out of range, - /// or they throw an exception. - /// The optional output parameter, where the position of - /// the first outlier is stored. - /// The inclusive lower boundary of valid values range - /// The exclusive upper boundary of valid values range - /// - public static bool CheckRange(InputArray src, bool quiet, out Point pos, - double minVal = double.MinValue, double maxVal = double.MaxValue) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_randn_Scalar(dst.CvPtr, mean, stddev)); - int ret = NativeMethods.core_checkRange(src.CvPtr, quiet ? 1 : 0, out pos, minVal, maxVal); - GC.KeepAlive(src); - return ret != 0; - } - #endregion - #region PatchNaNs - /// - /// converts NaN's to the given number - /// - /// - /// - public static void PatchNaNs(InputOutputArray a, double val = 0) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfNotReady(); - NativeMethods.core_patchNaNs(a.CvPtr, val); - GC.KeepAlive(a); - } - #endregion - #region Gemm - /// - /// implements generalized matrix product algorithm GEMM from BLAS - /// - /// - /// - /// - /// - /// - /// - /// - public static void Gemm(InputArray src1, InputArray src2, double alpha, - InputArray src3, double gamma, OutputArray dst, GemmFlags flags = GemmFlags.None) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (src3 == null) - throw new ArgumentNullException(nameof(src3)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - src3.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_gemm(src1.CvPtr, src2.CvPtr, alpha, src3.CvPtr, gamma, dst.CvPtr, (int)flags); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - GC.KeepAlive(src3); - dst.Fix(); - } - #endregion - #region MulTransposed - /// - /// multiplies matrix by its transposition from the left or from the right - /// - /// The source matrix - /// The destination square matrix - /// Specifies the multiplication ordering; see the description below - /// The optional delta matrix, subtracted from src before the - /// multiplication. When the matrix is empty ( delta=Mat() ), it’s assumed to be - /// zero, i.e. nothing is subtracted, otherwise if it has the same size as src, - /// then it’s simply subtracted, otherwise it is "repeated" to cover the full src - /// and then subtracted. Type of the delta matrix, when it's not empty, must be the - /// same as the type of created destination matrix, see the rtype description - /// The optional scale factor for the matrix product - /// When it’s negative, the destination matrix will have the - /// same type as src . Otherwise, it will have type=CV_MAT_DEPTH(rtype), - /// which should be either CV_32F or CV_64F - public static void MulTransposed(InputArray src, OutputArray dst, bool aTa, - InputArray delta = null, double scale = 1, int dtype = -1) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_mulTransposed(src.CvPtr, dst.CvPtr, aTa ? 1 : 0 , ToPtr(delta), scale, dtype); - GC.KeepAlive(src); - GC.KeepAlive(delta); - dst.Fix(); - } - #endregion - #region Transpose - /// - /// transposes the matrix - /// - /// The source array - /// The destination array of the same type as src - public static void Transpose(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_transpose(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Transform - /// - /// performs affine transformation of each element of multi-channel input matrix - /// - /// The source array; must have as many channels (1 to 4) as mtx.cols or mtx.cols-1 - /// The destination array; will have the same size and depth as src and as many channels as mtx.rows - /// The transformation matrix - public static void Transform(InputArray src, OutputArray dst, InputArray m) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - m.ThrowIfDisposed(); - NativeMethods.core_transform(src.CvPtr, dst.CvPtr, m.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region PerspectiveTransform - - /// - /// performs perspective transformation of each element of multi-channel input matrix - /// - /// The source two-channel or three-channel floating-point array; - /// each element is 2D/3D vector to be transformed - /// The destination array; it will have the same size and same type as src - /// 3x3 or 4x4 transformation matrix - public static void PerspectiveTransform(InputArray src, OutputArray dst, InputArray m) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - m.ThrowIfDisposed(); - NativeMethods.core_perspectiveTransform(src.CvPtr, dst.CvPtr, m.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// shuffles the input array elements + /// + /// The input/output numerical 1D array + /// The scale factor that determines the number of random swap operations. + // ReSharper disable once IdentifierTypo + public static void RandShuffle(InputOutputArray dst, double iterFactor) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); - /// - /// performs perspective transformation of each element of multi-channel input matrix - /// - /// The source two-channel or three-channel floating-point array; - /// each element is 2D/3D vector to be transformed - /// 3x3 or 4x4 transformation matrix - /// The destination array; it will have the same size and same type as src - public static Point2f[] PerspectiveTransform(IEnumerable src, Mat m) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (m == null) - throw new ArgumentNullException(nameof(m)); + NativeMethods.HandleException( + NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, IntPtr.Zero)); - using (var srcMat = MatOfPoint2f.FromArray(src)) - using (var dstMat = new MatOfPoint2f()) - { - NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr); - return dstMat.ToArray(); - } - } + GC.KeepAlive(dst); + dst.Fix(); + } - /// - /// performs perspective transformation of each element of multi-channel input matrix - /// - /// The source two-channel or three-channel floating-point array; - /// each element is 2D/3D vector to be transformed - /// 3x3 or 4x4 transformation matrix - /// The destination array; it will have the same size and same type as src - public static Point2d[] PerspectiveTransform(IEnumerable src, Mat m) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (m == null) - throw new ArgumentNullException(nameof(m)); + /// + /// shuffles the input array elements + /// + /// The input/output numerical 1D array + /// The scale factor that determines the number of random swap operations. + /// The optional random number generator used for shuffling. + /// If it is null, theRng() is used instead. + // ReSharper disable once IdentifierTypo + public static void RandShuffle(InputOutputArray dst, double iterFactor, ref RNG rng) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); - using (var srcMat = MatOfPoint2d.FromArray(src)) - using (var dstMat = new MatOfPoint2d()) - { - NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr); - return dstMat.ToArray(); - } - } + var state = rng.State; + NativeMethods.HandleException( + NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, ref state)); + rng = new RNG(state); - /// - /// performs perspective transformation of each element of multi-channel input matrix - /// - /// The source two-channel or three-channel floating-point array; - /// each element is 2D/3D vector to be transformed - /// 3x3 or 4x4 transformation matrix - /// The destination array; it will have the same size and same type as src - public static Point3f[] PerspectiveTransform(IEnumerable src, Mat m) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (m == null) - throw new ArgumentNullException(nameof(m)); + GC.KeepAlive(dst); + dst.Fix(); + } - using (var srcMat = MatOfPoint3f.FromArray(src)) - using (var dstMat = new MatOfPoint3f()) - { - NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr); - return dstMat.ToArray(); - } - } + /// + /// Finds centers of clusters and groups input samples around the clusters. + /// + /// Data for clustering. An array of N-Dimensional points with float coordinates is needed. + /// Number of clusters to split the set by. + /// Input/output integer array that stores the cluster indices for every sample. + /// The algorithm termination criteria, that is, the maximum number of iterations and/or + /// the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers + /// moves by less than criteria.epsilon on some iteration, the algorithm stops. + /// Flag to specify the number of times the algorithm is executed using different + /// initial labellings. The algorithm returns the labels that yield the best compactness (see the last function parameter). + /// Flag that can take values of cv::KmeansFlags + /// Output matrix of the cluster centers, one row per each cluster center. + /// The function returns the compactness measure that is computed as + /// \f[\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\f] + /// after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness + /// value are returned by the function. Basically, you can use only the core of the function, + /// set the number of attempts to 1, initialize labels each time using a custom algorithm, + /// pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering. + public static double Kmeans(InputArray data, int k, InputOutputArray bestLabels, + TermCriteria criteria, int attempts, KMeansFlags flags, OutputArray? centers = null) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (bestLabels is null) + throw new ArgumentNullException(nameof(bestLabels)); + data.ThrowIfDisposed(); + bestLabels.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_kmeans( + data.CvPtr, k, bestLabels.CvPtr, criteria, attempts, (int) flags, ToPtr(centers), out var ret)); + + bestLabels.Fix(); + centers?.Fix(); + GC.KeepAlive(data); + GC.KeepAlive(bestLabels); + GC.KeepAlive(centers); + return ret; + } - /// - /// performs perspective transformation of each element of multi-channel input matrix - /// - /// The source two-channel or three-channel floating-point array; - /// each element is 2D/3D vector to be transformed - /// 3x3 or 4x4 transformation matrix - /// The destination array; it will have the same size and same type as src - public static Point3d[] PerspectiveTransform(IEnumerable src, Mat m) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (m == null) - throw new ArgumentNullException(nameof(m)); + #endregion - using (var srcMat = MatOfPoint3d.FromArray(src)) - using (var dstMat = new MatOfPoint3d()) - { - NativeMethods.core_perspectiveTransform_Mat(srcMat.CvPtr, dstMat.CvPtr, m.CvPtr); - return dstMat.ToArray(); - } - } + #region base.hpp - #endregion - #region CompleteSymm - /// - /// extends the symmetrical matrix from the lower half or from the upper half - /// - /// Input-output floating-point square matrix - /// If true, the lower half is copied to the upper half, - /// otherwise the upper half is copied to the lower half - public static void CompleteSymm(InputOutputArray mtx, bool lowerToUpper = false) - { - if (mtx == null) - throw new ArgumentNullException(nameof(mtx)); - mtx.ThrowIfNotReady(); - NativeMethods.core_completeSymm(mtx.CvPtr, lowerToUpper ? 1 : 0); - mtx.Fix(); - } - #endregion - #region SetIdentity - /// - /// initializes scaled identity matrix - /// - /// The matrix to initialize (not necessarily square) - /// The value to assign to the diagonal elements - public static void SetIdentity(InputOutputArray mtx, Scalar? s = null) - { - if (mtx == null) - throw new ArgumentNullException(nameof(mtx)); - mtx.ThrowIfNotReady(); - Scalar s0 = s.GetValueOrDefault(new Scalar(1)); - NativeMethods.core_setIdentity(mtx.CvPtr, s0); - mtx.Fix(); - } - #endregion - #region Determinant - /// - /// computes determinant of a square matrix - /// - /// The input matrix; must have CV_32FC1 or CV_64FC1 type and square size - /// determinant of the specified matrix. - public static double Determinant(InputArray mtx) - { - if (mtx == null) - throw new ArgumentNullException(nameof(mtx)); - mtx.ThrowIfDisposed(); - var ret = NativeMethods.core_determinant(mtx.CvPtr); - GC.KeepAlive(mtx); - return ret; - } - #endregion - #region Trace - /// - /// computes trace of a matrix - /// - /// The source matrix - /// - public static Scalar Trace(InputArray mtx) - { - if (mtx == null) - throw new ArgumentNullException(nameof(mtx)); - mtx.ThrowIfDisposed(); - var ret = NativeMethods.core_trace(mtx.CvPtr); - GC.KeepAlive(mtx); - return ret; - } - #endregion - #region Invert - /// - /// computes inverse or pseudo-inverse matrix - /// - /// The source floating-point MxN matrix - /// The destination matrix; will have NxM size and the same type as src - /// The inversion method - /// - public static double Invert(InputArray src, OutputArray dst, - DecompTypes flags = DecompTypes.LU) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - double ret = NativeMethods.core_invert(src.CvPtr, dst.CvPtr, (int)flags); - GC.KeepAlive(src); - dst.Fix(); - return ret; - } - #endregion - #region Solve - /// - /// solves linear system or a least-square problem - /// - /// - /// - /// - /// - /// - public static bool Solve(InputArray src1, InputArray src2, OutputArray dst, - DecompTypes flags = DecompTypes.LU) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - int ret = NativeMethods.core_solve(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int)flags); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - return ret != 0; - } - #endregion - #region Sort - /// - /// sorts independently each matrix row or each matrix column - /// - /// The source single-channel array - /// The destination array of the same size and the same type as src - /// The operation flags, a combination of the SortFlag values - public static void Sort(InputArray src, OutputArray dst, SortFlags flags) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_sort(src.CvPtr, dst.CvPtr, (int)flags); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region SortIdx - /// - /// sorts independently each matrix row or each matrix column - /// - /// The source single-channel array - /// The destination integer array of the same size as src - /// The operation flags, a combination of SortFlag values - public static void SortIdx(InputArray src, OutputArray dst, SortFlags flags) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_sortIdx(src.CvPtr, dst.CvPtr, (int)flags); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region SolveCubic - /// - /// finds real roots of a cubic polynomial - /// - /// The equation coefficients, an array of 3 or 4 elements - /// The destination array of real roots which will have 1 or 3 elements - /// - public static int SolveCubic(InputArray coeffs, OutputArray roots) - { - if (coeffs == null) - throw new ArgumentNullException(nameof(coeffs)); - if (roots == null) - throw new ArgumentNullException(nameof(roots)); - coeffs.ThrowIfDisposed(); - roots.ThrowIfNotReady(); - int ret = NativeMethods.core_solveCubic(coeffs.CvPtr, roots.CvPtr); - GC.KeepAlive(coeffs); - roots.Fix(); - return ret; - } - #endregion - #region SolvePoly - /// - /// finds real and complex roots of a polynomial - /// - /// The array of polynomial coefficients - /// The destination (complex) array of roots - /// The maximum number of iterations the algorithm does - /// - public static double SolvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300) - { - if (coeffs == null) - throw new ArgumentNullException(nameof(coeffs)); - if (roots == null) - throw new ArgumentNullException(nameof(roots)); - coeffs.ThrowIfDisposed(); - roots.ThrowIfNotReady(); - double ret = NativeMethods.core_solvePoly(coeffs.CvPtr, roots.CvPtr, maxIters); - GC.KeepAlive(coeffs); - roots.Fix(); - return ret; - } - #endregion - #region Eigen - - /// - /// Computes eigenvalues and eigenvectors of a symmetric matrix. - /// - /// The input matrix; must have CV_32FC1 or CV_64FC1 type, - /// square size and be symmetric: src^T == src - /// The output vector of eigenvalues of the same type as src; - /// The eigenvalues are stored in the descending order. - /// The output matrix of eigenvectors; - /// It will have the same size and the same type as src; The eigenvectors are stored - /// as subsequent matrix rows, in the same order as the corresponding eigenvalues - /// - public static bool Eigen(InputArray src, OutputArray eigenvalues, OutputArray eigenvectors) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (eigenvalues == null) - throw new ArgumentNullException(nameof(eigenvalues)); - if (eigenvectors == null) - throw new ArgumentNullException(nameof(eigenvectors)); - src.ThrowIfDisposed(); - eigenvalues.ThrowIfNotReady(); - eigenvectors.ThrowIfNotReady(); - int ret = NativeMethods.core_eigen(src.CvPtr, eigenvalues.CvPtr, eigenvectors.CvPtr); - eigenvalues.Fix(); - eigenvectors.Fix(); - GC.KeepAlive(src); - return ret != 0; - } - #endregion - #region CalcCovarMatrix - /// - /// computes covariation matrix of a set of samples - /// - /// - /// - /// - /// - public static void CalcCovarMatrix(Mat[] samples, Mat covar, Mat mean, CovarFlags flags) - { - CalcCovarMatrix(samples, covar, mean, flags, MatType.CV_64F); - } + /// + /// computes the angle in degrees (0..360) of the vector (x,y) + /// + /// + /// + /// + public static float FastAtan2(float y, float x) + { + NativeMethods.HandleException( + NativeMethods.core_fastAtan2(y, x, out var ret)); + return ret; + } - /// - /// computes covariation matrix of a set of samples - /// - /// - /// - /// - /// - /// - public static void CalcCovarMatrix(Mat[] samples, Mat covar, Mat mean, - CovarFlags flags, MatType ctype) - { - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - if (covar == null) - throw new ArgumentNullException(nameof(covar)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - covar.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - IntPtr[] samplesPtr = EnumerableEx.SelectPtrs(samples); - NativeMethods.core_calcCovarMatrix_Mat(samplesPtr, samples.Length, covar.CvPtr, mean.CvPtr, (int)flags, ctype); - GC.KeepAlive(samples); - GC.KeepAlive(covar); - GC.KeepAlive(mean); - } + /// + /// computes cube root of the argument + /// + /// + /// + public static float CubeRoot(float val) + { + NativeMethods.HandleException( + NativeMethods.core_cubeRoot(val, out var ret)); + return ret; + } + + + #endregion + + #region utility.hpp + + /// + /// OpenCV will try to set the number of threads for the next parallel region. + /// If threads == 0, OpenCV will disable threading optimizations and run all it's functions + /// sequentially.Passing threads < 0 will reset threads number to system default. This function must + /// be called outside of parallel region. + /// OpenCV will try to run its functions with specified threads number, but some behaviour differs from framework: + /// - `TBB` - User-defined parallel constructions will run with the same threads number, if another is not specified.If later on user creates his own scheduler, OpenCV will use it. + /// - `OpenMP` - No special defined behaviour. + /// - `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run its functions sequentially. + /// - `GCD` - Supports only values <= 0. + /// - `C=` - No special defined behaviour. + /// + /// Number of threads used by OpenCV. + public static void SetNumThreads(int nThreads) + { + NativeMethods.HandleException( + NativeMethods.core_setNumThreads(nThreads)); + } - /// - /// computes covariation matrix of a set of samples - /// - /// - /// - /// - /// - public static void CalcCovarMatrix(InputArray samples, OutputArray covar, - InputOutputArray mean, CovarFlags flags) - { - CalcCovarMatrix(samples, covar, mean, flags, MatType.CV_64F); - } + /// + /// Returns the number of threads used by OpenCV for parallel regions. + /// + /// Always returns 1 if OpenCV is built without threading support. + /// The exact meaning of return value depends on the threading framework used by OpenCV library: + /// - `TBB` - The number of threads, that OpenCV will try to use for parallel regions. If there is + /// any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns default + /// number of threads used by TBB library. + /// - `OpenMP` - An upper bound on the number of threads that could be used to form a new team. + /// - `Concurrency` - The number of threads, that OpenCV will try to use for parallel regions. + /// - `GCD` - Unsupported; returns the GCD thread pool limit(512) for compatibility. + /// - `C=` - The number of threads, that OpenCV will try to use for parallel regions, if before + /// called setNumThreads with threads > 0, otherwise returns the number of logical CPUs, + /// available for the process. + /// + /// + public static int GetNumThreads() + { + NativeMethods.HandleException( + NativeMethods.core_getNumThreads(out var ret)); + return ret; + } + + /// + /// Returns the index of the currently executed thread within the current parallel region. + /// Always returns 0 if called outside of parallel region. + /// @deprecated Current implementation doesn't corresponding to this documentation. + /// The exact meaning of the return value depends on the threading framework used by OpenCV library: + /// - `TBB` - Unsupported with current 4.1 TBB release.Maybe will be supported in future. + /// - `OpenMP` - The thread number, within the current team, of the calling thread. + /// - `Concurrency` - An ID for the virtual processor that the current context is executing + /// on(0 for master thread and unique number for others, but not necessary 1,2,3,...). + /// - `GCD` - System calling thread's ID. Never returns 0 inside parallel region. + /// - `C=` - The index of the current parallel task. + /// + /// + public static int GetThreadNum() + { + NativeMethods.HandleException( + NativeMethods.core_getThreadNum(out var ret)); + return ret; + } - /// - /// computes covariation matrix of a set of samples - /// - /// - /// - /// - /// - /// - public static void CalcCovarMatrix(InputArray samples, OutputArray covar, - InputOutputArray mean, CovarFlags flags, MatType ctype) - { - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - if (covar == null) - throw new ArgumentNullException(nameof(covar)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - samples.ThrowIfDisposed(); - covar.ThrowIfNotReady(); - mean.ThrowIfNotReady(); - NativeMethods.core_calcCovarMatrix_InputArray(samples.CvPtr, covar.CvPtr, mean.CvPtr, (int)flags, ctype); - GC.KeepAlive(samples); - covar.Fix(); - mean.Fix(); - } - #endregion - - #region PCA - /// - /// PCA of the supplied dataset. - /// - /// input samples stored as the matrix rows or as the matrix columns. - /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. - /// - /// maximum number of components that PCA should - /// retain; by default, all the components are retained. - public static void PCACompute(InputArray data, InputOutputArray mean, - OutputArray eigenvectors, int maxComponents = 0) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - if (eigenvectors == null) - throw new ArgumentNullException(nameof(eigenvectors)); - data.ThrowIfDisposed(); - mean.ThrowIfNotReady(); - eigenvectors.ThrowIfNotReady(); - NativeMethods.core_PCACompute(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, maxComponents); - GC.KeepAlive(data); - mean.Fix(); - eigenvectors.Fix(); - } - /// - /// - /// - /// - /// - /// - /// - public static void PCAComputeVar(InputArray data, InputOutputArray mean, - OutputArray eigenvectors, double retainedVariance) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - if (eigenvectors == null) - throw new ArgumentNullException(nameof(eigenvectors)); - data.ThrowIfDisposed(); - mean.ThrowIfNotReady(); - eigenvectors.ThrowIfNotReady(); - NativeMethods.core_PCAComputeVar(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, retainedVariance); - GC.KeepAlive(data); - mean.Fix(); - eigenvectors.Fix(); - } - /// - /// - /// - /// - /// - /// - /// - public static void PCAProject(InputArray data, InputArray mean, - InputArray eigenvectors, OutputArray result) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - if (eigenvectors == null) - throw new ArgumentNullException(nameof(eigenvectors)); - if (result == null) - throw new ArgumentNullException(nameof(result)); - data.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - eigenvectors.ThrowIfDisposed(); - result.ThrowIfNotReady(); - NativeMethods.core_PCAProject(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, result.CvPtr); - GC.KeepAlive(data); - GC.KeepAlive(mean); - result.Fix(); - } - /// - /// - /// - /// - /// - /// - /// - public static void PCABackProject(InputArray data, InputArray mean, - InputArray eigenvectors, OutputArray result) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - if (eigenvectors == null) - throw new ArgumentNullException(nameof(eigenvectors)); - if (result == null) - throw new ArgumentNullException(nameof(result)); - data.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - eigenvectors.ThrowIfDisposed(); - result.ThrowIfNotReady(); - NativeMethods.core_PCABackProject(data.CvPtr, mean.CvPtr, eigenvectors.CvPtr, result.CvPtr); - GC.KeepAlive(data); - GC.KeepAlive(mean); - GC.KeepAlive(eigenvectors); - result.Fix(); - } - #endregion - #region SVD - /// - /// computes SVD of src - /// - /// - /// - /// - /// - /// -// ReSharper disable once InconsistentNaming - public static void SVDecomp(InputArray src, OutputArray w, - OutputArray u, OutputArray vt, SVD.Flags flags = SVD.Flags.None) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (w == null) - throw new ArgumentNullException(nameof(w)); - if (u == null) - throw new ArgumentNullException(nameof(u)); - if (vt == null) - throw new ArgumentNullException(nameof(vt)); - src.ThrowIfDisposed(); - w.ThrowIfNotReady(); - u.ThrowIfNotReady(); - vt.ThrowIfNotReady(); - NativeMethods.core_SVDecomp(src.CvPtr, w.CvPtr, u.CvPtr, vt.CvPtr, (int)flags); - w.Fix(); - u.Fix(); - vt.Fix(); - } + /// + /// Returns full configuration time cmake output. + /// + /// Returned value is raw cmake output including version control system revision, compiler version, + /// compiler flags, enabled modules and third party libraries, etc.Output format depends on target architecture. + /// + /// + public static string GetBuildInformation() + { + using var stdString = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_getBuildInformation(stdString.CvPtr)); + return stdString.ToString(); + } - /// - /// performs back substitution for the previously computed SVD - /// - /// - /// - /// - /// - /// -// ReSharper disable once InconsistentNaming - public static void SVBackSubst(InputArray w, InputArray u, InputArray vt, - InputArray rhs, OutputArray dst) - { - if (w == null) - throw new ArgumentNullException(nameof(w)); - if (u == null) - throw new ArgumentNullException(nameof(u)); - if (vt == null) - throw new ArgumentNullException(nameof(vt)); - if (rhs == null) - throw new ArgumentNullException(nameof(rhs)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - w.ThrowIfDisposed(); - u.ThrowIfDisposed(); - vt.ThrowIfDisposed(); - rhs.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_SVBackSubst(w.CvPtr, u.CvPtr, vt.CvPtr, rhs.CvPtr, dst.CvPtr); - dst.Fix(); - } - #endregion - - #region Mahalanobis/Mahalonobis - /// - /// - /// - /// - /// - /// - /// - public static double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar) - { - if (v1 == null) - throw new ArgumentNullException(nameof(v1)); - if (v2 == null) - throw new ArgumentNullException(nameof(v2)); - if (icovar == null) - throw new ArgumentNullException(nameof(icovar)); - v1.ThrowIfDisposed(); - v2.ThrowIfDisposed(); - icovar.ThrowIfDisposed(); - return NativeMethods.core_Mahalanobis(v1.CvPtr, v2.CvPtr, icovar.CvPtr); - } - /// - /// computes Mahalanobis distance between two vectors: sqrt((v1-v2)'*icovar*(v1-v2)), where icovar is the inverse covariation matrix - /// - /// - /// - /// - /// - public static double Mahalonobis(InputArray v1, InputArray v2, InputArray icovar) - { - return Mahalanobis(v1, v2, icovar); - } - #endregion - #region Dft/Idft - /// - /// Performs a forward Discrete Fourier transform of 1D or 2D floating-point array. - /// - /// The source array, real or complex - /// The destination array, which size and type depends on the flags - /// Transformation flags, a combination of the DftFlag2 values - /// When the parameter != 0, the function assumes that - /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) - /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, - /// thus the function can handle the rest of the rows more efficiently and - /// thus save some time. This technique is very useful for computing array cross-correlation - /// or convolution using DFT - public static void Dft(InputArray src, OutputArray dst, DftFlags flags = DftFlags.None, int nonzeroRows = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_dft(src.CvPtr, dst.CvPtr, (int)flags, nonzeroRows); - GC.KeepAlive(src); - dst.Fix(); - } + /// + /// Returns library version string. + /// For example "3.4.1-dev". + /// + /// + public static string? GetVersionString() + { + const int bufferSize = 128; - /// - /// Performs an inverse Discrete Fourier transform of 1D or 2D floating-point array. - /// - /// The source array, real or complex - /// The destination array, which size and type depends on the flags - /// Transformation flags, a combination of the DftFlag2 values - /// When the parameter != 0, the function assumes that - /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) - /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, - /// thus the function can handle the rest of the rows more efficiently and - /// thus save some time. This technique is very useful for computing array cross-correlation - /// or convolution using DFT - public static void Idft(InputArray src, OutputArray dst, DftFlags flags = DftFlags.None, int nonzeroRows = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_idft(src.CvPtr, dst.CvPtr, (int)flags, nonzeroRows); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Dct/Idct - /// - /// Performs forward or inverse 1D or 2D Discrete Cosine Transformation - /// - /// The source floating-point array - /// The destination array; will have the same size and same type as src - /// Transformation flags, a combination of DctFlag2 values - public static void Dct(InputArray src, OutputArray dst, DctFlags flags = DctFlags.None) + unsafe { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_dct(src.CvPtr, dst.CvPtr, (int)flags); - GC.KeepAlive(src); - dst.Fix(); + var buffer = stackalloc byte[bufferSize]; + NativeMethods.HandleException( + NativeMethods.core_getVersionString(buffer, bufferSize)); + var result = System.Runtime.InteropServices.Marshal.PtrToStringAnsi((IntPtr)buffer); + return result; } + } - /// - /// Performs inverse 1D or 2D Discrete Cosine Transformation - /// - /// The source floating-point array - /// The destination array; will have the same size and same type as src - /// Transformation flags, a combination of DctFlag2 values - public static void Idct(InputArray src, OutputArray dst, DctFlags flags = DctFlags.None) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_idct(src.CvPtr, dst.CvPtr, (int)flags); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region MulSpectrums - /// - /// computes element-wise product of the two Fourier spectrums. The second spectrum can optionally be conjugated before the multiplication - /// - /// - /// - /// - /// - /// - public static void MulSpectrums( - InputArray a, InputArray b, OutputArray c, - DftFlags flags, bool conjB = false) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - if (c == null) - throw new ArgumentNullException(nameof(c)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - c.ThrowIfNotReady(); - NativeMethods.core_mulSpectrums(a.CvPtr, b.CvPtr, c.CvPtr, (int)flags, conjB ? 1 : 0); - GC.KeepAlive(a); - GC.KeepAlive(b); - c.Fix(); - } - #endregion - #region GetOptimalDFTSize - /// - /// computes the minimal vector size vecsize1 >= vecsize so that the dft() of the vector of length vecsize1 can be computed efficiently - /// - /// - /// - public static int GetOptimalDFTSize(int vecsize) - { - return NativeMethods.core_getOptimalDFTSize(vecsize); - } - #endregion - #region Kmeans - /// - /// clusters the input data using k-Means algorithm - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static double Kmeans(InputArray data, int k, InputOutputArray bestLabels, - TermCriteria criteria, int attempts, KMeansFlags flags, OutputArray centers = null) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (bestLabels == null) - throw new ArgumentNullException(nameof(bestLabels)); - data.ThrowIfDisposed(); - bestLabels.ThrowIfDisposed(); - double ret = NativeMethods.core_kmeans(data.CvPtr, k, bestLabels.CvPtr, criteria, attempts, (int)flags, ToPtr(centers)); - bestLabels.Fix(); - if(centers != null) - centers.Fix(); - GC.KeepAlive(data); - return ret; - } - #endregion - #region TheRNG - /// - /// returns the thread-local Random number generator - /// - /// - public static RNG TheRNG() - { - ulong state = NativeMethods.core_theRNG(); - return new RNG(state); - } - #endregion - #region Randu - /// - /// fills array with uniformly-distributed random numbers from the range [low, high) - /// - /// The output array of random numbers. - /// The array must be pre-allocated and have 1 to 4 channels - /// The inclusive lower boundary of the generated random numbers - /// The exclusive upper boundary of the generated random numbers - public static void Randu(InputOutputArray dst, InputArray low, InputArray high) - { - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (low == null) - throw new ArgumentNullException(nameof(low)); - if (high == null) - throw new ArgumentNullException(nameof(high)); - dst.ThrowIfNotReady(); - low.ThrowIfDisposed(); - high.ThrowIfDisposed(); - NativeMethods.core_randu_InputArray(dst.CvPtr, low.CvPtr, high.CvPtr); - GC.KeepAlive(low); - GC.KeepAlive(high); - dst.Fix(); - } + /// + /// Returns major library version + /// + /// + public static int GetVersionMajor() + { + NativeMethods.HandleException( + NativeMethods.core_getVersionMajor(out var ret)); + return ret; + } - /// - /// fills array with uniformly-distributed random numbers from the range [low, high) - /// - /// The output array of random numbers. - /// The array must be pre-allocated and have 1 to 4 channels - /// The inclusive lower boundary of the generated random numbers - /// The exclusive upper boundary of the generated random numbers - public static void Randu(InputOutputArray dst, Scalar low, Scalar high) - { - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - dst.ThrowIfNotReady(); - NativeMethods.core_randu_Scalar(dst.CvPtr, low, high); - GC.KeepAlive(low); - GC.KeepAlive(high); - dst.Fix(); - } - #endregion - #region Randn - /// - /// fills array with normally-distributed random numbers with the specified mean and the standard deviation - /// - /// The output array of random numbers. - /// The array must be pre-allocated and have 1 to 4 channels - /// The mean value (expectation) of the generated random numbers - /// The standard deviation of the generated random numbers - public static void Randn(InputOutputArray dst, InputArray mean, InputArray stddev) - { - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - if (stddev == null) - throw new ArgumentNullException(nameof(stddev)); - dst.ThrowIfNotReady(); - mean.ThrowIfDisposed(); - stddev.ThrowIfDisposed(); - NativeMethods.core_randn_InputArray(dst.CvPtr, mean.CvPtr, stddev.CvPtr); - GC.KeepAlive(mean); - GC.KeepAlive(stddev); - dst.Fix(); - } + /// + /// Returns minor library version + /// + /// + public static int GetVersionMinor() + { + NativeMethods.HandleException( + NativeMethods.core_getVersionMinor(out var ret)); + return ret; + } - /// - /// fills array with normally-distributed random numbers with the specified mean and the standard deviation - /// - /// The output array of random numbers. - /// The array must be pre-allocated and have 1 to 4 channels - /// The mean value (expectation) of the generated random numbers - /// The standard deviation of the generated random numbers - public static void Randn(InputOutputArray dst, Scalar mean, Scalar stddev) - { - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - dst.ThrowIfNotReady(); - NativeMethods.core_randn_Scalar(dst.CvPtr, mean, stddev); - dst.Fix(); - } - #endregion - #region RandShuffle - /// - /// shuffles the input array elements - /// - /// The input/output numerical 1D array - /// The scale factor that determines the number of random swap operations. - /// The optional random number generator used for shuffling. - /// If it is null, theRng() is used instead. - public static void RandShuffle(InputOutputArray dst, double iterFactor, RNG rng = null) - { - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - dst.ThrowIfNotReady(); + /// + /// Returns revision field of the library version + /// + /// + public static int GetVersionRevision() + { + NativeMethods.HandleException( + NativeMethods.core_getVersionRevision(out var ret)); + return ret; + } - if (rng == null) - { - NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, IntPtr.Zero); - } - else - { - ulong state = rng.State; - NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, ref state); - rng.State = state; - } - dst.Fix(); - } - #endregion + /// + /// Returns the number of ticks. + /// The function returns the number of ticks after the certain event (for example, when the machine was + /// turned on). It can be used to initialize RNG or to measure a function execution time by reading the + /// tick count before and after the function call. + /// + /// + public static long GetTickCount() + { + NativeMethods.HandleException( + NativeMethods.core_getTickCount(out var ret)); + return ret; + } - #region Write + /// + /// Returns the number of ticks per second. + /// The function returns the number of ticks per second.That is, the following code computes the execution time in seconds: + /// + /// + public static double GetTickFrequency() + { + NativeMethods.HandleException( + NativeMethods.core_getTickFrequency(out var ret)); + return ret; + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, int value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// Returns the number of CPU ticks. + /// + /// The function returns the current number of CPU ticks on some architectures(such as x86, x64, PowerPC). + /// On other platforms the function is equivalent to getTickCount.It can also be used for very accurate time + /// measurements, as well as for RNG initialization.Note that in case of multi-CPU systems a thread, from which + /// getCPUTickCount is called, can be suspended and resumed at another CPU with its own counter. So, + /// theoretically (and practically) the subsequent calls to the function do not necessary return the monotonously + /// increasing values. Also, since a modern CPU varies the CPU frequency depending on the load, the number of CPU + /// clocks spent in some code cannot be directly converted to time units.Therefore, getTickCount is generally + /// a preferable solution for measuringexecution time. + /// + /// + public static long GetCpuTickCount() + { + NativeMethods.HandleException( + NativeMethods.core_getCPUTickCount(out var ret)); + return ret; + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, float value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// Returns true if the specified feature is supported by the host hardware. + /// The function returns true if the host hardware supports the specified feature.When user calls + /// setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until + /// setUseOptimized(true) is called.This way user can dynamically switch on and off the optimized code in OpenCV. + /// + /// The feature of interest, one of cv::CpuFeatures + /// + public static bool CheckHardwareSupport(CpuFeatures feature) + { + NativeMethods.HandleException( + NativeMethods.core_checkHardwareSupport((int) feature, out var ret)); + return ret != 0; + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, double value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// Returns feature name by ID. + /// Returns empty string if feature is not defined + /// + /// + /// + public static string GetHardwareFeatureName(CpuFeatures feature) + { + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_getHardwareFeatureName((int) feature, buf.CvPtr)); + return buf.ToString(); + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, string value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// Returns list of CPU features enabled during compilation. + /// Returned value is a string containing space separated list of CPU features with following markers: + /// - no markers - baseline features + /// - prefix `*` - features enabled in dispatcher + /// - suffix `?` - features enabled but not available in HW + /// + /// + /// `SSE SSE2 SSE3* SSE4.1 *SSE4.2 *FP16* AVX *AVX2* AVX512-SKX?` + /// + /// + public static string GetCpuFeaturesLine() + { + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_getCPUFeaturesLine(buf.CvPtr)); + return buf.ToString(); + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, Mat value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// Returns the number of logical CPUs available for the process. + /// + /// + public static int GetNumberOfCpus() + { + NativeMethods.HandleException( + NativeMethods.core_getNumberOfCPUs(out var ret)); + return ret; + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, SparseMat value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /* + /// + /// + /// + /// + /// + public static IntPtr FastMalloc(long bufSize) + { + return NativeMethods.core_fastMalloc(new IntPtr(bufSize)); + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, IEnumerable value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// + /// + /// + public static void FastFree(IntPtr ptr) + { + NativeMethods.core_fastFree(ptr); + } + */ + + /// + /// Turns on/off available optimization. + /// The function turns on or off the optimized code in OpenCV. Some optimization can not be enabled + /// or disabled, but, for example, most of SSE code in OpenCV can be temporarily turned on or off this way. + /// + /// + public static void SetUseOptimized(bool onoff) + { + NativeMethods.HandleException( + NativeMethods.core_setUseOptimized(onoff ? 1 : 0)); + } - /// - /// - /// - /// - /// - /// - public static void Write(FileStorage fs, string name, IEnumerable value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.Write(name, value); - } + /// + /// Returns the current optimization status. + /// The function returns the current optimization status, which is controlled by cv::setUseOptimized(). + /// + /// + public static bool UseOptimized() + { + NativeMethods.HandleException( + NativeMethods.core_useOptimized(out var ret)); + return ret != 0; + } - /// - /// - /// - /// - /// - public static void WriteScalar(FileStorage fs, int value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.WriteScalar(value); - } + /// + /// Aligns buffer size by the certain number of bytes + /// This small inline function aligns a buffer size by + /// the certian number of bytes by enlarging it. + /// + /// + /// + /// + public static int AlignSize(int sz, int n) + { + var assert = ((n & (n - 1)) == 0); // n is a power of 2 + if (!assert) + throw new ArgumentException("n must be a power of 2.", nameof(n)); + return (sz + n - 1) & -n; + } + + /// + /// Sets/resets the break-on-error mode. + /// When the break-on-error mode is set, the default error handler issues a hardware exception, + /// which can make debugging more convenient. + /// + /// + /// the previous state + public static bool SetBreakOnError(bool flag) + { + return NativeMethods.core_setBreakOnError(flag ? 1 : 0) != 0; + } - /// - /// - /// - /// - /// - public static void WriteScalar(FileStorage fs, float value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.WriteScalar(value); - } + /// + /// + /// + /// + /// + /// + public static string Format(InputArray mtx, FormatType format = FormatType.Default) + { + if (mtx is null) + throw new ArgumentNullException(nameof(mtx)); + + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_format(mtx.CvPtr, (int) format, buf.CvPtr)); + GC.KeepAlive(mtx); + return buf.ToString(); + } - /// - /// - /// - /// - /// - public static void WriteScalar(FileStorage fs, double value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.WriteScalar(value); - } + #endregion - /// - /// - /// - /// - /// - public static void WriteScalar(FileStorage fs, string value) - { - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - fs.WriteScalar(value); - } + #region logger.hpp - #endregion - #region Read + /// + /// Set global logging level + /// + /// logging level + /// previous logging level + public static LogLevel SetLogLevel(LogLevel logLevel) + { + NativeMethods.HandleException( + NativeMethods.core_logger_setLogLevel(logLevel, out var previous)); - /// - /// - /// - /// - /// - /// - public static int ReadInt(FileNode node, int defaultValue = default(int)) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadInt(defaultValue); - } + return previous; + } - /// - /// - /// - /// - /// - /// - public static float ReadFloat(FileNode node, float defaultValue = default(float)) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadFloat(defaultValue); - } + /// + /// Get global logging level + /// + /// logging level + public static LogLevel GetLogLevel() + { + NativeMethods.HandleException( + NativeMethods.core_logger_getLogLevel(out var logLevel)); - /// - /// - /// - /// - /// - /// - public static double ReadDouble(FileNode node, double defaultValue = default(double)) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadDouble(defaultValue); - } + return logLevel; + } - /// - /// - /// - /// - /// - /// - public static string ReadString(FileNode node, string defaultValue = default(string)) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadString(defaultValue); - } + #endregion - /// - /// - /// - /// - /// - /// - public static Mat ReadMat(FileNode node, Mat defaultMat = null) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadMat(defaultMat); - } + /// + /// Computes absolute value of each matrix element + /// + /// matrix + /// + public static MatExpr Abs(Mat src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_abs_Mat(src.CvPtr, out var ret)); + GC.KeepAlive(src); + return new MatExpr(ret); + } - /// - /// - /// - /// - /// - /// - public static SparseMat ReadSparseMat(FileNode node, SparseMat defaultMat = null) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadSparseMat(defaultMat); - } + /// + /// Computes absolute value of each matrix element + /// + /// matrix expression + /// + public static MatExpr Abs(MatExpr src) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_abs_MatExpr(src.CvPtr, out var ret)); + GC.KeepAlive(src); + return new MatExpr(ret); + } + + /// + /// Equivalence predicate (a boolean function of two arguments). + /// The predicate returns true when the elements are certainly in the same class, and returns false if they may or may not be in the same class. + /// + /// + /// + /// + /// + public delegate bool PartitionPredicate(T t1, T t2); + + /// + /// Splits an element set into equivalency classes. + /// Consider using GroupBy of Linq instead. + /// + /// + /// Set of elements stored as a vector. + /// Output vector of labels. It contains as many elements as vec. Each label labels[i] is a 0-based cluster index of vec[i] . + /// Equivalence predicate (a boolean function of two arguments). + /// The predicate returns true when the elements are certainly in the same class, and returns false if they may or may not be in the same class. + /// + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static int Partition(IEnumerable vec, out int[] labels, PartitionPredicate predicate) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (predicate is null) + throw new ArgumentNullException(nameof(predicate)); - /// - /// - /// - /// - /// - public static KeyPoint[] ReadKeyPoints(FileNode node) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadKeyPoints(); - } + var vecArray = vec as T[] ?? vec.ToArray(); + labels = new int[vecArray.Length]; + var groupHeads = new List(); - /// - /// - /// - /// - /// - public static DMatch[] ReadDMatches(FileNode node) + var index = 0; + foreach (var t in vecArray) { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return node.ReadDMatches(); + var foundGroup = false; + + var label = 0; + foreach (var groupHeadElem in groupHeads) + { + if (predicate(groupHeadElem, t)) + { + labels[index] = label; + foundGroup = true; + break; + } + + label++; + } + + if (!foundGroup) + { + labels[index] = groupHeads.Count; + groupHeads.Add(t); + } + + index++; } - #endregion + return groupHeads.Count; } } diff --git a/src/OpenCvSharp/Cv2/Cv2_cuda.cs b/src/OpenCvSharp/Cv2/Cv2_cuda.cs index 1f5bb6d74..1cd3ae899 100644 --- a/src/OpenCvSharp/Cv2/Cv2_cuda.cs +++ b/src/OpenCvSharp/Cv2/Cv2_cuda.cs @@ -1,69 +1,41 @@ -using System; +#if ENABLED_CUDA + +using System; using System.Collections.Generic; using OpenCvSharp.Cuda; namespace OpenCvSharp { - /// - /// Functions of OpenCV GPU module - /// static partial class Cv2 { #region Hardware -#if LANG_JP - /// - /// CUDAを利用可能なデバイスの個数を返します. - /// 最初のGPU関数呼び出しよりも前に利用しなければいけません. - /// OpenCVがGPUサポートなしでコンパイルされていれば,この関数は0を返します. - /// - /// -#else /// /// Returns the number of installed CUDA-enabled devices. /// Use this function before any other GPU functions calls. /// If OpenCV is compiled without GPU support, this function returns 0. /// /// -#endif public static int GetCudaEnabledDeviceCount() { return NativeMethods.cuda_getCudaEnabledDeviceCount(); } -#if LANG_JP - /// - /// 現在のデバイスインデックスを返します. - /// これは,SetDevice によって設定された,またはデフォルトで初期化されたデバイスです. - /// - /// -#else /// /// Returns the current device index set by SetDevice() or initialized by default. /// /// -#endif public static int GetDevice() { ThrowIfGpuNotAvailable(); return NativeMethods.cuda_getDevice(); } -#if LANG_JP - /// - /// 現在のスレッドでデバイスを設定し,それを初期化します. - /// この関数呼び出しを省略することもできますが,その場合, - /// 最初に GPU が利用される際にデフォルトデバイスが初期化されます. - /// - /// 0からはじまる,GPUデバイスのインデックス. - /// -#else /// /// Sets a device and initializes it for the current thread. /// /// System index of a GPU device starting with 0. /// -#endif public static int SetDevice(int device) { ThrowIfGpuNotAvailable(); @@ -111,9 +83,10 @@ public static void PrintShortCudaDeviceInfo(int device) public static void RegisterPageLocked(Mat m) { ThrowIfGpuNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); NativeMethods.cuda_registerPageLocked(m.CvPtr); + GC.KeepAlive(m); } /// @@ -123,9 +96,10 @@ public static void RegisterPageLocked(Mat m) public static void UnregisterPageLocked(Mat m) { ThrowIfGpuNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); NativeMethods.cuda_unregisterPageLocked(m.CvPtr); + GC.KeepAlive(m); } #endregion @@ -142,9 +116,10 @@ public static void UnregisterPageLocked(Mat m) public static void CreateContinuous(int rows, int cols, MatType type, GpuMat m) { ThrowIfGpuNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); NativeMethods.cuda_createContinuous1(rows, cols, type, m.CvPtr); + GC.KeepAlive(m); } /// @@ -196,9 +171,10 @@ public static GpuMat CreateContinuous(Size size, MatType type) public static void EnsureSizeIsEnough(int rows, int cols, MatType type, GpuMat m) { ThrowIfGpuNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); NativeMethods.cuda_ensureSizeIsEnough(rows, cols, type, m.CvPtr); + GC.KeepAlive(m); } /// @@ -226,3 +202,5 @@ public static void ThrowIfGpuNotAvailable() } } } + +#endif \ No newline at end of file diff --git a/src/OpenCvSharp/Cv2/Cv2_face.cs b/src/OpenCvSharp/Cv2/Cv2_face.cs deleted file mode 100644 index b8b8d4c73..000000000 --- a/src/OpenCvSharp/Cv2/Cv2_face.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using OpenCvSharp.Face; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class Cv2 - { - /// - /// - /// - /// - /// - /// - public static BasicFaceRecognizer CreateEigenFaceRecognizer( - int numComponents = 0, double threshold = Double.MaxValue) - { - return FaceRecognizer.CreateEigenFaceRecognizer(numComponents, threshold); - } - - /// - /// - /// - /// - /// - /// - public static BasicFaceRecognizer CreateFisherFaceRecognizer( - int numComponents = 0, double threshold = Double.MaxValue) - { - return FaceRecognizer.CreateFisherFaceRecognizer(numComponents, threshold); - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static LBPHFaceRecognizer CreateLBPHFaceRecognizer(int radius = 1, int neighbors = 8, - int gridX = 8, int gridY = 8, double threshold = Double.MaxValue) - { - return FaceRecognizer.CreateLBPHFaceRecognizer(radius, neighbors, gridX, gridY, threshold); - } - } -} diff --git a/src/OpenCvSharp/Cv2/Cv2_features2d.cs b/src/OpenCvSharp/Cv2/Cv2_features2d.cs index 06b86e428..87830d802 100644 --- a/src/OpenCvSharp/Cv2/Cv2_features2d.cs +++ b/src/OpenCvSharp/Cv2/Cv2_features2d.cs @@ -1,330 +1,364 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; +// ReSharper disable UnusedMember.Global // ReSharper disable InconsistentNaming -namespace OpenCvSharp +namespace OpenCvSharp; + +static partial class Cv2 { - static partial class Cv2 + /// + /// Detects corners using the FAST algorithm + /// + /// grayscale image where keypoints (corners) are detected. + /// threshold on difference between intensity of the central pixel + /// and pixels of a circle around this pixel. + /// if true, non-maximum suppression is applied to + /// detected corners (keypoints). + /// keypoints detected on the image. + public static KeyPoint[] FAST(InputArray image, int threshold, bool nonmaxSupression = true) { - /// - /// Detects corners using the FAST algorithm - /// - /// grayscale image where keypoints (corners) are detected. - /// threshold on difference between intensity of the central pixel - /// and pixels of a circle around this pixel. - /// if true, non-maximum suppression is applied to - /// detected corners (keypoints). - /// keypoints detected on the image. - public static KeyPoint[] FAST(InputArray image, int threshold, bool nonmaxSupression = true) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); - using (var kp = new VectorOfKeyPoint()) - { - NativeMethods.features2d_FAST1(image.CvPtr, kp.CvPtr, threshold, nonmaxSupression ? 1 : 0); - GC.KeepAlive(image); - return kp.ToArray(); - } - } + using var kp = new VectorOfKeyPoint(); + NativeMethods.HandleException( + NativeMethods.features2d_FAST1(image.CvPtr, kp.CvPtr, threshold, nonmaxSupression ? 1 : 0)); + GC.KeepAlive(image); + return kp.ToArray(); + } - /// - /// Detects corners using the FAST algorithm - /// - /// grayscale image where keypoints (corners) are detected. - /// threshold on difference between intensity of the central pixel - /// and pixels of a circle around this pixel. - /// if true, non-maximum suppression is applied to - /// detected corners (keypoints). - /// one of the three neighborhoods as defined in the paper - /// keypoints detected on the image. - public static KeyPoint[] FAST(InputArray image, int threshold, bool nonmaxSupression, FASTType type) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); + /// + /// Detects corners using the FAST algorithm + /// + /// grayscale image where keypoints (corners) are detected. + /// threshold on difference between intensity of the central pixel + /// and pixels of a circle around this pixel. + /// if true, non-maximum suppression is applied to + /// detected corners (keypoints). + /// one of the three neighborhoods as defined in the paper + /// keypoints detected on the image. + public static KeyPoint[] FAST(InputArray image, int threshold, bool nonmaxSupression, FASTType type) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); - using (var kp = new VectorOfKeyPoint()) - { - NativeMethods.features2d_FAST2(image.CvPtr, kp.CvPtr, threshold, nonmaxSupression ? 1 : 0, (int)type); - GC.KeepAlive(image); - return kp.ToArray(); - } - } + using var kp = new VectorOfKeyPoint(); + NativeMethods.HandleException( + NativeMethods.features2d_FAST2(image.CvPtr, kp.CvPtr, threshold, nonmaxSupression ? 1 : 0, (int)type)); + GC.KeepAlive(image); + return kp.ToArray(); + } - /// - /// Detects corners using the AGAST algorithm - /// - /// grayscale image where keypoints (corners) are detected. - /// threshold on difference between intensity of the central pixel - /// and pixels of a circle around this pixel. - /// if true, non-maximum suppression is applied to - /// detected corners (keypoints). - /// one of the four neighborhoods as defined in the paper - /// keypoints detected on the image. - public static KeyPoint[] AGAST(InputArray image, int threshold, bool nonmaxSuppression, AGASTType type) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - using (var vector = new VectorOfKeyPoint()) - { - NativeMethods.features2d_AGAST(image.CvPtr, vector.CvPtr, threshold, nonmaxSuppression ? 1 : 0, - (int) type); - GC.KeepAlive(image); - return vector.ToArray(); - } - } + /// + /// Detects corners using the AGAST algorithm + /// + /// grayscale image where keypoints (corners) are detected. + /// threshold on difference between intensity of the central pixel + /// and pixels of a circle around this pixel. + /// if true, non-maximum suppression is applied to + /// detected corners (keypoints). + /// one of the four neighborhoods as defined in the paper + /// keypoints detected on the image. + public static KeyPoint[] AGAST(InputArray image, int threshold, bool nonmaxSuppression, AgastFeatureDetector.DetectorType type) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); - /// - /// Draw keypoints. - /// - /// - /// - /// - /// - /// - public static void DrawKeypoints(Mat image, IEnumerable keypoints, Mat outImage, - Scalar? color = null, DrawMatchesFlags flags = DrawMatchesFlags.Default) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (outImage == null) - throw new ArgumentNullException(nameof(outImage)); - if (keypoints == null) - throw new ArgumentNullException(nameof(keypoints)); - image.ThrowIfDisposed(); - outImage.ThrowIfDisposed(); + using var vector = new VectorOfKeyPoint(); + NativeMethods.HandleException( + NativeMethods.features2d_AGAST(image.CvPtr, vector.CvPtr, threshold, nonmaxSuppression ? 1 : 0, (int) type)); + GC.KeepAlive(image); + return vector.ToArray(); + } - KeyPoint[] keypointsArray = EnumerableEx.ToArray(keypoints); - Scalar color0 = color.GetValueOrDefault(Scalar.All(-1)); - NativeMethods.features2d_drawKeypoints(image.CvPtr, keypointsArray, keypointsArray.Length, - outImage.CvPtr, color0, (int)flags); - } + /// + /// Draw keypoints. + /// + /// Source image. + /// Keypoints from the source image. + /// Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below. + /// Color of keypoints. + /// Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags. + public static void DrawKeypoints( + InputArray image, + IEnumerable keypoints, + InputOutputArray outImage, + Scalar? color = null, + DrawMatchesFlags flags = DrawMatchesFlags.Default) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (outImage is null) + throw new ArgumentNullException(nameof(outImage)); + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + image.ThrowIfDisposed(); + outImage.ThrowIfDisposed(); - /// - /// Draws matches of keypints from two images on output image. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void DrawMatches(Mat img1, IEnumerable keypoints1, - Mat img2, IEnumerable keypoints2, - IEnumerable matches1To2, Mat outImg, - Scalar? matchColor = null, Scalar? singlePointColor = null, - IEnumerable matchesMask = null, DrawMatchesFlags flags = DrawMatchesFlags.Default) - { - if (img1 == null) - throw new ArgumentNullException(nameof(img1)); - if (img2 == null) - throw new ArgumentNullException(nameof(img2)); - if (outImg == null) - throw new ArgumentNullException(nameof(outImg)); - if (keypoints1 == null) - throw new ArgumentNullException(nameof(keypoints1)); - if (keypoints2 == null) - throw new ArgumentNullException(nameof(keypoints2)); - if (matches1To2 == null) - throw new ArgumentNullException(nameof(matches1To2)); - img1.ThrowIfDisposed(); - img2.ThrowIfDisposed(); - outImg.ThrowIfDisposed(); + var keypointsArray = keypoints.CastOrToArray(); + var color0 = color.GetValueOrDefault(Scalar.All(-1)); + NativeMethods.HandleException( + NativeMethods.features2d_drawKeypoints(image.CvPtr, keypointsArray, keypointsArray.Length, outImage.CvPtr, color0, (int)flags)); - KeyPoint[] keypoints1Array = EnumerableEx.ToArray(keypoints1); - KeyPoint[] keypoints2Array = EnumerableEx.ToArray(keypoints2); - DMatch[] matches1To2Array = EnumerableEx.ToArray(matches1To2); - Scalar matchColor0 = matchColor.GetValueOrDefault(Scalar.All(-1)); - Scalar singlePointColor0 = singlePointColor.GetValueOrDefault(Scalar.All(-1)); + GC.KeepAlive(image); + GC.KeepAlive(outImage); + } - byte[] matchesMaskArray = null; - int matchesMaskLength = 0; - if (matchesMask != null) - { - matchesMaskArray = EnumerableEx.ToArray(matchesMask); - matchesMaskLength = matchesMaskArray.Length; - } + /// + /// Draws the found matches of keypoints from two images. + /// + /// First source image. + /// Keypoints from the first source image. + /// Second source image. + /// Keypoints from the second source image. + /// Matches from the first image to the second one, which means that keypoints1[i] + /// has a corresponding point in keypoints2[matches[i]] . + /// Output image. Its content depends on the flags value defining what is drawn in the + /// output image. See possible flags bit values below. + /// Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1), + /// the color is generated randomly. + /// Color of single keypoints (circles), which means that keypoints do not + /// have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly. + /// Mask determining which matches are drawn. If the mask is empty, all matches are drawn. + /// Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags. + public static void DrawMatches( + Mat img1, + IEnumerable keypoints1, + Mat img2, + IEnumerable keypoints2, + IEnumerable matches1To2, + Mat outImg, + Scalar? matchColor = null, + Scalar? singlePointColor = null, + IEnumerable? matchesMask = null, + DrawMatchesFlags flags = DrawMatchesFlags.Default) + { + if (img1 is null) + throw new ArgumentNullException(nameof(img1)); + if (img2 is null) + throw new ArgumentNullException(nameof(img2)); + if (outImg is null) + throw new ArgumentNullException(nameof(outImg)); + if (keypoints1 is null) + throw new ArgumentNullException(nameof(keypoints1)); + if (keypoints2 is null) + throw new ArgumentNullException(nameof(keypoints2)); + if (matches1To2 is null) + throw new ArgumentNullException(nameof(matches1To2)); + img1.ThrowIfDisposed(); + img2.ThrowIfDisposed(); + outImg.ThrowIfDisposed(); - NativeMethods.features2d_drawMatches1(img1.CvPtr, keypoints1Array, keypoints1Array.Length, + var keypoints1Array = keypoints1.CastOrToArray(); + var keypoints2Array = keypoints2.CastOrToArray(); + var matches1To2Array = matches1To2.CastOrToArray(); + var matchColor0 = matchColor.GetValueOrDefault(Scalar.All(-1)); + var singlePointColor0 = singlePointColor.GetValueOrDefault(Scalar.All(-1)); + + var matchesMaskArray = matchesMask?.CastOrToArray(); + var matchesMaskLength = matchesMaskArray?.Length ?? 0; + + NativeMethods.HandleException( + NativeMethods.features2d_drawMatches( + img1.CvPtr, keypoints1Array, keypoints1Array.Length, img2.CvPtr, keypoints2Array, keypoints2Array.Length, matches1To2Array, matches1To2Array.Length, outImg.CvPtr, - matchColor0, singlePointColor0, matchesMaskArray, matchesMaskLength, (int)flags); - } + matchColor0, singlePointColor0, matchesMaskArray, matchesMaskLength, (int) flags)); - /// - /// Draws matches of keypints from two images on output image. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void DrawMatches(Mat img1, IEnumerable keypoints1, - Mat img2, IEnumerable keypoints2, - IEnumerable> matches1To2, Mat outImg, - Scalar? matchColor = null, Scalar? singlePointColor = null, - IEnumerable> matchesMask = null, - DrawMatchesFlags flags = DrawMatchesFlags.Default) - { - if (img1 == null) - throw new ArgumentNullException(nameof(img1)); - if (img2 == null) - throw new ArgumentNullException(nameof(img2)); - if (outImg == null) - throw new ArgumentNullException(nameof(outImg)); - if (keypoints1 == null) - throw new ArgumentNullException(nameof(keypoints1)); - if (keypoints2 == null) - throw new ArgumentNullException(nameof(keypoints2)); - if (matches1To2 == null) - throw new ArgumentNullException(nameof(matches1To2)); - img1.ThrowIfDisposed(); - img2.ThrowIfDisposed(); - outImg.ThrowIfDisposed(); + GC.KeepAlive(img1); + GC.KeepAlive(img2); + GC.KeepAlive(outImg); + } - KeyPoint[] keypoints1Array = EnumerableEx.ToArray(keypoints1); - KeyPoint[] keypoints2Array = EnumerableEx.ToArray(keypoints2); - DMatch[][] matches1To2Array = EnumerableEx.SelectToArray(matches1To2, EnumerableEx.ToArray); - int matches1To2Size1 = matches1To2Array.Length; - int[] matches1To2Size2 = EnumerableEx.SelectToArray(matches1To2Array, dm => dm.Length); - Scalar matchColor0 = matchColor.GetValueOrDefault(Scalar.All(-1)); - Scalar singlePointColor0 = singlePointColor.GetValueOrDefault(Scalar.All(-1)); + /// + /// Draws the found matches of keypoints from two images. + /// + /// First source image. + /// Keypoints from the first source image. + /// Second source image. + /// Keypoints from the second source image. + /// Matches from the first image to the second one, which means that keypoints1[i] + /// has a corresponding point in keypoints2[matches[i]] . + /// Output image. Its content depends on the flags value defining what is drawn in the + /// output image. See possible flags bit values below. + /// Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1), + /// the color is generated randomly. + /// Color of single keypoints (circles), which means that keypoints do not + /// have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly. + /// Mask determining which matches are drawn. If the mask is empty, all matches are drawn. + /// Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags. + public static void DrawMatchesKnn( + Mat img1, + IEnumerable keypoints1, + Mat img2, + IEnumerable keypoints2, + IEnumerable> matches1To2, + Mat outImg, + Scalar? matchColor = null, + Scalar? singlePointColor = null, + IEnumerable>? matchesMask = null, + DrawMatchesFlags flags = DrawMatchesFlags.Default) + { + if (img1 is null) + throw new ArgumentNullException(nameof(img1)); + if (img2 is null) + throw new ArgumentNullException(nameof(img2)); + if (outImg is null) + throw new ArgumentNullException(nameof(outImg)); + if (keypoints1 is null) + throw new ArgumentNullException(nameof(keypoints1)); + if (keypoints2 is null) + throw new ArgumentNullException(nameof(keypoints2)); + if (matches1To2 is null) + throw new ArgumentNullException(nameof(matches1To2)); + img1.ThrowIfDisposed(); + img2.ThrowIfDisposed(); + outImg.ThrowIfDisposed(); - using (var matches1To2Ptr = new ArrayAddress2(matches1To2Array)) - { - if (matchesMask == null) - { - NativeMethods.features2d_drawMatches2(img1.CvPtr, keypoints1Array, keypoints1Array.Length, - img2.CvPtr, keypoints2Array, keypoints2Array.Length, - matches1To2Ptr, matches1To2Size1, matches1To2Size2, - outImg.CvPtr, matchColor0, singlePointColor0, - null, 0, null, (int)flags); - } - else - { - byte[][] matchesMaskArray = EnumerableEx.SelectToArray(matchesMask, EnumerableEx.ToArray); - int matchesMaskSize1 = matches1To2Array.Length; - int[] matchesMaskSize2 = EnumerableEx.SelectToArray(matchesMaskArray, dm => dm.Length); - using (var matchesMaskPtr = new ArrayAddress2(matchesMaskArray)) - { - NativeMethods.features2d_drawMatches2(img1.CvPtr, keypoints1Array, keypoints1Array.Length, - img2.CvPtr, keypoints2Array, keypoints2Array.Length, - matches1To2Ptr.Pointer, matches1To2Size1, matches1To2Size2, - outImg.CvPtr, matchColor0, singlePointColor0, - matchesMaskPtr, matchesMaskSize1, matchesMaskSize2, (int)flags); - } - } - } - } + var keypoints1Array = keypoints1.CastOrToArray(); + var keypoints2Array = keypoints2.CastOrToArray(); + var matches1To2Array = matches1To2.Select(m => m.ToArray()).ToArray(); + var matches1To2Size1 = matches1To2Array.Length; + var matches1To2Size2 = matches1To2Array.Select(dm => dm.Length).ToArray(); + var matchColor0 = matchColor.GetValueOrDefault(Scalar.All(-1)); + var singlePointColor0 = singlePointColor.GetValueOrDefault(Scalar.All(-1)); - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void EvaluateFeatureDetector( - Mat img1, Mat img2, Mat H1to2, - ref KeyPoint[] keypoints1, ref KeyPoint[] keypoints2, - out float repeatability, out int correspCount) + using var matches1To2Ptr = new ArrayAddress2(matches1To2Array); + if (matchesMask is null) { - if (img1 == null) - throw new ArgumentNullException(nameof(img1)); - if (img2 == null) - throw new ArgumentNullException(nameof(img2)); - if (H1to2 == null) - throw new ArgumentNullException(nameof(H1to2)); - if (keypoints1 == null) - throw new ArgumentNullException(nameof(keypoints1)); - if (keypoints2 == null) - throw new ArgumentNullException(nameof(keypoints2)); - - using (var keypoints1Vec = new VectorOfKeyPoint(keypoints1)) - using (var keypoints2Vec = new VectorOfKeyPoint(keypoints2)) - { - NativeMethods.features2d_evaluateFeatureDetector( - img1.CvPtr, img2.CvPtr, H1to2.CvPtr, - keypoints1Vec.CvPtr, keypoints2Vec.CvPtr, - out repeatability, out correspCount); - keypoints1 = keypoints1Vec.ToArray(); - keypoints2 = keypoints2Vec.ToArray(); - } + NativeMethods.HandleException( + NativeMethods.features2d_drawMatchesKnn( + img1.CvPtr, keypoints1Array, keypoints1Array.Length, + img2.CvPtr, keypoints2Array, keypoints2Array.Length, + matches1To2Ptr.GetPointer(), matches1To2Size1, matches1To2Size2, + outImg.CvPtr, matchColor0, singlePointColor0, + null, 0, null, (int) flags)); } - - /// - /// - /// - /// - /// - /// recallPrecisionCurve - public static Point2f[] ComputeRecallPrecisionCurve( - DMatch[][] matches1to2, byte[][] correctMatches1to2Mask) + else { - if (matches1to2 == null) - throw new ArgumentNullException(nameof(matches1to2)); - if (correctMatches1to2Mask == null) - throw new ArgumentNullException(nameof(correctMatches1to2Mask)); - - using (var dm = new ArrayAddress2(matches1to2)) - using (var cm = new ArrayAddress2(correctMatches1to2Mask)) - using (var recall = new VectorOfPoint2f()) - { - NativeMethods.features2d_computeRecallPrecisionCurve( - dm.Pointer, dm.Dim1Length, dm.Dim2Lengths, - cm.Pointer, cm.Dim1Length, cm.Dim2Lengths, - recall.CvPtr); - return recall.ToArray(); - } + var matchesMaskArray = matchesMask.Select(m => m.ToArray()).ToArray(); + var matchesMaskSize1 = matches1To2Array.Length; + var matchesMaskSize2 = matchesMaskArray.Select(dm => dm.Length).ToArray(); + using var matchesMaskPtr = new ArrayAddress2(matchesMaskArray); + NativeMethods.HandleException( + NativeMethods.features2d_drawMatchesKnn( + img1.CvPtr, keypoints1Array, keypoints1Array.Length, + img2.CvPtr, keypoints2Array, keypoints2Array.Length, + matches1To2Ptr.GetPointer(), matches1To2Size1, matches1To2Size2, + outImg.CvPtr, matchColor0, singlePointColor0, + matchesMaskPtr.GetPointer(), matchesMaskSize1, matchesMaskSize2, (int) flags)); } + GC.KeepAlive(img1); + GC.KeepAlive(img2); + GC.KeepAlive(outImg); + } - /// - /// - /// - /// - /// - /// - public static float GetRecall( - IEnumerable recallPrecisionCurve, float lPrecision) - { - if (recallPrecisionCurve == null) - throw new ArgumentNullException(nameof(recallPrecisionCurve)); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void EvaluateFeatureDetector( + Mat img1, Mat img2, Mat H1to2, + ref KeyPoint[] keypoints1, ref KeyPoint[] keypoints2, + out float repeatability, out int correspCount) + { + if (img1 is null) + throw new ArgumentNullException(nameof(img1)); + if (img2 is null) + throw new ArgumentNullException(nameof(img2)); + if (H1to2 is null) + throw new ArgumentNullException(nameof(H1to2)); + if (keypoints1 is null) + throw new ArgumentNullException(nameof(keypoints1)); + if (keypoints2 is null) + throw new ArgumentNullException(nameof(keypoints2)); - var array = EnumerableEx.ToArray(recallPrecisionCurve); - return NativeMethods.features2d_getRecall(array, array.Length, lPrecision); - } + using var keypoints1Vec = new VectorOfKeyPoint(keypoints1); + using var keypoints2Vec = new VectorOfKeyPoint(keypoints2); + NativeMethods.HandleException( + NativeMethods.features2d_evaluateFeatureDetector( + img1.CvPtr, img2.CvPtr, H1to2.CvPtr, + keypoints1Vec.CvPtr, keypoints2Vec.CvPtr, + out repeatability, out correspCount)); + GC.KeepAlive(img1); + GC.KeepAlive(img2); + GC.KeepAlive(H1to2); + keypoints1 = keypoints1Vec.ToArray(); + keypoints2 = keypoints2Vec.ToArray(); + } - /// - /// - /// - /// - /// - /// - public static int GetNearestPoint( - IEnumerable recallPrecisionCurve, float lPrecision) - { - if (recallPrecisionCurve == null) - throw new ArgumentNullException(nameof(recallPrecisionCurve)); - var array = EnumerableEx.ToArray(recallPrecisionCurve); - return NativeMethods.features2d_getNearestPoint(array, array.Length, lPrecision); - } + /// + /// + /// + /// + /// + /// recallPrecisionCurve + public static Point2f[] ComputeRecallPrecisionCurve( + DMatch[][] matches1to2, byte[][] correctMatches1to2Mask) + { + if (matches1to2 is null) + throw new ArgumentNullException(nameof(matches1to2)); + if (correctMatches1to2Mask is null) + throw new ArgumentNullException(nameof(correctMatches1to2Mask)); + + using var dm = new ArrayAddress2(matches1to2); + using var cm = new ArrayAddress2(correctMatches1to2Mask); + using var recall = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.features2d_computeRecallPrecisionCurve( + dm.GetPointer(), dm.GetDim1Length(), dm.GetDim2Lengths(), + cm.GetPointer(), cm.GetDim1Length(), cm.GetDim2Lengths(), + recall.CvPtr)); + return recall.ToArray(); + } + + /// + /// + /// + /// + /// + /// + public static float GetRecall( + IEnumerable recallPrecisionCurve, float lPrecision) + { + if (recallPrecisionCurve is null) + throw new ArgumentNullException(nameof(recallPrecisionCurve)); + + var recallPrecisionCurveArray = recallPrecisionCurve.CastOrToArray(); + NativeMethods.HandleException( + NativeMethods.features2d_getRecall( + recallPrecisionCurveArray, recallPrecisionCurveArray.Length, lPrecision, out var ret)); + return ret; + } + + /// + /// + /// + /// + /// + /// + public static int GetNearestPoint( + IEnumerable recallPrecisionCurve, float lPrecision) + { + if (recallPrecisionCurve is null) + throw new ArgumentNullException(nameof(recallPrecisionCurve)); + + var recallPrecisionCurveArray = recallPrecisionCurve.CastOrToArray(); + NativeMethods.HandleException( + NativeMethods.features2d_getNearestPoint( + recallPrecisionCurveArray, recallPrecisionCurveArray.Length, lPrecision, out var ret)); + return ret; } } diff --git a/src/OpenCvSharp/Cv2/Cv2_highgui.cs b/src/OpenCvSharp/Cv2/Cv2_highgui.cs index 362bc13b4..0b8133af1 100644 --- a/src/OpenCvSharp/Cv2/Cv2_highgui.cs +++ b/src/OpenCvSharp/Cv2/Cv2_highgui.cs @@ -1,199 +1,474 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +static partial class Cv2 { - static partial class Cv2 + /// + /// Creates a window. + /// + /// Name of the window in the window caption that may be used as a window identifier. + /// + /// Flags of the window. Currently the only supported flag is CV WINDOW AUTOSIZE. If this is set, + /// the window size is automatically adjusted to fit the displayed image (see imshow ), and the user can not change the window size manually. + /// + public static void NamedWindow(string winName, WindowFlags flags = WindowFlags.Normal) { - /// - /// Creates a window. - /// - /// Name of the window in the window caption that may be used as a window identifier. - public static void NamedWindow(string winname) - { - NamedWindow(winname, WindowMode.Normal); - } + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); - /// - /// Creates a window. - /// - /// Name of the window in the window caption that may be used as a window identifier. - /// - /// Flags of the window. Currently the only supported flag is CV WINDOW AUTOSIZE. If this is set, - /// the window size is automatically adjusted to fit the displayed image (see imshow ), and the user can not change the window size manually. - /// - public static void NamedWindow(string winname, WindowMode flags) - { - if (string.IsNullOrEmpty(winname)) - throw new ArgumentNullException(nameof(winname)); - try - { - NativeMethods.highgui_namedWindow(winname, (int) flags); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } + NativeMethods.HandleException( + NativeMethods.highgui_namedWindow(winName, (int) flags)); + } - /// - /// - /// - /// - public static void DestroyWindow(string winName) - { - if (String.IsNullOrEmpty("winName")) - throw new ArgumentNullException(nameof(winName)); - NativeMethods.highgui_destroyWindow(winName); - } + /// + /// Destroys the specified window. + /// + /// + public static void DestroyWindow(string winName) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); - /// - /// - /// - public static void DestroyAllWindows() - { - NativeMethods.highgui_destroyAllWindows(); - } + NativeMethods.HandleException( + NativeMethods.highgui_destroyWindow(winName)); + } - /// - /// Displays the image in the specified window - /// - /// Name of the window. - /// Image to be shown. - public static void ImShow(string winname, Mat mat) - { - if (string.IsNullOrEmpty(winname)) - throw new ArgumentNullException(nameof(winname)); - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - try - { - NativeMethods.highgui_imshow(winname, mat.CvPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } + /// + /// Destroys all of the HighGUI windows. + /// + public static void DestroyAllWindows() + { + NativeMethods.HandleException( + NativeMethods.highgui_destroyAllWindows()); + } - /// - /// - /// - /// - public static int StartWindowThread() - { - return NativeMethods.highgui_startWindowThread(); - } + /// + /// + /// + /// + public static int StartWindowThread() + { + NativeMethods.HandleException( + NativeMethods.highgui_startWindowThread(out var ret)); + return ret; + } - /// - /// Waits for a pressed key. - /// - /// Delay in milliseconds. 0 is the special value that means ”forever” - /// Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed. - public static int WaitKey(int delay = 0) - { - try - { - return NativeMethods.highgui_waitKey(delay); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } + /// + /// Waits for a pressed key. + /// Similar to #waitKey, but returns full key code. + /// Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc + /// + /// Delay in milliseconds. 0 is the special value that means ”forever” + /// Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed. + public static int WaitKeyEx(int delay = 0) + { + NativeMethods.HandleException( + NativeMethods.highgui_waitKeyEx(delay, out var ret)); + return ret; + } - /// - /// Resizes window to the specified size - /// - /// Window name - /// The new window width - /// The new window height - public static void ResizeWindow(string winName, int width, int height) - { - if (String.IsNullOrEmpty(winName)) - throw new ArgumentNullException(nameof(winName)); - NativeMethods.highgui_resizeWindow(winName, width, height); - } + /// + /// Waits for a pressed key. + /// + /// Delay in milliseconds. 0 is the special value that means ”forever” + /// Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed. + public static int WaitKey(int delay = 0) + { + NativeMethods.HandleException( + NativeMethods.highgui_waitKey(delay, out var ret)); + return ret; + } - /// - /// Moves window to the specified position - /// - /// Window name - /// The new x-coordinate of the window - /// The new y-coordinate of the window - public static void MoveWindow(string winName, int x, int y) - { - if (String.IsNullOrEmpty(winName)) - throw new ArgumentNullException(nameof(winName)); - NativeMethods.highgui_moveWindow(winName, x, y); - } + /// + /// Displays the image in the specified window + /// + /// Name of the window. + /// Image to be shown. + public static void ImShow(string winName, Mat mat) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); + if (mat is null) + throw new ArgumentNullException(nameof(mat)); - /// - /// Changes parameters of a window dynamically. - /// - /// Name of the window. - /// Window property to retrieve. - /// New value of the window property. - public static void SetWindowProperty(string winName, WindowProperty propId, double propValue) - { - if (String.IsNullOrEmpty(winName)) - throw new ArgumentNullException(nameof(winName)); - NativeMethods.highgui_setWindowProperty(winName, (int) propId, propValue); - } + NativeMethods.HandleException( + NativeMethods.highgui_imshow(winName, mat.CvPtr)); + GC.KeepAlive(mat); + } - /// - /// Updates window title - /// - /// - /// - public static void SetWindowTitle(string winname, string title) - { - if (String.IsNullOrEmpty(winname)) - throw new ArgumentNullException(nameof(winname)); - if (String.IsNullOrEmpty(title)) - throw new ArgumentNullException(nameof(title)); - NativeMethods.highgui_setWindowTitle(winname, title); - } + /// + /// Resizes window to the specified size + /// + /// Window name + /// The new window width + /// The new window height + public static void ResizeWindow(string winName, int width, int height) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); - /// - /// Provides parameters of a window. - /// - /// Name of the window. - /// Window property to retrieve. - /// - public static double GetWindowProperty(string winName, WindowProperty propId) - { - if (String.IsNullOrEmpty(winName)) - throw new ArgumentNullException(nameof(winName)); - return NativeMethods.highgui_getWindowProperty(winName, (int) propId); - } + NativeMethods.HandleException( + NativeMethods.highgui_resizeWindow(winName, width, height)); + } -#if LANG_JP /// - /// 指定されたウィンドウ内で発生するマウスイベントに対するコールバック関数を設定する + /// Resizes window to the specified size /// - /// ウィンドウの名前 - /// 指定されたウィンドウ内でマウスイベントが発生するたびに呼ばれるデリゲート -#else + /// Window name + /// The new window size + public static void ResizeWindow(string winName, Size size) + { + ResizeWindow(winName, size.Width, size.Height); + } + + /// + /// Moves window to the specified position + /// + /// Window name + /// The new x-coordinate of the window + /// The new y-coordinate of the window + public static void MoveWindow(string winName, int x, int y) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); + + NativeMethods.HandleException( + NativeMethods.highgui_moveWindow(winName, x, y)); + } + + /// + /// Changes parameters of a window dynamically. + /// + /// Name of the window. + /// Window property to retrieve. + /// New value of the window property. + public static void SetWindowProperty(string winName, WindowPropertyFlags propId, double propValue) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); + + NativeMethods.HandleException( + NativeMethods.highgui_setWindowProperty(winName, (int) propId, propValue)); + } + + /// + /// Updates window title + /// + /// Name of the window + /// New title + public static void SetWindowTitle(string winName, string title) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); + if (string.IsNullOrEmpty(title)) + throw new ArgumentException("null or empty string.", nameof(title)); + + NativeMethods.HandleException( + NativeMethods.highgui_setWindowTitle(winName, title)); + } + + /// + /// Provides parameters of a window. + /// + /// Name of the window. + /// Window property to retrieve. + /// + public static double GetWindowProperty(string winName, WindowPropertyFlags propId) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); + + NativeMethods.HandleException( + NativeMethods.highgui_getWindowProperty(winName, (int) propId, out var ret)); + return ret; + } + + /// + /// Provides rectangle of image in the window. + /// The function getWindowImageRect returns the client screen coordinates, width and height of the image rendering area. + /// + /// Name of the window. + /// + public static Rect GetWindowImageRect(string winName) + { + if (string.IsNullOrEmpty(winName)) + throw new ArgumentException("null or empty string.", nameof(winName)); + + NativeMethods.HandleException( + NativeMethods.highgui_getWindowImageRect(winName, out var ret)); + return ret; + } + + /// + /// Sets the callback function for mouse events occuring within the specified window. + /// + /// Name of the window. + /// Reference to the function to be called every time mouse event occurs in the specified window. + /// + public static void SetMouseCallback(string windowName, MouseCallback onMouse, IntPtr userData = default) + { + if (string.IsNullOrEmpty(windowName)) + throw new ArgumentNullException(nameof(windowName)); + if (onMouse is null) + throw new ArgumentNullException(nameof(onMouse)); + + NativeMethods.HandleException( + NativeMethods.highgui_setMouseCallback(windowName, onMouse, userData)); + } + + /// + /// Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and cv::EVENT_MOUSEHWHEEL. + /// + /// For regular mice with a scroll-wheel, delta will be a multiple of 120. The value 120 corresponds to + /// a one notch rotation of the wheel or the threshold for action to be taken and one such action should + /// occur for each delta.Some high-precision mice with higher-resolution freely-rotating wheels may + /// generate smaller values. + /// + /// For cv::EVENT_MOUSEWHEEL positive and negative values mean forward and backward scrolling, + /// respectively.For cv::EVENT_MOUSEHWHEEL, where available, positive and negative values mean right and + /// left scrolling, respectively. + /// + /// The mouse callback flags parameter. + /// + public static int GetMouseWheelDelta(MouseEventFlags flags) + { + NativeMethods.HandleException( + NativeMethods.highgui_getMouseWheelDelta((int)flags, out var ret)); + return ret; + } + + /// + /// Selects ROI on the given image. + /// Function creates a window and allows user to select a ROI using mouse. + /// Controls: use `space` or `enter` to finish selection, use key `c` to cancel selection (function will return the zero cv::Rect). + /// + /// name of the window where selection process will be shown. + /// image to select a ROI. + /// if true crosshair of selection rectangle will be shown. + /// if true center of selection will match initial mouse position. In opposite case a corner of + /// selection rectangle will correspond to the initial mouse position. + /// selected ROI or empty rect if selection canceled. + // ReSharper disable once InconsistentNaming + public static Rect SelectROI(string windowName, InputArray img, bool showCrosshair = true, bool fromCenter = false) + { + if (string.IsNullOrEmpty(windowName)) + throw new ArgumentNullException(nameof(windowName)); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.highgui_selectROI1(windowName, img.CvPtr, showCrosshair ? 1 : 0, fromCenter ? 1 : 0, out var ret)); + + GC.KeepAlive(img); + return ret; + } + + /// + /// Selects ROI on the given image. + /// Function creates a window and allows user to select a ROI using mouse. + /// Controls: use `space` or `enter` to finish selection, use key `c` to cancel selection (function will return the zero cv::Rect). + /// + /// image to select a ROI. + /// if true crosshair of selection rectangle will be shown. + /// if true center of selection will match initial mouse position. In opposite case a corner of + /// selection rectangle will correspond to the initial mouse position. + /// selected ROI or empty rect if selection canceled. + // ReSharper disable once InconsistentNaming + public static Rect SelectROI(InputArray img, bool showCrosshair = true, bool fromCenter = false) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.highgui_selectROI2(img.CvPtr, showCrosshair ? 1 : 0, fromCenter ? 1 : 0, out var ret)); + + GC.KeepAlive(img); + return ret; + } + + /// + /// Selects ROIs on the given image. + /// Function creates a window and allows user to select a ROIs using mouse. + /// Controls: use `space` or `enter` to finish current selection and start a new one, + /// use `esc` to terminate multiple ROI selection process. + /// + /// name of the window where selection process will be shown. + /// image to select a ROI. + /// if true crosshair of selection rectangle will be shown. + /// if true center of selection will match initial mouse position. In opposite case a corner of + /// selection rectangle will correspond to the initial mouse position. + /// selected ROIs. + // ReSharper disable once InconsistentNaming + public static Rect[] SelectROIs(string windowName, InputArray img, bool showCrosshair = true, bool fromCenter = false) + { + if (string.IsNullOrEmpty(windowName)) + throw new ArgumentNullException(nameof(windowName)); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + using var boundingBoxesVec = new VectorOfRect(); + NativeMethods.HandleException( + NativeMethods.highgui_selectROIs(windowName, img.CvPtr, boundingBoxesVec.CvPtr, showCrosshair ? 1 : 0, fromCenter ? 1 : 0)); + + GC.KeepAlive(img); + return boundingBoxesVec.ToArray(); + } + + /// + /// Creates a trackbar and attaches it to the specified window. + /// The function createTrackbar creates a trackbar(a slider or range control) with the specified name + /// and range, assigns a variable value to be a position synchronized with the trackbar and specifies + /// the callback function onChange to be called on the trackbar position change.The created trackbar is + /// displayed in the specified window winName. + /// + /// Name of the created trackbar. + /// Name of the window that will be used as a parent of the created trackbar. + /// Optional pointer to an integer variable whose value reflects the position of the slider.Upon creation, + /// the slider position is defined by this variable. + /// Maximal position of the slider. The minimal position is always 0. + /// Pointer to the function to be called every time the slider changes position. + /// This function should be prototyped as void Foo(int, void\*); , where the first parameter is the trackbar + /// position and the second parameter is the user data(see the next parameter). If the callback is + /// the NULL pointer, no callbacks are called, but only value is updated. + /// User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables. + /// + public static int CreateTrackbar(string trackbarName, string winName, + ref int value, int count, TrackbarCallbackNative? onChange = null, IntPtr userData = default) + { + if (trackbarName is null) + throw new ArgumentNullException(nameof(trackbarName)); + if (winName is null) + throw new ArgumentNullException(nameof(winName)); + + NativeMethods.HandleException( + NativeMethods.highgui_createTrackbar(trackbarName, winName, ref value, count, onChange, userData, out var ret)); + return ret; + } + + /// + /// Creates a trackbar and attaches it to the specified window. + /// The function createTrackbar creates a trackbar(a slider or range control) with the specified name + /// and range, assigns a variable value to be a position synchronized with the trackbar and specifies + /// the callback function onChange to be called on the trackbar position change.The created trackbar is + /// displayed in the specified window winName. + /// + /// Name of the created trackbar. + /// Name of the window that will be used as a parent of the created trackbar. + /// Maximal position of the slider. The minimal position is always 0. + /// Pointer to the function to be called every time the slider changes position. + /// This function should be prototyped as void Foo(int, void\*); , where the first parameter is the trackbar + /// position and the second parameter is the user data(see the next parameter). If the callback is + /// the NULL pointer, no callbacks are called, but only value is updated. + /// User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables. + /// + public static int CreateTrackbar(string trackbarName, string winName, + int count, TrackbarCallbackNative? onChange = null, IntPtr userData = default) + { + if (trackbarName is null) + throw new ArgumentNullException(nameof(trackbarName)); + if (winName is null) + throw new ArgumentNullException(nameof(winName)); + + NativeMethods.HandleException( + NativeMethods.highgui_createTrackbar(trackbarName, winName, IntPtr.Zero, count, onChange, userData, out var ret)); + return ret; + } + + /// + /// Returns the trackbar position. + /// + /// Name of the trackbar. + /// Name of the window that is the parent of the trackbar. + /// trackbar position + public static int GetTrackbarPos(string trackbarName, string winName) + { + if (trackbarName is null) + throw new ArgumentNullException(nameof(trackbarName)); + + NativeMethods.HandleException( + NativeMethods.highgui_getTrackbarPos(trackbarName, winName, out var ret)); + return ret; + } + + /// + /// Sets the trackbar position. + /// + /// Name of the trackbar. + /// Name of the window that is the parent of trackbar. + /// New position. + public static void SetTrackbarPos(string trackbarName, string winName, int pos) + { + if (trackbarName is null) + throw new ArgumentNullException(nameof(trackbarName)); + + NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarPos(trackbarName, winName, pos)); + } + + /// + /// Sets the trackbar maximum position. + /// The function sets the maximum position of the specified trackbar in the specified window. + /// + /// Name of the trackbar. + /// Name of the window that is the parent of trackbar. + /// New maximum position. + public static void SetTrackbarMax(string trackbarName, string winName, int maxVal) + { + if (trackbarName is null) + throw new ArgumentNullException(nameof(trackbarName)); + + NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarMax(trackbarName, winName, maxVal)); + } + + /// + /// Sets the trackbar minimum position. + /// The function sets the minimum position of the specified trackbar in the specified window. + /// + /// Name of the trackbar. + /// Name of the window that is the parent of trackbar. + /// New minimum position. + public static void SetTrackbarMin(string trackbarName, string winName, int minVal) + { + if (trackbarName is null) + throw new ArgumentNullException(nameof(trackbarName)); + + NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarMin(trackbarName, winName, minVal)); + } + + /// + /// get native window handle (HWND in case of Win32 and Widget in case of X Window) + /// + /// + public static IntPtr GetWindowHandle(string windowName) + { + if (windowName is null) + throw new ArgumentNullException(nameof(windowName)); + + NativeMethods.HandleException( + NativeMethods.highgui_cvGetWindowHandle(windowName, out var ret)); + return ret; + } + +#if WINRT + // MP! Added: To correctly support imShow under WinRT. + /// - /// Sets the callback function for mouse events occuting within the specified window. + /// Initialize XAML container panel for use by ImShow /// - /// Name of the window. - /// Reference to the function to be called every time mouse event occurs in the specified window. -#endif - public static void SetMouseCallback(string windowName, CvMouseCallback onMouse) + /// Panel container. + public static void InitContainer(object panel) { - if (string.IsNullOrEmpty(windowName)) - throw new ArgumentNullException(nameof(windowName)); - if (onMouse == null) - throw new ArgumentNullException(nameof(onMouse)); - - Window window = Window.GetWindowByName(windowName); - if (window != null) - { - window.OnMouseCallback += onMouse; - } + NativeMethods.HandleException( + NativeMethods.highgui_initContainer(panel)); } - } +#endif } diff --git a/src/OpenCvSharp/Cv2/Cv2_imgcodecs.cs b/src/OpenCvSharp/Cv2/Cv2_imgcodecs.cs index f546d609a..ee065daa7 100644 --- a/src/OpenCvSharp/Cv2/Cv2_imgcodecs.cs +++ b/src/OpenCvSharp/Cv2/Cv2_imgcodecs.cs @@ -1,224 +1,280 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp +namespace OpenCvSharp; + +static partial class Cv2 { - static partial class Cv2 + /// + /// Loads an image from a file. + /// + /// Name of file to be loaded. + /// Specifies color type of the loaded image + /// + public static Mat ImRead(string fileName, ImreadModes flags = ImreadModes.Color) { - /// - /// Loads an image from a file. - /// - /// Name of file to be loaded. - /// Specifies color type of the loaded image - /// - public static Mat ImRead(string fileName, ImreadModes flags = ImreadModes.Color) - { - return new Mat(fileName, flags); - } + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); - /// - /// Loads a multi-page image from a file. - /// - /// Name of file to be loaded. - /// A vector of Mat objects holding each page, if more than one. - /// Flag that can take values of @ref cv::ImreadModes, default with IMREAD_ANYCOLOR. - /// - public static bool ImReadMulti(string filename, out Mat[] mats, ImreadModes flags = ImreadModes.AnyColor) - { - if (filename == null) - throw new ArgumentNullException(nameof(filename)); + NativeMethods.HandleException( + NativeMethods.imgcodecs_imread(fileName, (int) flags, out var ret)); + if (ret == IntPtr.Zero) + throw new OpenCvSharpException("imread failed."); + return Mat.FromNativePointer(ret); + } - using (var matsVec = new VectorOfMat()) - { - int ret = NativeMethods.imgcodecs_imreadmulti(filename, matsVec.CvPtr, (int) flags); - mats = matsVec.ToArray(); - return ret != 0; - } - } + /// + /// Loads a multi-page image from a file. + /// + /// Name of file to be loaded. + /// A vector of Mat objects holding each page, if more than one. + /// Flag that can take values of @ref cv::ImreadModes, default with IMREAD_ANYCOLOR. + /// + public static bool ImReadMulti(string filename, out Mat[] mats, ImreadModes flags = ImreadModes.AnyColor) + { + if (filename is null) + throw new ArgumentNullException(nameof(filename)); - /// - /// Saves an image to a specified file. - /// - /// Name of the file. - /// Image to be saved. - /// Format-specific save parameters encoded as pairs - /// - public static bool ImWrite(string fileName, Mat img, int[] prms = null) - { - if (string.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (prms == null) - prms = new int[0]; - - return NativeMethods.imgcodecs_imwrite(fileName, img.CvPtr, prms, prms.Length) != 0; - } + using var matsVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.imgcodecs_imreadmulti(filename, matsVec.CvPtr, (int) flags, out var ret)); + mats = matsVec.ToArray(); + return ret != 0; + } - /// - /// Saves an image to a specified file. - /// - /// Name of the file. - /// Image to be saved. - /// Format-specific save parameters encoded as pairs - /// - public static bool ImWrite(string fileName, Mat img, params ImageEncodingParam[] prms) - { - if (prms != null) - { - List p = new List(); - foreach (ImageEncodingParam item in prms) - { - p.Add((int) item.EncodingId); - p.Add(item.Value); - } - return ImWrite(fileName, img, p.ToArray()); - } + /// + /// Saves an image to a specified file. + /// + /// Name of the file. + /// Image to be saved. + /// Format-specific save parameters encoded as pairs + /// + public static bool ImWrite(string fileName, Mat img, int[]? prms = null) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (img is null) + throw new ArgumentNullException(nameof(img)); + prms ??= []; - return ImWrite(fileName, img, (int[]) null); - } + NativeMethods.HandleException( + NativeMethods.imgcodecs_imwrite(fileName, img.CvPtr, prms, prms.Length, out var ret)); + GC.KeepAlive(img); + return ret != 0; + } - /// - /// Reads image from the specified buffer in memory. - /// - /// The input array of vector of bytes. - /// The same flags as in imread - /// - public static Mat ImDecode(Mat buf, ImreadModes flags) - { - if (buf == null) - throw new ArgumentNullException(nameof(buf)); - buf.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.imgcodecs_imdecode_Mat(buf.CvPtr, (int) flags); - GC.KeepAlive(buf); - return new Mat(matPtr); - } + /// + /// Saves an image to a specified file. + /// + /// Name of the file. + /// Image to be saved. + /// Format-specific save parameters encoded as pairs + /// + public static bool ImWrite(string fileName, Mat img, params ImageEncodingParam[] prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + if (prms.Length <= 0) + return ImWrite(fileName, img); - /// - /// Reads image from the specified buffer in memory. - /// - /// The input array of vector of bytes. - /// The same flags as in imread - /// - public static Mat ImDecode(InputArray buf, ImreadModes flags) + var p = new List(); + foreach (var item in prms) { - if (buf == null) - throw new ArgumentNullException(nameof(buf)); - buf.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.imgcodecs_imdecode_InputArray(buf.CvPtr, (int) flags); - GC.KeepAlive(buf); - return new Mat(matPtr); + p.Add((int) item.EncodingId); + p.Add(item.Value); } + return ImWrite(fileName, img, p.ToArray()); + } - /// - /// Reads image from the specified buffer in memory. - /// - /// The input array of vector of bytes. - /// The same flags as in imread - /// - public static Mat ImDecode(byte[] buf, ImreadModes flags) - { - if (buf == null) - throw new ArgumentNullException(nameof(buf)); - IntPtr matPtr = NativeMethods.imgcodecs_imdecode_vector( - buf, new IntPtr(buf.Length), (int) flags); - return new Mat(matPtr); - } + /// + /// Saves an image to a specified file. + /// + /// Name of the file. + /// Image to be saved. + /// Format-specific save parameters encoded as pairs + /// + public static bool ImWrite(string fileName, IEnumerable img, int[]? prms = null) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (img is null) + throw new ArgumentNullException(nameof(img)); + prms ??= []; + + using var imgVec = new VectorOfMat(img); + NativeMethods.HandleException( + NativeMethods.imgcodecs_imwrite_multi(fileName, imgVec.CvPtr, prms, prms.Length, out var ret)); + GC.KeepAlive(img); + return ret != 0; + } + + /// + /// Saves an image to a specified file. + /// + /// Name of the file. + /// Image to be saved. + /// Format-specific save parameters encoded as pairs + /// + public static bool ImWrite(string fileName, IEnumerable img, params ImageEncodingParam[] prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + if (prms.Length <= 0) + return ImWrite(fileName, img); - /// - /// Compresses the image and stores it in the memory buffer - /// - /// The file extension that defines the output format - /// The image to be written - /// Output buffer resized to fit the compressed image. - /// Format-specific parameters. - public static bool ImEncode(string ext, InputArray img, out byte[] buf, int[] prms = null) + var p = new List(); + foreach (var item in prms) { - if (string.IsNullOrEmpty(ext)) - throw new ArgumentNullException(nameof(ext)); - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (prms == null) - prms = new int[0]; - img.ThrowIfDisposed(); - using (var bufVec = new VectorOfByte()) - { - int ret = NativeMethods.imgcodecs_imencode_vector(ext, img.CvPtr, bufVec.CvPtr, prms, prms.Length); - buf = bufVec.ToArray(); - return ret != 0; - } + p.Add((int)item.EncodingId); + p.Add(item.Value); } + return ImWrite(fileName, img, p.ToArray()); + } - /// - /// Compresses the image and stores it in the memory buffer - /// - /// The file extension that defines the output format - /// The image to be written - /// Output buffer resized to fit the compressed image. - /// Format-specific parameters. - public static void ImEncode(string ext, InputArray img, out byte[] buf, params ImageEncodingParam[] prms) + /// + /// Reads image from the specified buffer in memory. + /// + /// The input array of vector of bytes. + /// The same flags as in imread + /// + public static Mat ImDecode(Mat buf, ImreadModes flags) + { + if (buf is null) + throw new ArgumentNullException(nameof(buf)); + buf.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgcodecs_imdecode_Mat(buf.CvPtr, (int) flags, out var ret)); + GC.KeepAlive(buf); + return new Mat(ret); + } + + /// + /// Reads image from the specified buffer in memory. + /// + /// The input array of vector of bytes. + /// The same flags as in imread + /// + public static Mat ImDecode(InputArray buf, ImreadModes flags) + { + if (buf is null) + throw new ArgumentNullException(nameof(buf)); + buf.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgcodecs_imdecode_InputArray(buf.CvPtr, (int) flags, out var ret)); + GC.KeepAlive(buf); + return new Mat(ret); + } + + /// + /// Reads image from the specified buffer in memory. + /// + /// The input array of vector of bytes. + /// The same flags as in imread + /// + public static Mat ImDecode(byte[] buf, ImreadModes flags) + { + if (buf is null) + throw new ArgumentNullException(nameof(buf)); + var ret = ImDecode(new ReadOnlySpan(buf), flags); + GC.KeepAlive(buf); + return ret; + } + + /// + /// Reads image from the specified buffer in memory. + /// + /// The input slice of bytes. + /// The same flags as in imread + /// + public static Mat ImDecode(ReadOnlySpan span, ImreadModes flags) + { + if (span.IsEmpty) + throw new ArgumentException("Empty span", nameof(span)); + + unsafe { - if (prms != null) - { - var p = new List(); - foreach (ImageEncodingParam item in prms) - { - p.Add((int) item.EncodingId); - p.Add(item.Value); - } - ImEncode(ext, img, out buf, p.ToArray()); - } - else + fixed (byte* pBuf = span) { - ImEncode(ext, img, out buf, (int[]) null); + NativeMethods.HandleException( + NativeMethods.imgcodecs_imdecode_vector(pBuf, span.Length, (int) flags, out var ret)); + return new Mat(ret); } } + } - /// - /// utility function: convert one image to another with optional vertical flip - /// - /// - /// - /// - public static void ConvertImage(Mat src, Mat dst, ConvertImageModes flags = ConvertImageModes.None) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - - dst.Create(src.Size(), MatType.CV_8UC3); - NativeMethods.imgcodecs_cvConvertImage_Mat(src.CvPtr, dst.CvPtr, (int)flags); - - GC.KeepAlive(src); - GC.KeepAlive(dst); - } + /// + /// Compresses the image and stores it in the memory buffer + /// + /// The file extension that defines the output format + /// The image to be written + /// Output buffer resized to fit the compressed image. + /// Format-specific parameters. + public static bool ImEncode(string ext, InputArray img, out byte[] buf, int[]? prms = null) + { + if (string.IsNullOrEmpty(ext)) + throw new ArgumentNullException(nameof(ext)); + if (img is null) + throw new ArgumentNullException(nameof(img)); + prms ??= []; + img.ThrowIfDisposed(); - /// - /// - /// - /// - /// - public static bool HaveImageReader(string fileName) - { - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - return NativeMethods.imgcodecs_cvHaveImageReader(fileName) != 0; - } + using var bufVec = new VectorOfByte(); + NativeMethods.HandleException( + NativeMethods.imgcodecs_imencode_vector(ext, img.CvPtr, bufVec.CvPtr, prms, prms.Length, out var ret)); + GC.KeepAlive(img); + buf = bufVec.ToArray(); + return ret != 0; + } - /// - /// - /// - /// - /// - public static bool HaveImageWriter(string fileName) + /// + /// Compresses the image and stores it in the memory buffer + /// + /// The file extension that defines the output format + /// The image to be written + /// Output buffer resized to fit the compressed image. + /// Format-specific parameters. + public static void ImEncode(string ext, InputArray img, out byte[] buf, params ImageEncodingParam[] prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + var p = new List(); + foreach (var item in prms) { - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - return NativeMethods.imgcodecs_cvHaveImageWriter(fileName) != 0; + p.Add((int)item.EncodingId); + p.Add(item.Value); } + ImEncode(ext, img, out buf, p.ToArray()); + } + + /// + /// + /// + /// + /// + public static bool HaveImageReader(string fileName) + { + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.imgcodecs_haveImageReader(fileName, out var ret)); + return ret != 0; + } + + /// + /// + /// + /// + /// + public static bool HaveImageWriter(string fileName) + { + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.imgcodecs_haveImageWriter(fileName, out var ret)); + return ret != 0; } } diff --git a/src/OpenCvSharp/Cv2/Cv2_imgproc.cs b/src/OpenCvSharp/Cv2/Cv2_imgproc.cs index af0820962..29c745e64 100644 --- a/src/OpenCvSharp/Cv2/Cv2_imgproc.cs +++ b/src/OpenCvSharp/Cv2/Cv2_imgproc.cs @@ -1,4674 +1,5088 @@ -using System; -using System.Collections.Generic; - -using OpenCvSharp.Util; +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; // ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo +// ReSharper disable IdentifierTypo + +namespace OpenCvSharp; -namespace OpenCvSharp +static partial class Cv2 { - static partial class Cv2 - { - /// - /// Returns Gaussian filter coefficients. - /// - /// Aperture size. It should be odd and positive. - /// Gaussian standard deviation. - /// If it is non-positive, it is computed from ksize as `sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8`. - /// Type of filter coefficients. It can be CV_32F or CV_64F. - /// - public static Mat GetGaussianKernel(int ksize, double sigma, MatType? ktype = null) - { - var ktype0 = ktype.GetValueOrDefault(MatType.CV_64F); - var ret = NativeMethods.imgproc_getGaussianKernel(ksize, sigma, ktype0); - if (ret == IntPtr.Zero) - return null; - return new Mat(ret); - } + /// + /// Returns Gaussian filter coefficients. + /// + /// Aperture size. It should be odd and positive. + /// Gaussian standard deviation. + /// If it is non-positive, it is computed from ksize as `sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8`. + /// Type of filter coefficients. It can be CV_32F or CV_64F. + /// + public static Mat? GetGaussianKernel(int ksize, double sigma, MatType? ktype = null) + { + var ktype0 = ktype.GetValueOrDefault(MatType.CV_64F); + NativeMethods.HandleException( + NativeMethods.imgproc_getGaussianKernel(ksize, sigma, ktype0, out var ret)); + if (ret == IntPtr.Zero) + return null; + return new Mat(ret); + } - /// - /// Returns filter coefficients for computing spatial image derivatives. - /// - /// Output matrix of row filter coefficients. It has the type ktype. - /// Output matrix of column filter coefficients. It has the type ktype. - /// Derivative order in respect of x. - /// Derivative order in respect of y. - /// Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7. - /// Flag indicating whether to normalize (scale down) the filter coefficients or not. - /// Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. - /// If you are going to filter floating-point images, you are likely to use the normalized kernels. - /// But if you compute derivatives of an 8-bit image, store the results in a 16-bit image, - /// and wish to preserve all the fractional bits, you may want to set normalize = false. - /// Type of filter coefficients. It can be CV_32f or CV_64F. - public static void GetDerivKernels( - OutputArray kx, OutputArray ky, int dx, int dy, int ksize, - bool normalize = false, MatType? ktype = null) - { - if (kx == null) - throw new ArgumentNullException(nameof(kx)); - if (ky == null) - throw new ArgumentNullException(nameof(ky)); - kx.ThrowIfNotReady(); - ky.ThrowIfNotReady(); - - var ktype0 = ktype.GetValueOrDefault(MatType.CV_32F); + /// + /// Returns filter coefficients for computing spatial image derivatives. + /// + /// Output matrix of row filter coefficients. It has the type ktype. + /// Output matrix of column filter coefficients. It has the type ktype. + /// Derivative order in respect of x. + /// Derivative order in respect of y. + /// Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7. + /// Flag indicating whether to normalize (scale down) the filter coefficients or not. + /// Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. + /// If you are going to filter floating-point images, you are likely to use the normalized kernels. + /// But if you compute derivatives of an 8-bit image, store the results in a 16-bit image, + /// and wish to preserve all the fractional bits, you may want to set normalize = false. + /// Type of filter coefficients. It can be CV_32f or CV_64F. + public static void GetDerivKernels( + OutputArray kx, OutputArray ky, int dx, int dy, int ksize, + bool normalize = false, MatType? ktype = null) + { + if (kx is null) + throw new ArgumentNullException(nameof(kx)); + if (ky is null) + throw new ArgumentNullException(nameof(ky)); + kx.ThrowIfNotReady(); + ky.ThrowIfNotReady(); + + var ktype0 = ktype.GetValueOrDefault(MatType.CV_32F); + NativeMethods.HandleException( NativeMethods.imgproc_getDerivKernels( - kx.CvPtr, ky.CvPtr, dx, dy, ksize, normalize ? 1 : 0, ktype0); + kx.CvPtr, ky.CvPtr, dx, dy, ksize, normalize ? 1 : 0, ktype0)); + GC.KeepAlive(kx); + GC.KeepAlive(ky); + kx.Fix(); + ky.Fix(); + } - kx.Fix(); - ky.Fix(); - } + /// + /// Returns Gabor filter coefficients. + /// + /// + /// For more details about gabor filter equations and parameters, see: https://en.wikipedia.org/wiki/Gabor_filter + /// + /// Size of the filter returned. + /// Standard deviation of the gaussian envelope. + /// Orientation of the normal to the parallel stripes of a Gabor function. + /// Wavelength of the sinusoidal factor. + /// Spatial aspect ratio. + /// Phase offset. + /// Type of filter coefficients. It can be CV_32F or CV_64F. + /// + public static Mat GetGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi, int ktype) + { + NativeMethods.HandleException( + NativeMethods.imgproc_getGaborKernel(ksize, sigma, theta, lambd, gamma, psi, ktype, out var matPtr)); + return Mat.FromNativePointer(matPtr); + } - #region GetGaborKernel - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static Mat GetGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi, int ktype) - { - IntPtr matPtr = NativeMethods.imgproc_getGaborKernel(ksize, sigma, theta, lambd, gamma, psi, ktype); - return new Mat(matPtr); - } - #endregion - #region GetStructuringElement - /// - /// - /// - /// - /// - /// - public static Mat GetStructuringElement(MorphShapes shape, Size ksize) - { - return GetStructuringElement(shape, ksize, new Point(-1, -1)); - } - /// - /// - /// - /// - /// - /// - /// - public static Mat GetStructuringElement(MorphShapes shape, Size ksize, Point anchor) - { - IntPtr matPtr = NativeMethods.imgproc_getStructuringElement((int)shape, ksize, anchor); - return new Mat(matPtr); - } - #endregion - #region CopyMakeBorder - /// - /// Forms a border around the image - /// - /// The source image - /// The destination image; will have the same type as src and - /// the size Size(src.cols+left+right, src.rows+top+bottom) - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// The border type - /// The border value if borderType == Constant - public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, BorderTypes borderType, Scalar? value = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - Scalar value0 = value.GetValueOrDefault(new Scalar()); - NativeMethods.imgproc_copyMakeBorder(src.CvPtr, dst.CvPtr, top, bottom, left, right, (int)borderType, value0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region MedianBlur - /// - /// Smoothes image using median filter - /// - /// The source 1-, 3- or 4-channel image. - /// When ksize is 3 or 5, the image depth should be CV_8U , CV_16U or CV_32F. - /// For larger aperture sizes it can only be CV_8U - /// The destination array; will have the same size and the same type as src - /// The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ... - public static void MedianBlur(InputArray src, OutputArray dst, int ksize) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_medianBlur(src.CvPtr, dst.CvPtr, ksize); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region GaussianBlur - /// - /// Blurs an image using a Gaussian filter. - /// - /// input image; the image can have any number of channels, which are processed independently, - /// but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. - /// output image of the same size and type as src. - /// Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. - /// Or, they can be zero’s and then they are computed from sigma* . - /// Gaussian kernel standard deviation in X direction. - /// Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, - /// if both sigmas are zeros, they are computed from ksize.width and ksize.height, - /// respectively (see getGaussianKernel() for details); to fully control the result - /// regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY. - /// pixel extrapolation method - public static void GaussianBlur(InputArray src, OutputArray dst, Size ksize, double sigmaX, - double sigmaY = 0, BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_GaussianBlur(src.CvPtr, dst.CvPtr, ksize, sigmaX, sigmaY, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region BilateralFilter - /// - /// Applies bilateral filter to the image - /// - /// The source 8-bit or floating-point, 1-channel or 3-channel image - /// The destination image; will have the same size and the same type as src - /// The diameter of each pixel neighborhood, that is used during filtering. - /// If it is non-positive, it's computed from sigmaSpace - /// Filter sigma in the color space. - /// Larger value of the parameter means that farther colors within the pixel neighborhood - /// will be mixed together, resulting in larger areas of semi-equal color - /// Filter sigma in the coordinate space. - /// Larger value of the parameter means that farther pixels will influence each other - /// (as long as their colors are close enough; see sigmaColor). Then d>0 , it specifies - /// the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace - /// - public static void BilateralFilter(InputArray src, OutputArray dst, int d, double sigmaColor, - double sigmaSpace, BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_bilateralFilter(src.CvPtr, dst.CvPtr, d, sigmaColor, sigmaSpace, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region AdaptiveBilateralFilter - /* - /// - /// Applies the adaptive bilateral filter to an image. - /// - /// The source image - /// The destination image; will have the same size and the same type as src - /// The kernel size. This is the neighborhood where the local variance will be calculated, - /// and where pixels will contribute (in a weighted manner). - /// Filter sigma in the coordinate space. - /// Larger value of the parameter means that farther pixels will influence each other - /// (as long as their colors are close enough; see sigmaColor). Then d>0, it specifies the neighborhood - /// size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace. - /// Maximum allowed sigma color (will clamp the value calculated in the - /// ksize neighborhood. Larger value of the parameter means that more dissimilar pixels will - /// influence each other (as long as their colors are close enough; see sigmaColor). - /// Then d>0, it specifies the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace. - /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center - /// Pixel extrapolation method. - public static void AdaptiveBilateralFilter(InputArray src, OutputArray dst, Size ksize, - double sigmaSpace, double maxSigmaColor = 20.0, Point? anchor = null, BorderType borderType = BorderType.Default) - { - if (src == null) - throw new ArgumentNullException("src"); - if (dst == null) - throw new ArgumentNullException("dst"); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - NativeMethods.imgproc_adaptiveBilateralFilter(src.CvPtr, dst.CvPtr, ksize, - sigmaSpace, maxSigmaColor, anchor0, (int)borderType); - dst.Fix(); - } - */ - #endregion - #region BoxFilter - /// - /// Smoothes image using box filter - /// - /// The source image - /// The destination image; will have the same size and the same type as src - /// - /// The smoothing kernel size - /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center - /// Indicates, whether the kernel is normalized by its area or not - /// The border mode used to extrapolate pixels outside of the image - public static void BoxFilter( - InputArray src, OutputArray dst, MatType ddepth, - Size ksize, Point? anchor = null, bool normalize = true, - BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - NativeMethods.imgproc_boxFilter(src.CvPtr, dst.CvPtr, ddepth, ksize, anchor0, normalize ? 1 : 0, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Blur - /// - /// Smoothes image using normalized box filter - /// - /// The source image - /// The destination image; will have the same size and the same type as src - /// The smoothing kernel size - /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center - /// The border mode used to extrapolate pixels outside of the image - public static void Blur( - InputArray src, OutputArray dst, Size ksize, - Point? anchor = null, BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - NativeMethods.imgproc_blur(src.CvPtr, dst.CvPtr, ksize, anchor0, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Filter2D - /// - /// Convolves an image with the kernel - /// - /// The source image - /// The destination image. It will have the same size and the same number of channels as src - /// The desired depth of the destination image. If it is negative, it will be the same as src.depth() - /// Convolution kernel (or rather a correlation kernel), - /// a single-channel floating point matrix. If you want to apply different kernels to - /// different channels, split the image into separate color planes using split() and process them individually - /// The anchor of the kernel that indicates the relative position of - /// a filtered point within the kernel. The anchor should lie within the kernel. - /// The special default value (-1,-1) means that the anchor is at the kernel center - /// The optional value added to the filtered pixels before storing them in dst - /// The pixel extrapolation method - public static void Filter2D( - InputArray src, OutputArray dst, MatType ddepth, - InputArray kernel, Point? anchor = null, double delta = 0, - BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (kernel == null) - throw new ArgumentNullException(nameof(kernel)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - kernel.ThrowIfDisposed(); - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - NativeMethods.imgproc_filter2D(src.CvPtr, dst.CvPtr, ddepth, kernel.CvPtr, - anchor0, delta, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region SepFilter2D - /// - /// Applies separable linear filter to an image - /// - /// The source image - /// The destination image; will have the same size and the same number of channels as src - /// The destination image depth - /// The coefficients for filtering each row - /// The coefficients for filtering each column - /// The anchor position within the kernel; The default value (-1, 1) means that the anchor is at the kernel center - /// The value added to the filtered results before storing them - /// The pixel extrapolation method - public static void SepFilter2D( - InputArray src, OutputArray dst, MatType ddepth, InputArray kernelX, InputArray kernelY, - Point? anchor = null, double delta = 0, - BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (kernelX == null) - throw new ArgumentNullException(nameof(kernelX)); - if (kernelY == null) - throw new ArgumentNullException(nameof(kernelY)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - kernelX.ThrowIfDisposed(); - kernelY.ThrowIfDisposed(); - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - NativeMethods.imgproc_sepFilter2D(src.CvPtr, dst.CvPtr, ddepth, - kernelX.CvPtr, kernelY.CvPtr, anchor0, delta, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Sobel - /// - /// Calculates the first, second, third or mixed image derivatives using an extended Sobel operator - /// - /// The source image - /// The destination image; will have the same size and the same number of channels as src - /// The destination image depth - /// Order of the derivative x - /// Order of the derivative y - /// Size of the extended Sobel kernel, must be 1, 3, 5 or 7 - /// The optional scale factor for the computed derivative values (by default, no scaling is applied - /// The optional delta value, added to the results prior to storing them in dst - /// The pixel extrapolation method - public static void Sobel( - InputArray src, OutputArray dst, MatType ddepth, int xorder, int yorder, - int ksize = 3, double scale = 1, double delta = 0, - BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_Sobel(src.CvPtr, dst.CvPtr, ddepth, xorder, yorder, - ksize, scale, delta, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Scharr - /// - /// Calculates the first x- or y- image derivative using Scharr operator - /// - /// The source image - /// The destination image; will have the same size and the same number of channels as src - /// The destination image depth - /// Order of the derivative x - /// Order of the derivative y - /// The optional scale factor for the computed derivative values (by default, no scaling is applie - /// The optional delta value, added to the results prior to storing them in dst - /// The pixel extrapolation method - public static void Scharr( - InputArray src, OutputArray dst, MatType ddepth, int xorder, int yorder, - double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_Scharr(src.CvPtr, dst.CvPtr, ddepth, xorder, yorder, - scale, delta, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Laplacian - /// - /// Calculates the Laplacian of an image - /// - /// Source image - /// Destination image; will have the same size and the same number of channels as src - /// The desired depth of the destination image - /// The aperture size used to compute the second-derivative filters - /// The optional scale factor for the computed Laplacian values (by default, no scaling is applied - /// The optional delta value, added to the results prior to storing them in dst - /// The pixel extrapolation method - public static void Laplacian( - InputArray src, OutputArray dst, MatType ddepth, - int ksize = 1, double scale = 1, double delta = 0, - BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_Laplacian(src.CvPtr, dst.CvPtr, ddepth, ksize, scale, delta, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Canny -#if LANG_JP - /// - /// Cannyアルゴリズムを用いて,画像のエッジを検出します. - /// - /// 8ビット,シングルチャンネルの入力画像 - /// 出力されるエッジのマップ. image と同じサイズ,同じ型 - /// ヒステリシスが存在する処理の,1番目の閾値 - /// ヒステリシスが存在する処理の,2番目の閾値 - /// Sobelオペレータのアパーチャサイズ [既定値はApertureSize.Size3] - /// 画像勾配の強度を求めるために,より精度の高い L2ノルムを利用するか,L1ノルムで十分(false)かを指定します. [既定値はfalse] -#else - /// - /// Finds edges in an image using Canny algorithm. - /// - /// Single-channel 8-bit input image - /// The output edge map. It will have the same size and the same type as image - /// The first threshold for the hysteresis procedure - /// The second threshold for the hysteresis procedure - /// Aperture size for the Sobel operator [By default this is ApertureSize.Size3] - /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] -#endif - public static void Canny(InputArray src, OutputArray edges, - double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (edges == null) - throw new ArgumentNullException(nameof(edges)); - src.ThrowIfDisposed(); - edges.ThrowIfNotReady(); - NativeMethods.imgproc_Canny(src.CvPtr, edges.CvPtr, threshold1, threshold2, apertureSize, L2gradient ? 1 : 0); - GC.KeepAlive(src); - edges.Fix(); - } - #endregion - #region CornerEigenValsAndVecs - /// - /// computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix. - /// - /// - /// - /// - /// - /// - public static void CornerEigenValsAndVecs( - InputArray src, OutputArray dst, int blockSize, int ksize, - BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_cornerEigenValsAndVecs(src.CvPtr, dst.CvPtr, blockSize, ksize, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); + /// + /// Returns a structuring element of the specified size and shape for morphological operations. + /// The function constructs and returns the structuring element that can be further passed to erode, + /// dilate or morphologyEx.But you can also construct an arbitrary binary mask yourself and use it as the structuring element. + /// + /// Element shape that could be one of MorphShapes + /// Size of the structuring element. + /// + public static Mat GetStructuringElement(MorphShapes shape, Size ksize) + { + return GetStructuringElement(shape, ksize, new Point(-1, -1)); + } + + /// + /// Returns a structuring element of the specified size and shape for morphological operations. + /// The function constructs and returns the structuring element that can be further passed to erode, + /// dilate or morphologyEx.But you can also construct an arbitrary binary mask yourself and use it as the structuring element. + /// + /// Element shape that could be one of MorphShapes + /// Size of the structuring element. + /// Anchor position within the element. The default value (−1,−1) means that the anchor is at the center. + /// Note that only the shape of a cross-shaped element depends on the anchor position. + /// In other cases the anchor just regulates how much the result of the morphological operation is shifted. + /// + public static Mat GetStructuringElement(MorphShapes shape, Size ksize, Point anchor) + { + NativeMethods.HandleException( + NativeMethods.imgproc_getStructuringElement((int)shape, ksize, anchor, out var matPtr)); + return new Mat(matPtr); + } + + /// + /// Smoothes image using median filter + /// + /// The source 1-, 3- or 4-channel image. + /// When ksize is 3 or 5, the image depth should be CV_8U , CV_16U or CV_32F. + /// For larger aperture sizes it can only be CV_8U + /// The destination array; will have the same size and the same type as src + /// The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ... + public static void MedianBlur(InputArray src, OutputArray dst, int ksize) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_medianBlur(src.CvPtr, dst.CvPtr, ksize)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Blurs an image using a Gaussian filter. + /// + /// input image; the image can have any number of channels, which are processed independently, + /// but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. + /// output image of the same size and type as src. + /// Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. + /// Or, they can be zero’s and then they are computed from sigma* . + /// Gaussian kernel standard deviation in X direction. + /// Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, + /// if both sigmas are zeros, they are computed from ksize.width and ksize.height, + /// respectively (see getGaussianKernel() for details); to fully control the result + /// regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY. + /// pixel extrapolation method + public static void GaussianBlur(InputArray src, OutputArray dst, Size ksize, double sigmaX, + double sigmaY = 0, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_GaussianBlur(src.CvPtr, dst.CvPtr, ksize, sigmaX, sigmaY, borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies bilateral filter to the image + /// + /// The source 8-bit or floating-point, 1-channel or 3-channel image + /// The destination image; will have the same size and the same type as src + /// The diameter of each pixel neighborhood, that is used during filtering. + /// If it is non-positive, it's computed from sigmaSpace + /// Filter sigma in the color space. + /// Larger value of the parameter means that farther colors within the pixel neighborhood + /// will be mixed together, resulting in larger areas of semi-equal color + /// Filter sigma in the coordinate space. + /// Larger value of the parameter means that farther pixels will influence each other + /// (as long as their colors are close enough; see sigmaColor). Then d>0 , it specifies + /// the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace + /// + public static void BilateralFilter(InputArray src, OutputArray dst, int d, double sigmaColor, + double sigmaSpace, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_bilateralFilter(src.CvPtr, dst.CvPtr, d, sigmaColor, sigmaSpace, borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Smoothes image using box filter + /// + /// The source image + /// The destination image; will have the same size and the same type as src + /// + /// The smoothing kernel size + /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center + /// Indicates, whether the kernel is normalized by its area or not + /// The border mode used to extrapolate pixels outside of the image + public static void BoxFilter( + InputArray src, OutputArray dst, MatType ddepth, + Size ksize, Point? anchor = null, bool normalize = true, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + NativeMethods.HandleException( + NativeMethods.imgproc_boxFilter(src.CvPtr, dst.CvPtr, ddepth, ksize, anchor0, normalize ? 1 : 0, borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates the normalized sum of squares of the pixel values overlapping the filter. + /// + /// For every pixel f(x, y) in the source image, the function calculates the sum of squares of those neighboring + /// pixel values which overlap the filter placed over the pixel f(x, y). + /// + /// The unnormalized square box filter can be useful in computing local image statistics such as the the local + /// variance and standard deviation around the neighborhood of a pixel. + /// + /// + /// + /// + /// + /// + /// + /// + public static void SqrBoxFilter( + InputArray src, OutputArray dst, int ddepth, + Size ksize, Point? anchor = null, bool normalize = true, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + NativeMethods.HandleException( + NativeMethods.imgproc_sqrBoxFilter(src.CvPtr, dst.CvPtr, ddepth, ksize, anchor0, normalize ? 1 : 0, borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Smoothes image using normalized box filter + /// + /// The source image + /// The destination image; will have the same size and the same type as src + /// The smoothing kernel size + /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center + /// The border mode used to extrapolate pixels outside of the image + public static void Blur( + InputArray src, OutputArray dst, Size ksize, + Point? anchor = null, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + NativeMethods.HandleException( + NativeMethods.imgproc_blur(src.CvPtr, dst.CvPtr, ksize, anchor0, (int)borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Convolves an image with the kernel + /// + /// The source image + /// The destination image. It will have the same size and the same number of channels as src + /// The desired depth of the destination image. If it is negative, it will be the same as src.depth() + /// Convolution kernel (or rather a correlation kernel), + /// a single-channel floating point matrix. If you want to apply different kernels to + /// different channels, split the image into separate color planes using split() and process them individually + /// The anchor of the kernel that indicates the relative position of + /// a filtered point within the kernel. The anchor should lie within the kernel. + /// The special default value (-1,-1) means that the anchor is at the kernel center + /// The optional value added to the filtered pixels before storing them in dst + /// The pixel extrapolation method + public static void Filter2D( + InputArray src, OutputArray dst, MatType ddepth, + InputArray kernel, Point? anchor = null, double delta = 0, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (kernel is null) + throw new ArgumentNullException(nameof(kernel)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + kernel.ThrowIfDisposed(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + NativeMethods.HandleException( + NativeMethods.imgproc_filter2D(src.CvPtr, dst.CvPtr, ddepth, kernel.CvPtr, anchor0, delta, (int)borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(kernel); + dst.Fix(); + } + + /// + /// Applies separable linear filter to an image + /// + /// The source image + /// The destination image; will have the same size and the same number of channels as src + /// The destination image depth + /// The coefficients for filtering each row + /// The coefficients for filtering each column + /// The anchor position within the kernel; The default value (-1, 1) means that the anchor is at the kernel center + /// The value added to the filtered results before storing them + /// The pixel extrapolation method + public static void SepFilter2D( + InputArray src, OutputArray dst, MatType ddepth, InputArray kernelX, InputArray kernelY, + Point? anchor = null, double delta = 0, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (kernelX is null) + throw new ArgumentNullException(nameof(kernelX)); + if (kernelY is null) + throw new ArgumentNullException(nameof(kernelY)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + kernelX.ThrowIfDisposed(); + kernelY.ThrowIfDisposed(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + NativeMethods.HandleException( + NativeMethods.imgproc_sepFilter2D(src.CvPtr, dst.CvPtr, ddepth, + kernelX.CvPtr, kernelY.CvPtr, anchor0, delta, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(kernelX); + GC.KeepAlive(kernelY); + dst.Fix(); + } + + /// + /// Calculates the first, second, third or mixed image derivatives using an extended Sobel operator + /// + /// The source image + /// The destination image; will have the same size and the same number of channels as src + /// The destination image depth + /// Order of the derivative x + /// Order of the derivative y + /// Size of the extended Sobel kernel, must be 1, 3, 5 or 7 + /// The optional scale factor for the computed derivative values (by default, no scaling is applied + /// The optional delta value, added to the results prior to storing them in dst + /// The pixel extrapolation method + public static void Sobel( + InputArray src, OutputArray dst, MatType ddepth, int xorder, int yorder, + int ksize = 3, double scale = 1, double delta = 0, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_Sobel(src.CvPtr, dst.CvPtr, ddepth, xorder, yorder, + ksize, scale, delta, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates the first order image derivative in both x and y using a Sobel operator + /// + /// input image. + /// output image with first-order derivative in x. + /// output image with first-order derivative in y. + /// size of Sobel kernel. It must be 3. + /// pixel extrapolation method + public static void SpatialGradient( + InputArray src, OutputArray dx, OutputArray dy, int ksize = 3, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dx is null) + throw new ArgumentNullException(nameof(dx)); + if (dy is null) + throw new ArgumentNullException(nameof(dy)); + src.ThrowIfDisposed(); + dx.ThrowIfNotReady(); + dy.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_spatialGradient(src.CvPtr, dx.CvPtr, dy.CvPtr, ksize, (int)borderType)); + + GC.KeepAlive(src); + dx.Fix(); + dy.Fix(); + } + + /// + /// Calculates the first x- or y- image derivative using Scharr operator + /// + /// The source image + /// The destination image; will have the same size and the same number of channels as src + /// The destination image depth + /// Order of the derivative x + /// Order of the derivative y + /// The optional scale factor for the computed derivative values (by default, no scaling is applie + /// The optional delta value, added to the results prior to storing them in dst + /// The pixel extrapolation method + public static void Scharr( + InputArray src, OutputArray dst, MatType ddepth, int xorder, int yorder, + double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_Scharr(src.CvPtr, dst.CvPtr, ddepth, xorder, yorder, + scale, delta, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates the Laplacian of an image + /// + /// Source image + /// Destination image; will have the same size and the same number of channels as src + /// The desired depth of the destination image + /// The aperture size used to compute the second-derivative filters + /// The optional scale factor for the computed Laplacian values (by default, no scaling is applied + /// The optional delta value, added to the results prior to storing them in dst + /// The pixel extrapolation method + public static void Laplacian( + InputArray src, OutputArray dst, MatType ddepth, + int ksize = 1, double scale = 1, double delta = 0, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_Laplacian(src.CvPtr, dst.CvPtr, ddepth, ksize, scale, delta, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Finds edges in an image using Canny algorithm. + /// + /// Single-channel 8-bit input image + /// The output edge map. It will have the same size and the same type as image + /// The first threshold for the hysteresis procedure + /// The second threshold for the hysteresis procedure + /// Aperture size for the Sobel operator [By default this is ApertureSize.Size3] + /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] + public static void Canny(InputArray src, OutputArray edges, + double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (edges is null) + throw new ArgumentNullException(nameof(edges)); + src.ThrowIfDisposed(); + edges.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_Canny1(src.CvPtr, edges.CvPtr, threshold1, threshold2, apertureSize, L2gradient ? 1 : 0)); + + GC.KeepAlive(src); + GC.KeepAlive(edges); + edges.Fix(); + } + + /// + /// Finds edges in an image using the Canny algorithm with custom image gradient. + /// + /// 16-bit x derivative of input image (CV_16SC1 or CV_16SC3). + /// 16-bit y derivative of input image (same type as dx). + /// output edge map; single channels 8-bit image, which has the same size as image. + /// first threshold for the hysteresis procedure. + /// second threshold for the hysteresis procedure. + /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] + public static void Canny( + InputArray dx, InputArray dy, OutputArray edges, + double threshold1, double threshold2, + bool L2gradient = false) + { + if (dx is null) + throw new ArgumentNullException(nameof(dx)); + if (dy is null) + throw new ArgumentNullException(nameof(dy)); + if (edges is null) + throw new ArgumentNullException(nameof(edges)); + dx.ThrowIfDisposed(); + dy.ThrowIfDisposed(); + edges.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_Canny2( + dx.CvPtr, dy.CvPtr, edges.CvPtr, threshold1, threshold2, L2gradient ? 1 : 0)); + + GC.KeepAlive(dx); + GC.KeepAlive(dy); + edges.Fix(); + } + + /// + /// Calculates the minimal eigenvalue of gradient matrices for corner detection. + /// + /// Input single-channel 8-bit or floating-point image. + /// Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as src . + /// Neighborhood size (see the details on #cornerEigenValsAndVecs ). + /// Aperture parameter for the Sobel operator. + /// Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported. + public static void CornerMinEigenVal( + InputArray src, + OutputArray dst, + int blockSize, + int ksize = 3, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_cornerMinEigenVal(src.CvPtr, dst.CvPtr, blockSize, ksize, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Harris corner detector. + /// + /// Input single-channel 8-bit or floating-point image. + /// Image to store the Harris detector responses. + /// It has the type CV_32FC1 and the same size as src. + /// Neighborhood size (see the details on #cornerEigenValsAndVecs ). + /// Aperture parameter for the Sobel operator. + /// Harris detector free parameter. See the formula above. + /// Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported. + public static void CornerHarris( + InputArray src, + OutputArray dst, + int blockSize, + int ksize, + double k, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_cornerHarris(src.CvPtr, dst.CvPtr, blockSize, ksize, k, (int)borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix. + /// + /// + /// + /// + /// + /// + public static void CornerEigenValsAndVecs( + InputArray src, OutputArray dst, int blockSize, int ksize, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_cornerEigenValsAndVecs(src.CvPtr, dst.CvPtr, blockSize, ksize, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes another complex cornerness criteria at each pixel + /// + /// + /// + /// + /// + public static void PreCornerDetect( + InputArray src, OutputArray dst, int ksize, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_preCornerDetect(src.CvPtr, dst.CvPtr, ksize, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria + /// + /// Input image. + /// Initial coordinates of the input corners and refined coordinates provided for output. + /// Half of the side length of the search window. + /// Half of the size of the dead region in the middle of the search zone + /// over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities + /// of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size. + /// Criteria for termination of the iterative process of corner refinement. + /// That is, the process of corner position refinement stops either after criteria.maxCount iterations + /// or when the corner position moves by less than criteria.epsilon on some iteration. + /// + public static Point2f[] CornerSubPix(InputArray image, IEnumerable inputCorners, + Size winSize, Size zeroZone, TermCriteria criteria) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (inputCorners is null) + throw new ArgumentNullException(nameof(inputCorners)); + image.ThrowIfDisposed(); + + var inputCornersSrc = inputCorners.ToArray(); + var inputCornersCopy = new Point2f[inputCornersSrc.Length]; + Array.Copy(inputCornersSrc, inputCornersCopy, inputCornersSrc.Length); + + using var vector = new VectorOfPoint2f(inputCornersCopy); + NativeMethods.HandleException( + NativeMethods.imgproc_cornerSubPix(image.CvPtr, vector.CvPtr, winSize, zeroZone, criteria)); + GC.KeepAlive(image); + return vector.ToArray(); + } + + /// + /// finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima + /// + /// Input 8-bit or floating-point 32-bit, single-channel image. + /// Maximum number of corners to return. If there are more corners than are found, + /// the strongest of them is returned. + /// Parameter characterizing the minimal accepted quality of image corners. + /// The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue + /// or the Harris function response (see cornerHarris() ). The corners with the quality measure less than + /// the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01, + /// then all the corners with the quality measure less than 15 are rejected. + /// Minimum possible Euclidean distance between the returned corners. + /// Optional region of interest. If the image is not empty + /// (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region + /// in which the corners are detected. + /// Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. + /// Parameter indicating whether to use a Harris detector + /// Free parameter of the Harris detector. + /// Output vector of detected corners. + public static Point2f[] GoodFeaturesToTrack(InputArray src, + int maxCorners, double qualityLevel, double minDistance, + InputArray mask, int blockSize, bool useHarrisDetector, double k) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + using var vector = new VectorOfPoint2f(); + var maskPtr = ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.imgproc_goodFeaturesToTrack(src.CvPtr, vector.CvPtr, maxCorners, qualityLevel, + minDistance, maskPtr, blockSize, useHarrisDetector ? 1 : 0, k)); + GC.KeepAlive(src); + GC.KeepAlive(mask); + return vector.ToArray(); + } + + /// + /// Finds lines in a binary image using standard Hough transform. + /// + /// The 8-bit, single-channel, binary source image. The image may be modified by the function + /// Distance resolution of the accumulator in pixels + /// Angle resolution of the accumulator in radians + /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) + /// For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0] + /// For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0] + /// The output vector of lines. Each line is represented by a two-element vector (rho, theta) . + /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians + public static LineSegmentPolar[] HoughLines( + InputArray image, double rho, double theta, int threshold, + double srn = 0, double stn = 0) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + + using var vec = new VectorOfVec2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_HoughLines(image.CvPtr, vec.CvPtr, rho, theta, threshold, srn, stn)); + GC.KeepAlive(image); + return vec.ToArray(); + } + + /// + /// Finds lines segments in a binary image using probabilistic Hough transform. + /// + /// + /// Distance resolution of the accumulator in pixels + /// Angle resolution of the accumulator in radians + /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) + /// The minimum line length. Line segments shorter than that will be rejected. [By default this is 0] + /// The maximum allowed gap between points on the same line to link them. [By default this is 0] + /// The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2) + public static LineSegmentPoint[] HoughLinesP( + InputArray image, double rho, double theta, int threshold, + double minLineLength = 0, double maxLineGap = 0) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + using var vec = new VectorOfVec4i(); + NativeMethods.HandleException( + NativeMethods.imgproc_HoughLinesP(image.CvPtr, vec.CvPtr, rho, theta, threshold, minLineLength, maxLineGap)); + GC.KeepAlive(image); + return vec.ToArray(); + } + + /// + /// Finds lines in a set of points using the standard Hough transform. + /// The function finds lines in a set of points using a modification of the Hough transform. + /// + /// Input vector of points. Each vector must be encoded as a Point vector \f$(x,y)\f$. Type must be CV_32FC2 or CV_32SC2. + /// Output vector of found lines. Each vector is encoded as a vector<Vec3d> + /// Max count of hough lines. + /// Accumulator threshold parameter. Only those lines are returned that get enough votes + /// Minimum Distance value of the accumulator in pixels. + /// Maximum Distance value of the accumulator in pixels. + /// Distance resolution of the accumulator in pixels. + /// Minimum angle value of the accumulator in radians. + /// Maximum angle value of the accumulator in radians. + /// Angle resolution of the accumulator in radians. + public static void HoughLinesPointSet( + InputArray point, OutputArray lines, int linesMax, int threshold, + double minRho, double maxRho, double rhoStep, + double minTheta, double maxTheta, double thetaStep) + { + if (point is null) + throw new ArgumentNullException(nameof(point)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + point.ThrowIfDisposed(); + lines.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_HoughLinesPointSet( + point.CvPtr, lines.CvPtr, linesMax, threshold, minRho, maxRho, rhoStep, minTheta, maxTheta, thetaStep)); + + GC.KeepAlive(point); + lines.Fix(); + } + + /// + /// Finds circles in a grayscale image using a Hough transform. + /// + /// The 8-bit, single-channel, grayscale input image + /// The available methods are HoughMethods.Gradient and HoughMethods.GradientAlt + /// The inverse ratio of the accumulator resolution to the image resolution. + /// Minimum distance between the centers of the detected circles. + /// The first method-specific parameter. [By default this is 100] + /// The second method-specific parameter. [By default this is 100] + /// Minimum circle radius. [By default this is 0] + /// Maximum circle radius. [By default this is 0] + /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) + public static CircleSegment[] HoughCircles( + InputArray image, HoughModes method, double dp, double minDist, + double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + using var vec = new VectorOfVec3f(); + NativeMethods.HandleException( + NativeMethods.imgproc_HoughCircles(image.CvPtr, vec.CvPtr, (int) method, dp, minDist, param1, + param2, minRadius, maxRadius)); + GC.KeepAlive(image); + return vec.ToArray(); + } + + /// + /// Default borderValue for Dilate/Erode + /// + /// + public static Scalar MorphologyDefaultBorderValue() + { + return Scalar.All(double.MaxValue); + } + + /// + /// Dilates an image by using a specific structuring element. + /// + /// The source image + /// The destination image. It will have the same size and the same type as src + /// The structuring element used for dilation. If element=new Mat() , a 3x3 rectangular structuring element is used + /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center + /// The number of times dilation is applied. [By default this is 1] + /// The pixel extrapolation method. [By default this is BorderType.Constant] + /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] + public static void Dilate( + InputArray src, OutputArray dst, InputArray? element, + Point? anchor = null, int iterations = 1, + BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + var borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue()); + var elementPtr = ToPtr(element); + NativeMethods.HandleException( + NativeMethods.imgproc_dilate(src.CvPtr, dst.CvPtr, elementPtr, anchor0, iterations, (int) borderType, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(element); + dst.Fix(); + } + + /// + /// Erodes an image by using a specific structuring element. + /// + /// The source image + /// The destination image. It will have the same size and the same type as src + /// The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used + /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center + /// The number of times erosion is applied + /// The pixel extrapolation method + /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] + public static void Erode( + InputArray src, OutputArray dst, InputArray? element, + Point? anchor = null, int iterations = 1, + BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + var borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue()); + var elementPtr = ToPtr(element); + NativeMethods.HandleException( + NativeMethods.imgproc_erode(src.CvPtr, dst.CvPtr, elementPtr, anchor0, iterations, (int) borderType, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(element); + dst.Fix(); + } + + /// + /// Performs advanced morphological transformations + /// + /// Source image + /// Destination image. It will have the same size and the same type as src + /// Type of morphological operation + /// Structuring element + /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center + /// Number of times erosion and dilation are applied. [By default this is 1] + /// The pixel extrapolation method. [By default this is BorderType.Constant] + /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] + public static void MorphologyEx( + InputArray src, OutputArray dst, MorphTypes op, InputArray? element, + Point? anchor = null, int iterations = 1, + BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + element?.ThrowIfDisposed(); + + var anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); + var borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue()); + var elementPtr = ToPtr(element); + NativeMethods.HandleException( + NativeMethods.imgproc_morphologyEx(src.CvPtr, dst.CvPtr, (int) op, elementPtr, anchor0, iterations, + (int) borderType, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(element); + dst.Fix(); + } + + /// + /// Resizes an image. + /// + /// input image. + /// output image; it has the size dsize (when it is non-zero) or the size computed + /// from src.size(), fx, and fy; the type of dst is the same as of src. + /// output image size; if it equals zero, it is computed as: + /// dsize = Size(round(fx*src.cols), round(fy*src.rows)) + /// Either dsize or both fx and fy must be non-zero. + /// scale factor along the horizontal axis; when it equals 0, + /// it is computed as: (double)dsize.width/src.cols + /// scale factor along the vertical axis; when it equals 0, + /// it is computed as: (double)dsize.height/src.rows + /// interpolation method + public static void Resize(InputArray src, OutputArray dst, Size dsize, + double fx = 0, double fy = 0, InterpolationFlags interpolation = InterpolationFlags.Linear) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_resize(src.CvPtr, dst.CvPtr, dsize, fx, fy, (int) interpolation)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies an affine transformation to an image. + /// + /// input image. + /// output image that has the size dsize and the same type as src. + /// 2x3 transformation matrix. + /// size of the output image. + /// combination of interpolation methods and the optional flag + /// WARP_INVERSE_MAP that means that M is the inverse transformation (dst -> src) . + /// pixel extrapolation method; when borderMode=BORDER_TRANSPARENT, + /// it means that the pixels in the destination image corresponding to the "outliers" + /// in the source image are not modified by the function. + /// value used in case of a constant border; by default, it is 0. + public static void WarpAffine( + InputArray src, OutputArray dst, InputArray m, Size dsize, + InterpolationFlags flags = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + m.ThrowIfDisposed(); + + var borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); + NativeMethods.HandleException( + NativeMethods.imgproc_warpAffine(src.CvPtr, dst.CvPtr, m.CvPtr, dsize, (int) flags, (int) borderMode, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(m); + dst.Fix(); + } + + /// + /// Applies a perspective transformation to an image. + /// + /// input image. + /// output image that has the size dsize and the same type as src. + /// 3x3 transformation matrix. + /// size of the output image. + /// combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) + /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). + /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). + /// value used in case of a constant border; by default, it equals 0. + public static void WarpPerspective( + InputArray src, OutputArray dst, InputArray m, Size dsize, + InterpolationFlags flags = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, + Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + m.ThrowIfDisposed(); + + var borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); + NativeMethods.HandleException( + NativeMethods.imgproc_warpPerspective_MisInputArray( + src.CvPtr, dst.CvPtr, m.CvPtr, dsize, (int) flags, (int) borderMode, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(m); + dst.Fix(); + } + + /// + /// Applies a perspective transformation to an image. + /// + /// input image. + /// output image that has the size dsize and the same type as src. + /// 3x3 transformation matrix. + /// size of the output image. + /// combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) + /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). + /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). + /// value used in case of a constant border; by default, it equals 0. + public static void WarpPerspective( + InputArray src, OutputArray dst, float[,] m, Size dsize, + InterpolationFlags flags = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, + Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + var borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); + var mRow = m.GetLength(0); + var mCol = m.GetLength(1); + NativeMethods.HandleException( + NativeMethods.imgproc_warpPerspective_MisArray( + src.CvPtr, dst.CvPtr, m, mRow, mCol, dsize, (int) flags, (int) borderMode, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies a generic geometrical transformation to an image. + /// + /// Source image. + /// Destination image. It has the same size as map1 and the same type as src + /// The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2. + /// The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively. + /// Interpolation method. The method INTER_AREA is not supported by this function. + /// Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, + /// it means that the pixels in the destination image that corresponds to the "outliers" in + /// the source image are not modified by the function. + /// Value used in case of a constant border. By default, it is 0. + public static void Remap( + InputArray src, OutputArray dst, InputArray map1, InputArray map2, + InterpolationFlags interpolation = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (map1 is null) + throw new ArgumentNullException(nameof(map1)); + if (map2 is null) + throw new ArgumentNullException(nameof(map2)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + map1.ThrowIfDisposed(); + map2.ThrowIfDisposed(); + + var borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); + NativeMethods.HandleException( + NativeMethods.imgproc_remap(src.CvPtr, dst.CvPtr, map1.CvPtr, map2.CvPtr, (int) interpolation, + (int) borderMode, borderValue0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + GC.KeepAlive(map1); + GC.KeepAlive(map2); + } + + /// + /// Converts image transformation maps from one representation to another. + /// + /// The first input map of type CV_16SC2 , CV_32FC1 , or CV_32FC2 . + /// The second input map of type CV_16UC1 , CV_32FC1 , or none (empty matrix), respectively. + /// The first output map that has the type dstmap1type and the same size as src. + /// The second output map. + /// Type of the first output map that should be CV_16SC2 , CV_32FC1 , or CV_32FC2 . + /// Flag indicating whether the fixed-point maps are used for the nearest-neighbor or for a more complex interpolation. + public static void ConvertMaps(InputArray map1, InputArray map2, OutputArray dstmap1, OutputArray dstmap2, MatType dstmap1Type, bool nnInterpolation = false) + { + if (map1 is null) + throw new ArgumentNullException(nameof(map1)); + if (map2 is null) + throw new ArgumentNullException(nameof(map2)); + if (dstmap1 is null) + throw new ArgumentNullException(nameof(dstmap1)); + if (dstmap2 is null) + throw new ArgumentNullException(nameof(dstmap2)); + map1.ThrowIfDisposed(); + map2.ThrowIfDisposed(); + dstmap1.ThrowIfDisposed(); + dstmap2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_convertMaps(map1.CvPtr, map2.CvPtr, dstmap1.CvPtr, dstmap2.CvPtr, dstmap1Type, + nnInterpolation ? 1 : 0)); + + GC.KeepAlive(map1); + GC.KeepAlive(map2); + GC.KeepAlive(dstmap1); + GC.KeepAlive(dstmap2); + dstmap1.Fix(); + dstmap2.Fix(); + } + + /// + /// Calculates an affine matrix of 2D rotation. + /// + /// Center of the rotation in the source image. + /// Rotation angle in degrees. Positive values mean counter-clockwise rotation (the coordinate origin is assumed to be the top-left corner). + /// Isotropic scale factor. + /// + public static Mat GetRotationMatrix2D(Point2f center, double angle, double scale) + { + NativeMethods.HandleException( + NativeMethods.imgproc_getRotationMatrix2D(center, angle, scale, out var retMat)); + return new Mat(retMat); + } + + /// + /// Inverts an affine transformation. + /// + /// Original affine transformation. + /// Output reverse affine transformation. + public static void InvertAffineTransform(InputArray m, OutputArray im) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (im is null) + throw new ArgumentNullException(nameof(im)); + m.ThrowIfDisposed(); + im.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.imgproc_invertAffineTransform(m.CvPtr, im.CvPtr)); + GC.KeepAlive(m); + GC.KeepAlive(im); + im.Fix(); + } + + /// + /// Calculates a perspective transform from four pairs of the corresponding points. + /// The function calculates the 3×3 matrix of a perspective transform. + /// + /// Coordinates of quadrangle vertices in the source image. + /// Coordinates of the corresponding quadrangle vertices in the destination image. + /// + public static Mat GetPerspectiveTransform(IEnumerable src, IEnumerable dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + var srcArray = src.ToArray(); + var dstArray = dst.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_getPerspectiveTransform1(srcArray, dstArray, out var retMat)); + return new Mat(retMat); + } + + /// + /// Calculates a perspective transform from four pairs of the corresponding points. + /// The function calculates the 3×3 matrix of a perspective transform. + /// + /// Coordinates of quadrangle vertices in the source image. + /// Coordinates of the corresponding quadrangle vertices in the destination image. + /// + public static Mat GetPerspectiveTransform(InputArray src, InputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_getPerspectiveTransform2(src.CvPtr, dst.CvPtr, out var retMat)); + GC.KeepAlive(src); + GC.KeepAlive(dst); + return new Mat(retMat); + } + + /// + /// Calculates an affine transform from three pairs of the corresponding points. + /// The function calculates the 2×3 matrix of an affine transform. + /// + /// Coordinates of triangle vertices in the source image. + /// Coordinates of the corresponding triangle vertices in the destination image. + /// + public static Mat GetAffineTransform(IEnumerable src, IEnumerable dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + var srcArray = src.ToArray(); + var dstArray = dst.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_getAffineTransform1(srcArray, dstArray, out var retMat)); + return new Mat(retMat); + } + + /// + /// Calculates an affine transform from three pairs of the corresponding points. + /// The function calculates the 2×3 matrix of an affine transform. + /// + /// Coordinates of triangle vertices in the source image. + /// Coordinates of the corresponding triangle vertices in the destination image. + /// + public static Mat GetAffineTransform(InputArray src, InputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_getAffineTransform2(src.CvPtr, dst.CvPtr, out var retMat)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + return new Mat(retMat); + } + + /// + /// Retrieves a pixel rectangle from an image with sub-pixel accuracy. + /// + /// Source image. + /// Size of the extracted patch. + /// Floating point coordinates of the center of the extracted rectangle + /// within the source image. The center must be inside the image. + /// Extracted patch that has the size patchSize and the same number of channels as src . + /// Depth of the extracted pixels. By default, they have the same depth as src. + public static void GetRectSubPix(InputArray image, Size patchSize, Point2f center, + OutputArray patch, int patchType = -1) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (patch is null) + throw new ArgumentNullException(nameof(patch)); + image.ThrowIfDisposed(); + patch.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_getRectSubPix(image.CvPtr, patchSize, center, patch.CvPtr, patchType)); + + GC.KeepAlive(image); + GC.KeepAlive(patch); + patch.Fix(); + } + + /// + /// Remaps an image to log-polar space. + /// + /// Source image + /// Destination image + /// The transformation center; where the output precision is maximal + /// Magnitude scale parameter. + /// A combination of interpolation methods, see cv::InterpolationFlags + public static void LogPolar( + InputArray src, OutputArray dst, + Point2f center, double m, InterpolationFlags flags) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_logPolar(src.CvPtr, dst.CvPtr, center, m, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Remaps an image to polar space. + /// + /// Source image + /// Destination image + /// The transformation center + /// Inverse magnitude scale parameter + /// A combination of interpolation methods, see cv::InterpolationFlags + public static void LinearPolar( + InputArray src, OutputArray dst, + Point2f center, double maxRadius, InterpolationFlags flags) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_linearPolar(src.CvPtr, dst.CvPtr, center, maxRadius, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Remaps an image to polar or semilog-polar coordinates space. + /// + /// + /// - The function can not operate in-place. + /// - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. + /// - This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767. + /// + /// Source image. + /// Destination image. It will have same type as src. + /// The destination image size (see description for valid options). + /// The transformation center. + /// The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. + /// interpolation methods. + /// interpolation methods. + public static void WarpPolar( + InputArray src, OutputArray dst, Size dsize, + Point2f center, double maxRadius, InterpolationFlags interpolationFlags, WarpPolarMode warpPolarMode) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + int flags = (int)interpolationFlags | (int)warpPolarMode; + NativeMethods.HandleException( + NativeMethods.imgproc_warpPolar(src.CvPtr, dst.CvPtr, dsize, center, maxRadius, flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates the integral of an image. + /// The function calculates one or more integral images for the source image. + /// + /// + /// + /// + public static void Integral(InputArray src, OutputArray sum, MatType? sdepth = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (sum is null) + throw new ArgumentNullException(nameof(sum)); + + src.ThrowIfDisposed(); + sum.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_integral1(src.CvPtr, sum.CvPtr, sdepth?.Value ?? -1)); + + GC.KeepAlive(src); + GC.KeepAlive(sum); + sum.Fix(); + } + + /// + /// Calculates the integral of an image. + /// The function calculates one or more integral images for the source image. + /// + /// + /// + /// + /// + public static void Integral(InputArray src, OutputArray sum, OutputArray sqsum, MatType? sdepth = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (sum is null) + throw new ArgumentNullException(nameof(sum)); + if (sqsum is null) + throw new ArgumentNullException(nameof(sqsum)); + src.ThrowIfDisposed(); + sum.ThrowIfNotReady(); + sqsum.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_integral2(src.CvPtr, sum.CvPtr, sqsum.CvPtr, sdepth?.Value ?? -1)); + + GC.KeepAlive(src); + GC.KeepAlive(sum); + GC.KeepAlive(sqsum); + sum.Fix(); + sqsum.Fix(); + } + + /// + /// Calculates the integral of an image. + /// The function calculates one or more integral images for the source image. + /// + /// input image as W×H, 8-bit or floating-point (32f or 64f). + /// integral image as (W+1)×(H+1) , 32-bit integer or floating-point (32f or 64f). + /// integral image for squared pixel values; it is (W+1)×(H+1), double-precision floating-point (64f) array. + /// integral for the image rotated by 45 degrees; it is (W+1)×(H+1) array with the same data type as sum. + /// desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F. + /// desired depth of the integral image of squared pixel values, CV_32F or CV_64F. + public static void Integral( + InputArray src, OutputArray sum, OutputArray sqsum, OutputArray tilted, + MatType? sdepth = null, MatType? sqdepth = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (sum is null) + throw new ArgumentNullException(nameof(sum)); + if (sqsum is null) + throw new ArgumentNullException(nameof(sqsum)); + if (tilted is null) + throw new ArgumentNullException(nameof(tilted)); + src.ThrowIfDisposed(); + sum.ThrowIfNotReady(); + sqsum.ThrowIfNotReady(); + tilted.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_integral3(src.CvPtr, sum.CvPtr, sqsum.CvPtr, tilted.CvPtr, sdepth?.Value ?? -1, sqdepth?.Value ?? -1)); + + GC.KeepAlive(src); + GC.KeepAlive(sum); + GC.KeepAlive(sqsum); + GC.KeepAlive(tilted); + sum.Fix(); + sqsum.Fix(); + tilted.Fix(); + } + + /// + /// Adds an image to the accumulator. + /// + /// Input image as 1- or 3-channel, 8-bit or 32-bit floating point. + /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. + /// Optional operation mask. + public static void Accumulate(InputArray src, InputOutputArray dst, InputArray mask) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_accumulate(src.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// Adds the square of a source image to the accumulator. + /// + /// Input image as 1- or 3-channel, 8-bit or 32-bit floating point. + /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. + /// Optional operation mask. + public static void AccumulateSquare(InputArray src, InputOutputArray dst, InputArray mask) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_accumulateSquare(src.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// Adds the per-element product of two input images to the accumulator. + /// + /// First input image, 1- or 3-channel, 8-bit or 32-bit floating point. + /// Second input image of the same type and the same size as src1 + /// Accumulator with the same number of channels as input images, 32-bit or 64-bit floating-point. + /// Optional operation mask. + public static void AccumulateProduct(InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_accumulateProduct(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask))); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// Updates a running average. + /// + /// Input image as 1- or 3-channel, 8-bit or 32-bit floating point. + /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. + /// Weight of the input image. + /// Optional operation mask. + public static void AccumulateWeighted(InputArray src, InputOutputArray dst, double alpha, InputArray mask) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_accumulateWeighted(src.CvPtr, dst.CvPtr, alpha, ToPtr(mask))); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// The function is used to detect translational shifts that occur between two images. + /// + /// The operation takes advantage of the Fourier shift theorem for detecting the translational shift in + /// the frequency domain.It can be used for fast image registration as well as motion estimation. + /// For more information please see http://en.wikipedia.org/wiki/Phase_correlation. + /// + /// Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize. + /// + /// Source floating point array (CV_32FC1 or CV_64FC1) + /// Source floating point array (CV_32FC1 or CV_64FC1) + /// Floating point array with windowing coefficients to reduce edge effects (optional). + /// Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional). + /// detected phase shift(sub-pixel) between the two arrays. + public static Point2d PhaseCorrelate(InputArray src1, InputArray src2, + InputArray window, out double response) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (window is null) + throw new ArgumentNullException(nameof(window)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + window.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_phaseCorrelate(src1.CvPtr, src2.CvPtr, window.CvPtr, out response, out var ret)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(window); + return ret; + } + + /// + /// Computes a Hanning window coefficients in two dimensions. + /// + /// Destination array to place Hann coefficients in + /// The window size specifications + /// Created array type + public static void CreateHanningWindow(InputOutputArray dst, Size winSize, MatType type) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_createHanningWindow(dst.CvPtr, winSize, type)); + + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies a fixed-level threshold to each array element. + /// + /// input array (single-channel, 8-bit or 32-bit floating point). + /// output array of the same size and type as src. + /// threshold value. + /// maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. + /// thresholding type (see the details below). + /// the computed threshold value when type == OTSU + public static double Threshold(InputArray src, OutputArray dst, double thresh, double maxval, ThresholdTypes type) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_threshold(src.CvPtr, dst.CvPtr, thresh, maxval, (int)type, out var ret)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + return ret; + } + + /// + /// Applies an adaptive threshold to an array. + /// + /// Source 8-bit single-channel image. + /// Destination image of the same size and the same type as src . + /// Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. + /// Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C . + /// Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV . + /// Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. + /// Constant subtracted from the mean or weighted mean (see the details below). + /// Normally, it is positive but may be zero or negative as well. + public static void AdaptiveThreshold(InputArray src, OutputArray dst, + double maxValue, AdaptiveThresholdTypes adaptiveMethod, ThresholdTypes thresholdType, int blockSize, double c) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_adaptiveThreshold(src.CvPtr, dst.CvPtr, maxValue, (int) adaptiveMethod, (int)thresholdType, blockSize, c)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Blurs an image and downsamples it. + /// + /// input image. + /// output image; it has the specified size and the same type as src. + /// size of the output image; by default, it is computed as Size((src.cols+1)/2 + /// + public static void PyrDown(InputArray src, OutputArray dst, + Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var dstSize0 = dstSize.GetValueOrDefault(new Size()); + NativeMethods.HandleException( + NativeMethods.imgproc_pyrDown(src.CvPtr, dst.CvPtr, dstSize0, (int) borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// + /// + /// + /// + /// + /// + public static void BuildPyramid(InputArray src, VectorOfMat dst,int maxlevel, + BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_buildPyramid(src.CvPtr, dst.CvPtr, maxlevel,(int)borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// Upsamples an image and then blurs it. + /// + /// input image. + /// output image. It has the specified size and the same type as src. + /// size of the output image; by default, it is computed as Size(src.cols*2, (src.rows*2) + /// + public static void PyrUp(InputArray src, OutputArray dst, + Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var dstSize0 = dstSize.GetValueOrDefault(new Size()); + NativeMethods.HandleException( + NativeMethods.imgproc_pyrUp(src.CvPtr, dst.CvPtr, dstSize0, (int)borderType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// computes the joint dense histogram for a set of images. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void CalcHist(Mat[] images, + int[] channels, InputArray? mask, + OutputArray hist, int dims, int[] histSize, + Rangef[] ranges, bool uniform = true, bool accumulate = false) + { + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + var rangesFloat = ranges.Select(r => new [] {r.Start, r.End}).ToArray(); + CalcHist(images, channels, mask, hist, dims, + histSize, rangesFloat, uniform, accumulate); + } + + /// + /// computes the joint dense histogram for a set of images. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void CalcHist(Mat[] images, + int[] channels, InputArray? mask, + OutputArray hist, int dims, int[] histSize, + float[][] ranges, bool uniform = true, bool accumulate = false) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (channels is null) + throw new ArgumentNullException(nameof(channels)); + if (hist is null) + throw new ArgumentNullException(nameof(hist)); + if (histSize is null) + throw new ArgumentNullException(nameof(histSize)); + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + hist.ThrowIfNotReady(); + + var imagesPtr = images.Select(x => x.CvPtr).ToArray(); + using (var rangesPtr = new ArrayAddress2(ranges)) + { + NativeMethods.HandleException( + NativeMethods.imgproc_calcHist( + imagesPtr, images.Length, channels, ToPtr(mask), hist.CvPtr, + dims, histSize, rangesPtr.GetPointer(), uniform ? 1 : 0, accumulate ? 1 : 0)); + } + GC.KeepAlive(images); + GC.KeepAlive(mask); + GC.KeepAlive(hist); + hist.Fix(); + } + + /// + /// computes the joint dense histogram for a set of images. + /// + /// + /// + /// + /// + /// + /// + public static void CalcBackProject(Mat[] images, + int[] channels, InputArray hist, OutputArray backProject, + Rangef[] ranges, bool uniform = true) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (channels is null) + throw new ArgumentNullException(nameof(channels)); + if (hist is null) + throw new ArgumentNullException(nameof(hist)); + if (backProject is null) + throw new ArgumentNullException(nameof(backProject)); + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + hist.ThrowIfDisposed(); + backProject.ThrowIfNotReady(); + + var imagesPtr =images.Select(x => x.CvPtr).ToArray(); + var rangesFloat = ranges.Select(r => new [] {r.Start, r.End}).ToArray(); + using (var rangesPtr = new ArrayAddress2(rangesFloat)) + { + NativeMethods.HandleException( + NativeMethods.imgproc_calcBackProject(imagesPtr, images.Length, channels, hist.CvPtr, + backProject.CvPtr, rangesPtr.GetPointer(), uniform ? 1 : 0)); } - #endregion - #region PreCornerDetect - /// - /// computes another complex cornerness criteria at each pixel - /// - /// - /// - /// - /// - public static void PreCornerDetect( - InputArray src, OutputArray dst, int ksize, BorderTypes borderType = BorderTypes.Default) + GC.KeepAlive(images); + GC.KeepAlive(hist); + GC.KeepAlive(backProject); + backProject.Fix(); + } + + /// + /// compares two histograms stored in dense arrays + /// + /// The first compared histogram + /// The second compared histogram of the same size as h1 + /// The comparison method + /// + public static double CompareHist(InputArray h1, InputArray h2, HistCompMethods method) + { + if (h1 is null) + throw new ArgumentNullException(nameof(h1)); + if (h2 is null) + throw new ArgumentNullException(nameof(h2)); + h1.ThrowIfDisposed(); + h2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_compareHist(h1.CvPtr, h2.CvPtr, (int)method, out var ret)); + + GC.KeepAlive(h1); + GC.KeepAlive(h2); + return ret; + } + + /// + /// normalizes the grayscale image brightness and contrast by normalizing its histogram + /// + /// The source 8-bit single channel image + /// The destination image; will have the same size and the same type as src + public static void EqualizeHist(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_equalizeHist(src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Creates a predefined CLAHE object + /// + /// + /// + /// + public static CLAHE CreateCLAHE(double clipLimit = 40.0, Size? tileGridSize = null) + { + return CLAHE.Create(clipLimit, tileGridSize); + } + + /// + /// Computes the "minimal work" distance between two weighted point configurations. + /// + /// The function computes the earth mover distance and/or a lower boundary of the distance between the + /// two weighted point configurations.One of the applications described in @cite RubnerSept98, + /// @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation + /// problem that is solved using some modification of a simplex algorithm, thus the complexity is + /// exponential in the worst case, though, on average it is much faster.In the case of a real metric + /// the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used + /// to determine roughly whether the two signatures are far enough so that they cannot relate to the same object. + /// + /// First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. + /// Each row stores the point weight followed by the point coordinates.The matrix is allowed to have + /// a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative + /// and have at least one non-zero value. + /// Second signature of the same format as signature1 , though the number of rows + /// may be different.The total weights may be different.In this case an extra "dummy" point is added + /// to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value. + /// Used metric. + /// + public static float EMD(InputArray signature1, InputArray signature2, DistanceTypes distType) + { + return EMD(signature1, signature2, distType, null, out _); + } + + /// + /// Computes the "minimal work" distance between two weighted point configurations. + /// + /// The function computes the earth mover distance and/or a lower boundary of the distance between the + /// two weighted point configurations.One of the applications described in @cite RubnerSept98, + /// @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation + /// problem that is solved using some modification of a simplex algorithm, thus the complexity is + /// exponential in the worst case, though, on average it is much faster.In the case of a real metric + /// the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used + /// to determine roughly whether the two signatures are far enough so that they cannot relate to the same object. + /// + /// First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. + /// Each row stores the point weight followed by the point coordinates.The matrix is allowed to have + /// a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative + /// and have at least one non-zero value. + /// Second signature of the same format as signature1 , though the number of rows + /// may be different.The total weights may be different.In this case an extra "dummy" point is added + /// to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value. + /// Used metric. + /// User-defined size1 x size2 cost matrix. Also, if a cost matrix + /// is used, lower boundary lowerBound cannot be calculated because it needs a metric function. + /// + public static float EMD(InputArray signature1, InputArray signature2, + DistanceTypes distType, InputArray? cost) + { + return EMD(signature1, signature2, distType, cost, out _); + } + + /// + /// Computes the "minimal work" distance between two weighted point configurations. + /// + /// The function computes the earth mover distance and/or a lower boundary of the distance between the + /// two weighted point configurations.One of the applications described in @cite RubnerSept98, + /// @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation + /// problem that is solved using some modification of a simplex algorithm, thus the complexity is + /// exponential in the worst case, though, on average it is much faster.In the case of a real metric + /// the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used + /// to determine roughly whether the two signatures are far enough so that they cannot relate to the same object. + /// + /// First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. + /// Each row stores the point weight followed by the point coordinates.The matrix is allowed to have + /// a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative + /// and have at least one non-zero value. + /// Second signature of the same format as signature1 , though the number of rows + /// may be different.The total weights may be different.In this case an extra "dummy" point is added + /// to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value. + /// Used metric. + /// User-defined size1 x size2 cost matrix. Also, if a cost matrix + /// is used, lower boundary lowerBound cannot be calculated because it needs a metric function. + /// Optional input/output parameter: lower boundary of a distance between the two + /// signatures that is a distance between mass centers.The lower boundary may not be calculated if + /// the user-defined cost matrix is used, the total weights of point configurations are not equal, or + /// if the signatures consist of weights only(the signature matrices have a single column). You ** must** + /// initialize \*lowerBound.If the calculated distance between mass centers is greater or equal to + /// \*lowerBound(it means that the signatures are far enough), the function does not calculate EMD. + /// In any case \*lowerBound is set to the calculated distance between mass centers on return. + /// Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound should be set to 0. + /// Resultant size1 x size2 flow matrix: flow[i,j] is a flow from i-th point of signature1 + /// to j-th point of signature2. + /// + public static float EMD(InputArray signature1, InputArray signature2, + DistanceTypes distType, InputArray? cost, out float lowerBound, OutputArray? flow = null) + { + if (signature1 is null) + throw new ArgumentNullException(nameof(signature1)); + if (signature2 is null) + throw new ArgumentNullException(nameof(signature2)); + signature1.ThrowIfDisposed(); + signature2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_EMD( + signature1.CvPtr, signature2.CvPtr, (int) distType, ToPtr(cost), + out lowerBound, ToPtr(flow), out var ret)); + + GC.KeepAlive(signature1); + GC.KeepAlive(signature2); + GC.KeepAlive(cost); + GC.KeepAlive(flow); + flow?.Fix(); + return ret; + } + + /// + /// Performs a marker-based image segmentation using the watershed algorithm. + /// + /// Input 8-bit 3-channel image. + /// Input/output 32-bit single-channel image (map) of markers. + /// It should have the same size as image. + public static void Watershed(InputArray image, InputOutputArray markers) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (markers is null) + throw new ArgumentNullException(nameof(markers)); + image.ThrowIfDisposed(); + markers.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_watershed(image.CvPtr, markers.CvPtr)); + + GC.KeepAlive(image); + GC.KeepAlive(markers); + markers.Fix(); + } + + /// + /// Performs initial step of meanshift segmentation of an image. + /// + /// The source 8-bit, 3-channel image. + /// The destination image of the same format and the same size as the source. + /// The spatial window radius. + /// The color window radius. + /// Maximum level of the pyramid for the segmentation. + /// Termination criteria: when to stop meanshift iterations. + public static void PyrMeanShiftFiltering(InputArray src, OutputArray dst, + double sp, double sr, int maxLevel = 1, TermCriteria? termcrit = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + var termcrit0 = termcrit.GetValueOrDefault( + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 5, 1)); + NativeMethods.HandleException( + NativeMethods.imgproc_pyrMeanShiftFiltering(src.CvPtr, dst.CvPtr, sp, sr, maxLevel, termcrit0)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Segments the image using GrabCut algorithm + /// + /// Input 8-bit 3-channel image. + /// Input/output 8-bit single-channel mask. + /// The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. + /// Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD + /// ROI containing a segmented object. The pixels outside of the ROI are + /// marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT. + /// Temporary array for the background model. Do not modify it while you are processing the same image. + /// Temporary arrays for the foreground model. Do not modify it while you are processing the same image. + /// Number of iterations the algorithm should make before returning the result. + /// Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL . + /// Operation mode that could be one of GrabCutFlag value. + public static void GrabCut(InputArray img, InputOutputArray mask, Rect rect, + InputOutputArray bgdModel, InputOutputArray fgdModel, + int iterCount, GrabCutModes mode) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + if (bgdModel is null) + throw new ArgumentNullException(nameof(bgdModel)); + if (fgdModel is null) + throw new ArgumentNullException(nameof(fgdModel)); + img.ThrowIfDisposed(); + mask.ThrowIfNotReady(); + bgdModel.ThrowIfNotReady(); + fgdModel.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_grabCut( + img.CvPtr, mask.CvPtr, rect, + bgdModel.CvPtr, fgdModel.CvPtr, iterCount, (int) mode)); + + GC.KeepAlive(img); + GC.KeepAlive(mask); + GC.KeepAlive(bgdModel); + GC.KeepAlive(fgdModel); + mask.Fix(); + bgdModel.Fix(); + fgdModel.Fix(); + } + + /// + /// Calculates the distance to the closest zero pixel for each pixel of the source image. + /// + /// 8-bit, single-channel (binary) source image. + /// Output image with calculated distances. It is a 8-bit or 32-bit floating-point, + /// single-channel image of the same size as src. + /// Output 2D array of labels (the discrete Voronoi diagram). It has the type + /// CV_32SC1 and the same size as src. + /// Type of distance + /// Size of the distance transform mask, see #DistanceTransformMasks. + /// #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, + /// the parameter is forced to 3 because a 3x3 mask gives the same result as 5x5 or any larger aperture. + /// Type of the label array to build + public static void DistanceTransformWithLabels(InputArray src, + OutputArray dst, + OutputArray labels, + DistanceTypes distanceType, + DistanceTransformMasks maskSize, + DistanceTransformLabelTypes labelType = DistanceTransformLabelTypes.CComp) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + labels.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_distanceTransformWithLabels( + src.CvPtr, dst.CvPtr, labels.CvPtr, (int) distanceType, (int) maskSize, (int) labelType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(labels); + dst.Fix(); + labels.Fix(); + } + + /// + /// computes the distance transform map + /// + /// 8-bit, single-channel (binary) source image. + /// Output image with calculated distances. It is a 8-bit or 32-bit floating-point, + /// single-channel image of the same size as src. + /// Type of distance + /// Size of the distance transform mask, see #DistanceTransformMasks. In case of the + /// #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a 3x3 mask gives + /// the same result as 5x5 or any larger aperture. + /// Type of output image. It can be MatType.CV_8U or MatType.CV_32F. + /// Type CV_8U can be used only for the first variant of the function and distanceType == #DIST_L1. + public static void DistanceTransform(InputArray src, + OutputArray dst, + DistanceTypes distanceType, + DistanceTransformMasks maskSize, + int dstType = MatType.CV_32S) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_distanceTransform(src.CvPtr, dst.CvPtr, (int) distanceType, (int) maskSize, dstType)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Fills a connected component with the given color. + /// + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// Starting point. + /// New value of the repainted domain pixels. + /// + public static int FloodFill(InputOutputArray image, Point seedPoint, Scalar newVal) + { + return FloodFill(image, seedPoint, newVal, out _); + } + + /// + /// Fills a connected component with the given color. + /// + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// Starting point. + /// New value of the repainted domain pixels. + /// Optional output parameter set by the function to the + /// minimum bounding rectangle of the repainted domain. + /// Maximal lower brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Maximal upper brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Operation flags. Lower bits contain a connectivity value, + /// 4 (default) or 8, used within the function. Connectivity determines which + /// neighbors of a pixel are considered. Using FloodFillFlags.MaskOnly will + /// fill in the mask using the grey value 255 (white). + /// + public static int FloodFill(InputOutputArray image, + Point seedPoint, Scalar newVal, out Rect rect, + Scalar? loDiff = null, Scalar? upDiff = null, + FloodFillFlags flags = FloodFillFlags.Link4) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + var loDiff0 = loDiff.GetValueOrDefault(new Scalar()); + var upDiff0 = upDiff.GetValueOrDefault(new Scalar()); + + if (flags.HasFlag(FloodFillFlags.MaskOnly)) { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_preCornerDetect(src.CvPtr, dst.CvPtr, ksize, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); + flags |= (FloodFillFlags)(255 << 8); } - #endregion - #region CornerSubPix - /// - /// adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria - /// - /// Input image. - /// Initial coordinates of the input corners and refined coordinates provided for output. - /// Half of the side length of the search window. - /// Half of the size of the dead region in the middle of the search zone - /// over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities - /// of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size. - /// Criteria for termination of the iterative process of corner refinement. - /// That is, the process of corner position refinement stops either after criteria.maxCount iterations - /// or when the corner position moves by less than criteria.epsilon on some iteration. - /// - public static Point2f[] CornerSubPix(InputArray image, IEnumerable inputCorners, - Size winSize, Size zeroZone, TermCriteria criteria) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (inputCorners == null) - throw new ArgumentNullException(nameof(inputCorners)); - image.ThrowIfDisposed(); - - var inputCornersSrc = EnumerableEx.ToArray(inputCorners); - var inputCornersCopy = new Point2f[inputCornersSrc.Length]; - Array.Copy(inputCornersSrc, inputCornersCopy, inputCornersSrc.Length); - using (var vector = new VectorOfPoint2f(inputCornersCopy)) + + NativeMethods.HandleException( + NativeMethods.imgproc_floodFill1( + image.CvPtr, seedPoint, newVal, out rect, + loDiff0, upDiff0, (int)flags, out var ret)); + + GC.KeepAlive(image); + image.Fix(); + return ret; + } + + /// + /// Fills a connected component with the given color. + /// + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// (For the second function only) Operation mask that should be a single-channel 8-bit image, + /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of + /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, + /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask + /// in multiple calls to the function to make sure the filled area does not overlap. + /// Starting point. + /// New value of the repainted domain pixels. + /// + public static int FloodFill(InputOutputArray image, InputOutputArray mask, + Point seedPoint, Scalar newVal) + { + return FloodFill(image, mask, seedPoint, newVal, out _); + } + + /// + /// Fills a connected component with the given color. + /// + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// (For the second function only) Operation mask that should be a single-channel 8-bit image, + /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of + /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, + /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask + /// in multiple calls to the function to make sure the filled area does not overlap. + /// Starting point. + /// New value of the repainted domain pixels. + /// Optional output parameter set by the function to the + /// minimum bounding rectangle of the repainted domain. + /// Maximal lower brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Maximal upper brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Operation flags. Lower bits contain a connectivity value, + /// 4 (default) or 8, used within the function. Connectivity determines which + /// neighbors of a pixel are considered. Using FloodFillFlags.MaskOnly will + /// fill in the mask using the grey value 255 (white). + /// + public static int FloodFill(InputOutputArray image, InputOutputArray mask, + Point seedPoint, Scalar newVal, out Rect rect, + Scalar? loDiff = null, Scalar? upDiff = null, + FloodFillFlags flags = FloodFillFlags.Link4) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + image.ThrowIfNotReady(); + mask.ThrowIfNotReady(); + var loDiff0 = loDiff.GetValueOrDefault(new Scalar()); + var upDiff0 = upDiff.GetValueOrDefault(new Scalar()); + + if (flags.HasFlag(FloodFillFlags.MaskOnly)) + { + flags |= (FloodFillFlags)(255 << 8); + } + + NativeMethods.HandleException( + NativeMethods.imgproc_floodFill2( + image.CvPtr, mask.CvPtr, seedPoint, + newVal, out rect, loDiff0, upDiff0, (int)flags, out var ret)); + + GC.KeepAlive(image); + GC.KeepAlive(mask); + image.Fix(); + mask.Fix(); + return ret; + } + + /// + /// Performs linear blending of two images: + /// dst(i,j) = weights1(i,j)*src1(i,j) + weights2(i,j)*src2(i,j) + /// + /// It has a type of CV_8UC(n) or CV_32FC(n), where n is a positive integer. + /// It has the same type and size as src1. + /// It has a type of CV_32FC1 and the same size with src1. + /// It has a type of CV_32FC1 and the same size with src1. + /// It is created if it does not have the same size and type with src1. + public static void BlendLinear(InputArray src1, InputArray src2, InputArray weights1, InputArray weights2, + OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (weights1 is null) + throw new ArgumentNullException(nameof(weights1)); + if (weights2 is null) + throw new ArgumentNullException(nameof(weights2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + weights1.ThrowIfDisposed(); + weights2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_blendLinear(src1.CvPtr, src2.CvPtr, weights1.CvPtr, weights2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(weights1); + GC.KeepAlive(weights2); + dst.Fix(); + } + + /// + /// Converts image from one color space to another + /// + /// The source image, 8-bit unsigned, 16-bit unsigned or single-precision floating-point + /// The destination image; will have the same size and the same depth as src + /// The color space conversion code + /// The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code + public static void CvtColor(InputArray src, OutputArray dst, ColorConversionCodes code, int dstCn = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_cvtColor(src.CvPtr, dst.CvPtr, (int) code, dstCn)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Converts an image from one color space to another where the source image is stored in two planes. + /// This function only supports YUV420 to RGB conversion as of now. + /// + /// 8-bit image (#CV_8U) of the Y plane. + /// image containing interleaved U/V plane. + /// output image. + /// Specifies the type of conversion. It can take any of the following values: + /// - #COLOR_YUV2BGR_NV12 + /// - #COLOR_YUV2RGB_NV12 + /// - #COLOR_YUV2BGRA_NV12 + /// - #COLOR_YUV2RGBA_NV12 + /// - #COLOR_YUV2BGR_NV21 + /// - #COLOR_YUV2RGB_NV21 + /// - #COLOR_YUV2BGRA_NV21 + /// - #COLOR_YUV2RGBA_NV21 + public static void CvtColorTwoPlane(InputArray src1, InputArray src2, OutputArray dst, ColorConversionCodes code) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_cvtColorTwoPlane(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int)code)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// main function for all demosaicing processes + /// + /// input image: 8-bit unsigned or 16-bit unsigned. + /// output image of the same size and depth as src. + /// Color space conversion code (see the description below). + /// number of channels in the destination image; if the parameter is 0, + /// the number of the channels is derived automatically from src and code. + /// + /// The function can do the following transformations: + /// + /// - Demosaicing using bilinear interpolation + /// + /// #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR + /// #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY + /// + /// - Demosaicing using Variable Number of Gradients. + /// + /// #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG + /// + /// - Edge-Aware Demosaicing. + /// + /// #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA + /// + /// - Demosaicing with alpha channel + /// + /// # COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA + /// + public static void Demosaicing(InputArray src, OutputArray dst, ColorConversionCodes code, int dstCn = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_demosaicing(src.CvPtr, dst.CvPtr, (int)code, dstCn)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (single-channel, 8-bit or floating-point + /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f ) + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public static Moments Moments(InputArray array, bool binaryImage = false) + { + return new (array, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (8-bit) 2D array + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public static Moments Moments(byte[,] array, bool binaryImage = false) + { + return new (array, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (floating-point) 2D array + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public static Moments Moments(float[,] array, bool binaryImage = false) + { + return new (array, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// Array of 2D points + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public static Moments Moments(IEnumerable array, bool binaryImage = false) + { + return new (array, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// Array of 2D points + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public static Moments Moments(IEnumerable array, bool binaryImage = false) + { + return new (array, binaryImage); + } + + /// + /// Computes the proximity map for the raster template and the image where the template is searched for + /// + /// Image where the search is running; should be 8-bit or 32-bit floating-point + /// Searched template; must be not greater than the source image and have the same data type + /// A map of comparison results; will be single-channel 32-bit floating-point. + /// If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1). + /// Specifies the comparison method + /// Mask of searched template. It must have the same datatype and size with templ. It is not set by default. + public static void MatchTemplate( + InputArray image, + InputArray templ, + OutputArray result, + TemplateMatchModes method, + InputArray? mask = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (templ is null) + throw new ArgumentNullException(nameof(templ)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + image.ThrowIfDisposed(); + templ.ThrowIfDisposed(); + result.ThrowIfNotReady(); + mask?.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_matchTemplate(image.CvPtr, templ.CvPtr, result.CvPtr, (int) method, ToPtr(mask))); + + GC.KeepAlive(image); + GC.KeepAlive(templ); + GC.KeepAlive(result); + result.Fix(); + GC.KeepAlive(mask); + } + + /// + /// Computes the connected components labeled image of boolean image. + /// + /// image with 4 or 8 way connectivity - returns N, the total number of labels[0, N - 1] where 0 + /// represents the background label.ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of pixels in + /// the source image.ccltype specifies the connected components labeling algorithm to use, currently + /// Grana (BBDT) and Wu's (SAUF) algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes + /// for details.Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. + /// This function uses parallel version of both Grana and Wu's algorithms if at least one allowed + /// parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs. + /// + /// the 8-bit single-channel image to be labeled + /// destination labeled image + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// output image label type. Currently CV_32S and CV_16U are supported. + /// connected components algorithm type. + /// + public static int ConnectedComponentsWithAlgorithm( + InputArray image, OutputArray labels, PixelConnectivity connectivity, MatType ltype, ConnectedComponentsAlgorithmsTypes ccltype) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + image.ThrowIfDisposed(); + labels.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_connectedComponentsWithAlgorithm( + image.CvPtr, labels.CvPtr, (int)connectivity, ltype, (int)ccltype, out var ret)); + + GC.KeepAlive(image); + GC.KeepAlive(labels); + labels.Fix(); + return ret; + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// the image to be labeled + /// destination labeled image + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// The number of labels + public static int ConnectedComponents(InputArray image, OutputArray labels, + PixelConnectivity connectivity = PixelConnectivity.Connectivity8) + { + return ConnectedComponents(image, labels, connectivity, MatType.CV_32S); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// the image to be labeled + /// destination labeled image + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// output image label type. Currently CV_32S and CV_16U are supported. + /// The number of labels + public static int ConnectedComponents(InputArray image, OutputArray labels, + PixelConnectivity connectivity, MatType ltype) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + image.ThrowIfDisposed(); + labels.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_connectedComponents( + image.CvPtr, labels.CvPtr, (int)connectivity, ltype, out var ret)); + + GC.KeepAlive(image); + GC.KeepAlive(labels); + labels.Fix(); + return ret; + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// the image to be labeled + /// destination labeled rectangular array + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// The number of labels + public static int ConnectedComponents(InputArray image, out int[,] labels, PixelConnectivity connectivity) + { + using var labelsMat = new Mat(); + var result = ConnectedComponents(image, labelsMat, connectivity, MatType.CV_32S); + labels = labelsMat.ToRectangularArray(); + return result; + } + + /// + /// computes the connected components labeled image of boolean image and also produces a statistics output for each label. + /// + /// image with 4 or 8 way connectivity - returns N, the total number of labels[0, N - 1] where 0 + /// represents the background label.ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of pixels in + /// the source image.ccltype specifies the connected components labeling algorithm to use, currently + /// Grana's (BBDT) and Wu's (SAUF) algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes + /// for details.Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. + /// This function uses parallel version of both Grana and Wu's algorithms (statistics included) if at least one allowed + /// parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs. + /// + /// the 8-bit single-channel image to be labeled + /// destination labeled image + /// statistics output for each label, including the background label, see below for + /// available statistics.Statistics are accessed via stats(label, COLUMN) where COLUMN is one of #ConnectedComponentsTypes. The data type is CV_32S. + /// centroid output for each label, including the background label. Centroids are + /// accessed via centroids(label, 0) for x and centroids(label, 1) for y.The data type CV_64F. + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// output image label type. Currently CV_32S and CV_16U are supported. + /// connected components algorithm type. + /// + public static int ConnectedComponentsWithStatsWithAlgorithm( + InputArray image, + OutputArray labels, + OutputArray stats, + OutputArray centroids, + PixelConnectivity connectivity, + MatType ltype, + ConnectedComponentsAlgorithmsTypes ccltype) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + if (stats is null) + throw new ArgumentNullException(nameof(stats)); + if (centroids is null) + throw new ArgumentNullException(nameof(centroids)); + image.ThrowIfDisposed(); + labels.ThrowIfNotReady(); + stats.ThrowIfNotReady(); + centroids.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_connectedComponentsWithStatsWithAlgorithm( + image.CvPtr, labels.CvPtr, stats.CvPtr, centroids.CvPtr, (int)connectivity, ltype, (int)ccltype, out var ret)); + + GC.KeepAlive(image); + GC.KeepAlive(labels); + GC.KeepAlive(stats); + GC.KeepAlive(centroids); + labels.Fix(); + stats.Fix(); + centroids.Fix(); + return ret; + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// the image to be labeled + /// destination labeled image + /// statistics output for each label, including the background label, + /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) + /// where COLUMN is one of cv::ConnectedComponentsTypes + /// floating point centroid (x,y) output for each label, + /// including the background label + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// + public static int ConnectedComponentsWithStats( + InputArray image, OutputArray labels, + OutputArray stats, OutputArray centroids, + PixelConnectivity connectivity = PixelConnectivity.Connectivity8) + { + return ConnectedComponentsWithStats(image, labels, stats, centroids, connectivity, MatType.CV_32S); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// the image to be labeled + /// destination labeled image + /// statistics output for each label, including the background label, + /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) + /// where COLUMN is one of cv::ConnectedComponentsTypes + /// floating point centroid (x,y) output for each label, + /// including the background label + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// output image label type. Currently CV_32S and CV_16U are supported. + /// + public static int ConnectedComponentsWithStats( + InputArray image, OutputArray labels, + OutputArray stats, OutputArray centroids, + PixelConnectivity connectivity, + MatType ltype) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + if (stats is null) + throw new ArgumentNullException(nameof(stats)); + if (centroids is null) + throw new ArgumentNullException(nameof(centroids)); + image.ThrowIfDisposed(); + labels.ThrowIfNotReady(); + stats.ThrowIfNotReady(); + centroids.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_connectedComponentsWithStats( + image.CvPtr, labels.CvPtr, stats.CvPtr, centroids.CvPtr, (int) connectivity, ltype, out var ret)); + + GC.KeepAlive(image); + GC.KeepAlive(labels); + GC.KeepAlive(stats); + GC.KeepAlive(centroids); + labels.Fix(); + stats.Fix(); + centroids.Fix(); + return ret; + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// the image to be labeled + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// + /// + public static ConnectedComponents ConnectedComponentsEx( + InputArray image, + PixelConnectivity connectivity = PixelConnectivity.Connectivity8, + ConnectedComponentsAlgorithmsTypes ccltype = ConnectedComponentsAlgorithmsTypes.Default) + { + using var labelsMat = new Mat(); + using var statsMat = new Mat(); + using var centroidsMat = new Mat(); + var nLabels = ConnectedComponentsWithStatsWithAlgorithm( + image, labelsMat, statsMat, centroidsMat, connectivity, MatType.CV_32S, ccltype); + var labels = labelsMat.ToRectangularArray(); + var stats = statsMat.ToRectangularArray(); + var centroids = centroidsMat.ToRectangularArray(); + + var blobs = new ConnectedComponents.Blob[nLabels]; + for (var i = 0; i < nLabels; i++) + { + blobs[i] = new ConnectedComponents.Blob { - NativeMethods.imgproc_cornerSubPix(image.CvPtr, vector.CvPtr, winSize, zeroZone, criteria); - GC.KeepAlive(image); - return vector.ToArray(); - } - } - #endregion - #region GoodFeaturesToTrack - /// - /// finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima - /// - /// Input 8-bit or floating-point 32-bit, single-channel image. - /// Maximum number of corners to return. If there are more corners than are found, - /// the strongest of them is returned. - /// Parameter characterizing the minimal accepted quality of image corners. - /// The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue - /// or the Harris function response (see cornerHarris() ). The corners with the quality measure less than - /// the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01, - /// then all the corners with the quality measure less than 15 are rejected. - /// Minimum possible Euclidean distance between the returned corners. - /// Optional region of interest. If the image is not empty - /// (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region - /// in which the corners are detected. - /// Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. - /// Parameter indicating whether to use a Harris detector - /// Free parameter of the Harris detector. - /// Output vector of detected corners. - public static Point2f[] GoodFeaturesToTrack(InputArray src, - int maxCorners, double qualityLevel, double minDistance, - InputArray mask, int blockSize, bool useHarrisDetector, double k) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); + Label = i, + Left = stats[i, 0], + Top = stats[i, 1], + Width = stats[i, 2], + Height = stats[i, 3], + Area = stats[i, 4], + Centroid = new Point2d(centroids[i, 0], centroids[i, 1]), + }; + } + return new ConnectedComponents(blobs, labels, nLabels); + } + + /// + /// Finds contours in a binary image. + /// + /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. + /// The function modifies the image while extracting the contours. + /// Detected contours. Each contour is stored as a vector of points. + /// Optional output vector, containing information about the image topology. + /// It has as many elements as the number of contours. For each i-th contour contours[i], + /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next + /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. + /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + public static void FindContours(InputArray image, out Point[][] contours, + out HierarchyIndex[] hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + var offset0 = offset.GetValueOrDefault(new Point()); + using var contoursVec = new VectorOfVectorPoint(); + using var hierarchyVec = new VectorOfVec4i(); + NativeMethods.HandleException( + NativeMethods.imgproc_findContours1_vector( + image.CvPtr, contoursVec.CvPtr, hierarchyVec.CvPtr, (int) mode, (int) method, offset0)); + + contours = contoursVec.ToArray(); + var hierarchyOrg = hierarchyVec.ToArray(); + hierarchy = hierarchyOrg.Select(HierarchyIndex.FromVec4i).ToArray(); + + GC.KeepAlive(image); + } + + /// + /// Finds contours in a binary image. + /// + /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. + /// The function modifies the image while extracting the contours. + /// Detected contours. Each contour is stored as a vector of points. + /// Optional output vector, containing information about the image topology. + /// It has as many elements as the number of contours. For each i-th contour contours[i], + /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next + /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. + /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + public static void FindContours(InputArray image, out Mat[] contours, + OutputArray hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (hierarchy is null) + throw new ArgumentNullException(nameof(hierarchy)); + image.ThrowIfDisposed(); + hierarchy.ThrowIfNotReady(); + + var offset0 = offset.GetValueOrDefault(new Point()); + using var contoursVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.imgproc_findContours1_OutputArray(image.CvPtr, contoursVec.CvPtr, hierarchy.CvPtr, (int) mode, (int) method, offset0)); + + contours = contoursVec.ToArray(); + + hierarchy.Fix(); + GC.KeepAlive(image); + GC.KeepAlive(hierarchy); + } + + /// + /// Finds contours in a binary image. + /// + /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. + /// The function modifies the image while extracting the contours. + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + /// Detected contours. Each contour is stored as a vector of points. + public static Point[][] FindContoursAsArray(InputArray image, + RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + var offset0 = offset.GetValueOrDefault(new Point()); + using var contoursVec = new VectorOfVectorPoint(); + NativeMethods.HandleException( + NativeMethods.imgproc_findContours2_vector(image.CvPtr, contoursVec.CvPtr, (int) mode, (int) method, offset0)); + GC.KeepAlive(image); + + return contoursVec.ToArray(); + } + + /// + /// Finds contours in a binary image. + /// + /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. + /// The function modifies the image while extracting the contours. + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + /// Detected contours. Each contour is stored as a vector of points. + public static Mat[] FindContoursAsMat(InputArray image, + RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + var offset0 = offset.GetValueOrDefault(new Point()); + using var contoursVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.imgproc_findContours2_OutputArray(image.CvPtr, contoursVec.CvPtr, (int)mode, (int)method, offset0)); + GC.KeepAlive(image); + + return contoursVec.ToArray>(); + } + + /// + /// Approximates contour or a curve using Douglas-Peucker algorithm + /// + /// The polygon or curve to approximate. + /// Must be 1 x N or N x 1 matrix of type CV_32SC2 or CV_32FC2. + /// The result of the approximation; + /// The type should match the type of the input curve + /// Specifies the approximation accuracy. + /// This is the maximum distance between the original curve and its approximation. + /// The result of the approximation; + /// The type should match the type of the input curve + public static void ApproxPolyDP(InputArray curve, OutputArray approxCurve, double epsilon, bool closed) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + if (approxCurve is null) + throw new ArgumentNullException(nameof(approxCurve)); + curve.ThrowIfDisposed(); + approxCurve.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_approxPolyDP_InputArray(curve.CvPtr, approxCurve.CvPtr, epsilon, closed ? 1 : 0)); + + GC.KeepAlive(curve); + GC.KeepAlive(approxCurve); + approxCurve.Fix(); + } + + /// + /// Approximates contour or a curve using Douglas-Peucker algorithm + /// + /// The polygon or curve to approximate. + /// Specifies the approximation accuracy. + /// This is the maximum distance between the original curve and its approximation. + /// The result of the approximation; + /// The type should match the type of the input curve + /// The result of the approximation; + /// The type should match the type of the input curve + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Point[] ApproxPolyDP(IEnumerable curve, double epsilon, bool closed) + { + if(curve is null) + throw new ArgumentNullException(nameof(curve)); + var curveArray = curve as Point[] ?? curve.ToArray(); + using var approxCurveVec = new VectorOfPoint(); + NativeMethods.HandleException( + NativeMethods.imgproc_approxPolyDP_Point( + curveArray, curveArray.Length, approxCurveVec.CvPtr, epsilon, closed ? 1 : 0)); + return approxCurveVec.ToArray(); + } + + /// + /// Approximates contour or a curve using Douglas-Peucker algorithm + /// + /// The polygon or curve to approximate. + /// Specifies the approximation accuracy. + /// This is the maximum distance between the original curve and its approximation. + /// If true, the approximated curve is closed + /// (i.e. its first and last vertices are connected), otherwise it’s not + /// The result of the approximation; + /// The type should match the type of the input curve + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static Point2f[] ApproxPolyDP(IEnumerable curve, double epsilon, bool closed) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + var curveArray = curve as Point2f[] ?? curve.ToArray(); + using var approxCurveVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_approxPolyDP_Point2f( + curveArray, curveArray.Length, approxCurveVec.CvPtr, epsilon, closed ? 1 : 0)); + return approxCurveVec.ToArray(); + } + + /// + /// Calculates a contour perimeter or a curve length. + /// + /// The input vector of 2D points, represented by CV_32SC2 or CV_32FC2 matrix. + /// Indicates, whether the curve is closed or not. + /// + public static double ArcLength(InputArray curve, bool closed) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + curve.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_arcLength_InputArray(curve.CvPtr, closed ? 1 : 0, out var ret)); + GC.KeepAlive(curve); + return ret; + } + + /// + /// Calculates a contour perimeter or a curve length. + /// + /// The input vector of 2D points. + /// Indicates, whether the curve is closed or not. + /// + public static double ArcLength(IEnumerable curve, bool closed) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + var curveArray = curve.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_arcLength_Point(curveArray, curveArray.Length, closed ? 1 : 0, out var ret)); + return ret; + } + + /// + /// Calculates a contour perimeter or a curve length. + /// + /// The input vector of 2D points. + /// Indicates, whether the curve is closed or not. + /// + public static double ArcLength(IEnumerable curve, bool closed) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + var curveArray = curve.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_arcLength_Point2f(curveArray, curveArray.Length, closed ? 1 : 0, out var ret)); + return ret; + } + + /// + /// Calculates the up-right bounding rectangle of a point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// Minimal up-right bounding rectangle for the specified point set. + public static Rect BoundingRect(InputArray curve) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + curve.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_boundingRect_InputArray(curve.CvPtr, out var ret)); + GC.KeepAlive(curve); + return ret; + } + + /// + /// Calculates the up-right bounding rectangle of a point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// Minimal up-right bounding rectangle for the specified point set. + public static Rect BoundingRect(IEnumerable curve) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + var curveArray = curve.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_boundingRect_Point(curveArray, curveArray.Length, out var ret)); + return ret; + } + + /// + /// Calculates the up-right bounding rectangle of a point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// Minimal up-right bounding rectangle for the specified point set. + public static Rect BoundingRect(IEnumerable curve) + { + if (curve is null) + throw new ArgumentNullException(nameof(curve)); + var curveArray = curve.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_boundingRect_Point2f(curveArray, curveArray.Length, out var ret)); + return ret; + } + + /// + /// Calculates the contour area + /// + /// The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix + /// + /// + public static double ContourArea(InputArray contour, bool oriented = false) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + contour.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_contourArea_InputArray(contour.CvPtr, oriented ? 1 : 0, out var ret)); + GC.KeepAlive(contour); + return ret; + } + + /// + /// Calculates the contour area + /// + /// The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix + /// + /// + public static double ContourArea(IEnumerable contour, bool oriented = false) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + var contourArray = contour.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_contourArea_Point(contourArray, contourArray.Length, oriented ? 1 : 0, out var ret)); + return ret; + } + + /// + /// Calculates the contour area + /// + /// The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix + /// + /// + public static double ContourArea(IEnumerable contour, bool oriented = false) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + var contourArray = contour.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_contourArea_Point2f(contourArray, contourArray.Length, oriented ? 1 : 0, out var ret)); + return ret; + } + + /// + /// Finds the minimum area rotated rectangle enclosing a 2D point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + public static RotatedRect MinAreaRect(InputArray points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + points.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_minAreaRect_InputArray(points.CvPtr, out var ret)); + GC.KeepAlive(points); + return ret; + } + + /// + /// Finds the minimum area rotated rectangle enclosing a 2D point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + public static RotatedRect MinAreaRect(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_minAreaRect_Point(pointsArray, pointsArray.Length, out var ret)); + return ret; + } + + /// + /// Finds the minimum area rotated rectangle enclosing a 2D point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + public static RotatedRect MinAreaRect(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_minAreaRect_Point2f(pointsArray, pointsArray.Length, out var ret)); + return ret; + } + + /// + /// Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. + /// + /// The function finds the four vertices of a rotated rectangle.This function is useful to draw the + /// rectangle.In C++, instead of using this function, you can directly use RotatedRect::points method. Please + /// visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information. + /// + /// The input rotated rectangle. It may be the output of + /// The output array of four vertices of rectangles. + /// + public static void BoxPoints(RotatedRect box, OutputArray points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + points.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_boxPoints_OutputArray(box, points.CvPtr)); + points.Fix(); + } + + /// + /// Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. + /// + /// The function finds the four vertices of a rotated rectangle.This function is useful to draw the + /// rectangle.In C++, instead of using this function, you can directly use RotatedRect::points method. Please + /// visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information. + /// + /// The input rotated rectangle. It may be the output of + /// The output array of four vertices of rectangles. + public static Point2f[] BoxPoints(RotatedRect box) + { + var points = new Point2f[4]; + NativeMethods.HandleException( + NativeMethods.imgproc_boxPoints_Point2f(box, points)); + return points; + } + + /// + /// Finds the minimum area circle enclosing a 2D point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// The output center of the circle + /// The output radius of the circle + public static void MinEnclosingCircle(InputArray points, out Point2f center, out float radius) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + points.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_minEnclosingCircle_InputArray(points.CvPtr, out center, out radius)); + GC.KeepAlive(points); + } + + /// + /// Finds the minimum area circle enclosing a 2D point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// The output center of the circle + /// The output radius of the circle + public static void MinEnclosingCircle(IEnumerable points, out Point2f center, out float radius) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_minEnclosingCircle_Point(pointsArray, pointsArray.Length, out center, out radius)); + } + + /// + /// Finds the minimum area circle enclosing a 2D point set. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// The output center of the circle + /// The output radius of the circle + public static void MinEnclosingCircle(IEnumerable points, out Point2f center, out float radius) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_minEnclosingCircle_Point2f(pointsArray, pointsArray.Length, out center, out radius)); + } + + /// + /// Finds a triangle of minimum area enclosing a 2D point set and returns its area. + /// + /// Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector or Mat + /// Output vector of three 2D points defining the vertices of the triangle. The depth + /// Triangle area + public static double MinEnclosingTriangle(InputArray points, OutputArray triangle) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + if (triangle is null) + throw new ArgumentNullException(nameof(triangle)); + points.ThrowIfDisposed(); + triangle.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_minEnclosingTriangle_InputOutputArray(points.CvPtr, triangle.CvPtr, out var ret)); + + GC.KeepAlive(points); + triangle.Fix(); + return ret; + } + + /// + /// Finds a triangle of minimum area enclosing a 2D point set and returns its area. + /// + /// Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector or Mat + /// Output vector of three 2D points defining the vertices of the triangle. The depth + /// Triangle area + public static double MinEnclosingTriangle(IEnumerable points, out Point2f[] triangle) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + + var pointsArray = points.ToArray(); + using var triangleVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_minEnclosingTriangle_Point( + pointsArray, pointsArray.Length, triangleVec.CvPtr, out var ret)); + + GC.KeepAlive(pointsArray); + triangle = triangleVec.ToArray(); + return ret; + } + + /// + /// Finds a triangle of minimum area enclosing a 2D point set and returns its area. + /// + /// Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector or Mat + /// Output vector of three 2D points defining the vertices of the triangle. The depth + /// Triangle area + public static double MinEnclosingTriangle(IEnumerable points, out Point2f[] triangle) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + + var pointsArray = points.ToArray(); + using var triangleVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_minEnclosingTriangle_Point2f( + pointsArray, pointsArray.Length, triangleVec.CvPtr, out var ret)); + + GC.KeepAlive(pointsArray); + triangle = triangleVec.ToArray(); + return ret; + } + + /// + /// Compares two shapes. + /// + /// First contour or grayscale image. + /// Second contour or grayscale image. + /// Comparison method + /// Method-specific parameter (not supported now) + /// + public static double MatchShapes(InputArray contour1, InputArray contour2, ShapeMatchModes method, double parameter = 0) + { + if (contour1 is null) + throw new ArgumentNullException(nameof(contour1)); + if (contour2 is null) + throw new ArgumentNullException(nameof(contour2)); + + NativeMethods.HandleException( + NativeMethods.imgproc_matchShapes_InputArray(contour1.CvPtr, contour2.CvPtr, (int)method, parameter, out var ret)); + + GC.KeepAlive(contour1); + GC.KeepAlive(contour2); + return ret; + } + + /// + /// Compares two shapes. + /// + /// First contour or grayscale image. + /// Second contour or grayscale image. + /// Comparison method + /// Method-specific parameter (not supported now) + /// + public static double MatchShapes(IEnumerable contour1, IEnumerable contour2, + ShapeMatchModes method, double parameter = 0) + { + if (contour1 is null) + throw new ArgumentNullException(nameof(contour1)); + if (contour2 is null) + throw new ArgumentNullException(nameof(contour2)); + var contour1Array = contour1.ToArray(); + var contour2Array = contour2.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_matchShapes_Point( + contour1Array, contour1Array.Length, + contour2Array, contour2Array.Length, + (int) method, parameter, out var ret)); + return ret; + } - using (var vector = new VectorOfPoint2f()) - { - IntPtr maskPtr = ToPtr(mask); - NativeMethods.imgproc_goodFeaturesToTrack(src.CvPtr, vector.CvPtr, maxCorners, qualityLevel, - minDistance, maskPtr, blockSize, useHarrisDetector ? 0 : 1, k); - GC.KeepAlive(src); - return vector.ToArray(); - } - } - #endregion - #region HoughLines -#if LANG_JP - /// - /// 標準ハフ変換を用いて,2値画像から直線を検出します. - /// - /// 8ビット,シングルチャンネルの2値入力画像.この画像は関数により書き換えられる可能性があります - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// マルチスケールハフ変換において,距離分解能 rho の除数となる値.[既定値は0] - /// マルチスケールハフ変換において,角度分解能 theta の除数となる値. [既定値は0] - /// 検出された直線.各直線は,2要素のベクトル (rho, theta) で表現されます. - /// rho は原点(画像の左上コーナー)からの距離, theta はラジアン単位で表される直線の回転角度です -#else - /// - /// Finds lines in a binary image using standard Hough transform. - /// - /// The 8-bit, single-channel, binary source image. The image may be modified by the function - /// Distance resolution of the accumulator in pixels - /// Angle resolution of the accumulator in radians - /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) - /// For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0] - /// For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0] - /// The output vector of lines. Each line is represented by a two-element vector (rho, theta) . - /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians -#endif - public static LineSegmentPolar[] HoughLines( - InputArray image, double rho, double theta, int threshold, - double srn = 0, double stn = 0) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); + /// + /// Computes convex hull for a set of 2D points. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix + /// The output convex hull. It is either a vector of points that form the + /// hull (must have the same type as the input points), or a vector of 0-based point + /// indices of the hull points in the original array (since the set of convex hull + /// points is a subset of the original point set). + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// + public static void ConvexHull(InputArray points, OutputArray hull, bool clockwise = false, bool returnPoints = true) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + if (hull is null) + throw new ArgumentNullException(nameof(hull)); + points.ThrowIfDisposed(); + hull.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_convexHull_InputArray(points.CvPtr, hull.CvPtr, clockwise ? 1 : 0, returnPoints ? 1 : 0)); + + GC.KeepAlive(points); + GC.KeepAlive(hull); + hull.Fix(); + } - using (var vec = new VectorOfVec2f()) - { - NativeMethods.imgproc_HoughLines(image.CvPtr, vec.CvPtr, rho, theta, threshold, srn, stn); - GC.KeepAlive(image); - return vec.ToArray(); - } - } - #endregion - #region HoughLinesP -#if LANG_JP - /// - /// 確率的ハフ変換を利用して,2値画像から線分を検出します. - /// - /// 8ビット,シングルチャンネルの2値入力画像.この画像は関数により書き換えられる可能性があります - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// 最小の線分長.これより短い線分は棄却されます. [既定値は0] - /// 2点が同一線分上にあると見なす場合に許容される最大距離. [既定値は0] - /// 検出された線分.各線分は,4要素のベクトル (x1, y1, x2, y2) で表現されます. -#else - /// - /// Finds lines segments in a binary image using probabilistic Hough transform. - /// - /// - /// Distance resolution of the accumulator in pixels - /// Angle resolution of the accumulator in radians - /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) - /// The minimum line length. Line segments shorter than that will be rejected. [By default this is 0] - /// The maximum allowed gap between points on the same line to link them. [By default this is 0] - /// The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2) -#endif - public static LineSegmentPoint[] HoughLinesP( - InputArray image, double rho, double theta, int threshold, - double minLineLength = 0, double maxLineGap = 0) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - using (var vec = new VectorOfVec4i()) - { - NativeMethods.imgproc_HoughLinesP(image.CvPtr, vec.CvPtr, rho, theta, threshold, minLineLength, maxLineGap); - GC.KeepAlive(image); - return vec.ToArray(); - } - } - #endregion - #region HoughCircles -#if LANG_JP - /// - /// ハフ変換を用いて,グレースケール画像から円を検出します. - /// - /// 8ビット,シングルチャンネル,グレースケールの入力画像> - /// 現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている. - /// 画像分解能に対する投票分解能の比率の逆数. - /// 検出される円の中心同士の最小距離. - /// 手法依存の1番目のパラメータ.[既定値は100] - /// 手法依存の2番目のパラメータ.[既定値は100] - /// 円の半径の最小値 [既定値は0] - /// 円の半径の最大値 [既定値は0] - /// 検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます -#else - /// - /// Finds circles in a grayscale image using a Hough transform. - /// - /// The 8-bit, single-channel, grayscale input image - /// Currently, the only implemented method is HoughCirclesMethod.Gradient - /// The inverse ratio of the accumulator resolution to the image resolution. - /// Minimum distance between the centers of the detected circles. - /// The first method-specific parameter. [By default this is 100] - /// The second method-specific parameter. [By default this is 100] - /// Minimum circle radius. [By default this is 0] - /// Maximum circle radius. [By default this is 0] - /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) -#endif - public static CircleSegment[] HoughCircles( - InputArray image, HoughMethods method, double dp, double minDist, - double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - using (var vec = new VectorOfVec3f()) - { - NativeMethods.imgproc_HoughCircles(image.CvPtr, vec.CvPtr, (int)method, dp, minDist, param1, param2, minRadius, maxRadius); - GC.KeepAlive(image); - return vec.ToArray(); - } - } - #endregion - #region MorphologyDefaultBorderValue - /// - /// Default borderValue for Dilate/Erode - /// - /// - public static Scalar MorphologyDefaultBorderValue() - { - return Scalar.All(double.MaxValue); - } - #endregion - #region Dilate -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の膨張を行います. - /// - /// 入力画像 - /// src と同じサイズ,同じ型の出力画像 - /// 膨張に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 膨張が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderType.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] -#else - /// - /// Dilates an image by using a specific structuring element. - /// - /// The source image - /// The destination image. It will have the same size and the same type as src - /// The structuring element used for dilation. If element=new Mat() , a 3x3 rectangular structuring element is used - /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center - /// The number of times dilation is applied. [By default this is 1] - /// The pixel extrapolation method. [By default this is BorderType.Constant] - /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] -#endif - public static void Dilate( - InputArray src, OutputArray dst, InputArray element, - Point? anchor = null, int iterations = 1, - BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - Scalar borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue()); - IntPtr elementPtr = ToPtr(element); - NativeMethods.imgproc_dilate(src.CvPtr, dst.CvPtr, elementPtr, anchor0, iterations, (int)borderType, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Erode -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の収縮を行います. - /// - /// 入力画像 - /// src と同じサイズ,同じ型の出力画像 - /// 収縮に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形の構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 収縮が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderType.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] -#else - /// - /// Erodes an image by using a specific structuring element. - /// - /// The source image - /// The destination image. It will have the same size and the same type as src - /// The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used - /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center - /// The number of times erosion is applied - /// The pixel extrapolation method - /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] -#endif - public static void Erode( - InputArray src, OutputArray dst, InputArray element, - Point? anchor = null, int iterations = 1, - BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - Scalar borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue()); - IntPtr elementPtr = ToPtr(element); - NativeMethods.imgproc_erode(src.CvPtr, dst.CvPtr, elementPtr, anchor0, iterations, (int)borderType, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region MorphologyEx -#if LANG_JP - /// - /// 高度なモルフォロジー変換を行います. - /// - /// 入力画像 - /// src と同じサイズ,同じ型の出力画像 - /// モルフォロジー演算の種類 - /// 構造要素 - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します. - /// 収縮と膨張が適用される回数. [既定値は1] - /// ピクセル外挿手法. [既定値はBorderType.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()] -#else - /// - /// Performs advanced morphological transformations - /// - /// Source image - /// Destination image. It will have the same size and the same type as src - /// Type of morphological operation - /// Structuring element - /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center - /// Number of times erosion and dilation are applied. [By default this is 1] - /// The pixel extrapolation method. [By default this is BorderType.Constant] - /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] -#endif - public static void MorphologyEx( - InputArray src, OutputArray dst, MorphTypes op, InputArray element, - Point? anchor = null, int iterations = 1, - BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1)); - Scalar borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue()); - IntPtr elementPtr = ToPtr(element); - NativeMethods.imgproc_morphologyEx(src.CvPtr, dst.CvPtr, (int)op, elementPtr, anchor0, iterations, (int)borderType, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Resize - /// - /// Resizes an image. - /// - /// input image. - /// output image; it has the size dsize (when it is non-zero) or the size computed - /// from src.size(), fx, and fy; the type of dst is the same as of src. - /// output image size; if it equals zero, it is computed as: - /// dsize = Size(round(fx*src.cols), round(fy*src.rows)) - /// Either dsize or both fx and fy must be non-zero. - /// scale factor along the horizontal axis; when it equals 0, - /// it is computed as: (double)dsize.width/src.cols - /// scale factor along the vertical axis; when it equals 0, - /// it is computed as: (double)dsize.height/src.rows - /// interpolation method - public static void Resize(InputArray src, OutputArray dst, Size dsize, - double fx = 0, double fy = 0, InterpolationFlags interpolation = InterpolationFlags.Linear) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_resize(src.CvPtr, dst.CvPtr, dsize, fx, fy, (int)interpolation); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region WarpAffine - /// - /// Applies an affine transformation to an image. - /// - /// input image. - /// output image that has the size dsize and the same type as src. - /// 2x3 transformation matrix. - /// size of the output image. - /// combination of interpolation methods and the optional flag - /// WARP_INVERSE_MAP that means that M is the inverse transformation (dst -> src) . - /// pixel extrapolation method; when borderMode=BORDER_TRANSPARENT, - /// it means that the pixels in the destination image corresponding to the "outliers" - /// in the source image are not modified by the function. - /// value used in case of a constant border; by default, it is 0. - public static void WarpAffine( - InputArray src, OutputArray dst, InputArray m, Size dsize, - InterpolationFlags flags = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - m.ThrowIfDisposed(); - Scalar borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); - NativeMethods.imgproc_warpAffine(src.CvPtr, dst.CvPtr, m.CvPtr, dsize, (int)flags, (int)borderMode, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region WarpPerspective -#if LANG_JP - /// - /// 画像の透視変換を行います. - /// - /// 入力画像 - /// サイズが dsize で src と同じタイプの出力画像 - /// 3x3 の変換行列 - /// 出力画像のサイズ - /// 補間手法 - /// ピクセル外挿手法. - /// borderMode=BORDER_TRANSPARENT の場合,入力画像中の「はずれ値」に対応する - /// 出力画像中のピクセルが,この関数では変更されないことを意味します - /// 定数境界モードで利用されるピクセル値. -#else - /// - /// Applies a perspective transformation to an image. - /// - /// input image. - /// output image that has the size dsize and the same type as src. - /// 3x3 transformation matrix. - /// size of the output image. - /// combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) - /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). - /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). - /// value used in case of a constant border; by default, it equals 0. -#endif - public static void WarpPerspective( - InputArray src, OutputArray dst, InputArray m, Size dsize, - InterpolationFlags flags = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, - Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - m.ThrowIfDisposed(); - Scalar borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); - NativeMethods.imgproc_warpPerspective_MisInputArray( - src.CvPtr, dst.CvPtr, m.CvPtr, dsize, (int)flags, (int)borderMode, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - } + /// + /// Computes convex hull for a set of 2D points. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of points that form + /// the hull (must have the same type as the input points). + public static Point[] ConvexHull(IEnumerable points, bool clockwise = false) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); -#if LANG_JP - /// - /// 画像の透視変換を行います. - /// - /// 入力画像 - /// サイズが dsize で src と同じタイプの出力画像 - /// 3x3 の変換行列 - /// 出力画像のサイズ - /// 補間手法 - /// ピクセル外挿手法. - /// borderMode=BORDER_TRANSPARENT の場合,入力画像中の「はずれ値」に対応する - /// 出力画像中のピクセルが,この関数では変更されないことを意味します - /// 定数境界モードで利用されるピクセル値. -#else - /// - /// Applies a perspective transformation to an image. - /// - /// input image. - /// output image that has the size dsize and the same type as src. - /// 3x3 transformation matrix. - /// size of the output image. - /// combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) - /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). - /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). - /// value used in case of a constant border; by default, it equals 0. -#endif - public static void WarpPerspective( - InputArray src, OutputArray dst, float[,] m, Size dsize, - InterpolationFlags flags = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, - Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - Scalar borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); - int mRow = m.GetLength(0); - int mCol = m.GetLength(1); - NativeMethods.imgproc_warpPerspective_MisArray( - src.CvPtr, dst.CvPtr, m, mRow, mCol, dsize, (int)flags, (int)borderMode, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Remap - /// - /// Applies a generic geometrical transformation to an image. - /// - /// Source image. - /// Destination image. It has the same size as map1 and the same type as src - /// The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2. - /// The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively. - /// Interpolation method. The method INTER_AREA is not supported by this function. - /// Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, - /// it means that the pixels in the destination image that corresponds to the "outliers" in - /// the source image are not modified by the function. - /// Value used in case of a constant border. By default, it is 0. - public static void Remap( - InputArray src, OutputArray dst, InputArray map1, InputArray map2, - InterpolationFlags interpolation = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (map1 == null) - throw new ArgumentNullException(nameof(map1)); - if (map2 == null) - throw new ArgumentNullException(nameof(map2)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - map1.ThrowIfDisposed(); - map2.ThrowIfDisposed(); - Scalar borderValue0 = borderValue.GetValueOrDefault(Scalar.All(0)); - NativeMethods.imgproc_remap(src.CvPtr, dst.CvPtr, map1.CvPtr, map2.CvPtr, (int)interpolation, (int)borderMode, borderValue0); - GC.KeepAlive(src); - dst.Fix(); - GC.KeepAlive(map1); - GC.KeepAlive(map2); - } - #endregion - #region ConvertMaps - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void ConvertMaps(InputArray map1, InputArray map2, OutputArray dstmap1, OutputArray dstmap2, MatType dstmap1Type, bool nnInterpolation = false) - { - if (map1 == null) - throw new ArgumentNullException(nameof(map1)); - if (map2 == null) - throw new ArgumentNullException(nameof(map2)); - if (dstmap1 == null) - throw new ArgumentNullException(nameof(dstmap1)); - if (dstmap2 == null) - throw new ArgumentNullException(nameof(dstmap2)); - map1.ThrowIfDisposed(); - map2.ThrowIfDisposed(); - dstmap1.ThrowIfDisposed(); - dstmap2.ThrowIfDisposed(); - NativeMethods.imgproc_convertMaps(map1.CvPtr, map2.CvPtr, dstmap1.CvPtr, dstmap2.CvPtr, dstmap1Type, nnInterpolation ? 1 : 0); - GC.KeepAlive(map1); - GC.KeepAlive(map2); - dstmap1.Fix(); - dstmap2.Fix(); - } - #endregion - - #region GetRotationMatrix2D - /// - /// - /// - /// - /// - /// - /// - public static Mat GetRotationMatrix2D(Point2f center, double angle, double scale) - { - IntPtr ret = NativeMethods.imgproc_getRotationMatrix2D(center, angle, scale); - return new Mat(ret); + using var hullVec = new VectorOfPoint(); + NativeMethods.HandleException( + NativeMethods.imgproc_convexHull_Point_ReturnsPoints( + pointsArray, pointsArray.Length, hullVec.CvPtr, clockwise ? 1 : 0)); - } - #endregion - #region InvertAffineTransform - /// - /// Inverts an affine transformation. - /// - /// Original affine transformation. - /// Output reverse affine transformation. - public static void InvertAffineTransform(InputArray m, OutputArray im) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - if (im == null) - throw new ArgumentNullException(nameof(im)); - m.ThrowIfDisposed(); - im.ThrowIfNotReady(); - NativeMethods.imgproc_invertAffineTransform(m.CvPtr, im.CvPtr); - GC.KeepAlive(m); - im.Fix(); - } - #endregion - #region GetPerspectiveTransform - /// - /// - /// - /// - /// - /// - public static Mat GetPerspectiveTransform(IEnumerable src, IEnumerable dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - Point2f[] srcArray = EnumerableEx.ToArray(src); - Point2f[] dstArray = EnumerableEx.ToArray(dst); - IntPtr ret = NativeMethods.imgproc_getPerspectiveTransform1(srcArray, dstArray); - return new Mat(ret); - } - /// - /// - /// - /// - /// - /// - public static Mat GetPerspectiveTransform(InputArray src, InputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - IntPtr ret = NativeMethods.imgproc_getPerspectiveTransform2(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - GC.KeepAlive(dst); - return new Mat(ret); - } - #endregion - #region GetAffineTransform - /// - /// - /// - /// - /// - /// - public static Mat GetAffineTransform(IEnumerable src, IEnumerable dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - Point2f[] srcArray = EnumerableEx.ToArray(src); - Point2f[] dstArray = EnumerableEx.ToArray(dst); - IntPtr ret = NativeMethods.imgproc_getAffineTransform1(srcArray, dstArray); - return new Mat(ret); - } + return hullVec.ToArray(); + } - /// - /// - /// - /// - /// - /// - public static Mat GetAffineTransform(InputArray src, InputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - IntPtr ret = NativeMethods.imgproc_getAffineTransform2(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - GC.KeepAlive(dst); - return new Mat(ret); - } - #endregion - - #region GetRectSubPix - /// - /// Retrieves a pixel rectangle from an image with sub-pixel accuracy. - /// - /// Source image. - /// Size of the extracted patch. - /// Floating point coordinates of the center of the extracted rectangle - /// within the source image. The center must be inside the image. - /// Extracted patch that has the size patchSize and the same number of channels as src . - /// Depth of the extracted pixels. By default, they have the same depth as src. - public static void GetRectSubPix(InputArray image, Size patchSize, Point2f center, - OutputArray patch, int patchType = -1) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (patch == null) - throw new ArgumentNullException(nameof(patch)); - image.ThrowIfDisposed(); - patch.ThrowIfNotReady(); - NativeMethods.imgproc_getRectSubPix(image.CvPtr, patchSize, center, patch.CvPtr, patchType); - GC.KeepAlive(image); - patch.Fix(); - } - #endregion - - /// - /// Remaps an image to log-polar space. - /// - /// Source image - /// Destination image - /// The transformation center; where the output precision is maximal - /// Magnitude scale parameter. - /// A combination of interpolation methods, see cv::InterpolationFlags - public static void LogPolar( - InputArray src, OutputArray dst, - Point2f center, double m, InterpolationFlags flags) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); + /// + /// Computes convex hull for a set of 2D points. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of points that form + /// the hull (must have the same type as the input points). + public static Point2f[] ConvexHull(IEnumerable points, bool clockwise = false) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + using var hullVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_convexHull_Point2f_ReturnsPoints( + pointsArray, pointsArray.Length, hullVec.CvPtr, clockwise ? 1 : 0)); + return hullVec.ToArray(); + } - NativeMethods.imgproc_logPolar(src.CvPtr, dst.CvPtr, center, m, (int)flags); + /// + /// Computes convex hull for a set of 2D points. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of 0-based point indices of the + /// hull points in the original array (since the set of convex hull points is a subset of the original point set). + public static int[] ConvexHullIndices(IEnumerable points, bool clockwise = false) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + using var hullVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.imgproc_convexHull_Point_ReturnsIndices( + pointsArray, pointsArray.Length, hullVec.CvPtr, clockwise ? 1 : 0)); + return hullVec.ToArray(); + } - GC.KeepAlive(src); - dst.Fix(); - } + /// + /// Computes convex hull for a set of 2D points. + /// + /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of 0-based point indices of the + /// hull points in the original array (since the set of convex hull points is a subset of the original point set). + public static int[] ConvexHullIndices(IEnumerable points, bool clockwise = false) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + using var hullVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.imgproc_convexHull_Point2f_ReturnsIndices( + pointsArray, pointsArray.Length, hullVec.CvPtr, clockwise ? 1 : 0)); + return hullVec.ToArray(); + } - /// - /// Remaps an image to polar space. - /// - /// Source image - /// Destination image - /// The transformation center - /// Inverse magnitude scale parameter - /// A combination of interpolation methods, see cv::InterpolationFlags - public static void LinearPolar( - InputArray src, OutputArray dst, - Point2f center, double maxRadius, InterpolationFlags flags) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); + /// + /// Computes the contour convexity defects + /// + /// Input contour. + /// Convex hull obtained using convexHull() that + /// should contain indices of the contour points that make the hull. + /// + /// The output vector of convexity defects. + /// Each convexity defect is represented as 4-element integer vector + /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), + /// where indices are 0-based indices in the original contour of the convexity defect beginning, + /// end and the farthest point, and fixpt_depth is fixed-point approximation + /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. + /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. + /// + public static void ConvexityDefects(InputArray contour, InputArray convexHull, OutputArray convexityDefects) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + if (convexHull is null) + throw new ArgumentNullException(nameof(convexHull)); + if (convexityDefects is null) + throw new ArgumentNullException(nameof(convexityDefects)); + contour.ThrowIfDisposed(); + convexHull.ThrowIfDisposed(); + convexityDefects.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_convexityDefects_InputArray(contour.CvPtr, convexHull.CvPtr, convexityDefects.CvPtr)); + + GC.KeepAlive(contour); + GC.KeepAlive(convexHull); + GC.KeepAlive(convexityDefects); + convexityDefects.Fix(); + } - NativeMethods.imgproc_linearPolar(src.CvPtr, dst.CvPtr, center, maxRadius, (int)flags); + /// + /// Computes the contour convexity defects + /// + /// Input contour. + /// Convex hull obtained using convexHull() that + /// should contain indices of the contour points that make the hull. + /// The output vector of convexity defects. + /// Each convexity defect is represented as 4-element integer vector + /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), + /// where indices are 0-based indices in the original contour of the convexity defect beginning, + /// end and the farthest point, and fixpt_depth is fixed-point approximation + /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. + /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. + public static Vec4i[] ConvexityDefects(IEnumerable contour, IEnumerable convexHull) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + if (convexHull is null) + throw new ArgumentNullException(nameof(convexHull)); + + var contourArray = contour.ToArray(); + var convexHullArray = convexHull.ToArray(); + using var convexityDefectsVec = new VectorOfVec4i(); + NativeMethods.HandleException( + NativeMethods.imgproc_convexityDefects_Point( + contourArray, contourArray.Length, + convexHullArray, convexHullArray.Length, convexityDefectsVec.CvPtr)); + + return convexityDefectsVec.ToArray(); + } - GC.KeepAlive(src); - dst.Fix(); - } + /// + /// Computes the contour convexity defects + /// + /// Input contour. + /// Convex hull obtained using convexHull() that + /// should contain indices of the contour points that make the hull. + /// The output vector of convexity defects. + /// Each convexity defect is represented as 4-element integer vector + /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), + /// where indices are 0-based indices in the original contour of the convexity defect beginning, + /// end and the farthest point, and fixpt_depth is fixed-point approximation + /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. + /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. + public static Vec4i[] ConvexityDefects(IEnumerable contour, IEnumerable convexHull) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + if (convexHull is null) + throw new ArgumentNullException(nameof(convexHull)); + + var contourArray = contour.ToArray(); + var convexHullArray = convexHull.ToArray(); + using var convexityDefectsVec = new VectorOfVec4i(); + NativeMethods.HandleException( + NativeMethods.imgproc_convexityDefects_Point2f( + contourArray, contourArray.Length, + convexHullArray, convexHullArray.Length, convexityDefectsVec.CvPtr)); + return convexityDefectsVec.ToArray(); + } - #region Integral - /// - /// - /// - /// - /// - /// - public static void Integral(InputArray src, OutputArray sum, int sdepth = -1) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (sum == null) - throw new ArgumentNullException(nameof(sum)); - src.ThrowIfDisposed(); - sum.ThrowIfNotReady(); - NativeMethods.imgproc_integral1(src.CvPtr, sum.CvPtr, sdepth); - GC.KeepAlive(src); - sum.Fix(); - } - /// - /// - /// - /// - /// - /// - /// - public static void Integral(InputArray src, OutputArray sum, OutputArray sqsum, int sdepth = -1) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (sum == null) - throw new ArgumentNullException(nameof(sum)); - if (sqsum == null) - throw new ArgumentNullException(nameof(sqsum)); - src.ThrowIfDisposed(); - sum.ThrowIfNotReady(); - sqsum.ThrowIfNotReady(); - NativeMethods.imgproc_integral2(src.CvPtr, sum.CvPtr, sqsum.CvPtr, sdepth); - GC.KeepAlive(src); - sum.Fix(); - sqsum.Fix(); - } - /// - /// - /// - /// - /// - /// - /// - /// - public static void Integral(InputArray src, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth = -1) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (sum == null) - throw new ArgumentNullException(nameof(sum)); - if (sqsum == null) - throw new ArgumentNullException(nameof(sqsum)); - if (tilted == null) - throw new ArgumentNullException(nameof(tilted)); - src.ThrowIfDisposed(); - sum.ThrowIfNotReady(); - sqsum.ThrowIfNotReady(); - tilted.ThrowIfNotReady(); - NativeMethods.imgproc_integral3(src.CvPtr, sum.CvPtr, sqsum.CvPtr, tilted.CvPtr, sdepth); - GC.KeepAlive(src); - sum.Fix(); - sqsum.Fix(); - tilted.Fix(); - } - #endregion - #region Accumulate* - /// - /// Adds an image to the accumulator. - /// - /// Input image as 1- or 3-channel, 8-bit or 32-bit floating point. - /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. - /// Optional operation mask. - public static void Accumulate(InputArray src, InputOutputArray dst, InputArray mask) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_accumulate(src.CvPtr, dst.CvPtr, ToPtr(mask)); - GC.KeepAlive(src); - dst.Fix(); - } - /// - /// Adds the square of a source image to the accumulator. - /// - /// Input image as 1- or 3-channel, 8-bit or 32-bit floating point. - /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. - /// Optional operation mask. - public static void AccumulateSquare(InputArray src, InputOutputArray dst, InputArray mask) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_accumulateSquare(src.CvPtr, dst.CvPtr, ToPtr(mask)); - GC.KeepAlive(src); - dst.Fix(); - } - /// - /// Adds the per-element product of two input images to the accumulator. - /// - /// First input image, 1- or 3-channel, 8-bit or 32-bit floating point. - /// Second input image of the same type and the same size as src1 - /// Accumulator with the same number of channels as input images, 32-bit or 64-bit floating-point. - /// Optional operation mask. - public static void AccumulateProduct(InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_accumulateProduct(src1.CvPtr, src2.CvPtr, dst.CvPtr, ToPtr(mask)); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - dst.Fix(); - } - /// - /// Updates a running average. - /// - /// Input image as 1- or 3-channel, 8-bit or 32-bit floating point. - /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. - /// Weight of the input image. - /// Optional operation mask. - public static void AccumulateWeighted(InputArray src, InputOutputArray dst, double alpha, InputArray mask) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_accumulateWeighted(src.CvPtr, dst.CvPtr, alpha, ToPtr(mask)); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region PSNR - /// - /// - /// - /// - /// - /// -// ReSharper disable once InconsistentNaming - public static double PSNR(InputArray src1, InputArray src2) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_PSNR(src1.CvPtr, src2.CvPtr); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - return ret; - } - #endregion - #region PhaseCorrelate - /// - /// - /// - /// - /// - /// - /// - public static Point2d PhaseCorrelate(InputArray src1, InputArray src2, - InputArray window = null) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_phaseCorrelate(src1.CvPtr, src2.CvPtr, ToPtr(window)); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - return ret; - } - #endregion - #region PhaseCorrelateRes - /// - /// - /// - /// - /// - /// - /// - public static Point2d PhaseCorrelateRes(InputArray src1, InputArray src2, InputArray window) - { - double response; - return PhaseCorrelateRes(src1, src2, window, out response); - } - /// - /// - /// - /// - /// - /// - /// - /// - public static Point2d PhaseCorrelateRes(InputArray src1, InputArray src2, - InputArray window, out double response) - { - if (src1 == null) - throw new ArgumentNullException(nameof(src1)); - if (src2 == null) - throw new ArgumentNullException(nameof(src2)); - if (window == null) - throw new ArgumentNullException(nameof(src2)); - src1.ThrowIfDisposed(); - src2.ThrowIfDisposed(); - window.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_phaseCorrelateRes(src1.CvPtr, src2.CvPtr, window.CvPtr, out response); - GC.KeepAlive(src1); - GC.KeepAlive(src2); - GC.KeepAlive(window); - return ret; - } - #endregion - #region CreateHanningWindow - /// - /// Computes a Hanning window coefficients in two dimensions. - /// - /// Destination array to place Hann coefficients in - /// The window size specifications - /// Created array type - public static void CreateHanningWindow(InputOutputArray dst, Size winSize, MatType type) - { - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_createHanningWindow(dst.CvPtr, winSize, type); - dst.Fix(); - } - #endregion - #region Threshold - /// - /// Applies a fixed-level threshold to each array element. - /// - /// input array (single-channel, 8-bit or 32-bit floating point). - /// output array of the same size and type as src. - /// threshold value. - /// maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. - /// thresholding type (see the details below). - /// the computed threshold value when type == OTSU - public static double Threshold(InputArray src, OutputArray dst, double thresh, double maxval, ThresholdTypes type) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - double ret = NativeMethods.imgproc_threshold(src.CvPtr, dst.CvPtr, thresh, maxval, (int)type); - GC.KeepAlive(src); - dst.Fix(); - return ret; - } - #endregion - #region AdaptiveThreshold - /// - /// Applies an adaptive threshold to an array. - /// - /// Source 8-bit single-channel image. - /// Destination image of the same size and the same type as src . - /// Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. - /// Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C . - /// Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV . - /// Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. - /// Constant subtracted from the mean or weighted mean (see the details below). - /// Normally, it is positive but may be zero or negative as well. - public static void AdaptiveThreshold(InputArray src, OutputArray dst, - double maxValue, AdaptiveThresholdTypes adaptiveMethod, ThresholdTypes thresholdType, int blockSize, double c) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_adaptiveThreshold(src.CvPtr, dst.CvPtr, maxValue, (int)adaptiveMethod, (int)thresholdType, blockSize, c); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region PyrDown/Up - /// - /// Blurs an image and downsamples it. - /// - /// input image. - /// output image; it has the specified size and the same type as src. - /// size of the output image; by default, it is computed as Size((src.cols+1)/2 - /// - public static void PyrDown(InputArray src, OutputArray dst, - Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - Size dstSize0 = dstSize.GetValueOrDefault(new Size()); - NativeMethods.imgproc_pyrDown(src.CvPtr, dst.CvPtr, dstSize0, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - /// - /// Upsamples an image and then blurs it. - /// - /// input image. - /// output image. It has the specified size and the same type as src. - /// size of the output image; by default, it is computed as Size(src.cols*2, (src.rows*2) - /// - public static void PyrUp(InputArray src, OutputArray dst, - Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - Size dstSize0 = dstSize.GetValueOrDefault(new Size()); - NativeMethods.imgproc_pyrUp(src.CvPtr, dst.CvPtr, dstSize0, (int)borderType); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Undistort - /// - /// corrects lens distortion for the given camera matrix and distortion coefficients - /// - /// Input (distorted) image. - /// Output (corrected) image that has the same size and type as src . - /// Input camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, - /// or 8 elements. If the vector is null, the zero distortion coefficients are assumed. - /// Camera matrix of the distorted image. - /// By default, it is the same as cameraMatrix but you may additionally scale - /// and shift the result by using a different matrix. - public static void Undistort(InputArray src, OutputArray dst, - InputArray cameraMatrix, - InputArray distCoeffs, - InputArray newCameraMatrix = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - cameraMatrix.ThrowIfDisposed(); - NativeMethods.imgproc_undistort(src.CvPtr, dst.CvPtr, cameraMatrix.CvPtr, - ToPtr(distCoeffs), ToPtr(newCameraMatrix)); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region InitUndistortRectifyMap - /// - /// initializes maps for cv::remap() to correct lens distortion and optionally rectify the image - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void InitUndistortRectifyMap( - InputArray cameraMatrix, InputArray distCoeffs, - InputArray r, InputArray newCameraMatrix, - Size size, MatType m1Type, OutputArray map1, OutputArray map2) - { - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (distCoeffs == null) - throw new ArgumentNullException(nameof(distCoeffs)); - if (r == null) - throw new ArgumentNullException(nameof(r)); - if (newCameraMatrix == null) - throw new ArgumentNullException(nameof(newCameraMatrix)); - if (map1 == null) - throw new ArgumentNullException(nameof(map1)); - if (map2 == null) - throw new ArgumentNullException(nameof(map2)); - cameraMatrix.ThrowIfDisposed(); - distCoeffs.ThrowIfDisposed(); - r.ThrowIfDisposed(); - newCameraMatrix.ThrowIfDisposed(); - map1.ThrowIfNotReady(); - map2.ThrowIfNotReady(); - NativeMethods.imgproc_initUndistortRectifyMap( - cameraMatrix.CvPtr, distCoeffs.CvPtr, r.CvPtr, newCameraMatrix.CvPtr, size, m1Type, map1.CvPtr, map2.CvPtr); - GC.KeepAlive(cameraMatrix); - GC.KeepAlive(distCoeffs); - GC.KeepAlive(r); - GC.KeepAlive(newCameraMatrix); - map1.Fix(); - map2.Fix(); - } - #endregion - #region InitWideAngleProjMap - /// - /// initializes maps for cv::remap() for wide-angle - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static float InitWideAngleProjMap( - InputArray cameraMatrix, InputArray distCoeffs, - Size imageSize, int destImageWidth, MatType m1Type, - OutputArray map1, OutputArray map2, - ProjectionType projType, double alpha = 0) - { - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - if (distCoeffs == null) - throw new ArgumentNullException(nameof(distCoeffs)); - if (map1 == null) - throw new ArgumentNullException(nameof(map1)); - if (map2 == null) - throw new ArgumentNullException(nameof(map2)); - cameraMatrix.ThrowIfDisposed(); - distCoeffs.ThrowIfDisposed(); - map1.ThrowIfNotReady(); - map2.ThrowIfNotReady(); - float ret = NativeMethods.imgproc_initWideAngleProjMap(cameraMatrix.CvPtr, distCoeffs.CvPtr, imageSize, - destImageWidth, m1Type, map1.CvPtr, map2.CvPtr, (int)projType, alpha); - GC.KeepAlive(cameraMatrix); - GC.KeepAlive(distCoeffs); - map1.Fix(); - map2.Fix(); - return ret; - } - #endregion - #region GetDefaultNewCameraMatrix - /// - /// returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true) - /// - /// Input camera matrix. - /// Camera view image size in pixels. - /// Location of the principal point in the new camera matrix. - /// The parameter indicates whether this location should be at the image center or not. - /// the camera matrix that is either an exact copy of the input cameraMatrix - /// (when centerPrinicipalPoint=false), or the modified one (when centerPrincipalPoint=true). - public static Mat GetDefaultNewCameraMatrix( - InputArray cameraMatrix, Size? imgSize = null, bool centerPrincipalPoint = false) - { - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - cameraMatrix.ThrowIfDisposed(); - Size imgSize0 = imgSize.GetValueOrDefault(new Size()); - IntPtr matPtr = NativeMethods.imgproc_getDefaultNewCameraMatrix(cameraMatrix.CvPtr, imgSize0, centerPrincipalPoint ? 1 : 0); - GC.KeepAlive(cameraMatrix); - return new Mat(matPtr); - } - #endregion - #region UndistortPoints - /// - /// Computes the ideal point coordinates from the observed point coordinates. - /// - /// Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). - /// Output ideal point coordinates after undistortion and reverse perspective transformation. - /// If matrix P is identity or omitted, dst will contain normalized point coordinates. - /// Camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Rectification transformation in the object space (3x3 matrix). - /// R1 or R2 computed by stereoRectify() can be passed here. - /// If the matrix is empty, the identity transformation is used. - /// New camera matrix (3x3) or new projection matrix (3x4). - /// P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, - /// the identity new camera matrix is used. - public static void UndistortPoints( - InputArray src, OutputArray dst, - InputArray cameraMatrix, InputArray distCoeffs, - InputArray r = null, InputArray p = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (cameraMatrix == null) - throw new ArgumentNullException(nameof(cameraMatrix)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - cameraMatrix.ThrowIfDisposed(); - NativeMethods.imgproc_undistortPoints(src.CvPtr, dst.CvPtr, cameraMatrix.CvPtr, - ToPtr(distCoeffs), ToPtr(r), ToPtr(p)); - GC.KeepAlive(src); - GC.KeepAlive(cameraMatrix); - GC.KeepAlive(r); - GC.KeepAlive(p); - dst.Fix(); - } - #endregion - #region CalcHist - /// - /// computes the joint dense histogram for a set of images. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void CalcHist(Mat[] images, - int[] channels, InputArray mask, - OutputArray hist, int dims, int[] histSize, - Rangef[] ranges, bool uniform = true, bool accumulate = false) - { - if (ranges == null) - throw new ArgumentNullException(nameof(ranges)); - float[][] rangesFloat = EnumerableEx.SelectToArray( - ranges, r => new [] {r.Start, r.End}); - CalcHist(images, channels, mask, hist, dims, - histSize, rangesFloat, uniform, accumulate); - } + /// + /// returns true if the contour is convex. + /// Does not support contours with self-intersection + /// + /// Input vector of 2D points + /// + public static bool IsContourConvex(InputArray contour) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + contour.ThrowIfDisposed(); - /// - /// computes the joint dense histogram for a set of images. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void CalcHist(Mat[] images, - int[] channels, InputArray mask, - OutputArray hist, int dims, int[] histSize, - float[][] ranges, bool uniform = true, bool accumulate = false) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (channels == null) - throw new ArgumentNullException(nameof(channels)); - if (hist == null) - throw new ArgumentNullException(nameof(hist)); - if (histSize == null) - throw new ArgumentNullException(nameof(histSize)); - if (ranges == null) - throw new ArgumentNullException(nameof(ranges)); - hist.ThrowIfNotReady(); - - IntPtr[] imagesPtr = EnumerableEx.SelectPtrs(images); - using (var rangesPtr = new ArrayAddress2(ranges)) - { - NativeMethods.imgproc_calcHist1(imagesPtr, images.Length, channels, ToPtr(mask), hist.CvPtr, - dims, histSize, rangesPtr, uniform ? 1 : 0, accumulate ? 1 : 0); - } - GC.KeepAlive(images); - GC.KeepAlive(mask); - hist.Fix(); - } - #endregion - #region CalcBackProject - /// - /// computes the joint dense histogram for a set of images. - /// - /// - /// - /// - /// - /// - /// - public static void CalcBackProject(Mat[] images, - int[] channels, InputArray hist, OutputArray backProject, - Rangef[] ranges, bool uniform = true) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (channels == null) - throw new ArgumentNullException(nameof(channels)); - if (hist == null) - throw new ArgumentNullException(nameof(hist)); - if (backProject == null) - throw new ArgumentNullException(nameof(backProject)); - if (ranges == null) - throw new ArgumentNullException(nameof(ranges)); - hist.ThrowIfDisposed(); - backProject.ThrowIfNotReady(); - - IntPtr[] imagesPtr = EnumerableEx.SelectPtrs(images); - float[][] rangesFloat = EnumerableEx.SelectToArray( - ranges, r => new [] {r.Start, r.End}); - using (var rangesPtr = new ArrayAddress2(rangesFloat)) - { - NativeMethods.imgproc_calcBackProject(imagesPtr, images.Length, channels, hist.CvPtr, - backProject.CvPtr, rangesPtr, uniform ? 1 : 0); - } - GC.KeepAlive(images); - GC.KeepAlive(hist); - backProject.Fix(); - } - #endregion - #region CompareHist - /// - /// compares two histograms stored in dense arrays - /// - /// The first compared histogram - /// The second compared histogram of the same size as h1 - /// The comparison method - /// - public static double CompareHist(InputArray h1, InputArray h2, HistCompMethods method) - { - if (h1 == null) - throw new ArgumentNullException(nameof(h1)); - if (h2 == null) - throw new ArgumentNullException(nameof(h2)); - h1.ThrowIfDisposed(); - h2.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_compareHist1(h1.CvPtr, h2.CvPtr, (int)method); - GC.KeepAlive(h1); - GC.KeepAlive(h2); - return ret; - } - #endregion - #region EqualizeHist - /// - /// normalizes the grayscale image brightness and contrast by normalizing its histogram - /// - /// The source 8-bit single channel image - /// The destination image; will have the same size and the same type as src - public static void EqualizeHist(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_equalizeHist(src.CvPtr, dst.CvPtr); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region CreateCLAHE - /// - /// Creates a predefined CLAHE object - /// - /// - /// - /// - public static CLAHE CreateCLAHE(double clipLimit = 40.0, Size? tileGridSize = null) - { - return CLAHE.Create(clipLimit, tileGridSize); - } - #endregion - #region EMD - /// - /// - /// - /// - /// - /// - /// - - public static float EMD(InputArray signature1, InputArray signature2, DistanceTypes distType) - { - float lowerBound; - return EMD(signature1, signature1, distType, null, out lowerBound, null); - } - /// - /// - /// - /// - /// - /// - /// - /// - public static float EMD(InputArray signature1, InputArray signature2, - DistanceTypes distType, InputArray cost) - { - float lowerBound; - return EMD(signature1, signature1, distType, cost, out lowerBound, null); - } - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static float EMD(InputArray signature1, InputArray signature2, - DistanceTypes distType, InputArray cost, out float lowerBound) - { - return EMD(signature1, signature1, distType, cost, out lowerBound, null); - } - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static float EMD(InputArray signature1, InputArray signature2, - DistanceTypes distType, InputArray cost, out float lowerBound, OutputArray flow) - { - if (signature1 == null) - throw new ArgumentNullException(nameof(signature1)); - if (signature2 == null) - throw new ArgumentNullException(nameof(signature2)); - signature1.ThrowIfDisposed(); - signature2.ThrowIfDisposed(); - float ret = NativeMethods.imgproc_EMD(signature1.CvPtr, signature2.CvPtr, (int)distType, ToPtr(cost), out lowerBound, ToPtr(flow)); - GC.KeepAlive(signature1); - GC.KeepAlive(signature2); - GC.KeepAlive(cost); - if(flow != null) - flow.Fix(); - return ret; - } - #endregion - #region Watershed - /// - /// Performs a marker-based image segmentation using the watershed algorithm. - /// - /// Input 8-bit 3-channel image. - /// Input/output 32-bit single-channel image (map) of markers. - /// It should have the same size as image. - public static void Watershed(InputArray image, InputOutputArray markers) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (markers == null) - throw new ArgumentNullException(nameof(markers)); - image.ThrowIfDisposed(); - markers.ThrowIfNotReady(); - NativeMethods.imgproc_watershed(image.CvPtr, markers.CvPtr); - GC.KeepAlive(image); - markers.Fix(); - } - #endregion - #region PyrMeanShiftFiltering - /// - /// Performs initial step of meanshift segmentation of an image. - /// - /// The source 8-bit, 3-channel image. - /// The destination image of the same format and the same size as the source. - /// The spatial window radius. - /// The color window radius. - /// Maximum level of the pyramid for the segmentation. - /// Termination criteria: when to stop meanshift iterations. - public static void PyrMeanShiftFiltering(InputArray src, OutputArray dst, - double sp, double sr, int maxLevel = 1, TermCriteria? termcrit = null) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - TermCriteria termcrit0 = termcrit.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 5, 1)); - NativeMethods.imgproc_pyrMeanShiftFiltering(src.CvPtr, dst.CvPtr, sp, sr, maxLevel, termcrit0); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region GrabCut - /// - /// Segments the image using GrabCut algorithm - /// - /// Input 8-bit 3-channel image. - /// Input/output 8-bit single-channel mask. - /// The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. - /// Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD - /// ROI containing a segmented object. The pixels outside of the ROI are - /// marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT. - /// Temporary array for the background model. Do not modify it while you are processing the same image. - /// Temporary arrays for the foreground model. Do not modify it while you are processing the same image. - /// Number of iterations the algorithm should make before returning the result. - /// Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL . - /// Operation mode that could be one of GrabCutFlag value. - public static void GrabCut(InputArray img, InputOutputArray mask, Rect rect, - InputOutputArray bgdModel, InputOutputArray fgdModel, - int iterCount, GrabCutModes mode) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (mask == null) - throw new ArgumentNullException(nameof(mask)); - if (bgdModel == null) - throw new ArgumentNullException(nameof(bgdModel)); - if (fgdModel == null) - throw new ArgumentNullException(nameof(fgdModel)); - img.ThrowIfDisposed(); - mask.ThrowIfNotReady(); - bgdModel.ThrowIfNotReady(); - fgdModel.ThrowIfNotReady(); - NativeMethods.imgproc_grabCut(img.CvPtr, mask.CvPtr, rect, - bgdModel.CvPtr, fgdModel.CvPtr, iterCount, (int)mode); - GC.KeepAlive(img); - mask.Fix(); - bgdModel.Fix(); - fgdModel.Fix(); - } - #endregion - #region DistanceTransform - /// - /// builds the discrete Voronoi diagram - /// - /// - /// - /// - /// - /// - /// - public static void DistanceTransformWithLabels(InputArray src, - OutputArray dst, - OutputArray labels, - DistanceTypes distanceType, - DistanceMaskSize maskSize, - DistanceTransformLabelTypes labelType = DistanceTransformLabelTypes.CComp) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - labels.ThrowIfNotReady(); - NativeMethods.imgproc_distanceTransformWithLabels( - src.CvPtr, dst.CvPtr, labels.CvPtr, (int)distanceType, (int)maskSize, (int)labelType); - GC.KeepAlive(src); - dst.Fix(); - labels.Fix(); - } + NativeMethods.HandleException( + NativeMethods.imgproc_isContourConvex_InputArray(contour.CvPtr, out var ret)); - /// - /// computes the distance transform map - /// - /// - /// - /// - /// - public static void DistanceTransform(InputArray src, - OutputArray dst, - DistanceTypes distanceType, - DistanceMaskSize maskSize) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_distanceTransform( - src.CvPtr, dst.CvPtr, (int)distanceType, (int)maskSize); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region FloodFill - /// - /// Fills a connected component with the given color. - /// - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// Starting point. - /// New value of the repainted domain pixels. - /// - public static int FloodFill(InputOutputArray image, Point seedPoint, Scalar newVal) - { - Rect rect; - return FloodFill(image, seedPoint, newVal, out rect, null, null, FloodFillFlags.Link4); - } + GC.KeepAlive(contour); + return ret != 0; + } - /// - /// Fills a connected component with the given color. - /// - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// Starting point. - /// New value of the repainted domain pixels. - /// Optional output parameter set by the function to the - /// minimum bounding rectangle of the repainted domain. - /// Maximal lower brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Maximal upper brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Operation flags. Lower bits contain a connectivity value, - /// 4 (default) or 8, used within the function. Connectivity determines which - /// neighbors of a pixel are considered. - /// - public static int FloodFill(InputOutputArray image, - Point seedPoint, Scalar newVal, out Rect rect, - Scalar? loDiff = null, Scalar? upDiff = null, - FloodFillFlags flags = FloodFillFlags.Link4) - { - return FloodFill(image, seedPoint, newVal, out rect, loDiff, upDiff, (int)flags); - } + /// + /// returns true if the contour is convex. + /// Does not support contours with self-intersection + /// + /// Input vector of 2D points + /// + public static bool IsContourConvex(IEnumerable contour) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + var contourArray = contour.ToArray(); - /// - /// Fills a connected component with the given color. - /// - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// Starting point. - /// New value of the repainted domain pixels. - /// Optional output parameter set by the function to the - /// minimum bounding rectangle of the repainted domain. - /// Maximal lower brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Maximal upper brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Operation flags. Lower bits contain a connectivity value, - /// 4 (default) or 8, used within the function. Connectivity determines which - /// neighbors of a pixel are considered. - /// - public static int FloodFill(InputOutputArray image, - Point seedPoint, Scalar newVal, out Rect rect, - Scalar? loDiff = null, Scalar? upDiff = null, - int flags = 4) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfNotReady(); - Scalar loDiff0 = loDiff.GetValueOrDefault(new Scalar()); - Scalar upDiff0 = upDiff.GetValueOrDefault(new Scalar()); - int ret = NativeMethods.imgproc_floodFill1(image.CvPtr, seedPoint, newVal, out rect, - loDiff0, upDiff0, (int)flags); - image.Fix(); - return ret; - } + NativeMethods.HandleException( + NativeMethods.imgproc_isContourConvex_Point(contourArray, contourArray.Length, out var ret)); + return ret != 0; + } - /// - /// Fills a connected component with the given color. - /// - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// (For the second function only) Operation mask that should be a single-channel 8-bit image, - /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of - /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, - /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask - /// in multiple calls to the function to make sure the filled area does not overlap. - /// Starting point. - /// New value of the repainted domain pixels. - /// - public static int FloodFill(InputOutputArray image, InputOutputArray mask, - Point seedPoint, Scalar newVal) - { - Rect rect; - return FloodFill(image, mask, seedPoint, newVal, out rect, null, null, FloodFillFlags.Link4); - } + /// + /// returns true if the contour is convex. D + /// oes not support contours with self-intersection + /// + /// Input vector of 2D points + /// + public static bool IsContourConvex(IEnumerable contour) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + var contourArray = contour.ToArray(); - /// - /// Fills a connected component with the given color. - /// - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// (For the second function only) Operation mask that should be a single-channel 8-bit image, - /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of - /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, - /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask - /// in multiple calls to the function to make sure the filled area does not overlap. - /// Starting point. - /// New value of the repainted domain pixels. - /// Optional output parameter set by the function to the - /// minimum bounding rectangle of the repainted domain. - /// Maximal lower brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Maximal upper brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Operation flags. Lower bits contain a connectivity value, - /// 4 (default) or 8, used within the function. Connectivity determines which - /// neighbors of a pixel are considered. - /// - public static int FloodFill(InputOutputArray image, InputOutputArray mask, - Point seedPoint, Scalar newVal, out Rect rect, - Scalar? loDiff = null, Scalar? upDiff = null, - FloodFillFlags flags = FloodFillFlags.Link4) - { - return FloodFill(image, mask, seedPoint, newVal, out rect, loDiff, upDiff, (int)flags); - } + NativeMethods.HandleException( + NativeMethods.imgproc_isContourConvex_Point2f(contourArray, contourArray.Length, out var ret)); + return ret != 0; + } - /// - /// Fills a connected component with the given color. - /// - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// (For the second function only) Operation mask that should be a single-channel 8-bit image, - /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of - /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, - /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask - /// in multiple calls to the function to make sure the filled area does not overlap. - /// Starting point. - /// New value of the repainted domain pixels. - /// Optional output parameter set by the function to the - /// minimum bounding rectangle of the repainted domain. - /// Maximal lower brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Maximal upper brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Operation flags. Lower bits contain a connectivity value, - /// 4 (default) or 8, used within the function. Connectivity determines which - /// neighbors of a pixel are considered. - /// - public static int FloodFill(InputOutputArray image, InputOutputArray mask, - Point seedPoint, Scalar newVal, out Rect rect, - Scalar? loDiff = null, Scalar? upDiff = null, - int flags = 4) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (mask == null) - throw new ArgumentNullException(nameof(mask)); - image.ThrowIfNotReady(); - mask.ThrowIfNotReady(); - Scalar loDiff0 = loDiff.GetValueOrDefault(new Scalar()); - Scalar upDiff0 = upDiff.GetValueOrDefault(new Scalar()); - int ret = NativeMethods.imgproc_floodFill2(image.CvPtr, mask.CvPtr, seedPoint, - newVal, out rect, loDiff0, upDiff0, flags); - image.Fix(); - mask.Fix(); - return ret; - } - #endregion - #region CvtColor -#if LANG_JP - /// - /// 画像の色空間を変換します. - /// - /// 8ビット符号なし整数型,16ビット符号なし整数型,または単精度浮動小数型の入力画像 - /// src と同じサイズ,同じタイプの出力画像 - /// 色空間の変換コード. - /// 出力画像のチャンネル数.この値が 0 の場合,チャンネル数は src と code から自動的に求められます -#else - /// - /// Converts image from one color space to another - /// - /// The source image, 8-bit unsigned, 16-bit unsigned or single-precision floating-point - /// The destination image; will have the same size and the same depth as src - /// The color space conversion code - /// The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code -#endif - public static void CvtColor(InputArray src, OutputArray dst, ColorConversionCodes code, int dstCn = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.imgproc_cvtColor(src.CvPtr, dst.CvPtr, (int)code, dstCn); - GC.KeepAlive(src); - dst.Fix(); - } - #endregion - #region Moments - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (single-channel, 8-bit or floating-point - /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f ) - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public static Moments Moments(InputArray array, bool binaryImage = false) - { - return new Moments(array, binaryImage); - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (8-bit) 2D array - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public static Moments Moments(byte[,] array, bool binaryImage = false) - { - return new Moments(array, binaryImage); - } + /// + /// finds intersection of two convex polygons + /// + /// + /// + /// + /// + /// + public static float IntersectConvexConvex(InputArray p1, InputArray p2, OutputArray p12, bool handleNested = true) + { + if (p1 is null) + throw new ArgumentNullException(nameof(p1)); + if (p2 is null) + throw new ArgumentNullException(nameof(p2)); + if (p12 is null) + throw new ArgumentNullException(nameof(p12)); + p1.ThrowIfDisposed(); + p2.ThrowIfDisposed(); + p12.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_intersectConvexConvex_InputArray( + p1.CvPtr, p2.CvPtr, p12.CvPtr, handleNested ? 1 : 0, out var ret)); + + GC.KeepAlive(p1); + GC.KeepAlive(p2); + GC.KeepAlive(p12); + p12.Fix(); + return ret; + } - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (floating-point) 2D array - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public static Moments Moments(float[,] array, bool binaryImage = false) - { - return new Moments(array, binaryImage); - } + /// + /// finds intersection of two convex polygons + /// + /// + /// + /// + /// + /// + public static float IntersectConvexConvex(IEnumerable p1, IEnumerable p2, + out Point[] p12, bool handleNested = true) + { + if (p1 is null) + throw new ArgumentNullException(nameof(p1)); + if (p2 is null) + throw new ArgumentNullException(nameof(p2)); + var p1Array = p1.ToArray(); + var p2Array = p2.ToArray(); - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// Array of 2D points - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public static Moments Moments(IEnumerable array, bool binaryImage = false) - { - return new Moments(array, binaryImage); - } + using var p12Vec = new VectorOfPoint(); + NativeMethods.HandleException( + NativeMethods.imgproc_intersectConvexConvex_Point( + p1Array, p1Array.Length, p2Array, p2Array.Length, p12Vec.CvPtr, handleNested ? 1 : 0, out var ret)); - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// Array of 2D points - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public static Moments Moments(IEnumerable array, bool binaryImage = false) - { - return new Moments(array, binaryImage); - } + p12 = p12Vec.ToArray(); - #endregion - #region MatchTemplate - /// - /// Computes the proximity map for the raster template and the image where the template is searched for - /// - /// Image where the search is running; should be 8-bit or 32-bit floating-point - /// Searched template; must be not greater than the source image and have the same data type - /// A map of comparison results; will be single-channel 32-bit floating-point. - /// If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1). - /// Specifies the comparison method - /// Mask of searched template. It must have the same datatype and size with templ. It is not set by default. - public static void MatchTemplate( - InputArray image, - InputArray templ, - OutputArray result, - TemplateMatchModes method, - InputArray mask = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (templ == null) - throw new ArgumentNullException(nameof(templ)); - if (result == null) - throw new ArgumentNullException(nameof(result)); - image.ThrowIfDisposed(); - templ.ThrowIfDisposed(); - result.ThrowIfNotReady(); - if (mask != null) - mask.ThrowIfDisposed(); - NativeMethods.imgproc_matchTemplate(image.CvPtr, templ.CvPtr, result.CvPtr, (int)method, ToPtr(mask)); - GC.KeepAlive(image); - GC.KeepAlive(templ); - result.Fix(); - GC.KeepAlive(mask); - } - #endregion - #region ConnectedComponents - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// the image to be labeled - /// destination labeled image - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// The number of labels - public static int ConnectedComponents(InputArray image, OutputArray labels, - PixelConnectivity connectivity = PixelConnectivity.Connectivity8) - { - return ConnectedComponents(image, labels, connectivity, MatType.CV_32S); - } + return ret; + } - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// the image to be labeled - /// destination labeled image - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// output image label type. Currently CV_32S and CV_16U are supported. - /// The number of labels - public static int ConnectedComponents(InputArray image, OutputArray labels, - PixelConnectivity connectivity, MatType ltype) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - image.ThrowIfDisposed(); - labels.ThrowIfNotReady(); - - int result = NativeMethods.imgproc_connectedComponents( - image.CvPtr, labels.CvPtr, (int)connectivity, ltype); - - GC.KeepAlive(image); - labels.Fix(); - return result; - } + /// + /// finds intersection of two convex polygons + /// + /// + /// + /// + /// + /// + public static float IntersectConvexConvex(IEnumerable p1, IEnumerable p2, + out Point2f[] p12, bool handleNested = true) + { + if (p1 is null) + throw new ArgumentNullException(nameof(p1)); + if (p2 is null) + throw new ArgumentNullException(nameof(p2)); + var p1Array = p1.ToArray(); + var p2Array = p2.ToArray(); + + using var p12Vec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_intersectConvexConvex_Point2f( + p1Array, p1Array.Length, p2Array, p2Array.Length, + p12Vec.CvPtr, handleNested ? 1 : 0, out var ret)); + + p12 = p12Vec.ToArray(); + + return ret; + } - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// the image to be labeled - /// destination labeled rectangular array - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// The number of labels - public static int ConnectedComponents(InputArray image, out int[,] labels, PixelConnectivity connectivity) - { - using (var labelsMat = new MatOfInt()) - { - int result = ConnectedComponents(image, labelsMat, connectivity, MatType.CV_32S); - labels = labelsMat.ToRectangularArray(); - return result; - } - } + /// + /// Fits ellipse to the set of 2D points. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipse(InputArray points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + points.ThrowIfDisposed(); - #endregion - #region ConnectedComponentsWithStats - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// the image to be labeled - /// destination labeled image - /// statistics output for each label, including the background label, - /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) - /// where COLUMN is one of cv::ConnectedComponentsTypes - /// floating point centroid (x,y) output for each label, - /// including the background label - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// - public static int ConnectedComponentsWithStats( - InputArray image, OutputArray labels, - OutputArray stats, OutputArray centroids, - PixelConnectivity connectivity = PixelConnectivity.Connectivity8) - { - return ConnectedComponentsWithStats(image, labels, stats, centroids, connectivity, MatType.CV_32S); - } + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipse_InputArray(points.CvPtr, out var ret)); - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// the image to be labeled - /// destination labeled image - /// statistics output for each label, including the background label, - /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) - /// where COLUMN is one of cv::ConnectedComponentsTypes - /// floating point centroid (x,y) output for each label, - /// including the background label - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// output image label type. Currently CV_32S and CV_16U are supported. - /// - public static int ConnectedComponentsWithStats( - InputArray image, OutputArray labels, - OutputArray stats, OutputArray centroids, - PixelConnectivity connectivity, - MatType ltype) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - if (stats == null) - throw new ArgumentNullException(nameof(stats)); - if (centroids == null) - throw new ArgumentNullException(nameof(centroids)); - image.ThrowIfDisposed(); - labels.ThrowIfNotReady(); - stats.ThrowIfNotReady(); - centroids.ThrowIfNotReady(); - - int result = NativeMethods.imgproc_connectedComponentsWithStats( - image.CvPtr, labels.CvPtr, stats.CvPtr, centroids.CvPtr, (int) connectivity, ltype); - - GC.KeepAlive(image); - labels.Fix(); - stats.Fix(); - centroids.Fix(); - return result; - } + GC.KeepAlive(points); + return ret; + } - #endregion - #region ConnectedComponentsEx - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// the image to be labeled - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// - public static ConnectedComponents ConnectedComponentsEx( - InputArray image, PixelConnectivity connectivity = PixelConnectivity.Connectivity8) - { - using (var labelsMat = new MatOfInt()) - using (var statsMat = new MatOfInt()) - using (var centroidsMat = new MatOfDouble()) - { - int nLabels = ConnectedComponentsWithStats( - image, labelsMat, statsMat, centroidsMat, connectivity, MatType.CV_32S); - var labels = labelsMat.ToRectangularArray(); - var stats = statsMat.ToRectangularArray(); - var centroids = centroidsMat.ToRectangularArray(); - - var blobs = new ConnectedComponents.Blob[nLabels]; - for (int i = 0; i < nLabels; i++) - { - blobs[i] = new ConnectedComponents.Blob - { - Label = i, - Left = stats[i, 0], - Top = stats[i, 1], - Width = stats[i, 2], - Height = stats[i, 3], - Area = stats[i, 4], - Centroid = new Point2d(centroids[i, 0], centroids[i, 1]), - }; - } - return new ConnectedComponents(blobs, labels, nLabels); - } - } + /// + /// Fits ellipse to the set of 2D points. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipse(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); - #endregion - #region FindContours -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else - /// - /// Finds contours in a binary image. - /// - /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. - /// The function modifies the image while extracting the contours. - /// Detected contours. Each contour is stored as a vector of points. - /// Optional output vector, containing information about the image topology. - /// It has as many elements as the number of contours. For each i-th contour contours[i], - /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next - /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. - /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif - public static void FindContours(InputOutputArray image, out Point[][] contours, - out HierarchyIndex[] hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipse_Point(pointsArray, pointsArray.Length, out var ret)); + return ret; + } - Point offset0 = offset.GetValueOrDefault(new Point()); - IntPtr contoursPtr, hierarchyPtr; - NativeMethods.imgproc_findContours1_vector(image.CvPtr, out contoursPtr, out hierarchyPtr, (int)mode, (int)method, offset0); + /// + /// Fits ellipse to the set of 2D points. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipse(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); - using (var contoursVec = new VectorOfVectorPoint(contoursPtr)) - using (var hierarchyVec = new VectorOfVec4i(hierarchyPtr)) - { - contours = contoursVec.ToArray(); - Vec4i[] hierarchyOrg = hierarchyVec.ToArray(); - hierarchy = EnumerableEx.SelectToArray(hierarchyOrg, HierarchyIndex.FromVec4i); - } - image.Fix(); - } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else - /// - /// Finds contours in a binary image. - /// - /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. - /// The function modifies the image while extracting the contours. - /// Detected contours. Each contour is stored as a vector of points. - /// Optional output vector, containing information about the image topology. - /// It has as many elements as the number of contours. For each i-th contour contours[i], - /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next - /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. - /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif - public static void FindContours(InputOutputArray image, out Mat[] contours, - OutputArray hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (hierarchy == null) - throw new ArgumentNullException(nameof(hierarchy)); - image.ThrowIfNotReady(); - hierarchy.ThrowIfNotReady(); - - Point offset0 = offset.GetValueOrDefault(new Point()); - IntPtr contoursPtr; - NativeMethods.imgproc_findContours1_OutputArray(image.CvPtr, out contoursPtr, hierarchy.CvPtr, (int)mode, (int)method, offset0); - - using (var contoursVec = new VectorOfMat(contoursPtr)) - { - contours = contoursVec.ToArray(); - } - image.Fix(); - hierarchy.Fix(); - } + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipse_Point2f(pointsArray, pointsArray.Length, out var ret)); + return ret; + } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else - /// - /// Finds contours in a binary image. - /// - /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. - /// The function modifies the image while extracting the contours. - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. - /// Detected contours. Each contour is stored as a vector of points. -#endif - public static Point[][] FindContoursAsArray(InputOutputArray image, - RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfNotReady(); + /// + /// Fits an ellipse around a set of 2D points. + /// + /// The function calculates the ellipse that fits a set of 2D points. + /// It returns the rotated rectangle in which the ellipse is inscribed. + /// The Approximate Mean Square(AMS) proposed by @cite Taubin1991 is used. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipseAMS(InputArray points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + points.ThrowIfDisposed(); - Point offset0 = offset.GetValueOrDefault(new Point()); - IntPtr contoursPtr; - NativeMethods.imgproc_findContours2_vector(image.CvPtr, out contoursPtr, (int)mode, (int)method, offset0); - image.Fix(); + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipseAMS_InputArray(points.CvPtr, out var ret)); - using (var contoursVec = new VectorOfVectorPoint(contoursPtr)) - { - return contoursVec.ToArray(); - } - } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else - /// - /// Finds contours in a binary image. - /// - /// Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. - /// The function modifies the image while extracting the contours. - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. - /// Detected contours. Each contour is stored as a vector of points. -#endif - public static MatOfPoint[] FindContoursAsMat(InputOutputArray image, - RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfNotReady(); + GC.KeepAlive(points); + return ret; + } + + /// + /// Fits an ellipse around a set of 2D points. + /// + /// The function calculates the ellipse that fits a set of 2D points. + /// It returns the rotated rectangle in which the ellipse is inscribed. + /// The Approximate Mean Square(AMS) proposed by @cite Taubin1991 is used. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipseAMS(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipseAMS_Point(pointsArray, pointsArray.Length, out var ret)); + return ret; + } + + /// + /// Fits an ellipse around a set of 2D points. + /// + /// The function calculates the ellipse that fits a set of 2D points. + /// It returns the rotated rectangle in which the ellipse is inscribed. + /// The Approximate Mean Square(AMS) proposed by @cite Taubin1991 is used. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipseAMS(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipseAMS_Point2f(pointsArray, pointsArray.Length, out var ret)); + return ret; + } + + /// + /// Fits an ellipse around a set of 2D points. + /// + /// The function calculates the ellipse that fits a set of 2D points. + /// It returns the rotated rectangle in which the ellipse is inscribed. + /// The Direct least square(Direct) method by @cite Fitzgibbon1999 is used. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipseDirect(InputArray points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + points.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipseDirect_InputArray(points.CvPtr, out var ret)); + + GC.KeepAlive(points); + return ret; + } + + /// + /// Fits an ellipse around a set of 2D points. + /// + /// The function calculates the ellipse that fits a set of 2D points. + /// It returns the rotated rectangle in which the ellipse is inscribed. + /// The Direct least square(Direct) method by @cite Fitzgibbon1999 is used. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipseDirect(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipseDirect_Point(pointsArray, pointsArray.Length, out var ret)); + return ret; + } + + /// + /// Fits an ellipse around a set of 2D points. + /// + /// The function calculates the ellipse that fits a set of 2D points. + /// It returns the rotated rectangle in which the ellipse is inscribed. + /// The Direct least square(Direct) method by @cite Fitzgibbon1999 is used. + /// + /// Input 2D point set + /// + public static RotatedRect FitEllipseDirect(IEnumerable points) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fitEllipseDirect_Point2f(pointsArray, pointsArray.Length, out var ret)); + return ret; + } + + /// + /// Fits line to the set of 2D points using M-estimator algorithm + /// + /// Input vector of 2D or 3D points + /// Output line parameters. + /// In case of 2D fitting, it should be a vector of 4 elements + /// (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector + /// collinear to the line and (x0, y0) is a point on the line. + /// In case of 3D fitting, it should be a vector of 6 elements + /// (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a + /// normalized vector collinear to the line and (x0, y0, z0) is a point on the line. + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + public static void FitLine(InputArray points, OutputArray line, DistanceTypes distType, + double param, double reps, double aeps) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + if (line is null) + throw new ArgumentNullException(nameof(line)); + points.ThrowIfDisposed(); + line.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fitLine_InputArray( + points.CvPtr, line.CvPtr, (int) distType, param, reps, aeps)); + + GC.KeepAlive(points); + GC.KeepAlive(line); + line.Fix(); + } + + /// + /// Fits line to the set of 2D points using M-estimator algorithm + /// + /// Input vector of 2D or 3D points + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + /// Output line parameters. + public static Line2D FitLine(IEnumerable points, DistanceTypes distType, + double param, double reps, double aeps) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + var line = new float[4]; + NativeMethods.HandleException( + NativeMethods.imgproc_fitLine_Point( + pointsArray, pointsArray.Length, line, (int) distType, param, reps, aeps)); + return new Line2D(line); + } + + /// + /// Fits line to the set of 2D points using M-estimator algorithm + /// + /// Input vector of 2D or 3D points + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + /// Output line parameters. + public static Line2D FitLine(IEnumerable points, DistanceTypes distType, + double param, double reps, double aeps) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + var line = new float[4]; + NativeMethods.HandleException( + NativeMethods.imgproc_fitLine_Point2f( + pointsArray, pointsArray.Length, line, (int) distType, param, reps, aeps)); + return new Line2D(line); + } - Point offset0 = offset.GetValueOrDefault(new Point()); - IntPtr contoursPtr; - NativeMethods.imgproc_findContours2_OutputArray(image.CvPtr, out contoursPtr, (int)mode, (int)method, offset0); - image.Fix(); + /// + /// Fits line to the set of 3D points using M-estimator algorithm + /// + /// Input vector of 2D or 3D points + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + /// Output line parameters. + public static Line3D FitLine(IEnumerable points, DistanceTypes distType, + double param, double reps, double aeps) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + var line = new float[6]; + NativeMethods.HandleException( + NativeMethods.imgproc_fitLine_Point3i( + pointsArray, pointsArray.Length, line, (int) distType, param, reps, aeps)); + return new Line3D(line); + } - using (var contoursVec = new VectorOfMat(contoursPtr)) - { - return contoursVec.ToArray(); - } - } - #endregion - #region ApproxPolyDP - - /// - /// Approximates contour or a curve using Douglas-Peucker algorithm - /// - /// The polygon or curve to approximate. - /// Must be 1 x N or N x 1 matrix of type CV_32SC2 or CV_32FC2. - /// The result of the approximation; - /// The type should match the type of the input curve - /// Specifies the approximation accuracy. - /// This is the maximum distance between the original curve and its approximation. - /// The result of the approximation; - /// The type should match the type of the input curve - public static void ApproxPolyDP(InputArray curve, OutputArray approxCurve, double epsilon, bool closed) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - if (approxCurve == null) - throw new ArgumentNullException(nameof(approxCurve)); - curve.ThrowIfDisposed(); - approxCurve.ThrowIfNotReady(); - NativeMethods.imgproc_approxPolyDP_InputArray(curve.CvPtr, approxCurve.CvPtr, epsilon, closed ? 1 : 0); - GC.KeepAlive(curve); - approxCurve.Fix(); - } - /// - /// Approximates contour or a curve using Douglas-Peucker algorithm - /// - /// The polygon or curve to approximate. - /// Specifies the approximation accuracy. - /// This is the maximum distance between the original curve and its approximation. - /// The result of the approximation; - /// The type should match the type of the input curve - /// The result of the approximation; - /// The type should match the type of the input curve - public static Point[] ApproxPolyDP(IEnumerable curve, double epsilon, bool closed) - { - if(curve == null) - throw new ArgumentNullException(nameof(curve)); - Point[] curveArray = EnumerableEx.ToArray(curve); - IntPtr approxCurvePtr; - NativeMethods.imgproc_approxPolyDP_Point(curveArray, curveArray.Length, out approxCurvePtr, epsilon, closed ? 1 : 0); - using (var approxCurveVec = new VectorOfPoint(approxCurvePtr)) - { - return approxCurveVec.ToArray(); - } - } - /// - /// Approximates contour or a curve using Douglas-Peucker algorithm - /// - /// The polygon or curve to approximate. - /// Specifies the approximation accuracy. - /// This is the maximum distance between the original curve and its approximation. - /// If true, the approximated curve is closed - /// (i.e. its first and last vertices are connected), otherwise it’s not - /// The result of the approximation; - /// The type should match the type of the input curve - public static Point2f[] ApproxPolyDP(IEnumerable curve, double epsilon, bool closed) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - Point2f[] curveArray = EnumerableEx.ToArray(curve); - IntPtr approxCurvePtr; - NativeMethods.imgproc_approxPolyDP_Point2f(curveArray, curveArray.Length, out approxCurvePtr, epsilon, closed ? 1 : 0); - using (var approxCurveVec = new VectorOfPoint2f(approxCurvePtr)) - { - return approxCurveVec.ToArray(); - } - } - #endregion - #region ArcLength - /// - /// Calculates a contour perimeter or a curve length. - /// - /// The input vector of 2D points, represented by CV_32SC2 or CV_32FC2 matrix. - /// Indicates, whether the curve is closed or not. - /// - public static double ArcLength(InputArray curve, bool closed) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - curve.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_arcLength_InputArray(curve.CvPtr, closed ? 1 : 0); - GC.KeepAlive(curve); - return ret; - } + /// + /// Fits line to the set of 3D points using M-estimator algorithm + /// + /// Input vector of 2D or 3D points + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + /// Output line parameters. + public static Line3D FitLine(IEnumerable points, DistanceTypes distType, + double param, double reps, double aeps) + { + if (points is null) + throw new ArgumentNullException(nameof(points)); + var pointsArray = points.ToArray(); + var line = new float[6]; + NativeMethods.HandleException( + NativeMethods.imgproc_fitLine_Point3f( + pointsArray, pointsArray.Length, line, (int) distType, param, reps, aeps)); + return new Line3D(line); + } - /// - /// Calculates a contour perimeter or a curve length. - /// - /// The input vector of 2D points. - /// Indicates, whether the curve is closed or not. - /// - public static double ArcLength(IEnumerable curve, bool closed) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - Point[] curveArray = EnumerableEx.ToArray(curve); - return NativeMethods.imgproc_arcLength_Point(curveArray, curveArray.Length, closed ? 1 : 0); - } + /// + /// Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary + /// + /// + /// + /// + /// + public static double PointPolygonTest(InputArray contour, Point2f pt, bool measureDist) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + contour.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_pointPolygonTest_InputArray( + contour.CvPtr, pt, measureDist ? 1 : 0, out var ret)); + GC.KeepAlive(contour); + return ret; + } - /// - /// Calculates a contour perimeter or a curve length. - /// - /// The input vector of 2D points. - /// Indicates, whether the curve is closed or not. - /// - public static double ArcLength(IEnumerable curve, bool closed) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - Point2f[] curveArray = EnumerableEx.ToArray(curve); - return NativeMethods.imgproc_arcLength_Point2f(curveArray, curveArray.Length, closed ? 1 : 0); - } - #endregion - #region BoundingRect - /// - /// Calculates the up-right bounding rectangle of a point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// Minimal up-right bounding rectangle for the specified point set. - public static Rect BoundingRect(InputArray curve) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - curve.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_boundingRect_InputArray(curve.CvPtr); - GC.KeepAlive(curve); - return ret; - } + /// + /// Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary + /// + /// + /// + /// + /// + public static double PointPolygonTest(IEnumerable contour, Point2f pt, bool measureDist) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + var contourArray = contour.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_pointPolygonTest_Point( + contourArray, contourArray.Length, pt, measureDist ? 1 : 0, out var ret)); + return ret; + } - /// - /// Calculates the up-right bounding rectangle of a point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// Minimal up-right bounding rectangle for the specified point set. - public static Rect BoundingRect(IEnumerable curve) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - Point[] curveArray = EnumerableEx.ToArray(curve); - return NativeMethods.imgproc_boundingRect_Point(curveArray, curveArray.Length); - } + /// + /// Checks if the point is inside the contour. + /// Optionally computes the signed distance from the point to the contour boundary. + /// + /// Input contour. + /// Point tested against the contour. + /// If true, the function estimates the signed distance + /// from the point to the nearest contour edge. Otherwise, the function only checks + /// if the point is inside a contour or not. + /// Positive (inside), negative (outside), or zero (on an edge) value. + public static double PointPolygonTest(IEnumerable contour, Point2f pt, bool measureDist) + { + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + var contourArray = contour.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_pointPolygonTest_Point2f( + contourArray, contourArray.Length, pt, measureDist ? 1 : 0, out var ret)); + return ret; + } - /// - /// Calculates the up-right bounding rectangle of a point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// Minimal up-right bounding rectangle for the specified point set. - public static Rect BoundingRect(IEnumerable curve) - { - if (curve == null) - throw new ArgumentNullException(nameof(curve)); - Point2f[] curveArray = EnumerableEx.ToArray(curve); - return NativeMethods.imgproc_boundingRect_Point2f(curveArray, curveArray.Length); - } - #endregion - #region ContourArea - /// - /// Calculates the contour area - /// - /// The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix - /// - /// - public static double ContourArea(InputArray contour, bool oriented = false) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_contourArea_InputArray(contour.CvPtr, oriented ? 1 : 0); - GC.KeepAlive(contour); - return ret; - } - /// - /// Calculates the contour area - /// - /// The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix - /// - /// - public static double ContourArea(IEnumerable contour, bool oriented = false) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - Point[] contourArray = EnumerableEx.ToArray(contour); - return NativeMethods.imgproc_contourArea_Point(contourArray, contourArray.Length, oriented ? 1 : 0); - } - /// - /// Calculates the contour area - /// - /// The contour vertices, represented by CV_32SC2 or CV_32FC2 matrix - /// - /// - public static double ContourArea(IEnumerable contour, bool oriented = false) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - Point2f[] contourArray = EnumerableEx.ToArray(contour); - return NativeMethods.imgproc_contourArea_Point2f(contourArray, contourArray.Length, oriented ? 1 : 0); - } - #endregion - #region MinAreaRect - /// - /// Finds the minimum area rotated rectangle enclosing a 2D point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - public static RotatedRect MinAreaRect(InputArray points) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - points.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_minAreaRect_InputArray(points.CvPtr); - GC.KeepAlive(points); - return ret; - } - /// - /// Finds the minimum area rotated rectangle enclosing a 2D point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - public static RotatedRect MinAreaRect(IEnumerable points) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point[] pointsArray = EnumerableEx.ToArray(points); - return NativeMethods.imgproc_minAreaRect_Point(pointsArray, pointsArray.Length); - } - /// - /// Finds the minimum area rotated rectangle enclosing a 2D point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - public static RotatedRect MinAreaRect(IEnumerable points) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point2f[] pointsArray = EnumerableEx.ToArray(points); - return NativeMethods.imgproc_minAreaRect_Point2f(pointsArray, pointsArray.Length); - } - #endregion - #region MinEnclosingCircle - /// - /// Finds the minimum area circle enclosing a 2D point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// The output center of the circle - /// The output radius of the circle - public static void MinEnclosingCircle(InputArray points, out Point2f center, out float radius) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - points.ThrowIfDisposed(); - NativeMethods.imgproc_minEnclosingCircle_InputArray(points.CvPtr, out center, out radius); - GC.KeepAlive(points); - } + /// + /// Finds out if there is any intersection between two rotated rectangles. + /// If there is then the vertices of the interesecting region are returned as well. + /// Below are some examples of intersection configurations. + /// The hatched pattern indicates the intersecting region and the red + /// vertices are returned by the function. + /// + /// First rectangle + /// Second rectangle + /// + /// The output array of the verticies of the intersecting region. + /// It returns at most 8 vertices. + /// Stored as std::vector<cv::Point2f> or cv::Mat as Mx1 of type CV_32FC2. + /// + public static RectanglesIntersectTypes RotatedRectangleIntersection( + RotatedRect rect1, RotatedRect rect2, OutputArray intersectingRegion) + { + if (intersectingRegion is null) + throw new ArgumentNullException(nameof(intersectingRegion)); + intersectingRegion.ThrowIfNotReady(); - /// - /// Finds the minimum area circle enclosing a 2D point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// The output center of the circle - /// The output radius of the circle - public static void MinEnclosingCircle(IEnumerable points, out Point2f center, out float radius) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point[] pointsArray = EnumerableEx.ToArray(points); - NativeMethods.imgproc_minEnclosingCircle_Point(pointsArray, pointsArray.Length, out center, out radius); - } + NativeMethods.HandleException( + NativeMethods.imgproc_rotatedRectangleIntersection_OutputArray( + rect1, rect2, intersectingRegion.CvPtr, out var ret)); - /// - /// Finds the minimum area circle enclosing a 2D point set. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// The output center of the circle - /// The output radius of the circle - public static void MinEnclosingCircle(IEnumerable points, out Point2f center, out float radius) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point2f[] pointsArray = EnumerableEx.ToArray(points); - NativeMethods.imgproc_minEnclosingCircle_Point2f(pointsArray, pointsArray.Length, out center, out radius); - } - #endregion - #region MatchShapes - /// - /// matches two contours using one of the available algorithms - /// - /// - /// - /// - /// - /// - public static double MatchShapes(InputArray contour1, InputArray contour2, ShapeMatchModes method, double parameter = 0) - { - if (contour1 == null) - throw new ArgumentNullException(nameof(contour1)); - if (contour2 == null) - throw new ArgumentNullException(nameof(contour2)); - var ret = NativeMethods.imgproc_matchShapes_InputArray(contour1.CvPtr, contour2.CvPtr, (int)method, parameter); - GC.KeepAlive(contour1); - GC.KeepAlive(contour2); - return ret; - } - /// - /// matches two contours using one of the available algorithms - /// - /// - /// - /// - /// - /// - public static double MatchShapes(IEnumerable contour1, IEnumerable contour2, - ShapeMatchModes method, double parameter = 0) - { - if (contour1 == null) - throw new ArgumentNullException(nameof(contour1)); - if (contour2 == null) - throw new ArgumentNullException(nameof(contour2)); - Point[] contour1Array = EnumerableEx.ToArray(contour1); - Point[] contour2Array = EnumerableEx.ToArray(contour2); - return NativeMethods.imgproc_matchShapes_Point(contour1Array, contour1Array.Length, - contour2Array, contour2Array.Length, (int)method, parameter); - } - #endregion - #region ConvexHull - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// The output convex hull. It is either a vector of points that form the - /// hull (must have the same type as the input points), or a vector of 0-based point - /// indices of the hull points in the original array (since the set of convex hull - /// points is a subset of the original point set). - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// - public static void ConvexHull(InputArray points, OutputArray hull, bool clockwise = false, bool returnPoints = true) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - if (hull == null) - throw new ArgumentNullException(nameof(hull)); - points.ThrowIfDisposed(); - hull.ThrowIfNotReady(); - NativeMethods.imgproc_convexHull_InputArray(points.CvPtr, hull.CvPtr, clockwise ? 1 : 0, returnPoints ? 1 : 0); - GC.KeepAlive(points); - hull.Fix(); - } + GC.KeepAlive(intersectingRegion); + intersectingRegion.Fix(); - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of points that form - /// the hull (must have the same type as the input points). - public static Point[] ConvexHull(IEnumerable points, bool clockwise = false) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point[] pointsArray = EnumerableEx.ToArray(points); - IntPtr hullPtr; - NativeMethods.imgproc_convexHull_Point_ReturnsPoints(pointsArray, pointsArray.Length, out hullPtr, clockwise ? 1 : 0); - using (var hullVec = new VectorOfPoint(hullPtr)) - { - return hullVec.ToArray(); - } - } + return (RectanglesIntersectTypes)ret; + } - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of points that form - /// the hull (must have the same type as the input points). - public static Point2f[] ConvexHull(IEnumerable points, bool clockwise = false) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point2f[] pointsArray = EnumerableEx.ToArray(points); - IntPtr hullPtr; - NativeMethods.imgproc_convexHull_Point2f_ReturnsPoints(pointsArray, pointsArray.Length, out hullPtr, - clockwise ? 1 : 0); - using (var hullVec = new VectorOfPoint2f(hullPtr)) - { - return hullVec.ToArray(); - } - } + /// + /// Finds out if there is any intersection between two rotated rectangles. + /// If there is then the vertices of the interesecting region are returned as well. + /// Below are some examples of intersection configurations. + /// The hatched pattern indicates the intersecting region and the red + /// vertices are returned by the function. + /// + /// First rectangle + /// Second rectangle + /// + /// The output array of the verticies of the intersecting region. + /// It returns at most 8 vertices. + /// + public static RectanglesIntersectTypes RotatedRectangleIntersection( + RotatedRect rect1, RotatedRect rect2, out Point2f[] intersectingRegion) + { + using var intersectingRegionVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_rotatedRectangleIntersection_vector( + rect1, rect2, intersectingRegionVec.CvPtr, out var ret)); - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of 0-based point indices of the - /// hull points in the original array (since the set of convex hull points is a subset of the original point set). - public static int[] ConvexHullIndices(IEnumerable points, bool clockwise = false) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point[] pointsArray = EnumerableEx.ToArray(points); - IntPtr hullPtr; - NativeMethods.imgproc_convexHull_Point_ReturnsIndices(pointsArray, pointsArray.Length, out hullPtr, clockwise ? 1 : 0); - using (var hullVec = new VectorOfInt32(hullPtr)) - { - return hullVec.ToArray(); - } - } + intersectingRegion = intersectingRegionVec.ToArray(); + return (RectanglesIntersectTypes) ret; + } - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of 0-based point indices of the - /// hull points in the original array (since the set of convex hull points is a subset of the original point set). - public static int[] ConvexHullIndices(IEnumerable points, bool clockwise = false) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point2f[] pointsArray = EnumerableEx.ToArray(points); - IntPtr hullPtr; - NativeMethods.imgproc_convexHull_Point2f_ReturnsIndices(pointsArray, pointsArray.Length, out hullPtr, clockwise ? 1 : 0); - using (var hullVec = new VectorOfInt32(hullPtr)) - { - return hullVec.ToArray(); - } - } - #endregion - #region ConvexityDefects - - /// - /// Computes the contour convexity defects - /// - /// Input contour. - /// Convex hull obtained using convexHull() that - /// should contain indices of the contour points that make the hull. - /// - /// The output vector of convexity defects. - /// Each convexity defect is represented as 4-element integer vector - /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), - /// where indices are 0-based indices in the original contour of the convexity defect beginning, - /// end and the farthest point, and fixpt_depth is fixed-point approximation - /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. - /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. - /// - public static void ConvexityDefects(InputArray contour, InputArray convexHull, OutputArray convexityDefects) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - if (convexHull == null) - throw new ArgumentNullException(nameof(convexHull)); - if (convexityDefects == null) - throw new ArgumentNullException(nameof(convexityDefects)); - contour.ThrowIfDisposed(); - convexHull.ThrowIfDisposed(); - convexityDefects.ThrowIfNotReady(); - NativeMethods.imgproc_convexityDefects_InputArray(contour.CvPtr, convexHull.CvPtr, convexityDefects.CvPtr); - GC.KeepAlive(contour); - GC.KeepAlive(convexHull); - convexityDefects.Fix(); - } + /// + /// Applies a GNU Octave/MATLAB equivalent colormap on a given image. + /// + /// The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. + /// The result is the colormapped source image. Note: Mat::create is called on dst. + /// colormap The colormap to apply + public static void ApplyColorMap(InputArray src, OutputArray dst, ColormapTypes colormap) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_applyColorMap1(src.CvPtr, dst.CvPtr, (int) colormap)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies a user colormap on a given image. + /// + /// The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. + /// The result is the colormapped source image. Note: Mat::create is called on dst. + /// The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256 + public static void ApplyColorMap(InputArray src, OutputArray dst, InputArray userColor) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (userColor is null) + throw new ArgumentNullException(nameof(userColor)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + userColor.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_applyColorMap2(src.CvPtr, dst.CvPtr, userColor.CvPtr)); + + GC.KeepAlive(src); + dst.Fix(); + GC.KeepAlive(userColor); + } - /// - /// Computes the contour convexity defects - /// - /// Input contour. - /// Convex hull obtained using convexHull() that - /// should contain indices of the contour points that make the hull. - /// The output vector of convexity defects. - /// Each convexity defect is represented as 4-element integer vector - /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), - /// where indices are 0-based indices in the original contour of the convexity defect beginning, - /// end and the farthest point, and fixpt_depth is fixed-point approximation - /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. - /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. - public static Vec4i[] ConvexityDefects(IEnumerable contour, IEnumerable convexHull) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - if (convexHull == null) - throw new ArgumentNullException(nameof(convexHull)); - Point[] contourArray = EnumerableEx.ToArray(contour); - int[] convexHullArray = EnumerableEx.ToArray(convexHull); - IntPtr convexityDefectsPtr; - NativeMethods.imgproc_convexityDefects_Point(contourArray, contourArray.Length, - convexHullArray, convexHullArray.Length, out convexityDefectsPtr); - - using (var convexityDefects = new VectorOfVec4i(convexityDefectsPtr)) - { - return convexityDefects.ToArray(); - } - } + #region Drawing + + /// + /// Draws a line segment connecting two points + /// + /// The image. + /// First point's x-coordinate of the line segment. + /// First point's y-coordinate of the line segment. + /// Second point's x-coordinate of the line segment. + /// Second point's y-coordinate of the line segment. + /// Line color. + /// Line thickness. [By default this is 1] + /// Type of the line. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public static void Line(InputOutputArray img, int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Line(img, new Point(pt1X, pt1Y), new Point(pt2X, pt2Y), color, thickness, lineType, shift); + } - /// - /// Computes the contour convexity defects - /// - /// Input contour. - /// Convex hull obtained using convexHull() that - /// should contain indices of the contour points that make the hull. - /// The output vector of convexity defects. - /// Each convexity defect is represented as 4-element integer vector - /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), - /// where indices are 0-based indices in the original contour of the convexity defect beginning, - /// end and the farthest point, and fixpt_depth is fixed-point approximation - /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. - /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. - public static Vec4i[] ConvexityDefects(IEnumerable contour, IEnumerable convexHull) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - if (convexHull == null) - throw new ArgumentNullException(nameof(convexHull)); - Point2f[] contourArray = EnumerableEx.ToArray(contour); - int[] convexHullArray = EnumerableEx.ToArray(convexHull); - IntPtr convexityDefectsPtr; - NativeMethods.imgproc_convexityDefects_Point2f(contourArray, contourArray.Length, - convexHullArray, convexHullArray.Length, out convexityDefectsPtr); - - using (var convexityDefects = new VectorOfVec4i(convexityDefectsPtr)) - { - return convexityDefects.ToArray(); - } - } - #endregion - #region IsContourConvex - /// - /// returns true if the contour is convex. - /// Does not support contours with self-intersection - /// - /// Input vector of 2D points - /// - public static bool IsContourConvex(InputArray contour) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.ThrowIfDisposed(); - int ret = NativeMethods.imgproc_isContourConvex_InputArray(contour.CvPtr); - GC.KeepAlive(contour); - return ret != 0; - } - /// - /// returns true if the contour is convex. - /// Does not support contours with self-intersection - /// - /// Input vector of 2D points - /// - public static bool IsContourConvex(IEnumerable contour) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - Point[] contourArray = EnumerableEx.ToArray(contour); - int ret = NativeMethods.imgproc_isContourConvex_Point(contourArray, contourArray.Length); - return ret != 0; - } - /// - /// returns true if the contour is convex. D - /// oes not support contours with self-intersection - /// - /// Input vector of 2D points - /// - public static bool IsContourConvex(IEnumerable contour) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - Point2f[] contourArray = EnumerableEx.ToArray(contour); - int ret = NativeMethods.imgproc_isContourConvex_Point2f(contourArray, contourArray.Length); - return ret != 0; - } - #endregion - #region IntersectConvexConvex - /// - /// finds intersection of two convex polygons - /// - /// - /// - /// - /// - /// - public static float IntersectConvexConvex(InputArray p1, InputArray p2, OutputArray p12, bool handleNested = true) - { - if (p1 == null) - throw new ArgumentNullException(nameof(p1)); - if (p2 == null) - throw new ArgumentNullException(nameof(p2)); - if (p12 == null) - throw new ArgumentNullException(nameof(p12)); - p1.ThrowIfDisposed(); - p2.ThrowIfDisposed(); - p12.ThrowIfNotReady(); - float ret = NativeMethods.imgproc_intersectConvexConvex_InputArray(p1.CvPtr, p2.CvPtr, p12.CvPtr, handleNested ? 1 : 0); - GC.KeepAlive(p1); - GC.KeepAlive(p2); - p12.Fix(); - return ret; - } - /// - /// finds intersection of two convex polygons - /// - /// - /// - /// - /// - /// - public static float IntersectConvexConvex(IEnumerable p1, IEnumerable p2, - out Point[] p12, bool handleNested = true) - { - if (p1 == null) - throw new ArgumentNullException(nameof(p1)); - if (p2 == null) - throw new ArgumentNullException(nameof(p2)); - Point[] p1Array = EnumerableEx.ToArray(p1); - Point[] p2Array = EnumerableEx.ToArray(p2); - IntPtr p12Ptr; - float ret = NativeMethods.imgproc_intersectConvexConvex_Point(p1Array, p1Array.Length, p2Array, p2Array.Length, - out p12Ptr, handleNested ? 1 : 0); - - using (var p12Vec = new VectorOfPoint(p12Ptr)) - { - p12 = p12Vec.ToArray(); - } + /// + /// Draws a line segment connecting two points + /// + /// The image. + /// First point of the line segment. + /// Second point of the line segment. + /// Line color. + /// Line thickness. [By default this is 1] + /// Type of the line. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public static void Line( + InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfNotReady(); - return ret; - } - /// - /// finds intersection of two convex polygons - /// - /// - /// - /// - /// - /// - public static float IntersectConvexConvex(IEnumerable p1, IEnumerable p2, - out Point2f[] p12, bool handleNested = true) - { - if (p1 == null) - throw new ArgumentNullException(nameof(p1)); - if (p2 == null) - throw new ArgumentNullException(nameof(p2)); - Point2f[] p1Array = EnumerableEx.ToArray(p1); - Point2f[] p2Array = EnumerableEx.ToArray(p2); - IntPtr p12Ptr; - float ret = NativeMethods.imgproc_intersectConvexConvex_Point2f(p1Array, p1Array.Length, p2Array, p2Array.Length, - out p12Ptr, handleNested ? 1 : 0); - - using (var p12Vec = new VectorOfPoint2f(p12Ptr)) - { - p12 = p12Vec.ToArray(); - } + NativeMethods.HandleException( + NativeMethods.imgproc_line(img.CvPtr, pt1, pt2, color, thickness, (int) lineType, shift)); - return ret; - } - #endregion - #region FitEllipse - /// - /// Fits ellipse to the set of 2D points. - /// - /// Input 2D point set - /// - public static RotatedRect FitEllipse(InputArray points) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - points.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_fitEllipse_InputArray(points.CvPtr); - GC.KeepAlive(points); - return ret; - } - /// - /// Fits ellipse to the set of 2D points. - /// - /// Input 2D point set - /// - public static RotatedRect FitEllipse(IEnumerable points) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point[] pointsArray = EnumerableEx.ToArray(points); - return NativeMethods.imgproc_fitEllipse_Point(pointsArray, pointsArray.Length); - } - /// - /// Fits ellipse to the set of 2D points. - /// - /// Input 2D point set - /// - public static RotatedRect FitEllipse(IEnumerable points) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point2f[] pointsArray = EnumerableEx.ToArray(points); - return NativeMethods.imgproc_fitEllipse_Point2f(pointsArray, pointsArray.Length); - } - #endregion - #region FitLine - - /// - /// Fits line to the set of 2D points using M-estimator algorithm - /// - /// Input vector of 2D or 3D points - /// Output line parameters. - /// In case of 2D fitting, it should be a vector of 4 elements - /// (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector - /// collinear to the line and (x0, y0) is a point on the line. - /// In case of 3D fitting, it should be a vector of 6 elements - /// (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a - /// normalized vector collinear to the line and (x0, y0, z0) is a point on the line. - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - public static void FitLine(InputArray points, OutputArray line, DistanceTypes distType, - double param, double reps, double aeps) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - if (line == null) - throw new ArgumentNullException(nameof(line)); - points.ThrowIfDisposed(); - line.ThrowIfNotReady(); - NativeMethods.imgproc_fitLine_InputArray(points.CvPtr, line.CvPtr, (int)distType, param, reps, aeps); - GC.KeepAlive(points); - line.Fix(); - } + img.Fix(); + GC.KeepAlive(img); + } - /// - /// Fits line to the set of 2D points using M-estimator algorithm - /// - /// Input vector of 2D or 3D points - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - /// Output line parameters. - public static Line2D FitLine(IEnumerable points, DistanceTypes distType, - double param, double reps, double aeps) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point[] pointsArray = EnumerableEx.ToArray(points); - float[] line = new float[4]; - NativeMethods.imgproc_fitLine_Point(pointsArray, pointsArray.Length, line, (int)distType, param, reps, aeps); - return new Line2D(line); - } + /// + /// Draws a arrow segment pointing from the first point to the second one. + /// The function arrowedLine draws an arrow between pt1 and pt2 points in the image. + /// See also cv::line. + /// + /// Image. + /// The point the arrow starts from. + /// The point the arrow points to. + /// Line color. + /// Line thickness. + /// Type of the line, see cv::LineTypes + /// Number of fractional bits in the point coordinates. + /// The length of the arrow tip in relation to the arrow length + public static void ArrowedLine( + InputOutputArray img, + Point pt1, Point pt2, + Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + int shift = 0, + double tipLength = 0.1) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfNotReady(); - /// - /// Fits line to the set of 2D points using M-estimator algorithm - /// - /// Input vector of 2D or 3D points - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - /// Output line parameters. - public static Line2D FitLine(IEnumerable points, DistanceTypes distType, - double param, double reps, double aeps) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point2f[] pointsArray = EnumerableEx.ToArray(points); - float[] line = new float[4]; - NativeMethods.imgproc_fitLine_Point2f(pointsArray, pointsArray.Length, line, (int)distType, param, reps, aeps); - return new Line2D(line); - } + NativeMethods.HandleException( + NativeMethods.imgproc_arrowedLine( + img.CvPtr, pt1, pt2, color, thickness, (int) lineType, shift, tipLength)); - /// - /// Fits line to the set of 3D points using M-estimator algorithm - /// - /// Input vector of 2D or 3D points - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - /// Output line parameters. - public static Line3D FitLine(IEnumerable points, DistanceTypes distType, - double param, double reps, double aeps) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point3i[] pointsArray = EnumerableEx.ToArray(points); - float[] line = new float[6]; - NativeMethods.imgproc_fitLine_Point3i(pointsArray, pointsArray.Length, line, (int)distType, param, reps, aeps); - return new Line3D(line); - } + GC.KeepAlive(img); + img.Fix(); + } - /// - /// Fits line to the set of 3D points using M-estimator algorithm - /// - /// Input vector of 2D or 3D points - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - /// Output line parameters. - public static Line3D FitLine(IEnumerable points, DistanceTypes distType, - double param, double reps, double aeps) - { - if (points == null) - throw new ArgumentNullException(nameof(points)); - Point3f[] pointsArray = EnumerableEx.ToArray(points); - float[] line = new float[6]; - NativeMethods.imgproc_fitLine_Point3f(pointsArray, pointsArray.Length, line, (int)distType, param, reps, aeps); - return new Line3D(line); - } - #endregion - #region PointPolygonTest - /// - /// Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary - /// - /// - /// - /// - /// - public static double PointPolygonTest(InputArray contour, Point2f pt, bool measureDist) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - contour.ThrowIfDisposed(); - var ret = NativeMethods.imgproc_pointPolygonTest_InputArray(contour.CvPtr, pt, measureDist ? 1 : 0); - GC.KeepAlive(contour); - return ret; - } + /// + /// Draws simple, thick or filled rectangle + /// + /// Image. + /// One of the rectangle vertices. + /// Opposite rectangle vertex. + /// Line color (RGB) or brightness (grayscale image). + /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] + /// Type of the line, see cvLine description. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public static void Rectangle( + InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); - /// - /// Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary - /// - /// - /// - /// - /// - public static double PointPolygonTest(IEnumerable contour, Point2f pt, bool measureDist) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - Point[] contourArray = EnumerableEx.ToArray(contour); - return NativeMethods.imgproc_pointPolygonTest_Point(contourArray, contourArray.Length, pt, measureDist ? 1 : 0); - } + NativeMethods.HandleException( + NativeMethods.imgproc_rectangle_InputOutputArray_Point( + img.CvPtr, pt1, pt2, color, thickness, (int) lineType, shift)); - /// - /// Checks if the point is inside the contour. - /// Optionally computes the signed distance from the point to the contour boundary. - /// - /// Input contour. - /// Point tested against the contour. - /// If true, the function estimates the signed distance - /// from the point to the nearest contour edge. Otherwise, the function only checks - /// if the point is inside a contour or not. - /// Positive (inside), negative (outside), or zero (on an edge) value. - public static double PointPolygonTest(IEnumerable contour, Point2f pt, bool measureDist) - { - if (contour == null) - throw new ArgumentNullException(nameof(contour)); - Point2f[] contourArray = EnumerableEx.ToArray(contour); - return NativeMethods.imgproc_pointPolygonTest_Point2f(contourArray, contourArray.Length, pt, measureDist ? 1 : 0); - } - #endregion - - #region RotatedRectangleIntersection - - /// - /// Finds out if there is any intersection between two rotated rectangles. - /// If there is then the vertices of the interesecting region are returned as well. - /// Below are some examples of intersection configurations. - /// The hatched pattern indicates the intersecting region and the red - /// vertices are returned by the function. - /// - /// First rectangle - /// Second rectangle - /// - /// The output array of the verticies of the intersecting region. - /// It returns at most 8 vertices. - /// Stored as std::vector<cv::Point2f> or cv::Mat as Mx1 of type CV_32FC2. - /// - public static RectanglesIntersectTypes RotatedRectangleIntersection( - RotatedRect rect1, RotatedRect rect2, OutputArray intersectingRegion) - { - if (intersectingRegion == null) - throw new ArgumentNullException(nameof(intersectingRegion)); - intersectingRegion.ThrowIfNotReady(); + img.Fix(); + GC.KeepAlive(img); + } - int ret = NativeMethods.imgproc_rotatedRectangleIntersection_OutputArray( - rect1, rect2, intersectingRegion.CvPtr); + /// + /// Draws simple, thick or filled rectangle + /// + /// Image. + /// Rectangle. + /// Line color (RGB) or brightness (grayscale image). + /// Thickness of lines that make up the rectangle. + /// Negative values make the function to draw a filled rectangle. [By default this is 1] + /// Type of the line, see cvLine description. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public static void Rectangle( + InputOutputArray img, Rect rect, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + + NativeMethods.HandleException( + NativeMethods.imgproc_rectangle_InputOutputArray_Rect( + img.CvPtr, rect, color, thickness, (int) lineType, shift)); + img.Fix(); + GC.KeepAlive(img); + } - intersectingRegion.Fix(); + /// + /// Draws simple, thick or filled rectangle + /// + /// Image. + /// Rectangle. + /// Line color (RGB) or brightness (grayscale image). + /// Thickness of lines that make up the rectangle. + /// Negative values make the function to draw a filled rectangle. [By default this is 1] + /// Type of the line, see cvLine description. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public static void Rectangle( + Mat img, Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); - return (RectanglesIntersectTypes)ret; - } + NativeMethods.HandleException( + NativeMethods.imgproc_rectangle_Mat_Rect(img.CvPtr, rect, color, thickness, (int) lineType, shift)); + GC.KeepAlive(img); + } - /// - /// Finds out if there is any intersection between two rotated rectangles. - /// If there is then the vertices of the interesecting region are returned as well. - /// Below are some examples of intersection configurations. - /// The hatched pattern indicates the intersecting region and the red - /// vertices are returned by the function. - /// - /// First rectangle - /// Second rectangle - /// - /// The output array of the verticies of the intersecting region. - /// It returns at most 8 vertices. - /// - public static RectanglesIntersectTypes RotatedRectangleIntersection( - RotatedRect rect1, RotatedRect rect2, out Point2f[] intersectingRegion) - { - using (var intersectingRegionVec = new VectorOfPoint2f()) - { - int ret = NativeMethods.imgproc_rotatedRectangleIntersection_OutputArray( - rect1, rect2, intersectingRegionVec.CvPtr); - intersectingRegion = intersectingRegionVec.ToArray(); - return (RectanglesIntersectTypes) ret; - } - } + /// + /// Draws simple, thick or filled rectangle + /// + /// Image. + /// One of the rectangle vertices. + /// Opposite rectangle vertex. + /// Line color (RGB) or brightness (grayscale image). + /// Thickness of lines that make up the rectangle. + /// Negative values make the function to draw a filled rectangle. [By default this is 1] + /// Type of the line, see cvLine description. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public static void Rectangle( + Mat img, Point pt1, Point pt2, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); - #endregion + NativeMethods.HandleException( + NativeMethods.imgproc_rectangle_Mat_Point(img.CvPtr, pt1, pt2, color, thickness, (int)lineType, shift)); + GC.KeepAlive(img); + } - /// - /// Applies a GNU Octave/MATLAB equivalent colormap on a given image. - /// - /// - /// - /// - public static void ApplyColorMap(InputArray src, OutputArray dst, ColormapTypes colormap) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.imgproc_applyColorMap(src.CvPtr, dst.CvPtr, (int)colormap); - GC.KeepAlive(src); - dst.Fix(); - } + /// + /// Draws a circle + /// + /// Image where the circle is drawn. + /// X-coordinate of the center of the circle. + /// Y-coordinate of the center of the circle. + /// Radius of the circle. + /// Circle color. + /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] + /// Type of the circle boundary. [By default this is LineType.Link8] + /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] + public static void Circle(InputOutputArray img, int centerX, int centerY, int radius, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Circle(img, new Point(centerX, centerY), radius, color, thickness, lineType, shift); + } - #region Drawing - #region Line -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 画像 - /// 線分の1番目の端点x - /// 線分の1番目の端点y - /// 線分の2番目の端点x - /// 線分の2番目の端点y - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a line segment connecting two points - /// - /// The image. - /// First point's x-coordinate of the line segment. - /// First point's y-coordinate of the line segment. - /// Second point's x-coordinate of the line segment. - /// Second point's y-coordinate of the line segment. - /// Line color. - /// Line thickness. [By default this is 1] - /// Type of the line. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public static void Line(InputOutputArray img, int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Line(img, new Point(pt1X, pt1Y), new Point(pt2X, pt2Y), color, thickness, lineType, shift); - } + /// + /// Draws a circle + /// + /// Image where the circle is drawn. + /// Center of the circle. + /// Radius of the circle. + /// Circle color. + /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] + /// Type of the circle boundary. [By default this is LineType.Link8] + /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] + public static void Circle(InputOutputArray img, Point center, int radius, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_circle(img.CvPtr, center, radius, color, thickness, (int) lineType, shift)); + img.Fix(); + GC.KeepAlive(img); + } -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 画像 - /// 線分の1番目の端点 - /// 線分の2番目の端点 - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a line segment connecting two points - /// - /// The image. - /// First point of the line segment. - /// Second point of the line segment. - /// Line color. - /// Line thickness. [By default this is 1] - /// Type of the line. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public static void Line( - InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfNotReady(); - NativeMethods.imgproc_line(img.CvPtr, pt1, pt2, color, thickness, (int)lineType, shift); - img.Fix(); - } - #endregion - - /// - /// Draws a arrow segment pointing from the first point to the second one. - /// The function arrowedLine draws an arrow between pt1 and pt2 points in the image. - /// See also cv::line. - /// - /// Image. - /// The point the arrow starts from. - /// The point the arrow points to. - /// Line color. - /// Line thickness. - /// Type of the line, see cv::LineTypes - /// Number of fractional bits in the point coordinates. - /// The length of the arrow tip in relation to the arrow length - public static void ArrowedLine( - InputOutputArray img, - Point pt1, Point pt2, - Scalar color, - int thickness = 1, - LineTypes lineType = LineTypes.Link8, - int shift = 0, - double tipLength = 0.1) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfNotReady(); + /// + /// Draws simple or thick elliptic arc or fills ellipse sector + /// + /// Image. + /// Center of the ellipse. + /// Length of the ellipse axes. + /// Rotation angle. + /// Starting angle of the elliptic arc. + /// Ending angle of the elliptic arc. + /// Ellipse color. + /// Thickness of the ellipse arc. [By default this is 1] + /// Type of the ellipse boundary. [By default this is LineType.Link8] + /// Number of fractional bits in the center coordinates and axes' values. [By default this is 0] + public static void Ellipse( + InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfNotReady(); - NativeMethods.imgproc_arrowedLine( - img.CvPtr, pt1, pt2, color, thickness, (int)lineType, shift, tipLength); + NativeMethods.HandleException( + NativeMethods.imgproc_ellipse1( + img.CvPtr, center, axes, angle, startAngle, endAngle, color, thickness, (int) lineType, shift)); - img.Fix(); - } + img.Fix(); + GC.KeepAlive(img); + } - #region Rectangle -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形の一つの頂点 - /// 矩形の反対側の頂点 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws simple, thick or filled rectangle - /// - /// Image. - /// One of the rectangle vertices. - /// Opposite rectangle vertex. - /// Line color (RGB) or brightness (grayscale image). - /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] - /// Type of the line, see cvLine description. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public static void Rectangle( - InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - NativeMethods.imgproc_rectangle_InputOutputArray(img.CvPtr, pt1, pt2, color, thickness, (int)lineType, shift); - img.Fix(); - } + /// + /// Draws simple or thick elliptic arc or fills ellipse sector + /// + /// Image. + /// The enclosing box of the ellipse drawn + /// Ellipse color. + /// Thickness of the ellipse boundary. [By default this is 1] + /// Type of the ellipse boundary. [By default this is LineType.Link8] + public static void Ellipse(InputOutputArray img, RotatedRect box, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_ellipse2(img.CvPtr, box, color, thickness, (int) lineType)); + img.Fix(); + GC.KeepAlive(img); + } -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws simple, thick or filled rectangle - /// - /// Image. - /// Rectangle. - /// Line color (RGB) or brightness (grayscale image). - /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] - /// Type of the line, see cvLine description. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public static void Rectangle( - InputOutputArray img, Rect rect, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - NativeMethods.imgproc_rectangle_InputOutputArray(img.CvPtr, rect.TopLeft, rect.BottomRight, color, thickness, (int)lineType, shift); - img.Fix(); - } + /// + /// Draws a marker on a predefined position in an image. + /// + /// The function cv::drawMarker draws a marker on a given position in the image.For the moment several + /// marker types are supported, see #MarkerTypes for more information. + /// + /// Image. + /// The point where the crosshair is positioned. + /// Line color. + /// The specific type of marker you want to use. + /// The length of the marker axis [default = 20 pixels] + /// Line thickness. + /// Type of the line. + public static void DrawMarker( + InputOutputArray img, Point position, Scalar color, + MarkerTypes markerType = MarkerTypes.Cross, int markerSize = 20, int thickness = 1, LineTypes lineType = LineTypes.Link8) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形の一つの頂点 - /// 矩形の反対側の頂点 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws simple, thick or filled rectangle - /// - /// Image. - /// One of the rectangle vertices. - /// Opposite rectangle vertex. - /// Line color (RGB) or brightness (grayscale image). - /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] - /// Type of the line, see cvLine description. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public static void Rectangle( - Mat img, Point pt1, Point pt2, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - Rect rect = Rect.FromLTRB(pt1.X, pt1.Y, pt2.X, pt2.Y); - NativeMethods.imgproc_rectangle_Mat(img.CvPtr, rect, color, thickness, (int)lineType, shift); - GC.KeepAlive(img); - } + NativeMethods.HandleException( + NativeMethods.imgproc_drawMarker( + img.CvPtr, position, color, (int)markerType, markerSize, thickness, (int)lineType)); -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws simple, thick or filled rectangle - /// - /// Image. - /// Rectangle. - /// Line color (RGB) or brightness (grayscale image). - /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] - /// Type of the line, see cvLine description. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public static void Rectangle( - Mat img, Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - NativeMethods.imgproc_rectangle_Mat(img.CvPtr, rect, color, thickness, (int)lineType, shift); - GC.KeepAlive(img); - } + img.Fix(); + GC.KeepAlive(img); + } - #endregion - #region Circle -#if LANG_JP - /// - /// 円を描画する - /// - /// 画像 - /// 円の中心のx座標 - /// 円の中心のy座標 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a circle - /// - /// Image where the circle is drawn. - /// X-coordinate of the center of the circle. - /// Y-coordinate of the center of the circle. - /// Radius of the circle. - /// Circle color. - /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] - /// Type of the circle boundary. [By default this is LineType.Link8] - /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif - public static void Circle(InputOutputArray img, int centerX, int centerY, int radius, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Circle(img, new Point(centerX, centerY), radius, color, thickness, lineType, shift); - } + /// + /// Fills a convex polygon. + /// + /// Image + /// The polygon vertices + /// Polygon color + /// Type of the polygon boundaries + /// The number of fractional bits in the vertex coordinates + public static void FillConvexPoly(Mat img, IEnumerable pts, Scalar color, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + var ptsArray = pts.ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_fillConvexPoly_Mat( + img.CvPtr, ptsArray, ptsArray.Length, color, (int) lineType, shift)); + GC.KeepAlive(img); + } -#if LANG_JP - /// - /// 円を描画する - /// - /// 画像 - /// 円の中心 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a circle - /// - /// Image where the circle is drawn. - /// Center of the circle. - /// Radius of the circle. - /// Circle color. - /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] - /// Type of the circle boundary. [By default this is LineType.Link8] - /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif - public static void Circle(InputOutputArray img, Point center, int radius, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - NativeMethods.imgproc_circle(img.CvPtr, center, radius, color, thickness, (int)lineType, shift); - img.Fix(); - } - #endregion - #region Ellipse -#if LANG_JP - /// - /// 枠だけの楕円,楕円弧,もしくは塗りつぶされた扇形の楕円を描画する - /// - /// 楕円が描画される画像 - /// 楕円の中心 - /// 楕円の軸の長さ - /// 回転角度 - /// 楕円弧の開始角度 - /// 楕円弧の終了角度 - /// 楕円の色 - /// 楕円弧の線の幅 [既定値は1] - /// 楕円弧の線の種類 [既定値はLineType.Link8] - /// 中心座標と軸の長さの小数点以下の桁を表すビット数 [既定値は0] -#else - /// - /// Draws simple or thick elliptic arc or fills ellipse sector - /// - /// Image. - /// Center of the ellipse. - /// Length of the ellipse axes. - /// Rotation angle. - /// Starting angle of the elliptic arc. - /// Ending angle of the elliptic arc. - /// Ellipse color. - /// Thickness of the ellipse arc. [By default this is 1] - /// Type of the ellipse boundary. [By default this is LineType.Link8] - /// Number of fractional bits in the center coordinates and axes' values. [By default this is 0] -#endif - public static void Ellipse( - InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfNotReady(); - NativeMethods.imgproc_ellipse1(img.CvPtr, center, axes, angle, startAngle, endAngle, color, thickness, (int)lineType, shift); - img.Fix(); - } + /// + /// Fills a convex polygon. + /// + /// Image + /// The polygon vertices + /// Polygon color + /// Type of the polygon boundaries + /// The number of fractional bits in the vertex coordinates + public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar color, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (pts is null) + throw new ArgumentNullException(nameof(pts)); + img.ThrowIfDisposed(); + pts.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_fillConvexPoly_InputOutputArray( + img.CvPtr, pts.CvPtr, color, (int) lineType, shift)); + GC.KeepAlive(img); + GC.KeepAlive(pts); + } -#if LANG_JP - /// - /// 枠だけの楕円,もしくは塗りつぶされた楕円を描画する - /// - /// 楕円が描かれる画像. - /// 描画したい楕円を囲む矩形領域. - /// 楕円の色. - /// 楕円境界線の幅.[既定値は1] - /// 楕円境界線の種類.[既定値はLineType.Link8] -#else - /// - /// Draws simple or thick elliptic arc or fills ellipse sector - /// - /// Image. - /// The enclosing box of the ellipse drawn - /// Ellipse color. - /// Thickness of the ellipse boundary. [By default this is 1] - /// Type of the ellipse boundary. [By default this is LineType.Link8] -#endif - public static void Ellipse(InputOutputArray img, RotatedRect box, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - NativeMethods.imgproc_ellipse2(img.CvPtr, box, color, thickness, (int)lineType); - img.Fix(); - } - #endregion - #region FillConvexPoly -#if LANG_JP - /// - /// 塗りつぶされた凸ポリゴンを描きます. - /// - /// 画像 - /// ポリゴンの頂点. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. -#else - /// - /// Fills a convex polygon. - /// - /// Image - /// The polygon vertices - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates -#endif - public static void FillConvexPoly(Mat img, IEnumerable pts, Scalar color, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); + /// + /// Fills the area bounded by one or more polygons + /// + /// Image + /// Array of polygons, each represented as an array of points + /// Polygon color + /// Type of the polygon boundaries + /// The number of fractional bits in the vertex coordinates + /// + public static void FillPoly( + Mat img, IEnumerable> pts, Scalar color, + LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (pts is null) + throw new ArgumentNullException(nameof(pts)); - Point[] ptsArray = EnumerableEx.ToArray(pts); - NativeMethods.imgproc_fillConvexPoly_Mat(img.CvPtr, ptsArray, ptsArray.Length, color, (int)lineType, shift); - GC.KeepAlive(img); - } + img.ThrowIfDisposed(); + var offset0 = offset.GetValueOrDefault(new Point()); -#if LANG_JP - /// - /// 塗りつぶされた凸ポリゴンを描きます. - /// - /// 画像 - /// ポリゴンの頂点. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. -#else - /// - /// Fills a convex polygon. - /// - /// Image - /// The polygon vertices - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates -#endif - public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar color, - LineTypes lineType = LineTypes.Link8, int shift = 0) + var ptsList = new List(); + var nptsList = new List(); + foreach (var pts1 in pts) { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (pts == null) - throw new ArgumentNullException(nameof(pts)); - img.ThrowIfDisposed(); - pts.ThrowIfDisposed(); - - NativeMethods.imgproc_fillConvexPoly_InputOutputArray( - img.CvPtr, pts.CvPtr, color, (int)lineType, shift); - GC.KeepAlive(img); - GC.KeepAlive(pts); + var pts1Arr = pts1.ToArray(); + ptsList.Add(pts1Arr); + nptsList.Add(pts1Arr.Length); } - #endregion - #region FillPoly -#if LANG_JP - /// - /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします. - /// - /// 画像 - /// ポリゴンの配列.各要素は,点の配列で表現されます. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. - /// -#else - /// - /// Fills the area bounded by one or more polygons - /// - /// Image - /// Array of polygons, each represented as an array of points - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates - /// -#endif - public static void FillPoly( - Mat img, IEnumerable> pts, Scalar color, - LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) + var ptsArr = ptsList.ToArray(); + var npts = nptsList.ToArray(); + var ncontours = ptsArr.Length; + using (var ptsPtr = new ArrayAddress2(ptsArr)) { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - Point offset0 = offset.GetValueOrDefault(new Point()); - - List ptsList = new List(); - List nptsList = new List(); - foreach (IEnumerable pts1 in pts) - { - Point[] pts1Arr = EnumerableEx.ToArray(pts1); - ptsList.Add(pts1Arr); - nptsList.Add(pts1Arr.Length); - } - Point[][] ptsArr = ptsList.ToArray(); - int[] npts = nptsList.ToArray(); - int ncontours = ptsArr.Length; - using (var ptsPtr = new ArrayAddress2(ptsArr)) - { + NativeMethods.HandleException( NativeMethods.imgproc_fillPoly_Mat( - img.CvPtr, ptsPtr.Pointer, npts, ncontours, color, (int)lineType, shift, offset0); - } + img.CvPtr, ptsPtr.GetPointer(), npts, ncontours, color, (int) lineType, shift, offset0)); } + GC.KeepAlive(img); + } -#if LANG_JP - /// - /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします. - /// - /// 画像 - /// ポリゴンの配列.各要素は,点の配列で表現されます. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. - /// -#else - /// - /// Fills the area bounded by one or more polygons - /// - /// Image - /// Array of polygons, each represented as an array of points - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates - /// -#endif - public static void FillPoly( - InputOutputArray img, InputArray pts, Scalar color, - LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (pts == null) - throw new ArgumentNullException(nameof(pts)); - img.ThrowIfDisposed(); - pts.ThrowIfDisposed(); - Point offset0 = offset.GetValueOrDefault(new Point()); - + /// + /// Fills the area bounded by one or more polygons + /// + /// Image + /// Array of polygons, each represented as an array of points + /// Polygon color + /// Type of the polygon boundaries + /// The number of fractional bits in the vertex coordinates + /// + public static void FillPoly( + InputOutputArray img, InputArray pts, Scalar color, + LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (pts is null) + throw new ArgumentNullException(nameof(pts)); + img.ThrowIfDisposed(); + pts.ThrowIfDisposed(); + var offset0 = offset.GetValueOrDefault(new Point()); + + NativeMethods.HandleException( NativeMethods.imgproc_fillPoly_InputOutputArray( - img.CvPtr, pts.CvPtr, color, (int)lineType, shift, offset0); + img.CvPtr, pts.CvPtr, color, (int) lineType, shift, offset0)); + GC.KeepAlive(img); + GC.KeepAlive(pts); + img.Fix(); + } - GC.KeepAlive(pts); - img.Fix(); - } - #endregion - #region Polylines - /// - /// draws one or more polygonal curves - /// - /// - /// - /// - /// - /// - /// - /// - public static void Polylines( - Mat img, IEnumerable> pts, bool isClosed, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); + /// + /// draws one or more polygonal curves + /// + /// + /// + /// + /// + /// + /// + /// + public static void Polylines( + Mat img, + IEnumerable> pts, + bool isClosed, + Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (pts is null) + throw new ArgumentNullException(nameof(pts)); + img.ThrowIfDisposed(); + + var ptsList = new List(); + var nptsList = new List(); + foreach (var pts1 in pts) + { + var pts1Arr = pts1.ToArray(); + ptsList.Add(pts1Arr); + nptsList.Add(pts1Arr.Length); + } + var ptsArr = ptsList.ToArray(); + var npts = nptsList.ToArray(); + var ncontours = ptsArr.Length; + using var ptsPtr = new ArrayAddress2(ptsArr); + + NativeMethods.HandleException( + NativeMethods.imgproc_polylines_Mat( + img.CvPtr, ptsPtr.GetPointer(), npts, ncontours, isClosed ? 1 : 0, color, thickness, (int) lineType, shift)); + GC.KeepAlive(img); + } + + /// + /// draws one or more polygonal curves + /// + /// + /// + /// + /// + /// + /// + /// + public static void Polylines( + InputOutputArray img, InputArray pts, bool isClosed, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (pts is null) + throw new ArgumentNullException(nameof(pts)); + img.ThrowIfDisposed(); + pts.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_polylines_InputOutputArray( + img.CvPtr, pts.CvPtr, isClosed ? 1 : 0, color, thickness, (int) lineType, shift)); + GC.KeepAlive(img); + img.Fix(); + GC.KeepAlive(pts); + } - List ptsList = new List(); - List nptsList = new List(); - foreach (IEnumerable pts1 in pts) + /// + /// draws contours in the image + /// + /// Destination image. + /// All the input contours. Each contour is stored as a point vector. + /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. + /// Color of the contours. + /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), + /// the contour interiors are drawn. + /// Line connectivity. + /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours + /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. + /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, + /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account + /// when there is hierarchy available. + /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) + public static void DrawContours( + InputOutputArray image, + IEnumerable> contours, + int contourIdx, + Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + IEnumerable? hierarchy = null, + int maxLevel = int.MaxValue, + Point? offset = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (contours is null) + throw new ArgumentNullException(nameof(contours)); + image.ThrowIfNotReady(); + + var offset0 = offset.GetValueOrDefault(new Point()); + var contoursArray = contours.Select(c => c.ToArray()).ToArray(); + var contourSize2 = contoursArray.Select(pts => pts.Length).ToArray(); + using (var contoursPtr = new ArrayAddress2(contoursArray)) + { + if (hierarchy is null) { - Point[] pts1Arr = EnumerableEx.ToArray(pts1); - ptsList.Add(pts1Arr); - nptsList.Add(pts1Arr.Length); + NativeMethods.HandleException( + NativeMethods.imgproc_drawContours_vector( + image.CvPtr, contoursPtr.GetPointer(), contoursArray.Length, contourSize2, + contourIdx, color, thickness, (int) lineType, IntPtr.Zero, 0, maxLevel, offset0)); } - Point[][] ptsArr = ptsList.ToArray(); - int[] npts = nptsList.ToArray(); - int ncontours = ptsArr.Length; - using (ArrayAddress2 ptsPtr = new ArrayAddress2(ptsArr)) + else { - NativeMethods.imgproc_polylines_Mat( - img.CvPtr, ptsPtr.Pointer, npts, ncontours, isClosed ? 1 : 0, color, thickness, (int)lineType, shift); + var hierarchyVecs = hierarchy.Select(hi => hi.ToVec4i()).ToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_drawContours_vector( + image.CvPtr, contoursPtr.GetPointer(), contoursArray.Length, contourSize2, + contourIdx, color, thickness, (int) lineType, hierarchyVecs, hierarchyVecs.Length, maxLevel, offset0)); } } + GC.KeepAlive(image); + image.Fix(); + } - /// - /// draws one or more polygonal curves - /// - /// - /// - /// - /// - /// - /// - /// - public static void Polylines( - InputOutputArray img, InputArray pts, bool isClosed, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (pts == null) - throw new ArgumentNullException(nameof(pts)); - img.ThrowIfDisposed(); - pts.ThrowIfDisposed(); + /// + /// draws contours in the image + /// + /// Destination image. + /// All the input contours. Each contour is stored as a point vector. + /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. + /// Color of the contours. + /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), + /// the contour interiors are drawn. + /// Line connectivity. + /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours + /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. + /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, + /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account + /// when there is hierarchy available. + /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) + public static void DrawContours( + InputOutputArray image, + IEnumerable contours, + int contourIdx, + Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + Mat? hierarchy = null, + int maxLevel = int.MaxValue, + Point? offset = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (contours is null) + throw new ArgumentNullException(nameof(contours)); + image.ThrowIfNotReady(); + + var offset0 = offset.GetValueOrDefault(new Point()); + var contoursPtr = contours.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.imgproc_drawContours_InputArray( + image.CvPtr, contoursPtr, contoursPtr.Length, + contourIdx, color, thickness, (int) lineType, ToPtr(hierarchy), maxLevel, offset0)); + image.Fix(); + GC.KeepAlive(image); + GC.KeepAlive(contours); + GC.KeepAlive(hierarchy); + } - NativeMethods.imgproc_polylines_InputOutputArray( - img.CvPtr, pts.CvPtr, isClosed ? 1 : 0, color, thickness, (int)lineType, shift); + /// + /// Clips the line against the image rectangle + /// + /// The image size + /// The first line point + /// The second line point + /// + public static bool ClipLine(Size imgSize, ref Point pt1, ref Point pt2) + { + NativeMethods.HandleException( + NativeMethods.imgproc_clipLine1(imgSize, ref pt1, ref pt2, out var ret)); + return ret != 0; + } - img.Fix(); - GC.KeepAlive(pts); - } + /// + /// Clips the line against the image rectangle + /// + /// sThe image rectangle + /// The first line point + /// The second line point + /// + public static bool ClipLine(Rect imgRect, ref Point pt1, ref Point pt2) + { + NativeMethods.HandleException( + NativeMethods.imgproc_clipLine2(imgRect, ref pt1, ref pt2, out var ret)); + return ret != 0; + } - #endregion - - #region DrawContours -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 出力画像 - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else - /// - /// draws contours in the image - /// - /// Destination image. - /// All the input contours. Each contour is stored as a point vector. - /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. - /// Color of the contours. - /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), - /// the contour interiors are drawn. - /// Line connectivity. - /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours - /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. - /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, - /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account - /// when there is hierarchy available. - /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif - public static void DrawContours( - InputOutputArray image, - IEnumerable> contours, - int contourIdx, - Scalar color, - int thickness = 1, - LineTypes lineType = LineTypes.Link8, - IEnumerable hierarchy = null, - int maxLevel = Int32.MaxValue, - Point? offset = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (contours == null) - throw new ArgumentNullException(nameof(contours)); - image.ThrowIfNotReady(); - - Point offset0 = offset.GetValueOrDefault(new Point()); - Point[][] contoursArray = EnumerableEx.SelectToArray(contours, EnumerableEx.ToArray); - int[] contourSize2 = EnumerableEx.SelectToArray(contoursArray, pts => pts.Length); - using (var contoursPtr = new ArrayAddress2(contoursArray)) - { - if (hierarchy == null) - { - NativeMethods.imgproc_drawContours_vector(image.CvPtr, contoursPtr.Pointer, contoursArray.Length, contourSize2, - contourIdx, color, thickness, (int)lineType, IntPtr.Zero, 0, maxLevel, offset0); - } - else - { - Vec4i[] hiearchyVecs = EnumerableEx.SelectToArray(hierarchy, hi => hi.ToVec4i()); - NativeMethods.imgproc_drawContours_vector(image.CvPtr, contoursPtr.Pointer, contoursArray.Length, contourSize2, - contourIdx, color, thickness, (int)lineType, hiearchyVecs, hiearchyVecs.Length, maxLevel, offset0); - } - } + /// + /// Approximates an elliptic arc with a polyline. + /// The function ellipse2Poly computes the vertices of a polyline that + /// approximates the specified elliptic arc. It is used by cv::ellipse. + /// + /// Center of the arc. + /// Half of the size of the ellipse main axes. See the ellipse for details. + /// Rotation angle of the ellipse in degrees. See the ellipse for details. + /// Starting angle of the elliptic arc in degrees. + /// Ending angle of the elliptic arc in degrees. + /// Angle between the subsequent polyline vertices. It defines the approximation + /// Output vector of polyline vertices. + public static Point[] Ellipse2Poly(Point center, Size axes, int angle, + int arcStart, int arcEnd, int delta) + { + using var vec = new VectorOfPoint(); + NativeMethods.HandleException( + NativeMethods.imgproc_ellipse2Poly_int(center, axes, angle, arcStart, arcEnd, delta, vec.CvPtr)); + return vec.ToArray(); + } - image.Fix(); - } -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 出力画像 - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else - /// - /// draws contours in the image - /// - /// Destination image. - /// All the input contours. Each contour is stored as a point vector. - /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. - /// Color of the contours. - /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), - /// the contour interiors are drawn. - /// Line connectivity. - /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours - /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. - /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, - /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account - /// when there is hierarchy available. - /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif - public static void DrawContours( - InputOutputArray image, - IEnumerable contours, - int contourIdx, - Scalar color, - int thickness = 1, - LineTypes lineType = LineTypes.Link8, - Mat hierarchy = null, - int maxLevel = Int32.MaxValue, - Point? offset = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (contours == null) - throw new ArgumentNullException(nameof(contours)); - image.ThrowIfNotReady(); - - Point offset0 = offset.GetValueOrDefault(new Point()); - IntPtr[] contoursPtr = EnumerableEx.SelectPtrs(contours); - NativeMethods.imgproc_drawContours_InputArray(image.CvPtr, contoursPtr, contoursPtr.Length, - contourIdx, color, thickness, (int)lineType, ToPtr(hierarchy), maxLevel, offset0); - image.Fix(); - } - #endregion - - #region ClipLine -#if LANG_JP - /// - /// 線分が画像矩形内に収まるように切り詰めます. - /// - /// 画像サイズ. - /// 線分の1番目の端点. - /// 線分の2番目の端点. - /// -#else - /// - /// Clips the line against the image rectangle - /// - /// The image size - /// The first line point - /// The second line point - /// -#endif - public static bool ClipLine(Size imgSize, ref Point pt1, ref Point pt2) - { - return NativeMethods.imgproc_clipLine1(imgSize, ref pt1, ref pt2) != 0; - } -#if LANG_JP - /// - /// 線分が画像矩形内に収まるように切り詰めます. - /// - /// 画像矩形. - /// 線分の1番目の端点. - /// 線分の2番目の端点. - /// -#else - /// - /// Clips the line against the image rectangle - /// - /// sThe image rectangle - /// The first line point - /// The second line point - /// -#endif - public static bool ClipLine(Rect imgRect, ref Point pt1, ref Point pt2) - { - return NativeMethods.imgproc_clipLine2(imgRect, ref pt1, ref pt2) != 0; - } - #endregion - - /// - /// Approximates an elliptic arc with a polyline. - /// The function ellipse2Poly computes the vertices of a polyline that - /// approximates the specified elliptic arc. It is used by cv::ellipse. - /// - /// Center of the arc. - /// Half of the size of the ellipse main axes. See the ellipse for details. - /// Rotation angle of the ellipse in degrees. See the ellipse for details. - /// Starting angle of the elliptic arc in degrees. - /// Ending angle of the elliptic arc in degrees. - /// Angle between the subsequent polyline vertices. It defines the approximation - /// Output vector of polyline vertices. - public static Point[] Ellipse2Poly(Point center, Size axes, int angle, - int arcStart, int arcEnd, int delta) - { - using (var vec = new VectorOfPoint()) - { - NativeMethods.imgproc_ellipse2Poly(center, axes, angle, arcStart, arcEnd, delta, vec.CvPtr); - return vec.ToArray(); - } - } + /// + /// Approximates an elliptic arc with a polyline. + /// The function ellipse2Poly computes the vertices of a polyline that + /// approximates the specified elliptic arc. It is used by cv::ellipse. + /// + /// Center of the arc. + /// Half of the size of the ellipse main axes. See the ellipse for details. + /// Rotation angle of the ellipse in degrees. See the ellipse for details. + /// Starting angle of the elliptic arc in degrees. + /// Ending angle of the elliptic arc in degrees. + /// Angle between the subsequent polyline vertices. It defines the approximation + /// Output vector of polyline vertices. + public static Point2d[] Ellipse2Poly(Point2d center, Size2d axes, int angle, + int arcStart, int arcEnd, int delta) + { + using var vec = new VectorOfPoint2d(); + NativeMethods.HandleException( + NativeMethods.imgproc_ellipse2Poly_double(center, axes, angle, arcStart, arcEnd, delta, vec.CvPtr)); + return vec.ToArray(); + } - /// - /// renders text string in the image - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void PutText(InputOutputArray img, string text, Point org, - HersheyFonts fontFace, double fontScale, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, bool bottomLeftOrigin = false) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (String.IsNullOrEmpty(text)) - throw new ArgumentNullException(text); - img.ThrowIfDisposed(); - NativeMethods.core_putText(img.CvPtr, text, org, (int)fontFace, fontScale, color, - thickness, (int)lineType, bottomLeftOrigin ? 1 : 0); - img.Fix(); - } + /// + /// renders text string in the image + /// + /// Image. + /// Text string to be drawn. + /// Bottom-left corner of the text string in the image. + /// Font type, see #HersheyFonts. + /// Font scale factor that is multiplied by the font-specific base size. + /// Text color. + /// Thickness of the lines used to draw a text. + /// Line type. See #LineTypes + /// When true, the image data origin is at the bottom-left corner. + /// Otherwise, it is at the top-left corner. + public static void PutText(InputOutputArray img, string text, Point org, + HersheyFonts fontFace, double fontScale, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, bool bottomLeftOrigin = false) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (string.IsNullOrEmpty(text)) + throw new ArgumentNullException(text); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_putText(img.CvPtr, text, org, (int) fontFace, fontScale, color, + thickness, (int) lineType, bottomLeftOrigin ? 1 : 0)); + + img.Fix(); + GC.KeepAlive(img); + } - /// - /// returns bounding box of the text string - /// - /// - /// - /// - /// - /// - /// - public static Size GetTextSize(string text, HersheyFonts fontFace, - double fontScale, int thickness, out int baseLine) - { - if (String.IsNullOrEmpty(text)) - throw new ArgumentNullException(text); - return NativeMethods.core_getTextSize(text, (int)fontFace, fontScale, thickness, out baseLine); - } + /// + /// returns bounding box of the text string + /// + /// Input text string. + /// Font to use, see #HersheyFonts. + /// Font scale factor that is multiplied by the font-specific base size. + /// Thickness of lines used to render the text. See #putText for details. + /// baseLine y-coordinate of the baseline relative to the bottom-most text + /// The size of a box that contains the specified text. + public static Size GetTextSize(string text, HersheyFonts fontFace, + double fontScale, int thickness, out int baseLine) + { + if (string.IsNullOrEmpty(text)) + throw new ArgumentNullException(text); - #endregion + NativeMethods.HandleException( + NativeMethods.imgproc_getTextSize(text, (int)fontFace, fontScale, thickness, out baseLine, out var ret)); + return ret; } + + /// + /// Calculates the font-specific size to use to achieve a given height in pixels. + /// + /// Font to use, see cv::HersheyFonts. + /// Pixel height to compute the fontScale for + /// Thickness of lines used to render the text.See putText for details. + /// The fontSize to use for cv::putText + public static double GetFontScaleFromHeight(HersheyFonts fontFace, int pixelHeight, int thickness = 1) + { + NativeMethods.HandleException( + NativeMethods.imgproc_getFontScaleFromHeight((int)fontFace, pixelHeight, thickness, out var ret)); + return ret; + } + + #endregion } diff --git a/src/OpenCvSharp/Cv2/Cv2_ml.cs b/src/OpenCvSharp/Cv2/Cv2_ml.cs deleted file mode 100644 index e0e58f043..000000000 --- a/src/OpenCvSharp/Cv2/Cv2_ml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - static partial class Cv2 - { - } -} diff --git a/src/OpenCvSharp/Cv2/Cv2_objdetect.cs b/src/OpenCvSharp/Cv2/Cv2_objdetect.cs index 72e09f81d..eed20bc6a 100644 --- a/src/OpenCvSharp/Cv2/Cv2_objdetect.cs +++ b/src/OpenCvSharp/Cv2/Cv2_objdetect.cs @@ -1,138 +1,138 @@ -using System; -using System.Collections.Generic; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp +namespace OpenCvSharp; + +static partial class Cv2 { - static partial class Cv2 + /// + /// Groups the object candidate rectangles. + /// + /// Input/output vector of rectangles. Output vector includes retained and grouped rectangles. + /// Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. + /// + public static void GroupRectangles(IList rectList, int groupThreshold, double eps = 0.2) { - /// - /// Groups the object candidate rectangles. - /// - /// Input/output vector of rectangles. Output vector includes retained and grouped rectangles. - /// Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. - /// - public static void GroupRectangles(IList rectList, int groupThreshold, double eps = 0.2) - { - if (rectList == null) - throw new ArgumentNullException(nameof(rectList)); - - using (var rectListVec = new VectorOfRect(rectList)) - { - NativeMethods.objdetect_groupRectangles1(rectListVec.CvPtr, groupThreshold, eps); - ClearAndAddRange(rectList, rectListVec.ToArray()); - } - } + if (rectList is null) + throw new ArgumentNullException(nameof(rectList)); - /// - /// Groups the object candidate rectangles. - /// - /// Input/output vector of rectangles. Output vector includes retained and grouped rectangles. - /// - /// Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. - /// Relative difference between sides of the rectangles to merge them into a group. - public static void GroupRectangles(IList rectList, out int[] weights, int groupThreshold, double eps = 0.2) - { - if (rectList == null) - throw new ArgumentNullException(nameof(rectList)); - - using (var rectListVec = new VectorOfRect(rectList)) - using (var weightsVec = new VectorOfInt32()) - { - NativeMethods.objdetect_groupRectangles2(rectListVec.CvPtr, weightsVec.CvPtr, groupThreshold, eps); - ClearAndAddRange(rectList, rectListVec.ToArray()); - weights = weightsVec.ToArray(); - } - } + using var rectListVec = new VectorOfRect(rectList); - /// - /// Groups the object candidate rectangles. - /// - /// - /// - /// - /// - /// - public static void GroupRectangles(IList rectList, int groupThreshold, double eps, out int[] weights, out double[] levelWeights) - { - if (rectList == null) - throw new ArgumentNullException(nameof(rectList)); - - using (var rectListVec = new VectorOfRect(rectList)) - using (var weightsVec = new VectorOfInt32()) - using (var levelWeightsVec = new VectorOfDouble()) - { - NativeMethods.objdetect_groupRectangles3(rectListVec.CvPtr, groupThreshold, eps, weightsVec.CvPtr, levelWeightsVec.CvPtr); - ClearAndAddRange(rectList, rectListVec.ToArray()); - weights = weightsVec.ToArray(); - levelWeights = levelWeightsVec.ToArray(); - } - } + NativeMethods.HandleException( + NativeMethods.objdetect_groupRectangles1(rectListVec.CvPtr, groupThreshold, eps)); - /// - /// Groups the object candidate rectangles. - /// - /// - /// - /// - /// - /// - public static void GroupRectangles(IList rectList, out int[] rejectLevels, out double[] levelWeights, int groupThreshold, double eps = 0.2) - { - if (rectList == null) - throw new ArgumentNullException(nameof(rectList)); - - using (var rectListVec = new VectorOfRect(rectList)) - using (var rejectLevelsVec = new VectorOfInt32()) - using (var levelWeightsVec = new VectorOfDouble()) - { - NativeMethods.objdetect_groupRectangles4(rectListVec.CvPtr, rejectLevelsVec.CvPtr, levelWeightsVec.CvPtr, groupThreshold, eps); - ClearAndAddRange(rectList, rectListVec.ToArray()); - rejectLevels = rejectLevelsVec.ToArray(); - levelWeights = levelWeightsVec.ToArray(); - } - } + ClearAndAddRange(rectList, rectListVec.ToArray()); + } - /// - /// - /// - /// - /// - /// - /// - /// - public static void GroupRectanglesMeanshift(IList rectList, out double[] foundWeights, - out double[] foundScales, double detectThreshold = 0.0, Size? winDetSize = null) - { - if (rectList == null) - throw new ArgumentNullException(nameof(rectList)); - - Size winDetSize0 = winDetSize.GetValueOrDefault(new Size(64, 128)); - - using (var rectListVec = new VectorOfRect(rectList)) - using (var foundWeightsVec = new VectorOfDouble()) - using (var foundScalesVec = new VectorOfDouble()) - { - NativeMethods.objdetect_groupRectangles_meanshift( - rectListVec.CvPtr, foundWeightsVec.CvPtr, foundScalesVec.CvPtr, detectThreshold, winDetSize0); - ClearAndAddRange(rectList, rectListVec.ToArray()); - foundWeights = foundWeightsVec.ToArray(); - foundScales = foundScalesVec.ToArray(); - } - } + /// + /// Groups the object candidate rectangles. + /// + /// Input/output vector of rectangles. Output vector includes retained and grouped rectangles. + /// + /// Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. + /// Relative difference between sides of the rectangles to merge them into a group. + public static void GroupRectangles(IList rectList, out int[] weights, int groupThreshold, double eps = 0.2) + { + if (rectList is null) + throw new ArgumentNullException(nameof(rectList)); + + using var rectListVec = new VectorOfRect(rectList); + using var weightsVec = new VectorOfInt32(); + + NativeMethods.HandleException( + NativeMethods.objdetect_groupRectangles2(rectListVec.CvPtr, weightsVec.CvPtr, groupThreshold, eps)); + + ClearAndAddRange(rectList, rectListVec.ToArray()); + weights = weightsVec.ToArray(); + } + + /// + /// Groups the object candidate rectangles. + /// + /// + /// + /// + /// + /// + public static void GroupRectangles(IList rectList, int groupThreshold, double eps, out int[] weights, out double[] levelWeights) + { + if (rectList is null) + throw new ArgumentNullException(nameof(rectList)); - /// - /// IListの要素にvaluesを設定する - /// - /// - /// - /// - private static void ClearAndAddRange(IList list, IEnumerable values) + using var rectListVec = new VectorOfRect(rectList); + using var weightsVec = new VectorOfInt32(); + using var levelWeightsVec = new VectorOfDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_groupRectangles3( + rectListVec.CvPtr, groupThreshold, eps, weightsVec.CvPtr, levelWeightsVec.CvPtr)); + + ClearAndAddRange(rectList, rectListVec.ToArray()); + weights = weightsVec.ToArray(); + levelWeights = levelWeightsVec.ToArray(); + } + + /// + /// Groups the object candidate rectangles. + /// + /// + /// + /// + /// + /// + public static void GroupRectangles(IList rectList, out int[] rejectLevels, out double[] levelWeights, int groupThreshold, double eps = 0.2) + { + if (rectList is null) + throw new ArgumentNullException(nameof(rectList)); + + using var rectListVec = new VectorOfRect(rectList); + using var rejectLevelsVec = new VectorOfInt32(); + using var levelWeightsVec = new VectorOfDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_groupRectangles4( + rectListVec.CvPtr, rejectLevelsVec.CvPtr, levelWeightsVec.CvPtr, groupThreshold, eps)); + + ClearAndAddRange(rectList, rectListVec.ToArray()); + rejectLevels = rejectLevelsVec.ToArray(); + levelWeights = levelWeightsVec.ToArray(); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public static void GroupRectanglesMeanshift(IList rectList, out double[] foundWeights, + out double[] foundScales, double detectThreshold = 0.0, Size? winDetSize = null) + { + if (rectList is null) + throw new ArgumentNullException(nameof(rectList)); + + var winDetSize0 = winDetSize.GetValueOrDefault(new Size(64, 128)); + + using var rectListVec = new VectorOfRect(rectList); + using var foundWeightsVec = new VectorOfDouble(); + using var foundScalesVec = new VectorOfDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_groupRectangles_meanshift( + rectListVec.CvPtr, foundWeightsVec.CvPtr, foundScalesVec.CvPtr, detectThreshold, winDetSize0)); + + ClearAndAddRange(rectList, rectListVec.ToArray()); + foundWeights = foundWeightsVec.ToArray(); + foundScales = foundScalesVec.ToArray(); + } + + private static void ClearAndAddRange(ICollection list, IEnumerable values) + { + list.Clear(); + foreach (var t in values) { - list.Clear(); - foreach (T t in values) - { - list.Add(t); - } + list.Add(t); } } } diff --git a/src/OpenCvSharp/Cv2/Cv2_optflow.cs b/src/OpenCvSharp/Cv2/Cv2_optflow.cs deleted file mode 100644 index 04c4f21a3..000000000 --- a/src/OpenCvSharp/Cv2/Cv2_optflow.cs +++ /dev/null @@ -1,211 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class Cv2 - { - /// - /// Updates motion history image using the current silhouette - /// - /// Silhouette mask that has non-zero pixels where the motion occurs. - /// Motion history image that is updated by the function (single-channel, 32-bit floating-point). - /// Current time in milliseconds or other units. - /// Maximal duration of the motion track in the same units as timestamp . - public static void UpdateMotionHistory( - InputArray silhouette, InputOutputArray mhi, - double timestamp, double duration) - { - if (silhouette == null) - throw new ArgumentNullException(nameof(silhouette)); - if (mhi == null) - throw new ArgumentNullException(nameof(mhi)); - silhouette.ThrowIfDisposed(); - mhi.ThrowIfNotReady(); - NativeMethods.optflow_motempl_updateMotionHistory( - silhouette.CvPtr, mhi.CvPtr, timestamp, duration); - mhi.Fix(); - } - - /// - /// Computes the motion gradient orientation image from the motion history image - /// - /// Motion history single-channel floating-point image. - /// Output mask image that has the type CV_8UC1 and the same size as mhi. - /// Its non-zero elements mark pixels where the motion gradient data is correct. - /// Output motion gradient orientation image that has the same type and the same size as mhi. - /// Each pixel of the image is a motion orientation, from 0 to 360 degrees. - /// Minimal (or maximal) allowed difference between mhi values within a pixel neighborhood. - /// Maximal (or minimal) allowed difference between mhi values within a pixel neighborhood. - /// That is, the function finds the minimum ( m(x,y) ) and maximum ( M(x,y) ) mhi values over 3x3 neighborhood of each pixel - /// and marks the motion orientation at (x, y) as valid only if: - /// min(delta1, delta2) <= M(x,y)-m(x,y) <= max(delta1, delta2). - /// - public static void CalcMotionGradient( - InputArray mhi, OutputArray mask, OutputArray orientation, - double delta1, double delta2, int apertureSize = 3) - { - if (mhi == null) - throw new ArgumentNullException(nameof(mhi)); - if (mask == null) - throw new ArgumentNullException(nameof(mask)); - if (orientation == null) - throw new ArgumentNullException(nameof(orientation)); - mhi.ThrowIfDisposed(); - mask.ThrowIfNotReady(); - orientation.ThrowIfNotReady(); - - NativeMethods.optflow_motempl_calcMotionGradient( - mhi.CvPtr, mask.CvPtr, orientation.CvPtr, delta1, delta2, apertureSize); - - mask.Fix(); - orientation.Fix(); - } - - /// - /// Computes the global orientation of the selected motion history image part - /// - /// Motion gradient orientation image calculated by the function CalcMotionGradient() . - /// Mask image. It may be a conjunction of a valid gradient mask, also calculated by CalcMotionGradient() , - /// and the mask of a region whose direction needs to be calculated. - /// Motion history image calculated by UpdateMotionHistory() . - /// Timestamp passed to UpdateMotionHistory() . - /// Maximum duration of a motion track in milliseconds, passed to UpdateMotionHistory() . - /// - public static double CalcGlobalOrientation( - InputArray orientation, InputArray mask, InputArray mhi, - double timestamp, double duration) - { - if (orientation == null) - throw new ArgumentNullException(nameof(orientation)); - if (mask == null) - throw new ArgumentNullException(nameof(mask)); - if (mhi == null) - throw new ArgumentNullException(nameof(mhi)); - orientation.ThrowIfDisposed(); - mask.ThrowIfDisposed(); - mhi.ThrowIfDisposed(); - - return NativeMethods.optflow_motempl_calcGlobalOrientation( - orientation.CvPtr, mask.CvPtr, mhi.CvPtr, timestamp, duration); - } - - /// - /// Splits a motion history image into a few parts corresponding to separate independent motions - /// (for example, left hand, right hand). - /// - /// Motion history image. - /// Image where the found mask should be stored, single-channel, 32-bit floating-point. - /// Vector containing ROIs of motion connected components. - /// Current time in milliseconds or other units. - /// Segmentation threshold that is recommended to be equal to the interval between motion history “steps” or greater. - public static void SegmentMotion( - InputArray mhi, OutputArray segmask, - out Rect[] boundingRects, - double timestamp, double segThresh) - { - if (mhi == null) - throw new ArgumentNullException(nameof(mhi)); - if (segmask == null) - throw new ArgumentNullException(nameof(segmask)); - mhi.ThrowIfDisposed(); - segmask.ThrowIfNotReady(); - - using (var br = new VectorOfRect()) - { - NativeMethods.optflow_motempl_segmentMotion( - mhi.CvPtr, segmask.CvPtr, br.CvPtr, timestamp, segThresh); - boundingRects = br.ToArray(); - } - segmask.Fix(); - } - - /// - /// computes dense optical flow using Simple Flow algorithm - /// - /// First 8-bit 3-channel image. - /// Second 8-bit 3-channel image - /// Estimated flow - /// Number of layers - /// Size of block through which we sum up when calculate cost function for pixel - /// maximal flow that we search at each level - public static void CalcOpticalFlowSF( - Mat from, - Mat to, - Mat flow, - int layers, - int averagingBlockSize, - int maxFlow) - { - if (from == null) - throw new ArgumentNullException(nameof(@from)); - if (to == null) - throw new ArgumentNullException(nameof(to)); - if (flow == null) - throw new ArgumentNullException(nameof(flow)); - from.ThrowIfDisposed(); - to.ThrowIfDisposed(); - flow.ThrowIfDisposed(); - - NativeMethods.optflow_calcOpticalFlowSF1( - from.CvPtr, to.CvPtr, flow.CvPtr, - layers, averagingBlockSize, maxFlow); - } - - /// - /// computes dense optical flow using Simple Flow algorithm - /// - /// First 8-bit 3-channel image. - /// Second 8-bit 3-channel image - /// Estimated flow - /// Number of layers - /// Size of block through which we sum up when calculate cost function for pixel - /// maximal flow that we search at each level - /// vector smooth spatial sigma parameter - /// vector smooth color sigma parameter - /// window size for postprocess cross bilateral filter - /// spatial sigma for postprocess cross bilateralf filter - /// color sigma for postprocess cross bilateral filter - /// threshold for detecting occlusions - /// window size for bilateral upscale operation - /// spatial sigma for bilateral upscale operation - /// color sigma for bilateral upscale operation - /// threshold to detect point with irregular flow - where flow should be recalculated after upscale - public static void calcOpticalFlowSF( - Mat from, - Mat to, - Mat flow, - int layers, - int averagingBlockSize, - int maxFlow, - double sigmaDist, - double sigmaColor, - int postprocessWindow, - double sigmaDistFix, - double sigmaColorFix, - double occThr, - int upscaleAveragingRadius, - double upscaleSigmaDist, - double upscaleSigmaColor, - double speedUpThr) - { - if (from == null) - throw new ArgumentNullException(nameof(@from)); - if (to == null) - throw new ArgumentNullException(nameof(to)); - if (flow == null) - throw new ArgumentNullException(nameof(flow)); - from.ThrowIfDisposed(); - to.ThrowIfDisposed(); - flow.ThrowIfDisposed(); - - NativeMethods.optflow_calcOpticalFlowSF2( - from.CvPtr, to.CvPtr, flow.CvPtr, - layers, averagingBlockSize, maxFlow, - sigmaDist, sigmaColor, postprocessWindow, sigmaDistFix, - sigmaColorFix, occThr, upscaleAveragingRadius, - upscaleSigmaDist, upscaleSigmaColor, speedUpThr); - } - } -} diff --git a/src/OpenCvSharp/Cv2/Cv2_photo.cs b/src/OpenCvSharp/Cv2/Cv2_photo.cs index 714f96649..23a08faee 100644 --- a/src/OpenCvSharp/Cv2/Cv2_photo.cs +++ b/src/OpenCvSharp/Cv2/Cv2_photo.cs @@ -1,517 +1,493 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; +using OpenCvSharp.Internal; -namespace OpenCvSharp +namespace OpenCvSharp; + +static partial class Cv2 { - static partial class Cv2 + /// + /// Restores the selected region in an image using the region neighborhood. + /// + /// Input 8-bit, 16-bit unsigned or 32-bit float 1-channel or 8-bit 3-channel image. + /// Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted. + /// Output image with the same size and type as src. + /// Radius of a circular neighborhood of each point inpainted that is considered by the algorithm. + /// Inpainting method that could be cv::INPAINT_NS or cv::INPAINT_TELEA + public static void Inpaint(InputArray src, InputArray inpaintMask, + OutputArray dst, double inpaintRadius, InpaintMethod flags) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (inpaintMask is null) + throw new ArgumentNullException(nameof(inpaintMask)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + inpaintMask.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.photo_inpaint(src.CvPtr, inpaintMask.CvPtr, dst.CvPtr, inpaintRadius, (int)flags)); + + dst.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(inpaintMask); + } + + /// + /// Perform image denoising using Non-local Means Denoising algorithm + /// with several computational optimizations. Noise expected to be a gaussian white noise + /// + /// Input 8-bit 1-channel, 2-channel or 3-channel image. + /// Output image with the same size and type as src . + /// + /// Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, + /// smaller h value preserves details but also preserves some noise + /// + /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels + /// + /// Size in pixels of the window that is used to compute weighted average for given pixel. + /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels + public static void FastNlMeansDenoising(InputArray src, OutputArray dst, float h = 3, + int templateWindowSize = 7, int searchWindowSize = 21) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.photo_fastNlMeansDenoising(src.CvPtr, dst.CvPtr, h, templateWindowSize, searchWindowSize)); + + dst.Fix(); + GC.KeepAlive(src); + } + + /// + /// Modification of fastNlMeansDenoising function for colored images + /// + /// Input 8-bit 3-channel image. + /// Output image with the same size and type as src. + /// Parameter regulating filter strength for luminance component. + /// Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise + /// The same as h but for color components. For most images value equals 10 will be enought + /// to remove colored noise and do not distort colors + /// + /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels + /// + /// Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. + /// Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels + public static void FastNlMeansDenoisingColored(InputArray src, OutputArray dst, + float h = 3, float hColor = 3, + int templateWindowSize = 7, int searchWindowSize = 21) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.photo_fastNlMeansDenoisingColored(src.CvPtr, dst.CvPtr, h, hColor, templateWindowSize, searchWindowSize)); + + dst.Fix(); + GC.KeepAlive(src); + } + + /// + /// Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured + /// in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. + /// + /// Input 8-bit 1-channel, 2-channel or 3-channel images sequence. All images should have the same type and size. + /// Output image with the same size and type as srcImgs images. + /// Target image to denoise index in srcImgs sequence + /// Number of surrounding images to use for target image denoising. + /// Should be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 + /// from srcImgs will be used to denoise srcImgs[imgToDenoiseIndex] image. + /// Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, + /// smaller h value preserves details but also preserves some noise + /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels + /// Size in pixels of the window that is used to compute weighted average for given pixel. + /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels + public static void FastNlMeansDenoisingMulti( + IEnumerable srcImgs, OutputArray dst, + int imgToDenoiseIndex, int temporalWindowSize, + float h = 3, int templateWindowSize = 7, int searchWindowSize = 21) + { + if (srcImgs is null) + throw new ArgumentNullException(nameof(srcImgs)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + dst.ThrowIfNotReady(); + var srcImgPtrs = srcImgs.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.photo_fastNlMeansDenoisingMulti( + srcImgPtrs, srcImgPtrs.Length, dst.CvPtr, + imgToDenoiseIndex, + temporalWindowSize, h, templateWindowSize, searchWindowSize)); + + dst.Fix(); + GC.KeepAlive(srcImgs); + } + + /// + /// Modification of fastNlMeansDenoisingMulti function for colored images sequences + /// + /// Input 8-bit 3-channel images sequence. All images should have the same type and size. + /// Output image with the same size and type as srcImgs images. + /// Target image to denoise index in srcImgs sequence + /// Number of surrounding images to use for target image denoising. Should be odd. + /// Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs + /// will be used to denoise srcImgs[imgToDenoiseIndex] image. + /// Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise + /// but also removes image details, smaller h value preserves details but also preserves some noise. + /// The same as h but for color components. + /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels + /// Size in pixels of the window that is used to compute weighted average for given pixel. + /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels + public static void FastNlMeansDenoisingColoredMulti( + IEnumerable srcImgs, OutputArray dst, + int imgToDenoiseIndex, int temporalWindowSize, float h = 3, float hColor = 3, + int templateWindowSize = 7, int searchWindowSize = 21) { - #region Inpaint - /// - /// restores the damaged image areas using one of the available intpainting algorithms - /// - /// - /// - /// - /// - /// - public static void Inpaint(InputArray src, InputArray inpaintMask, - OutputArray dst, double inpaintRadius, InpaintMethod flags) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (inpaintMask == null) - throw new ArgumentNullException(nameof(inpaintMask)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - inpaintMask.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.photo_inpaint(src.CvPtr, inpaintMask.CvPtr, dst.CvPtr, inpaintRadius, (int)flags); - dst.Fix(); - } - #endregion - - #region FastNlMeansDenoising - /// - /// Perform image denoising using Non-local Means Denoising algorithm - /// with several computational optimizations. Noise expected to be a gaussian white noise - /// - /// Input 8-bit 1-channel, 2-channel or 3-channel image. - /// Output image with the same size and type as src . - /// - /// Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, - /// smaller h value preserves details but also preserves some noise - /// - /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels - /// - /// Size in pixels of the window that is used to compute weighted average for given pixel. - /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels - public static void FastNlMeansDenoising(InputArray src, OutputArray dst, float h = 3, - int templateWindowSize = 7, int searchWindowSize = 21) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.photo_fastNlMeansDenoising(src.CvPtr, dst.CvPtr, h, templateWindowSize, searchWindowSize); - dst.Fix(); - } - #endregion - #region FastNlMeansDenoisingColored - - /// - /// Modification of fastNlMeansDenoising function for colored images - /// - /// Input 8-bit 3-channel image. - /// Output image with the same size and type as src. - /// Parameter regulating filter strength for luminance component. - /// Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise - /// The same as h but for color components. For most images value equals 10 will be enought - /// to remove colored noise and do not distort colors - /// - /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels - /// - /// Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. - /// Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels - public static void FastNlMeansDenoisingColored(InputArray src, OutputArray dst, - float h = 3, float hColor = 3, - int templateWindowSize = 7, int searchWindowSize = 21) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.photo_fastNlMeansDenoisingColored(src.CvPtr, dst.CvPtr, h, hColor, templateWindowSize, searchWindowSize); - dst.Fix(); - } - #endregion - #region FastNlMeansDenoisingMulti - /// - /// Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured - /// in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. - /// - /// Input 8-bit 1-channel, 2-channel or 3-channel images sequence. All images should have the same type and size. - /// Output image with the same size and type as srcImgs images. - /// Target image to denoise index in srcImgs sequence - /// Number of surrounding images to use for target image denoising. - /// Should be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 - /// from srcImgs will be used to denoise srcImgs[imgToDenoiseIndex] image. - /// Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, - /// smaller h value preserves details but also preserves some noise - /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels - /// Size in pixels of the window that is used to compute weighted average for given pixel. - /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels - public static void FastNlMeansDenoisingMulti(IEnumerable srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, - float h = 3, int templateWindowSize = 7, int searchWindowSize = 21) - { - if (srcImgs == null) - throw new ArgumentNullException(nameof(srcImgs)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - dst.ThrowIfNotReady(); - IntPtr[] srcImgPtrs = EnumerableEx.SelectPtrs(srcImgs); - - NativeMethods.photo_fastNlMeansDenoisingMulti(srcImgPtrs, srcImgPtrs.Length, dst.CvPtr, imgToDenoiseIndex, - templateWindowSize, h, templateWindowSize, searchWindowSize); - dst.Fix(); - } - /// - /// Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured - /// in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. - /// - /// Input 8-bit 1-channel, 2-channel or 3-channel images sequence. All images should have the same type and size. - /// Output image with the same size and type as srcImgs images. - /// Target image to denoise index in srcImgs sequence - /// Number of surrounding images to use for target image denoising. - /// Should be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 - /// from srcImgs will be used to denoise srcImgs[imgToDenoiseIndex] image. - /// Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, - /// smaller h value preserves details but also preserves some noise - /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels - /// Size in pixels of the window that is used to compute weighted average for given pixel. - /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels - public static void FastNlMeansDenoisingMulti(IEnumerable srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, - float h = 3, int templateWindowSize = 7, int searchWindowSize = 21) - { - IEnumerable srcImgsAsArrays = EnumerableEx.Select(srcImgs, m => new InputArray(m)); - FastNlMeansDenoisingMulti(srcImgsAsArrays, dst, imgToDenoiseIndex, templateWindowSize, - h, templateWindowSize, searchWindowSize); - } - #endregion - #region FastNlMeansDenoisingColoredMulti - /// - /// Modification of fastNlMeansDenoisingMulti function for colored images sequences - /// - /// Input 8-bit 3-channel images sequence. All images should have the same type and size. - /// Output image with the same size and type as srcImgs images. - /// Target image to denoise index in srcImgs sequence - /// Number of surrounding images to use for target image denoising. Should be odd. - /// Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs - /// will be used to denoise srcImgs[imgToDenoiseIndex] image. - /// Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise - /// but also removes image details, smaller h value preserves details but also preserves some noise. - /// The same as h but for color components. - /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels - /// Size in pixels of the window that is used to compute weighted average for given pixel. - /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels - public static void FastNlMeansDenoisingColoredMulti(IEnumerable srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, float h = 3, float hColor = 3, - int templateWindowSize = 7, int searchWindowSize = 21) - { - if (srcImgs == null) - throw new ArgumentNullException(nameof(srcImgs)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - dst.ThrowIfNotReady(); - IntPtr[] srcImgPtrs = EnumerableEx.SelectPtrs(srcImgs); - - NativeMethods.photo_fastNlMeansDenoisingColoredMulti(srcImgPtrs, srcImgPtrs.Length, dst.CvPtr, imgToDenoiseIndex, - templateWindowSize, h, hColor, templateWindowSize, searchWindowSize); - dst.Fix(); - } - /// - /// Modification of fastNlMeansDenoisingMulti function for colored images sequences - /// - /// Input 8-bit 3-channel images sequence. All images should have the same type and size. - /// Output image with the same size and type as srcImgs images. - /// Target image to denoise index in srcImgs sequence - /// Number of surrounding images to use for target image denoising. Should be odd. - /// Images from imgToDenoiseIndex - temporalWindowSize / 2 to imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs - /// will be used to denoise srcImgs[imgToDenoiseIndex] image. - /// Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise - /// but also removes image details, smaller h value preserves details but also preserves some noise. - /// The same as h but for color components. - /// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels - /// Size in pixels of the window that is used to compute weighted average for given pixel. - /// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels - public static void FastNlMeansDenoisingColoredMulti(IEnumerable srcImgs, OutputArray dst, - int imgToDenoiseIndex, int temporalWindowSize, float h = 3, float hColor = 3, - int templateWindowSize = 7, int searchWindowSize = 21) - { - IEnumerable srcImgsAsArrays = EnumerableEx.Select(srcImgs, m => new InputArray(m)); - FastNlMeansDenoisingColoredMulti(srcImgsAsArrays, dst, imgToDenoiseIndex, templateWindowSize, - h, hColor, templateWindowSize, searchWindowSize); - } - #endregion - - /// - /// Primal-dual algorithm is an algorithm for solving special types of variational problems - /// (that is, finding a function to minimize some functional). As the image denoising, - /// in particular, may be seen as the variational problem, primal-dual algorithm then - /// can be used to perform denoising and this is exactly what is implemented. - /// - /// This array should contain one or more noised versions - /// of the image that is to be restored. - /// Here the denoised image will be stored. There is no need to - /// do pre-allocation of storage space, as it will be automatically allocated, if necessary. - /// Corresponds to \f$\lambda\f$ in the formulas above. - /// As it is enlarged, the smooth (blurred) images are treated more favorably than - /// detailed (but maybe more noised) ones. Roughly speaking, as it becomes smaller, - /// the result will be more blur but more sever outliers will be removed. - /// Number of iterations that the algorithm will run. - /// Of course, as more iterations as better, but it is hard to quantitatively - /// refine this statement, so just use the default and increase it if the results are poor. -// ReSharper disable once InconsistentNaming - public static void DenoiseTVL1( - IEnumerable observations, Mat result, double lambda = 1.0, int niters = 30) - { - if (observations == null) - throw new ArgumentNullException(nameof(observations)); - if (result == null) - throw new ArgumentNullException(nameof(result)); - - IntPtr[] observationsPtrs = EnumerableEx.SelectPtrs(observations); - NativeMethods.photo_denoise_TVL1(observationsPtrs, observationsPtrs.Length, result.CvPtr, lambda, niters); - GC.KeepAlive(observations); - GC.KeepAlive(result); - } - - /// - /// Transforms a color image to a grayscale image. It is a basic tool in digital - /// printing, stylized black-and-white photograph rendering, and in many single - /// channel image processing applications @cite CL12 . - /// - /// Input 8-bit 3-channel image. - /// Output 8-bit 1-channel image. - /// Output 8-bit 3-channel image. - public static void Decolor( - InputArray src, OutputArray grayscale, OutputArray colorBoost) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (grayscale == null) - throw new ArgumentNullException(nameof(grayscale)); - if (colorBoost == null) - throw new ArgumentNullException(nameof(colorBoost)); - src.ThrowIfDisposed(); - grayscale.ThrowIfNotReady(); - colorBoost.ThrowIfNotReady(); - NativeMethods.photo_decolor(src.CvPtr, grayscale.CvPtr, colorBoost.CvPtr); - GC.KeepAlive(src); - grayscale.Fix(); - colorBoost.Fix(); - } - - /// - /// Image editing tasks concern either global changes (color/intensity corrections, - /// filters, deformations) or local changes concerned to a selection. Here we are - /// interested in achieving local changes, ones that are restricted to a region - /// manually selected (ROI), in a seamless and effortless manner. The extent of - /// the changes ranges from slight distortions to complete replacement by novel - /// content @cite PM03 . - /// - /// Input 8-bit 3-channel image. - /// Input 8-bit 3-channel image. - /// Input 8-bit 1 or 3-channel image. - /// Point in dst image where object is placed. - /// Output image with the same size and type as dst. - /// Cloning method - public static void SeamlessClone( - InputArray src, InputArray dst, InputArray mask, Point p, - OutputArray blend, SeamlessCloneMethods flags) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (blend == null) - throw new ArgumentNullException(nameof(blend)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); - if (mask != null) - mask.ThrowIfDisposed(); - blend.ThrowIfNotReady(); + if (srcImgs is null) + throw new ArgumentNullException(nameof(srcImgs)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); + var srcImgPtrs = srcImgs.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.photo_fastNlMeansDenoisingColoredMulti( + srcImgPtrs, srcImgPtrs.Length, dst.CvPtr, imgToDenoiseIndex, + temporalWindowSize, h, hColor, templateWindowSize, searchWindowSize)); + + dst.Fix(); + GC.KeepAlive(srcImgs); + } + + /// + /// Primal-dual algorithm is an algorithm for solving special types of variational problems + /// (that is, finding a function to minimize some functional). As the image denoising, + /// in particular, may be seen as the variational problem, primal-dual algorithm then + /// can be used to perform denoising and this is exactly what is implemented. + /// + /// This array should contain one or more noised versions + /// of the image that is to be restored. + /// Here the denoised image will be stored. There is no need to + /// do pre-allocation of storage space, as it will be automatically allocated, if necessary. + /// Corresponds to \f$\lambda\f$ in the formulas above. + /// As it is enlarged, the smooth (blurred) images are treated more favorably than + /// detailed (but maybe more noised) ones. Roughly speaking, as it becomes smaller, + /// the result will be more blur but more sever outliers will be removed. + /// Number of iterations that the algorithm will run. + /// Of course, as more iterations as better, but it is hard to quantitatively + /// refine this statement, so just use the default and increase it if the results are poor. + // ReSharper disable once InconsistentNaming + public static void DenoiseTVL1( + IEnumerable observations, Mat result, double lambda = 1.0, int niters = 30) + { + if (observations is null) + throw new ArgumentNullException(nameof(observations)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + + var observationsPtrs = observations.Select(x => x.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.photo_denoise_TVL1(observationsPtrs, observationsPtrs.Length, result.CvPtr, lambda, niters)); + GC.KeepAlive(observations); + GC.KeepAlive(result); + } + + /// + /// Transforms a color image to a grayscale image. It is a basic tool in digital + /// printing, stylized black-and-white photograph rendering, and in many single + /// channel image processing applications @cite CL12 . + /// + /// Input 8-bit 3-channel image. + /// Output 8-bit 1-channel image. + /// Output 8-bit 3-channel image. + public static void Decolor( + InputArray src, OutputArray grayscale, OutputArray colorBoost) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (grayscale is null) + throw new ArgumentNullException(nameof(grayscale)); + if (colorBoost is null) + throw new ArgumentNullException(nameof(colorBoost)); + src.ThrowIfDisposed(); + grayscale.ThrowIfNotReady(); + colorBoost.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.photo_decolor(src.CvPtr, grayscale.CvPtr, colorBoost.CvPtr)); + + GC.KeepAlive(src); + grayscale.Fix(); + colorBoost.Fix(); + } + /// + /// Image editing tasks concern either global changes (color/intensity corrections, + /// filters, deformations) or local changes concerned to a selection. Here we are + /// interested in achieving local changes, ones that are restricted to a region + /// manually selected (ROI), in a seamless and effortless manner. The extent of + /// the changes ranges from slight distortions to complete replacement by novel + /// content @cite PM03 . + /// + /// Input 8-bit 3-channel image. + /// Input 8-bit 3-channel image. + /// Input 8-bit 1 or 3-channel image. + /// Point in dst image where object is placed. + /// Output image with the same size and type as dst. + /// Cloning method + public static void SeamlessClone( + InputArray src, InputArray dst, InputArray? mask, Point p, + OutputArray blend, SeamlessCloneMethods flags) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (blend is null) + throw new ArgumentNullException(nameof(blend)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); + blend.ThrowIfNotReady(); + + NativeMethods.HandleException( NativeMethods.photo_seamlessClone( - src.CvPtr, dst.CvPtr, ToPtr(mask), p, blend.CvPtr, (int)flags); - - GC.KeepAlive(src); - GC.KeepAlive(dst); - GC.KeepAlive(mask); - blend.Fix(); - } - - /// - /// Given an original color image, two differently colored versions of this - /// image can be mixed seamlessly. Multiplication factor is between 0.5 to 2.5. - /// - /// Input 8-bit 3-channel image. - /// Input 8-bit 1 or 3-channel image. - /// Output image with the same size and type as src. - /// R-channel multiply factor. - /// G-channel multiply factor. - /// B-channel multiply factor. - public static void ColorChange( - InputArray src, InputArray mask, OutputArray dst, - float redMul = 1.0f, float greenMul = 1.0f, float blueMul = 1.0f) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - if (mask != null) - mask.ThrowIfDisposed(); + src.CvPtr, dst.CvPtr, ToPtr(mask), p, blend.CvPtr, (int) flags)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(mask); + blend.Fix(); + } + /// + /// Given an original color image, two differently colored versions of this + /// image can be mixed seamlessly. Multiplication factor is between 0.5 to 2.5. + /// + /// Input 8-bit 3-channel image. + /// Input 8-bit 1 or 3-channel image. + /// Output image with the same size and type as src. + /// R-channel multiply factor. + /// G-channel multiply factor. + /// B-channel multiply factor. + public static void ColorChange( + InputArray src, InputArray? mask, OutputArray dst, + float redMul = 1.0f, float greenMul = 1.0f, float blueMul = 1.0f) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + mask?.ThrowIfDisposed(); + + NativeMethods.HandleException( NativeMethods.photo_colorChange( - src.CvPtr, ToPtr(mask), dst.CvPtr, redMul, greenMul, blueMul); - - GC.KeepAlive(src); - GC.KeepAlive(mask); - dst.Fix(); - } - - /// - /// Applying an appropriate non-linear transformation to the gradient field inside - /// the selection and then integrating back with a Poisson solver, modifies locally - /// the apparent illumination of an image. - /// - /// Input 8-bit 3-channel image. - /// Input 8-bit 1 or 3-channel image. - /// Output image with the same size and type as src. - /// Value ranges between 0-2. - /// Value ranges between 0-2. - /// - /// This is useful to highlight under-exposed foreground objects or to reduce specular reflections. - /// - public static void IlluminationChange( - InputArray src, InputArray mask, OutputArray dst, - float alpha = 0.2f, float beta = 0.4f) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - if (mask != null) - mask.ThrowIfDisposed(); + src.CvPtr, ToPtr(mask), dst.CvPtr, redMul, greenMul, blueMul)); + + GC.KeepAlive(src); + GC.KeepAlive(mask); + dst.Fix(); + } + /// + /// Applying an appropriate non-linear transformation to the gradient field inside + /// the selection and then integrating back with a Poisson solver, modifies locally + /// the apparent illumination of an image. + /// + /// Input 8-bit 3-channel image. + /// Input 8-bit 1 or 3-channel image. + /// Output image with the same size and type as src. + /// Value ranges between 0-2. + /// Value ranges between 0-2. + /// + /// This is useful to highlight under-exposed foreground objects or to reduce specular reflections. + /// + public static void IlluminationChange( + InputArray src, InputArray? mask, OutputArray dst, + float alpha = 0.2f, float beta = 0.4f) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + mask?.ThrowIfDisposed(); + + NativeMethods.HandleException( NativeMethods.photo_illuminationChange( - src.CvPtr, ToPtr(mask), dst.CvPtr, alpha, beta); - - GC.KeepAlive(src); - GC.KeepAlive(mask); - dst.Fix(); - } - - /// - /// By retaining only the gradients at edge locations, before integrating with the - /// Poisson solver, one washes out the texture of the selected region, giving its - /// contents a flat aspect. Here Canny Edge Detector is used. - /// - /// Input 8-bit 3-channel image. - /// Input 8-bit 1 or 3-channel image. - /// Output image with the same size and type as src. - /// Range from 0 to 100. - /// Value > 100. - /// The size of the Sobel kernel to be used. - public static void TextureFlattening( - InputArray src, InputArray mask, OutputArray dst, - float lowThreshold = 30, float highThreshold = 45, - int kernelSize = 3) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - if (mask != null) - mask.ThrowIfDisposed(); + src.CvPtr, ToPtr(mask), dst.CvPtr, alpha, beta)); + + GC.KeepAlive(src); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// By retaining only the gradients at edge locations, before integrating with the + /// Poisson solver, one washes out the texture of the selected region, giving its + /// contents a flat aspect. Here Canny Edge Detector is used. + /// + /// Input 8-bit 3-channel image. + /// Input 8-bit 1 or 3-channel image. + /// Output image with the same size and type as src. + /// Range from 0 to 100. + /// Value > 100. + /// The size of the Sobel kernel to be used. + public static void TextureFlattening( + InputArray src, InputArray? mask, OutputArray dst, + float lowThreshold = 30, float highThreshold = 45, + int kernelSize = 3) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + mask?.ThrowIfDisposed(); + + NativeMethods.HandleException( NativeMethods.photo_textureFlattening( - src.CvPtr, ToPtr(mask), dst.CvPtr, lowThreshold, highThreshold, kernelSize); - - GC.KeepAlive(src); - GC.KeepAlive(mask); - dst.Fix(); - } - - /// - /// Filtering is the fundamental operation in image and video processing. - /// Edge-preserving smoothing filters are used in many different applications @cite EM11 . - /// - /// Input 8-bit 3-channel image. - /// Output 8-bit 3-channel image. - /// Edge preserving filters - /// Range between 0 to 200. - /// Range between 0 to 1. - public static void EdgePreservingFilter( - InputArray src, OutputArray dst, - EdgePreservingMethods flags = EdgePreservingMethods.RecursFilter, - float sigmaS = 60, float sigmaR = 0.4f) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); + src.CvPtr, ToPtr(mask), dst.CvPtr, lowThreshold, highThreshold, kernelSize)); + + GC.KeepAlive(src); + GC.KeepAlive(mask); + dst.Fix(); + } + + /// + /// Filtering is the fundamental operation in image and video processing. + /// Edge-preserving smoothing filters are used in many different applications @cite EM11 . + /// + /// Input 8-bit 3-channel image. + /// Output 8-bit 3-channel image. + /// Edge preserving filters + /// Range between 0 to 200. + /// Range between 0 to 1. + public static void EdgePreservingFilter( + InputArray src, OutputArray dst, + EdgePreservingMethods flags = EdgePreservingMethods.RecursFilter, + float sigmaS = 60, float sigmaR = 0.4f) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( NativeMethods.photo_edgePreservingFilter( - src.CvPtr, dst.CvPtr, (int)flags, sigmaS, sigmaR); - - GC.KeepAlive(src); - dst.Fix(); - } - - /// - /// This filter enhances the details of a particular image. - /// - /// Input 8-bit 3-channel image. - /// Output image with the same size and type as src. - /// Range between 0 to 200. - /// Range between 0 to 1. - public static void DetailEnhance( - InputArray src, OutputArray dst, - float sigmaS = 10, float sigmaR = 0.15f) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); + src.CvPtr, dst.CvPtr, (int) flags, sigmaS, sigmaR)); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// This filter enhances the details of a particular image. + /// + /// Input 8-bit 3-channel image. + /// Output image with the same size and type as src. + /// Range between 0 to 200. + /// Range between 0 to 1. + public static void DetailEnhance( + InputArray src, OutputArray dst, + float sigmaS = 10, float sigmaR = 0.15f) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( NativeMethods.photo_detailEnhance( - src.CvPtr, dst.CvPtr, sigmaS, sigmaR); - - GC.KeepAlive(src); - dst.Fix(); - } - - /// - /// Pencil-like non-photorealistic line drawing - /// - /// Input 8-bit 3-channel image. - /// Output 8-bit 1-channel image. - /// Output image with the same size and type as src. - /// Range between 0 to 200. - /// Range between 0 to 1. - /// Range between 0 to 0.1. - public static void PencilSketch( - InputArray src, OutputArray dst1, OutputArray dst2, - float sigmaS = 60, float sigmaR = 0.07f, float shadeFactor = 0.02f) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst1 == null) - throw new ArgumentNullException(nameof(dst1)); - if (dst2 == null) - throw new ArgumentNullException(nameof(dst2)); - - src.ThrowIfDisposed(); - dst1.ThrowIfNotReady(); - dst2.ThrowIfNotReady(); + src.CvPtr, dst.CvPtr, sigmaS, sigmaR)); + + GC.KeepAlive(src); + dst.Fix(); + } + /// + /// Pencil-like non-photorealistic line drawing + /// + /// Input 8-bit 3-channel image. + /// Output 8-bit 1-channel image. + /// Output image with the same size and type as src. + /// Range between 0 to 200. + /// Range between 0 to 1. + /// Range between 0 to 0.1. + public static void PencilSketch( + InputArray src, OutputArray dst1, OutputArray dst2, + float sigmaS = 60, float sigmaR = 0.07f, float shadeFactor = 0.02f) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst1 is null) + throw new ArgumentNullException(nameof(dst1)); + if (dst2 is null) + throw new ArgumentNullException(nameof(dst2)); + + src.ThrowIfDisposed(); + dst1.ThrowIfNotReady(); + dst2.ThrowIfNotReady(); + + NativeMethods.HandleException( NativeMethods.photo_pencilSketch( - src.CvPtr, dst1.CvPtr, dst2.CvPtr, sigmaS, sigmaR, shadeFactor); - - GC.KeepAlive(src); - dst1.Fix(); - dst2.Fix(); - } - - /// - /// Stylization aims to produce digital imagery with a wide variety of effects - /// not focused on photorealism. Edge-aware filters are ideal for stylization, - /// as they can abstract regions of low contrast while preserving, or enhancing, - /// high-contrast features. - /// - /// Input 8-bit 3-channel image. - /// Output image with the same size and type as src. - /// Range between 0 to 200. - /// Range between 0 to 1. - public static void Stylization( - InputArray src, OutputArray dst, - float sigmaS = 60, float sigmaR = 0.45f) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); + src.CvPtr, dst1.CvPtr, dst2.CvPtr, sigmaS, sigmaR, shadeFactor)); + + GC.KeepAlive(src); + dst1.Fix(); + dst2.Fix(); + } + + /// + /// Stylization aims to produce digital imagery with a wide variety of effects + /// not focused on photorealism. Edge-aware filters are ideal for stylization, + /// as they can abstract regions of low contrast while preserving, or enhancing, + /// high-contrast features. + /// + /// Input 8-bit 3-channel image. + /// Output image with the same size and type as src. + /// Range between 0 to 200. + /// Range between 0 to 1. + public static void Stylization( + InputArray src, OutputArray dst, + float sigmaS = 60, float sigmaR = 0.45f) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( NativeMethods.photo_stylization( - src.CvPtr, dst.CvPtr, sigmaS, sigmaR); + src.CvPtr, dst.CvPtr, sigmaS, sigmaR)); - GC.KeepAlive(src); - dst.Fix(); - } + GC.KeepAlive(src); + dst.Fix(); } } diff --git a/src/OpenCvSharp/Cv2/Cv2_superres.cs b/src/OpenCvSharp/Cv2/Cv2_superres.cs index bb6986b5a..9c6376df6 100644 --- a/src/OpenCvSharp/Cv2/Cv2_superres.cs +++ b/src/OpenCvSharp/Cv2/Cv2_superres.cs @@ -1,174 +1,108 @@ -using System; +namespace OpenCvSharp; -namespace OpenCvSharp +// ReSharper disable InconsistentNaming +static partial class Cv2 { - // ReSharper disable InconsistentNaming - - static partial class Cv2 + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Empty() { - /// - /// - /// - /// - public static FrameSource CreateFrameSource_Empty() - { - return FrameSource.CreateEmptySource(); - } - - /// - /// - /// - /// - /// - public static FrameSource CreateFrameSource_Video(string fileName) - { - return FrameSource.CreateVideoSource(fileName); - } - - /// - /// - /// - /// - /// - public static FrameSource CreateFrameSource_Video_CUDA(string fileName) - { - return FrameSource.CreateVideoSourceCuda(fileName); - } - - /// - /// - /// - /// - /// - public static FrameSource CreateFrameSource_Camera(int deviceId) - { - return FrameSource.CreateCameraSource(deviceId); - } - - - /// - /// Create Bilateral TV-L1 Super Resolution. - /// - /// - public static SuperResolution CreateSuperResolution_BTVL1() - { - return SuperResolution.CreateBTVL1(); - } - - /// - /// Create Bilateral TV-L1 Super Resolution. - /// - /// - public static SuperResolution CreateSuperResolution_BTVL1_CUDA() - { - return SuperResolution.CreateBTVL1_CUDA(); - } - - /// - /// Create Bilateral TV-L1 Super Resolution. - /// - /// - public static SuperResolution CreateSuperResolution_BTVL1_OCL() - { - throw new NotImplementedException(); - //return SuperResolution.CreateBTVL1_OCL(); - } - - + return FrameSource.CreateFrameSource_Empty(); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_Farneback() - { - return DenseOpticalFlowExt.CreateFarneback(); - } + /// + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Video(string fileName) + { + return FrameSource.CreateFrameSource_Video(fileName); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_Farneback_GPU() - { - return DenseOpticalFlowExt.CreateFarneback_CUDA(); - } + /// + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Video_CUDA(string fileName) + { + return FrameSource.CreateFrameSource_Video_CUDA(fileName); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_Farneback_OCL() - { - throw new NotImplementedException(); - //return DenseOpticalFlowExt.CreateFarneback_OCL(); - } + /// + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Camera(int deviceId) + { + return FrameSource.CreateFrameSource_Camera(deviceId); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_Simple() - { - return DenseOpticalFlowExt.CreateSimple(); - } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_DualTVL1Ex() - { - return DenseOpticalFlowExt.CreateDualTVL1(); - } + /// + /// Create Bilateral TV-L1 Super Resolution. + /// + /// + public static SuperResolution CreateSuperResolution_BTVL1() + { + return SuperResolution.CreateBTVL1(); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_DualTVL1_GPU() - { - //throw new NotImplementedException(); - return DenseOpticalFlowExt.CreateDualTVL1_CUDA(); - } + /// + /// Create Bilateral TV-L1 Super Resolution. + /// + /// + public static SuperResolution CreateSuperResolution_BTVL1_CUDA() + { + return SuperResolution.CreateBTVL1_CUDA(); + } + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateOptFlow_Farneback() + { + return DenseOpticalFlowExt.CreateFarneback(); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_DualTVL1_OCL() - { - //throw new NotImplementedException(); - return DenseOpticalFlowExt.CreateDualTVL1_OCL(); - } + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateOptFlow_Farneback_GPU() + { + return DenseOpticalFlowExt.CreateFarneback_CUDA(); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_Brox_GPU() - { - return DenseOpticalFlowExt.CreateBrox_CUDA(); - } + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateOptFlow_DualTVL1_GPU() + { + return DenseOpticalFlowExt.CreateDualTVL1_CUDA(); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_PyrLK_GPU() - { - //throw new NotImplementedException(); - return DenseOpticalFlowExt.CreatePyrLK_CUDA(); - } + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateOptFlow_Brox_GPU() + { + return DenseOpticalFlowExt.CreateBrox_CUDA(); + } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateOptFlow_PyrLK_OCL() - { - //throw new NotImplementedException(); - return DenseOpticalFlowExt.CreatePyrLK_OCL(); - } + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateOptFlow_PyrLK_GPU() + { + return DenseOpticalFlowExt.CreatePyrLK_CUDA(); } } diff --git a/src/OpenCvSharp/Cv2/Cv2_video.cs b/src/OpenCvSharp/Cv2/Cv2_video.cs index 259163ab3..48f63195e 100644 --- a/src/OpenCvSharp/Cv2/Cv2_video.cs +++ b/src/OpenCvSharp/Cv2/Cv2_video.cs @@ -1,309 +1,411 @@ -using System; -using System.Collections.Generic; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming +namespace OpenCvSharp; - static partial class Cv2 +// ReSharper disable InconsistentNaming +static partial class Cv2 +{ + /// + /// Finds an object center, size, and orientation. + /// + /// Back projection of the object histogram. + /// Initial search window. + /// Stop criteria for the underlying MeanShift() . + /// + public static RotatedRect CamShift( + InputArray probImage, ref Rect window, TermCriteria criteria) { - /// - /// Finds an object center, size, and orientation. - /// - /// Back projection of the object histogram. - /// Initial search window. - /// Stop criteria for the underlying MeanShift() . - /// - public static RotatedRect CamShift( - InputArray probImage, ref Rect window, TermCriteria criteria) - { - if (probImage == null) - throw new ArgumentNullException(nameof(probImage)); - probImage.ThrowIfDisposed(); + if (probImage is null) + throw new ArgumentNullException(nameof(probImage)); + probImage.ThrowIfDisposed(); - RotatedRect result = NativeMethods.video_CamShift( - probImage.CvPtr, ref window, criteria); - return result; - } + NativeMethods.HandleException( + NativeMethods.video_CamShift( + probImage.CvPtr, ref window, criteria, out var ret)); + GC.KeepAlive(probImage); + return ret; + } - /// - /// Finds an object on a back projection image. - /// - /// Back projection of the object histogram. - /// Initial search window. - /// Stop criteria for the iterative search algorithm. - /// Number of iterations CAMSHIFT took to converge. - public static int MeanShift( - InputArray probImage, ref Rect window, TermCriteria criteria) - { - if (probImage == null) - throw new ArgumentNullException(nameof(probImage)); - probImage.ThrowIfDisposed(); + /// + /// Finds an object on a back projection image. + /// + /// Back projection of the object histogram. + /// Initial search window. + /// Stop criteria for the iterative search algorithm. + /// Number of iterations CAMSHIFT took to converge. + public static int MeanShift( + InputArray probImage, ref Rect window, TermCriteria criteria) + { + if (probImage is null) + throw new ArgumentNullException(nameof(probImage)); + probImage.ThrowIfDisposed(); - int result = NativeMethods.video_meanShift( - probImage.CvPtr, ref window, criteria); - return result; - } + NativeMethods.HandleException( + NativeMethods.video_meanShift( + probImage.CvPtr, ref window, criteria, out var ret)); + GC.KeepAlive(probImage); + return ret; + } - /// - /// Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK - /// - /// 8-bit input image. - /// output pyramid. - /// window size of optical flow algorithm. - /// Must be not less than winSize argument of calcOpticalFlowPyrLK(). - /// It is needed to calculate required padding for pyramid levels. - /// 0-based maximal pyramid level number. - /// set to precompute gradients for the every pyramid level. - /// If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will - /// calculate them internally. - /// the border mode for pyramid layers. - /// the border mode for gradients. - /// put ROI of input image into the pyramid if possible. - /// You can pass false to force data copying. - /// number of levels in constructed pyramid. Can be less than maxLevel. - public static int BuildOpticalFlowPyramid( - InputArray img, OutputArray pyramid, - Size winSize, int maxLevel, - bool withDerivatives = true, - BorderTypes pyrBorder = BorderTypes.Reflect101, - BorderTypes derivBorder = BorderTypes.Constant, - bool tryReuseInputImage = true) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (pyramid == null) - throw new ArgumentNullException(nameof(pyramid)); - img.ThrowIfDisposed(); - pyramid.ThrowIfNotReady(); + /// + /// Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK + /// + /// 8-bit input image. + /// output pyramid. + /// window size of optical flow algorithm. + /// Must be not less than winSize argument of calcOpticalFlowPyrLK(). + /// It is needed to calculate required padding for pyramid levels. + /// 0-based maximal pyramid level number. + /// set to precompute gradients for the every pyramid level. + /// If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will + /// calculate them internally. + /// the border mode for pyramid layers. + /// the border mode for gradients. + /// put ROI of input image into the pyramid if possible. + /// You can pass false to force data copying. + /// number of levels in constructed pyramid. Can be less than maxLevel. + public static int BuildOpticalFlowPyramid( + InputArray img, OutputArray pyramid, + Size winSize, int maxLevel, + bool withDerivatives = true, + BorderTypes pyrBorder = BorderTypes.Reflect101, + BorderTypes derivBorder = BorderTypes.Constant, + bool tryReuseInputImage = true) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (pyramid is null) + throw new ArgumentNullException(nameof(pyramid)); + img.ThrowIfDisposed(); + pyramid.ThrowIfNotReady(); - int result = NativeMethods.video_buildOpticalFlowPyramid1( - img.CvPtr, pyramid.CvPtr, winSize, maxLevel, withDerivatives ? 1 : 0, - (int)pyrBorder, (int)derivBorder, tryReuseInputImage ? 1 : 0); - pyramid.Fix(); - return result; - } + NativeMethods.HandleException( + NativeMethods.video_buildOpticalFlowPyramid1( + img.CvPtr, pyramid.CvPtr, winSize, maxLevel, withDerivatives ? 1 : 0, + (int) pyrBorder, (int) derivBorder, tryReuseInputImage ? 1 : 0, out var ret)); + pyramid.Fix(); + GC.KeepAlive(img); + return ret; + } - /// - /// Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK - /// - /// 8-bit input image. - /// output pyramid. - /// window size of optical flow algorithm. - /// Must be not less than winSize argument of calcOpticalFlowPyrLK(). - /// It is needed to calculate required padding for pyramid levels. - /// 0-based maximal pyramid level number. - /// set to precompute gradients for the every pyramid level. - /// If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will - /// calculate them internally. - /// the border mode for pyramid layers. - /// the border mode for gradients. - /// put ROI of input image into the pyramid if possible. - /// You can pass false to force data copying. - /// number of levels in constructed pyramid. Can be less than maxLevel. - public static int BuildOpticalFlowPyramid( - InputArray img, out Mat[] pyramid, - Size winSize, int maxLevel, - bool withDerivatives = true, - BorderTypes pyrBorder = BorderTypes.Reflect101, - BorderTypes derivBorder = BorderTypes.Constant, - bool tryReuseInputImage = true) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); + /// + /// Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK + /// + /// 8-bit input image. + /// output pyramid. + /// window size of optical flow algorithm. + /// Must be not less than winSize argument of calcOpticalFlowPyrLK(). + /// It is needed to calculate required padding for pyramid levels. + /// 0-based maximal pyramid level number. + /// set to precompute gradients for the every pyramid level. + /// If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will + /// calculate them internally. + /// the border mode for pyramid layers. + /// the border mode for gradients. + /// put ROI of input image into the pyramid if possible. + /// You can pass false to force data copying. + /// number of levels in constructed pyramid. Can be less than maxLevel. + public static int BuildOpticalFlowPyramid( + InputArray img, out Mat[] pyramid, + Size winSize, int maxLevel, + bool withDerivatives = true, + BorderTypes pyrBorder = BorderTypes.Reflect101, + BorderTypes derivBorder = BorderTypes.Constant, + bool tryReuseInputImage = true) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); - using (var pyramidVec = new VectorOfMat()) - { - int result = NativeMethods.video_buildOpticalFlowPyramid2( - img.CvPtr, pyramidVec.CvPtr, winSize, maxLevel, withDerivatives ? 1 : 0, - (int) pyrBorder, (int) derivBorder, tryReuseInputImage ? 1 : 0); - pyramid = pyramidVec.ToArray(); - return result; - } - } + using var pyramidVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.video_buildOpticalFlowPyramid2( + img.CvPtr, pyramidVec.CvPtr, winSize, maxLevel, withDerivatives ? 1 : 0, + (int) pyrBorder, (int) derivBorder, tryReuseInputImage ? 1 : 0, out var ret)); + GC.KeepAlive(img); + pyramid = pyramidVec.ToArray(); + return ret; + } - /// - /// computes sparse optical flow using multi-scale Lucas-Kanade algorithm - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void CalcOpticalFlowPyrLK( - InputArray prevImg, InputArray nextImg, - InputArray prevPts, InputOutputArray nextPts, - OutputArray status, OutputArray err, - Size? winSize = null, - int maxLevel = 3, - TermCriteria? criteria = null, - OpticalFlowFlags flags = OpticalFlowFlags.None, - double minEigThreshold = 1e-4) - { - if (prevImg == null) - throw new ArgumentNullException(nameof(prevImg)); - if (nextImg == null) - throw new ArgumentNullException(nameof(nextImg)); - if (prevPts == null) - throw new ArgumentNullException(nameof(prevPts)); - if (nextPts == null) - throw new ArgumentNullException(nameof(nextPts)); - if (status == null) - throw new ArgumentNullException(nameof(status)); - if (err == null) - throw new ArgumentNullException(nameof(err)); - prevImg.ThrowIfDisposed(); - nextImg.ThrowIfDisposed(); - prevPts.ThrowIfDisposed(); - nextPts.ThrowIfNotReady(); - status.ThrowIfNotReady(); - err.ThrowIfNotReady(); + /// + /// computes sparse optical flow using multi-scale Lucas-Kanade algorithm + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void CalcOpticalFlowPyrLK( + InputArray prevImg, InputArray nextImg, + InputArray prevPts, InputOutputArray nextPts, + OutputArray status, OutputArray err, + Size? winSize = null, + int maxLevel = 3, + TermCriteria? criteria = null, + OpticalFlowFlags flags = OpticalFlowFlags.None, + double minEigThreshold = 1e-4) + { + if (prevImg is null) + throw new ArgumentNullException(nameof(prevImg)); + if (nextImg is null) + throw new ArgumentNullException(nameof(nextImg)); + if (prevPts is null) + throw new ArgumentNullException(nameof(prevPts)); + if (nextPts is null) + throw new ArgumentNullException(nameof(nextPts)); + if (status is null) + throw new ArgumentNullException(nameof(status)); + if (err is null) + throw new ArgumentNullException(nameof(err)); + prevImg.ThrowIfDisposed(); + nextImg.ThrowIfDisposed(); + prevPts.ThrowIfDisposed(); + nextPts.ThrowIfNotReady(); + status.ThrowIfNotReady(); + err.ThrowIfNotReady(); - Size winSize0 = winSize.GetValueOrDefault(new Size(21, 21)); - TermCriteria criteria0 = criteria.GetValueOrDefault( - TermCriteria.Both(30, 0.01)); + var winSize0 = winSize.GetValueOrDefault(new Size(21, 21)); + var criteria0 = criteria.GetValueOrDefault( + TermCriteria.Both(30, 0.01)); + NativeMethods.HandleException( NativeMethods.video_calcOpticalFlowPyrLK_InputArray( prevImg.CvPtr, nextImg.CvPtr, prevPts.CvPtr, nextPts.CvPtr, - status.CvPtr, err.CvPtr, winSize0,maxLevel, - criteria0, (int)flags, minEigThreshold); + status.CvPtr, err.CvPtr, winSize0, maxLevel, + criteria0, (int) flags, minEigThreshold)); + GC.KeepAlive(prevImg); + GC.KeepAlive(nextImg); + GC.KeepAlive(prevPts); + nextPts.Fix(); + status.Fix(); + err.Fix(); + } + /// + /// computes sparse optical flow using multi-scale Lucas-Kanade algorithm + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void CalcOpticalFlowPyrLK( + InputArray prevImg, + InputArray nextImg, + Point2f[] prevPts, + ref Point2f[] nextPts, + out byte[] status, + out float[] err, + Size? winSize = null, + int maxLevel = 3, + TermCriteria? criteria = null, + OpticalFlowFlags flags = OpticalFlowFlags.None, + double minEigThreshold = 1e-4) + { + if (prevImg is null) + throw new ArgumentNullException(nameof(prevImg)); + if (nextImg is null) + throw new ArgumentNullException(nameof(nextImg)); + if (prevPts is null) + throw new ArgumentNullException(nameof(prevPts)); + if (nextPts is null) + throw new ArgumentNullException(nameof(nextPts)); + prevImg.ThrowIfDisposed(); + nextImg.ThrowIfDisposed(); + + var winSize0 = winSize.GetValueOrDefault(new Size(21, 21)); + var criteria0 = criteria.GetValueOrDefault( + TermCriteria.Both(30, 0.01)); - nextPts.Fix(); - status.Fix(); - err.Fix(); - } - /// - /// computes sparse optical flow using multi-scale Lucas-Kanade algorithm - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void CalcOpticalFlowPyrLK( - InputArray prevImg, InputArray nextImg, - Point2f[] prevPts, ref Point2f[] nextPts, - out byte[] status, out float[] err, - Size? winSize = null, - int maxLevel = 3, - TermCriteria? criteria = null, - OpticalFlowFlags flags = OpticalFlowFlags.None, - double minEigThreshold = 1e-4) - { - if (prevImg == null) - throw new ArgumentNullException(nameof(prevImg)); - if (nextImg == null) - throw new ArgumentNullException(nameof(nextImg)); - if (prevPts == null) - throw new ArgumentNullException(nameof(prevPts)); - if (nextPts == null) - throw new ArgumentNullException(nameof(nextPts)); - prevImg.ThrowIfDisposed(); - nextImg.ThrowIfDisposed(); + using var nextPtsVec = new VectorOfPoint2f(nextPts); + using var statusVec = new VectorOfByte(); + using var errVec = new VectorOfFloat(); + NativeMethods.HandleException( + NativeMethods.video_calcOpticalFlowPyrLK_vector( + prevImg.CvPtr, nextImg.CvPtr, prevPts, prevPts.Length, + nextPtsVec.CvPtr, statusVec.CvPtr, errVec.CvPtr, + winSize0, maxLevel, criteria0, (int) flags, minEigThreshold)); + GC.KeepAlive(prevImg); + GC.KeepAlive(nextImg); + nextPts = nextPtsVec.ToArray(); + status = statusVec.ToArray(); + err = errVec.ToArray(); + } - Size winSize0 = winSize.GetValueOrDefault(new Size(21, 21)); - TermCriteria criteria0 = criteria.GetValueOrDefault( - TermCriteria.Both(30, 0.01)); + /// + /// Computes a dense optical flow using the Gunnar Farneback's algorithm. + /// + /// first 8-bit single-channel input image. + /// second input image of the same size and the same type as prev. + /// computed flow image that has the same size as prev and type CV_32FC2. + /// parameter, specifying the image scale (<1) to build pyramids for each image; + /// pyrScale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one. + /// number of pyramid layers including the initial image; + /// levels=1 means that no extra layers are created and only the original images are used. + /// averaging window size; larger values increase the algorithm robustness to + /// image noise and give more chances for fast motion detection, but yield more blurred motion field. + /// number of iterations the algorithm does at each pyramid level. + /// size of the pixel neighborhood used to find polynomial expansion in each pixel; + /// larger values mean that the image will be approximated with smoother surfaces, + /// yielding more robust algorithm and more blurred motion field, typically poly_n =5 or 7. + /// standard deviation of the Gaussian that is used to smooth derivatives used as + /// a basis for the polynomial expansion; for polyN=5, you can set polySigma=1.1, + /// for polyN=7, a good value would be polySigma=1.5. + /// operation flags that can be a combination of OPTFLOW_USE_INITIAL_FLOW and/or OPTFLOW_FARNEBACK_GAUSSIAN + public static void CalcOpticalFlowFarneback(InputArray prev, InputArray next, + InputOutputArray flow, double pyrScale, int levels, int winsize, + int iterations, int polyN, double polySigma, OpticalFlowFlags flags) + { + if (prev is null) + throw new ArgumentNullException(nameof(prev)); + if (next is null) + throw new ArgumentNullException(nameof(next)); + if (flow is null) + throw new ArgumentNullException(nameof(flow)); + prev.ThrowIfDisposed(); + next.ThrowIfDisposed(); + flow.ThrowIfNotReady(); - using (var nextPtsVec = new VectorOfPoint2f()) - using (var statusVec = new VectorOfByte()) - using (var errVec = new VectorOfFloat()) - { - NativeMethods.video_calcOpticalFlowPyrLK_vector( - prevImg.CvPtr, nextImg.CvPtr, prevPts, prevPts.Length, - nextPtsVec.CvPtr, statusVec.CvPtr, errVec.CvPtr, - winSize0, maxLevel, criteria0, (int)flags, minEigThreshold); - nextPts = nextPtsVec.ToArray(); - status = statusVec.ToArray(); - err = errVec.ToArray(); - } - } + NativeMethods.HandleException( + NativeMethods.video_calcOpticalFlowFarneback( + prev.CvPtr, next.CvPtr, flow.CvPtr, pyrScale, levels, winsize, + iterations, polyN, polySigma, (int) flags)); + GC.KeepAlive(prev); + GC.KeepAlive(next); + flow.Fix(); + } - /// - /// Computes a dense optical flow using the Gunnar Farneback's algorithm. - /// - /// first 8-bit single-channel input image. - /// second input image of the same size and the same type as prev. - /// computed flow image that has the same size as prev and type CV_32FC2. - /// parameter, specifying the image scale (<1) to build pyramids for each image; - /// pyrScale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one. - /// number of pyramid layers including the initial image; - /// levels=1 means that no extra layers are created and only the original images are used. - /// averaging window size; larger values increase the algorithm robustness to - /// image noise and give more chances for fast motion detection, but yield more blurred motion field. - /// number of iterations the algorithm does at each pyramid level. - /// size of the pixel neighborhood used to find polynomial expansion in each pixel; - /// larger values mean that the image will be approximated with smoother surfaces, - /// yielding more robust algorithm and more blurred motion field, typically poly_n =5 or 7. - /// standard deviation of the Gaussian that is used to smooth derivatives used as - /// a basis for the polynomial expansion; for polyN=5, you can set polySigma=1.1, - /// for polyN=7, a good value would be polySigma=1.5. - /// operation flags that can be a combination of OPTFLOW_USE_INITIAL_FLOW and/or OPTFLOW_FARNEBACK_GAUSSIAN - public static void CalcOpticalFlowFarneback(InputArray prev, InputArray next, - InputOutputArray flow, double pyrScale, int levels, int winsize, - int iterations, int polyN, double polySigma, OpticalFlowFlags flags) - { - if (prev == null) - throw new ArgumentNullException(nameof(prev)); - if (next == null) - throw new ArgumentNullException(nameof(next)); - if (flow == null) - throw new ArgumentNullException(nameof(flow)); - prev.ThrowIfDisposed(); - next.ThrowIfDisposed(); - flow.ThrowIfNotReady(); + /// + /// Computes the Enhanced Correlation Coefficient value between two images @cite EP08 . + /// + /// single-channel template image; CV_8U or CV_32F array. + /// single-channel input image to be warped to provide an image similar to templateImage, same type as templateImage. + /// An optional mask to indicate valid values of inputImage. + /// + public static double ComputeECC(InputArray templateImage, InputArray inputImage, InputArray? inputMask = null) + { + if (templateImage is null) + throw new ArgumentNullException(nameof(templateImage)); + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + templateImage.ThrowIfDisposed(); + inputImage.ThrowIfDisposed(); + inputMask?.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.video_computeECC( + templateImage.CvPtr, inputImage.CvPtr, inputMask?.CvPtr ?? IntPtr.Zero, out var ret)); + + GC.KeepAlive(templateImage); + GC.KeepAlive(inputImage); + GC.KeepAlive(inputMask); + return ret; + } - NativeMethods.video_calcOpticalFlowFarneback(prev.CvPtr, next.CvPtr, - flow.CvPtr, pyrScale, levels, winsize, iterations, polyN, polySigma, - (int)flags); + /// + /// Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 . + /// + /// single-channel template image; CV_8U or CV_32F array. + /// single-channel input image which should be warped with the final warpMatrix in + /// order to provide an image similar to templateImage, same type as templateImage. + /// floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp). + /// parameter, specifying the type of motion + /// parameter, specifying the termination criteria of the ECC algorithm; + /// criteria.epsilon defines the threshold of the increment in the correlation coefficient between two + /// iterations(a negative criteria.epsilon makes criteria.maxcount the only termination criterion). + /// Default values are shown in the declaration above. + /// An optional mask to indicate valid values of inputImage. + /// An optional value indicating size of gaussian blur filter; (DEFAULT: 5) + /// + public static double FindTransformECC( + InputArray templateImage, + InputArray inputImage, + InputOutputArray warpMatrix, + MotionTypes motionType, + TermCriteria criteria, + InputArray? inputMask = null, + int gaussFiltSize = 5) + { + if (templateImage is null) + throw new ArgumentNullException(nameof(templateImage)); + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + if (warpMatrix is null) + throw new ArgumentNullException(nameof(warpMatrix)); + templateImage.ThrowIfDisposed(); + inputImage.ThrowIfDisposed(); + warpMatrix.ThrowIfDisposed(); + inputMask?.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.video_findTransformECC1( + templateImage.CvPtr, inputImage.CvPtr, warpMatrix.CvPtr, (int)motionType, + criteria, inputMask?.CvPtr ?? IntPtr.Zero, gaussFiltSize, + out var ret)); + + GC.KeepAlive(templateImage); + GC.KeepAlive(inputImage); + GC.KeepAlive(warpMatrix); + GC.KeepAlive(inputMask); + return ret; + } + + /// + /// Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 . + /// + /// single-channel template image; CV_8U or CV_32F array. + /// single-channel input image which should be warped with the final warpMatrix in + /// order to provide an image similar to templateImage, same type as templateImage. + /// floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp). + /// parameter, specifying the type of motion + /// parameter, specifying the termination criteria of the ECC algorithm; + /// criteria.epsilon defines the threshold of the increment in the correlation coefficient between two + /// iterations(a negative criteria.epsilon makes criteria.maxcount the only termination criterion). + /// Default values are shown in the declaration above. + /// An optional mask to indicate valid values of inputImage. + /// + public static double FindTransformECC( + InputArray templateImage, + InputArray inputImage, + InputOutputArray warpMatrix, + MotionTypes motionType = MotionTypes.Affine, + TermCriteria? criteria = null, + InputArray? inputMask = null) + { + if (templateImage is null) + throw new ArgumentNullException(nameof(templateImage)); + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + if (warpMatrix is null) + throw new ArgumentNullException(nameof(warpMatrix)); + templateImage.ThrowIfDisposed(); + inputImage.ThrowIfDisposed(); + warpMatrix.ThrowIfDisposed(); + inputMask?.ThrowIfDisposed(); - flow.Fix(); - } + var criteriaValue = criteria.GetValueOrDefault(new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 50, 0.001)); - /// - /// Estimates the best-fit Euqcidean, similarity, affine or perspective transformation - /// that maps one 2D point set to another or one image to another. - /// - /// First input 2D point set stored in std::vector or Mat, or an image stored in Mat. - /// Second input 2D point set of the same size and the same type as A, or another image. - /// If true, the function finds an optimal affine transformation with no additional restrictions (6 degrees of freedom). - /// Otherwise, the class of transformations to choose from is limited to combinations of translation, rotation, and uniform scaling (5 degrees of freedom). - /// - public static Mat EstimateRigidTransform( - InputArray src, InputArray dst, bool fullAffine) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_findTransformECC2( + templateImage.CvPtr, inputImage.CvPtr, warpMatrix.CvPtr, (int)motionType, + criteriaValue, inputMask?.CvPtr ?? IntPtr.Zero, out var ret)); - IntPtr result = NativeMethods.video_estimateRigidTransform( - src.CvPtr, dst.CvPtr, fullAffine ? 1 : 0); - return new Mat(result); - } - - /// - /// Implementation of the Zach, Pock and Bischof Dual TV-L1 Optical Flow method - /// - /// - public static DenseOpticalFlow CreateOptFlow_DualTVL1() - { - return DenseOpticalFlow.CreateOptFlow_DualTVL1(); - } + GC.KeepAlive(templateImage); + GC.KeepAlive(inputImage); + GC.KeepAlive(warpMatrix); + GC.KeepAlive(inputMask); + return ret; } } diff --git a/src/OpenCvSharp/Cv2/Cv2_xfeatures2d.cs b/src/OpenCvSharp/Cv2/Cv2_xfeatures2d.cs deleted file mode 100644 index e0e58f043..000000000 --- a/src/OpenCvSharp/Cv2/Cv2_xfeatures2d.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - static partial class Cv2 - { - } -} diff --git a/src/OpenCvSharp/Cv2/Cv2_ximgproc.cs b/src/OpenCvSharp/Cv2/Cv2_ximgproc.cs deleted file mode 100644 index 0a8ad7f5f..000000000 --- a/src/OpenCvSharp/Cv2/Cv2_ximgproc.cs +++ /dev/null @@ -1,220 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenCvSharp.XImgProc; - -namespace OpenCvSharp -{ - static partial class Cv2 - { - /// - /// Applies Niblack thresholding to input image. - /// - /// T(x, y)\)}{0}{otherwise}\f] - /// - ** THRESH_BINARY_INV** - /// \f[dst(x, y) = \fork{0}{if \(src(x, y) > T(x, y)\)}{\texttt{maxValue}}{otherwise}\f] - /// where \f$T(x, y)\f$ is a threshold calculated individually for each pixel. - /// The threshold value \f$T(x, y)\f$ is the mean minus \f$ delta \f$ times standard deviation - /// of \f$\texttt{blockSize} \times\texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$. - /// The function can't process the image in-place. - /// ]]> - /// Source 8-bit single-channel image. - /// Destination image of the same size and the same type as src. - /// Non-zero value assigned to the pixels for which the condition is satisfied, - /// used with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. - /// Thresholding type, see cv::ThresholdTypes. - /// Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. - /// Constant multiplied with the standard deviation and subtracted from the mean. - /// Normally, it is taken to be a real number between 0 and 1. - public static void NiblackThreshold( - InputArray src, OutputArray dst, - double maxValue, ThresholdTypes type, int blockSize, double delta) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.ximgproc_niBlackThreshold(src.CvPtr, dst.CvPtr, maxValue, (int)type, blockSize, delta); - - GC.KeepAlive(src); - dst.Fix(); - } - - /// - /// Applies a binary blob thinning operation, to achieve a skeletization of the input image. - /// The function transforms a binary blob image into a skeletized form using the technique of Zhang-Suen. - /// - /// Source 8-bit single-channel image, containing binary blobs, with blobs having 255 pixel values. - /// Destination image of the same size and the same type as src. The function can work in-place. - /// Value that defines which thinning algorithm should be used. - public static void Thinning( - InputArray src, OutputArray dst, - ThinningTypes thinningType = ThinningTypes.ZHANGSUEN) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.ximgproc_thinning(src.CvPtr, dst.CvPtr, (int)thinningType); - - GC.KeepAlive(src); - dst.Fix(); - } - - /// - /// Creates a smart pointer to a FastLineDetector object and initializes it - /// - /// Segment shorter than this will be discarded - /// A point placed from a hypothesis line segment farther than - /// this will be regarded as an outlier - /// First threshold for hysteresis procedure in Canny() - /// Second threshold for hysteresis procedure in Canny() - /// Aperturesize for the sobel operator in Canny() - /// If true, incremental merging of segments will be perfomred - /// - public static FastLineDetector CreateFastLineDetector( - int lengthThreshold = 10, float distanceThreshold = 1.414213562f, - double cannyTh1 = 50.0, double cannyTh2 = 50.0, int cannyApertureSize = 3, - bool doMerge = false) - { - return FastLineDetector.Create(lengthThreshold, distanceThreshold, cannyTh1, cannyTh2, cannyApertureSize, doMerge); - } - - /// - /// Calculates 2D Fast Hough transform of an image. - /// - /// The source (input) image. - /// The destination image, result of transformation. - /// The depth of destination image - /// The part of Hough space to calculate, see cv::AngleRangeOption - /// The operation to be applied, see cv::HoughOp - /// Specifies to do or not to do image skewing, see cv::HoughDeskewOption - public static void FastHoughTransform( - InputArray src, - OutputArray dst, - MatType dstMatDepth, - AngleRangeOption angleRange = AngleRangeOption.ARO_315_135, - HoughOP op = HoughOP.FHT_ADD, - HoughDeskewOption makeSkew = HoughDeskewOption.DESKEW) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.ximgproc_FastHoughTransform(src.CvPtr, dst.CvPtr, dstMatDepth, (int)angleRange, (int)op, (int)makeSkew); - - GC.KeepAlive(src); - dst.Fix(); - } - - /// - /// Calculates coordinates of line segment corresponded by point in Hough space. - /// - /// - /// If rules parameter set to RO_STRICT then returned line cut along the border of source image. - /// If rules parameter set to RO_WEAK then in case of point, which belongs - /// the incorrect part of Hough image, returned line will not intersect source image. - /// - /// Point in Hough space. - /// The source (input) image of Hough transform. - /// The part of Hough space where point is situated, see cv::AngleRangeOption - /// Specifies to do or not to do image skewing, see cv::HoughDeskewOption - /// Specifies strictness of line segment calculating, see cv::RulesOption - /// Coordinates of line segment corresponded by point in Hough space. - public static Vec4i HoughPoint2Line( - Point houghPoint, - InputArray srcImgInfo, - AngleRangeOption angleRange = AngleRangeOption.ARO_315_135, - HoughDeskewOption makeSkew = HoughDeskewOption.DESKEW, - RulesOption rules = RulesOption.IGNORE_BORDERS) - { - if (srcImgInfo == null) - throw new ArgumentNullException(nameof(srcImgInfo)); - srcImgInfo.ThrowIfDisposed(); - - var ret = NativeMethods.ximgproc_HoughPoint2Line(houghPoint, srcImgInfo.CvPtr, (int) angleRange, (int) makeSkew, - (int) rules); - GC.KeepAlive(srcImgInfo); - return ret; - } - - /// - /// Applies weighted median filter to an image. - /// - /// - /// For more details about this implementation, please see @cite zhang2014100+ - /// - /// Joint 8-bit, 1-channel or 3-channel image. - /// Source 8-bit or floating-point, 1-channel or 3-channel image. - /// Destination image. - /// Radius of filtering kernel, should be a positive integer. - /// Filter range standard deviation for the joint image. - /// The type of weight definition, see WMFWeightType - /// A 0-1 mask that has the same size with I. This mask is used to ignore the effect of some pixels. If the pixel value on mask is 0, - /// the pixel will be ignored when maintaining the joint-histogram.This is useful for applications like optical flow occlusion handling. - public static void WeightedMedianFilter( - InputArray joint, InputArray src, OutputArray dst, int r, - double sigma = 25.5, WMFWeightType weightType = WMFWeightType.EXP, Mat mask = null) - { - if (joint == null) - throw new ArgumentNullException(nameof(joint)); - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - joint.ThrowIfDisposed(); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.ximgproc_weightedMedianFilter( - joint.CvPtr, src.CvPtr, dst.CvPtr, r, sigma, (int)weightType, ToPtr(mask)); - - GC.KeepAlive(joint); - GC.KeepAlive(src); - dst.Fix(); - } - - /// - /// Computes the estimated covariance matrix of an image using the sliding window forumlation. - /// - /// - /// The window size parameters control the accuracy of the estimation. - /// The sliding window moves over the entire image from the top-left corner - /// to the bottom right corner.Each location of the window represents a sample. - /// If the window is the size of the image, then this gives the exact covariance matrix. - /// For all other cases, the sizes of the window will impact the number of samples - /// and the number of elements in the estimated covariance matrix. - /// - /// The source image. Input image must be of a complex type. - /// The destination estimated covariance matrix. Output matrix will be size (windowRows*windowCols, windowRows*windowCols). - /// The number of rows in the window. - /// The number of cols in the window. - public static void CovarianceEstimation(InputArray src, OutputArray dst, int windowRows, int windowCols) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.ximgproc_covarianceEstimation(src.CvPtr, dst.CvPtr, windowRows, windowCols); - - GC.KeepAlive(src); - dst.Fix(); - } - } -} diff --git a/src/OpenCvSharp/Fundamentals/CvObject.cs b/src/OpenCvSharp/Fundamentals/CvObject.cs index bfead5583..128d70720 100644 --- a/src/OpenCvSharp/Fundamentals/CvObject.cs +++ b/src/OpenCvSharp/Fundamentals/CvObject.cs @@ -1,64 +1,36 @@ -using System; +using System.Diagnostics.CodeAnalysis; -namespace OpenCvSharp +namespace OpenCvSharp; + +/// +/// A class which has a pointer of OpenCV structure +/// +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public abstract class CvObject : ICvPtrHolder { -#if LANG_JP - /// - /// OpenCVのネイティブポインタをもったクラスの基本クラス - /// -#else /// - /// A class which has a pointer of OpenCV structure + /// Data pointer /// -#endif - public abstract class CvObject : ICvPtrHolder - { - /// - /// Data pointer - /// - protected IntPtr ptr; + protected IntPtr ptr; -#if LANG_JP /// - /// + /// Default constructor /// -#else - /// - /// Default constructor - /// -#endif - protected CvObject() - { - } + protected CvObject() + { + } -#if LANG_JP /// /// /// /// -#else - /// - /// - /// - /// -#endif - protected CvObject(IntPtr ptr) - { - this.ptr = ptr; - } + protected CvObject(IntPtr ptr) + { + this.ptr = ptr; + } -#if LANG_JP /// - /// OpenCVの構造体へのネイティブポインタ + /// Native pointer of OpenCV structure /// -#else - /// - /// Native pointer of OpenCV structure - /// -#endif - public IntPtr CvPtr - { - get { return ptr; } - } - } + public IntPtr CvPtr => ptr; } diff --git a/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs b/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs index 5dc36b4fb..e96eb1dfe 100644 --- a/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs +++ b/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs @@ -1,121 +1,73 @@ -using System; +#pragma warning disable CA1051 // Do not declare visible instance fields +#pragma warning disable CA2216 -namespace OpenCvSharp +namespace OpenCvSharp; + +/// +/// DisposableObject + ICvPtrHolder +/// +public abstract class DisposableCvObject : DisposableObject, ICvPtrHolder { -#if LANG_JP /// - /// リソースを解放すべきOpenCVのクラスに継承させる基本クラス + /// Data pointer /// -#else + protected IntPtr ptr; + /// - /// DisposableObject + ICvPtrHolder + /// Default constructor /// -#endif - abstract public class DisposableCvObject : DisposableObject, ICvPtrHolder + protected DisposableCvObject() + : this(true) { - /// - /// Data pointer - /// - protected IntPtr ptr; - - /// - /// Track whether Dispose has been called - /// - private bool disposed; - - #region Init and Dispose -#if LANG_JP - /// - /// - /// -#else - /// - /// Default constructor - /// -#endif - protected DisposableCvObject() - : this(true) - { - } + } -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - protected DisposableCvObject(IntPtr ptr) - : this(ptr, true) - { - } + /// + /// Constructor + /// + /// + protected DisposableCvObject(IntPtr ptr) + : this(ptr, true) + { + } -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - protected DisposableCvObject(bool isEnabledDispose) - : this(IntPtr.Zero, isEnabledDispose) - { - } + /// + /// Constructor + /// + /// + protected DisposableCvObject(bool isEnabledDispose) + : this(IntPtr.Zero, isEnabledDispose) + { + } -#if LANG_JP - /// - /// - /// - /// - /// -#else - /// - /// - /// - /// - /// -#endif - protected DisposableCvObject(IntPtr ptr, bool isEnabledDispose) - : base(isEnabledDispose) - { - this.ptr = ptr; - } + /// + /// Constructor + /// + /// + /// + protected DisposableCvObject(IntPtr ptr, bool isEnabledDispose) + : base(isEnabledDispose) + { + this.ptr = ptr; + } - /// - /// releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - ptr = IntPtr.Zero; - base.DisposeUnmanaged(); - } + /// + /// releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + ptr = IntPtr.Zero; + base.DisposeUnmanaged(); + } - #endregion - -#if LANG_JP - /// - /// OpenCVの構造体へのネイティブポインタ - /// -#else - /// - /// Native pointer of OpenCV structure - /// -#endif - public IntPtr CvPtr + /// + /// Native pointer of OpenCV structure + /// + public IntPtr CvPtr + { + get { - get - { - ThrowIfDisposed(); - return ptr; - } + ThrowIfDisposed(); + return ptr; } } } diff --git a/src/OpenCvSharp/Fundamentals/DisposableObject.cs b/src/OpenCvSharp/Fundamentals/DisposableObject.cs index db420528a..387c3f4c6 100644 --- a/src/OpenCvSharp/Fundamentals/DisposableObject.cs +++ b/src/OpenCvSharp/Fundamentals/DisposableObject.cs @@ -1,307 +1,195 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; +using System.Runtime.InteropServices; -namespace OpenCvSharp +#pragma warning disable CA1805 // Do not initialize unnecessarily. + +namespace OpenCvSharp; + +/// +/// Represents a class which manages its own memory. +/// +public abstract class DisposableObject : IDisposable { -#if LANG_JP - /// - /// 解放処理を行うクラスが継承するための基本クラス - /// -#else /// - /// Represents a class which manages its own memory. + /// Gets or sets a handle which allocates using cvSetData. /// -#endif - public abstract class DisposableObject : IDisposable - { - /// - /// Gets or sets a handle which allocates using cvSetData. - /// - protected GCHandle dataHandle; + protected GCHandle DataHandle { get; private set; } - private volatile int disposeSignaled = 0; + private volatile int disposeSignaled = 0; - #region Properties -#if LANG_JP - /// - /// リソースが解放済みかどうかを取得する - /// -#else - /// - /// Gets a value indicating whether this instance has been disposed. - /// -#endif - public bool IsDisposed { get; protected set; } + /// + /// Gets a value indicating whether this instance has been disposed. + /// + public bool IsDisposed { get; protected set; } -#if LANG_JP - /// - /// 解放処理を許可するかどうかを取得・設定する. falseならばDisposeは何もしない. - /// 通常はユーザはこのフラグを変更してはならない. CvCapture.QueryFrameで取得したIplImageのように, - /// 解放処理をするとエラーとなるオブジェクトの場合に自動的にこのフラグがfalseとなる。 - /// -#else - /// - /// Gets or sets a value indicating whether you permit disposing this instance. - /// -#endif - public bool IsEnabledDispose { get; set; } + /// + /// Gets or sets a value indicating whether you permit disposing this instance. + /// + public bool IsEnabledDispose { get; set; } + /// + /// Gets or sets a memory address allocated by AllocMemory. + /// + protected IntPtr AllocatedMemory { get; set; } -#if LANG_JP - /// - /// cvCreateXXX といった関数がなく自前で構造体の分のメモリを確保する場合、 - /// そのアドレスを入れておく場所 - /// -#else - /// - /// Gets or sets a memory address allocated by AllocMemory. - /// -#endif - protected IntPtr AllocatedMemory { get; set; } + /// + /// Gets or sets the byte length of the allocated memory + /// + protected long AllocatedMemorySize { get; set; } -#if LANG_JP - /// - /// AllocatedMemoryに確保されているメモリのサイズ - /// -#else - /// - /// Gets or sets the byte length of the allocated memory - /// -#endif - protected long AllocatedMemorySize { get; set; } + /// + /// Default constructor + /// + protected DisposableObject() + : this(true) + { + } - #endregion + /// + /// Constructor + /// + /// true if you permit disposing this class by GC + protected DisposableObject(bool isEnabledDispose) + { + IsDisposed = false; + IsEnabledDispose = isEnabledDispose; + AllocatedMemory = IntPtr.Zero; + AllocatedMemorySize = 0; + } - #region Init and Dispossal -#if LANG_JP - /// - /// デフォルトコンストラクタ - /// -#else - /// - /// Default constructor - /// -#endif - protected DisposableObject() - : this(true) - { - } + /// + /// Releases the resources + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } -#if LANG_JP - /// - /// 解放の可否を指定して初期化 - /// - /// GCで解放するならtrue -#else - /// - /// Constructor - /// - /// true if you permit disposing this class by GC -#endif - protected DisposableObject(bool isEnabledDispose) + /// + /// Releases the resources + /// + /// + /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. + /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. + /// + protected virtual void Dispose(bool disposing) + { +#pragma warning disable 420 + // http://stackoverflow.com/questions/425132/a-reference-to-a-volatile-field-will-not-be-treated-as-volatile-implications + if (Interlocked.Exchange(ref disposeSignaled, 1) != 0) { - IsDisposed = false; - IsEnabledDispose = isEnabledDispose; - AllocatedMemory = IntPtr.Zero; - AllocatedMemorySize = 0; + return; } -#if LANG_JP - /// - /// リソースの解放 - /// -#else - /// - /// Releases the resources - /// -#endif - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } + IsDisposed = true; -#if LANG_JP - /// - /// リソースの解放 - /// - /// - /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。 - /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。 - /// -#else - /// - /// Releases the resources - /// - /// - /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. - /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. - /// -#endif - private void Dispose(bool disposing) + if (IsEnabledDispose) { -#pragma warning disable 420 - // http://stackoverflow.com/questions/425132/a-reference-to-a-volatile-field-will-not-be-treated-as-volatile-implications - if (Interlocked.Exchange(ref disposeSignaled, 1) != 0) + if (disposing) { - return; + DisposeManaged(); } + DisposeUnmanaged(); + } + } - IsDisposed = true; + /// + /// Destructor + /// + ~DisposableObject() + { + Dispose(false); + } - if (IsEnabledDispose) - { - if (disposing) - { - DisposeManaged(); - } - DisposeUnmanaged(); - } - } + /// + /// Releases managed resources + /// + protected virtual void DisposeManaged() + { + } -#if LANG_JP - /// - /// デストラクタ - /// -#else - /// - /// Destructor - /// -#endif - ~DisposableObject() + /// + /// Releases unmanaged resources + /// + protected virtual void DisposeUnmanaged() + { + if (DataHandle.IsAllocated) { - Dispose(false); + DataHandle.Free(); } - - /// - /// Releases managed resources - /// - protected virtual void DisposeManaged() + if (AllocatedMemorySize > 0) { + GC.RemoveMemoryPressure(AllocatedMemorySize); + AllocatedMemorySize = 0; } - - /// - /// Releases unmanaged resources - /// - protected virtual void DisposeUnmanaged() + if (AllocatedMemory != IntPtr.Zero) { - if (dataHandle.IsAllocated) - { - dataHandle.Free(); - } - if (AllocatedMemorySize > 0) - { - GC.RemoveMemoryPressure(AllocatedMemorySize); - AllocatedMemorySize = 0; - } - if (AllocatedMemory != IntPtr.Zero) - { - Marshal.FreeHGlobal(AllocatedMemory); - AllocatedMemory = IntPtr.Zero; - } + Marshal.FreeHGlobal(AllocatedMemory); + AllocatedMemory = IntPtr.Zero; } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// cvSetDataで割り当てる配列データをGCHandleでピン止めする - /// - /// -#else - /// - /// Pins the object to be allocated by cvSetData. - /// - /// - /// -#endif - protected internal GCHandle AllocGCHandle(object obj) - { - if (obj == null) - throw new ArgumentNullException(nameof(obj)); + } + + /// + /// Pins the object to be allocated by cvSetData. + /// + /// + /// + // ReSharper disable once InconsistentNaming + protected internal GCHandle AllocGCHandle(object obj) + { + if (obj is null) + throw new ArgumentNullException(nameof(obj)); - if (dataHandle.IsAllocated) - dataHandle.Free(); - dataHandle = GCHandle.Alloc(obj, GCHandleType.Pinned); - return dataHandle; - } + if (DataHandle.IsAllocated) + DataHandle.Free(); + DataHandle = GCHandle.Alloc(obj, GCHandleType.Pinned); + return DataHandle; + } -#if LANG_JP - /// - /// 指定したサイズの量のメモリを割り当てる。 - /// Dispose時に解放する - /// - /// 割り当てたメモリ -#else - /// - /// Allocates the specified size of memory. - /// - /// - /// -#endif - protected IntPtr AllocMemory(int size) - { - if (size <= 0) - throw new ArgumentOutOfRangeException(nameof(size)); + /// + /// Allocates the specified size of memory. + /// + /// + /// + protected IntPtr AllocMemory(int size) + { + if (size <= 0) + throw new ArgumentOutOfRangeException(nameof(size)); - if (AllocatedMemory != IntPtr.Zero) - Marshal.FreeHGlobal(AllocatedMemory); - AllocatedMemory = Marshal.AllocHGlobal(size); - NotifyMemoryPressure(size); - return AllocatedMemory; - } + if (AllocatedMemory != IntPtr.Zero) + Marshal.FreeHGlobal(AllocatedMemory); + AllocatedMemory = Marshal.AllocHGlobal(size); + NotifyMemoryPressure(size); + return AllocatedMemory; + } -#if LANG_JP - /// - /// アンマネージメモリを確保したメモリサイズを通知する。 - /// - /// 実際に確保するならAllocMemoryのほうを使う。 - /// 確保はcvCreateXXXがやってくれるという場合はこっちを使う - /// - /// -#else - /// - /// Notifies the allocated size of memory. - /// - /// -#endif - protected void NotifyMemoryPressure(long size) - { - // マルチスレッド動作時にロックがかかるらしい。いったん廃止 - if (!IsEnabledDispose) - return; - if (size == 0) - return; - if (size <= 0) - throw new ArgumentOutOfRangeException(nameof(size)); + /// + /// Notifies the allocated size of memory. + /// + /// + protected void NotifyMemoryPressure(long size) + { + // マルチスレッド動作時にロックがかかるらしい。いったん廃止 + if (!IsEnabledDispose) + return; + if (size == 0) + return; + if (size <= 0) + throw new ArgumentOutOfRangeException(nameof(size)); - if (AllocatedMemorySize > 0) - GC.RemoveMemoryPressure(AllocatedMemorySize); + if (AllocatedMemorySize > 0) + GC.RemoveMemoryPressure(AllocatedMemorySize); - AllocatedMemorySize = size; - GC.AddMemoryPressure(size); - } - -#if LANG_JP - /// - /// このオブジェクトが解放済みの場合はObjectDisposedExceptionを投げる - /// -#else - /// - /// If this object is disposed, then ObjectDisposedException is thrown. - /// -#endif - public void ThrowIfDisposed() - { - if (IsDisposed) - throw new ObjectDisposedException(GetType().FullName); - } + AllocatedMemorySize = size; + GC.AddMemoryPressure(size); + } - #endregion + /// + /// If this object is disposed, then ObjectDisposedException is thrown. + /// + public void ThrowIfDisposed() + { + if (IsDisposed) + throw new ObjectDisposedException(GetType().FullName); } } diff --git a/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs b/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs index fe8bcb45f..1167f3dc5 100644 --- a/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs +++ b/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs @@ -1,22 +1,12 @@ -using System; +namespace OpenCvSharp; -namespace OpenCvSharp +/// +/// Represents a OpenCV-based class which has a native pointer. +/// +public interface ICvPtrHolder { -#if LANG_JP /// - /// OpenCVのネイティブデータポインタを持つことを示すインターフェイス + /// Unmanaged OpenCV data pointer /// -#else - /// - /// Represents a OpenCV-based class which has a native pointer. - /// -#endif - public interface ICvPtrHolder - { - /// - /// Unmanaged OpenCV data pointer - /// - IntPtr CvPtr { get; } - - } + IntPtr CvPtr { get; } } diff --git a/src/OpenCvSharp/Fundamentals/MatMemoryManager.cs b/src/OpenCvSharp/Fundamentals/MatMemoryManager.cs new file mode 100644 index 000000000..ab25e1967 --- /dev/null +++ b/src/OpenCvSharp/Fundamentals/MatMemoryManager.cs @@ -0,0 +1,62 @@ +using System.Buffers; + +namespace OpenCvSharp; + +/// +/// A MemoryManager over an OpenCvSharpMat +/// +/// The pointer is assumed to be fully unmanaged, or externally pinned - no attempt will be made to pin this data +public sealed unsafe class MatMemoryManager : MemoryManager + where T : unmanaged +{ + private readonly Mat wrapped; + + /// + /// Create a new UnmanagedMemoryManager instance at the given pointer and size + /// + /// It is assumed that the span provided is already unmanaged or externally pinned + public MatMemoryManager(Mat mat, bool isDataOwner = true) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + if (!mat.IsContinuous()) + throw new ArgumentException("mat is not continuous", nameof(mat)); + + wrapped = isDataOwner ? mat : new Mat(mat); + } + + /// + public override Span GetSpan() => new((void*)wrapped.Data, (int)wrapped.Total()); + + /// + /// Provides access to a pointer that represents the data (note: no actual pin occurs) + /// + public override MemoryHandle Pin(int elementIndex = 0) + { + if (elementIndex < 0 || elementIndex >= wrapped.Total()) + throw new ArgumentOutOfRangeException(nameof(elementIndex)); + + var dims = wrapped.Dims; + var idxs = new int[dims]; + var remainIdx = elementIndex; + for (var dim = dims - 1; dim >= 0; dim--) + { + remainIdx = Math.DivRem(remainIdx, wrapped.Size(dim), out idxs[dim]); + } + + return new MemoryHandle((void*)wrapped.Ptr(idxs)); + } + + /// + /// Has no effect + /// + public override void Unpin() + { + } + + /// + /// Releases all resources associated with this object + /// + protected override void Dispose(bool disposing) + => wrapped.Dispose(); +} diff --git a/src/OpenCvSharp/Fundamentals/OpenCVException.cs b/src/OpenCvSharp/Fundamentals/OpenCVException.cs index 73f48cb48..0df09a81c 100644 --- a/src/OpenCvSharp/Fundamentals/OpenCVException.cs +++ b/src/OpenCvSharp/Fundamentals/OpenCVException.cs @@ -1,98 +1,105 @@ -using System; +using System.Runtime.Serialization; -namespace OpenCvSharp +namespace OpenCvSharp; + +/// +/// The default exception to be thrown by OpenCV +/// +[Serializable] +// ReSharper disable once InconsistentNaming +public class OpenCVException : Exception { -#if LANG_JP /// - /// OpenCVから投げられる例外 + /// The numeric code for error status + /// + public ErrorCode Status { get; set; } + + /// + /// The source file name where error is encountered + /// + public string FuncName { get; set; } + + /// + /// A description of the error /// -#else + public string ErrMsg { get; set; } + + /// + /// The source file name where error is encountered + /// + public string FileName { get; set; } + + /// + /// The line number in the source where error is encountered + /// + public int Line { get; set; } + /// - /// The default exception to be thrown by OpenCV + /// Constructor /// -#endif - public class OpenCVException : Exception + /// The numeric code for error status + /// The source file name where error is encountered + /// A description of the error + /// The source file name where error is encountered + /// The line number in the source where error is encountered + public OpenCVException(ErrorCode status, string funcName, string errMsg, string fileName, int line) + : base(errMsg) { - #region Properties -#if LANG_JP - /// - /// エラーステータス - /// -#else - /// - /// The numeric code for error status - /// -#endif - public ErrorCode Status { get; set; } -#if LANG_JP - /// - /// エラーが発生したOpenCVの関数名. - /// -#else - /// - /// The source file name where error is encountered - /// -#endif - public string FuncName { get; set; } -#if LANG_JP - /// - /// エラーについての追加情報/診断結果 - /// -#else - /// - /// A description of the error - /// -#endif - public string ErrMsg { get; set; } -#if LANG_JP - /// - /// エラーが発生したファイル名 - /// -#else - /// - /// The source file name where error is encountered - /// -#endif - public string FileName { get; set; } -#if LANG_JP - /// - /// エラーが発生した行番号 - /// -#else - /// - /// The line number in the souce where error is encountered - /// -#endif - public int Line { get; set; } - #endregion + Status = status; + FuncName = funcName; + ErrMsg = errMsg; + FileName = fileName; + Line = line; + } + + /// + protected OpenCVException(SerializationInfo info, StreamingContext context) : base(info, context) + { + Status = (ErrorCode) info.GetInt32(nameof(Status)); + FuncName = info.GetString(nameof(FuncName)) ?? ""; + FileName = info.GetString(nameof(FileName)) ?? ""; + ErrMsg = info.GetString(nameof(ErrMsg)) ?? ""; + Line = info.GetInt32(nameof(Line)); + } + + /// + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue(nameof(Status), Status); + info.AddValue(nameof(FuncName), FuncName); + info.AddValue(nameof(FileName), FileName); + info.AddValue(nameof(ErrMsg), ErrMsg); + info.AddValue(nameof(Line), Line); + } -#if LANG_JP - /// - /// 初期化 - /// - /// エラーステータス - /// エラーが発生した関数名 - /// エラーについての追加情報/診断結果 - /// エラーが発生したファイル名 - /// エラーが発生した行番号 -#else - /// - /// Constructor - /// - /// The numeric code for error status - /// The source file name where error is encountered - /// A description of the error - /// The source file name where error is encountered - /// The line number in the souce where error is encountered -#endif - public OpenCVException(ErrorCode status, string funcName, string errMsg, string fileName, int line) - : base(errMsg) - { - Status = status; - FuncName = funcName; - ErrMsg = errMsg; - FileName = fileName; - Line = line; - } + /// + public OpenCVException() + { + Status = 0; + FuncName = ""; + ErrMsg = ""; + FileName = ""; + Line = 0; + } + + /// + public OpenCVException(string message) : base(message) + { + Status = 0; + FuncName = ""; + ErrMsg = ""; + FileName = ""; + Line = 0; + } + + /// + public OpenCVException(string message, Exception innerException) : base(message, innerException) + { + Status = 0; + FuncName = ""; + ErrMsg = ""; + FileName = ""; + Line = 0; } } diff --git a/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs b/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs index e1efdba43..44e6c33dc 100644 --- a/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs +++ b/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs @@ -1,53 +1,38 @@ -using System; +using System.Runtime.Serialization; + +namespace OpenCvSharp; -namespace OpenCvSharp -{ -#if LANG_JP /// -/// OpenCvSharpから投げられる例外 +/// The exception that is thrown by OpenCvSharp. /// -#else - /// - /// The exception that is thrown by OpenCvSharp. - /// -#endif - public class OpenCvSharpException : Exception +[Serializable] +public class OpenCvSharpException : Exception +{ + /// + public OpenCvSharpException() { - /// - /// - /// - public OpenCvSharpException() - : base() - { - } + } - /// - /// - /// - /// - public OpenCvSharpException(string message) - : base(message) - { - } + /// + /// + public OpenCvSharpException(string message) + : base(message) + { + } - /// - /// - /// - /// - /// - public OpenCvSharpException(string messageFormat, params object[] args) - : base(string.Format(messageFormat, args)) - { - } + /// + /// + /// + public OpenCvSharpException(string message, Exception innerException) + : base(message, innerException) + { + } - /// - /// - /// - /// - /// - public OpenCvSharpException(string message, Exception innerException) - : base(message, innerException) - { - } + /// + /// + /// + protected OpenCvSharpException(SerializationInfo info, StreamingContext context) + : base(info, context) + { } } diff --git a/src/OpenCvSharp/Fundamentals/Ptr.cs b/src/OpenCvSharp/Fundamentals/Ptr.cs index 20ec7e9c5..9d508145c 100644 --- a/src/OpenCvSharp/Fundamentals/Ptr.cs +++ b/src/OpenCvSharp/Fundamentals/Ptr.cs @@ -1,29 +1,24 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Face; -using OpenCvSharp.ML; -using OpenCvSharp.XFeatures2D; -using OpenCvSharp.XImgProc; +using System.Diagnostics.CodeAnalysis; -namespace OpenCvSharp +namespace OpenCvSharp; + +/// +/// Template class for smart reference-counting pointers +/// +public abstract class Ptr : DisposableCvObject { /// - /// Template class for smart reference-counting pointers + /// Constructor /// - public abstract class Ptr : DisposableCvObject + /// + protected Ptr(IntPtr ptr) { - /// - /// Constructor - /// - /// - protected Ptr(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// Returns Ptr<T>.get() pointer - /// - public abstract IntPtr Get(); + this.ptr = ptr; } + + /// + /// Returns Ptr<T>.get() pointer + /// + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] + public abstract IntPtr Get(); } diff --git a/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs b/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs new file mode 100644 index 000000000..8150d0ff2 --- /dev/null +++ b/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs @@ -0,0 +1,108 @@ +namespace OpenCvSharp; + +/// +/// Used for managing the resources of OpenCVSharp, like Mat, MatExpr, etc. +/// +public sealed class ResourcesTracker : IDisposable +{ + private readonly ISet trackedObjects = new HashSet(); + private readonly object asyncLock = new (); + + /// + /// Trace the object obj, and return it + /// + /// + /// + /// + public TCvObject T(TCvObject obj) + where TCvObject : DisposableObject + { + if (obj is null) + throw new ArgumentNullException(nameof(obj)); + + lock (asyncLock) + { + trackedObjects.Add(obj); + } + return obj; + } + + /// + /// Trace an array of objects , and return them + /// + /// + /// + /// + public TCvObject[] T(TCvObject[] objects) + where TCvObject : DisposableObject + { + if (objects is null) + throw new ArgumentNullException(nameof(objects)); + + foreach (var obj in objects) + { + T(obj); + } + return objects; + } + + /// + /// Create a new Mat instance, and trace it + /// + /// + public Mat NewMat() + { + return T(new Mat()); + } + + /// + /// Create a new Mat instance, and trace it + /// + /// size + /// matType + /// scalar + /// + public Mat NewMat(Size size, MatType matType, Scalar scalar) + { + return T(new Mat(size, matType, scalar)); + } + + /// + /// Create a new UMat instance, and trace it + /// + /// + public UMat NewUMat() + { + return T(new UMat()); + } + + /// + /// Create a new UMat instance, and trace it + /// + /// size + /// matType + /// scalar + /// + public UMat NewUMat(Size size, MatType matType, Scalar scalar) + { + return T(new UMat(size, matType, scalar)); + } + + /// + /// Dispose all traced objects + /// + public void Dispose() + { + lock (asyncLock) + { + foreach (var obj in trackedObjects) + { + if (obj.IsDisposed == false) + { + obj.Dispose(); + } + } + trackedObjects.Clear(); + } + } +} diff --git a/src/OpenCvSharp/Fundamentals/SerializableAttribute.cs b/src/OpenCvSharp/Fundamentals/SerializableAttribute.cs deleted file mode 100644 index 78c5f3b45..000000000 --- a/src/OpenCvSharp/Fundamentals/SerializableAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if !DOTNET_FRAMEWORK - /// - /// Dummy System.Serializable - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] - public class SerializableAttribute : Attribute - { - } -#endif -} diff --git a/src/OpenCvSharp/Internal/PInvoke/ExceptionHandler.cs b/src/OpenCvSharp/Internal/PInvoke/ExceptionHandler.cs new file mode 100644 index 000000000..3e18b947a --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/ExceptionHandler.cs @@ -0,0 +1,79 @@ +#if DOTNETCORE + +namespace OpenCvSharp.Internal; + +/// +/// This static class defines one instance which than can be used by multiple threads to gather exception information from OpenCV +/// Implemented as a singleton +/// +public static class ExceptionHandler +{ + // ThreadLocal variables to save the exception for the current thread + private static readonly ThreadLocal exceptionHappened = new(false); + private static readonly ThreadLocal localStatus = new(); + private static readonly ThreadLocal localFuncName = new(); + private static readonly ThreadLocal localErrMsg = new(); + private static readonly ThreadLocal localFileName = new(); + private static readonly ThreadLocal localLine = new(); + + /// + /// Callback function invoked by OpenCV when exception occurs + /// Stores the information locally for every thread + /// + public static readonly CvErrorCallback ErrorHandlerCallback = + delegate (ErrorCode status, string funcName, string errMsg, string fileName, int line, IntPtr userData) + { + try + { + return 0; + } + finally + { + exceptionHappened.Value = true; + localStatus.Value = status; + localErrMsg.Value = errMsg; + localFileName.Value = fileName; + localLine.Value = line; + localFuncName.Value = funcName; + } + }; + + /// + /// Registers the callback function to OpenCV, so exception caught before the p/invoke boundary + /// + public static void RegisterExceptionCallback() + { + IntPtr zero = IntPtr.Zero; + IntPtr ret = NativeMethods.redirectError(ErrorHandlerCallback, zero, ref zero); + } + + /// + /// Throws appropriate exception if one happened + /// + public static void ThrowPossibleException() + { + if (CheckForException()) + { + throw new OpenCVException( + localStatus.Value, + localFuncName.Value ?? "", + localErrMsg.Value ?? "", + localFileName.Value ?? "", + localLine.Value); + } + } + + /// + /// Returns a boolean which indicates if an exception occured for the current thread + /// Reading this value changes its state, so an exception is handled only once + /// + private static bool CheckForException() + { + var value = exceptionHappened.Value; + // reset exception value + exceptionHappened.Value = false; + return value; + } +} + +#endif diff --git a/src/OpenCvSharp/Internal/PInvoke/ExceptionStatus.cs b/src/OpenCvSharp/Internal/PInvoke/ExceptionStatus.cs new file mode 100644 index 000000000..2bc41c45d --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/ExceptionStatus.cs @@ -0,0 +1,11 @@ +namespace OpenCvSharp.Internal; + +/// +/// Whether native methods for P/Invoke raises an exception +/// +public enum ExceptionStatus +{ +#pragma warning disable 1591 + NotOccurred = 0, + Occurred = 1 +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs new file mode 100644 index 000000000..dea202b3c --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs @@ -0,0 +1,240 @@ +using System.Diagnostics; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +#if DOTNET_FRAMEWORK +using System.Security; +using System.Security.Permissions; +#endif + +// TODO +#pragma warning disable CA5393 +[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.LegacyBehavior)] + +// ReSharper disable InconsistentNaming +#pragma warning disable 1591 +#pragma warning disable CA1805 // Do not initialize unnecessarily. + +namespace OpenCvSharp.Internal; + +/// +/// P/Invoke methods of OpenCV 2.x C++ interface +/// +#if DOTNET_FRAMEWORK + [SuppressUnmanagedCodeSecurity] +#endif +public static partial class NativeMethods +{ + public const string DllExtern = "OpenCvSharpExtern"; + + //public const string DllFfmpegX86 = "opencv_videoio_ffmpeg430"; + //public const string DllFfmpegX64 = "opencv_videoio_ffmpeg430_64"; + + //private const UnmanagedType StringUnmanagedType = UnmanagedType.LPStr; + + private const UnmanagedType StringUnmanagedTypeWindows = UnmanagedType.LPStr; + + private const UnmanagedType StringUnmanagedTypeNotWindows = +#if NET48 || NETSTANDARD2_0 + UnmanagedType.LPStr; +#else + UnmanagedType.LPUTF8Str; +#endif + + /// + /// Is tried P/Invoke once + /// + private static bool tried; + + /// + /// Static constructor + /// +#if DOTNET_FRAMEWORK + [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] +#endif + static NativeMethods() + { + LoadLibraries(WindowsLibraryLoader.Instance.AdditionalPaths); + + // call cv to enable redirecting + TryPInvoke(); + } + +#pragma warning disable CA1801 + public static void HandleException(ExceptionStatus status) + { +#if DOTNETCORE + // Check if there has been an exception + if (status == ExceptionStatus.Occurred /*&& IsUnix()*/) // thrown can be 1 when unix + { + ExceptionHandler.ThrowPossibleException(); + } +#else +#endif + } +#pragma warning restore CA1801 + + /// + /// Load DLL files dynamically using Win32 LoadLibrary + /// + /// + public static void LoadLibraries(IEnumerable? additionalPaths = null) + { + if (IsWasm()) + { + return; + } + + if (IsUnix()) + { +#if DOTNETCORE + ExceptionHandler.RegisterExceptionCallback(); +#endif + return; + } + + var ap = (additionalPaths is null) ? [] : additionalPaths.ToArray(); + + /* + if (Environment.Is64BitProcess) + WindowsLibraryLoader.Instance.LoadLibrary(DllFfmpegX64, ap); + else + WindowsLibraryLoader.Instance.LoadLibrary(DllFfmpegX86, ap); + //*/ + WindowsLibraryLoader.Instance.LoadLibrary(DllExtern, ap); + + // Redirection of error occurred in native library + var zero = IntPtr.Zero; + var current = redirectError(ErrorHandlerThrowException, zero, ref zero); + GC.KeepAlive(current); + } + + /// + /// Checks whether PInvoke functions can be called + /// + public static void TryPInvoke() + { +#pragma warning disable CA1031 + if (tried) + return; + tried = true; + + try + { + var ret = core_Mat_sizeof(); + GC.KeepAlive(ret); + } + catch (DllNotFoundException e) + { + var exception = PInvokeHelper.CreateException(e); + try{Console.WriteLine(exception.Message); } + // ReSharper disable once EmptyGeneralCatchClause + catch { } + try{Debug.WriteLine(exception.Message); } + // ReSharper disable once EmptyGeneralCatchClause + catch { } + throw exception; + } + catch (BadImageFormatException e) + { + var exception = PInvokeHelper.CreateException(e); + try { Console.WriteLine(exception.Message); } + // ReSharper disable once EmptyGeneralCatchClause + catch { } + try { Debug.WriteLine(exception.Message); } + // ReSharper disable once EmptyGeneralCatchClause + catch { } + throw exception; + } + catch (Exception e) + { + var ex = e.InnerException ?? e; + try{ Console.WriteLine(ex.Message); } + // ReSharper disable once EmptyGeneralCatchClause + catch { } + try { Debug.WriteLine(ex.Message); } + // ReSharper disable once EmptyGeneralCatchClause + catch { } + throw; + } +#pragma warning restore CA1031 + } + + /// + /// Returns whether the OS is Windows or not + /// + /// + public static bool IsWindows() + { +#if NET48 + return !IsUnix(); +#else + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); +#endif + } + + /// + /// Returns whether the OS is *nix or not + /// + /// + public static bool IsUnix() + { +#if NET48 + var p = Environment.OSVersion.Platform; + return (p == PlatformID.Unix || + p == PlatformID.MacOSX || + (int)p == 128); +#elif NETCOREAPP3_1_OR_GREATER + return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || + RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD); +#else + return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || + RuntimeInformation.IsOSPlatform(OSPlatform.OSX); +#endif + } + + /// + /// Returns whether the runtime is Mono or not + /// + /// + public static bool IsMono() + { + return (Type.GetType("Mono.Runtime") is not null); + } + + /// + /// Returns whether the architecture is Wasm or not + /// + /// + public static bool IsWasm() + { +#if NET6_0 + return RuntimeInformation.OSArchitecture == Architecture.Wasm; +#else + return false; +#endif + } + + /// + /// Custom error handler to be thrown by OpenCV + /// + public static readonly CvErrorCallback ErrorHandlerThrowException = + // ReSharper disable once UnusedParameter.Local + (status, funcName, errMsg, fileName, line, userData) => throw new OpenCVException(status, funcName, errMsg, fileName, line); + + /// + /// Custom error handler to ignore all OpenCV errors + /// + // ReSharper disable UnusedParameter.Local + public static readonly CvErrorCallback ErrorHandlerIgnorance = + (status, funcName, errMsg, fileName, line, userData) => 0; + // ReSharper restore UnusedParameter.Local + +#pragma warning disable CA2211 + /// + /// Default error handler + /// + public static CvErrorCallback? ErrorHandlerDefault = null; +#pragma warning restore CA2211 +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_aruco.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_aruco.cs new file mode 100644 index 000000000..37f2c8d15 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_aruco.cs @@ -0,0 +1,108 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using OpenCvSharp.Aruco; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_detectMarkers( + IntPtr image, IntPtr dictionary, IntPtr corners, IntPtr ids, ref DetectorParameters detectParameters, IntPtr outrejectedImgPoints); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_drawDetectedMarkers( + IntPtr image, + [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornerSize1, int[] contoursSize2, + [MarshalAs(UnmanagedType.LPArray)] int[] ids, int idxLength, Scalar borderColor); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_drawDetectedMarkers( + IntPtr image, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornerSize1, int[] contoursSize2, IntPtr ids, int idxLength, Scalar borderColor); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_estimatePoseSingleMarkers( + [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornersLength1, + int[] cornersLengths2, float markerLength, + IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr rvecs, IntPtr tvecs, IntPtr objPoints); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_getPredefinedDictionary(int name, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_readDictionary(string dictionaryFile, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_detectCharucoDiamond( + IntPtr image, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] markerCorners, int markerCornersSize1, int[] markerCornersSize2, + IntPtr markerIds, float squareMarkerLengthRate, + IntPtr diamondCorners, IntPtr diamondIds, IntPtr cameraMatrix, IntPtr distCoeffs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_drawDetectedDiamonds( + IntPtr image, + [MarshalAs(UnmanagedType.LPArray)] IntPtr[] corners, int cornerSize1, int[] contoursSize2, + IntPtr ids, Scalar borderColor); + + #region Dictionary + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_setMarkerSize(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_setMaxCorrectionBits(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_getBytesList(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_getMarkerSize(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_getMaxCorrectionBits(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_identify( + IntPtr obj, + IntPtr onlyBits, + out int idx, + out int rotation, + double maxCorrectionRate, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_getDistanceToId( + IntPtr obj, + IntPtr bits, + int id, + int allRotations, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_generateImageMarker( + IntPtr obj, + int id, + int sidePixels, + IntPtr img, + int borderBits); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_getByteListFromBits( + IntPtr bits, + IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus aruco_Dictionary_getBitsFromByteList( + IntPtr byteList, + int markerSize, + IntPtr returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_bgsegm.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_bgsegm.cs new file mode 100644 index 000000000..293ac15ce --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_bgsegm.cs @@ -0,0 +1,123 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region BackgroundSubtractorMOG + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_createBackgroundSubtractorMOG( + int history, int nMixtures, double backgroundRatio, double noiseSigma, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_Ptr_BackgroundSubtractorMOG_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_Ptr_BackgroundSubtractorMOG_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_getHistory(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_setHistory(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_getNMixtures(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_setNMixtures(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_getBackgroundRatio(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_setBackgroundRatio(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_getNoiseSigma(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorMOG_setNoiseSigma(IntPtr ptr, double value); + + #endregion + + #region BackgroundSubtractorGMG + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_createBackgroundSubtractorGMG( + int initializationFrames, double decisionThreshold, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_Ptr_BackgroundSubtractorGMG_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_Ptr_BackgroundSubtractorGMG_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getMaxFeatures(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setMaxFeatures(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getDefaultLearningRate(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setDefaultLearningRate(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getNumFrames(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setNumFrames(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getQuantizationLevels(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setQuantizationLevels(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getBackgroundPrior(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setBackgroundPrior(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getSmoothingRadius(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setSmoothingRadius(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getDecisionThreshold(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setDecisionThreshold(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getUpdateBackgroundModel(IntPtr ptr, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setUpdateBackgroundModel(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getMinVal(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setMinVal(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_getMaxVal(IntPtr ptr, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus bgsegm_BackgroundSubtractorGMG_setMaxVal(IntPtr ptr, double value); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_dnn_superres.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_dnn_superres.cs new file mode 100644 index 000000000..f22b51497 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_dnn_superres.cs @@ -0,0 +1,74 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_new1( + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_new2( + [MarshalAs(UnmanagedType.LPStr)] string algo, int scale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_readModel1( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string path); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_readModel2( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string weights, [MarshalAs(UnmanagedType.LPStr)] string definition); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_setModel( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string algo, int scale); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_setPreferableBackend( + IntPtr obj, int backendId); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_setPreferableTarget( + IntPtr obj, int targetId); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_upsample( + IntPtr obj, IntPtr img, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_upsampleMultioutput( + IntPtr obj, IntPtr img, IntPtr imgsNew, + int[] scaleFactors, int scaleFactorsSize, + string[] nodeNames, int nodeNamesSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_getScale( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus dnn_superres_DnnSuperResImpl_getAlgorithm( + IntPtr obj, IntPtr returnValue); + +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_flann.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_flann.cs new file mode 100644 index 000000000..bcce11dba --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_flann.cs @@ -0,0 +1,192 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using OpenCvSharp.Flann; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region Index + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_new(IntPtr features, IntPtr @params, int distType, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_knnSearch1( + IntPtr obj, [In] float[] queries, int queriesLength, [Out] int[] indices, [Out] float[] dists, int knn, IntPtr @params); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_knnSearch2( + IntPtr obj, IntPtr queries, IntPtr indices, IntPtr dists, int knn, IntPtr @params); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_knnSearch3( + IntPtr obj, IntPtr queries, [Out] int[] indices, [Out] float[] dists, int knn, IntPtr @params); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_radiusSearch1( + IntPtr obj, [In] float[] queries, int queriesLength, [Out] int[] indices, int indicesLength, [Out] float[] dists, int distsLength, double radius, int maxResults, IntPtr @params); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_radiusSearch2( + IntPtr obj, IntPtr queries, IntPtr indices, IntPtr dists, double radius, int maxResults, IntPtr @params); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_radiusSearch3( + IntPtr obj, IntPtr queries, [Out] int[] indices, int indicesLength, [Out] float[] dists, int distsLength, double radius, int maxResults, IntPtr @params); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_Index_save(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); + + #endregion + + #region IndexParams + #region IndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_IndexParams_new(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_IndexParams_get(IntPtr ptr, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_IndexParams_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_getString( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string? defaultVal, IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_getInt( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int defaultVal, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_getDouble( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, double defaultVal, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_setString(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_setInt(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_setDouble(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_setFloat(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_setBool(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_IndexParams_setAlgorithm(IntPtr obj, int value); + + #endregion + + #region LinearIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_LinearIndexParams_new(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_LinearIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_LinearIndexParams_delete(IntPtr obj); + + #endregion + + #region KDTreeIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_KDTreeIndexParams_new(int trees, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_KDTreeIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_KDTreeIndexParams_delete(IntPtr obj); + + #endregion + + #region KMeansIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_KMeansIndexParams_new( + int branching, int iterations, [MarshalAs(UnmanagedType.I4)] FlannCentersInit centersInit, float cbIndex, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_KMeansIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_KMeansIndexParams_delete(IntPtr obj); + + #endregion + + #region LshIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_LshIndexParams_new( + int tableNumber, int keySize, int multiProbeLevel, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_LshIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_LshIndexParams_delete(IntPtr obj); + + #endregion + + #region CompositeIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_CompositeIndexParams_new( + int trees, int branching, int iterations, FlannCentersInit centersInit, float cbIndex, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_CompositeIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_CompositeIndexParams_delete(IntPtr obj); + + #endregion + + #region AutotunedIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_AutotunedIndexParams_new( + float targetPrecision, float buildWeight, float memoryWeight, float sampleFraction, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_AutotunedIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_AutotunedIndexParams_delete(IntPtr obj); + + #endregion + + #region SavedIndexParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_SavedIndexParams_new( + [MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_SavedIndexParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_SavedIndexParams_delete(IntPtr obj); + + #endregion + + #region SearchParams + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_SearchParams_new(int checks, float eps, int sorted, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_SearchParams_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus flann_Ptr_SearchParams_delete(IntPtr obj); + + #endregion + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_highgui.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_highgui.cs new file mode 100644 index 000000000..b3f00c3a5 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_highgui.cs @@ -0,0 +1,112 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_namedWindow([MarshalAs(UnmanagedType.LPStr)] string winName, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_destroyWindow([MarshalAs(UnmanagedType.LPStr)] string winName); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus highgui_destroyAllWindows(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus highgui_startWindowThread(out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_imshow([MarshalAs(UnmanagedType.LPStr)] string winName, IntPtr mat); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_imshow_umat([MarshalAs(UnmanagedType.LPStr)] string winName, IntPtr mat); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus highgui_waitKey(int delay, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus highgui_waitKeyEx(int delay, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_resizeWindow([MarshalAs(UnmanagedType.LPStr)] string winName, int width, int height); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_moveWindow([MarshalAs(UnmanagedType.LPStr)] string winName, int x, int y); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_setWindowProperty([MarshalAs(UnmanagedType.LPStr)] string winName, int propId, double propValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_setWindowTitle([MarshalAs(UnmanagedType.LPStr)] string winName, [MarshalAs(UnmanagedType.LPStr)] string title); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_getWindowProperty([MarshalAs(UnmanagedType.LPStr)] string winName, int propId, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_getWindowImageRect([MarshalAs(UnmanagedType.LPStr)] string winName, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_setMouseCallback(string winName, [MarshalAs(UnmanagedType.FunctionPtr)] MouseCallback onMouse, IntPtr userData); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_getMouseWheelDelta(int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_selectROI1( + [MarshalAs(UnmanagedType.LPStr)] string windowName, IntPtr img, int showCrosshair, int fromCenter, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_selectROI2(IntPtr img, int showCrosshair, int fromCenter, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_selectROIs( + [MarshalAs(UnmanagedType.LPStr)] string windowName, IntPtr img, IntPtr boundingBoxes, int showCrosshair, int fromCenter); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_createTrackbar( + [MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, + IntPtr value, int count, IntPtr onChange, IntPtr userData, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_createTrackbar( + [MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, + IntPtr value, int count, TrackbarCallbackNative? onChange, IntPtr userData, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_createTrackbar( + [MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, + ref int value, int count, TrackbarCallbackNative? onChange, IntPtr userData, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_getTrackbarPos( + [MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_setTrackbarPos(string trackbarName, string winName, int pos); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_setTrackbarMax([MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, int maxVal); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_setTrackbarMin([MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, int minVal); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + //public static extern ExceptionStatus highgui_createButton( + // [MarshalAs(UnmanagedType.LPStr)] string barName, IntPtr onChange, IntPtr userData, int type, int initialButtonState, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_cvGetWindowHandle([MarshalAs(UnmanagedType.LPStr)] string name, out IntPtr returnValue); + +#if WINRT + // MP! Added: To correctly support imShow under WinRT. + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus highgui_initContainer([MarshalAs(UnmanagedType.IUnknown)] Object panel); +#endif +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_img_hash.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_img_hash.cs new file mode 100644 index 000000000..b3ccbf99d --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_img_hash.cs @@ -0,0 +1,111 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_ImgHashBase_compute(IntPtr obj, IntPtr inputArr, IntPtr outputArr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_ImgHashBase_compare(IntPtr obj, IntPtr hashOne, IntPtr hashTwo, out double returnValue); + + + // AverageHash + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_AverageHash_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_AverageHash_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_AverageHash_get(IntPtr ptr, out IntPtr returnValue); + + // BlockMeanHash + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_BlockMeanHash_create(int mode, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_BlockMeanHash_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_BlockMeanHash_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_BlockMeanHash_setMode(IntPtr obj, int mode); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_BlockMeanHash_getMean(IntPtr obj, IntPtr outVec); + + // ColorMomentHash + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_ColorMomentHash_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_ColorMomentHash_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_ColorMomentHash_get(IntPtr ptr, out IntPtr returnValue); + + // MarrHildrethHash + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_MarrHildrethHash_create(float alpha, float scale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_MarrHildrethHash_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_MarrHildrethHash_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_MarrHildrethHash_setKernelParam(IntPtr obj, float alpha, float scale); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_MarrHildrethHash_getAlpha(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_MarrHildrethHash_getScale(IntPtr obj, out float returnValue); + + // PHash + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_PHash_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_PHash_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_PHash_get(IntPtr ptr, out IntPtr returnValue); + + // RadialVarianceHash + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_RadialVarianceHash_create(double sigma, int numOfAngleLine, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_RadialVarianceHash_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_Ptr_RadialVarianceHash_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_RadialVarianceHash_setNumOfAngleLine(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_RadialVarianceHash_setSigma(IntPtr obj, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_RadialVarianceHash_getNumOfAngleLine(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus img_hash_RadialVarianceHash_getSigma(IntPtr obj, out double returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_imgcodecs.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_imgcodecs.cs new file mode 100644 index 000000000..eb1cbd94f --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_imgcodecs.cs @@ -0,0 +1,145 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // imread + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imread")] + public static extern ExceptionStatus imgcodecs_imread_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string fileName, int flags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imread")] + public static extern ExceptionStatus imgcodecs_imread_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string fileName, int flags, out IntPtr returnValue); + + [Pure] + public static ExceptionStatus imgcodecs_imread(string fileName, int flags, out IntPtr returnValue) + { + if (IsWindows()) + return imgcodecs_imread_Windows(fileName, flags, out returnValue); + return imgcodecs_imread_NotWindows(fileName, flags, out returnValue); + } + + // imreadmulti + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imreadmulti")] + public static extern ExceptionStatus imgcodecs_imreadmulti_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string fileName, IntPtr mats, int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imreadmulti")] + public static extern ExceptionStatus imgcodecs_imreadmulti_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string fileName, IntPtr mats, int flags, out int returnValue); + + [Pure] + public static ExceptionStatus imgcodecs_imreadmulti(string fileName, IntPtr mats, int flags, out int returnValue) + { + if (IsWindows()) + return imgcodecs_imreadmulti_Windows(fileName, mats, flags, out returnValue); + return imgcodecs_imreadmulti_NotWindows(fileName, mats, flags, out returnValue); + } + + // imwrite + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imwrite")] + public static extern ExceptionStatus imgcodecs_imwrite_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string fileName, IntPtr img, [In] int[] @params, int paramsLength, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imwrite")] + public static extern ExceptionStatus imgcodecs_imwrite_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string fileName, IntPtr img, [In] int[] @params, int paramsLength, out int returnValue); + + [Pure] + public static ExceptionStatus imgcodecs_imwrite(string fileName, IntPtr img, int[] @params, int paramsLength, out int returnValue) + { + if (IsWasm()) { + returnValue = default(int); + return ExceptionStatus.Occurred; + } + + if (IsWindows()) + return imgcodecs_imwrite_Windows(fileName, img, @params, paramsLength, out returnValue); + return imgcodecs_imwrite_NotWindows(fileName, img, @params, paramsLength, out returnValue); + } + + // imwrite_multi + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imwrite_multi")] + public static extern ExceptionStatus imgcodecs_imwrite_multi_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string fileName, IntPtr img, [In] int[] @params, int paramsLength, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imwrite_multi")] + public static extern ExceptionStatus imgcodecs_imwrite_multi_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string fileName, IntPtr img, [In] int[] @params, int paramsLength, out int returnValue); + + [Pure] + public static ExceptionStatus imgcodecs_imwrite_multi(string fileName, IntPtr img, int[] @params, int paramsLength, out int returnValue) + { + if (IsWindows()) + return imgcodecs_imwrite_multi_Windows(fileName, img, @params, paramsLength, out returnValue); + return imgcodecs_imwrite_multi_NotWindows(fileName, img, @params, paramsLength, out returnValue); + } + + // + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgcodecs_imdecode_Mat( + IntPtr buf, int flags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus imgcodecs_imdecode_vector( + byte* buf, int bufLength, int flags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgcodecs_imdecode_InputArray( + IntPtr buf, int flags, out IntPtr returnValue); + + // Do not consider that "ext" may not be ASCII characters + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus imgcodecs_imencode_vector( + [MarshalAs(UnmanagedType.LPStr)] string ext, IntPtr img, IntPtr buf, [In] int[] @params, int paramsLength, out int returnValue); + + // haveImageReader + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imwrite")] + public static extern ExceptionStatus imgcodecs_haveImageReader_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string fileName, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true, + EntryPoint = "imgcodecs_imwrite")] + public static extern ExceptionStatus imgcodecs_haveImageReader_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string fileName, out int returnValue); + + [Pure] + public static ExceptionStatus imgcodecs_haveImageReader(string fileName, out int returnValue) + { + if (IsWasm()) { + returnValue = default(int); + return ExceptionStatus.Occurred; + } + + if (IsWindows()) + return imgcodecs_haveImageReader_Windows(fileName, out returnValue); + return imgcodecs_haveImageReader_NotWindows(fileName, out returnValue); + } + + // haveImageWriter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus imgcodecs_haveImageWriter( + [MarshalAs(UnmanagedType.LPStr)] string fileName, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_line_descriptor.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_line_descriptor.cs new file mode 100644 index 000000000..1d9dda0af --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_line_descriptor.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus line_descriptor_LSDDetector_new1( + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus line_descriptor_LSDDetector_new2( + double scale, + double sigmaScale, + double quant, + double angTh, + double logEps, + double densityTh, + int nBins, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus line_descriptor_LSDDetector_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus line_descriptor_LSDDetector_detect1( + IntPtr obj, IntPtr image, IntPtr keypoints, int scale, int numOctaves, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus line_descriptor_LSDDetector_detect2( + IntPtr obj, + IntPtr[] images, int imagesSize, + IntPtr keyLines, int scale, int numOctaves, + IntPtr[] masks, int masksSize); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_optflow.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_optflow.cs new file mode 100644 index 000000000..f6b50644c --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_optflow.cs @@ -0,0 +1,65 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region motempl + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_motempl_updateMotionHistory( + IntPtr silhouette, IntPtr mhi, + double timestamp, double duration); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_motempl_calcMotionGradient( + IntPtr mhi, IntPtr mask, IntPtr orientation, + double delta1, double delta2, int apertureSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_motempl_calcGlobalOrientation( + IntPtr orientation, IntPtr mask, + IntPtr mhi, double timestamp, double duration, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_motempl_segmentMotion( + IntPtr mhi, IntPtr segmask, IntPtr boundingRects, + double timestamp, double segThresh); + + #endregion + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_calcOpticalFlowSF1( + IntPtr from, IntPtr to, IntPtr flow, + int layers, + int averagingBlockSize, + int maxFlow); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_calcOpticalFlowSF2( + IntPtr from, IntPtr to, IntPtr flow, + int layers, + int averagingBlockSize, + int maxFlow, + double sigmaDist, + double sigmaColor, + int postprocessWindow, + double sigmaDistFix, + double sigmaColorFix, + double occThr, + int upscaleAveragingRadius, + double upscaleSigmaDist, + double upscaleSigmaColor, + double speedUpThr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus optflow_calcOpticalFlowSparseToDense( + IntPtr from, IntPtr to, IntPtr flow, + int gridStep, int k, float sigma, int usePostProc, float fgsLambda, float fgsSigma); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_quality.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_quality.cs new file mode 100644 index 000000000..f7687d45e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_quality.cs @@ -0,0 +1,131 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region QualityBase + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityBase_compute(IntPtr obj, IntPtr img, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityBase_getQualityMap(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityBase_clear(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityBase_empty(IntPtr obj, out int returnValue); + + #endregion + + #region QualityPSNR + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_createQualityPSNR(IntPtr @ref, double maxPixelValue, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityPSNR_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityPSNR_staticCompute( + IntPtr @ref, IntPtr cmp, IntPtr qualityMap, double maxPixelValue, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityPSNR_getMaxPixelValue(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityPSNR_setMaxPixelValue(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityPSNR_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region QualitySSIM + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_createQualitySSIM(IntPtr @ref, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualitySSIM_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualitySSIM_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualitySSIM_staticCompute( + IntPtr @ref, IntPtr cmp, IntPtr qualityMap, out Scalar returnValue); + + #endregion + + #region QualityGMSD + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_createQualityGMSD(IntPtr @ref, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityGMSD_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityGMSD_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityGMSD_staticCompute( + IntPtr @ref, IntPtr cmp, IntPtr qualityMap, out Scalar returnValue); + + #endregion + + #region QualityMSE + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_createQualityMSE(IntPtr @ref, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityMSE_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityMSE_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityMSE_staticCompute( + IntPtr @ref, IntPtr cmp, IntPtr qualityMap, out Scalar returnValue); + + #endregion + + #region QualityBRISQUE + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_createQualityBRISQUE1( + [MarshalAs(UnmanagedType.LPStr)] string modelFilePath, + [MarshalAs(UnmanagedType.LPStr)] string rangeFilePath, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_createQualityBRISQUE2(IntPtr model, IntPtr range, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityBRISQUE_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_Ptr_QualityBRISQUE_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityBRISQUE_staticCompute( + IntPtr @ref, + [MarshalAs(UnmanagedType.LPStr)] string modelFilePath, + [MarshalAs(UnmanagedType.LPStr)] string rangeFilePath, + out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus quality_QualityBRISQUE_computeFeatures(IntPtr img, IntPtr features); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_stdstring.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_stdstring.cs new file mode 100644 index 000000000..6a2dc7539 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_stdstring.cs @@ -0,0 +1,24 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr string_new1(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + public static extern IntPtr string_new2([MarshalAs(UnmanagedType.LPArray)] byte[] str); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void string_delete(IntPtr s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe sbyte* string_c_str(IntPtr s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint string_size(IntPtr s); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_stdvector.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_stdvector.cs new file mode 100644 index 000000000..85560120e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_stdvector.cs @@ -0,0 +1,451 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using OpenCvSharp.Detail; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1707 // Underscore +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region uchar + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_uchar_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_uchar_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_uchar_new3([In] byte[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_uchar_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_uchar_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_uchar_copy(IntPtr vector, IntPtr dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_uchar_delete(IntPtr vector); + #endregion + #region int + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_int32_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_int32_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_int32_new3([In] int[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_int32_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_int32_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_int32_delete(IntPtr vector); + #endregion + #region float + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_float_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_float_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_float_new3([In] float[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_float_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_float_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_float_delete(IntPtr vector); + #endregion + #region double + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_double_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_double_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_double_new3([In] double[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_double_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_double_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_double_delete(IntPtr vector); + #endregion + #region cv::Vec2f + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec2f_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Vec2f_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec2f_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Vec2f_delete(IntPtr vector); + #endregion + #region cv::Vec3f + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec3f_new1(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Vec3f_getSize(IntPtr vector); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec3f_getPointer(IntPtr vector); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Vec3f_delete(IntPtr vector); + #endregion + #region cv::Vec4f + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec4f_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec4f_new3([In] Vec4f[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Vec4f_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec4f_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Vec4f_delete(IntPtr vector); + #endregion + #region cv::Vec4i + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec4i_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec4i_new3([In] Vec4i[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Vec4i_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec4i_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Vec4i_delete(IntPtr vector); + #endregion + #region cv::Vec6f + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec6f_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Vec6f_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Vec6f_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Vec6f_delete(IntPtr vector); + #endregion + #region cv::Point2i + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2i_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2i_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2i_new3([In] Point[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Point2i_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2i_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Point2i_delete(IntPtr vector); + #endregion + #region cv::Point2f + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2f_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2f_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2f_new3([In] Point2f[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Point2f_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2f_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Point2f_delete(IntPtr vector); + #endregion + #region cv::Point2d + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2d_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Point2d_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point2d_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Point2d_delete(IntPtr vector); + #endregion + #region cv::Point3f + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point3f_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point3f_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point3f_new3([In] Point3f[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Point3f_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Point3f_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Point3f_delete(IntPtr vector); + #endregion + #region cv::Rect + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect_new3([In] Rect[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Rect_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Rect_delete(IntPtr vector); + #endregion + #region cv::Rect2d + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect2d_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect2d_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect2d_new3([In] Rect2d[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Rect2d_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Rect2d_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Rect2d_delete(IntPtr vector); + #endregion + #region cv::RotatedRect + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_RotatedRect_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_RotatedRect_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_RotatedRect_new3([In] RotatedRect[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_RotatedRect_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_RotatedRect_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_RotatedRect_delete(IntPtr vector); + #endregion + #region cv::KeyPoint + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_KeyPoint_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_KeyPoint_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_KeyPoint_new3([In]KeyPoint[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_KeyPoint_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_KeyPoint_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_KeyPoint_delete(IntPtr vector); + #endregion + #region cv::KeyPoint + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DMatch_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DMatch_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DMatch_new3([In] DMatch[] data, nuint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_DMatch_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DMatch_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_DMatch_delete(IntPtr vector); + #endregion + #region cv::Mat + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Mat_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Mat_new2(uint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Mat_new3(IntPtr[] data, uint dataLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_Mat_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_Mat_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Mat_delete(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_Mat_assignToArray(IntPtr vector, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] arr); + + #endregion + + #region cv::ml::DTrees::Node + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DTrees_Node_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_DTrees_Node_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DTrees_Node_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_DTrees_Node_delete(IntPtr vector); + + #endregion + #region cv::ml::DTrees::Split + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DTrees_Split_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_DTrees_Split_getSize(IntPtr vector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_DTrees_Split_getPointer(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_DTrees_Split_delete(IntPtr vector); + + #endregion + #region cv::detail::ImageFeatures + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_ImageFeatures_new1(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_ImageFeatures_getSize(IntPtr vector); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_ImageFeatures_getKeypointsSize( + IntPtr vector, [Out] nuint[] dst); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_ImageFeatures_getElements(IntPtr vector, [Out] WImageFeatures[] dst); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_ImageFeatures_delete(IntPtr vector); + + #endregion + #region cv::line_descriptor::KeyLine +#if false + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_KeyLine_new1(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_KeyLine_getSize(IntPtr vector); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern void vector_KeyLine_getElements(IntPtr vector, [Out] KeyLine[] dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_KeyLine_getPointer(IntPtr vector); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_KeyLine_delete(IntPtr vector); +#endif + #endregion + + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_uchar_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_uchar_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_uchar_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_uchar_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_uchar_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_int_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_int_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_int_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_int_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_int_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_double_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_double_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_double_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_double_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_double_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_KeyPoint_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_KeyPoint_new3( + IntPtr[] values, int size1, int[] size2); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_KeyPoint_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_KeyPoint_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_KeyPoint_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_KeyPoint_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_DMatch_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_DMatch_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_DMatch_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_DMatch_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_DMatch_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_Point_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_Point_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_Point_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_Point_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_Point_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_Point_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_Point2f_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_Point2f_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_Point2f_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_Point2f_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_Point2f_delete(IntPtr vector); + #endregion + #region vector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_string_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_string_new2(nuint size); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_string_getSize(IntPtr vec); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_string_getElements( + IntPtr vector, + [MarshalAs(UnmanagedType.LPArray)] IntPtr[] cStringPointers, + [MarshalAs(UnmanagedType.LPArray)] int[] stringLengths); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_string_delete(IntPtr vector); + #endregion + #region vector +#if false + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr vector_vector_KeyLine_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern nuint vector_vector_KeyLine_getSize1(IntPtr vector); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_KeyLine_getSize2(IntPtr vector, [In, Out] nuint[] size); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_KeyLine_copy(IntPtr vec, IntPtr[] dst); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void vector_vector_KeyLine_delete(IntPtr vector); +#endif + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_videoio.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_videoio.cs new file mode 100644 index 000000000..ab7cd1834 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_videoio.cs @@ -0,0 +1,149 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // VideoCapture + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_new1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_new2( + [MarshalAs(UnmanagedType.LPStr)] string filename, int apiPreference, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_new3(int device, int apiPreference, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_new4( + [MarshalAs(UnmanagedType.LPStr)] string filename, int apiPreference, [In] int[] @params, int paramsLength, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_new5(int device, int apiPreference, [In] int[] @params, int paramsLength, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_open1( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename, int apiPreference, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_open2(IntPtr obj, int device, int apiPreference, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_isOpened(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_release(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_grab(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_retrieve_OutputArray(IntPtr obj, IntPtr image, int flag, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_retrieve_Mat(IntPtr obj, IntPtr image, int flag, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_operatorRightShift_Mat(IntPtr obj, IntPtr image); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus videoio_VideoCapture_operatorRightShift_UMat(IntPtr obj, IntPtr image); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_read_OutputArray(IntPtr obj, IntPtr image, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_read_Mat(IntPtr obj, IntPtr image, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_set(IntPtr obj, int propId, double value, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_get(IntPtr obj, int propId, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_getBackendName(IntPtr obj, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_setExceptionMode(IntPtr obj, int enable); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_getExceptionMode(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoCapture_waitAny( + IntPtr[] streams, nuint streamsSize, + IntPtr readyIndex, long timeoutNs, out int returnValue); + + + // VideoWriter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_new1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_new2( + [MarshalAs(UnmanagedType.LPStr)] string filename, int fourcc, double fps, + Size frameSize, int isColor, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_new3( + [MarshalAs(UnmanagedType.LPStr)] string filename, int apiPreference, int fourcc, double fps, + Size frameSize, int isColor, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_new4( + [MarshalAs(UnmanagedType.LPStr)] string filename, int fourcc, double fps, + Size frameSize, [In] int[] @params, int paramsLength, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_new5( + [MarshalAs(UnmanagedType.LPStr)] string filename, int apiPreference, int fourcc, double fps, + Size frameSize, [In] int[] @params, int paramsLength, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_open1( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename, + int fourcc, double fps, Size frameSize, int isColor, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_open2( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename, int apiPreference, + int fourcc, double fps, Size frameSize, int isColor, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_isOpened(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_release(IntPtr obj); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus videoio_VideoWriter_OperatorLeftShift(IntPtr obj, IntPtr image); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_write(IntPtr obj, IntPtr image); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_set(IntPtr obj, int propId, double value, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_get(IntPtr obj, int propId, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_fourcc(sbyte c1, sbyte c2, sbyte c3, sbyte c4, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus videoio_VideoWriter_getBackendName(IntPtr obj, IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_wechat_qrcode.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_wechat_qrcode.cs new file mode 100644 index 000000000..ec3b52440 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_wechat_qrcode.cs @@ -0,0 +1,27 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1707 // Underscore +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus wechat_qrcode_create1([MarshalAs(UnmanagedType.LPStr)] string detector_prototxt_path, + [MarshalAs(UnmanagedType.LPStr)] string detector_caffe_model_path, + [MarshalAs(UnmanagedType.LPStr)] string super_resolution_prototxt_path , + [MarshalAs(UnmanagedType.LPStr)] string super_resolution_caffe_model_path,out IntPtr ptr); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus wechat_qrcode_WeChatQRCode_detectAndDecode(IntPtr obj, IntPtr inputImage, IntPtr points, IntPtr texts); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus wechat_qrcode_Ptr_WeChatQRCode_get(IntPtr ptr, out IntPtr ret); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus wechat_qrcode_Ptr_delete(IntPtr ptr); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_xfeatures2d.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_xfeatures2d.cs new file mode 100644 index 000000000..6ab21a909 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_xfeatures2d.cs @@ -0,0 +1,122 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // BriefDescriptorExtractor + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_BriefDescriptorExtractor_create(int bytes, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_BriefDescriptorExtractor_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_BriefDescriptorExtractor_read(IntPtr obj, IntPtr fn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_BriefDescriptorExtractor_write(IntPtr obj, IntPtr fs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_BriefDescriptorExtractor_descriptorSize(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_BriefDescriptorExtractor_descriptorType(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_BriefDescriptorExtractor_get(IntPtr ptr, out IntPtr returnValue); + + + // FREAK + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_FREAK_create(int orientationNormalized, + int scaleNormalized, float patternScale, int nOctaves, + int[]? selectedPairs, int selectedPairsLength, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_FREAK_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_FREAK_get(IntPtr ptr, out IntPtr returnValue); + + // StarDetector + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_StarDetector_create( + int maxSize, int responseThreshold, + int lineThresholdProjected, int lineThresholdBinarized, int suppressNonmaxSize, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_StarDetector_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_StarDetector_get(IntPtr ptr, out IntPtr returnValue); + + + // LUCID + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_LUCID_create(int lucidKernel, int blurKernel, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_LUCID_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_LUCID_get(IntPtr ptr, out IntPtr returnValue); + + + // LATCH + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_LATCH_create( + int bytes, int rotationInvariance, int halfSsdSize, double sigma, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_LATCH_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_LATCH_get(IntPtr ptr, out IntPtr returnValue); + + + // SURF + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_create( + double hessianThreshold, int nOctaves, + int nOctaveLayers, int extended, int upright, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_SURF_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_Ptr_SURF_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_getHessianThreshold(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_getNOctaves(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_getNOctaveLayers(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_getExtended(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_getUpright(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_setHessianThreshold(IntPtr obj, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_setNOctaves(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_setNOctaveLayers(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_setExtended(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xfeatures2d_SURF_setUpright(IntPtr obj, int value); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_xphoto.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_xphoto.cs new file mode 100644 index 000000000..c216015e2 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_xphoto.cs @@ -0,0 +1,213 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1707 // Underscore +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region bm3d_image_denoising.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_bm3dDenoising1( + IntPtr src, + IntPtr dstStep1, + IntPtr dstStep2, + float h, + int templateWindowSize, + int searchWindowSize, + int blockMatchingStep1, + int blockMatchingStep2, + int groupSize, + int slidingStep, + float beta, + int normType, + int step, + int transformType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_bm3dDenoising2( + IntPtr src, + IntPtr dst, + float h, + int templateWindowSize, + int searchWindowSize, + int blockMatchingStep1, + int blockMatchingStep2, + int groupSize, + int slidingStep, + float beta, + int normType, + int step, + int transformType); + + #endregion + + #region dct_image_denoising.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_dctDenoising(IntPtr src, IntPtr dst, double sigma, int psize); + + #endregion + + #region inpainting.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_inpaint(IntPtr prt, IntPtr src, IntPtr dst, int algorithm); + + #endregion + + #region oilpainting.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_oilPainting( + IntPtr src, IntPtr dst, int size, int dynRatio, int code); + + #endregion + + #region tonemap.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_getSaturation(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_setSaturation(IntPtr obj, float saturation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_getContrast(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_setContrast(IntPtr obj, float contrast); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_getSigmaSpace(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_setSigmaSpace(IntPtr obj, float saturation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_getSigmaColor(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_TonemapDurand_setSigmaColor(IntPtr obj, float saturation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_createTonemapDurand( + float gamma, float contrast, float saturation, float sigmaSpace, float sigmaColor, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_TonemapDurand_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_TonemapDurand_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region white_balance.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_applyChannelGains( + IntPtr src, IntPtr dst, float gainB, float gainG, float gainR); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_createGrayworldWB(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_GrayworldWB_delete(IntPtr prt); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_GrayworldWB_get(IntPtr prt, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_GrayworldWB_balanceWhite(IntPtr prt, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_GrayworldWB_SaturationThreshold_get(IntPtr ptr, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_GrayworldWB_SaturationThreshold_set(IntPtr ptr, float val); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_createLearningBasedWB(string trackerType, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_LearningBasedWB_delete(IntPtr prt); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_LearningBasedWB_get(IntPtr prt, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_balanceWhite(IntPtr prt, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_extractSimpleFeatures(IntPtr prt, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_HistBinNum_set(IntPtr prt, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_RangeMaxVal_set(IntPtr prt, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_SaturationThreshold_set(IntPtr prt, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_HistBinNum_get(IntPtr prt, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_RangeMaxVal_get(IntPtr prt, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_LearningBasedWB_SaturationThreshold_get(IntPtr prt, out float returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_createSimpleWB(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_SimpleWB_delete(IntPtr prt); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_Ptr_SimpleWB_get(IntPtr prt, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_balanceWhite(IntPtr prt, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_InputMax_get(IntPtr prt, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_InputMax_set(IntPtr prt, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_InputMin_get(IntPtr prt, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_InputMin_set(IntPtr prt, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_OutputMax_get(IntPtr prt, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_OutputMax_set(IntPtr prt, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_OutputMin_get(IntPtr prt, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_OutputMin_set(IntPtr prt, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_P_get(IntPtr prt, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus xphoto_SimpleWB_P_set(IntPtr prt, float value); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d.cs new file mode 100644 index 000000000..8fc13cf28 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d.cs @@ -0,0 +1,515 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_Rodrigues( + IntPtr src, IntPtr dst, IntPtr jacobian); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findHomography_InputArray( + IntPtr srcPoints, IntPtr dstPoints, + int method, double ransacReprojThreshold, IntPtr mask, + int maxIters, double confidence, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findHomography_vector( + Point2d[] srcPoints, int srcPointsLength, + Point2d[] dstPoints, int dstPointsLength, int method, double ransacReprojThreshold, IntPtr mask, + int maxIters, double confidence, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findHomography_UsacParams( + IntPtr srcPoints, IntPtr dstPoints, IntPtr mask, ref WUsacParams @params, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_RQDecomp3x3_InputArray( + IntPtr src, IntPtr mtxR, + IntPtr mtxQ, IntPtr qx, IntPtr qy, IntPtr qz, out Vec3d outVal); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_RQDecomp3x3_Mat( + IntPtr src, IntPtr mtxR, IntPtr mtxQ, + IntPtr qx, IntPtr qy, IntPtr qz, out Vec3d outVal); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_decomposeProjectionMatrix_InputArray( + IntPtr projMatrix, IntPtr cameraMatrix, IntPtr rotMatrix, IntPtr transVect, + IntPtr rotMatrixX, IntPtr rotMatrixY, IntPtr rotMatrixZ, IntPtr eulerAngles); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_decomposeProjectionMatrix_Mat( + IntPtr projMatrix, IntPtr cameraMatrix, IntPtr rotMatrix, IntPtr transVect, + IntPtr rotMatrixX, IntPtr rotMatrixY, IntPtr rotMatrixZ, IntPtr eulerAngles); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_matMulDeriv( + IntPtr a, IntPtr b, IntPtr dABdA, IntPtr dABdB); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_composeRT_InputArray( + IntPtr rvec1, IntPtr tvec1, IntPtr rvec2, IntPtr tvec2, IntPtr rvec3, IntPtr tvec3, + IntPtr dr3dr1, IntPtr dr3dt1, IntPtr dr3dr2, IntPtr dr3dt2, + IntPtr dt3dr1, IntPtr dt3dt1, IntPtr dt3dr2, IntPtr dt3dt2); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_composeRT_Mat( + IntPtr rvec1, IntPtr tvec1, IntPtr rvec2, IntPtr tvec2, IntPtr rvec3, IntPtr tvec3, + IntPtr dr3dr1, IntPtr dr3dt1, IntPtr dr3dr2, IntPtr dr3dt2, + IntPtr dt3dr1, IntPtr dt3dt1, IntPtr dt3dr2, IntPtr dt3dt2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_projectPoints_InputArray( + IntPtr objectPoints, IntPtr rvec, IntPtr tvec, IntPtr cameraMatrix, IntPtr distCoeffs, + IntPtr imagePoints, IntPtr jacobian, double aspectRatio); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_projectPoints_Mat( + IntPtr objectPoints, IntPtr rvec, IntPtr tvec, IntPtr cameraMatrix, IntPtr distCoeffs, + IntPtr imagePoints, IntPtr jacobian, double aspectRatio); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_solvePnP_InputArray( + IntPtr selfectPoints, IntPtr imagePoints, IntPtr cameraMatrix, + IntPtr distCoeffs, IntPtr rvec, IntPtr tvec, int useExtrinsicGuess, int flags); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_solvePnP_vector( + Point3f[] objectPoints, int objectPointsLength, + Point2f[] imagePoints, int imagePointsLength, + double* cameraMatrix, double[]? distCoeffs, int distCoeffsLength, + [Out] double[] rvec, [Out] double[] tvec, int useExtrinsicGuess, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_solvePnPRansac_InputArray( + IntPtr objectPoints, IntPtr imagePoints, + IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr rvec, IntPtr tvec, + int useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, + IntPtr inliers, int flags); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_solvePnPRansac_vector( + Point3f[] objectPoints, int objectPointsLength, + Point2f[] imagePoints, int imagePointsLength, + double* cameraMatrix, double[]? distCoeffs, int distCoeffsLength, + [Out] double[] rvec, [Out] double[] tvec, int useExtrinsicGuess, int iterationsCount, float reprojectionError, + double confidence, IntPtr inliers, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_initCameraMatrix2D_Mat( + IntPtr[] objectPoints, int objectPointsLength, + IntPtr[] imagePoints, int imagePointsLength, + Size imageSize, double aspectRatio, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_initCameraMatrix2D_array( + IntPtr[] objectPoints, int opSize1, int[] opSize2, + IntPtr[] imagePoints, int ipSize1, int[] ipSize2, + Size imageSize, double aspectRatio, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findChessboardCorners_InputArray( + IntPtr image, Size patternSize, IntPtr corners, int flags, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findChessboardCorners_vector( + IntPtr image, Size patternSize, IntPtr corners, int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_checkChessboard( + IntPtr img, Size size, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findChessboardCornersSB_OutputArray( + IntPtr image, Size patternSize, IntPtr corners, int flags, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findChessboardCornersSB_vector( + IntPtr image, Size patternSize, IntPtr corners, int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_find4QuadCornerSubpix_InputArray( + IntPtr img, IntPtr corners, Size regionSize, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_find4QuadCornerSubpix_vector( + IntPtr img, IntPtr corners, Size regionSize, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_drawChessboardCorners_InputArray( + IntPtr image, Size patternSize, IntPtr corners, int patternWasFound); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_drawChessboardCorners_array( + IntPtr image, Size patternSize, [In] Point2f[] corners, int cornersLength, int patternWasFound); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_drawFrameAxes( + IntPtr image, IntPtr cameraMatrix, IntPtr distCoeffs, + IntPtr rvec, IntPtr tvec, float length, int thickness); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findCirclesGrid_InputArray( + IntPtr image, Size patternSize, + IntPtr centers, int flags, IntPtr blobDetector, + out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findCirclesGrid_vector( + IntPtr image, Size patternSize, + IntPtr centers, int flags, IntPtr blobDetector, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_calibrateCamera_InputArray( + IntPtr[] objectPoints, int objectPointsSize, + IntPtr[] imagePoints, int imagePointsSize, + Size imageSize, + IntPtr cameraMatrix,IntPtr distCoeffs, + IntPtr rvecs, IntPtr tvecs, + int flags, TermCriteria criteria, + out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_calibrateCamera_vector( + IntPtr[] objectPoints, int opSize1, int[] opSize2, + IntPtr[] imagePoints, int ipSize1, int[] ipSize2, + Size imageSize, + double* cameraMatrix, + [In, Out] double[] distCoeffs, int distCoeffsSize, + IntPtr rvecs, IntPtr tvecs, + int flags, TermCriteria criteria, + out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_calibrationMatrixValues_InputArray( + IntPtr cameraMatrix, + Size imageSize, double apertureWidth, double apertureHeight, out double fovx, out double fovy, + out double focalLength, out Point2d principalPoint, out double aspectRatio); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_calibrationMatrixValues_array( + double* cameraMatrix, Size imageSize, + double apertureWidth, double apertureHeight, out double fovx, out double fovy, out double focalLength, + out Point2d principalPoint, out double aspectRatio); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_stereoCalibrate_InputArray( + IntPtr[] objectPoints, int opSize, + IntPtr[] imagePoints1, int ip1Size, + IntPtr[] imagePoints2, int ip2Size, + IntPtr cameraMatrix1, + IntPtr distCoeffs1, + IntPtr cameraMatrix2, + IntPtr distCoeffs2, + Size imageSize, + IntPtr R, IntPtr T, + IntPtr E, IntPtr F, + int flags, TermCriteria criteria, + out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_stereoCalibrate_array( + IntPtr[] objectPoints, int opSize1, int[] opSizes2, + IntPtr[] imagePoints1, int ip1Size1, int[] ip1Sizes2, + IntPtr[] imagePoints2, int ip2Size1, int[] ip2Sizes2, + double* cameraMatrix1, + [In, Out] double[] distCoeffs1, int dc1Size, + double* cameraMatrix2, + [In, Out] double[] distCoeffs2, int dc2Size, + Size imageSize, + IntPtr R, IntPtr T, + IntPtr E, IntPtr F, + int flags, TermCriteria criteria, + out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_stereoRectify_InputArray( + IntPtr cameraMatrix1, IntPtr distCoeffs1, + IntPtr cameraMatrix2, IntPtr distCoeffs2, + Size imageSize, IntPtr R, IntPtr T, + IntPtr R1, IntPtr R2, + IntPtr P1, IntPtr P2, + IntPtr Q, int flags, + double alpha, Size newImageSize, + out Rect validPixROI1, out Rect validPixROI2); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_stereoRectify_array( + double* cameraMatrix1, + double[] distCoeffs1, int dc1Size, + double* cameraMatrix2, + double[] distCoeffs2, int dc2Size, + Size imageSize, + double* R, double[] T, + double* R1, double* R2, double* P1, double* P2, + double* Q, int flags, double alpha, Size newImageSize, + out Rect validPixROI1, out Rect validPixROI2); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_stereoRectifyUncalibrated_InputArray( + IntPtr points1, IntPtr points2, + IntPtr F, Size imgSize, + IntPtr H1, IntPtr H2, + double threshold, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_stereoRectifyUncalibrated_array( + Point2d[] points1, int points1Size, + Point2d[] points2, int points2Size, + double* F, Size imgSize, + double* H1, double* H2, + double threshold, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_rectify3Collinear_InputArray( + IntPtr cameraMatrix1, IntPtr distCoeffs1, + IntPtr cameraMatrix2, IntPtr distCoeffs2, + IntPtr cameraMatrix3, IntPtr distCoeffs3, + IntPtr[] imgpt1, int imgpt1Size, + IntPtr[] imgpt3, int imgpt3Size, + Size imageSize, IntPtr R12, IntPtr T12, + IntPtr R13, IntPtr T13, + IntPtr R1, IntPtr R2, IntPtr R3, + IntPtr P1, IntPtr P2, IntPtr P3, + IntPtr Q, double alpha, Size newImgSize, + out Rect roi1, out Rect roi2, int flags, + out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_getOptimalNewCameraMatrix_InputArray( + IntPtr cameraMatrix, IntPtr distCoeffs, + Size imageSize, double alpha, Size newImgSize, + out Rect validPixROI, int centerPrincipalPoint, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_getOptimalNewCameraMatrix_array( + double* cameraMatrix, + [In] double[] distCoeffs, int distCoeffsSize, + Size imageSize, double alpha, Size newImgSize, + out Rect validPixROI, int centerPrincipalPoint, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_calibrateHandEye( + IntPtr[] R_gripper2baseMats, int R_gripper2baseMatsSize, + IntPtr[] t_gripper2baseMats, int t_gripper2baseMatsSize, + IntPtr[] R_target2camMats, int R_target2camMatsSize, + IntPtr[] t_target2camMats, int t_target2camMatsSize, + IntPtr R_cam2gripper, + IntPtr t_cam2gripper, + int method); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_calibrateRobotWorldHandEye_OutputArray( + IntPtr[] R_world2camMats, int R_world2camMatsSize, + IntPtr[] t_world2camMats, int t_world2camMatsSize, + IntPtr[] R_base2gripperMats, int R_base2gripperMatsSize, + IntPtr[] t_base2gripperMats, int t_base2gripperMatsSize, + IntPtr R_base2world, IntPtr t_base2world, + IntPtr R_gripper2cam, IntPtr t_gripper2cam, + int method); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_calibrateRobotWorldHandEye_Pointer( + IntPtr[] R_world2camMats, int R_world2camMatsSize, + IntPtr[] t_world2camMats, int t_world2camMatsSize, + IntPtr[] R_base2gripperMats, int R_base2gripperMatsSize, + IntPtr[] t_base2gripperMats, int t_base2gripperMatsSize, + [MarshalAs(UnmanagedType.LPArray), Out] double[,] R_base2world, + [MarshalAs(UnmanagedType.LPArray), Out] double[] t_base2world, + [MarshalAs(UnmanagedType.LPArray), Out] double[,] R_gripper2cam, + [MarshalAs(UnmanagedType.LPArray), Out] double[] t_gripper2cam, + int method); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsToHomogeneous_InputArray( + IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsToHomogeneous_array1( + [In] Vec2f[] src, [In, Out] Vec3f[] dst, int length); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsToHomogeneous_array2( + [In] Vec3f[] src, [In, Out] Vec4f[] dst, int length); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsFromHomogeneous_InputArray( + IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsFromHomogeneous_array1( + [In] Vec3f[] src, [In, Out] Vec2f[] dst, int length); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsFromHomogeneous_array2( + [In] Vec4f[] src, [In, Out] Vec3f[] dst, int length); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_convertPointsHomogeneous( + IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findFundamentalMat_InputArray( + IntPtr points1, IntPtr points2, + int method, double param1, double param2, IntPtr mask, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findFundamentalMat_arrayF64( + Point2d[] points1, int points1Size, + Point2d[] points2, int points2Size, + int method, double param1, double param2, IntPtr mask, + out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findFundamentalMat_arrayF32( + Point2f[] points1, int points1Size, + Point2f[] points2, int points2Size, + int method, double param1, double param2, IntPtr mask, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_computeCorrespondEpilines_InputArray( + IntPtr points, int whichImage, IntPtr F, IntPtr lines); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_computeCorrespondEpilines_array2d( + [In] Point2d[] points, int pointsSize, + int whichImage, double* F, [In, Out] Point3f[] lines); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_computeCorrespondEpilines_array3d( + [In] Point3d[] points, int pointsSize, + int whichImage, double* F, [In, Out] Point3f[] lines); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_triangulatePoints_InputArray( + IntPtr projMatr1, IntPtr projMatr2, + IntPtr projPoints1, IntPtr projPoints2, + IntPtr points4D); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_triangulatePoints_array( + double* projMatr1, double* projMatr2, + [In] Point2d[] projPoints1, int projPoints1Size, + [In] Point2d[] projPoints2, int projPoints2Size, + [In, Out] Vec4d[] points4D); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_correctMatches_InputArray( + IntPtr F, IntPtr points1, IntPtr points2, + IntPtr newPoints1, IntPtr newPoints2); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_correctMatches_array( + double* F, Point2d[] points1, int points1Size, + Point2d[] points2, int points2Size, + Point2d[] newPoints1, Point2d[] newPoints2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_filterSpeckles( + IntPtr img, double newVal, int maxSpeckleSize, + double maxDiff, IntPtr buf); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_getValidDisparityROI( + Rect roi1, Rect roi2, + int minDisparity, int numberOfDisparities, int SADWindowSize, + out Rect returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_validateDisparity( + IntPtr disparity, IntPtr cost, + int minDisparity, int numberOfDisparities, int disp12MaxDisp); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_reprojectImageTo3D( + IntPtr disparity, IntPtr _3dImage, + IntPtr Q, int handleMissingValues, int ddepth); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_estimateAffine3D( + IntPtr src, IntPtr dst, + IntPtr outVal, IntPtr inliers, double ransacThreshold, double confidence, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_sampsonDistance_InputArray( + IntPtr pt1, IntPtr pt2, IntPtr F, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus calib3d_sampsonDistance_Point3d( + Point3d pt1, Point3d pt2, double* F, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_estimateAffine2D( + IntPtr from, IntPtr to, IntPtr inliers, + int method, double ransacReprojThreshold, + ulong maxIters, double confidence, ulong refineIters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_estimateAffinePartial2D( + IntPtr from, IntPtr to, IntPtr inliers, + int method, double ransacReprojThreshold, + ulong maxIters, double confidence, ulong refineIters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_decomposeHomographyMat( + IntPtr H, + IntPtr K, + IntPtr rotations, + IntPtr translations, + IntPtr normals, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_filterHomographyDecompByVisibleRefpoints( + IntPtr rotations, + IntPtr normals, + IntPtr beforePoints, + IntPtr afterPoints, + IntPtr possibleSolutions, + IntPtr pointsMask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_undistort( + IntPtr src, IntPtr dst, + IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr newCameraMatrix); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_initUndistortRectifyMap( + IntPtr cameraMatrix, IntPtr distCoeffs, + IntPtr R, IntPtr newCameraMatrix, + Size size, MatType m1type, IntPtr map1, IntPtr map2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_initWideAngleProjMap( + IntPtr cameraMatrix, IntPtr distCoeffs, + Size imageSize, int destImageWidth, + MatType m1type, IntPtr map1, IntPtr map2, + int projType, double alpha, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_getDefaultNewCameraMatrix( + IntPtr cameraMatrix, Size imgsize, int centerPrincipalPoint, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_undistortPoints( + IntPtr src, IntPtr dst, + IntPtr cameraMatrix, IntPtr distCoeffs, + IntPtr R, IntPtr P); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_undistortPointsIter( + IntPtr src, IntPtr dst, + IntPtr cameraMatrix, IntPtr distCoeffs, + IntPtr R, IntPtr P, TermCriteria criteria); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_recoverPose_InputArray1( + IntPtr E, IntPtr points1, IntPtr points2, + IntPtr cameraMatrix, + IntPtr R, IntPtr P, IntPtr mask, + out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_recoverPose_InputArray2( + IntPtr E, IntPtr points1, IntPtr points2, + IntPtr R, IntPtr P, double focal, Point2d pp, IntPtr mask, + out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_recoverPose_InputArray3( + IntPtr E, IntPtr points1, IntPtr points2, + IntPtr cameraMatrix, + IntPtr R, IntPtr P, double distanceTresh, IntPtr mask, IntPtr triangulatedPoints, + out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findEssentialMat_InputArray1( + IntPtr points1, IntPtr points2, IntPtr cameraMatrix, + int method, double prob, double threshold, IntPtr mask, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_findEssentialMat_InputArray2( + IntPtr points1, IntPtr points2, double focal, Point2d pp, + int method, double prob, double threshold, IntPtr mask, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d_StereoMatcher.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d_StereoMatcher.cs new file mode 100644 index 000000000..a643bae05 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d_StereoMatcher.cs @@ -0,0 +1,210 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +static partial class NativeMethods +{ + #region StereoMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_compute( + IntPtr obj, IntPtr left, IntPtr right, IntPtr disparity); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_getMinDisparity( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_setMinDisparity( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_getNumDisparities( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_setNumDisparities( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_getBlockSize( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_setBlockSize( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_getSpeckleWindowSize( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_setSpeckleWindowSize( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_getSpeckleRange( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_setSpeckleRange( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_getDisp12MaxDiff( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoMatcher_setDisp12MaxDiff( + IntPtr obj, int value); + + #endregion + + #region StereoBM + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_Ptr_StereoBM_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_Ptr_StereoBM_get( + IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_create( + int numDisparities, int blockSize, out IntPtr returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getPreFilterType( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setPreFilterType( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getPreFilterSize( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setPreFilterSize( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getPreFilterCap( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setPreFilterCap( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getTextureThreshold( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setTextureThreshold( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getUniquenessRatio( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setUniquenessRatio( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getSmallerBlockSize( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setSmallerBlockSize( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getROI1( + IntPtr obj, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setROI1( + IntPtr obj, Rect value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_getROI2( + IntPtr obj, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoBM_setROI2( + IntPtr obj, Rect value); + + #endregion + + #region StereoSGBM + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_Ptr_StereoSGBM_get( + IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_Ptr_StereoSGBM_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_create( + int minDisparity, int numDisparities, int blockSize, + int P1, int P2, int disp12MaxDiff, + int preFilterCap, int uniquenessRatio, + int speckleWindowSize, int speckleRange, int mode, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_getPreFilterCap( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_setPreFilterCap( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_getUniquenessRatio( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_setUniquenessRatio( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_getP1( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_setP1( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_getP2( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_setP2( + IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_getMode( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_StereoSGBM_setMode( + IntPtr obj, int value); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d_fisheye.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d_fisheye.cs new file mode 100644 index 000000000..e0e0d776b --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/calib3d/NativeMethods_calib3d_fisheye.cs @@ -0,0 +1,82 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +static partial class NativeMethods +{ + // TODO + /* + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void calib3d_fisheye_projectPoints1( + IntPtr objectPoints, IntPtr imagePoints, IntPtr affine, + IntPtr K, IntPtr D, double alpha, IntPtr jacobian);*/ + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_projectPoints2( + IntPtr objectPoints, IntPtr imagePoints, IntPtr rvec, IntPtr tvec, + IntPtr K, IntPtr D, double alpha, IntPtr jacobian); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_distortPoints( + IntPtr undistorted, IntPtr distorted, IntPtr K, IntPtr D, double alpha); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_undistortPoints( + IntPtr distorted, IntPtr undistorted, + IntPtr K, IntPtr D, IntPtr R, IntPtr P); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_initUndistortRectifyMap( + IntPtr K, IntPtr D, IntPtr R, IntPtr P, + Size size, int m1type, IntPtr map1, IntPtr map2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_undistortImage( + IntPtr distorted, IntPtr undistorted, + IntPtr K, IntPtr D, IntPtr Knew, Size newSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_estimateNewCameraMatrixForUndistortRectify( + IntPtr K, IntPtr D, Size image_size, IntPtr R, + IntPtr P, double balance, Size newSize, double fov_scale); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_calibrate( + IntPtr objectPoints, IntPtr imagePoints, + Size imageSize, + IntPtr K, + IntPtr D, + IntPtr rvecs, + IntPtr tvecs, + int flags, + TermCriteria criteria, + out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_stereoRectify( + IntPtr K1, IntPtr D1, IntPtr K2, IntPtr D2, Size imageSize, IntPtr R, IntPtr tvec, + IntPtr R1, IntPtr R2, IntPtr P1, IntPtr P2, IntPtr Q, int flags, Size newImageSize, + double balance, double fov_scale); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus calib3d_fisheye_stereoCalibrate( + IntPtr objectPoints, + IntPtr imagePoints1, + IntPtr imagePoints2, + IntPtr K1, + IntPtr D1, + IntPtr K2, + IntPtr D2, + Size imageSize, + IntPtr R, + IntPtr T, + int flags, + TermCriteria criteria, + out double returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core.cs new file mode 100644 index 000000000..6e2ba9a91 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core.cs @@ -0,0 +1,457 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern RotatedRect core_RotatedRect_byThreeVertexPoints(Point2f p1, Point2f p2, Point2f p3); + + #region utility.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int core_setBreakOnError(int flag); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr redirectError(CvErrorCallback errCallback, IntPtr userdata, ref IntPtr prevUserdata); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_setNumThreads(int nthreads); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getNumThreads(out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getThreadNum(out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getBuildInformation(IntPtr buf); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_getVersionString(byte* buf, int maxLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getVersionMajor(out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getVersionMinor(out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getVersionRevision(out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getTickCount(out long returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getTickFrequency(out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getCPUTickCount(out long returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_checkHardwareSupport(int feature, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getHardwareFeatureName(int feature, IntPtr buf); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getCPUFeaturesLine(IntPtr buf); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getNumberOfCPUs(out int returnValue); + + /* + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr core_fastMalloc(IntPtr bufSize); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void core_fastFree(IntPtr ptr); + */ + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_setUseOptimized(int onoff); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_useOptimized(out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_format(IntPtr mtx, int fmt, IntPtr buf); + + #endregion + + #region logger.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_logger_setLogLevel(LogLevel logLevel, out LogLevel returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_logger_getLogLevel(out LogLevel returnValue); + + #endregion + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_borderInterpolate( + int p, int len, int borderType, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_copyMakeBorder( + IntPtr src, IntPtr dst, int top, int bottom, int left, int right, int borderType, Scalar value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_add(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_subtract_InputArray2( + IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, int dtype); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_subtract_InputArrayScalar( + IntPtr src1, Scalar src2, IntPtr dst, IntPtr mask, int dtype); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_subtract_ScalarInputArray( + Scalar src1, IntPtr src2, IntPtr dst, IntPtr mask, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_multiply(IntPtr src1, IntPtr src2, IntPtr dst, double scale, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_divide1(double scale, IntPtr src2, IntPtr dst, int dtype); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_divide2(IntPtr src1, IntPtr src2, IntPtr dst, double scale, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_scaleAdd(IntPtr src1, double alpha, IntPtr src2,IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_addWeighted(IntPtr src1, double alpha, IntPtr src2, + double beta, double gamma, IntPtr dst, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_convertScaleAbs(IntPtr src, IntPtr dst, double alpha, double beta); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_convertFp16(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LUT(IntPtr src, IntPtr lut, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_sum(IntPtr src, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_countNonZero(IntPtr src, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_findNonZero(IntPtr src, IntPtr idx); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_mean(IntPtr src, IntPtr mask, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_meanStdDev_OutputArray( + IntPtr src, IntPtr mean, IntPtr stddev, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_meanStdDev_Scalar( + IntPtr src, out Scalar mean, out Scalar stddev, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_norm1( + IntPtr src1, int normType, IntPtr mask, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_norm2( + IntPtr src1, IntPtr src2, int normType, IntPtr mask, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PSNR(IntPtr src1, IntPtr src2, double r, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_batchDistance(IntPtr src1, IntPtr src2, + IntPtr dist, int dtype, IntPtr nidx, + int normType, int k, IntPtr mask, + int update, int crosscheck); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_normalize(IntPtr src, IntPtr dst, double alpha, double beta, + int normType, int dtype, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_reduceArgMax(IntPtr src, IntPtr dst, int axis, [MarshalAs(UnmanagedType.U1)] bool lastIndex); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_reduceArgMin(IntPtr src, IntPtr dst, int axis, [MarshalAs(UnmanagedType.U1)] bool lastIndex); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_minMaxLoc1(IntPtr src, out double minVal, out double maxVal); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_minMaxLoc2(IntPtr src, out double minVal, out double maxVal, + out Point minLoc, out Point maxLoc, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_minMaxIdx1(IntPtr src, out double minVal, out double maxVal); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_minMaxIdx2(IntPtr src, out double minVal, out double maxVal, + [MarshalAs(UnmanagedType.LPArray), Out] int[] minIdx, [MarshalAs(UnmanagedType.LPArray), Out] int[] maxIdx, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_reduce(IntPtr src, IntPtr dst, int dim, int rtype, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_merge([MarshalAs(UnmanagedType.LPArray)] IntPtr[] mv, uint count, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_split(IntPtr src, IntPtr mv); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_mixChannels(IntPtr[] src, uint nsrcs, + IntPtr[] dst, uint ndsts, int[] fromTo, uint npairs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_extractChannel(IntPtr src, IntPtr dst, int coi); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_insertChannel(IntPtr src, IntPtr dst, int coi); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_flip(IntPtr src, IntPtr dst, int flipCode); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_rotate(IntPtr src, IntPtr dst, int rotateCode); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_repeat1(IntPtr src, int ny, int nx, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_repeat2(IntPtr src, int ny, int nx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_hconcat1([MarshalAs(UnmanagedType.LPArray)] IntPtr[] src, uint nsrc, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_hconcat2(IntPtr src1, IntPtr src2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_vconcat1([MarshalAs(UnmanagedType.LPArray)] IntPtr[] src, uint nsrc, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_vconcat2(IntPtr src1, IntPtr src2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_bitwise_and(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_bitwise_or(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_bitwise_xor(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_bitwise_not(IntPtr src, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_absdiff(IntPtr src1, IntPtr src2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_copyTo(IntPtr src, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_inRange_InputArray(IntPtr src, IntPtr lowerb, IntPtr upperb, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_inRange_Scalar(IntPtr src, Scalar lowerb, Scalar upperb, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_compare(IntPtr src1, IntPtr src2, IntPtr dst, int cmpop); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_min1(IntPtr src1, IntPtr src2, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_min_MatMat(IntPtr src1, IntPtr src2, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_min_MatDouble(IntPtr src1, double src2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_max1(IntPtr src1, IntPtr src2, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_max_MatMat(IntPtr src1, IntPtr src2, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_max_MatDouble(IntPtr src1, double src2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_sqrt(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_pow_Mat(IntPtr src, double power, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_exp_Mat(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_log_Mat(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_polarToCart(IntPtr magnitude, IntPtr angle, IntPtr x, IntPtr y, int angleInDegrees); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_cartToPolar(IntPtr x, IntPtr y, IntPtr magnitude, IntPtr angle, int angleInDegrees); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_phase(IntPtr x, IntPtr y, IntPtr angle, int angleInDegrees); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_magnitude_Mat(IntPtr x, IntPtr y, IntPtr magnitude); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_checkRange(IntPtr a, int quiet, out Point pos, double minVal, double maxVal, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_patchNaNs(IntPtr a, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_gemm(IntPtr src1, IntPtr src2, double alpha, IntPtr src3, double gamma, IntPtr dst, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_mulTransposed(IntPtr src, IntPtr dst, int aTa, IntPtr delta, double scale, int dtype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_transpose(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_transform(IntPtr src, IntPtr dst, IntPtr m); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_perspectiveTransform(IntPtr src, IntPtr dst, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_perspectiveTransform_Mat(IntPtr src, IntPtr dst, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_perspectiveTransform_Point2f(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_perspectiveTransform_Point2d(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_perspectiveTransform_Point3f(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_perspectiveTransform_Point3d(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_completeSymm(IntPtr mtx, int lowerToUpper); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_setIdentity(IntPtr mtx, Scalar s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_determinant(IntPtr mtx, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_trace(IntPtr mtx, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_invert(IntPtr src, IntPtr dst, int flags, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_solve(IntPtr src1, IntPtr src2, IntPtr dst, int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_solveLP(IntPtr func, IntPtr constr, IntPtr z, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_sort(IntPtr src, IntPtr dst, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_sortIdx(IntPtr src, IntPtr dst, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_solveCubic(IntPtr coeffs, IntPtr roots, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_solvePoly(IntPtr coeffs, IntPtr roots, int maxIters, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_eigen(IntPtr src, IntPtr eigenvalues, IntPtr eigenvectors, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_eigenNonSymmetric(IntPtr src, IntPtr eigenvalues, IntPtr eigenvectors); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_calcCovarMatrix_Mat([MarshalAs(UnmanagedType.LPArray)] IntPtr[] samples, + int nsamples, IntPtr covar, IntPtr mean, int flags, int ctype); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_calcCovarMatrix_InputArray(IntPtr samples, IntPtr covar, + IntPtr mean, int flags, int ctype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCACompute(IntPtr data, IntPtr mean, IntPtr eigenvectors, int maxComponents); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCACompute2(IntPtr data, IntPtr mean, IntPtr eigenvectors, IntPtr eigenvalues, int maxComponents); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCAComputeVar(IntPtr data, IntPtr mean, IntPtr eigenvectors, double retainedVariance); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCAComputeVar2(IntPtr data, IntPtr mean, IntPtr eigenvectors, IntPtr eigenvalues, double retainedVariance); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCAProject(IntPtr data, IntPtr mean, IntPtr eigenvectors, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCABackProject(IntPtr data, IntPtr mean, IntPtr eigenvectors, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVDecomp(IntPtr src, IntPtr w, IntPtr u, IntPtr vt, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVBackSubst(IntPtr w, IntPtr u, IntPtr vt, IntPtr rhs, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mahalanobis(IntPtr v1, IntPtr v2, IntPtr icovar, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_dft(IntPtr src, IntPtr dst, int flags, int nonzeroRows); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_idft(IntPtr src, IntPtr dst, int flags, int nonzeroRows); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_dct(IntPtr src, IntPtr dst, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_idct(IntPtr src, IntPtr dst, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_mulSpectrums(IntPtr a, IntPtr b, IntPtr c, int flags, int conjB); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_getOptimalDFTSize(int vecsize, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_theRNG_get(out ulong returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_theRNG_set(ulong returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_randu_InputArray(IntPtr dst, IntPtr low, IntPtr high); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_randu_Scalar(IntPtr dst, Scalar low, Scalar high); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_randn_InputArray(IntPtr dst, IntPtr mean, IntPtr stddev); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_randn_Scalar(IntPtr dst, Scalar mean, Scalar stddev); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_randShuffle(IntPtr dst, double iterFactor, ref ulong rng); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_randShuffle(IntPtr dst, double iterFactor, IntPtr rng); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_kmeans( + IntPtr data, int k, IntPtr bestLabels, + TermCriteria criteria, int attempts, int flags, IntPtr centers, + out double returnValue); + + #region base.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_cubeRoot(float val, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_fastAtan2(float y, float x, out float returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Algorithm.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Algorithm.cs new file mode 100644 index 000000000..89858bc43 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Algorithm.cs @@ -0,0 +1,26 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Algorithm_write(IntPtr obj, IntPtr fs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Algorithm_read(IntPtr obj, IntPtr fn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Algorithm_empty(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = true, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus core_Algorithm_save(IntPtr obj, string filename); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Algorithm_getDefaultName(IntPtr obj, IntPtr buf); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Classes.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Classes.cs new file mode 100644 index 000000000..52292902c --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Classes.cs @@ -0,0 +1,148 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region PCA + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_new2( + IntPtr data, IntPtr mean, int flags, int maxComponents, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_new3( + IntPtr data, IntPtr mean, int flags, double retainedVariance, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_operatorThis( + IntPtr obj, IntPtr data, IntPtr mean, int flags, int maxComponents); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_computeVar( + IntPtr obj, IntPtr data, IntPtr mean, int flags, double retainedVariance); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_project1(IntPtr obj, IntPtr vec, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_project2(IntPtr obj, IntPtr vec, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_backProject1(IntPtr obj, IntPtr vec, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_backProject2(IntPtr obj, IntPtr vec, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_eigenvectors(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_eigenvalues(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_mean(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_write(IntPtr obj, IntPtr fs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_PCA_read(IntPtr obj, IntPtr fn); + + #endregion + + #region RNG + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_RNG_fill(ref ulong state, IntPtr mat, int distType, IntPtr a, IntPtr b, int saturateRange); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_RNG_gaussian(ref ulong state, double sigma, out double returnValue); + + #endregion + + #region SVD + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_new2(IntPtr src, int flags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_operatorThis(IntPtr obj, IntPtr src, int flags); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_backSubst(IntPtr obj, IntPtr rhs, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_static_compute1(IntPtr src, IntPtr w, IntPtr u, IntPtr vt, int flags); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_static_compute2(IntPtr src, IntPtr w, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_static_backSubst(IntPtr w, IntPtr u, IntPtr vt, IntPtr rhs, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_static_solveZ(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_u(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_w(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SVD_vt(IntPtr obj, out IntPtr returnValue); + #endregion + + #region LDA + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_new1(int numComponents, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_new2(IntPtr src, IntPtr labels, int numComponents, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_save_String(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_load_String(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_save_FileStorage(IntPtr obj, IntPtr fs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_load_FileStorage(IntPtr obj, IntPtr node); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_compute(IntPtr obj, IntPtr src, IntPtr labels); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_project(IntPtr obj, IntPtr src, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_reconstruct(IntPtr obj, IntPtr src, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_eigenvectors(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_eigenvalues(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_subspaceProject(IntPtr w, IntPtr mean, IntPtr src, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_LDA_subspaceReconstruct(IntPtr w, IntPtr mean, IntPtr src, out IntPtr returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileNode.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileNode.cs new file mode 100644 index 000000000..ecc15c5d4 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileNode.cs @@ -0,0 +1,177 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_new1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_delete(IntPtr node); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_operatorThis_byString( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string nodeName, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_operatorThis_byInt(IntPtr obj, int i, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_type(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_empty(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isNone(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isSeq(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isMap(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isInt(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isReal(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isString(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_isNamed(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_name(IntPtr obj, IntPtr buf); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_size(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_toInt(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_toFloat(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_toDouble(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_toString(IntPtr obj, IntPtr buf); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_toMat(IntPtr obj, IntPtr m); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_begin(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_end(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_readRaw( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fmt, IntPtr vec, IntPtr len); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_int(IntPtr node, out int value, int defaultValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_float(IntPtr node, out float value, float defaultValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_double(IntPtr node, out double value, double defaultValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_String(IntPtr node, IntPtr value, [MarshalAs(UnmanagedType.LPStr)] string? defaultValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Mat(IntPtr node, IntPtr mat, IntPtr defaultMat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_SparseMat(IntPtr node, IntPtr mat, IntPtr defaultMat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_vectorOfKeyPoint(IntPtr node, IntPtr keypoints); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_vectorOfDMatch(IntPtr node, IntPtr matches); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Range(IntPtr node, out Range returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_KeyPoint(IntPtr node, out KeyPoint returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_DMatch(IntPtr node, out DMatch returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Point2i(IntPtr node, out Point returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Point2f(IntPtr node, out Point2f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Point2d(IntPtr node, out Point2d returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Point3i(IntPtr nod, out Point3i returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Point3f(IntPtr node, out Point3f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Point3d(IntPtr node, out Point3d returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Size2i(IntPtr node, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Size2f(IntPtr node, out Size2f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Size2d(IntPtr node, out Size2d returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Rect2i(IntPtr node, out Rect returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Rect2f(IntPtr node, out Rect2f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Rect2d(IntPtr node, out Rect2d returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Scalar(IntPtr node, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec2i(IntPtr node, out Vec2i returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec3i(IntPtr node, out Vec3i returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec4i(IntPtr node, out Vec4i returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec6i(IntPtr node, out Vec6i returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec2d(IntPtr node, out Vec2d returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec3d(IntPtr node, out Vec3d returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec4d(IntPtr node, out Vec4d returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec6d(IntPtr node, out Vec6d returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec2f(IntPtr node, out Vec2f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec3f(IntPtr node, out Vec3f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec4f(IntPtr node, out Vec4f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec6f(IntPtr node, out Vec6f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec2b(IntPtr node, out Vec2b returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec3b(IntPtr node, out Vec3b returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec4b(IntPtr node, out Vec4b returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec6b(IntPtr node, out Vec6b returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec2s(IntPtr node, out Vec2s returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec3s(IntPtr node, out Vec3s returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec4s(IntPtr node, out Vec4s returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec6s(IntPtr node, out Vec6s returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec2w(IntPtr node, out Vec2w returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec3w(IntPtr node, out Vec3w returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec4w(IntPtr node, out Vec4w returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNode_read_Vec6w(IntPtr node, out Vec6w returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileNodeIterator.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileNodeIterator.cs new file mode 100644 index 000000000..bc28f2aaf --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileNodeIterator.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_new1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_operatorAsterisk(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_operatorIncrement(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_operatorPlusEqual(IntPtr obj, int ofs, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_readRaw( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fmt, IntPtr vec, IntPtr maxCount); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_operatorEqual(IntPtr it1, IntPtr it2, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_operatorMinus(IntPtr it1, IntPtr it2, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileNodeIterator_operatorLessThan(IntPtr it1, IntPtr it2, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileStorage.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileStorage.cs new file mode 100644 index 000000000..9b1c7dab8 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_FileStorage.cs @@ -0,0 +1,259 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_new2( + [MarshalAs(UnmanagedType.LPStr)] string source, + int flags, + [MarshalAs(UnmanagedType.LPStr)] string? encoding, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_open( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename, + int flags, [MarshalAs(UnmanagedType.LPStr)] string? encoding, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_isOpened(IntPtr obj, out int returnValue); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_FileStorage_release(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_releaseAndGetString( + IntPtr obj, IntPtr outString); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_getFirstTopLevelNode( + IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_root( + IntPtr obj, int streamIdx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_indexer( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string nodeName, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_writeRaw( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fmt, IntPtr vec, IntPtr len); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_writeComment( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string comment, int append); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_getDefaultObjectName( + [MarshalAs(UnmanagedType.LPStr)] string filename, IntPtr buf); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_elname(IntPtr obj, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_startWriteStruct( + IntPtr obj, + [MarshalAs(UnmanagedType.LPStr)] string name, + int flags, + [MarshalAs(UnmanagedType.LPStr)] string typeName); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_endWriteStruct(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_state(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_int( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_float( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_double( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_String( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_Mat( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_SparseMat( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_vectorOfKeyPoint( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_write_vectorOfDMatch( + IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_writeScalar_int(IntPtr fs, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_writeScalar_float(IntPtr fs, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_writeScalar_double(IntPtr fs, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_writeScalar_String(IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string value); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_String(IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_int(IntPtr fs, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_float(IntPtr fs, float val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_double(IntPtr fs, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Mat(IntPtr fs, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_SparseMat(IntPtr fs, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Range(IntPtr fs, Range val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_KeyPoint(IntPtr fs, KeyPoint val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_DMatch(IntPtr fs, DMatch val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_vectorOfKeyPoint(IntPtr fs, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_vectorOfDMatch(IntPtr fs, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Point2i(IntPtr fs, Point val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Point2f(IntPtr fs, Point2f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Point2d(IntPtr fs, Point2d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Point3i(IntPtr fs, Point3i val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Point3f(IntPtr fs, Point3f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Point3d(IntPtr fs, Point3d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Size2i(IntPtr fs, Size val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Size2f(IntPtr fs, Size2f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Size2d(IntPtr fs, Size2d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Rect2i(IntPtr fs, Rect val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Rect2f(IntPtr fs, Rect2f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Rect2d(IntPtr fs, Rect2d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Scalar(IntPtr fs, Scalar val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec2i(IntPtr fs, Vec2i val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec3i(IntPtr fs, Vec3i val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec4i(IntPtr fs, Vec4i val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec6i(IntPtr fs, Vec6i val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec2d(IntPtr fs, Vec2d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec3d(IntPtr fs, Vec3d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec4d(IntPtr fs, Vec4d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec6d(IntPtr fs, Vec6d val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec2f(IntPtr fs, Vec2f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec3f(IntPtr fs, Vec3f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec4f(IntPtr fs, Vec4f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec6f(IntPtr fs, Vec6f val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec2b(IntPtr fs, Vec2b val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec3b(IntPtr fs, Vec3b val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec4b(IntPtr fs, Vec4b val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec6b(IntPtr fs, Vec6b val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec2s(IntPtr fs, Vec2s val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec3s(IntPtr fs, Vec3s val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec4s(IntPtr fs, Vec4s val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec6s(IntPtr fs, Vec6s val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec2w(IntPtr fs, Vec2w val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec3w(IntPtr fs, Vec3w val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec4w(IntPtr fs, Vec4w val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_FileStorage_shift_Vec6w(IntPtr fs, Vec6w val); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_InputArray.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_InputArray.cs new file mode 100644 index 000000000..bada01e69 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_InputArray.cs @@ -0,0 +1,114 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byMat(IntPtr mat, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byUMat(IntPtr mat, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byMatExpr(IntPtr mat, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byScalar(Scalar val, out IntPtr handle, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byDouble(IntPtr valPointer, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVectorOfMat(IntPtr vector, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVecb(IntPtr vec, int n, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVecs(IntPtr vec, int n, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVecw(IntPtr vec, int n, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVeci(IntPtr vec, int n, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVecf(IntPtr vec, int n, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_new_byVecd(IntPtr vec, int n, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_delete(IntPtr ia); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_delete_withScalar(IntPtr ia, IntPtr handle); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_getMat(IntPtr ia, int idx, out IntPtr returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_InputArray_getMat_(IntPtr ia, int idx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_getUMat(IntPtr ia, int idx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_getMatVector(IntPtr ia, IntPtr mv); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern void core_InputArray_getUMatVector(IntPtr ia, IntPtr umv); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_getFlags(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_getObj(IntPtr ia, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_getSz(IntPtr ia, out Size returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_kind(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_dims(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_cols(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_rows(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_size(IntPtr ia, int i, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_sizend(IntPtr ia, int[] sz, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_sameSize(IntPtr self, IntPtr target, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_total(IntPtr ia, int i, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_type(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_depth(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_channels(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isContinuous(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isSubmatrix(IntPtr ia, int i, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_empty(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_copyTo1(IntPtr ia, IntPtr arr); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_copyTo2(IntPtr ia, IntPtr arr, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_offset(IntPtr ia, int i, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_step(IntPtr ia, int i, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isMat(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isUMat(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isMatVector(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isUMatVector(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isMatx(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isVector(IntPtr ia, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_InputArray_isGpuMatVector(IntPtr ia, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Mat.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Mat.cs new file mode 100644 index 000000000..722e27487 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_Mat.cs @@ -0,0 +1,498 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong core_Mat_sizeof(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new2(int rows, int cols, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new3(int rows, int cols, MatType type, Scalar scalar, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new4(IntPtr mat, Range rowRange, Range colRange, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new5(IntPtr mat, Range rowRange, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new6(IntPtr mat, [MarshalAs(UnmanagedType.LPArray)] Range[] rowRange, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new7(IntPtr mat, Rect roi, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new8(int rows, int cols, MatType type, IntPtr data, IntPtr step, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new9(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, + MatType type, IntPtr data, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] steps, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new9(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, + MatType type, IntPtr data, IntPtr steps, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new10(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new11(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, MatType type, Scalar s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_new12(IntPtr mat, out IntPtr returnValue); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_Mat_release(IntPtr mat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_delete(IntPtr mat); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_getUMat(IntPtr self, int accessFlag, int usageFlags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_row(IntPtr self, int y, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_col(IntPtr self, int x, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_rowRange(IntPtr self, int startRow, int endRow, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_colRange(IntPtr self, int startCol, int endCol, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_diag(IntPtr self, int d, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_diag_static(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_clone(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_copyTo1(IntPtr self, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_copyTo2(IntPtr self, IntPtr m, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_copyTo_toMat1(IntPtr self, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_copyTo_toMat2(IntPtr self, IntPtr m, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_convertTo(IntPtr self, IntPtr m, MatType rtype, double alpha, double beta); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_assignTo(IntPtr self, IntPtr m, int type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_setTo_Scalar(IntPtr self, Scalar value, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_setTo_InputArray(IntPtr self, IntPtr value, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_reshape1( + IntPtr self, int cn, int rows, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_reshape2( + IntPtr self, int cn, int newndims, [MarshalAs(UnmanagedType.LPArray), In] int[] newsz, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_t(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_inv(IntPtr self, int method, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_mul(IntPtr self, IntPtr m, double scale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_cross(IntPtr self, IntPtr m, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_dot(IntPtr self, IntPtr m, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_zeros1( + int rows, int cols, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_zeros2( + int ndims, [MarshalAs(UnmanagedType.LPArray), In] int[] sz, MatType type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_ones1( + int rows, int cols, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_ones2( + int ndims, [MarshalAs(UnmanagedType.LPArray), In] int[] sz, MatType type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_eye(int rows, int cols, MatType type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_create1( + IntPtr self, int rows, int cols, MatType type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_create2( + IntPtr self, int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, MatType type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_reserve(IntPtr self, IntPtr sz); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_reserveBuffer(IntPtr self, IntPtr sz); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_resize1(IntPtr obj, IntPtr sz); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_resize2(IntPtr obj, IntPtr sz, Scalar s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_pop_back(IntPtr obj, IntPtr nelems); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_locateROI(IntPtr self, out Size wholeSize, out Point ofs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_adjustROI( + IntPtr nativeObj, int dtop, int dbottom, int dleft, int dright, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_subMat1( + IntPtr self, int rowStart, int rowEnd, int colStart, int colEnd, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_subMat2( + IntPtr self, int nRanges, Range[] ranges, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_isContinuous(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_isSubmatrix(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_elemSize(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_elemSize1(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_type(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_depth(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_channels(IntPtr self, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_empty(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_total1(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_total2(IntPtr self, int startDim, int endDim, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_checkVector( + IntPtr self, int elemChannels, int depth, int requireContinuous, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_ptr1d(IntPtr self, int i0, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_ptr2d(IntPtr self, int i0, int i1, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_ptr3d(IntPtr self, int i0, int i1, int i2, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_ptrnd(IntPtr self, [MarshalAs(UnmanagedType.LPArray), In] int[] idx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_flags(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_dims(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_rows(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_cols(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_Mat_data(IntPtr self, out byte* returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_datastart(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_dataend(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_datalimit(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_size(IntPtr self, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_sizeAt(IntPtr self, int i, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_step1(IntPtr self, int i, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_step(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_stepAt(IntPtr self, int i, out IntPtr returnValue); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_Mat_assignment_FromMat(IntPtr self, IntPtr newMat); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_Mat_assignment_FromScalar(IntPtr self, Scalar scalar); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_abs_Mat(IntPtr e, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_Mat_setMatData(IntPtr obj, byte* vals, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_Mat_getMatData(IntPtr obj, byte* vals, out int returnValue); + + #region push_back + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Mat(IntPtr self, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_char(IntPtr self, sbyte v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_uchar(IntPtr self, byte v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_short(IntPtr self, short v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_ushort(IntPtr self, ushort v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_int(IntPtr self, int v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_float(IntPtr self, float v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_double(IntPtr self, double v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec2b(IntPtr self, Vec2b v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec3b(IntPtr self, Vec3b v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec4b(IntPtr self, Vec4b v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec6b(IntPtr self, Vec6b v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec2s(IntPtr self, Vec2s v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec3s(IntPtr self, Vec3s v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec4s(IntPtr self, Vec4s v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec6s(IntPtr self, Vec6s v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec2w(IntPtr self, Vec2w v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec3w(IntPtr self, Vec3w v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec4w(IntPtr self, Vec4w v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec6w(IntPtr self, Vec6w v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec2i(IntPtr self, Vec2i v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec3i(IntPtr self, Vec3i v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec4i(IntPtr self, Vec4i v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec6i(IntPtr self, Vec6i v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec2f(IntPtr self, Vec2f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec3f(IntPtr self, Vec3f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec4f(IntPtr self, Vec4f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec6f(IntPtr self, Vec6f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec2d(IntPtr self, Vec2d v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec3d(IntPtr self, Vec3d v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec4d(IntPtr self, Vec4d v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Vec6d(IntPtr self, Vec6d v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Point(IntPtr self, Point v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Point2f(IntPtr self, Point2f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Point2d(IntPtr self, Point2d v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Point3i(IntPtr self, Point3i v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Point3f(IntPtr self, Point3f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Point3d(IntPtr self, Point3d v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Size(IntPtr self, Size v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Size2f(IntPtr self, Size2f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Size2d(IntPtr self, Size2d v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Rect(IntPtr self, Rect v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Rect2f(IntPtr self, Rect2f v); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_push_back_Rect2d(IntPtr self, Rect2d v); + + #endregion + + #region forEach + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_uchar(IntPtr m, MatForeachFunctionByte proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec2b(IntPtr m, MatForeachFunctionVec2b proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec3b(IntPtr m, MatForeachFunctionVec3b proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec4b(IntPtr m, MatForeachFunctionVec4b proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec6b(IntPtr m, MatForeachFunctionVec6b proc); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_short(IntPtr m, MatForeachFunctionInt16 proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec2s(IntPtr m, MatForeachFunctionVec2s proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec3s(IntPtr m, MatForeachFunctionVec3s proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec4s(IntPtr m, MatForeachFunctionVec4s proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec6s(IntPtr m, MatForeachFunctionVec6s proc); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_int(IntPtr m, MatForeachFunctionInt32 proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec2i(IntPtr m, MatForeachFunctionVec2i proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec3i(IntPtr m, MatForeachFunctionVec3i proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec4i(IntPtr m, MatForeachFunctionVec4i proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec6i(IntPtr m, MatForeachFunctionVec6i proc); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_float(IntPtr m, MatForeachFunctionFloat proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec2f(IntPtr m, MatForeachFunctionVec2f proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec3f(IntPtr m, MatForeachFunctionVec3f proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec4f(IntPtr m, MatForeachFunctionVec4f proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec6f(IntPtr m, MatForeachFunctionVec6f proc); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_double(IntPtr m, MatForeachFunctionDouble proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec2d(IntPtr m, MatForeachFunctionVec2d proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec3d(IntPtr m, MatForeachFunctionVec3d proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec4d(IntPtr m, MatForeachFunctionVec4d proc); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_forEach_Vec6d(IntPtr m, MatForeachFunctionVec6d proc); + + #endregion + + #region Operators + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorUnaryMinus(IntPtr mat, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorAdd_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorAdd_MatScalar(IntPtr a, Scalar s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorAdd_ScalarMat(Scalar s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorMinus_Mat(IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorSubtract_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorSubtract_MatScalar(IntPtr a, Scalar s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorSubtract_ScalarMat(Scalar s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorMultiply_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorMultiply_MatDouble(IntPtr a, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorMultiply_DoubleMat(double s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorDivide_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorDivide_MatDouble(IntPtr a, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorDivide_DoubleMat(double s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorAnd_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorAnd_MatDouble(IntPtr a, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorAnd_DoubleMat(double s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorOr_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorOr_MatDouble(IntPtr a, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorOr_DoubleMat(double s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorXor_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorXor_MatDouble(IntPtr a, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorXor_DoubleMat(double s, IntPtr a, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorNot(IntPtr a, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorLT_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorLT_DoubleMat(double a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorLT_MatDouble(IntPtr a, double b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorLE_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorLE_DoubleMat(double a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorLE_MatDouble(IntPtr a, double b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorGT_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorGT_DoubleMat(double a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorGT_MatDouble(IntPtr a, double b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorGE_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorGE_DoubleMat(double a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorGE_MatDouble(IntPtr a, double b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorEQ_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorEQ_DoubleMat(double a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorEQ_MatDouble(IntPtr a, double b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorNE_MatMat(IntPtr a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorNE_DoubleMat(double a, IntPtr b, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_Mat_operatorNE_MatDouble(IntPtr a, double b, out IntPtr returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_MatExpr.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_MatExpr.cs new file mode 100644 index 000000000..bef8b37a3 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_MatExpr.cs @@ -0,0 +1,109 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_new2(IntPtr mat, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_delete(IntPtr expr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_toMat(IntPtr expr, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_row(IntPtr self, int y, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_col(IntPtr self, int x, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_diag(IntPtr self, int d, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_submat( + IntPtr self, int rowStart, int rowEnd, int colStart, int colEnd, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_t(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_inv(IntPtr self, int method, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_mul_toMatExpr(IntPtr self, IntPtr e, double scale, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_mul_toMat(IntPtr self, IntPtr m, double scale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_cross(IntPtr self, IntPtr m, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_dot(IntPtr self, IntPtr m, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_size(IntPtr self, out Size returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_MatExpr_type(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorUnaryMinus_MatExpr(IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorUnaryNot_MatExpr(IntPtr e, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorAdd_MatExprMat(IntPtr e, IntPtr m, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorAdd_MatMatExpr(IntPtr m, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorAdd_MatExprScalar(IntPtr e, Scalar s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorAdd_ScalarMatExpr(Scalar s, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorAdd_MatExprMatExpr(IntPtr e1, IntPtr e2, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorSubtract_MatExprMat(IntPtr e, IntPtr m, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorSubtract_MatMatExpr(IntPtr m, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorSubtract_MatExprScalar(IntPtr e, Scalar s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorSubtract_ScalarMatExpr(Scalar s, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorSubtract_MatExprMatExpr(IntPtr e1, IntPtr e2, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorMultiply_MatExprMat(IntPtr e, IntPtr m, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorMultiply_MatMatExpr(IntPtr m, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorMultiply_MatExprDouble(IntPtr e, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorMultiply_DoubleMatExpr(double s, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorMultiply_MatExprMatExpr(IntPtr e1, IntPtr e2, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorDivide_MatExprMat(IntPtr e, IntPtr m, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorDivide_MatMatExpr(IntPtr m, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorDivide_MatExprDouble(IntPtr e, double s, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorDivide_DoubleMatExpr(double s, IntPtr e, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_operatorDivide_MatExprMatExpr(IntPtr e1, IntPtr e2, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_abs_MatExpr(IntPtr e, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_OutputArray.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_OutputArray.cs new file mode 100644 index 000000000..91e38411c --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_OutputArray.cs @@ -0,0 +1,37 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_new_byMat(IntPtr mat, out IntPtr returnValue); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_OutputArray_new_byGpuMat(IntPtr mat, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_new_byUMat(IntPtr mat, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_new_byScalar(Scalar val, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_new_byVectorOfMat(IntPtr vector, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_delete(IntPtr oa); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_getMat(IntPtr oa, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_getScalar(IntPtr oa, out Scalar returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_OutputArray_getVectorOfMat(IntPtr oa, IntPtr vector); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_SparseMat.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_SparseMat.cs new file mode 100644 index 000000000..5417900c8 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_SparseMat.cs @@ -0,0 +1,108 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_new2(int dims, int[] sizes, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_new3(IntPtr m, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_operatorAssign_SparseMat(IntPtr obj, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_operatorAssign_Mat(IntPtr obj, IntPtr m); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_clone(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_copyTo_SparseMat(IntPtr obj, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_copyTo_Mat(IntPtr obj, IntPtr m); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_convertTo_SparseMat( + IntPtr obj, IntPtr m, MatType rtype, double alpha); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_convertTo_Mat( + IntPtr obj, IntPtr m, MatType rtype, double alpha, double beta); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_assignTo(IntPtr obj, IntPtr m, MatType type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_create(IntPtr obj, int dims, int[] sizes, MatType type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_clear(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_addref(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_release(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_elemSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_elemSize1(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_type(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_depth(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_channels(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_size1(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_size2(IntPtr obj, int i, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_dims(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_nzcount(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_hash_1d(IntPtr obj, int i0, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_hash_2d(IntPtr obj, int i0, int i1, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_hash_3d(IntPtr obj, int i0, int i1, int i2, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_SparseMat_hash_nd(IntPtr obj, int[] idx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_SparseMat_ptr_1d( + IntPtr obj, int i0, int createMissing, ulong* hashVal, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_SparseMat_ptr_2d( + IntPtr obj, int i0, int i1, int createMissing, ulong* hashVal, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_SparseMat_ptr_3d( + IntPtr obj, int i0, int i1, int i2, int createMissing, ulong* hashVal, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus core_SparseMat_ptr_nd( + IntPtr obj, int[] idx, int createMissing, ulong* hashVal, out IntPtr returnValue); + +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_UMat.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_UMat.cs new file mode 100644 index 000000000..513db9ea5 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/core/NativeMethods_core_UMat.cs @@ -0,0 +1,202 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new1(int usageFlags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new2(int rows, int cols, MatType type, int usageFlags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new3(int rows, int cols, MatType type, Scalar scalar, int usageFlags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new4(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, MatType type, out IntPtr returnValue); + + // Not exported + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new5(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, MatType type, Scalar s, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new6(IntPtr umat, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new7(IntPtr umat, Range rowRange, Range colRange, int usageFlags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new8(IntPtr umat, Rect roi, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_new9(IntPtr umat, Range[] ranges, out IntPtr returnValue); + + + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus core_UMat_release(IntPtr mat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_delete(IntPtr umat); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_getMat(IntPtr self, int accessFlag, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_row(IntPtr self, int y, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_col(IntPtr self, int x, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_rowRange(IntPtr self, int startRow, int endRow, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_colRange(IntPtr self, int startCol, int endCol, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_diag(IntPtr self, int d, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_diag_static(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_clone(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_copyTo1(IntPtr self, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_copyTo2(IntPtr self, IntPtr m, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_copyTo_toUMat1(IntPtr self, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_copyTo_toUMat2(IntPtr self, IntPtr m, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_convertTo(IntPtr self, IntPtr m, MatType rtype, double alpha, double beta); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_assignTo(IntPtr self, IntPtr m, int type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_setTo_Scalar(IntPtr self, Scalar value, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_setTo_InputArray(IntPtr self, IntPtr value, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_reshape1( + IntPtr self, int cn, int rows, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_reshape2( + IntPtr self, int cn, int newndims, [MarshalAs(UnmanagedType.LPArray), In] int[] newsz, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_t(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_inv(IntPtr self, int method, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_mul(IntPtr self, IntPtr m, double scale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_dot(IntPtr self, IntPtr m, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_zeros1( + int rows, int cols, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_zeros2( + int ndims, [MarshalAs(UnmanagedType.LPArray), In] int[] sz, MatType type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_ones1( + int rows, int cols, MatType type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_ones2( + int ndims, [MarshalAs(UnmanagedType.LPArray), In] int[] sz, MatType type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_eye(int rows, int cols, MatType type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_create1( + IntPtr self, int rows, int cols, MatType type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_create2( + IntPtr self, int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, MatType type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_locateROI(IntPtr self, out Size wholeSize, out Point ofs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_adjustROI( + IntPtr nativeObj, int dtop, int dbottom, int dleft, int dright, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_subMat1( + IntPtr self, int rowStart, int rowEnd, int colStart, int colEnd, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_subMat2( + IntPtr self, int nRanges, Range[] ranges, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_isContinuous(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_isSubmatrix(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_elemSize(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_elemSize1(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_type(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_depth(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_channels(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_step1(IntPtr self, int i, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_empty(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_total(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_checkVector( + IntPtr self, int elemChannels, int depth, int requireContinuous, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_flags(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_dims(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_rows(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_cols(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_size(IntPtr self, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_sizeAt(IntPtr self, int i, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_step(IntPtr self, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus core_UMat_stepAt(IntPtr self, int i, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/cuda/NativeMethods_cuda.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/cuda/NativeMethods_cuda.cs new file mode 100644 index 000000000..a38fdbe74 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/cuda/NativeMethods_cuda.cs @@ -0,0 +1,343 @@ +#if ENABLED_CUDA + +using System; +using System.Runtime.InteropServices; +using System.Text; +using OpenCvSharp.Cuda; + +#pragma warning disable 1591 + +namespace OpenCvSharp +{ + // ReSharper disable InconsistentNaming + + static partial class NativeMethods + { + #region Device + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_getCudaEnabledDeviceCount(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_setDevice(int device); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_getDevice(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_resetDevice(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_deviceSupports(int feature_set); + + // TargetArchs + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_builtWith(int feature_set); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_has(int major, int minor); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_hasPtx(int major, int minor); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_hasBin(int major, int minor); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_hasEqualOrLessPtx(int major, int minor); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_hasEqualOrGreater(int major, int minor); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_hasEqualOrGreaterPtx(int major, int minor); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_TargetArchs_hasEqualOrGreaterBin(int major, int minor); + + // DeviceInfo + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_DeviceInfo_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_DeviceInfo_new2(int deviceId); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_DeviceInfo_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)] + public static extern void cuda_DeviceInfo_name( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_majorVersion(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_minorVersion(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_multiProcessorCount(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_DeviceInfo_sharedMemPerBlock(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_DeviceInfo_queryMemory( + IntPtr obj, out ulong totalMemory, out ulong freeMemory); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_DeviceInfo_freeMemory(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_DeviceInfo_totalMemory(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_supports(IntPtr obj, int featureSet); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_isCompatible(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_deviceID(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_DeviceInfo_canMapHostMemory(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_printCudaDeviceInfo(int device); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_printShortCudaDeviceInfo(int device); + #endregion + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_registerPageLocked(IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_unregisterPageLocked(IntPtr m); + + #region Stream + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_Stream_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_Stream_new2(IntPtr s); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_opAssign(IntPtr left, IntPtr right); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_Stream_queryIfComplete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_waitForCompletion(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueDownload_CudaMem(IntPtr obj, IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueDownload_Mat(IntPtr obj, IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueUpload_CudaMem(IntPtr obj, IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueUpload_Mat(IntPtr obj, IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueCopy(IntPtr obj, IntPtr src, IntPtr dst); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueMemSet(IntPtr obj, IntPtr src, Scalar val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueMemSet_WithMask(IntPtr obj, IntPtr src, Scalar val, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueConvert( + IntPtr obj, IntPtr src, IntPtr dst, int dtype, double a, double b); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_Stream_enqueueHostCallback( + IntPtr obj, IntPtr callback, IntPtr userData); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_Stream_Null(); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_Stream_bool(IntPtr obj); + + #endregion + + #region CascadeClassifier_GPU + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_CascadeClassifier_GPU_delete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_CascadeClassifier_GPU_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_CascadeClassifier_GPU_new2(string filename); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_CascadeClassifier_GPU_empty(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_CascadeClassifier_GPU_load(IntPtr obj, string filename); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_CascadeClassifier_GPU_release(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_CascadeClassifier_GPU_detectMultiScale1(IntPtr obj, + IntPtr image, IntPtr objectsBuf, double scaleFactor, int minNeighbors, Size minSize); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_CascadeClassifier_GPU_detectMultiScale2(IntPtr obj, + IntPtr image, IntPtr objectsBuf, Size maxObjectSize, Size minSize, double scaleFactor, + int minNeighbors); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_CascadeClassifier_GPU_findLargestObject_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_CascadeClassifier_GPU_findLargestObject_set(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_CascadeClassifier_GPU_visualizeInPlace_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_CascadeClassifier_GPU_visualizeInPlace_set(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Size cuda_CascadeClassifier_GPU_getClassifierSize(IntPtr obj); + + #endregion + + #region HogDescriptor + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int HOGDescriptor_sizeof(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr HOGDescriptor_new(Size win_size, Size block_size, Size block_stride, Size cell_size, + int nbins, double winSigma, double threshold_L2Hys, bool gamma_correction, int nlevels); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong HOGDescriptor_getDescriptorSize(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong HOGDescriptor_getBlockHistogramSize(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int HOGDescriptor_checkDetectorSize(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double HOGDescriptor_getWinSigma(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_setSVMDetector(IntPtr obj, IntPtr svmdetector); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_detect(IntPtr obj, IntPtr img, IntPtr found_locations, double hit_threshold, Size win_stride, Size padding); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_detectMultiScale(IntPtr obj, IntPtr img, IntPtr found_locations, + double hit_threshold, Size win_stride, Size padding, double scale, int group_threshold); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_getDescriptors(IntPtr obj, IntPtr img, Size win_stride, IntPtr descriptors, [MarshalAs(UnmanagedType.I4)] DescriptorFormat descr_format); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Size HOGDescriptor_win_size_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Size HOGDescriptor_block_size_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Size HOGDescriptor_block_stride_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Size HOGDescriptor_cell_size_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int HOGDescriptor_nbins_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double HOGDescriptor_win_sigma_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double HOGDescriptor_threshold_L2hys_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int HOGDescriptor_nlevels_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int HOGDescriptor_gamma_correction_get(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_win_size_set(IntPtr obj, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_block_size_set(IntPtr obj, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_block_stride_set(IntPtr obj, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_cell_size_set(IntPtr obj, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_nbins_set(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_win_sigma_set(IntPtr obj, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_threshold_L2hys_set(IntPtr obj, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_nlevels_set(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void HOGDescriptor_gamma_correction_set(IntPtr obj, int value); + #endregion + + #region MOG_GPU + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG_GPU_delete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_MOG_GPU_new(int nmixtures); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG_GPU_initialize( + IntPtr obj, Size frameSize, int frameType); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG_GPU_operator( + IntPtr obj, IntPtr frame, IntPtr fgmask, float learningRate, IntPtr stream); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG_GPU_getBackgroundImage( + IntPtr obj, IntPtr backgroundImage, IntPtr stream); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG_GPU_release(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe int* cuda_MOG_GPU_history(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG_GPU_varThreshold(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG_GPU_backgroundRatio(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG_GPU_noiseSigma(IntPtr obj); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG2_GPU_delete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_MOG2_GPU_new(int nmixtures); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG2_GPU_initialize( + IntPtr obj, Size frameSize, int frameType); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG2_GPU_operator( + IntPtr obj, IntPtr frame, IntPtr fgmask, float learningRate, IntPtr stream); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG2_GPU_getBackgroundImage( + IntPtr obj, IntPtr backgroundImage, IntPtr stream); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG2_GPU_release(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe int* cuda_MOG2_GPU_history(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_varThreshold(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_backgroundRatio(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_varThresholdGen(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_fVarInit(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_fVarMin(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_fVarMax(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_fCT(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_MOG2_GPU_bShadowDetection_get(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_MOG2_GPU_bShadowDetection_set(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe byte* cuda_MOG2_GPU_nShadowDetection(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_MOG2_GPU_fTau(IntPtr obj); + + #endregion + + #region StereoBM_GPU + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_StereoBM_GPU_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_StereoBM_GPU_new2(int preset, int ndisparities, int winSize); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_StereoBM_GPU_delete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_StereoBM_GPU_run1(IntPtr obj, IntPtr left, IntPtr right, IntPtr disparity); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_StereoBM_GPU_run2(IntPtr obj, IntPtr left, IntPtr right, IntPtr disparity, IntPtr stream); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_StereoBM_GPU_checkIfGpuCallReasonable(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe int* cuda_StereoBM_GPU_preset(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe int* cuda_StereoBM_GPU_ndisp(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe int* cuda_StereoBM_GPU_winSize(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe float* cuda_StereoBM_GPU_avergeTexThreshold(IntPtr obj); + #endregion + } +} + +#endif \ No newline at end of file diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/cuda/NativeMethods_cuda_GpuMat.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/cuda/NativeMethods_cuda_GpuMat.cs new file mode 100644 index 000000000..e7c6eb8bd --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/cuda/NativeMethods_cuda_GpuMat.cs @@ -0,0 +1,155 @@ +#if ENABLED_CUDA + +using System; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +namespace OpenCvSharp +{ + // ReSharper disable InconsistentNaming + + static partial class NativeMethods + { +#region Init & Disposal + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_delete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new1(); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new2(int rows, int cols, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new3(int rows, int cols, int type, IntPtr data, ulong step); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new4(IntPtr mat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new5(IntPtr gpumat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new6(Size size, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new7(Size size, int type, IntPtr data, ulong step); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new8(int rows, int cols, int type, Scalar s); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new9(IntPtr m, Range rowRange, Range colRange); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new10(IntPtr m, Rect roi); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_new11(Size size, int type, Scalar s); + +#endregion + +#region Operators + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_opToMat(IntPtr src); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_opToGpuMat(IntPtr src); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_opAssign(IntPtr left, IntPtr right); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_opRange1(IntPtr src, Rect roi); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_opRange2(IntPtr src, Range rowRange, Range colRange); + +#endregion + +#region Fields + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_flags(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_rows(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_cols(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_GpuMat_step(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe byte* cuda_GpuMat_data(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_refcount(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_datastart(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_dataend(IntPtr obj); +#endregion + +#region Methods + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_upload(IntPtr obj, IntPtr mat); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_download(IntPtr obj, IntPtr mat); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_row(IntPtr obj, int y); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_col(IntPtr obj, int x); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_rowRange(IntPtr obj, int startrow, int endrow); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_colRange(IntPtr obj, int startcol, int endcol); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_clone(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_copyTo1(IntPtr obj, IntPtr m); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_copyTo2(IntPtr obj, IntPtr m, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_convertTo(IntPtr obj, IntPtr m, int rtype, double alpha, double beta); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_assignTo(IntPtr obj, IntPtr m, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_setTo(IntPtr obj, Scalar s, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_reshape(IntPtr obj, int cn, int rows); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_create1(IntPtr obj, int rows, int cols, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_create2(IntPtr obj, Size size, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_release(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_swap(IntPtr obj, IntPtr mat); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_GpuMat_locateROI(IntPtr obj, out Size wholeSize, out Point ofs); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_GpuMat_adjustROI(IntPtr obj, int dtop, int dbottom, int dleft, int drightt); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_isContinuous(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_GpuMat_elemSize(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_GpuMat_elemSize1(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_type(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_depth(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_channels(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ulong cuda_GpuMat_step1(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Size cuda_GpuMat_size(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int cuda_GpuMat_empty(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe byte* cuda_GpuMat_ptr(IntPtr obj, int y); +#endregion + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_createContinuous1( + int rows, int cols, int type, IntPtr gm); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr cuda_createContinuous2( + int rows, int cols, int type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void cuda_ensureSizeIsEnough( + int rows, int cols, int type, IntPtr m); + } +} + +#endif \ No newline at end of file diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/dnn/NativeMethods_dnn.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/dnn/NativeMethods_dnn.cs new file mode 100644 index 000000000..df10cd8c0 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/dnn/NativeMethods_dnn.cs @@ -0,0 +1,320 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + + namespace OpenCvSharp.Internal; + + // ReSharper disable InconsistentNaming + static partial class NativeMethods + { + // readNetFromDarknet + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromDarknet")] + public static extern ExceptionStatus dnn_readNetFromDarknet_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string cfgFile, + [MarshalAs(StringUnmanagedTypeNotWindows)] string? darknetModel, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromDarknet")] + public static extern ExceptionStatus dnn_readNetFromDarknet_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string cfgFile, + [MarshalAs(StringUnmanagedTypeWindows)] string? darknetModel, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNetFromDarknet(string cfgFile, string? darknetModel, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNetFromDarknet_Windows(cfgFile, darknetModel, out returnValue); + return dnn_readNetFromDarknet_NotWindows(cfgFile, darknetModel, out returnValue); + } + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, EntryPoint = "dnn_readNetFromDarknet_InputArray")] + public static extern unsafe ExceptionStatus dnn_readNetFromDarknet( + byte* bufferCfg, IntPtr lenCfg, + byte* bufferModel, IntPtr lenModel, + out IntPtr returnValue); + + // readNetFromCaffe + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromCaffe")] + public static extern ExceptionStatus dnn_readNetFromCaffe_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string prototxt, + [MarshalAs(StringUnmanagedTypeNotWindows)] string? caffeModel, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromCaffe")] + public static extern ExceptionStatus dnn_readNetFromCaffe_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string prototxt, + [MarshalAs(StringUnmanagedTypeWindows)] string? caffeModel, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNetFromCaffe(string prototxt, string? caffeModel, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNetFromCaffe_Windows(prototxt, caffeModel, out returnValue); + return dnn_readNetFromCaffe_NotWindows(prototxt, caffeModel, out returnValue); + } + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, + EntryPoint = "dnn_readNetFromCaffe_InputArray")] + public static extern unsafe ExceptionStatus dnn_readNetFromCaffe( + byte* bufferProto, IntPtr lenProto, + byte* bufferModel, IntPtr lenModel, + out IntPtr returnValue); + + // readNetFromTensorflow + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromTensorflow")] + public static extern ExceptionStatus dnn_readNetFromTensorflow_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string model, + [MarshalAs(StringUnmanagedTypeNotWindows)] string? config, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromTensorflow")] + public static extern ExceptionStatus dnn_readNetFromTensorflow_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string model, + [MarshalAs(StringUnmanagedTypeWindows)] string? config, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNetFromTensorflow(string model, string? config, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNetFromTensorflow_Windows(model, config, out returnValue); + return dnn_readNetFromTensorflow_NotWindows(model, config, out returnValue); + } + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, EntryPoint = "dnn_readNetFromTensorflow_InputArray")] + public static extern unsafe ExceptionStatus dnn_readNetFromTensorflow( + byte* bufferModel, IntPtr modelDataLength, + byte* bufferConfig, IntPtr configDataLength, + out IntPtr returnValue); + + // readNetFromTorch + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromTorch")] + public static extern ExceptionStatus dnn_readNetFromTorch_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string model, + int isBinary, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromTorch")] + public static extern ExceptionStatus dnn_readNetFromTorch_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string model, + int isBinary, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNetFromTorch(string model, int isBinary, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNetFromTorch_Windows(model, isBinary, out returnValue); + return dnn_readNetFromTorch_NotWindows(model, isBinary, out returnValue); + } + + // readNet + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNet")] + public static extern ExceptionStatus dnn_readNet_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string model, + [MarshalAs(StringUnmanagedTypeNotWindows)] string config, + [MarshalAs(UnmanagedType.LPStr)] string framework, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNet")] + public static extern ExceptionStatus dnn_readNet_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string model, + [MarshalAs(StringUnmanagedTypeWindows)] string config, + [MarshalAs(UnmanagedType.LPStr)] string framework, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNet(string model, string config, string framework, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNet_Windows(model, config, framework, out returnValue); + return dnn_readNet_NotWindows(model, config, framework, out returnValue); + } + + // readTorchBlob + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readTorchBlob")] + public static extern ExceptionStatus dnn_readTorchBlob_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string fileName, + int isBinary, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readTorchBlob")] + public static extern ExceptionStatus dnn_readTorchBlob_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string fileName, + int isBinary, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readTorchBlob(string fileName, int isBinary, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readTorchBlob_Windows(fileName, isBinary, out returnValue); + return dnn_readTorchBlob_NotWindows(fileName, isBinary, out returnValue); + } + + // readNetFromModelOptimizer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromModelOptimizer")] + public static extern ExceptionStatus dnn_readNetFromModelOptimizer_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string xml, + [MarshalAs(StringUnmanagedTypeNotWindows)] string bin, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromModelOptimizer")] + public static extern ExceptionStatus dnn_readNetFromModelOptimizer_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string xml, + [MarshalAs(StringUnmanagedTypeWindows)] string bin, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNetFromModelOptimizer(string xml, string bin, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNetFromModelOptimizer_Windows(xml, bin, out returnValue); + return dnn_readNetFromModelOptimizer_NotWindows(xml, bin, out returnValue); + } + + // readNetFromONNX + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromONNX")] + public static extern ExceptionStatus dnn_readNetFromONNX_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string onnxFile, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readNetFromONNX")] + public static extern ExceptionStatus dnn_readNetFromONNX_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string onnxFile, + out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readNetFromONNX(string onnxFile, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readNetFromONNX_Windows(onnxFile, out returnValue); + return dnn_readNetFromONNX_NotWindows(onnxFile, out returnValue); + } + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, EntryPoint = "dnn_readNetFromONNX_InputArray")] + public static extern unsafe ExceptionStatus dnn_readNetFromONNX( + byte* buffer, IntPtr sizeBuffer, out IntPtr returnValue); + + // readTensorFromONNX + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readTensorFromONNX")] + public static extern ExceptionStatus dnn_readTensorFromONNX_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string path, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_readTensorFromONNX")] + public static extern ExceptionStatus dnn_readTensorFromONNX_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string path, out IntPtr returnValue); + + [Pure] + public static ExceptionStatus dnn_readTensorFromONNX(string path, out IntPtr returnValue) + { + if (IsWindows()) + return dnn_readTensorFromONNX_Windows(path, out returnValue); + return dnn_readTensorFromONNX_NotWindows(path, out returnValue); + } + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_blobFromImage( + IntPtr image, double scaleFactor, Size size, Scalar mean, int swapRB, int crop, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_blobFromImages( + IntPtr[] images, int imagesLength, double scaleFactor, Size size, Scalar mean, int swapRB, int crop, out IntPtr returnValue); + + // shrinkCaffeModel + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_shrinkCaffeModel")] + public static extern ExceptionStatus dnn_shrinkCaffeModel_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string src, + [MarshalAs(StringUnmanagedTypeNotWindows)] string dst, + string[] layersTypes, int layersTypesSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_shrinkCaffeModel")] + public static extern ExceptionStatus dnn_shrinkCaffeModel_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string src, [MarshalAs(StringUnmanagedTypeWindows)] string dst, + string[] layersTypes, int layersTypesSize); + + [Pure] + public static ExceptionStatus dnn_shrinkCaffeModel(string src, string dst, string[] layersTypes, int layersTypesSize) + { + if (IsWindows()) + return dnn_shrinkCaffeModel_Windows(src, dst, layersTypes, layersTypesSize); + return dnn_shrinkCaffeModel_NotWindows(src, dst, layersTypes, layersTypesSize); + } + + // writeTextGraph + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_writeTextGraph")] + public static extern ExceptionStatus dnn_writeTextGraph_NotWindows( + [MarshalAs(StringUnmanagedTypeNotWindows)] string model, [MarshalAs(StringUnmanagedTypeNotWindows)] string output); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true, + EntryPoint = "dnn_writeTextGraph")] + public static extern ExceptionStatus dnn_writeTextGraph_Windows( + [MarshalAs(StringUnmanagedTypeWindows)] string model, [MarshalAs(StringUnmanagedTypeWindows)] string output); + + [Pure] + public static ExceptionStatus dnn_writeTextGraph(string path, string output) + { + if (IsWindows()) + return dnn_writeTextGraph_Windows(path, output); + return dnn_writeTextGraph_NotWindows(path, output); + } + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_NMSBoxes_Rect( + IntPtr bboxes, IntPtr scores, + float score_threshold, float nms_threshold, + IntPtr indices, float eta, int top_k); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_NMSBoxes_Rect2d( + IntPtr bboxes, IntPtr scores, + float score_threshold, float nms_threshold, + IntPtr indices, float eta, int top_k); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_NMSBoxes_RotatedRect( + IntPtr bboxes, IntPtr scores, + float score_threshold, float nms_threshold, + IntPtr indices, float eta, int top_k); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_resetMyriadDevice(); + } diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/dnn/NativeMethods_dnn_Net.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/dnn/NativeMethods_dnn_Net.cs new file mode 100644 index 000000000..accbc9483 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/dnn/NativeMethods_dnn_Net.cs @@ -0,0 +1,83 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_new(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_delete(IntPtr net); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_readFromModelOptimizer( + [MarshalAs(UnmanagedType.LPStr)] string xml, [MarshalAs(UnmanagedType.LPStr)] string bin, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_empty(IntPtr net, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_dump(IntPtr net, IntPtr outString); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_dumpToFile(IntPtr net, [MarshalAs(UnmanagedType.LPStr)] string path); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_getLayerId(IntPtr net, [MarshalAs(UnmanagedType.LPStr)] string layer, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_getLayerNames(IntPtr net, IntPtr outVec); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_connect1( + IntPtr net, [MarshalAs(UnmanagedType.LPStr)] string outPin, [MarshalAs(UnmanagedType.LPStr)] string inpPin); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus dnn_Net_connect2(IntPtr net, int outLayerId, int outNum, int inpLayerId, int inpNum); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_setInputsNames(IntPtr net, string[] inputBlobNames, int inputBlobNamesLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_forward1(IntPtr net, [MarshalAs(UnmanagedType.LPStr)] string? outputName, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_forward2( + IntPtr net, IntPtr[] outputBlobs, int outputBlobsLength, [MarshalAs(UnmanagedType.LPStr)] string? outputName); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_forward3( + IntPtr net, IntPtr[] outputBlobs, int outputBlobsLength, string[] outBlobNames, int outBlobNamesLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_setHalideScheduler(IntPtr net, [MarshalAs(UnmanagedType.LPStr)] string scheduler); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_setPreferableBackend(IntPtr net, int backendId); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_setPreferableTarget(IntPtr net, int targetId); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_setInput(IntPtr net, IntPtr blob, [MarshalAs(UnmanagedType.LPStr)] string name); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_getUnconnectedOutLayers(IntPtr net, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_getUnconnectedOutLayersNames(IntPtr net, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_enableFusion(IntPtr net, int fusion); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern ExceptionStatus dnn_Net_getPerfProfile(IntPtr net, IntPtr timings, out long returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/face/NativeMethods_face_FaceRecognizer.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/face/NativeMethods_face_FaceRecognizer.cs new file mode 100644 index 000000000..f6e180d55 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/face/NativeMethods_face_FaceRecognizer.cs @@ -0,0 +1,167 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +static partial class NativeMethods +{ + #region FaceRecognizer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_train( + IntPtr obj, IntPtr[] src, int srcLength, int[] labels, int labelsLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_update( + IntPtr obj, IntPtr[] src, int srcLength, int[] labels, int labelsLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_predict1(IntPtr obj, IntPtr src, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_predict2( + IntPtr obj, IntPtr src, out int label, out double confidence); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_write1( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_read1( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_write2(IntPtr obj, IntPtr fs); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_read2(IntPtr obj, IntPtr fs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_setLabelInfo( + IntPtr obj, int label, [MarshalAs(UnmanagedType.LPStr)] string strInfo); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_getLabelInfo(IntPtr obj, int label, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_getLabelsByString( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string str, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_getThreshold(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FaceRecognizer_setThreshold(IntPtr obj, double val); + + #endregion + + #region BasicFaceRecognizer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getNumComponents(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_setNumComponents(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getThreshold(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_setThreshold(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getProjections(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getLabels(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getEigenValues(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getEigenVectors(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_BasicFaceRecognizer_getMean(IntPtr obj, IntPtr dst); + + #endregion + + #region EigenFaceRecognizer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_EigenFaceRecognizer_create(int numComponents, double threshold, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_EigenFaceRecognizer_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_EigenFaceRecognizer_delete(IntPtr obj); + + #endregion + + #region FisherFaceRecognizer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FisherFaceRecognizer_create(int numComponents, double threshold, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_FisherFaceRecognizer_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_FisherFaceRecognizer_delete(IntPtr obj); + + #endregion + + #region LBPHFaceRecognizer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_create( + int radius, int neighbors, int gridX, int gridY, double threshold, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getGridX(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_setGridX(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getGridY(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_setGridY(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getRadius(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_setRadius(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getNeighbors(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_setNeighbors(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getThreshold(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_setThreshold(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getHistograms(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_LBPHFaceRecognizer_getLabels(IntPtr obj, IntPtr dst); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_LBPHFaceRecognizer_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_LBPHFaceRecognizer_delete(IntPtr obj); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/face/NativeMethods_face_Facemark.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/face/NativeMethods_face_Facemark.cs new file mode 100644 index 000000000..762e31a11 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/face/NativeMethods_face_Facemark.cs @@ -0,0 +1,249 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +static partial class NativeMethods +{ + #region Facemark + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Facemark_loadModel( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string model); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Facemark_fit( + IntPtr obj, IntPtr image, IntPtr faces, IntPtr landmarks, out int returnValue); + + #endregion + + #region FacemarkLBF + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_create(IntPtr @params, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_FacemarkLBF_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_FacemarkLBF_delete(IntPtr obj); + + #region Params + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_new(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_shape_offset_get(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_shape_offset_set(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_cascade_face_get(IntPtr obj, IntPtr s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_cascade_face_set( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_verbose_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_verbose_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_n_landmarks_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_n_landmarks_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_initShape_n_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_initShape_n_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_stages_n_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_stages_n_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_tree_n_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_tree_n_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_tree_depth_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_tree_depth_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_bagging_overlap_get(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_bagging_overlap_set(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_model_filename_get(IntPtr obj, IntPtr s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_model_filename_set( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_save_model_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_save_model_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_seed_get(IntPtr obj, out uint returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_seed_set(IntPtr obj, uint val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_feats_m_get(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_feats_m_set(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_radius_m_get(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_radius_m_set(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_pupils0_get(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_pupils0_set(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_pupils1_get(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_pupils1_set(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_detectROI_get(IntPtr obj, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_detectROI_set(IntPtr obj, Rect val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_read(IntPtr obj, IntPtr fn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkLBF_Params_write(IntPtr obj, IntPtr fs); + + #endregion + + #endregion + + #region FacemarkAAM + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_create(IntPtr @params, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_FacemarkAAM_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_Ptr_FacemarkAAM_delete(IntPtr obj); + + #region Params + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_new(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_model_filename_get(IntPtr obj, IntPtr s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_model_filename_set( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_m_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_m_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_n_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_n_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_n_iter_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_n_iter_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_verbose_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_verbose_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_save_model_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_save_model_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_max_m_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_max_m_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_max_n_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_max_n_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_texture_max_m_get(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_texture_max_m_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_scales_get(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_scales_set(IntPtr obj, IntPtr v); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_read(IntPtr obj, IntPtr fn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus face_FacemarkAAM_Params_write(IntPtr obj, IntPtr fs); + + #endregion + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d.cs new file mode 100644 index 000000000..910e3ff6d --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d.cs @@ -0,0 +1,81 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // ReSharper disable InconsistentNaming + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_drawKeypoints( + IntPtr image, KeyPoint[] keypoints, int keypointsLength, + IntPtr outImage, Scalar color, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_drawMatches( + IntPtr img1, KeyPoint[] keypoints1, int keypoints1Length, + IntPtr img2, KeyPoint[] keypoints2, int keypoints2Length, + DMatch[] matches1to2, int matches1to2Length, IntPtr outImg, + Scalar matchColor, Scalar singlePointColor, + byte[]? matchesMask, int matchesMaskLength, int flags); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_drawMatchesKnn( + IntPtr img1, KeyPoint[] keypoints1, int keypoints1Length, + IntPtr img2, KeyPoint[] keypoints2, int keypoints2Length, + IntPtr[] matches1to2, int matches1to2Size1, int[] matches1to2Size2, + IntPtr outImg, Scalar matchColor, Scalar singlePointColor, + IntPtr[]? matchesMask, int matchesMaskSize1, int[]? matchesMaskSize2, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_evaluateFeatureDetector( + IntPtr img1, IntPtr img2, IntPtr H1to2, + IntPtr keypoints1, IntPtr keypoints2, + out float repeatability, out int correspCount); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_computeRecallPrecisionCurve( + IntPtr[] matches1to2, int matches1to2Size1, int[] matches1to2Size2, + IntPtr[] correctMatches1to2Mask, int correctMatches1to2MaskSize1, int[] correctMatches1to2MaskSize2, + IntPtr recallPrecisionCurve); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_getRecall( + Point2f[] recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_getNearestPoint( + Point2f[] recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision, out int returnValue); + + #region KeyPointsFilter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KeyPointsFilter_runByImageBorder( + IntPtr keypoints, Size imageSize, int borderSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KeyPointsFilter_runByKeypointSize( + IntPtr keypoints, float minSize, float maxSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KeyPointsFilter_runByPixelsMask( + IntPtr keypoints, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KeyPointsFilter_removeDuplicated( + IntPtr keypoints); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KeyPointsFilter_removeDuplicatedSorted( + IntPtr keypoints); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KeyPointsFilter_retainBest( + IntPtr keypoints, int nPoints); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_BOW.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_BOW.cs new file mode 100644 index 000000000..5514ab5a8 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_BOW.cs @@ -0,0 +1,88 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // BOWTrainer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWTrainer_add(IntPtr obj, IntPtr descriptors); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWTrainer_getDescriptors(IntPtr obj, IntPtr descriptors); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + + public static extern ExceptionStatus features2d_BOWTrainer_descriptorsCount(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWTrainer_clear(IntPtr obj); + + + // BOWKMeansTrainer + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWKMeansTrainer_new( + int clusterCount, TermCriteria termcrit, int attempts, int flags, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWKMeansTrainer_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWKMeansTrainer_cluster1( + IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWKMeansTrainer_cluster2( + IntPtr obj, IntPtr descriptors, out IntPtr returnValue); + + + // BOWImgDescriptorExtractor + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_new1_Ptr( + IntPtr dextractor, IntPtr dmatcher, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_new2_Ptr( + IntPtr dmatcher, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_new1_RawPtr( + IntPtr dextractor, IntPtr dmatcher, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_new2_RawPtr( + IntPtr dmatcher, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_setVocabulary(IntPtr obj, IntPtr vocabulary); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_getVocabulary(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_compute11( + IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr imgDescriptor, + IntPtr pointIdxsOfClusters, IntPtr descriptors); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_compute12( + IntPtr obj, IntPtr keypointDescriptors, + IntPtr imgDescriptor, IntPtr pointIdxsOfClusters); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_compute2( + IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr imgDescriptor); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_descriptorSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BOWImgDescriptorExtractor_descriptorType(IntPtr obj, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_DescriptorMatcher.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_DescriptorMatcher.cs new file mode 100644 index 000000000..f2b5e806d --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_DescriptorMatcher.cs @@ -0,0 +1,120 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // DescriptorMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_add( + IntPtr obj, IntPtr[] descriptors, int descriptorLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_getTrainDescriptors(IntPtr obj, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_clear(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_empty(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_isMaskSupported(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_train(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_match1( + IntPtr obj, IntPtr queryDescriptors, IntPtr trainDescriptors, IntPtr matches, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_knnMatch1( + IntPtr obj, IntPtr queryDescriptors, IntPtr trainDescriptors, IntPtr matches, int k, + IntPtr mask, int compactResult); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_radiusMatch1( + IntPtr obj, IntPtr queryDescriptors,IntPtr trainDescriptors, IntPtr matches, float maxDistance, + IntPtr mask, int compactResult); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_match2( + IntPtr obj, IntPtr queryDescriptors, IntPtr matches, + IntPtr[] masks, int masksSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_knnMatch2( + IntPtr obj, IntPtr queryDescriptors, IntPtr matches, + int k, IntPtr[] masks, int masksSize, int compactResult); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_radiusMatch2( + IntPtr obj, IntPtr queryDescriptors, IntPtr matches, + float maxDistance, IntPtr[] masks, int masksSize, int compactResult); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus features2d_DescriptorMatcher_create( + [MarshalAs(UnmanagedType.LPStr)] string descriptorMatcherType, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_DescriptorMatcher_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_DescriptorMatcher_delete(IntPtr ptr); + + + // BFMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BFMatcher_new(int normType, int crossCheck, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BFMatcher_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BFMatcher_isMaskSupported(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_BFMatcher_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_BFMatcher_delete(IntPtr ptr); + + + // FlannBasedMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FlannBasedMatcher_new( + IntPtr indexParams, IntPtr searchParams, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FlannBasedMatcher_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FlannBasedMatcher_add( + IntPtr obj, IntPtr[] descriptors, int descriptorsSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FlannBasedMatcher_clear(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FlannBasedMatcher_train(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FlannBasedMatcher_isMaskSupported(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_FlannBasedMatcher_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_FlannBasedMatcher_delete(IntPtr ptr); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_Feature2D.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_Feature2D.cs new file mode 100644 index 000000000..da3a97e98 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_Feature2D.cs @@ -0,0 +1,424 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // ReSharper disable InconsistentNaming + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus features2d_Ptr_Feature2D_get(IntPtr ptr, out IntPtr returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus features2d_Ptr_Feature2D_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_detect_Mat1( + IntPtr detector, IntPtr image, IntPtr keypoints, IntPtr mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_detect_Mat2( + IntPtr detector, IntPtr[] images, int imageLength, IntPtr keypoints, IntPtr[]? mask); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_detect_InputArray( + IntPtr detector, IntPtr image, IntPtr keypoints, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_compute1(IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr descriptors); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_compute2( + IntPtr detector, IntPtr[] images, int imageLength, + IntPtr keypoints, IntPtr[] descriptors, int descriptorsLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_detectAndCompute( + IntPtr detector, IntPtr image, IntPtr mask, + IntPtr keypoints, IntPtr descriptors, int useProvidedKeypoints); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_descriptorSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_descriptorType(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_defaultNorm(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_empty(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_write(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fileName); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_read(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fileName); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Feature2D_getDefaultName(IntPtr obj, IntPtr returnValue); + + #region SIFT + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_SIFT_create( + int nFeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_SIFT_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_SIFT_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region BRISK + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BRISK_create1( + int thresh, int octaves, float patternScale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BRISK_create2( + float[] radiusList, int radiusListLength, + int[] numberList, int numberListLength, + float dMax, float dMin, + int[]? indexChange, int indexChangeLength, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_BRISK_create3( + int thresh, int octaves, + float[] radiusList, int radiusListLength, + int[] numberList, int numberListLength, + float dMax, float dMin, + int[]? indexChange, int indexChangeLength, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_BRISK_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_BRISK_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region ORB + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_create( + int nFeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int wtaK, + int scoreType, int patchSize, int fastThreshold, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_ORB_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_ORB_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setMaxFeatures(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getMaxFeatures(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setScaleFactor(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getScaleFactor(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setNLevels(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getNLevels(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setEdgeThreshold(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getEdgeThreshold(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setFirstLevel(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getFirstLevel(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setWTA_K(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getWTA_K(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setScoreType(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getScoreType(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setPatchSize(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getPatchSize(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_setFastThreshold(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_ORB_getFastThreshold(IntPtr obj, out int returnValue); + + #endregion + + #region MSER + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_create(int delta, int minArea, int maxArea, + double maxVariation, double minDiversity, int maxEvolution, + double areaThreshold, double minMargin, int edgeBlurSize, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_MSER_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_MSER_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_detectRegions( + IntPtr obj, IntPtr image, IntPtr msers, IntPtr bboxes); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_setDelta(IntPtr obj, int delta); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_getDelta(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_setMinArea(IntPtr obj, int minArea); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_getMinArea(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_setMaxArea(IntPtr obj, int maxArea); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_getMaxArea(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_setPass2Only(IntPtr obj, int f); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_MSER_getPass2Only(IntPtr obj, out int returnValue); + + #endregion + + #region FastFeatureDetector + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FAST1(IntPtr image, IntPtr keypoints, int threshold, int nonmaxSupression); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FAST2(IntPtr image, IntPtr keypoints, int threshold, int nonmaxSupression, int type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_create(int threshold, int nonmaxSuppression, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_FastFeatureDetector_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_FastFeatureDetector_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_setThreshold(IntPtr obj, int threshold); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_getThreshold(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_setNonmaxSuppression(IntPtr obj, int f); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_getNonmaxSuppression(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_setType(IntPtr obj, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_FastFeatureDetector_getType(IntPtr obj, out int returnValue); + + #endregion + + #region AgastFeatureDetector + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AGAST(IntPtr image, IntPtr keypoints, + int threshold, int nonmaxSuppression, int type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_create( + int threshold, int nonmaxSuppression, int type, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_AgastFeatureDetector_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_AgastFeatureDetector_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_setThreshold(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_getThreshold(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_setNonmaxSuppression(IntPtr obj,int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_getNonmaxSuppression(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_setType(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AgastFeatureDetector_getType(IntPtr obj, out int returnValue); + + #endregion + + #region GFTTDetector + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_create(int maxCorners, double qualityLevel, + double minDistance, int blockSize, int useHarrisDetector, double k, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_GFTTDetector_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_GFTTDetector_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_setMaxFeatures(IntPtr obj, int maxFeatures); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_getMaxFeatures(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_setQualityLevel(IntPtr obj, double qLevel); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_getQualityLevel(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_setMinDistance(IntPtr obj, double minDistance); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_getMinDistance(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_setBlockSize(IntPtr obj, int blockSize); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_getBlockSize(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_setHarrisDetector(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_getHarrisDetector(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_setK(IntPtr obj, double k); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_GFTTDetector_getK(IntPtr obj, out double returnValue); + + #endregion + + #region SimpleBlobDetector + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_SimpleBlobDetector_create( + ref SimpleBlobDetector.WParams parameters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_SimpleBlobDetector_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_SimpleBlobDetector_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region KAZE + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_create( + int extended, int upright, float threshold, + int nOctaves, int nOctaveLayers, int diffusivity, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_KAZE_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_KAZE_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_setDiffusivity(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_getDiffusivity(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_setExtended(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_getExtended(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_setNOctaveLayers(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_getNOctaveLayers(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_setNOctaves(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_getNOctaves(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_setThreshold(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_getThreshold(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_setUpright(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_KAZE_getUpright(IntPtr obj, out int returnValue); + + #endregion + + #region AKAZE + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_create( + int descriptor_type, int descriptor_size, int descriptor_channels, + float threshold, int nOctaves, int nOctaveLayers, int diffusivity, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_AKAZE_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_Ptr_AKAZE_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setDescriptorType(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getDescriptorType(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setDescriptorSize(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getDescriptorSize(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setDescriptorChannels(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getDescriptorChannels(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setThreshold(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getThreshold(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setNOctaves(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getNOctaves(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setNOctaveLayers(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getNOctaveLayers(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_setDiffusivity(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus features2d_AKAZE_getDiffusivity(IntPtr obj, out int returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc.cs new file mode 100644 index 000000000..f525529a1 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc.cs @@ -0,0 +1,678 @@ +using System.Runtime.InteropServices; +using System.Diagnostics.Contracts; + +// ReSharper disable IdentifierTypo + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming rules + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getGaussianKernel( + int ksize, double sigma, MatType ktype, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getDerivKernels( + IntPtr kx, IntPtr ky, int dx, int dy, int ksize, int normalize, MatType ktype); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getGaborKernel(Size ksize, double sigma, double theta, double lambd, + double gamma, double psi, int ktype, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getStructuringElement(int shape, Size ksize, Point anchor, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_medianBlur(IntPtr src, IntPtr dst, int ksize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GaussianBlur(IntPtr src, IntPtr dst, Size ksize, double sigmaX, + double sigmaY, BorderTypes borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_bilateralFilter(IntPtr src, IntPtr dst, int d, double sigmaColor, + double sigmaSpace, BorderTypes borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_boxFilter(IntPtr src, IntPtr dst, MatType ddepth, Size ksize, Point anchor, + int normalize, BorderTypes borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_sqrBoxFilter(IntPtr src, IntPtr dst, MatType ddepth, Size ksize, Point anchor, + int normalize, BorderTypes borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_blur(IntPtr src, IntPtr dst, Size ksize, Point anchor, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_filter2D(IntPtr src, IntPtr dst, MatType ddepth, IntPtr kernel, Point anchor, + double delta, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_sepFilter2D(IntPtr src, IntPtr dst, MatType ddepth, IntPtr kernelX, + IntPtr kernelY, Point anchor, double delta, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Sobel(IntPtr src, IntPtr dst, MatType ddepth, + int dx, int dy, int ksize, double scale, double delta, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_spatialGradient( + IntPtr src, IntPtr dx, IntPtr dy, int ksize, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Scharr(IntPtr src, IntPtr dst, MatType ddepth, + int dx, int dy, double scale, double delta, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Laplacian(IntPtr src, IntPtr dst, MatType ddepth, + int ksize, double scale, double delta, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Canny1( + IntPtr src, IntPtr edges, double threshold1, double threshold2, int apertureSize, int l2Gradient); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Canny2( + IntPtr dx, IntPtr dy, IntPtr edges, double threshold1, double threshold2, int l2Gradient); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_cornerMinEigenVal(IntPtr src, IntPtr dst, int blockSize, int ksize, + int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_cornerHarris(IntPtr src, IntPtr dst, int blockSize, int ksize, + double k, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_cornerEigenValsAndVecs(IntPtr src, IntPtr dst, int blockSize, int ksize, + int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_preCornerDetect(IntPtr src, IntPtr dst, int ksize, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_cornerSubPix(IntPtr image, IntPtr corners, + Size winSize, Size zeroZone, TermCriteria criteria); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_goodFeaturesToTrack(IntPtr src, IntPtr corners, + int maxCorners, double qualityLevel, double minDistance, IntPtr mask, int blockSize, int useHarrisDetector, + double k); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_HoughLines(IntPtr src, IntPtr lines, + double rho, double theta, int threshold, double srn, double stn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_HoughLinesP(IntPtr src, IntPtr lines, + double rho, double theta, int threshold, double minLineLength, double maxLineG); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_HoughLinesPointSet( + IntPtr point, IntPtr lines, int linesMax, int threshold, + double minRho, double maxRho, double rhoStep, + double minTheta, double maxTheta, double thetaStep); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_HoughCircles(IntPtr src, IntPtr circles, + int method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_erode(IntPtr src, IntPtr dst, IntPtr kernel, Point anchor, int iterations, + int borderType, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_dilate(IntPtr src, IntPtr dst, IntPtr kernel, Point anchor, int iterations, + int borderType, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_morphologyEx(IntPtr src, IntPtr dst, int op, IntPtr kernel, Point anchor, + int iterations, int borderType, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_resize(IntPtr src, IntPtr dst, Size dsize, double fx, double fy, + int interpolation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_warpAffine(IntPtr src, IntPtr dst, IntPtr m, Size dsize, int flags, + int borderMode, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_warpPerspective_MisInputArray( + IntPtr src, IntPtr dst, IntPtr m, Size dsize, int flags, int borderMode, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_warpPerspective_MisArray( + IntPtr src, IntPtr dst, [MarshalAs(UnmanagedType.LPArray)] float[,] m, int mRow, int mCol, + Size dsize, int flags, int borderMode, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_remap(IntPtr src, IntPtr dst, IntPtr map1, IntPtr map2, int interpolation, + int borderMode, Scalar borderValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convertMaps(IntPtr map1, IntPtr map2, IntPtr dstmap1, IntPtr dstmap2, + MatType dstmap1Type, int nninterpolation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getRotationMatrix2D(Point2f center, double angle, double scale, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_invertAffineTransform(IntPtr m, IntPtr im); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getPerspectiveTransform1(Point2f[] src, Point2f[] dst, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getPerspectiveTransform2(IntPtr src, IntPtr dst, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getAffineTransform1(Point2f[] src, Point2f[] dst, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getAffineTransform2(IntPtr src, IntPtr dst, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getRectSubPix(IntPtr image, Size patchSize, Point2f center, IntPtr patch, + int patchType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_logPolar( + IntPtr src, IntPtr dst, Point2f center, double m, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_linearPolar( + IntPtr src, IntPtr dst, Point2f center, double maxRadius, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_warpPolar( + IntPtr src, IntPtr dst, Size dsize, Point2f center, double maxRadius, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_integral1(IntPtr src, IntPtr sum, int sdepth); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_integral2(IntPtr src, IntPtr sum, IntPtr sqsum, int sdepth); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_integral3(IntPtr src, IntPtr sum, IntPtr sqsum, IntPtr tilted, int sdepth, int sqdepth); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_accumulate(IntPtr src, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_accumulateSquare(IntPtr src, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_accumulateProduct(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_accumulateWeighted(IntPtr src, IntPtr dst, double alpha, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_phaseCorrelate(IntPtr src1, IntPtr src2, IntPtr window, + out double response, out Point2d returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_createHanningWindow(IntPtr dst, Size winSize, MatType type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_threshold(IntPtr src, IntPtr dst, double thresh, double maxval, int type, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_adaptiveThreshold(IntPtr src, IntPtr dst, + double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double c); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_pyrDown(IntPtr src, IntPtr dst, Size dstsize, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_buildPyramid(IntPtr src, IntPtr dst, int maxlevel, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_pyrUp(IntPtr src, IntPtr dst, Size dstsize, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_calcHist(IntPtr[] images, int nimages, + int[] channels, IntPtr mask, IntPtr hist, int dims, int[] histSize, + IntPtr[] ranges, int uniform, int accumulate); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_calcBackProject(IntPtr[] images, int nimages, + int[] channels, IntPtr hist, IntPtr backProject, IntPtr[] ranges, int uniform); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_compareHist(IntPtr h1, IntPtr h2, int method, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_equalizeHist(IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_EMD(IntPtr signature1, IntPtr signature2, + int distType, IntPtr cost, out float lowerBound, IntPtr flow, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_watershed(IntPtr image, IntPtr markers); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_pyrMeanShiftFiltering(IntPtr src, IntPtr dst, + double sp, double sr, int maxLevel, TermCriteria termcrit); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_grabCut(IntPtr img, IntPtr mask, Rect rect, + IntPtr bgdModel, IntPtr fgdModel, + int iterCount, int mode); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_distanceTransformWithLabels(IntPtr src, IntPtr dst, IntPtr labels, + int distanceType, int maskSize, int labelType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_distanceTransform(IntPtr src, IntPtr dst, + int distanceType, int maskSize, int dstType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_floodFill1(IntPtr image, + Point seedPoint, Scalar newVal, out Rect rect, + Scalar loDiff, Scalar upDiff, int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_floodFill2(IntPtr image, IntPtr mask, + Point seedPoint, Scalar newVal, out Rect rect, + Scalar loDiff, Scalar upDiff, int flags, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_blendLinear( + IntPtr src1, IntPtr src2, IntPtr weights1, IntPtr weights2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_cvtColor(IntPtr src, IntPtr dst, int code, int dstCn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_cvtColorTwoPlane(IntPtr src1, IntPtr src2, IntPtr dst, int code); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_demosaicing(IntPtr src, IntPtr dst, int code, int dstCn); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_moments(IntPtr arr, int binaryImage, out Moments.NativeStruct returnValue); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_HuMoments(ref Moments.NativeStruct moments, [MarshalAs(UnmanagedType.LPArray)] double[] hu); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_matchTemplate( + IntPtr image, IntPtr templ, IntPtr result, int method, IntPtr mask); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_connectedComponentsWithAlgorithm( + IntPtr image, IntPtr labels, int connectivity, MatType ltype, int ccltype, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_connectedComponents( + IntPtr image, IntPtr labels, int connectivity, MatType ltype, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_connectedComponentsWithStatsWithAlgorithm( + IntPtr image, IntPtr labels, IntPtr stats, IntPtr centroids, int connectivity, MatType ltype, int ccltype, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_connectedComponentsWithStats( + IntPtr image, IntPtr labels, IntPtr stats, IntPtr centroids, int connectivity, MatType ltype, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_findContours1_vector(IntPtr image, IntPtr contours, + IntPtr hierarchy, int mode, int method, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_findContours1_OutputArray(IntPtr image, IntPtr contours, + IntPtr hierarchy, int mode, int method, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_findContours2_vector(IntPtr image, IntPtr contours, + int mode, int method, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_findContours2_OutputArray(IntPtr image, IntPtr contours, + int mode, int method, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_approxPolyDP_InputArray(IntPtr curve, IntPtr approxCurve, + double epsilon, int closed); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_approxPolyDP_Point(Point[] curve, int curveLength, + IntPtr approxCurve, double epsilon, int closed); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_approxPolyDP_Point2f(Point2f[] curve, int curveLength, + IntPtr approxCurve, double epsilon, int closed); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_arcLength_InputArray(IntPtr curve, int closed, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_arcLength_Point(Point[] curve, int curveLength, int closed, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_arcLength_Point2f(Point2f[] curve, int curveLength, int closed, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_boundingRect_InputArray(IntPtr curve, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_boundingRect_Point(Point[] curve, int curveLength, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_boundingRect_Point2f(Point2f[] curve, int curveLength, out Rect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_contourArea_InputArray(IntPtr contour, int oriented, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_contourArea_Point( + [MarshalAs(UnmanagedType.LPArray)] Point[] contour, int contourLength, int oriented, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_contourArea_Point2f( + [MarshalAs(UnmanagedType.LPArray)] Point2f[] contour, int contourLength, int oriented, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minAreaRect_InputArray(IntPtr points, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minAreaRect_Point( + [MarshalAs(UnmanagedType.LPArray)] Point[] points, int pointsLength, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minAreaRect_Point2f( + [MarshalAs(UnmanagedType.LPArray)] Point2f[] points, int pointsLength, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_boxPoints_OutputArray(RotatedRect box, IntPtr points); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_boxPoints_Point2f(RotatedRect box, [MarshalAs(UnmanagedType.LPArray), Out] Point2f[] points); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minEnclosingCircle_InputArray(IntPtr points, out Point2f center, + out float radius); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minEnclosingCircle_Point(Point[] points, int pointsLength, + out Point2f center, out float radius); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minEnclosingCircle_Point2f(Point2f[] points, int pointsLength, + out Point2f center, out float radius); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minEnclosingTriangle_InputOutputArray(IntPtr points, IntPtr triangle, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minEnclosingTriangle_Point( + [MarshalAs(UnmanagedType.LPArray), In] Point[] points, int pointsLength, IntPtr triangle, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_minEnclosingTriangle_Point2f( + [MarshalAs(UnmanagedType.LPArray), In] Point2f[] points, int pointsLength, IntPtr triangle, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_matchShapes_InputArray( + IntPtr contour1, IntPtr contour2, int method, double parameter, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_matchShapes_Point( + Point[] contour1, int contour1Length, Point[] contour2, int contour2Length, int method, double parameter, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexHull_InputArray(IntPtr points, IntPtr hull, + int clockwise, int returnPoints); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexHull_Point_ReturnsPoints(Point[] points, int pointsLength, + IntPtr hull, int clockwise); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexHull_Point2f_ReturnsPoints(Point2f[] points, int pointsLength, + IntPtr hull, int clockwise); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexHull_Point_ReturnsIndices(Point[] points, int pointsLength, + IntPtr hull, int clockwise); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexHull_Point2f_ReturnsIndices(Point2f[] points, int pointsLength, + IntPtr hull, int clockwise); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexityDefects_InputArray(IntPtr contour, IntPtr convexHull, + IntPtr convexityDefects); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexityDefects_Point(Point[] contour, int contourLength, int[] convexHull, + int convexHullLength, IntPtr convexityDefects); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_convexityDefects_Point2f(Point2f[] contour, int contourLength, + int[] convexHull, int convexHullLength, IntPtr convexityDefects); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_isContourConvex_InputArray(IntPtr contour, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_isContourConvex_Point(Point[] contour, int contourLength, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_isContourConvex_Point2f(Point2f[] contour, int contourLength, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_intersectConvexConvex_InputArray(IntPtr p1, IntPtr p2, + IntPtr p12, int handleNested, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_intersectConvexConvex_Point(Point[] p1, int p1Length, Point[] p2, + int p2Length, IntPtr p12, int handleNested, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_intersectConvexConvex_Point2f(Point2f[] p1, int p1Length, Point2f[] p2, + int p2Length, IntPtr p12, int handleNested, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipse_InputArray(IntPtr points, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipse_Point(Point[] points, int pointsLength, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipse_Point2f(Point2f[] points, int pointsLength, out RotatedRect returnValue); + + // Not exported + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipseAMS_InputArray(IntPtr points, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipseAMS_Point(Point[] points, int pointsLength, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipseAMS_Point2f(Point2f[] points, int pointsLength, out RotatedRect returnValue); + + // Not exported + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipseDirect_InputArray(IntPtr points, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipseDirect_Point(Point[] points, int pointsLength, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitEllipseDirect_Point2f(Point2f[] points, int pointsLength, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitLine_InputArray(IntPtr points, IntPtr line, + int distType, double param, double reps, double aeps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitLine_Point(Point[] points, int pointsLength, [In, Out] float[] line, + int distType, + double param, double reps, double aeps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitLine_Point2f(Point2f[] points, int pointsLength, [In, Out] float[] line, + int distType, double param, double reps, double aeps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitLine_Point3i(Point3i[] points, int pointsLength, [In, Out] float[] line, + int distType, double param, double reps, double aeps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fitLine_Point3f(Point3f[] points, int pointsLength, [In, Out] float[] line, + int distType, double param, double reps, double aeps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_pointPolygonTest_InputArray( + IntPtr contour, Point2f pt, int measureDist, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_pointPolygonTest_Point(Point[] contour, int contourLength, Point2f pt, + int measureDist, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_pointPolygonTest_Point2f(Point2f[] contour, int contourLength, + Point2f pt, int measureDist, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_rotatedRectangleIntersection_OutputArray( + RotatedRect rect1, RotatedRect rect2, IntPtr intersectingRegion, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_rotatedRectangleIntersection_vector( + RotatedRect rect1, RotatedRect rect2, IntPtr intersectingRegion, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_applyColorMap1(IntPtr src, IntPtr dst, int colormap); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_applyColorMap2(IntPtr src, IntPtr dst, IntPtr userColor); + + #region Drawing + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_line( + IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_arrowedLine( + IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift, double tipLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_rectangle_InputOutputArray_Point( + IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_rectangle_InputOutputArray_Rect( + IntPtr img, Rect rect, Scalar color, int thickness, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_rectangle_Mat_Point( + IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_rectangle_Mat_Rect( + IntPtr img, Rect rect, Scalar color, int thickness, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_circle(IntPtr img, Point center, int radius, Scalar color, int thickness, + int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_ellipse1( + IntPtr img, Point center, Size axes, + double angle, double startAngle, double endAngle, Scalar color, int thickness, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_ellipse2( + IntPtr img, RotatedRect box, Scalar color, int thickness, int lineType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_drawMarker( + IntPtr img, Point position, Scalar color, int markerType, int markerSize, int thickness, int lineType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fillConvexPoly_Mat( + IntPtr img, Point[] pts, int npts, Scalar color, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fillConvexPoly_InputOutputArray( + IntPtr img, IntPtr points, Scalar color, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fillPoly_Mat( + IntPtr img, IntPtr[] pts, int[] npts, int ncontours, + Scalar color, int lineType, int shift, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_fillPoly_InputOutputArray( + IntPtr img, IntPtr pts, Scalar color, int lineType, int shift, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_polylines_Mat( + IntPtr img, IntPtr[] pts, int[] npts, + int ncontours, int isClosed, Scalar color, int thickness, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_polylines_InputOutputArray( + IntPtr img, IntPtr pts, int isClosed, Scalar color, int thickness, int lineType, int shift); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_drawContours_vector(IntPtr image, + IntPtr[] contours, int contoursSize1, int[] contoursSize2, + int contourIdx, Scalar color, int thickness, int lineType, + Vec4i[] hierarchy, int hiearchyLength, int maxLevel, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_drawContours_vector(IntPtr image, + IntPtr[] contours, int contoursSize1, int[] contoursSize2, + int contourIdx, Scalar color, int thickness, int lineType, + IntPtr hierarchy, int hiearchyLength, int maxLevel, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_drawContours_InputArray(IntPtr image, + IntPtr[] contours, int contoursLength, + int contourIdx, Scalar color, int thickness, int lineType, + IntPtr hierarchy, int maxLevel, Point offset); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_clipLine1(Size imgSize, ref Point pt1, ref Point pt2, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_clipLine2(Rect imgRect, ref Point pt1, ref Point pt2, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_ellipse2Poly_int( + Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, IntPtr pts); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_ellipse2Poly_double( + Point2d center, Size2d axes, int angle, int arcStart, int arcEnd, int delta, IntPtr pts); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_putText(IntPtr img, [MarshalAs(UnmanagedType.LPStr)] string text, Point org, + int fontFace, double fontScale, Scalar color, + int thickness, int lineType, int bottomLeftOrigin); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, + ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getTextSize([MarshalAs(UnmanagedType.LPStr)] string text, int fontFace, + double fontScale, int thickness, out int baseLine, out Size returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_getFontScaleFromHeight( + int fontFace, int pixelHeight, int thickness, out double returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_CLAHE.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_CLAHE.cs new file mode 100644 index 000000000..418a3a7b7 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_CLAHE.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_createCLAHE(double clipLimit, Size tileGridSize, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Ptr_CLAHE_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Ptr_CLAHE_get(IntPtr obj, out IntPtr returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_CLAHE_apply(IntPtr obj, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_CLAHE_setClipLimit(IntPtr obj, double clipLimit); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_CLAHE_getClipLimit(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_CLAHE_setTilesGridSize(IntPtr obj, Size tileGridSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_CLAHE_getTilesGridSize(IntPtr obj, out Size returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_CLAHE_collectGarbage(IntPtr obj); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_GeneralizedHough.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_GeneralizedHough.cs new file mode 100644 index 000000000..9accb40db --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_GeneralizedHough.cs @@ -0,0 +1,187 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // GeneralizedHough + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setTemplate1( + IntPtr obj, IntPtr templ, Point templCenter); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setTemplate2( + IntPtr obj, IntPtr edges, IntPtr dx, IntPtr dy, Point templCenter); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_detect1( + IntPtr obj, IntPtr image, IntPtr positions, IntPtr votes); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_detect2( + IntPtr obj, IntPtr edges, IntPtr dx, IntPtr dy, IntPtr positions, IntPtr votes); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setCannyLowThresh(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_getCannyLowThresh(IntPtr obj, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setCannyHighThresh(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_getCannyHighThresh(IntPtr obj, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setMinDist(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_getMinDist(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setDp(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_getDp(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_setMaxBufferSize(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHough_getMaxBufferSize(IntPtr obj, out int returnValue); + + + + // GeneralizedHoughBallard + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_createGeneralizedHoughBallard(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Ptr_GeneralizedHoughBallard_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Ptr_GeneralizedHoughBallard_delete(IntPtr obj); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughBallard_setLevels(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughBallard_getLevels(IntPtr obj, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughBallard_setVotesThreshold(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughBallard_getVotesThreshold(IntPtr obj, out int returnValue); + + + + // GeneralizedHoughGuil + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_createGeneralizedHoughGuil(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Ptr_GeneralizedHoughGuil_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Ptr_GeneralizedHoughGuil_delete(IntPtr obj); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setXi(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getXi(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setLevels(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getLevels(IntPtr obj, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setAngleEpsilon(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getAngleEpsilon(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setMinAngle(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getMinAngle(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setMaxAngle(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getMaxAngle(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setAngleStep(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getAngleStep(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setAngleThresh(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getAngleThresh(IntPtr obj, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setMinScale(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getMinScale(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setMaxScale(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getMaxScale(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setScaleStep(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getScaleStep(IntPtr obj, out double returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setScaleThresh(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getScaleThresh(IntPtr obj, out int returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_setPosThresh(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_GeneralizedHoughGuil_getPosThresh(IntPtr obj, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_LineIterator.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_LineIterator.cs new file mode 100644 index 000000000..ed8f7a114 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_LineIterator.cs @@ -0,0 +1,80 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_new( + IntPtr img, Point pt1, Point pt2, int connectivity, int leftToRight, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_getValuePosAndShiftToNext( + IntPtr obj, out IntPtr returnValue, out Point returnPos); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_operatorEntity(IntPtr obj, out IntPtr returnValue); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_operatorPP(IntPtr obj); + + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_pos(IntPtr obj, out Point returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_ptr_get(IntPtr obj, out IntPtr returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_ptr_set(IntPtr obj, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_ptr0_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_step_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_step_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_elemSize_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_elemSize_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_err_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_err_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_count_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_count_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_minusDelta_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_minusDelta_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_plusDelta_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_plusDelta_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_minusStep_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_minusStep_set(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_LineIterator_plusStep_get(IntPtr obj, out int returnValue); + //[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + //public static extern ExceptionStatus imgproc_LineIterator_plusStep_set(IntPtr obj, int val); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_LineSegmentDetector.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_LineSegmentDetector.cs new file mode 100644 index 000000000..e9fa7684e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_LineSegmentDetector.cs @@ -0,0 +1,38 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void imgproc_LineSegmentDetector_detect_OutputArray(IntPtr obj, IntPtr image, IntPtr lines, + IntPtr width, IntPtr prec, IntPtr nfa); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void imgproc_LineSegmentDetector_detect_vector(IntPtr obj, IntPtr image, IntPtr lines, + IntPtr width, IntPtr prec, IntPtr nfa); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void imgproc_LineSegmentDetector_drawSegments(IntPtr obj, IntPtr image, IntPtr lines); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int imgproc_LineSegmentDetector_compareSegments(IntPtr obj, Size size, + IntPtr lines1, IntPtr lines2, IntPtr image); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr imgproc_createLineSegmentDetector( + int refine, double scale, double sigma_scale, double quant, double ang_th, + double log_eps, double density_th, int n_bins); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void imgproc_Ptr_LineSegmentDetector_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr imgproc_Ptr_LineSegmentDetector_get(IntPtr obj); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_Segmentation.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_Segmentation.cs new file mode 100644 index 000000000..5ee0f59b1 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_Segmentation.cs @@ -0,0 +1,65 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_new( + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_setWeights( + IntPtr obj, + float weight_non_edge, float weight_gradient_direction, float weight_gradient_magnitude); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_setGradientMagnitudeMaxLimit( + IntPtr obj, + float gradient_magnitude_threshold_max); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_setEdgeFeatureZeroCrossingParameters( + IntPtr obj, + float gradient_magnitude_min_value); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_setEdgeFeatureCannyParameters( + IntPtr obj, + double threshold1, double threshold2, + int apertureSize, int L2gradient); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_applyImage( + IntPtr obj, + IntPtr image); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_applyImageFeatures( + IntPtr obj, + IntPtr non_edge, + IntPtr gradient_direction, + IntPtr gradient_magnitude, + IntPtr image); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_buildMap( + IntPtr obj, + Point sourcePt); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_segmentation_IntelligentScissorsMB_getContour( + IntPtr obj, + Point targetPt, IntPtr contour, int backward); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_Subdiv2D.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_Subdiv2D.cs new file mode 100644 index 000000000..b0fef73d3 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/imgproc/NativeMethods_imgproc_Subdiv2D.cs @@ -0,0 +1,65 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_new2(Rect rect, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_initDelaunay(IntPtr obj, Rect rect); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_insert1(IntPtr obj, Point2f pt, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_insert2( + IntPtr obj, [MarshalAs(UnmanagedType.LPArray)] Point2f[] ptArray, int length); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_locate(IntPtr obj, Point2f pt, out int edge, out int vertex, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_findNearest(IntPtr obj, Point2f pt, out Point2f nearestPt, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_getEdgeList(IntPtr obj, IntPtr edgeList); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_getLeadingEdgeList(IntPtr obj, IntPtr leadingEdgeList); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_getTriangleList(IntPtr obj, IntPtr triangleList); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_getVoronoiFacetList( + IntPtr obj, [MarshalAs(UnmanagedType.LPArray), In] int[]? idx, int idxCount, + IntPtr facetList, IntPtr facetCenters); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_getVertex(IntPtr obj, int vertex, out int firstEdge, out Point2f returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_getEdge(IntPtr obj, int edge, int nextEdgeType, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_nextEdge(IntPtr obj, int edge, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_rotateEdge(IntPtr obj, int edge, int rotate, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_symEdge(IntPtr obj, int edge, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_edgeOrg(IntPtr obj, int edge, out Point2f orgPt, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus imgproc_Subdiv2D_edgeDst(IntPtr obj, int edge, out Point2f dstPt, out int returnValue); + +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_ANN_MLP.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_ANN_MLP.cs new file mode 100644 index 000000000..8bae21312 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_ANN_MLP.cs @@ -0,0 +1,82 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setTrainMethod(IntPtr obj, int method, double param1, double param2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getTrainMethod(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setActivationFunction(IntPtr obj, int type, double param1, double param2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setLayerSizes(IntPtr obj, IntPtr layerSizes); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getLayerSizes(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getTermCriteria(IntPtr obj, out TermCriteria returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setTermCriteria(IntPtr obj, TermCriteria val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getBackpropWeightScale(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setBackpropWeightScale(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getBackpropMomentumScale(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setBackpropMomentumScale(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getRpropDW0(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setRpropDW0(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getRpropDWPlus(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setRpropDWPlus(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getRpropDWMinus(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setRpropDWMinus(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getRpropDWMin(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setRpropDWMin(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getRpropDWMax(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_setRpropDWMax(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_getWeights(IntPtr obj, int layerIdx, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_create(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_ANN_MLP_delete(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_ANN_MLP_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_load(string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_ANN_MLP_loadFromString(string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_Boost.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_Boost.cs new file mode 100644 index 000000000..ed123f3dd --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_Boost.cs @@ -0,0 +1,42 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_getBoostType(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_setBoostType(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_getWeakCount(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_setWeakCount(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_getWeightTrimRate(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_setWeightTrimRate(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_Boost_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_Boost_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_load([MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Boost_loadFromString([MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_DTrees.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_DTrees.cs new file mode 100644 index 000000000..4ea7ba492 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_DTrees.cs @@ -0,0 +1,81 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getMaxCategories(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setMaxCategories(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getMaxDepth(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setMaxDepth(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getMinSampleCount(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setMinSampleCount(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getCVFolds(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setCVFolds(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getUseSurrogates(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setUseSurrogates(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getUse1SERule(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setUse1SERule(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getTruncatePrunedTree(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setTruncatePrunedTree(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getRegressionAccuracy(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setRegressionAccuracy(IntPtr obj, float val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getPriors(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_setPriors(IntPtr obj, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getRoots(IntPtr obj, IntPtr result); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getNodes(IntPtr obj, IntPtr result); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getSplits(IntPtr obj, IntPtr result); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_getSubsets(IntPtr obj, IntPtr result); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_DTrees_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_DTrees_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_load([MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_DTrees_loadFromString([MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_EM.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_EM.cs new file mode 100644 index 000000000..5e3e5645e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_EM.cs @@ -0,0 +1,68 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1720 // Identifiers should not contain type names +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_getClustersNumber(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_setClustersNumber(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_getCovarianceMatrixType(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_setCovarianceMatrixType(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_getTermCriteria(IntPtr obj, out TermCriteria returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_setTermCriteria(IntPtr obj, TermCriteria val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_getWeights(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_getMeans(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_getCovs(IntPtr obj, IntPtr covs); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_predict2(IntPtr model, IntPtr sample, IntPtr probs, out Vec2d returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_trainEM( + IntPtr obj, IntPtr samples, IntPtr logLikelihoods, IntPtr labels, IntPtr probs, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_trainE( + IntPtr model, IntPtr samples, IntPtr means0, IntPtr covs0, IntPtr weights0, + IntPtr logLikelihoods, IntPtr labels, IntPtr probs, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_trainM( + IntPtr model, IntPtr samples, IntPtr probs0, IntPtr logLikelihoods, + IntPtr labels, IntPtr probs, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_create(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_EM_get(IntPtr ptr, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_EM_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_load( + [MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_EM_loadFromString( + [MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_KNearest.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_KNearest.cs new file mode 100644 index 000000000..857536388 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_KNearest.cs @@ -0,0 +1,51 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_getDefaultK(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_setDefaultK(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_getIsClassifier(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_setIsClassifier(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_getEmax(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_setEmax(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_getAlgorithmType(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_setAlgorithmType(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_findNearest(IntPtr obj, IntPtr samples, int k, + IntPtr results, IntPtr neighborResponses, IntPtr dist, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_KNearest_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_KNearest_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_load([MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_KNearest_loadFromString([MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_LogisticRegression.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_LogisticRegression.cs new file mode 100644 index 000000000..552b063b4 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_LogisticRegression.cs @@ -0,0 +1,66 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_getLearningRate(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_setLearningRate(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_getIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_setIterations(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_getRegularization(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_setRegularization(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_getTrainMethod(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_setTrainMethod(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_getMiniBatchSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_setMiniBatchSize(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_getTermCriteria(IntPtr obj, out TermCriteria returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_setTermCriteria(IntPtr obj, TermCriteria val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_predict( + IntPtr obj, IntPtr samples, IntPtr results, int flags, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_get_learnt_thetas(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_LogisticRegression_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_LogisticRegression_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_load( + [MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_LogisticRegression_loadFromString( + [MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_NormalBayesClassifier.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_NormalBayesClassifier.cs new file mode 100644 index 000000000..ed9723df5 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_NormalBayesClassifier.cs @@ -0,0 +1,34 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_NormalBayesClassifier_predictProb( + IntPtr obj, IntPtr inputs, + IntPtr samples, IntPtr outputProbs, int flags, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_NormalBayesClassifier_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_NormalBayesClassifier_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_NormalBayesClassifier_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_NormalBayesClassifier_load( + [MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_NormalBayesClassifier_loadFromString( + [MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_RTrees.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_RTrees.cs new file mode 100644 index 000000000..a989a5ed9 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_RTrees.cs @@ -0,0 +1,47 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_getCalculateVarImportance(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_setCalculateVarImportance(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_getActiveVarCount(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_setActiveVarCount(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_getTermCriteria(IntPtr obj, out TermCriteria returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_setTermCriteria(IntPtr obj, TermCriteria val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_getVarImportance(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_RTrees_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_RTrees_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_load( + [MarshalAs(UnmanagedType.LPStr)] string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_RTrees_loadFromString( + [MarshalAs(UnmanagedType.LPStr)] string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_SVM.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_SVM.cs new file mode 100644 index 000000000..8693e4600 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_SVM.cs @@ -0,0 +1,90 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using OpenCvSharp.ML; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getType(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setType(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getGamma(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setGamma(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getCoef0(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setCoef0(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getDegree(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setDegree(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getC(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setC(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getP(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setP(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getNu(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setNu(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getClassWeights(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setClassWeights(IntPtr obj, IntPtr val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getTermCriteria(IntPtr obj, out TermCriteria returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setTermCriteria(IntPtr obj, TermCriteria val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getKernelType(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_setKernel(IntPtr obj, int kernelType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getSupportVectors(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getDecisionFunction( + IntPtr obj, int i, IntPtr alpha, IntPtr svidx, out double returnValue); + + // static + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_getDefaultGrid(int paramId, out ParamGrid returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_create(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_SVM_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_Ptr_SVM_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_load(string filePath, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_SVM_loadFromString(string strModel, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_StatModel.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_StatModel.cs new file mode 100644 index 000000000..f762b6f7b --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ml/NativeMethods_ml_StatModel.cs @@ -0,0 +1,42 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_clear(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_getVarCount(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_empty(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_isTrained(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_isClassifier(IntPtr obj, out int returnValue); + + /*[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_train1( + IntPtr obj, IntPtr trainData, int flags, out int returnValue);*/ + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_train2( + IntPtr obj, IntPtr samples, int layout, IntPtr responses, out int returnValue); + + /*[Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_calcError( + IntPtr obj, IntPtr data, int test, IntPtr resp, out float returnValue);*/ + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ml_StatModel_predict( + IntPtr obj, IntPtr samples, IntPtr results, int flags, out float returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect.cs new file mode 100644 index 000000000..d6168155e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect.cs @@ -0,0 +1,30 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_groupRectangles1(IntPtr rectList, int groupThreshold, double eps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_groupRectangles2(IntPtr rectList, IntPtr weights, int groupThreshold, double eps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_groupRectangles3( + IntPtr rectList, int groupThreshold, double eps, IntPtr weights, IntPtr levelWeights); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_groupRectangles4( + IntPtr rectList, IntPtr rejectLevels, IntPtr levelWeights, int groupThreshold, double eps); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_groupRectangles_meanshift( + IntPtr rectList, IntPtr foundWeights, IntPtr foundScales, double detectThreshold, Size winDetSize); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_CascadeClassfier.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_CascadeClassfier.cs new file mode 100644 index 000000000..43a6775fe --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_CascadeClassfier.cs @@ -0,0 +1,54 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_read(IntPtr obj, IntPtr fn, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_new(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_newFromFile( + [MarshalAs(UnmanagedType.LPStr)] string fileName, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_empty(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_load( + IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fileName, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_detectMultiScale1( + IntPtr obj, IntPtr image, IntPtr objects, + double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_detectMultiScale2( + IntPtr obj, IntPtr image, IntPtr objects, + IntPtr rejectLevels, IntPtr levelWeights, + double scaleFactor, int minNeighbors, int flags, + Size minSize, Size maxSize, int outputRejectLevels); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_isOldFormatCascade(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_getOriginalWindowSize(IntPtr obj, out Size returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_CascadeClassifier_getFeatureType(IntPtr obj, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_HOGDescriptor.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_HOGDescriptor.cs new file mode 100644 index 000000000..245cf6382 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_HOGDescriptor.cs @@ -0,0 +1,142 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_new2( + Size winSize, Size blockSize, Size blockStride, Size cellSize, + int nbins, int derivAperture, double winSigma, [MarshalAs(UnmanagedType.I4)] HistogramNormType histogramNormType, + double l2HysThreshold, int gammaCorrection, int nlevels, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_new3( + [MarshalAs(UnmanagedType.LPStr)] string fileName, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_delete(IntPtr self); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_getDescriptorSize(IntPtr self, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_checkDetectorSize(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_getWinSigma(IntPtr self, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_setSVMDetector(IntPtr self, IntPtr svmDetector); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_load( + IntPtr self, [MarshalAs(UnmanagedType.LPStr)] string filename, [MarshalAs(UnmanagedType.LPStr)] string? objName, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_save( + IntPtr self, [MarshalAs(UnmanagedType.LPStr)] string filename, [MarshalAs(UnmanagedType.LPStr)] string? objName); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_compute( + IntPtr self, IntPtr img, IntPtr descriptors, + Size winStride, Size padding, [In] Point[]? locations, int locationsLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_detect1( + IntPtr self, IntPtr img, IntPtr foundLocations, + double hitThreshold, Size winStride, Size padding, [In] Point[]? searchLocations, int searchLocationsLength); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_detect2( + IntPtr self, IntPtr img, IntPtr foundLocations, IntPtr weights, + double hitThreshold, Size winStride, Size padding, [In] Point[]? searchLocations, int searchLocationsLength); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_detectMultiScale1( + IntPtr self, IntPtr img, IntPtr foundLocations, + double hitThreshold, Size winStride, Size padding, double scale, int groupThreshold); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_detectMultiScale2( + IntPtr self, IntPtr img, IntPtr foundLocations, IntPtr foundWeights, + double hitThreshold, Size winStride, Size padding, double scale, int groupThreshold); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_computeGradient( + IntPtr self, IntPtr img, IntPtr grad, IntPtr angleOfs, Size paddingTL, Size paddingBR); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_detectROI( + IntPtr obj, IntPtr img, + Point[] locations, int locationsLength, + IntPtr foundLocations, IntPtr confidences, + double hitThreshold, Size winStride, Size padding); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_detectMultiScaleROI( + IntPtr obj, IntPtr img, IntPtr foundLocations, + IntPtr roiScales, IntPtr roiLocations, IntPtr roiConfidences, + double hitThreshold, int groupThreshold); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_groupRectangles(IntPtr obj, + IntPtr rectList, IntPtr weights, int groupThreshold, double eps); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_winSize_get(IntPtr self, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_blockSize_get(IntPtr self, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_blockStride_get(IntPtr self, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_cellSize_get(IntPtr self, out Size returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_nbins_get(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_derivAperture_get(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_winSigma_get(IntPtr self, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_histogramNormType_get(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_L2HysThreshold_get(IntPtr self, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_gammaCorrection_get(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_nlevels_get(IntPtr self, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_signedGradient_get(IntPtr self, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_winSize_set(IntPtr self, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_blockSize_set(IntPtr self, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_blockStride_set(IntPtr self, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_cellSize_set(IntPtr self, Size value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_nbins_set(IntPtr self, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_derivAperture_set(IntPtr self, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_winSigma_set(IntPtr self, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_histogramNormType_set(IntPtr self, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_L2HysThreshold_set(IntPtr self, double value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_gammaCorrection_set(IntPtr self, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_nlevels_set(IntPtr self, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_HOGDescriptor_signedGradient_set(IntPtr self, int value); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_QRCodeDetector.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_QRCodeDetector.cs new file mode 100644 index 000000000..58aef2c8f --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/objdetect/NativeMethods_objdetect_QRCodeDetector.cs @@ -0,0 +1,47 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_new(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_setEpsX(IntPtr obj, double epsX); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_setEpsY(IntPtr obj, double epsY); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_detect(IntPtr obj, IntPtr img, IntPtr points, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_decode( + IntPtr obj, IntPtr img, IntPtr points, IntPtr straightQrCode, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_detectAndDecode( + IntPtr obj, IntPtr img, IntPtr points, + IntPtr straightQrCode, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_detectMulti(IntPtr obj, IntPtr img, IntPtr points, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_decodeMulti( + IntPtr obj, IntPtr img, IntPtr points, IntPtr decodedInfo, IntPtr straightQrCode, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus objdetect_QRCodeDetector_decodeMulti_NoStraightQrCode( + IntPtr obj, IntPtr img, IntPtr points, IntPtr decodedInfo, out int returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo.cs new file mode 100644 index 000000000..16c414053 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo.cs @@ -0,0 +1,81 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_inpaint( + IntPtr src, IntPtr inpaintMask, + IntPtr dst, double inpaintRadius, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_fastNlMeansDenoising( + IntPtr src, IntPtr dst, float h, + int templateWindowSize, int searchWindowSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_fastNlMeansDenoisingColored( + IntPtr src, IntPtr dst, + float h, float hColor, int templateWindowSize, int searchWindowSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_fastNlMeansDenoisingMulti( + IntPtr[] srcImgs, int srcImgsLength, + IntPtr dst, int imgToDenoiseIndex, int temporalWindowSize, + float h, int templateWindowSize, int searchWindowSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_fastNlMeansDenoisingColoredMulti(IntPtr[] srcImgs, int srcImgsLength, + IntPtr dst, int imgToDenoiseIndex, int temporalWindowSize, + float h, float hColor, int templateWindowSize, int searchWindowSize); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_denoise_TVL1( + IntPtr[] observations, int observationsSize, IntPtr result, double lambda, int niters); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_decolor( + IntPtr src, IntPtr grayscale, IntPtr color_boost); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_seamlessClone( + IntPtr src, IntPtr dst, IntPtr mask, Point p, IntPtr blend, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_colorChange( + IntPtr src, IntPtr mask, IntPtr dst, float red_mul, float green_mul, float blue_mul); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_illuminationChange( + IntPtr src, IntPtr mask, IntPtr dst, float alpha, float beta); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_textureFlattening( + IntPtr src, IntPtr mask, IntPtr dst, + float low_threshold, float high_threshold, int kernel_size); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_edgePreservingFilter( + IntPtr src, IntPtr dst, int flags, float sigma_s, float sigma_r); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_detailEnhance( + IntPtr src, IntPtr dst, float sigma_s, float sigma_r); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_pencilSketch( + IntPtr src, IntPtr dst1, IntPtr dst2, + float sigma_s, float sigma_r, float shade_factor); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_stylization( + IntPtr src, IntPtr dst, float sigma_s, float sigma_r); + +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo_HDR.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo_HDR.cs new file mode 100644 index 000000000..3f66ae425 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo_HDR.cs @@ -0,0 +1,94 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // CalibrateDebevec + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_createCalibrateDebevec(int samples, float lambda, int random, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_CalibrateDebevec_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_CalibrateDebevec_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateDebevec_getLambda(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateDebevec_setLambda(IntPtr obj, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateDebevec_getSamples(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateDebevec_setSamples(IntPtr obj, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateDebevec_getRandom(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateDebevec_setRandom(IntPtr obj, int value); + + // CalibrateRobertson + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_createCalibrateRobertson(int maxIter, float threshold, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_CalibrateRobertson_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_CalibrateRobertson_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateRobertson_getMaxIter(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateRobertson_setMaxIter(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateRobertson_getThreshold(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateRobertson_setThreshold(IntPtr obj, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateRobertson_getRadiance(IntPtr obj, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_CalibrateCRF_process( + IntPtr obj, IntPtr[] srcImgs, int srcImgsLength, IntPtr dst, [In, MarshalAs(UnmanagedType.LPArray)] float[] times); + + // TODO Exception Handling + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr photo_createMergeDebevec(); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void photo_Ptr_MergeDebevec_delete(IntPtr obj); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr photo_Ptr_MergeDebevec_get(IntPtr obj); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr photo_createMergeMertens(); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void photo_Ptr_MergeMertens_delete(IntPtr obj); + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr photo_Ptr_MergeMertens_get(IntPtr obj); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void photo_MergeExposures_process( + IntPtr obj, IntPtr[] srcImgs, int srcImgsLength, IntPtr dst, [In, MarshalAs(UnmanagedType.LPArray)] float[] times, IntPtr response); + + [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern IntPtr photo_MergeMertens_process(IntPtr obj, IntPtr[] srcImgs, int srcImgsLength, IntPtr dst); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo_Tonemap.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo_Tonemap.cs new file mode 100644 index 000000000..6205f4594 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/photo/NativeMethods_photo_Tonemap.cs @@ -0,0 +1,126 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region Tonemap + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Tonemap_process(IntPtr obj, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Tonemap_getGamma(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Tonemap_setGamma(IntPtr obj, float gamma); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_createTonemap(float gamma, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_Tonemap_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_Tonemap_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region TonemapDrago + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapDrago_getSaturation(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapDrago_setSaturation(IntPtr obj, float saturation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapDrago_getBias(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapDrago_setBias(IntPtr obj, float bias); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_createTonemapDrago( + float gamma, float saturation, float bias, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_TonemapDrago_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_TonemapDrago_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region TonemapReinhard + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapReinhard_getIntensity( + IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapReinhard_setIntensity( + IntPtr obj, float intensity); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapReinhard_getLightAdaptation( + IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapReinhard_setLightAdaptation( + IntPtr obj, float light_adapt); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapReinhard_getColorAdaptation( + IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapReinhard_setColorAdaptation( + IntPtr obj, float color_adapt); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_createTonemapReinhard( + float gamma, float intensity, float light_adapt, float color_adapt, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_TonemapReinhard_delete( + IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_TonemapReinhard_get( + IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region TonemapMantiuk + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapMantiuk_getScale(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapMantiuk_setScale(IntPtr obj, float scale); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapMantiuk_getSaturation(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_TonemapMantiuk_setSaturation(IntPtr obj, float saturation); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_createTonemapMantiuk( + float gamma, float scale, float saturation, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_TonemapMantiuk_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus photo_Ptr_TonemapMantiuk_get(IntPtr ptr, out IntPtr returnValue); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/shape/NativeMethods_shape_ShapeDistanceExtractor.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/shape/NativeMethods_shape_ShapeDistanceExtractor.cs new file mode 100644 index 000000000..e84a32e2f --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/shape/NativeMethods_shape_ShapeDistanceExtractor.cs @@ -0,0 +1,109 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // ShapeDistanceExtractor + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeDistanceExtractor_computeDistance( + IntPtr obj, IntPtr contour1, IntPtr contour2, out float returnValue); + + // ShapeContextDistanceExtractor + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_Ptr_ShapeContextDistanceExtractor_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_Ptr_ShapeContextDistanceExtractor_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setAngularBins(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getAngularBins(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setRadialBins(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getRadialBins(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setInnerRadius(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getInnerRadius(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setOuterRadius(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getOuterRadius(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setRotationInvariant(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getRotationInvariant(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setShapeContextWeight(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getShapeContextWeight(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setImageAppearanceWeight(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getImageAppearanceWeight(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setBendingEnergyWeight(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getBendingEnergyWeight(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setImages(IntPtr obj, IntPtr image1, IntPtr image2); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getImages(IntPtr obj, IntPtr image1, IntPtr image2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setIterations(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getIterations(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_setStdDev(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_ShapeContextDistanceExtractor_getStdDev(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_createShapeContextDistanceExtractor( + int nAngularBins, int nRadialBins, + float innerRadius, float outerRadius, int iterations /*, + const Ptr &comparer = createChiHistogramCostExtractor(), + const Ptr &transformer = createThinPlateSplineShapeTransformer()*/, out IntPtr returnValue); + + + // HausdorffDistanceExtractor + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_Ptr_HausdorffDistanceExtractor_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_Ptr_HausdorffDistanceExtractor_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_HausdorffDistanceExtractor_setDistanceFlag(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_HausdorffDistanceExtractor_getDistanceFlag(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_HausdorffDistanceExtractor_setRankProportion(IntPtr obj, float val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_HausdorffDistanceExtractor_getRankProportion(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus shape_createHausdorffDistanceExtractor(int distanceFlag, float rankProp, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/stitching/NativeMethods_stitching.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/stitching/NativeMethods_stitching.cs new file mode 100644 index 000000000..2b10cc510 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/stitching/NativeMethods_stitching.cs @@ -0,0 +1,97 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_create(int mode, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Ptr_Stitcher_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Ptr_Stitcher_get(IntPtr obj, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_registrationResol(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_setRegistrationResol(IntPtr obj, double resolMpx); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_seamEstimationResol(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_setSeamEstimationResol(IntPtr obj, double resolMpx); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_compositingResol(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_setCompositingResol(IntPtr obj, double resolMpx); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_panoConfidenceThresh(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_setPanoConfidenceThresh(IntPtr obj, double confThresh); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_waveCorrection(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_setWaveCorrection(IntPtr obj, int flag); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_waveCorrectKind(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_setWaveCorrectKind(IntPtr obj, int kind); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_estimateTransform_InputArray1( + IntPtr obj, IntPtr images, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_estimateTransform_InputArray2( + IntPtr obj, IntPtr images, + IntPtr[] rois, int roisSize1, int[] roisSize2, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_estimateTransform_MatArray1( + IntPtr obj, IntPtr[] images, int imagesSize, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_estimateTransform_MatArray2( + IntPtr obj, IntPtr[] images, int imagesSize, + IntPtr[] rois, int roisSize1, int[] roisSize2, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_composePanorama1( + IntPtr obj, IntPtr pano, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_composePanorama2_InputArray( + IntPtr obj, IntPtr images, IntPtr pano, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_composePanorama2_MatArray( + IntPtr obj, IntPtr[] images, int imagesSize, IntPtr pano, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_stitch1_InputArray( + IntPtr obj, IntPtr images, IntPtr pano, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_stitch1_MatArray( + IntPtr obj, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] images, int imagesSize, + IntPtr pano, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_stitch2_InputArray( + IntPtr obj, IntPtr images, + IntPtr[] rois, int roisSize1, int[] roisSize2, + IntPtr pano, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_stitch2_MatArray( + IntPtr obj, IntPtr[] images, int imagesSize, + IntPtr[] rois, int roisSize1, int[] roisSize2, + IntPtr pano, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_component(IntPtr obj, IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_Stitcher_workScale(IntPtr obj, out double returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/stitching/NativeMethods_stitching_Matchers.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/stitching/NativeMethods_stitching_Matchers.cs new file mode 100644 index 000000000..8c1989c1e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/stitching/NativeMethods_stitching_Matchers.cs @@ -0,0 +1,90 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using OpenCvSharp.Detail; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_computeImageFeatures1( + IntPtr featuresFinder, + IntPtr[] images, + int imagesLength, + IntPtr featuresVec, + IntPtr[]? masks); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus stitching_computeImageFeatures2( + IntPtr featuresFinder, + IntPtr image, + WImageFeatures* features, + IntPtr mask); + + + // FeaturesMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_FeaturesMatcher_apply( + IntPtr obj, + ref WImageFeatures features1, + ref WImageFeatures features2, + out int outSrcImgIdx, + out int outDstImgIdx, + IntPtr outMatches, + IntPtr outInliersMask, + out int outNumInliers, + IntPtr outH, + out double outConfidence); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_FeaturesMatcher_apply2( + IntPtr obj, + WImageFeatures[] features, int featuresSize, + IntPtr mask, + IntPtr outSrcImgIdx, + IntPtr outDstImgIdx, + IntPtr outMatches, + IntPtr outInliersMask, + IntPtr outNumInliers, + IntPtr outH, + IntPtr outConfidence); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_FeaturesMatcher_isThreadSafe( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_FeaturesMatcher_collectGarbage( + IntPtr obj); + + + // BestOf2NearestMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_BestOf2NearestMatcher_new( + int tryUseGpu, float matchConf, int numMatchesThresh1, int numMatchesThresh2, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_BestOf2NearestMatcher_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_BestOf2NearestMatcher_collectGarbage(IntPtr obj); + + + // AffineBestOf2NearestMatcher + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_AffineBestOf2NearestMatcher_new( + int fullAffine, int tryUseGpu, float matchConf, int numMatchesThresh1, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus stitching_AffineBestOf2NearestMatcher_delete( + IntPtr obj); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_DenseOpticalFlowExt.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_DenseOpticalFlowExt.cs new file mode 100644 index 000000000..9935095dd --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_DenseOpticalFlowExt.cs @@ -0,0 +1,170 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DenseOpticalFlowExt_calc( + IntPtr obj, IntPtr frame0, IntPtr frame1, IntPtr flow1, IntPtr flow2); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DenseOpticalFlowExt_collectGarbage(IntPtr obj); + + #region FarnebackOpticalFlow + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createOptFlow_Farneback(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createOptFlow_Farneback_CUDA(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_FarnebackOpticalFlow_get(IntPtr ptr, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_FarnebackOpticalFlow_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getPyrScale(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setPyrScale(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getLevelsNumber(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setLevelsNumber(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getWindowSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setWindowSize(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setIterations(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getPolyN(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setPolyN(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getPolySigma(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setPolySigma(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_getFlags(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FarnebackOpticalFlow_setFlags(IntPtr obj, int val); + + #endregion + + #region DualTVL1OpticalFlow + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createOptFlow_DualTVL1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createOptFlow_DualTVL1_CUDA(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_DualTVL1OpticalFlow_get(IntPtr ptr, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_DualTVL1OpticalFlow_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getTau(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setTau(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getLambda(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setLambda(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getTheta(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setTheta(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getScalesNumber(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setScalesNumber(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getWarpingsNumber(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setWarpingsNumber(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getEpsilon(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setEpsilon(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setIterations(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_getUseInitialFlow(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_DualTVL1OpticalFlow_setUseInitialFlow(IntPtr obj, int val); + + #endregion + + #region BroxOpticalFlow + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createOptFlow_Brox_CUDA(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_BroxOpticalFlow_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_BroxOpticalFlow_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_getAlpha(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_setAlpha(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_getGamma(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_setGamma(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_getScaleFactor(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_setScaleFactor(IntPtr obj, double val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_getInnerIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_setInnerIterations(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_getOuterIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_setOuterIterations(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_getSolverIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_BroxOpticalFlow_setSolverIterations(IntPtr obj, int val); + + #endregion + + #region PyrLKOpticalFlow + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createOptFlow_PyrLK_CUDA(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_PyrLKOpticalFlow_get(IntPtr ptr, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_PyrLKOpticalFlow_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_PyrLKOpticalFlow_getWindowSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_PyrLKOpticalFlow_setWindowSize(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_PyrLKOpticalFlow_getMaxLevel(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_PyrLKOpticalFlow_setMaxLevel(IntPtr obj, int val); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_PyrLKOpticalFlow_getIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_PyrLKOpticalFlow_setIterations(IntPtr obj, int val); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_FrameSource.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_FrameSource.cs new file mode 100644 index 000000000..4c34fd57e --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_FrameSource.cs @@ -0,0 +1,35 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FrameSource_nextFrame(IntPtr obj, IntPtr frame); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_FrameSource_reset(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createFrameSource_Empty(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus superres_createFrameSource_Video( + [MarshalAs(UnmanagedType.LPStr)] string fileName, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] + public static extern ExceptionStatus superres_createFrameSource_Video_CUDA( + [MarshalAs(UnmanagedType.LPStr)] string fileName, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createFrameSource_Camera(int deviceId, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_FrameSource_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_FrameSource_delete(IntPtr ptr); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_SuperResolution.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_SuperResolution.cs new file mode 100644 index 000000000..97c305ecd --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/superres/NativeMethods_superres_SuperResolution.cs @@ -0,0 +1,81 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setInput(IntPtr obj, IntPtr frameSource); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_nextFrame(IntPtr obj, IntPtr frame); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_reset(IntPtr obj); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_collectGarbage(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createSuperResolution_BTVL1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_createSuperResolution_BTVL1_CUDA(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_SuperResolution_get(IntPtr ptr, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_Ptr_SuperResolution_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getScale(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setScale(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getIterations(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setIterations(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getTau(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setTau(IntPtr obj, double val); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getLambda(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setLambda(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getAlpha(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setAlpha(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getKernelSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setKernelSize(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getBlurKernelSize(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setBlurKernelSize(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getBlurSigma(IntPtr obj, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setBlurSigma(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getTemporalAreaRadius(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setTemporalAreaRadius(IntPtr obj,int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_getOpticalFlow(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus superres_SuperResolution_setOpticalFlow(IntPtr obj, IntPtr val); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/text/NativeMethods_text.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/text/NativeMethods_text.cs new file mode 100644 index 000000000..a74805afa --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/text/NativeMethods_text.cs @@ -0,0 +1,102 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // BaseOCR + /* + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_BaseOCR_run1( + IntPtr obj, + IntPtr image, + IntPtr outputText, + IntPtr componentRects, + IntPtr componentTexts, + IntPtr componentConfidences, + int componentLevel); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_BaseOCR_run2( + IntPtr obj, + IntPtr image, + IntPtr mask, + IntPtr outputText, + IntPtr componentRects, + IntPtr componentTexts, + IntPtr componentConfidences, + int componentLevel); + */ + + // OCRTesseract + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_run1( + IntPtr obj, + IntPtr image, + IntPtr outputText, + IntPtr componentRects, + IntPtr componentTexts, + IntPtr componentConfidences, + int componentLevel); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_run2( + IntPtr obj, + IntPtr image, + IntPtr mask, + IntPtr outputText, + IntPtr componentRects, + IntPtr componentTexts, + IntPtr componentConfidences, + int componentLevel); + + /* + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_run3( + IntPtr obj, + IntPtr image, + int minConfidence, + int componentLevel, + IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_run4( + IntPtr obj, + IntPtr image, + IntPtr mask, + int minConfidence, + int componentLevel, + IntPtr dst);*/ + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_setWhiteList( + IntPtr obj, + [MarshalAs(UnmanagedType.LPStr)] string charWhitelist); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_create( + [MarshalAs(UnmanagedType.LPStr)] string? datapath, + [MarshalAs(UnmanagedType.LPStr)] string? language, + [MarshalAs(UnmanagedType.LPStr)] string? charWhitelist, + int oem, + int psmode, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_Ptr_OCRTesseract_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_OCRTesseract_get(IntPtr obj, out IntPtr returnValue); + + // swt_text_detection.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_detectTextSWT( + IntPtr input, IntPtr result, int darkOnLight, IntPtr draw, IntPtr chainBBs); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/text/NativeMethods_text_TextDetector.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/text/NativeMethods_text_TextDetector.cs new file mode 100644 index 000000000..c6d23ddc7 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/text/NativeMethods_text_TextDetector.cs @@ -0,0 +1,39 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // ReSharper disable once IdentifierTypo + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_TextDetector_detect(IntPtr obj, IntPtr inputImage, IntPtr bbox, IntPtr confidence); + + // ReSharper disable once IdentifierTypo + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_TextDetectorCNN_detect(IntPtr obj, IntPtr inputImage, IntPtr bbox, IntPtr confidence); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_TextDetectorCNN_create1( + [MarshalAs(UnmanagedType.LPStr)] string modelArchFilename, + [MarshalAs(UnmanagedType.LPStr)] string modelWeightsFilename, + [MarshalAs(UnmanagedType.LPArray)] Size[] detectionSizes, int detectionSizesLength, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_TextDetectorCNN_create2( + [MarshalAs(UnmanagedType.LPStr)] string modelArchFilename, + [MarshalAs(UnmanagedType.LPStr)] string modelWeightsFilename, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_Ptr_TextDetectorCNN_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus text_Ptr_TextDetectorCNN_get(IntPtr obj, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/traking/NativeMethods_tracking.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/traking/NativeMethods_tracking.cs new file mode 100644 index 000000000..cf2beccf2 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/traking/NativeMethods_tracking.cs @@ -0,0 +1,47 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using OpenCvSharp.Tracking; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible + +// ReSharper disable UnusedMember.Global +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // TrackerKCF + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_TrackerKCF_create1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_TrackerKCF_create2(TrackerKCF.Params parameters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_Ptr_TrackerKCF_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_Ptr_TrackerKCF_get(IntPtr ptr, out IntPtr returnValue); + + + // TrackerCSRT + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_TrackerCSRT_create1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_TrackerCSRT_create2(ref TrackerCSRT.Params parameters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_Ptr_TrackerCSRT_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_Ptr_TrackerCSRT_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus tracking_TrackerCSRT_setInitialMask(IntPtr tracker, IntPtr mask); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/video/NativeMethods_video_BackgroundSubtractor.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/video/NativeMethods_video_BackgroundSubtractor.cs new file mode 100644 index 000000000..a31252938 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/video/NativeMethods_video_BackgroundSubtractor.cs @@ -0,0 +1,147 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + #region BackgroundSubtractor + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractor_getBackgroundImage(IntPtr self, IntPtr backgroundImage); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractor_apply(IntPtr self, IntPtr image, IntPtr fgmask, double learningRate); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_BackgroundSubtractor_delete(IntPtr ptr); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_BackgroundSubtractor_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + #region BackgroundSubtractorMOG2 + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_createBackgroundSubtractorMOG2( + int history, double varThreshold, int detectShadows, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_BackgroundSubtractorMOG2_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_BackgroundSubtractorMOG2_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getHistory(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setHistory(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getNMixtures(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setNMixtures(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getBackgroundRatio(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setBackgroundRatio(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getVarThreshold(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setVarThreshold(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getVarThresholdGen(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setVarThresholdGen(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getVarInit(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setVarInit(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getVarMin(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setVarMin(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getVarMax(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setVarMax(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getComplexityReductionThreshold(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setComplexityReductionThreshold(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getDetectShadows(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setDetectShadows(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getShadowValue(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setShadowValue(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_getShadowThreshold(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorMOG2_setShadowThreshold(IntPtr ptr, double value); + + #endregion + + #region BackgroundSubtractorKNN + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_createBackgroundSubtractorKNN( + int history, double dist2Threshold, int detectShadows, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_BackgroundSubtractorKNN_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_BackgroundSubtractorKNN_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getHistory(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setHistory(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getNSamples(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setNSamples(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getDist2Threshold(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setDist2Threshold(IntPtr ptr, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getkNNSamples(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setkNNSamples(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getDetectShadows(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setDetectShadows(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getShadowValue(IntPtr ptr, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setShadowValue(IntPtr ptr, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_getShadowThreshold(IntPtr ptr, out double returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_BackgroundSubtractorKNN_setShadowThreshold(IntPtr ptr, double value); + + #endregion +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/video/NativeMethods_video_tracking.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/video/NativeMethods_video_tracking.cs new file mode 100644 index 000000000..2568a9a29 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/video/NativeMethods_video_tracking.cs @@ -0,0 +1,167 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_CamShift( + IntPtr probImage, ref Rect window, TermCriteria criteria, out RotatedRect returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_meanShift( + IntPtr probImage, ref Rect window, TermCriteria criteria, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_buildOpticalFlowPyramid1( + IntPtr img, IntPtr pyramid, + Size winSize, int maxLevel, int withDerivatives, + int pyrBorder, int derivBorder, int tryReuseInputImage, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_buildOpticalFlowPyramid2( + IntPtr img, IntPtr pyramidVec, + Size winSize, int maxLevel, int withDerivatives, + int pyrBorder, int derivBorder, int tryReuseInputImage, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_calcOpticalFlowPyrLK_InputArray( + IntPtr prevImg, IntPtr nextImg, + IntPtr prevPts, IntPtr nextPts, + IntPtr status, IntPtr err, + Size winSize, int maxLevel, TermCriteria criteria, + int flags, double minEigThreshold); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_calcOpticalFlowPyrLK_vector( + IntPtr prevImg, IntPtr nextImg, + Point2f[] prevPts, int prevPtsSize, + IntPtr nextPts, IntPtr status, IntPtr err, + Size winSize, int maxLevel, TermCriteria criteria, + int flags, double minEigThreshold); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_calcOpticalFlowFarneback( + IntPtr prev, IntPtr next, + IntPtr flow, double pyrScale, int levels, int winSize, + int iterations, int polyN, double polySigma, int flags); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_computeECC( + IntPtr templateImage, IntPtr inputImage, IntPtr inputMask, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_findTransformECC1( + IntPtr templateImage, IntPtr inputImage, + IntPtr warpMatrix, int motionType, TermCriteria criteria, + IntPtr inputMask, int gaussFiltSize, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_findTransformECC2( + IntPtr templateImage, IntPtr inputImage, + IntPtr warpMatrix, int motionType, TermCriteria criteria, + IntPtr inputMask, out double returnValue); + + #region Kalman filter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_new1(out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_new2( + int dynamParams, int measureParams, int controlParams, int type, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_init(IntPtr obj, int dynamParams, int measureParams, + int controlParams, int type); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_predict(IntPtr obj, IntPtr control, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_correct(IntPtr obj, IntPtr measurement, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_statePre(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_statePost(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_transitionMatrix(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_controlMatrix(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_measurementMatrix(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_processNoiseCov(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_measurementNoiseCov(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_errorCovPre(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_gain(IntPtr obj, out IntPtr returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_KalmanFilter_errorCovPost(IntPtr obj, out IntPtr returnValue); + + #endregion + + #region Tracker + + // Tracker + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Tracker_init(IntPtr obj, IntPtr image, Rect boundingBox); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Tracker_update(IntPtr obj, IntPtr image, ref Rect boundingBox, out int returnValue); + + + // TrackerMIL + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_TrackerMIL_create1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus video_TrackerMIL_create2(TrackerMIL.Params* parameters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_TrackerMIL_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_TrackerMIL_get(IntPtr ptr, out IntPtr returnValue); + + + // TrackerGOTURN + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_TrackerGOTURN_create1(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus video_TrackerGOTURN_create2(TrackerGOTURN.Params* parameters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_TrackerGOTURN_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_TrackerGOTURN_get(IntPtr ptr, out IntPtr returnValue); + + #endregion + + // TODO + /* + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_DenseOpticalFlow_calc( + IntPtr obj, IntPtr i0, IntPtr i1, IntPtr flow); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_DenseOpticalFlow_collectGarbage(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_DenseOpticalFlow_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus video_Ptr_DenseOpticalFlow_delete(IntPtr ptr); + //*/ +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc.cs new file mode 100644 index 000000000..ced95a36f --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc.cs @@ -0,0 +1,136 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style +// ReSharper disable IdentifierTypo + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_niBlackThreshold( + IntPtr src, IntPtr dst, double maxValue, int type, + int blockSize, double k, int binarizationMethod, double r); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_thinning(IntPtr src, IntPtr dst, int thinningType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_anisotropicDiffusion(IntPtr src, IntPtr dst, float alpha, float K, int niters); + + // brightedges.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_BrightEdges( + IntPtr original, IntPtr edgeview, int contrast, int shortRange, int longRange); + + // color_match.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createQuaternionImage(IntPtr img, IntPtr qimg); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_qconj(IntPtr qimg, IntPtr qcimg); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_qunitary(IntPtr qimg, IntPtr qnimg); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_qmultiply(IntPtr src1, IntPtr src2, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_qdft(IntPtr img, IntPtr qimg, int flags, int sideLeft); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_colorMatchTemplate(IntPtr img, IntPtr templ, IntPtr result); + + // deriche_filter.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_GradientDericheY(IntPtr op, IntPtr dst, double alpha, double omega); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_GradientDericheX(IntPtr op, IntPtr dst, double alpha, double omega); + + // edgepreserving_filter.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_edgePreservingFilter(IntPtr src, IntPtr dst, int d, double threshold); + + // estimated_covariance + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_covarianceEstimation( + IntPtr src, IntPtr dst, int windowRows, int windowCols); + + // fast_hough_transform + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastHoughTransform( + IntPtr src, IntPtr dst, MatType dstMatDepth, int angleRange, int op, int makeSkew); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_HoughPoint2Line( + Point houghPoint, IntPtr srcImgInfo, int angleRange, int makeSkew, int rules, out Vec4i returnValue); + + // paillou_filter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_GradientPaillouY(IntPtr op, IntPtr dst, double alpha, double omega); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_GradientPaillouX(IntPtr op, IntPtr dst, double alpha, double omega); + + // peilin.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern unsafe ExceptionStatus ximgproc_PeiLinNormalization_Mat23d(IntPtr I, double* returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_PeiLinNormalization_OutputArray(IntPtr I, IntPtr T); + + // run_length_morphology.hpp + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_threshold( + IntPtr src, IntPtr rlDest, double thresh, int type); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_dilate( + IntPtr rlSrc, IntPtr rlDest, IntPtr rlKernel, Point anchor); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_erode( + IntPtr rlSrc, IntPtr rlDest, IntPtr rlKernel, int bBoundaryOn, Point anchor); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_getStructuringElement( + int shape, Size ksize, IntPtr outValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_paint( + IntPtr image, IntPtr rlSrc, Scalar value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_isRLMorphologyPossible( + IntPtr rlStructuringElement, out int outValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_createRLEImage( + Point3i[] runs, nint runsLength, IntPtr res, Size size); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rl_morphologyEx( + IntPtr rlSrc, IntPtr rlDest, int op, IntPtr rlKernel, int bBoundaryOnForErosion, Point anchor); + + // weighted_median_filter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_weightedMedianFilter( + IntPtr joint, IntPtr src, IntPtr dst, int r, double sigma, int weightType, IntPtr mask); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_EdgeBoxes.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_EdgeBoxes.cs new file mode 100644 index 000000000..287c6890d --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_EdgeBoxes.cs @@ -0,0 +1,77 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getBoundingBoxes( + IntPtr obj, IntPtr edgeMap, IntPtr orientationMap, IntPtr boxes); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getAlpha(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setAlpha(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getBeta(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setBeta(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getEta(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setEta(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getMinScore(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setMinScore(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getMaxBoxes(IntPtr obj, out int returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setMaxBoxes(IntPtr obj, int value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getEdgeMinMag(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setEdgeMinMag(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getEdgeMergeThr(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setEdgeMergeThr(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getClusterMinMag(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setClusterMinMag(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getMaxAspectRatio(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setMaxAspectRatio(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getMinBoxArea(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setMinBoxArea(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getGamma(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setGamma(IntPtr obj, float value); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_getKappa(IntPtr obj, out float returnValue); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_EdgeBoxes_setKappa(IntPtr obj, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createEdgeBoxes( + float alpha, float beta, float eta, float minScore, int maxBoxes, float edgeMinMag, float edgeMergeThr, + float clusterMinMag, float maxAspectRatio, float minBoxArea, float gamma, float kappa, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_EdgeBoxes_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_EdgeBoxes_get(IntPtr ptr, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_EdgeFilter.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_EdgeFilter.cs new file mode 100644 index 000000000..ad1087422 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_EdgeFilter.cs @@ -0,0 +1,186 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // DTFilter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_DTFilter_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_DTFilter_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_DTFilter_filter( + IntPtr obj, IntPtr src, IntPtr dst, int dDepth); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createDTFilter( + IntPtr guide, double sigmaSpatial, double sigmaColor, int mode, int numIters, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_dtFilter( + IntPtr guide, IntPtr src, IntPtr dst, double sigmaSpatial, double sigmaColor, int mode, int numIters); + + ////////////////////////////////////////////////////////////////////////// + // GuidedFilter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_GuidedFilter_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_GuidedFilter_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_GuidedFilter_filter( + IntPtr obj, IntPtr src, IntPtr dst, int dDepth); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createGuidedFilter( + IntPtr guide, int radius, double eps, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_guidedFilter( + IntPtr guide, IntPtr src, IntPtr dst, int radius, double eps, int dDepth); + + ////////////////////////////////////////////////////////////////////////// + // AdaptiveManifoldFilter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_AdaptiveManifoldFilter_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_AdaptiveManifoldFilter_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_filter( + IntPtr obj, IntPtr src, IntPtr dst, IntPtr joint); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_collectGarbage( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_getSigmaS(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_setSigmaS(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_getSigmaR(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_setSigmaR(IntPtr obj, double val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_getTreeHeight(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_setTreeHeight(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_getPCAIterations(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_setPCAIterations(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_getAdjustOutliers(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_setAdjustOutliers(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_getUseRNG(IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_AdaptiveManifoldFilter_setUseRNG(IntPtr obj, int val); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createAMFilter( + double sigma_s, double sigma_r, int adjust_outliers, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_amFilter( + IntPtr joint, IntPtr src, IntPtr dst, double sigma_s, double sigma_r, int adjust_outliers); + + ////////////////////////////////////////////////////////////////////////// + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_jointBilateralFilter( + IntPtr joint, IntPtr src, IntPtr dst, int d, double sigmaColor, double sigmaSpace, int borderType); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_bilateralTextureFilter( + IntPtr src, IntPtr dst, int fr, int numIter, double sigmaAlpha, double sigmaAvg); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_rollingGuidanceFilter( + IntPtr src, IntPtr dst, int d, double sigmaColor, double sigmaSpace, int numOfIter, int borderType); + + ////////////////////////////////////////////////////////////////////////// + // FastBilateralSolverFilter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_FastBilateralSolverFilter_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_FastBilateralSolverFilter_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastBilateralSolverFilter_filter( + IntPtr obj, IntPtr src, IntPtr confidence, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createFastBilateralSolverFilter( + IntPtr guide, double sigma_spatial, double sigma_luma, double sigma_chroma, double lambda, int num_iter, + double max_tol, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_fastBilateralSolverFilter( + IntPtr guide, IntPtr src, IntPtr confidence, IntPtr dst, + double sigma_spatial, double sigma_luma, double sigma_chroma, double lambda, int num_iter, double max_tol); + + ////////////////////////////////////////////////////////////////////////// + // FastGlobalSmootherFilter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_FastGlobalSmootherFilter_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_FastGlobalSmootherFilter_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastGlobalSmootherFilter_filter( + IntPtr obj, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createFastGlobalSmootherFilter( + IntPtr guide, double lambda, double sigma_color, double lambda_attenuation, int num_iter, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_fastGlobalSmootherFilter( + IntPtr guide, IntPtr src, IntPtr dst, double lambda, double sigma_color, double lambda_attenuation, int num_iter); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_l0Smooth(IntPtr src, IntPtr dst, double lambda, double kappa); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_FastLineDetector.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_FastLineDetector.cs new file mode 100644 index 000000000..2a21f279f --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_FastLineDetector.cs @@ -0,0 +1,37 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_FastLineDetector_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_FastLineDetector_get(IntPtr ptr, out IntPtr returnValue); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastLineDetector_detect_OutputArray(IntPtr obj, IntPtr image, IntPtr lines); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastLineDetector_detect_vector(IntPtr obj, IntPtr image, IntPtr lines); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastLineDetector_drawSegments_InputArray(IntPtr obj, IntPtr image, IntPtr lines, int draw_arrow); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_FastLineDetector_drawSegments_vector(IntPtr obj, IntPtr image, IntPtr lines, int draw_arrow); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createFastLineDetector( + int length_threshold, float distance_threshold, double canny_th1, double canny_th2, int canny_aperture_size, + int do_merge, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_RidgeDetectionFilter.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_RidgeDetectionFilter.cs new file mode 100644 index 000000000..e69ecf9b6 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_RidgeDetectionFilter.cs @@ -0,0 +1,28 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_RidgeDetectionFilter_create( + MatType ddepth, int dx, int dy, int ksize, MatType outDtype, double scale, double delta, int borderType, + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_RidgeDetectionFilter_getRidgeFilteredImage( + IntPtr obj, IntPtr _img, IntPtr @out); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_RidgeDetectionFilter_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_RidgeDetectionFilter_get(IntPtr ptr, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_Segmentation.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_Segmentation.cs new file mode 100644 index 000000000..44963c9a9 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_Segmentation.cs @@ -0,0 +1,177 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // GraphSegmentation + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createGraphSegmentation(double sigma, float k, int minSize, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_GraphSegmentation_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_GraphSegmentation_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_processImage(IntPtr obj, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_setSigma(IntPtr obj, double value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_getSigma(IntPtr obj, out double returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_setK(IntPtr obj, float value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_getK(IntPtr obj, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_setMinSize(IntPtr obj, int value); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_GraphSegmentation_getMinSize(IntPtr obj, out int returnValue); + + + // SelectiveSearchSegmentationStrategy + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentationStrategy_setImage(IntPtr obj, + IntPtr img, IntPtr regions, IntPtr sizes, int image_id); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentationStrategy_get(IntPtr obj, int r1, int r2, out float returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentationStrategy_merge(IntPtr obj, int r1, int r2); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyColor(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategySize(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyTexture(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyFill(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyColor_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategySize_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyTexture_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyFill_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyColor_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategySize_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyTexture_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyFill_get(IntPtr ptr, out IntPtr returnValue); + + + // SelectiveSearchSegmentationStrategyMultiple + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentationStrategyMultiple_addStrategy(IntPtr obj, IntPtr g, float weight); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentationStrategyMultiple_clearStrategies(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple0( + out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple1( + IntPtr s1, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple2( + IntPtr s1, IntPtr s2, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple3( + IntPtr s1, IntPtr s2, IntPtr s3, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple4( + IntPtr s1, IntPtr s2, IntPtr s3, IntPtr s4, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyMultiple_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyMultiple_get(IntPtr ptr, out IntPtr returnValue); + + + // SelectiveSearchSegmentation + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_setBaseImage(IntPtr obj, IntPtr img); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_switchToSingleStrategy(IntPtr obj, + int k, float sigma); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_switchToSelectiveSearchFast( + IntPtr obj, int base_k, int inc_k, float sigma); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_switchToSelectiveSearchQuality( + IntPtr obj, int base_k, int inc_k, float sigma); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_addImage(IntPtr obj, IntPtr img); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_clearImages(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_addGraphSegmentation(IntPtr obj, IntPtr g); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_clearGraphSegmentations(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_addStrategy(IntPtr obj, IntPtr s); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_clearStrategies(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_SelectiveSearchSegmentation_process(IntPtr obj, IntPtr rects); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_createSelectiveSearchSegmentation(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentation_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_segmentation_Ptr_SelectiveSearchSegmentation_get(IntPtr ptr, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_StructuredEdgeDetection.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_StructuredEdgeDetection.cs new file mode 100644 index 000000000..2fef17c42 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_StructuredEdgeDetection.cs @@ -0,0 +1,56 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // RFFeatureGetter + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createRFFeatureGetter(out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_RFFeatureGetter_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_RFFeatureGetter_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_RFFeatureGetter_getFeatures( + IntPtr obj, IntPtr src, IntPtr features, + int gnrmRad, int gsmthRad, int shrink, int outNum, int gradNum); + + + // StructuredEdgeDetection + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createStructuredEdgeDetection( + [MarshalAs(UnmanagedType.LPStr)] string model, IntPtr howToGetFeatures, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_StructuredEdgeDetection_delete(IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_StructuredEdgeDetection_get(IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_StructuredEdgeDetection_detectEdges( + IntPtr obj, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_StructuredEdgeDetection_computeOrientation( + IntPtr obj, IntPtr src, IntPtr dst); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_StructuredEdgeDetection_edgesNms( + IntPtr obj, IntPtr edge_image, IntPtr orientation_image, IntPtr dst, + int r, int s, float m, int isParallel); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_Superpixel.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_Superpixel.cs new file mode 100644 index 000000000..17f6bb7e1 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/ximgproc/NativeMethods_ximgproc_Superpixel.cs @@ -0,0 +1,116 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming + +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable IDE1006 // Naming style + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + // SuperpixelLSC + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_SuperpixelLSC_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_SuperpixelLSC_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelLSC_getNumberOfSuperpixels( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelLSC_iterate( + IntPtr obj, int num_iterations); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelLSC_getLabels( + IntPtr obj, IntPtr labels_out); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelLSC_getLabelContourMask( + IntPtr obj, IntPtr image, int thick_line); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelLSC_enforceLabelConnectivity( + IntPtr obj, int min_element_size); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createSuperpixelLSC( + IntPtr image, int region_size, float ratio, out IntPtr returnValue); + + + // SuperpixelSEEDS + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_SuperpixelSEEDS_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_SuperpixelSEEDS_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSEEDS_getNumberOfSuperpixels( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSEEDS_iterate( + IntPtr obj, IntPtr img, int num_iterations); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSEEDS_getLabels( + IntPtr obj, IntPtr labels_out); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSEEDS_getLabelContourMask( + IntPtr obj, IntPtr image, int thick_line); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createSuperpixelSEEDS( + int image_width, int image_height, int image_channels, + int num_superpixels, int num_levels, int prior, + int histogram_bins, int double_step, + out IntPtr returnValue); + + + // SuperpixelSLIC + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_SuperpixelSLIC_delete( + IntPtr obj); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_Ptr_SuperpixelSLIC_get( + IntPtr ptr, out IntPtr returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSLIC_getNumberOfSuperpixels( + IntPtr obj, out int returnValue); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSLIC_iterate( + IntPtr obj, int num_iterations); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSLIC_getLabels( + IntPtr obj, IntPtr labels_out); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSLIC_getLabelContourMask( + IntPtr obj, IntPtr image, int thick_line); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_SuperpixelSLIC_enforceLabelConnectivity( + IntPtr obj, int min_element_size); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus ximgproc_createSuperpixelSLIC( + IntPtr image, int algorithm, int region_size, float ruler, out IntPtr returnValue); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/StdString.cs b/src/OpenCvSharp/Internal/PInvoke/StdString.cs new file mode 100644 index 000000000..6c04955dc --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/StdString.cs @@ -0,0 +1,68 @@ +using System.Text; + +namespace OpenCvSharp.Internal; + +/// +/// +/// C++ std::string +/// +public class StdString : DisposableCvObject +{ + /// + /// + /// + public StdString() + { + ptr = NativeMethods.string_new1(); + } + + /// + /// + /// + /// + public StdString(string str) + { + if (str is null) + throw new ArgumentNullException(nameof(str)); + + var utf8Bytes = Encoding.UTF8.GetBytes(str); + ptr = NativeMethods.string_new2(utf8Bytes); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.string_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// string.size() + /// + public nuint Size + { + get + { + var ret = NativeMethods.string_size(ptr); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// Converts std::string to managed string + /// + /// + public new string ToString() + { + unsafe + { + var stringPointer = NativeMethods.string_c_str(ptr); + var ret = Encoding.UTF8.GetString((byte*) stringPointer, (int)Size); + GC.KeepAlive(this); + return ret; + } + } +} diff --git a/src/OpenCvSharp/Internal/PInvoke/Win32API.cs b/src/OpenCvSharp/Internal/PInvoke/Win32API.cs new file mode 100644 index 000000000..385bcd488 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/Win32API.cs @@ -0,0 +1,26 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments + +namespace OpenCvSharp.Internal; + +/// +/// Win32API Wrapper +/// +public static class Win32Api +{ + +#if DOTNET_FRAMEWORK + private const CharSet DefaultCharSet = CharSet.Auto; +#else + private const CharSet DefaultCharSet = CharSet.Unicode; +#endif + + [Pure, DllImport("kernel32", CallingConvention = CallingConvention.Winapi, + SetLastError = true, CharSet = DefaultCharSet, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern IntPtr LoadLibrary(string dllPath); +} diff --git a/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs b/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs new file mode 100644 index 000000000..e9b0034f5 --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs @@ -0,0 +1,379 @@ +using System.Diagnostics; +using System.Globalization; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; + +#pragma warning disable 1591 + +namespace OpenCvSharp.Internal; + +/// +/// Handles loading embedded dlls into memory, based on http://stackoverflow.com/questions/666799/embedding-unmanaged-dll-into-a-managed-c-sharp-dll. +/// +/// This code is based on https://github.com/charlesw/tesseract +public sealed class WindowsLibraryLoader +{ + public static WindowsLibraryLoader Instance { get; } = new(); + + /// + /// The default base directory name to copy the assemblies too. + /// + private const string ProcessorArchitecture = "PROCESSOR_ARCHITECTURE"; + private const string DllFileExtension = ".dll"; + private const string DllDirectory = "dll"; + + private readonly List loadedAssemblies = []; + + /// + /// Map processor + /// + private readonly Dictionary processorArchitecturePlatforms = + new (StringComparer.OrdinalIgnoreCase) + { + {"x86", "x86"}, + {"AMD64", "x64"}, + {"IA64", "Itanium"}, + {"ARM", "WinCE"} + }; + + /// + /// Used as a sanity check for the returned processor architecture to double check the returned value. + /// + private readonly Dictionary processorArchitectureAddressWidthPlatforms = + new(StringComparer.OrdinalIgnoreCase) + { + {"x86", 4}, + {"AMD64", 8}, + {"IA64", 8}, + {"ARM", 4} + }; + + /// + /// Additional user-defined DLL paths + /// +#pragma warning disable CA1002 // Do not expose generic lists + public List AdditionalPaths { get; } +#pragma warning restore CA1002 + + private readonly object syncLock = new(); + + /// + /// constructor + /// + private WindowsLibraryLoader() + { + AdditionalPaths = []; + } + + /// + /// + /// + /// + /// + public bool IsLibraryLoaded(string dllName) + { + lock (syncLock) + { + return loadedAssemblies.Contains(dllName); + } + } + + /// + /// Determine if the OS is Windows + /// + /// + public static bool IsCurrentPlatformSupported() + { + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + } + + /// + /// Determine if the runtime is .NET Core + /// + /// + public static bool IsDotNetCore() + { +#if NET48 + return false; +#else + // https://github.com/dotnet/corefx/blob/v2.1-preview1/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs + return Environment.Version.Major >= 5 || + RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); +#endif + } + + /// + /// + /// + /// + /// + public void LoadLibrary(string dllName, IEnumerable? additionalPaths = null) + { + // Windows only + if (!IsCurrentPlatformSupported()) + return; + + var additionalPathsArray = additionalPaths?.ToArray() ?? []; + + // In .NET Core, process only when additional paths are specified. + if (IsDotNetCore() && additionalPathsArray.Length == 0) + return; + + try + { + lock (syncLock) + { + if (loadedAssemblies.Contains(dllName)) + { + return; + } + + var processArch = GetProcessArchitecture(); + IntPtr dllHandle; + + // Try loading from user-defined paths + foreach (var path in additionalPathsArray) + { + // baseDirectory = Path.GetFullPath(path); + dllHandle = LoadLibraryRaw(dllName, path); + if (dllHandle != IntPtr.Zero) return; + } + + // Try loading from executing assembly domain +#if DOTNET_FRAMEWORK + var executingAssembly = Assembly.GetExecutingAssembly(); +#else + var executingAssembly = GetType().GetTypeInfo().Assembly; +#endif + var baseDirectory = Path.GetDirectoryName(executingAssembly.Location) ?? ""; + dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); + if (dllHandle != IntPtr.Zero) return; + + // Fallback to current app domain + // TODO +#if DOTNET_FRAMEWORK + baseDirectory = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory); + dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); + if (dllHandle != IntPtr.Zero) return; +#endif + + // Gets the pathname of the base directory that the assembly resolver uses to probe for assemblies. + // https://github.com/dotnet/corefx/issues/2221 +#if !NET40 + baseDirectory = AppContext.BaseDirectory; + dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); + if (dllHandle != IntPtr.Zero) return; +#endif + + // Finally try the working directory + baseDirectory = Path.GetFullPath(Directory.GetCurrentDirectory()); + dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); + if (dllHandle != IntPtr.Zero) return; + + // ASP.NET hack, requires an active context +#if DOTNET_FRAMEWORK + if (System.Web.HttpContext.Current is not null) + { + var server = System.Web.HttpContext.Current.Server; + baseDirectory = Path.GetFullPath(server.MapPath("bin")); + dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); + if (dllHandle != IntPtr.Zero) return; + } +#endif + + var errorMessage = new StringBuilder(); + errorMessage.AppendFormat(CultureInfo.InvariantCulture, $"Failed to find dll \"{dllName}\", for processor architecture {processArch.Architecture}."); + if (processArch.HasWarnings) + { + // include process detection warnings + errorMessage.AppendLine().Append("Warnings: ").AppendLine().Append("{processArch.WarningText()}"); + } + + throw new OpenCvSharpException(errorMessage.ToString()); + } + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception e) + { + Debug.WriteLine(e); + } +#pragma warning restore CA1031 // Do not catch general exception types + } + + /// + /// Gets the current process architecture while keeping track of any assumptions or possible errors. + /// + /// + private ProcessArchitectureInfo GetProcessArchitecture() + { + // BUGBUG: Will this always be reliable? + var processArchitecture = Environment.GetEnvironmentVariable(ProcessorArchitecture); + + var processInfo = new ProcessArchitectureInfo(); + if (!string.IsNullOrEmpty(processArchitecture)) + { + // Sanity check + processInfo.Architecture = processArchitecture; + } + else + { + processInfo.AddWarning("Failed to detect processor architecture, falling back to x86."); + processInfo.Architecture = (IntPtr.Size == 8) ? "x64" : "x86"; + } + + var addressWidth = processorArchitectureAddressWidthPlatforms[processInfo.Architecture]; + if (addressWidth != IntPtr.Size) + { + if (string.Equals(processInfo.Architecture, "AMD64", StringComparison.OrdinalIgnoreCase) && IntPtr.Size == 4) + { + // fall back to x86 if detected x64 but has an address width of 32 bits. + processInfo.Architecture = "x86"; + processInfo.AddWarning("Expected the detected processing architecture of {0} to have an address width of {1} Bytes but was {2} Bytes, falling back to x86.", processInfo.Architecture, addressWidth, IntPtr.Size); + } + else + { + // no fallback possible + processInfo.AddWarning("Expected the detected processing architecture of {0} to have an address width of {1} Bytes but was {2} Bytes.", processInfo.Architecture, addressWidth, IntPtr.Size); + } + } + + return processInfo; + } + + private IntPtr LoadLibraryInternal(string dllName, string baseDirectory, ProcessArchitectureInfo processArchInfo) + { + //IntPtr libraryHandle = IntPtr.Zero; + var platformName = GetPlatformName(processArchInfo.Architecture) ?? ""; + var expectedDllDirectory = Path.Combine( + Path.Combine(baseDirectory, DllDirectory), platformName); + //var fileName = FixUpDllFileName(Path.Combine(expectedDllDirectory, dllName)); + + return LoadLibraryRaw(dllName, expectedDllDirectory); + } + + private IntPtr LoadLibraryRaw(string dllName, string baseDirectory) + { + var libraryHandle = IntPtr.Zero; + var fileName = FixUpDllFileName(Path.Combine(baseDirectory, dllName)); + +#if WINRT && false + // MP! Note: This is a hack, needs refinement. We don't need to carry payload of both binaries for WinRT because the appx is platform specific. + ProcessArchitectureInfo processInfo = GetProcessArchitecture(); + + string cpu = "x86"; + if (processInfo.Architecture == "AMD64") + cpu = "x64"; + + string dllpath = baseDirectory.Replace($"dll\\{cpu}", ""); + fileName = $"{dllpath}{dllName}.dll"; + + // Show where we're trying to load the file from + Debug.WriteLine($"Trying to load native library \"{fileName}\"..."); +#endif + + if (File.Exists(fileName)) + { + // Attempt to load dll + try + { + libraryHandle = Win32Api.LoadLibrary(fileName); + if (libraryHandle != IntPtr.Zero) + { + // library has been loaded + Debug.WriteLine($"Successfully loaded native library \"{fileName}\"."); + loadedAssemblies.Add(dllName); + } + else + { + Debug.WriteLine($"Failed to load native library \"{fileName}\".\r\nCheck windows event log."); + } + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception e) + { + // ReSharper disable once RedundantAssignment + var lastError = Marshal.GetLastWin32Error(); + Debug.WriteLine( + $"Failed to load native library \"{fileName}\".\r\nLast Error:{lastError}\r\nCheck inner exception and\\or windows event log.\r\nInner Exception: {e}"); + } +#pragma warning restore CA1031 // Do not catch general exception types + } + else + { + Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, + "The native library \"{0}\" does not exist.", + fileName)); + } + + return libraryHandle; + } + + /// + /// Determines if the dynamic link library file name requires a suffix + /// and adds it if necessary. + /// + private static string FixUpDllFileName(string fileName) + { + if (!string.IsNullOrEmpty(fileName)) + { +#if DOTNET_FRAMEWORK + var platformId = Environment.OSVersion.Platform; + if ((platformId == PlatformID.Win32S) || + (platformId == PlatformID.Win32Windows) || + (platformId == PlatformID.Win32NT) || + (platformId == PlatformID.WinCE)) +#else + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) +#endif + { + if (!fileName.EndsWith(DllFileExtension, + StringComparison.OrdinalIgnoreCase)) + { + return fileName + DllFileExtension; + } + } + } + + return fileName; + } + + /// + /// Given the processor architecture, returns the name of the platform. + /// + private string? GetPlatformName(string processorArchitecture) + { + if (string.IsNullOrEmpty(processorArchitecture)) + return null; + + if (processorArchitecturePlatforms.TryGetValue(processorArchitecture, out var platformName)) + return platformName; + + return null; + } + + private class ProcessArchitectureInfo + { + public string Architecture { get; set; } + private List Warnings { get; } + + public ProcessArchitectureInfo() + { + Architecture = ""; + Warnings = []; + } + + public bool HasWarnings => Warnings.Count > 0; + + public void AddWarning(string format, params object[] args) + { + Warnings.Add(string.Format(CultureInfo.InvariantCulture, format, args)); + } + + public string WarningText() + { + return string.Join("\r\n", Warnings.ToArray()); + } + } + +} diff --git a/src/OpenCvSharp/Internal/Util/ArrayAddress.cs b/src/OpenCvSharp/Internal/Util/ArrayAddress.cs new file mode 100644 index 000000000..ec01296ac --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/ArrayAddress.cs @@ -0,0 +1,50 @@ +using System.Runtime.InteropServices; + +#pragma warning disable 1591 +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Internal.Util; + +/// +/// +/// +/// +public class ArrayAddress1 : DisposableObject + where T : unmanaged +{ + private readonly Array array; + private GCHandle gch; + + public ArrayAddress1(T[] array) + { + this.array = array ?? throw new ArgumentNullException(nameof(array)); + gch = GCHandle.Alloc(array, GCHandleType.Pinned); + } + + public ArrayAddress1(IEnumerable enumerable) + : this(enumerable.ToArray()) + { + } + + public ArrayAddress1(T[,] array) + { + this.array = array ?? throw new ArgumentNullException(nameof(array)); + gch = GCHandle.Alloc(array, GCHandleType.Pinned); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (gch.IsAllocated) + { + gch.Free(); + } + base.DisposeUnmanaged(); + } + + public IntPtr Pointer => gch.AddrOfPinnedObject(); + + public int Length => array.Length; +} diff --git a/src/OpenCvSharp/Internal/Util/ArrayAddress2.cs b/src/OpenCvSharp/Internal/Util/ArrayAddress2.cs new file mode 100644 index 000000000..abd09bb88 --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/ArrayAddress2.cs @@ -0,0 +1,87 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp.Internal.Util; + +/// +/// Class to get address of specified jagged array +/// +/// +public class ArrayAddress2 : DisposableObject + where T : unmanaged +{ + private readonly T[][] array; + private readonly GCHandle[] gch; + private readonly IntPtr[] ptr; + + /// + /// + /// + /// + public ArrayAddress2(T[][] array) + { + this.array = array ?? throw new ArgumentNullException(nameof(array)); + + // T[][]をIntPtr[]に変換する + ptr = new IntPtr[array.Length]; + gch = new GCHandle[array.Length]; + for (var i = 0; i < array.Length; i++) + { + var elem = array[i]; + if (elem is null/* || elem.Length == 0*/) + throw new ArgumentException($"array[{i}] is not valid array object."); + + // メモリ確保 + gch[i] = GCHandle.Alloc(elem, GCHandleType.Pinned); + ptr[i] = gch[i].AddrOfPinnedObject(); + } + } + + /// + /// + /// + /// + public ArrayAddress2(IEnumerable> enumerable) + : this(enumerable.Select(x => x.ToArray()).ToArray()) + { + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + foreach (var h in gch) + { + if (h.IsAllocated) + { + h.Free(); + } + } + base.DisposeUnmanaged(); + } + + /// + /// + public IntPtr[] GetPointer() + { + return ptr; + } + + /// + /// +#pragma warning disable CA1024 // Use properties where appropriate + public int GetDim1Length() => array.Length; +#pragma warning restore CA1024 // Use properties where appropriate + + /// + /// + public int[] GetDim2Lengths() + { + var lengths = new int[array.Length]; + for (var i = 0; i < array.Length; i++) + { + lengths[i] = array[i].Length; + } + return lengths; + } +} diff --git a/src/OpenCvSharp/Internal/Util/EnumerableExtensions.cs b/src/OpenCvSharp/Internal/Util/EnumerableExtensions.cs new file mode 100644 index 000000000..3c4861fbc --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/EnumerableExtensions.cs @@ -0,0 +1,18 @@ +namespace OpenCvSharp.Internal.Util; +#pragma warning disable 1591 + +internal static class EnumerableExtensions +{ + /// + /// enumerable as T[] ?? enumerable.ToArray() + /// + /// + /// + /// + public static T[] CastOrToArray(this IEnumerable enumerable) + { + if (enumerable is T[] array) + return array; + return enumerable.ToArray(); + } +} diff --git a/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs b/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs new file mode 100644 index 000000000..1811cf2ec --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs @@ -0,0 +1,72 @@ +namespace OpenCvSharp.Internal.Util; + +/// +/// +/// +public static class PInvokeHelper +{ + /// + /// Checks whether PInvoke functions can be called + /// + public static void TryPInvoke() + { + try + { + var size = NativeMethods.core_Mat_sizeof(); + } + catch (DllNotFoundException e) + { + DllImportError(e); + } + catch (BadImageFormatException e) + { + DllImportError(e); + } + } + + /// + /// DllImportの際にDllNotFoundExceptionかBadImageFormatExceptionが発生した際に呼び出されるメソッド。 + /// エラーメッセージを表示して解決策をユーザに示す。 + /// + /// + public static void DllImportError(Exception ex) + { + throw CreateException(ex); + } + + /// + /// + /// + /// + public static OpenCvSharpException CreateException(Exception ex) + { + if (ex is null) + throw new ArgumentNullException(nameof(ex)); + + /*StringBuilder message = new StringBuilder(); + if (System.Globalization.CultureInfo.CurrentCulture.Name.Contains("ja")) + { + message.AppendFormat("{0}\n", ex.Message); + message.Append("*** P/Invokeが原因で例外が発生しました。***\n") + .Append("以下の項目を確認して下さい。\n") + .Append("(1) OpenCVのDLLが実行ファイルと同じ場所に置かれていますか? またはパスが正しく通っていますか?\n") + .Append("(2) Visual C++ Redistributable Packageをインストールしましたか?\n") + .Append("(3) OpenCVのDLLやOpenCvSharpの対象プラットフォーム(x86またはx64)と、プロジェクトのプラットフォーム設定が合っていますか?\n") + .Append("\n") + .Append(ex.ToString()); + } + else + { + message.AppendFormat("{0}\n", ex.Message); + message.Append("*** An exception has occurred because of P/Invoke. ***\n") + .Append("Please check the following:\n") + .Append("(1) OpenCV's DLL files exist in the same directory as the executable file.\n") + .Append("(2) Visual C++ Redistributable Package has been installed.\n") + .Append("(3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.\n") + .Append("\n") + .Append(ex.ToString()); + } + return new OpenCvSharpException(message.ToString(), ex);*/ + return new OpenCvSharpException(ex.Message, ex); + } +} diff --git a/src/OpenCvSharp/Internal/Util/Platform.cs b/src/OpenCvSharp/Internal/Util/Platform.cs new file mode 100644 index 000000000..15429a6ea --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/Platform.cs @@ -0,0 +1,46 @@ +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +namespace OpenCvSharp.Internal.Util; + +// ReSharper disable once InconsistentNaming +internal enum OS +{ + Windows, + Unix +} + +internal enum Runtime +{ + DotNet, + Mono +} + +/// +/// Provides information for the platform which the user is using +/// +internal static class Platform +{ + /// + /// OS type + /// + // ReSharper disable once InconsistentNaming + public static readonly OS OS; + + /// + /// Runtime type + /// + public static readonly Runtime Runtime; + +#pragma warning disable CA1810 + static Platform() +#pragma warning restore CA1810 + { + OS = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) + ? OS.Unix + : OS.Windows; + Runtime = (Type.GetType("Mono.Runtime") is null) ? Runtime.Mono : Runtime.DotNet; + } +} diff --git a/src/OpenCvSharp/Internal/Util/ReadOnlyArray2D.cs b/src/OpenCvSharp/Internal/Util/ReadOnlyArray2D.cs new file mode 100644 index 000000000..a64aedf8a --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/ReadOnlyArray2D.cs @@ -0,0 +1,47 @@ +namespace OpenCvSharp.Internal.Util; + +/// +/// Readonly rectangular array (T[,]) +/// +/// +public class ReadOnlyArray2D +{ + private readonly T[,] data; + + /// + /// Constructor + /// + /// + public ReadOnlyArray2D(T[,] data) + { + this.data = data ?? throw new ArgumentNullException(nameof(data)); + } + + /// + /// Indexer + /// + /// + /// + /// + public ref readonly T this[int index0, int index1] => ref data[index0, index1]; + + /// + /// Gets the total number of elements in all the dimensions of the System.Array. + /// +#pragma warning disable CA1721 + public int Length => data.Length; +#pragma warning restore CA1721 + + /// + /// Gets a 32-bit integer that represents the number of elements in the specified dimension of the System.Array. + /// + /// + /// + public int GetLength(int dimension) => data.GetLength(dimension); + + /// + /// Returns internal buffer + /// + /// + public T[,] GetBuffer() => data; +} diff --git a/src/OpenCvSharp/Internal/Util/SaturateCast.cs b/src/OpenCvSharp/Internal/Util/SaturateCast.cs new file mode 100644 index 000000000..51d5e302b --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/SaturateCast.cs @@ -0,0 +1,67 @@ +namespace OpenCvSharp.Internal.Util; +#pragma warning disable 1591 + +public static class SaturateCast +{ + // ReSharper disable UnusedMember.Global + + public static byte ToByte(sbyte v) => (byte)Math.Max((int)v, 0); + public static byte ToByte(ushort v) => (byte)Math.Min(v, (uint)byte.MaxValue); + public static byte ToByte(int v) => (byte)((uint)v <= byte.MaxValue ? v : v > 0 ? byte.MaxValue : 0); + public static byte ToByte(short v) => ToByte((int)v); + public static byte ToByte(uint v) => (byte)Math.Min(v, byte.MaxValue); + public static byte ToByte(float v) { var iv = (int)Math.Round(v); return ToByte(iv); } + public static byte ToByte(double v) { var iv = (long)Math.Round(v); return ToByte(iv); } + public static byte ToByte(long v) => (byte)((ulong)v <= byte.MaxValue ? v : v > 0 ? byte.MaxValue : 0); + public static byte ToByte(ulong v) => (byte)Math.Min(v, byte.MaxValue); + + public static sbyte ToSByte(byte v) => (sbyte)Math.Min((int)v, sbyte.MaxValue); + public static sbyte ToSByte(ushort v) => (sbyte)Math.Min(v, (uint)sbyte.MaxValue); + public static sbyte ToSByte(int v) => (sbyte)((uint)(v - sbyte.MinValue) <= byte.MaxValue ? v : v > 0 ? sbyte.MaxValue : sbyte.MinValue); + public static sbyte ToSByte(short v) => ToSByte((int)v); + public static sbyte ToSByte(uint v) => (sbyte)Math.Min(v, sbyte.MaxValue); + public static sbyte ToSByte(float v) { var iv = (int)Math.Round(v); return ToSByte(iv); } + public static sbyte ToSByte(double v) { var iv = (int)Math.Round(v); return ToSByte(iv); } + public static sbyte ToSByte(long v) => (sbyte)((ulong)(v - sbyte.MinValue) <= byte.MaxValue ? v : v > 0 ? sbyte.MaxValue : sbyte.MinValue); + public static sbyte ToSByte(ulong v) => (sbyte)Math.Min(v, (int)sbyte.MaxValue); + + public static ushort ToUInt16(sbyte v) => (ushort)Math.Max((int)v, 0); + public static ushort ToUInt16(short v) => (ushort)Math.Max((int)v, 0); + public static ushort ToUInt16(int v) => (ushort)((uint)v <= ushort.MaxValue ? v : v > 0 ? ushort.MaxValue : 0); + public static ushort ToUInt16(uint v) => (ushort)Math.Min(v, ushort.MaxValue); + public static ushort ToUInt16(float v) { var iv = (int)Math.Round(v); return ToUInt16(iv); } + public static ushort ToUInt16(double v) { var iv = (int)Math.Round(v); return ToUInt16(iv); } + public static ushort ToUInt16(long v) => (ushort)((ulong)v <= ushort.MaxValue ? v : v > 0 ? ushort.MaxValue : 0); + public static ushort ToUInt16(ulong v) => (ushort)Math.Min(v, ushort.MaxValue); + + public static short ToInt16(ushort v) => (short)Math.Min(v, short.MaxValue); + public static short ToInt16(int v) => (short)((uint)(v - short.MinValue) <= ushort.MaxValue ? v : v > 0 ? short.MaxValue : short.MinValue); + public static short ToInt16(uint v) => (short)Math.Min(v, short.MaxValue); + public static short ToInt16(float v) { var iv = (int)Math.Round(v); return ToInt16(iv); } + public static short ToInt16(double v) { var iv = (int)Math.Round(v); return ToInt16(iv); } + public static short ToInt16(long v) => (short)((ulong)(v - short.MinValue) <= ushort.MaxValue ? v : v > 0 ? short.MaxValue : short.MinValue); + public static short ToInt16(ulong v) => (short)Math.Min(v, (int)short.MaxValue); + + public static int ToInt32(uint v) => (int)Math.Min(v, int.MaxValue); + public static int ToInt32(long v) => (int)((ulong)(v - int.MinValue) <= uint.MaxValue ? v : v > 0 ? int.MaxValue : int.MinValue); + public static int ToInt32(ulong v) => (int)Math.Min(v, int.MaxValue); + public static int ToInt32(float v) => (int)Math.Round(v); + public static int ToInt32(double v) => (int)Math.Round(v); + + public static uint ToUInt32(sbyte v) => (uint)Math.Max(v, (sbyte)0); + public static uint ToUInt32(short v) => (uint)Math.Max(v, (short)0); + public static uint ToUInt32(int v) => (uint)Math.Max(v, 0); + public static uint ToUInt32(long v) => (uint)((ulong)v <= uint.MaxValue ? v : v > 0 ? uint.MaxValue : 0); + public static uint ToUInt32(ulong v) => (uint)Math.Min(v, uint.MaxValue); + + // we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc. + public static uint ToUInt32(float v) => (uint)Math.Round(v); + public static uint ToUInt32(double v) => (uint)Math.Round(v); + + public static ulong ToUInt64(sbyte v) => (ulong)Math.Max(v, (sbyte)0); + public static ulong ToUInt64(short v) => (ulong)Math.Max(v, (short)0); + public static ulong ToUInt64(int v) => (ulong)Math.Max(v, 0); + public static ulong ToUInt64(long v) => (ulong)Math.Max(v, 0); + + public static long ToInt64(ulong v) => (long)Math.Min(v, long.MaxValue); +} diff --git a/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs b/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs new file mode 100644 index 000000000..7c7fb94d0 --- /dev/null +++ b/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; + +#pragma warning disable 1591 + +namespace OpenCvSharp.Internal.Util; + +/// +/// Original GCHandle that implement IDisposable +/// +// ReSharper disable once InconsistentNaming +public sealed class ScopedGCHandle : IDisposable +{ + private GCHandle handle; + private bool disposed; + + /// + /// Constructor + /// + /// + public ScopedGCHandle(object value) + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + handle = GCHandle.Alloc(value); + disposed = false; + } + + /// + /// Constructor + /// + /// + /// + public ScopedGCHandle(object value, GCHandleType type) + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + handle = GCHandle.Alloc(value, type); + disposed = false; + } + + /// + /// Constructor + /// + /// + private ScopedGCHandle(GCHandle handle) + { + this.handle = handle; + disposed = false; + } + + public void Dispose() + { + if (!disposed) + { + // Release managed resources. + if (handle.IsAllocated) + { + handle.Free(); + } + disposed = true; + } + } + + public static ScopedGCHandle FromIntPtr(IntPtr value) + { + return new ScopedGCHandle(GCHandle.FromIntPtr(value)); + } + + public static IntPtr ToIntPtr(ScopedGCHandle value) + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + + return GCHandle.ToIntPtr(value.Handle); + } + + public GCHandle Handle => handle; + + public bool IsAllocated => handle.IsAllocated; + + public object? Target => handle.Target; + + public void Free() + { + handle.Free(); + } + + public override string? ToString() + { + return handle.ToString(); + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/IStdVector.cs b/src/OpenCvSharp/Internal/Vectors/IStdVector.cs new file mode 100644 index 000000000..d5bee8317 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/IStdVector.cs @@ -0,0 +1,18 @@ +namespace OpenCvSharp.Internal.Vectors; + +/// +/// Represents std::vector +/// +public interface IStdVector : IDisposable +{ + /// + /// vector.size() + /// + int Size { get; } + + /// + /// Convert std::vector<T> to managed array T[] + /// + /// + T[] ToArray(); +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfByte.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfByte.cs new file mode 100644 index 000000000..c449aae4a --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfByte.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfByte : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfByte() + { + ptr = NativeMethods.vector_uchar_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfByte(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_uchar_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfByte(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_uchar_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_uchar_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_uchar_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_uchar_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public byte[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new byte[size]; + Marshal.Copy(ElemPtr, dst, 0, dst.Length); + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfDMatch.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfDMatch.cs new file mode 100644 index 000000000..ab58f00a9 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfDMatch.cs @@ -0,0 +1,100 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfDMatch : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfDMatch() + { + ptr = NativeMethods.vector_DMatch_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfDMatch(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_DMatch_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfDMatch(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_DMatch_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_DMatch_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_DMatch_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_DMatch_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public DMatch[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new DMatch[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfDTreesNode.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfDTreesNode.cs new file mode 100644 index 000000000..8310963a0 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfDTreesNode.cs @@ -0,0 +1,78 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.ML; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfDTreesNode : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfDTreesNode() + { + ptr = NativeMethods.vector_DTrees_Node_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_DTrees_Node_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_DTrees_Node_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_DTrees_Node_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public DTrees.Node[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new DTrees.Node[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfDTreesSplit.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfDTreesSplit.cs new file mode 100644 index 000000000..234709bf5 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfDTreesSplit.cs @@ -0,0 +1,78 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.ML; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +internal class VectorOfDTreesSplit : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfDTreesSplit() + { + ptr = NativeMethods.vector_DTrees_Split_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_DTrees_Split_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_DTrees_Split_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_DTrees_Split_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public DTrees.Split[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new DTrees.Split[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfDouble.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfDouble.cs new file mode 100644 index 000000000..a547b5f5f --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfDouble.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfDouble : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfDouble() + { + ptr = NativeMethods.vector_double_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfDouble(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_double_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfDouble(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_double_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_double_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_double_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_double_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public double[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new double[size]; + Marshal.Copy(ElemPtr, dst, 0, dst.Length); + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfFloat.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfFloat.cs new file mode 100644 index 000000000..f5dd2c56e --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfFloat.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfFloat : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfFloat() + { + ptr = NativeMethods.vector_float_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfFloat(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_float_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfFloat(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_float_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_float_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_float_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_float_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public float[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new float[size]; + Marshal.Copy(ElemPtr, dst, 0, dst.Length); + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfImageFeatures.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfImageFeatures.cs new file mode 100644 index 000000000..8b47f1fc0 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfImageFeatures.cs @@ -0,0 +1,113 @@ +using OpenCvSharp.Detail; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfImageFeatures : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfImageFeatures() + { + ptr = NativeMethods.vector_ImageFeatures_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_ImageFeatures_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_ImageFeatures_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public ImageFeatures[] ToArray() + { + var size = Size; + if (size == 0) + return []; + + VectorOfKeyPoint[]? keypointsVecs = null; + Mat[]? descriptors = null; + try + { + var nativeResult = new WImageFeatures[size]; + keypointsVecs = new VectorOfKeyPoint[size]; + descriptors = new Mat[size]; + for (var i = 0; i < size; i++) + { + keypointsVecs[i] = new VectorOfKeyPoint(); + descriptors[i] = new Mat(); + nativeResult[i].Keypoints = keypointsVecs[i].CvPtr; + nativeResult[i].Descriptors = descriptors[i].CvPtr; + } + + NativeMethods.vector_ImageFeatures_getElements(ptr, nativeResult); + + var result = new ImageFeatures[size]; + for (int i = 0; i < size; i++) + { + result[i] = new ImageFeatures( + imgIdx: nativeResult[i].ImgIdx, + imgSize: nativeResult[i].ImgSize, + keypoints: keypointsVecs[i].ToArray(), + descriptors: descriptors[i]); + } + + // ElemPtr is IntPtr to memory held by this object, so make sure we are not disposed until finished with copy. + GC.KeepAlive(this); + return result; + } + catch + { + if (descriptors is not null) + { + foreach (var mat in descriptors) + { + mat.Dispose(); + } + } + + throw; + } + finally + { +#pragma warning disable CA1508 // (???) Avoid dead conditional code + if (keypointsVecs is not null) + { + foreach (var vec in keypointsVecs) + { + vec.Dispose(); + } + } +#pragma warning restore CA1508 + } + } + + private int[] KeypointsSizes(int size) + { + var ret = new nuint[size]; + NativeMethods.vector_ImageFeatures_getKeypointsSize(ptr, ret); + GC.KeepAlive(this); + return ret.Select(v => (int)v).ToArray(); + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfInt32.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfInt32.cs new file mode 100644 index 000000000..55e642879 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfInt32.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfInt32 : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfInt32() + { + ptr = NativeMethods.vector_int32_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfInt32(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_int32_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfInt32(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_int32_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_int32_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_int32_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_int32_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public int[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new int[size]; + Marshal.Copy(ElemPtr, dst, 0, dst.Length); + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfKeyLine.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfKeyLine.cs new file mode 100644 index 000000000..005e4b5d3 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfKeyLine.cs @@ -0,0 +1,79 @@ +#if false + +namespace OpenCvSharp.Internal.Vectors +{ + /// + /// + public class VectorOfKeyLine : DisposableCvObject, IStdVector + { + /// + /// Constructor + /// + public VectorOfKeyLine() + { + ptr = NativeMethods.vector_KeyLine_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_KeyLine_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_KeyLine_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_KeyLine_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public KeyLine[] ToArray() + { + var size = Size; + if (size == 0) + { + return Array.Empty(); + } + var dst = new KeyLine[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } + } +} + +#endif diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfKeyPoint.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfKeyPoint.cs new file mode 100644 index 000000000..84ba9027b --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfKeyPoint.cs @@ -0,0 +1,100 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfKeyPoint : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfKeyPoint() + { + ptr = NativeMethods.vector_KeyPoint_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfKeyPoint(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_KeyPoint_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfKeyPoint(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_KeyPoint_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_KeyPoint_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_KeyPoint_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_KeyPoint_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public KeyPoint[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new KeyPoint[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfMat.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfMat.cs new file mode 100644 index 000000000..d2056e8b8 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfMat.cs @@ -0,0 +1,118 @@ +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfMat : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfMat() + { + ptr = NativeMethods.vector_Mat_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfMat(int size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_Mat_new2((uint)size); + } + + /// + /// Constructor + /// + /// + public VectorOfMat(IEnumerable mats) + { + if (mats is null) + throw new ArgumentNullException(nameof(mats)); + + var matsArray = mats.ToArray(); + var matPointers = matsArray.Select(x => x.CvPtr).ToArray(); + + ptr = NativeMethods.vector_Mat_new3( + matPointers, + (uint) matPointers.Length); + + GC.KeepAlive(matPointers); + GC.KeepAlive(mats); // todo: rsb - should probably generate Mat[] and then get CvPtrs + foreach (var m in matsArray) + { + GC.KeepAlive(m); + } + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Mat_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Mat_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Mat_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Mat[] ToArray() + { + return ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public T[] ToArray() + where T : Mat, new() + { + var size = Size; + if (size == 0) + return []; + + var dst = new T[size]; + var dstPtr = new IntPtr[size]; + for (var i = 0; i < size; i++) + { + var m = new T(); + dst[i] = m; + dstPtr[i] = m.CvPtr; + } + NativeMethods.vector_Mat_assignToArray(ptr, dstPtr); + GC.KeepAlive(this); + + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfPoint.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint.cs new file mode 100644 index 000000000..218ff18d8 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint.cs @@ -0,0 +1,100 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfPoint : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfPoint() + { + ptr = NativeMethods.vector_Point2i_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfPoint(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_Point2i_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfPoint(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Point2i_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Point2i_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Point2i_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Point2i_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Point[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new Point[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfPoint2d.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint2d.cs new file mode 100644 index 000000000..ab135d527 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint2d.cs @@ -0,0 +1,78 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfPoint2d : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfPoint2d() + { + ptr = NativeMethods.vector_Point2d_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Point2d_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Point2d_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Point2d_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Point2d[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new Point2d[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfPoint2f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint2f.cs new file mode 100644 index 000000000..8d53cb07d --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint2f.cs @@ -0,0 +1,101 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfPoint2f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfPoint2f() + { + ptr = NativeMethods.vector_Point2f_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfPoint2f(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_Point2f_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfPoint2f(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Point2f_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Point2f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Point2f_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Point2f_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Point2f[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new Point2f[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfPoint3f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint3f.cs new file mode 100644 index 000000000..8c187dcf6 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfPoint3f.cs @@ -0,0 +1,101 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfPoint3f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfPoint3f() + { + ptr = NativeMethods.vector_Point3f_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfPoint3f(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_Point3f_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfPoint3f(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Point3f_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Point3f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Point3f_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Point3f_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Point3f[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new Point3f[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfRect.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfRect.cs new file mode 100644 index 000000000..d5daec889 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfRect.cs @@ -0,0 +1,100 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfRect : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfRect() + { + ptr = NativeMethods.vector_Rect_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfRect(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_Rect_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfRect(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Rect_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Rect_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Rect_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Rect_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Rect[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new Rect[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfRect2d.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfRect2d.cs new file mode 100644 index 000000000..89c1e40b2 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfRect2d.cs @@ -0,0 +1,102 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfRect2d : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfRect2d() + { + ptr = NativeMethods.vector_Rect2d_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfRect2d(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_Rect2d_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfRect2d(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Rect2d_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Rect2d_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Rect2d_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Rect2d_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Rect2d[] ToArray() + { + var size = Size; + if (size == 0) + { + return []; + } + var dst = new Rect2d[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfRotatedRect.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfRotatedRect.cs new file mode 100644 index 000000000..5b01fbde3 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfRotatedRect.cs @@ -0,0 +1,101 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfRotatedRect : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfRotatedRect() + { + ptr = NativeMethods.vector_RotatedRect_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfRotatedRect(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_RotatedRect_new2(size); + } + + /// + /// Constructor + /// + /// + public VectorOfRotatedRect(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_RotatedRect_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_RotatedRect_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_RotatedRect_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_RotatedRect_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public RotatedRect[] ToArray() + { + var size = Size; + if (size == 0) + return []; + + var dst = new RotatedRect[size]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = Marshal.SizeOf() * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfString.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfString.cs new file mode 100644 index 000000000..0653da4bd --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfString.cs @@ -0,0 +1,79 @@ +using System.Text; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfString : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfString() + { + ptr = NativeMethods.vector_string_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfString(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_string_new2(size); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_string_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_string_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public string[] ToArray() + { + var size = Size; + if (size == 0) + return []; + + var ret = new string[size]; + var cStringPointers = new IntPtr[size]; + var stringLengths = new int[size]; + + NativeMethods.vector_string_getElements(ptr, cStringPointers, stringLengths); + + for (var i = 0; i < size; i++) + { + unsafe + { + ret[i] = Encoding.UTF8.GetString((byte*) cStringPointers[i], stringLengths[i]); + } + } + + GC.KeepAlive(cStringPointers); + GC.KeepAlive(stringLengths); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVec2f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVec2f.cs new file mode 100644 index 000000000..c3338106c --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVec2f.cs @@ -0,0 +1,95 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfVec2f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVec2f() + { + ptr = NativeMethods.vector_Vec2f_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Vec2f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Vec2f_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Vec2f_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Vec2f[] ToArray() + { + return ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// structure that has two float members (ex. CvLineSegmentPolar, CvPoint2D32f, PointF) + /// + public T[] ToArray() where T : unmanaged + { + var typeSize = Marshal.SizeOf(); + if (typeSize != sizeof (float)*2) + throw new OpenCvSharpException($"Unsupported type '{typeof(T)}'"); + + var arySize = Size; + if (arySize == 0) + { + return []; + } + else + { + var dst = new T[arySize]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = typeSize * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVec3f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVec3f.cs new file mode 100644 index 000000000..51edf4490 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVec3f.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfVec3f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVec3f() + { + ptr = NativeMethods.vector_Vec3f_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Vec3f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Vec3f_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Vec3f_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Vec3f[] ToArray() + { + return ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// structure that has two float members (ex. CvLineSegmentPolar, CvPoint2D32f, PointF) + /// + public T[] ToArray() where T : unmanaged + { + var typeSize = Marshal.SizeOf(); + if (typeSize != sizeof (float)*3) + throw new OpenCvSharpException($"Unsupported type '{typeof(T)}'"); + + var arySize = Size; + if (arySize == 0) + { + return []; + } + var dst = new T[arySize]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = typeSize * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVec4f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVec4f.cs new file mode 100644 index 000000000..ecbddd655 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVec4f.cs @@ -0,0 +1,104 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfVec4f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVec4f() + { + ptr = NativeMethods.vector_Vec4f_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfVec4f(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Vec4f_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Vec4f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Vec4f_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Vec4f_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Vec4f[] ToArray() + { + return ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) + /// + public T[] ToArray() where T : unmanaged + { + var typeSize = Marshal.SizeOf(); + if (typeSize != sizeof (float)*4) + throw new OpenCvSharpException($"Unsupported type '{typeof(T)}'"); + + var arySize = Size; + if (arySize == 0) + { + return []; + } + var dst = new T[arySize]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = typeSize * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVec4i.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVec4i.cs new file mode 100644 index 000000000..e8e8da4e8 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVec4i.cs @@ -0,0 +1,104 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfVec4i : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVec4i() + { + ptr = NativeMethods.vector_Vec4i_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfVec4i(IEnumerable data) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + var array = data.ToArray(); + ptr = NativeMethods.vector_Vec4i_new3(array, (nuint)array.Length); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Vec4i_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Vec4i_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Vec4i_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Vec4i[] ToArray() + { + return ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) + /// + public T[] ToArray() where T : unmanaged + { + var typeSize = Marshal.SizeOf(); + if (typeSize != sizeof (int)*4) + throw new OpenCvSharpException($"Unsupported type '{typeof(T)}'"); + + var arySize = Size; + if (arySize == 0) + { + return []; + } + var dst = new T[arySize]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = typeSize * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVec6f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVec6f.cs new file mode 100644 index 000000000..397164ef3 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVec6f.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +internal class VectorOfVec6f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVec6f() + { + ptr = NativeMethods.vector_Vec6f_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_Vec6f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int Size + { + get + { + var res = NativeMethods.vector_Vec6f_getSize(ptr); + GC.KeepAlive(this); + return (int)res; + } + } + + /// + /// &vector[0] + /// + public IntPtr ElemPtr + { + get + { + var res = NativeMethods.vector_Vec6f_getPointer(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Converts std::vector to managed array + /// + /// + public Vec6f[] ToArray() + { + return ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) + /// + public T[] ToArray() where T : unmanaged + { + var typeSize = Marshal.SizeOf(); + if (typeSize != sizeof (float)*6) + throw new OpenCvSharpException($"Unsupported type '{typeof(T)}'"); + + var arySize = Size; + if (arySize == 0) + { + return []; + } + var dst = new T[arySize]; + using (var dstPtr = new ArrayAddress1(dst)) + { + long bytesToCopy = typeSize * dst.Length; + unsafe + { + Buffer.MemoryCopy(ElemPtr.ToPointer(), dstPtr.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + GC.KeepAlive(this); // ElemPtr is IntPtr to memory held by this object, so + // make sure we are not disposed until finished with copy. + return dst; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorByte.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorByte.cs new file mode 100644 index 000000000..3ec9f2299 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorByte.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfVectorByte : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorByte() + { + ptr = NativeMethods.vector_vector_uchar_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_uchar_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_uchar_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// vector.size() + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_uchar_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public byte[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new byte[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new byte[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_uchar_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorDMatch.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorDMatch.cs new file mode 100644 index 000000000..83cec9d7b --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorDMatch.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfVectorDMatch : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorDMatch() + { + ptr = NativeMethods.vector_vector_DMatch_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_DMatch_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_DMatch_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// vector.size() + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_DMatch_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public DMatch[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new DMatch[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new DMatch[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_DMatch_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorDouble.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorDouble.cs new file mode 100644 index 000000000..7213b74c4 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorDouble.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfVectorDouble : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorDouble() + { + ptr = NativeMethods.vector_vector_double_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_double_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_double_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// vector.size() + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_double_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public double[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new double[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new double[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_double_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorInt32.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorInt32.cs new file mode 100644 index 000000000..6ab52dde2 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorInt32.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfVectorInt32 : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorInt32() + { + ptr = NativeMethods.vector_vector_int_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_int_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_int_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// vector.size() + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_int_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public int[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new int[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new int[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_int_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorKeyLine.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorKeyLine.cs new file mode 100644 index 000000000..3bdc14359 --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorKeyLine.cs @@ -0,0 +1,79 @@ +#if false + +namespace OpenCvSharp.Internal.Vectors +{ + /// + /// + // ReSharper disable once InconsistentNaming + public class VectorOfVectorKeyLine : DisposableCvObject, IStdVector + { + /// + /// Constructor + /// + public VectorOfVectorKeyLine() + { + ptr = NativeMethods.vector_vector_KeyLine_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_KeyLine_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_KeyLine_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_KeyLine_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public KeyLine[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return Array.Empty(); + var size2 = GetSize2(); + + var ret = new KeyLine[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new KeyLine[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_KeyLine_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } + } +} + +#endif diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorKeyPoint.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorKeyPoint.cs new file mode 100644 index 000000000..bd068803f --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorKeyPoint.cs @@ -0,0 +1,89 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfVectorKeyPoint : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorKeyPoint() + { + ptr = NativeMethods.vector_vector_KeyPoint_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfVectorKeyPoint(KeyPoint[][] values) + { + if (values is null) + throw new ArgumentNullException(nameof(values)); + + using var aa = new ArrayAddress2(values); + ptr = NativeMethods.vector_vector_KeyPoint_new3( + aa.GetPointer(), aa.GetDim1Length(), aa.GetDim2Lengths()); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_KeyPoint_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_KeyPoint_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// vector.size() + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_KeyPoint_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public KeyPoint[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new KeyPoint[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new KeyPoint[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_KeyPoint_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorPoint.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorPoint.cs new file mode 100644 index 000000000..3c0ed219e --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorPoint.cs @@ -0,0 +1,86 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +public class VectorOfVectorPoint : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorPoint() + { + ptr = NativeMethods.vector_vector_Point_new1(); + } + + /// + /// Constructor + /// + /// + public VectorOfVectorPoint(nuint size) + { + if (size < 0) + throw new ArgumentOutOfRangeException(nameof(size)); + ptr = NativeMethods.vector_vector_Point_new2(size); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_Point_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_Point_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// + /// + public int Size => GetSize1(); + + /// + /// vector.size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_Point_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public Point[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new Point[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new Point[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_Point_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Internal/Vectors/VectorOfVectorPoint2f.cs b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorPoint2f.cs new file mode 100644 index 000000000..c018417cf --- /dev/null +++ b/src/OpenCvSharp/Internal/Vectors/VectorOfVectorPoint2f.cs @@ -0,0 +1,76 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp.Internal.Vectors; + +/// +/// +// ReSharper disable once InconsistentNaming +public class VectorOfVectorPoint2f : DisposableCvObject, IStdVector +{ + /// + /// Constructor + /// + public VectorOfVectorPoint2f() + { + ptr = NativeMethods.vector_vector_Point2f_new1(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.vector_vector_Point2f_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// vector.size() + /// + public int GetSize1() + { + var res = NativeMethods.vector_vector_Point2f_getSize1(ptr); + GC.KeepAlive(this); + return (int)res; + } + + /// + /// + /// + public int Size => GetSize1(); + + /// + /// vector[i].size() + /// + public IReadOnlyList GetSize2() + { + var size1 = GetSize1(); + var size2 = new nuint[size1]; + NativeMethods.vector_vector_Point2f_getSize2(ptr, size2); + GC.KeepAlive(this); + return size2.Select(s => (long)s).ToArray(); + } + + /// + /// Converts std::vector to managed array + /// + /// + public Point2f[][] ToArray() + { + var size1 = GetSize1(); + if (size1 == 0) + return []; + var size2 = GetSize2(); + + var ret = new Point2f[size1][]; + for (var i = 0; i < size1; i++) + { + ret[i] = new Point2f[size2[i]]; + } + + using var retPtr = new ArrayAddress2(ret); + NativeMethods.vector_vector_Point2f_copy(ptr, retPtr.GetPointer()); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Modules/aruco/CvAruco.cs b/src/OpenCvSharp/Modules/aruco/CvAruco.cs new file mode 100644 index 000000000..7cfa6460b --- /dev/null +++ b/src/OpenCvSharp/Modules/aruco/CvAruco.cs @@ -0,0 +1,299 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Aruco; + +/// +/// aruco module +/// +public static class CvAruco +{ + /// + /// Basic marker detection + /// + /// input image + /// indicates the type of markers that will be searched + /// vector of detected marker corners. + /// For each marker, its four corners are provided. For N detected markers, + /// the dimensions of this array is Nx4.The order of the corners is clockwise. + /// vector of identifiers of the detected markers. The identifier is of type int. + /// For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array. + /// marker detection parameters + /// contains the imgPoints of those squares whose inner code has not a + /// correct codification.Useful for debugging purposes. + public static void DetectMarkers( + InputArray image, + Dictionary dictionary, + out Point2f[][] corners, + out int[] ids, + DetectorParameters parameters, + out Point2f[][] rejectedImgPoints) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (dictionary is null) + throw new ArgumentNullException(nameof(dictionary)); + dictionary.ThrowIfDisposed(); + + using var cornersVec = new VectorOfVectorPoint2f(); + using var idsVec = new VectorOfInt32(); + using var rejectedImgPointsVec = new VectorOfVectorPoint2f(); + + NativeMethods.HandleException( + NativeMethods.aruco_detectMarkers( + image.CvPtr, dictionary.CvPtr, cornersVec.CvPtr, idsVec.CvPtr, ref parameters, + rejectedImgPointsVec.CvPtr)); + + corners = cornersVec.ToArray(); + ids = idsVec.ToArray(); + rejectedImgPoints = rejectedImgPointsVec.ToArray(); + + GC.KeepAlive(image); + GC.KeepAlive(dictionary); + GC.KeepAlive(parameters); + } + + /// + /// Pose estimation for single markers + /// + /// corners vector of already detected markers corners. + /// For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f>> ). + /// For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. + /// the length of the markers' side. The returning translation vectors will + /// be in the same unit.Normally, unit is meters. + /// input 3x3 floating-point camera matrix + /// \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ + /// vector of distortion coefficients + /// \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements + /// array of output rotation vectors (@sa Rodrigues) (e.g. std::vector<cv::Vec3d>). + /// Each element in rvecs corresponds to the specific marker in imgPoints. + /// array of output translation vectors (e.g. std::vector<cv::Vec3d>). + /// Each element in tvecs corresponds to the specific marker in imgPoints. + /// array of object points of all the marker corners + public static void EstimatePoseSingleMarkers( + Point2f[][] corners, + float markerLength, + InputArray cameraMatrix, + InputArray distortionCoefficients, + OutputArray rvec, + OutputArray tvec, + OutputArray? objPoints = null) + { + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + if (cameraMatrix is null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (distortionCoefficients is null) + throw new ArgumentNullException(nameof(distortionCoefficients)); + if (rvec is null) + throw new ArgumentNullException(nameof(rvec)); + if (tvec is null) + throw new ArgumentNullException(nameof(tvec)); + + cameraMatrix.ThrowIfDisposed(); + distortionCoefficients.ThrowIfDisposed(); + rvec.ThrowIfNotReady(); + tvec.ThrowIfNotReady(); + objPoints?.ThrowIfNotReady(); + + using var cornersAddress = new ArrayAddress2(corners); + + NativeMethods.HandleException( + NativeMethods.aruco_estimatePoseSingleMarkers( + cornersAddress.GetPointer(), cornersAddress.GetDim1Length(), cornersAddress.GetDim2Lengths(), + markerLength, cameraMatrix.CvPtr, distortionCoefficients.CvPtr, rvec.CvPtr, tvec.CvPtr, + objPoints?.CvPtr ?? IntPtr.Zero)); + + GC.KeepAlive(cameraMatrix); + GC.KeepAlive(distortionCoefficients); + rvec.Fix(); + tvec.Fix(); + objPoints?.Fix(); + } + + /// + /// Draw detected markers in image + /// + /// input/output image. It must have 1 or 3 channels. The number of channels is not altered. + /// positions of marker corners on input image. + /// For N detected markers, the dimensions of this array should be Nx4.The order of the corners should be clockwise. + /// vector of identifiers for markers in markersCorners. Optional, if not provided, ids are not painted. + public static void DrawDetectedMarkers(InputArray image, Point2f[][] corners, IEnumerable ids) + { + DrawDetectedMarkers(image, corners, ids, new Scalar(0, 255, 0)); + } + + /// + /// Draw detected markers in image + /// + /// input/output image. It must have 1 or 3 channels. The number of channels is not altered. + /// positions of marker corners on input image. + /// For N detected markers, the dimensions of this array should be Nx4.The order of the corners should be clockwise. + /// vector of identifiers for markers in markersCorners. Optional, if not provided, ids are not painted. + /// color of marker borders. Rest of colors (text color and first corner color) + /// are calculated based on this one to improve visualization. + public static void DrawDetectedMarkers(InputArray image, Point2f[][] corners, IEnumerable? ids, Scalar borderColor) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (corners is null) + throw new ArgumentNullException(nameof(corners)); + + using var cornersAddress = new ArrayAddress2(corners); + if (ids is null) + { + NativeMethods.HandleException( + NativeMethods.aruco_drawDetectedMarkers( + image.CvPtr, cornersAddress.GetPointer(), cornersAddress.GetDim1Length(), cornersAddress.GetDim2Lengths(), + IntPtr.Zero, 0, borderColor)); + } + else + { + var idxArray = ids.ToArray(); + NativeMethods.HandleException( + NativeMethods.aruco_drawDetectedMarkers( + image.CvPtr, cornersAddress.GetPointer(), cornersAddress.GetDim1Length(), cornersAddress.GetDim2Lengths(), + idxArray, idxArray.Length, borderColor)); + } + GC.KeepAlive(image); + } + + /// + /// Returns one of the predefined dictionaries defined in PREDEFINED_DICTIONARY_NAME + /// + /// + /// + public static Dictionary GetPredefinedDictionary(PredefinedDictionaryName name) + { + NativeMethods.HandleException( + NativeMethods.aruco_getPredefinedDictionary((int) name, out IntPtr p)); + return new Dictionary(p); + } + + /// + /// Reads a new dictionary from FileNode. + /// + /// + /// Dictionary format is YAML see sample below + /// + /// nmarkers: 35 + /// markersize: 6 + /// maxCorrectionBits: 5 + /// marker_0: "101011111011111001001001101100000000" + /// ... + /// marker_34: "011111010000111011111110110101100101" + /// + /// + /// The path of the dictionary file + /// Instance of a Dictionary + public static Dictionary ReadDictionary(string dictionaryFile) + { + NativeMethods.HandleException( + NativeMethods.aruco_readDictionary(dictionaryFile, out IntPtr p)); + return new Dictionary(p); + } + + /// + /// Detect ChArUco Diamond markers. + /// + /// input image necessary for corner subpixel. + /// list of detected marker corners from detectMarkers function. + /// list of marker ids in markerCorners. + /// rate between square and marker length: squareMarkerLengthRate = squareLength/markerLength. The real units are not necessary. + /// output list of detected diamond corners (4 corners per diamond). The order is the same than in marker corners: top left, top right, bottom right and bottom left. Similar format than the corners returned by detectMarkers (e.g std::vector<std::vector<cv::Point2f>>). + /// ids of the diamonds in diamondCorners. The id of each diamond is in fact of type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the diamond. + /// Optional camera calibration matrix. + /// Optional camera distortion coefficients. + public static void DetectCharucoDiamond(InputArray image, Point2f[][] markerCorners, IEnumerable markerIds, + float squareMarkerLengthRate, out Point2f[][] diamondCorners, out Vec4i[] diamondIds, + InputArray? cameraMatrix = null, InputArray? distCoeffs = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (markerCorners is null) + throw new ArgumentNullException(nameof(markerCorners)); + if (markerIds is null) + throw new ArgumentNullException(nameof(markerIds)); + + if (cameraMatrix is null && distCoeffs is not null) + throw new ArgumentNullException(nameof(cameraMatrix)); + if (cameraMatrix is not null && distCoeffs is null) + throw new ArgumentNullException(nameof(distCoeffs)); + + image.ThrowIfDisposed(); + + cameraMatrix?.ThrowIfDisposed(); + distCoeffs?.ThrowIfDisposed(); + + using var markerCornersAddress = new ArrayAddress2(markerCorners); + using var markerIdsVec = new VectorOfInt32(markerIds); + + using var diamondCornersVec = new VectorOfVectorPoint2f(); + using var diamondIdsVec = new VectorOfVec4i(); + + NativeMethods.HandleException( + NativeMethods.aruco_detectCharucoDiamond( + image.CvPtr, markerCornersAddress.GetPointer(), markerCornersAddress.GetDim1Length(), markerCornersAddress.GetDim2Lengths(), + markerIdsVec.CvPtr, squareMarkerLengthRate, + diamondCornersVec.CvPtr, diamondIdsVec.CvPtr, + cameraMatrix?.CvPtr ?? IntPtr.Zero, distCoeffs?.CvPtr ?? IntPtr.Zero)); + + diamondCorners = diamondCornersVec.ToArray(); + diamondIds = diamondIdsVec.ToArray(); + + GC.KeepAlive(image); + if (cameraMatrix is not null) + GC.KeepAlive(cameraMatrix); + if (distCoeffs is not null) + GC.KeepAlive(distCoeffs); + } + + /// + /// Draw a set of detected ChArUco Diamond markers. + /// + /// input/output image. It must have 1 or 3 channels. The number of channels is not altered. + /// positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f>>). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. + /// vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. + public static void DrawDetectedDiamonds(InputArray image, Point2f[][] diamondCorners, IEnumerable? diamondIds = null) + { + DrawDetectedDiamonds(image, diamondCorners, diamondIds, new Scalar(0, 0, 255)); + } + + /// + /// Draw a set of detected ChArUco Diamond markers. + /// + /// input/output image. It must have 1 or 3 channels. The number of channels is not altered. + /// positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f>>). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. + /// vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. + /// color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one. + public static void DrawDetectedDiamonds(InputArray image, + Point2f[][] diamondCorners, IEnumerable? diamondIds, Scalar borderColor) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (diamondCorners is null) + throw new ArgumentNullException(nameof(diamondCorners)); + + using var cornersAddress = new ArrayAddress2(diamondCorners); + + if (diamondIds is null) + { + NativeMethods.HandleException( + NativeMethods.aruco_drawDetectedDiamonds(image.CvPtr, + cornersAddress.GetPointer(), cornersAddress.GetDim1Length(), cornersAddress.GetDim2Lengths(), + IntPtr.Zero, borderColor)); + } + else + { + using var ids = new VectorOfVec4i(diamondIds); + + NativeMethods.HandleException( + NativeMethods.aruco_drawDetectedDiamonds(image.CvPtr, + cornersAddress.GetPointer(), cornersAddress.GetDim1Length(), cornersAddress.GetDim2Lengths(), + ids.CvPtr, borderColor)); + } + + GC.KeepAlive(image); + } +} diff --git a/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs b/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs new file mode 100644 index 000000000..c99ac57c1 --- /dev/null +++ b/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs @@ -0,0 +1,200 @@ +using System.Runtime.InteropServices; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.Aruco; + +#pragma warning disable CA1815 + +/// +/// Parameters for the detectMarker process +/// +[StructLayout(LayoutKind.Sequential)] +public struct DetectorParameters +{ + /// + /// minimum window size for adaptive thresholding before finding contours (default 3). + /// + public int AdaptiveThreshWinSizeMin = 3; + + /// + /// adaptiveThreshWinSizeMax: maximum window size for adaptive thresholding before finding contours(default 23). + /// + public int AdaptiveThreshWinSizeMax = 23; + + /// + /// increments from adaptiveThreshWinSizeMin to adaptiveThreshWinSizeMax during the thresholding(default 10). + /// + public int AdaptiveThreshWinSizeStep = 10; + + /// + /// constant for adaptive thresholding before finding contours (default 7) + /// + public double AdaptiveThreshConstant = 7; + + /// + /// determine minimum perimeter for marker contour to be detected. + /// This is defined as a rate respect to the maximum dimension of the input image(default 0.03). + /// + public double MinMarkerPerimeterRate = 0.03; + + /// + /// determine maximum perimeter for marker contour to be detected. + /// This is defined as a rate respect to the maximum dimension of the input image(default 4.0). + /// + public double MaxMarkerPerimeterRate = 4; + + /// + /// minimum accuracy during the polygonal approximation process to determine which contours are squares. + /// + public double PolygonalApproxAccuracyRate = 0.03; + + /// + /// minimum distance between corners for detected markers relative to its perimeter(default 0.05) + /// + public double MinCornerDistanceRate = 0.05; + + /// + /// minimum distance of any corner to the image border for detected markers (in pixels) (default 3) + /// + public int MinDistanceToBorder = 3; + + /// + /// minimum mean distance between two marker corners to be considered similar, + /// so that the smaller one is removed.The rate is relative to the smaller perimeter of the two markers(default 0.05). + /// + public double MinMarkerDistanceRate = 0.05; + + /// + /// corner refinement method. + /// (CORNER_REFINE_NONE, no refinement. CORNER_REFINE_SUBPIX, do subpixel refinement. CORNER_REFINE_CONTOUR use contour-Points) + /// + [MarshalAs(UnmanagedType.I4)] + public CornerRefineMethod CornerRefinementMethod = CornerRefineMethod.None; + + /// + /// window size for the corner refinement process (in pixels) (default 5). + /// + public int CornerRefinementWinSize = 5; + + /// + /// maximum number of iterations for stop criteria of the corner refinement process(default 30). + /// + public int CornerRefinementMaxIterations = 30; + + /// + /// minimum error for the stop criteria of the corner refinement process(default: 0.1) + /// + public double CornerRefinementMinAccuracy = 0.1; + + /// + /// number of bits of the marker border, i.e. marker border width (default 1). + /// + public int MarkerBorderBits = 1; + + /// + /// number of bits (per dimension) for each cell of the marker when removing the perspective(default 8). + /// + public int PerspectiveRemovePixelPerCell = 4; + + /// + /// width of the margin of pixels on each cell not considered for the determination + /// of the cell bit.Represents the rate respect to the total size of the cell, + /// i.e. perspectiveRemovePixelPerCell (default 0.13) + /// + public double PerspectiveRemoveIgnoredMarginPerCell = 0.13; + + /// + /// maximum number of accepted erroneous bits in the border + /// (i.e. number of allowed white bits in the border). Represented as a rate respect to the total + /// number of bits per marker(default 0.35). + /// + public double MaxErroneousBitsInBorderRate = 0.35; + + /// + /// minimun standard deviation in pixels values during the decodification step to + /// apply Otsu thresholding(otherwise, all the bits are set to 0 or 1 depending on mean higher than 128 or not) (default 5.0) + /// + public double MinOtsuStdDev = 5.0; + + /// + /// errorCorrectionRate error correction rate respect to the maximun error correction capability for each dictionary. (default 0.6). + /// + public double ErrorCorrectionRate = 0.6; + + /// + /// Detection of quads can be done on a lower-resolution image, improving speed at a cost of pose accuracy and a slight decrease in detection rate. + /// Decoding the binary payload is still done at full resolution. + /// + public float AprilTagQuadDecimate = 0; + + /// + /// What Gaussian blur should be applied to the segmented image (used for quad detection?) Parameter is the standard deviation in pixels. + /// Very noisy images benefit from non-zero values (e.g. 0.8). + /// + public float AprilTagQuadSigma = 0; + + /// + /// reject quads containing too few pixels. + /// + public int AprilTagMinClusterPixels = 5; + + /// + /// how many corner candidates to consider when segmenting a group of pixels into a quad. + /// + public int AprilTagMaxNmaxima = 10; + + /// + /// Reject quads where pairs of edges have angles that are close to straight or close to 180 degrees. Zero means that no quads are rejected. (In radians). + /// + public float AprilTagCriticalRad = (float)(10 * Cv2.PI / 180); + + /// + /// When fitting lines to the contours, what is the maximum mean squared error allowed? + /// This is useful in rejecting contours that are far from being quad shaped; rejecting these quads "early" saves expensive decoding processing. + /// + public float AprilTagMaxLineFitMse = 10; + + /// + /// When we build our model of black & white pixels, we add an extra check that the white model must be (overall) brighter than the black model. + /// How much brighter? (in pixel values, [0,255]). + /// + public int AprilTagMinWhiteBlackDiff = 5; + + /// + /// should the thresholded image be deglitched? Only useful for very noisy images + /// + public int AprilTagDeglitch = 0; + + /// + /// to check if there is a white marker. In order to generate a "white" marker just invert a normal marker by using a tilde, ~markerImage. (default false) + /// + [MarshalAs(UnmanagedType.U1)] + public bool DetectInvertedMarker = false; + + /// + /// enable the new and faster Aruco detection strategy. + /// Proposed in the paper: + /// * Romero-Ramirez et al: Speeded up detection of squared fiducial markers (2018) + /// * https://www.researchgate.net/publication/325787310_Speeded_Up_Detection_of_Squared_Fiducial_Markers + /// + [MarshalAs(UnmanagedType.U1)] + public bool UseAruco3Detection = false; + + /// + /// minimum side length of a marker in the canonical image. Latter is the binarized image in which contours are searched. + /// + public int MinSideLengthCanonicalImg = 32; + + /// + /// range [0,1], eq (2) from paper. The parameter tau_i has a direct influence on the processing speed. + /// + public float MinMarkerLengthRatioOriginalImg = 0.0f; + + /// + /// Constructor + /// + public DetectorParameters() + { + } +} diff --git a/src/OpenCvSharp/Modules/aruco/Dictionary.cs b/src/OpenCvSharp/Modules/aruco/Dictionary.cs new file mode 100644 index 000000000..fa3c0a1b3 --- /dev/null +++ b/src/OpenCvSharp/Modules/aruco/Dictionary.cs @@ -0,0 +1,187 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Aruco; + +/// +/// Dictionary/Set of markers. It contains the inner codification +/// +public class Dictionary : DisposableCvObject +{ + /// + /// + /// + internal Dictionary(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero && IsEnabledDispose) + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Marker code information + /// + public Mat BytesList + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_getBytesList(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + } + + /// + /// Number of bits per dimension. + /// + public int MarkerSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_getMarkerSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_setMarkerSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Maximum number of bits that can be corrected. + /// + public int MaxCorrectionBits + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_getMaxCorrectionBits(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_setMaxCorrectionBits(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Given a matrix of bits. Returns whether if marker is identified or not. + /// It returns by reference the correct id (if any) and the correct rotation + /// + /// + /// + /// + /// + /// + public bool Identify(Mat onlyBits, out int idx, out int rotation, double maxCorrectionRate) + { + if (onlyBits is null) + throw new ArgumentNullException(nameof(onlyBits)); + onlyBits.ThrowIfDisposed(); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_identify(ptr, onlyBits.CvPtr, out idx, out rotation, maxCorrectionRate, out var ret)); + + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the distance of the input bits to the specific id. + /// If allRotations is true, the four possible bits rotation are considered + /// + /// + /// + /// + /// + public int GetDistanceToId(InputArray bits, int id, bool allRotations = true) + { + if (bits is null) + throw new ArgumentNullException(nameof(bits)); + bits.ThrowIfDisposed(); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_getDistanceToId(ptr, bits.CvPtr, id, allRotations ? 1 : 0, out var ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Generate a canonical marker image + /// + /// + /// + /// + /// + public void GenerateImageMarker(int id, int sidePixels, OutputArray img, int borderBits = 1) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfNotReady(); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_generateImageMarker(ptr, id, sidePixels, img.CvPtr, borderBits)); + + GC.KeepAlive(this); + } + + /// + /// Transform matrix of bits to list of bytes in the 4 rotations + /// + /// + /// + public static Mat GetByteListFromBits(Mat bits) + { + if (bits is null) + throw new ArgumentNullException(nameof(bits)); + bits.ThrowIfDisposed(); + + var ret = new Mat(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_getByteListFromBits(bits.CvPtr, ret.CvPtr)); + return ret; + } + + /// + /// Transform list of bytes to matrix of bits + /// + /// + /// + /// + public static Mat GetBitsFromByteList(Mat byteList, int markerSize) + { + if (byteList is null) + throw new ArgumentNullException(nameof(byteList)); + byteList.ThrowIfDisposed(); + + var ret = new Mat(); + NativeMethods.HandleException( + NativeMethods.aruco_Dictionary_getBitsFromByteList(byteList.CvPtr, markerSize, ret.CvPtr)); + return ret; + } +} diff --git a/src/OpenCvSharp/Modules/aruco/Enum/CornerRefineMethod.cs b/src/OpenCvSharp/Modules/aruco/Enum/CornerRefineMethod.cs new file mode 100644 index 000000000..a23bad23c --- /dev/null +++ b/src/OpenCvSharp/Modules/aruco/Enum/CornerRefineMethod.cs @@ -0,0 +1,27 @@ +namespace OpenCvSharp.Aruco; + +/// +/// corner refinement method +/// +public enum CornerRefineMethod +{ + /// + /// Tag and corners detection based on the ArUco approach. + /// + None, + + /// + /// ArUco approach and refine the corners locations using corner subpixel accuracy. + /// + Subpix, + + /// + /// ArUco approach and refine the corners locations using the contour-points line fitting. + /// + Contour, + + /// + /// Tag and corners detection based on the AprilTag 2 approach + /// + AprilTag +} diff --git a/src/OpenCvSharp/Modules/aruco/Enum/PredefinedDictionaryName.cs b/src/OpenCvSharp/Modules/aruco/Enum/PredefinedDictionaryName.cs new file mode 100644 index 000000000..1bfa361a2 --- /dev/null +++ b/src/OpenCvSharp/Modules/aruco/Enum/PredefinedDictionaryName.cs @@ -0,0 +1,31 @@ +// ReSharper disable InconsistentNaming +namespace OpenCvSharp.Aruco; + +/// +/// PredefinedDictionaryName +/// +public enum PredefinedDictionaryName +{ +#pragma warning disable 1591 + Dict4X4_50 = 0, + Dict4X4_100, + Dict4X4_250, + Dict4X4_1000, + Dict5X5_50, + Dict5X5_100, + Dict5X5_250, + Dict5X5_1000, + Dict6X6_50, + Dict6X6_100, + Dict6X6_250, + Dict6X6_1000, + Dict7X7_50, + Dict7X7_100, + Dict7X7_250, + Dict7X7_1000, + DictArucoOriginal, + DictAprilTag_16h5, + DictAprilTag_25h9, + DictAprilTag_36h10, + DictAprilTag_36h11 +} diff --git a/src/OpenCvSharp/Modules/bgsegm/BackgroundSubtractorGMG.cs b/src/OpenCvSharp/Modules/bgsegm/BackgroundSubtractorGMG.cs new file mode 100644 index 000000000..023e5115c --- /dev/null +++ b/src/OpenCvSharp/Modules/bgsegm/BackgroundSubtractorGMG.cs @@ -0,0 +1,289 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Background Subtractor module. Takes a series of images and returns a sequence of mask (8UC1) +/// images of the same size, where 255 indicates Foreground and 0 represents Background. +/// +public class BackgroundSubtractorGMG : BackgroundSubtractor +{ + /// + /// cv::Ptr<T> + /// + private Ptr? objectPtr; + + /// + /// Creates a GMG Background Subtractor + /// + /// number of frames used to initialize the background models. + /// Threshold value, above which it is marked foreground, else background. + /// + public static BackgroundSubtractorGMG Create( + int initializationFrames = 120, double decisionThreshold = 0.8) + { + NativeMethods.HandleException( + NativeMethods.bgsegm_createBackgroundSubtractorGMG( + initializationFrames, decisionThreshold, out var ptr)); + return new BackgroundSubtractorGMG(ptr); + } + + internal BackgroundSubtractorGMG(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + base.DisposeManaged(); + } + + #region Properties + + /// + /// + /// + public int MaxFeatures + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getMaxFeatures(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setMaxFeatures(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double DefaultLearningRate + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getDefaultLearningRate(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setDefaultLearningRate(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NumFrames + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getNumFrames(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setNumFrames(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int QuantizationLevels + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getQuantizationLevels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setQuantizationLevels(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double BackgroundPrior + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getBackgroundPrior(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setBackgroundPrior(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int SmoothingRadius + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getSmoothingRadius(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setSmoothingRadius(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double DecisionThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getDecisionThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setDecisionThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool UpdateBackgroundModel + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getUpdateBackgroundModel(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setUpdateBackgroundModel(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double MinVal + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getMinVal(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setMinVal(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double MaxVal + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_getMaxVal(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorGMG_setMaxVal(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.bgsegm_Ptr_BackgroundSubtractorGMG_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.bgsegm_Ptr_BackgroundSubtractorGMG_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/bgsegm/BackgroundSubtractorMOG.cs b/src/OpenCvSharp/Modules/bgsegm/BackgroundSubtractorMOG.cs new file mode 100644 index 000000000..33c609c81 --- /dev/null +++ b/src/OpenCvSharp/Modules/bgsegm/BackgroundSubtractorMOG.cs @@ -0,0 +1,154 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm +/// +public class BackgroundSubtractorMOG : BackgroundSubtractor +{ + /// + /// cv::Ptr<T> + /// + private Ptr? objectPtr; + + /// + /// Creates mixture-of-gaussian background subtractor + /// + /// Length of the history. + /// Number of Gaussian mixtures. + /// Background ratio. + /// Noise strength (standard deviation of the brightness or each color channel). 0 means some automatic value. + /// + public static BackgroundSubtractorMOG Create( + int history = 200, int nMixtures = 5, double backgroundRatio = 0.7, double noiseSigma = 0) + { + NativeMethods.HandleException( + NativeMethods.bgsegm_createBackgroundSubtractorMOG( + history, nMixtures, backgroundRatio, noiseSigma, out var ptr)); + return new BackgroundSubtractorMOG(ptr); + } + + internal BackgroundSubtractorMOG(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + base.DisposeManaged(); + } + + /// + /// + /// + public int History + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_getHistory(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_setHistory(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NMixtures + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_getNMixtures(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_setNMixtures(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double BackgroundRatio + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_getBackgroundRatio(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_setBackgroundRatio(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double NoiseSigma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_getNoiseSigma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.bgsegm_BackgroundSubtractorMOG_setNoiseSigma(ptr, value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.bgsegm_Ptr_BackgroundSubtractorMOG_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.bgsegm_Ptr_BackgroundSubtractorMOG_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs new file mode 100644 index 000000000..af4ce88f1 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs @@ -0,0 +1,105 @@ +namespace OpenCvSharp; + +/// +/// Different flags for cvCalibrateCamera2 and cvStereoCalibrate +/// +[Flags] +public enum CalibrationFlags +{ + /// + /// + /// + None = 0, + + /// + /// The flag allows the function to optimize some or all of the intrinsic parameters, depending on the other flags, but the initial values are provided by the user + /// + UseIntrinsicGuess = 0x00001, + + /// + /// fyk is optimized, but the ratio fxk/fyk is fixed. + /// + FixAspectRatio = 0x00002, + + /// + /// The principal points are fixed during the optimization. + /// + FixPrincipalPoint = 0x00004, + + /// + /// Tangential distortion coefficients are set to zeros and do not change during the optimization. + /// + ZeroTangentDist = 0x00008, + + /// + /// fxk and fyk are fixed. + /// + FixFocalLength = 0x00010, + + /// + /// The 0-th distortion coefficients (k1) are fixed + /// + FixK1 = 0x00020, + + /// + /// The 1-th distortion coefficients (k2) are fixed + /// + FixK2 = 0x00040, + + /// + /// The 4-th distortion coefficients (k3) are fixed + /// + FixK3 = 0x00080, + + /// + /// Do not change the corresponding radial distortion coefficient during the optimization. + /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. + /// + FixK4 = 0x00800, + + /// + /// Do not change the corresponding radial distortion coefficient during the optimization. + /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. + /// + FixK5 = 0x01000, + + /// + /// Do not change the corresponding radial distortion coefficient during the optimization. + /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. + /// + FixK6 = 0x02000, + + /// + /// Enable coefficients k4, k5 and k6. + /// To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function + /// use the rational model and return 8 coefficients. If the flag is not set, the function will compute only 5 distortion coefficients. + /// + RationalModel = 0x04000, + + /// + /// + /// + ThinPrismModel = 0x08000, + + /// + /// + /// +#pragma warning disable CA1069 // Enums should not have duplicate values + FixS1S2S3S4 = 0x08000, +#pragma warning restore CA1069 + + /// + /// If it is set, camera_matrix1,2, as well as dist_coeffs1,2 are fixed, so that only extrinsic parameters are optimized. + /// + FixIntrinsic = 0x00100, + + /// + /// Enforces fx0=fx1 and fy0=fy1. CV_CALIB_ZERO_TANGENT_DIST - Tangential distortion coefficients for each camera are set to zeros and fixed there. + /// + SameFocalLength = 0x00200, + + /// + /// for stereo rectification + /// + ZeroDisparity = 0x00400, +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs new file mode 100644 index 000000000..d41e59948 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs @@ -0,0 +1,50 @@ + + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// Various operation flags for cvFindChessboardCorners +/// +[Flags] +public enum ChessboardFlags +{ + /// + /// + /// + None = 0, + + /// + /// Use adaptive thresholding to convert the image to black-n-white, rather than a fixed threshold level (computed from the average image brightness). + /// + AdaptiveThresh = 1, + + /// + /// Normalize the image using cvNormalizeHist before applying fixed or adaptive thresholding. + /// + NormalizeImage = 2, + + /// + /// Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads + /// that are extracted at the contour retrieval stage. + /// + FilterQuads = 4, + + /// + /// Run a fast check on the image that looks for chessboard corners, and shortcut the call if none is found. + /// This can drastically speed up the call in the degenerate condition when no chessboard is observed. + /// + FastCheck = 8, + + /// + /// Run an exhaustive search to improve detection rate. + /// + Exhaustive = 16, + + /// + /// Up sample input image to improve sub-pixel accuracy due to aliasing effects. + /// This should be used if an accurate camera calibration is required. + /// + Accuracy = 32 +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/EssentialMatMethod.cs b/src/OpenCvSharp/Modules/calib3d/Enum/EssentialMatMethod.cs new file mode 100644 index 000000000..c0325cb9e --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/EssentialMatMethod.cs @@ -0,0 +1,19 @@ +namespace OpenCvSharp; + +/// +/// Method for computing the essential matrix +/// +[Flags] +public enum EssentialMatMethod +{ + /// + /// for LMedS algorithm. + /// + LMedS = 4, + + + /// + /// for RANSAC algorithm. + /// + Ransac = 8, +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/FindCirclesGridFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/FindCirclesGridFlags.cs new file mode 100644 index 000000000..c70b2c80f --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/FindCirclesGridFlags.cs @@ -0,0 +1,23 @@ +namespace OpenCvSharp; + +/// +/// Method for solving a PnP problem: +/// +[Flags] +public enum FindCirclesGridFlags +{ + /// + /// uses symmetric pattern of circles. + /// + SymmetricGrid = 1, + + /// + /// uses asymmetric pattern of circles. + /// + AsymmetricGrid = 2, + + /// + /// uses a special algorithm for grid detection. It is more robust to perspective distortions but much more sensitive to background clutter. + /// + Clustering = 4, +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/FishEyeCalibrationFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/FishEyeCalibrationFlags.cs new file mode 100644 index 000000000..998ece377 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/FishEyeCalibrationFlags.cs @@ -0,0 +1,22 @@ + + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; +#pragma warning disable CS1591 + +[Flags] +public enum FishEyeCalibrationFlags +{ + None = 0, + UseIntrinsicGuess = 1, + RecomputeExtrinsic = 1 << 1, + CheckCond = 1 << 2, + FixSkew = 1 << 3, + FixK1 = 1 << 4, + FixK2 = 1 << 5, + FixK3 = 1 << 6, + FixK4 = 1 << 7, + FixIntrinsic = 1 << 8, + FixPrincipalPoint = 1 << 9 +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs b/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs new file mode 100644 index 000000000..f3bc9173c --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs @@ -0,0 +1,29 @@ +namespace OpenCvSharp; + +/// +/// Method for computing the fundamental matrix +/// +[Flags] +public enum FundamentalMatMethods +{ + /// + /// for 7-point algorithm. N == 7 + /// + Point7 = 1, + + /// + /// for 8-point algorithm. N >= 8 + /// [CV_FM_8POINT] + /// + Point8 = 2, + + /// + /// for LMedS algorithm. N > 8 + /// + LMedS = 4, + + /// + /// for RANSAC algorithm. N > 8 + /// + Ransac = 8, +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/HandEyeCalibrationMethod.cs b/src/OpenCvSharp/Modules/calib3d/Enum/HandEyeCalibrationMethod.cs new file mode 100644 index 000000000..94f0b60cc --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/HandEyeCalibrationMethod.cs @@ -0,0 +1,35 @@ +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// method One of the implemented Hand-Eye calibration method +/// +public enum HandEyeCalibrationMethod +{ + /// + /// A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/Eye Calibration @cite Tsai89 + /// + TSAI = 0, + + /// + /// Robot Sensor Calibration: Solving AX = XB on the Euclidean Group @cite Park94 + /// + PARK = 1, + + /// + /// Hand-eye Calibration @cite Horaud95 + /// + HORAUD = 2, + + /// + /// On-line Hand-Eye Calibration @cite Andreff99 + /// + ANDREFF = 3, + + /// + /// Hand-Eye Calibration Using Dual Quaternions @cite Daniilidis98 + /// + DANIILIDIS = 4 +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs b/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs new file mode 100644 index 000000000..15276810b --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs @@ -0,0 +1,62 @@ +namespace OpenCvSharp; + +/// +/// The method used to computed homography matrix +/// +public enum HomographyMethods +{ + /// + /// Regular method using all the point pairs + /// + None = 0, + + /// + /// Least-Median robust method + /// + LMedS = 4, + + /// + /// RANSAC-based robust method + /// + Ransac = 8, + + /// + /// RHO algorithm + /// + Rho = 16, + + /// + /// USAC algorithm, default settings + /// + USAC_DEFAULT = 32, + + /// + /// USAC, parallel version + /// + USAC_PARALLEL = 33, + + /// + /// USAC, fundamental matrix 8 points + /// + USAC_FM_8PTS = 34, + + /// + /// USAC, fast settings + /// + USAC_FAST = 35, + + /// + /// USAC, accurate settings + /// + USAC_ACCURATE = 36, + + /// + /// USAC, sorted points, runs PROSAC + /// + USAC_PROSAC = 37, + + /// + /// USAC, runs MAGSAC++ + /// + USAC_MAGSAC = 38 +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/ProjectionType.cs b/src/OpenCvSharp/Modules/calib3d/Enum/ProjectionType.cs new file mode 100644 index 000000000..1c448e21d --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/ProjectionType.cs @@ -0,0 +1,17 @@ +namespace OpenCvSharp; + +/// +/// cv::initWideAngleProjMap flags +/// +public enum ProjectionType +{ + /// + /// + /// + SphericalOrtho = 0, + + /// + /// + /// + SphericalEqRect = 1, +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/RobotWorldHandEyeCalibrationMethod.cs b/src/OpenCvSharp/Modules/calib3d/Enum/RobotWorldHandEyeCalibrationMethod.cs new file mode 100644 index 000000000..89ac437d5 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/RobotWorldHandEyeCalibrationMethod.cs @@ -0,0 +1,20 @@ +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// One of the implemented Robot-World/Hand-Eye calibration method +/// +public enum RobotWorldHandEyeCalibrationMethod +{ + /// + /// Solving the robot-world/hand-eye calibration problem using the kronecker product @cite Shah2013SolvingTR + /// + SHAH = 0, + + /// + /// Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product @cite Li2010SimultaneousRA + /// + LI = 1 +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/RobustEstimationAlgorithms.cs b/src/OpenCvSharp/Modules/calib3d/Enum/RobustEstimationAlgorithms.cs new file mode 100644 index 000000000..8a9f691b6 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/RobustEstimationAlgorithms.cs @@ -0,0 +1,60 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// type of the robust estimation algorithm +/// +public enum RobustEstimationAlgorithms +{ + /// + /// least-median of squares algorithm + /// + LMEDS = 4, + + /// + /// RANSAC algorithm + /// + RANSAC = 8, + + /// + /// RHO algorithm + /// + RHO = 16, + + /// + /// USAC algorithm, default settings + /// + USAC_DEFAULT = 32, + + /// + /// USAC, parallel version + /// + USAC_PARALLEL = 33, + + /// + /// USAC, fundamental matrix 8 points + /// + USAC_FM_8PTS = 34, + + /// + /// USAC, fast settings + /// + USAC_FAST = 35, + + /// + /// USAC, accurate settings + /// + USAC_ACCURATE = 36, + + /// + /// USAC, sorted points, runs PROSAC + /// + USAC_PROSAC = 37, + + /// + /// USAC, runs MAGSAC++ + /// + USAC_MAGSAC = 38 +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/SolvePnPFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/SolvePnPFlags.cs new file mode 100644 index 000000000..60144304e --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/SolvePnPFlags.cs @@ -0,0 +1,36 @@ +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Method for solving a PnP problem: +/// +public enum SolvePnPFlags +{ + /// + /// Iterative method is based on Levenberg-Marquardt optimization. + /// In this case the function finds such a pose that minimizes reprojection error, + /// that is the sum of squared distances between the observed projections imagePoints and the projected (using projectPoints() ) objectPoints . + /// + Iterative = 0, + + /// + /// Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the paper “EPnP: Efficient Perspective-n-Point Camera Pose Estimation”. + /// + EPNP = 1, + + /// + /// Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang“Complete Solution Classification for + /// the Perspective-Three-Point Problem”. In this case the function requires exactly four object and image points. + /// + P3P = 2, + + /// + /// Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP" + /// + DLS = 3, + + /// + /// A.Penate-Sanchez, J.Andrade-Cetto, F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation" + /// + UPNP = 4, +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs new file mode 100644 index 000000000..e9e745274 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs @@ -0,0 +1,19 @@ +namespace OpenCvSharp; + +/// +/// The operation flags for cvStereoRectify +/// +[Flags] +public enum StereoRectificationFlags +{ + /// + /// Default value (=0). + /// the function can shift one of the image in horizontal or vertical direction (depending on the orientation of epipolar lines) in order to maximise the useful image area. + /// + None = 0, + + /// + /// the function makes the principal points of each camera have the same pixel coordinates in the rectified views. + /// + ZeroDisparity = 1024, +}; diff --git a/src/OpenCvSharp/Modules/calib3d/StereoBM.cs b/src/OpenCvSharp/Modules/calib3d/StereoBM.cs new file mode 100644 index 000000000..1b4cff75f --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/StereoBM.cs @@ -0,0 +1,246 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Semi-Global Stereo Matching +/// +public class StereoBM : StereoMatcher +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// constructor + /// + protected StereoBM(IntPtr ptr) + : base(ptr) + { + ptrObj = new Ptr(ptr); + } + + /// + /// + /// + /// + /// + /// + public static StereoBM Create(int numDisparities = 0, int blockSize = 21) + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_create(numDisparities, blockSize, out var ptrObj)); + return new StereoBM(ptrObj); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// + /// + public int PreFilterType + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getPreFilterType(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setPreFilterType(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int PreFilterSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getPreFilterSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setPreFilterSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int PreFilterCap + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getPreFilterCap(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setPreFilterCap(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int TextureThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getTextureThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setTextureThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int UniquenessRatio + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getUniquenessRatio(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setUniquenessRatio(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int SmallerBlockSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getSmallerBlockSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setSmallerBlockSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public Rect ROI1 + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getROI1(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setROI1(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public Rect ROI2 + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_getROI2(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoBM_setROI2(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.calib3d_Ptr_StereoBM_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.calib3d_Ptr_StereoBM_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/calib3d/StereoMatcher.cs b/src/OpenCvSharp/Modules/calib3d/StereoMatcher.cs new file mode 100644 index 000000000..8d2c2585b --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/StereoMatcher.cs @@ -0,0 +1,168 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; +// ReSharper disable InconsistentNaming +#pragma warning disable 1591 + +/// +/// The base class for stereo correspondence algorithms. +/// +public class StereoMatcher : Algorithm +{ + /// + /// constructor + /// + protected StereoMatcher(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Computes disparity map for the specified stereo pair + /// + /// Left 8-bit single-channel image. + /// Right image of the same size and the same type as the left one. + /// Output disparity map. It has the same size as the input images. Some algorithms, + /// like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map(where each disparity value has 4 fractional bits), + /// whereas other algorithms output 32 - bit floating - point disparity map. + public virtual void Compute(InputArray left, InputArray right, OutputArray disparity) + { + if (left is null) + throw new ArgumentNullException(nameof(left)); + if (right is null) + throw new ArgumentNullException(nameof(right)); + if (disparity is null) + throw new ArgumentNullException(nameof(disparity)); + left.ThrowIfDisposed(); + right.ThrowIfDisposed(); + disparity.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_compute(ptr, left.CvPtr, right.CvPtr, disparity.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(left); + GC.KeepAlive(right); + disparity.Fix(); + } + + /// + /// + /// + public int MinDisparity + { + get + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_getMinDisparity(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_setMinDisparity(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NumDisparities + { + get + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_getNumDisparities(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_setNumDisparities(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int BlockSize + { + get + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_getBlockSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_setBlockSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int SpeckleWindowSize + { + get + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_getSpeckleWindowSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_setSpeckleWindowSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int SpeckleRange + { + get + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_getSpeckleRange(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_setSpeckleRange(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Disp12MaxDiff + { + get + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_getDisp12MaxDiff(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoMatcher_setDisp12MaxDiff(ptr, value)); + GC.KeepAlive(this); + } + } +} diff --git a/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs b/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs new file mode 100644 index 000000000..a6fdbb00d --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs @@ -0,0 +1,218 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +#pragma warning disable 1591 + +namespace OpenCvSharp; + +/// +/// +/// +public enum StereoSGBMMode +{ + SGBM = 0, + HH = 1, +} + +/// +/// Semi-Global Stereo Matching +/// +public class StereoSGBM : StereoMatcher +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// constructor + /// + protected StereoSGBM(IntPtr ptr) : base(ptr) + { + ptrObj = new Ptr(ptr); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static StereoSGBM Create( + int minDisparity, int numDisparities, int blockSize, + int p1 = 0, int p2 = 0, int disp12MaxDiff = 0, + int preFilterCap = 0, int uniquenessRatio = 0, + int speckleWindowSize = 0, int speckleRange = 0, + StereoSGBMMode mode = StereoSGBMMode.SGBM) + { + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_create( + minDisparity, numDisparities, blockSize, + p1, p2, disp12MaxDiff, preFilterCap, uniquenessRatio, + speckleWindowSize, speckleRange, (int) mode, out var ptrObj)); + return new StereoSGBM(ptrObj); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Truncation value for the prefiltered image pixels. The algorithm first + /// computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. + /// The result values are passed to the Birchfield-Tomasi pixel cost function. + /// + public int PreFilterCap + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_getPreFilterCap(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_setPreFilterCap(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Margin in percentage by which the best (minimum) computed cost function + /// value should "win" the second best value to consider the found match correct. Normally, a value + /// within the 5-15 range is good enough. + /// + public int UniquenessRatio + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_getUniquenessRatio(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_setUniquenessRatio(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The first parameter controlling the disparity smoothness. See P2 description. + /// + public int P1 + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_getP1(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_setP1(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The second parameter controlling the disparity smoothness. The larger the values are, + /// the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 + /// between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor + /// pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good + /// P1 and P2 values are shown (like 8\*number_of_image_channels\*SADWindowSize\*SADWindowSize and + /// 32\*number_of_image_channels\*SADWindowSize\*SADWindowSize , respectively). + /// + public int P2 + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_getP2(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_setP2(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming + /// algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and + /// huge for HD-size pictures. By default, it is set to false . + /// + public StereoSGBMMode Mode + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_getMode(ptr, out var ret)); + GC.KeepAlive(this); + return (StereoSGBMMode)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.calib3d_StereoSGBM_setMode(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.calib3d_Ptr_StereoSGBM_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.calib3d_Ptr_StereoSGBM_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/calib3d/UsacParams.cs b/src/OpenCvSharp/Modules/calib3d/UsacParams.cs new file mode 100644 index 000000000..e1c35de57 --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/UsacParams.cs @@ -0,0 +1,88 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp; +#pragma warning disable CS1591 + +public record UsacParams +{ +#pragma warning disable CA1805 + public double Confidence { get; set; } = 0.99; + public bool IsParallel { get; set; } = false; + public int LoIterations { get; set; } = 5; + public LocalOptimMethod LoMethod { get; set; } = LocalOptimMethod.INNER_LO; + public int LoSampleSize { get; set; } = 14; + public int MaxIterations { get; set; } = 5000; + public NeighborSearchMethod NeighborsSearch { get; set; } = NeighborSearchMethod.GRID; + public int RandomGeneratorState { get; set; } = 0; + public SamplingMethod Sampler { get; set; } = SamplingMethod.UNIFORM; + public ScoreMethod Score { get; set; } = ScoreMethod.MSAC; + public double Threshold { get; set; } = 1.5; + + public WUsacParams ToNativeStruct() => new() + { + Confidence = Confidence, + IsParallel = IsParallel ? 1 : 0, + LoIterations = LoIterations, + LoMethod = LoMethod, + LoSampleSize = LoSampleSize, + MaxIterations = MaxIterations, + NeighborsSearch = NeighborsSearch, + RandomGeneratorState = RandomGeneratorState, + Sampler = Sampler, + Score = Score, + Threshold = Threshold, + }; +} + +#pragma warning disable CA1815 +[StructLayout(LayoutKind.Sequential)] +public struct WUsacParams +{ + public double Confidence; + public int IsParallel; + public int LoIterations; + public LocalOptimMethod LoMethod; + public int LoSampleSize; + public int MaxIterations; + public NeighborSearchMethod NeighborsSearch; + public int RandomGeneratorState; + public SamplingMethod Sampler; + public ScoreMethod Score; + public double Threshold; +} + +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global +// ReSharper disable IdentifierTypo + +public enum SamplingMethod +{ + UNIFORM, + PROGRESSIVE_NAPSAC, + NAPSAC, + PROSAC +} + +public enum LocalOptimMethod +{ + NULL, + INNER_LO, + INNER_AND_ITER_LO, + GC, + SIGMA +} + +public enum ScoreMethod +{ + RANSAC, + MSAC, + MAGSAC, + LMEDS +} + +public enum NeighborSearchMethod +{ + FLANN_KNN, + GRID, + FLANN_RADIUS +} diff --git a/src/OpenCvSharp/Modules/core/Algorithm.cs b/src/OpenCvSharp/Modules/core/Algorithm.cs new file mode 100644 index 000000000..51014f380 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Algorithm.cs @@ -0,0 +1,97 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Base class for high-level OpenCV algorithms +/// +public abstract class Algorithm : DisposableCvObject +{ + /// + /// Stores algorithm parameters in a file storage + /// + /// + public virtual void Write(FileStorage fs) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + + NativeMethods.HandleException( + NativeMethods.core_Algorithm_write(ptr, fs.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(fs); + } + + /// + /// Reads algorithm parameters from a file storage + /// + /// + public virtual void Read(FileNode fn) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (fn is null) + throw new ArgumentNullException(nameof(fn)); + + NativeMethods.HandleException( + NativeMethods.core_Algorithm_read(ptr, fn.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(fn); + } + + /// + /// Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read + /// + /// + public virtual bool Empty + { + get + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + NativeMethods.HandleException( + NativeMethods.core_Algorithm_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Saves the algorithm to a file. + /// In order to make this method work, the derived class must + /// implement Algorithm::write(FileStorage fs). + /// + /// + public virtual void Save(string fileName) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.core_Algorithm_save(ptr, fileName)); + GC.KeepAlive(this); + } + + /// + /// Returns the algorithm string identifier. + /// This string is used as top level xml/yml node tag when the object + /// is saved to a file or string. + /// + /// + public virtual string GetDefaultName() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_Algorithm_getDefaultName(ptr, buf.CvPtr)); + GC.KeepAlive(this); + return buf.ToString(); + } +} diff --git a/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs b/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs index d6194624f..2c04c3b8d 100644 --- a/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs +++ b/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs @@ -1,38 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; +using System.Runtime.InteropServices; -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// エラーハンドラ - /// - /// エラーステータス - /// エラーが発生したOpenCVの関数名 - /// エラーについての追加情報/診断結果 - /// エラーが発生したファイル名 - /// エラーが発生した行番号 - /// -#else - /// - /// Error Handler - /// - /// The numeric code for error status - /// The source file name where error is encountered - /// A description of the error - /// The source file name where error is encountered - /// The line number in the souce where error is encountered - /// Pointer to the user data. Ignored by the standard handlers -#endif - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int CvErrorCallback( - [MarshalAs(UnmanagedType.I4)] ErrorCode status, - [MarshalAs(UnmanagedType.LPStr)] string funcName, - [MarshalAs(UnmanagedType.LPStr)] string errMsg, - [MarshalAs(UnmanagedType.LPStr)] string fileName, - int line, - IntPtr userdata - ); -} +namespace OpenCvSharp; + +/// +/// Error Handler +/// +/// The numeric code for error status +/// The source file name where error is encountered +/// A description of the error +/// The source file name where error is encountered +/// The line number in the source where error is encountered +/// Pointer to the user data. Ignored by the standard handlers +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public delegate int CvErrorCallback( + [MarshalAs(UnmanagedType.I4)] ErrorCode status, + [MarshalAs(UnmanagedType.LPStr)] string funcName, + [MarshalAs(UnmanagedType.LPStr)] string errMsg, + [MarshalAs(UnmanagedType.LPStr)] string fileName, + int line, + IntPtr userData +); diff --git a/src/OpenCvSharp/Modules/core/Delegate/MatForeachFunction.cs b/src/OpenCvSharp/Modules/core/Delegate/MatForeachFunction.cs index 8fe898384..5480961b9 100644 --- a/src/OpenCvSharp/Modules/core/Delegate/MatForeachFunction.cs +++ b/src/OpenCvSharp/Modules/core/Delegate/MatForeachFunction.cs @@ -1,83 +1,80 @@ -using System; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; -namespace OpenCvSharp -{ +namespace OpenCvSharp; #pragma warning disable 1591 // ReSharper disable InconsistentNaming - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionByte(byte* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionByte(byte* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec2b(Vec2b* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec2b(Vec2b* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec3b(Vec3b* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec3b(Vec3b* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec4b(Vec4b* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec4b(Vec4b* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec6b(Vec6b* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec6b(Vec6b* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionInt16(short* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionInt16(short* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec2s(Vec2s* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec2s(Vec2s* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec3s(Vec3s* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec3s(Vec3s* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec4s(Vec4s* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec4s(Vec4s* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec6s(Vec6s* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec6s(Vec6s* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionInt32(int* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionInt32(int* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec2i(Vec2i* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec2i(Vec2i* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec3i(Vec3i* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec3i(Vec3i* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec4i(Vec4i* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec4i(Vec4i* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec6i(Vec6i* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec6i(Vec6i* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionFloat(float* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionFloat(float* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec2f(Vec2f* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec2f(Vec2f* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec3f(Vec3f* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec3f(Vec3f* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec4f(Vec4f* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec4f(Vec4f* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec6f(Vec6f* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec6f(Vec6f* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionDouble(double* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionDouble(double* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec2d(Vec2d* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec2d(Vec2d* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec3d(Vec3d* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec3d(Vec3d* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec4d(Vec4d* value, int* position); +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec4d(Vec4d* value, int* position); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public unsafe delegate void MatForeachFunctionVec6d(Vec6d* value, int* position); -} +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public unsafe delegate void MatForeachFunctionVec6d(Vec6d* value, int* position); diff --git a/src/OpenCvSharp/Modules/core/Enum/AccessFlag.cs b/src/OpenCvSharp/Modules/core/Enum/AccessFlag.cs new file mode 100644 index 000000000..a3ff62ebf --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/AccessFlag.cs @@ -0,0 +1,19 @@ + + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// cv::AccessFlag +/// +[Flags] +public enum AccessFlag +{ +#pragma warning disable 1591 + READ = 1 << 24, + WRITE = 1 << 25, + RW = 3 << 24, + MASK = RW, + FAST = 1 << 26 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/AlgorithmParamType.cs b/src/OpenCvSharp/Modules/core/Enum/AlgorithmParamType.cs new file mode 100644 index 000000000..766a6b461 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/AlgorithmParamType.cs @@ -0,0 +1,22 @@ +#pragma warning disable 1591 + +namespace OpenCvSharp; + +/// +/// cv::Algorithm parameter type +/// +public enum AlgorithmParamType +{ + Int = 0, + Boolean = 1, + Real = 2, + String = 3, + Mat = 4, + MatVector = 5, + Algorithm = 6, + Float = 7, + UnsignedInt = 8, + UInt64 = 9, + Short = 10, + UChar = 11 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/BorderTypes.cs b/src/OpenCvSharp/Modules/core/Enum/BorderTypes.cs new file mode 100644 index 000000000..aeca191a0 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/BorderTypes.cs @@ -0,0 +1,57 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// Type of the border to create around the copied source image rectangle +/// +/// +///https://github.com/opencv/opencv/blob/fc1a15626226609babd128e043cf7c4e32f567ca/modules/core/include/opencv2/core/base.hpp#L268 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum BorderTypes +{ + /// + /// Border is filled with the fixed value, passed as last parameter of the function. + /// `iiiiii|abcdefgh|iiiiiii` with some specified `i` + /// + Constant = 0, + + /// + /// The pixels from the top and bottom rows, the left-most and right-most columns are replicated to fill the border. + /// `aaaaaa|abcdefgh|hhhhhhh` + /// + Replicate = 1, + + /// + /// `fedcba|abcdefgh|hgfedcb` + /// + Reflect = 2, + + /// + /// `cdefgh|abcdefgh|abcdefg` + /// + Wrap = 3, + + /// + /// `gfedcb|abcdefgh|gfedcba` + /// + Reflect101 = 4, + + /// + /// `uvwxyz|absdefgh|ijklmno` + /// + Transparent = 5, + + /// + /// same as BORDER_REFLECT_101 + /// + Default = Reflect101, + + /// + /// do not look outside of ROI + /// + Isolated = 16, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/CmpType.cs b/src/OpenCvSharp/Modules/core/Enum/CmpType.cs new file mode 100644 index 000000000..bf1b4a9fc --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/CmpType.cs @@ -0,0 +1,38 @@ +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// The flag specifying the relation between the elements to be checked +/// +public enum CmpType +{ + /// + /// src1(I) "equal to" src2(I) + /// + EQ = 0, + + /// + /// src1(I) "greater than" src2(I) + /// + GT = 1, + + /// + /// src1(I) "greater or equal" src2(I) + /// + GE = 2, + + /// + /// src1(I) "less than" src2(I) + /// + LT = 3, + + /// + /// src1(I) "less or equal" src2(I) + /// + LE = 4, + + /// + /// src1(I) "not equal to" src2(I) + /// + NE = 5, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs b/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs new file mode 100644 index 000000000..70556ee0f --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs @@ -0,0 +1,50 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Operation flags for Covariation +/// +[Flags] +public enum CovarFlags +{ + /// + /// scale * [vects[0]-avg,vects[1]-avg,...]^T * [vects[0]-avg,vects[1]-avg,...] + /// that is, the covariation matrix is count×count. Such an unusual covariation matrix is used for fast PCA of a set of very large vectors + /// (see, for example, Eigen Faces technique for face recognition). Eigenvalues of this "scrambled" matrix will match to the eigenvalues of + /// the true covariation matrix and the "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariation matrix. + /// + Scrambled = 0, + + /// + /// scale * [vects[0]-avg,vects[1]-avg,...]*[vects[0]-avg,vects[1]-avg,...]^T + /// that is, cov_mat will be a usual covariation matrix with the same linear size as the total number of elements in every input vector. + /// One and only one of CV_COVAR_SCRAMBLED and CV_COVAR_NORMAL must be specified + /// + Normal = 1, + + /// + /// If the flag is specified, the function does not calculate avg from the input vectors, + /// but, instead, uses the passed avg vector. This is useful if avg has been already calculated somehow, + /// or if the covariation matrix is calculated by parts - in this case, avg is not a mean vector of the input sub-set of vectors, + /// but rather the mean vector of the whole set. + /// + UseAvg = 2, + + /// + /// If the flag is specified, the covariation matrix is scaled by the number of input vectors. + /// + Scale = 4, + + /// + /// Means that all the input vectors are stored as rows of a single matrix, vects[0].count is ignored in this case, + /// and avg should be a single-row vector of an appropriate size. + /// + Rows = 8, + + /// + /// Means that all the input vectors are stored as columns of a single matrix, vects[0].count is ignored in this case, + /// and avg should be a single-column vector of an appropriate size. + /// + Cols = 16, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/CpuFeatures.cs b/src/OpenCvSharp/Modules/core/Enum/CpuFeatures.cs new file mode 100644 index 000000000..6a9cb7d0b --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/CpuFeatures.cs @@ -0,0 +1,58 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// +/// +[SuppressMessage("Microsoft.Design", "CA1008: Enums should have zero value")] +[SuppressMessage("Microsoft.Design", "CA1069: Enums should not have duplicate values")] +public enum CpuFeatures +{ +#pragma warning disable 1591 +// ReSharper disable InconsistentNaming + MMX = 1, + SSE = 2, + SSE2 = 3, + SSE3 = 4, + SSSE3 = 5, + SSE4_1 = 6, + SSE4_2 = 7, + POPCNT = 8, + FP16 = 9, + AVX = 10, + AVX2 = 11, + FMA3 = 12, + + AVX_512F = 13, + AVX_512BW = 14, + AVX_512CD = 15, + AVX_512DQ = 16, + AVX_512ER = 17, + AVX_512IFMA512 = 18, // deprecated + AVX_512IFMA = 18, + AVX_512PF = 19, + AVX_512VBMI = 20, + AVX_512VL = 21, + AVX_512VBMI2 = 22, + AVX_512VNNI = 23, + AVX_512BITALG = 24, + AVX_512VPOPCNTDQ= 25, + AVX_5124VNNIW = 26, + AVX_5124FMAPS = 27, + + NEON = 100, + + VSX = 200, + VSX3 = 201, + + AVX512_SKX = 256, //!< Skylake-X with AVX-512F/CD/BW/DQ/VL + AVX512_COMMON = 257, //!< Common instructions AVX-512F/CD for all CPUs that support AVX-512 + AVX512_KNL = 258, //!< Knights Landing with AVX-512F/CD/ER/PF + AVX512_KNM = 259, //!< Knights Mill with AVX-512F/CD/ER/PF/4FMAPS/4VNNIW/VPOPCNTDQ + AVX512_CNL = 260, //!< Cannon Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI + AVX512_CEL = 261, //!< Cascade Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI + AVX512_ICL = 262, //!< Ice Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI/VBMI2/BITALG/VPOPCNTDQ + + MAX_FEATURE = 512 // see CV_HARDWARE_MAX_FEATURE +} diff --git a/src/OpenCvSharp/Modules/core/Enum/CriteriaTypes.cs b/src/OpenCvSharp/Modules/core/Enum/CriteriaTypes.cs new file mode 100644 index 000000000..dfd03a3c2 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/CriteriaTypes.cs @@ -0,0 +1,23 @@ +namespace OpenCvSharp; + +/// +/// Type of termination criteria +/// +[Flags] +public enum CriteriaTypes +{ + /// + /// the maximum number of iterations or elements to compute + /// + Count = 1, + + /// + /// the maximum number of iterations or elements to compute + /// + MaxIter = Count, + + /// + /// the desired accuracy or change in parameters at which the iterative algorithm stops + /// + Eps = 2, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs b/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs new file mode 100644 index 000000000..35118cdca --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs @@ -0,0 +1,27 @@ +namespace OpenCvSharp; + +/// +/// Transformation flags for cv::dct +/// +[Flags] +public enum DctFlags +{ + /// + /// + /// + None = 0, + + /// + /// Do inverse 1D or 2D transform. + /// (Forward and Inverse are mutually exclusive, of course.) + /// + Inverse = 1, + + /// + /// Do forward or inverse transform of every individual row of the input matrix. + /// This flag allows user to transform multiple vectors simultaneously and can be used to decrease the overhead + /// (which is sometimes several times larger than the processing itself), to do 3D and higher-dimensional transforms etc. + /// [CV_DXT_ROWS] + /// + Rows = 4, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs b/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs new file mode 100644 index 000000000..82a8c194e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs @@ -0,0 +1,43 @@ +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// Inversion methods +/// +public enum DecompTypes +{ + /// + /// Gaussian elimination with the optimal pivot element chosen. + /// + LU = 0, + + /// + /// singular value decomposition (SVD) method; + /// the system can be over-defined and/or the matrix src1 can be singular + /// + SVD = 1, + + /// + /// eigenvalue decomposition; the matrix src1 must be symmetrical + /// + Eig = 2, + + /// + /// Cholesky \f$LL^T\f$ factorization; the matrix src1 must be symmetrical + /// and positively defined + /// + Cholesky = 3, + + /// + /// QR factorization; the system can be over-defined and/or the matrix + /// src1 can be singular + /// + QR = 4, + + /// + /// while all the previous flags are mutually exclusive, + /// this flag can be used together with any of the previous + /// + Normal = 16, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs b/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs new file mode 100644 index 000000000..b7412304e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs @@ -0,0 +1,57 @@ +namespace OpenCvSharp; + +/// +/// Transformation flags for cvDFT +/// +[Flags] +public enum DftFlags +{ + /// + /// + /// + None = 0, + + /// + /// Do inverse 1D or 2D transform. The result is not scaled. + /// (Forward and Inverse are mutually exclusive, of course.) + /// + Inverse = 1, + + /// + /// Scale the result: divide it by the number of array elements. Usually, it is combined with Inverse. + /// + Scale = 2, + + /// + /// Do forward or inverse transform of every individual row of the input matrix. + /// This flag allows user to transform multiple vectors simultaneously and can be used to decrease the overhead + /// (which is sometimes several times larger than the processing itself), to do 3D and higher-dimensional transforms etc. + /// + Rows = 4, + + /// + /// performs a forward transformation of 1D or 2D real array; the result, + /// though being a complex array, has complex-conjugate symmetry (*CCS*, + /// see the function description below for details), and such an array can + /// be packed into a real array of the same size as input, which is the fastest + /// option and which is what the function does by default; however, you may + /// wish to get a full complex array (for simpler spectrum analysis, and so on) - + /// pass the flag to enable the function to produce a full-size complex output array. + /// + ComplexOutput = 16, + + /// + /// performs an inverse transformation of a 1D or 2D complex array; + /// the result is normally a complex array of the same size, however, + /// if the input array has conjugate-complex symmetry (for example, + /// it is a result of forward transformation with DFT_COMPLEX_OUTPUT flag), + /// the output is a real array; while the function itself does not + /// check whether the input is symmetrical or not, you can pass the flag + /// and then the function will assume the symmetry and produce the real + /// output array (note that when the input is packed into a real array + /// and inverse transformation is executed, the function treats the input + /// as a packed complex-conjugate symmetrical array, and the output + /// will also be a real array). + /// + RealOutput = 32, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs b/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs new file mode 100644 index 000000000..51a326018 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs @@ -0,0 +1,17 @@ +namespace OpenCvSharp; + +/// +/// Distribution type for cvRandArr, etc. +/// +public enum DistributionType +{ + /// + /// Uniform distribution + /// + Uniform = 0, + + /// + /// Normal or Gaussian distribution + /// + Normal = 1, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/ErrorCode.cs b/src/OpenCvSharp/Modules/core/Enum/ErrorCode.cs new file mode 100644 index 000000000..5f67a6e8d --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/ErrorCode.cs @@ -0,0 +1,261 @@ +namespace OpenCvSharp; + +/// +/// Error status codes +/// +public enum ErrorCode +{ + /* this part of CVStatus is compatible with IPLStatus + Some of below symbols are not [yet] used in OpenCV + */ + + // ReSharper disable InconsistentNaming + + /// + /// everithing is ok [CV_StsOk] + /// + StsOk = 0, + + /// + /// pseudo error for back trace [CV_StsBackTrace] + /// + StsBackTrace = -1, + + /// + /// unknown /unspecified error [CV_StsError] + /// + StsError = -2, + + /// + /// internal error (bad state) [CV_StsInternal] + /// + StsInternal = -3, + + /// + /// insufficient memory [CV_StsNoMem] + /// + StsNoMem = -4, + + /// + /// function arg/param is bad [CV_StsBadArg] + /// + StsBadArg = -5, + + /// + /// unsupported function [CV_StsBadFunc] + /// + StsBadFunc = -6, + + /// + /// iter. didn't converge [CV_StsNoConv] + /// + StsNoConv = -7, + + /// + /// tracing [CV_StsAutoTrace] + /// + StsAutoTrace = -8, + + + /// + /// image header is NULL [CV_HeaderIsNull] + /// + HeaderIsNull = -9, + + /// + /// image size is invalid [CV_BadImageSize] + /// + BadImageSize = -10, + + /// + /// offset is invalid [CV_BadOffset] + /// + BadOffset = -11, + + /// + /// [CV_BadOffset] + /// + BadDataPtr = -12, + + /// + /// [CV_BadStep] + /// + BadStep = -13, + + /// + /// [CV_BadModelOrChSeq] + /// + BadModelOrChSeq = -14, + + /// + /// [CV_BadNumChannels] + /// + BadNumChannels = -15, + + /// + /// [CV_BadNumChannel1U] + /// + BadNumChannel1U = -16, + + /// + /// [CV_BadDepth] + /// + BadDepth = -17, + + /// + /// [CV_BadAlphaChannel] + /// + BadAlphaChannel = -18, + + /// + /// [CV_BadOrder] + /// + BadOrder = -19, + + /// + /// [CV_BadOrigin] + /// + BadOrigin = -20, + + /// + /// [CV_BadAlign] + /// + BadAlign = -21, + + /// + /// [CV_BadCallBack] + /// + BadCallBack = -22, + + /// + /// [CV_BadTileSize] + /// + BadTileSize = -23, + + /// + /// [CV_BadCOI] + /// + BadCOI = -24, + + /// + /// [CV_BadROISize] + /// + BadROISize = -25, + + /// + /// [CV_MaskIsTiled] + /// + MaskIsTiled = -26, + + /// + /// null pointer [CV_StsNullPtr] + /// + StsNullPtr = -27, + + /// + /// incorrect vector length [CV_StsVecLengthErr] + /// + StsVecLengthErr = -28, + + /// + /// incorr. filter structure content [CV_StsFilterStructContentErr] + /// + StsFilterStructContentErr = -29, + + /// + /// incorr. transform kernel content [CV_StsKernelStructContentErr] + /// + StsKernelStructContentErr = -30, + + /// + /// incorrect filter ofset value [CV_StsFilterOffsetErr] + /// + StsFilterOffsetErr = -31, + + /*extra for CV */ + + /// + /// the input/output structure size is incorrect [CV_StsBadSize] + /// + StsBadSize = -201, + + /// + /// division by zero [CV_StsDivByZero] + /// + StsDivByZero = -202, + + /// + /// in-place operation is not supported [CV_StsInplaceNotSupported] + /// + StsInplaceNotSupported = -203, + + /// + /// request can't be completed [CV_StsObjectNotFound] + /// + StsObjectNotFound = -204, + + /// + /// formats of input/output arrays differ [CV_StsUnmatchedFormats] + /// + StsUnmatchedFormats = -205, + + /// + /// flag is wrong or not supported [CV_StsBadFlag] + /// + StsBadFlag = -206, + + /// + /// bad CvPoint [CV_StsBadPoint] + /// + StsBadPoint = -207, + + /// + /// bad format of mask (neither 8uC1 nor 8sC1) [CV_StsBadMask] + /// + StsBadMask = -208, + + /// + /// sizes of input/output structures do not match [CV_StsUnmatchedSizes] + /// + StsUnmatchedSizes = -209, + + /// + /// the data format/type is not supported by the function [CV_StsUnsupportedFormat] + /// + StsUnsupportedFormat = -210, + + /// + /// some of parameters are out of range [CV_StsOutOfRange] + /// + StsOutOfRange = -211, + + /// + /// invalid syntax/structure of the parsed file [CV_StsParseError] + /// + StsParseError = -212, + + /// + /// the requested function/feature is not implemented [CV_StsNotImplemented] + /// + StsNotImplemented = -213, + + /// + /// an allocated block has been corrupted [CV_StsBadMemBlock] + /// + StsBadMemBlock = -214, + + /// + /// assertion failed + /// + StsAssert = -215, + +#pragma warning disable 1591 + GpuNotSupported = -216, + GpuApiCallError = -217, + OpenGlNotSupported = -218, + OpenGlApiCallError = -219, + OpenCLApiCallError = -220, + OpenCLDoubleNotSupported = -221, + OpenCLInitError = -222, + OpenCLNoAMDBlasFft = -223 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/FormatType.cs b/src/OpenCvSharp/Modules/core/Enum/FormatType.cs new file mode 100644 index 000000000..4f3590111 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/FormatType.cs @@ -0,0 +1,48 @@ +// ReSharper disable InconsistentNaming +namespace OpenCvSharp; + +/// +/// Output string format of Mat.Dump() +/// +public enum FormatType +{ + /// + /// Default format. + /// [1, 2, 3, 4, 5, 6; \n + /// 7, 8, 9, ... ] + /// + Default = 0, + + /// + /// + /// + MATLAB = 1, + + /// + /// CSV format. + /// 1, 2, 3, 4, 5, 6\n + /// 7, 8, 9, ... + /// + CSV = 2, + + /// + /// Python format. + /// [[[1, 2, 3], [4, 5, 6]], \n + /// [[7, 8, 9], ... ] + /// + Python = 3, + + /// + /// NumPy format. + /// array([[[1, 2, 3], [4, 5, 6]], \n + /// [[7, 8, 9], .... ]]], type='uint8'); + /// + NumPy = 4, + + /// + /// C language format. + /// {1, 2, 3, 4, 5, 6, \n + /// 7, 8, 9, ...}; + /// + C = 5, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs b/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs new file mode 100644 index 000000000..5fe660f60 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs @@ -0,0 +1,29 @@ +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// The operation flags for cv::GEMM +/// +[Flags] +public enum GemmFlags +{ + /// + /// + /// + None = 0, + + /// + /// Transpose src1 + /// + A_T = 1, + + /// + /// Transpose src2 + /// + B_T = 2, + + /// + /// Transpose src3 + /// + C_T = 4, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs b/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs new file mode 100644 index 000000000..f78a93795 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs @@ -0,0 +1,56 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Font name identifier. +/// Only a subset of Hershey fonts (http://sources.isc.org/utils/misc/hershey-font.txt) are supported now. +/// +[Flags] +public enum HersheyFonts +{ + /// + /// normal size sans-serif font + /// + HersheySimplex = 0, + + /// + /// small size sans-serif font + /// + HersheyPlain = 1, + + /// + /// normal size sans-serif font (more complex than HERSHEY_SIMPLEX) + /// + HersheyDuplex = 2, + + /// + /// normal size serif font + /// + HersheyComplex = 3, + + /// + /// normal size serif font (more complex than HERSHEY_COMPLEX) + /// + HersheyTriplex = 4, + + /// + /// smaller version of HERSHEY_COMPLEX + /// + HersheyComplexSmall = 5, + + /// + /// hand-writing style font + /// + HersheyScriptSimplex = 6, + + /// + /// more complex variant of HERSHEY_SCRIPT_SIMPLEX + /// + HersheyScriptComplex = 7, + + /// + /// flag for italic font + /// + Italic = 16 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/InOutArrayKind.cs b/src/OpenCvSharp/Modules/core/Enum/InOutArrayKind.cs new file mode 100644 index 000000000..35bf2bb62 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/InOutArrayKind.cs @@ -0,0 +1,29 @@ +#pragma warning disable 1591 +#pragma warning disable CA2217 // Do not mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// +/// +[Flags] +public enum InOutArrayKind +{ + None = 0, + Mat = 1 << InputArray.KIND_SHIFT, + Matx = 2 << InputArray.KIND_SHIFT, + StdVector = 3 << InputArray.KIND_SHIFT, + VectorVector = 4 << InputArray.KIND_SHIFT, + VectorMat = 5 << InputArray.KIND_SHIFT, + Expr = 6 << InputArray.KIND_SHIFT, + OpenGLBuffer = 7 << InputArray.KIND_SHIFT, + CudaHostMem = 8 << InputArray.KIND_SHIFT, + CudaGpuMat = 9 << InputArray.KIND_SHIFT, + UMat = 10 << InputArray.KIND_SHIFT, + StdVectorUMat = 11 << InputArray.KIND_SHIFT, + StdBoolVector = 12 << InputArray.KIND_SHIFT, + StdVectorCudaGpuMat = 13 << InputArray.KIND_SHIFT, + + FixedType = 0x8000 << InputArray.KIND_SHIFT, + FixedSize = 0x4000 << InputArray.KIND_SHIFT, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs b/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs new file mode 100644 index 000000000..845bf30a3 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs @@ -0,0 +1,28 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Miscellaneous flags for cv::kmeans +/// +[Flags] +public enum KMeansFlags +{ + /// + /// Select random initial centers in each attempt. + /// + RandomCenters = 0, + + /// + /// Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007]. + /// + PpCenters = 2, + + /// + /// During the first (and possibly the only) attempt, use the + /// user-supplied labels instead of computing them from the initial centers. + /// For the second and further attempts, use the random or semi-random centers. + /// Use one of KMEANS_\*_CENTERS flag to specify the exact method. + /// + UseInitialLabels = 1, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/LogLevel.cs b/src/OpenCvSharp/Modules/core/Enum/LogLevel.cs new file mode 100644 index 000000000..01f45d9c4 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/LogLevel.cs @@ -0,0 +1,42 @@ +namespace OpenCvSharp; + +/// +/// cv::utils::logging::LogLevel +/// +public enum LogLevel +{ + /// + /// for using in setLogVevel() call + /// + SILENT = 0, + + /// + /// Fatal (critical) error (unrecoverable internal error) + /// + FATAL = 1, + + /// + /// Error message. + /// + ERROR = 2, + + /// + /// Warning message. + /// + WARNING = 3, + + /// + /// Info message. + /// + INFO = 4, + + /// + /// Debug message. Disabled in the "Release" build. + /// + DEBUG = 5, + + /// + /// Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. + /// + VERBOSE = 6 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs b/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs new file mode 100644 index 000000000..d69e83cee --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs @@ -0,0 +1,25 @@ +namespace OpenCvSharp; + +/// +/// diagonal type +/// +public enum MatDiagType +{ + /// + /// a diagonal from the upper half + /// [< 0] + /// + Upper = -1, + + /// + /// Main diagonal + /// [= 0] + /// + Main = 0, + + /// + /// a diagonal from the lower half + /// [> 0] + /// + Lower = +1, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs b/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs new file mode 100644 index 000000000..a11ceb605 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs @@ -0,0 +1,49 @@ +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Type of norm +/// +[Flags] +public enum NormTypes +{ + /// + /// + /// + INF = 1, + + /// + /// The L1-norm (sum of absolute values) of the array is normalized. + /// + L1 = 2, + + /// + /// The (Euclidean) L2-norm of the array is normalized. + /// + L2 = 4, + + /// + /// + /// + L2SQR = 5, + + /// + /// + /// + Hamming = 6, + + /// + /// + /// + Hamming2 = 7, + + /// + /// + /// + Relative = 8, + + /// + /// The array values are scaled and shifted to the specified range. + /// + MinMax = 32, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs b/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs new file mode 100644 index 000000000..03de22d8c --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs @@ -0,0 +1,26 @@ + +namespace OpenCvSharp; + +/// +/// The dimension index along which the matrix is reduce. +/// +public enum ReduceDimension +{ + /// + /// The matrix is reduced to a single row. + /// [= 0] + /// + Row = 0, + + /// + /// The matrix is reduced to a single column. + /// [= 1] + /// + Column = 1, + + /// + /// The dimension is chosen automatically by analysing the dst size. + /// [= -1] + /// + Auto = -1 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs b/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs new file mode 100644 index 000000000..c108b50f8 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs @@ -0,0 +1,33 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// The reduction operations for cvReduce +/// +/// +///https://github.com/opencv/opencv/blob/37c12db3668a1fbbfdb286be59f662c67cfbfea1/modules/core/include/opencv2/core.hpp#L231 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum ReduceTypes +{ + /// + /// The output is the sum of all the matrix rows/columns. + /// + Sum = 0, + + /// + /// The output is the mean vector of all the matrix rows/columns. + /// + Avg = 1, + + /// + /// The output is the maximum (column/row-wise) of all the matrix rows/columns. + /// + Max = 2, + + /// + /// The output is the minimum (column/row-wise) of all the matrix rows/columns. + /// + Min = 3, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/RotateFlags.cs b/src/OpenCvSharp/Modules/core/Enum/RotateFlags.cs new file mode 100644 index 000000000..4745ffc40 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/RotateFlags.cs @@ -0,0 +1,22 @@ +namespace OpenCvSharp; + +/// +/// an enum to specify how to rotate the array. +/// +public enum RotateFlags +{ + /// + /// Rotate 90 degrees clockwise + /// + Rotate90Clockwise = 0, + + /// + /// Rotate 180 degrees clockwise + /// + Rotate180 = 1, + + /// + /// Rotate 270 degrees clockwise + /// + Rotate90Counterclockwise = 2, +}; diff --git a/src/OpenCvSharp/Modules/core/Enum/SolveLPResult.cs b/src/OpenCvSharp/Modules/core/Enum/SolveLPResult.cs new file mode 100644 index 000000000..c0ea9702f --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/SolveLPResult.cs @@ -0,0 +1,29 @@ +// ReSharper disable UnusedMember.Global +namespace OpenCvSharp; + +/// +/// return codes for cv::solveLP() function +/// +// ReSharper disable once InconsistentNaming +public enum SolveLPResult +{ + /// + /// problem is unbounded (target function can achieve arbitrary high values) + /// + Unbounded = -2, + + /// + /// problem is unfeasible (there are no points that satisfy all the constraints imposed) + /// + Unfeasible = -1, + + /// + /// there is only one maximum for target function + /// + Single = 0, + + /// + /// there are multiple maxima for target function - the arbitrary one is returned + /// + Multi = 1 +} diff --git a/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs b/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs new file mode 100644 index 000000000..c48e20a33 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs @@ -0,0 +1,34 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Signals an error and raises the exception. +/// +[Flags] +[SuppressMessage("Microsoft.Design", "CA1008: Enums should have zero value")] +[SuppressMessage("Microsoft.Design", "CA1069: Enums should not have duplicate values")] +public enum SortFlags +{ + /// + /// each matrix row is sorted independently + /// + EveryRow = 0, + + /// + /// each matrix column is sorted independently; + /// this flag and the previous one are mutually exclusive. + /// + EveryColumn = 1, + + /// + /// each matrix row is sorted in the ascending order. + /// + Ascending = 0, + + /// + /// each matrix row is sorted in the descending order; + /// this flag and the previous one are also mutually exclusive. + /// + Descending = 16, +} diff --git a/src/OpenCvSharp/Modules/core/Enum/UMatUsageFlags.cs b/src/OpenCvSharp/Modules/core/Enum/UMatUsageFlags.cs new file mode 100644 index 000000000..db4efd067 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/UMatUsageFlags.cs @@ -0,0 +1,16 @@ +namespace OpenCvSharp; + +/// +/// cv::UMatUsageFlags +/// +[Flags] +public enum UMatUsageFlags +{ +#pragma warning disable 1591 + None = 0, + + // buffer allocation policy is platform and usage specific + HostMemory = 1 << 0, + DeviceMemory = 1 << 1, + SharedMemory = 1 << 2, // It is not equal to: USAGE_ALLOCATE_HOST_MEMORY | USAGE_ALLOCATE_DEVICE_MEMORY +} diff --git a/src/OpenCvSharp/Modules/core/FileNode.cs b/src/OpenCvSharp/Modules/core/FileNode.cs new file mode 100644 index 000000000..161c4dbb3 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/FileNode.cs @@ -0,0 +1,1194 @@ +using System.Collections; +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// File Storage Node class +/// +public class FileNode : DisposableCvObject, IEnumerable +{ + // ReSharper disable InconsistentNaming + + #region Init & Disposal + + /// + /// The default constructor + /// + public FileNode() + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_new1(out ptr)); + } + + /// + /// Initializes from cv::FileNode* + /// + /// + public FileNode(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Cast + + /// + /// Returns the node content as an integer. If the node stores floating-point number, it is rounded. + /// + /// + /// + public static explicit operator int(FileNode node) + { + if (node is null) + throw new ArgumentNullException(nameof(node)); + return node.ToInt32(); + } + + /// + /// Returns the node content as an integer. If the node stores floating-point number, it is rounded. + /// + /// + public int ToInt32() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNode_toInt(ptr, out var ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the node content as float + /// + /// + /// + public static explicit operator float(FileNode node) + { + if (node is null) + throw new ArgumentNullException(nameof(node)); + return node.ToSingle(); + } + + /// + /// Returns the node content as System.Single + /// + /// + public float ToSingle() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNode_toFloat(ptr, out var ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the node content as double + /// + /// + /// + public static explicit operator double(FileNode node) + { + if (node is null) + throw new ArgumentNullException(nameof(node)); + return node.ToDouble(); + } + + /// + /// Returns the node content as double + /// + /// + public double ToDouble() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNode_toDouble(ptr, out var ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the node content as text string + /// + /// + /// + public static explicit operator string(FileNode node) + { + if (node is null) + throw new ArgumentNullException(nameof(node)); + return node.ToString(); + } + + /// + /// Returns the node content as text string + /// + /// + public override string ToString() + { + ThrowIfDisposed(); + + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_toString(ptr, buf.CvPtr)); + + GC.KeepAlive(this); + return buf.ToString(); + } + + /// + /// Returns the node content as OpenCV Mat + /// + /// + /// + public static explicit operator Mat(FileNode node) + { + if (node is null) + throw new ArgumentNullException(nameof(node)); + return node.ToMat(); + } + + /// + /// Returns the node content as OpenCV Mat + /// + /// + public Mat ToMat() + { + ThrowIfDisposed(); + + var matrix = new Mat(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_toMat(ptr, matrix.CvPtr)); + + GC.KeepAlive(this); + return matrix; + } + + #endregion + + #region Properties + + /// + /// returns element of a mapping node + /// + public FileNode? this[string nodeName] + { + get + { + ThrowIfDisposed(); + if (nodeName is null) + throw new ArgumentNullException(nameof(nodeName)); + + NativeMethods.HandleException( + NativeMethods.core_FileNode_operatorThis_byString(ptr, nodeName, out var node)); + + GC.KeepAlive(this); + if (node == IntPtr.Zero) + return null; + return new FileNode(node); + } + } + + /// + /// returns element of a sequence node + /// + public FileNode? this[int i] + { + get + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNode_operatorThis_byInt(ptr, i, out var node)); + + GC.KeepAlive(this); + if (node == IntPtr.Zero) + return null; + return new FileNode(node); + } + } + + /// + /// Returns true if the node is empty + /// + /// + public bool Empty + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node is a "none" object + /// + /// + public bool IsNone + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isNone(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node is a sequence + /// + /// + public bool IsSeq + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isSeq(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node is a mapping + /// + /// + public bool IsMap + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isMap(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node is an integer + /// + /// + public bool IsInt + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isInt(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node is a floating-point number + /// + /// + public bool IsReal + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isReal(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node is a text string + /// + /// + public bool IsString + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isString(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns true if the node has a name + /// + /// + public bool IsNamed + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_isNamed(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns the node name or an empty string if the node is nameless + /// + /// + public string Name + { + get + { + ThrowIfDisposed(); + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_name(ptr, buf.CvPtr)); + GC.KeepAlive(this); + return buf.ToString(); + } + } + + /// + /// Returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. + /// + /// + public long Size + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_size(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + } + + /// + /// Returns type of the node. + /// + /// Type of the node. + public Types Type + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_type(ptr, out var ret)); + GC.KeepAlive(this); + return (Types)ret; + } + } + + #endregion + + #region Methods + + /// + /// returns iterator pointing to the first node element + /// + /// + public FileNodeIterator Begin() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_begin(ptr, out var p)); + GC.KeepAlive(this); + return new FileNodeIterator(p); + } + + /// + /// returns iterator pointing to the element following the last node element + /// + /// + public FileNodeIterator End() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_end(ptr, out var p)); + GC.KeepAlive(this); + return new FileNodeIterator(p); + } + + /// + /// Get FileNode iterator + /// + /// + public IEnumerator GetEnumerator() + { + using FileNodeIterator it = Begin(), end = End(); + for (; !it.Equals(end); it.MoveNext()) + { + yield return it.Current; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Reads node elements to the buffer with the specified format + /// + /// + /// + /// + public void ReadRaw(string fmt, IntPtr vec, long len) + { + ThrowIfDisposed(); + if (fmt is null) + throw new ArgumentNullException(nameof(fmt)); + NativeMethods.HandleException( + NativeMethods.core_FileNode_readRaw(ptr, fmt, vec, new IntPtr(len))); + GC.KeepAlive(this); + } + + #region Read + + /// + /// Reads the node element as Int32 (int) + /// + /// + /// + public int ReadInt(int defaultValue = default) + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_int(ptr, out var value, defaultValue)); + GC.KeepAlive(this); + return value; + } + + /// + /// Reads the node element as Single (float) + /// + /// + /// + public float ReadFloat(float defaultValue = default) + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_float(ptr, out var value, defaultValue)); + GC.KeepAlive(this); + return value; + } + + /// + /// Reads the node element as Double + /// + /// + /// + public double ReadDouble(double defaultValue = default) + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_double(ptr, out var value, defaultValue)); + GC.KeepAlive(this); + return value; + } + + /// + /// Reads the node element as String + /// + /// + /// + public string ReadString(string? defaultValue = null) + { + using var value = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_String(ptr, value.CvPtr, defaultValue)); + GC.KeepAlive(this); + return value.ToString(); + } + + /// + /// Reads the node element as Mat + /// + /// + /// + public Mat ReadMat(Mat? defaultMat = null) + { + var value = new Mat(); + try + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Mat(ptr, value.CvPtr, Cv2.ToPtr(defaultMat))); + GC.KeepAlive(this); + GC.KeepAlive(defaultMat); + } + catch + { + value.Dispose(); + throw; + } + return value; + } + + /// + /// Reads the node element as SparseMat + /// + /// + /// + public SparseMat ReadSparseMat(SparseMat? defaultMat = null) + { + var value = new SparseMat(); + try + { + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_SparseMat(ptr, value.CvPtr, Cv2.ToPtr(defaultMat))); + GC.KeepAlive(this); + GC.KeepAlive(defaultMat); + } + catch + { + value.Dispose(); + throw; + } + return value; + } + + /// + /// Reads the node element as KeyPoint[] + /// + /// + public KeyPoint[] ReadKeyPoints() + { + using var valueVector = new VectorOfKeyPoint(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_vectorOfKeyPoint(ptr, valueVector.CvPtr)); + GC.KeepAlive(this); + return valueVector.ToArray(); + } + + /// + /// Reads the node element as DMatch[] + /// + /// + public DMatch[] ReadDMatches() + { + using var valueVector = new VectorOfDMatch(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_vectorOfDMatch(ptr, valueVector.CvPtr)); + GC.KeepAlive(this); + return valueVector.ToArray(); + } + + /// + /// Reads the node element as Range + /// + /// + public Range ReadRange() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Range(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as KeyPoint + /// + /// + public KeyPoint ReadKeyPoint() + { + ThrowIfDisposed(); + NativeMethods.HandleException( NativeMethods.core_FileNode_read_KeyPoint(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as DMatch + /// + /// + public DMatch ReadDMatch() + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_FileNode_read_DMatch(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Point + /// + /// + public Point ReadPoint() + { + ThrowIfDisposed(); + NativeMethods.HandleException( NativeMethods.core_FileNode_read_Point2i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Point2f + /// + /// + public Point2f ReadPoint2f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( NativeMethods.core_FileNode_read_Point2f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Point2d + /// + /// + public Point2d ReadPoint2d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( NativeMethods.core_FileNode_read_Point2d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Point3i + /// + /// + public Point3i ReadPoint3i() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Point3i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Point3f + /// + /// + public Point3f ReadPoint3f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Point3f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Point3d + /// + /// + public Point3d ReadPoint3d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Point3d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Size + /// + /// + public Size ReadSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Size2i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Size2f + /// + /// + public Size2f ReadSize2f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Size2f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Size2d + /// + /// + public Size2d ReadSize2d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Size2d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Rect + /// + /// + public Rect ReadRect() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Rect2i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Rect2f + /// + /// + public Rect2f ReadRect2f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Rect2f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Rect2d + /// + /// + public Rect2d ReadRect2d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Rect2d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Scalar + /// + /// + public Scalar ReadScalar() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Scalar(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec2i ReadVec2i() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec2i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec3i ReadVec3i() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec3i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec4i ReadVec4i() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec4i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec6i ReadVec6i() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec6i(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec2d ReadVec2d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec2d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec3d ReadVec3d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec3d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec4d ReadVec4d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec4d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec6d ReadVec6d() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec6d(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec2f ReadVec2f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec2f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec3f ReadVec3f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec3f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec4f ReadVec4f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec4f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec6f ReadVec6f() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec6f(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec2b ReadVec2b() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec2b(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public Vec3b ReadVec3b() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec3b(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec4b ReadVec4b() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec4b(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec6b ReadVec6b() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec6b(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + + /// + /// Reads the node element as Vector + /// + /// + public Vec2s ReadVec2s() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec2s(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec3s ReadVec3s() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec3s(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec4s ReadVec4s() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec4s(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec6s ReadVec6s() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec6s(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec2w ReadVec2w() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec2w(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec3w ReadVec3w() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec3w(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec4w ReadVec4w() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec4w(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Reads the node element as Vector + /// + /// + public Vec6w ReadVec6w() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNode_read_Vec6w(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + #endregion + + #endregion + + /// + /// type of the file storage node + /// + [Flags] + [SuppressMessage("Microsoft.Design", "CA1069: Enums should not have duplicate values")] + public enum Types + { + /// + /// empty node + /// + None = 0, + + /// + /// an integer + /// + Int = 1, + + /// + /// floating-point number + /// + Real = 2, + + /// + /// synonym or REAL + /// + Float = Real, + + /// + /// text string in UTF-8 encoding + /// + Str = 3, + + /// + /// synonym for STR + /// + String = Str, + + /// + /// sequence + /// + Seq = 4, + + /// + /// mapping + /// + Map = 5, + + /// + /// + /// + TypeMask = 7, + + /// + /// compact representation of a sequence or mapping. Used only by YAML writer + /// + Flow = 8, + + // ReSharper disable once CommentTypo + /// + /// if set, means that all the collection elements are numbers of the same type (real's or int's). + /// UNIFORM is used only when reading FileStorage; FLOW is used only when writing. So they share the same bit + /// + Uniform = 8, + + /// + /// empty structure (sequence or mapping) + /// + Empty = 16, + + /// + /// the node has a name (i.e. it is element of a mapping) + /// + Named = 32, + } +} diff --git a/src/OpenCvSharp/Modules/core/FileNodeIterator.cs b/src/OpenCvSharp/Modules/core/FileNodeIterator.cs new file mode 100644 index 000000000..6e865efa2 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/FileNodeIterator.cs @@ -0,0 +1,194 @@ +using System.Collections; +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// +/// File Storage Node class +/// +public class FileNodeIterator : DisposableCvObject, IEquatable, IEnumerator +{ + /// + /// The default constructor + /// + public FileNodeIterator() + { + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_new1(out ptr)); + } + + /// + /// Initializes from cv::FileNode* + /// + /// + public FileNodeIterator(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Reads node elements to the buffer with the specified format. + /// Usually it is more convenient to use operator `>>` instead of this method. + /// + /// Specification of each array element.See @ref format_spec "format specification" + /// Pointer to the destination array. + /// Number of elements to read. If it is greater than number of remaining elements then all of them will be read. + /// + public FileNodeIterator ReadRaw(string fmt, IntPtr vec, long maxCount = int.MaxValue) + { + if (fmt is null) + throw new ArgumentNullException(nameof(fmt)); + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_readRaw(ptr, fmt, vec, new IntPtr(maxCount))); + GC.KeepAlive(this); + return this; + } + + /// + /// *iterator + /// + public FileNode Current + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_operatorAsterisk(ptr, out var p)); + GC.KeepAlive(this); + return new FileNode(p); + } + } + + object IEnumerator.Current => Current; + + /// + /// IEnumerable<T>.Reset + /// + public void Reset() => throw new NotImplementedException(); + + /// + /// iterator++ + /// + /// + public bool MoveNext() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_operatorIncrement(ptr, out var changed)); + GC.KeepAlive(this); + return changed != 0; + } + + /// + /// iterator += ofs + /// + /// + /// + public bool MoveNext(int ofs) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_operatorPlusEqual(ptr, ofs, out var changed)); + GC.KeepAlive(this); + return changed != 0; + } + + /// + /// Reads node elements to the buffer with the specified format. + /// Usually it is more convenient to use operator `>>` instead of this method. + /// + /// Specification of each array element.See @ref format_spec "format specification" + /// Pointer to the destination array. + /// Number of elements to read. If it is greater than number of remaining elements then all of them will be read. + /// + public FileNodeIterator ReadRaw(string fmt, byte[] vec, long maxCount = int.MaxValue) + { + if (fmt is null) + throw new ArgumentNullException(nameof(fmt)); + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + unsafe + { + fixed (byte* vecPtr = vec) + { + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_readRaw(ptr, fmt, new IntPtr(vecPtr), new IntPtr(maxCount))); + } + } + GC.KeepAlive(this); + return this; + } + +#pragma warning disable 1591 + + public override bool Equals(object? obj) + { + return obj is FileNodeIterator fni && Equals(fni); + } + + public bool Equals(FileNodeIterator? other) + { + if (other is null) + return false; + + ThrowIfDisposed(); + other.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_operatorEqual(ptr, other.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(other); + + return ret != 0; + } + + public override int GetHashCode() => ptr.GetHashCode(); + + public long Minus(FileNodeIterator it) + { + if (it is null) + throw new ArgumentNullException(nameof(it)); + ThrowIfDisposed(); + it.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_operatorMinus(ptr, it.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(it); + + return ret.ToInt64(); + } + + public bool LessThan(FileNodeIterator it) + { + if (it is null) + throw new ArgumentNullException(nameof(it)); + ThrowIfDisposed(); + it.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileNodeIterator_operatorLessThan(ptr, it.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(it); + + return ret != 0; + } + +#pragma warning restore 1591 +} diff --git a/src/OpenCvSharp/Modules/core/FileStorage.cs b/src/OpenCvSharp/Modules/core/FileStorage.cs new file mode 100644 index 000000000..d6e4e5830 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/FileStorage.cs @@ -0,0 +1,1229 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// XML/YAML File Storage Class. +/// +public class FileStorage : DisposableCvObject +{ + #region Init & Disposal + + /// + /// Default constructor. + /// You should call FileStorage::open() after initialization. + /// + public FileStorage() + { + NativeMethods.HandleException( + NativeMethods.core_FileStorage_new1(out ptr)); + } + + /// + /// The full constructor + /// + /// Name of the file to open or the text string to read the data from. + /// Extension of the file (.xml or .yml/.yaml) determines its format + /// (XML or YAML respectively). Also you can append .gz to work with + /// compressed files, for example myHugeMatrix.xml.gz. + /// If both FileStorage::WRITE and FileStorage::MEMORY flags are specified, + /// source is used just to specify the output file format + /// (e.g. mydata.xml, .yml etc.). + /// + /// Encoding of the file. Note that UTF-16 XML encoding is not supported + /// currently and you should use 8-bit encoding instead of it. + public FileStorage(string source, Modes flags, string? encoding = null) + { + if (source is null) + throw new ArgumentNullException(nameof(source)); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_new2(source, (int)flags, encoding, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_FileStorage_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Properties + + /// + /// Returns the specified element of the top-level mapping + /// + /// + /// + public FileNode? this[string nodeName] + { + get + { + ThrowIfDisposed(); + if (nodeName is null) + throw new ArgumentNullException(nameof(nodeName)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_indexer(ptr, nodeName, out var node)); + + GC.KeepAlive(this); + if (node == IntPtr.Zero) + return null; + return new FileNode(node); + } + } + + /// + /// the currently written element + /// + public string ElName + { + get + { + ThrowIfDisposed(); + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_elname(ptr, buf.CvPtr)); + GC.KeepAlive(this); + return buf.ToString(); + } + } + + /// + /// the writer state + /// + public States State + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_state(ptr, out var ret)); + GC.KeepAlive(this); + return (States)ret; + } + } + + #endregion + + #region Methods + + /// + /// operator that performs PCA. The previously stored data, if any, is released + /// + /// Name of the file to open or the text string to read the data from. + /// Extension of the file (.xml, .yml/.yaml or .json) determines its format (XML, YAML or JSON respectively). + /// Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. + /// If both FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify the output file format (e.g. mydata.xml, .yml etc.). + /// A file name can also contain parameters. You can use this format, "*?base64" (e.g. "file.json?base64" (case sensitive)), + /// as an alternative to FileStorage::BASE64 flag. + /// Mode of operation. + /// Encoding of the file. Note that UTF-16 XML encoding is not supported + /// currently and you should use 8-bit encoding instead of it. + /// + public virtual bool Open(string fileName, Modes flags, string? encoding = null) + { + ThrowIfDisposed(); + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_open(ptr, fileName, (int)flags, encoding, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns true if the object is associated with currently opened file. + /// + /// + public virtual bool IsOpened() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_isOpened(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Closes the file and releases all the memory buffers + /// + public virtual void Release() + { + ThrowIfDisposed(); + Dispose(); + } + + /// + /// Closes the file, releases all the memory buffers and returns the text string + /// + /// + public string ReleaseAndGetString() + { + ThrowIfDisposed(); + + try + { + using var stdString = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_releaseAndGetString(ptr, stdString.CvPtr)); + return stdString.ToString(); + } + finally + { + Dispose(); + } + } + + /// + /// Returns the first element of the top-level mapping + /// + /// The first element of the top-level mapping. + public FileNode? GetFirstTopLevelNode() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_getFirstTopLevelNode(ptr, out var node)); + + GC.KeepAlive(this); + if (node == IntPtr.Zero) + return null; + return new FileNode(node); + } + + /// + /// Returns the top-level mapping. YAML supports multiple streams + /// + /// Zero-based index of the stream. In most cases there is only one stream in the file. + /// However, YAML supports multiple streams and so there can be several. + /// The top-level mapping. + public FileNode? Root(int streamIdx = 0) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_root(ptr, streamIdx, out var node)); + + GC.KeepAlive(this); + if (node == IntPtr.Zero) + return null; + return new FileNode(node); + } + + /// + /// Writes one or more numbers of the specified format to the currently written structure + /// + /// Specification of each array element, see @ref format_spec "format specification" + /// Pointer to the written array. + /// Number of the uchar elements to write. + public void WriteRaw(string fmt, IntPtr vec, int len) + { + if (fmt is null) + throw new ArgumentNullException(nameof(fmt)); + if (vec == IntPtr.Zero) + throw new ArgumentException("vec == IntPtr.Zero", nameof(vec)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_writeRaw(ptr, fmt, vec, new IntPtr(len))); + + GC.KeepAlive(this); + } + + /// + /// Writes a comment. + /// The function writes a comment into file storage. The comments are skipped when the storage is read. + /// + /// The written comment, single-line or multi-line + /// If true, the function tries to put the comment at the end of current line. + /// Else if the comment is multi-line, or if it does not fit at the end of the current line, the comment starts a new line. + public void WriteComment(string comment, bool append = false) + { + if (comment is null) + throw new ArgumentNullException(nameof(comment)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_writeComment(ptr, comment, append ? 1 : 0)); + + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + /// + public void StartWriteStruct(string name, int flags, string typeName) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_startWriteStruct(ptr, name, flags, typeName)); + GC.KeepAlive(this); + } + + /// + /// + /// + public void EndWriteStruct() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_endWriteStruct(ptr)); + GC.KeepAlive(this); + } + + /// + /// Returns the normalized object name for the specified file name + /// + /// + /// + public static string GetDefaultObjectName(string fileName) + { + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + using var buf = new StdString(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_getDefaultObjectName(fileName, buf.CvPtr)); + return buf.ToString(); + } + + #region Write + + /// + /// + /// + /// + /// + public void Write(string name, int value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_int(ptr, name, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + public void Write(string name, float value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_float(ptr, name, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + public void Write(string name, double value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_double(ptr, name, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + public void Write(string name, string value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + if (value is null) + throw new ArgumentNullException(nameof(value)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_String(ptr, name, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + public void Write(string name, Mat value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + if (value is null) + throw new ArgumentNullException(nameof(value)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_Mat(ptr, name, value.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(value); + } + + /// + /// + /// + /// + /// + public void Write(string name, SparseMat value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + if (value is null) + throw new ArgumentNullException(nameof(value)); + + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_SparseMat(ptr, name, value.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(value); + } + + /// + /// + /// + /// + /// + public void Write(string name, IEnumerable value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + if (value is null) + throw new ArgumentNullException(nameof(value)); + + using var valueVector = new VectorOfKeyPoint(value); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_vectorOfKeyPoint(ptr, name, valueVector.CvPtr)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + public void Write(string name, IEnumerable value) + { + ThrowIfDisposed(); + if (name is null) + throw new ArgumentNullException(nameof(name)); + if (value is null) + throw new ArgumentNullException(nameof(value)); + + using var valueVector = new VectorOfDMatch(value); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_write_vectorOfDMatch(ptr, name, valueVector.CvPtr)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void WriteScalar(int value) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_writeScalar_int(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void WriteScalar(float value) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_writeScalar_float(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void WriteScalar(double value) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_writeScalar_double(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void WriteScalar(string value) + { + ThrowIfDisposed(); + if (value is null) + throw new ArgumentNullException(nameof(value)); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_writeScalar_String(ptr, value)); + GC.KeepAlive(this); + } + + #endregion + + #region Add + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(string val) + { + if (val is null) + throw new ArgumentNullException(nameof(val)); + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_String(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(int val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_int(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(float val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_float(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(double val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_double(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Mat val) + { + if (val is null) + throw new ArgumentNullException(nameof(val)); + ThrowIfDisposed(); + val.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Mat(ptr, val.CvPtr)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(SparseMat val) + { + if (val is null) + throw new ArgumentNullException(nameof(val)); + ThrowIfDisposed(); + val.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_SparseMat(ptr, val.CvPtr)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Range val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Range(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(KeyPoint val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_KeyPoint(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(DMatch val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_DMatch(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(IEnumerable val) + { + if (val is null) + throw new ArgumentNullException(nameof(val)); + ThrowIfDisposed(); + using (var valVec = new VectorOfKeyPoint(val)) + { + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_vectorOfKeyPoint(ptr, valVec.CvPtr)); + } + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(IEnumerable val) + { + if (val is null) + throw new ArgumentNullException(nameof(val)); + ThrowIfDisposed(); + using (var valVec = new VectorOfDMatch(val)) + { + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_vectorOfDMatch(ptr, valVec.CvPtr)); + } + GC.KeepAlive(this); + return this; + } + + /// + /// /Writes data to a file storage. + /// + /// + public FileStorage Add(Point val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Point2i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Point2f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Point2f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Point2d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Point2d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Point3i val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Point3i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Point3f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Point3f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Point3d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Point3d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Size val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Size2i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Size2f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Size2f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Size2d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Size2d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Rect val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Rect2i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Rect2f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Rect2f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Rect2d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Rect2d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Scalar val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Scalar(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec2i val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec2i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec3i val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec3i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec4i val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec4i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec6i val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec6i(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec2d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec2d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec3d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec3d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec4d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec4d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec6d val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec6d(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec2f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec2f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec3f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec3f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec4f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec4f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec6f val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec6f(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec2b val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec2b(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec3b val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec3b(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec4b val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec4b(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec6b val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec6b(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec2s val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec2s(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec3s val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec3s(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec4s val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec4s(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec6s val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec6s(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec2w val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec2w(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec3w val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec3w(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec4w val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec4w(ptr, val)); + GC.KeepAlive(this); + return this; + } + + /// + /// Writes data to a file storage. + /// + /// + public FileStorage Add(Vec6w val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_FileStorage_shift_Vec6w(ptr, val)); + GC.KeepAlive(this); + return this; + } + + #endregion + + #endregion + + /// + /// + /// + [Flags] + [SuppressMessage("Microsoft.Design", "CA1008: Enums should have zero value")] + [SuppressMessage("Microsoft.Design", "CA1069: Enums should not have duplicate values")] + public enum States + { + /// + /// + /// + Undefined = 0, + + /// + /// + /// + ValueExpected = 1, + + /// + /// + /// + NameExpected = 2, + + /// + /// + /// + InsideMap = 4 + } + + /// + /// File storage mode + /// + [Flags] + [SuppressMessage("Microsoft.Design", "CA1008: Enums should have zero value")] + [SuppressMessage("Microsoft.Design", "CA1069: Enums should not have duplicate values")] + public enum Modes + { + /// + /// The storage is open for reading + /// + Read = 0, + + /// + /// The storage is open for writing + /// + Write = 1, + + /// + /// The storage is open for appending + /// + Append = 2, + + /// + /// flag, read data from source or write data to the internal buffer + /// (which is returned by FileStorage::release) + /// + Memory = 4, + + /// + /// flag, auto format + /// + FormatAuto = 0, + + /// + /// flag, XML format + /// + FormatXml = (1 << 3), + + /// + /// flag, YAML format + /// + FormatYaml = (2 << 3), + + /// + /// flag, write rawdata in Base64 by default. (consider using WRITE_BASE64) + /// + Base64 = 64, + + /// + /// flag, enable both WRITE and BASE64 + /// + WriteBase64 = Base64 | Write, + } +} diff --git a/src/OpenCvSharp/Modules/core/InputArray.cs b/src/OpenCvSharp/Modules/core/InputArray.cs new file mode 100644 index 000000000..763bcc518 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/InputArray.cs @@ -0,0 +1,1113 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +#pragma warning disable CA1002 // Do not expose generic lists + +namespace OpenCvSharp; + +/// +/// Proxy data type for passing Mat's and vector<>'s as input parameters +/// +public class InputArray : DisposableCvObject +{ + enum HandleKind + { + Unknown, + Mat, + Scalar, + Double, + Vec + } + + private object? obj; + private readonly IntPtr handle; + private readonly HandleKind handleKind; + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public const int KIND_SHIFT = 16; + public const int KIND_MASK = ~(0x8000 << KIND_SHIFT | 0x4000 << KIND_SHIFT) - (1 << KIND_SHIFT) + 1; + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + #region Init & Disposal + + /// + /// Constructor + /// + /// + internal InputArray(IntPtr ptr) + { + this.ptr = ptr; + obj = null; + handleKind = HandleKind.Unknown; + } + + /// + /// Constructor + /// + /// + // ReSharper disable once SuggestBaseTypeForParameter + internal InputArray(Mat? mat) + { + // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression + if (mat is null) + ptr = IntPtr.Zero; + else + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byMat(mat.CvPtr, out ptr)); + GC.KeepAlive(mat); + obj = mat; + handleKind = HandleKind.Mat; + } + + /// + /// Constructor + /// + /// + // ReSharper disable once SuggestBaseTypeForParameter + internal InputArray(UMat? mat) + { + // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression + if (mat is null) + ptr = IntPtr.Zero; + else + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byUMat(mat.CvPtr, out ptr)); + GC.KeepAlive(mat); + obj = mat; + handleKind = HandleKind.Mat; + } + + /// + /// Constructor + /// + /// + // ReSharper disable once SuggestBaseTypeForParameter + internal InputArray(MatExpr? expr) + { + // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression + if (expr is null) + ptr = IntPtr.Zero; + else + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byMatExpr(expr.CvPtr, out ptr)); + GC.KeepAlive(expr); + obj = null; + } + + /// + /// Constructor + /// + /// + internal InputArray(Scalar val) + { + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byScalar(val, out handle, out ptr)); + handleKind = HandleKind.Scalar; + } + + /// + /// Constructor + /// + /// + internal InputArray(double val) + { + handle = Marshal.AllocHGlobal(sizeof(double)); + Marshal.StructureToPtr(val, handle, false); + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byDouble(handle, out ptr)); + handleKind = HandleKind.Double; + } + + /// + /// Constructor + /// + /// + internal InputArray(byte[] vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (vec.Length == 0) + throw new ArgumentException("Empty array.", nameof(vec)); + + var gch = GCHandle.Alloc(vec, GCHandleType.Pinned); + handle = GCHandle.ToIntPtr(gch); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVecb(gch.AddrOfPinnedObject(), vec.Length, out ptr)); + handleKind = HandleKind.Vec; + } + + /// + /// Constructor + /// + /// + internal InputArray(short[] vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (vec.Length == 0) + throw new ArgumentException("Empty array.", nameof(vec)); + + var gch = GCHandle.Alloc(vec, GCHandleType.Pinned); + handle = GCHandle.ToIntPtr(gch); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVecs(gch.AddrOfPinnedObject(), vec.Length, out ptr)); + handleKind = HandleKind.Vec; + } + + /// + /// Constructor + /// + /// + internal InputArray(ushort[] vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (vec.Length == 0) + throw new ArgumentException("Empty array.", nameof(vec)); + + var gch = GCHandle.Alloc(vec, GCHandleType.Pinned); + handle = GCHandle.ToIntPtr(gch); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVecw(gch.AddrOfPinnedObject(), vec.Length, out ptr)); + handleKind = HandleKind.Vec; + } + + /// + /// Constructor + /// + /// + internal InputArray(int[] vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (vec.Length == 0) + throw new ArgumentException("Empty array.", nameof(vec)); + + var gch = GCHandle.Alloc(vec, GCHandleType.Pinned); + handle = GCHandle.ToIntPtr(gch); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVeci(gch.AddrOfPinnedObject(), vec.Length, out ptr)); + handleKind = HandleKind.Vec; + } + + /// + /// Constructor + /// + /// + internal InputArray(float[] vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (vec.Length == 0) + throw new ArgumentException("Empty array.", nameof(vec)); + + var gch = GCHandle.Alloc(vec, GCHandleType.Pinned); + handle = GCHandle.ToIntPtr(gch); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVecf(gch.AddrOfPinnedObject(), vec.Length, out ptr)); + handleKind = HandleKind.Vec; + } + + /// + /// Constructor + /// + /// + internal InputArray(double[] vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (vec.Length == 0) + throw new ArgumentException("Empty array.", nameof(vec)); + + var gch = GCHandle.Alloc(vec, GCHandleType.Pinned); + handle = GCHandle.ToIntPtr(gch); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVecd(gch.AddrOfPinnedObject(), vec.Length, out ptr)); + handleKind = HandleKind.Vec; + } + + /// + /// + /// + /// + internal InputArray(IEnumerable mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + + using (var matVector = new VectorOfMat(mat)) + { + NativeMethods.HandleException( + NativeMethods.core_InputArray_new_byVectorOfMat(matVector.CvPtr, out ptr)); + } + obj = mat; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + GC.KeepAlive(obj); + obj = null; + base.DisposeManaged(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + switch (handleKind) + { + case HandleKind.Scalar: + NativeMethods.HandleException( + NativeMethods.core_InputArray_delete_withScalar(ptr, handle)); + break; + case HandleKind.Double: + Marshal.FreeHGlobal(handle); + goto default; + case HandleKind.Vec: + var gch = GCHandle.FromIntPtr(handle); + if (gch.IsAllocated) + gch.Free(); + goto default; + default: + NativeMethods.HandleException( + NativeMethods.core_InputArray_delete(ptr)); + break; + } + + base.DisposeUnmanaged(); + } + + #endregion + + #region Create + + /// + /// Creates a proxy class of the specified Mat + /// + /// + /// + public static InputArray Create(Mat mat) => new(mat); + + /// + /// Creates a proxy class of the specified Mat + /// + /// + /// + public static InputArray Create(UMat mat) => new(mat); + + /// + /// Creates a proxy class of the specified MatExpr + /// + /// + /// + public static InputArray Create(MatExpr expr) => new(expr); + + /// + /// Creates a proxy class of the specified Scalar + /// + /// + /// + public static InputArray Create(Scalar val) => new(val); + + /// + /// Creates a proxy class of the specified double + /// + /// + /// + public static InputArray Create(double val) => new(val); + +#if ENABLED_CUDA + /// + /// Creates a proxy class of the specified GpuMat + /// + /// + /// + public static InputArray Create(GpuMat mat) + { + return new InputArray(mat); + } +#endif + + /// + /// Creates a proxy class of the specified array of Mat + /// + /// + /// + public static InputArray Create(IEnumerable matVector) => new(matVector); + + /// + /// Creates a proxy class of the specified list + /// + /// Array object + /// + public static InputArray Create(IEnumerable enumerable) + where T : struct + { + if (enumerable is null) + throw new ArgumentNullException(nameof(enumerable)); + var list = new List(enumerable); + return Create(list.ToArray()); + } + + /// + /// Creates a proxy class of the specified list + /// + /// Array object + /// Matrix depth and channels for converting array to cv::Mat + /// + public static InputArray Create(IEnumerable enumerable, MatType type) + where T : struct + { + if (enumerable is null) + throw new ArgumentNullException(nameof(enumerable)); + var list = new List(enumerable); + return Create(list.ToArray(), type); + } + + /// + /// Creates a proxy class of the specified list + /// + /// Array object + /// + public static InputArray Create(T[] array) + where T : struct + { + var type = EstimateType(typeof(T)); + return Create(array, type); + } + + /// + /// Creates a proxy class of the specified list + /// + /// Array object + /// Matrix depth and channels for converting array to cv::Mat + /// + public static InputArray Create(T[] array, MatType type) + where T : struct + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + if (array.Length == 0) + throw new ArgumentException("array.Length == 0"); + + var rows = array.Length; + var mat = Mat.FromPixelData(rows, 1, type, array); + return new InputArray(mat); + } + + /// + /// Creates a proxy class of the specified list + /// + /// Array object + /// + public static InputArray Create(T[,] array) + where T : struct + { + var type = EstimateType(typeof(T)); + return Create(array, type); + } + + /// + /// Creates a proxy class of the specified list + /// + /// Array object + /// Matrix depth and channels for converting array to cv::Mat + /// + public static InputArray Create(T[,] array, MatType type) + where T : struct + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + var rows = array.GetLength(0); + var cols = array.GetLength(1); + if (rows == 0) + throw new ArgumentException("array.GetLength(0) == 0"); + if (cols == 0) + throw new ArgumentException("array.GetLength(1) == 0"); + var mat = Mat.FromPixelData(rows, cols, type, array); + return new InputArray(mat); + } + + /// + /// Creates a proxy class of the specified Vec*b + /// + /// + /// + public static InputArray Create(IVec vec) + { + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + + return vec switch + { +#pragma warning disable CA2000 + Vec2b v => new InputArray(new[] { v.Item0, v.Item1 }), + Vec3b v => new InputArray(new[] { v.Item0, v.Item1, v.Item2 }), + Vec4b v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3 }), + Vec6b v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3, v.Item4, v.Item5 }), + Vec2s v => new InputArray(new[] { v.Item0, v.Item1 }), + Vec3s v => new InputArray(new[] { v.Item0, v.Item1, v.Item2 }), + Vec4s v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3 }), + Vec6s v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3, v.Item4, v.Item5 }), + Vec2w v => new InputArray(new[] { v.Item0, v.Item1 }), + Vec3w v => new InputArray(new[] { v.Item0, v.Item1, v.Item2 }), + Vec4w v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3 }), + Vec6w v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3, v.Item4, v.Item5 }), + Vec2i v => new InputArray(new[] { v.Item0, v.Item1 }), + Vec3i v => new InputArray(new[] { v.Item0, v.Item1, v.Item2 }), + Vec4i v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3 }), + Vec6i v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3, v.Item4, v.Item5 }), + Vec2f v => new InputArray(new[] { v.Item0, v.Item1 }), + Vec3f v => new InputArray(new[] { v.Item0, v.Item1, v.Item2 }), + Vec4f v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3 }), + Vec6f v => new InputArray(new[] { v.Item0, v.Item1, v.Item2, v.Item3, v.Item4, v.Item5 }), + Vec2d v => new InputArray([v.Item0, v.Item1]), + Vec3d v => new InputArray([v.Item0, v.Item1, v.Item2]), + Vec4d v => new InputArray([v.Item0, v.Item1, v.Item2, v.Item3]), + Vec6d v => new InputArray([v.Item0, v.Item1, v.Item2, v.Item3, v.Item4, v.Item5]), +#pragma warning restore CA2000 + _ => throw new ArgumentException($"Not supported type: '{vec.GetType().Name}'", nameof(vec)) + }; + } + + /// + /// + /// + /// + /// + private static MatType EstimateType(Type t) + { + if (!t.GetTypeInfo().IsValueType) + throw new ArgumentException("Reference type is not supported."); + + // Primitive types +#if false + if (t == typeof(byte)) + return MatType.CV_8UC1; + if (t == typeof(sbyte)) + return MatType.CV_8SC1; + if (t == typeof(ushort) || t == typeof(char)) + return MatType.CV_16UC1; + if (t == typeof(short)) + return MatType.CV_16SC1; + if (t == typeof(int) || t == typeof(uint)) + return MatType.CV_32SC1; + if (t == typeof(float)) + return MatType.CV_32FC1; + if (t == typeof(double)) + return MatType.CV_64FC1; +#else + var code = System.Type.GetTypeCode(t); + switch (code) + { + case TypeCode.Byte: + return MatType.CV_8UC1; + case TypeCode.SByte: + return MatType.CV_8SC1; + case TypeCode.UInt16: + return MatType.CV_16UC1; + case TypeCode.Int16: + case TypeCode.Char: + return MatType.CV_16SC1; + case TypeCode.UInt32: + case TypeCode.Int32: + return MatType.CV_32SC1; + case TypeCode.Single: + return MatType.CV_32FC1; + case TypeCode.Double: + return MatType.CV_64FC1; + } +#endif + + // OpenCV struct types + if (t == typeof(Point)) + return MatType.CV_32SC2; + if (t == typeof(Point2f)) + return MatType.CV_32FC2; + if (t == typeof(Point2d)) + return MatType.CV_64FC2; + if (t == typeof(Point3i)) + return MatType.CV_32SC3; + if (t == typeof(Point3f)) + return MatType.CV_32FC3; + if (t == typeof(Point3d)) + return MatType.CV_64FC3; + if (t == typeof(Range)) + return MatType.CV_32SC2; + if (t == typeof(Rangef)) + return MatType.CV_32FC2; + if (t == typeof(Rect)) + return MatType.CV_32SC4; + if (t == typeof(Size)) + return MatType.CV_32SC2; + if (t == typeof(Size2f)) + return MatType.CV_32FC2; + + if (t == typeof(Vec2b)) + return MatType.CV_8UC2; + if (t == typeof(Vec3b)) + return MatType.CV_8UC3; + if (t == typeof(Vec4b)) + return MatType.CV_8UC4; + if (t == typeof(Vec6b)) + return MatType.CV_8UC(6); + if (t == typeof(Vec2s)) + return MatType.CV_16SC2; + if (t == typeof(Vec3s)) + return MatType.CV_16SC3; + if (t == typeof(Vec4s)) + return MatType.CV_16SC4; + if (t == typeof(Vec6s)) + return MatType.CV_16SC(6); + if (t == typeof(Vec2w)) + return MatType.CV_16UC2; + if (t == typeof(Vec3w)) + return MatType.CV_16UC3; + if (t == typeof(Vec4w)) + return MatType.CV_16UC4; + if (t == typeof(Vec6w)) + return MatType.CV_16UC(6); + if (t == typeof(Vec2i)) + return MatType.CV_32SC2; + if (t == typeof(Vec3i)) + return MatType.CV_32SC3; + if (t == typeof(Vec4i)) + return MatType.CV_32SC4; + if (t == typeof(Vec6i)) + return MatType.CV_32SC(6); + if (t == typeof(Vec2f)) + return MatType.CV_32FC2; + if (t == typeof(Vec3f)) + return MatType.CV_32FC3; + if (t == typeof(Vec4f)) + return MatType.CV_32FC4; + if (t == typeof(Vec6f)) + return MatType.CV_32FC(6); + if (t == typeof(Vec2d)) + return MatType.CV_64FC2; + if (t == typeof(Vec3d)) + return MatType.CV_64FC3; + if (t == typeof(Vec4d)) + return MatType.CV_64FC4; + if (t == typeof(Vec6d)) + return MatType.CV_64FC(6); + + throw new ArgumentException("Not supported value type for InputArray"); + } + #endregion + + #region Cast + +#pragma warning disable 1591 +#pragma warning disable CA2225 + + public static implicit operator InputArray(Mat mat) => Create(mat); + + public static implicit operator InputArray(UMat mat) => Create(mat); + + public static implicit operator InputArray(MatExpr expr) => Create(expr); + + public static implicit operator InputArray(Scalar val) => Create(val); + + public static implicit operator InputArray(double val) => Create(val); + +#if ENABLED_CUDA + public static implicit operator InputArray(GpuMat mat) + { + return Create(mat); + } +#endif + + public static explicit operator InputArray(List mats) => Create(mats); + + public static explicit operator InputArray(Mat[] mats) => Create(mats); + + public static implicit operator InputArray(Vec2b vec) => Create(vec); + public static implicit operator InputArray(Vec3b vec) => Create(vec); + public static implicit operator InputArray(Vec4b vec) => Create(vec); + public static implicit operator InputArray(Vec6b vec) => Create(vec); + public static implicit operator InputArray(Vec2s vec) => Create(vec); + public static implicit operator InputArray(Vec3s vec) => Create(vec); + public static implicit operator InputArray(Vec4s vec) => Create(vec); + public static implicit operator InputArray(Vec6s vec) => Create(vec); + public static implicit operator InputArray(Vec2w vec) => Create(vec); + public static implicit operator InputArray(Vec3w vec) => Create(vec); + public static implicit operator InputArray(Vec4w vec) => Create(vec); + public static implicit operator InputArray(Vec6w vec) => Create(vec); + public static implicit operator InputArray(Vec2i vec) => Create(vec); + public static implicit operator InputArray(Vec3i vec) => Create(vec); + public static implicit operator InputArray(Vec4i vec) => Create(vec); + public static implicit operator InputArray(Vec6i vec) => Create(vec); + public static implicit operator InputArray(Vec2f vec) => Create(vec); + public static implicit operator InputArray(Vec3f vec) => Create(vec); + public static implicit operator InputArray(Vec4f vec) => Create(vec); + public static implicit operator InputArray(Vec6f vec) => Create(vec); + public static implicit operator InputArray(Vec2d vec) => Create(vec); + public static implicit operator InputArray(Vec3d vec) => Create(vec); + public static implicit operator InputArray(Vec4d vec) => Create(vec); + public static implicit operator InputArray(Vec6d vec) => Create(vec); +#pragma warning restore CA2225 +#pragma warning restore 1591 + + #endregion + + #region Methods + + /// + /// + /// + /// + /// + public Mat GetMat(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_getMat(ptr, i, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// + /// + /// + public Mat[] GetMatVector() + { + ThrowIfDisposed(); + using var vec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_getMatVector(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + + /// + /// + /// + /// + /// + public UMat GetUMat(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_getUMat(ptr, i, out var ret)); + GC.KeepAlive(this); + return new UMat(ret); + } + + /// + /// + /// + /// + public int GetFlags() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_getFlags(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public IntPtr GetObj() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_getObj(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public Size GetSz() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_getSz(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + public InOutArrayKind Kind() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_kind(ptr, out var ret)); + GC.KeepAlive(this); + return (InOutArrayKind)ret; + } + + /// + /// + /// + /// + /// + public int Dims(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_dims(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public int Cols(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_cols(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public int Rows(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_rows(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public Size Size(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_size(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + /// + // ReSharper disable once InconsistentNaming + public int SizeND(int[] sz, int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_sizend(ptr, sz, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public bool SameSize(InputArray arr) + { + if (arr is null) + throw new ArgumentNullException(nameof(arr)); + arr.ThrowIfDisposed(); + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_sameSize(ptr, arr.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(arr); + return ret != 0; + } + + /// + /// + /// + /// + /// + public long Total(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_total(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// + /// + /// + /// + public int Type(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_type(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public int Depth(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_depth(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public int Channels(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_channels(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public bool IsContinuous(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isContinuous(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + /// + public bool IsSubmatrix(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isSubmatrix(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + /// + public bool Empty() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public void CopyTo(OutputArray arr) + { + if (arr is null) + throw new ArgumentNullException(nameof(arr)); + arr.ThrowIfNotReady(); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_copyTo1(ptr, arr.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(arr); + } + + /// + /// + /// + /// + /// + public void CopyTo(OutputArray arr, InputArray mask) + { + if (arr is null) + throw new ArgumentNullException(nameof(arr)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + arr.ThrowIfNotReady(); + mask.ThrowIfDisposed(); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_InputArray_copyTo2(ptr, arr.CvPtr, mask.CvPtr)); + + arr.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(arr); + GC.KeepAlive(mask); + } + + /// + /// + /// + /// + /// + public long Offset(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_offset(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// + /// + /// + /// + public long Step(int i = -1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_step(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// + /// + /// + public bool IsMat() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isMat(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public bool IsUMat() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isUMat(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public bool IsMatVector() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isMatVector(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public bool IsUMatVector() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isUMatVector(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public bool IsMatx() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isMatx(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public bool IsVector() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isVector(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public bool IsGpuMatVector() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_InputArray_isGpuMatVector(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/InputOutputArray.cs b/src/OpenCvSharp/Modules/core/InputOutputArray.cs new file mode 100644 index 000000000..6279aa825 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/InputOutputArray.cs @@ -0,0 +1,70 @@ + +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Proxy data type for passing Mat's and vector<>'s as input parameters. +/// Synonym for OutputArray. +/// +public class InputOutputArray : OutputArray +{ + /// + /// Constructor + /// + /// + internal InputOutputArray(Mat mat) + : base(mat) + { + } + + /// + /// Constructor + /// + /// + internal InputOutputArray(UMat mat) + : base(mat) + { + } + + /// + /// Creates a proxy class of the specified Mat + /// + /// + /// + public new static InputOutputArray Create(Mat mat) + { + return new(mat); + } + + /// + /// Creates a proxy class of the specified UMat + /// + /// + /// + public new static InputOutputArray Create(UMat mat) + { + return new(mat); + } + + /// + /// + /// + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static implicit operator InputOutputArray(Mat mat) + { + return new(mat); + } + + /// + /// + /// + /// + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static implicit operator InputOutputArray(UMat mat) + { + return new(mat); + } +} diff --git a/src/OpenCvSharp/Modules/core/LDA.cs b/src/OpenCvSharp/Modules/core/LDA.cs new file mode 100644 index 000000000..ae389d8af --- /dev/null +++ b/src/OpenCvSharp/Modules/core/LDA.cs @@ -0,0 +1,269 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// +/// Linear Discriminant Analysis +/// +// ReSharper disable once InconsistentNaming +public class LDA : DisposableCvObject +{ + /// + /// constructor + /// + /// + public LDA(int numComponents = 0) + { + NativeMethods.HandleException( + NativeMethods.core_LDA_new1(numComponents, out ptr)); + } + + /// + /// Initializes and performs a Discriminant Analysis with Fisher's + /// Optimization Criterion on given data in src and corresponding labels + /// in labels.If 0 (or less) number of components are given, they are + /// automatically determined for given data in computation. + /// + /// + /// + /// + public LDA(InputArray src, InputArray labels, int numComponents = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + src.ThrowIfDisposed(); + labels.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_LDA_new2(src.CvPtr, labels.CvPtr, numComponents, out ptr)); + GC.KeepAlive(src); + GC.KeepAlive(labels); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_LDA_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Returns the eigenvectors of this LDA. + /// + public Mat Eigenvectors() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_LDA_eigenvectors(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// Returns the eigenvalues of this LDA. + /// + public Mat Eigenvalues() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_LDA_eigenvalues(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// Serializes this object to a given filename. + /// + /// + public void Save(string fileName) + { + ThrowIfDisposed(); + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + NativeMethods.HandleException( + NativeMethods.core_LDA_save_String(ptr, fileName)); + GC.KeepAlive(this); + } + + /// + /// Deserializes this object from a given filename. + /// + /// + public void Load(string fileName) + { + ThrowIfDisposed(); + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + NativeMethods.HandleException( + NativeMethods.core_LDA_load_String(ptr, fileName)); + GC.KeepAlive(this); + } + + /// + /// Serializes this object to a given cv::FileStorage. + /// + /// + public void Save(FileStorage fs) + { + ThrowIfDisposed(); + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + fs.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_save_FileStorage(ptr, fs.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(fs); + } + + /// + /// Deserializes this object from a given cv::FileStorage. + /// + /// + public void Load(FileStorage node) + { + ThrowIfDisposed(); + if (node is null) + throw new ArgumentNullException(nameof(node)); + node.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_load_FileStorage(ptr, node.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(node); + } + + /// + /// Compute the discriminants for data in src (row aligned) and labels. + /// + /// + /// + public void Compute(InputArray src, InputArray labels) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + src.ThrowIfDisposed(); + labels.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_compute(ptr, src.CvPtr, labels.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(labels); + } + + /// + /// Projects samples into the LDA subspace. + /// src may be one or more row aligned samples. + /// + /// + /// + public Mat Project(InputArray src) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_project(ptr, src.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + + return new Mat(ret); + } + + /// + /// Reconstructs projections from the LDA subspace. + /// src may be one or more row aligned projections. + /// + /// + /// + public Mat Reconstruct(InputArray src) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_reconstruct(ptr, src.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + + return new Mat(ret); + } + + /// + /// + /// + /// + /// + /// + /// + public static Mat SubspaceProject(InputArray w, InputArray mean, InputArray src) + { + if (w is null) + throw new ArgumentNullException(nameof(w)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + w.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_subspaceProject(w.CvPtr, mean.CvPtr, src.CvPtr, out var ret)); + + GC.KeepAlive(w); + GC.KeepAlive(mean); + GC.KeepAlive(src); + + return new Mat(ret); + } + + /// + /// + /// + /// + /// + /// + /// + public static Mat SubspaceReconstruct(InputArray w, InputArray mean, InputArray src) + { + if (w is null) + throw new ArgumentNullException(nameof(w)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + w.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_LDA_subspaceReconstruct(w.CvPtr, mean.CvPtr, src.CvPtr, out var ret)); + + GC.KeepAlive(w); + GC.KeepAlive(mean); + GC.KeepAlive(src); + + return new Mat(ret); + } +} diff --git a/src/OpenCvSharp/Modules/core/Mat/Mat.cs b/src/OpenCvSharp/Modules/core/Mat/Mat.cs new file mode 100644 index 000000000..c64ca2051 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Mat/Mat.cs @@ -0,0 +1,4149 @@ +using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Contracts; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// OpenCV C++ n-dimensional dense array class (cv::Mat) +/// +public partial class Mat : DisposableCvObject +{ + #region Init & Disposal + + /// + /// typeof(T) -> MatType + /// + protected static readonly IReadOnlyDictionary TypeMap = new Dictionary + { + [typeof(byte)] = MatType.CV_8UC1, + [typeof(sbyte)] = MatType.CV_8SC1, + [typeof(short)] = MatType.CV_16SC1, + [typeof(char)] = MatType.CV_16UC1, + [typeof(ushort)] = MatType.CV_16UC1, + [typeof(int)] = MatType.CV_32SC1, + [typeof(float)] = MatType.CV_32FC1, + [typeof(double)] = MatType.CV_64FC1, + + [typeof(Vec2b)] = MatType.CV_8UC2, + [typeof(Vec3b)] = MatType.CV_8UC3, + [typeof(Vec4b)] = MatType.CV_8UC4, + [typeof(Vec6b)] = MatType.CV_8UC(6), + + [typeof(Vec2s)] = MatType.CV_16SC2, + [typeof(Vec3s)] = MatType.CV_16SC3, + [typeof(Vec4s)] = MatType.CV_16SC4, + [typeof(Vec6s)] = MatType.CV_16SC(6), + + [typeof(Vec2w)] = MatType.CV_16UC2, + [typeof(Vec3w)] = MatType.CV_16UC3, + [typeof(Vec4w)] = MatType.CV_16UC4, + [typeof(Vec6w)] = MatType.CV_16UC(6), + + [typeof(Vec2i)] = MatType.CV_32SC2, + [typeof(Vec3i)] = MatType.CV_32SC3, + [typeof(Vec4i)] = MatType.CV_32SC4, + [typeof(Vec6i)] = MatType.CV_32SC(6), + + [typeof(Vec2f)] = MatType.CV_32FC2, + [typeof(Vec3f)] = MatType.CV_32FC3, + [typeof(Vec4f)] = MatType.CV_32FC4, + [typeof(Vec6f)] = MatType.CV_32FC(6), + + [typeof(Vec2d)] = MatType.CV_64FC2, + [typeof(Vec3d)] = MatType.CV_64FC3, + [typeof(Vec4d)] = MatType.CV_64FC4, + [typeof(Vec6d)] = MatType.CV_64FC(6), + + [typeof(Point)] = MatType.CV_32SC2, + [typeof(Point2f)] = MatType.CV_32FC2, + [typeof(Point2d)] = MatType.CV_64FC2, + + [typeof(Point3i)] = MatType.CV_32SC3, + [typeof(Point3f)] = MatType.CV_32FC3, + [typeof(Point3d)] = MatType.CV_64FC3, + + [typeof(Size)] = MatType.CV_32SC2, + [typeof(Size2f)] = MatType.CV_32FC2, + [typeof(Size2d)] = MatType.CV_64FC2, + + [typeof(Rect)] = MatType.CV_32SC4, + [typeof(Rect2f)] = MatType.CV_32FC4, + [typeof(Rect2d)] = MatType.CV_64FC4, + + [typeof(DMatch)] = MatType.CV_32FC4, + }; + + /// + /// Creates from native cv::Mat* pointer + /// + /// + internal Mat(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Native object address is NULL"); + this.ptr = ptr; + } + + /// + /// Creates from native cv::Mat* pointer + /// + /// + public static Mat FromNativePointer(IntPtr ptr) + => new (ptr); + + /// + /// Creates empty Mat + /// + public Mat() + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new1(out ptr)); + } + + /// + /// + /// + /// + protected Mat(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_new12(m.ptr, out ptr)); + pinLifetime = m.pinLifetime?.Ref(); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("imread failed."); + } + + /// + /// Loads an image from a file. (cv::imread) + /// + /// Name of file to be loaded. + /// Specifies color type of the loaded image + public Mat(string fileName, ImreadModes flags = ImreadModes.Color) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.imgcodecs_imread(fileName, (int) flags, out ptr)); + } + + /// + /// constructs 2D matrix of the specified size and type + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + public Mat(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new2(rows, cols, type, out ptr)); + } + + /// + /// constructs 2D matrix of the specified size and type + /// + /// 2D array size: Size(cols, rows) . In the Size() constructor, + /// the number of rows and the number of columns go in the reverse order. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + public Mat(Size size, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new2(size.Height, size.Width, type, out ptr)); + } + + /// + /// constructs 2D matrix and fills it with the specified Scalar value. + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public Mat(int rows, int cols, MatType type, Scalar s) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new3(rows, cols, type, s, out ptr)); + } + + /// + /// constructs 2D matrix and fills it with the specified Scalar value. + /// + /// 2D array size: Size(cols, rows) . In the Size() constructor, + /// the number of rows and the number of columns go in the reverse order. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public Mat(Size size, MatType type, Scalar s) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new3(size.Height, size.Width, type, s, out ptr)); + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat::clone() . + /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. + /// Use Range.All to take all the rows. + /// Range of the m columns to take. Use Range.All to take all the columns. + public Mat(Mat m, Range rowRange, Range? colRange = null) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + if (colRange.HasValue) + NativeMethods.HandleException(NativeMethods.core_Mat_new4(m.ptr, rowRange, colRange.Value, out ptr)); + else + NativeMethods.HandleException(NativeMethods.core_Mat_new5(m.ptr, rowRange, out ptr)); + GC.KeepAlive(m); + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat.Clone() . + /// Array of selected ranges of m along each dimensionality. + public Mat(Mat m, params Range[] ranges) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + if (ranges.Length == 0) + throw new ArgumentException("empty ranges", nameof(ranges)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_new6(m.ptr, ranges, out ptr)); + GC.KeepAlive(m); + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat.Clone() . + /// Region of interest. + public Mat(Mat m, Rect roi) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_new7(m.ptr, roi, out ptr)); + GC.KeepAlive(m); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . + [Obsolete("Use Mat.FromPixelData instead. This constructor has been deprecated because the introduction of 'nint' made overload resolution confusing.", true)] + public Mat(int rows, int cols, MatType type, IntPtr data, long step = 0) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new8(rows, cols, type, data, new IntPtr(step), out ptr)); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . + public static Mat FromPixelData(int rows, int cols, MatType type, IntPtr data, long step = 0) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new8(rows, cols, type, data, new IntPtr(step), out var ptr)); + return new Mat(ptr); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . + protected Mat(int rows, int cols, MatType type, Array data, long step = 0) + { + pinLifetime = new ArrayPinningLifetime(data); + NativeMethods.HandleException( + NativeMethods.core_Mat_new8(rows, cols, type, + pinLifetime.DataPtr, new IntPtr(step), out ptr)); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . + public static Mat FromPixelData(int rows, int cols, MatType type, Array data, long step = 0) + => new (rows, cols, type, data, step); + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). + /// If not specified, the matrix is assumed to be continuous. + public static Mat FromPixelData(IEnumerable sizes, MatType type, IntPtr data, IEnumerable? steps = null) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + if (data == IntPtr.Zero) + throw new ArgumentNullException(nameof(data)); +#pragma warning disable CA1508 + var sizesArray = sizes as int[] ?? sizes.ToArray(); +#pragma warning restore CA1508 + + IntPtr ptr; + if (steps is null) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, type, data, IntPtr.Zero, out ptr)); + } + else + { + var stepsArray = steps.Select(s => new IntPtr(s)).ToArray(); + NativeMethods.HandleException( + NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, type, data, stepsArray, out ptr)); + } + return new Mat(ptr); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). + /// If not specified, the matrix is assumed to be continuous. + protected Mat(IEnumerable sizes, MatType type, Array data, IEnumerable? steps = null) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + if (data is null) + throw new ArgumentNullException(nameof(data)); + + pinLifetime = new ArrayPinningLifetime(data); +#pragma warning disable CA1508 + var sizesArray = sizes as int[] ?? sizes.ToArray(); +#pragma warning restore CA1508 + if (steps is null) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, + type, pinLifetime.DataPtr, IntPtr.Zero, out ptr)); + } + else + { + var stepsArray = steps.Select(s => new IntPtr(s)).ToArray(); + NativeMethods.HandleException( + NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, + type, pinLifetime.DataPtr, stepsArray, out ptr)); + } + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). + /// If not specified, the matrix is assumed to be continuous. + public static Mat FromPixelData(IEnumerable sizes, MatType type, Array data, IEnumerable? steps = null) + => new (sizes, type, data, steps); + + /// + /// constructs n-dimensional matrix + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + public Mat(IEnumerable sizes, MatType type) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + +#pragma warning disable CA1508 + var sizesArray = sizes as int[] ?? sizes.ToArray(); +#pragma warning restore CA1508 + NativeMethods.HandleException( + NativeMethods.core_Mat_new10(sizesArray.Length, sizesArray, type, out ptr)); + } + + /// + /// constructs n-dimensional matrix + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public Mat(IEnumerable sizes, MatType type, Scalar s) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); +#pragma warning disable CA1508 + var sizesArray = sizes as int[] ?? sizes.ToArray(); +#pragma warning restore CA1508 + NativeMethods.HandleException( + NativeMethods.core_Mat_new11(sizesArray.Length, sizesArray, type, s, out ptr)); + } + + /// + /// Releases the resources + /// + public void Release() => Dispose(); + + /// + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero && IsEnabledDispose) + NativeMethods.HandleException( + NativeMethods.core_Mat_delete(ptr)); + base.DisposeUnmanaged(); + } + + #region Static Initializers + + /// + /// Creates the Mat instance from System.IO.Stream + /// + /// + /// + /// + public static Mat FromStream(Stream stream, ImreadModes mode) + { + if (stream is null) + throw new ArgumentNullException(nameof(stream)); + if (stream.Length > int.MaxValue) + throw new ArgumentException("Not supported stream (too long)"); + + using var memoryStream = new MemoryStream(); + stream.CopyTo(memoryStream); + + return FromImageData(memoryStream.ToArray(), mode); + } + + /// + /// Creates the Mat instance from image data (using cv::decode) + /// + /// + /// + /// + public static Mat ImDecode(byte[] imageBytes, ImreadModes mode = ImreadModes.Color) + { + if (imageBytes is null) + throw new ArgumentNullException(nameof(imageBytes)); + return Cv2.ImDecode(imageBytes, mode); + } + + /// + /// Reads image from the specified buffer in memory. + /// + /// The input slice of bytes. + /// The same flags as in imread + /// + public static Mat ImDecode(ReadOnlySpan span, ImreadModes mode = ImreadModes.Color) + => Cv2.ImDecode(span, mode); + + /// + /// Creates the Mat instance from image data (using cv::decode) + /// + /// + /// + /// + public static Mat FromImageData(byte[] imageBytes, ImreadModes mode = ImreadModes.Color) + => ImDecode(imageBytes, mode); + + /// + /// Reads image from the specified buffer in memory. + /// + /// The input slice of bytes. + /// The same flags as in imread + /// + public static Mat FromImageData(ReadOnlySpan span, ImreadModes mode = ImreadModes.Color) + => Cv2.ImDecode(span, mode); + + #endregion + + #endregion + + #region Static + + /// + /// Extracts a diagonal from a matrix, or creates a diagonal matrix. + /// + /// One-dimensional matrix that represents the main diagonal. + /// + public static Mat Diag(Mat d) + { + if (d is null) + throw new ArgumentNullException(nameof(d)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_diag_static(d.CvPtr, out var ret)); + GC.KeepAlive(d); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Returns a zero array of the specified size and type. + /// + /// Number of rows. + /// Number of columns. + /// Created matrix type. + /// + public static MatExpr Zeros(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_zeros1(rows, cols, type, out var ret)); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Returns a zero array of the specified size and type. + /// + /// Alternative to the matrix size specification Size(cols, rows) . + /// Created matrix type. + /// + public static MatExpr Zeros(Size size, MatType type) + => Zeros(size.Height, size.Width, type); + + /// + /// Returns a zero array of the specified size and type. + /// + /// Created matrix type. + /// + /// + public static MatExpr Zeros(MatType type, params int[] sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_zeros2(sizes.Length, sizes, type, out var ret)); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Returns an array of all 1’s of the specified size and type. + /// + /// Number of rows. + /// Number of columns. + /// Created matrix type. + /// + public static MatExpr Ones(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_ones1(rows, cols, type, out var ret)); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Returns an array of all 1’s of the specified size and type. + /// + /// Alternative to the matrix size specification Size(cols, rows) . + /// Created matrix type. + /// + public static MatExpr Ones(Size size, MatType type) + => Ones(size.Height, size.Width, type); + + /// + /// Returns an array of all 1’s of the specified size and type. + /// + /// Created matrix type. + /// Array of integers specifying the array shape. + /// + public static MatExpr Ones(MatType type, params int[] sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_ones2(sizes.Length, sizes, type, out var ret)); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Returns an identity matrix of the specified size and type. + /// + /// Alternative to the matrix size specification Size(cols, rows) . + /// Created matrix type. + /// + public static MatExpr Eye(Size size, MatType type) + => Eye(size.Height, size.Width, type); + + /// + /// Returns an identity matrix of the specified size and type. + /// + /// Number of rows. + /// Number of columns. + /// Created matrix type. + /// + public static MatExpr Eye(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_eye(rows, cols, type, out var ret)); + var retVal = new MatExpr(ret); + return retVal; + } + + #region FromArray + + /// + /// Initializes as N x 1 matrix and copies array data to this + /// + /// Source array data to be copied to this + public static Mat FromArray(params TElem[] arr) + where TElem : unmanaged + { + if (arr is null) + throw new ArgumentNullException(nameof(arr)); + if (arr.Length == 0) + throw new ArgumentException("arr.Length == 0"); + + var numElems = arr.Length /* / ThisChannels*/; + var mat = new Mat(numElems, 1); + if (!mat.SetArray(arr)) + throw new OpenCvSharpException("Failed to copy pixel data into cv::Mat"); + return mat; + } + + /// + /// Initializes as M x N matrix and copies array data to this + /// + /// Source array data to be copied to this + public static Mat FromArray(TElem[,] arr) + where TElem : unmanaged + { + if (arr is null) + throw new ArgumentNullException(nameof(arr)); + if (arr.Length == 0) + throw new ArgumentException("arr.Length == 0"); + + var rows = arr.GetLength(0); + var cols = arr.GetLength(1); + var mat = new Mat(rows, cols); + if (!mat.SetRectangularArray(arr)) + throw new OpenCvSharpException("Failed to copy pixel data into cv::Mat"); + return mat; + } + + /// + /// Initializes as N x 1 matrix and copies array data to this + /// + /// Source array data to be copied to this + public static Mat FromArray(IEnumerable enumerable) + where TElem : unmanaged => + FromArray(enumerable.ToArray()); + + #endregion + + #endregion + + #region Operators + +#pragma warning disable 1591 + + public static Mat operator +(Mat mat) => mat; + + public MatExpr Plus() => this; + + public static MatExpr operator -(Mat mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorUnaryMinus(mat.CvPtr, out var ret)); + GC.KeepAlive(mat); + return new MatExpr(ret); + } + + public MatExpr Negate() => -this; + + public static MatExpr operator +(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorAdd_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator +(Mat a, Scalar s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorAdd_MatScalar(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator +(Scalar s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorAdd_ScalarMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr Add(Mat m) => this + m; + public MatExpr Add(Scalar s) => this + s; + + public static MatExpr operator -(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorSubtract_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator -(Mat a, Scalar s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorSubtract_MatScalar(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator -(Scalar s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorSubtract_ScalarMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr Subtract(Mat m) => this - m; + public MatExpr Subtract(Scalar s) => this - s; + + public static MatExpr operator *(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorMultiply_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator *(Mat a, double s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorMultiply_MatDouble(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator *(double s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorMultiply_DoubleMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr Multiply(Mat m) => this * m; + public MatExpr Multiply(double s) => this * s; + + public static MatExpr operator /(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorDivide_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator /(Mat a, double s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorDivide_MatDouble(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator /(double s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorDivide_DoubleMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr Divide(Mat m) => this / m; + public MatExpr Divide(double s) => this / s; + + public static MatExpr operator &(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorAnd_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator &(Mat a, double s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorAnd_MatDouble(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator &(double s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorAnd_DoubleMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr BitwiseAnd(Mat m) => this & m; + public MatExpr BitwiseAnd(double s) => this & s; + + public static MatExpr operator |(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorOr_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator |(Mat a, double s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorOr_MatDouble(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator |(double s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorOr_DoubleMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr BitwiseOr(Mat m) => this | m; + public MatExpr BitwiseOr(double s) => this | s; + + public static MatExpr operator ^(Mat a, Mat b) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorXor_MatMat(a.CvPtr, b.CvPtr, out var ret)); + GC.KeepAlive(a); + GC.KeepAlive(b); + return new MatExpr(ret); + } + + public static MatExpr operator ^(Mat a, double s) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorXor_MatDouble(a.CvPtr, s, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public static MatExpr operator ^(double s, Mat a) + { + if (a is null) + throw new ArgumentNullException(nameof(a)); + a.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorXor_DoubleMat(s, a.CvPtr, out var ret)); + GC.KeepAlive(a); + return new MatExpr(ret); + } + + public MatExpr Xor(Mat m) => this ^ m; + public MatExpr Xor(double s) => this ^ s; + + public static MatExpr operator ~(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorNot(m.CvPtr, out var ret)); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + public MatExpr OnesComplement() => ~this; + +#pragma warning restore 1591 + #endregion + + #region Comparison + + /// + /// operator < + /// + /// + /// + public MatExpr LessThan(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorLT_MatMat(ptr, m.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + /// + /// operator < + /// + /// + /// + public MatExpr LessThan(double d) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorLT_MatDouble(ptr, d, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// operator <= + /// + /// + /// + public MatExpr LessThanOrEqual(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorLE_MatMat(ptr, m.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + /// + /// operator <= + /// + /// + /// + public MatExpr LessThanOrEqual(double d) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorLE_MatDouble(ptr, d, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// operator == + /// + /// + /// + public MatExpr Equals(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorEQ_MatMat(ptr, m.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + /// + /// operator == + /// + /// + /// + public MatExpr Equals(double d) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorEQ_MatDouble(ptr, d, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// operator != + /// + /// + /// + public MatExpr NotEquals(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorNE_MatMat(ptr, m.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + /// + /// operator != + /// + /// + /// + public MatExpr NotEquals(double d) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorNE_MatDouble(ptr, d, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// operator > + /// + /// + /// + public MatExpr GreaterThan(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorGT_MatMat(ptr, m.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + /// + /// operator > + /// + /// + /// + public MatExpr GreaterThan(double d) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorGT_MatDouble(ptr, d, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// operator >= + /// + /// + /// + public MatExpr GreaterThanOrEqual(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorGE_MatMat(ptr, m.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + /// + /// operator >= + /// + /// + /// + public MatExpr GreaterThanOrEqual(double d) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_operatorGE_MatDouble(ptr, d, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + #endregion + + #region Public Methods + + #region Mat Indexers + + /// + /// Extracts a rectangular submatrix. + /// + /// Start row of the extracted submatrix. The upper boundary is not included. + /// End row of the extracted submatrix. The upper boundary is not included. + /// Start column of the extracted submatrix. The upper boundary is not included. + /// End column of the extracted submatrix. The upper boundary is not included. + /// + public Mat this[int rowStart, int rowEnd, int colStart, int colEnd] + { + get => SubMat(rowStart, rowEnd, colStart, colEnd); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + using var sub = SubMat(rowStart, rowEnd, colStart, colEnd); + if (sub.Size() != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + value.CopyTo(sub); + } + } + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range.All(). + /// Start and end column of the extracted submatrix. + /// The upper boundary is not included. To select all the columns, use Range.All(). + /// + public Mat this[System.Range rowRange, System.Range colRange] + { + get => SubMat(rowRange, colRange); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + using var sub = SubMat(rowRange, colRange); + if (sub.Size() != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + value.CopyTo(sub); + } + } +#endif + + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range.All(). + /// Start and end column of the extracted submatrix. + /// The upper boundary is not included. To select all the columns, use Range.All(). + /// + public Mat this[Range rowRange, Range colRange] + { + get => SubMat(rowRange, colRange); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + using var sub = SubMat(rowRange, colRange); + if (sub.Size() != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + value.CopyTo(sub); + } + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Extracted submatrix specified as a rectangle. + /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public Mat this[Rect roi] + { + get => SubMat(roi); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + if (roi.Size != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + using var sub = SubMat(roi); + value.CopyTo(sub); + } + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Array of selected ranges along each array dimension. + /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public Mat this[params Range[] ranges] + { + get => SubMat(ranges); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + + using var sub = SubMat(ranges); + + var dims = Dims; + if (dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + for (var i = 0; i < dims; i++) + { + if (sub.Size(i) != value.Size(i)) + throw new ArgumentException("Size mismatch at dimension " + i); + } + + value.CopyTo(sub); + } + } + + #endregion + + /// + /// Retrieve UMat from Mat + /// + /// + /// + /// + public UMat GetUMat(AccessFlag accessFlags, UMatUsageFlags usageFlags) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_getUMat(ptr, (int)accessFlags, (int)usageFlags, out var matPtr)); + return new UMat(matPtr); + } + + /// + /// Creates a matrix header for the specified matrix column. + /// + /// A 0-based column index. + /// + public Mat Col(int x) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_col(ptr, x, out var matPtr)); + return new Mat(matPtr); + } + + /// + /// Creates a matrix header for the specified column span. + /// + /// An inclusive 0-based start index of the column span. + /// An exclusive 0-based ending index of the column span. + /// + public Mat ColRange(int startCol, int endCol) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_colRange(ptr, startCol, endCol, out var matPtr)); + GC.KeepAlive(this); + return new Mat(matPtr); + } + + /// + /// Creates a matrix header for the specified column span. + /// + /// + /// + public Mat ColRange(Range range) + => ColRange(range.Start, range.End); + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Creates a matrix header for the specified column span. + /// + /// + /// + public Mat ColRange(System.Range range) + { + var (colStart, colLength) = range.GetOffsetAndLength(Cols); + return ColRange(colStart, colStart + colLength); + } +#endif + + /// + /// Creates a matrix header for the specified matrix row. + /// + /// A 0-based row index. + /// + public Mat Row(int y) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_row(ptr, y, out var matPtr)); + return new Mat(matPtr); + } + + /// + /// Creates a matrix header for the specified row span. + /// + /// + /// + /// + public Mat RowRange(int startRow, int endRow) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_rowRange(ptr, startRow, endRow, out var matPtr)); + GC.KeepAlive(this); + return new Mat(matPtr); + } + + /// + /// Creates a matrix header for the specified row span. + /// + /// + /// + public Mat RowRange(Range range) + => RowRange(range.Start, range.End); + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Creates a matrix header for the specified row span. + /// + /// + /// + public Mat RowRange(System.Range range) + { + var (rowStart, rowLength) = range.GetOffsetAndLength(Rows); + return RowRange(rowStart, rowStart + rowLength); + } +#endif + + /// + /// Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values: + /// + /// Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values: + /// + public Mat Diag(MatDiagType d = MatDiagType.Main) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_diag(ptr, (int)d, out var ret)); + GC.KeepAlive(this); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Creates a full copy of the matrix. + /// + /// + public Mat Clone() + { + ThrowIfDisposed(); + + if (Empty()) + return new Mat(Size(), Type()); + + NativeMethods.HandleException( + NativeMethods.core_Mat_clone(ptr, out var ret)); + GC.KeepAlive(this); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Returns the partial Mat of the specified Mat + /// + /// + /// + public Mat Clone(Rect roi) + { + using var part = new Mat(this, roi); + return part.Clone(); + } + + /// + /// Copies the matrix to another one. + /// + /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. + /// Operation mask. Its non-zero elements indicate which matrix elements need to be copied. + public void CopyTo(OutputArray m, InputArray? mask = null) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfNotReady(); + mask?.ThrowIfDisposed(); + + if (mask is null) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_copyTo1(ptr, m.CvPtr)); + } + else + { + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_Mat_copyTo2(ptr, m.CvPtr, maskPtr)); + } + + GC.KeepAlive(this); + m.Fix(); + GC.KeepAlive(mask); + } + + /// + /// Copies the matrix to another one. + /// + /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. + /// Operation mask. Its non-zero elements indicate which matrix elements need to be copied. + public void CopyTo(Mat m, InputArray? mask = null) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); + + if (mask is null) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_copyTo_toMat1(ptr, m.CvPtr)); + } + else + { + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_Mat_copyTo_toMat2(ptr, m.CvPtr, maskPtr)); + } + + GC.KeepAlive(this); + GC.KeepAlive(m); + GC.KeepAlive(mask); + } + + /// + /// Converts an array to another data type with optional scaling. + /// + /// output matrix; if it does not have a proper size or type before the operation, it is reallocated. + /// desired output matrix type or, rather, the depth since the number of channels are the same as the input has; + /// if rtype is negative, the output matrix will have the same type as the input. + /// optional scale factor. + /// optional delta added to the scaled values. + public void ConvertTo(OutputArray m, MatType rtype, double alpha = 1, double beta = 0) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_convertTo(ptr, m.CvPtr, rtype, alpha, beta)); + + GC.KeepAlive(this); + m.Fix(); + } + + /// + /// Provides a functional form of convertTo. + /// + /// Destination array. + /// Desired destination array depth (or -1 if it should be the same as the source type). + public void AssignTo(Mat m, MatType? type = null) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_assignTo(ptr, m.CvPtr, type?.Value ?? -1)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// Sets all or some of the array elements to the specified value. + /// + /// + /// + /// + public Mat SetTo(Scalar value, Mat? mask = null) + { + ThrowIfDisposed(); + + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_Mat_setTo_Scalar(ptr, value, maskPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(mask); + return this; + } + + /// + /// Sets all or some of the array elements to the specified value. + /// + /// + /// + /// + public Mat SetTo(InputArray value, Mat? mask = null) + { + ThrowIfDisposed(); + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_Mat_setTo_InputArray(ptr, value.CvPtr, maskPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(value); + GC.KeepAlive(mask); + return this; + } + + /// + /// Changes the shape and/or the number of channels of a 2D matrix without copying the data. + /// + /// New number of channels. If the parameter is 0, the number of channels remains the same. + /// New number of rows. If the parameter is 0, the number of rows remains the same. + /// + public Mat Reshape(int cn, int rows = 0) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_reshape1(ptr, cn, rows, out var ret)); + + GC.KeepAlive(this); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Changes the shape and/or the number of channels of a 2D matrix without copying the data. + /// + /// New number of channels. If the parameter is 0, the number of channels remains the same. + /// New number of rows. If the parameter is 0, the number of rows remains the same. + /// + public Mat Reshape(int cn, params int[] newDims) + { + if (newDims is null) + throw new ArgumentNullException(nameof(newDims)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_reshape2(ptr, cn, newDims.Length, newDims, out var ret)); + + GC.KeepAlive(this); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Transposes a matrix. + /// + /// + public MatExpr T() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_t(ptr, out var ret)); + + GC.KeepAlive(this); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Inverses a matrix. + /// + /// Matrix inversion method + /// + public MatExpr Inv(DecompTypes method = DecompTypes.LU) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_inv(ptr, (int) method, out var ret)); + + GC.KeepAlive(this); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Performs an element-wise multiplication or division of the two matrices. + /// + /// + /// + /// + public MatExpr Mul(InputArray m, double scale = 1) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_mul(ptr, m.CvPtr, scale, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Computes a cross-product of two 3-element vectors. + /// + /// Another cross-product operand. + /// + public Mat Cross(InputArray m) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_cross(ptr, m.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Computes a dot-product of two vectors. + /// + /// another dot-product operand. + /// + public double Dot(InputArray m) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_dot(ptr, m.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + return ret; + } + + /// + /// Allocates new array data if needed. + /// + /// New number of rows. + /// New number of columns. + /// New matrix type. + public void Create(int rows, int cols, MatType type) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_create1(ptr, rows, cols, type)); + GC.KeepAlive(this); + } + + /// + /// Allocates new array data if needed. + /// + /// Alternative new matrix size specification: Size(cols, rows) + /// New matrix type. + public void Create(Size size, MatType type) + => Create(size.Height, size.Width, type); + + /// + /// Allocates new array data if needed. + /// + /// Array of integers specifying a new array shape. + /// New matrix type. + public void Create(MatType type, params int[] sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + if (sizes.Length < 2) + throw new ArgumentException("sizes.Length < 2"); + NativeMethods.HandleException( + NativeMethods.core_Mat_create2(ptr, sizes.Length, sizes, type)); + GC.KeepAlive(this); + } + + /// + /// Reserves space for the certain number of rows. + /// + /// The method reserves space for sz rows. If the matrix already has enough space to store sz rows, + /// nothing happens. If the matrix is reallocated, the first Mat::rows rows are preserved. The method + /// emulates the corresponding method of the STL vector class. + /// + /// Number of rows. + public void Reserve(int sz) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_reserve(ptr, new IntPtr(sz))); + GC.KeepAlive(this); + } + + /// + /// Reserves space for the certain number of bytes. + /// + /// The method reserves space for sz bytes. If the matrix already has enough space to store sz bytes, + /// nothing happens. If matrix has to be reallocated its previous content could be lost. + /// + /// Number of bytes. + public void ReserveBuffer(int sz) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_reserveBuffer(ptr, new IntPtr(sz))); + GC.KeepAlive(this); + } + + /// + /// Changes the number of matrix rows. + /// + /// New number of rows. + public void Resize(int sz) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_resize1(ptr, new IntPtr(sz))); + GC.KeepAlive(this); + } + + /// + /// Changes the number of matrix rows. + /// + /// New number of rows. + /// Value assigned to the newly added elements. + public void Resize(int sz, Scalar s) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_resize2(ptr, new IntPtr(sz), s)); + GC.KeepAlive(this); + } + + /// + /// removes several hyper-planes from bottom of the matrix (Mat.pop_back) + /// + /// + public void PopBack(int nElems = 1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_pop_back(ptr, new IntPtr(nElems))); + GC.KeepAlive(this); + } + + #region PushBack + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(byte value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_uchar(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(sbyte value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_char(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(ushort value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_ushort(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(short value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_short(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(int value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_int(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(float value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_float(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(double value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_double(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec2b value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec2b(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec3b value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec3b(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec4b value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec4b(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec6b value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec6b(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec2w value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec2w(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec3w value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec3w(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec4w value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec4w(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec6w value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec6w(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec2s value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec2s(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec3s value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec3s(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec4s value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec4s(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec6s value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec6s(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec2i value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec2i(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec3i value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec3i(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec4i value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec4i(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec6i value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec6i(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec2f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec2f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec3f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec3f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec4f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec4f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec6f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec6f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec2d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec2d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec3d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec3d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec4d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec4d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Vec6d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Vec6d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Point value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Point(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Point2d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Point2d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Point2f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Point2f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Point3i value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Point3i(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Point3d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Point3d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Point3f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Point3f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Size value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Size(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Size2d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Size2d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Size2f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Size2f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Rect value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Rect(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Rect2d value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Rect2d(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat::push_back) + /// + /// Added element + public void PushBack(Rect2f value) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_Mat_push_back_Rect2f(ptr, value)); + GC.KeepAlive(this); + } + + /// + /// Adds elements to the bottom of the matrix. (Mat.push_back) + /// + /// Added line(s) + public void PushBack(Mat m) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_push_back_Mat(ptr, m.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + #endregion + + /// + /// Locates the matrix header within a parent matrix. + /// + /// Output parameter that contains the size of the whole matrix containing *this as a part. + /// Output parameter that contains an offset of *this inside the whole matrix. + // ReSharper disable once InconsistentNaming + public void LocateROI(out Size wholeSize, out Point ofs) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_locateROI(ptr, out wholeSize, out ofs)); + GC.KeepAlive(this); + } + + /// + /// Adjusts a submatrix size and position within the parent matrix. + /// + /// Shift of the top submatrix boundary upwards. + /// Shift of the bottom submatrix boundary downwards. + /// Shift of the left submatrix boundary to the left. + /// Shift of the right submatrix boundary to the right. + /// + // ReSharper disable once InconsistentNaming + public Mat AdjustROI(int dtop, int dbottom, int dleft, int dright) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_adjustROI(ptr, dtop, dbottom, dleft, dright, out var ret)); + GC.KeepAlive(this); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + /// + /// + /// + public Mat SubMat(int rowStart, int rowEnd, int colStart, int colEnd) + { + if (rowStart >= rowEnd) + throw new ArgumentException("rowStart >= rowEnd"); + if (colStart >= colEnd) + throw new ArgumentException("colStart >= colEnd"); + + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_subMat1(ptr, rowStart, rowEnd, colStart, colEnd, out var ret)); + GC.KeepAlive(this); + var retVal = new Mat(ret); + + // If this is a managed array, keep the array pinned as long as the Mat is alive + retVal.pinLifetime = pinLifetime?.Ref(); + return retVal; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range::all(). + /// Start and end column of the extracted submatrix. The upper boundary is not included. + /// To select all the columns, use Range::all(). + /// + public Mat SubMat(Range rowRange, Range colRange) + => SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range::all(). + /// Start and end column of the extracted submatrix. The upper boundary is not included. + /// To select all the columns, use Range::all(). + /// + public Mat SubMat(System.Range rowRange, System.Range colRange) + { + var (rowStart, rowLength) = rowRange.GetOffsetAndLength(Rows); + var (colStart, colLength) = colRange.GetOffsetAndLength(Cols); + return SubMat(rowStart, rowStart + rowLength, colStart, colStart + colLength); + } +#endif + + /// + /// Extracts a rectangular submatrix. + /// + /// Extracted submatrix specified as a rectangle. + /// + public Mat SubMat(Rect roi) + => SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); + + /// + /// Extracts a rectangular submatrix. + /// + /// Array of selected ranges along each array dimension. + /// + public Mat SubMat(params Range[] ranges) + { + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_Mat_subMat2(ptr, ranges.Length, ranges, out var ret)); + var retVal = new Mat(ret); + GC.KeepAlive(this); + return retVal; + } + + /// + /// Reports whether the matrix is continuous or not. + /// + /// + public bool IsContinuous() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_isContinuous(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns whether this matrix is a part of other matrix or not. + /// + /// + public bool IsSubmatrix() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_isSubmatrix(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the matrix element size in bytes. + /// + /// + public int ElemSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_elemSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt32(); + } + + /// + /// Returns the size of each matrix element channel in bytes. + /// + /// + public int ElemSize1() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_elemSize1(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt32(); + } + + /// + /// Returns the type of a matrix element. + /// + /// + public MatType Type() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_type(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the depth of a matrix element. + /// + /// + public int Depth() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_depth(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the number of matrix channels. + /// + /// + public int Channels() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_channels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a normalized step. + /// + /// + /// + public long Step1(int i = 0) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_step1(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Returns true if the array has no elements. + /// + /// + public bool Empty() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the total number of array elements. + /// + /// + public long Total() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_total1(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Returns the total number of array elements. + /// The method returns the number of elements within a certain sub-array slice with startDim <= dim < endDim + /// + /// + /// + /// + public long Total(int startDim, int endDim = int.MaxValue) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_total2(ptr, startDim, endDim, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// + /// + /// Number of channels or number of columns the matrix should have. + /// For a 2-D matrix, when the matrix has only 1 column, then it should have + /// elemChannels channels; When the matrix has only 1 channel, + /// then it should have elemChannels columns. For a 3-D matrix, it should have only one channel. + /// Furthermore, if the number of planes is not one, then the number of rows within every + /// plane has to be 1; if the number of rows within every plane is not 1, + /// then the number of planes has to be 1. + /// The depth the matrix should have. Set it to -1 when any depth is fine. + /// Set it to true to require the matrix to be continuous + /// -1 if the requirement is not satisfied. + /// Otherwise, it returns the number of elements in the matrix. Note that an element may have multiple channels. + public int CheckVector(int elemChannels, int depth = -1, bool requireContinuous = true) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_checkVector( + ptr, elemChannels, depth, requireContinuous ? 1 : 0, out var ret)); + GC.KeepAlive(this); + return ret; + } + +#pragma warning disable CA1720 // Identifiers should not contain type names + + /// + /// Returns a pointer to the specified matrix row. + /// + /// Index along the dimension 0 + /// + public IntPtr Ptr(int i0) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_ptr1d(ptr, i0, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a pointer to the specified matrix element. + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// + public IntPtr Ptr(int i0, int i1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_ptr2d(ptr, i0, i1, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a pointer to the specified matrix element. + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// + public IntPtr Ptr(int i0, int i1, int i2) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_ptr3d(ptr, i0, i1, i2, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a pointer to the specified matrix element. + /// + /// Array of Mat::dims indices. + /// + public IntPtr Ptr(params int[] idx) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_ptrnd(ptr, idx, out var ret)); + GC.KeepAlive(this); + return ret; + } + +#pragma warning restore CA1720 // Identifiers should not contain type names + + /// + /// includes several bit-fields: + /// - the magic signature + /// - continuity flag + /// - depth + /// - number of channels + /// + public int Flags + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_flags(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the array dimensionality, >= 2 + /// + public int Dims + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_dims(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the number of rows or -1 when the array has more than 2 dimensions + /// + public int Rows + { + get + { + NativeMethods.HandleException( + NativeMethods.core_Mat_rows(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the number of rows or -1 when the array has more than 2 dimensions + /// + /// + public int Height => Rows; + + /// + /// the number of columns or -1 when the array has more than 2 dimensions + /// + /// + public int Cols + { + get + { + NativeMethods.HandleException( + NativeMethods.core_Mat_cols(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the number of columns or -1 when the array has more than 2 dimensions + /// + /// + public int Width => Cols; + + /// + /// pointer to the data + /// + public IntPtr Data + { + get + { + unsafe + { + return new IntPtr(DataPointer); + } + } + } + + /// + /// unsafe pointer to the data + /// + public unsafe byte* DataPointer + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_data(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// The pointer that is possible to compute a relative sub-array position in the main container array using locateROI() + /// + public IntPtr DataStart + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_datastart(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// The pointer that is possible to compute a relative sub-array position in the main container array using locateROI() + /// + public IntPtr DataEnd + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_dataend(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// The pointer that is possible to compute a relative sub-array position in the main container array using locateROI() + /// + public IntPtr DataLimit + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_datalimit(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// Returns a matrix size. + /// + /// + public Size Size() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_size(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a matrix size. + /// + /// + /// + public int Size(int dim) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_sizeAt(ptr, dim, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns number of bytes each matrix row occupies. + /// + /// + public long Step() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_step(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Returns number of bytes each matrix row occupies. + /// + /// + /// + public long Step(int i) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_Mat_stepAt(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + #region ToString + + /// + /// Returns a string that represents this Mat. + /// + /// + public override string ToString() + { + if (IsDisposed) + return "Mat [disposed]"; + + return "Mat [ " + + Rows + "*" + Cols + "*" + Type().ToString() + + ", IsContinuous=" + IsContinuous() + ", IsSubmatrix=" + IsSubmatrix() + + ", Ptr=0x" + Convert.ToString(ptr.ToInt64(), 16) + + ", Data=0x" + Convert.ToString(Data.ToInt64(), 16) + + " ]"; + } + + #endregion + + #region Dump + + /// + /// Returns a string that represents each element value of Mat. + /// This method corresponds to std::ostream << Mat + /// + /// + /// + public string Dump(FormatType format = FormatType.Default) + { + ThrowIfDisposed(); + return Cv2.Format(this, format); + } + + #endregion + + #region EmptyClone + + /// + /// Makes a Mat that have the same size, depth and channels as this image + /// + /// + public Mat EmptyClone() + { + ThrowIfDisposed(); + return new Mat(Size(), Type()); + } + + #endregion + + #region Element Indexer + + /// + /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. + /// + /// + /// + public Indexer GetGenericIndexer() where T : struct + { + return new Indexer(this); + } + + /// + /// Gets a type-specific unsafe indexer. The indexer has getters/setters to access each matrix element. + /// + /// + /// + public UnsafeIndexer GetUnsafeGenericIndexer() where T : unmanaged + => new(this); + +#pragma warning disable CA1034 + /// + /// Mat Indexer + /// + /// + public sealed class Indexer : MatIndexer where T : struct + { + private readonly long ptrVal; + + internal Indexer(Mat parent) + : base(parent) + { + ptrVal = parent.Data.ToInt64(); + } + + /// + /// 1-dimensional indexer + /// + /// Index along the dimension 0 + /// A value to the specified array element. + public override T this[int i0] + { + get + { + var p = new IntPtr(ptrVal + (Steps[0] * i0)); + return Marshal.PtrToStructure(p); + } + set + { + var p = new IntPtr(ptrVal + (Steps[0] * i0)); + Marshal.StructureToPtr(value, p, false); + } + } + + /// + /// 2-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// A value to the specified array element. + public override T this[int i0, int i1] + { + get + { + var p = new IntPtr(ptrVal + (Steps[0] * i0) + (Steps[1] * i1)); + return Marshal.PtrToStructure(p); + } + set + { + var p = new IntPtr(ptrVal + (Steps[0] * i0) + (Steps[1] * i1)); + Marshal.StructureToPtr(value, p, false); + } + } + + /// + /// 3-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// A value to the specified array element. + public override T this[int i0, int i1, int i2] + { + get + { + var p = new IntPtr(ptrVal + (Steps[0] * i0) + (Steps[1] * i1) + (Steps[2] * i2)); + return Marshal.PtrToStructure(p); + } + set + { + var p = new IntPtr(ptrVal + (Steps[0] * i0) + (Steps[1] * i1) + (Steps[2] * i2)); + Marshal.StructureToPtr(value, p, false); + } + } + + /// + /// n-dimensional indexer + /// + /// Array of Mat::dims indices. + /// A value to the specified array element. + public override T this[params int[] idx] + { + get + { + long offset = 0; + for (var i = 0; i < idx.Length; i++) + { + offset += Steps[i] * idx[i]; + } + + var p = new IntPtr(ptrVal + offset); + return Marshal.PtrToStructure(p); + } + set + { + long offset = 0; + for (var i = 0; i < idx.Length; i++) + { + offset += Steps[i] * idx[i]; + } + + var p = new IntPtr(ptrVal + offset); + Marshal.StructureToPtr(value, p, false); + } + } + } + +#pragma warning disable CA1034 + /// + /// Mat Indexer + /// + /// + public sealed class UnsafeIndexer : MatIndexer where T : unmanaged + { + private readonly long ptrVal; + + internal UnsafeIndexer(Mat parent) + : base(parent) + { + ptrVal = parent.Data.ToInt64(); + } + + /// + /// 1-dimensional indexer + /// + /// Index along the dimension 0 + /// A value to the specified array element. + public override unsafe T this[int i0] + { + get + { + var p = (T*) (ptrVal + (Steps[0] * i0)); + return *p; + } + set + { + var p = (T*) (ptrVal + (Steps[0] * i0)); + *p = value; + } + } + + /// + /// 2-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// A value to the specified array element. + public override unsafe T this[int i0, int i1] + { + get + { + var p = (T*) (ptrVal + (Steps[0] * i0) + (Steps[1] * i1)); + return *p; + } + set + { + var p = (T*) (ptrVal + (Steps[0] * i0) + (Steps[1] * i1)); + *p = value; + } + } + + /// + /// 3-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// A value to the specified array element. + public override unsafe T this[int i0, int i1, int i2] + { + get + { + var p = (T*) (ptrVal + (Steps[0] * i0) + (Steps[1] * i1) + (Steps[2] * i2)); + return *p; + } + set + { + var p = (T*) (ptrVal + (Steps[0] * i0) + (Steps[1] * i1) + (Steps[2] * i2)); + *p = value; + } + } + + /// + /// n-dimensional indexer + /// + /// Array of Mat::dims indices. + /// A value to the specified array element. + public override unsafe T this[params int[] idx] + { + get + { + long offset = 0; + for (var i = 0; i < idx.Length; i++) + { + offset += Steps[i] * idx[i]; + } + + var p = (T*) (ptrVal + offset); + return *p; + } + set + { + long offset = 0; + for (var i = 0; i < idx.Length; i++) + { + offset += Steps[i] * idx[i]; + } + + var p = (T*) (ptrVal + offset); + *p = value; + } + } + } + + #endregion + + #region Get/Set + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// A value to the specified array element. + public T Get(int i0) where T : struct + { + var p = Ptr(i0); + return Marshal.PtrToStructure(p); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// A value to the specified array element. + public T Get(int i0, int i1) where T : struct + { + var p = Ptr(i0, i1); + return Marshal.PtrToStructure(p); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// A value to the specified array element. + public T Get(int i0, int i1, int i2) where T : struct + { + var p = Ptr(i0, i1, i2); + return Marshal.PtrToStructure(p); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Array of Mat::dims indices. + /// A value to the specified array element. + public T Get(params int[] idx) where T : struct + { + var p = Ptr(idx); + return Marshal.PtrToStructure(p); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// A value to the specified array element. + public unsafe ref T At(int i0) where T : unmanaged + { + var p = Ptr(i0); + return ref Unsafe.AsRef(p.ToPointer()); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// A value to the specified array element. + public unsafe ref T At(int i0, int i1) where T : unmanaged + { + var p = Ptr(i0, i1); + return ref Unsafe.AsRef(p.ToPointer()); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// A value to the specified array element. + public unsafe ref T At(int i0, int i1, int i2) where T : unmanaged + { + var p = Ptr(i0, i1, i2); + return ref Unsafe.AsRef(p.ToPointer()); + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Array of Mat::dims indices. + /// A value to the specified array element. + public unsafe ref T At(params int[] idx) where T : unmanaged + { + var p = Ptr(idx); + return ref Unsafe.AsRef(p.ToPointer()); + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// + public void Set(int i0, T value) where T : struct + { + var p = Ptr(i0); + Marshal.StructureToPtr(value, p, false); + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// + public void Set(int i0, int i1, T value) where T : struct + { + var p = Ptr(i0, i1); + Marshal.StructureToPtr(value, p, false); + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// + public void Set(int i0, int i1, int i2, T value) where T : struct + { + var p = Ptr(i0, i1, i2); + Marshal.StructureToPtr(value, p, false); + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Array of Mat::dims indices. + /// + public void Set(int[] idx, T value) where T : struct + { + var p = Ptr(idx); + Marshal.StructureToPtr(value, p, false); + } + + #endregion + + #region Get/SetArray + + private static readonly IReadOnlyDictionary dataDimensionMap = new Dictionary + { + {typeof(byte), 1}, + {typeof(sbyte), 1}, + {typeof(short), 1}, + {typeof(ushort), 1}, + {typeof(int), 1}, + {typeof(float), 1}, + {typeof(double), 1}, + {typeof(Point), 2}, + {typeof(Point2f), 2}, + {typeof(Point2d), 2}, + {typeof(Point3i), 3}, + {typeof(Point3f), 3}, + {typeof(Point3d), 3}, + {typeof(Size), 2}, + {typeof(Size2f), 2}, + {typeof(Size2d), 2}, + {typeof(Rect), 4}, + {typeof(Rect2f), 4}, + {typeof(Rect2d), 4}, + //{typeof(DMatch), 4}, + {typeof(Vec2b), 2}, + {typeof(Vec2s), 2}, + {typeof(Vec2w), 2}, + {typeof(Vec2i), 2}, + {typeof(Vec2f), 2}, + {typeof(Vec2d), 2}, + {typeof(Vec3b), 3}, + {typeof(Vec3s), 3}, + {typeof(Vec3w), 3}, + {typeof(Vec3i), 3}, + {typeof(Vec3f), 3}, + {typeof(Vec3d), 3}, + {typeof(Vec4b), 4}, + {typeof(Vec4s), 4}, + {typeof(Vec4w), 4}, + {typeof(Vec4i), 4}, + {typeof(Vec4f), 4}, + {typeof(Vec4d), 4}, + {typeof(Vec6b), 6}, + {typeof(Vec6s), 6}, + {typeof(Vec6w), 6}, + {typeof(Vec6i), 6}, + {typeof(Vec6f), 6}, + {typeof(Vec6d), 6}, + }; + + private static readonly IReadOnlyDictionary acceptableTypesMap = new Dictionary + { + {typeof(byte), [MatType.CV_8SC1, MatType.CV_8UC1] }, + {typeof(sbyte), [MatType.CV_8SC1, MatType.CV_8UC1] }, + {typeof(short), [MatType.CV_16SC1, MatType.CV_16UC1] }, + {typeof(ushort), [MatType.CV_16SC1, MatType.CV_16UC1] }, + {typeof(int), [MatType.CV_32SC1] }, + {typeof(float), [MatType.CV_32FC1] }, + {typeof(double), [MatType.CV_64FC1] }, + {typeof(Point), [MatType.CV_32SC2] }, + {typeof(Point2f), [MatType.CV_32FC2] }, + {typeof(Point2d), [MatType.CV_64FC2] }, + {typeof(Point3i), [MatType.CV_32SC3] }, + {typeof(Point3f), [MatType.CV_32FC3] }, + {typeof(Point3d), [MatType.CV_64FC3] }, + {typeof(Size), [MatType.CV_32SC2] }, + {typeof(Size2f), [MatType.CV_32FC2] }, + {typeof(Size2d), [MatType.CV_64FC2] }, + {typeof(Rect), [MatType.CV_32SC4] }, + {typeof(Rect2f), [MatType.CV_32FC4] }, + {typeof(Rect2d), [MatType.CV_64FC4] }, + //{typeof(DMatch), new[]{MatType.CV_32FC4}}, + {typeof(Vec2b), [MatType.CV_8UC2] }, + {typeof(Vec2s), [MatType.CV_16SC2] }, + {typeof(Vec2w), [MatType.CV_16UC2] }, + {typeof(Vec2i), [MatType.CV_32SC2] }, + {typeof(Vec2f), [MatType.CV_32FC2] }, + {typeof(Vec2d), [MatType.CV_64FC2] }, + {typeof(Vec3b), [MatType.CV_8UC3] }, + {typeof(Vec3s), [MatType.CV_16SC3] }, + {typeof(Vec3w), [MatType.CV_16UC3] }, + {typeof(Vec3i), [MatType.CV_32SC3] }, + {typeof(Vec3f), [MatType.CV_32FC3] }, + {typeof(Vec3d), [MatType.CV_64FC3] }, + {typeof(Vec4b), [MatType.CV_8UC4] }, + {typeof(Vec4s), [MatType.CV_16SC4] }, + {typeof(Vec4w), [MatType.CV_16UC4] }, + {typeof(Vec4i), [MatType.CV_32SC4] }, + {typeof(Vec4f), [MatType.CV_32FC4] }, + {typeof(Vec4d), [MatType.CV_64FC4] }, + {typeof(Vec6b), [MatType.CV_8UC(6)] }, + {typeof(Vec6s), [MatType.CV_16SC(6)] }, + {typeof(Vec6w), [MatType.CV_16UC(6)] }, + {typeof(Vec6i), [MatType.CV_32SC(6)] }, + {typeof(Vec6f), [MatType.CV_32FC(6)] }, + {typeof(Vec6d), [MatType.CV_64FC(6)] }, + }; + + private void CheckArgumentsForConvert(Array data) + where T : unmanaged + { + ThrowIfDisposed(); + + if (data is null) + throw new ArgumentNullException(nameof(data)); + + if (!dataDimensionMap.TryGetValue(typeof(T), out var dataDimension)) + throw new ArgumentException($"Type argument {typeof(T)} is not supported"); + if (!acceptableTypesMap.TryGetValue(typeof(T), out var acceptableTypes)) + throw new ArgumentException($"Type argument {typeof(T)} is not supported"); + + var t = Type(); + if ((data.Length * dataDimension) % t.Channels != 0) + throw new OpenCvSharpException( + $"Provided data element number ({data.Length}) should be multiple of the Mat channels count ({t.Channels})"); + + if (acceptableTypes.Length > 0) + { + var isValidDepth = acceptableTypes.Any(type => type == t); + if (!isValidDepth) + throw new OpenCvSharpException("Mat data type is not compatible: " + t); + } + } + + /// + /// Get the data of this matrix as array + /// + /// Primitive or Vec array to be copied + /// Length of copied bytes + /// + /// using var m1 = new Mat(1, 1, MatType.CV_8UC1); + /// m1.GetArray(out byte[] array); + /// + /// using var m2 = new Mat(1, 1, MatType.CV_32SC1); + /// m2.GetArray(out int[] array); + /// + /// using var m3 = new Mat(1, 1, MatType.CV_8UC(6)); + /// m3.GetArray(out Vec6b[] array); + /// + /// using var m4 = new Mat(1, 1, MatType.CV_64FC4); + /// m4.GetArray(out Vec4d[] array); + /// + [Pure] + public bool GetArray(out T[] data) + where T : unmanaged + { + data = new T[(long)Rows * Cols]; + + CheckArgumentsForConvert(data); + + unsafe + { + fixed (T* pData = data) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_getMatData(ptr, (byte*)pData, out var success)); + GC.KeepAlive(this); + return success != 0; + } + } + } + + /// + /// Get the data of this matrix as array + /// + /// Primitive or Vec array to be copied + /// Length of copied bytes + /// + /// using var m1 = new Mat(1, 1, MatType.CV_8UC1); + /// m1.GetRectangularArray(out byte[,] array); + /// + /// using var m2 = new Mat(1, 1, MatType.CV_32SC1); + /// m2.GetRectangularArray(out int[,] array); + /// + /// using var m3 = new Mat(1, 1, MatType.CV_8UC(6)); + /// m3.GetRectangularArray(out Vec6b[,] array); + /// + /// using var m4 = new Mat(1, 1, MatType.CV_64FC4); + /// m4.GetRectangularArray(out Vec4d[,] array); + /// + [Pure] + public bool GetRectangularArray(out T[,] data) + where T : unmanaged + { + data = new T[Rows, Cols]; + + CheckArgumentsForConvert(data); + + unsafe + { + fixed (T* pData = data) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_getMatData(ptr, (byte*)pData, out var success)); + GC.KeepAlive(this); + return success != 0; + } + } + } + + /// + /// Set the specified array data to this matrix + /// + /// Primitive or Vec array to be copied + /// Length of copied bytes + public bool SetArray(params T[] data) + where T : unmanaged + { + CheckArgumentsForConvert(data); + + unsafe + { + fixed (T* pData = data) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_setMatData(ptr, (byte*)pData, out var success)); + GC.KeepAlive(this); + return success != 0; + } + } + } + + /// + /// Set the specified array data to this matrix + /// + /// Primitive or Vec array to be copied + /// Length of copied bytes + public bool SetRectangularArray(T[,] data) + where T : unmanaged + { + CheckArgumentsForConvert(data); + + unsafe + { + fixed (T* pData = data) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_setMatData(ptr, (byte*)pData, out var success)); + GC.KeepAlive(this); + return success != 0; + } + } + } + + #endregion + + #region To* + + /// + /// Encodes an image into a memory buffer. + /// + /// Encodes an image into a memory buffer. + /// Format-specific parameters. + /// + public byte[] ToBytes(string ext = ".png", int[]? prms = null) + => ImEncode(ext, prms); + + /// + /// Encodes an image into a memory buffer. + /// + /// Encodes an image into a memory buffer. + /// Format-specific parameters. + /// + public byte[] ToBytes(string ext = ".png", params ImageEncodingParam[] prms) + => ImEncode(ext, prms); + + /// + /// Converts Mat to System.IO.MemoryStream + /// + /// + /// + /// + public MemoryStream ToMemoryStream(string ext = ".png", params ImageEncodingParam[] prms) + { + var bytes = ToBytes(ext, prms); + return new MemoryStream(bytes, 0, bytes.Length, writable: false, publiclyVisible: true); + } + + /// + /// Writes image data encoded from this Mat to System.IO.Stream + /// + /// + /// + /// + /// + public void WriteToStream(Stream stream, string ext = ".png", params ImageEncodingParam[] prms) + { + if (stream is null) + throw new ArgumentNullException(nameof(stream)); + var imageBytes = ToBytes(ext, prms); + stream.Write(imageBytes, 0, imageBytes.Length); + } + + #endregion + + /// + /// + /// + /// + /// + public Mat Alignment(int n = 4) + { + var newCols = Cv2.AlignSize(Cols, n); + using var pMat = new Mat(Rows, newCols, Type()); +#pragma warning disable CA2000 + var roiMat = new Mat(pMat, new Rect(0, 0, Cols, Rows)); +#pragma warning restore CA2000 + CopyTo(roiMat); + return roiMat; + } + + /// + /// Creates type-specific Mat instance from this. + /// + /// + /// + public TMat Cast() + where TMat : Mat + { + var type = typeof(TMat); + + var obj = Activator.CreateInstance(type, this); + if (obj is TMat mat) + return mat; + + throw new NotSupportedException($"Failed to convert Mat to {typeof(TMat).Name}"); + } + + #region ForEach + +// ReSharper disable InconsistentNaming + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsByte(MatForeachFunctionByte operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_uchar(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec2b(MatForeachFunctionVec2b operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec2b(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec3b(MatForeachFunctionVec3b operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec3b(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec4b(MatForeachFunctionVec4b operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec4b(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec6b(MatForeachFunctionVec6b operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec6b(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsInt16(MatForeachFunctionInt16 operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_short(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec2s(MatForeachFunctionVec2s operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec2s(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec3s(MatForeachFunctionVec3s operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec3s(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec4s(MatForeachFunctionVec4s operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec4s(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec6s(MatForeachFunctionVec6s operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec6s(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsInt32(MatForeachFunctionInt32 operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_int(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec2i(MatForeachFunctionVec2i operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec2i(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec3i(MatForeachFunctionVec3i operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec3i(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec4i(MatForeachFunctionVec4i operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec4i(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec6i(MatForeachFunctionVec6i operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec6i(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsFloat(MatForeachFunctionFloat operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_float(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec2f(MatForeachFunctionVec2f operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec2f(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec3f(MatForeachFunctionVec3f operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec3f(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec4f(MatForeachFunctionVec4f operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec4f(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec6f(MatForeachFunctionVec6f operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec6f(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsDouble(MatForeachFunctionDouble operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_double(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec2d(MatForeachFunctionVec2d operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec2d(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec3d(MatForeachFunctionVec3d operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec3d(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec4d(MatForeachFunctionVec4d operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec4d(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + + /// + /// Runs the given functor over all matrix elements in parallel. + /// + /// + public void ForEachAsVec6d(MatForeachFunctionVec6d operation) + { + ThrowIfDisposed(); + if (operation is null) + throw new ArgumentNullException(nameof(operation)); + + NativeMethods.HandleException( + NativeMethods.core_Mat_forEach_Vec6d(ptr, operation)); + GC.KeepAlive(this); + GC.KeepAlive(operation); + } + +// ReSharper restore InconsistentNaming + + #endregion + + /// + /// Creates a new span over the Mat. + /// + /// + /// + public unsafe Span AsSpan() where T : unmanaged + => IsContinuous() ? new Span(DataPointer, (int)Total() * ElemSize() / sizeof(T)) : []; + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs b/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs new file mode 100644 index 000000000..ac47bf58e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs @@ -0,0 +1,69 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Abstract definition of Mat indexer +/// +/// +public abstract class MatIndexer where T : struct +{ + /// + /// 1-dimensional indexer + /// + /// Index along the dimension 0 + /// A value to the specified array element. + public abstract T this[int i0] { get; set; } + + /// + /// 2-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// A value to the specified array element. + public abstract T this[int i0, int i1] { get; set; } + + /// + /// 3-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// A value to the specified array element. + public abstract T this[int i0, int i1, int i2] { get; set; } + + /// + /// n-dimensional indexer + /// + /// Array of Mat::dims indices. + /// A value to the specified array element. + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public abstract T this[params int[] idx] { get; set; } + + /// + /// Parent matrix object + /// + protected Mat Parent { get; } + + /// + /// Step byte length for each dimension + /// + protected IReadOnlyList Steps { get; } + + /// + /// Constructor + /// + /// + internal MatIndexer(Mat parent) + { + Parent = parent; + + var dims = parent.Dims; + var steps = new long[dims]; + for (var i = 0; i < dims; i++) + { + steps[i] = parent.Step(i); + } + Steps = steps; + } +} diff --git a/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs b/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs new file mode 100644 index 000000000..3f2e5716e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs @@ -0,0 +1,632 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Type-specific abstract matrix +/// +/// Element Type +public class Mat : Mat + where TElem : unmanaged +{ + #region Init & Disposal + + private static MatType GetMatType() + { + var type = typeof(TElem); + if (TypeMap.TryGetValue(type, out var value)) + return value; + throw new NotSupportedException($"Type parameter {type} is not supported by Mat"); + } + + /// + /// Creates empty Mat + /// + public Mat() + : this(0, 0) + { + } + + /// + /// Creates from native cv::Mat* pointer + /// + /// + internal Mat(IntPtr ptr) + : base(ptr) + { + } + + /// + /// Creates from native cv::Mat* pointer + /// + /// +#pragma warning disable CA1000 // Do not declare static members on generic types + public new static Mat FromNativePointer(IntPtr ptr) +#pragma warning restore CA1000 + => new(ptr); + + /// + /// Initializes by Mat object + /// + /// Managed Mat object + public Mat(Mat mat) + : base(mat) + { + } + + /// + /// constructs 2D matrix of the specified size and type + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + public Mat(int rows, int cols) + : base(rows, cols, GetMatType()) + { + } + + /// + /// constructs 2D matrix of the specified size and type + /// + /// 2D array size: Size(cols, rows) . In the Size() constructor, + /// the number of rows and the number of columns go in the reverse order. + public Mat(Size size) + : base(size, GetMatType()) + { + } + + /// + /// constructs 2D matrix and fills it with the specified Scalar value. + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public Mat(int rows, int cols, Scalar s) + : base(rows, cols, GetMatType(), s) + { + } + + /// + /// constructs 2D matrix and fills it with the specified Scalar value. + /// + /// 2D array size: Size(cols, rows) . In the Size() constructor, + /// the number of rows and the number of columns go in the reverse order. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public Mat(Size size, Scalar s) + : base(size, GetMatType(), s) + { + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat::clone() . + /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. + /// Use Range.All to take all the rows. + /// Range of the m columns to take. Use Range.All to take all the columns. + public Mat(Mat m, Range rowRange, Range? colRange = null) + : base(m, rowRange, colRange) + { + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat.Clone() . + /// Array of selected ranges of m along each dimensionality. + protected Mat(Mat m, params Range[] ranges) + : base(m, ranges) + { + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat.Clone() . + /// Region of interest. + public Mat(Mat m, Rect roi) + : base(m, roi) + { + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . +#pragma warning disable CA1000 + public static Mat FromPixelData(int rows, int cols, IntPtr data, long step = 0) +#pragma warning restore CA1000 + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new8(rows, cols, GetMatType(), data, new IntPtr(step), out var ptr)); + return new Mat(ptr); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . +#pragma warning disable CA1000 + public static Mat FromPixelData(int rows, int cols, Array data, long step = 0) +#pragma warning restore CA1000 + => new (rows, cols, data, step); + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. + /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . + protected Mat(int rows, int cols, Array data, long step = 0) + : base(rows, cols, GetMatType(), data, step) + { + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Array of integers specifying an n-dimensional array shape. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). + /// If not specified, the matrix is assumed to be continuous. +#pragma warning disable CA1000 + public static Mat FromPixelData(IEnumerable sizes, IntPtr data, IEnumerable? steps = null) +#pragma warning restore CA1000 + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + if (data == IntPtr.Zero) + throw new ArgumentNullException(nameof(data)); +#pragma warning disable CA1508 + var sizesArray = sizes as int[] ?? sizes.ToArray(); +#pragma warning restore CA1508 + var type = GetMatType(); + + IntPtr ptr; + if (steps is null) + { + NativeMethods.HandleException( + NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, type, data, IntPtr.Zero, out ptr)); + } + else + { + var stepsArray = steps.Select(s => new IntPtr(s)).ToArray(); + NativeMethods.HandleException( + NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, type, data, stepsArray, out ptr)); + } + return new Mat(ptr); + } + + /// + /// constructor for matrix headers pointing to user-allocated data + /// + /// Array of integers specifying an n-dimensional array shape. + /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. + /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. + /// This operation is very efficient and can be used to process external data using OpenCV functions. + /// The external data is not automatically de-allocated, so you should take care of it. + /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). + /// If not specified, the matrix is assumed to be continuous. + public Mat(IEnumerable sizes, Array data, IEnumerable? steps = null) + : base(sizes, GetMatType(), data, steps) + { + } + + /// + /// constructs n-dimensional matrix + /// + /// Array of integers specifying an n-dimensional array shape. + public Mat(IEnumerable sizes) + : base(sizes, GetMatType()) + { + } + + /// + /// constructs n-dimensional matrix + /// + /// Array of integers specifying an n-dimensional array shape. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public Mat(IEnumerable sizes, Scalar s) + : base(sizes, GetMatType(), s) + { + } + + #endregion + + #region Indexer + + /// + /// Matrix indexer + /// +#pragma warning disable CA1034 // Nested types should not be visible + public sealed unsafe class Indexer : MatIndexer +#pragma warning restore CA1034 + { + private readonly byte* ptr; + + internal Indexer(Mat parent) + : base(parent) + { + ptr = (byte*)parent.Data.ToPointer(); + } + + /// + /// 1-dimensional indexer + /// + /// Index along the dimension 0 + /// A value to the specified array element. + public override TElem this[int i0] + { + get => *(TElem*)(ptr + (Steps[0] * i0)); + set => *(TElem*)(ptr + (Steps[0] * i0)) = value; + } + + /// + /// 2-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// A value to the specified array element. + public override TElem this[int i0, int i1] + { + get => *(TElem*)(ptr + (Steps[0] * i0) + (Steps[1] * i1)); + set => *(TElem*)(ptr + (Steps[0] * i0) + (Steps[1] * i1)) = value; + } + + /// + /// 3-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// A value to the specified array element. + public override TElem this[int i0, int i1, int i2] + { + get => *(TElem*)(ptr + (Steps[0] * i0) + (Steps[1] * i1) + (Steps[2] * i2)); + set => *(TElem*)(ptr + (Steps[0] * i0) + (Steps[1] * i1) + (Steps[2] * i2)) = value; + } + + /// + /// n-dimensional indexer + /// + /// Array of Mat::dims indices. + /// A value to the specified array element. + public override TElem this[params int[] idx] + { + get + { + long offset = 0; + for (var i = 0; i < idx.Length; i++) + { + offset += Steps[i] * idx[i]; + } + return *(TElem*)(ptr + offset); + } + set + { + long offset = 0; + for (var i = 0; i < idx.Length; i++) + { + offset += Steps[i] * idx[i]; + } + *(TElem*)(ptr + offset) = value; + } + } + } + + #endregion + + #region Methods + + /// + /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. + /// + /// +#pragma warning disable CA1024 // Use properties where appropriate + public MatIndexer GetIndexer() +#pragma warning restore CA1024 + { + return new Indexer(this); + } + + /// + /// Gets read-only enumerator + /// + /// + public IEnumerator GetEnumerator() + { + ThrowIfDisposed(); + var indexer = new Indexer(this); + + var dims = Dims; + if (dims == 2) + { + var rows = Rows; + var cols = Cols; + for (var r = 0; r < rows; r++) + { + for (var c = 0; c < cols; c++) + { + yield return indexer[r, c]; + } + } + } + else + { + throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); + } + } + + /// + /// Convert this mat to managed array + /// + /// + public TElem[] ToArray() + { + if (Rows == 0 || Cols == 0) + return []; + + if (!GetArray(out TElem[] array)) + throw new OpenCvSharpException("Failed to copy pixel data into managed array"); + + return array; + } + + /// + /// Convert this mat to managed rectangular array + /// + /// + public TElem[,] ToRectangularArray() + { + if (Rows == 0 || Cols == 0) + return new TElem[0, 0]; + + if (!GetRectangularArray(out TElem[,] array)) + throw new OpenCvSharpException("Failed to copy pixel data into managed array"); + + return array; + } + + #endregion + + #region Mat Methods + /// + /// + /// + /// + /// + protected Mat Wrap(Mat mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + + var ret = new Mat(); + mat.AssignTo(ret); + return ret; + } + + #region Clone + + /// + /// Creates a full copy of the matrix. + /// + /// + public new Mat Clone() + { + ThrowIfDisposed(); + + if (Empty()) + return new Mat(Size()); + + using var result = base.Clone(); + return Wrap(result); + } + + #endregion + #region Reshape + + /// + /// Changes the shape of channels of a 2D matrix without copying the data. + /// + /// New number of rows. If the parameter is 0, the number of rows remains the same. + /// + public Mat Reshape(int rows) + { +#pragma warning disable CA2000 + var result = base.Reshape(0, rows); +#pragma warning restore CA2000 + return Wrap(result); + } + + /// + /// Changes the shape of a 2D matrix without copying the data. + /// + /// New number of rows. If the parameter is 0, the number of rows remains the same. + /// + public Mat Reshape(params int[] newDims) + { +#pragma warning disable CA2000 + var result = base.Reshape(0, newDims); +#pragma warning restore CA2000 + return Wrap(result); + } + + #endregion + #region T + + /// + /// Transposes a matrix. + /// + /// + public new Mat T() + { + using var result = base.T(); + return Wrap(result); + } + + #endregion + + #region SubMat + /// + /// Extracts a rectangular submatrix. + /// + /// Start row of the extracted submatrix. The upper boundary is not included. + /// End row of the extracted submatrix. The upper boundary is not included. + /// Start column of the extracted submatrix. The upper boundary is not included. + /// End column of the extracted submatrix. The upper boundary is not included. + /// + public new Mat SubMat(int rowStart, int rowEnd, int colStart, int colEnd) + { +#pragma warning disable CA2000 + var result = base.SubMat(rowStart, rowEnd, colStart, colEnd); +#pragma warning restore CA2000 + return Wrap(result); + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range.All(). + /// Start and end column of the extracted submatrix. + /// The upper boundary is not included. To select all the columns, use Range.All(). + /// + public new Mat SubMat(Range rowRange, Range colRange) + { + return SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Extracted submatrix specified as a rectangle. + /// + public new Mat SubMat(Rect roi) + { + return SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Array of selected ranges along each array dimension. + /// + public new Mat SubMat(params Range[] ranges) + { +#pragma warning disable CA2000 + var result = base.SubMat(ranges); +#pragma warning restore CA2000 + return Wrap(result); + } + + #endregion + #region Mat Indexers + /// + /// Extracts a rectangular submatrix. + /// + /// Start row of the extracted submatrix. The upper boundary is not included. + /// End row of the extracted submatrix. The upper boundary is not included. + /// Start column of the extracted submatrix. The upper boundary is not included. + /// End column of the extracted submatrix. The upper boundary is not included. + /// + public new Mat this[int rowStart, int rowEnd, int colStart, int colEnd] + { + get + { + var result = base[rowStart, rowEnd, colStart, colEnd]; + return Wrap(result); + } + set => base[rowStart, rowEnd, colStart, colEnd] = value; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range.All(). + /// Start and end column of the extracted submatrix. + /// The upper boundary is not included. To select all the columns, use Range.All(). + /// + public new Mat this[Range rowRange, Range colRange] + { + get + { + var result = base[rowRange, colRange]; + return Wrap(result); + } + set => base[rowRange, colRange] = value; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Extracted submatrix specified as a rectangle. + /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public new Mat this[Rect roi] + { + get + { + var result = base[roi]; + return Wrap(result); + } + set => base[roi] = value; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Array of selected ranges along each array dimension. + /// +#pragma warning disable CA1043 // Use integral or string argument for indexers + public new Mat this[params Range[] ranges] +#pragma warning restore CA1043 + { + get + { + var result = base[ranges]; + return Wrap(result); + } + set => base[ranges] = value; + } + #endregion + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Mat/MatPinning.cs b/src/OpenCvSharp/Modules/core/Mat/MatPinning.cs new file mode 100644 index 000000000..e43ce07fd --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Mat/MatPinning.cs @@ -0,0 +1,70 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +public partial class Mat +{ + private ArrayPinningLifetime? pinLifetime; + + /// + protected override void DisposeManaged() + { + pinLifetime?.Dispose(); + base.DisposeManaged(); + } + + /// + /// Pins an array and unpins it when all references are released. + /// + private class ArrayPinningLifetime : IDisposable + { + private GCHandle handle; + private int refCount; + + /// + /// Creates an instance of the class. + /// + /// The array to be pinned. + public ArrayPinningLifetime(Array array) + { + handle = GCHandle.Alloc(array, GCHandleType.Pinned); + } + + /// + /// Gets the data pointer of the pinned . + /// + /// Thrown when the handle has been deallocated. + public IntPtr DataPtr => handle.IsAllocated ? handle.AddrOfPinnedObject() : throw new ObjectDisposedException(nameof(ArrayPinningLifetime)); + + /// Increments the reference count of the pinned array. + /// Returns a reference to this instance. + public ArrayPinningLifetime Ref() + { + Interlocked.Increment(ref refCount); + return this; + } + + /// + /// Decrements the reference count of the pinned array. If the reference count reaches zero, the array will be + /// unpinned. + /// + public void Dispose() + { + if (Interlocked.Decrement(ref refCount) != 0 || !handle.IsAllocated) + { + return; + } + + handle.Free(); + GC.SuppressFinalize(this); + } + + ~ArrayPinningLifetime() + { + if (handle.IsAllocated) + { + handle.Free(); + } + } + } +} diff --git a/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs b/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs new file mode 100644 index 000000000..642a26ee4 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs @@ -0,0 +1,2313 @@ +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +partial class Mat +{ + #region core + + /// + /// Computes absolute value of each matrix element + /// + /// + public MatExpr Abs() + { + return Cv2.Abs(this); + } + + /// + /// Scales, computes absolute values and converts the result to 8-bit. + /// + /// The optional scale factor. [By default this is 1] + /// The optional delta added to the scaled values. [By default this is 0] + /// + public Mat ConvertScaleAbs(double alpha = 1, double beta = 0) + { + var dst = new Mat(); + Cv2.ConvertScaleAbs(this, dst, alpha, beta); + return dst; + } + + /// + /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) + /// + /// Look-up table of 256 elements. + /// In the case of multi-channel source array, the table should either have + /// a single channel (in this case the same table is used for all channels) + /// or the same number of channels as in the source array + /// + public Mat LUT(InputArray lut) + { + var dst = new Mat(); + Cv2.LUT(this, lut, dst); + return dst; + } + + /// + /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) + /// + /// Look-up table of 256 elements. + /// In the case of multi-channel source array, the table should either have + /// a single channel (in this case the same table is used for all channels) + /// or the same number of channels as in the source array + /// + public Mat LUT(byte[] lut) + { + var dst = new Mat(); + Cv2.LUT(this, lut, dst); + return dst; + } + + /// + /// computes sum of array elements + /// + /// + public Scalar Sum() + { + return Cv2.Sum(this); + } + + /// + /// computes the number of nonzero array elements + /// + /// number of non-zero elements in mtx + public int CountNonZero() + { + return Cv2.CountNonZero(this); + } + + /// + /// returns the list of locations of non-zero pixels + /// + /// + public Mat FindNonZero() + { + var idx = new Mat(); + Cv2.FindNonZero(this, idx); + return idx; + } + + /// + /// computes mean value of selected array elements + /// + /// The optional operation mask + /// + public Scalar Mean(InputArray? mask = null) + { + return Cv2.Mean(this, mask); + } + + /// + /// computes mean value and standard deviation of all or selected array elements + /// + /// The output parameter: computed mean value + /// The output parameter: computed standard deviation + /// The optional operation mask + public void MeanStdDev(OutputArray mean, OutputArray stddev, InputArray? mask = null) + { + Cv2.MeanStdDev(this, mean, stddev, mask); + } + + /// + /// computes norm of the selected array part + /// + /// Type of the norm + /// The optional operation mask + /// + public double Norm(NormTypes normType = NormTypes.L2, InputArray? mask = null) + { + return Cv2.Norm(this, normType, mask); + } + + /// + /// scales and shifts array elements so that either the specified norm (alpha) + /// or the minimum (alpha) and maximum (beta) array values get the specified values + /// + /// The norm value to normalize to or the lower range boundary + /// in the case of range normalization + /// The upper range boundary in the case of range normalization; + /// not used for norm normalization + /// The normalization type + /// When the parameter is negative, + /// the destination array will have the same type as src, + /// otherwise it will have the same number of channels as src and the depth =CV_MAT_DEPTH(rtype) + /// The optional operation mask + /// + public Mat Normalize(double alpha = 1, double beta = 0, + NormTypes normType = NormTypes.L2, int dtype = -1, InputArray? mask = null) + { + var dst = new Mat(); + Cv2.Normalize(this, dst, alpha, beta, normType, dtype, mask); + return dst; + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// Pointer to returned minimum value + /// Pointer to returned maximum value + public void MinMaxLoc(out double minVal, out double maxVal) + { + Cv2.MinMaxLoc(this, out minVal, out maxVal); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// Pointer to returned minimum location + /// Pointer to returned maximum location + public void MinMaxLoc(out Point minLoc, out Point maxLoc) + { + Cv2.MinMaxLoc(this, out minLoc, out maxLoc); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// Pointer to returned minimum value + /// Pointer to returned maximum value + /// Pointer to returned minimum location + /// Pointer to returned maximum location + /// The optional mask used to select a sub-array + public void MinMaxLoc(out double minVal, out double maxVal, + out Point minLoc, out Point maxLoc, InputArray? mask = null) + { + Cv2.MinMaxLoc(this, out minVal, out maxVal, out minLoc, out maxLoc, mask); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// Pointer to returned minimum value + /// Pointer to returned maximum value + public void MinMaxIdx(out double minVal, out double maxVal) + { + Cv2.MinMaxIdx(this, out minVal, out maxVal); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// + /// + public void MinMaxIdx(int[] minIdx, int[] maxIdx) + { + Cv2.MinMaxIdx(this, minIdx, maxIdx); + } + + /// + /// finds global minimum and maximum array elements and returns their values and their locations + /// + /// Pointer to returned minimum value + /// Pointer to returned maximum value + /// + /// + /// + public void MinMaxIdx(out double minVal, out double maxVal, + int[] minIdx, int[] maxIdx, InputArray? mask = null) + { + Cv2.MinMaxIdx(this, out minVal, out maxVal, minIdx, maxIdx, mask); + } + + /// + /// transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows + /// + /// The dimension index along which the matrix is reduced. + /// 0 means that the matrix is reduced to a single row and 1 means that the matrix is reduced to a single column + /// + /// When it is negative, the destination vector will have + /// the same type as the source matrix, otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels()) + /// + public Mat Reduce(ReduceDimension dim, ReduceTypes rtype, int dtype) + { + var dst = new Mat(); + Cv2.Reduce(this, dst, dim, rtype, dtype); + return dst; + } + + /// + /// Copies each plane of a multi-channel array to a dedicated array + /// + /// The number of arrays must match mtx.channels() . + /// The arrays themselves will be reallocated if needed + public Mat[] Split() + { + return Cv2.Split(this); + } + + /// + /// extracts a single channel from src (coi is 0-based index) + /// + /// + /// + public Mat ExtractChannel(int coi) + { + var dst = new Mat(); + Cv2.ExtractChannel(this, dst, coi); + return dst; + } + + /// + /// inserts a single channel to dst (coi is 0-based index) + /// + /// + /// + public void InsertChannel(InputOutputArray dst, int coi) + { + Cv2.InsertChannel(this, dst, coi); + } + + /// + /// reverses the order of the rows, columns or both in a matrix + /// + /// Specifies how to flip the array: + /// 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, + /// and negative (e.g., -1) means flipping around both axes. See also the discussion below for the formulas. + /// The destination array; will have the same size and same type as src + public Mat Flip(FlipMode flipCode) + { + var dst = new Mat(); + Cv2.Flip(this, dst, flipCode); + return dst; + } + + /// + /// replicates the input matrix the specified number of times in the horizontal and/or vertical direction + /// + /// How many times the src is repeated along the vertical axis + /// How many times the src is repeated along the horizontal axis + /// + public Mat Repeat(int ny, int nx) + { + var dst = new Mat(); + Cv2.Repeat(this, ny, nx, dst); + return dst; + } + + /// + /// Checks if array elements lie between the elements of two other arrays. + /// + /// inclusive lower boundary array or a scalar. + /// inclusive upper boundary array or a scalar. + /// The destination array, will have the same size as src and CV_8U type + public Mat InRange(InputArray lowerb, InputArray upperb) + { + var dst = new Mat(); + Cv2.InRange(this, lowerb, upperb, dst); + return dst; + } + + + /// + /// Checks if array elements lie between the elements of two other arrays. + /// + /// inclusive lower boundary array or a scalar. + /// inclusive upper boundary array or a scalar. + /// The destination array, will have the same size as src and CV_8U type + public Mat InRange(Scalar lowerb, Scalar upperb) + { + var dst = new Mat(); + Cv2.InRange(this, lowerb, upperb, dst); + return dst; + } + + /// + /// computes square root of each matrix element (dst = src**0.5) + /// + /// The destination array; will have the same size and the same type as src + public Mat Sqrt() + { + var dst = new Mat(); + Cv2.Sqrt(this, dst); + return dst; + } + + /// + /// raises the input matrix elements to the specified power (b = a**power) + /// + /// The exponent of power + /// The destination array; will have the same size and the same type as src + public Mat Pow(double power) + { + var dst = new Mat(); + Cv2.Pow(this, power, dst); + return dst; + } + + /// + /// computes exponent of each matrix element (dst = e**src) + /// + /// The destination array; will have the same size and same type as src + public Mat Exp() + { + var dst = new Mat(); + Cv2.Exp(this, dst); + return dst; + } + + /// + /// computes natural logarithm of absolute value of each matrix element: dst = log(abs(src)) + /// + /// The destination array; will have the same size and same type as src + public Mat Log() + { + var dst = new Mat(); + Cv2.Log(this, dst); + return dst; + } + + /// + /// checks that each matrix element is within the specified range. + /// + /// The flag indicating whether the functions quietly + /// return false when the array elements are out of range, + /// or they throw an exception. + /// + public bool CheckRange(bool quiet = true) + { + return Cv2.CheckRange(this, quiet); + } + + /// + /// checks that each matrix element is within the specified range. + /// + /// The flag indicating whether the functions quietly + /// return false when the array elements are out of range, + /// or they throw an exception. + /// The optional output parameter, where the position of + /// the first outlier is stored. + /// The inclusive lower boundary of valid values range + /// The exclusive upper boundary of valid values range + /// + public bool CheckRange(bool quiet, out Point pos, + double minVal = double.MinValue, double maxVal = double.MaxValue) + { + return Cv2.CheckRange(this, quiet, out pos, minVal, maxVal); + } + + /// + /// converts NaN's to the given number + /// + /// + public void PatchNaNs(double val = 0) + { + Cv2.PatchNaNs(this, val); + } + + /// + /// multiplies matrix by its transposition from the left or from the right + /// + /// Specifies the multiplication ordering; see the description below + /// The optional delta matrix, subtracted from src before the + /// multiplication. When the matrix is empty ( delta=Mat() ), it’s assumed to be + /// zero, i.e. nothing is subtracted, otherwise if it has the same size as src, + /// then it’s simply subtracted, otherwise it is "repeated" to cover the full src + /// and then subtracted. Type of the delta matrix, when it's not empty, must be the + /// same as the type of created destination matrix, see the rtype description + /// The optional scale factor for the matrix product + /// When it’s negative, the destination matrix will have the + /// same type as src . Otherwise, it will have type=CV_MAT_DEPTH(rtype), + /// which should be either CV_32F or CV_64F + public Mat MulTransposed(bool aTa, InputArray? delta = null, double scale = 1, int dtype = -1) + { + var dst = new Mat(); + Cv2.MulTransposed(this, dst, aTa, delta, scale, dtype); + return dst; + } + + /// + /// transposes the matrix + /// + /// The destination array of the same type as src + public Mat Transpose() + { + var dst = new Mat(); + Cv2.Transpose(this, dst); + return dst; + } + + /// + /// performs affine transformation of each element of multi-channel input matrix + /// + /// The transformation matrix + /// The destination array; will have the same size and depth as src and as many channels as mtx.rows + public Mat Transform(InputArray m) + { + var dst = new Mat(); + Cv2.Transform(this, dst, m); + return dst; + } + + /// + /// performs perspective transformation of each element of multi-channel input matrix + /// + /// 3x3 or 4x4 transformation matrix + /// The destination array; it will have the same size and same type as src + public Mat PerspectiveTransform(InputArray m) + { + var dst = new Mat(); + Cv2.PerspectiveTransform(this, dst, m); + return dst; + } + + /// + /// extends the symmetrical matrix from the lower half or from the upper half + /// + /// If true, the lower half is copied to the upper half, + /// otherwise the upper half is copied to the lower half + public void CompleteSymm(bool lowerToUpper = false) + { + Cv2.CompleteSymm(this, lowerToUpper); + } + + /// + /// initializes scaled identity matrix (not necessarily square). + /// + /// The value to assign to the diagonal elements + public void SetIdentity(Scalar? s = null) + { + Cv2.SetIdentity(this, s); + } + + /// + /// computes determinant of a square matrix. + /// The input matrix must have CV_32FC1 or CV_64FC1 type and square size. + /// + /// determinant of the specified matrix. + public double Determinant() + { + return Cv2.Determinant(this); + } + + /// + /// computes trace of a matrix + /// + /// + public Scalar Trace() + { + return Cv2.Trace(this); + } + + /// + /// sorts independently each matrix row or each matrix column + /// + /// The operation flags, a combination of the SortFlag values + /// The destination array of the same size and the same type as src + public Mat Sort(SortFlags flags) + { + var dst = new Mat(); + Cv2.Sort(this, dst, flags); + return dst; + } + + /// + /// sorts independently each matrix row or each matrix column + /// + /// The operation flags, a combination of SortFlag values + /// The destination integer array of the same size as src + public Mat SortIdx(SortFlags flags) + { + var dst = new Mat(); + Cv2.SortIdx(this, dst, flags); + return dst; + } + + /// + /// Performs a forward Discrete Fourier transform of 1D or 2D floating-point array. + /// + /// Transformation flags, a combination of the DftFlag2 values + /// When the parameter != 0, the function assumes that + /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) + /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, + /// thus the function can handle the rest of the rows more efficiently and + /// thus save some time. This technique is very useful for computing array cross-correlation + /// or convolution using DFT + /// The destination array, which size and type depends on the flags + public Mat Dft(DftFlags flags = 0, int nonzeroRows = 0) + { + var dst = new Mat(); + Cv2.Dft(this, dst, flags, nonzeroRows); + return dst; + } + + /// + /// Performs an inverse Discrete Fourier transform of 1D or 2D floating-point array. + /// + /// Transformation flags, a combination of the DftFlag2 values + /// When the parameter != 0, the function assumes that + /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) + /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, + /// thus the function can handle the rest of the rows more efficiently and + /// thus save some time. This technique is very useful for computing array cross-correlation + /// or convolution using DFT + /// The destination array, which size and type depends on the flags + public Mat Idft(DftFlags flags = 0, int nonzeroRows = 0) + { + var dst = new Mat(); + Cv2.Idft(this, dst, flags, nonzeroRows); + return dst; + } + + /// + /// performs forward or inverse 1D or 2D Discrete Cosine Transformation + /// + /// Transformation flags, a combination of DctFlag2 values + /// The destination array; will have the same size and same type as src + public Mat Dct(DctFlags flags = 0) + { + var dst = new Mat(); + Cv2.Dct(this, dst, flags); + return dst; + } + + /// + /// performs inverse 1D or 2D Discrete Cosine Transformation + /// + /// Transformation flags, a combination of DctFlag2 values + /// The destination array; will have the same size and same type as src + public Mat Idct(DctFlags flags = 0) + { + var dst = new Mat(); + Cv2.Idct(this, dst, flags); + return dst; + } + + /// + /// fills array with uniformly-distributed random numbers from the range [low, high) + /// + /// The inclusive lower boundary of the generated random numbers + /// The exclusive upper boundary of the generated random numbers + public void Randu(InputArray low, InputArray high) + { + Cv2.Randu(this, low, high); + } + + /// + /// fills array with uniformly-distributed random numbers from the range [low, high) + /// + /// The inclusive lower boundary of the generated random numbers + /// The exclusive upper boundary of the generated random numbers + public void Randu(Scalar low, Scalar high) + { + Cv2.Randu(this, low, high); + } + + /// + /// fills array with normally-distributed random numbers with the specified mean and the standard deviation + /// + /// The mean value (expectation) of the generated random numbers + /// The standard deviation of the generated random numbers + public void Randn(InputArray mean, InputArray stddev) + { + Cv2.Randn(this, mean, stddev); + } + + /// + /// fills array with normally-distributed random numbers with the specified mean and the standard deviation + /// + /// The mean value (expectation) of the generated random numbers + /// The standard deviation of the generated random numbers + public void Randn(Scalar mean, Scalar stddev) + { + Cv2.Randn(this, mean, stddev); + } + + /// + /// shuffles the input array elements + /// + /// The scale factor that determines the number of random swap operations. + /// The input/output numerical 1D array + public void RandShuffle(double iterFactor) + { + Cv2.RandShuffle(this, iterFactor); + } + + /// + /// shuffles the input array elements + /// + /// The scale factor that determines the number of random swap operations. + /// The optional random number generator used for shuffling. + /// If it is null, theRng() is used instead. + /// The input/output numerical 1D array + public void RandShuffle(double iterFactor, ref RNG rng) + { + Cv2.RandShuffle(this, iterFactor, ref rng); + } + + #region Drawing + + #region Line + + /// + /// Draws a line segment connecting two points + /// + /// First point's x-coordinate of the line segment. + /// First point's y-coordinate of the line segment. + /// Second point's x-coordinate of the line segment. + /// Second point's y-coordinate of the line segment. + /// Line color. + /// Line thickness. [By default this is 1] + /// Type of the line. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public void Line(int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Line(this, pt1X, pt1Y, pt2X, pt2Y, color, thickness, lineType, shift); + } + + /// + /// Draws a line segment connecting two points + /// + /// First point of the line segment. + /// Second point of the line segment. + /// Line color. + /// Line thickness. [By default this is 1] + /// Type of the line. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public void Line( + Point pt1, Point pt2, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Line(this, pt1, pt2, color, thickness, lineType, shift); + } + + #endregion + + #region Rectangle + + /// + /// Draws simple, thick or filled rectangle + /// + /// One of the rectangle vertices. + /// Opposite rectangle vertex. + /// Line color (RGB) or brightness (grayscale image). + /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] + /// Type of the line, see cvLine description. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public void Rectangle( + Point pt1, Point pt2, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Rectangle(this, pt1, pt2, color, thickness, lineType, shift); + } + + /// + /// Draws simple, thick or filled rectangle + /// + /// Rectangle. + /// Line color (RGB) or brightness (grayscale image). + /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] + /// Type of the line, see cvLine description. [By default this is LineType.Link8] + /// Number of fractional bits in the point coordinates. [By default this is 0] + public void Rectangle( + Rect rect, Scalar color, int thickness = 1, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Rectangle(this, rect, color, thickness, lineType, shift); + } + + #endregion + + #region Circle + + /// + /// Draws a circle + /// + /// X-coordinate of the center of the circle. + /// Y-coordinate of the center of the circle. + /// Radius of the circle. + /// Circle color. + /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] + /// Type of the circle boundary. [By default this is LineType.Link8] + /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] + public void Circle(int centerX, int centerY, int radius, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Circle(this, centerX, centerY, radius, color, thickness, lineType, shift); + } + + /// + /// Draws a circle + /// + /// Center of the circle. + /// Radius of the circle. + /// Circle color. + /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] + /// Type of the circle boundary. [By default this is LineType.Link8] + /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] + public void Circle(Point center, int radius, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Circle(this, center, radius, color, thickness, lineType, shift); + } + + #endregion + + #region Ellipse + + /// + /// Draws simple or thick elliptic arc or fills ellipse sector + /// + /// Center of the ellipse. + /// Length of the ellipse axes. + /// Rotation angle. + /// Starting angle of the elliptic arc. + /// Ending angle of the elliptic arc. + /// Ellipse color. + /// Thickness of the ellipse arc. [By default this is 1] + /// Type of the ellipse boundary. [By default this is LineType.Link8] + /// Number of fractional bits in the center coordinates and axes' values. [By default this is 0] + public void Ellipse( + Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Ellipse(this, center, axes, angle, startAngle, endAngle, color, thickness, lineType, shift); + } + + /// + /// Draws simple or thick elliptic arc or fills ellipse sector + /// + /// The enclosing box of the ellipse drawn + /// Ellipse color. + /// Thickness of the ellipse boundary. [By default this is 1] + /// Type of the ellipse boundary. [By default this is LineType.Link8] + public void Ellipse(RotatedRect box, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8) + { + Cv2.Ellipse(this, box, color, thickness, lineType); + } + + #endregion + + /// + /// Draws a marker on a predefined position in an image. + /// + /// The function cv::drawMarker draws a marker on a given position in the image.For the moment several + /// marker types are supported, see #MarkerTypes for more information. + /// + /// The point where the crosshair is positioned. + /// Line color. + /// The specific type of marker you want to use. + /// The length of the marker axis [default = 20 pixels] + /// Line thickness. + /// Type of the line. + public void DrawMarker( + Point position, Scalar color, + MarkerTypes markerType = MarkerTypes.Cross, int markerSize = 20, int thickness = 1, LineTypes lineType = LineTypes.Link8) + { + Cv2.DrawMarker(this, position, color, markerType, markerSize, thickness, lineType); + } + + #region FillConvexPoly + + /// + /// Fills a convex polygon. + /// + /// The polygon vertices + /// Polygon color + /// Type of the polygon boundaries + /// The number of fractional bits in the vertex coordinates + public void FillConvexPoly(IEnumerable pts, Scalar color, + LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.FillConvexPoly(this, pts, color, lineType, shift); + } + + #endregion + + #region FillPoly + + /// + /// Fills the area bounded by one or more polygons + /// + /// Array of polygons, each represented as an array of points + /// Polygon color + /// Type of the polygon boundaries + /// The number of fractional bits in the vertex coordinates + /// + public void FillPoly(IEnumerable> pts, Scalar color, + LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) + { + Cv2.FillPoly(this, pts, color, lineType, shift, offset); + } + + #endregion + + #region Polylines + + /// + /// draws one or more polygonal curves + /// + /// + /// + /// + /// + /// + /// + public void Polylines(IEnumerable> pts, bool isClosed, Scalar color, + int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) + { + Cv2.Polylines(this, pts, isClosed, color, thickness, lineType, shift); + } + + #endregion + + #region PutText + + /// + /// renders text string in the image + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void PutText(string text, Point org, + HersheyFonts fontFace, double fontScale, Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + bool bottomLeftOrigin = false) + { + Cv2.PutText(this, text, org, fontFace, fontScale, color, thickness, lineType, bottomLeftOrigin); + } + + #endregion + + #region ImEncode / ToBytes + + /// + /// Encodes an image into a memory buffer. + /// + /// Encodes an image into a memory buffer. + /// Format-specific parameters. + /// + public byte[] ImEncode(string ext = ".png", int[]? prms = null) + { + ThrowIfDisposed(); + Cv2.ImEncode(ext, this, out var buf, prms); + return buf; + } + + /// + /// Encodes an image into a memory buffer. + /// + /// Encodes an image into a memory buffer. + /// Format-specific parameters. + /// + public byte[] ImEncode(string ext = ".png", params ImageEncodingParam[] prms) + { + ThrowIfDisposed(); + Cv2.ImEncode(ext, this, out var buf, prms); + return buf; + } + + #endregion + + #region ImWrite / SaveImage + + /// + /// Saves an image to a specified file. + /// + /// + /// + /// + public bool ImWrite(string fileName, int[]? prms = null) + { + return Cv2.ImWrite(fileName, this, prms); + } + + /// + /// Saves an image to a specified file. + /// + /// + /// + /// + public bool ImWrite(string fileName, params ImageEncodingParam[] prms) + { + return Cv2.ImWrite(fileName, this, prms); + } + + /// + /// Saves an image to a specified file. + /// + /// + /// + /// + public bool SaveImage(string fileName, int[]? prms = null) + { + return Cv2.ImWrite(fileName, this, prms); + } + + /// + /// Saves an image to a specified file. + /// + /// + /// + /// + public bool SaveImage(string fileName, params ImageEncodingParam[] prms) + { + return Cv2.ImWrite(fileName, this, prms); + } + + #endregion + + #endregion + + #endregion + + #region imgproc + + /// + /// Forms a border around the image + /// + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate + /// The border type + /// The border value if borderType == Constant + public Mat CopyMakeBorder(int top, int bottom, int left, int right, BorderTypes borderType, Scalar? value = null) + { + var dst = new Mat(); + Cv2.CopyMakeBorder(this, dst, top, bottom, left, right, borderType, value); + return dst; + } + + /// + /// Smoothes image using median filter. + /// The source image must have 1-, 3- or 4-channel and + /// its depth should be CV_8U , CV_16U or CV_32F. + /// + /// The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ... + /// The destination array; will have the same size and the same type as src. + public Mat MedianBlur(int ksize) + { + var dst = new Mat(); + Cv2.MedianBlur(this, dst, ksize); + return dst; + } + + /// + /// Blurs an image using a Gaussian filter. + /// The input image can have any number of channels, which are processed independently, + /// but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. + /// + /// Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. + /// Or, they can be zero’s and then they are computed from sigma* . + /// Gaussian kernel standard deviation in X direction. + /// Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, + /// if both sigmas are zeros, they are computed from ksize.width and ksize.height, + /// respectively (see getGaussianKernel() for details); to fully control the result + /// regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY. + /// pixel extrapolation method + public Mat GaussianBlur(Size ksize, double sigmaX, + double sigmaY = 0, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.GaussianBlur(this, dst, ksize, sigmaX, sigmaY, borderType); + return dst; + } + + /// + /// Applies bilateral filter to the image + /// The source image must be a 8-bit or floating-point, 1-channel or 3-channel image. + /// + /// The diameter of each pixel neighborhood, that is used during filtering. + /// If it is non-positive, it's computed from sigmaSpace + /// Filter sigma in the color space. + /// Larger value of the parameter means that farther colors within the pixel neighborhood + /// will be mixed together, resulting in larger areas of semi-equal color + /// Filter sigma in the coordinate space. + /// Larger value of the parameter means that farther pixels will influence each other + /// (as long as their colors are close enough; see sigmaColor). Then d>0 , it specifies + /// the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace + /// + /// The destination image; will have the same size and the same type as src + public Mat BilateralFilter(int d, double sigmaColor, double sigmaSpace, + BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.BilateralFilter(this, dst, d, sigmaColor, sigmaSpace, borderType); + return dst; + } + + /// + /// Smoothes image using box filter + /// + /// + /// The smoothing kernel size + /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center + /// Indicates, whether the kernel is normalized by its area or not + /// The border mode used to extrapolate pixels outside of the image + /// The destination image; will have the same size and the same type as src + public Mat BoxFilter(MatType ddepth, Size ksize, Point? anchor = null, + bool normalize = true, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.BoxFilter(this, dst, ddepth, ksize, anchor, normalize, borderType); + return dst; + } + + /// + /// Smoothes image using normalized box filter + /// + /// The smoothing kernel size + /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center + /// The border mode used to extrapolate pixels outside of the image + /// The destination image; will have the same size and the same type as src + public Mat Blur(Size ksize, Point? anchor = null, + BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.Blur(this, dst, ksize, anchor, borderType); + return dst; + } + + /// + /// Convolves an image with the kernel + /// + /// The desired depth of the destination image. If it is negative, it will be the same as src.depth() + /// Convolution kernel (or rather a correlation kernel), + /// a single-channel floating point matrix. If you want to apply different kernels to + /// different channels, split the image into separate color planes using split() and process them individually + /// The anchor of the kernel that indicates the relative position of + /// a filtered point within the kernel. The anchor should lie within the kernel. + /// The special default value (-1,-1) means that the anchor is at the kernel center + /// The optional value added to the filtered pixels before storing them in dst + /// The pixel extrapolation method + /// The destination image. It will have the same size and the same number of channels as src + public Mat Filter2D(MatType ddepth, InputArray kernel, Point? anchor = null, + double delta = 0, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.Filter2D(this, dst, ddepth, kernel, anchor, delta, borderType); + return dst; + } + + /// + /// Applies separable linear filter to an image + /// + /// The destination image depth + /// The coefficients for filtering each row + /// The coefficients for filtering each column + /// The anchor position within the kernel; The default value (-1, 1) means that the anchor is at the kernel center + /// The value added to the filtered results before storing them + /// The pixel extrapolation method + /// The destination image; will have the same size and the same number of channels as src + public Mat SepFilter2D(MatType ddepth, InputArray kernelX, InputArray kernelY, + Point? anchor = null, double delta = 0, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.SepFilter2D(this, dst, ddepth, kernelX, kernelY, anchor, delta, borderType); + return dst; + } + + /// + /// Calculates the first, second, third or mixed image derivatives using an extended Sobel operator + /// + /// The destination image depth + /// Order of the derivative x + /// Order of the derivative y + /// Size of the extended Sobel kernel, must be 1, 3, 5 or 7 + /// The optional scale factor for the computed derivative values (by default, no scaling is applied + /// The optional delta value, added to the results prior to storing them in dst + /// The pixel extrapolation method + /// The destination image; will have the same size and the same number of channels as src + public Mat Sobel(MatType ddepth, int xorder, int yorder, + int ksize = 3, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.Sobel(this, dst, ddepth, xorder, yorder, ksize, scale, delta, borderType); + return dst; + } + + /// + /// Calculates the first x- or y- image derivative using Scharr operator + /// + /// The destination image depth + /// Order of the derivative x + /// Order of the derivative y + /// The optional scale factor for the computed derivative values (by default, no scaling is applie + /// The optional delta value, added to the results prior to storing them in dst + /// The pixel extrapolation method + /// The destination image; will have the same size and the same number of channels as src + public Mat Scharr(MatType ddepth, int xorder, int yorder, + double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.Scharr(this, dst, ddepth, xorder, yorder, scale, delta, borderType); + return dst; + } + + /// + /// Calculates the Laplacian of an image + /// + /// The desired depth of the destination image + /// The aperture size used to compute the second-derivative filters + /// The optional scale factor for the computed Laplacian values (by default, no scaling is applied + /// The optional delta value, added to the results prior to storing them in dst + /// The pixel extrapolation method + /// Destination image; will have the same size and the same number of channels as src + public Mat Laplacian(MatType ddepth, + int ksize = 1, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.Laplacian(this, dst, ddepth, ksize, scale, delta, borderType); + return dst; + } + + /// + /// Finds edges in an image using Canny algorithm. + /// + /// The first threshold for the hysteresis procedure + /// The second threshold for the hysteresis procedure + /// Aperture size for the Sobel operator [By default this is ApertureSize.Size3] + /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] + /// The output edge map. It will have the same size and the same type as image + // ReSharper disable once InconsistentNaming + public Mat Canny(double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false) + { + var dst = new Mat(); + Cv2.Canny(this, dst, threshold1, threshold2, apertureSize, L2gradient); + return dst; + } + + /// + /// computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix. + /// + /// + /// + /// + public Mat CornerEigenValsAndVecs(int blockSize, int ksize, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.CornerEigenValsAndVecs(this, dst, blockSize, ksize, borderType); + return dst; + } + + /// + /// computes another complex cornerness criteria at each pixel + /// + /// + /// + public Mat PreCornerDetect(int ksize, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.PreCornerDetect(this, dst, ksize, borderType); + return dst; + } + + /// + /// adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria + /// + /// Initial coordinates of the input corners and refined coordinates provided for output. + /// Half of the side length of the search window. + /// Half of the size of the dead region in the middle of the search zone + /// over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities + /// of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size. + /// Criteria for termination of the iterative process of corner refinement. + /// That is, the process of corner position refinement stops either after criteria.maxCount iterations + /// or when the corner position moves by less than criteria.epsilon on some iteration. + /// + public Point2f[] CornerSubPix(IEnumerable inputCorners, + Size winSize, Size zeroZone, TermCriteria criteria) + { + return Cv2.CornerSubPix(this, inputCorners, winSize, zeroZone, criteria); + } + + /// + /// Finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima. + /// Input matrix must be 8-bit or floating-point 32-bit, single-channel image. + /// + /// Maximum number of corners to return. If there are more corners than are found, + /// the strongest of them is returned. + /// Parameter characterizing the minimal accepted quality of image corners. + /// The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue + /// or the Harris function response (see cornerHarris() ). The corners with the quality measure less than + /// the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01, + /// then all the corners with the quality measure less than 15 are rejected. + /// Minimum possible Euclidean distance between the returned corners. + /// Optional region of interest. If the image is not empty + /// (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region + /// in which the corners are detected. + /// Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. + /// Parameter indicating whether to use a Harris detector + /// Free parameter of the Harris detector. + /// Output vector of detected corners. + public Point2f[] GoodFeaturesToTrack( + int maxCorners, double qualityLevel, double minDistance, + InputArray mask, int blockSize, bool useHarrisDetector, double k) + { + return Cv2.GoodFeaturesToTrack(this, maxCorners, qualityLevel, + minDistance, mask, blockSize, useHarrisDetector, k); + } + + /// + /// Finds lines in a binary image using standard Hough transform. + /// The input matrix must be 8-bit, single-channel, binary source image. + /// This image may be modified by the function. + /// + /// Distance resolution of the accumulator in pixels + /// Angle resolution of the accumulator in radians + /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) + /// For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0] + /// For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0] + /// The output vector of lines. Each line is represented by a two-element vector (rho, theta) . + /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians + public LineSegmentPolar[] HoughLines(double rho, double theta, int threshold, + double srn = 0, double stn = 0) + { + return Cv2.HoughLines(this, rho, theta, threshold, srn, stn); + } + + /// + /// Finds lines segments in a binary image using probabilistic Hough transform. + /// + /// Distance resolution of the accumulator in pixels + /// Angle resolution of the accumulator in radians + /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) + /// The minimum line length. Line segments shorter than that will be rejected. [By default this is 0] + /// The maximum allowed gap between points on the same line to link them. [By default this is 0] + /// The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2) + public LineSegmentPoint[] HoughLinesP(double rho, double theta, int threshold, + double minLineLength = 0, double maxLineGap = 0) + { + return Cv2.HoughLinesP(this, rho, theta, threshold, minLineLength, maxLineGap); + } + + /// + /// Finds circles in a grayscale image using a Hough transform. + /// The input matrix must be 8-bit, single-channel and grayscale. + /// + /// The available methods are HoughMethods.Gradient and HoughMethods.GradientAlt + /// The inverse ratio of the accumulator resolution to the image resolution. + /// Minimum distance between the centers of the detected circles. + /// The first method-specific parameter. [By default this is 100] + /// The second method-specific parameter. [By default this is 100] + /// Minimum circle radius. [By default this is 0] + /// Maximum circle radius. [By default this is 0] + /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) + public CircleSegment[] HoughCircles(HoughModes method, double dp, double minDist, + double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) + { + return Cv2.HoughCircles(this, method, dp, minDist, param1, param2, minRadius, maxRadius); + } + + /// + /// Dilates an image by using a specific structuring element. + /// + /// The structuring element used for dilation. If element=new Mat() , a 3x3 rectangular structuring element is used + /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center + /// The number of times dilation is applied. [By default this is 1] + /// The pixel extrapolation method. [By default this is BorderTypes.Constant] + /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] + /// The destination image. It will have the same size and the same type as src + public Mat Dilate(InputArray? element, Point? anchor = null, int iterations = 1, + BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) + { + var dst = new Mat(); + Cv2.Dilate(this, dst, element, anchor, iterations, borderType, borderValue); + return dst; + } + + /// + /// Erodes an image by using a specific structuring element. + /// + /// The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used + /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center + /// The number of times erosion is applied + /// The pixel extrapolation method + /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] + /// The destination image. It will have the same size and the same type as src + public Mat Erode(InputArray? element, Point? anchor = null, int iterations = 1, + BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) + { + var dst = new Mat(); + Cv2.Erode(this, dst, element, anchor, iterations, borderType, borderValue); + return dst; + } + + /// + /// Performs advanced morphological transformations + /// + /// Type of morphological operation + /// Structuring element + /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center + /// Number of times erosion and dilation are applied. [By default this is 1] + /// The pixel extrapolation method. [By default this is BorderTypes.Constant] + /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] + /// Destination image. It will have the same size and the same type as src + public Mat MorphologyEx( + MorphTypes op, InputArray? element, + Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, + Scalar? borderValue = null) + { + var dst = new Mat(); + Cv2.MorphologyEx(this, dst, op, element, anchor, iterations, borderType, borderValue); + return dst; + } + + /// + /// Resizes an image. + /// + /// output image size; if it equals zero, it is computed as: + /// dsize = Size(round(fx*src.cols), round(fy*src.rows)) + /// Either dsize or both fx and fy must be non-zero. + /// scale factor along the horizontal axis; when it equals 0, + /// it is computed as: (double)dsize.width/src.cols + /// scale factor along the vertical axis; when it equals 0, + /// it is computed as: (double)dsize.height/src.rows + /// interpolation method + /// output image; it has the size dsize (when it is non-zero) or the size computed + /// from src.size(), fx, and fy; the type of dst is the same as of src. + public Mat Resize(Size dsize, double fx = 0, double fy = 0, + InterpolationFlags interpolation = InterpolationFlags.Linear) + { + var dst = new Mat(); + Cv2.Resize(this, dst, dsize, fx, fy, interpolation); + return dst; + } + + /// + /// Applies an affine transformation to an image. + /// + /// output image that has the size dsize and the same type as src. + /// 2x3 transformation matrix. + /// size of the output image. + /// combination of interpolation methods and the optional flag + /// WARP_INVERSE_MAP that means that M is the inverse transformation (dst -> src) . + /// pixel extrapolation method; when borderMode=BORDER_TRANSPARENT, + /// it means that the pixels in the destination image corresponding to the "outliers" + /// in the source image are not modified by the function. + /// value used in case of a constant border; by default, it is 0. + public Mat WarpAffine(InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) + { + var dst = new Mat(); + Cv2.WarpAffine(this, dst, m, dsize, flags, borderMode, borderValue); + return dst; + } + + /// + /// Applies a perspective transformation to an image. + /// + /// 3x3 transformation matrix. + /// size of the output image. + /// combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) + /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). + /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). + /// value used in case of a constant border; by default, it equals 0. + /// output image that has the size dsize and the same type as src. + public Mat WarpPerspective(Mat m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) + { + var dst = new Mat(); + Cv2.WarpPerspective(this, dst, m, dsize, flags, borderMode, borderValue); + return dst; + } + + /// + /// Applies a generic geometrical transformation to an image. + /// + /// The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2. + /// The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively. + /// Interpolation method. The method INTER_AREA is not supported by this function. + /// Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, + /// it means that the pixels in the destination image that corresponds to the "outliers" in + /// the source image are not modified by the function. + /// Value used in case of a constant border. By default, it is 0. + /// Destination image. It has the same size as map1 and the same type as src + public Mat Remap(InputArray map1, InputArray map2, InterpolationFlags interpolation = InterpolationFlags.Linear, + BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) + { + var dst = new Mat(); + Cv2.Remap(this, dst, map1, map2, interpolation, borderMode, borderValue); + return dst; + } + + /// + /// Inverts an affine transformation. + /// + /// Output reverse affine transformation. + public Mat InvertAffineTransform() + { + var dst = new Mat(); + Cv2.InvertAffineTransform(this, dst); + return dst; + } + + /// + /// Retrieves a pixel rectangle from an image with sub-pixel accuracy. + /// + /// Size of the extracted patch. + /// Floating point coordinates of the center of the extracted rectangle + /// within the source image. The center must be inside the image. + /// Depth of the extracted pixels. By default, they have the same depth as src. + /// Extracted patch that has the size patchSize and the same number of channels as src . + public Mat GetRectSubPix(Size patchSize, Point2f center, int patchType = -1) + { + var dst = new Mat(); + Cv2.GetRectSubPix(this, patchSize, center, dst, patchType); + return dst; + } + + /// + /// Adds an image to the accumulator. + /// + /// Optional operation mask. + /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. + public Mat Accumulate(InputArray mask) + { + var dst = new Mat(); + Cv2.Accumulate(this, dst, mask); + return dst; + } + + /// + /// Adds the square of a source image to the accumulator. + /// + /// Optional operation mask. + /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. + public Mat AccumulateSquare(InputArray mask) + { + var dst = new Mat(); + Cv2.AccumulateSquare(this, dst, mask); + return dst; + } + + /// + /// Computes a Hanning window coefficients in two dimensions. + /// + /// The window size specifications + /// Created array type + public void CreateHanningWindow(Size winSize, MatType type) + { + Cv2.CreateHanningWindow(this, winSize, type); + } + + /// + /// Applies a fixed-level threshold to each array element. + /// The input matrix must be single-channel, 8-bit or 32-bit floating point. + /// + /// threshold value. + /// maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. + /// thresholding type (see the details below). + /// output array of the same size and type as src. + public Mat Threshold(double thresh, double maxval, ThresholdTypes type) + { + var dst = new Mat(); + Cv2.Threshold(this, dst, thresh, maxval, type); + return dst; + } + + /// + /// Applies an adaptive threshold to an array. + /// Source matrix must be 8-bit single-channel image. + /// + /// Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. + /// Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C . + /// Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV . + /// Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. + /// Constant subtracted from the mean or weighted mean (see the details below). + /// Normally, it is positive but may be zero or negative as well. + /// Destination image of the same size and the same type as src. + public Mat AdaptiveThreshold(double maxValue, AdaptiveThresholdTypes adaptiveMethod, + ThresholdTypes thresholdType, int blockSize, double c) + { + var dst = new Mat(); + Cv2.AdaptiveThreshold(this, dst, maxValue, adaptiveMethod, + thresholdType, blockSize, c); + return dst; + } + + /// + /// Blurs an image and downsamples it. + /// + /// size of the output image; by default, it is computed as Size((src.cols+1)/2 + /// + /// + public Mat PyrDown(Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.PyrDown(this, dst, dstSize, borderType); + return dst; + } + + /// + /// Upsamples an image and then blurs it. + /// + /// size of the output image; by default, it is computed as Size(src.cols*2, (src.rows*2) + /// + /// + public Mat PyrUp(Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) + { + var dst = new Mat(); + Cv2.PyrUp(this, dst, dstSize, borderType); + return dst; + } + + /// + /// Upsamples an image and then blurs it. + /// + /// + /// + /// + public IEnumerable BuildPyramid(int maxlevel, BorderTypes borderType = BorderTypes.Default) + { + using var dst = new VectorOfMat(); + Cv2.BuildPyramid(this, dst, maxlevel, borderType); + return dst.ToArray(); + } + + /// + /// corrects lens distortion for the given camera matrix and distortion coefficients + /// + /// Input camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, + /// or 8 elements. If the vector is null, the zero distortion coefficients are assumed. + /// Camera matrix of the distorted image. + /// By default, it is the same as cameraMatrix but you may additionally scale + /// and shift the result by using a different matrix. + /// Output (corrected) image that has the same size and type as src . + public Mat Undistort(InputArray cameraMatrix, InputArray distCoeffs, InputArray? newCameraMatrix = null) + { + var dst = new Mat(); + Cv2.Undistort(this, dst, cameraMatrix, distCoeffs, newCameraMatrix); + return dst; + } + + /// + /// returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true) + /// + /// Camera view image size in pixels. + /// Location of the principal point in the new camera matrix. + /// The parameter indicates whether this location should be at the image center or not. + /// the camera matrix that is either an exact copy of the input cameraMatrix + /// (when centerPrinicipalPoint=false), or the modified one (when centerPrincipalPoint=true). + public Mat GetDefaultNewCameraMatrix(Size? imgSize = null, bool centerPrincipalPoint = false) + { + return Cv2.GetDefaultNewCameraMatrix(this, imgSize, centerPrincipalPoint); + } + + /// + /// Computes the ideal point coordinates from the observed point coordinates. + /// Input matrix is an observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). + /// + /// Camera matrix + /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. + /// If the vector is null, the zero distortion coefficients are assumed. + /// Rectification transformation in the object space (3x3 matrix). + /// R1 or R2 computed by stereoRectify() can be passed here. + /// If the matrix is empty, the identity transformation is used. + /// New camera matrix (3x3) or new projection matrix (3x4). + /// P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, + /// the identity new camera matrix is used. + /// Output ideal point coordinates after undistortion and reverse perspective transformation. + /// If matrix P is identity or omitted, dst will contain normalized point coordinates. + public Mat UndistortPoints( + InputArray cameraMatrix, InputArray distCoeffs, + InputArray? r = null, InputArray? p = null) + { + var dst = new Mat(); + Cv2.UndistortPoints(this, dst, cameraMatrix, distCoeffs, r, p); + return dst; + } + + /// + /// Normalizes the grayscale image brightness and contrast by normalizing its histogram. + /// The source matrix is 8-bit single channel image. + /// + /// The destination image; will have the same size and the same type as src + public Mat EqualizeHist() + { + var dst = new Mat(); + Cv2.EqualizeHist(this, dst); + return dst; + } + + /// + /// Performs a marker-based image segmentation using the watershed algorithm. + /// Input matrix is 8-bit 3-channel image. + /// + /// Input/output 32-bit single-channel image (map) of markers. + /// It should have the same size as image. + public void Watershed(InputOutputArray markers) + { + Cv2.Watershed(this, markers); + } + + /// + /// Performs initial step of meanshift segmentation of an image. + /// The source matrix is 8-bit, 3-channel image. + /// + /// The spatial window radius. + /// The color window radius. + /// Maximum level of the pyramid for the segmentation. + /// Termination criteria: when to stop meanshift iterations. + /// The destination image of the same format and the same size as the source. + public Mat PyrMeanShiftFiltering(double sp, double sr, int maxLevel = 1, TermCriteria? termcrit = null) + { + var dst = new Mat(); + Cv2.PyrMeanShiftFiltering(this, dst, sp, sr, maxLevel, termcrit); + return dst; + } + + /// + /// Segments the image using GrabCut algorithm. + /// The input is 8-bit 3-channel image. + /// + /// Input/output 8-bit single-channel mask. + /// The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. + /// Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD + /// ROI containing a segmented object. The pixels outside of the ROI are + /// marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT. + /// Temporary array for the background model. Do not modify it while you are processing the same image. + /// Temporary arrays for the foreground model. Do not modify it while you are processing the same image. + /// Number of iterations the algorithm should make before returning the result. + /// Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL . + /// Operation mode that could be one of GrabCutFlag value. + public void GrabCut(InputOutputArray mask, Rect rect, + InputOutputArray bgdModel, InputOutputArray fgdModel, + int iterCount, GrabCutModes mode) + { + Cv2.GrabCut(this, mask, rect, bgdModel, fgdModel, iterCount, mode); + } + + /// + /// Fills a connected component with the given color. + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// + /// Starting point. + /// New value of the repainted domain pixels. + /// + public int FloodFill(Point seedPoint, Scalar newVal) + { + return Cv2.FloodFill(this, seedPoint, newVal); + } + + /// + /// Fills a connected component with the given color. + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// + /// Starting point. + /// New value of the repainted domain pixels. + /// Optional output parameter set by the function to the + /// minimum bounding rectangle of the repainted domain. + /// Maximal lower brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Maximal upper brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Operation flags. Lower bits contain a connectivity value, + /// 4 (default) or 8, used within the function. Connectivity determines which + /// neighbors of a pixel are considered. + /// + public int FloodFill( + Point seedPoint, Scalar newVal, out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, + FloodFillFlags flags = FloodFillFlags.Link4) + { + return Cv2.FloodFill(this, seedPoint, newVal, out rect, + loDiff, upDiff, flags); + } + + /// + /// Fills a connected component with the given color. + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// + /// (For the second function only) Operation mask that should be a single-channel 8-bit image, + /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of + /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, + /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask + /// in multiple calls to the function to make sure the filled area does not overlap. + /// Starting point. + /// New value of the repainted domain pixels. + /// + public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal) + { + return Cv2.FloodFill(this, mask, seedPoint, newVal); + } + + /// + /// Fills a connected component with the given color. + /// Input/output 1- or 3-channel, 8-bit, or floating-point image. + /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the + /// second variant of the function. See the details below. + /// + /// (For the second function only) Operation mask that should be a single-channel 8-bit image, + /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of + /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, + /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask + /// in multiple calls to the function to make sure the filled area does not overlap. + /// Starting point. + /// New value of the repainted domain pixels. + /// Optional output parameter set by the function to the + /// minimum bounding rectangle of the repainted domain. + /// Maximal lower brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Maximal upper brightness/color difference between the currently + /// observed pixel and one of its neighbors belonging to the component, or a seed pixel + /// being added to the component. + /// Operation flags. Lower bits contain a connectivity value, + /// 4 (default) or 8, used within the function. Connectivity determines which + /// neighbors of a pixel are considered. + /// + public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal, + out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, + FloodFillFlags flags = FloodFillFlags.Link4) + { + return Cv2.FloodFill(this, mask, seedPoint, + newVal, out rect, loDiff, upDiff, flags); + } + + /// + /// Converts image from one color space to another + /// + /// The color space conversion code + /// The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code + /// The destination image; will have the same size and the same depth as src + public Mat CvtColor(ColorConversionCodes code, int dstCn = 0) + { + var dst = new Mat(); + Cv2.CvtColor(this, dst, code, dstCn); + return dst; + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// The input is a raster image (single-channel, 8-bit or floating-point 2D array). + /// + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public Moments Moments(bool binaryImage = false) + { + return new Moments(this, binaryImage); + } + + /// + /// Computes the proximity map for the raster template and the image where the template is searched for + /// The input is Image where the search is running; should be 8-bit or 32-bit floating-point. + /// + /// Searched template; must be not greater than the source image and have the same data type + /// Specifies the comparison method + /// Mask of searched template. It must have the same datatype and size with templ. It is not set by default. + /// A map of comparison results; will be single-channel 32-bit floating-point. + /// If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1). + public Mat MatchTemplate(InputArray templ, TemplateMatchModes method, InputArray? mask = null) + { + var dst = new Mat(); + Cv2.MatchTemplate(this, templ, dst, method, mask); + return dst; + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// destination labeled image + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// The number of labels + public int ConnectedComponents(OutputArray labels, + PixelConnectivity connectivity = PixelConnectivity.Connectivity8) + { + return ConnectedComponents(labels, connectivity, MatType.CV_32S); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// destination labeled image + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// output image label type. Currently CV_32S and CV_16U are supported. + /// The number of labels + public int ConnectedComponents(OutputArray labels, + PixelConnectivity connectivity, MatType ltype) + { + return Cv2.ConnectedComponents(this, labels, connectivity, ltype); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// destination labeled rectangular array + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// The number of labels + public int ConnectedComponents(out int[,] labels, PixelConnectivity connectivity) + { + return Cv2.ConnectedComponents(this, out labels, connectivity); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// destination labeled image + /// statistics output for each label, including the background label, + /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) + /// where COLUMN is one of cv::ConnectedComponentsTypes + /// floating point centroid (x,y) output for each label, + /// including the background label + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// + public int ConnectedComponentsWithStats( + OutputArray labels, OutputArray stats, OutputArray centroids, + PixelConnectivity connectivity = PixelConnectivity.Connectivity8) + { + return ConnectedComponentsWithStats(labels, stats, centroids, connectivity, MatType.CV_32S); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// destination labeled image + /// statistics output for each label, including the background label, + /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) + /// where COLUMN is one of cv::ConnectedComponentsTypes + /// floating point centroid (x,y) output for each label, + /// including the background label + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// output image label type. Currently CV_32S and CV_16U are supported. + /// + public int ConnectedComponentsWithStats( + OutputArray labels, OutputArray stats, OutputArray centroids, + PixelConnectivity connectivity, MatType ltype) + { + return Cv2.ConnectedComponentsWithStats(this, labels, stats, centroids, connectivity, ltype); + } + + /// + /// computes the connected components labeled image of boolean image. + /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 + /// represents the background label. ltype specifies the output label image type, an important + /// consideration based on the total number of labels or alternatively the total number of + /// pixels in the source image. + /// + /// 8 or 4 for 8-way or 4-way connectivity respectively + /// + public ConnectedComponents ConnectedComponentsEx(PixelConnectivity connectivity = PixelConnectivity.Connectivity8) + { + return Cv2.ConnectedComponentsEx(this, connectivity); + } + + /// + /// Finds contours in a binary image. + /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. + /// + /// Detected contours. Each contour is stored as a vector of points. + /// Optional output vector, containing information about the image topology. + /// It has as many elements as the number of contours. For each i-th contour contours[i], + /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next + /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. + /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + public void FindContours(out Point[][] contours, out HierarchyIndex[] hierarchy, + RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + Cv2.FindContours(this, out contours, out hierarchy, mode, method, offset); + } + + /// + /// Finds contours in a binary image. + /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. + /// + /// Detected contours. Each contour is stored as a vector of points. + /// Optional output vector, containing information about the image topology. + /// It has as many elements as the number of contours. For each i-th contour contours[i], + /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next + /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. + /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + public void FindContours(out Mat[] contours, OutputArray hierarchy, + RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + Cv2.FindContours(this, out contours, hierarchy, mode, method, offset); + } + + /// + /// Finds contours in a binary image. + /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. + /// + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + /// Detected contours. Each contour is stored as a vector of points. + public Point[][] FindContoursAsArray(RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + return Cv2.FindContoursAsArray(this, mode, method, offset); + } + + /// + /// Finds contours in a binary image. + /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. + /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. + /// + /// Contour retrieval mode + /// Contour approximation method + /// Optional offset by which every contour point is shifted. + /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. + /// Detected contours. Each contour is stored as a vector of points. + public Mat[] FindContoursAsMat(RetrievalModes mode, ContourApproximationModes method, Point? offset = null) + { + return Cv2.FindContoursAsMat(this, mode, method, offset); + } + + /// + /// Draws contours in the image + /// + /// All the input contours. Each contour is stored as a point vector. + /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. + /// Color of the contours. + /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), + /// the contour interiors are drawn. + /// Line connectivity. + /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours + /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. + /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, + /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account + /// when there is hierarchy available. + /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) + public void DrawContours( + IEnumerable> contours, + int contourIdx, + Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + IEnumerable? hierarchy = null, + int maxLevel = int.MaxValue, + Point? offset = null) + { + Cv2.DrawContours(this, contours, contourIdx, color, + thickness, lineType, hierarchy, maxLevel, offset); + } + + /// + /// Draws contours in the image + /// + /// All the input contours. Each contour is stored as a point vector. + /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. + /// Color of the contours. + /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), + /// the contour interiors are drawn. + /// Line connectivity. + /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours + /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. + /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, + /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account + /// when there is hierarchy available. + /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) + public void DrawContours( + IEnumerable contours, + int contourIdx, + Scalar color, + int thickness = 1, + LineTypes lineType = LineTypes.Link8, + Mat? hierarchy = null, + int maxLevel = int.MaxValue, + Point? offset = null) + { + Cv2.DrawContours(this, contours, contourIdx, color, + thickness, lineType, hierarchy, maxLevel, offset); + } + + /// + /// Approximates contour or a curve using Douglas-Peucker algorithm. + /// The input is the polygon or curve to approximate and + /// it must be 1 x N or N x 1 matrix of type CV_32SC2 or CV_32FC2. + /// + /// Specifies the approximation accuracy. + /// This is the maximum distance between the original curve and its approximation. + /// The result of the approximation; + /// The type should match the type of the input curve + /// The result of the approximation; + /// The type should match the type of the input curve + // ReSharper disable once InconsistentNaming + public Mat ApproxPolyDP(double epsilon, bool closed) + { + var dst = new Mat(); + Cv2.ApproxPolyDP(this, dst, epsilon, closed); + return dst; + } + + /// + /// Calculates a contour perimeter or a curve length. + /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + /// Indicates, whether the curve is closed or not + /// + public double ArcLength(bool closed) + { + return Cv2.ArcLength(this, closed); + } + + /// + /// Calculates the up-right bounding rectangle of a point set. + /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + /// Minimal up-right bounding rectangle for the specified point set. + public Rect BoundingRect() + { + return Cv2.BoundingRect(this); + } + + /// + /// Calculates the contour area. + /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + /// + /// + public double ContourArea(bool oriented = false) + { + return Cv2.ContourArea(this, oriented); + } + + /// + /// Finds the minimum area rotated rectangle enclosing a 2D point set. + /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + /// + public RotatedRect MinAreaRect() + { + return Cv2.MinAreaRect(this); + } + + /// + /// Finds the minimum area circle enclosing a 2D point set. + /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. + /// + /// The output center of the circle + /// The output radius of the circle + public void MinEnclosingCircle(out Point2f center, out float radius) + { + Cv2.MinEnclosingCircle(this, out center, out radius); + } + + /// + /// Computes convex hull for a set of 2D points. + /// + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// + /// The output convex hull. It is either a vector of points that form the + /// hull (must have the same type as the input points), or a vector of 0-based point + /// indices of the hull points in the original array (since the set of convex hull + /// points is a subset of the original point set). + public Mat ConvexHull(bool clockwise = false, bool returnPoints = true) + { + var dst = new Mat(); + Cv2.ConvexHull(this, dst, clockwise, returnPoints); + return dst; + } + + /// + /// Computes convex hull for a set of 2D points. + /// + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of points that form the + /// hull (must have the same type as the input points). + public Point[] ConvexHullPoints(bool clockwise = false) + { + var dst = new Mat(); + Cv2.ConvexHull(this, dst, clockwise); + return dst.ToArray(); + } + + /// + /// Computes convex hull for a set of 2D points. + /// + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of points that form the + /// hull (must have the same type as the input points). + public Point2f[] ConvexHullFloatPoints(bool clockwise = false) + { + var dst = new Mat(); + Cv2.ConvexHull(this, dst, clockwise); + return dst.ToArray(); + } + + /// + /// Computes convex hull for a set of 2D points. + /// + /// If true, the output convex hull will be oriented clockwise, + /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate + /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, + /// and y axis is oriented downwards. + /// The output convex hull. It is a vector of 0-based point + /// indices of the hull points in the original array (since the set of convex hull + /// points is a subset of the original point set). + public int[] ConvexHullIndices(bool clockwise = false) + { + var dst = new Mat(); + Cv2.ConvexHull(this, dst, clockwise, false); + return dst.ToArray(); + } + + /// + /// Computes the contour convexity defects + /// + /// Convex hull obtained using convexHull() that + /// should contain indices of the contour points that make the hull. + /// The output vector of convexity defects. + /// Each convexity defect is represented as 4-element integer vector + /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), + /// where indices are 0-based indices in the original contour of the convexity defect beginning, + /// end and the farthest point, and fixpt_depth is fixed-point approximation + /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. + /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. + public Mat ConvexityDefects(InputArray convexHull) + { + var dst = new Mat(); + Cv2.ConvexityDefects(this, convexHull, dst); + return dst; + } + + /// + /// Computes the contour convexity defects + /// + /// Convex hull obtained using convexHull() that + /// should contain indices of the contour points that make the hull. + /// The output vector of convexity defects. + /// Each convexity defect is represented as 4-element integer vector + /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), + /// where indices are 0-based indices in the original contour of the convexity defect beginning, + /// end and the farthest point, and fixpt_depth is fixed-point approximation + /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. + /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. + public Vec4i[] ConvexityDefectsAsVec(InputArray convexHull) + { + var dst = new Mat(); + Cv2.ConvexityDefects(this, convexHull, dst); + return dst.ToArray(); + } + + /// + /// Returns true if the contour is convex. + /// Does not support contours with self-intersection + /// + /// + public bool IsContourConvex() + { + return Cv2.IsContourConvex(this); + } + + /// + /// Fits ellipse to the set of 2D points. + /// + /// + public RotatedRect FitEllipse() + { + return Cv2.FitEllipse(this); + } + + /// + /// Fits line to the set of 2D points using M-estimator algorithm. + /// The input is vector of 2D points. + /// + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + /// Output line parameters. + public Line2D FitLine2D(DistanceTypes distType, double param, double reps, double aeps) + { + var line = new Mat(); + Cv2.FitLine(this, line, distType, param, reps, aeps); + return new Line2D(line.ToArray()); + } + + /// + /// Fits line to the set of 3D points using M-estimator algorithm. + /// The input is vector of 3D points. + /// + /// Distance used by the M-estimator + /// Numerical parameter ( C ) for some types of distances. + /// If it is 0, an optimal value is chosen. + /// Sufficient accuracy for the radius + /// (distance between the coordinate origin and the line). + /// Sufficient accuracy for the angle. + /// 0.01 would be a good default value for reps and aeps. + /// Output line parameters. + public Line3D FitLine3D(DistanceTypes distType, double param, double reps, double aeps) + { + var line = new Mat(); + Cv2.FitLine(this, line, distType, param, reps, aeps); + return new Line3D(line.ToArray()); + } + + /// + /// Checks if the point is inside the contour. + /// Optionally computes the signed distance from the point to the contour boundary. + /// + /// Point tested against the contour. + /// If true, the function estimates the signed distance + /// from the point to the nearest contour edge. Otherwise, the function only checks + /// if the point is inside a contour or not. + /// Positive (inside), negative (outside), or zero (on an edge) value. + public double PointPolygonTest(Point2f pt, bool measureDist) + { + return Cv2.PointPolygonTest(this, pt, measureDist); + } + + /// + /// Computes the distance transform map + /// + /// + /// + public Mat DistanceTransform(DistanceTypes distanceType, DistanceTransformMasks maskSize) + { + var dst = new Mat(); + Cv2.DistanceTransform(this, dst, distanceType, maskSize); + return dst; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Mat/UMat.cs b/src/OpenCvSharp/Modules/core/Mat/UMat.cs new file mode 100644 index 000000000..cd665d943 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Mat/UMat.cs @@ -0,0 +1,1489 @@ +using OpenCvSharp.Internal; +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// OpenCV C++ n-dimensional dense array class (cv::Mat) +/// +public class UMat : DisposableCvObject +{ + #region Init & Disposal + + /// + /// typeof(T) -> MatType + /// + protected static readonly IReadOnlyDictionary TypeMap = new Dictionary + { + [typeof(byte)] = MatType.CV_8UC1, + [typeof(sbyte)] = MatType.CV_8SC1, + [typeof(short)] = MatType.CV_16SC1, + [typeof(char)] = MatType.CV_16UC1, + [typeof(ushort)] = MatType.CV_16UC1, + [typeof(int)] = MatType.CV_32SC1, + [typeof(float)] = MatType.CV_32FC1, + [typeof(double)] = MatType.CV_64FC1, + + [typeof(Vec2b)] = MatType.CV_8UC2, + [typeof(Vec3b)] = MatType.CV_8UC3, + [typeof(Vec4b)] = MatType.CV_8UC4, + [typeof(Vec6b)] = MatType.CV_8UC(6), + + [typeof(Vec2s)] = MatType.CV_16SC2, + [typeof(Vec3s)] = MatType.CV_16SC3, + [typeof(Vec4s)] = MatType.CV_16SC4, + [typeof(Vec6s)] = MatType.CV_16SC(6), + + [typeof(Vec2w)] = MatType.CV_16UC2, + [typeof(Vec3w)] = MatType.CV_16UC3, + [typeof(Vec4w)] = MatType.CV_16UC4, + [typeof(Vec6w)] = MatType.CV_16UC(6), + + [typeof(Vec2i)] = MatType.CV_32SC2, + [typeof(Vec3i)] = MatType.CV_32SC3, + [typeof(Vec4i)] = MatType.CV_32SC4, + [typeof(Vec6i)] = MatType.CV_32SC(6), + + [typeof(Vec2f)] = MatType.CV_32FC2, + [typeof(Vec3f)] = MatType.CV_32FC3, + [typeof(Vec4f)] = MatType.CV_32FC4, + [typeof(Vec6f)] = MatType.CV_32FC(6), + + [typeof(Vec2d)] = MatType.CV_64FC2, + [typeof(Vec3d)] = MatType.CV_64FC3, + [typeof(Vec4d)] = MatType.CV_64FC4, + [typeof(Vec6d)] = MatType.CV_64FC(6), + + [typeof(Point)] = MatType.CV_32SC2, + [typeof(Point2f)] = MatType.CV_32FC2, + [typeof(Point2d)] = MatType.CV_64FC2, + + [typeof(Point3i)] = MatType.CV_32SC3, + [typeof(Point3f)] = MatType.CV_32FC3, + [typeof(Point3d)] = MatType.CV_64FC3, + + [typeof(Size)] = MatType.CV_32SC2, + [typeof(Size2f)] = MatType.CV_32FC2, + [typeof(Size2d)] = MatType.CV_64FC2, + + [typeof(Rect)] = MatType.CV_32SC4, + [typeof(Rect2f)] = MatType.CV_32FC4, + [typeof(Rect2d)] = MatType.CV_64FC4, + + [typeof(DMatch)] = MatType.CV_32FC4, + }; + + /// + /// Creates from native cv::Mat* pointer + /// + /// + internal UMat(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Native object address is NULL"); + this.ptr = ptr; + } + + /// + /// Creates from native cv::UMat* pointer + /// + /// + public static UMat FromNativePointer(IntPtr ptr) + => new(ptr); + + /// + /// Creates empty Mat + /// + public UMat(UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_new1((int)usageFlags, out ptr)); + } + + /// + /// + /// + /// + protected UMat(UMat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_new6(m.ptr, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("imread failed."); + } + + /// + /// constructs 2D matrix of the specified size and type + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// usage flags for allocator + public UMat(int rows, int cols, MatType type, UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_new2(rows, cols, type, (int)usageFlags, out ptr)); + } + + /// + /// constructs 2D matrix of the specified size and type + /// + /// 2D array size: Size(cols, rows) . In the Size() constructor, + /// the number of rows and the number of columns go in the reverse order. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// usage flags for allocator + public UMat(Size size, MatType type, UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_new2(size.Height, size.Width, type, (int)usageFlags, out ptr)); + } + + /// + /// constructs 2D matrix and fills it with the specified Scalar value. + /// + /// Number of rows in a 2D array. + /// Number of columns in a 2D array. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + /// usage flags for allocator + public UMat(int rows, int cols, MatType type, Scalar s, UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_new3(rows, cols, type, s, (int)usageFlags, out ptr)); + } + + /// + /// constructs 2D matrix and fills it with the specified Scalar value. + /// + /// 2D array size: Size(cols, rows) . In the Size() constructor, + /// the number of rows and the number of columns go in the reverse order. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + /// usage flags for allocator + public UMat(Size size, MatType type, Scalar s, UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_new3(size.Height, size.Width, type, s, (int)usageFlags, out ptr)); + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat::clone() . + /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. + /// Use Range.All to take all the rows. + /// Range of the m columns to take. Use Range.All to take all the columns. + /// usage flags for allocator + public UMat(UMat m, Range rowRange, Range colRange, UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException(NativeMethods.core_UMat_new7(m.ptr, rowRange, colRange, (int)usageFlags, out ptr)); + GC.KeepAlive(m); + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat.Clone() . + /// Array of selected ranges of m along each dimensionality. + public UMat(UMat m, params Range[] ranges) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + if (ranges.Length == 0) + throw new ArgumentException("empty ranges", nameof(ranges)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_new9(m.ptr, ranges, out ptr)); + GC.KeepAlive(m); + } + + /// + /// creates a matrix header for a part of the bigger matrix + /// + /// Array that (as a whole or partly) is assigned to the constructed matrix. + /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array + /// is constructed and associated with it. The reference counter, if any, is incremented. + /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . + /// If you want to have an independent copy of the sub-array, use Mat.Clone() . + /// Region of interest. + public UMat(UMat m, Rect roi) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_new8(m.ptr, roi, out ptr)); + GC.KeepAlive(m); + } + + /// + /// constructs n-dimensional matrix + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + public UMat(IEnumerable sizes, MatType type) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + + var sizesArray = sizes.ToArray(); + NativeMethods.HandleException( + NativeMethods.core_UMat_new4(sizesArray.Length, sizesArray, type, out ptr)); + } + + /// + /// constructs n-dimensional matrix + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + /// An optional value to initialize each matrix element with. + /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . + public UMat(IEnumerable sizes, MatType type, Scalar s) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + var sizesArray = sizes.ToArray(); + NativeMethods.HandleException( + NativeMethods.core_UMat_new5(sizesArray.Length, sizesArray, type, s, out ptr)); + } + + /// + /// Releases the resources + /// + public void Release() + { + Dispose(); + } + + /// + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero && IsEnabledDispose) + NativeMethods.HandleException( + NativeMethods.core_UMat_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Static + + /// + /// Extracts a diagonal from a matrix, or creates a diagonal matrix. + /// + /// One-dimensional matrix that represents the main diagonal. + /// + public static UMat Diag(UMat d) + { + if (d is null) + throw new ArgumentNullException(nameof(d)); + + NativeMethods.HandleException( + NativeMethods.core_UMat_diag_static(d.CvPtr, out var ret)); + GC.KeepAlive(d); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Returns a zero array of the specified size and type. + /// + /// Number of rows. + /// Number of columns. + /// Created matrix type. + /// + public static UMat Zeros(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_zeros1(rows, cols, type, out var ret)); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Returns a zero array of the specified size and type. + /// + /// Alternative to the matrix size specification Size(cols, rows) . + /// Created matrix type. + /// + public static UMat Zeros(Size size, MatType type) + { + return Zeros(size.Height, size.Width, type); + } + + /// + /// Returns a zero array of the specified size and type. + /// + /// Created matrix type. + /// + /// + public static UMat Zeros(MatType type, params int[] sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + + NativeMethods.HandleException( + NativeMethods.core_UMat_zeros2(sizes.Length, sizes, type.Value, out var ret)); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Returns an array of all 1’s of the specified size and type. + /// + /// Number of rows. + /// Number of columns. + /// Created matrix type. + /// + public static UMat Ones(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_ones1(rows, cols, type, out var ret)); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Returns an array of all 1’s of the specified size and type. + /// + /// Alternative to the matrix size specification Size(cols, rows) . + /// Created matrix type. + /// + public static UMat Ones(Size size, MatType type) + { + return Ones(size.Height, size.Width, type); + } + + /// + /// Returns an array of all 1’s of the specified size and type. + /// + /// Created matrix type. + /// Array of integers specifying the array shape. + /// + public static UMat Ones(MatType type, params int[] sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + + NativeMethods.HandleException( + NativeMethods.core_UMat_ones2(sizes.Length, sizes, type, out var ret)); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Returns an identity matrix of the specified size and type. + /// + /// Alternative to the matrix size specification Size(cols, rows) . + /// Created matrix type. + /// + public static UMat Eye(Size size, MatType type) + { + return Eye(size.Height, size.Width, type); + } + + /// + /// Returns an identity matrix of the specified size and type. + /// + /// Number of rows. + /// Number of columns. + /// Created matrix type. + /// + public static UMat Eye(int rows, int cols, MatType type) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_eye(rows, cols, type, out var ret)); + var retVal = new UMat(ret); + return retVal; + } + + #endregion + + #region Public Methods + + #region Mat Indexers + + /// + /// Extracts a rectangular submatrix. + /// + /// Start row of the extracted submatrix. The upper boundary is not included. + /// End row of the extracted submatrix. The upper boundary is not included. + /// Start column of the extracted submatrix. The upper boundary is not included. + /// End column of the extracted submatrix. The upper boundary is not included. + /// + public UMat this[int rowStart, int rowEnd, int colStart, int colEnd] + { + get => SubMat(rowStart, rowEnd, colStart, colEnd); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + using var sub = SubMat(rowStart, rowEnd, colStart, colEnd); + if (sub.Size() != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + value.CopyTo(sub); + } + } + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range.All(). + /// Start and end column of the extracted submatrix. + /// The upper boundary is not included. To select all the columns, use Range.All(). + /// + public UMat this[System.Range rowRange, System.Range colRange] + { + get => SubMat(rowRange, colRange); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + using var sub = SubMat(rowRange, colRange); + if (sub.Size() != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + value.CopyTo(sub); + } + } +#endif + + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range.All(). + /// Start and end column of the extracted submatrix. + /// The upper boundary is not included. To select all the columns, use Range.All(). + /// + public UMat this[Range rowRange, Range colRange] + { + get => SubMat(rowRange, colRange); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + using var sub = SubMat(rowRange, colRange); + if (sub.Size() != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + value.CopyTo(sub); + } + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Extracted submatrix specified as a rectangle. + /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public UMat this[Rect roi] + { + get => SubMat(roi); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + if (Dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + + if (roi.Size != value.Size()) + throw new ArgumentException("Specified ROI != mat.Size()"); + using var sub = SubMat(roi); + value.CopyTo(sub); + } + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Array of selected ranges along each array dimension. + /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public UMat this[params Range[] ranges] + { + get => SubMat(ranges); + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + //if (Type() != value.Type()) + // throw new ArgumentException("Mat type mismatch"); + + using var sub = SubMat(ranges); + + var dims = Dims; + if (dims != value.Dims) + throw new ArgumentException("Dimension mismatch"); + for (var i = 0; i < dims; i++) + { + if (sub.Size(i) != value.Size(i)) + throw new ArgumentException("Size mismatch at dimension " + i); + } + + value.CopyTo(sub); + } + } + + #endregion + + /// + /// Returns the UMat data as a Mat. + /// + /// AccessFlag determining the mode in which the data is to be acquired + /// + public Mat GetMat(AccessFlag accessFlags) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_getMat(ptr, (int)accessFlags, out var matPtr)); + return new Mat(matPtr); + } + + /// + /// Creates a matrix header for the specified matrix column. + /// + /// A 0-based column index. + /// + public UMat Col(int x) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_col(ptr, x, out var matPtr)); + return new UMat(matPtr); + } + + /// + /// Creates a matrix header for the specified column span. + /// + /// An inclusive 0-based start index of the column span. + /// An exclusive 0-based ending index of the column span. + /// + public UMat ColRange(int startCol, int endCol) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_colRange(ptr, startCol, endCol, out var matPtr)); + GC.KeepAlive(this); + return new UMat(matPtr); + } + + /// + /// Creates a matrix header for the specified column span. + /// + /// + /// + public UMat ColRange(Range range) + { + return ColRange(range.Start, range.End); + } + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Creates a matrix header for the specified column span. + /// + /// + /// + public UMat ColRange(System.Range range) + { + var (colStart, colLength) = range.GetOffsetAndLength(Cols); + return ColRange(colStart, colStart + colLength); + } +#endif + + /// + /// Creates a matrix header for the specified matrix row. + /// + /// A 0-based row index. + /// + public UMat Row(int y) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_row(ptr, y, out var matPtr)); + return new UMat(matPtr); + } + + /// + /// Creates a matrix header for the specified row span. + /// + /// + /// + /// + public UMat RowRange(int startRow, int endRow) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_rowRange(ptr, startRow, endRow, out var matPtr)); + GC.KeepAlive(this); + return new UMat(matPtr); + } + + /// + /// Creates a matrix header for the specified row span. + /// + /// + /// + public UMat RowRange(Range range) + { + return RowRange(range.Start, range.End); + } + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Creates a matrix header for the specified row span. + /// + /// + /// + public UMat RowRange(System.Range range) + { + var (rowStart, rowLength) = range.GetOffsetAndLength(Rows); + return RowRange(rowStart, rowStart + rowLength); + } +#endif + + /// + /// Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values: + /// + /// Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values: + /// + public UMat Diag(MatDiagType d = MatDiagType.Main) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_diag(ptr, (int)d, out var ret)); + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Creates a full copy of the matrix. + /// + /// + public UMat Clone() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_clone(ptr, out var ret)); + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Returns the partial Mat of the specified Mat + /// + /// + /// + public UMat Clone(Rect roi) + { + using var part = new UMat(this, roi); + return part.Clone(); + } + + /// + /// Copies the matrix to another one. + /// + /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. + /// Operation mask. Its non-zero elements indicate which matrix elements need to be copied. + public void CopyTo(OutputArray m, InputArray? mask = null) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfNotReady(); + mask?.ThrowIfDisposed(); + + if (mask is null) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_copyTo1(ptr, m.CvPtr)); + } + else + { + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_UMat_copyTo2(ptr, m.CvPtr, maskPtr)); + } + + GC.KeepAlive(this); + m.Fix(); + GC.KeepAlive(mask); + } + + /// + /// Copies the matrix to another one. + /// + /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. + /// Operation mask. Its non-zero elements indicate which matrix elements need to be copied. + public void CopyTo(UMat m, InputArray? mask = null) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); + + if (mask is null) + { + NativeMethods.HandleException( + NativeMethods.core_UMat_copyTo_toUMat1(ptr, m.CvPtr)); + } + else + { + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_UMat_copyTo_toUMat2(ptr, m.CvPtr, maskPtr)); + } + + GC.KeepAlive(this); + GC.KeepAlive(m); + GC.KeepAlive(mask); + } + + /// + /// Converts an array to another data type with optional scaling. + /// + /// output matrix; if it does not have a proper size or type before the operation, it is reallocated. + /// desired output matrix type or, rather, the depth since the number of channels are the same as the input has; + /// if rtype is negative, the output matrix will have the same type as the input. + /// optional scale factor. + /// optional delta added to the scaled values. + public void ConvertTo(OutputArray m, MatType rtype, double alpha = 1, double beta = 0) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_convertTo(ptr, m.CvPtr, rtype, alpha, beta)); + + GC.KeepAlive(this); + m.Fix(); + } + + /// + /// Provides a functional form of convertTo. + /// + /// Destination array. + /// Desired destination array depth (or -1 if it should be the same as the source type). + public void AssignTo(UMat m, MatType? type = null) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_UMat_assignTo(ptr, m.CvPtr, type?.Value ?? -1)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// Sets all or some of the array elements to the specified value. + /// + /// + /// + /// + public UMat SetTo(Scalar value, UMat? mask = null) + { + ThrowIfDisposed(); + + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_UMat_setTo_Scalar(ptr, value, maskPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(mask); + return this; + } + + /// + /// Sets all or some of the array elements to the specified value. + /// + /// + /// + /// + public UMat SetTo(InputArray value, UMat? mask = null) + { + ThrowIfDisposed(); + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + var maskPtr = Cv2.ToPtr(mask); + NativeMethods.HandleException( + NativeMethods.core_UMat_setTo_InputArray(ptr, value.CvPtr, maskPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(value); + GC.KeepAlive(mask); + return this; + } + + /// + /// Changes the shape and/or the number of channels of a 2D matrix without copying the data. + /// + /// New number of channels. If the parameter is 0, the number of channels remains the same. + /// New number of rows. If the parameter is 0, the number of rows remains the same. + /// + public UMat Reshape(int cn, int rows = 0) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_reshape1(ptr, cn, rows, out var ret)); + + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Changes the shape and/or the number of channels of a 2D matrix without copying the data. + /// + /// New number of channels. If the parameter is 0, the number of channels remains the same. + /// New number of rows. If the parameter is 0, the number of rows remains the same. + /// + public UMat Reshape(int cn, params int[] newDims) + { + if (newDims is null) + throw new ArgumentNullException(nameof(newDims)); + + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_reshape2(ptr, cn, newDims.Length, newDims, out var ret)); + + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Transposes a matrix. + /// + /// + public UMat T() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_t(ptr, out var ret)); + + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Inverses a matrix. + /// + /// Matrix inversion method + /// + public UMat Inv(DecompTypes method = DecompTypes.LU) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_inv(ptr, (int)method, out var ret)); + + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Performs an element-wise multiplication or division of the two matrices. + /// + /// + /// + /// + public UMat Mul(InputArray m, double scale = 1) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_mul(ptr, m.CvPtr, scale, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Computes a dot-product of two vectors. + /// + /// another dot-product operand. + /// + public double Dot(InputArray m) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_dot(ptr, m.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + return ret; + } + + /// + /// Allocates new array data if needed. + /// + /// New number of rows. + /// New number of columns. + /// New matrix type. + public void Create(int rows, int cols, MatType type) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_create1(ptr, rows, cols, type)); + GC.KeepAlive(this); + } + + /// + /// Allocates new array data if needed. + /// + /// Alternative new matrix size specification: Size(cols, rows) + /// New matrix type. + public void Create(Size size, MatType type) + { + Create(size.Height, size.Width, type); + } + + /// + /// Allocates new array data if needed. + /// + /// Array of integers specifying a new array shape. + /// New matrix type. + public void Create(MatType type, params int[] sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + if (sizes.Length < 2) + throw new ArgumentException("sizes.Length < 2"); + NativeMethods.HandleException( + NativeMethods.core_UMat_create2(ptr, sizes.Length, sizes, type)); + GC.KeepAlive(this); + } + + /// + /// Locates the matrix header within a parent matrix. + /// + /// Output parameter that contains the size of the whole matrix containing *this as a part. + /// Output parameter that contains an offset of *this inside the whole matrix. + // ReSharper disable once InconsistentNaming + public void LocateROI(out Size wholeSize, out Point ofs) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_locateROI(ptr, out wholeSize, out ofs)); + GC.KeepAlive(this); + } + + /// + /// Adjusts a submatrix size and position within the parent matrix. + /// + /// Shift of the top submatrix boundary upwards. + /// Shift of the bottom submatrix boundary downwards. + /// Shift of the left submatrix boundary to the left. + /// Shift of the right submatrix boundary to the right. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable IdentifierTypo + public UMat AdjustROI(int dtop, int dbottom, int dleft, int dright) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_adjustROI(ptr, dtop, dbottom, dleft, dright, out var ret)); + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + // ReSharper restore IdentifierTypo + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + /// + /// + /// + public UMat SubMat(int rowStart, int rowEnd, int colStart, int colEnd) + { + if (rowStart >= rowEnd) + throw new ArgumentException("rowStart >= rowEnd"); + if (colStart >= colEnd) + throw new ArgumentException("colStart >= colEnd"); + + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_subMat1(ptr, rowStart, rowEnd, colStart, colEnd, out var ret)); + GC.KeepAlive(this); + var retVal = new UMat(ret); + return retVal; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range::all(). + /// Start and end column of the extracted submatrix. The upper boundary is not included. + /// To select all the columns, use Range::all(). + /// + public UMat SubMat(Range rowRange, Range colRange) + { + return SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); + } + +#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 + /// + /// Extracts a rectangular submatrix. + /// + /// Start and end row of the extracted submatrix. The upper boundary is not included. + /// To select all the rows, use Range::all(). + /// Start and end column of the extracted submatrix. The upper boundary is not included. + /// To select all the columns, use Range::all(). + /// + public UMat SubMat(System.Range rowRange, System.Range colRange) + { + var (rowStart, rowLength) = rowRange.GetOffsetAndLength(Rows); + var (colStart, colLength) = colRange.GetOffsetAndLength(Cols); + return SubMat(rowStart, rowStart + rowLength, colStart, colStart + colLength); + } +#endif + + /// + /// Extracts a rectangular submatrix. + /// + /// Extracted submatrix specified as a rectangle. + /// + public UMat SubMat(Rect roi) + { + return SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); + } + + /// + /// Extracts a rectangular submatrix. + /// + /// Array of selected ranges along each array dimension. + /// + public UMat SubMat(params Range[] ranges) + { + if (ranges is null) + throw new ArgumentNullException(nameof(ranges)); + + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_UMat_subMat2(ptr, ranges.Length, ranges, out var ret)); + var retVal = new UMat(ret); + GC.KeepAlive(this); + return retVal; + } + + /// + /// Reports whether the matrix is continuous or not. + /// + /// + public bool IsContinuous() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_isContinuous(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns whether this matrix is a part of other matrix or not. + /// + /// + public bool IsSubmatrix() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_isSubmatrix(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the matrix element size in bytes. + /// + /// + public int ElemSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_elemSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt32(); + } + + /// + /// Returns the size of each matrix element channel in bytes. + /// + /// + public int ElemSize1() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_elemSize1(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt32(); + } + + /// + /// Returns the type of a matrix element. + /// + /// + public MatType Type() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_type(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the depth of a matrix element. + /// + /// + public int Depth() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_depth(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the number of matrix channels. + /// + /// + public int Channels() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_channels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a normalized step. + /// + /// + /// + public long Step1(int i = 0) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_step1(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Returns true if the array has no elements. + /// + /// + public bool Empty() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the total number of array elements. + /// + /// + public long Total() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_total(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// + /// + /// Number of channels or number of columns the matrix should have. + /// For a 2-D matrix, when the matrix has only 1 column, then it should have + /// elemChannels channels; When the matrix has only 1 channel, + /// then it should have elemChannels columns. For a 3-D matrix, it should have only one channel. + /// Furthermore, if the number of planes is not one, then the number of rows within every + /// plane has to be 1; if the number of rows within every plane is not 1, + /// then the number of planes has to be 1. + /// The depth the matrix should have. Set it to -1 when any depth is fine. + /// Set it to true to require the matrix to be continuous + /// -1 if the requirement is not satisfied. + /// Otherwise, it returns the number of elements in the matrix. Note that an element may have multiple channels. + public int CheckVector(int elemChannels, int depth = -1, bool requireContinuous = true) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_checkVector( + ptr, elemChannels, depth, requireContinuous ? 1 : 0, out var ret)); + GC.KeepAlive(this); + return ret; + } + +#pragma warning restore CA1720 // Identifiers should not contain type names + + /// + /// includes several bit-fields: + /// - the magic signature + /// - continuity flag + /// - depth + /// - number of channels + /// + public int Flags + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_flags(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the array dimensionality, >= 2 + /// + public int Dims + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_dims(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the number of rows or -1 when the array has more than 2 dimensions + /// + public int Rows + { + get + { + NativeMethods.HandleException( + NativeMethods.core_UMat_rows(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the number of rows or -1 when the array has more than 2 dimensions + /// + /// + public int Height => Rows; + + /// + /// the number of columns or -1 when the array has more than 2 dimensions + /// + /// + public int Cols + { + get + { + NativeMethods.HandleException( + NativeMethods.core_UMat_cols(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// the number of columns or -1 when the array has more than 2 dimensions + /// + /// + public int Width => Cols; + + /// + /// Returns a matrix size. + /// + /// + public Size Size() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_size(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a matrix size. + /// + /// + /// + public int Size(int dim) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_sizeAt(ptr, dim, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns number of bytes each matrix row occupies. + /// + /// + public long Step() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_step(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Returns number of bytes each matrix row occupies. + /// + /// + /// + public long Step(int i) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_UMat_stepAt(ptr, i, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + #region ToString + + /// + /// Returns a string that represents this Mat. + /// + /// + public override string ToString() + { + if (IsDisposed) + return "Mat [disposed]"; + + return "Mat [ " + + Rows + "*" + Cols + "*" + Type().ToString() + + ", IsContinuous=" + IsContinuous() + ", IsSubmatrix=" + IsSubmatrix() + + ", Ptr=0x" + Convert.ToString(ptr.ToInt64(), 16) + + " ]"; + } + + #endregion + + #region EmptyClone + + /// + /// Makes a Mat that have the same size, depth and channels as this image + /// + /// + public UMat EmptyClone(UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + ThrowIfDisposed(); + return new UMat(Size(), Type(), usageFlags); + } + + #endregion + + /// + /// + /// + /// + /// usage flags for allocator + /// + public UMat Alignment(int n = 4, UMatUsageFlags usageFlags = UMatUsageFlags.None) + { + var newCols = Cv2.AlignSize(Cols, n); + using var pMat = new UMat(Rows, newCols, Type(), usageFlags); +#pragma warning disable CA2000 + var roiMat = new UMat(pMat, new Rect(0, 0, Cols, Rows)); +#pragma warning restore CA2000 + CopyTo(roiMat); + return roiMat; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/MatExpr.cs b/src/OpenCvSharp/Modules/core/MatExpr.cs new file mode 100644 index 000000000..6e187e05a --- /dev/null +++ b/src/OpenCvSharp/Modules/core/MatExpr.cs @@ -0,0 +1,731 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Matrix expression +/// +public sealed partial class MatExpr : DisposableCvObject +{ + #region Init & Disposal + + /// + /// Constructor + /// + /// + internal MatExpr(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Constructor + /// + /// + internal MatExpr(Mat mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + NativeMethods.HandleException( + NativeMethods.core_MatExpr_new2(mat.CvPtr, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_MatExpr_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Cast + + /// + /// Convert to cv::Mat + /// + /// + /// + public static implicit operator Mat(MatExpr self) + { +#pragma warning disable CA1065 // TODO + if (self is null) + throw new ArgumentNullException(nameof(self)); +#pragma warning restore CA1065 + return self.ToMat(); + } + + /// + /// Convert to cv::Mat + /// + /// + public Mat ToMat() + { + Mat? mat = null; + try + { + mat = new Mat(); + NativeMethods.HandleException( + NativeMethods.core_MatExpr_toMat(ptr, mat.CvPtr)); + GC.KeepAlive(this); + return mat; + } + catch + { + mat?.Dispose(); + throw; + } + } + + /// + /// Convert cv::Mat to cv::MatExpr + /// + /// + /// + public static implicit operator MatExpr(Mat mat) + { + return new MatExpr(mat); + } + + /// + /// Convert cv::Mat to cv::MatExpr + /// + /// + /// + public static MatExpr FromMat(Mat mat) + { + return new MatExpr(mat); + } + + #endregion + + #region Operators + +#pragma warning disable 1591 + + public static MatExpr operator +(MatExpr e) => e; + + public MatExpr Plus() => this; + + public static MatExpr operator -(MatExpr e) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorUnaryMinus_MatExpr(e.CvPtr, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public MatExpr Negate() => -this; + + public static MatExpr operator ~(MatExpr e) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorUnaryNot_MatExpr(e.CvPtr, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public MatExpr OnesComplement() => ~this; + + public static MatExpr operator +(MatExpr e, Mat m) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + e.ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorAdd_MatExprMat(e.CvPtr, m.CvPtr, out var ret)); + GC.KeepAlive(e); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + public static MatExpr operator +(Mat m, MatExpr e) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (e is null) + throw new ArgumentNullException(nameof(e)); + m.ThrowIfDisposed(); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorAdd_MatMatExpr(m.CvPtr, e.CvPtr, out var ret)); + GC.KeepAlive(m); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator +(MatExpr e, Scalar s) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorAdd_MatExprScalar(e.CvPtr, s, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator +(Scalar s, MatExpr e) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorAdd_ScalarMatExpr(s, e.CvPtr, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator +(MatExpr e1, MatExpr e2) + { + if (e1 is null) + throw new ArgumentNullException(nameof(e1)); + if (e2 is null) + throw new ArgumentNullException(nameof(e2)); + e1.ThrowIfDisposed(); + e2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorAdd_MatExprMatExpr(e1.CvPtr, e2.CvPtr, out var ret)); + GC.KeepAlive(e1); + GC.KeepAlive(e2); + return new MatExpr(ret); + } + + public MatExpr Add(Mat m) => this + m; + public MatExpr Add(MatExpr me) => this + me; + public MatExpr Add(Scalar s) => this + s; + + public static MatExpr operator -(MatExpr e, Mat m) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + e.ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorSubtract_MatExprMat(e.CvPtr, m.CvPtr, out var ret)); + GC.KeepAlive(e); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + public static MatExpr operator -(Mat m, MatExpr e) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (e is null) + throw new ArgumentNullException(nameof(e)); + m.ThrowIfDisposed(); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorSubtract_MatMatExpr(m.CvPtr, e.CvPtr, out var ret)); + GC.KeepAlive(m); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator -(MatExpr e, Scalar s) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorSubtract_MatExprScalar(e.CvPtr, s, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator -(Scalar s, MatExpr e) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorSubtract_ScalarMatExpr(s, e.CvPtr, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator -(MatExpr e1, MatExpr e2) + { + if (e1 is null) + throw new ArgumentNullException(nameof(e1)); + if (e2 is null) + throw new ArgumentNullException(nameof(e2)); + e1.ThrowIfDisposed(); + e2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorSubtract_MatExprMatExpr(e1.CvPtr, e2.CvPtr, out var ret)); + GC.KeepAlive(e1); + GC.KeepAlive(e2); + return new MatExpr(ret); + } + + public MatExpr Subtract(Mat m) => this - m; + public MatExpr Subtract(MatExpr me) => this - me; + public MatExpr Subtract(Scalar s) => this - s; + + public static MatExpr operator *(MatExpr e, Mat m) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + e.ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorMultiply_MatExprMat(e.CvPtr, m.CvPtr, out var ret)); + GC.KeepAlive(e); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + public static MatExpr operator *(Mat m, MatExpr e) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (e is null) + throw new ArgumentNullException(nameof(e)); + m.ThrowIfDisposed(); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorMultiply_MatMatExpr(m.CvPtr, e.CvPtr, out var ret)); + GC.KeepAlive(m); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator *(MatExpr e, double s) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorMultiply_MatExprDouble(e.CvPtr, s, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator *(double s, MatExpr e) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorMultiply_DoubleMatExpr(s, e.CvPtr, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator *(MatExpr e1, MatExpr e2) + { + if (e1 is null) + throw new ArgumentNullException(nameof(e1)); + if (e2 is null) + throw new ArgumentNullException(nameof(e2)); + e1.ThrowIfDisposed(); + e2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorMultiply_MatExprMatExpr(e1.CvPtr, e2.CvPtr, out var ret)); + GC.KeepAlive(e1); + GC.KeepAlive(e2); + return new MatExpr(ret); + } + + public MatExpr Multiply(Mat m) => this * m; + public MatExpr Multiply(MatExpr me) => this * me; + public MatExpr Multiply(double s) => this * s; + + public static MatExpr operator /(MatExpr e, Mat m) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + if (m is null) + throw new ArgumentNullException(nameof(m)); + e.ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorDivide_MatExprMat(e.CvPtr, m.CvPtr, out var ret)); + GC.KeepAlive(e); + GC.KeepAlive(m); + return new MatExpr(ret); + } + + public static MatExpr operator /(Mat m, MatExpr e) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + if (e is null) + throw new ArgumentNullException(nameof(e)); + m.ThrowIfDisposed(); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorDivide_MatMatExpr(m.CvPtr, e.CvPtr, out var ret)); + GC.KeepAlive(m); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator /(MatExpr e, double s) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorDivide_MatExprDouble(e.CvPtr, s, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator /(double s, MatExpr e) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorDivide_DoubleMatExpr(s, e.CvPtr, out var ret)); + GC.KeepAlive(e); + return new MatExpr(ret); + } + + public static MatExpr operator /(MatExpr e1, MatExpr e2) + { + if (e1 is null) + throw new ArgumentNullException(nameof(e1)); + if (e2 is null) + throw new ArgumentNullException(nameof(e2)); + e1.ThrowIfDisposed(); + e2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_operatorDivide_MatExprMatExpr(e1.CvPtr, e2.CvPtr, out var ret)); + GC.KeepAlive(e1); + GC.KeepAlive(e2); + return new MatExpr(ret); + } + + public MatExpr Divide(Mat m) => this / m; + public MatExpr Divide(MatExpr me) => this / me; + public MatExpr Divide(double s) => this / s; + +#pragma warning restore 1591 + + #endregion + + #region Methods + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + /// + /// + /// + public MatExpr this[int rowStart, int rowEnd, int colStart, int colEnd] + { + get + { + ThrowIfDisposed(); + return SubMat(rowStart, rowEnd, colStart, colEnd); + } + } + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + /// + public MatExpr this[Range rowRange, Range colRange] + { + get + { + ThrowIfDisposed(); + return SubMat(rowRange, colRange); + } + } + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] + public MatExpr this[Rect roi] + { + get + { + ThrowIfDisposed(); + return SubMat(roi); + } + } + + /// + /// Creates a matrix header for the specified matrix row. + /// + /// A 0-based row index. + /// + public MatExpr Row(int y) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_MatExpr_row(ptr, y, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// Creates a matrix header for the specified matrix column. + /// + /// A 0-based column index. + /// + public MatExpr Col(int x) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_MatExpr_col(ptr, x, out var ret)); + GC.KeepAlive(this); + return new MatExpr(ret); + } + + /// + /// Extracts a diagonal from a matrix + /// + /// d index of the diagonal, with the following values: + /// - d=0 is the main diagonal. + /// - d<0 is a diagonal from the lower half. For example, d=-1 means the diagonal is set immediately below the main one. + /// - d>0 is a diagonal from the upper half. For example, d=1 means the diagonal is set immediately above the main one. + /// + public MatExpr Diag(MatDiagType d = MatDiagType.Main) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_diag(ptr, (int) d, out var ret)); + GC.KeepAlive(this); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + /// + /// + /// + public MatExpr SubMat(int rowStart, int rowEnd, int colStart, int colEnd) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_submat(ptr, rowStart, rowEnd, colStart, colEnd, out var ret)); + GC.KeepAlive(this); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + /// + public MatExpr SubMat(Range rowRange, Range colRange) + { + return SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); + } + + /// + /// Extracts a rectangular submatrix. + /// + /// + /// + public MatExpr SubMat(Rect roi) + { + return SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); + } + + /// + /// Transposes a matrix. + /// + /// + public MatExpr T() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_t(ptr, out var ret)); + GC.KeepAlive(this); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Inverses a matrix. + /// + /// + /// + public MatExpr Inv(DecompTypes method = DecompTypes.LU) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_inv(ptr, (int) method, out var ret)); + GC.KeepAlive(this); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Performs an element-wise multiplication or division of the two matrices. + /// + /// Another array of the same type and the same size as this, or a matrix expression. + /// Optional scale factor. + /// + public MatExpr Mul(MatExpr e, double scale = 1.0) + { + if (e is null) + throw new ArgumentNullException(nameof(e)); + ThrowIfDisposed(); + e.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_mul_toMatExpr(ptr, e.CvPtr, scale, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(e); + var retVal = new MatExpr(ret); + return retVal; + + } + + /// + /// Performs an element-wise multiplication or division of the two matrices. + /// + /// Another array of the same type and the same size as this, or a matrix expression. + /// Optional scale factor. + /// + public MatExpr Mul(Mat m, double scale = 1.0) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_mul_toMat(ptr, m.CvPtr, scale, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + var retVal = new MatExpr(ret); + return retVal; + } + + /// + /// Computes a cross-product of two 3-element vectors. + /// + /// Another cross-product operand. + /// + public Mat Cross(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + + ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_cross(ptr, m.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + var retVal = new Mat(ret); + return retVal; + } + + /// + /// Computes a dot-product of two vectors. + /// + /// another dot-product operand. + /// + public double Dot(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_dot(ptr, m.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + return ret; + } + + /// + /// Returns the size of a matrix element. + /// + public Size Size() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_size(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the type of a matrix element. + /// + public MatType Type() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_MatExpr_type(ptr, out var ret)); + GC.KeepAlive(this); + return (MatType) ret; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs b/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs new file mode 100644 index 000000000..ab6f665db --- /dev/null +++ b/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// +/// +public abstract class MatExprRowColIndexer +{ + /// + /// + protected MatExpr Parent { get; } + + /// + /// + /// + /// + internal protected MatExprRowColIndexer(MatExpr parent) + { + Parent = parent; + } + + /// + /// + /// + /// + /// + public abstract MatExpr this[int pos] { get; } + + /// + /// + /// + /// + /// + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] + public virtual MatExpr Get(int pos) + { + return this[pos]; + } +} diff --git a/src/OpenCvSharp/Modules/core/MatExpr_CvMethods.cs b/src/OpenCvSharp/Modules/core/MatExpr_CvMethods.cs new file mode 100644 index 000000000..7fbfda104 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/MatExpr_CvMethods.cs @@ -0,0 +1,13 @@ +namespace OpenCvSharp; + +partial class MatExpr +{ + /// + /// Computes absolute value of each matrix element + /// + /// + public MatExpr Abs() + { + return Cv2.Abs(this); + } +} diff --git a/src/OpenCvSharp/Modules/core/OutputArray.cs b/src/OpenCvSharp/Modules/core/OutputArray.cs new file mode 100644 index 000000000..b22ceffec --- /dev/null +++ b/src/OpenCvSharp/Modules/core/OutputArray.cs @@ -0,0 +1,298 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +#pragma warning disable CA1002 // Do not expose generic lists + +namespace OpenCvSharp; + +/// +/// Proxy datatype for passing Mat's and List<>'s as output parameters +/// +public class OutputArray : DisposableCvObject +{ + private readonly object obj; + + #region Init & Disposal + + /// + /// Constructor + /// + /// + internal OutputArray(Mat mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + NativeMethods.HandleException( + NativeMethods.core_OutputArray_new_byMat(mat.CvPtr, out ptr)); + GC.KeepAlive(mat); + obj = mat; + } + + /// + /// Constructor + /// + /// + internal OutputArray(UMat mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + NativeMethods.HandleException( + NativeMethods.core_OutputArray_new_byUMat(mat.CvPtr, out ptr)); + GC.KeepAlive(mat); + obj = mat; + } + +#if ENABLED_CUDA + /// + /// + /// + /// + internal OutputArray(GpuMat mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + ptr = NativeMethods.core_OutputArray_new_byGpuMat(mat.CvPtr); + GC.KeepAlive(mat); + obj = mat; + } +#endif + + /// + /// Constructor + /// + /// + internal OutputArray(IEnumerable mat) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + using (var matVector = new VectorOfMat(mat)) + { + NativeMethods.HandleException( + NativeMethods.core_OutputArray_new_byVectorOfMat(matVector.CvPtr, out ptr)); + } + obj = mat; + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_OutputArray_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Cast + + /// + /// + /// + /// + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static implicit operator OutputArray(Mat mat) + { + return new(mat); + } + + /// + /// + /// + /// + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static implicit operator OutputArray(UMat umat) + { + return new(umat); + } + +#if ENABLED_CUDA + /// + /// + /// + /// + /// + public static implicit operator OutputArray(GpuMat mat) + { + return new OutputArray(mat); + } +#endif + + #endregion + + #region Methods + + /// + /// + /// + /// + public bool IsMat() + { + return obj is Mat; + } + + /// + /// + /// + /// + public bool IsUMat() + { + return obj is UMat; + } + + /// + /// + /// + /// + public virtual Mat? GetMat() + { + return obj as Mat; + } + +#if ENABLED_CUDA + /// + /// + /// + /// + public bool IsGpuMat() + { + return obj is GpuMat; + } +#endif + +#if ENABLED_CUDA + /// + /// + /// + /// + public virtual Mat GetGpuMat() + { + return obj as GpuMat; + } +#endif + + /// + /// + /// + /// + public bool IsVectorOfMat() + { + return obj is IEnumerable; + } + + /// + /// + /// + /// + public virtual IEnumerable? GetVectorOfMat() + { + return obj as IEnumerable; + } + + /// + /// + /// + public virtual void AssignResult() + { + if (!IsReady()) + throw new NotSupportedException(); + } + + /// + /// + /// + public void Fix() + { + AssignResult(); + Dispose(); + } + + /// + /// + /// + /// + public bool IsReady() + { + return + ptr != IntPtr.Zero && + !IsDisposed && +#if ENABLED_CUDA + (IsMat() || IsGpuMat()); +#else + IsMat() || IsUMat(); +#endif + } + /// + /// + /// + /// + public void ThrowIfNotReady() + { + if (!IsReady()) + throw new OpenCvSharpException("Invalid OutputArray"); + } + + /// + /// Creates a proxy class of the specified matrix + /// + /// + /// + public static OutputArray Create(Mat mat) + { + return new (mat); + } + + /// + /// Creates a proxy class of the specified matrix + /// + /// + /// + public static OutputArray Create(UMat mat) + { + return new (mat); + } + +#if ENABLED_CUDA + /// + /// Creates a proxy class of the specified matrix + /// + /// + /// + public static OutputArray Create(GpuMat mat) + { + return new OutputArray(mat); + } +#endif + + /// + /// Creates a proxy class of the specified list + /// + /// + /// + /// + public static OutputArrayOfStructList Create(List list) + where T : unmanaged + { + if (list is null) + throw new ArgumentNullException(nameof(list)); + return new OutputArrayOfStructList(list); + } + + /// + /// Creates a proxy class of the specified list + /// + /// + /// + public static OutputArrayOfMatList Create(List list) + { + if (list is null) + throw new ArgumentNullException(nameof(list)); + return new OutputArrayOfMatList(list); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/OutputArrayOfMatList.cs b/src/OpenCvSharp/Modules/core/OutputArrayOfMatList.cs new file mode 100644 index 000000000..a94aa1e3d --- /dev/null +++ b/src/OpenCvSharp/Modules/core/OutputArrayOfMatList.cs @@ -0,0 +1,47 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// Proxy datatype for passing Mat's and List<>'s as output parameters +/// +public sealed class OutputArrayOfMatList : OutputArray +{ + private readonly List list; + + /// + /// + /// + /// + internal OutputArrayOfMatList(List list) + : base(list) + { + this.list = list ?? throw new ArgumentNullException(nameof(list)); + } + + /// + /// + /// + /// + public override IEnumerable GetVectorOfMat() + { + return list; + } + + /// + /// + /// + public override void AssignResult() + { + if (!IsReady()) + throw new NotSupportedException(); + + using var vectorOfMat = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.core_OutputArray_getVectorOfMat(ptr, vectorOfMat.CvPtr)); + GC.KeepAlive(this); + list.Clear(); + list.AddRange(vectorOfMat.ToArray()); + } +} diff --git a/src/OpenCvSharp/Modules/core/OutputArrayOfStructList.cs b/src/OpenCvSharp/Modules/core/OutputArrayOfStructList.cs new file mode 100644 index 000000000..f9afc14d7 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/OutputArrayOfStructList.cs @@ -0,0 +1,52 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// Proxy datatype for passing Mat's and List<>'s as output parameters +/// +public sealed class OutputArrayOfStructList : OutputArray + where T : unmanaged +{ + private readonly List list; + + /// + /// + /// + /// + internal OutputArrayOfStructList(List list) + : base(new Mat()) + { + this.list = list ?? throw new ArgumentNullException(nameof(list)); + } + + /// + /// + /// + public override void AssignResult() + { + if (!IsReady()) + throw new NotSupportedException(); + + NativeMethods.HandleException( + NativeMethods.core_OutputArray_getMat(ptr, out var matPtr)); + GC.KeepAlive(this); + using var mat = new Mat(matPtr); + + var size = mat.Rows * mat.Cols; + var array = new T[size]; + using (var aa = new ArrayAddress1(array)) + { + long bytesToCopy = Marshal.SizeOf() * size; + unsafe + { + Buffer.MemoryCopy(mat.DataPointer, aa.Pointer.ToPointer(), bytesToCopy, bytesToCopy); + } + } + + list.Clear(); + list.AddRange(array); + } +} diff --git a/src/OpenCvSharp/Modules/core/PCA.cs b/src/OpenCvSharp/Modules/core/PCA.cs new file mode 100644 index 000000000..f02e650d2 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/PCA.cs @@ -0,0 +1,365 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Principal Component Analysis +/// +public class PCA : DisposableCvObject +{ + + /// + /// default constructor. + /// + /// The default constructor initializes an empty PCA structure. + /// The other constructors initialize the structure and call PCA::operator()(). + /// + public PCA() + { + NativeMethods.HandleException( + NativeMethods.core_PCA_new1(out ptr)); + } + + /// + /// Constructor + /// + /// input samples stored as matrix rows or matrix columns. + /// optional mean value; if the matrix is empty (@c noArray()), the mean is computed from the data. + /// operation flags; currently the parameter is only used to specify the data layout (PCA::Flags) + /// maximum number of components that PCA should retain; by default, all the components are retained. + public PCA(InputArray data, InputArray mean, Flags flags, int maxComponents = 0) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + data.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_new2(data.CvPtr, mean.CvPtr, (int)flags, maxComponents, out ptr)); + GC.KeepAlive(data); + GC.KeepAlive(mean); + } + + /// + /// Constructor + /// + /// input samples stored as matrix rows or matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// operation flags; currently the parameter is only used to specify the data layout (PCA::Flags) + /// Percentage of variance that PCA should retain. + /// Using this parameter will let the PCA decided how many components to retain but it will always keep at least 2. + public PCA(InputArray data, InputArray mean, Flags flags, double retainedVariance) + { + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + data.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_new3(data.CvPtr, mean.CvPtr, (int)flags, retainedVariance, out ptr)); + GC.KeepAlive(data); + GC.KeepAlive(mean); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_PCA_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// eigenvalues of the covariation matrix + /// + public Mat Eigenvectors + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_eigenvectors(ptr, out var ret)); + GC.KeepAlive(this); + return Mat.FromNativePointer(ret); + } + } + + /// + /// eigenvalues of the covariation matrix + /// + public Mat Eigenvalues + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_eigenvalues(ptr, out var ret)); + GC.KeepAlive(this); + return Mat.FromNativePointer(ret); + } + } + + /// + /// mean value subtracted before the projection and added after the back projection + /// + public Mat Mean + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_mean(ptr, out var ret)); + GC.KeepAlive(this); + return Mat.FromNativePointer(ret); + } + } + + /// + /// Performs PCA. + /// + /// The operator performs %PCA of the supplied dataset. It is safe to reuse + /// the same PCA structure for multiple datasets. That is, if the structure + /// has been previously used with another dataset, the existing internal + /// data is reclaimed and the new @ref eigenvalues, @ref eigenvectors and @ref + /// mean are allocated and computed. + /// + /// The computed @ref eigenvalues are sorted from the largest to the smallest and + /// the corresponding @ref eigenvectors are stored as eigenvectors rows. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), the mean is computed from the data. + /// operation flags; currently the parameter is only used to specify the data layout. (Flags) + /// maximum number of components that PCA should retain; + /// by default, all the components are retained. + /// + public PCA Compute(InputArray data, InputArray mean, Flags flags, int maxComponents = 0) + { + ThrowIfDisposed(); + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + data.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_operatorThis(ptr, data.CvPtr, mean.CvPtr, (int)flags, maxComponents)); + GC.KeepAlive(data); + GC.KeepAlive(mean); + return this; + } + + /// + /// Performs PCA. + /// + /// The operator performs %PCA of the supplied dataset. It is safe to reuse + /// the same PCA structure for multiple datasets. That is, if the structure + /// has been previously used with another dataset, the existing internal + /// data is reclaimed and the new @ref eigenvalues, @ref eigenvectors and @ref + /// mean are allocated and computed. + /// + /// The computed @ref eigenvalues are sorted from the largest to the smallest and + /// the corresponding @ref eigenvectors are stored as eigenvectors rows. + /// + /// input samples stored as the matrix rows or as the matrix columns. + /// optional mean value; if the matrix is empty (noArray()), + /// the mean is computed from the data. + /// operation flags; currently the parameter is only used to + /// specify the data layout. (PCA::Flags) + /// Percentage of variance that %PCA should retain. + /// Using this parameter will let the %PCA decided how many components to + /// retain but it will always keep at least 2. + /// + public PCA ComputeVar(InputArray data, InputArray mean, Flags flags, double retainedVariance) + { + ThrowIfDisposed(); + if (data is null) + throw new ArgumentNullException(nameof(data)); + if (mean is null) + throw new ArgumentNullException(nameof(mean)); + data.ThrowIfDisposed(); + mean.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_computeVar(ptr, data.CvPtr, mean.CvPtr, (int)flags, retainedVariance)); + GC.KeepAlive(data); + GC.KeepAlive(mean); + return this; + } + + /// + /// Projects vector(s) to the principal component subspace. + /// + /// The methods project one or more vectors to the principal component + /// subspace, where each vector projection is represented by coefficients in + /// the principal component basis. The first form of the method returns the + /// matrix that the second form writes to the result. So the first form can + /// be used as a part of expression while the second form can be more + /// efficient in a processing loop. + /// + /// input vector(s); must have the same dimensionality and the + /// same layout as the input data used at %PCA phase, that is, if + /// DATA_AS_ROW are specified, then `vec.cols==data.cols` + /// (vector dimensionality) and `vec.rows` is the number of vectors to + /// project, and the same is true for the PCA::DATA_AS_COL case. + /// + public Mat Project(InputArray vec) + { + ThrowIfDisposed(); + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + vec.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_project1(ptr, vec.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(vec); + return Mat.FromNativePointer(ret); + } + + /// + /// Projects vector(s) to the principal component subspace. + /// + /// input vector(s); must have the same dimensionality and the + /// same layout as the input data used at PCA phase, that is, if DATA_AS_ROW are + /// specified, then `vec.cols==data.cols` (vector dimensionality) and `vec.rows` + /// is the number of vectors to project, and the same is true for the PCA::DATA_AS_COL case. + /// output vectors; in case of PCA::DATA_AS_COL, the + /// output matrix has as many columns as the number of input vectors, this + /// means that `result.cols==vec.cols` and the number of rows match the + /// number of principal components (for example, `maxComponents` parameter + /// passed to the constructor). + public void Project(InputArray vec, OutputArray result) + { + ThrowIfDisposed(); + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + vec.ThrowIfDisposed(); + result.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_PCA_project2(ptr, vec.CvPtr, result.CvPtr)); + result.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(vec); + GC.KeepAlive(result); + } + + /// + /// Reconstructs vectors from their PC projections. + /// + /// The methods are inverse operations to PCA::project. They take PC + /// coordinates of projected vectors and reconstruct the original vectors. + /// Unless all the principal components have been retained, the + /// reconstructed vectors are different from the originals. But typically, + /// the difference is small if the number of components is large enough (but + /// still much smaller than the original vector dimensionality). As a result, PCA is used. + /// + /// coordinates of the vectors in the principal component subspace, + /// the layout and size are the same as of PCA::project output vectors. + /// + public Mat BackProject(InputArray vec) + { + ThrowIfDisposed(); + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + vec.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_PCA_backProject1(ptr, vec.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(vec); + return new Mat(ret); + } + + /// + /// Reconstructs vectors from their PC projections. + /// + /// The methods are inverse operations to PCA::project. They take PC + /// coordinates of projected vectors and reconstruct the original vectors. + /// Unless all the principal components have been retained, the + /// reconstructed vectors are different from the originals. But typically, + /// the difference is small if the number of components is large enough (but + /// still much smaller than the original vector dimensionality). As a result, PCA is used. + /// + /// coordinates of the vectors in the principal component subspace, + /// the layout and size are the same as of PCA::project output vectors. + /// reconstructed vectors; the layout and size are the same as + /// of PCA::project input vectors. + public void BackProject(InputArray vec, OutputArray result) + { + ThrowIfDisposed(); + if (vec is null) + throw new ArgumentNullException(nameof(vec)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + vec.ThrowIfDisposed(); + result.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_PCA_backProject2(ptr, vec.CvPtr, result.CvPtr)); + result.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(vec); + GC.KeepAlive(result); + } + + /// + /// Write PCA objects. + /// Writes @ref eigenvalues @ref eigenvectors and @ref mean to specified FileStorage + /// + /// + public void Write(FileStorage fs) + { + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + fs.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_PCA_write(ptr, fs.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(fs); + } + + /// + /// Load PCA objects. + /// Loads @ref eigenvalues @ref eigenvectors and @ref mean from specified FileNode + /// + /// + public void Read(FileNode fn) + { + if (fn is null) + throw new ArgumentNullException(nameof(fn)); + fn.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_PCA_read(ptr, fn.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(fn); + } + +#pragma warning disable CA1008 // Enums should have zero value + /// + /// Flags for PCA operations + /// + [Flags] + public enum Flags + { + /// + /// The vectors are stored as rows (i.e. all the components of a certain vector are stored continously) + /// + DataAsRow = 0, + + /// + /// The vectors are stored as columns (i.e. values of a certain vector component are stored continuously) + /// + DataAsCol = 1, + + /// + /// Use pre-computed average vector + /// + UseAvg = 2, + } +} diff --git a/src/OpenCvSharp/Modules/core/RNG.cs b/src/OpenCvSharp/Modules/core/RNG.cs new file mode 100644 index 000000000..bda856d2f --- /dev/null +++ b/src/OpenCvSharp/Modules/core/RNG.cs @@ -0,0 +1,355 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Random Number Generator. +/// The class implements RNG using Multiply-with-Carry algorithm. +/// +/// operations.hpp +[StructLayout(LayoutKind.Sequential)] +public struct RNG : IEquatable +{ + private ulong state; + + /// + /// + public ulong State + { + get => state; + set => state = value; + } + + /// + /// Constructor + /// + /// 64-bit value used to initialize the RNG. + public RNG(ulong state = 0xffffffff) + { + this.state = (state != 0) ? state : 0xffffffff; + } + + #region Cast + + /// + /// (byte)RNG.next() + /// + /// + /// + public static explicit operator byte(RNG self) + { + return self.ToByte(); + } + + /// + /// (byte)RNG.next() + /// + /// + public byte ToByte() + { + return (byte) Next(); + } + + /// + /// (sbyte)RNG.next() + /// + /// + /// + public static explicit operator sbyte(RNG self) + { + return self.ToSByte(); + } + + /// + /// (sbyte)RNG.next() + /// + /// + public sbyte ToSByte() + { + return (sbyte) Next(); + } + + /// + /// (ushort)RNG.next() + /// + /// + /// + public static explicit operator ushort(RNG self) + { + return self.ToUInt16(); + } + + /// + /// (ushort)RNG.next() + /// + /// + public ushort ToUInt16() + { + return (ushort) Next(); + } + + /// + /// (short)RNG.next() + /// + /// + /// + public static explicit operator short(RNG self) + { + return self.ToInt16(); + } + + /// + /// (short)RNG.next() + /// + /// + public short ToInt16() + { + return (short) Next(); + } + + /// + /// (uint)RNG.next() + /// + /// + /// + public static explicit operator uint(RNG self) + { + return self.Next(); + } + + /// + /// (uint)RNG.next() + /// + /// + public uint ToUInt32() + { + return Next(); + } + + /// + /// (int)RNG.next() + /// + /// + /// + public static explicit operator int(RNG self) + { + return self.ToInt32(); + } + + /// + /// (int)RNG.next() + /// + /// + public int ToInt32() + { + return (int) Next(); + } + + /// + /// returns a next random value as float (System.Single) + /// + /// + /// + public static explicit operator float(RNG self) + { + return self.ToSingle(); + } + + /// + /// returns a next random value as float (System.Single) + /// + /// + public float ToSingle() + { + return Next() * 2.3283064365386962890625e-10f; + } + + /// + /// returns a next random value as double (System.Double) + /// + /// + /// + public static explicit operator double(RNG self) + { + return self.ToDouble(); + } + + /// + /// returns a next random value as double (System.Double) + /// + /// + public double ToDouble() + { + var t = Next(); + return (((ulong)t << 32) | Next()) * 5.4210108624275221700372640043497e-20; + } + + #endregion + + #region Methods + + /// + /// updates the state and returns the next 32-bit unsigned integer random number + /// + /// + public uint Next() + { + state = (ulong)(uint)State * /*CV_RNG_COEFF*/ 4164903690U + (uint)(State >> 32); + return (uint)State; + } + + /// + /// returns a random integer sampled uniformly from [0, N). + /// + /// + /// + public uint Run(uint n) + { + return (uint)Uniform(0, n); + } + + /// + /// + /// + /// + public uint Run() + { + return Next(); + } + + /// + /// returns uniformly distributed integer random number from [a,b) range + /// + /// + /// + /// + public int Uniform(int a, int b) + { + return a == b ? a : (int)(Next() % (b - a) + a); + } + + /// + /// returns uniformly distributed floating-point random number from [a,b) range + /// + /// + /// + /// + public float Uniform(float a, float b) + { + return ((float)this) * (b - a) + a; + } + + /// + /// returns uniformly distributed double-precision floating-point random number from [a,b) range + /// + /// + /// + /// + public double Uniform(double a, double b) + { + return ((double)this) * (b - a) + a; + } + + /// + /// Fills arrays with random numbers. + /// + /// 2D or N-dimensional matrix; currently matrices with more than + /// 4 channels are not supported by the methods, use Mat::reshape as a possible workaround. + /// distribution type, RNG::UNIFORM or RNG::NORMAL. + /// first distribution parameter; in case of the uniform distribution, + /// this is an inclusive lower boundary, in case of the normal distribution, this is a mean value. + /// second distribution parameter; in case of the uniform distribution, this is + /// a non-inclusive upper boundary, in case of the normal distribution, this is a standard deviation + /// (diagonal of the standard deviation matrix or the full standard deviation matrix). + /// pre-saturation flag; for uniform distribution only; + /// if true, the method will first convert a and b to the acceptable value range (according to the + /// mat datatype) and then will generate uniformly distributed random numbers within the range + /// [saturate(a), saturate(b)), if saturateRange=false, the method will generate uniformly distributed + /// random numbers in the original range [a, b) and then will saturate them, it means, for example, that + /// theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX) will likely produce array mostly filled + /// with 0's and 255's, since the range (0, 255) is significantly smaller than [-DBL_MAX, DBL_MAX). + public void Fill( + InputOutputArray mat, + DistributionType distType, + InputArray a, + InputArray b, + bool saturateRange = false) + { + if (mat is null) + throw new ArgumentNullException(nameof(mat)); + if (a is null) + throw new ArgumentNullException(nameof(a)); + if (b is null) + throw new ArgumentNullException(nameof(b)); + mat.ThrowIfNotReady(); + a.ThrowIfDisposed(); + b.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_RNG_fill(ref state, mat.CvPtr, (int) distType, a.CvPtr, b.CvPtr, saturateRange ? 1 : 0)); + + mat.Fix(); + GC.KeepAlive(mat); + GC.KeepAlive(a); + GC.KeepAlive(b); + } + + /// + /// Returns the next random number sampled from the Gaussian distribution. + /// + /// The method transforms the state using the MWC algorithm and returns the next random number + /// from the Gaussian distribution N(0,sigma) . That is, the mean value of the returned random + /// numbers is zero and the standard deviation is the specified sigma. + /// + /// standard deviation of the distribution. + /// + public double Gaussian(double sigma) + { + NativeMethods.HandleException( + NativeMethods.core_RNG_gaussian(ref state, sigma, out double returnValue)); + return returnValue; + } + + /// + public override bool Equals(object? obj) + { + if (obj is RNG rng) + return Equals(rng); + return false; + } + + /// + public bool Equals(RNG other) + { + return state == other.state; + } + + /// + public override int GetHashCode() + { + return state.GetHashCode(); + } + + /// + /// + /// + /// + /// + public static bool operator ==(RNG left, RNG right) + { + return left.Equals(right); + } + + /// + /// + /// + /// + /// + public static bool operator !=(RNG left, RNG right) + { + return !(left == right); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/RNG_MT19937.cs b/src/OpenCvSharp/Modules/core/RNG_MT19937.cs new file mode 100644 index 000000000..4163af78d --- /dev/null +++ b/src/OpenCvSharp/Modules/core/RNG_MT19937.cs @@ -0,0 +1,224 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Mersenne Twister random number generator +/// +/// operations.hpp +// ReSharper disable once InconsistentNaming +[SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] +public struct RNG_MT19937 +{ + private const int N = 624, M = 397; + + private readonly uint[] state; + private int mti; + + /// + /// Constructor + /// + /// + public RNG_MT19937(uint s = 5489U) + { + state = new uint[N]; + mti = 0; + Seed(s); + } + + #region Cast + + /// + /// + /// + /// + public static explicit operator uint(RNG_MT19937 self) + { + return self.Next(); + } + + /// + /// + /// + public uint ToUInt32() + { + return Next(); + } + + /// + /// + /// + /// + /// + public static explicit operator int(RNG_MT19937 self) + { + return self.ToInt32(); + } + + /// + /// + /// + public int ToInt32() + { + return (int)Next(); + } + + /// + /// + /// + /// + /// + public static explicit operator float(RNG_MT19937 self) + { + return self.ToSingle(); + } + + /// + /// + /// + public float ToSingle() + { + return Next() * (1.0f / 4294967296.0f); + } + + /// + /// + /// + /// + /// + public static explicit operator double(RNG_MT19937 self) + { + return self.ToDouble(); + } + + /// + /// + /// + public double ToDouble() + { + var a = Next() >> 5; + var b = Next() >> 6; + return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); + } + + #endregion + + #region Methods + + /// + /// + /// + /// + public void Seed(uint s) + { + state[0] = s; + for (mti = 1; mti < N; mti++) + { + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + state[mti] = (uint) (1812433253U * (state[mti - 1] ^ (state[mti - 1] >> 30)) + mti); + } + } + + /// + /// updates the state and returns the next 32-bit unsigned integer random number + /// + /// + public uint Next() + { + /* mag01[x] = x * MATRIX_A for x=0,1 */ + uint[] mag01 = [0x0U, /*MATRIX_A*/ 0x9908b0dfU]; + + const uint upperMask = 0x80000000U; + const uint lowerMask = 0x7fffffffU; + const int n = N; + const int m = M; + + /* generate N words at one time */ + uint y; + if (mti >= n) + { + var kk = 0; + + for (; kk < n - m; ++kk) + { + y = (state[kk] & upperMask) | (state[kk + 1] & lowerMask); + state[kk] = state[kk + m] ^ (y >> 1) ^ mag01[y & 0x1U]; + } + + for (; kk < n - 1; ++kk) + { + y = (state[kk] & upperMask) | (state[kk + 1] & lowerMask); + state[kk] = state[kk + (m - n)] ^ (y >> 1) ^ mag01[y & 0x1U]; + } + + y = (state[n - 1] & upperMask) | (state[0] & lowerMask); + state[n - 1] = state[m - 1] ^ (y >> 1) ^ mag01[y & 0x1U]; + + mti = 0; + } + + y = state[mti++]; + + /* Tempering */ + y ^= (y >> 11); + y ^= (y << 7) & 0x9d2c5680U; + y ^= (y << 15) & 0xefc60000U; + y ^= (y >> 18); + + return y; + } + + /// + /// returns a random integer sampled uniformly from [0, N). + /// + /// + /// + public uint Run(uint b) + { + return Next() % b; + } + + /// + /// + /// + /// + public uint Run() + { + return Next(); + } + + /// + /// returns uniformly distributed integer random number from [a,b) range + /// + /// + /// + /// + public int Uniform(int a, int b) + { + return (int)(Next() % (b - a) + a); + } + + /// + /// returns uniformly distributed floating-point random number from [a,b) range + /// + /// + /// + /// + public float Uniform(float a, float b) + { + return ((float)this) * (b - a) + a; + } + + /// + /// returns uniformly distributed double-precision floating-point random number from [a,b) range + /// + /// + /// + /// + public double Uniform(double a, double b) + { + return ((double)this) * (b - a) + a; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/SVD.cs b/src/OpenCvSharp/Modules/core/SVD.cs new file mode 100644 index 000000000..3dc5b2d9b --- /dev/null +++ b/src/OpenCvSharp/Modules/core/SVD.cs @@ -0,0 +1,264 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Singular Value Decomposition class +/// +// ReSharper disable once InconsistentNaming +public class SVD : DisposableCvObject +{ + /// + /// the default constructor + /// + public SVD() + { + NativeMethods.HandleException( + NativeMethods.core_SVD_new1(out ptr)); + } + /// + /// the constructor that performs SVD + /// + /// + /// + public SVD(InputArray src, Flags flags = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SVD_new2(src.CvPtr, (int)flags, out ptr)); + GC.KeepAlive(src); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_SVD_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// eigenvalues of the covariation matrix + /// + public Mat U() + { + + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SVD_u(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// eigenvalues of the covariation matrix + /// + public Mat W() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SVD_w(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// mean value subtracted before the projection and added after the back projection + /// + public Mat Vt() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SVD_vt(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// the operator that performs SVD. The previously allocated SVD::u, SVD::w are SVD::vt are released. + /// + /// + /// + /// + public SVD Run(InputArray src, Flags flags = 0) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SVD_operatorThis(ptr, src.CvPtr, (int)flags)); + GC.KeepAlive(src); + return this; + } + + /// + /// performs back substitution, so that dst is the solution or pseudo-solution of m*dst = rhs, where m is the decomposed matrix + /// + /// + /// + /// + public void BackSubst(InputArray rhs, OutputArray dst) + { + ThrowIfDisposed(); + if (rhs is null) + throw new ArgumentNullException(nameof(rhs)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + rhs.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_SVD_backSubst(ptr, rhs.CvPtr, dst.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(rhs); + GC.KeepAlive(dst); + } + + /// + /// decomposes matrix and stores the results to user-provided matrices + /// + /// + /// + /// + /// + /// + public static void Compute(InputArray src, OutputArray w, + OutputArray u, OutputArray vt, Flags flags = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (w is null) + throw new ArgumentNullException(nameof(w)); + if (u is null) + throw new ArgumentNullException(nameof(u)); + if (vt is null) + throw new ArgumentNullException(nameof(vt)); + src.ThrowIfDisposed(); + w.ThrowIfNotReady(); + u.ThrowIfNotReady(); + vt.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_SVD_static_compute1(src.CvPtr, w.CvPtr, u.CvPtr, vt.CvPtr, (int)flags)); + w.Fix(); + u.Fix(); + vt.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(w); + GC.KeepAlive(u); + GC.KeepAlive(vt); + } + + /// + /// computes singular values of a matrix + /// + /// + /// + /// + public static void Compute(InputArray src, OutputArray w, Flags flags = 0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (w is null) + throw new ArgumentNullException(nameof(w)); + src.ThrowIfDisposed(); + w.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_SVD_static_compute2(src.CvPtr, w.CvPtr, (int)flags)); + w.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(w); + } + + /// + /// performs back substitution + /// + /// + /// + /// + /// + /// + public static void BackSubst(InputArray w, InputArray u, + InputArray vt, InputArray rhs, OutputArray dst) + { + if (w is null) + throw new ArgumentNullException(nameof(w)); + if (u is null) + throw new ArgumentNullException(nameof(u)); + if (vt is null) + throw new ArgumentNullException(nameof(vt)); + if (rhs is null) + throw new ArgumentNullException(nameof(rhs)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + w.ThrowIfDisposed(); + u.ThrowIfDisposed(); + vt.ThrowIfDisposed(); + rhs.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_SVD_static_backSubst(w.CvPtr, u.CvPtr, vt.CvPtr, rhs.CvPtr, dst.CvPtr)); + dst.Fix(); + GC.KeepAlive(w); + GC.KeepAlive(u); + GC.KeepAlive(vt); + GC.KeepAlive(rhs); + GC.KeepAlive(dst); + } + + /// + /// finds dst = arg min_{|dst|=1} |m*dst| + /// + /// + /// + public static void SolveZ(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.core_SVD_static_solveZ(src.CvPtr, dst.CvPtr)); + dst.Fix(); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// Operation flags for SVD + /// + [Flags] + public enum Flags + { + /// + /// + /// + None = 0, + + /// + /// enables modification of matrix src1 during the operation. It speeds up the processing. + /// + ModifyA = 1, + + /// + /// indicates that only a vector of singular values `w` is to be processed, + /// while u and vt will be set to empty matrices + /// + // ReSharper disable once InconsistentNaming + NoUV = 2, + + /// + /// when the matrix is not square, by default the algorithm produces u and + /// vt matrices of sufficiently large size for the further A reconstruction; + /// if, however, FULL_UV flag is specified, u and vt will be full-size square + /// orthogonal matrices. + /// + // ReSharper disable once InconsistentNaming + FullUV = 4, + } +} diff --git a/src/OpenCvSharp/Modules/core/SparseMat.cs b/src/OpenCvSharp/Modules/core/SparseMat.cs new file mode 100644 index 000000000..630a05a58 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/SparseMat.cs @@ -0,0 +1,977 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Sparse matrix class. +/// +public class SparseMat : DisposableCvObject +{ + #region Init & Disposal + + /// + /// Creates from native cv::SparseMat* pointer + /// + /// + public SparseMat(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Native object address is NULL"); + this.ptr = ptr; + } + + /// + /// Creates empty SparseMat + /// + public SparseMat() + { + NativeMethods.HandleException( + NativeMethods.core_SparseMat_new1(out ptr)); + } + + /// + /// constructs n-dimensional sparse matrix + /// + /// Array of integers specifying an n-dimensional array shape. + /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, + /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public SparseMat(IEnumerable sizes, MatType type) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + + var sizesArray = sizes as int[] ?? sizes.ToArray(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_new2(sizesArray.Length, sizesArray, type, out ptr)); + } + + /// + /// converts old-style CvMat to the new matrix; the data is not copied by default + /// + /// cv::Mat object + public SparseMat(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + m.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_new3(m.CvPtr, out ptr)); + + GC.KeepAlive(m); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException(); + } + + /// + /// Releases the resources + /// + public void Release() + { + Dispose(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.core_SparseMat_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Create SparseMat from Mat + /// + /// + /// + public static SparseMat FromMat(Mat mat) + { + return new SparseMat(mat); + } + + #endregion + + #region Public Methods + + /// + /// Assignment operator. This is O(1) operation, i.e. no data is copied + /// + /// + /// + public SparseMat AssignFrom(SparseMat m) + { + ThrowIfDisposed(); + if(m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_operatorAssign_SparseMat(ptr, m.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + return this; + } + + /// + /// Assignment operator. equivalent to the corresponding constructor. + /// + /// + /// + public SparseMat AssignFrom(Mat m) + { + ThrowIfDisposed(); + if (m is null) + throw new ArgumentNullException(nameof(m)); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_operatorAssign_Mat(ptr, m.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + return this; + } + + /// + /// creates full copy of the matrix + /// + /// + public SparseMat Clone() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_clone(ptr, out var p)); + + GC.KeepAlive(this); + return new SparseMat(p); + } + + /// + /// copies all the data to the destination matrix. All the previous content of m is erased. + /// + /// + public void CopyTo(SparseMat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_copyTo_SparseMat(ptr, m.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// converts sparse matrix to dense matrix. + /// + /// + public void CopyTo(Mat m) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_copyTo_Mat(ptr, m.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type + /// + /// + /// + /// + public void ConvertTo(SparseMat m, MatType rtype, double alpha = 1) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_convertTo_SparseMat(ptr, m.CvPtr, rtype, alpha)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// converts sparse matrix to dense n-dim matrix with optional type conversion and scaling. + /// + /// + /// The output matrix data type. When it is =-1, the output array will have the same data type as (*this) + /// The scale factor + /// The optional delta added to the scaled values before the conversion + public void ConvertTo(Mat m, MatType rtype, double alpha = 1, double beta = 0) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_convertTo_Mat(ptr, m.CvPtr, rtype, alpha, beta)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// not used now + /// + /// + /// + public void AssignTo(SparseMat m, MatType? type = null) + { + if (m is null) + throw new ArgumentNullException(nameof(m)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_assignTo(ptr, m.CvPtr, type?.Value ?? -1)); + + GC.KeepAlive(this); + GC.KeepAlive(m); + } + + /// + /// Reallocates sparse matrix. + /// If the matrix already had the proper size and type, + /// it is simply cleared with clear(), otherwise, + /// the old matrix is released (using release()) and the new one is allocated. + /// + /// + /// + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public void Create(MatType type, params int[] sizes) + { + ThrowIfDisposed(); + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + if (sizes.Length == 1) + throw new ArgumentException("sizes is empty"); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_create(ptr, sizes.Length, sizes, type)); + + GC.KeepAlive(this); + } + + /// + /// sets all the sparse matrix elements to 0, which means clearing the hash table. + /// + public void Clear() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_clear(ptr)); + GC.KeepAlive(this); + } + + /// + /// manually increments the reference counter to the header. + /// + public void AddRef() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_addref(ptr)); + GC.KeepAlive(this); + } + + /// + /// returns the size of each element in bytes (not including the overhead - the space occupied by SparseMat::Node elements) + /// + /// + public int ElemSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_elemSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// returns elemSize()/channels() + /// + /// + public int ElemSize1() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_elemSize1(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the type of sparse matrix element. + /// + /// + public MatType Type() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_type(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the depth of sparse matrix element. + /// + /// + public int Depth() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_depth(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the matrix dimensionality + /// + public int Dims() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_dims(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the number of sparse matrix channels. + /// + /// + public int Channels() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_channels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the array of sizes, or null if the matrix is not allocated + /// + /// + public int[] Size() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.core_SparseMat_size1(ptr, out var sizePtr)); + if (sizePtr == IntPtr.Zero) + throw new OpenCvSharpException("core_SparseMat_size1 == IntPtr.Zero"); + + var length = Dims(); + var size = new int[length]; + Marshal.Copy(sizePtr, size, 0, length); + GC.KeepAlive(this); + return size; + } + + /// + /// Returns the size of i-th matrix dimension (or 0) + /// + /// + /// + public int Size(int dim) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_size2(ptr, dim, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// returns the number of non-zero elements (=the number of hash table nodes) + /// + /// + public long NzCount() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_nzcount(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + #region Hash + + /// + /// Computes the element hash value (1D case) + /// + /// Index along the dimension 0 + /// + public long Hash(int i0) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_hash_1d(ptr, i0, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Computes the element hash value (2D case) + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// + public long Hash(int i0, int i1) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_hash_2d(ptr, i0, i1, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Computes the element hash value (3D case) + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// + public long Hash(int i0, int i1, int i2) + { + ThrowIfDisposed(); + NativeMethods.HandleException(NativeMethods.core_SparseMat_hash_3d(ptr, i0, i1, i2, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + /// + /// Computes the element hash value (nD case) + /// + /// Array of Mat::dims indices. + /// + public long Hash(params int[] idx) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.core_SparseMat_hash_nd(ptr, idx, out var ret)); + GC.KeepAlive(this); + return ret.ToInt64(); + } + + #endregion + + #region Ptr + + /// + /// Low-level element-access function. + /// + /// Index along the dimension 0 + /// Create new element with 0 value if it does not exist in SparseMat. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public unsafe IntPtr Ptr(int i0, bool createMissing, long? hashVal = null) + { + IntPtr ret; + //ThrowIfDisposed(); + if (hashVal.HasValue) + { + var hashVal0 = (ulong)hashVal.Value; + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_1d( + ptr, i0, createMissing ? 1 : 0, &hashVal0, out ret)); + } + else + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_1d( + ptr, i0, createMissing ? 1 : 0, null, out ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Low-level element-access function. + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Create new element with 0 value if it does not exist in SparseMat. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public unsafe IntPtr Ptr(int i0, int i1, bool createMissing, long? hashVal = null) + { + IntPtr ret; + //ThrowIfDisposed(); + if (hashVal.HasValue) + { + var hashVal0 = (ulong)hashVal.Value; + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_2d( + ptr, i0, i1, createMissing ? 1 : 0, &hashVal0, out ret)); + } + else + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_2d( + ptr, i0, i1, createMissing ? 1 : 0, null, out ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Low-level element-access function. + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// Create new element with 0 value if it does not exist in SparseMat. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public unsafe IntPtr Ptr(int i0, int i1, int i2, bool createMissing, long? hashVal = null) + { + IntPtr ret; + //ThrowIfDisposed(); + if (hashVal.HasValue) + { + var hashVal0 = (ulong)hashVal.Value; + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_3d( + ptr, i0, i1, i2, createMissing ? 1 : 0, &hashVal0, out ret)); + } + else + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_3d( + ptr, i0, i1, i2, createMissing ? 1 : 0, null, out ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Low-level element-access function. + /// + /// Array of Mat::dims indices. + /// Create new element with 0 value if it does not exist in SparseMat. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public unsafe IntPtr Ptr(int[] idx, bool createMissing, long? hashVal = null) + { + IntPtr ret; + //ThrowIfDisposed(); + if (hashVal.HasValue) + { + var hashVal0 = (ulong)hashVal.Value; + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_nd( + ptr, idx, createMissing ? 1 : 0, &hashVal0, out ret)); + } + else + NativeMethods.HandleException( + NativeMethods.core_SparseMat_ptr_nd( + ptr, idx, createMissing ? 1 : 0, null, out ret)); + GC.KeepAlive(this); + return ret; + } + + #endregion + + #region Find + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, null. + /// + /// Index along the dimension 0 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T? Find(int i0, long? hashVal = null) + where T : struct + { + var p = Ptr(i0, false, hashVal); + if (p == IntPtr.Zero) + return null; + + return Marshal.PtrToStructure(p); + } + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, null. + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T? Find(int i0, int i1, long? hashVal = null) + where T : struct + { + var p = Ptr(i0, i1, false, hashVal); + if (p == IntPtr.Zero) + return null; + + return Marshal.PtrToStructure(p); + } + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, null. + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T? Find(int i0, int i1, int i2, long? hashVal = null) + where T : struct + { + var p = Ptr(i0, i1, i2, false, hashVal); + if (p == IntPtr.Zero) + return null; + + return Marshal.PtrToStructure(p); + } + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, null. + /// + /// Array of Mat::dims indices. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T? Find(int[] idx, long? hashVal = null) + where T : struct + { + var p = Ptr(idx, false, hashVal); + if (p == IntPtr.Zero) + return null; + + return Marshal.PtrToStructure(p); + } + + #endregion + + #region Value + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). + /// + /// Index along the dimension 0 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T Value(int i0, long? hashVal = null) + where T : struct + { + var p = Ptr(i0, false, hashVal); + if (p == IntPtr.Zero) + return default; + + return Marshal.PtrToStructure(p); + } + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T Value(int i0, int i1, long? hashVal = null) + where T : struct + { + var p = Ptr(i0, i1, false, hashVal); + if (p == IntPtr.Zero) + return default; + + return Marshal.PtrToStructure(p); + } + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T Value(int i0, int i1, int i2, long? hashVal = null) + where T : struct + { + var p = Ptr(i0, i1, i2, false, hashVal); + if (p == IntPtr.Zero) + return default; + + return Marshal.PtrToStructure(p); + } + + /// + /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). + /// + /// Array of Mat::dims indices. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// + public T Value(int[] idx, long? hashVal = null) + where T : struct + { + var p = Ptr(idx, false, hashVal); + if (p == IntPtr.Zero) + return default; + + return Marshal.PtrToStructure(p); + } + + #endregion + + #region Element Indexer + +#pragma warning disable CA1034 + /// + /// Mat Indexer + /// + /// + public sealed class Indexer : SparseMatIndexer where T : struct + { + internal Indexer(SparseMat parent) + : base(parent) + { + } + + /// + /// 1-dimensional indexer + /// + /// Index along the dimension 0 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public override T this[int i0, long? hashVal = null] + { + get + { + var p = Parent.Ptr(i0, true, hashVal); + return Marshal.PtrToStructure(p); + } + set + { + var p = Parent.Ptr(i0, true, hashVal); + Marshal.StructureToPtr(value, p, false); + } + } + + /// + /// 2-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public override T this[int i0, int i1, long? hashVal = null] + { + get + { + var p = Parent.Ptr(i0, i1, true, hashVal); + return Marshal.PtrToStructure(p); + } + set + { + var p = Parent.Ptr(i0, i1, true, hashVal); + Marshal.StructureToPtr(value, p, false); + } + } + + /// + /// 3-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public override T this[int i0, int i1, int i2, long? hashVal = null] + { + get + { + var p = Parent.Ptr(i0, i1, i2, true, hashVal); + return Marshal.PtrToStructure(p); + } + set + { + var p = Parent.Ptr(i0, i1, i2, true, hashVal); + Marshal.StructureToPtr(value, p, false); + } + } + + /// + /// n-dimensional indexer + /// + /// Array of Mat::dims indices. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public override T this[int[] idx, long? hashVal = null] + { + get + { + var p = Parent.Ptr(idx, true, hashVal); + return Marshal.PtrToStructure(p); + } + set + { + var p = Parent.Ptr(idx, true, hashVal); + Marshal.StructureToPtr(value, p, false); + } + } + } + + /// + /// Gets a type-specific indexer. + /// The indexer has getters/setters to access each matrix element. + /// + /// + /// + public Indexer Ref() where T : struct + { + return new Indexer(this); + } + + /// + /// Gets a type-specific indexer. + /// The indexer has getters/setters to access each matrix element. + /// + /// + /// + public Indexer GetIndexer() where T : struct + { + return new Indexer(this); + } + + #endregion + + #region Get/Set + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public T Get(int i0, long? hashVal = null) where T : struct + { + return new Indexer(this)[i0, hashVal]; + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public T Get(int i0, int i1, long? hashVal = null) where T : struct + { + return new Indexer(this)[i0, i1, hashVal]; + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public T Get(int i0, int i1, int i2, long? hashVal = null) where T : struct + { + return new Indexer(this)[i0, i1, i2, hashVal]; + } + + /// + /// Returns a value to the specified array element. + /// + /// + /// Array of Mat::dims indices. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public T Get(int[] idx, long? hashVal = null) where T : struct + { + return new Indexer(this)[idx, hashVal]; + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// + /// + public void Set(int i0, T value, long? hashVal = null) where T : struct + { + (new Indexer(this))[i0, hashVal] = value; + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + public void Set(int i0, int i1, T value, long? hashVal = null) where T : struct + { + (new Indexer(this))[i0, i1, hashVal] = value; + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + public void Set(int i0, int i1, int i2, T value, long? hashVal = null) where T : struct + { + (new Indexer(this)[i0, i1, i2, hashVal]) = value; + } + + /// + /// Set a value to the specified array element. + /// + /// + /// Array of Mat::dims indices. + /// + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + public void Set(int[] idx, T value, long? hashVal = null) where T : struct + { + (new Indexer(this)[idx, hashVal]) = value; + } + + #endregion + + #region ToString + + /// + /// Returns a string that represents this Mat. + /// + /// + public override string ToString() + { + return "Mat [ " + + "Dims=" + Dims() + + "Type=" + Type().ToString() + + " ]"; + } + + #endregion + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/SparseMatIndexer.cs b/src/OpenCvSharp/Modules/core/SparseMatIndexer.cs new file mode 100644 index 000000000..daf2a46ca --- /dev/null +++ b/src/OpenCvSharp/Modules/core/SparseMatIndexer.cs @@ -0,0 +1,57 @@ +namespace OpenCvSharp; + +/// +/// Abstract definition of Mat indexer +/// +/// +public abstract class SparseMatIndexer where T : struct +{ + /// + /// 1-dimensional indexer + /// + /// Index along the dimension 0 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public abstract T this[int i0, long? hashVal = null] { get; set; } + + /// + /// 2-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public abstract T this[int i0, int i1, long? hashVal = null] { get; set; } + + /// + /// 3-dimensional indexer + /// + /// Index along the dimension 0 + /// Index along the dimension 1 + /// Index along the dimension 2 + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public abstract T this[int i0, int i1, int i2, long? hashVal = null] { get; set; } + + /// + /// n-dimensional indexer + /// + /// Array of Mat::dims indices. + /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. + /// A value to the specified array element. + public abstract T this[int[] idx, long? hashVal = null] { get; set; } + + /// + /// Parent matrix object + /// + protected SparseMat Parent { get; } + + /// + /// Constructor + /// + /// + internal SparseMatIndexer(SparseMat parent) + { + Parent = parent; + } +} diff --git a/src/OpenCvSharp/Modules/core/Struct/DMatch.cs b/src/OpenCvSharp/Modules/core/Struct/DMatch.cs new file mode 100644 index 000000000..d2724afbe --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/DMatch.cs @@ -0,0 +1,92 @@ +namespace OpenCvSharp; + +#pragma warning disable CA1051 + +/// +/// Struct for matching: query descriptor index, train descriptor index, train image index and distance between descriptors. +/// +/// +/// Constructor +/// +public record struct DMatch(int QueryIdx, int TrainIdx, int ImgIdx, float Distance) +{ + /// + /// query descriptor index + /// + public int QueryIdx = QueryIdx; + + /// + /// train descriptor index + /// + public int TrainIdx = TrainIdx; + + /// + /// train image index + /// + public int ImgIdx = ImgIdx; + + /// + /// + /// + public float Distance = Distance; + + /// + /// + /// + /// + public static DMatch Empty() => new(-1, -1, -1, float.MaxValue); + + /// + /// Constructor + /// + /// + /// + /// + public DMatch(int queryIdx, int trainIdx, float distance) : + this(queryIdx, trainIdx, -1, distance) + { + } + + /// + /// Compares by distance (less is better) + /// + /// + /// + /// + public static bool operator <(DMatch d1, DMatch d2) + { + return d1.Distance < d2.Distance; + } + + /// + /// Compares by distance (less is better) + /// + /// + /// + /// + public static bool operator >(DMatch d1, DMatch d2) + { + return d1.Distance > d2.Distance; + } + + /// + /// Compares by distance (less is better) + /// + /// + /// + public int CompareTo(DMatch other) => Distance.CompareTo(other.Distance); + +#pragma warning disable 1591 + + public static explicit operator Vec4f(DMatch self) => self.ToVec4f(); + + // ReSharper disable once InconsistentNaming + public Vec4f ToVec4f() => new(QueryIdx, TrainIdx, ImgIdx, Distance); + + public static explicit operator DMatch(Vec4f v) => FromVec4f(v); + + // ReSharper disable once InconsistentNaming + public static DMatch FromVec4f(Vec4f v) => new ((int)v.Item0, (int)v.Item1, (int)v.Item2, v.Item3); + +#pragma warning restore 1591 +} diff --git a/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs b/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs new file mode 100644 index 000000000..742f6b09f --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs @@ -0,0 +1,69 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// Data structure for salient point detectors +/// +/// +/// Complete constructor +/// +/// Coordinate of the point +/// Feature size +/// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) +/// Feature strength (can be used to select only the most prominent key points) +/// Scale-space octave in which the feature has been found; may correlate with the size +/// Point class (can be used by feature classifiers or object detectors) +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public record struct KeyPoint( + Point2f Pt, float Size, float Angle = -1, float Response = 0, int Octave = 0, int ClassId = -1) +{ + /// + /// Coordinate of the point + /// + public Point2f Pt = Pt; + + /// + /// Feature size + /// + public float Size = Size; + + /// + /// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) + /// + public float Angle = Angle; + + /// + /// Feature strength (can be used to select only the most prominent key points) + /// + public float Response = Response; + + /// + /// Scale-space octave in which the feature has been found; may correlate with the size + /// + public int Octave = Octave; + + /// + /// Point class (can be used by feature classifiers or object detectors) + /// + public int ClassId = ClassId; + + /// + /// Complete constructor + /// + /// X-coordinate of the point + /// Y-coordinate of the point + /// Feature size + /// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) + /// Feature strength (can be used to select only the most prominent key points) + /// Scale-space octave in which the feature has been found; may correlate with the size + /// Point class (can be used by feature classifiers or object detectors) + public KeyPoint( + float x, float y, float size, float angle = -1, float response = 0, int octave = 0, int classId = -1) + : this(new Point2f(x, y), size, angle, response, octave, classId) + { + } +} diff --git a/src/OpenCvSharp/Modules/core/Struct/MatType.cs b/src/OpenCvSharp/Modules/core/Struct/MatType.cs new file mode 100644 index 000000000..db62f4fa3 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/MatType.cs @@ -0,0 +1,261 @@ +namespace OpenCvSharp; +// ReSharper disable InconsistentNaming +#pragma warning disable 1591 + +/// +/// Matrix data type (depth and number of channels) +/// +public readonly record struct MatType(int value) : IEquatable +{ + /// + /// Entity value + /// + private readonly int value = value; + + /// + /// Entity value + /// + public int Value => value; + + /// + /// + /// + /// + public static explicit operator int(MatType self) + { + return self.value; + } + + /// + /// + /// + public int ToInt32() => value; + + /// + /// + /// + /// + public static implicit operator MatType(int value) + { + return new MatType(value); + } + + /// + /// + /// + /// + public static MatType FromInt32(int value) + { + return new MatType(value); + } + + /// + /// + /// + public int Depth => value & (CV_DEPTH_MAX - 1); + + /// + /// + /// + public bool IsInteger => Depth < CV_32F; + + /// + /// + /// + public int Channels => (Value >> CV_CN_SHIFT) + 1; + + public bool Equals(int other) + { + return value == other; + } + + public static bool operator ==(MatType self, int other) + { + return self.Equals(other); + } + + public static bool operator !=(MatType self, int other) + { + return !self.Equals(other); + } + + /// + public override string ToString() + { + string s; + switch (Depth) + { + case CV_8U: + s = "CV_8U"; + break; + case CV_8S: + s = "CV_8S"; + break; + case CV_16U: + s = "CV_16U"; + break; + case CV_16S: + s = "CV_16S"; + break; + case CV_32S: + s = "CV_32S"; + break; + case CV_32F: + s = "CV_32F"; + break; + case CV_64F: + s = "CV_64F"; + break; + case CV_USRTYPE1: + s = "CV_USRTYPE1"; + break; + default: + return $"Unsupported type value ({Value})"; + } + + var ch = Channels; + if (ch <= 4) + return s + "C" + ch; + else + return s + "C(" + ch + ")"; + } + + private const int CV_CN_MAX = 512, + CV_CN_SHIFT = 3, + CV_DEPTH_MAX = (1 << CV_CN_SHIFT); + + /// + /// type depth constants + /// + public const int + CV_8U = 0, + CV_8S = 1, + CV_16U = 2, + CV_16S = 3, + CV_32S = 4, + CV_32F = 5, + CV_64F = 6, + CV_USRTYPE1 = 7; + + /// + /// predefined type constants + /// + public static readonly MatType + CV_8UC1 = CV_8UC(1), + CV_8UC2 = CV_8UC(2), + CV_8UC3 = CV_8UC(3), + CV_8UC4 = CV_8UC(4), + CV_8SC1 = CV_8SC(1), + CV_8SC2 = CV_8SC(2), + CV_8SC3 = CV_8SC(3), + CV_8SC4 = CV_8SC(4), + CV_16UC1 = CV_16UC(1), + CV_16UC2 = CV_16UC(2), + CV_16UC3 = CV_16UC(3), + CV_16UC4 = CV_16UC(4), + CV_16SC1 = CV_16SC(1), + CV_16SC2 = CV_16SC(2), + CV_16SC3 = CV_16SC(3), + CV_16SC4 = CV_16SC(4), + CV_32SC1 = CV_32SC(1), + CV_32SC2 = CV_32SC(2), + CV_32SC3 = CV_32SC(3), + CV_32SC4 = CV_32SC(4), + CV_32FC1 = CV_32FC(1), + CV_32FC2 = CV_32FC(2), + CV_32FC3 = CV_32FC(3), + CV_32FC4 = CV_32FC(4), + CV_64FC1 = CV_64FC(1), + CV_64FC2 = CV_64FC(2), + CV_64FC3 = CV_64FC(3), + CV_64FC4 = CV_64FC(4); + /* + public const int + CV_8UC1 = 0, + CV_8SC1 = 1, + CV_16UC1 = 2, + CV_16SC1 = 3, + CV_32SC1 = 4, + CV_32FC1 = 5, + CV_64FC1 = 6, + CV_8UC2 = 8, + CV_8SC2 = 9, + CV_16UC2 = 10, + CV_16SC2 = 11, + CV_32SC2 = 12, + CV_32FC2 = 13, + CV_64FC2 = 14, + CV_8UC3 = 16, + CV_8SC3 = 17, + CV_16UC3 = 18, + CV_16SC3 = 19, + CV_32SC3 = 20, + CV_32FC3 = 21, + CV_64FC3 = 22, + CV_8UC4 = 24, + CV_8SC4 = 25, + CV_16UC4 = 26, + CV_16SC4 = 27, + CV_32SC4 = 28, + CV_32FC4 = 29, + CV_64FC4 = 30, + CV_8UC5 = 32, + CV_8SC5 = 33, + CV_16UC5 = 34, + CV_16SC5 = 35, + CV_32SC5 = 36, + CV_32FC5 = 37, + CV_64FC5 = 38, + CV_8UC6 = 40, + CV_8SC6 = 41, + CV_16UC6 = 42, + CV_16SC6 = 43, + CV_32SC6 = 44, + CV_32FC6 = 45, + CV_64FC6 = 46; + */ + + public static MatType CV_8UC(int ch) + { + return MakeType(CV_8U, ch); + } + + public static MatType CV_8SC(int ch) + { + return MakeType(CV_8S, ch); + } + + public static MatType CV_16UC(int ch) + { + return MakeType(CV_16U, ch); + } + + public static MatType CV_16SC(int ch) + { + return MakeType(CV_16S, ch); + } + + public static MatType CV_32SC(int ch) + { + return MakeType(CV_32S, ch); + } + + public static MatType CV_32FC(int ch) + { + return MakeType(CV_32F, ch); + } + + public static MatType CV_64FC(int ch) + { + return MakeType(CV_64F, ch); + } + + public static MatType MakeType(int depth, int channels) + { + if (channels <= 0 || channels >= CV_CN_MAX) + throw new OpenCvSharpException("Channels count should be 1.." + (CV_CN_MAX - 1)); + if (depth < 0 || depth >= CV_DEPTH_MAX) + throw new OpenCvSharpException("Data type depth should be 0.." + (CV_DEPTH_MAX - 1)); + return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT); + } +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Point.cs b/src/OpenCvSharp/Modules/core/Struct/Point.cs new file mode 100644 index 000000000..9dced2758 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Point.cs @@ -0,0 +1,193 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Point(int X, int Y) +{ + /// + /// + /// + public int X = X; + + /// + /// + /// + public int Y = Y; + + /// + /// + /// + /// + /// + public Point(double x, double y) + : this((int)x, (int)y) + { + } + + #region Cast + +#pragma warning disable 1591 + + // ReSharper disable once InconsistentNaming + public readonly Vec2i ToVec2i() => new(X, Y); + + public static implicit operator Vec2i(Point point) => point.ToVec2i(); + + // ReSharper disable once InconsistentNaming + public static Point FromVec2i(Vec2i vec) => new(vec.Item0, vec.Item1); + + public static implicit operator Point(Vec2i vec) => FromVec2i(vec); + +#pragma warning restore 1591 + + #endregion + + #region Operators + + /// + /// Unary plus operator + /// + /// + public readonly Point Plus() => this; + + /// + /// Unary plus operator + /// + /// + /// + public static Point operator +(Point pt) => pt; + + /// + /// Unary minus operator + /// + /// + public readonly Point Negate() => new(-X, -Y); + + /// + /// Unary minus operator + /// + /// + /// + public static Point operator -(Point pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point Add(Point p) => new(X + p.X, Y + p.Y); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point operator +(Point p1, Point p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point Subtract(Point p) => new(X - p.X, Y - p.Y); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point operator -(Point p1, Point p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point Multiply(double scale) => new(X * scale, Y * scale); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point operator *(Point pt, double scale) => pt.Multiply(scale); + + #endregion + + #region Methods + + /// + /// Returns the distance between the specified two points + /// + /// + /// + /// + public static double Distance(Point p1, Point p2) + { + return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); + } + + /// + /// Returns the distance between the specified two points + /// + /// + /// + public readonly double DistanceTo(Point p) + { + return Distance(this, p); + } + + /// + /// Calculates the dot product of two 2D vectors. + /// + /// + /// + /// + public static double DotProduct(Point p1, Point p2) + { + return p1.X*p2.X + p1.Y*p2.Y; + } + + /// + /// Calculates the dot product of two 2D vectors. + /// + /// + /// + public readonly double DotProduct(Point p) + { + return DotProduct(this, p); + } + + /// + /// Calculates the cross product of two 2D vectors. + /// + /// + /// + /// + public static double CrossProduct(Point p1, Point p2) + { + return p1.X*p2.Y - p2.X*p1.Y; + } + + /// + /// Calculates the cross product of two 2D vectors. + /// + /// + /// + public readonly double CrossProduct(Point p) + { + return CrossProduct(this, p); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Point2d.cs b/src/OpenCvSharp/Modules/core/Struct/Point2d.cs new file mode 100644 index 000000000..67c252d9e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Point2d.cs @@ -0,0 +1,191 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// /// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Point2d(double X, double Y) +{ + /// + /// + /// + public double X = X; + + /// + /// + /// + public double Y = Y; + + #region Cast + +#pragma warning disable 1591 + + // ReSharper disable once InconsistentNaming + public readonly Point ToPoint() => new((int)X, (int)Y); + + public static explicit operator Point(Point2d self) => new((int) self.X, (int) self.Y); + + public static Point2d FromPoint(Point point) => new(point.X, point.Y); + + public static implicit operator Point2d(Point point) => new(point.X, point.Y); + + // ReSharper disable once InconsistentNaming + public readonly Vec2d ToVec2d() => new(X, Y); + + public static implicit operator Vec2d(Point2d point) => new(point.X, point.Y); + + // ReSharper disable once InconsistentNaming + public static Point2d FromVec2d(Vec2d vec) => new(vec.Item0, vec.Item1); + + public static implicit operator Point2d(Vec2d vec) => new(vec.Item0, vec.Item1); + +#pragma warning restore 1591 + + #endregion + + #region Operators + + /// + /// Unary plus operator + /// + /// + public readonly Point2d Plus() => this; + + /// + /// Unary plus operator + /// + /// + /// + public static Point2d operator +(Point2d pt) => pt; + + /// + /// Unary minus operator + /// + /// + public readonly Point2d Negate() => new(-X, -Y); + + /// + /// Unary minus operator + /// + /// + /// + public static Point2d operator -(Point2d pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2d Add(Point2d p) => new(X + p.X, Y + p.Y); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point2d operator +(Point2d p1, Point2d p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2d Subtract(Point2d p) => new(X - p.X, Y - p.Y); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point2d operator -(Point2d p1, Point2d p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2d Multiply(double scale) => new(X * scale, Y * scale); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point2d operator *(Point2d pt, double scale) => pt.Multiply(scale); + + #endregion + + #region Methods + + /// + /// Returns the distance between the specified two points + /// + /// + /// + /// + public static double Distance(Point2d p1, Point2d p2) + { + return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); + } + + /// + /// Returns the distance between the specified two points + /// + /// + /// + public readonly double DistanceTo(Point2d p) + { + return Distance(this, p); + } + + /// + /// Calculates the dot product of two 2D vectors. + /// + /// + /// + /// + public static double DotProduct(Point2d p1, Point2d p2) + { + return p1.X*p2.X + p1.Y*p2.Y; + } + + /// + /// Calculates the dot product of two 2D vectors. + /// + /// + /// + public readonly double DotProduct(Point2d p) + { + return DotProduct(this, p); + } + + /// + /// Calculates the cross product of two 2D vectors. + /// + /// + /// + /// + public static double CrossProduct(Point2d p1, Point2d p2) + { + return p1.X*p2.Y - p2.X*p1.Y; + } + + /// + /// Calculates the cross product of two 2D vectors. + /// + /// + /// + public readonly double CrossProduct(Point2d p) + { + return CrossProduct(this, p); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Point2f.cs b/src/OpenCvSharp/Modules/core/Struct/Point2f.cs new file mode 100644 index 000000000..9cf0b3159 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Point2f.cs @@ -0,0 +1,196 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +// ReSharper disable once InconsistentNaming +public record struct Point2f(float X, float Y) +{ + /// + /// + /// + public float X = X; + + /// + /// + /// + public float Y = Y; + + #region Cast + +#pragma warning disable 1591 + + // ReSharper disable once InconsistentNaming + public readonly Point ToPoint() => new((int)X, (int)Y); + + public static explicit operator Point(Point2f self) => self.ToPoint(); + + public static Point2f FromPoint(Point point) => new (point.X, point.Y); + + public static implicit operator Point2f(Point point) => FromPoint(point); + + // ReSharper disable once InconsistentNaming + public readonly Vec2f ToVec2f() => new(X, Y); + + public static implicit operator Vec2f(Point2f point) => point.ToVec2f(); + + // ReSharper disable once InconsistentNaming + public static Point2f FromVec2f(Vec2f vec) => new(vec.Item0, vec.Item1); + + public static implicit operator Point2f(Vec2f vec) => FromVec2f(vec); + +#pragma warning restore 1591 + + #endregion + + #region Operators + + /// + /// Unary plus operator + /// + /// + public readonly Point2f Plus() => this; + + /// + /// Unary plus operator + /// + /// + /// + public static Point2f operator +(Point2f pt) + { + return pt; + } + + /// + /// Unary minus operator + /// + /// + public readonly Point2f Negate() => new(-X, -Y); + + /// + /// Unary minus operator + /// + /// + /// + public static Point2f operator -(Point2f pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2f Add(Point2f p) => new(X + p.X, Y + p.Y); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point2f operator +(Point2f p1, Point2f p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2f Subtract(Point2f p) => new(X - p.X, Y - p.Y); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point2f operator -(Point2f p1, Point2f p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2f Multiply(double scale) => new((float)(X * scale), (float)(Y * scale)); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point2f operator *(Point2f pt, double scale) => pt.Multiply(scale); + + #endregion + + #region Methods + + /// + /// Returns the distance between the specified two points + /// + /// + /// + /// + public static double Distance(Point2f p1, Point2f p2) + { + return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); + } + + /// + /// Returns the distance between the specified two points + /// + /// + /// + public readonly double DistanceTo(Point2f p) + { + return Distance(this, p); + } + + /// + /// Calculates the dot product of two 2D vectors. + /// + /// + /// + /// + public static double DotProduct(Point2f p1, Point2f p2) + { + return p1.X*p2.X + p1.Y*p2.Y; + } + + /// + /// Calculates the dot product of two 2D vectors. + /// + /// + /// + public readonly double DotProduct(Point2f p) + { + return DotProduct(this, p); + } + + /// + /// Calculates the cross product of two 2D vectors. + /// + /// + /// + /// + public static double CrossProduct(Point2f p1, Point2f p2) + { + return p1.X*p2.Y - p2.X*p1.Y; + } + + /// + /// Calculates the cross product of two 2D vectors. + /// + /// + /// + public readonly double CrossProduct(Point2f p) + { + return CrossProduct(this, p); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3d.cs b/src/OpenCvSharp/Modules/core/Struct/Point3d.cs new file mode 100644 index 000000000..48536847e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Point3d.cs @@ -0,0 +1,130 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// /// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Point3d(double X, double Y, double Z) +{ + /// + /// + /// + public double X = X; + + /// + /// + /// + public double Y = Y; + + /// + /// + /// + public double Z = Z; + + #region Cast + +#pragma warning disable 1591 + + public static explicit operator Point3i(Point3d self) => self.ToPoint3i(); + + // ReSharper disable once InconsistentNaming + public readonly Point3i ToPoint3i() => new((int)X, (int)Y, (int)Z); + + public static implicit operator Point3d(Point3i point) => FromPoint3i(point); + + // ReSharper disable once InconsistentNaming + public static Point3d FromPoint3i(Point3i point) => new(point.X, point.Y, point.Z); + + public static implicit operator Vec3d(Point3d self) => self.ToVec3d(); + + // ReSharper disable once InconsistentNaming + public readonly Vec3d ToVec3d() => new(X, Y, Z); + + public static implicit operator Point3d(Vec3d vec) => FromVec3d(vec); + + // ReSharper disable once InconsistentNaming + public static Point3d FromVec3d(Vec3d vec) => new(vec.Item0, vec.Item1, vec.Item2); + +#pragma warning restore 1591 + + #endregion + + #region Operators + + /// + /// Unary plus operator + /// + /// + /// + public static Point3d operator +(Point3d pt) => pt; + + /// + /// Unary plus operator + /// + /// + public readonly Point3d Plus() => this; + + /// + /// Unary minus operator + /// + /// + /// + public static Point3d operator -(Point3d pt) => pt.Negate(); + + /// + /// Unary minus operator + /// + /// + public readonly Point3d Negate() => new(-X, -Y, -Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3d operator +(Point3d p1, Point3d p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3d Add(Point3d p) => new(X + p.X, Y + p.Y, Z + p.Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3d operator -(Point3d p1, Point3d p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3d Subtract(Point3d p) => new(X - p.X, Y - p.Y, Z - p.Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3d operator *(Point3d pt, double scale) => pt.Multiply(scale); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3d Multiply(double scale) => new(X * scale, Y * scale, Z * scale); + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3f.cs b/src/OpenCvSharp/Modules/core/Struct/Point3f.cs new file mode 100644 index 000000000..76423a7c8 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Point3f.cs @@ -0,0 +1,132 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// /// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public record struct Point3f(float X, float Y, float Z) +{ + /// + /// + /// + public float X = X; + + /// + /// + /// + public float Y = Y; + + /// + /// + /// + public float Z = Z; + + #region Cast + +#pragma warning disable 1591 + + public static explicit operator Point3i(Point3f self) => self.ToPoint3i(); + + // ReSharper disable once InconsistentNaming + public readonly Point3i ToPoint3i() => new ((int)X, (int)Y, (int)Z); + + public static implicit operator Point3f(Point3i point) => FromPoint3i(point); + + // ReSharper disable once InconsistentNaming + public static Point3f FromPoint3i(Point3i point) => new (point.X, point.Y, point.Z); + + public static implicit operator Vec3f(Point3f self) => self.ToVec3f(); + + // ReSharper disable once InconsistentNaming + public readonly Vec3f ToVec3f() => new(X, Y, Z); + + public static implicit operator Point3f(Vec3f vec) => FromVec3f(vec); + + // ReSharper disable once InconsistentNaming + public static Point3f FromVec3f(Vec3f vec) => new (vec.Item0, vec.Item1, vec.Item2); + +#pragma warning restore 1591 + + #endregion + + #region Operators + + /// + /// Unary plus operator + /// + /// + public readonly Point3f Plus() => this; + + /// + /// Unary plus operator + /// + /// + /// + public static Point3f operator +(Point3f pt) => pt; + + /// + /// Unary minus operator + /// + /// + public readonly Point3f Negate() => new(-X, -Y, -Z); + + /// + /// Unary minus operator + /// + /// + /// + public static Point3f operator -(Point3f pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3f Add(Point3f p) => new(X + p.X, Y + p.Y, Z + p.Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3f operator +(Point3f p1, Point3f p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3f Subtract(Point3f p) => new(X - p.X, Y - p.Y, Z - p.Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3f operator -(Point3f p1, Point3f p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3f Multiply(double scale) + => new((float)(X * scale), (float)(Y * scale), (float)(Z * scale)); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3f operator *(Point3f pt, double scale) => pt.Multiply(scale); + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3i.cs b/src/OpenCvSharp/Modules/core/Struct/Point3i.cs new file mode 100644 index 000000000..6dd154357 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Point3i.cs @@ -0,0 +1,125 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +// ReSharper disable once InconsistentNaming +public record struct Point3i(int X, int Y, int Z) +{ + /// + /// + /// + public int X = X; + + /// + /// + /// + public int Y = Y; + + /// + /// + /// + public int Z = Z; + + #region Cast + +#pragma warning disable 1591 + + public static implicit operator Vec3i(Point3i point) => point.ToVec3i(); + + // ReSharper disable once InconsistentNaming + public readonly Vec3i ToVec3i() => new(X, Y, Z); + + public static implicit operator Point3i(Vec3i vec) => FromVec3i(vec); + + // ReSharper disable once InconsistentNaming + public static Point3i FromVec3i(Vec3i vec) => new(vec.Item0, vec.Item1, vec.Item2); + +#pragma warning restore 1591 + + #endregion + + #region Operators + + /// + /// Unary plus operator + /// + /// + /// + public static Point3i operator +(Point3i pt) => pt; + + /// + /// Unary plus operator + /// + /// + public readonly Point3i Plus() => this; + + /// + /// Unary minus operator + /// + /// + /// + public static Point3i operator -(Point3i pt) + { + return pt.Negate(); + } + + /// + /// Unary minus operator + /// + /// + public readonly Point3i Negate() => new (-X, -Y, -Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3i operator +(Point3i p1, Point3i p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3i Add(Point3i p) => new (X + p.X, Y + p.Y, Z + p.Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3i operator -(Point3i p1, Point3i p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3i Subtract(Point3i p) => new (X - p.X, Y - p.Y, Z - p.Z); + + /// + /// Shifts point by a certain offset + /// + /// + /// + /// + public static Point3i operator *(Point3i pt, double scale) => pt.Multiply(scale); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3i Multiply(double scale) => new ((int)(X * scale), (int)(Y * scale), (int)(Z * scale)); + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Range.cs b/src/OpenCvSharp/Modules/core/Struct/Range.cs new file mode 100644 index 000000000..a1767d2b1 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Range.cs @@ -0,0 +1,28 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// Template class specifying a continuous subsequence (slice) of a sequence. +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public readonly record struct Range(int Start, int End) +{ + /// + /// + /// + public readonly int Start = Start; + + /// + /// + /// + public readonly int End = End; + + /// + /// + /// + public static Range All => new(int.MinValue, int.MaxValue); +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Rangef.cs b/src/OpenCvSharp/Modules/core/Struct/Rangef.cs new file mode 100644 index 000000000..ee0ed903f --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Rangef.cs @@ -0,0 +1,42 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// float Range class +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once IdentifierTypo +public readonly record struct Rangef(float Start, float End) +{ + /// + /// + /// + public readonly float Start = Start; + + /// + /// + /// + public readonly float End = End; + + /// + /// Convert to Range + /// + /// + public Range ToRange() => new ((int)Start, (int)End); + + /// + /// Implicit operator (Range)this + /// + /// + /// + public static implicit operator Range(Rangef range) => new ((int)range.Start, (int)range.End); + + /// + /// Range(int.MinValue, int.MaxValue) + /// + public static Range All => new (int.MinValue, int.MaxValue); +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect.cs b/src/OpenCvSharp/Modules/core/Struct/Rect.cs new file mode 100644 index 000000000..87521f222 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Rect.cs @@ -0,0 +1,390 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// Stores a set of four integers that represent the location and size of a rectangle +/// +/// The x-coordinate of the upper-left corner of the rectangle. +/// The y-coordinate of the upper-left corner of the rectangle. +/// The width of the rectangle. +/// The height of the rectangle. +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Rect(int X, int Y, int Width, int Height) +{ + /// + /// The x-coordinate of the upper-left corner of the rectangle. + /// + public int X = X; + + /// + /// The y-coordinate of the upper-left corner of the rectangle. + /// + public int Y = Y; + + /// + /// The width of the rectangle. + /// + public int Width = Width; + + /// + /// The height of the rectangle. + /// + public int Height = Height; + + /// + /// Initializes a new instance of the Rectangle class with the specified location and size. + /// + /// A Point that represents the upper-left corner of the rectangular region. + /// A Size that represents the width and height of the rectangular region. + public Rect(Point location, Size size) + : this(location.X, location.Y, size.Width, size.Height) + { + } + + /// + /// Creates a Rectangle structure with the specified edge locations. + /// + /// The x-coordinate of the upper-left corner of this Rectangle structure. + /// The y-coordinate of the upper-left corner of this Rectangle structure. + /// The x-coordinate of the lower-right corner of this Rectangle structure. + /// The y-coordinate of the lower-right corner of this Rectangle structure. + // ReSharper disable once InconsistentNaming + public static Rect FromLTRB(int left, int top, int right, int bottom) + { + var r = new Rect + { + X = left, + Y = top, + Width = right - left, + Height = bottom - top + }; + + if (r.Width < 0) + throw new ArgumentException("right > left"); + if (r.Height < 0) + throw new ArgumentException("bottom > top"); + return r; + } + + #region Operators + + #region + / - + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + /// + public static Rect operator +(Rect rect, Point pt) => rect.Add(pt); + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect Add(Point pt) + => this with + { + X = X + pt.X, + Y = Y + pt.Y + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + /// + public static Rect operator -(Rect rect, Point pt) + => rect with + { + X = rect.X - pt.X, + Y = rect.Y - pt.Y + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect Subtract(Point pt) + => this with + { + X = X - pt.X, + Y = Y - pt.Y + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + /// + public static Rect operator +(Rect rect, Size size) => + rect with + { + Width = rect.Width + size.Width, + Height = rect.Height + size.Height + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + public readonly Rect Add(Size size) => this with + { + Width = Width + size.Width, + Height = Height + size.Height + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + /// + public static Rect operator -(Rect rect, Size size) => + rect with + { + Width = rect.Width - size.Width, + Height = rect.Height - size.Height + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + public readonly Rect Subtract(Size size) + => this with + { + Width = Width - size.Width, + Height = Height - size.Height + }; + + #endregion + + #region & / | + + /// + /// Determines the Rect structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// A rectangle to intersect. + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static Rect operator &(Rect a, Rect b) + => Intersect(a, b); + + /// + /// Gets a Rect structure that contains the union of two Rect structures. + /// + /// A rectangle to union. + /// A rectangle to union. + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static Rect operator |(Rect a, Rect b) + => Union(a, b); + + #endregion + + #endregion + + #region Properties + + /// + /// Gets the y-coordinate of the top edge of this Rect structure. + /// + public int Top + { + readonly get => Y; + set => Y = value; + } + + /// + /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect structure. + /// + public int Bottom => Y + Height; + + /// + /// Gets the x-coordinate of the left edge of this Rect structure. + /// + public int Left + { + get => X; + set => X = value; + } + + /// + /// Gets the x-coordinate that is the sum of X and Width property values of this Rect structure. + /// + public int Right => X + Width; + + /// + /// Coordinate of the left-most rectangle corner [Point(X, Y)] + /// + public Point Location + { + get => new(X, Y); + set + { + X = value.X; + Y = value.Y; + } + } + + /// + /// Size of the rectangle [CvSize(Width, Height)] + /// + public Size Size + { + get => new(Width, Height); + set + { + Width = value.Width; + Height = value.Height; + } + } + + /// + /// Coordinate of the left-most rectangle corner [Point(X, Y)] + /// + public Point TopLeft => new(X, Y); + + /// + /// Coordinate of the right-most rectangle corner [Point(X+Width, Y+Height)] + /// + public Point BottomRight => new(X + Width, Y + Height); + + #endregion + + #region Methods + + /// + /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. + /// + /// x-coordinate of the point + /// y-coordinate of the point + /// + public readonly bool Contains(int x, int y) + => (X <= x && Y <= y && X + Width > x && Y + Height > y); + + /// + /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. + /// + /// point + /// + public readonly bool Contains(Point pt) + => Contains(pt.X, pt.Y); + + /// + /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. + /// + /// rectangle + /// + public readonly bool Contains(Rect rect) => + X <= rect.X && + (rect.X + rect.Width) <= (X + Width) && + Y <= rect.Y && + (rect.Y + rect.Height) <= (Y + Height); + + /// + /// Inflates this Rect by the specified amount. + /// + /// The amount to inflate this Rectangle horizontally. + /// The amount to inflate this Rectangle vertically. + public void Inflate(int width, int height) + { + X -= width; + Y -= height; + Width += (2 * width); + Height += (2 * height); + } + + /// + /// Inflates this Rect by the specified amount. + /// + /// The amount to inflate this rectangle. + public void Inflate(Size size) => Inflate(size.Width, size.Height); + + /// + /// Creates and returns an inflated copy of the specified Rect structure. + /// + /// The Rectangle with which to start. This rectangle is not modified. + /// The amount to inflate this Rectangle horizontally. + /// The amount to inflate this Rectangle vertically. + /// + public static Rect Inflate(Rect rect, int x, int y) + { + rect.Inflate(x, y); + return rect; + } + + /// + /// Determines the Rect structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// A rectangle to intersect. + /// + public static Rect Intersect(Rect a, Rect b) + { + var x1 = Math.Max(a.X, b.X); + var x2 = Math.Min(a.X + a.Width, b.X + b.Width); + var y1 = Math.Max(a.Y, b.Y); + var y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); + + if (x2 >= x1 && y2 >= y1) + return new Rect(x1, y1, x2 - x1, y2 - y1); + return default; + } + + /// + /// Determines the Rect structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// + public readonly Rect Intersect(Rect rect) => Intersect(this, rect); + + /// + /// Determines if this rectangle intersects with rect. + /// + /// Rectangle + /// + public readonly bool IntersectsWith(Rect rect) => + (X < rect.X + rect.Width) && + (X + Width > rect.X) && + (Y < rect.Y + rect.Height) && + (Y + Height > rect.Y); + + /// + /// Gets a Rect structure that contains the union of two Rect structures. + /// + /// A rectangle to union. + /// + public readonly Rect Union(Rect rect) => Union(this, rect); + + /// + /// Gets a Rect structure that contains the union of two Rect structures. + /// + /// A rectangle to union. + /// A rectangle to union. + /// + public static Rect Union(Rect a, Rect b) + { + var x1 = Math.Min(a.X, b.X); + var x2 = Math.Max(a.X + a.Width, b.X + b.Width); + var y1 = Math.Min(a.Y, b.Y); + var y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); + + return new Rect(x1, y1, x2 - x1, y2 - y1); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs b/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs new file mode 100644 index 000000000..b0994e30f --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs @@ -0,0 +1,399 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// Stores a set of four double-precision floating-point numbers that represent the location and size of a rectangle +/// +/// The x-coordinate of the upper-left corner of the rectangle. +/// The y-coordinate of the upper-left corner of the rectangle. +/// The width of the rectangle. +/// The height of the rectangle. +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Rect2d(double X, double Y, double Width, double Height) +{ + /// + /// The x-coordinate of the upper-left corner of the rectangle. + /// + public double X = X; + + /// + /// The y-coordinate of the upper-left corner of the rectangle. + /// + public double Y = Y; + + /// + /// The width of the rectangle. + /// + public double Width = Width; + + /// + /// The height of the rectangle. + /// + public double Height = Height; + + /// + /// Constructor + /// + /// + /// + public Rect2d(Point2d location, Size2d size) + : this(location.X, location.Y, size.Width, size.Height) + { + X = location.X; + Y = location.Y; + Width = size.Width; + Height = size.Height; + } + + /// + /// + /// + /// + /// + /// + /// + // ReSharper disable once InconsistentNaming + public static Rect2d FromLTRB(double left, double top, double right, double bottom) + { + var r = new Rect2d + { + X = left, + Y = top, + Width = right - left, + Height = bottom - top + }; + + if (r.Width < 0) + throw new ArgumentException("right > left"); + if (r.Height < 0) + throw new ArgumentException("bottom > top"); + return r; + } + + #region Operators + + #region + / - + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + /// + public static Rect2d operator +(Rect2d rect, Point2d pt) + => rect.Add(pt); + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2d Add(Point2d pt) + => this with + { + X = X + pt.X, + Y = Y + pt.Y + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + /// + public static Rect2d operator -(Rect2d rect, Point2d pt) + => rect.Subtract(pt); + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2d Subtract(Point2d pt) + => this with + { + X = X - pt.X, + Y = Y - pt.Y + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + /// + public static Rect2d operator +(Rect2d rect, Size2d size) + => rect with + { + Width = rect.Width + size.Width, + Height = rect.Height + size.Height + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2d Add(Size2d size) + => this with + { + Width = Width + size.Width, + Height = Height + size.Height + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + /// + public static Rect2d operator -(Rect2d rect, Size2d size) + => rect with + { + Width = rect.Width - size.Width, + Height = rect.Height - size.Height + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2d Subtract(Size2d size) + => this with + { + Width = Width - size.Width, + Height = Height - size.Height + }; + + #endregion + + #region & / | + + /// + /// Determines the Rect2d structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// A rectangle to intersect. + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static Rect2d operator &(Rect2d a, Rect2d b) + => Intersect(a, b); + + /// + /// Gets a Rect2d structure that contains the union of two Rect2d structures. + /// + /// A rectangle to union. + /// A rectangle to union. + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static Rect2d operator |(Rect2d a, Rect2d b) + => Union(a, b); + + #endregion + + #endregion + + #region Properties + + /// + /// Gets the y-coordinate of the top edge of this Rect2d structure. + /// + public double Top + { + readonly get => Y; + set => Y = value; + } + + /// + /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect2d structure. + /// + public readonly double Bottom => Y + Height; + + /// + /// Gets the x-coordinate of the left edge of this Rect2d structure. + /// + public double Left + { + readonly get => X; + set => X = value; + } + + /// + /// Gets the x-coordinate that is the sum of X and Width property values of this Rect2d structure. + /// + public readonly double Right => X + Width; + + /// + /// Coordinate of the left-most rectangle corner [Point2d(X, Y)] + /// + public Point2d Location + { + readonly get => new(X, Y); + set + { + X = value.X; + Y = value.Y; + } + } + + /// + /// Size of the rectangle [CvSize(Width, Height)] + /// + public Size2d Size + { + readonly get => new(Width, Height); + set + { + Width = value.Width; + Height = value.Height; + } + } + + /// + /// Coordinate of the left-most rectangle corner [Point2d(X, Y)] + /// + public readonly Point2d TopLeft => new(X, Y); + + /// + /// Coordinate of the right-most rectangle corner [Point2d(X+Width, Y+Height)] + /// + public readonly Point2d BottomRight => new(X + Width, Y + Height); + + #endregion + + #region Methods + + /// + /// + /// + /// + public readonly Rect ToRect() + => new((int)X, (int)Y, (int)Width, (int)Height); + + /// + /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. + /// + /// x-coordinate of the point + /// y-coordinate of the point + /// + public readonly bool Contains(double x, double y) + => (X <= x && Y <= y && X + Width > x && Y + Height > y); + + /// + /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. + /// + /// point + /// + public readonly bool Contains(Point2d pt) + => Contains(pt.X, pt.Y); + + /// + /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. + /// + /// rectangle + /// + public readonly bool Contains(Rect2d rect) => + X <= rect.X && + (rect.X + rect.Width) <= (X + Width) && + Y <= rect.Y && + (rect.Y + rect.Height) <= (Y + Height); + + /// + /// Inflates this Rect by the specified amount. + /// + /// The amount to inflate this Rectangle horizontally. + /// The amount to inflate this Rectangle vertically. + public void Inflate(double width, double height) + { + X -= width; + Y -= height; + Width += (2 * width); + Height += (2 * height); + } + + /// + /// Inflates this Rect by the specified amount. + /// + /// The amount to inflate this rectangle. + public void Inflate(Size2d size) => Inflate(size.Width, size.Height); + + /// + /// Creates and returns an inflated copy of the specified Rect2d structure. + /// + /// The Rectangle with which to start. This rectangle is not modified. + /// The amount to inflate this Rectangle horizontally. + /// The amount to inflate this Rectangle vertically. + /// + public static Rect Inflate(Rect rect, int x, int y) + { + rect.Inflate(x, y); + return rect; + } + + /// + /// Determines the Rect2d structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// A rectangle to intersect. + /// + public static Rect2d Intersect(Rect2d a, Rect2d b) + { + var x1 = Math.Max(a.X, b.X); + var x2 = Math.Min(a.X + a.Width, b.X + b.Width); + var y1 = Math.Max(a.Y, b.Y); + var y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); + + if (x2 >= x1 && y2 >= y1) + return new Rect2d(x1, y1, x2 - x1, y2 - y1); + return default; + } + + /// + /// Determines the Rect2d structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// + public readonly Rect2d Intersect(Rect2d rect) => Intersect(this, rect); + + /// + /// Determines if this rectangle intersects with rect. + /// + /// Rectangle + /// + public readonly bool IntersectsWith(Rect2d rect) => + (X < rect.X + rect.Width) && + (X + Width > rect.X) && + (Y < rect.Y + rect.Height) && + (Y + Height > rect.Y); + + /// + /// Gets a Rect2d structure that contains the union of two Rect2d structures. + /// + /// A rectangle to union. + /// + public readonly Rect2d Union(Rect2d rect) => Union(this, rect); + + /// + /// Gets a Rect2d structure that contains the union of two Rect2d structures. + /// + /// A rectangle to union. + /// A rectangle to union. + /// + public static Rect2d Union(Rect2d a, Rect2d b) + { + var x1 = Math.Min(a.X, b.X); + var x2 = Math.Max(a.X + a.Width, b.X + b.Width); + var y1 = Math.Min(a.Y, b.Y); + var y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); + + return new Rect2d(x1, y1, x2 - x1, y2 - y1); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs b/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs new file mode 100644 index 000000000..94fe4a1a4 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs @@ -0,0 +1,387 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// A rectangle with float type coordinates in 2D space +/// +/// The x-coordinate of the upper-left corner of the rectangle. +/// The y-coordinate of the upper-left corner of the rectangle. +/// The width of the rectangle. +/// The height of the rectangle. +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public record struct Rect2f(float X, float Y, float Width, float Height) +{ + /// + /// The x-coordinate of the upper-left corner of the rectangle. + /// + public float X = X; + + /// + /// The y-coordinate of the upper-left corner of the rectangle. + /// + public float Y = Y; + + /// + /// The width of the rectangle. + /// + public float Width = Width; + + /// + /// The height of the rectangle. + /// + public float Height = Height; + + /// + /// Constructor + /// + /// + /// + public Rect2f(Point2f location, Size2f size) + : this(location.X, location.Y, size.Width, size.Height) + { + X = location.X; + Y = location.Y; + Width = size.Width; + Height = size.Height; + } + + /// + /// + /// + /// + /// + /// + /// + // ReSharper disable once InconsistentNaming + public static Rect2f FromLTRB(float left, float top, float right, float bottom) + { + var r = new Rect2f + { + X = left, + Y = top, + Width = right - left, + Height = bottom - top + }; + + if (r.Width < 0) + throw new ArgumentException("right > left"); + if (r.Height < 0) + throw new ArgumentException("bottom > top"); + return r; + } + + #region Operators + + #region + / - + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2f Add(Point2f pt) + => this with + { + X = X + pt.X, + Y = Y + pt.Y + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + /// + public static Rect2f operator +(Rect2f rect, Point2f pt) + => rect.Add(pt); + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2f Subtract(Point2f pt) + => this with + { + X = X - pt.X, + Y = Y - pt.Y + }; + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + /// + public static Rect2f operator -(Rect2f rect, Point2f pt) + => rect.Subtract(pt); + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + public readonly Rect2f Add(Size2f size) + => this with + { + Width = Width + size.Width, + Height = Height + size.Height + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + /// + public static Rect2f operator +(Rect2f rect, Size2f size) + => rect.Add(size); + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + public readonly Rect2f Subtract(Size2f size) + => this with + { + Width = Width - size.Width, + Height = Height - size.Height + }; + + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + /// + public static Rect2f operator -(Rect2f rect, Size2f size) + => rect.Subtract(size); + + #endregion + + #region & / | + + /// + /// Determines the Rect2f structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// A rectangle to intersect. + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static Rect2f operator &(Rect2f a, Rect2f b) + => Intersect(a, b); + + /// + /// Gets a Rect2f structure that contains the union of two Rect2f structures. + /// + /// A rectangle to union. + /// A rectangle to union. + /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] + public static Rect2f operator |(Rect2f a, Rect2f b) + => Union(a, b); + + #endregion + + #endregion + + #region Properties + + /// + /// Gets the y-coordinate of the top edge of this Rect2f structure. + /// + public float Top + { + readonly get => Y; + set => Y = value; + } + + /// + /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect2f structure. + /// + public readonly float Bottom => Y + Height; + + /// + /// Gets the x-coordinate of the left edge of this Rect2f structure. + /// + public float Left + { + readonly get => X; + set => X = value; + } + + /// + /// Gets the x-coordinate that is the sum of X and Width property values of this Rect2f structure. + /// + public readonly float Right => X + Width; + + /// + /// Coordinate of the left-most rectangle corner [Point2f(X, Y)] + /// + public Point2f Location + { + readonly get => new(X, Y); + set + { + X = value.X; + Y = value.Y; + } + } + + /// + /// Size of the rectangle [CvSize(Width, Height)] + /// + public Size2f Size + { + readonly get => new(Width, Height); + set + { + Width = value.Width; + Height = value.Height; + } + } + + /// + /// Coordinate of the left-most rectangle corner [Point2f(X, Y)] + /// + public readonly Point2f TopLeft => new(X, Y); + + /// + /// Coordinate of the right-most rectangle corner [Point2f(X+Width, Y+Height)] + /// + public readonly Point2f BottomRight => new(X + Width, Y + Height); + + #endregion + + #region Methods + + /// + /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. + /// + /// x-coordinate of the point + /// y-coordinate of the point + /// + public readonly bool Contains(float x, float y) + => (X <= x && Y <= y && X + Width > x && Y + Height > y); + + /// + /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. + /// + /// point + /// + public readonly bool Contains(Point2f pt) + => Contains(pt.X, pt.Y); + + /// + /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. + /// + /// rectangle + /// + public readonly bool Contains(Rect2f rect) => + X <= rect.X && + (rect.X + rect.Width) <= (X + Width) && + Y <= rect.Y && + (rect.Y + rect.Height) <= (Y + Height); + + /// + /// Inflates this Rect by the specified amount. + /// + /// The amount to inflate this Rectangle horizontally. + /// The amount to inflate this Rectangle vertically. + public void Inflate(float width, float height) + { + X -= width; + Y -= height; + Width += (2 * width); + Height += (2 * height); + } + + /// + /// Inflates this Rect by the specified amount. + /// + /// The amount to inflate this rectangle. + public void Inflate(Size2f size) + => Inflate(size.Width, size.Height); + + /// + /// Creates and returns an inflated copy of the specified Rect2f structure. + /// + /// The Rectangle with which to start. This rectangle is not modified. + /// The amount to inflate this Rectangle horizontally. + /// The amount to inflate this Rectangle vertically. + /// + public static Rect Inflate(Rect rect, int x, int y) + { + rect.Inflate(x, y); + return rect; + } + + /// + /// Determines the Rect2f structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// A rectangle to intersect. + /// + public static Rect2f Intersect(Rect2f a, Rect2f b) + { + var x1 = Math.Max(a.X, b.X); + var x2 = Math.Min(a.X + a.Width, b.X + b.Width); + var y1 = Math.Max(a.Y, b.Y); + var y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); + + if (x2 >= x1 && y2 >= y1) + return new Rect2f(x1, y1, x2 - x1, y2 - y1); + return default; + } + + /// + /// Determines the Rect2f structure that represents the intersection of two rectangles. + /// + /// A rectangle to intersect. + /// + public readonly Rect2f Intersect(Rect2f rect) + => Intersect(this, rect); + + /// + /// Determines if this rectangle intersects with rect. + /// + /// Rectangle + /// + public readonly bool IntersectsWith(Rect2f rect) => + (X < rect.X + rect.Width) && + (X + Width > rect.X) && + (Y < rect.Y + rect.Height) && + (Y + Height > rect.Y); + + /// + /// Gets a Rect2f structure that contains the union of two Rect2f structures. + /// + /// A rectangle to union. + /// + public readonly Rect2f Union(Rect2f rect) + => Union(this, rect); + + /// + /// Gets a Rect2f structure that contains the union of two Rect2f structures. + /// + /// A rectangle to union. + /// A rectangle to union. + /// + public static Rect2f Union(Rect2f a, Rect2f b) + { + var x1 = Math.Min(a.X, b.X); + var x2 = Math.Max(a.X + a.Width, b.X + b.Width); + var y1 = Math.Min(a.Y, b.Y); + var y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); + + return new Rect2f(x1, y1, x2 - x1, y2 - y1); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs b/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs new file mode 100644 index 000000000..c203c6ef8 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs @@ -0,0 +1,148 @@ +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// The class represents rotated (i.e. not up-right) rectangles on a plane. +/// +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public record struct RotatedRect +{ + /// + /// the rectangle mass center + /// + public Point2f Center; + + /// + /// width and height of the rectangle + /// + public Size2f Size; + + /// + /// the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle. + /// + public float Angle; + + /// + /// Constructor + /// + /// + /// + /// + public RotatedRect(Point2f center, Size2f size, float angle) + { + Center = center; + Size = size; + Angle = angle; + } + + /// + /// Any 3 end points of the RotatedRect. They must be given in order (either clockwise or anticlockwise). + /// + public RotatedRect(Point2f point1, Point2f point2, Point2f point3) + { // https://github.com/opencv/opencv/blob/6ad77b23193bdf7e40db83e6077789284ac08781/modules/core/src/types.cpp#LL147C20-L147C20 + var center = (point1 + point3) * 0.5; + var vecs = new Vec2f[2]; + vecs[0] = (point1 - point2).ToVec2f(); + vecs[1] = (point2 - point3).ToVec2f(); + var x = Math.Max(Norm(point1), Math.Max(Norm(point2), Norm(point3))); + var a = Math.Min(Norm(vecs[0]), Norm(vecs[1])); + + const float fltEpsilon = 1.19209290e-7f; // https://github.com/opencv/opencv/blob/6ad77b23193bdf7e40db83e6077789284ac08781/modules/dnn/src/math_utils.hpp#L39 + + // check that given sides are perpendicular + Debug.Assert( + Math.Abs(Ddot(vecs[0], vecs[1])) * a <= fltEpsilon * 9 * x * (Norm(vecs[0]) * Norm(vecs[1]))); + + // wd_i stores which vector (0,1) or (1,2) will make the width + // One of them will definitely have slope within -1 to 1 + var wdI = 0; + if (Math.Abs(vecs[1][1]) < Math.Abs(vecs[1][0])) + { + wdI = 1; + } + var htI = (wdI + 1) % 2; + + var angle = Math.Atan(vecs[wdI][1] / vecs[wdI][0]) * 180.0f / (float)Cv2.PI; + var width = (float)Norm(vecs[wdI]); + var height = (float)Norm(vecs[htI]); + + Center = center; + Size = new(width, height); + Angle = (float)angle; + + static double Ddot(Vec2f a, Vec2f b) + { // https://github.com/opencv/opencv/blob/0052d46b8e33c7bfe0e1450e4bff28b88f455570/modules/core/include/opencv2/core/matx.hpp#L741 + var s = 0d; + for (var i = 0; i < 2; i++) + { + s += (double)a[i] * b[i]; + } + return s; + } + + // core/types.hpp + /* + template static inline + double norm(const Point_<_Tp>& pt) + { + return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y); + } + */ + static double Norm(Point2f p) + { + return Math.Sqrt((double)p.X * p.X + (double)p.Y * p.Y); + } + } + + /// + /// Any 3 end points of the RotatedRect. They must be given in order (either clockwise or anticlockwise). + /// + public static RotatedRect FromThreeVertexPoints(Point2f point1, Point2f point2, Point2f point3) + => NativeMethods.core_RotatedRect_byThreeVertexPoints(point1, point2, point3); + + /// + /// returns 4 vertices of the rectangle + /// + /// + public readonly Point2f[] Points() + { + var angle = Angle*Math.PI/180.0; + var b = (float) Math.Cos(angle)*0.5f; + var a = (float) Math.Sin(angle)*0.5f; + + var pt = new Point2f[4]; + pt[0].X = Center.X - a*Size.Height - b*Size.Width; + pt[0].Y = Center.Y + b*Size.Height - a*Size.Width; + pt[1].X = Center.X + a*Size.Height - b*Size.Width; + pt[1].Y = Center.Y - b*Size.Height - a*Size.Width; + pt[2].X = 2*Center.X - pt[0].X; + pt[2].Y = 2*Center.Y - pt[0].Y; + pt[3].X = 2*Center.X - pt[1].X; + pt[3].Y = 2*Center.Y - pt[1].Y; + return pt; + } + + /// + /// returns the minimal up-right rectangle containing the rotated rectangle + /// + /// + public readonly Rect BoundingRect() + { + var pt = Points(); + var r = new Rect + { + X = (int)Math.Floor(Math.Min(Math.Min(Math.Min(pt[0].X, pt[1].X), pt[2].X), pt[3].X)), + Y = (int)Math.Floor(Math.Min(Math.Min(Math.Min(pt[0].Y, pt[1].Y), pt[2].Y), pt[3].Y)), + Width = (int)Math.Ceiling(Math.Max(Math.Max(Math.Max(pt[0].X, pt[1].X), pt[2].X), pt[3].X)), + Height = (int)Math.Ceiling(Math.Max(Math.Max(Math.Max(pt[0].Y, pt[1].Y), pt[2].Y), pt[3].Y)) + }; + r.Width -= r.X - 1; + r.Height -= r.Y - 1; + return r; + } +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Scalar.cs b/src/OpenCvSharp/Modules/core/Struct/Scalar.cs new file mode 100644 index 000000000..204903e1e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Scalar.cs @@ -0,0 +1,959 @@ +using System.Runtime.InteropServices; +using System.Security.Cryptography; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// Template class for a 4-element vector derived from Vec. +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Scalar(double Val0, double Val1, double Val2, double Val3) +{ + #region Field + + /// + /// + /// + public double Val0 = Val0; + + /// + /// + /// + public double Val1 = Val1; + + /// + /// + /// + public double Val2 = Val2; + + /// + /// + /// + public double Val3 = Val3; + + /// + /// + /// + public double this[int i] + { + get => + i switch + { + 0 => Val0, + 1 => Val1, + 2 => Val2, + 3 => Val3, + _ => throw new ArgumentOutOfRangeException(nameof(i)), + }; + set + { + switch (i) + { + case 0: + Val0 = value; + break; + case 1: + Val1 = value; + break; + case 2: + Val2 = value; + break; + case 3: + Val3 = value; + break; + default: + throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + + #region Init + + /// + /// + /// + /// + public Scalar(double val0) + : this(val0, 0, 0, 0) + { + } + + /// + /// + /// + /// + /// + public Scalar(double val0, double val1) + : this(val0, val1, 0, 0) + { + } + + /// + /// + /// + /// + /// + /// + public Scalar(double val0, double val1, double val2) + : this(val0, val1, val2, 0) + { + } + + /// + /// + /// + /// + /// + /// + public static Scalar FromRgb(int r, int g, int b) + { + return new(b, g, r); + } + + /// + /// Gets random color + /// + public static Scalar RandomColor() => RandomColor(defaultRng); + + /// + /// Gets random color + /// + /// .NET random number generator. This method uses Random.NextBytes() + public static Scalar RandomColor(RandomNumberGenerator rng) + { + if (rng is null) + throw new ArgumentNullException(nameof(rng)); + + var buf = new byte[3]; + rng.GetBytes(buf); + return new Scalar(buf[0], buf[1], buf[2]); + } + + private static readonly RandomNumberGenerator defaultRng = RandomNumberGenerator.Create(); + + #endregion + + #region Cast + +#pragma warning disable 1591 + + public readonly double ToDouble() => Val0; + public readonly DMatch ToDMatch() => new((int)Val0, (int)Val1, (int)Val2, (float)Val3); + + public static explicit operator double(Scalar self) => self.ToDouble(); + public static explicit operator DMatch(Scalar self) => new((int)self.Val0, (int)self.Val1, (int)self.Val2, (float)self.Val3); + + // ReSharper disable InconsistentNaming + public static Scalar FromDouble(double val) => new(val); + public static Scalar FromDMatch(DMatch d) => new(d.QueryIdx, d.TrainIdx, d.ImgIdx, d.Distance); + public static Scalar FromVec3b(Vec3b v) => new(v.Item0, v.Item1, v.Item2); + public static Scalar FromVec3f(Vec3f v) => new(v.Item0, v.Item1, v.Item2); + public static Scalar FromVec4f(Vec4f v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromVec6f(Vec6f v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromVec3d(Vec3d v) => new(v.Item0, v.Item1, v.Item2); + public static Scalar FromVec4d(Vec4d v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromVec6d(Vec6d v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromPoint(Point p) => new(p.X, p.Y); + public static Scalar FromPoint2f(Point2f p) => new(p.X, p.Y); + public static Scalar FromPoint2d(Point2d p) => new(p.X, p.Y); + public static Scalar FromPoint3i(Point3i p) => new(p.X, p.Y, p.Z); + public static Scalar FromPoint3f(Point3f p) => new(p.X, p.Y, p.Z); + public static Scalar FromPoint3d(Point3d p) => new(p.X, p.Y, p.Z); + public static Scalar FromRect(Rect p) => new(p.X, p.Y, p.Width, p.Height); + // ReSharper restore InconsistentNaming + + public static explicit operator Scalar(double val) => FromDouble(val); + public static explicit operator Scalar(DMatch d) => FromDMatch(d); + public static explicit operator Scalar(Vec3b v) => FromVec3b(v); + public static explicit operator Scalar(Vec3f v) => FromVec3f(v); + public static explicit operator Scalar(Vec4f v) => FromVec4f(v); + public static explicit operator Scalar(Vec6f v) => FromVec6f(v); + public static explicit operator Scalar(Vec3d v) => FromVec3d(v); + public static explicit operator Scalar(Vec4d v) => FromVec4d(v); + public static explicit operator Scalar(Vec6d v) => FromVec6d(v); + public static explicit operator Scalar(Point p) => FromPoint(p); + public static explicit operator Scalar(Point2f p) => FromPoint2f(p); + public static explicit operator Scalar(Point2d p) => FromPoint2d(p); + public static explicit operator Scalar(Point3i p) => FromPoint3i(p); + public static explicit operator Scalar(Point3f p) => FromPoint3f(p); + public static explicit operator Scalar(Point3d p) => FromPoint3d(p); + public static explicit operator Scalar(Rect p) => FromRect(p); + +#pragma warning restore 1591 + + #endregion + + #region Methods + + /// + /// + /// + /// + /// + public static Scalar All(double v) + { + return new(v, v, v, v); + } + + /// + /// + /// + /// + /// + /// + public readonly Scalar Mul(Scalar it, double scale) + { + return new(Val0*it.Val0*scale, Val1*it.Val1*scale, + Val2*it.Val2*scale, Val3*it.Val3*scale); + } + + /// + /// + /// + /// + /// + public readonly Scalar Mul(Scalar it) + { + return Mul(it, 1); + } + + /// + /// + /// + /// + public readonly Scalar Conj() + { + return new(Val0, -Val1, -Val2, -Val3); + } + + /// + /// + /// + /// + public readonly bool IsReal() + { + // ReSharper disable CompareOfFloatsByEqualityOperator + return Val1 == 0 && Val2 == 0 && Val3 == 0; + } + + /// + /// + /// + /// + // ReSharper disable once InconsistentNaming + public readonly Vec3b ToVec3b() + { + return new((byte)Val0, (byte)Val1, (byte)Val2); + } + + #endregion + + #region Existing Color Constants + + /// + /// #F0F8FF + /// + public static readonly Scalar AliceBlue = FromRgb(240, 248, 255); + + /// + /// #FAEBD7 + /// + public static readonly Scalar AntiqueWhite = FromRgb(250, 235, 215); + + /// + /// #00FFFF + /// + public static readonly Scalar Aqua = FromRgb(0, 255, 255); + + /// + /// #7FFFD4 + /// + public static readonly Scalar Aquamarine = FromRgb(127, 255, 212); + + /// + /// #F0FFFF + /// + public static readonly Scalar Azure = FromRgb(240, 255, 255); + + /// + /// #F5F5DC + /// + public static readonly Scalar Beige = FromRgb(245, 245, 220); + + /// + /// #FFE4C4 + /// + public static readonly Scalar Bisque = FromRgb(255, 228, 196); + + /// + /// #000000 + /// + public static readonly Scalar Black = FromRgb(0, 0, 0); + + /// + /// #FFEBCD + /// + public static readonly Scalar BlanchedAlmond = FromRgb(255, 235, 205); + + /// + /// #0000FF + /// + public static readonly Scalar Blue = FromRgb(0, 0, 255); + + /// + /// #8A2BE2 + /// + public static readonly Scalar BlueViolet = FromRgb(138, 43, 226); + + /// + /// #A52A2A + /// + public static readonly Scalar Brown = FromRgb(165, 42, 42); + + /// + /// #DEB887 + /// + public static readonly Scalar BurlyWood = FromRgb(222, 184, 135); + + /// + /// #5F9EA0 + /// + public static readonly Scalar CadetBlue = FromRgb(95, 158, 160); + + /// + /// #7FFF00 + /// + public static readonly Scalar Chartreuse = FromRgb(127, 255, 0); + + /// + /// #D2691E + /// + public static readonly Scalar Chocolate = FromRgb(210, 105, 30); + + /// + /// #FF7F50 + /// + public static readonly Scalar Coral = FromRgb(255, 127, 80); + + /// + /// #6495ED + /// + public static readonly Scalar CornflowerBlue = FromRgb(100, 149, 237); + + /// + /// #FFF8DC + /// + public static readonly Scalar Cornsilk = FromRgb(255, 248, 220); + + /// + /// #DC143C + /// + public static readonly Scalar Crimson = FromRgb(220, 20, 60); + + /// + /// #00FFFF + /// + public static readonly Scalar Cyan = FromRgb(0, 255, 255); + + /// + /// #00008B + /// + public static readonly Scalar DarkBlue = FromRgb(0, 0, 139); + + /// + /// #008B8B + /// + public static readonly Scalar DarkCyan = FromRgb(0, 139, 139); + + /// + /// #B8860B + /// + public static readonly Scalar DarkGoldenrod = FromRgb(184, 134, 11); + + /// + /// #A9A9A9 + /// + public static readonly Scalar DarkGray = FromRgb(169, 169, 169); + + /// + /// #006400 + /// + public static readonly Scalar DarkGreen = FromRgb(0, 100, 0); + + /// + /// #BDB76B + /// + public static readonly Scalar DarkKhaki = FromRgb(189, 183, 107); + + /// + /// #8B008B + /// + public static readonly Scalar DarkMagenta = FromRgb(139, 0, 139); + + /// + /// #556B2F + /// + public static readonly Scalar DarkOliveGreen = FromRgb(85, 107, 47); + + /// + /// #FF8C00 + /// + public static readonly Scalar DarkOrange = FromRgb(255, 140, 0); + + /// + /// #9932CC + /// + public static readonly Scalar DarkOrchid = FromRgb(153, 50, 204); + + /// + /// #8B0000 + /// + public static readonly Scalar DarkRed = FromRgb(139, 0, 0); + + /// + /// #E9967A + /// + public static readonly Scalar DarkSalmon = FromRgb(233, 150, 122); + + /// + /// #8FBC8F + /// + public static readonly Scalar DarkSeaGreen = FromRgb(143, 188, 139); + + /// + /// #483D8B + /// + public static readonly Scalar DarkSlateBlue = FromRgb(72, 61, 139); + + /// + /// #2F4F4F + /// + public static readonly Scalar DarkSlateGray = FromRgb(47, 79, 79); + + /// + /// #00CED1 + /// + public static readonly Scalar DarkTurquoise = FromRgb(0, 206, 209); + + /// + /// #9400D3 + /// + public static readonly Scalar DarkViolet = FromRgb(148, 0, 211); + + /// + /// #FF1493 + /// + public static readonly Scalar DeepPink = FromRgb(255, 20, 147); + + /// + /// #00BFFF + /// + public static readonly Scalar DeepSkyBlue = FromRgb(0, 191, 255); + + /// + /// #696969 + /// + public static readonly Scalar DimGray = FromRgb(105, 105, 105); + + /// + /// #1E90FF + /// + public static readonly Scalar DodgerBlue = FromRgb(30, 144, 255); + + /// + /// #B22222 + /// + public static readonly Scalar Firebrick = FromRgb(178, 34, 34); + + /// + /// #FFFAF0 + /// + public static readonly Scalar FloralWhite = FromRgb(255, 250, 240); + + /// + /// #228B22 + /// + public static readonly Scalar ForestGreen = FromRgb(34, 139, 34); + + /// + /// #FF00FF + /// + public static readonly Scalar Fuchsia = FromRgb(255, 0, 255); + + /// + /// #DCDCDC + /// + public static readonly Scalar Gainsboro = FromRgb(220, 220, 220); + + /// + /// #F8F8FF + /// + public static readonly Scalar GhostWhite = FromRgb(248, 248, 255); + + /// + /// #FFD700 + /// + public static readonly Scalar Gold = FromRgb(255, 215, 0); + + /// + /// #DAA520 + /// + public static readonly Scalar Goldenrod = FromRgb(218, 165, 32); + + /// + /// #808080 + /// + public static readonly Scalar Gray = FromRgb(128, 128, 128); + + /// + /// #008000 + /// + public static readonly Scalar Green = FromRgb(0, 128, 0); + + /// + /// #ADFF2F + /// + public static readonly Scalar GreenYellow = FromRgb(173, 255, 47); + + /// + /// #F0FFF0 + /// + public static readonly Scalar Honeydew = FromRgb(240, 255, 240); + + /// + /// #FF69B4 + /// + public static readonly Scalar HotPink = FromRgb(255, 105, 180); + + /// + /// #CD5C5C + /// + public static readonly Scalar IndianRed = FromRgb(205, 92, 92); + + /// + /// #4B0082 + /// + public static readonly Scalar Indigo = FromRgb(75, 0, 130); + + /// + /// #FFFFF0 + /// + public static readonly Scalar Ivory = FromRgb(255, 255, 240); + + /// + /// #F0E68C + /// + public static readonly Scalar Khaki = FromRgb(240, 230, 140); + + /// + /// #E6E6FA + /// + public static readonly Scalar Lavender = FromRgb(230, 230, 250); + + /// + /// #FFF0F5 + /// + public static readonly Scalar LavenderBlush = FromRgb(255, 240, 245); + + /// + /// #7CFC00 + /// + public static readonly Scalar LawnGreen = FromRgb(124, 252, 0); + + /// + /// #FFFACD + /// + public static readonly Scalar LemonChiffon = FromRgb(255, 250, 205); + + /// + /// #ADD8E6 + /// + public static readonly Scalar LightBlue = FromRgb(173, 216, 230); + + /// + /// #F08080 + /// + public static readonly Scalar LightCoral = FromRgb(240, 128, 128); + + /// + /// #E0FFFF + /// + public static readonly Scalar LightCyan = FromRgb(224, 255, 255); + + /// + /// #FAFAD2 + /// + public static readonly Scalar LightGoldenrodYellow = FromRgb(250, 250, 210); + + /// + /// #D3D3D3 + /// + public static readonly Scalar LightGray = FromRgb(211, 211, 211); + + /// + /// #90EE90 + /// + public static readonly Scalar LightGreen = FromRgb(144, 238, 144); + + /// + /// #FFB6C1 + /// + public static readonly Scalar LightPink = FromRgb(255, 182, 193); + + /// + /// #FFA07A + /// + public static readonly Scalar LightSalmon = FromRgb(255, 160, 122); + + /// + /// #20B2AA + /// + public static readonly Scalar LightSeaGreen = FromRgb(32, 178, 170); + + /// + /// #87CEFA + /// + public static readonly Scalar LightSkyBlue = FromRgb(135, 206, 250); + + /// + /// #778899 + /// + public static readonly Scalar LightSlateGray = FromRgb(119, 136, 153); + + /// + /// #B0C4DE + /// + public static readonly Scalar LightSteelBlue = FromRgb(176, 196, 222); + + /// + /// #FFFFE0 + /// + public static readonly Scalar LightYellow = FromRgb(255, 255, 224); + + /// + /// #00FF00 + /// + public static readonly Scalar Lime = FromRgb(0, 255, 0); + + /// + /// #32CD32 + /// + public static readonly Scalar LimeGreen = FromRgb(50, 205, 50); + + /// + /// #FAF0E6 + /// + public static readonly Scalar Linen = FromRgb(250, 240, 230); + + /// + /// #FF00FF + /// + public static readonly Scalar Magenta = FromRgb(255, 0, 255); + + /// + /// #800000 + /// + public static readonly Scalar Maroon = FromRgb(128, 0, 0); + + /// + /// #66CDAA + /// + public static readonly Scalar MediumAquamarine = FromRgb(102, 205, 170); + + /// + /// #0000CD + /// + public static readonly Scalar MediumBlue = FromRgb(0, 0, 205); + + /// + /// #BA55D3 + /// + public static readonly Scalar MediumOrchid = FromRgb(186, 85, 211); + + /// + /// #9370DB + /// + public static readonly Scalar MediumPurple = FromRgb(147, 112, 219); + + /// + /// #3CB371 + /// + public static readonly Scalar MediumSeaGreen = FromRgb(60, 179, 113); + + /// + /// #7B68EE + /// + public static readonly Scalar MediumSlateBlue = FromRgb(123, 104, 238); + + /// + /// #00FA9A + /// + public static readonly Scalar MediumSpringGreen = FromRgb(0, 250, 154); + + /// + /// #48D1CC + /// + public static readonly Scalar MediumTurquoise = FromRgb(72, 209, 204); + + /// + /// #C71585 + /// + public static readonly Scalar MediumVioletRed = FromRgb(199, 21, 133); + + /// + /// #191970 + /// + public static readonly Scalar MidnightBlue = FromRgb(25, 25, 112); + + /// + /// #F5FFFA + /// + public static readonly Scalar MintCream = FromRgb(245, 255, 250); + + /// + /// #FFE4E1 + /// + public static readonly Scalar MistyRose = FromRgb(255, 228, 225); + + /// + /// #FFE4B5 + /// + public static readonly Scalar Moccasin = FromRgb(255, 228, 181); + + /// + /// #FFDEAD + /// + public static readonly Scalar NavajoWhite = FromRgb(255, 222, 173); + + /// + /// #000080 + /// + public static readonly Scalar Navy = FromRgb(0, 0, 128); + + /// + /// #FDF5E6 + /// + public static readonly Scalar OldLace = FromRgb(253, 245, 230); + + /// + /// #808000 + /// + public static readonly Scalar Olive = FromRgb(128, 128, 0); + + /// + /// #6B8E23 + /// + public static readonly Scalar OliveDrab = FromRgb(107, 142, 35); + + /// + /// #FFA500 + /// + public static readonly Scalar Orange = FromRgb(255, 165, 0); + + /// + /// #FF4500 + /// + public static readonly Scalar OrangeRed = FromRgb(255, 69, 0); + + /// + /// #DA70D6 + /// + public static readonly Scalar Orchid = FromRgb(218, 112, 214); + + /// + /// #EEE8AA + /// + public static readonly Scalar PaleGoldenrod = FromRgb(238, 232, 170); + + /// + /// #98FB98 + /// + public static readonly Scalar PaleGreen = FromRgb(152, 251, 152); + + /// + /// #AFEEEE + /// + public static readonly Scalar PaleTurquoise = FromRgb(175, 238, 238); + + /// + /// #DB7093 + /// + public static readonly Scalar PaleVioletRed = FromRgb(219, 112, 147); + + /// + /// #FFEFD5 + /// + public static readonly Scalar PapayaWhip = FromRgb(255, 239, 213); + + /// + /// #FFDAB9 + /// + public static readonly Scalar PeachPuff = FromRgb(255, 218, 185); + + /// + /// #CD853F + /// + public static readonly Scalar Peru = FromRgb(205, 133, 63); + + /// + /// #FFC0CB + /// + public static readonly Scalar Pink = FromRgb(255, 192, 203); + + /// + /// #DDA0DD + /// + public static readonly Scalar Plum = FromRgb(221, 160, 221); + + /// + /// #B0E0E6 + /// + public static readonly Scalar PowderBlue = FromRgb(176, 224, 230); + + /// + /// #800080 + /// + public static readonly Scalar Purple = FromRgb(128, 0, 128); + + /// + /// #FF0000 + /// + public static readonly Scalar Red = FromRgb(255, 0, 0); + + /// + /// #BC8F8F + /// + public static readonly Scalar RosyBrown = FromRgb(188, 143, 143); + + /// + /// #4169E1 + /// + public static readonly Scalar RoyalBlue = FromRgb(65, 105, 225); + + /// + /// #8B4513 + /// + public static readonly Scalar SaddleBrown = FromRgb(139, 69, 19); + + /// + /// #FA8072 + /// + public static readonly Scalar Salmon = FromRgb(250, 128, 114); + + /// + /// #F4A460 + /// + public static readonly Scalar SandyBrown = FromRgb(244, 164, 96); + + /// + /// #2E8B57 + /// + public static readonly Scalar SeaGreen = FromRgb(46, 139, 87); + + /// + /// #FFF5EE + /// + public static readonly Scalar SeaShell = FromRgb(255, 245, 238); + + /// + /// #A0522D + /// + public static readonly Scalar Sienna = FromRgb(160, 82, 45); + + /// + /// #C0C0C0 + /// + public static readonly Scalar Silver = FromRgb(192, 192, 192); + + /// + /// #87CEEB + /// + public static readonly Scalar SkyBlue = FromRgb(135, 206, 235); + + /// + /// #6A5ACD + /// + public static readonly Scalar SlateBlue = FromRgb(106, 90, 205); + + /// + /// #708090 + /// + public static readonly Scalar SlateGray = FromRgb(112, 128, 144); + + /// + /// #FFFAFA + /// + public static readonly Scalar Snow = FromRgb(255, 250, 250); + + /// + /// #00FF7F + /// + public static readonly Scalar SpringGreen = FromRgb(0, 255, 127); + + /// + /// #4682B4 + /// + public static readonly Scalar SteelBlue = FromRgb(70, 130, 180); + + /// + /// #D2B48C + /// + public static readonly Scalar Tan = FromRgb(210, 180, 140); + + /// + /// #008080 + /// + public static readonly Scalar Teal = FromRgb(0, 128, 128); + + /// + /// #D8BFD8 + /// + public static readonly Scalar Thistle = FromRgb(216, 191, 216); + + /// + /// #FF6347 + /// + public static readonly Scalar Tomato = FromRgb(255, 99, 71); + + /// + /// #40E0D0 + /// + public static readonly Scalar Turquoise = FromRgb(64, 224, 208); + + /// + /// #EE82EE + /// + public static readonly Scalar Violet = FromRgb(238, 130, 238); + + /// + /// #F5DEB3 + /// + public static readonly Scalar Wheat = FromRgb(245, 222, 179); + + /// + /// #FFFFFF + /// + public static readonly Scalar White = FromRgb(255, 255, 255); + + /// + /// #F5F5F5 + /// + public static readonly Scalar WhiteSmoke = FromRgb(245, 245, 245); + + /// + /// #FFFF00 + /// + public static readonly Scalar Yellow = FromRgb(255, 255, 0); + + /// + /// #9ACD32 + /// + public static readonly Scalar YellowGreen = FromRgb(154, 205, 50); + + #endregion +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Size.cs b/src/OpenCvSharp/Modules/core/Struct/Size.cs new file mode 100644 index 000000000..6fda432a9 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Size.cs @@ -0,0 +1,47 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public record struct Size(int Width, int Height) +{ + /// + /// + /// + public int Width = Width; + + /// + /// + /// + public int Height = Height; + + /// + /// Constructor + /// + /// + /// + public Size(double width, double height) + : this((int)width, (int)height) + { + } + +#pragma warning disable CA2225 + /// + /// + /// + public static explicit operator Size(Size2d size) + => new(size.Width, size.Height); + + /// + /// + /// + public static explicit operator Size(Size2f size) + => new(size.Width, size.Height); +#pragma warning restore CA2225 +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Size2d.cs b/src/OpenCvSharp/Modules/core/Struct/Size2d.cs new file mode 100644 index 000000000..8511fd538 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Size2d.cs @@ -0,0 +1,48 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public record struct Size2d(double Width, double Height) +{ + /// + /// + /// + public double Width = Width; + + /// + /// + /// + public double Height = Height; + +#pragma warning disable CA2225 + /// + /// + /// + public static implicit operator Size2d(Size size) + => new(size.Width, size.Height); + + /// + /// + /// + public static implicit operator Size2d(Size2f size) + => new(size.Width, size.Height); +#pragma warning restore CA2225 + + /// + /// + /// + public readonly Size ToSize() => new (Width, Height); + + /// + /// + /// + // ReSharper disable once InconsistentNaming + public readonly Size2f ToSize2f() => new (Width, Height); +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Size2f.cs b/src/OpenCvSharp/Modules/core/Struct/Size2f.cs new file mode 100644 index 000000000..9395156cc --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Size2f.cs @@ -0,0 +1,58 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +// ReSharper disable once InconsistentNaming +public record struct Size2f(float Width, float Height) +{ + /// + /// + /// + public float Width = Width; + + /// + /// + /// + public float Height = Height; + + /// + /// Constructor + /// + /// + /// + public Size2f(double width, double height) + : this((float)width, (float)height) + { + } + +#pragma warning disable CA2225 + /// + /// + /// + public static implicit operator Size2f(Size size) + => new(size.Width, size.Height); + + /// + /// + /// + public static explicit operator Size2f(Size2d size) + => new(size.Width, size.Height); +#pragma warning restore CA2225 + + /// + /// + /// + public readonly Size ToSize() => new (Width, Height); + + /// + /// + /// + public readonly Size2d ToSize2d() => new (Width, Height); +} diff --git a/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs b/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs new file mode 100644 index 000000000..527a29948 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs @@ -0,0 +1,37 @@ +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// The class defining termination criteria for iterative algorithms. +/// +public readonly record struct TermCriteria(CriteriaTypes Type, int MaxCount, double Epsilon) +{ + /// + /// the type of termination criteria: COUNT, EPS or COUNT + EPS + /// + public readonly CriteriaTypes Type = Type; + + /// + /// the maximum number of iterations/elements + /// + public readonly int MaxCount = MaxCount; + + /// + /// the desired accuracy + /// + public readonly double Epsilon = Epsilon; + + /// + /// full constructor with both type (count | epsilon) + /// + /// + /// + public static TermCriteria Both(int maxCount, double epsilon) + { + return new ( + Type: CriteriaTypes.Count | CriteriaTypes.Eps, + MaxCount: maxCount, + Epsilon: epsilon); + } +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/IVec.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/IVec.cs new file mode 100644 index 000000000..6a21f61f6 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/IVec.cs @@ -0,0 +1,53 @@ +#pragma warning disable CA1040 // Avoid empty interfaces + +namespace OpenCvSharp; + +/// +/// Vec empty interface +/// +public interface IVec; + +/// +/// Vec** interface +/// +/// +/// +public interface IVec : IVec + where TSelf : IVec + where TElem : unmanaged +{ + /// + /// this + other + /// + /// + /// + public TSelf Add(TSelf other); + + /// + /// this - other + /// + /// + /// + public TSelf Subtract(TSelf other); + + /// + /// this * alpha + /// + /// + /// + public TSelf Multiply(double alpha); + + /// + /// this * alpha + /// + /// + /// + public TSelf Divide(double alpha); + + /// + /// indexer + /// + /// + /// + TElem this[int i] { get; } +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs new file mode 100644 index 000000000..5e43b6dca --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs @@ -0,0 +1,174 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 2-Tuple of byte (System.Byte) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec2b : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public byte Item0; + + /// + /// The value of the second component of this object. + /// + public byte Item1; + + /// + /// Deconstructing a Vector + /// + /// + /// + public readonly void Deconstruct(out byte item0, out byte item1) => (item0, item1) = (Item0, Item1); + + /// + /// Initializer + /// + /// + /// + public Vec2b(byte item0, byte item1) + { + Item0 = item0; + Item1 = item1; + } + + /// + /// returns a Vec with all elements set to v0 + /// + /// + /// + public static Vec2b All(byte v0) => new(v0, v0); + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec2b Add(Vec2b other) => new( + SaturateCast.ToByte(Item0 + other.Item0), + SaturateCast.ToByte(Item1 + other.Item1)); + + /// + /// this - other + /// + /// + /// + public readonly Vec2b Subtract(Vec2b other) => new( + SaturateCast.ToByte(Item0 - other.Item0), + SaturateCast.ToByte(Item1 - other.Item1)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec2b Multiply(double alpha) => new( + SaturateCast.ToByte(Item0 * alpha), + SaturateCast.ToByte(Item1 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec2b Divide(double alpha) => new( + SaturateCast.ToByte(Item0 / alpha), + SaturateCast.ToByte(Item1 / alpha)); + +#pragma warning disable 1591 + public static Vec2b operator +(Vec2b a, Vec2b b) => a.Add(b); + public static Vec2b operator -(Vec2b a, Vec2b b) => a.Subtract(b); + public static Vec2b operator *(Vec2b a, double alpha) => a.Multiply(alpha); + public static Vec2b operator /(Vec2b a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public byte this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec2s ToVec2s() => new(Item0, Item1); + public Vec2w ToVec2w() => new(Item0, Item1); + public Vec2i ToVec2i() => new(Item0, Item1); + public Vec2f ToVec2f() => new(Item0, Item1); + public Vec2d ToVec2d() => new(Item0, Item1); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec2b other) => + Item0 == other.Item0 && + Item1 == other.Item1; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec2b v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec2b a, Vec2b b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec2b a, Vec2b b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + return (Item0.GetHashCode() * 397) ^ Item1.GetHashCode(); + } +#else + return HashCode.Combine(Item0, Item1); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec2b)} ({Item0}, {Item1})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs new file mode 100644 index 000000000..1e716487d --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs @@ -0,0 +1,157 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// 2-Tuple of double (System.Double) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public struct Vec2d : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public double Item0; + + /// + /// The value of the second component of this object. + /// + public double Item1; + + /// + /// Deconstructing a Vector + /// + /// + /// + public readonly void Deconstruct(out double item0, out double item1) => (item0, item1) = (Item0, Item1); + + /// + /// Initializer + /// + /// + /// + public Vec2d(double item0, double item1) + { + Item0 = item0; + Item1 = item1; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec2d Add(Vec2d other) => new( + Item0 + other.Item0, + Item1 + other.Item1); + + /// + /// this - other + /// + /// + /// + public readonly Vec2d Subtract(Vec2d other) => new( + Item0 - other.Item0, + Item1 - other.Item1); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec2d Multiply(double alpha) => new( + Item0 * alpha, + Item1 * alpha); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec2d Divide(double alpha) => new( + Item0 / alpha, + Item1 / alpha); + +#pragma warning disable 1591 + public static Vec2d operator +(Vec2d a, Vec2d b) => a.Add(b); + public static Vec2d operator -(Vec2d a, Vec2d b) => a.Subtract(b); + public static Vec2d operator *(Vec2d a, double alpha) => a.Multiply(alpha); + public static Vec2d operator /(Vec2d a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public double this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + + /// + public readonly bool Equals(Vec2d other) => Item0.Equals(other.Item0) && Item1.Equals(other.Item1); + + /// + /// + /// + /// + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec2d v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec2d a, Vec2d b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec2d a, Vec2d b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + return (Item0.GetHashCode() * 397) ^ Item1.GetHashCode(); + } +#else + return HashCode.Combine(Item0, Item1); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec2d)} ({Item0}, {Item1})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs new file mode 100644 index 000000000..0f7f2c7d3 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs @@ -0,0 +1,161 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 2-Tuple of float (System.Single) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec2f : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public float Item0; + + /// + /// The value of the second component of this object. + /// + public float Item1; + + /// + /// Deconstructing a Vector + /// + /// + /// + public readonly void Deconstruct(out float item0, out float item1) => (item0, item1) = (Item0, Item1); + + /// + /// Initializer + /// + /// + /// + public Vec2f(float item0, float item1) + { + Item0 = item0; + Item1 = item1; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec2f Add(Vec2f other) => new( + Item0 + other.Item0, + Item1 + other.Item1); + + /// + /// this - other + /// + /// + /// + public readonly Vec2f Subtract(Vec2f other) => new( + Item0 - other.Item0, + Item1 - other.Item1); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec2f Multiply(double alpha) => new( + (float)(Item0 * alpha), + (float)(Item1 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec2f Divide(double alpha) => new( + (float)(Item0 / alpha), + (float)(Item1 / alpha)); + +#pragma warning disable 1591 + public static Vec2f operator +(Vec2f a, Vec2f b) => a.Add(b); + public static Vec2f operator -(Vec2f a, Vec2f b) => a.Subtract(b); + public static Vec2f operator *(Vec2f a, double alpha) => a.Multiply(alpha); + public static Vec2f operator /(Vec2f a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public float this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec2i ToVec2i() => new((int)Item0, (int)Item1); + public Vec2d ToVec2d() => new(Item0, Item1); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec2f other) => Item0.Equals(other.Item0) && Item1.Equals(other.Item1); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec2f v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec2f a, Vec2f b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec2f a, Vec2f b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + return (Item0.GetHashCode() * 397) ^ Item1.GetHashCode(); + } +#else + return HashCode.Combine(Item0, Item1); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec2f)} ({Item0}, {Item1})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs new file mode 100644 index 000000000..7e6f20b98 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs @@ -0,0 +1,164 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 2-Tuple of int (System.Int32) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec2i : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public int Item0; + + /// + /// The value of the second component of this object. + /// + public int Item1; + + /// + /// Deconstructing a Vector + /// + /// + /// + public readonly void Deconstruct(out int item0, out int item1) => (item0, item1) = (Item0, Item1); + + /// + /// Initializer + /// + /// + /// + public Vec2i(int item0, int item1) + { + Item0 = item0; + Item1 = item1; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec2i Add(Vec2i other) => new( + SaturateCast.ToInt32(Item0 + other.Item0), + SaturateCast.ToInt32(Item1 + other.Item1)); + + /// + /// this - other + /// + /// + /// + public readonly Vec2i Subtract(Vec2i other) => new( + SaturateCast.ToInt32(Item0 - other.Item0), + SaturateCast.ToInt32(Item1 - other.Item1)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec2i Multiply(double alpha) => new( + SaturateCast.ToInt32(Item0 * alpha), + SaturateCast.ToInt32(Item1 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec2i Divide(double alpha) => new( + SaturateCast.ToInt32(Item0 / alpha), + SaturateCast.ToInt32(Item1 / alpha)); + +#pragma warning disable 1591 + public static Vec2i operator +(Vec2i a, Vec2i b) => a.Add(b); + public static Vec2i operator -(Vec2i a, Vec2i b) => a.Subtract(b); + public static Vec2i operator *(Vec2i a, double alpha) => a.Multiply(alpha); + public static Vec2i operator /(Vec2i a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public int this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec2f ToVec2f() => new(Item0, Item1); + public Vec2d ToVec2d() => new(Item0, Item1); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec2i other) => + Item0 == other.Item0 && + Item1 == other.Item1; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec2i v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec2i a, Vec2i b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec2i a, Vec2i b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + return (Item0 * 397) ^ Item1; + } +#else + return HashCode.Combine(Item0, Item1); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec2i)} ({Item0}, {Item1})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs new file mode 100644 index 000000000..ab67d0fa5 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs @@ -0,0 +1,164 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// 2-Tuple of short (System.Int16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +// ReSharper disable once InconsistentNaming +public struct Vec2s : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public short Item0; + + /// + /// The value of the second component of this object. + /// + public short Item1; + + /// + /// Deconstructing a Vector + /// + /// + /// + public readonly void Deconstruct(out short item0, out short item1) => (item0, item1) = (Item0, Item1); + + /// + /// Initializer + /// + /// + /// + public Vec2s(short item0, short item1) + { + Item0 = item0; + Item1 = item1; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec2s Add(Vec2s other) => new( + SaturateCast.ToInt16(Item0 + other.Item0), + SaturateCast.ToInt16(Item1 + other.Item1)); + + /// + /// this - other + /// + /// + /// + public readonly Vec2s Subtract(Vec2s other) => new( + SaturateCast.ToInt16(Item0 - other.Item0), + SaturateCast.ToInt16(Item1 - other.Item1)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec2s Multiply(double alpha) => new( + SaturateCast.ToInt16(Item0 * alpha), + SaturateCast.ToInt16(Item1 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec2s Divide(double alpha) => new( + SaturateCast.ToInt16(Item0 / alpha), + SaturateCast.ToInt16(Item1 / alpha)); + +#pragma warning disable 1591 + public static Vec2s operator +(Vec2s a, Vec2s b) => a.Add(b); + public static Vec2s operator -(Vec2s a, Vec2s b) => a.Subtract(b); + public static Vec2s operator *(Vec2s a, double alpha) => a.Multiply(alpha); + public static Vec2s operator /(Vec2s a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public short this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec2w ToVec2w() => new((ushort)Item0, (ushort)Item1); + public Vec2i ToVec2i() => new(Item0, Item1); + public Vec2f ToVec2f() => new(Item0, Item1); + public Vec2d ToVec2d() => new(Item0, Item1); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec2s other) => Item0 == other.Item0 && Item1 == other.Item1; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec2s v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec2s a, Vec2s b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec2s a, Vec2s b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + return (Item0.GetHashCode() * 397) ^ Item1.GetHashCode(); + } +#else + return HashCode.Combine(Item0, Item1); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec2s)} ({Item0}, {Item1})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs new file mode 100644 index 000000000..284ab61cb --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs @@ -0,0 +1,165 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 2-Tuple of ushort (System.UInt16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec2w : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public ushort Item0; + + /// + /// The value of the second component of this object. + /// + public ushort Item1; + + /// + /// Deconstructing a Vector + /// + /// + /// + public readonly void Deconstruct(out ushort item0, out ushort item1) => (item0, item1) = (Item0, Item1); + + /// + /// Initializer + /// + /// + /// + public Vec2w(ushort item0, ushort item1) + { + Item0 = item0; + Item1 = item1; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec2w Add(Vec2w other) => new( + SaturateCast.ToUInt16(Item0 + other.Item0), + SaturateCast.ToUInt16(Item1 + other.Item1)); + + /// + /// this - other + /// + /// + /// + public readonly Vec2w Subtract(Vec2w other) => new( + SaturateCast.ToUInt16(Item0 - other.Item0), + SaturateCast.ToUInt16(Item1 - other.Item1)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec2w Multiply(double alpha) => new( + SaturateCast.ToUInt16(Item0 * alpha), + SaturateCast.ToUInt16(Item1 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec2w Divide(double alpha) => new( + SaturateCast.ToUInt16(Item0 / alpha), + SaturateCast.ToUInt16(Item1 / alpha)); + +#pragma warning disable 1591 + public static Vec2w operator +(Vec2w a, Vec2w b) => a.Add(b); + public static Vec2w operator -(Vec2w a, Vec2w b) => a.Subtract(b); + public static Vec2w operator *(Vec2w a, double alpha) => a.Multiply(alpha); + public static Vec2w operator /(Vec2w a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public ushort this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec2s ToVec2s() => new((short)Item0, (short)Item1); + public Vec2i ToVec2i() => new(Item0, Item1); + public Vec2f ToVec2f() => new(Item0, Item1); + public Vec2d ToVec2d() => new(Item0, Item1); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec2w other) => Item0 == other.Item0 && Item1 == other.Item1; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec2w w && Equals(w); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec2w a, Vec2w b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec2w a, Vec2w b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + return (Item0.GetHashCode() * 397) ^ Item1.GetHashCode(); + } +#else + return HashCode.Combine(Item0, Item1); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec2w)} ({Item0}, {Item1})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs new file mode 100644 index 000000000..8de6ab418 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs @@ -0,0 +1,185 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 3-Tuple of byte (System.Byte) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec3b : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public byte Item0; + + /// + /// The value of the second component of this object. + /// + public byte Item1; + + /// + /// The value of the third component of this object. + /// + public byte Item2; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + public readonly void Deconstruct(out byte item0, out byte item1, out byte item2) => (item0, item1, item2) = (Item0, Item1, Item2); + + /// + /// Initializer + /// + /// + /// + /// + public Vec3b(byte item0, byte item1, byte item2) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec3b Add(Vec3b other) => new( + SaturateCast.ToByte(Item0 + other.Item0), + SaturateCast.ToByte(Item1 + other.Item1), + SaturateCast.ToByte(Item2 + other.Item2)); + + /// + /// this - other + /// + /// + /// + public readonly Vec3b Subtract(Vec3b other) => new( + SaturateCast.ToByte(Item0 - other.Item0), + SaturateCast.ToByte(Item1 - other.Item1), + SaturateCast.ToByte(Item2 - other.Item2)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec3b Multiply(double alpha) => new( + SaturateCast.ToByte(Item0 * alpha), + SaturateCast.ToByte(Item1 * alpha), + SaturateCast.ToByte(Item2 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec3b Divide(double alpha) => new( + SaturateCast.ToByte(Item0 / alpha), + SaturateCast.ToByte(Item1 / alpha), + SaturateCast.ToByte(Item2 / alpha)); + +#pragma warning disable 1591 + public static Vec3b operator +(Vec3b a, Vec3b b) => a.Add(b); + public static Vec3b operator -(Vec3b a, Vec3b b) => a.Subtract(b); + public static Vec3b operator *(Vec3b a, double alpha) => a.Multiply(alpha); + public static Vec3b operator /(Vec3b a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public byte this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec3s ToVec3s() => new(Item0, Item1, Item2); + public Vec3w ToVec3w() => new(Item0, Item1, Item2); + public Vec3i ToVec3i() => new(Item0, Item1, Item2); + public Vec3f ToVec3f() => new(Item0, Item1, Item2); + public Vec3d ToVec3d() => new(Item0, Item1, Item2); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec3b other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec3b b && Equals(b); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec3b a, Vec3b b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec3b a, Vec3b b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec3b)} ({Item0}, {Item1}, {Item2})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs new file mode 100644 index 000000000..ebe66f923 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs @@ -0,0 +1,171 @@ +using System.Runtime.InteropServices; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// 3-Tuple of double (System.Double) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +public struct Vec3d : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public double Item0; + + /// + /// The value of the second component of this object. + /// + public double Item1; + + /// + /// The value of the third component of this object. + /// + public double Item2; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + public readonly void Deconstruct(out double item0, out double item1, out double item2) + => (item0, item1, item2) = (Item0, Item1, Item2); + + /// + /// Initializer + /// + /// + /// + /// + public Vec3d(double item0, double item1, double item2) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec3d Add(Vec3d other) => new( + Item0 + other.Item0, + Item1 + other.Item1, + Item2 + other.Item2); + + /// + /// this - other + /// + /// + /// + public readonly Vec3d Subtract(Vec3d other) => new( + Item0 - other.Item0, + Item1 - other.Item1, + Item2 - other.Item2); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec3d Multiply(double alpha) => new( + Item0 * alpha, + Item1 * alpha, + Item2 * alpha); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec3d Divide(double alpha) => new( + Item0 / alpha, + Item1 / alpha, + Item2 / alpha); + +#pragma warning disable 1591 + public static Vec3d operator +(Vec3d a, Vec3d b) => a.Add(b); + public static Vec3d operator -(Vec3d a, Vec3d b) => a.Subtract(b); + public static Vec3d operator *(Vec3d a, double alpha) => a.Multiply(alpha); + public static Vec3d operator /(Vec3d a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public double this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + + /// + public readonly bool Equals(Vec3d other) => Item0.Equals(other.Item0) && Item1.Equals(other.Item1) && Item2.Equals(other.Item2); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec3d v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec3d a, Vec3d b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec3d a, Vec3d b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec3d)} ({Item0}, {Item1}, {Item2})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs new file mode 100644 index 000000000..e4f068589 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs @@ -0,0 +1,178 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 3-Tuple of float (System.Single) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec3f : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public float Item0; + + /// + /// The value of the second component of this object. + /// + public float Item1; + + /// + /// The value of the third component of this object. + /// + public float Item2; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + public readonly void Deconstruct(out float item0, out float item1, out float item2) => (item0, item1, item2) = (Item0, Item1, Item2); + + /// + /// Initializer + /// + /// + /// + /// + public Vec3f(float item0, float item1, float item2) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec3f Add(Vec3f other) => new( + Item0 + other.Item0, + Item1 + other.Item1, + Item2 + other.Item2); + + /// + /// this - other + /// + /// + /// + public readonly Vec3f Subtract(Vec3f other) => new( + Item0 - other.Item0, + Item1 - other.Item1, + Item2 - other.Item2); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec3f Multiply(double alpha) => new( + (float)(Item0 * alpha), + (float)(Item1 * alpha), + (float)(Item2 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec3f Divide(double alpha) => new( + (float)(Item0 / alpha), + (float)(Item1 / alpha), + (float)(Item2 / alpha)); + +#pragma warning disable 1591 + public static Vec3f operator +(Vec3f a, Vec3f b) => a.Add(b); + public static Vec3f operator -(Vec3f a, Vec3f b) => a.Subtract(b); + public static Vec3f operator *(Vec3f a, double alpha) => a.Multiply(alpha); + public static Vec3f operator /(Vec3f a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public float this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec3i ToVec3i() => new((int)Item0, (int)Item1, (int)Item2); + public Vec3d ToVec3d() => new(Item0, Item1, Item2); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec3f other) => Item0.Equals(other.Item0) && Item1.Equals(other.Item1) && Item2.Equals(other.Item2); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec3f v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec3f a, Vec3f b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec3f a, Vec3f b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec3f)} ({Item0}, {Item1}, {Item2})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs new file mode 100644 index 000000000..6a1ae0d34 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs @@ -0,0 +1,183 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 3-Tuple of int (System.Int32) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec3i : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public int Item0; + + /// + /// The value of the second component of this object. + /// + public int Item1; + + /// + /// The value of the third component of this object. + /// + public int Item2; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + public readonly void Deconstruct(out int item0, out int item1, out int item2) + => (item0, item1, item2) = (Item0, Item1, Item2); + + /// + /// Initializer + /// + /// + /// + /// + public Vec3i(int item0, int item1, int item2) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec3i Add(Vec3i other) => new( + SaturateCast.ToInt32(Item0 + other.Item0), + SaturateCast.ToInt32(Item1 + other.Item1), + SaturateCast.ToInt32(Item2 + other.Item2)); + + /// + /// this - other + /// + /// + /// + public readonly Vec3i Subtract(Vec3i other) => new( + SaturateCast.ToInt32(Item0 - other.Item0), + SaturateCast.ToInt32(Item1 - other.Item1), + SaturateCast.ToInt32(Item2 - other.Item2)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec3i Multiply(double alpha) => new( + SaturateCast.ToInt32(Item0 * alpha), + SaturateCast.ToInt32(Item1 * alpha), + SaturateCast.ToInt32(Item2 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec3i Divide(double alpha) => new( + SaturateCast.ToInt32(Item0 / alpha), + SaturateCast.ToInt32(Item1 / alpha), + SaturateCast.ToInt32(Item2 / alpha)); + +#pragma warning disable 1591 + public static Vec3i operator +(Vec3i a, Vec3i b) => a.Add(b); + public static Vec3i operator -(Vec3i a, Vec3i b) => a.Subtract(b); + public static Vec3i operator *(Vec3i a, double alpha) => a.Multiply(alpha); + public static Vec3i operator /(Vec3i a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public int this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec3f ToVec3f() => new(Item0, Item1, Item2); + public Vec3d ToVec3d() => new(Item0, Item1, Item2); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec3i other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec3i v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec3i a, Vec3i b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec3i a, Vec3i b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0; + hashCode = (hashCode * 397) ^ Item1; + hashCode = (hashCode * 397) ^ Item2; + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec3i)} ({Item0}, {Item1}, {Item2})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs new file mode 100644 index 000000000..1aec6c785 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs @@ -0,0 +1,185 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 3-Tuple of short (System.Int16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec3s : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public short Item0; + + /// + /// The value of the second component of this object. + /// + public short Item1; + + /// + /// The value of the third component of this object. + /// + public short Item2; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + public readonly void Deconstruct(out short item0, out short item1, out short item2) => (item0, item1, item2) = (Item0, Item1, Item2); + + /// + /// Initializer + /// + /// + /// + /// + public Vec3s(short item0, short item1, short item2) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec3s Add(Vec3s other) => new( + SaturateCast.ToInt16(Item0 + other.Item0), + SaturateCast.ToInt16(Item1 + other.Item1), + SaturateCast.ToInt16(Item2 + other.Item2)); + + /// + /// this - other + /// + /// + /// + public readonly Vec3s Subtract(Vec3s other) => new( + SaturateCast.ToInt16(Item0 - other.Item0), + SaturateCast.ToInt16(Item1 - other.Item1), + SaturateCast.ToInt16(Item2 - other.Item2)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec3s Multiply(double alpha) => new( + SaturateCast.ToInt16(Item0 * alpha), + SaturateCast.ToInt16(Item1 * alpha), + SaturateCast.ToInt16(Item2 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec3s Divide(double alpha) => new( + SaturateCast.ToInt16(Item0 / alpha), + SaturateCast.ToInt16(Item1 / alpha), + SaturateCast.ToInt16(Item2 / alpha)); + +#pragma warning disable 1591 + public static Vec3s operator +(Vec3s a, Vec3s b) => a.Add(b); + public static Vec3s operator -(Vec3s a, Vec3s b) => a.Subtract(b); + public static Vec3s operator *(Vec3s a, double alpha) => a.Multiply(alpha); + public static Vec3s operator /(Vec3s a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public short this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec3w ToVec3w() => new((ushort)Item0, (ushort)Item1, (ushort)Item2); + public Vec3i ToVec3i() => new(Item0, Item1, Item2); + public Vec3f ToVec3f() => new(Item0, Item1, Item2); + public Vec3d ToVec3d() => new(Item0, Item1, Item2); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec3s other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec3s v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec3s a, Vec3s b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec3s a, Vec3s b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec3s)} ({Item0}, {Item1}, {Item2})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs new file mode 100644 index 000000000..0dfd4ca3e --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs @@ -0,0 +1,186 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 3-Tuple of ushort (System.UInt16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec3w : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public ushort Item0; + + /// + /// The value of the second component of this object. + /// + public ushort Item1; + + /// + /// The value of the third component of this object. + /// + public ushort Item2; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + public readonly void Deconstruct(out ushort item0, out ushort item1, out ushort item2) + => (item0, item1, item2) = (Item0, Item1, Item2); + + /// + /// Initializer + /// + /// + /// + /// + public Vec3w(ushort item0, ushort item1, ushort item2) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec3w Add(Vec3w other) => new( + SaturateCast.ToUInt16(Item0 + other.Item0), + SaturateCast.ToUInt16(Item1 + other.Item1), + SaturateCast.ToUInt16(Item2 + other.Item2)); + + /// + /// this - other + /// + /// + /// + public readonly Vec3w Subtract(Vec3w other) => new( + SaturateCast.ToUInt16(Item0 - other.Item0), + SaturateCast.ToUInt16(Item1 - other.Item1), + SaturateCast.ToUInt16(Item2 - other.Item2)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec3w Multiply(double alpha) => new( + SaturateCast.ToUInt16(Item0 * alpha), + SaturateCast.ToUInt16(Item1 * alpha), + SaturateCast.ToUInt16(Item2 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec3w Divide(double alpha) => new( + SaturateCast.ToUInt16(Item0 / alpha), + SaturateCast.ToUInt16(Item1 / alpha), + SaturateCast.ToUInt16(Item2 / alpha)); + +#pragma warning disable 1591 + public static Vec3w operator +(Vec3w a, Vec3w b) => a.Add(b); + public static Vec3w operator -(Vec3w a, Vec3w b) => a.Subtract(b); + public static Vec3w operator *(Vec3w a, double alpha) => a.Multiply(alpha); + public static Vec3w operator /(Vec3w a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public ushort this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec3s ToVec3s() => new((short)Item0, (short)Item1, (short)Item2); + public Vec3i ToVec3i() => new(Item0, Item1, Item2); + public Vec3f ToVec3f() => new(Item0, Item1, Item2); + public Vec3d ToVec3d() => new(Item0, Item1, Item2); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec3w other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec3w v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec3w a, Vec3w b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec3w a, Vec3w b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec3w)} ({Item0}, {Item1}, {Item2})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs new file mode 100644 index 000000000..49ec3c9d8 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs @@ -0,0 +1,201 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// 4-Tuple of byte (System.Byte) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +// ReSharper disable once InconsistentNaming +public struct Vec4b : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public byte Item0; + + /// + /// The value of the second component of this object. + /// + public byte Item1; + + /// + /// The value of the third component of this object. + /// + public byte Item2; + + /// + /// The value of the fourth component of this object. + /// + public byte Item3; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + public readonly void Deconstruct(out byte item0, out byte item1, out byte item2, out byte item3) => (item0, item1, item2, item3) = (Item0, Item1, Item2, Item3); + + /// + /// Initializer + /// + /// + /// + /// + /// + public Vec4b(byte item0, byte item1, byte item2, byte item3) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec4b Add(Vec4b other) => new( + SaturateCast.ToByte(Item0 + other.Item0), + SaturateCast.ToByte(Item1 + other.Item1), + SaturateCast.ToByte(Item2 + other.Item2), + SaturateCast.ToByte(Item3 + other.Item3)); + + /// + /// this - other + /// + /// + /// + public readonly Vec4b Subtract(Vec4b other) => new( + SaturateCast.ToByte(Item0 - other.Item0), + SaturateCast.ToByte(Item1 - other.Item1), + SaturateCast.ToByte(Item2 - other.Item2), + SaturateCast.ToByte(Item3 - other.Item3)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec4b Multiply(double alpha) => new( + SaturateCast.ToByte(Item0 * alpha), + SaturateCast.ToByte(Item1 * alpha), + SaturateCast.ToByte(Item2 * alpha), + SaturateCast.ToByte(Item3 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec4b Divide(double alpha) => new( + SaturateCast.ToByte(Item0 / alpha), + SaturateCast.ToByte(Item1 / alpha), + SaturateCast.ToByte(Item2 / alpha), + SaturateCast.ToByte(Item3 / alpha)); + +#pragma warning disable 1591 + public static Vec4b operator +(Vec4b a, Vec4b b) => a.Add(b); + public static Vec4b operator -(Vec4b a, Vec4b b) => a.Subtract(b); + public static Vec4b operator *(Vec4b a, double alpha) => a.Multiply(alpha); + public static Vec4b operator /(Vec4b a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public byte this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec4s ToVec4s() => new(Item0, Item1, Item2, Item3); + public Vec4w ToVec4w() => new(Item0, Item1, Item2, Item3); + public Vec4i ToVec4i() => new(Item0, Item1, Item2, Item3); + public Vec4f ToVec4f() => new(Item0, Item1, Item2, Item3); + public Vec4d ToVec4d() => new(Item0, Item1, Item2, Item3); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec4b other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec4b v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec4b a, Vec4b b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec4b a, Vec4b b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec4b)} ({Item0}, {Item1}, {Item2}, {Item3})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs new file mode 100644 index 000000000..fadee7752 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs @@ -0,0 +1,190 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 4-Tuple of double (System.Double) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public struct Vec4d : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public double Item0; + + /// + /// The value of the second component of this object. + /// + public double Item1; + + /// + /// The value of the third component of this object. + /// + public double Item2; + + /// + /// The value of the fourth component of this object. + /// + public double Item3; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + public readonly void Deconstruct(out double item0, out double item1, out double item2, out double item3) + => (item0, item1, item2, item3) = (Item0, Item1, Item2, Item3); + + /// + /// Initializer + /// + /// + /// + /// + /// + public Vec4d(double item0, double item1, double item2, double item3) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec4d Add(Vec4d other) => new( + Item0 + other.Item0, + Item1 + other.Item1, + Item2 + other.Item2, + Item3 + other.Item3); + + /// + /// this - other + /// + /// + /// + public readonly Vec4d Subtract(Vec4d other) => new( + Item0 - other.Item0, + Item1 - other.Item1, + Item2 - other.Item2, + Item3 - other.Item3); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec4d Multiply(double alpha) => new( + Item0 * alpha, + Item1 * alpha, + Item2 * alpha, + Item3 * alpha); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec4d Divide(double alpha) => new( + Item0 / alpha, + Item1 / alpha, + Item2 / alpha, + Item3 / alpha); + +#pragma warning disable 1591 + public static Vec4d operator +(Vec4d a, Vec4d b) => a.Add(b); + public static Vec4d operator -(Vec4d a, Vec4d b) => a.Subtract(b); + public static Vec4d operator *(Vec4d a, double alpha) => a.Multiply(alpha); + public static Vec4d operator /(Vec4d a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public double this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + + /// + public readonly bool Equals(Vec4d other) => + Item0.Equals(other.Item0) && + Item1.Equals(other.Item1) && + Item2.Equals(other.Item2) && + Item3.Equals(other.Item3); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec4d v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec4d a, Vec4d b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec4d a, Vec4d b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec4d)} ({Item0}, {Item1}, {Item2}, {Item3})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs new file mode 100644 index 000000000..98572995a --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs @@ -0,0 +1,198 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 4-Tuple of float (System.Single) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec4f : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public float Item0; + + /// + /// The value of the second component of this object. + /// + public float Item1; + + /// + /// The value of the third component of this object. + /// + public float Item2; + + /// + /// The value of the fourth component of this object. + /// + public float Item3; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + public readonly void Deconstruct(out float item0, out float item1, out float item2, out float item3) + => (item0, item1, item2, item3) = (Item0, Item1, Item2, Item3); + + /// + /// Initializer + /// + /// + /// + /// + /// + public Vec4f(float item0, float item1, float item2, float item3) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec4f Add(Vec4f other) => new( + Item0 + other.Item0, + Item1 + other.Item1, + Item2 + other.Item2, + Item3 + other.Item3); + + /// + /// this - other + /// + /// + /// + public readonly Vec4f Subtract(Vec4f other) => new( + Item0 - other.Item0, + Item1 - other.Item1, + Item2 - other.Item2, + Item3 - other.Item3); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec4f Multiply(double alpha) => new( + (float)(Item0 * alpha), + (float)(Item1 * alpha), + (float)(Item2 * alpha), + (float)(Item3 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec4f Divide(double alpha) => new( + (float)(Item0 / alpha), + (float)(Item1 / alpha), + (float)(Item2 / alpha), + (float)(Item3 / alpha)); + +#pragma warning disable 1591 + public static Vec4f operator +(Vec4f a, Vec4f b) => a.Add(b); + public static Vec4f operator -(Vec4f a, Vec4f b) => a.Subtract(b); + public static Vec4f operator *(Vec4f a, double alpha) => a.Multiply(alpha); + public static Vec4f operator /(Vec4f a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public float this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec4i ToVec4i() => new((int)Item0, (int)Item1, (int)Item2, (int)Item3); + public Vec4d ToVec4d() => new(Item0, Item1, Item2, Item3); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec4f other) => + Item0.Equals(other.Item0) && + Item1.Equals(other.Item1) && + Item2.Equals(other.Item2) && + Item3.Equals(other.Item3); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec4f v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec4f a, Vec4f b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec4f a, Vec4f b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec4f)} ({Item0}, {Item1}, {Item2}, {Item3})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs new file mode 100644 index 000000000..a935c1cb3 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs @@ -0,0 +1,199 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 4-Tuple of int (System.Int32) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec4i : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public int Item0; + + /// + /// The value of the second component of this object. + /// + public int Item1; + + /// + /// The value of the third component of this object. + /// + public int Item2; + + /// + /// The value of the fourth component of this object. + /// + public int Item3; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + public readonly void Deconstruct(out int item0, out int item1, out int item2, out int item3) + => (item0, item1, item2, item3) = (Item0, Item1, Item2, Item3); + + /// + /// Initializer + /// + /// + /// + /// + /// + public Vec4i(int item0, int item1, int item2, int item3) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec4i Add(Vec4i other) => new( + SaturateCast.ToInt32(Item0 + other.Item0), + SaturateCast.ToInt32(Item1 + other.Item1), + SaturateCast.ToInt32(Item2 + other.Item2), + SaturateCast.ToInt32(Item3 + other.Item3)); + + /// + /// this - other + /// + /// + /// + public readonly Vec4i Subtract(Vec4i other) => new( + SaturateCast.ToInt32(Item0 - other.Item0), + SaturateCast.ToInt32(Item1 - other.Item1), + SaturateCast.ToInt32(Item2 - other.Item2), + SaturateCast.ToInt32(Item3 - other.Item3)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec4i Multiply(double alpha) => new( + SaturateCast.ToInt32(Item0 * alpha), + SaturateCast.ToInt32(Item1 * alpha), + SaturateCast.ToInt32(Item2 * alpha), + SaturateCast.ToInt32(Item3 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec4i Divide(double alpha) => new( + SaturateCast.ToInt32(Item0 / alpha), + SaturateCast.ToInt32(Item1 / alpha), + SaturateCast.ToInt32(Item2 / alpha), + SaturateCast.ToInt32(Item3 / alpha)); + +#pragma warning disable 1591 + public static Vec4i operator +(Vec4i a, Vec4i b) => a.Add(b); + public static Vec4i operator -(Vec4i a, Vec4i b) => a.Subtract(b); + public static Vec4i operator *(Vec4i a, double alpha) => a.Multiply(alpha); + public static Vec4i operator /(Vec4i a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public int this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec4f ToVec4f() => new(Item0, Item1, Item2, Item3); + public Vec4d ToVec4d() => new(Item0, Item1, Item2, Item3); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec4i other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec4i v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec4i a, Vec4i b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec4i a, Vec4i b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0; + hashCode = (hashCode * 397) ^ Item1; + hashCode = (hashCode * 397) ^ Item2; + hashCode = (hashCode * 397) ^ Item3; + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec4i)} ({Item0}, {Item1}, {Item2}, {Item3})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs new file mode 100644 index 000000000..b5da3ead7 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs @@ -0,0 +1,203 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 4-Tuple of short (System.Int16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec4s : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public short Item0; + + /// + /// The value of the second component of this object. + /// + public short Item1; + + /// + /// The value of the third component of this object. + /// + public short Item2; + + /// + /// The value of the fourth component of this object. + /// + public short Item3; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + public readonly void Deconstruct(out short item0, out short item1, out short item2, out short item3) + => (item0, item1, item2, item3) = (Item0, Item1, Item2, Item3); + + /// + /// Initializer + /// + /// + /// + /// + /// + public Vec4s(short item0, short item1, short item2, short item3) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec4s Add(Vec4s other) => new( + SaturateCast.ToInt16(Item0 + other.Item0), + SaturateCast.ToInt16(Item1 + other.Item1), + SaturateCast.ToInt16(Item2 + other.Item2), + SaturateCast.ToInt16(Item3 + other.Item3)); + + /// + /// this - other + /// + /// + /// + public readonly Vec4s Subtract(Vec4s other) => new( + SaturateCast.ToInt16(Item0 - other.Item0), + SaturateCast.ToInt16(Item1 - other.Item1), + SaturateCast.ToInt16(Item2 - other.Item2), + SaturateCast.ToInt16(Item3 - other.Item3)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec4s Multiply(double alpha) => new( + SaturateCast.ToInt16(Item0 * alpha), + SaturateCast.ToInt16(Item1 * alpha), + SaturateCast.ToInt16(Item2 * alpha), + SaturateCast.ToInt16(Item3 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec4s Divide(double alpha) => new( + SaturateCast.ToInt16(Item0 / alpha), + SaturateCast.ToInt16(Item1 / alpha), + SaturateCast.ToInt16(Item2 / alpha), + SaturateCast.ToInt16(Item3 / alpha)); + +#pragma warning disable 1591 + public static Vec4s operator +(Vec4s a, Vec4s b) => a.Add(b); + public static Vec4s operator -(Vec4s a, Vec4s b) => a.Subtract(b); + public static Vec4s operator *(Vec4s a, double alpha) => a.Multiply(alpha); + public static Vec4s operator /(Vec4s a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public short this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec4w ToVec4w() => new((ushort)Item0, (ushort)Item1, (ushort)Item2, (ushort)Item3); + public Vec4i ToVec4i() => new(Item0, Item1, Item2, Item3); + public Vec4f ToVec4f() => new(Item0, Item1, Item2, Item3); + public Vec4d ToVec4d() => new(Item0, Item1, Item2, Item3); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + + /// + public readonly bool Equals(Vec4s other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec4s v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec4s a, Vec4s b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec4s a, Vec4s b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec4s)} ({Item0}, {Item1}, {Item2}, {Item3})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs new file mode 100644 index 000000000..7603aba36 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs @@ -0,0 +1,202 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 4-Tuple of ushort (System.UInt16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec4w : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public ushort Item0; + + /// + /// The value of the second component of this object. + /// + public ushort Item1; + + /// + /// The value of the third component of this object. + /// + public ushort Item2; + + /// + /// The value of the fourth component of this object. + /// + public ushort Item3; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + public readonly void Deconstruct(out ushort item0, out ushort item1, out ushort item2, out ushort item3) + => (item0, item1, item2, item3) = (Item0, Item1, Item2, Item3); + + /// + /// Initializer + /// + /// + /// + /// + /// + public Vec4w(ushort item0, ushort item1, ushort item2, ushort item3) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec4w Add(Vec4w other) => new( + SaturateCast.ToUInt16(Item0 + other.Item0), + SaturateCast.ToUInt16(Item1 + other.Item1), + SaturateCast.ToUInt16(Item2 + other.Item2), + SaturateCast.ToUInt16(Item3 + other.Item3)); + + /// + /// this - other + /// + /// + /// + public readonly Vec4w Subtract(Vec4w other) => new( + SaturateCast.ToUInt16(Item0 - other.Item0), + SaturateCast.ToUInt16(Item1 - other.Item1), + SaturateCast.ToUInt16(Item2 - other.Item2), + SaturateCast.ToUInt16(Item3 - other.Item3)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec4w Multiply(double alpha) => new( + SaturateCast.ToUInt16(Item0 * alpha), + SaturateCast.ToUInt16(Item1 * alpha), + SaturateCast.ToUInt16(Item2 * alpha), + SaturateCast.ToUInt16(Item3 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec4w Divide(double alpha) => new( + SaturateCast.ToUInt16(Item0 / alpha), + SaturateCast.ToUInt16(Item1 / alpha), + SaturateCast.ToUInt16(Item2 / alpha), + SaturateCast.ToUInt16(Item3 / alpha)); + +#pragma warning disable 1591 + public static Vec4w operator +(Vec4w a, Vec4w b) => a.Add(b); + public static Vec4w operator -(Vec4w a, Vec4w b) => a.Subtract(b); + public static Vec4w operator *(Vec4w a, double alpha) => a.Multiply(alpha); + public static Vec4w operator /(Vec4w a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public ushort this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec4s ToVec4s() => new((short)Item0, (short)Item1, (short)Item2, (short)Item3); + public Vec4i ToVec4i() => new(Item0, Item1, Item2, Item3); + public Vec4f ToVec4f() => new(Item0, Item1, Item2, Item3); + public Vec4d ToVec4d() => new(Item0, Item1, Item2, Item3); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec4w other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec4w v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec4w a, Vec4w b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec4w a, Vec4w b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec4w)} ({Item0}, {Item1}, {Item2}, {Item3})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs new file mode 100644 index 000000000..8171fdfac --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs @@ -0,0 +1,234 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 6-Tuple of byte (System.Byte) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec6b : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public byte Item0; + + /// + /// The value of the second component of this object. + /// + public byte Item1; + + /// + /// The value of the third component of this object. + /// + public byte Item2; + + /// + /// The value of the fourth component of this object. + /// + public byte Item3; + + /// + /// The value of the fifth component of this object. + /// + public byte Item4; + + /// + /// The value of the sixth component of this object. + /// + public byte Item5; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + /// + /// + public readonly void Deconstruct(out byte item0, out byte item1, out byte item2, out byte item3, out byte item4, out byte item5) => (item0, item1, item2, item3, item4, item5) = (Item0, Item1, Item2, Item3, Item4, Item5); + + /// + /// Initializer + /// + /// + /// + /// + /// + /// + /// + public Vec6b(byte item0, byte item1, byte item2, byte item3, byte item4, byte item5) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec6b Add(Vec6b other) => new( + SaturateCast.ToByte(Item0 + other.Item0), + SaturateCast.ToByte(Item1 + other.Item1), + SaturateCast.ToByte(Item2 + other.Item2), + SaturateCast.ToByte(Item3 + other.Item3), + SaturateCast.ToByte(Item4 + other.Item4), + SaturateCast.ToByte(Item5 + other.Item5)); + + /// + /// this - other + /// + /// + /// + public readonly Vec6b Subtract(Vec6b other) => new( + SaturateCast.ToByte(Item0 - other.Item0), + SaturateCast.ToByte(Item1 - other.Item1), + SaturateCast.ToByte(Item2 - other.Item2), + SaturateCast.ToByte(Item3 - other.Item3), + SaturateCast.ToByte(Item4 - other.Item4), + SaturateCast.ToByte(Item5 - other.Item5)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec6b Multiply(double alpha) => new( + SaturateCast.ToByte(Item0 * alpha), + SaturateCast.ToByte(Item1 * alpha), + SaturateCast.ToByte(Item2 * alpha), + SaturateCast.ToByte(Item3 * alpha), + SaturateCast.ToByte(Item4 * alpha), + SaturateCast.ToByte(Item5 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec6b Divide(double alpha) => new( + SaturateCast.ToByte(Item0 / alpha), + SaturateCast.ToByte(Item1 / alpha), + SaturateCast.ToByte(Item2 / alpha), + SaturateCast.ToByte(Item3 / alpha), + SaturateCast.ToByte(Item4 / alpha), + SaturateCast.ToByte(Item5 / alpha)); + +#pragma warning disable 1591 + public static Vec6b operator +(Vec6b a, Vec6b b) => a.Add(b); + public static Vec6b operator -(Vec6b a, Vec6b b) => a.Subtract(b); + public static Vec6b operator *(Vec6b a, double alpha) => a.Multiply(alpha); + public static Vec6b operator /(Vec6b a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public byte this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + 4 => Item4, + 5 => Item5, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + case 4: Item4 = value; break; + case 5: Item5 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec6s ToVec6s() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6w ToVec6w() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6i ToVec6i() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6f ToVec6f() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6d ToVec6d() => new(Item0, Item1, Item2, Item3, Item4, Item5); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec6b other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3 && + Item4 == other.Item4 && + Item5 == other.Item5; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec6b v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec6b a, Vec6b b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec6b a, Vec6b b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + hashCode = (hashCode * 397) ^ Item4.GetHashCode(); + hashCode = (hashCode * 397) ^ Item5.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3, Item4, Item5); +#endif + } + + /// + public readonly override string ToString() + => $"{nameof(Vec6b)} ({Item0}, {Item1}, {Item2}, {Item3}, {Item4}, {Item5})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs new file mode 100644 index 000000000..b78b8b3ff --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs @@ -0,0 +1,222 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 6-Tuple of double (System.Double) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public struct Vec6d : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public double Item0; + + /// + /// The value of the second component of this object. + /// + public double Item1; + + /// + /// The value of the third component of this object. + /// + public double Item2; + + /// + /// The value of the fourth component of this object. + /// + public double Item3; + + /// + /// The value of the fifth component of this object. + /// + public double Item4; + + /// + /// The value of the sixth component of this object. + /// + public double Item5; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + /// + /// + public readonly void Deconstruct(out double item0, out double item1, out double item2, out double item3, out double item4, out double item5) + => (item0, item1, item2, item3, item4, item5) = (Item0, Item1, Item2, Item3, Item4, Item5); + + /// + /// Initializer + /// + /// + /// + /// + /// + /// + /// + public Vec6d(double item0, double item1, double item2, double item3, double item4, double item5) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec6d Add(Vec6d other) => new( + Item0 + other.Item0, + Item1 + other.Item1, + Item2 + other.Item2, + Item3 + other.Item3, + Item4 + other.Item4, + Item5 + other.Item5); + + /// + /// this - other + /// + /// + /// + public readonly Vec6d Subtract(Vec6d other) => new( + Item0 - other.Item0, + Item1 - other.Item1, + Item2 - other.Item2, + Item3 - other.Item3, + Item4 - other.Item4, + Item5 - other.Item5); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec6d Multiply(double alpha) => new( + Item0 * alpha, + Item1 * alpha, + Item2 * alpha, + Item3 * alpha, + Item4 * alpha, + Item5 * alpha); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec6d Divide(double alpha) => new( + Item0 / alpha, + Item1 / alpha, + Item2 / alpha, + Item3 / alpha, + Item4 / alpha, + Item5 / alpha); + +#pragma warning disable 1591 + public static Vec6d operator +(Vec6d a, Vec6d b) => a.Add(b); + public static Vec6d operator -(Vec6d a, Vec6d b) => a.Subtract(b); + public static Vec6d operator *(Vec6d a, double alpha) => a.Multiply(alpha); + public static Vec6d operator /(Vec6d a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public double this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + 4 => Item4, + 5 => Item5, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + case 4: Item4 = value; break; + case 5: Item5 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + + /// + public readonly bool Equals(Vec6d other) => + Item0.Equals(other.Item0) && + Item1.Equals(other.Item1) && + Item2.Equals(other.Item2) && + Item3.Equals(other.Item3) && + Item4.Equals(other.Item4) && + Item5.Equals(other.Item5); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec6d v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec6d a, Vec6d b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec6d a, Vec6d b) => !(a == b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + hashCode = (hashCode * 397) ^ Item4.GetHashCode(); + hashCode = (hashCode * 397) ^ Item5.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3, Item4, Item5); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec6d)} ({Item0}, {Item1}, {Item2}, {Item3}, {Item4}, {Item5})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs new file mode 100644 index 000000000..5ceb4edbf --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs @@ -0,0 +1,230 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 6-Tuple of float (System.Single) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec6f : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public float Item0; + + /// + /// The value of the second component of this object. + /// + public float Item1; + + /// + /// The value of the third component of this object. + /// + public float Item2; + + /// + /// The value of the fourth component of this object. + /// + public float Item3; + + /// + /// The value of the fifth component of this object. + /// + public float Item4; + + /// + /// The value of the sixth component of this object. + /// + public float Item5; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + /// + /// + public readonly void Deconstruct(out float item0, out float item1, out float item2, out float item3, out float item4, out float item5) + => (item0, item1, item2, item3, item4, item5) = (Item0, Item1, Item2, Item3, Item4, Item5); + + /// + /// Initializer + /// + /// + /// + /// + /// + /// + /// + public Vec6f(float item0, float item1, float item2, float item3, float item4, float item5) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec6f Add(Vec6f other) => new( + Item0 + other.Item0, + Item1 + other.Item1, + Item2 + other.Item2, + Item3 + other.Item3, + Item4 + other.Item4, + Item5 + other.Item5); + + /// + /// this - other + /// + /// + /// + public readonly Vec6f Subtract(Vec6f other) => new( + Item0 - other.Item0, + Item1 - other.Item1, + Item2 - other.Item2, + Item3 - other.Item3, + Item4 - other.Item4, + Item5 - other.Item5); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec6f Multiply(double alpha) => new( + (float)(Item0 * alpha), + (float)(Item1 * alpha), + (float)(Item2 * alpha), + (float)(Item3 * alpha), + (float)(Item4 * alpha), + (float)(Item5 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec6f Divide(double alpha) => new( + (float)(Item0 / alpha), + (float)(Item1 / alpha), + (float)(Item2 / alpha), + (float)(Item3 / alpha), + (float)(Item4 / alpha), + (float)(Item5 / alpha)); + +#pragma warning disable 1591 + public static Vec6f operator +(Vec6f a, Vec6f b) => a.Add(b); + public static Vec6f operator -(Vec6f a, Vec6f b) => a.Subtract(b); + public static Vec6f operator *(Vec6f a, double alpha) => a.Multiply(alpha); + public static Vec6f operator /(Vec6f a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public float this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + 4 => Item4, + 5 => Item5, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + case 4: Item4 = value; break; + case 5: Item5 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec6i ToVec6i() => new((int)Item0, (int)Item1, (int)Item2, (int)Item3, (int)Item4, (int)Item5); + public Vec6d ToVec6d() => new(Item0, Item1, Item2, Item3, Item4, Item5); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec6f other) => + Item0.Equals(other.Item0) && + Item1.Equals(other.Item1) && + Item2.Equals(other.Item2) && + Item3.Equals(other.Item3) && + Item4.Equals(other.Item4) && + Item5.Equals(other.Item5); + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec6f v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec6f a, Vec6f b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec6f a, Vec6f b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + hashCode = (hashCode * 397) ^ Item4.GetHashCode(); + hashCode = (hashCode * 397) ^ Item5.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3, Item4, Item5); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec6f)} ({Item0}, {Item1}, {Item2}, {Item3}, {Item4}, {Item5})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs new file mode 100644 index 000000000..008066543 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs @@ -0,0 +1,231 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 6-Tuple of int (System.Int32) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec6i : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public int Item0; + + /// + /// The value of the second component of this object. + /// + public int Item1; + + /// + /// The value of the third component of this object. + /// + public int Item2; + + /// + /// The value of the fourth component of this object. + /// + public int Item3; + + /// + /// The value of the fourth component of this object. + /// + public int Item4; + + /// + /// The value of the sixth component of this object. + /// + public int Item5; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + /// + /// + public readonly void Deconstruct(out int item0, out int item1, out int item2, out int item3, out int item4, out int item5) + => (item0, item1, item2, item3, item4, item5) = (Item0, Item1, Item2, Item3, Item4, Item5); + + /// + /// Initializer + /// + /// + /// + /// + /// + /// + /// + public Vec6i(int item0, int item1, int item2, int item3, int item4, int item5) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec6i Add(Vec6i other) => new( + SaturateCast.ToInt32(Item0 + other.Item0), + SaturateCast.ToInt32(Item1 + other.Item1), + SaturateCast.ToInt32(Item2 + other.Item2), + SaturateCast.ToInt32(Item3 + other.Item3), + SaturateCast.ToInt32(Item4 + other.Item4), + SaturateCast.ToInt32(Item5 + other.Item5)); + + /// + /// this - other + /// + /// + /// + public readonly Vec6i Subtract(Vec6i other) => new( + SaturateCast.ToInt32(Item0 - other.Item0), + SaturateCast.ToInt32(Item1 - other.Item1), + SaturateCast.ToInt32(Item2 - other.Item2), + SaturateCast.ToInt32(Item3 - other.Item3), + SaturateCast.ToInt32(Item4 - other.Item4), + SaturateCast.ToInt32(Item5 - other.Item5)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec6i Multiply(double alpha) => new( + SaturateCast.ToInt32(Item0 * alpha), + SaturateCast.ToInt32(Item1 * alpha), + SaturateCast.ToInt32(Item2 * alpha), + SaturateCast.ToInt32(Item3 * alpha), + SaturateCast.ToInt32(Item4 * alpha), + SaturateCast.ToInt32(Item5 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec6i Divide(double alpha) => new( + SaturateCast.ToInt32(Item0 / alpha), + SaturateCast.ToInt32(Item1 / alpha), + SaturateCast.ToInt32(Item2 / alpha), + SaturateCast.ToInt32(Item3 / alpha), + SaturateCast.ToInt32(Item4 / alpha), + SaturateCast.ToInt32(Item5 / alpha)); + +#pragma warning disable 1591 + public static Vec6i operator +(Vec6i a, Vec6i b) => a.Add(b); + public static Vec6i operator -(Vec6i a, Vec6i b) => a.Subtract(b); + public static Vec6i operator *(Vec6i a, double alpha) => a.Multiply(alpha); + public static Vec6i operator /(Vec6i a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public int this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + 4 => Item4, + 5 => Item5, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + case 4: Item4 = value; break; + case 5: Item5 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public Vec6f ToVec6f() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6d ToVec6d() => new(Item0, Item1, Item2, Item3, Item4, Item5); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec6i other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3 && + Item4 == other.Item4 && + Item5 == other.Item5; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec6i v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec6i a, Vec6i b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec6i a, Vec6i b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0; + hashCode = (hashCode * 397) ^ Item1; + hashCode = (hashCode * 397) ^ Item2; + hashCode = (hashCode * 397) ^ Item3; + hashCode = (hashCode * 397) ^ Item4; + hashCode = (hashCode * 397) ^ Item5; + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3, Item4, Item5); +#endif + } + + /// + public readonly override string ToString() => $"{nameof(Vec6i)} ({Item0}, {Item1}, {Item2}, {Item3}, {Item4}, {Item5})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs new file mode 100644 index 000000000..4ad68e974 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs @@ -0,0 +1,235 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 6-Tuple of short (System.Int16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec6s : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public short Item0; + + /// + /// The value of the second component of this object. + /// + public short Item1; + + /// + /// The value of the third component of this object. + /// + public short Item2; + + /// + /// The value of the fourth component of this object. + /// + public short Item3; + + /// + /// The value of the fifth component of this object. + /// + public short Item4; + + /// + /// The value of the sixth component of this object. + /// + public short Item5; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + /// + /// + public readonly void Deconstruct(out short item0, out short item1, out short item2, out short item3, out short item4, out short item5) + => (item0, item1, item2, item3, item4, item5) = (Item0, Item1, Item2, Item3, Item4, Item5); + + /// + /// Initializer + /// + /// + /// + /// + /// + /// + /// + public Vec6s(short item0, short item1, short item2, short item3, short item4, short item5) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec6s Add(Vec6s other) => new( + SaturateCast.ToInt16(Item0 + other.Item0), + SaturateCast.ToInt16(Item1 + other.Item1), + SaturateCast.ToInt16(Item2 + other.Item2), + SaturateCast.ToInt16(Item3 + other.Item3), + SaturateCast.ToInt16(Item4 + other.Item4), + SaturateCast.ToInt16(Item5 + other.Item5)); + + /// + /// this - other + /// + /// + /// + public readonly Vec6s Subtract(Vec6s other) => new( + SaturateCast.ToInt16(Item0 - other.Item0), + SaturateCast.ToInt16(Item1 - other.Item1), + SaturateCast.ToInt16(Item2 - other.Item2), + SaturateCast.ToInt16(Item3 - other.Item3), + SaturateCast.ToInt16(Item4 - other.Item4), + SaturateCast.ToInt16(Item5 - other.Item5)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec6s Multiply(double alpha) => new( + SaturateCast.ToInt16(Item0 * alpha), + SaturateCast.ToInt16(Item1 * alpha), + SaturateCast.ToInt16(Item2 * alpha), + SaturateCast.ToInt16(Item3 * alpha), + SaturateCast.ToInt16(Item4 * alpha), + SaturateCast.ToInt16(Item5 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec6s Divide(double alpha) => new( + SaturateCast.ToInt16(Item0 / alpha), + SaturateCast.ToInt16(Item1 / alpha), + SaturateCast.ToInt16(Item2 / alpha), + SaturateCast.ToInt16(Item3 / alpha), + SaturateCast.ToInt16(Item4 / alpha), + SaturateCast.ToInt16(Item5 / alpha)); + +#pragma warning disable 1591 + public static Vec6s operator +(Vec6s a, Vec6s b) => a.Add(b); + public static Vec6s operator -(Vec6s a, Vec6s b) => a.Subtract(b); + public static Vec6s operator *(Vec6s a, double alpha) => a.Multiply(alpha); + public static Vec6s operator /(Vec6s a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public short this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + 4 => Item4, + 5 => Item5, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch (i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + case 4: Item4 = value; break; + case 5: Item5 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec6w ToVec6w() => new((ushort)Item0, (ushort)Item1, (ushort)Item2, (ushort)Item3, (ushort)Item4, (ushort)Item5); + public Vec6i ToVec6i() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6f ToVec6f() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6d ToVec6d() => new(Item0, Item1, Item2, Item3, Item4, Item5); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec6s other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3 && + Item4 == other.Item4 && + Item5 == other.Item5; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec6s v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec6s a, Vec6s b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec6s a, Vec6s b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + hashCode = (hashCode * 397) ^ Item4.GetHashCode(); + hashCode = (hashCode * 397) ^ Item5.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3, Item4, Item5); +#endif + } + + /// + public readonly override string ToString() + => $"{nameof(Vec6s)} ({Item0}, {Item1}, {Item2}, {Item3}, {Item4}, {Item5})"; +} diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs new file mode 100644 index 000000000..cb4bba6fc --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs @@ -0,0 +1,235 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// 4-Tuple of ushort (System.UInt16) +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public struct Vec6w : IVec, IEquatable +{ + /// + /// The value of the first component of this object. + /// + public ushort Item0; + + /// + /// The value of the second component of this object. + /// + public ushort Item1; + + /// + /// The value of the third component of this object. + /// + public ushort Item2; + + /// + /// The value of the fourth component of this object. + /// + public ushort Item3; + + /// + /// The value of the fifth component of this object. + /// + public ushort Item4; + + /// + /// The value of the sixth component of this object. + /// + public ushort Item5; + + /// + /// Deconstructing a Vector + /// + /// + /// + /// + /// + /// + /// + public readonly void Deconstruct(out ushort item0, out ushort item1, out ushort item2, out ushort item3, out ushort item4, out ushort item5) + => (item0, item1, item2, item3, item4, item5) = (Item0, Item1, Item2, Item3, Item4, Item5); + + /// + /// Initializer + /// + /// + /// + /// + /// + /// + /// + public Vec6w(ushort item0, ushort item1, ushort item2, ushort item3, ushort item4, ushort item5) + { + Item0 = item0; + Item1 = item1; + Item2 = item2; + Item3 = item3; + Item4 = item4; + Item5 = item5; + } + + #region Operators + + /// + /// this + other + /// + /// + /// + public readonly Vec6w Add(Vec6w other) => new( + SaturateCast.ToUInt16(Item0 + other.Item0), + SaturateCast.ToUInt16(Item1 + other.Item1), + SaturateCast.ToUInt16(Item2 + other.Item2), + SaturateCast.ToUInt16(Item3 + other.Item3), + SaturateCast.ToUInt16(Item4 + other.Item4), + SaturateCast.ToUInt16(Item5 + other.Item5)); + + /// + /// this - other + /// + /// + /// + public readonly Vec6w Subtract(Vec6w other) => new( + SaturateCast.ToUInt16(Item0 - other.Item0), + SaturateCast.ToUInt16(Item1 - other.Item1), + SaturateCast.ToUInt16(Item2 - other.Item2), + SaturateCast.ToUInt16(Item3 - other.Item3), + SaturateCast.ToUInt16(Item4 - other.Item4), + SaturateCast.ToUInt16(Item5 - other.Item5)); + + /// + /// this * alpha + /// + /// + /// + public readonly Vec6w Multiply(double alpha) => new( + SaturateCast.ToUInt16(Item0 * alpha), + SaturateCast.ToUInt16(Item1 * alpha), + SaturateCast.ToUInt16(Item2 * alpha), + SaturateCast.ToUInt16(Item3 * alpha), + SaturateCast.ToUInt16(Item4 * alpha), + SaturateCast.ToUInt16(Item5 * alpha)); + + /// + /// this / alpha + /// + /// + /// + public readonly Vec6w Divide(double alpha) => new( + SaturateCast.ToUInt16(Item0 / alpha), + SaturateCast.ToUInt16(Item1 / alpha), + SaturateCast.ToUInt16(Item2 / alpha), + SaturateCast.ToUInt16(Item3 / alpha), + SaturateCast.ToUInt16(Item4 / alpha), + SaturateCast.ToUInt16(Item5 / alpha)); + +#pragma warning disable 1591 + public static Vec6w operator +(Vec6w a, Vec6w b) => a.Add(b); + public static Vec6w operator -(Vec6w a, Vec6w b) => a.Subtract(b); + public static Vec6w operator *(Vec6w a, double alpha) => a.Multiply(alpha); + public static Vec6w operator /(Vec6w a, double alpha) => a.Divide(alpha); +#pragma warning restore 1591 + + /// + /// Indexer + /// + /// + /// + public ushort this[int i] + { + readonly get => + i switch + { + 0 => Item0, + 1 => Item1, + 2 => Item2, + 3 => Item3, + 4 => Item4, + 5 => Item5, + _ => throw new ArgumentOutOfRangeException(nameof(i)) + }; + set + { + switch(i) + { + case 0: Item0 = value; break; + case 1: Item1 = value; break; + case 2: Item2 = value; break; + case 3: Item3 = value; break; + case 4: Item4 = value; break; + case 5: Item5 = value; break; + default: throw new ArgumentOutOfRangeException(nameof(i)); + } + } + } + + #endregion + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + //public Vec6b ToVec6b() => new Vec6b((byte)Item0, (byte)Item1, (byte)Item2, (byte)Item3, (byte)Item4, (byte)Item5); + public Vec6s ToVec6s() => new((short)Item0, (short)Item1, (short)Item2, (short)Item3, (short)Item4, (short)Item5); + public Vec6i ToVec6i() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6f ToVec6f() => new(Item0, Item1, Item2, Item3, Item4, Item5); + public Vec6d ToVec6d() => new(Item0, Item1, Item2, Item3, Item4, Item5); + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + public readonly bool Equals(Vec6w other) => + Item0 == other.Item0 && + Item1 == other.Item1 && + Item2 == other.Item2 && + Item3 == other.Item3 && + Item4 == other.Item4 && + Item5 == other.Item5; + + /// + public readonly override bool Equals(object? obj) + { + if (obj is null) return false; + return obj is Vec6w v && Equals(v); + } + + /// + /// + /// + /// + /// + public static bool operator ==(Vec6w a, Vec6w b) => a.Equals(b); + + /// + /// + /// + /// + /// + public static bool operator !=(Vec6w a, Vec6w b) => !a.Equals(b); + + /// + public readonly override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Item0.GetHashCode(); + hashCode = (hashCode * 397) ^ Item1.GetHashCode(); + hashCode = (hashCode * 397) ^ Item2.GetHashCode(); + hashCode = (hashCode * 397) ^ Item3.GetHashCode(); + hashCode = (hashCode * 397) ^ Item4.GetHashCode(); + hashCode = (hashCode * 397) ^ Item5.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Item0, Item1, Item2, Item3, Item4, Item5); +#endif + } + + /// + public readonly override string ToString() + => $"{nameof(Vec6w)} ({Item0}, {Item1}, {Item2}, {Item3}, {Item4}, {Item5})"; +} diff --git a/src/OpenCvSharp/modules/cuda/DescriptorFormat.cs b/src/OpenCvSharp/Modules/cuda/DescriptorFormat.cs similarity index 91% rename from src/OpenCvSharp/modules/cuda/DescriptorFormat.cs rename to src/OpenCvSharp/Modules/cuda/DescriptorFormat.cs index 68a897ef7..fba76fcef 100644 --- a/src/OpenCvSharp/modules/cuda/DescriptorFormat.cs +++ b/src/OpenCvSharp/Modules/cuda/DescriptorFormat.cs @@ -1,4 +1,6 @@ -using System; +#if ENABLED_CUDA + +using System; using System.Collections.Generic; using System.Text; @@ -23,4 +25,4 @@ public enum DescriptorFormat } } - +#endif diff --git a/src/OpenCvSharp/Modules/cuda/DeviceInfo.cs b/src/OpenCvSharp/Modules/cuda/DeviceInfo.cs new file mode 100644 index 000000000..e901e9baf --- /dev/null +++ b/src/OpenCvSharp/Modules/cuda/DeviceInfo.cs @@ -0,0 +1,201 @@ +#if ENABLED_CUDA + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenCvSharp.Cuda +{ + /// + /// Gives information about the given GPU + /// + public sealed class DeviceInfo : DisposableGpuObject + { + /// + /// Creates DeviceInfo object for the current GPU + /// + public DeviceInfo() + { + Cv2.ThrowIfGpuNotAvailable(); + ptr = NativeMethods.cuda_DeviceInfo_new1(); + } + + /// + /// Creates DeviceInfo object for the given GPU + /// + /// + public DeviceInfo(int deviceId) + { + Cv2.ThrowIfGpuNotAvailable(); + ptr = NativeMethods.cuda_DeviceInfo_new2(deviceId); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.cuda_DeviceInfo_delete(ptr); + base.DisposeUnmanaged(); + } + + /// + /// + /// + public int DeviceId + { + get + { + var res = NativeMethods.cuda_DeviceInfo_deviceID(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// + /// + public string Name + { + get + { + var buf = new StringBuilder(1 << 16); + NativeMethods.cuda_DeviceInfo_name(ptr, buf, buf.Capacity); + GC.KeepAlive(this); + return buf.ToString(); + } + } + + /// + /// Return compute capability versions + /// + public int MajorVersion + { + get + { + var res = NativeMethods.cuda_DeviceInfo_majorVersion(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Return compute capability versions + /// + public int MinorVersion + { + get + { + var res = NativeMethods.cuda_DeviceInfo_minorVersion(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// + /// + public int MultiProcessorCount + { + get + { + var res = NativeMethods.cuda_DeviceInfo_multiProcessorCount(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// + /// + public long SharedMemPerBlock + { + get + { + var res = (long)NativeMethods.cuda_DeviceInfo_sharedMemPerBlock(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// + /// + public void QueryMemory(out long totalMemory, out long freeMemory) + { + ulong t, f; + NativeMethods.cuda_DeviceInfo_queryMemory(ptr, out t, out f); + GC.KeepAlive(this); + totalMemory = (long)t; + freeMemory = (long)f; + } + + /// + /// + /// + public long FreeMemory + { + get + { + var res = (long)NativeMethods.cuda_DeviceInfo_freeMemory(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// + /// + public long TotalMemory + { + get + { + var res = (long)NativeMethods.cuda_DeviceInfo_totalMemory(ptr); + GC.KeepAlive(this); + return res; + } + } + + /// + /// Checks whether device supports the given feature + /// + /// + /// + public bool Supports(FeatureSet featureSet) + { + var res = NativeMethods.cuda_DeviceInfo_supports(ptr, (int)featureSet) != 0; + GC.KeepAlive(this); + return res; + } + + /// + /// Checks whether the GPU module can be run on the given device + /// + /// + public bool IsCompatible + { + get + { + var res = NativeMethods.cuda_DeviceInfo_isCompatible(ptr) != 0; + GC.KeepAlive(this); + return res; + } + } + + /// + /// + /// + /// + public bool CanMapHostMemory + { + get + { + var res = NativeMethods.cuda_DeviceInfo_canMapHostMemory(ptr) != 0; + GC.KeepAlive(this); + return res; + } + } + } +} + +#endif diff --git a/src/OpenCvSharp/modules/cuda/DisposableGpuObject.cs b/src/OpenCvSharp/Modules/cuda/DisposableGpuObject.cs similarity index 98% rename from src/OpenCvSharp/modules/cuda/DisposableGpuObject.cs rename to src/OpenCvSharp/Modules/cuda/DisposableGpuObject.cs index 229738d7f..43c4ab7b6 100644 --- a/src/OpenCvSharp/modules/cuda/DisposableGpuObject.cs +++ b/src/OpenCvSharp/Modules/cuda/DisposableGpuObject.cs @@ -1,4 +1,6 @@ -using System; +#if ENABLED_CUDA + +using System; namespace OpenCvSharp.Cuda { @@ -76,3 +78,5 @@ protected bool IsGpuCompatible private bool? isGpuAvailable = null; } } + +#endif diff --git a/src/OpenCvSharp/modules/cuda/Enum/CudaMemAllocType.cs b/src/OpenCvSharp/Modules/cuda/Enum/CudaMemAllocType.cs similarity index 87% rename from src/OpenCvSharp/modules/cuda/Enum/CudaMemAllocType.cs rename to src/OpenCvSharp/Modules/cuda/Enum/CudaMemAllocType.cs index d440e0d8e..db3f0f32a 100644 --- a/src/OpenCvSharp/modules/cuda/Enum/CudaMemAllocType.cs +++ b/src/OpenCvSharp/Modules/cuda/Enum/CudaMemAllocType.cs @@ -1,3 +1,5 @@ +#if ENABLED_CUDA + using System; namespace OpenCvSharp.Cuda @@ -11,4 +13,6 @@ public enum CudaMemAllocType ZeroCopy = 2, WhiteCombined = 4 } -} \ No newline at end of file +} + +#endif diff --git a/src/OpenCvSharp/modules/cuda/Enum/FeatureSet.cs b/src/OpenCvSharp/Modules/cuda/Enum/FeatureSet.cs similarity index 92% rename from src/OpenCvSharp/modules/cuda/Enum/FeatureSet.cs rename to src/OpenCvSharp/Modules/cuda/Enum/FeatureSet.cs index 3c1e08d8f..e53d8d3b0 100644 --- a/src/OpenCvSharp/modules/cuda/Enum/FeatureSet.cs +++ b/src/OpenCvSharp/Modules/cuda/Enum/FeatureSet.cs @@ -1,4 +1,6 @@ -using System; +#if ENABLED_CUDA + +using System; using System.Collections.Generic; using System.Text; @@ -24,3 +26,5 @@ public enum FeatureSet DynamicParallelism = Compute35 } } + +#endif diff --git a/src/OpenCvSharp/modules/cuda/GpuMat.cs b/src/OpenCvSharp/Modules/cuda/GpuMat.cs similarity index 79% rename from src/OpenCvSharp/modules/cuda/GpuMat.cs rename to src/OpenCvSharp/Modules/cuda/GpuMat.cs index 1ba6a8ead..afa4ef70f 100644 --- a/src/OpenCvSharp/modules/cuda/GpuMat.cs +++ b/src/OpenCvSharp/Modules/cuda/GpuMat.cs @@ -1,4 +1,6 @@ -using System; +#if ENABLED_CUDA + +using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; @@ -6,30 +8,17 @@ namespace OpenCvSharp.Cuda { -#if LANG_JP - /// - /// 参照カウンタを持つ,GPU メモリ用の基底ストレージクラス. - /// -#else /// /// Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat. /// -#endif public class GpuMat : DisposableCvObject { #region Init and Disposal -#if LANG_JP - /// - /// OpenCVネイティブの cv::gpu::GpuMat* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::gpu::GpuMat* pointer /// /// -#endif public GpuMat(IntPtr ptr) { ThrowIfNotAvailable(); @@ -38,15 +27,9 @@ public GpuMat(IntPtr ptr) this.ptr = ptr; } -#if LANG_JP - /// - /// 空の行列として初期化 - /// -#else /// /// Creates empty GpuMat /// -#endif public GpuMat() { ThrowIfNotAvailable(); @@ -55,15 +38,6 @@ public GpuMat() throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs 2D matrix of the specified size and type /// @@ -71,7 +45,6 @@ public GpuMat() /// Number of columns in a 2D array. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public GpuMat(int rows, int cols, MatType type) { ThrowIfNotAvailable(); @@ -84,24 +57,6 @@ public GpuMat(int rows, int cols, MatType type) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -115,7 +70,6 @@ public GpuMat(int rows, int cols, MatType type) /// The external data is not automatically deallocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public GpuMat(int rows, int cols, MatType type, IntPtr data, long step) { ThrowIfNotAvailable(); @@ -128,21 +82,12 @@ public GpuMat(int rows, int cols, MatType type, IntPtr data, long step) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs 2D matrix of the specified size and type /// /// 2D array size: Size(cols, rows) /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public GpuMat(Size size, MatType type) { ThrowIfNotAvailable(); @@ -151,23 +96,6 @@ public GpuMat(Size size, MatType type) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -180,7 +108,6 @@ public GpuMat(Size size, MatType type) /// The external data is not automatically deallocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public GpuMat(Size size, MatType type, IntPtr data, long step = 0) { ThrowIfNotAvailable(); @@ -189,59 +116,36 @@ public GpuMat(Size size, MatType type, IntPtr data, long step = 0) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他の行列のから初期化 - /// - /// 作成された行列に全体的割り当てられる配列. -#else /// /// creates a matrix for other matrix /// /// Array that (as a whole) is assigned to the constructed matrix. -#endif public GpuMat(Mat m) { ThrowIfNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); ptr = NativeMethods.cuda_GpuMat_new4(m.CvPtr); + GC.KeepAlive(m); if (ptr == IntPtr.Zero) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他のGpuMat初期化 - /// - /// 作成された行列に全体的割り当てられる配列. -#else /// /// creates a matrix for other matrix /// /// GpuMat that (as a whole) is assigned to the constructed matrix. -#endif public GpuMat(GpuMat m) { ThrowIfNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); ptr = NativeMethods.cuda_GpuMat_new5(m.CvPtr); + GC.KeepAlive(m); if (ptr == IntPtr.Zero) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constucts 2D matrix and fills it with the specified Scalar value. /// @@ -251,7 +155,6 @@ public GpuMat(GpuMat m) /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public GpuMat(int rows, int cols, MatType type, Scalar s) { ThrowIfNotAvailable(); @@ -264,16 +167,6 @@ public GpuMat(int rows, int cols, MatType type, Scalar s) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constucts 2D matrix and fills it with the specified Scalar value. /// @@ -282,7 +175,6 @@ public GpuMat(int rows, int cols, MatType type, Scalar s) /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public GpuMat(Size size, MatType type, Scalar s) { ThrowIfNotAvailable(); @@ -291,14 +183,6 @@ public GpuMat(Size size, MatType type, Scalar s) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -306,49 +190,36 @@ public GpuMat(Size size, MatType type, Scalar s) /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. /// Use Range.All to take all the rows. /// Range of the m columns to take. Use Range.All to take all the columns. -#endif public GpuMat(GpuMat m, Range rowRange, Range colRange) { ThrowIfNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); ptr = NativeMethods.cuda_GpuMat_new9(m.CvPtr, rowRange, colRange); + GC.KeepAlive(m); if (ptr == IntPtr.Zero) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else /// /// creates a matrix header for a part of the bigger matrix /// /// Array that (as a whole or partly) is assigned to the constructed matrix.. /// Region of interest. -#endif public GpuMat(GpuMat m, Rect roi) { ThrowIfNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); ptr = NativeMethods.cuda_GpuMat_new10(m.CvPtr, roi); + GC.KeepAlive(m); if (ptr == IntPtr.Zero) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// リソースの解放 - /// -#else /// /// Clean up any resources being used. /// -#endif public void Release() { Dispose(); @@ -374,10 +245,11 @@ protected override void DisposeUnmanaged() /// public static explicit operator GpuMat(Mat mat) { - if (mat == null) + if (mat is null) return null; IntPtr ret = NativeMethods.cuda_GpuMat_opToGpuMat(mat.CvPtr); + GC.KeepAlive(mat); return new GpuMat(ret); } @@ -388,12 +260,14 @@ public static explicit operator GpuMat(Mat mat) /// public static implicit operator Mat(GpuMat gpumat) { - if (gpumat == null) + if (gpumat is null) return null; IntPtr ret = NativeMethods.cuda_GpuMat_opToMat(gpumat.CvPtr); + GC.KeepAlive(gpumat); return new Mat(ret); } + #endregion #region Properties @@ -410,6 +284,7 @@ public int Flags get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_flags(ptr); } } @@ -422,6 +297,7 @@ public int Rows get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_rows(ptr); } } @@ -434,6 +310,7 @@ public int Cols get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_cols(ptr); } } @@ -446,6 +323,7 @@ public int Height get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_rows(ptr); } } @@ -458,6 +336,7 @@ public int Width get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_cols(ptr); } } @@ -470,6 +349,7 @@ public unsafe IntPtr Data get { ThrowIfDisposed(); + GC.KeepAlive(this); return (IntPtr)NativeMethods.cuda_GpuMat_data(ptr); } } @@ -483,6 +363,7 @@ public IntPtr RefCount get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_refcount(ptr); } } @@ -495,6 +376,7 @@ public IntPtr DataStart get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_datastart(ptr); } } @@ -507,6 +389,7 @@ public IntPtr DataEnd get { ThrowIfDisposed(); + GC.KeepAlive(this); return NativeMethods.cuda_GpuMat_dataend(ptr); } } @@ -521,10 +404,10 @@ public int Bpp return (int)Math.Pow(2, ((Depth() / 2) + 1) + 2); } } - #endregion +#endregion - #region Indexers - #region Range Indexer +#region Indexers +#region Range Indexer /// /// /// @@ -535,6 +418,7 @@ public virtual GpuMat this[Rect roi] get { IntPtr ret = NativeMethods.cuda_GpuMat_opRange1(ptr, roi); + GC.KeepAlive(this); return new GpuMat(ret); } } @@ -550,6 +434,7 @@ public virtual GpuMat this[Rect roi] get { IntPtr ret = NativeMethods.cuda_GpuMat_opRange2(ptr, rowRange, colRange); + GC.KeepAlive(this); return new GpuMat(ret); } } @@ -569,9 +454,9 @@ public virtual GpuMat this[Rect roi] return this[new Range(rowStart, rowEnd), new Range(colStart, colEnd)]; } } - #endregion +#endregion - #region Element Indexer +#region Element Indexer /// /// GpuMat Indexer @@ -618,9 +503,9 @@ public Indexer GetGenericIndexer() where T : struct return new Indexer(this); } - #endregion +#endregion - #region Get/Set +#region Get/Set /// /// Returns a value to the specified array element. @@ -658,9 +543,9 @@ public void Set(int i0, int i1, T value) where T : struct (new Indexer(this))[i0, i1] = value; } - #endregion +#endregion - #region Col/ColRange +#region Col/ColRange /// /// returns a new matrix header for the specified column span @@ -672,6 +557,7 @@ public GpuMat ColRange(int startcol, int endcol) { ThrowIfDisposed(); IntPtr ret = NativeMethods.cuda_GpuMat_colRange(ptr, startcol, endcol); + GC.KeepAlive(this); return new GpuMat(ret); } @@ -710,16 +596,18 @@ public override GpuMat this[int x] { parent.ThrowIfDisposed(); IntPtr matPtr = NativeMethods.cuda_GpuMat_col(parent.ptr, x); + GC.KeepAlive(this); return new GpuMat(matPtr); } set { parent.ThrowIfDisposed(); - if (value == null) + if (value is null) throw new ArgumentNullException(nameof(value)); value.ThrowIfDisposed(); var matPtr = NativeMethods.cuda_GpuMat_col(parent.ptr, x); + GC.KeepAlive(this); var mat = new GpuMat(matPtr); if (mat.Size() != value.Size()) throw new ArgumentException("Specified ROI != mat.Size()"); @@ -739,16 +627,18 @@ public override GpuMat this[int x] { parent.ThrowIfDisposed(); IntPtr matPtr = NativeMethods.cuda_GpuMat_colRange(parent.ptr, startCol, endCol); + GC.KeepAlive(this); return new GpuMat(matPtr); } set { parent.ThrowIfDisposed(); - if (value == null) + if (value is null) throw new ArgumentNullException(nameof(value)); value.ThrowIfDisposed(); var colMatPtr = NativeMethods.cuda_GpuMat_colRange(parent.ptr, startCol, endCol); + GC.KeepAlive(this); var colMat = new GpuMat(colMatPtr); if (colMat.Size() != value.Size()) throw new ArgumentException("Specified ROI != mat.Size()"); @@ -768,8 +658,8 @@ public ColIndexer Col private ColIndexer colIndexer; - #endregion - #region Row/RowRange +#endregion +#region Row/RowRange /// /// returns a new matrix header for the specified row span @@ -781,6 +671,7 @@ public GpuMat RowRange(int startrow, int endrow) { ThrowIfDisposed(); IntPtr ret = NativeMethods.cuda_GpuMat_rowRange(ptr, startrow, endrow); + GC.KeepAlive(this); return new GpuMat(ret); } @@ -819,16 +710,18 @@ public override GpuMat this[int x] { parent.ThrowIfDisposed(); var matPtr = NativeMethods.cuda_GpuMat_row(parent.ptr, x); + GC.KeepAlive(this); return new GpuMat(matPtr); } set { parent.ThrowIfDisposed(); - if (value == null) + if (value is null) throw new ArgumentNullException(nameof(value)); value.ThrowIfDisposed(); var matPtr = NativeMethods.cuda_GpuMat_row(parent.ptr, x); + GC.KeepAlive(this); var mat = new GpuMat(matPtr); if (mat.Size() != value.Size()) throw new ArgumentException("Specified ROI != mat.Size()"); @@ -848,16 +741,18 @@ public override GpuMat this[int x] { parent.ThrowIfDisposed(); var matPtr = NativeMethods.cuda_GpuMat_rowRange(parent.ptr, startCol, endCol); + GC.KeepAlive(this); return new GpuMat(matPtr); } set { parent.ThrowIfDisposed(); - if (value == null) + if (value is null) throw new ArgumentNullException(nameof(value)); value.ThrowIfDisposed(); var matPtr = NativeMethods.cuda_GpuMat_rowRange(parent.ptr, startCol, endCol); + GC.KeepAlive(this); var mat = new GpuMat(matPtr); if (mat.Size() != value.Size()) throw new ArgumentException("Specified ROI != mat.Size()"); @@ -877,10 +772,10 @@ public RowIndexer Row private RowIndexer rowIndexer; - #endregion - #endregion +#endregion +#endregion - #region Public methods +#region Public methods /// /// returns true iff the GpuMatrix data is continuous @@ -891,7 +786,9 @@ public RowIndexer Row public bool IsContinuous() { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_isContinuous(ptr) != 0; + var res = NativeMethods.cuda_GpuMat_isContinuous(ptr) != 0; + GC.KeepAlive(this); + return res; } /// @@ -901,7 +798,9 @@ public bool IsContinuous() public int Channels() { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_channels(ptr); + var res = NativeMethods.cuda_GpuMat_channels(ptr); + GC.KeepAlive(this); + return res; } /// @@ -911,7 +810,9 @@ public int Channels() public int Depth() { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_depth(ptr); + var res = NativeMethods.cuda_GpuMat_depth(ptr); + GC.KeepAlive(this); + return res; } /// @@ -921,7 +822,9 @@ public int Depth() public long ElemSize() { ThrowIfDisposed(); - return (long)NativeMethods.cuda_GpuMat_elemSize(ptr); + var res = (long)NativeMethods.cuda_GpuMat_elemSize(ptr); + GC.KeepAlive(this); + return res; } /// @@ -931,7 +834,9 @@ public long ElemSize() public long ElemSize1() { ThrowIfDisposed(); - return (long)NativeMethods.cuda_GpuMat_elemSize1(ptr); + var res = (long)NativeMethods.cuda_GpuMat_elemSize1(ptr); + GC.KeepAlive(this); + return res; } /// @@ -941,16 +846,20 @@ public long ElemSize1() public Size Size() { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_size(ptr); + var res = NativeMethods.cuda_GpuMat_size(ptr); + GC.KeepAlive(this); + return res; } - + /// /// a distance between successive rows in bytes; includes the gap if any /// public long Step() { ThrowIfDisposed(); - return (long)NativeMethods.cuda_GpuMat_step(ptr); + var res = (long)NativeMethods.cuda_GpuMat_step(ptr); + GC.KeepAlive(this); + return res; } /// @@ -959,7 +868,9 @@ public long Step() public long Step1() { ThrowIfDisposed(); - return (long)NativeMethods.cuda_GpuMat_step1(ptr); + var res = (long)NativeMethods.cuda_GpuMat_step1(ptr); + GC.KeepAlive(this); + return res; } /// @@ -969,7 +880,9 @@ public long Step1() public MatType Type() { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_type(ptr); + var res = NativeMethods.cuda_GpuMat_type(ptr); + GC.KeepAlive(this); + return res; } /// @@ -979,9 +892,11 @@ public MatType Type() public bool Empty() { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_empty(ptr) != 0; + var res = NativeMethods.cuda_GpuMat_empty(ptr) != 0; + GC.KeepAlive(this); + return res; } - + /// /// Pefroms blocking upload data to GpuMat. /// @@ -990,6 +905,8 @@ public void Upload(Mat m) { ThrowIfDisposed(); NativeMethods.cuda_GpuMat_upload(ptr, m.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(m); } /// @@ -1000,6 +917,8 @@ public void Download(Mat m) { ThrowIfDisposed(); NativeMethods.cuda_GpuMat_download(ptr, m.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(m); } /// @@ -1010,6 +929,7 @@ public GpuMat Clone() { ThrowIfDisposed(); IntPtr ret = NativeMethods.cuda_GpuMat_clone(ptr); + GC.KeepAlive(this); return new GpuMat(ret); } @@ -1020,9 +940,11 @@ public GpuMat Clone() public void CopyTo(GpuMat m) { ThrowIfDisposed(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); NativeMethods.cuda_GpuMat_copyTo1(ptr, m.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(m); } /// @@ -1033,11 +955,14 @@ public void CopyTo(GpuMat m) public void CopyTo(GpuMat m, GpuMat mask) { ThrowIfDisposed(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); - if (mask == null) + if (mask is null) throw new ArgumentNullException(nameof(mask)); NativeMethods.cuda_GpuMat_copyTo2(ptr, m.CvPtr, mask.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(m); + GC.KeepAlive(mask); } /// @@ -1051,9 +976,11 @@ public void CopyTo(GpuMat m, GpuMat mask) public void ConvertTo(GpuMat dst, MatType rtype, double alpha = 1, double beta = 0) { ThrowIfDisposed(); - if (dst == null) + if (dst is null) throw new ArgumentNullException(nameof(dst)); NativeMethods.cuda_GpuMat_convertTo(ptr, dst.CvPtr, rtype, alpha, beta); + GC.KeepAlive(this); + GC.KeepAlive(dst); } /// @@ -1064,6 +991,8 @@ public void AssignTo(GpuMat m) { ThrowIfDisposed(); NativeMethods.cuda_GpuMat_assignTo(ptr, m.CvPtr, -1); + GC.KeepAlive(this); + GC.KeepAlive(m); } /// /// @@ -1073,9 +1002,11 @@ public void AssignTo(GpuMat m) public void AssignTo(GpuMat m, MatType type) { ThrowIfDisposed(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); NativeMethods.cuda_GpuMat_assignTo(ptr, m.CvPtr, type); + GC.KeepAlive(this); + GC.KeepAlive(m); } /// @@ -1088,6 +1019,8 @@ public GpuMat SetTo(Scalar s, GpuMat mask = null) { ThrowIfDisposed(); IntPtr ret = NativeMethods.cuda_GpuMat_setTo(ptr, s, Cv2.ToPtr(mask)); + GC.KeepAlive(this); + GC.KeepAlive(mask); return new GpuMat(ret); } @@ -1102,6 +1035,7 @@ public GpuMat Reshape(int cn, int rows) { ThrowIfDisposed(); IntPtr ret = NativeMethods.cuda_GpuMat_reshape(ptr, cn, rows); + GC.KeepAlive(this); return new GpuMat(ret); } @@ -1116,6 +1050,7 @@ public void Create(int rows, int cols, MatType type) { ThrowIfDisposed(); NativeMethods.cuda_GpuMat_create1(ptr, rows, cols, type); + GC.KeepAlive(this); } /// @@ -1128,6 +1063,7 @@ public void Create(Size size, MatType type) { ThrowIfDisposed(); NativeMethods.cuda_GpuMat_create2(ptr, size, type); + GC.KeepAlive(this); } /// @@ -1137,9 +1073,11 @@ public void Create(Size size, MatType type) public void Swap(GpuMat mat) { ThrowIfDisposed(); - if (mat == null) + if (mat is null) throw new ArgumentNullException(nameof(mat)); NativeMethods.cuda_GpuMat_swap(ptr, mat.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(mat); } /// @@ -1151,6 +1089,7 @@ public void LocateROI(out Size wholeSize, out Point ofs) { ThrowIfDisposed(); NativeMethods.cuda_GpuMat_locateROI(ptr, out wholeSize, out ofs); + GC.KeepAlive(this); } /// @@ -1165,6 +1104,7 @@ public GpuMat AdjustROI(int dtop, int dbottom, int dleft, int dright) { ThrowIfDisposed(); IntPtr ret = NativeMethods.cuda_GpuMat_adjustROI(ptr, dtop, dbottom, dleft, dright); + GC.KeepAlive(this); return new GpuMat(ret); } @@ -1176,7 +1116,9 @@ public GpuMat AdjustROI(int dtop, int dbottom, int dleft, int dright) public unsafe byte* Ptr(int y = 0) { ThrowIfDisposed(); - return NativeMethods.cuda_GpuMat_ptr(ptr, y); + var res = NativeMethods.cuda_GpuMat_ptr(ptr, y); + GC.KeepAlive(this); + return res; } /// @@ -1193,7 +1135,7 @@ public override string ToString() " ]"; } - #endregion +#endregion private void ThrowIfNotAvailable() { @@ -1204,4 +1146,4 @@ private void ThrowIfNotAvailable() } } - +#endif diff --git a/src/OpenCvSharp/modules/cuda/GpuMatIndexer.cs b/src/OpenCvSharp/Modules/cuda/GpuMatIndexer.cs similarity index 97% rename from src/OpenCvSharp/modules/cuda/GpuMatIndexer.cs rename to src/OpenCvSharp/Modules/cuda/GpuMatIndexer.cs index 2457fcbc9..50c0356c7 100644 --- a/src/OpenCvSharp/modules/cuda/GpuMatIndexer.cs +++ b/src/OpenCvSharp/Modules/cuda/GpuMatIndexer.cs @@ -1,3 +1,5 @@ +#if ENABLED_CUDA + using OpenCvSharp.Util; namespace OpenCvSharp.Cuda @@ -42,4 +44,6 @@ internal GpuMatIndexer(GpuMat parent) this.sizeOfT = MarshalHelper.SizeOf(); } } -} \ No newline at end of file +} + +#endif diff --git a/src/OpenCvSharp/modules/cuda/GpuMatRowColIndexer.cs b/src/OpenCvSharp/Modules/cuda/GpuMatRowColIndexer.cs similarity index 99% rename from src/OpenCvSharp/modules/cuda/GpuMatRowColIndexer.cs rename to src/OpenCvSharp/Modules/cuda/GpuMatRowColIndexer.cs index 362a8e444..578e3db0f 100644 --- a/src/OpenCvSharp/modules/cuda/GpuMatRowColIndexer.cs +++ b/src/OpenCvSharp/Modules/cuda/GpuMatRowColIndexer.cs @@ -1,3 +1,5 @@ +#if ENABLED_CUDA + namespace OpenCvSharp.Cuda { /// @@ -104,4 +106,6 @@ public virtual void Set(Range range, GpuMat value) this[range.Start, range.End] = value; } } -} \ No newline at end of file +} + +#endif diff --git a/src/OpenCvSharp/modules/cuda/Stream.cs b/src/OpenCvSharp/Modules/cuda/Stream.cs similarity index 85% rename from src/OpenCvSharp/modules/cuda/Stream.cs rename to src/OpenCvSharp/Modules/cuda/Stream.cs index ad4e0ea36..021dc244f 100644 --- a/src/OpenCvSharp/modules/cuda/Stream.cs +++ b/src/OpenCvSharp/Modules/cuda/Stream.cs @@ -1,4 +1,6 @@ -using System; +#if ENABLED_CUDA + +using System; using System.Collections.Generic; using System.Runtime.InteropServices; @@ -15,15 +17,9 @@ namespace OpenCvSharp.Cuda [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void StreamCallbackInternal(IntPtr stream, int status, IntPtr userData); -#if LANG_JP - /// - /// Encapculates Cuda Stream. Provides interface for async coping. - /// -#else /// /// Encapculates Cuda Stream. Provides interface for async coping. /// -#endif public sealed class Stream : DisposableGpuObject { private StreamCallbackInternal callbackInternal; @@ -32,17 +28,10 @@ public sealed class Stream : DisposableGpuObject #region Init and Disposal -#if LANG_JP - /// - /// OpenCVネイティブの cv::gpu::Stream* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::gpu::Stream* pointer /// /// -#endif public Stream(IntPtr ptr) { ThrowIfNotAvailable(); @@ -67,20 +56,15 @@ public Stream() public Stream(Stream m) { ThrowIfNotAvailable(); - if (m == null) + if (m is null) throw new ArgumentNullException(nameof(m)); ptr = NativeMethods.cuda_Stream_new2(m.CvPtr); + GC.KeepAlive(m); } -#if LANG_JP - /// - /// リソースの解放 - /// -#else /// /// Clean up any resources being used. /// -#endif public void Release() { Dispose(); @@ -109,7 +93,7 @@ public static Stream Null { get { - if (nullObject == null) + if (nullObject is null) { IntPtr ret = NativeMethods.cuda_Stream_Null(); nullObject = new Stream(ret) {IsEnabledDispose = false}; @@ -127,7 +111,9 @@ public static Stream Null public static explicit operator bool(Stream self) { self.ThrowIfDisposed(); - return NativeMethods.cuda_Stream_bool(self.ptr) != 0; + var res = NativeMethods.cuda_Stream_bool(self.ptr) != 0; + GC.KeepAlive(self); + return res; } /// @@ -137,7 +123,9 @@ public static explicit operator bool(Stream self) public bool QueryIfComplete() { ThrowIfDisposed(); - return NativeMethods.cuda_Stream_queryIfComplete(ptr) != 0; + var res = NativeMethods.cuda_Stream_queryIfComplete(ptr) != 0; + GC.KeepAlive(this); + return res; } /// @@ -147,6 +135,7 @@ public void WaitForCompletion() { ThrowIfDisposed(); NativeMethods.cuda_Stream_waitForCompletion(ptr); + GC.KeepAlive(this); } /// @@ -158,14 +147,17 @@ public void WaitForCompletion() public void EnqueueDownload(GpuMat src, Mat dst) { ThrowIfDisposed(); - if (src == null) + if (src is null) throw new ArgumentNullException(nameof(src)); - if (dst == null) + if (dst is null) throw new ArgumentNullException(nameof(dst)); src.ThrowIfDisposed(); dst.ThrowIfDisposed(); NativeMethods.cuda_Stream_enqueueDownload_Mat(ptr, src.CvPtr, dst.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); } /// @@ -177,14 +169,17 @@ public void EnqueueDownload(GpuMat src, Mat dst) public void EnqueueUpload(Mat src, GpuMat dst) { ThrowIfDisposed(); - if (src == null) + if (src is null) throw new ArgumentNullException(nameof(src)); - if (dst == null) + if (dst is null) throw new ArgumentNullException(nameof(dst)); src.ThrowIfDisposed(); dst.ThrowIfDisposed(); NativeMethods.cuda_Stream_enqueueUpload_Mat(ptr, src.CvPtr, dst.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); } /// @@ -195,14 +190,17 @@ public void EnqueueUpload(Mat src, GpuMat dst) public void EnqueueCopy(GpuMat src, GpuMat dst) { ThrowIfDisposed(); - if (src == null) + if (src is null) throw new ArgumentNullException(nameof(src)); - if (dst == null) + if (dst is null) throw new ArgumentNullException(nameof(dst)); src.ThrowIfDisposed(); dst.ThrowIfDisposed(); NativeMethods.cuda_Stream_enqueueCopy(ptr, src.CvPtr, dst.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); } /// @@ -213,11 +211,13 @@ public void EnqueueCopy(GpuMat src, GpuMat dst) public void EnqueueMemSet(GpuMat src, Scalar val) { ThrowIfDisposed(); - if (src == null) + if (src is null) throw new ArgumentNullException(nameof(src)); src.ThrowIfDisposed(); NativeMethods.cuda_Stream_enqueueMemSet(ptr, src.CvPtr, val); + GC.KeepAlive(this); + GC.KeepAlive(src); } /// @@ -229,11 +229,14 @@ public void EnqueueMemSet(GpuMat src, Scalar val) public void EnqueueMemSet(GpuMat src, Scalar val, GpuMat mask) { ThrowIfDisposed(); - if (src == null) + if (src is null) throw new ArgumentNullException(nameof(src)); src.ThrowIfDisposed(); NativeMethods.cuda_Stream_enqueueMemSet_WithMask(ptr, src.CvPtr, val, Cv2.ToPtr(mask)); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(mask); } /// @@ -247,14 +250,17 @@ public void EnqueueMemSet(GpuMat src, Scalar val, GpuMat mask) public void EnqueueConvert(GpuMat src, GpuMat dst, int dtype, double a = 1, double b = 0) { ThrowIfDisposed(); - if (src == null) + if (src is null) throw new ArgumentNullException(nameof(src)); - if (dst == null) + if (dst is null) throw new ArgumentNullException(nameof(dst)); src.ThrowIfDisposed(); dst.ThrowIfDisposed(); NativeMethods.cuda_Stream_enqueueConvert(ptr, src.CvPtr, dst.CvPtr, dtype, a, b); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); } /// @@ -266,7 +272,7 @@ public void EnqueueConvert(GpuMat src, GpuMat dst, int dtype, double a = 1, doub public void EnqueueHostCallback(StreamCallback callback, object userData = null) { ThrowIfDisposed(); - if (callback == null) + if (callback is null) throw new ArgumentNullException(nameof(callback)); if (callbackHandle.IsAllocated) @@ -275,14 +281,14 @@ public void EnqueueHostCallback(StreamCallback callback, object userData = null) userDataHandle.Free(); IntPtr userDataPtr = IntPtr.Zero; - if (userData != null) + if (userData is not null) { userDataHandle = GCHandle.Alloc(userData); userDataPtr = GCHandle.ToIntPtr(userDataHandle); } callbackInternal = new StreamCallbackInternal( - delegate(IntPtr rawStream, int status, IntPtr rawUserData) + (rawStream, status, rawUserData) => { var streamObj = new Stream(rawStream) {IsEnabledDispose = false}; var userDataObj = GCHandle.FromIntPtr(rawUserData).Target; @@ -293,6 +299,9 @@ public void EnqueueHostCallback(StreamCallback callback, object userData = null) NativeMethods.cuda_Stream_enqueueHostCallback( ptr, callbackPtr, userDataPtr); + GC.KeepAlive(this); } } } + +#endif diff --git a/src/OpenCvSharp/Modules/dnn/Backend.cs b/src/OpenCvSharp/Modules/dnn/Backend.cs new file mode 100644 index 000000000..7d81e17af --- /dev/null +++ b/src/OpenCvSharp/Modules/dnn/Backend.cs @@ -0,0 +1,28 @@ +#pragma warning disable CS1591 + +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Dnn; + +/// +/// Enum of computation backends supported by layers. +/// +/// +/// DNN_BACKEND_DEFAULT equals to DNN_BACKEND_INFERENCE_ENGINE if +/// OpenCV is built with Intel's Inference Engine library or +/// DNN_BACKEND_OPENCV otherwise. +/// +public enum Backend +{ + //! DNN_BACKEND_DEFAULT equals to DNN_BACKEND_INFERENCE_ENGINE if + //! OpenCV is built with Intel's Inference Engine library or + //! DNN_BACKEND_OPENCV otherwise. + // ReSharper disable once InconsistentNaming + DEFAULT, + HALIDE, + INFERENCE_ENGINE, + OPENCV, + VKCOM, + CUDA +} diff --git a/src/OpenCvSharp/Modules/dnn/CvDnn.cs b/src/OpenCvSharp/Modules/dnn/CvDnn.cs new file mode 100644 index 000000000..f9889d0cc --- /dev/null +++ b/src/OpenCvSharp/Modules/dnn/CvDnn.cs @@ -0,0 +1,482 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.Dnn; + +/// +/// cv::dnn functions +/// +public static class CvDnn +{ + /// + /// Reads a network model stored in Darknet (https://pjreddie.com/darknet/) model files. + /// + /// path to the .cfg file with text description of the network architecture. + /// path to the .weights file with learned network. + /// Network object that ready to do forward, throw an exception in failure cases. + /// This is shortcut consisting from DarknetImporter and Net::populateNet calls. + public static Net? ReadNetFromDarknet(string cfgFile, string? darknetModel = null) + { + return Net.ReadNetFromDarknet(cfgFile, darknetModel); + } + + /// + /// Reads a network model stored in Darknet (https://pjreddie.com/darknet/) model files from memory. + /// + /// A buffer contains a content of .cfg file with text description of the network architecture. + /// A buffer contains a content of .weights file with learned network. + /// + /// This is shortcut consisting from DarknetImporter and Net::populateNet calls. + public static Net? ReadNetFromDarknet(byte[] bufferCfg, byte[]? bufferModel = null) + { + return Net.ReadNetFromDarknet(bufferCfg, bufferModel); + } + + /// + /// Reads a network model stored in Darknet (https://pjreddie.com/darknet/) model files from stream. + /// + /// A buffer contains a content of .cfg file with text description of the network architecture. + /// A buffer contains a content of .weights file with learned network. + /// + /// This is shortcut consisting from DarknetImporter and Net::populateNet calls. + public static Net? ReadNetFromDarknet(Stream bufferCfg, Stream? bufferModel = null) + { + if (bufferCfg is null) + throw new ArgumentNullException(nameof(bufferCfg)); + return Net.ReadNetFromDarknet( + bufferCfg.StreamToArray(), + bufferModel?.StreamToArray()); + } + + /// + /// Reads a network model stored in Caffe model files. + /// + /// path to the .prototxt file with text description of the network architecture. + /// path to the .caffemodel file with learned network. + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + // ReSharper disable once IdentifierTypo + public static Net? ReadNetFromCaffe(string prototxt, string? caffeModel = null) + { + return Net.ReadNetFromCaffe(prototxt, caffeModel); + } + + /// + /// Reads a network model stored in Caffe model files from memory. + /// + /// buffer containing the content of the .prototxt file + /// buffer containing the content of the .caffemodel file + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromCaffe(byte[] bufferProto, byte[]? bufferModel = null) + { + return Net.ReadNetFromCaffe(bufferProto, bufferModel); + } + + /// + /// Reads a network model stored in Caffe model files from memory. + /// + /// buffer containing the content of the .prototxt file + /// buffer containing the content of the .caffemodel file + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromCaffe(ReadOnlySpan bufferProto, ReadOnlySpan bufferModel = default) + { + return Net.ReadNetFromCaffe(bufferProto, bufferModel); + } + + /// + /// Reads a network model stored in Caffe model files from Stream. + /// + /// buffer containing the content of the .prototxt file + /// buffer containing the content of the .caffemodel file + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromCaffe(Stream bufferProto, Stream? bufferModel = null) + { + if (bufferProto is null) + throw new ArgumentNullException(nameof(bufferProto)); + return Net.ReadNetFromCaffe( + bufferProto.StreamToArray(), + bufferModel?.StreamToArray()); + } + + /// + /// Reads a network model stored in Tensorflow model file. + /// + /// path to the .pb file with binary protobuf description of the network architecture + /// path to the .pbtxt file that contains text graph definition in protobuf format. + /// Resulting Net object is built by text graph using weights from a binary one that + /// let us make it more flexible. + /// This is shortcut consisting from createTensorflowImporter and Net::populateNet calls. + public static Net? ReadNetFromTensorflow(string model, string? config = null) + { + return Net.ReadNetFromTensorflow(model, config); + } + + /// + /// Reads a network model stored in Tensorflow model file from memory. + /// + /// buffer containing the content of the pb file + /// buffer containing the content of the pbtxt file (optional) + /// + /// This is shortcut consisting from createTensorflowImporter and Net::populateNet calls. + public static Net? ReadNetFromTensorflow(byte[] bufferModel, byte[]? bufferConfig = null) + { + return Net.ReadNetFromTensorflow(bufferModel, bufferConfig); + } + + /// + /// Reads a network model stored in Tensorflow model file from stream. + /// + /// buffer containing the content of the pb file + /// buffer containing the content of the pbtxt file (optional) + /// + /// This is shortcut consisting from createTensorflowImporter and Net::populateNet calls. + public static Net? ReadNetFromTensorflow(Stream bufferModel, Stream? bufferConfig = null) + { + if (bufferModel is null) + throw new ArgumentNullException(nameof(bufferModel)); + return Net.ReadNetFromTensorflow( + bufferModel.StreamToArray(), + bufferConfig?.StreamToArray()); + } + + /// + /// Reads a network model stored in Torch model file. + /// + /// + /// + /// + /// This is shortcut consisting from createTorchImporter and Net::populateNet calls. + public static Net? ReadNetFromTorch(string model, bool isBinary = true) + { + return Net.ReadNetFromTorch(model, isBinary); + } + + /// + /// Read deep learning network represented in one of the supported formats. + /// + /// This function automatically detects an origin framework of trained model + /// and calls an appropriate function such @ref readNetFromCaffe, @ref readNetFromTensorflow, + /// + /// Binary file contains trained weights. The following file + /// * extensions are expected for models from different frameworks: + /// * * `*.caffemodel` (Caffe, http://caffe.berkeleyvision.org/) + /// * * `*.pb` (TensorFlow, https://www.tensorflow.org/) + /// * * `*.t7` | `*.net` (Torch, http://torch.ch/) + /// * * `*.weights` (Darknet, https://pjreddie.com/darknet/) + /// * * `*.bin` (DLDT, https://software.intel.com/openvino-toolkit) + /// Text file contains network configuration. It could be a + /// * file with the following extensions: + /// * * `*.prototxt` (Caffe, http://caffe.berkeleyvision.org/) + /// * * `*.pbtxt` (TensorFlow, https://www.tensorflow.org/) + /// * * `*.cfg` (Darknet, https://pjreddie.com/darknet/) + /// * * `*.xml` (DLDT, https://software.intel.com/openvino-toolkit) + /// Explicit framework name tag to determine a format. + /// + public static Net ReadNet(string model, string config = "", string framework = "") + { + return Net.ReadNet(model, config, framework); + } + + /// + /// Loads blob which was serialized as torch.Tensor object of Torch7 framework. + /// + /// + /// + /// + /// + /// This function has the same limitations as createTorchImporter(). + /// + public static Mat ReadTorchBlob(string fileName, bool isBinary = true) + { + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.dnn_readTorchBlob(fileName, isBinary ? 1 : 0, out var ret)); + return new Mat(ret); + } + + /// + /// Reads a network model ONNX https://onnx.ai/ from memory + /// + /// + /// + public static Net? ReadNetFromOnnx(string onnxFile) + { + return Net.ReadNetFromONNX(onnxFile); + } + + /// + /// Reads a network model ONNX https://onnx.ai/ from memory + /// + /// memory of the first byte of the buffer. + /// + public static Net? ReadNetFromOnnx(byte[] onnxFileData) + { + return Net.ReadNetFromONNX(onnxFileData); + } + + /// + /// Reads a network model ONNX https://onnx.ai/ from memory + /// + /// memory of the first byte of the buffer. + /// + public static Net? ReadNetFromOnnx(ReadOnlySpan onnxFileData) + { + return Net.ReadNetFromONNX(onnxFileData); + } + + /// + /// Reads a network model ONNX https://onnx.ai/ from stream. + /// + /// memory of the first byte of the buffer. + /// + public static Net? ReadNetFromOnnx(Stream onnxFileStream) + { + if (onnxFileStream is null) + throw new ArgumentNullException(nameof(onnxFileStream)); + return ReadNetFromOnnx(StreamToArray(onnxFileStream)); + } + + /// + /// Creates blob from .pb file. + /// + /// path to the .pb file with input tensor. + /// + public static Mat? ReadTensorFromONNX(string path) + { + if (path is null) + throw new ArgumentNullException(nameof(path)); + + NativeMethods.HandleException( + NativeMethods.dnn_readTensorFromONNX(path, out var ret)); + return (ret == IntPtr.Zero) ? null : new Mat(ret); + } + + /// + /// Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, + /// subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels. + /// + /// input image (with 1- or 3-channels). + /// multiplier for @p image values. + /// spatial size for output image + /// scalar with mean values which are subtracted from channels. Values are intended + /// to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true. + /// flag which indicates that swap first and last channels in 3-channel image is necessary. + /// flag which indicates whether image will be cropped after resize or not + /// 4-dimansional Mat with NCHW dimensions order. + /// if @p crop is true, input image is resized so one side after resize is equal to corresponing + /// dimension in @p size and another one is equal or larger.Then, crop from the center is performed. + /// If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. + public static Mat BlobFromImage( + Mat image, double scaleFactor = 1.0, Size size = default, + Scalar mean = default, bool swapRB = true, bool crop = true) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + + NativeMethods.HandleException( + NativeMethods.dnn_blobFromImage( + image.CvPtr, scaleFactor, size, mean, swapRB ? 1 : 0, crop ? 1 : 0, out var ret)); + return new Mat(ret); + } + + /// + /// Creates 4-dimensional blob from series of images. Optionally resizes and + /// crops @p images from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels. + /// + /// input images (all with 1- or 3-channels). + /// multiplier for @p image values. + /// spatial size for output image + /// scalar with mean values which are subtracted from channels. Values are intended + /// to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true. + /// flag which indicates that swap first and last channels in 3-channel image is necessary. + /// flag which indicates whether image will be cropped after resize or not + /// 4-dimansional Mat with NCHW dimensions order. + /// if @p crop is true, input image is resized so one side after resize is equal to corresponing + /// dimension in @p size and another one is equal or larger.Then, crop from the center is performed. + /// If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. + public static Mat BlobFromImages( + IEnumerable images, double scaleFactor, + Size size = default, Scalar mean = default, bool swapRB = true, bool crop = true) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + + var imagesPointers = images.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.dnn_blobFromImages( + imagesPointers, imagesPointers.Length, scaleFactor, size, mean, swapRB ? 1 : 0, crop ? 1 : 0, + out var ret)); + return new Mat(ret); + } + + /// + /// Convert all weights of Caffe network to half precision floating point. + /// + /// Path to origin model from Caffe framework contains single + /// precision floating point weights(usually has `.caffemodel` extension). + /// Path to destination model with updated weights. + /// Set of layers types which parameters will be converted. + /// By default, converts only Convolutional and Fully-Connected layers' weights. + /// + /// Shrinked model has no origin float32 weights so it can't be used + /// in origin Caffe framework anymore.However the structure of data + /// is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe. + /// So the resulting model may be used there. + /// + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public static void ShrinkCaffeModel(string src, string dst, IEnumerable? layersTypes = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + var layersTypesArray = layersTypes as string[] ?? layersTypes?.ToArray() ?? []; + NativeMethods.HandleException( + NativeMethods.dnn_shrinkCaffeModel(src, dst, layersTypesArray, layersTypesArray.Length)); + } + + /// + /// Create a text representation for a binary network stored in protocol buffer format. + /// + /// A path to binary network. + /// A path to output text file to be created. + public static void WriteTextGraph(string model, string output) + { + if (model is null) + throw new ArgumentNullException(nameof(model)); + if (output is null) + throw new ArgumentNullException(nameof(output)); + + NativeMethods.HandleException( + NativeMethods.dnn_writeTextGraph(model, output)); + } + + /// + /// Performs non maximum suppression given boxes and corresponding scores. + /// + /// a set of bounding boxes to apply NMS. + /// a set of corresponding confidences. + /// a threshold used to filter boxes by score. + /// a threshold used in non maximum suppression. + /// the kept indices of bboxes after NMS. + /// a coefficient in adaptive threshold formula + /// if `>0`, keep at most @p top_k picked indices. + // ReSharper disable once IdentifierTypo + public static void NMSBoxes(IEnumerable bboxes, IEnumerable scores, + float scoreThreshold, float nmsThreshold, + out int[] indices, + float eta = 1.0f, int topK = 0) + { + if (bboxes is null) + throw new ArgumentNullException(nameof(bboxes)); + if (scores is null) + throw new ArgumentNullException(nameof(scores)); + + // ReSharper disable once IdentifierTypo + using var bboxesVec = new VectorOfRect(bboxes); + using var scoresVec = new VectorOfFloat(scores); + using var indicesVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.dnn_NMSBoxes_Rect( + bboxesVec.CvPtr, scoresVec.CvPtr, scoreThreshold, nmsThreshold, + indicesVec.CvPtr, eta, topK)); + indices = indicesVec.ToArray(); + } + + /// + /// Performs non maximum suppression given boxes and corresponding scores. + /// + /// a set of bounding boxes to apply NMS. + /// a set of corresponding confidences. + /// a threshold used to filter boxes by score. + /// a threshold used in non maximum suppression. + /// the kept indices of bboxes after NMS. + /// a coefficient in adaptive threshold formula + /// if `>0`, keep at most @p top_k picked indices. + // ReSharper disable once IdentifierTypo + public static void NMSBoxes(IEnumerable bboxes, IEnumerable scores, + float scoreThreshold, float nmsThreshold, + out int[] indices, + float eta = 1.0f, int topK = 0) + { + if (bboxes is null) + throw new ArgumentNullException(nameof(bboxes)); + if (scores is null) + throw new ArgumentNullException(nameof(scores)); + + // ReSharper disable once IdentifierTypo + using var bboxesVec = new VectorOfRect2d(bboxes); + using var scoresVec = new VectorOfFloat(scores); + using var indicesVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.dnn_NMSBoxes_Rect2d( + bboxesVec.CvPtr, scoresVec.CvPtr, scoreThreshold, nmsThreshold, + indicesVec.CvPtr, eta, topK)); + indices = indicesVec.ToArray(); + } + + /// + /// Performs non maximum suppression given boxes and corresponding scores. + /// + /// a set of bounding boxes to apply NMS. + /// a set of corresponding confidences. + /// a threshold used to filter boxes by score. + /// a threshold used in non maximum suppression. + /// the kept indices of bboxes after NMS. + /// a coefficient in adaptive threshold formula + /// if `>0`, keep at most @p top_k picked indices. + // ReSharper disable once IdentifierTypo + public static void NMSBoxes(IEnumerable bboxes, IEnumerable scores, + float scoreThreshold, float nmsThreshold, + out int[] indices, + float eta = 1.0f, int topK = 0) + { + if (bboxes is null) + throw new ArgumentNullException(nameof(bboxes)); + if (scores is null) + throw new ArgumentNullException(nameof(scores)); + + // ReSharper disable once IdentifierTypo + using var bboxesVec = new VectorOfRotatedRect(bboxes); + using var scoresVec = new VectorOfFloat(scores); + using var indicesVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.dnn_NMSBoxes_RotatedRect( + bboxesVec.CvPtr, scoresVec.CvPtr, scoreThreshold, nmsThreshold, + indicesVec.CvPtr, eta, topK)); + indices = indicesVec.ToArray(); + } + + /// + /// Release a Myriad device is binded by OpenCV. + /// + /// Single Myriad device cannot be shared across multiple processes which uses Inference Engine's Myriad plugin. + /// + public static void ResetMyriadDevice() + { + NativeMethods.HandleException( + NativeMethods.dnn_resetMyriadDevice()); + } + + private static byte[] StreamToArray(this Stream stream) + { + if (!stream.CanRead) + throw new ArgumentException("Unreadable stream", nameof(stream)); + using var memoryStream = new MemoryStream(); + stream.CopyTo(memoryStream); + byte[] byteBlob = memoryStream.ToArray(); + return byteBlob; + } +} diff --git a/src/OpenCvSharp/Modules/dnn/Net.cs b/src/OpenCvSharp/Modules/dnn/Net.cs new file mode 100644 index 000000000..f9f4da6f5 --- /dev/null +++ b/src/OpenCvSharp/Modules/dnn/Net.cs @@ -0,0 +1,699 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.Dnn; + +/// +/// +/// This class allows to create and manipulate comprehensive artificial neural networks. +/// +/// +/// Neural network is presented as directed acyclic graph(DAG), where vertices are Layer instances, +/// and edges specify relationships between layers inputs and outputs. +/// +/// Each network layer has unique integer id and unique string name inside its network. +/// LayerId can store either layer name or layer id. +/// This class supports reference counting of its instances, i.e.copies point to the same instance. +/// +[SuppressMessage("Microsoft.Design", "CA1724: Type names should not match namespaces")] +public class Net : DisposableCvObject +{ + #region Init & Disposal + + /// + /// + /// Default constructor. + /// + public Net() + { + NativeMethods.HandleException( + NativeMethods.dnn_Net_new(out ptr)); + } + + /// + /// + /// + protected Net(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.dnn_Net_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Create a network from Intel's Model Optimizer intermediate representation (IR). + /// Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend. + /// + /// XML configuration file with network's topology. + /// Binary file with trained weights. + /// + public static Net? ReadFromModelOptimizer(string xml, string bin) + { + if (xml is null) + throw new ArgumentNullException(nameof(xml)); + if (bin is null) + throw new ArgumentNullException(nameof(bin)); + + NativeMethods.HandleException( + NativeMethods.dnn_Net_readFromModelOptimizer(xml, bin, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Reads a network model stored in Darknet (https://pjreddie.com/darknet/) model files. + /// + /// path to the .cfg file with text description of the network architecture. + /// path to the .weights file with learned network. + /// Network object that ready to do forward, throw an exception in failure cases. + /// This is shortcut consisting from DarknetImporter and Net::populateNet calls. + public static Net? ReadNetFromDarknet(string cfgFile, string? darknetModel = null) + { + if (cfgFile is null) + throw new ArgumentNullException(nameof(cfgFile)); + + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromDarknet(cfgFile, darknetModel, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Reads a network model stored in Caffe model files from memory. + /// + /// A buffer contains a content of .cfg file with text description of the network architecture. + /// A buffer contains a content of .weights file with learned network. + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromDarknet(byte[] bufferCfg, byte[]? bufferModel = null) + { + if (bufferCfg is null) + throw new ArgumentNullException(nameof(bufferCfg)); + + var ret = ReadNetFromDarknet( + new ReadOnlySpan(bufferCfg), + bufferModel is null ? ReadOnlySpan.Empty : new ReadOnlySpan(bufferModel)); + GC.KeepAlive(bufferCfg); + GC.KeepAlive(bufferModel); + return ret; + } + + /// + /// Reads a network model stored in Caffe model files from memory. + /// + /// A buffer contains a content of .cfg file with text description of the network architecture. + /// A buffer contains a content of .weights file with learned network. + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromDarknet(ReadOnlySpan bufferCfg, ReadOnlySpan bufferModel = default) + { + if (bufferCfg.IsEmpty) + throw new ArgumentException("Empty span", nameof(bufferCfg)); + + unsafe + { + fixed (byte* bufferCfgPtr = bufferCfg) + fixed (byte* bufferModelPtr = bufferModel) + { + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromDarknet( + bufferCfgPtr, new IntPtr(bufferCfg.Length), + bufferModelPtr, new IntPtr(bufferModel.Length), + out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + } + } + + /// + /// Reads a network model stored in Caffe model files. + /// + /// path to the .prototxt file with text description of the network architecture. + /// path to the .caffemodel file with learned network. + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromCaffe(string prototxt, string? caffeModel = null) + { + if (prototxt is null) + throw new ArgumentNullException(nameof(prototxt)); + + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromCaffe(prototxt, caffeModel, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Reads a network model stored in Caffe model in memory. + /// + /// buffer containing the content of the .prototxt file + /// buffer containing the content of the .caffemodel file + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromCaffe(byte[] bufferProto, byte[]? bufferModel = null) + { + if (bufferProto is null) + throw new ArgumentNullException(nameof(bufferProto)); + + var ret = ReadNetFromCaffe( + new ReadOnlySpan(bufferProto), + bufferModel is null ? ReadOnlySpan.Empty : new ReadOnlySpan(bufferModel)); + GC.KeepAlive(bufferProto); + GC.KeepAlive(bufferModel); + return ret; + } + + /// + /// Reads a network model stored in Caffe model files from memory. + /// + /// buffer containing the content of the .prototxt file + /// buffer containing the content of the .caffemodel file + /// + /// This is shortcut consisting from createCaffeImporter and Net::populateNet calls. + public static Net? ReadNetFromCaffe(ReadOnlySpan bufferProto, ReadOnlySpan bufferModel = default) + { + if (bufferProto.IsEmpty) + throw new ArgumentException("Empty span", nameof(bufferProto)); + + unsafe + { + fixed (byte* bufferProtoPtr = bufferProto) + fixed (byte* bufferModelPtr = bufferModel) + { + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromCaffe( + bufferProtoPtr, new IntPtr(bufferProto.Length), + bufferModelPtr, new IntPtr(bufferModel.Length), + out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + } + } + + /// + /// Reads a network model stored in Tensorflow model file. + /// + /// path to the .pb file with binary protobuf description of the network architecture + /// path to the .pbtxt file that contains text graph definition in protobuf format. + /// Resulting Net object is built by text graph using weights from a binary one that + /// let us make it more flexible. + /// This is shortcut consisting from createTensorflowImporter and Net::populateNet calls. + public static Net? ReadNetFromTensorflow(string model, string? config = null) + { + if (model is null) + throw new ArgumentNullException(nameof(model)); + + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromTensorflow(model, config, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Reads a network model stored in Tensorflow model from memory. + /// + /// buffer containing the content of the pb file + /// buffer containing the content of the pbtxt file (optional) + /// + /// This is shortcut consisting from createTensorflowImporter and Net::populateNet calls. + public static Net? ReadNetFromTensorflow(byte[] bufferModel, byte[]? bufferConfig = null) + { + if (bufferModel is null) + throw new ArgumentNullException(nameof(bufferModel)); + + var ret = ReadNetFromTensorflow( + new ReadOnlySpan(bufferModel), + bufferConfig is null ? ReadOnlySpan.Empty : new ReadOnlySpan(bufferConfig)); + GC.KeepAlive(bufferModel); + GC.KeepAlive(bufferConfig); + return ret; + } + + /// + /// Reads a network model stored in Tensorflow model from memory. + /// + /// buffer containing the content of the pb file + /// buffer containing the content of the pbtxt file (optional) + /// + /// This is shortcut consisting from createTensorflowImporter and Net::populateNet calls. + public static Net? ReadNetFromTensorflow(ReadOnlySpan bufferModel, ReadOnlySpan bufferConfig = default) + { + if (bufferModel.IsEmpty) + throw new ArgumentException("Empty span", nameof(bufferModel)); + + unsafe + { + fixed (byte* bufferModelPtr = bufferModel) + fixed (byte* bufferConfigPtr = bufferConfig) + { + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromTensorflow( + bufferModelPtr, new IntPtr(bufferModel.Length), + bufferConfigPtr, new IntPtr(bufferConfig.Length), + out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + } + } + + /// + /// Reads a network model stored in Torch model file. + /// + /// + /// + /// + /// This is shortcut consisting from createTorchImporter and Net::populateNet calls. + public static Net? ReadNetFromTorch(string model, bool isBinary = true) + { + if (model is null) + throw new ArgumentNullException(nameof(model)); + + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromTorch(model, isBinary ? 1 : 0, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Read deep learning network represented in one of the supported formats. + /// + /// This function automatically detects an origin framework of trained model + /// and calls an appropriate function such @ref readNetFromCaffe, @ref readNetFromTensorflow, + /// + /// Binary file contains trained weights. The following file + /// * extensions are expected for models from different frameworks: + /// * * `*.caffemodel` (Caffe, http://caffe.berkeleyvision.org/) + /// * * `*.pb` (TensorFlow, https://www.tensorflow.org/) + /// * * `*.t7` | `*.net` (Torch, http://torch.ch/) + /// * * `*.weights` (Darknet, https://pjreddie.com/darknet/) + /// * * `*.bin` (DLDT, https://software.intel.com/openvino-toolkit) + /// Text file contains network configuration. It could be a + /// * file with the following extensions: + /// * * `*.prototxt` (Caffe, http://caffe.berkeleyvision.org/) + /// * * `*.pbtxt` (TensorFlow, https://www.tensorflow.org/) + /// * * `*.cfg` (Darknet, https://pjreddie.com/darknet/) + /// * * `*.xml` (DLDT, https://software.intel.com/openvino-toolkit) + /// Explicit framework name tag to determine a format. + /// + public static Net ReadNet(string model, string config = "", string framework = "") + { + if (string.IsNullOrEmpty(model)) + throw new ArgumentException("message is null or empty", nameof(model)); + config ??= ""; + framework ??= ""; + + NativeMethods.HandleException( + NativeMethods.dnn_readNet(model, config, framework, out var p)); + return new Net(p); + } + + /// + /// Load a network from Intel's Model Optimizer intermediate representation. + /// Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend. + /// + /// XML configuration file with network's topology. + /// Binary file with trained weights. + /// + public static Net? ReadNetFromModelOptimizer(string xml, string bin) + { + if (xml is null) + throw new ArgumentNullException(nameof(xml)); + if (bin is null) + throw new ArgumentNullException(nameof(bin)); + + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromModelOptimizer(xml, bin, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Reads a network model ONNX https://onnx.ai/ + /// + /// path to the .onnx file with text description of the network architecture. + /// Network object that ready to do forward, throw an exception in failure cases. + // ReSharper disable once InconsistentNaming + public static Net? ReadNetFromONNX(string onnxFile) + { + if (onnxFile is null) + throw new ArgumentNullException(nameof(onnxFile)); + + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromONNX(onnxFile, out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + + /// + /// Reads a network model ONNX https://onnx.ai/ from memory + /// + /// memory of the first byte of the buffer. + /// Network object that ready to do forward, throw an exception in failure cases. + // ReSharper disable once InconsistentNaming + public static Net? ReadNetFromONNX(byte[] onnxFileData) + { + if (onnxFileData is null) + throw new ArgumentNullException(nameof(onnxFileData)); + + var ret = ReadNetFromONNX( + new ReadOnlySpan(onnxFileData)); + GC.KeepAlive(onnxFileData); + return ret; + } + + /// + /// Reads a network model ONNX https://onnx.ai/ from memory + /// + /// memory of the first byte of the buffer. + /// Network object that ready to do forward, throw an exception in failure cases. + // ReSharper disable once InconsistentNaming + public static Net? ReadNetFromONNX(ReadOnlySpan onnxFileData) + { + if (onnxFileData.IsEmpty) + throw new ArgumentException("Empty span", nameof(onnxFileData)); + unsafe + { + fixed (byte* onnxFileDataPtr = onnxFileData) + { + NativeMethods.HandleException( + NativeMethods.dnn_readNetFromONNX( + onnxFileDataPtr, new IntPtr(onnxFileData.Length), out var p)); + return (p == IntPtr.Zero) ? null : new Net(p); + } + } + } + + #endregion + + #region Methods + + /// + /// Returns true if there are no layers in the network. + /// + /// + public bool Empty() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.dnn_Net_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Dump net to String. + /// Call method after setInput(). To see correct backend, target and fusion run after forward(). + /// + /// String with structure, hyperparameters, backend, target and fusion + public string Dump() + { + ThrowIfDisposed(); + + using var stdString = new StdString(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_dump(ptr, stdString.CvPtr)); + GC.KeepAlive(this); + return stdString.ToString(); + } + + /// + /// Dump net structure, hyperparameters, backend, target and fusion to dot file + /// + /// path to output file with .dot extension + public void DumpToFile(string path) + { + if (path is null) + throw new ArgumentNullException(nameof(path)); + NativeMethods.HandleException( + NativeMethods.dnn_Net_dumpToFile(ptr, path)); + GC.KeepAlive(this); + } + + /// + /// Converts string name of the layer to the integer identifier. + /// + /// + /// id of the layer, or -1 if the layer wasn't found. + public int GetLayerId(string layer) + { + if (layer is null) + throw new ArgumentNullException(nameof(layer)); + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.dnn_Net_getLayerId(ptr, layer, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public string?[] GetLayerNames() + { + using var namesVec = new VectorOfString(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_getLayerNames(ptr, namesVec.CvPtr)); + GC.KeepAlive(this); + return namesVec.ToArray(); + } + + /// + /// Connects output of the first layer to input of the second layer. + /// + /// descriptor of the first layer output. + /// descriptor of the second layer input. + public void Connect(string outPin, string inpPin) + { + if (outPin is null) + throw new ArgumentNullException(nameof(outPin)); + if (inpPin is null) + throw new ArgumentNullException(nameof(inpPin)); + + NativeMethods.HandleException( + NativeMethods.dnn_Net_connect1(ptr, outPin, inpPin)); + GC.KeepAlive(this); + } + + /// + /// Connects #@p outNum output of the first layer to #@p inNum input of the second layer. + /// + /// identifier of the first layer + /// identifier of the second layer + /// number of the first layer output + /// number of the second layer input + public void Connect(int outLayerId, int outNum, int inpLayerId, int inpNum) + { + NativeMethods.HandleException( + NativeMethods.dnn_Net_connect2(ptr, outLayerId, outNum, inpLayerId, inpNum)); + GC.KeepAlive(this); + } + + /// + /// Sets outputs names of the network input pseudo layer. + /// + /// + /// + /// * Each net always has special own the network input pseudo layer with id=0. + /// * This layer stores the user blobs only and don't make any computations. + /// * In fact, this layer provides the only way to pass user data into the network. + /// * As any other layer, this layer can label its outputs and this function provides an easy way to do this. + /// + public void SetInputsNames(IEnumerable inputBlobNames) + { + if (inputBlobNames is null) + throw new ArgumentNullException(nameof(inputBlobNames)); + + var inputBlobNamesArray = inputBlobNames.ToArray(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_setInputsNames(ptr, inputBlobNamesArray, inputBlobNamesArray.Length)); + GC.KeepAlive(this); + } + + /// + /// Runs forward pass to compute output of layer with name @p outputName. + /// By default runs forward pass for the whole network. + /// + /// name for layer which output is needed to get + /// blob for first output of specified layer. + public Mat Forward(string? outputName = null) + { + NativeMethods.HandleException( + NativeMethods.dnn_Net_forward1(ptr, outputName, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// Runs forward pass to compute output of layer with name @p outputName. + /// + /// contains all output blobs for specified layer. + /// name for layer which output is needed to get. + /// If outputName is empty, runs forward pass for the whole network. + public void Forward(IEnumerable outputBlobs, string? outputName = null) + { + if (outputBlobs is null) + throw new ArgumentNullException(nameof(outputBlobs)); + + var outputBlobsPtrs = outputBlobs.Select(x => x.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_forward2(ptr, outputBlobsPtrs, outputBlobsPtrs.Length, outputName)); + + GC.KeepAlive(outputBlobs); + GC.KeepAlive(this); + } + + /// + /// Runs forward pass to compute outputs of layers listed in @p outBlobNames. + /// + /// contains blobs for first outputs of specified layers. + /// names for layers which outputs are needed to get + public void Forward(IEnumerable outputBlobs, IEnumerable outBlobNames) + { + if (outputBlobs is null) + throw new ArgumentNullException(nameof(outputBlobs)); + if (outBlobNames is null) + throw new ArgumentNullException(nameof(outBlobNames)); + + var outputBlobsPtrs = outputBlobs.Select(x => x.CvPtr).ToArray(); + var outBlobNamesArray = outBlobNames.ToArray(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_forward3( + ptr, outputBlobsPtrs, outputBlobsPtrs.Length, outBlobNamesArray, outBlobNamesArray.Length)); + + GC.KeepAlive(outputBlobs); + GC.KeepAlive(this); + } + + /// + /// Compile Halide layers. + /// Schedule layers that support Halide backend. Then compile them for + /// specific target.For layers that not represented in scheduling file + /// or if no manual scheduling used at all, automatic scheduling will be applied. + /// + /// Path to YAML file with scheduling directives. + public void SetHalideScheduler(string scheduler) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_setHalideScheduler(ptr, scheduler)); + GC.KeepAlive(this); + } + + /// + /// Ask network to use specific computation backend where it supported. + /// + /// backend identifier. + public void SetPreferableBackend(Backend backendId) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_setPreferableBackend(ptr, (int)backendId)); + GC.KeepAlive(this); + } + + /// + /// Ask network to make computations on specific target device. + /// + /// target identifier. + public void SetPreferableTarget(Target targetId) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_setPreferableTarget(ptr, (int)targetId)); + GC.KeepAlive(this); + } + + /// + /// Sets the new value for the layer output blob + /// + /// new blob. + /// descriptor of the updating layer output blob. + /// + /// connect(String, String) to know format of the descriptor. + /// If updating blob is not empty then @p blob must have the same shape, + /// because network reshaping is not implemented yet. + /// + public void SetInput(Mat blob, string name = "") + { + if (blob is null) + throw new ArgumentNullException(nameof(blob)); + + NativeMethods.HandleException( + NativeMethods.dnn_Net_setInput(ptr, blob.CvPtr, name)); + GC.KeepAlive(this); + } + + /// + /// Returns indexes of layers with unconnected outputs. + /// + /// + public int[] GetUnconnectedOutLayers() + { + ThrowIfDisposed(); + + using var resultVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_getUnconnectedOutLayers(ptr, resultVec.CvPtr)); + GC.KeepAlive(this); + return resultVec.ToArray(); + } + + /// + /// Returns names of layers with unconnected outputs. + /// + /// + public string?[] GetUnconnectedOutLayersNames() + { + ThrowIfDisposed(); + + using var resultVec = new VectorOfString(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_getUnconnectedOutLayersNames(ptr, resultVec.CvPtr)); + GC.KeepAlive(this); + return resultVec.ToArray(); + } + + /// + /// Enables or disables layer fusion in the network. + /// + /// true to enable the fusion, false to disable. The fusion is enabled by default. + public void EnableFusion(bool fusion) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_enableFusion(ptr, fusion ? 1 : 0)); + GC.KeepAlive(this); + } + + /// + /// Returns overall time for inference and timings (in ticks) for layers. + /// Indexes in returned vector correspond to layers ids.Some layers can be fused with others, + /// in this case zero ticks count will be return for that skipped layers. + /// + /// vector for tick timings for all layers. + /// overall ticks for model inference. + public long GetPerfProfile(out double[] timings) + { + ThrowIfDisposed(); + + using var timingsVec = new VectorOfDouble(); + NativeMethods.HandleException( + NativeMethods.dnn_Net_getPerfProfile(ptr, timingsVec.CvPtr, out var ret)); + GC.KeepAlive(this); + + timings = timingsVec.ToArray(); + return ret; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/dnn/Target.cs b/src/OpenCvSharp/Modules/dnn/Target.cs new file mode 100644 index 000000000..88c8fffd8 --- /dev/null +++ b/src/OpenCvSharp/Modules/dnn/Target.cs @@ -0,0 +1,26 @@ +#pragma warning disable CS1591 + +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Dnn; + +/// +/// Enum of target devices for computations. +/// +public enum Target +{ + CPU, + OPENCL, + OPENCL_FP16, + MYRIAD, + VULKAN, + + /// + /// FPGA device with CPU fallbacks using Inference Engine's Heterogeneous plugin. + /// + FPGA, + CUDA, + CUDA_FP16, + HDDL +} diff --git a/src/OpenCvSharp/Modules/dnn_superres/DnnSuperResImpl.cs b/src/OpenCvSharp/Modules/dnn_superres/DnnSuperResImpl.cs new file mode 100644 index 000000000..1e725624a --- /dev/null +++ b/src/OpenCvSharp/Modules/dnn_superres/DnnSuperResImpl.cs @@ -0,0 +1,220 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Dnn; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.DnnSuperres; + +/// +/// A class to upscale images via convolutional neural networks. +/// The following four models are implemented: +/// - edsr +/// - espcn +/// - fsrcnn +/// - lapsrn +/// +public class DnnSuperResImpl : DisposableCvObject +{ + /// + /// + /// Empty constructor + /// + public DnnSuperResImpl() + { + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_new1(out ptr)); + } + + /// + /// + /// Constructor which immediately sets the desired model + /// + /// String containing one of the desired models: + /// - edsr + /// - espcn + /// - fsrcnn + /// - lapsrn + /// Integer specifying the upscale factor + public DnnSuperResImpl(string algo, int scale) + { + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_new2(algo, scale, out ptr)); + } + + /// + /// + /// + protected DnnSuperResImpl(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Read the model from the given path + /// + /// Path to the model file. + /// + public void ReadModel(string path) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_readModel1(ptr, path)); + GC.KeepAlive(this); + } + + /// + /// Read the model from the given path + /// + /// Path to the model weights file. + /// Path to the model definition file. + /// + public void ReadModel(string weights, string definition) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_readModel2(ptr, weights, definition)); + GC.KeepAlive(this); + } + + /// + /// Set desired model + /// + /// String containing one of the desired models: + /// - edsr + /// - espcn + /// - fsrcnn + /// - lapsrn + /// Integer specifying the upscale factor + /// + public void SetModel(string algo, int scale) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_setModel(ptr, algo, scale)); + GC.KeepAlive(this); + } + + /// + /// Ask network to use specific computation backend where it supported. + /// + /// backend identifier. + public void SetPreferableBackend(Backend backendId) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_setPreferableBackend(ptr, (int)backendId)); + GC.KeepAlive(this); + } + + /// + /// Ask network to make computations on specific target device. + /// + /// target identifier. + public void SetPreferableTarget(Target targetId) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_setPreferableTarget(ptr, (int)targetId)); + GC.KeepAlive(this); + } + + /// + /// Upsample via neural network + /// + /// Image to upscale + /// Destination upscaled image + public void Upsample(InputArray img, OutputArray result) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + img.ThrowIfDisposed(); + result.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_upsample(ptr, img.CvPtr, result.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + result.Fix(); + } + + /// + /// Upsample via neural network of multiple outputs + /// + /// Image to upscale + /// Destination upscaled images + /// Scaling factors of the output nodes + /// Names of the output nodes in the neural network + [SuppressMessage("Maintainability", "CA1508: Avoid dead conditional code")] + public void UpsampleMultioutput( + InputArray img, out Mat[] imgsNew, IEnumerable scaleFactors, IEnumerable nodeNames) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (scaleFactors is null) + throw new ArgumentNullException(nameof(scaleFactors)); + if (nodeNames is null) + throw new ArgumentNullException(nameof(nodeNames)); + + using var imgsNewVec = new VectorOfMat(); + var scaleFactorsArray = scaleFactors as int[] ?? scaleFactors.ToArray(); + var nodeNamesArray = nodeNames as string[] ?? nodeNames.ToArray(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_upsampleMultioutput( + ptr, img.CvPtr, imgsNewVec.CvPtr, + scaleFactorsArray, scaleFactorsArray.Length, + nodeNamesArray, nodeNamesArray.Length)); + + GC.KeepAlive(this); + imgsNew = imgsNewVec.ToArray(); + } + + /// + /// Returns the scale factor of the model + /// + /// Current scale factor. + public int GetScale() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_getScale( + ptr, out int ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the scale factor of the model + /// + /// Current algorithm. + public string GetAlgorithm() + { + ThrowIfDisposed(); + + using var result = new StdString(); + NativeMethods.HandleException( + NativeMethods.dnn_superres_DnnSuperResImpl_getAlgorithm( + ptr, result.CvPtr)); + GC.KeepAlive(this); + return result.ToString(); + } +} diff --git a/src/OpenCvSharp/Modules/face/BasicFaceRecognizer.cs b/src/OpenCvSharp/Modules/face/BasicFaceRecognizer.cs deleted file mode 100644 index 3ba67d51c..000000000 --- a/src/OpenCvSharp/Modules/face/BasicFaceRecognizer.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Face -{ - /// - /// base for two FaceRecognizer classes - /// - public class BasicFaceRecognizer : FaceRecognizer - { - /// - /// - /// - private Ptr recognizerPtr; - - #region Init & Disposal - - /// - /// - /// - protected BasicFaceRecognizer() - { - recognizerPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal new static BasicFaceRecognizer FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(BasicFaceRecognizer)}> pointer"); - var ptrObj = new Ptr(ptr); - var detector = new BasicFaceRecognizer - { - recognizerPtr = ptrObj, - ptr = ptrObj.Get() - }; - return detector; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - recognizerPtr?.Dispose(); - recognizerPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - public virtual int GetNumComponents() - { - ThrowIfDisposed(); - return NativeMethods.face_BasicFaceRecognizer_getNumComponents(ptr); - } - - /// - /// - /// - /// - public virtual void SetNumComponents(int val) - { - ThrowIfDisposed(); - NativeMethods.face_BasicFaceRecognizer_setNumComponents(ptr, val); - } - - /// - /// - /// - /// - public new virtual double GetThreshold() - { - ThrowIfDisposed(); - return NativeMethods.face_BasicFaceRecognizer_getThreshold(ptr); - } - - /// - /// - /// - /// - public new virtual void SetThreshold(double val) - { - ThrowIfDisposed(); - NativeMethods.face_BasicFaceRecognizer_setThreshold(ptr, val); - } - - /// - /// - /// - /// - public virtual Mat[] GetProjections() - { - ThrowIfDisposed(); - using (var resultVector = new VectorOfMat()) - { - NativeMethods.face_BasicFaceRecognizer_getProjections(ptr, resultVector.CvPtr); - return resultVector.ToArray(); - } - } - - /// - /// - /// - /// - public virtual Mat GetLabels() - { - ThrowIfDisposed(); - Mat result = new Mat(); - NativeMethods.face_BasicFaceRecognizer_getLabels(ptr, result.CvPtr); - return result; - } - - /// - /// - /// - /// - public virtual Mat GetEigenValues() - { - ThrowIfDisposed(); - Mat result = new Mat(); - NativeMethods.face_BasicFaceRecognizer_getEigenValues(ptr, result.CvPtr); - return result; - } - - /// - /// - /// - /// - public virtual Mat GetEigenVectors() - { - ThrowIfDisposed(); - Mat result = new Mat(); - NativeMethods.face_BasicFaceRecognizer_getEigenVectors(ptr, result.CvPtr); - return result; - } - - /// - /// - /// - /// - public virtual Mat GetMean() - { - ThrowIfDisposed(); - Mat result = new Mat(); - NativeMethods.face_BasicFaceRecognizer_getMean(ptr, result.CvPtr); - return result; - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.face_Ptr_BasicFaceRecognizer_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.face_Ptr_BasicFaceRecognizer_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/face/FaceRecognizer/BasicFaceRecognizer.cs b/src/OpenCvSharp/Modules/face/FaceRecognizer/BasicFaceRecognizer.cs new file mode 100644 index 000000000..e66cdda7d --- /dev/null +++ b/src/OpenCvSharp/Modules/face/FaceRecognizer/BasicFaceRecognizer.cs @@ -0,0 +1,130 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Face; + +/// +/// base for two FaceRecognizer classes +/// +public abstract class BasicFaceRecognizer : FaceRecognizer +{ + /// + /// + /// + /// + public virtual int GetNumComponents() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getNumComponents(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public virtual void SetNumComponents(int val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_setNumComponents(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public new virtual double GetThreshold() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public new virtual void SetThreshold(double val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_setThreshold(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public virtual Mat[] GetProjections() + { + ThrowIfDisposed(); + using var resultVector = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getProjections(ptr, resultVector.CvPtr)); + GC.KeepAlive(this); + return resultVector.ToArray(); + } + + /// + /// + /// + /// + public virtual Mat GetLabels() + { + ThrowIfDisposed(); + var result = new Mat(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getLabels(ptr, result.CvPtr)); + GC.KeepAlive(this); + return result; + } + + /// + /// + /// + /// + public virtual Mat GetEigenValues() + { + ThrowIfDisposed(); + var result = new Mat(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getEigenValues(ptr, result.CvPtr)); + GC.KeepAlive(this); + return result; + } + + /// + /// + /// + /// + public virtual Mat GetEigenVectors() + { + ThrowIfDisposed(); + var result = new Mat(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getEigenVectors(ptr, result.CvPtr)); + GC.KeepAlive(this); + return result; + } + + /// + /// + /// + /// + public virtual Mat GetMean() + { + ThrowIfDisposed(); + var result = new Mat(); + NativeMethods.HandleException( + NativeMethods.face_BasicFaceRecognizer_getMean(ptr, result.CvPtr)); + GC.KeepAlive(this); + return result; + } +} diff --git a/src/OpenCvSharp/Modules/face/FaceRecognizer/EigenFaceRecognizer.cs b/src/OpenCvSharp/Modules/face/FaceRecognizer/EigenFaceRecognizer.cs new file mode 100644 index 000000000..9e6860fc5 --- /dev/null +++ b/src/OpenCvSharp/Modules/face/FaceRecognizer/EigenFaceRecognizer.cs @@ -0,0 +1,86 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Face; + +/// +/// +/// Training and prediction must be done on grayscale images, use cvtColor to convert between the +/// color spaces. +/// - **THE EIGENFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. +/// ** (caps-lock, because I got so many mails asking for this). You have to make sure your +/// input data has the correct shape, else a meaningful exception is thrown.Use resize to resize the images. +/// - This model does not support updating. +/// +// ReSharper disable once InconsistentNaming +public class EigenFaceRecognizer : BasicFaceRecognizer +{ + /// + /// + /// + private Ptr? recognizerPtr; + + /// + /// + /// + protected EigenFaceRecognizer() + { + recognizerPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + recognizerPtr?.Dispose(); + recognizerPtr = null; + base.DisposeManaged(); + } + + /// + /// Training and prediction must be done on grayscale images, use cvtColor to convert between the + /// color spaces. + /// - **THE EIGENFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. + /// ** (caps-lock, because I got so many mails asking for this). You have to make sure your + /// input data has the correct shape, else a meaningful exception is thrown.Use resize to resize the images. + /// - This model does not support updating. + /// + /// The number of components (read: Eigenfaces) kept for this Principal Component Analysis. + /// As a hint: There's no rule how many components (read: Eigenfaces) should be kept for good reconstruction capabilities. + /// It is based on your input data, so experiment with the number. Keeping 80 components should almost always be sufficient. + /// The threshold applied in the prediction. + /// + public static EigenFaceRecognizer Create(int numComponents = 0, double threshold = double.MaxValue) + { + NativeMethods.HandleException( + NativeMethods.face_EigenFaceRecognizer_create(numComponents, threshold, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(EigenFaceRecognizer)}> pointer"); + var ptrObj = new Ptr(p); + var detector = new EigenFaceRecognizer + { + recognizerPtr = ptrObj, + ptr = ptrObj.Get() + }; + return detector; + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_EigenFaceRecognizer_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_EigenFaceRecognizer_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/face/FaceRecognizer/FaceRecognizer.cs b/src/OpenCvSharp/Modules/face/FaceRecognizer/FaceRecognizer.cs new file mode 100644 index 000000000..40057424b --- /dev/null +++ b/src/OpenCvSharp/Modules/face/FaceRecognizer/FaceRecognizer.cs @@ -0,0 +1,237 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Face; + +/// +/// Abstract base class for all face recognition models. +/// All face recognition models in OpenCV are derived from the abstract base class FaceRecognizer, which +/// provides a unified access to all face recongition algorithms in OpenCV. +/// +public abstract class FaceRecognizer : Algorithm +{ + /// + /// Trains a FaceRecognizer with given data and associated labels. + /// + /// + /// + public virtual void Train(IEnumerable src, IEnumerable labels) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + + var srcArray = src.Select(x => x.CvPtr).ToArray(); + var labelsArray = labels.ToArray(); + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_train( + ptr, srcArray, srcArray.Length, labelsArray, labelsArray.Length)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + } + + /// + /// Updates a FaceRecognizer with given data and associated labels. + /// + /// + /// + public void Update(IEnumerable src, IEnumerable labels) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (labels is null) + throw new ArgumentNullException(nameof(labels)); + + var srcArray = src.Select(x => x.CvPtr).ToArray(); + var labelsArray = labels.ToArray(); + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_update( + ptr, srcArray, srcArray.Length, labelsArray, labelsArray.Length)); + GC.KeepAlive(this); + GC.KeepAlive(src); + } + + /// + /// Gets a prediction from a FaceRecognizer. + /// + /// + /// + public virtual int Predict(InputArray src) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_predict1(ptr, src.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(src); + return ret; + } + + /// + /// Predicts the label and confidence for a given sample. + /// + /// + /// + /// + public virtual void Predict(InputArray src, out int label, out double confidence) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + src.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_predict2(ptr, src.CvPtr, out label, out confidence)); + GC.KeepAlive(this); + GC.KeepAlive(src); + } + + /// + /// Serializes this object to a given filename. + /// + /// + public virtual void Write(string fileName) + { + ThrowIfDisposed(); + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_write1(ptr, fileName)); + } + + /// + /// Deserializes this object from a given filename. + /// + /// + public virtual void Read(string fileName) + { + ThrowIfDisposed(); + if (fileName is null) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_read1(ptr, fileName)); + } + + /// + /// + /// Serializes this object to a given cv::FileStorage. + /// + /// + public override void Write(FileStorage fs) + { + ThrowIfDisposed(); + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + fs.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_write2(ptr, fs.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(fs); + } + + /// + /// + /// Deserializes this object from a given cv::FileNode. + /// + /// + public override void Read(FileNode fn) + { + ThrowIfDisposed(); + if (fn is null) + throw new ArgumentNullException(nameof(fn)); + fn.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_read2(ptr, fn.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(fn); + } + + /// + /// Sets string info for the specified model's label. + /// The string info is replaced by the provided value if it was set before for the specified label. + /// + /// + /// + public void SetLabelInfo(int label, string strInfo) + { + ThrowIfDisposed(); + if (strInfo is null) + throw new ArgumentNullException(nameof(strInfo)); + + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_setLabelInfo(ptr, label, strInfo)); + GC.KeepAlive(this); + } + + /// + /// Gets string information by label. + /// If an unknown label id is provided or there is no label information associated with the specified + /// label id the method returns an empty string. + /// + /// + /// + public string GetLabelInfo(int label) + { + ThrowIfDisposed(); + + using var resultString = new StdString(); + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_getLabelInfo(ptr, label, resultString.CvPtr)); + GC.KeepAlive(this); + return resultString.ToString(); + } + + /// + /// Gets vector of labels by string. + /// The function searches for the labels containing the specified sub-string in the associated string info. + /// + /// + /// + public int[] GetLabelsByString(string str) + { + ThrowIfDisposed(); + if (str is null) + throw new ArgumentNullException(nameof(str)); + using var resultVector = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_getLabelsByString(ptr, str, resultVector.CvPtr)); + GC.KeepAlive(this); + return resultVector.ToArray(); + } + + /// + /// threshold parameter accessor - required for default BestMinDist collector + /// + /// + public double GetThreshold() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Sets threshold of model + /// + /// + public void SetThreshold(double val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_FaceRecognizer_setThreshold(ptr, val)); + GC.KeepAlive(this); + } +} diff --git a/src/OpenCvSharp/Modules/face/FaceRecognizer/FisherFaceRecognizer.cs b/src/OpenCvSharp/Modules/face/FaceRecognizer/FisherFaceRecognizer.cs new file mode 100644 index 000000000..c52b9d009 --- /dev/null +++ b/src/OpenCvSharp/Modules/face/FaceRecognizer/FisherFaceRecognizer.cs @@ -0,0 +1,86 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Face; + +/// +/// +/// Training and prediction must be done on grayscale images, use cvtColor to convert between the color spaces. +/// - **THE FISHERFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. +/// ** (caps-lock, because I got so many mails asking for this). You have to make sure your input data +/// has the correct shape, else a meaningful exception is thrown.Use resize to resize the images. +/// - This model does not support updating. +/// +// ReSharper disable once InconsistentNaming +public class FisherFaceRecognizer : BasicFaceRecognizer +{ + /// + /// + /// + private Ptr? recognizerPtr; + + /// + /// + /// + protected FisherFaceRecognizer() + { + recognizerPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + recognizerPtr?.Dispose(); + recognizerPtr = null; + base.DisposeManaged(); + } + + /// + /// Training and prediction must be done on grayscale images, use cvtColor to convert between the color spaces. + /// - **THE FISHERFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. + /// ** (caps-lock, because I got so many mails asking for this). You have to make sure your input data + /// has the correct shape, else a meaningful exception is thrown.Use resize to resize the images. + /// - This model does not support updating. + /// + /// The number of components (read: Fisherfaces) kept for this Linear Discriminant Analysis + /// with the Fisherfaces criterion. It's useful to keep all components, that means the number of your classes c + /// (read: subjects, persons you want to recognize). If you leave this at the default (0) or set it + /// to a value less-equal 0 or greater (c-1), it will be set to the correct number (c-1) automatically. + /// The threshold applied in the prediction. If the distance to the nearest neighbor + /// is larger than the threshold, this method returns -1. + /// + public static FisherFaceRecognizer Create(int numComponents = 0, double threshold = double.MaxValue) + { + NativeMethods.HandleException( + NativeMethods.face_FisherFaceRecognizer_create(numComponents, threshold, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(FisherFaceRecognizer)}> pointer"); + var ptrObj = new Ptr(p); + var detector = new FisherFaceRecognizer + { + recognizerPtr = ptrObj, + ptr = ptrObj.Get() + }; + return detector; + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_FisherFaceRecognizer_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_FisherFaceRecognizer_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/face/FaceRecognizer/LBPHFaceRecognizer.cs b/src/OpenCvSharp/Modules/face/FaceRecognizer/LBPHFaceRecognizer.cs new file mode 100644 index 000000000..35a33b172 --- /dev/null +++ b/src/OpenCvSharp/Modules/face/FaceRecognizer/LBPHFaceRecognizer.cs @@ -0,0 +1,249 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Face; + +/// +/// +/// The Circular Local Binary Patterns (used in training and prediction) expect the data given as +/// grayscale images, use cvtColor to convert between the color spaces. +/// This model supports updating. +/// +// ReSharper disable once InconsistentNaming +public class LBPHFaceRecognizer : FaceRecognizer +{ + /// + /// + /// + private Ptr? recognizerPtr; + + #region Init & Disposal + + /// + /// + /// + protected LBPHFaceRecognizer() + { + recognizerPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + recognizerPtr?.Dispose(); + recognizerPtr = null; + base.DisposeManaged(); + } + + /// + /// The Circular Local Binary Patterns (used in training and prediction) expect the data given as + /// grayscale images, use cvtColor to convert between the color spaces. + /// This model supports updating. + /// + /// The radius used for building the Circular Local Binary Pattern. The greater the radius, the + /// The number of sample points to build a Circular Local Binary Pattern from. + /// An appropriate value is to use `8` sample points.Keep in mind: the more sample points you include, the higher the computational cost. + /// The number of cells in the horizontal direction, 8 is a common value used in publications. + /// The more cells, the finer the grid, the higher the dimensionality of the resulting feature vector. + /// The number of cells in the vertical direction, 8 is a common value used in publications. + /// The more cells, the finer the grid, the higher the dimensionality of the resulting feature vector. + /// The threshold applied in the prediction. If the distance to the nearest neighbor + /// is larger than the threshold, this method returns -1. + /// + // ReSharper disable once InconsistentNaming + public static LBPHFaceRecognizer Create(int radius = 1, int neighbors = 8, + int gridX = 8, int gridY = 8, double threshold = double.MaxValue) + { + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_create(radius, neighbors, gridX, gridY, threshold, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(LBPHFaceRecognizer)}> pointer"); + var ptrObj = new Ptr(p); + var detector = new LBPHFaceRecognizer + { + recognizerPtr = ptrObj, + ptr = ptrObj.Get() + }; + return detector; + } + + #endregion + + #region Methods + + /// + /// + /// + /// + public virtual int GetGridX() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getGridX(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public virtual void SetGridX(int val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_setGridX(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public virtual int GetGridY() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getGridY(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public virtual void SetGridY(int val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_setGridY(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public virtual int GetRadius() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getRadius(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public virtual void SetRadius(int val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_setRadius(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public virtual int GetNeighbors() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getNeighbors(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public virtual void SetNeighbors(int val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_setNeighbors(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public new virtual double GetThreshold() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public new virtual void SetThreshold(double val) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_setThreshold(ptr, val)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public virtual Mat[] GetHistograms() + { + ThrowIfDisposed(); + using var resultVector = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getHistograms(ptr, resultVector.CvPtr)); + GC.KeepAlive(this); + return resultVector.ToArray(); + } + + /// + /// + /// + /// + public virtual Mat GetLabels() + { + ThrowIfDisposed(); + var result = new Mat(); + NativeMethods.HandleException( + NativeMethods.face_LBPHFaceRecognizer_getLabels(ptr, result.CvPtr)); + GC.KeepAlive(this); + return result; + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_LBPHFaceRecognizer_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_LBPHFaceRecognizer_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/face/Facemark/Facemark.cs b/src/OpenCvSharp/Modules/face/Facemark/Facemark.cs new file mode 100644 index 000000000..13fce514f --- /dev/null +++ b/src/OpenCvSharp/Modules/face/Facemark/Facemark.cs @@ -0,0 +1,62 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.Face; + +/// +/// Abstract base class for all facemark models. +/// +/// All facemark models in OpenCV are derived from the abstract base class Facemark, which +/// provides a unified access to all facemark algorithms in OpenCV. +/// To utilize this API in your program, please take a look at the @ref tutorial_table_of_content_facemark +/// +public abstract class Facemark : Algorithm +{ + /// + /// A function to load the trained model before the fitting process. + /// + /// A string represent the filename of a trained model. + public virtual void LoadModel(string model) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.face_Facemark_loadModel(ptr, model)); + GC.KeepAlive(this); + } + + /// + /// Trains a Facemark algorithm using the given dataset. + /// + /// Input image. + /// Output of the function which represent region of interest of the detected faces. Each face is stored in cv::Rect container. + /// The detected landmark points for each faces. + /// + public virtual bool Fit( + InputArray image, + InputArray faces, + out Point2f[][] landmarks) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (faces is null) + throw new ArgumentNullException(nameof(faces)); + image.ThrowIfDisposed(); + faces.ThrowIfDisposed(); + + int ret; + using (var landmarx = new VectorOfVectorPoint2f()) + { + NativeMethods.HandleException( + NativeMethods.face_Facemark_fit(ptr, image.CvPtr, faces.CvPtr, landmarx.CvPtr, out ret)); + landmarks = landmarx.ToArray(); + } + + GC.KeepAlive(this); + GC.KeepAlive(image); + + return ret != 0; + } +} diff --git a/src/OpenCvSharp/Modules/face/Facemark/FacemarkAAM.cs b/src/OpenCvSharp/Modules/face/Facemark/FacemarkAAM.cs new file mode 100644 index 000000000..b6595d701 --- /dev/null +++ b/src/OpenCvSharp/Modules/face/Facemark/FacemarkAAM.cs @@ -0,0 +1,270 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Face; + +/// +/// +/// +/// +// ReSharper disable once InconsistentNaming +public sealed class FacemarkAAM : Facemark +{ + private Ptr? ptrObj; + + /// + /// + /// + private FacemarkAAM() + { + ptrObj = null; + ptr = IntPtr.Zero; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + /// + /// + public static FacemarkAAM Create(Params? parameters = null) + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_create(parameters?.CvPtr ?? IntPtr.Zero, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(FacemarkAAM)}> pointer"); + var ptrObj = new Ptr(p); + var detector = new FacemarkAAM + { + ptrObj = ptrObj, + ptr = ptrObj.Get() + }; + return detector; + } + +#pragma warning disable CA1034 + /// + /// + /// + public sealed class Params : DisposableCvObject + { + /// + /// Constructor + /// + public Params() + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_new(out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid {GetType().Name} pointer"); + } + + /// + /// Releases managed resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero) + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// filename of the model + /// + public string ModelFilename + { + get + { + using var s = new StdString(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_model_filename_get(ptr, s.CvPtr)); + GC.KeepAlive(this); + return s.ToString(); + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_model_filename_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int M + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_m_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_m_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int N + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_n_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_n_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NIter + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_n_iter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_n_iter_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// show the training print-out + /// + public bool Verbose + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_verbose_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_verbose_set(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + /// + /// flag to save the trained model or not + /// + public bool SaveModel + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_save_model_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_save_model_set(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public IReadOnlyList Scales + { + get + { + using var vec = new VectorOfFloat(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_scales_get(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + set + { + using var vec = new VectorOfFloat(value); + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_scales_set(ptr, vec.CvPtr)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + /// + public void Read(FileNode fn) + { + if (fn is null) + throw new ArgumentNullException(nameof(fn)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_write(ptr, fn.CvPtr)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void Write(FileStorage fs) + { + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkAAM_Params_write(ptr, fs.CvPtr)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_FacemarkAAM_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_FacemarkAAM_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/face/Facemark/FacemarkLBF.cs b/src/OpenCvSharp/Modules/face/Facemark/FacemarkLBF.cs new file mode 100644 index 000000000..88225a467 --- /dev/null +++ b/src/OpenCvSharp/Modules/face/Facemark/FacemarkLBF.cs @@ -0,0 +1,481 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Face; + +/// +/// +/// +/// +// ReSharper disable once InconsistentNaming +public sealed class FacemarkLBF : Facemark +{ + private Ptr? ptrObj; + + /// + /// + /// + private FacemarkLBF() + { + ptrObj = null; + ptr = IntPtr.Zero; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + /// + /// + public static FacemarkLBF Create(Params? parameters = null) + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_create(parameters?.CvPtr ?? IntPtr.Zero, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(FacemarkLBF)}> pointer"); + var ptrObj = new Ptr(p); + var detector = new FacemarkLBF + { + ptrObj = ptrObj, + ptr = ptrObj.Get() + }; + return detector; + } + +#pragma warning disable CA1034 + /// + /// + /// + public sealed class Params : DisposableCvObject + { + /// + /// Constructor + /// + public Params() + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_new(out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException($"Invalid {GetType().Name} pointer"); + } + + /// + /// Releases managed resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero) + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// offset for the loaded face landmark points + /// + public double ShapeOffset + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_shape_offset_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_shape_offset_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// filename of the face detector model + /// + public string CascadeFace + { + get + { + using var s = new StdString(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_cascade_face_get(ptr, s.CvPtr)); + GC.KeepAlive(this); + return s.ToString(); + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_cascade_face_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// show the training print-out + /// + public bool Verbose + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_verbose_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_verbose_set(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// number of landmark points + /// + public int NLandmarks + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_n_landmarks_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_n_landmarks_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// multiplier for augment the training data + /// + public int InitShapeN + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_initShape_n_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_initShape_n_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// number of refinement stages + /// + public int StagesN + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_stages_n_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_stages_n_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// number of tree in the model for each landmark point refinement + /// + public int TreeN + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_tree_n_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_tree_n_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// the depth of decision tree, defines the size of feature + /// + public int TreeDepth + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_tree_depth_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_tree_depth_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// overlap ratio for training the LBF feature + /// + public double BaggingOverlap + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_bagging_overlap_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_bagging_overlap_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// filename where the trained model will be saved + /// + public string ModelFilename + { + get + { + using var s = new StdString(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_model_filename_get(ptr, s.CvPtr)); + GC.KeepAlive(this); + return s.ToString(); + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_model_filename_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// flag to save the trained model or not + /// + public bool SaveModel + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_save_model_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_save_model_set(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// seed for shuffling the training data + /// + public uint Seed + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_seed_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_seed_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public IReadOnlyList FeatsM + { + get + { + using var vec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_feats_m_get(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + set + { + using var vec = new VectorOfInt32(value); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_feats_m_set(ptr, vec.CvPtr)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public IReadOnlyList RadiusM + { + get + { + using var vec = new VectorOfDouble(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_radius_m_get(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + set + { + using var vec = new VectorOfDouble(value); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_radius_m_set(ptr, vec.CvPtr)); + GC.KeepAlive(this); + } + } + + /// + /// index of facemark points on pupils of left and right eye + /// + public IReadOnlyList Pupils0 + { + get + { + using var vec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_pupils0_get(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + set + { + using var vec = new VectorOfInt32(value); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_pupils0_set(ptr, vec.CvPtr)); + GC.KeepAlive(this); + } + } + + /// + /// index of facemark points on pupils of left and right eye + /// + public IReadOnlyList Pupils1 + { + get + { + using var vec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_pupils1_get(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + set + { + using var vec = new VectorOfInt32(value); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_pupils1_set(ptr, vec.CvPtr)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + // ReSharper disable once InconsistentNaming + public Rect DetectROI + { + get + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_detectROI_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_detectROI_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + /// + public void Read(FileNode fn) + { + if (fn is null) + throw new ArgumentNullException(nameof(fn)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_write(ptr, fn.CvPtr)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void Write(FileStorage fs) + { + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + NativeMethods.HandleException( + NativeMethods.face_FacemarkLBF_Params_write(ptr, fs.CvPtr)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_FacemarkLBF_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.face_Ptr_FacemarkLBF_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/face/LBPHFaceRecognizer.cs b/src/OpenCvSharp/Modules/face/LBPHFaceRecognizer.cs deleted file mode 100644 index 464caa2b2..000000000 --- a/src/OpenCvSharp/Modules/face/LBPHFaceRecognizer.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Face -{ - /// - /// - /// - public class LBPHFaceRecognizer : FaceRecognizer - { - /// - /// - /// - private Ptr recognizerPtr; - - #region Init & Disposal - - /// - /// - /// - protected LBPHFaceRecognizer() - { - recognizerPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal new static LBPHFaceRecognizer FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(LBPHFaceRecognizer)}> pointer"); - var ptrObj = new Ptr(ptr); - var detector = new LBPHFaceRecognizer - { - recognizerPtr = ptrObj, - ptr = ptrObj.Get() - }; - return detector; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - recognizerPtr?.Dispose(); - recognizerPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - public virtual int GetGridX() - { - ThrowIfDisposed(); - return NativeMethods.face_LBPHFaceRecognizer_getGridX(ptr); - } - - /// - /// - /// - /// - public virtual void SetGridX(int val) - { - ThrowIfDisposed(); - NativeMethods.face_LBPHFaceRecognizer_setGridX(ptr, val); - } - - /// - /// - /// - /// - public virtual int GetGridY() - { - ThrowIfDisposed(); - return NativeMethods.face_LBPHFaceRecognizer_getGridY(ptr); - } - - /// - /// - /// - /// - public virtual void SetGridY(int val) - { - ThrowIfDisposed(); - NativeMethods.face_LBPHFaceRecognizer_setGridY(ptr, val); - } - - /// - /// - /// - /// - public virtual int GetRadius() - { - ThrowIfDisposed(); - return NativeMethods.face_LBPHFaceRecognizer_getRadius(ptr); - } - - /// - /// - /// - /// - public virtual void SetRadius(int val) - { - ThrowIfDisposed(); - NativeMethods.face_LBPHFaceRecognizer_setRadius(ptr, val); - } - - /// - /// - /// - /// - public virtual int GetNeighbors() - { - ThrowIfDisposed(); - return NativeMethods.face_LBPHFaceRecognizer_getNeighbors(ptr); - } - - /// - /// - /// - /// - public virtual void SetNeighbors(int val) - { - ThrowIfDisposed(); - NativeMethods.face_LBPHFaceRecognizer_setNeighbors(ptr, val); - } - - /// - /// - /// - /// - public new virtual double GetThreshold() - { - ThrowIfDisposed(); - return NativeMethods.face_LBPHFaceRecognizer_getThreshold(ptr); - } - - /// - /// - /// - /// - public new virtual void SetThreshold(double val) - { - ThrowIfDisposed(); - NativeMethods.face_LBPHFaceRecognizer_setThreshold(ptr, val); - } - - /// - /// - /// - /// - public virtual Mat[] GetHistograms() - { - ThrowIfDisposed(); - using (var resultVector = new VectorOfMat()) - { - NativeMethods.face_LBPHFaceRecognizer_getHistograms(ptr, resultVector.CvPtr); - return resultVector.ToArray(); - } - } - - /// - /// - /// - /// - public virtual Mat GetLabels() - { - ThrowIfDisposed(); - Mat result = new Mat(); - NativeMethods.face_LBPHFaceRecognizer_getLabels(ptr, result.CvPtr); - return result; - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.face_Ptr_LBPHFaceRecognizer_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.face_Ptr_LBPHFaceRecognizer_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/features2d/AKAZE.cs b/src/OpenCvSharp/Modules/features2d/AKAZE.cs new file mode 100644 index 000000000..600fd9fdf --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/AKAZE.cs @@ -0,0 +1,243 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Class implementing the AKAZE keypoint detector and descriptor extractor, +/// described in @cite ANB13 +/// +/// +/// AKAZE descriptors can only be used with KAZE or AKAZE keypoints. +/// Try to avoid using *extract* and *detect* instead of *operator()* due to performance reasons. +/// .. [ANB13] Fast Explicit Diffusion for Accelerated Features in Nonlinear Scale +/// Spaces. Pablo F. Alcantarilla, Jesús Nuevo and Adrien Bartoli. +/// In British Machine Vision Conference (BMVC), Bristol, UK, September 2013. +/// +// ReSharper disable once InconsistentNaming +public class AKAZE : Feature2D +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + protected AKAZE(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// The AKAZE constructor + /// + /// Type of the extracted descriptor: DESCRIPTOR_KAZE, + /// DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT. + /// Size of the descriptor in bits. 0 -> Full size + /// Number of channels in the descriptor (1, 2, 3) + /// Detector response threshold to accept point + /// Maximum octave evolution of the image + /// Default number of sublevels per scale level + /// Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or DIFF_CHARBONNIER + public static AKAZE Create( + AKAZEDescriptorType descriptorType = AKAZEDescriptorType.MLDB, + int descriptorSize = 0, + int descriptorChannels = 3, + float threshold = 0.001f, + int nOctaves = 4, + int nOctaveLayers = 4, + KAZEDiffusivityType diffusivity = KAZEDiffusivityType.DiffPmG2) + { + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_create( + (int) descriptorType, descriptorSize, descriptorChannels, + threshold, nOctaves, nOctaveLayers, (int) diffusivity, out var ptr)); + return new AKAZE(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public AKAZEDescriptorType AKAZEDescriptorType // avoid name conflict + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getDescriptorType(ptr, out var ret)); + GC.KeepAlive(this); + return (AKAZEDescriptorType)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setDescriptorType(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + // ReSharper disable once InconsistentNaming + public int AKAZEDescriptorSize // avoid name conflict + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getDescriptorSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setDescriptorSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + // ReSharper disable once InconsistentNaming + public int AKAZEDescriptorChannels // avoid name conflict + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getDescriptorChannels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setDescriptorChannels(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double Threshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NOctaves + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getNOctaves(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setNOctaves(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NOctaveLayers + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getNOctaveLayers(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setNOctaveLayers(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public KAZEDiffusivityType DiffusivityType + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_getDiffusivity(ptr, out var ret)); + GC.KeepAlive(this); + return (KAZEDiffusivityType)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AKAZE_setDiffusivity(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_AKAZE_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_AKAZE_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/AgastFeatureDetector.cs b/src/OpenCvSharp/Modules/features2d/AgastFeatureDetector.cs new file mode 100644 index 000000000..881453190 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/AgastFeatureDetector.cs @@ -0,0 +1,148 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// Detects corners using the AGAST algorithm +/// +public class AgastFeatureDetector : Feature2D +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + protected AgastFeatureDetector(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// The AgastFeatureDetector constructor + /// + /// threshold on difference between intensity of the central pixel + /// and pixels of a circle around this pixel. + /// if true, non-maximum suppression is applied to detected corners (keypoints). + /// + public static AgastFeatureDetector Create( + int threshold = 10, + bool nonmaxSuppression = true, + DetectorType type = DetectorType.OAST_9_16) + { + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_create( + threshold, nonmaxSuppression ? 1 : 0, (int) type, out var ptr)); + return new AgastFeatureDetector(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// threshold on difference between intensity of the central pixel and pixels of a circle around this pixel. + /// + public int Threshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_setThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// if true, non-maximum suppression is applied to detected corners (keypoints). + /// + public int NonmaxSuppression + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_getNonmaxSuppression(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_setNonmaxSuppression(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// type one of the four neighborhoods as defined in the paper + /// + public DetectorType Type + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_getType(ptr, out var ret)); + GC.KeepAlive(this); + return (DetectorType)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_AgastFeatureDetector_setType(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_AgastFeatureDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_AgastFeatureDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + } + +#pragma warning disable 1591 + + /// + /// AGAST type one of the four neighborhoods as defined in the paper + /// + public enum DetectorType + { + AGAST_5_8 = 0, + AGAST_7_12d = 1, + AGAST_7_12s = 2, + OAST_9_16 = 3, + } +} diff --git a/src/OpenCvSharp/Modules/features2d/BFMatcher.cs b/src/OpenCvSharp/Modules/features2d/BFMatcher.cs new file mode 100644 index 000000000..7c23f4c8f --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/BFMatcher.cs @@ -0,0 +1,113 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Brute-force descriptor matcher. +/// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. +/// +public class BFMatcher : DescriptorMatcher +{ + private Ptr? detectorPtr; + + /// + /// + /// + /// + /// + public BFMatcher(NormTypes normType = NormTypes.L2, bool crossCheck = false) + { + NativeMethods.HandleException( + NativeMethods.features2d_BFMatcher_new((int) normType, crossCheck ? 1 : 0, out ptr)); + detectorPtr = null; + } + + /// + /// Creates instance by cv::Ptr<T> + /// + internal BFMatcher(Ptr detectorPtr) + { + this.detectorPtr = detectorPtr; + ptr = detectorPtr.Get(); + } + + /// + /// Creates instance by raw pointer T* + /// + internal BFMatcher(IntPtr rawPtr) + { + detectorPtr = null; + ptr = rawPtr; + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal new static BFMatcher FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid cv::Ptr pointer"); + var ptrObj = new Ptr(ptr); + return new BFMatcher(ptrObj); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + if (detectorPtr is not null) + { + detectorPtr.Dispose(); + detectorPtr = null; + ptr = IntPtr.Zero; + } + base.DisposeManaged(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeUnmanaged() + { + if (detectorPtr is null && ptr != IntPtr.Zero) + NativeMethods.HandleException( + NativeMethods.features2d_BFMatcher_delete(ptr)); + ptr = IntPtr.Zero; + base.DisposeUnmanaged(); + } + + /// + /// Return true if the matcher supports mask in match methods. + /// + /// + public override bool IsMaskSupported() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_BFMatcher_isMaskSupported(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_BFMatcher_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_BFMatcher_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/BOWImgDescriptorExtractor.cs b/src/OpenCvSharp/Modules/features2d/BOWImgDescriptorExtractor.cs new file mode 100644 index 000000000..e416ea52a --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/BOWImgDescriptorExtractor.cs @@ -0,0 +1,196 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Brute-force descriptor matcher. +/// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. +/// +public class BOWImgDescriptorExtractor : DisposableCvObject +{ + /// + /// The constructor. + /// + /// Descriptor extractor that is used to compute descriptors for an input image and its keypoints. + /// Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image. + public BOWImgDescriptorExtractor(Feature2D dextractor, DescriptorMatcher dmatcher) + { + if (dextractor is null) + throw new ArgumentNullException(nameof(dextractor)); + if (dmatcher is null) + throw new ArgumentNullException(nameof(dmatcher)); + + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_new1_RawPtr(dextractor.CvPtr, dmatcher.CvPtr, out ptr)); + + GC.KeepAlive(dextractor); + GC.KeepAlive(dmatcher); + } + + /// + /// The constructor. + /// + /// Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image. + public BOWImgDescriptorExtractor(DescriptorMatcher dmatcher) + { + if (dmatcher is null) + throw new ArgumentNullException(nameof(dmatcher)); + + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_new2_RawPtr(dmatcher.CvPtr, out ptr)); + GC.KeepAlive(dmatcher); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Sets a visual vocabulary. + /// + /// Vocabulary (can be trained using the inheritor of BOWTrainer ). + /// Each row of the vocabulary is a visual word(cluster center). + public void SetVocabulary(Mat vocabulary) + { + ThrowIfDisposed(); + if (vocabulary is null) + throw new ArgumentNullException(nameof(vocabulary)); + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_setVocabulary(ptr, vocabulary.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(vocabulary); + } + + /// + /// Returns the set vocabulary. + /// + /// + public Mat GetVocabulary() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_getVocabulary(ptr, out var p)); + GC.KeepAlive(this); + return new Mat(p); + } + + /// + /// Computes an image descriptor using the set visual vocabulary. + /// + /// Image, for which the descriptor is computed. + /// Keypoints detected in the input image. + /// Computed output image descriptor. + /// pointIdxsOfClusters Indices of keypoints that belong to the cluster. + /// This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster(word of vocabulary) returned if it is non-zero. + /// Descriptors of the image keypoints that are returned if they are non-zero. + public void Compute(InputArray image, ref KeyPoint[] keypoints, OutputArray imgDescriptor, + out int[][] pointIdxsOfClusters, Mat? descriptors = null) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (imgDescriptor is null) + throw new ArgumentNullException(nameof(imgDescriptor)); + + using (var keypointsVec = new VectorOfKeyPoint(keypoints)) + using (var pointIdxsOfClustersVec = new VectorOfVectorInt32()) + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_compute11(ptr, image.CvPtr, keypointsVec.CvPtr, + imgDescriptor.CvPtr, pointIdxsOfClustersVec.CvPtr, Cv2.ToPtr(descriptors))); + keypoints = keypointsVec.ToArray(); + pointIdxsOfClusters = pointIdxsOfClustersVec.ToArray(); + } + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(imgDescriptor); + GC.KeepAlive(descriptors); + } + + /// + /// Computes an image descriptor using the set visual vocabulary. + /// + /// Computed descriptors to match with vocabulary. + /// Computed output image descriptor. + /// Indices of keypoints that belong to the cluster. + /// This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster(word of vocabulary) returned if it is non-zero. + public void Compute(InputArray keypointDescriptors, OutputArray imgDescriptor, out int[][] pointIdxsOfClusters) + { + ThrowIfDisposed(); + if (keypointDescriptors is null) + throw new ArgumentNullException(nameof(keypointDescriptors)); + if (imgDescriptor is null) + throw new ArgumentNullException(nameof(imgDescriptor)); + + using (var pointIdxsOfClustersVec = new VectorOfVectorInt32()) + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_compute12( + ptr, keypointDescriptors.CvPtr, imgDescriptor.CvPtr, pointIdxsOfClustersVec.CvPtr)); + pointIdxsOfClusters = pointIdxsOfClustersVec.ToArray(); + } + GC.KeepAlive(this); + GC.KeepAlive(keypointDescriptors); + GC.KeepAlive(imgDescriptor); + } + + /// + /// Computes an image descriptor using the set visual vocabulary. + /// + /// Image, for which the descriptor is computed. + /// Keypoints detected in the input image. + /// Computed output image descriptor. + public void Compute2(Mat image, ref KeyPoint[] keypoints, Mat imgDescriptor) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (imgDescriptor is null) + throw new ArgumentNullException(nameof(imgDescriptor)); + + using (var keypointsVec = new VectorOfKeyPoint(keypoints)) + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_compute2( + ptr, image.CvPtr, keypointsVec.CvPtr, imgDescriptor.CvPtr)); + keypoints = keypointsVec.ToArray(); + } + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(imgDescriptor); + } + + /// + /// Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0. + /// + /// + public int DescriptorSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_descriptorSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns an image descriptor type. + /// + /// + public int DescriptorType() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_BOWImgDescriptorExtractor_descriptorType(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } +} diff --git a/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs b/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs new file mode 100644 index 000000000..4d6c16faa --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs @@ -0,0 +1,70 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Brute-force descriptor matcher. +/// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. +/// +public class BOWKMeansTrainer : BOWTrainer +{ + /// + /// The constructor. + /// + /// + /// + /// + /// + public BOWKMeansTrainer(int clusterCount, TermCriteria? termcrit = null, + int attempts = 3, KMeansFlags flags = KMeansFlags.PpCenters) + { + var termCritValue = termcrit.GetValueOrDefault(new TermCriteria()); + NativeMethods.HandleException( + NativeMethods.features2d_BOWKMeansTrainer_new(clusterCount, termCritValue, attempts, (int)flags, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWKMeansTrainer_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Clusters train descriptors. + /// + /// + public override Mat Cluster() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_BOWKMeansTrainer_cluster1(ptr, out var p)); + GC.KeepAlive(this); + return new Mat(p); + } + + /// + /// Clusters train descriptors. + /// + /// Descriptors to cluster. Each row of the descriptors matrix is a descriptor. Descriptors are not added to the inner train descriptor set. + /// The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object + /// are clustered.In the second variant, input descriptors are clustered. + /// + public override Mat Cluster(Mat descriptors) + { + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + ThrowIfDisposed(); + descriptors.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.features2d_BOWKMeansTrainer_cluster2(ptr, descriptors.CvPtr, out var p)); + GC.KeepAlive(this); + GC.KeepAlive(descriptors); + return new Mat(p); + } +} diff --git a/src/OpenCvSharp/Modules/features2d/BOWTrainer.cs b/src/OpenCvSharp/Modules/features2d/BOWTrainer.cs new file mode 100644 index 000000000..9f085070d --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/BOWTrainer.cs @@ -0,0 +1,77 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Brute-force descriptor matcher. +/// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. +/// +public abstract class BOWTrainer : DisposableCvObject +{ + /// + /// Adds descriptors to a training set. + /// + /// descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a descriptor. + /// The training set is clustered using clustermethod to construct the vocabulary. + public void Add(Mat descriptors) + { + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + NativeMethods.HandleException( + NativeMethods.features2d_BOWTrainer_add(ptr, descriptors.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(descriptors); + } + + /// + /// Returns a training set of descriptors. + /// + /// + public Mat[] GetDescriptors() + { + using var descriptors = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.features2d_BOWTrainer_getDescriptors(ptr, descriptors.CvPtr)); + GC.KeepAlive(this); + return descriptors.ToArray(); + } + + /// + /// Returns the count of all descriptors stored in the training set. + /// + /// + public int DescriptorsCount() + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWTrainer_descriptorsCount(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + public virtual void Clear() + { + NativeMethods.HandleException( + NativeMethods.features2d_BOWTrainer_clear(ptr)); + GC.KeepAlive(this); + } + + /// + /// Clusters train descriptors. + /// + /// + public abstract Mat Cluster(); + + /// + /// Clusters train descriptors. + /// + /// Descriptors to cluster. Each row of the descriptors matrix is a descriptor. Descriptors are not added to the inner train descriptor set. + /// The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object + /// are clustered.In the second variant, input descriptors are clustered. + /// + public abstract Mat Cluster(Mat descriptors); +} diff --git a/src/OpenCvSharp/Modules/features2d/BRISK.cs b/src/OpenCvSharp/Modules/features2d/BRISK.cs new file mode 100644 index 000000000..93cf5bb6d --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/BRISK.cs @@ -0,0 +1,147 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// BRISK implementation +/// +// ReSharper disable once InconsistentNaming +public class BRISK : Feature2D +{ + private Ptr? ptrObj; + + /// + /// + protected BRISK() + { + } + + /// + /// Construct from native cv::Ptr<T>* + /// + /// + protected BRISK(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// The BRISK constructor + /// + /// AGAST detection threshold score. + /// detection octaves. Use 0 to do single scale. + /// apply this scale to the pattern used for sampling the neighbourhood of a keypoint. + public static BRISK Create(int thresh = 30, int octaves = 3, float patternScale = 1.0f) + { + NativeMethods.HandleException( + NativeMethods.features2d_BRISK_create1(thresh, octaves, patternScale, out var ptr)); + return new BRISK(ptr); + } + + /// + /// The BRISK constructor for a custom pattern + /// + /// defines the radii (in pixels) where the samples around a keypoint are taken (for keypoint scale 1). + /// defines the number of sampling points on the sampling circle. Must be the same size as radiusList.. + /// threshold for the short pairings used for descriptor formation (in pixels for keypoint scale 1). + /// threshold for the long pairings used for orientation determination (in pixels for keypoint scale 1). + /// index remapping of the bits. + /// + public static BRISK Create( + IEnumerable radiusList, + IEnumerable numberList, + float dMax = 5.85f, + float dMin = 8.2f, + IEnumerable? indexChange = null) + { + if (radiusList is null) + throw new ArgumentNullException(nameof(radiusList)); + if (numberList is null) + throw new ArgumentNullException(nameof(numberList)); + + var radiusListArray = radiusList.ToArray(); + var numberListArray = numberList.ToArray(); + var indexChangeArray = indexChange?.ToArray(); + + NativeMethods.HandleException( + NativeMethods.features2d_BRISK_create2( + radiusListArray, radiusListArray.Length, + numberListArray, numberListArray.Length, + dMax, dMin, + indexChangeArray, indexChangeArray?.Length ?? 0, + out var ptr)); + + return new BRISK(ptr); + } + + /// + /// The BRISK constructor for a custom pattern, detection threshold and octaves + /// + /// AGAST detection threshold score. + /// detection octaves. Use 0 to do single scale. + /// defines the radii (in pixels) where the samples around a keypoint are taken (for keypoint scale 1). + /// defines the number of sampling points on the sampling circle. Must be the same size as radiusList.. + /// threshold for the short pairings used for descriptor formation (in pixels for keypoint scale 1). + /// threshold for the long pairings used for orientation determination (in pixels for keypoint scale 1). + /// index remapping of the bits. + /// + public static BRISK Create( + int thresh, + int octaves, + IEnumerable radiusList, + IEnumerable numberList, + float dMax = 5.85f, + float dMin = 8.2f, + IEnumerable? indexChange = null) + { + if (radiusList is null) + throw new ArgumentNullException(nameof(radiusList)); + if (numberList is null) + throw new ArgumentNullException(nameof(numberList)); + + var radiusListArray = radiusList.ToArray(); + var numberListArray = numberList.ToArray(); + var indexChangeArray = indexChange?.ToArray(); + + NativeMethods.HandleException( + NativeMethods.features2d_BRISK_create3( + thresh, octaves, + radiusListArray, radiusListArray.Length, + numberListArray, numberListArray.Length, + dMax, dMin, + indexChangeArray, indexChangeArray?.Length ?? 0, + out var ptr)); + + return new BRISK(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_BRISK_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_BRISK_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/modules/features2d/DenseFeatureDetector.cs b/src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs similarity index 87% rename from src/OpenCvSharp/modules/features2d/DenseFeatureDetector.cs rename to src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs index 5a43434a8..1f80074af 100644 --- a/src/OpenCvSharp/modules/features2d/DenseFeatureDetector.cs +++ b/src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs @@ -1,8 +1,6 @@ -using System; - +#if false namespace OpenCvSharp { -#if false /// /// Class for generation of image features which are /// distributed densely and regularly over the image. @@ -67,15 +65,6 @@ internal DenseFeatureDetector(IntPtr rawPtr) return new DenseFeatureDetector(ptrObj); } -#if LANG_JP - /// - /// リソースの解放 - /// - /// - /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。 - /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。 - /// -#else /// /// Releases the resources /// @@ -83,7 +72,6 @@ internal DenseFeatureDetector(IntPtr rawPtr) /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. /// -#endif protected override void Dispose(bool disposing) { if (!disposed) @@ -95,7 +83,7 @@ protected override void Dispose(bool disposing) { } // releases unmanaged resources - if (detectorPtr != null) + if (detectorPtr is not null) { detectorPtr.Dispose(); detectorPtr = null; @@ -114,6 +102,7 @@ protected override void Dispose(bool disposing) } } } + #endregion /// @@ -128,5 +117,5 @@ public override IntPtr InfoPtr } } } -#endif } +#endif diff --git a/src/OpenCvSharp/Modules/features2d/DescriptorMatcher.cs b/src/OpenCvSharp/Modules/features2d/DescriptorMatcher.cs new file mode 100644 index 000000000..c51a6622f --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/DescriptorMatcher.cs @@ -0,0 +1,404 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// +/// +public class DescriptorMatcher : Algorithm +{ + /// + /// + /// + private Ptr? detectorPtr; + + /// + /// + /// + protected DescriptorMatcher() + { + detectorPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Create descriptor matcher by type name. + /// + /// + /// + public static DescriptorMatcher Create(string descriptorMatcherType) + { + if (string.IsNullOrEmpty(descriptorMatcherType)) + throw new ArgumentNullException(nameof(descriptorMatcherType)); + + switch (descriptorMatcherType) + { + case "FlannBased": + return new FlannBasedMatcher(); + + case "BruteForce": // L2 + // ReSharper disable once RedundantArgumentDefaultValue + return new BFMatcher(NormTypes.L2); + + case "BruteForce-SL2": // Squared L2 + return new BFMatcher(NormTypes.L2SQR); + + case "BruteForce-L1": + return new BFMatcher(NormTypes.L1); + + case "BruteForce-Hamming": + case "BruteForce-HammingLUT": + return new BFMatcher(NormTypes.Hamming); + + case "BruteForce-Hamming(2)": + return new BFMatcher(NormTypes.Hamming2); + + default: + throw new OpenCvSharpException($"Unknown matcher name '{descriptorMatcherType}'"); + } + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal static DescriptorMatcher FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid cv::Ptr pointer"); + var ptrObj = new Ptr(ptr); + var detector = new DescriptorMatcher + { + detectorPtr = ptrObj, + ptr = ptrObj.Get() + }; + return detector; + } + + /// + /// Creates instance from raw pointer T* + /// + /// + internal static DescriptorMatcher FromRawPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid DescriptorMatcher pointer"); + var detector = new DescriptorMatcher + { + detectorPtr = null, + ptr = ptr + }; + return detector; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + #region Methods + + /// + /// Add descriptors to train descriptor collection. + /// + /// Descriptors to add. Each descriptors[i] is a descriptors set from one image. + public virtual void Add(IEnumerable descriptors) + { + ThrowIfDisposed(); + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + + var descriptorsArray = descriptors.ToArray(); + if (descriptorsArray.Length == 0) + return; + + var descriptorsPtrs = descriptorsArray.Select(x => x.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_add(ptr, descriptorsPtrs, descriptorsPtrs.Length)); + GC.KeepAlive(this); + GC.KeepAlive(descriptorsArray); + } + + /// + /// Get train descriptors collection. + /// + /// + public Mat[] GetTrainDescriptors() + { + ThrowIfDisposed(); + using var matVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_getTrainDescriptors(ptr, matVec.CvPtr)); + GC.KeepAlive(this); + return matVec.ToArray(); + } + + /// + /// Clear train descriptors collection. + /// + public virtual void Clear() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_clear(ptr)); + GC.KeepAlive(this); + } + + /// + /// Return true if there are not train descriptors in collection. + /// + /// + public new virtual bool Empty() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Return true if the matcher supports mask in match methods. + /// + /// + public virtual bool IsMaskSupported() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_isMaskSupported(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Train matcher (e.g. train flann index). + /// In all methods to match the method train() is run every time before matching. + /// Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation + /// of this method, other matchers really train their inner structures + /// (e.g. FlannBasedMatcher trains flann::Index). So nonempty implementation + /// of train() should check the class object state and do traing/retraining + /// only if the state requires that (e.g. FlannBasedMatcher trains flann::Index + /// if it has not trained yet or if new descriptors have been added to the train collection). + /// + public virtual void Train() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_train(ptr)); + GC.KeepAlive(this); + } + + #region *Match + + /// + /// Find one best match for each query descriptor (if mask is empty). + /// + /// + /// + /// + /// + public DMatch[] Match(Mat queryDescriptors, Mat trainDescriptors, Mat? mask = null) + { + ThrowIfDisposed(); + if (queryDescriptors is null) + throw new ArgumentNullException(nameof(queryDescriptors)); + if (trainDescriptors is null) + throw new ArgumentNullException(nameof(trainDescriptors)); + using var matchesVec = new VectorOfDMatch(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_match1( + ptr, queryDescriptors.CvPtr, trainDescriptors.CvPtr, + matchesVec.CvPtr, Cv2.ToPtr(mask))); + GC.KeepAlive(this); + GC.KeepAlive(queryDescriptors); + GC.KeepAlive(trainDescriptors); + GC.KeepAlive(mask); + return matchesVec.ToArray(); + } + + /// + /// Find k best matches for each query descriptor (in increasing order of distances). + /// compactResult is used when mask is not empty. If compactResult is false matches + /// vector will have the same size as queryDescriptors rows. If compactResult is true + /// matches vector will not contain matches for fully masked out query descriptors. + /// + /// + /// + /// + /// + /// + /// + public DMatch[][] KnnMatch(Mat queryDescriptors, Mat trainDescriptors, + int k, Mat? mask = null, bool compactResult = false) + { + ThrowIfDisposed(); + if (queryDescriptors is null) + throw new ArgumentNullException(nameof(queryDescriptors)); + if (trainDescriptors is null) + throw new ArgumentNullException(nameof(trainDescriptors)); + using var matchesVec = new VectorOfVectorDMatch(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_knnMatch1( + ptr, queryDescriptors.CvPtr, trainDescriptors.CvPtr, + matchesVec.CvPtr, k, Cv2.ToPtr(mask), compactResult ? 1 : 0)); + GC.KeepAlive(this); + GC.KeepAlive(queryDescriptors); + GC.KeepAlive(trainDescriptors); + GC.KeepAlive(mask); + return matchesVec.ToArray(); + } + + /// + /// Find best matches for each query descriptor which have distance less than + /// maxDistance (in increasing order of distances). + /// + /// + /// + /// + /// + /// + /// + public DMatch[][] RadiusMatch(Mat queryDescriptors, Mat trainDescriptors, + float maxDistance, Mat? mask = null, bool compactResult = false) + { + ThrowIfDisposed(); + if (queryDescriptors is null) + throw new ArgumentNullException(nameof(queryDescriptors)); + if (trainDescriptors is null) + throw new ArgumentNullException(nameof(trainDescriptors)); + + using var matchesVec = new VectorOfVectorDMatch(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_radiusMatch1( + ptr, queryDescriptors.CvPtr, trainDescriptors.CvPtr, + matchesVec.CvPtr, maxDistance, Cv2.ToPtr(mask), compactResult ? 1 : 0)); + GC.KeepAlive(this); + GC.KeepAlive(queryDescriptors); + GC.KeepAlive(trainDescriptors); + GC.KeepAlive(mask); + return matchesVec.ToArray(); + } + + /// + /// Find one best match for each query descriptor (if mask is empty). + /// + /// + /// + /// + public DMatch[] Match(Mat queryDescriptors, Mat[]? masks = null) + { + ThrowIfDisposed(); + if (queryDescriptors is null) + throw new ArgumentNullException(nameof(queryDescriptors)); + + var masksPtrs = Array.Empty(); + if (masks is not null) + { + masksPtrs = masks.Select(x => x.CvPtr).ToArray(); + } + + using var matchesVec = new VectorOfDMatch(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_match2( + ptr, queryDescriptors.CvPtr, matchesVec.CvPtr, masksPtrs, masksPtrs.Length)); + GC.KeepAlive(this); + GC.KeepAlive(queryDescriptors); + GC.KeepAlive(masks); + return matchesVec.ToArray(); + } + + /// + /// Find k best matches for each query descriptor (in increasing order of distances). + /// compactResult is used when mask is not empty. If compactResult is false matches + /// vector will have the same size as queryDescriptors rows. If compactResult is true + /// matches vector will not contain matches for fully masked out query descriptors. + /// + /// + /// + /// + /// + /// + public DMatch[][] KnnMatch(Mat queryDescriptors, int k, Mat[]? masks = null, bool compactResult = false) + { + ThrowIfDisposed(); + if (queryDescriptors is null) + throw new ArgumentNullException(nameof(queryDescriptors)); + + var masksPtrs = Array.Empty(); + if (masks is not null) + { + masksPtrs = masks.Select(x => x.CvPtr).ToArray(); + } + + using var matchesVec = new VectorOfVectorDMatch(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_knnMatch2( + ptr, queryDescriptors.CvPtr, matchesVec.CvPtr, k, + masksPtrs, masksPtrs.Length, compactResult ? 1 : 0)); + GC.KeepAlive(this); + GC.KeepAlive(queryDescriptors); + GC.KeepAlive(masks); + return matchesVec.ToArray(); + } + + /// + /// Find best matches for each query descriptor which have distance less than + /// maxDistance (in increasing order of distances). + /// + /// + /// + /// + /// + /// + public DMatch[][] RadiusMatch(Mat queryDescriptors, float maxDistance, Mat[]? masks = null, bool compactResult = false) + { + ThrowIfDisposed(); + if (queryDescriptors is null) + throw new ArgumentNullException(nameof(queryDescriptors)); + + var masksPtrs = Array.Empty(); + if (masks is not null) + { + masksPtrs = masks.Select(x => x.CvPtr).ToArray(); + } + + using var matchesVec = new VectorOfVectorDMatch(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_radiusMatch2( + ptr, queryDescriptors.CvPtr, matchesVec.CvPtr, maxDistance, + masksPtrs, masksPtrs.Length, compactResult ? 1 : 0)); + GC.KeepAlive(this); + GC.KeepAlive(queryDescriptors); + GC.KeepAlive(masks); + return matchesVec.ToArray(); + } + + #endregion + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_DescriptorMatcher_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_DescriptorMatcher_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/Enum/AKAZEDescriptorType.cs b/src/OpenCvSharp/Modules/features2d/Enum/AKAZEDescriptorType.cs new file mode 100644 index 000000000..7f7d8db72 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/Enum/AKAZEDescriptorType.cs @@ -0,0 +1,31 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// cv::AKAZE descriptor type +/// +public enum AKAZEDescriptorType +{ + /// + /// Upright descriptors, not invariant to rotation + /// + KAZEUpright = 2, + + /// + /// + /// + KAZE = 3, + + /// + /// + /// + MLDBUpright = 4, + + /// + /// Upright descriptors, not invariant to rotation + /// + MLDB = 5 +} diff --git a/src/OpenCvSharp/Modules/features2d/Enum/DrawMatchesFlags.cs b/src/OpenCvSharp/Modules/features2d/Enum/DrawMatchesFlags.cs new file mode 100644 index 000000000..8ba000707 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/Enum/DrawMatchesFlags.cs @@ -0,0 +1,36 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// +/// +[Flags] +public enum DrawMatchesFlags +{ + /// + /// Output image matrix will be created (Mat::create), + /// i.e. existing memory of output image may be reused. + /// Two source image, matches and single keypoints will be drawn. + /// For each keypoint only the center point will be drawn (without + /// the circle around keypoint with keypoint size and orientation). + /// + Default = 0, + + /// + /// Output image matrix will not be created (Mat::create). + /// Matches will be drawn on existing content of output image. + /// + DrawOverOutImg = 1, + + /// + /// Single keypoints will not be drawn. + /// + NotDrawSinglePoints = 2, + + /// + /// For each keypoint the circle around keypoint with keypoint size and + /// orientation will be drawn. + /// + DrawRichKeypoints = 4 +} diff --git a/src/OpenCvSharp/Modules/features2d/Enum/FASTType.cs b/src/OpenCvSharp/Modules/features2d/Enum/FASTType.cs new file mode 100644 index 000000000..162e6df2c --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/Enum/FASTType.cs @@ -0,0 +1,13 @@ +namespace OpenCvSharp; +// ReSharper disable InconsistentNaming +#pragma warning disable 1591 + +/// +/// AGAST type one of the four neighborhoods as defined in the paper +/// +public enum FASTType +{ + TYPE_5_8 = 0, + TYPE_7_12 = 1, + TYPE_9_16 = 2, +} diff --git a/src/OpenCvSharp/Modules/features2d/Enum/KAZEDiffusivityType.cs b/src/OpenCvSharp/Modules/features2d/Enum/KAZEDiffusivityType.cs new file mode 100644 index 000000000..5ba51e7ac --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/Enum/KAZEDiffusivityType.cs @@ -0,0 +1,28 @@ +namespace OpenCvSharp; + +/// +/// cv::KAZE diffusivity type +/// +// ReSharper disable once InconsistentNaming +public enum KAZEDiffusivityType +{ + /// + /// + /// + DiffPmG1 = 0, + + /// + /// + /// + DiffPmG2 = 1, + + /// + /// + /// + DiffWeickert = 2, + + /// + /// + /// + DiffCharbonnier = 3, +} diff --git a/src/OpenCvSharp/Modules/features2d/Enum/ORBScoreType.cs b/src/OpenCvSharp/Modules/features2d/Enum/ORBScoreType.cs new file mode 100644 index 000000000..914807a8e --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/Enum/ORBScoreType.cs @@ -0,0 +1,18 @@ +namespace OpenCvSharp; + +/// +/// cv::ORB score flags +/// +// ReSharper disable once InconsistentNaming +public enum ORBScoreType +{ + /// + /// + /// + Fast = 1, + + /// + /// + /// + Harris = 0, +} diff --git a/src/OpenCvSharp/Modules/features2d/FastFeatureDetector.cs b/src/OpenCvSharp/Modules/features2d/FastFeatureDetector.cs new file mode 100644 index 000000000..278c69053 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/FastFeatureDetector.cs @@ -0,0 +1,126 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Detects corners using FAST algorithm by E. Rosten +/// +public class FastFeatureDetector : Feature2D +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + protected FastFeatureDetector(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructs FastFeatureDetector + /// + /// threshold on difference between intensity of the central pixel and pixels of a circle around this pixel. + /// if true, non-maximum suppression is applied to detected corners (keypoints). + public static FastFeatureDetector Create(int threshold = 10, bool nonmaxSuppression = true) + { + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_create(threshold, nonmaxSuppression ? 1 : 0, out var ptr)); + return new FastFeatureDetector(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public int Threshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_setThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool NonmaxSuppression + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_getNonmaxSuppression(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_setNonmaxSuppression(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Type + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_getType(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FastFeatureDetector_setType(ptr, value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_FastFeatureDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_FastFeatureDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/Feature2D.cs b/src/OpenCvSharp/Modules/features2d/Feature2D.cs new file mode 100644 index 000000000..8e5e04e10 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/Feature2D.cs @@ -0,0 +1,313 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// Abstract base class for 2D image feature detectors and descriptor extractors +/// +public class Feature2D : Algorithm +{ + /// + protected Feature2D() + { + } + + #region Properties + + /// + /// + /// + public virtual int DescriptorSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_descriptorSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public virtual int DescriptorType + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_descriptorType(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public virtual int DefaultNorm + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_defaultNorm(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + #endregion + + #region Methods + + /// + /// Return true if detector object is empty + /// + /// + public new virtual bool Empty() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Detect keypoints in an image. + /// + /// The image. + /// Mask specifying where to look for keypoints (optional). + /// Must be a char matrix with non-zero values in the region of interest. + /// The detected keypoints. + public KeyPoint[] Detect(Mat image, Mat? mask = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + ThrowIfDisposed(); + + image.ThrowIfDisposed(); + try + { + using var keyPoints = new VectorOfKeyPoint(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_detect_Mat1(ptr, image.CvPtr, keyPoints.CvPtr, Cv2.ToPtr(mask))); + return keyPoints.ToArray(); + } + finally + { + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(mask); + } + } + + /// + /// Detect keypoints in an image. + /// + /// The image. + /// Mask specifying where to look for keypoints (optional). + /// Must be a char matrix with non-zero values in the region of interest. + /// The detected keypoints. + public KeyPoint[] Detect(InputArray image, Mat? mask = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + ThrowIfDisposed(); + + image.ThrowIfDisposed(); + try + { + using var keypoints = new VectorOfKeyPoint(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_detect_InputArray(ptr, image.CvPtr, keypoints.CvPtr, Cv2.ToPtr(mask))); + return keypoints.ToArray(); + } + finally + { + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(mask); + } + } + + /// + /// Detect keypoints in an image set. + /// + /// Image collection. + /// Masks for image set. masks[i] is a mask for images[i]. + /// Collection of keypoints detected in an input images. keypoints[i] is a set of keypoints detected in an images[i]. + public KeyPoint[][] Detect(IEnumerable images, IEnumerable? masks = null) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + ThrowIfDisposed(); + + var imagesArray = images.ToArray(); + var imagesPtr = new IntPtr[imagesArray.Length]; + for (var i = 0; i < imagesArray.Length; i++) + imagesPtr[i] = imagesArray[i].CvPtr; + + using var keypoints = new VectorOfVectorKeyPoint(); + IntPtr[]? masksPtr = null; + if (masks is not null) + { + masksPtr = masks.Select(x => x.CvPtr).ToArray(); + if (masksPtr.Length != imagesArray.Length) + throw new ArgumentException("masks.Length != images.Length"); + } + + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_detect_Mat2( + ptr, imagesPtr, imagesArray.Length, keypoints.CvPtr, masksPtr)); + GC.KeepAlive(masks); + + GC.KeepAlive(this); + GC.KeepAlive(imagesArray); + return keypoints.ToArray(); + } + + /// + /// Compute the descriptors for a set of keypoints in an image. + /// + /// The image. + /// The input keypoints. Keypoints for which a descriptor cannot be computed are removed. + /// Computed descriptors. Row i is the descriptor for KeyPoint i.param> + public virtual void Compute(InputArray image, ref KeyPoint[] keypoints, OutputArray descriptors) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + ThrowIfDisposed(); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_compute1(ptr, image.CvPtr, keypointsVec.CvPtr, descriptors.CvPtr)); + keypoints = keypointsVec.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(descriptors); + } + + /// + /// Compute the descriptors for a keypoints collection detected in image collection. + /// + /// Image collection. + /// Input keypoints collection. keypoints[i] is keypoints detected in images[i]. + /// Keypoints for which a descriptor cannot be computed are removed. + /// Descriptor collection. descriptors[i] are descriptors computed for set keypoints[i]. + public virtual void Compute(IEnumerable images, ref KeyPoint[][] keypoints, IEnumerable descriptors) + { + ThrowIfDisposed(); + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + + var imagesPtrs = images.Select(x => x.CvPtr).ToArray(); + var descriptorsPtrs = descriptors.Select(x => x.CvPtr).ToArray(); + + using var keypointsVec = new VectorOfVectorKeyPoint(keypoints); + + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_compute2( + ptr, imagesPtrs, imagesPtrs.Length, keypointsVec.CvPtr, + descriptorsPtrs, descriptorsPtrs.Length)); + keypoints = keypointsVec.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(descriptors); + } + + /// + /// Detects keypoints and computes the descriptors + /// + /// + /// + /// + /// + /// + public virtual void DetectAndCompute( + InputArray image, + InputArray? mask, + out KeyPoint[] keypoints, + OutputArray descriptors, + bool useProvidedKeypoints = false) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + image.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); + + using var keypointsVec = new VectorOfKeyPoint(); + + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_detectAndCompute( + ptr, image.CvPtr, Cv2.ToPtr(mask), keypointsVec.CvPtr, descriptors.CvPtr, + useProvidedKeypoints ? 1 : 0)); + keypoints = keypointsVec.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(mask); + descriptors.Fix(); + GC.KeepAlive(descriptors); + } + + /// + /// + /// + /// + public void Write(string fileName) + { + ThrowIfDisposed(); + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_write(ptr, fileName)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public void Read(string fileName) + { + ThrowIfDisposed(); + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_read(ptr, fileName)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public override string GetDefaultName() + { + ThrowIfDisposed(); + + using var returnValue = new StdString(); + NativeMethods.HandleException( + NativeMethods.features2d_Feature2D_getDefaultName(ptr, returnValue.CvPtr)); + GC.KeepAlive(this); + return returnValue.ToString(); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/features2d/FlannBasedMatcher.cs b/src/OpenCvSharp/Modules/features2d/FlannBasedMatcher.cs new file mode 100644 index 000000000..6a9b4bf77 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/FlannBasedMatcher.cs @@ -0,0 +1,173 @@ +using OpenCvSharp.Flann; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Brute-force descriptor matcher. +/// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. +/// +public class FlannBasedMatcher : DescriptorMatcher +{ + private Ptr? detectorPtr; + private IndexParams? indexParams; + private SearchParams? searchParams; + + /// + /// + /// + /// + /// + public FlannBasedMatcher(IndexParams? indexParams = null, SearchParams? searchParams = null) + { + indexParams?.ThrowIfDisposed(); + searchParams?.ThrowIfDisposed(); + + var indexParamsPtr = indexParams?.PtrObj?.CvPtr ?? IntPtr.Zero; + var searchParamsPtr = searchParams?.PtrObj?.CvPtr ?? IntPtr.Zero; + NativeMethods.HandleException( + NativeMethods.features2d_FlannBasedMatcher_new(indexParamsPtr, searchParamsPtr, out ptr)); + this.indexParams = indexParams; + this.searchParams = searchParams; + } + + /// + /// Creates instance by cv::Ptr<T> + /// + internal FlannBasedMatcher(Ptr detectorPtr) + { + this.detectorPtr = detectorPtr; + ptr = detectorPtr.Get(); + } + + /// + /// Creates instance by raw pointer T* + /// + internal FlannBasedMatcher(IntPtr rawPtr) + { + detectorPtr = null; + ptr = rawPtr; + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal new static FlannBasedMatcher FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid cv::Ptr pointer"); + var ptrObj = new Ptr(ptr); + return new FlannBasedMatcher(ptrObj); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + if (detectorPtr is not null) + { + detectorPtr.Dispose(); + detectorPtr = null; + ptr = IntPtr.Zero; + } + base.DisposeManaged(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeUnmanaged() + { + if (detectorPtr is null && ptr != IntPtr.Zero) + NativeMethods.HandleException( + NativeMethods.features2d_FlannBasedMatcher_delete(ptr)); + indexParams = null; + searchParams = null; + ptr = IntPtr.Zero; + base.DisposeUnmanaged(); + } + + /// + /// Return true if the matcher supports mask in match methods. + /// + /// + public override bool IsMaskSupported() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FlannBasedMatcher_isMaskSupported(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Add descriptors to train descriptor collection. + /// + /// Descriptors to add. Each descriptors[i] is a descriptors set from one image. + public override void Add(IEnumerable descriptors) + { + ThrowIfDisposed(); + if (descriptors is null) + throw new ArgumentNullException(nameof(descriptors)); + + var descriptorsArray = descriptors.ToArray(); + if (descriptorsArray.Length == 0) + return; + + var descriptorsPtrs = descriptorsArray.Select(x => x.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.features2d_DescriptorMatcher_add(ptr, descriptorsPtrs, descriptorsPtrs.Length)); + GC.KeepAlive(descriptorsArray); + } + + /// + /// Clear train descriptors collection. + /// + public override void Clear() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FlannBasedMatcher_clear(ptr)); + GC.KeepAlive(this); + } + + /// + /// Train matcher (e.g. train flann index). + /// In all methods to match the method train() is run every time before matching. + /// Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation + /// of this method, other matchers really train their inner structures + /// (e.g. FlannBasedMatcher trains flann::Index). So nonempty implementation + /// of train() should check the class object state and do traing/retraining + /// only if the state requires that (e.g. FlannBasedMatcher trains flann::Index + /// if it has not trained yet or if new descriptors have been added to the train collection). + /// + public override void Train() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_FlannBasedMatcher_train(ptr)); + GC.KeepAlive(this); + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_FlannBasedMatcher_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_FlannBasedMatcher_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/GFTTDetector.cs b/src/OpenCvSharp/Modules/features2d/GFTTDetector.cs new file mode 100644 index 000000000..daeb691d5 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/GFTTDetector.cs @@ -0,0 +1,208 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Good Features To Track Detector +/// +// ReSharper disable once IdentifierTypo +// ReSharper disable once InconsistentNaming +public class GFTTDetector : Feature2D +{ + private Ptr? ptrObj; + + // ReSharper disable once CommentTypo + /// + /// Construct GFTT processor + /// + /// + /// + /// + /// + /// + /// + public static GFTTDetector Create( + int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 1, + int blockSize = 3, bool useHarrisDetector = false, double k = 0.04) + { + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_create( + maxCorners, qualityLevel, minDistance, + blockSize, useHarrisDetector ? 1 : 0, k, out var ptr)); + return new GFTTDetector(ptr); + } + + /// + /// Constructor + /// + /// + // ReSharper disable once IdentifierTypo + protected GFTTDetector(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public int MaxFeatures + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_getMaxFeatures(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_setMaxFeatures(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double QualityLevel + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_getQualityLevel(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_setQualityLevel(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double MinDistance + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_getMinDistance(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_setMinDistance(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public int BlockSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_getBlockSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_setBlockSize(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public bool HarrisDetector + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_getHarrisDetector(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_setHarrisDetector(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public double K + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_getK(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_GFTTDetector_setK(ptr, value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_GFTTDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_GFTTDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/KAZE.cs b/src/OpenCvSharp/Modules/features2d/KAZE.cs new file mode 100644 index 000000000..e1ded5dc0 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/KAZE.cs @@ -0,0 +1,206 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Class implementing the KAZE keypoint detector and descriptor extractor +/// +// ReSharper disable once InconsistentNaming +public class KAZE : Feature2D +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + protected KAZE(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// The KAZE constructor + /// + /// Set to enable extraction of extended (128-byte) descriptor. + /// Set to enable use of upright descriptors (non rotation-invariant). + /// Detector response threshold to accept point + /// Maximum octave evolution of the image + /// Default number of sublevels per scale level + /// Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or DIFF_CHARBONNIER + public static KAZE Create( + bool extended = false, bool upright = false, float threshold = 0.001f, + int nOctaves = 4, int nOctaveLayers = 4, KAZEDiffusivityType diffusivity = KAZEDiffusivityType.DiffPmG2) + { + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_create( + extended ? 1 : 0, upright ? 1 : 0, threshold, + nOctaves, nOctaveLayers, (int) diffusivity, out var ptr)); + return new KAZE(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public KAZEDiffusivityType Diffusivity + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_getDiffusivity(ptr, out var ret)); + GC.KeepAlive(this); + return (KAZEDiffusivityType)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_setDiffusivity(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool Extended + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_getExtended(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_setExtended(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public int NOctaveLayers + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_getNOctaveLayers(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_setNOctaveLayers(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public int NOctaves + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_getNOctaves(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_setNOctaves(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public double Threshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_getThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_setThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public bool Upright + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_getUpright(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_KAZE_setUpright(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_KAZE_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_KAZE_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/KeyPointsFilter.cs b/src/OpenCvSharp/Modules/features2d/KeyPointsFilter.cs new file mode 100644 index 000000000..77f31e299 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/KeyPointsFilter.cs @@ -0,0 +1,122 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// A class filters a vector of keypoints. +/// +public static class KeyPointsFilter +{ + /// + /// Remove keypoints within borderPixels of an image edge. + /// + /// + /// + /// + /// + public static KeyPoint[] RunByImageBorder(IEnumerable keypoints, Size imageSize, int borderSize) + { + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_KeyPointsFilter_runByImageBorder( + keypointsVec.CvPtr, imageSize, borderSize)); + return keypointsVec.ToArray(); + } + + /// + /// Remove keypoints of sizes out of range. + /// + /// + /// + /// + /// + public static KeyPoint[] RunByKeypointSize(IEnumerable keypoints, float minSize, + float maxSize = float.MaxValue) + { + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_KeyPointsFilter_runByKeypointSize( + keypointsVec.CvPtr, minSize, maxSize)); + return keypointsVec.ToArray(); + } + + /// + /// Remove keypoints from some image by mask for pixels of this image. + /// + /// + /// + /// + public static KeyPoint[] RunByPixelsMask(IEnumerable keypoints, Mat mask) + { + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + mask.ThrowIfDisposed(); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_KeyPointsFilter_runByPixelsMask(keypointsVec.CvPtr, mask.CvPtr)); + GC.KeepAlive(mask); + return keypointsVec.ToArray(); + } + + /// + /// Remove duplicated keypoints. + /// + /// + /// + public static KeyPoint[] RemoveDuplicated(IEnumerable keypoints) + { + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_KeyPointsFilter_removeDuplicated(keypointsVec.CvPtr)); + return keypointsVec.ToArray(); + } + + /// + /// Remove duplicated keypoints and sort the remaining keypoints + /// + /// + /// + public static KeyPoint[] RemoveDuplicatedSorted(IEnumerable keypoints) + { + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_KeyPointsFilter_removeDuplicatedSorted(keypointsVec.CvPtr)); + return keypointsVec.ToArray(); + } + + + /// + /// Retain the specified number of the best keypoints (according to the response) + /// + /// + /// + /// + public static KeyPoint[] RetainBest(IEnumerable keypoints, int nPoints) + { + if (keypoints is null) + throw new ArgumentNullException(nameof(keypoints)); + + using var keypointsVec = new VectorOfKeyPoint(keypoints); + NativeMethods.HandleException( + NativeMethods.features2d_KeyPointsFilter_retainBest( + keypointsVec.CvPtr, nPoints)); + return keypointsVec.ToArray(); + } +} diff --git a/src/OpenCvSharp/Modules/features2d/MSER.cs b/src/OpenCvSharp/Modules/features2d/MSER.cs new file mode 100644 index 000000000..91a9eb4d1 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/MSER.cs @@ -0,0 +1,204 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Maximal Stable Extremal Regions class +/// +// ReSharper disable once InconsistentNaming +public class MSER : Feature2D +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer cv::MSER* + /// + protected MSER(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates MSER parameters + /// + /// delta, in the code, it compares (size_{i}-size_{i-delta})/size_{i-delta} + /// prune the area which smaller than min_area + /// prune the area which bigger than max_area + /// prune the area have simliar size to its children + /// trace back to cut off mser with diversity < min_diversity + /// for color image, the evolution steps + /// the area threshold to cause re-initialize + /// ignore too small margin + /// the aperture size for edge blur + public static MSER Create( + int delta = 5, + int minArea = 60, + int maxArea = 14400, + double maxVariation = 0.25, + double minDiversity = 0.2, + int maxEvolution = 200, + double areaThreshold = 1.01, + double minMargin = 0.003, + int edgeBlurSize = 5) + { + NativeMethods.HandleException( + NativeMethods.features2d_MSER_create(delta, minArea, maxArea, maxVariation, minDiversity, + maxEvolution, areaThreshold, minMargin, edgeBlurSize, out var ptr)); + return new MSER(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #region Properties + + /// + /// + /// + public int Delta + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_getDelta(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_setDelta(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int MinArea + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_getMinArea(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_setMinArea(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int MaxArea + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_getMaxArea(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_setMaxArea(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool Pass2Only + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_getPass2Only(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_MSER_setPass2Only(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Detect MSER regions + /// + /// input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3) + /// resulting list of point sets + /// resulting bounding boxes + public virtual void DetectRegions( + InputArray image, out Point[][] msers, out Rect[] bboxes) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using (var msersVec = new VectorOfVectorPoint()) + using (var bboxesVec = new VectorOfRect()) + { + NativeMethods.HandleException( + NativeMethods.features2d_MSER_detectRegions( + ptr, image.CvPtr, msersVec.CvPtr, bboxesVec.CvPtr)); + GC.KeepAlive(this); + msers = msersVec.ToArray(); + bboxes = bboxesVec.ToArray(); + } + + GC.KeepAlive(image); + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_MSER_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_MSER_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/ORB.cs b/src/OpenCvSharp/Modules/features2d/ORB.cs new file mode 100644 index 000000000..ce27b9c08 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/ORB.cs @@ -0,0 +1,298 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor. +/// +/// described in @cite RRKB11 . The algorithm uses FAST in pyramids to detect stable keypoints, selects +/// the strongest features using FAST or Harris response, finds their orientation using first-order +/// moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or +/// k-tuples) are rotated according to the measured orientation). +/// +// ReSharper disable once InconsistentNaming +public class ORB : Feature2D +{ + private Ptr? ptrObj; + + /// + /// + /// + protected ORB(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// The ORB constructor + /// + /// The maximum number of features to retain. + /// Pyramid decimation ratio, greater than 1. scaleFactor==2 means the classical + /// pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor + /// will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor + /// will mean that to cover certain scale range you will need more pyramid levels and so the speed will suffer. + /// The number of pyramid levels. The smallest level will have linear size equal to + /// input_image_linear_size/pow(scaleFactor, nlevels - firstLevel). + /// This is size of the border where the features are not detected. It should + /// roughly match the patchSize parameter. + /// The level of pyramid to put source image to. Previous layers are filled + /// with upscaled source image. + /// The number of points that produce each element of the oriented BRIEF descriptor. The + /// default value 2 means the BRIEF where we take a random point pair and compare their brightnesses, + /// so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3 + /// random points (of course, those point coordinates are random, but they are generated from the + /// pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel + /// rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such + /// output will occupy 2 bits, and therefore it will need a special variant of Hamming distance, + /// denoted as NORM_HAMMING2 (2 bits per bin). When WTA_K=4, we take 4 random points to compute each + /// bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3). + /// The default HARRIS_SCORE means that Harris algorithm is used to rank features + /// (the score is written to KeyPoint::score and is used to retain best nfeatures features); + /// FAST_SCORE is alternative value of the parameter that produces slightly less stable keypoints, + /// but it is a little faster to compute. + /// size of the patch used by the oriented BRIEF descriptor. Of course, on smaller + /// pyramid layers the perceived image area covered by a feature will be larger. + /// the fast threshold + public static ORB Create( + int nFeatures = 500, float scaleFactor = 1.2f, int nLevels = 8, + int edgeThreshold = 31, int firstLevel = 0, int wtaK = 2, + ORBScoreType scoreType = ORBScoreType.Harris, int patchSize = 31, + int fastThreshold = 20) + { + NativeMethods.HandleException( + NativeMethods.features2d_ORB_create( + nFeatures, scaleFactor, nLevels, edgeThreshold, + firstLevel, wtaK, (int) scoreType, patchSize, fastThreshold, + out var ptr)); + return new ORB(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public int MaxFeatures + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getMaxFeatures(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setMaxFeatures(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double ScaleFactor + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getScaleFactor(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setScaleFactor(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int NLevels + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getNLevels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setNLevels(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int EdgeThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getEdgeThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setEdgeThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int FirstLevel + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getFirstLevel(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setFirstLevel(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + // ReSharper disable once InconsistentNaming + public int WTA_K + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getWTA_K(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setWTA_K(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public ORBScoreType ScoreType + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getScoreType(ptr, out var ret)); + GC.KeepAlive(this); + return (ORBScoreType)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setScoreType(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int PatchSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getPatchSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setPatchSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int FastThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_getFastThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.features2d_ORB_setFastThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_ORB_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_ORB_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/SIFT.cs b/src/OpenCvSharp/Modules/features2d/SIFT.cs new file mode 100644 index 000000000..8e8bbb367 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/SIFT.cs @@ -0,0 +1,73 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Features2D; + +// ReSharper disable InconsistentNaming +/// +/// SIFT implementation. +/// +public class SIFT : Feature2D +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer cv::SIFT* + /// + protected SIFT(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// The SIFT constructor. + /// + /// The number of best features to retain. + /// The features are ranked by their scores (measured in SIFT algorithm as the local contrast) + /// The number of layers in each octave. 3 is the value used in D. Lowe paper. + /// The number of octaves is computed automatically from the image resolution. + /// The contrast threshold used to filter out weak features in semi-uniform + /// (low-contrast) regions. The larger the threshold, the less features are produced by the detector. + /// The threshold used to filter out edge-like features. Note that the its meaning is + /// different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are filtered out (more features are retained). + /// The sigma of the Gaussian applied to the input image at the octave #0. + /// If your image is captured with a weak camera with soft lenses, you might want to reduce the number. + public static SIFT Create(int nFeatures = 0, int nOctaveLayers = 3, + double contrastThreshold = 0.04, double edgeThreshold = 10, + double sigma = 1.6) + { + NativeMethods.HandleException( + NativeMethods.features2d_SIFT_create( + nFeatures, nOctaveLayers, + contrastThreshold, edgeThreshold, sigma, out var ptr)); + return new SIFT(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_SIFT_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_SIFT_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs b/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs new file mode 100644 index 000000000..2d491efc2 --- /dev/null +++ b/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs @@ -0,0 +1,244 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Class for extracting blobs from an image. +/// +public class SimpleBlobDetector : Feature2D +{ + private Ptr? ptrObj; + +#pragma warning disable CA1034 + /// + /// SimpleBlobDetector parameters + /// + public class Params + { + internal WParams Data; + + /// + /// + /// + public Params() + { + Data = new WParams + { + thresholdStep = 10, + minThreshold = 50, + maxThreshold = 220, + minRepeatability = 2, + minDistBetweenBlobs = 10, + filterByColor = 1, + blobColor = 0, + filterByArea = 1, + minArea = 25, + maxArea = 5000, + filterByCircularity = 0, + minCircularity = 0.8f, + maxCircularity = float.MaxValue, + filterByInertia = 1, + minInertiaRatio = 0.1f, + maxInertiaRatio = float.MaxValue, + filterByConvexity = 1, + minConvexity = 0.95f, + maxConvexity = float.MaxValue + }; + } + +#pragma warning disable 1591 + public float ThresholdStep + { + get => Data.thresholdStep; + set => Data.thresholdStep = value; + } + + public float MinThreshold + { + get => Data.minThreshold; + set => Data.minThreshold = value; + } + + public float MaxThreshold + { + get => Data.maxThreshold; + set => Data.maxThreshold = value; + } + + public uint MinRepeatability + { + get => Data.minRepeatability; + set => Data.minRepeatability = value; + } + + public float MinDistBetweenBlobs + { + get => Data.minDistBetweenBlobs; + set => Data.minDistBetweenBlobs = value; + } + + public bool FilterByColor + { + get => Data.filterByColor != 0; + set => Data.filterByColor = (value ? 1 : 0); + } + + public byte BlobColor + { + get => Data.blobColor; + set => Data.blobColor = value; + } + + public bool FilterByArea + { + get => Data.filterByArea != 0; + set => Data.filterByArea = (value ? 1 : 0); + } + + public float MinArea + { + get => Data.minArea; + set => Data.minArea = value; + } + + public float MaxArea + { + get => Data.maxArea; + set => Data.maxArea = value; + } + + public bool FilterByCircularity + { + get => Data.filterByCircularity != 0; + set => Data.filterByCircularity = (value ? 1 : 0); + } + + public float MinCircularity + { + get => Data.minCircularity; + set => Data.minCircularity = value; + } + + public float MaxCircularity + { + get => Data.maxCircularity; + set => Data.maxCircularity = value; + } + + public bool FilterByInertia + { + get => Data.filterByInertia != 0; + set => Data.filterByInertia = (value ? 1 : 0); + } + + public float MinInertiaRatio + { + get => Data.minInertiaRatio; + set => Data.minInertiaRatio = value; + } + + public float MaxInertiaRatio + { + get => Data.maxInertiaRatio; + set => Data.maxInertiaRatio = value; + } + + public bool FilterByConvexity + { + get => Data.filterByConvexity != 0; + set => Data.filterByConvexity = (value ? 1 : 0); + } + + public float MinConvexity + { + get => Data.minConvexity; + set => Data.minConvexity = value; + } + + public float MaxConvexity + { + get => Data.maxConvexity; + set => Data.maxConvexity = value; + } + } + +#pragma warning disable CA1051 + [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] + public struct WParams + { + public float thresholdStep; + public float minThreshold; + public float maxThreshold; + public uint minRepeatability; // size_t + public float minDistBetweenBlobs; + + public int filterByColor; + public byte blobColor; + + public int filterByArea; + public float minArea, maxArea; + + public int filterByCircularity; + public float minCircularity, maxCircularity; + + public int filterByInertia; + public float minInertiaRatio, maxInertiaRatio; + + public int filterByConvexity; + public float minConvexity, maxConvexity; +#pragma warning restore CA1051 +#pragma warning restore 1591 + } + + /// + /// Constructor + /// + protected SimpleBlobDetector(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Construct a SimpleBlobDetector instance + /// + /// + public static SimpleBlobDetector Create(Params? parameters = null) + { + parameters ??= new Params(); + NativeMethods.HandleException( + NativeMethods.features2d_SimpleBlobDetector_create(ref parameters.Data, out var ptr)); + return new SimpleBlobDetector(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_SimpleBlobDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.features2d_Ptr_SimpleBlobDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs b/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs new file mode 100644 index 000000000..f9b06a8f7 --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs @@ -0,0 +1,28 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.Flann; + +/// +/// The algorithm to use for selecting the initial centers when performing a k-means clustering step. +/// +public enum FlannCentersInit +{ + /// + /// picks the initial cluster centers randomly + /// [flann_centers_init_t::CENTERS_RANDOM] + /// + Random = 0, + + /// + /// picks the initial centers using Gonzales’ algorithm + /// [flann_centers_init_t::CENTERS_GONZALES] + /// + Gonzales = 1, + + /// + /// picks the initial centers using the algorithm suggested in [arthur_kmeanspp_2007] + /// [flann_centers_init_t::CENTERS_KMEANSPP] + /// + KMeansPP = 2 +} diff --git a/src/OpenCvSharp/Modules/flann/FlannDistance.cs b/src/OpenCvSharp/Modules/flann/FlannDistance.cs new file mode 100644 index 000000000..d3d63c15c --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/FlannDistance.cs @@ -0,0 +1,26 @@ +#pragma warning disable CA1008 // Enums should have zero value +#pragma warning disable CA1027 // Mark enums with FlagsAttribute +#pragma warning disable CA1069 +#pragma warning disable 1591 + +namespace OpenCvSharp.Flann; + +public enum FlannDistance +{ + Euclidean = 1, + L2 = 1, + Manhattan = 2, + L1 = 2, + // ReSharper disable once IdentifierTypo + Minkowski = 3, + Max = 4, + HistIntersect = 5, + // ReSharper disable once IdentifierTypo + Hellinger = 6, + ChiSquare = 7, + CS = 7, + // ReSharper disable once IdentifierTypo + KullbackLeibler = 8, + KL = 8, + Hamming = 9, +} diff --git a/src/OpenCvSharp/Modules/flann/Index.cs b/src/OpenCvSharp/Modules/flann/Index.cs new file mode 100644 index 000000000..792a995ee --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/Index.cs @@ -0,0 +1,231 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// The FLANN nearest neighbor index class. +/// +public class Index : DisposableCvObject +{ + /// + /// Constructs a nearest neighbor search index for a given dataset. + /// + /// features – Matrix of type CV _ 32F containing the features(points) to index. The size of the matrix is num _ features x feature _ dimensionality. + /// Structure containing the index parameters. The type of index that will be constructed depends on the type of this parameter. + /// + public Index(InputArray features, IndexParams @params, FlannDistance distType = FlannDistance.L2) + { + if (features is null) + throw new ArgumentNullException(nameof(features)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + + NativeMethods.HandleException( + NativeMethods.flann_Index_new(features.CvPtr, @params.CvPtr, (int)distType, out ptr)); + + GC.KeepAlive(features); + GC.KeepAlive(@params); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create Index"); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Index_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Performs a K-nearest neighbor search for multiple query points. + /// + /// The query points, one per row + /// Indices of the nearest neighbors found + /// Distances to the nearest neighbors found + /// Number of nearest neighbors to search for + /// Search parameters + public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int knn, SearchParams @params) + { + if (queries is null) + throw new ArgumentNullException(nameof(queries)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + if (queries.Length == 0) + throw new ArgumentException("empty array", nameof(queries)); + if (knn < 1) + throw new ArgumentOutOfRangeException(nameof(knn)); + + indices = new int[knn]; + dists = new float[knn]; + + NativeMethods.HandleException( + NativeMethods.flann_Index_knnSearch1( + ptr, queries, queries.Length, indices, dists, knn, @params.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(@params); + } + + /// + /// Performs a K-nearest neighbor search for multiple query points. + /// + /// The query points, one per row + /// Indices of the nearest neighbors found + /// Distances to the nearest neighbors found + /// Number of nearest neighbors to search for + /// Search parameters + public void KnnSearch(Mat queries, Mat indices, Mat dists, int knn, SearchParams @params) + { + if (queries is null) + throw new ArgumentNullException(nameof(queries)); + if (indices is null) + throw new ArgumentNullException(nameof(indices)); + if (dists is null) + throw new ArgumentNullException(nameof(dists)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + + NativeMethods.HandleException( + NativeMethods.flann_Index_knnSearch2( + ptr, queries.CvPtr, indices.CvPtr, dists.CvPtr, knn, @params.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(queries); + GC.KeepAlive(indices); + GC.KeepAlive(dists); + GC.KeepAlive(@params); + } + + /// + /// Performs a K-nearest neighbor search for multiple query points. + /// + /// The query points, one per row + /// Indices of the nearest neighbors found + /// Distances to the nearest neighbors found + /// Number of nearest neighbors to search for + /// Search parameters + public void KnnSearch(Mat queries, out int[] indices, out float[] dists, int knn, SearchParams @params) + { + if (queries is null) + throw new ArgumentNullException(nameof(queries)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + if (knn < 1) + throw new ArgumentOutOfRangeException(nameof(knn)); + + indices = new int[knn]; + dists = new float[knn]; + + NativeMethods.HandleException( + NativeMethods.flann_Index_knnSearch3( + ptr, queries.CvPtr, indices, dists, knn, @params.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(queries); + GC.KeepAlive(@params); + } + + /// + /// Performs a radius nearest neighbor search for a given query point. + /// + /// The query point + /// Indices of the nearest neighbors found + /// Distances to the nearest neighbors found + /// Number of nearest neighbors to search for + /// + /// Search parameters + public void RadiusSearch(float[] queries, int[] indices, float[] dists, double radius, int maxResults, SearchParams @params) + { + if (queries is null) + throw new ArgumentNullException(nameof(queries)); + if (indices is null) + throw new ArgumentNullException(nameof(indices)); + if (dists is null) + throw new ArgumentNullException(nameof(dists)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + + NativeMethods.HandleException( + NativeMethods.flann_Index_radiusSearch1( + ptr, queries, queries.Length, indices, indices.Length, dists, dists.Length, radius, maxResults, @params.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(@params); + } + + /// + /// Performs a radius nearest neighbor search for a given query point. + /// + /// The query point + /// Indices of the nearest neighbors found + /// Distances to the nearest neighbors found + /// Number of nearest neighbors to search for + /// + /// Search parameters + public void RadiusSearch(Mat queries, Mat indices, Mat dists, double radius, int maxResults, SearchParams @params) + { + if (queries is null) + throw new ArgumentNullException(nameof(queries)); + if (indices is null) + throw new ArgumentNullException(nameof(indices)); + if (dists is null) + throw new ArgumentNullException(nameof(dists)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + + NativeMethods.HandleException( + NativeMethods.flann_Index_radiusSearch2( + ptr, queries.CvPtr, indices.CvPtr, dists.CvPtr, radius, maxResults, @params.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(queries); + GC.KeepAlive(indices); + GC.KeepAlive(dists); + GC.KeepAlive(@params); + } + + /// + /// Performs a radius nearest neighbor search for a given query point. + /// + /// The query point + /// Indices of the nearest neighbors found + /// Distances to the nearest neighbors found + /// Number of nearest neighbors to search for + /// + /// Search parameters + public void RadiusSearch(Mat queries, int[] indices, float[] dists, double radius, int maxResults, SearchParams @params) + { + if (queries is null) + throw new ArgumentNullException(nameof(queries)); + if (indices is null) + throw new ArgumentNullException(nameof(indices)); + if (dists is null) + throw new ArgumentNullException(nameof(dists)); + if (@params is null) + throw new ArgumentNullException(nameof(@params)); + + NativeMethods.HandleException( + NativeMethods.flann_Index_radiusSearch3( + ptr, queries.CvPtr, indices, indices.Length, dists, dists.Length, radius, maxResults, @params.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(queries); + GC.KeepAlive(@params); + } + + /// + /// Saves the index to a file. + /// + /// The file to save the index to + public void Save(string filename) + { + if (string.IsNullOrEmpty(filename)) + throw new ArgumentNullException(nameof(filename)); + NativeMethods.HandleException( + NativeMethods.flann_Index_save(ptr, filename)); + GC.KeepAlive(this); + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs new file mode 100644 index 000000000..db1e84b3d --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs @@ -0,0 +1,60 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// hierarchical k-means tree. +/// +public class AutotunedIndexParams : IndexParams +{ + /// + /// + /// + /// Is a number between 0 and 1 specifying the percentage of the approximate nearest-neighbor searches that return the exact nearest-neighbor. + /// Using a higher value for this parameter gives more accurate results, but the search takes longer. The optimum value usually depends on the application. + /// Specifies the importance of the index build time raported to the nearest-neighbor search time. + /// In some applications it’s acceptable for the index build step to take a long time if the subsequent searches in the index can be performed very fast. + /// In other applications it’s required that the index be build as fast as possible even if that leads to slightly longer search times. + /// Is used to specify the tradeoff between time (index build time and search time) and memory used by the index. + /// A value less than 1 gives more importance to the time spent and a value greater than 1 gives more importance to the memory usage. + /// Is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. + /// Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. + /// In such case using just a fraction of the data helps speeding up this algorithm while still giving good approximations of the optimum parameters. + public AutotunedIndexParams(float targetPrecision = 0.9f, float buildWeight = 0.01f, float memoryWeight = 0, float sampleFraction = 0.1f) + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_AutotunedIndexParams_new(targetPrecision, buildWeight, memoryWeight, sampleFraction, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(AutotunedIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected AutotunedIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_AutotunedIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_AutotunedIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs new file mode 100644 index 000000000..9bed06dca --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs @@ -0,0 +1,56 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// When using a parameters object of this type the index created combines the randomized kd-trees and the hierarchical k-means tree. +/// +public class CompositeIndexParams : IndexParams +{ + /// + /// + /// + /// The number of parallel kd-trees to use. Good values are in the range [1..16] + /// The branching factor to use for the hierarchical k-means tree + /// The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence + /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. + /// This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When cb_index is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. + public CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11, + FlannCentersInit centersInit = FlannCentersInit.Random, float cbIndex = 0.2f) + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_CompositeIndexParams_new(trees, branching, iterations, centersInit, cbIndex, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(CompositeIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected CompositeIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_CompositeIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_CompositeIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/IndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/IndexParams.cs new file mode 100644 index 000000000..b30032f12 --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/IndexParams.cs @@ -0,0 +1,177 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// +/// +public class IndexParams : DisposableCvObject +{ + internal OpenCvSharp.Ptr? PtrObj { get; set; } + + /// + /// + /// + public IndexParams() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_IndexParams_new(out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(IndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected IndexParams(OpenCvSharp.Ptr? ptrObj) + { + PtrObj = ptrObj; + ptr = PtrObj?.Get() ?? IntPtr.Zero; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + PtrObj?.Dispose(); + PtrObj = null; + base.DisposeManaged(); + } + + #region Methods + #region Get** + /// + /// + /// + /// + /// + /// + public string GetString(string key, string? defaultVal = null) + { + using var result = new StdString(); + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_getString(ptr, key, defaultVal, result.CvPtr)); + GC.KeepAlive(this); + return result.ToString(); + } + + /// + /// + /// + /// + /// + /// + public int GetInt(string key, int defaultVal = -1) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_getInt(ptr, key, defaultVal, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + /// + public double GetDouble(string key, double defaultVal = -1) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_getDouble(ptr, key, defaultVal, out var ret)); + GC.KeepAlive(this); + return ret; + } + + #endregion + #region Set** + /// + /// + /// + /// + /// + public void SetString(string key, string value) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_setString(ptr, key, value)); + GC.KeepAlive(this); + } + /// + /// + /// + /// + /// + public void SetInt(string key, int value) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_setInt(ptr, key, value)); + GC.KeepAlive(this); + } + /// + /// + /// + /// + /// + public void SetDouble(string key, double value) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_setDouble(ptr, key, value)); + GC.KeepAlive(this); + } + /// + /// + /// + /// + /// + public void SetFloat(string key, float value) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_setFloat(ptr, key, value)); + GC.KeepAlive(this); + } + /// + /// + /// + /// + /// + public void SetBool(string key, bool value) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_setBool(ptr, key, value ? 1 : 0)); + GC.KeepAlive(this); + } + /// + /// + /// + /// + public void SetAlgorithm(int value) + { + NativeMethods.HandleException( + NativeMethods.flann_IndexParams_setAlgorithm(ptr, value)); + GC.KeepAlive(this); + } + #endregion + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_IndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_IndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs new file mode 100644 index 000000000..7714ed7ba --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs @@ -0,0 +1,54 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Flann; + +/// +/// When passing an object of this type the index constructed will consist of a set +/// of randomized kd-trees which will be searched in parallel. +/// +public class KDTreeIndexParams : IndexParams +{ + /// + /// Constructor + /// + /// The number of parallel kd-trees to use. Good values are in the range [1..16] + public KDTreeIndexParams(int trees = 4) + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_KDTreeIndexParams_new(trees, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(KDTreeIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected KDTreeIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_KDTreeIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_KDTreeIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs new file mode 100644 index 000000000..a261fb044 --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs @@ -0,0 +1,54 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// When passing an object of this type the index constructed will be a hierarchical k-means tree. +/// +public class KMeansIndexParams : IndexParams +{ + /// + /// Constructor + /// + /// The branching factor to use for the hierarchical k-means tree + /// The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence + /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. + /// This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When cb_index is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. + public KMeansIndexParams(int branching = 32, int iterations = 11, FlannCentersInit centersInit = FlannCentersInit.Random, float cbIndex = 0.2f) + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_KMeansIndexParams_new(branching, iterations, centersInit, cbIndex, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(KMeansIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected KMeansIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_KMeansIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_KMeansIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs new file mode 100644 index 000000000..db598394c --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs @@ -0,0 +1,50 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// the index will perform a linear, brute-force search. +/// +public class LinearIndexParams : IndexParams +{ + /// + /// Constructor + /// + public LinearIndexParams() + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_LinearIndexParams_new(out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(LinearIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected LinearIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_LinearIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_LinearIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs new file mode 100644 index 000000000..cb2e2d752 --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs @@ -0,0 +1,53 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// When using a parameters object of this type the index created uses multi-probe LSH (by Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search by Qin Lv, William Josephson, Zhe Wang, Moses Charikar, Kai Li., Proceedings of the 33rd International Conference on Very Large Data Bases (VLDB). Vienna, Austria. September 2007) +/// +public class LshIndexParams : IndexParams +{ + /// + /// Constructor + /// + /// The number of hash tables to use (between 10 and 30 usually). + /// The size of the hash key in bits (between 10 and 20 usually). + /// The number of bits to shift to check for neighboring buckets (0 is regular LSH, 2 is recommended). + public LshIndexParams(int tableNumber, int keySize, int multiProbeLevel) + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_LshIndexParams_new(tableNumber, keySize, multiProbeLevel, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(LshIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected LshIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_LshIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_LshIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs new file mode 100644 index 000000000..4dfd57882 --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs @@ -0,0 +1,54 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// This object type is used for loading a previously saved index from the disk. +/// +public class SavedIndexParams : IndexParams +{ + /// + /// Constructor + /// + /// + public SavedIndexParams(string fileName) + : base(null) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.flann_Ptr_SavedIndexParams_new(fileName, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(SavedIndexParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected SavedIndexParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_SavedIndexParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_SavedIndexParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/SearchParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/SearchParams.cs new file mode 100644 index 000000000..2da6f523b --- /dev/null +++ b/src/OpenCvSharp/Modules/flann/IndexParams/SearchParams.cs @@ -0,0 +1,53 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Flann; + +/// +/// +/// +public class SearchParams : IndexParams +{ + /// + /// + /// + /// + /// + /// + public SearchParams(int checks = 32, float eps = 0.0f, bool sorted = true) + : base(null) + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_SearchParams_new(checks, eps, sorted ? 1 : 0, out var p)); + if (p == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(SearchParams)}"); + + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// + /// + protected SearchParams(OpenCvSharp.Ptr ptrObj) + : base(ptrObj) + { + } + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_SearchParams_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.flann_Ptr_SearchParams_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/highgui/CvMouseCallback.cs b/src/OpenCvSharp/Modules/highgui/CvMouseCallback.cs deleted file mode 100644 index 1cf3016cd..000000000 --- a/src/OpenCvSharp/Modules/highgui/CvMouseCallback.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvSetMouseCallbackで指定する、HighGUIウィンドウでマウスイベントが発生したときのイベント処理を行うデリゲート - /// - /// CV_EVENT_ であらわされるフラグのうちのひとつ - /// 画像内でのマウスポインタのx座標 - /// 画像内でのマウスポインタのy座標 - /// CV_EVENT_FLAGであらわされるフラグの論理和 -#else - /// - /// Delegate to be called every time mouse event occurs in the specified window. - /// - /// one of CV_EVENT_ - /// x-coordinates of mouse pointer in image coordinates - /// y-coordinates of mouse pointer in image coordinates - /// a combination of CV_EVENT_FLAG -#endif - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CvMouseCallback( - MouseEvent @event, - Int32 x, - Int32 y, - MouseEvent flags/*, - void* param <- うまくいかん - */ - ); -} diff --git a/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs b/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs new file mode 100644 index 000000000..4e4143167 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs @@ -0,0 +1,142 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Trackbar that is shown on OpenCV Window +/// +public class CvTrackbar : DisposableObject +{ + private readonly int result; + private TrackbarCallbackNative callbackNative; + private GCHandle gchCallback; + private GCHandle gchCallbackNative; + + #region Properties + + /// + /// Name of this trackbar + /// + public string TrackbarName { get; } + + /// + /// Name of parent window + /// + public string WindowName { get; } + + /// + /// + /// + public TrackbarCallback Callback { get; } + + /// + /// Gets or sets a numeric value that represents the current position of the scroll box on the track bar. + /// + public int Pos + { + get + { + NativeMethods.HandleException( + NativeMethods.highgui_getTrackbarPos(TrackbarName, WindowName, out var ret)); + return ret; + } + set => NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarPos(TrackbarName, WindowName, value)); + } + + /// + /// Result value of cv::createTrackbar + /// + public int Result => result; + + #endregion + + #region Init and Disposal + + /// + /// Constructor (value=0, max=100) + /// + /// Trackbar name + /// Window name + /// Callback handler + internal CvTrackbar(string name, string window, TrackbarCallback callback) + : this(name, window, 0, 100, callback) + { + } + + /// + /// Constructor + /// + /// Trackbar name + /// Window name + /// Initial slider position + /// The upper limit of the range this trackbar is working with. + /// Callback handler + internal CvTrackbar(string trackbarName, string windowName, int initialPos, int max, TrackbarCallback callback) + { + if (string.IsNullOrEmpty(trackbarName)) + throw new ArgumentNullException(nameof(trackbarName)); + if (string.IsNullOrEmpty(windowName)) + throw new ArgumentNullException(nameof(windowName)); + + Callback = callback ?? throw new ArgumentNullException(nameof(callback)); + TrackbarName = trackbarName; + WindowName = windowName; + + // userData wrapper + callbackNative = (pos, ud) => callback(pos); + + gchCallback = GCHandle.Alloc(callback); + gchCallbackNative = GCHandle.Alloc(callbackNative); + var callbackPtr = Marshal.GetFunctionPointerForDelegate(callbackNative); + + NativeMethods.HandleException( + NativeMethods.highgui_createTrackbar( + trackbarName, windowName, IntPtr.Zero, max, callbackPtr, IntPtr.Zero, out result)); + + // Set initial trackbar position + NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarPos( + trackbarName, windowName, initialPos)); + + if (result == 0) + throw new OpenCvSharpException("Failed to create CvTrackbar."); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (gchCallback.IsAllocated) + gchCallback.Free(); + if (gchCallbackNative.IsAllocated) + gchCallbackNative.Free(); + base.DisposeUnmanaged(); + } + + #endregion + + /// + /// Sets the trackbar maximum position. + /// The function sets the maximum position of the specified trackbar in the specified window. + /// + /// New maximum position. + public void SetMax(int maxVal) + { + NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarMax(TrackbarName, WindowName, maxVal)); + } + + /// + /// Sets the trackbar minimum position. + /// The function sets the minimum position of the specified trackbar in the specified window. + /// + /// New minimum position. + public void SetMin(int minVal) + { + NativeMethods.HandleException( + NativeMethods.highgui_setTrackbarMin(TrackbarName, WindowName, minVal)); + } +} diff --git a/src/OpenCvSharp/Modules/highgui/CvTrackbarCallback.cs b/src/OpenCvSharp/Modules/highgui/CvTrackbarCallback.cs deleted file mode 100644 index 0e7b67bfc..000000000 --- a/src/OpenCvSharp/Modules/highgui/CvTrackbarCallback.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// CvTrackbarが操作されたときのイベント処理を行うデリゲート - /// -#else - /// - /// Delegate to be called every time the slider changes the position. - /// - /// -#endif - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CvTrackbarCallback(int pos); - -#if LANG_JP - /// - /// CvTrackbarが操作されたときのイベント処理を行うデリゲート - /// - /// - /// -#else - /// - /// Delegate to be called every time the slider changes the position. - /// - /// - /// -#endif - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CvTrackbarCallback2(int pos, object userdata); - - /// - /// - /// - /// - /// - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void CvTrackbarCallback2Native(int pos, IntPtr userdata); -} diff --git a/src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs b/src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs new file mode 100644 index 000000000..708e1cd26 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs @@ -0,0 +1,23 @@ +namespace OpenCvSharp; +// TODO support createButton + +/// +/// Button type flags (cv::createButton) +/// +public enum ButtonType +{ + /// + /// The button will be a push button. + /// + PushButton = 0, + + /// + /// The button will be a checkbox button. + /// + Checkbox = 1, + + /// + /// The button will be a radiobox button. The radiobox on the same buttonbar (same line) are exclusive; one on can be select at the time. + /// + Radiobox = 2, +} diff --git a/src/OpenCvSharp/Modules/highgui/Enum/MouseEventFlags.cs b/src/OpenCvSharp/Modules/highgui/Enum/MouseEventFlags.cs new file mode 100644 index 000000000..885d5bcb0 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Enum/MouseEventFlags.cs @@ -0,0 +1,38 @@ +namespace OpenCvSharp; + +/// +/// Mouse Event Flags see cv::MouseCallback +/// +[Flags] +public enum MouseEventFlags +{ + /// + /// indicates that the left mouse button is down. + /// + LButton = 1, + + /// + /// indicates that the right mouse button is down. + /// + RButton = 2, + + /// + /// indicates that the middle mouse button is down. + /// + MButton = 4, + + /// + /// indicates that CTRL Key is pressed. + /// + CtrlKey = 8, + + /// + /// indicates that SHIFT Key is pressed. + /// + ShiftKey = 16, + + /// + /// indicates that ALT Key is pressed. + /// + AltKey = 32, +} diff --git a/src/OpenCvSharp/Modules/highgui/Enum/MouseEventTypes.cs b/src/OpenCvSharp/Modules/highgui/Enum/MouseEventTypes.cs new file mode 100644 index 000000000..79bcd4f21 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Enum/MouseEventTypes.cs @@ -0,0 +1,67 @@ +namespace OpenCvSharp; + +/// +/// Mouse Events +/// +public enum MouseEventTypes +{ + /// + /// indicates that the mouse pointer has moved over the window. + /// + MouseMove = 0, + + /// + /// indicates that the left mouse button is pressed. + /// + LButtonDown = 1, + + /// + /// indicates that the right mouse button is pressed. + /// + RButtonDown = 2, + + /// + /// indicates that the middle mouse button is pressed. + /// + MButtonDown = 3, + + /// + /// indicates that left mouse button is released. + /// + LButtonUp = 4, + + /// + /// indicates that right mouse button is released. + /// + RButtonUp = 5, + + /// + /// indicates that middle mouse button is released. + /// + MButtonUp = 6, + + /// + /// indicates that left mouse button is double clicked. + /// + LButtonDoubleClick = 7, + + /// + /// indicates that right mouse button is double clicked. + /// + RButtonDoubleClick = 8, + + /// + /// indicates that middle mouse button is double clicked. + /// + MButtonDoubleClick = 9, + + /// + /// positive and negative values mean forward and backward scrolling, respectively. + /// + MouseWheel = 10, + + /// + /// positive and negative values mean right and left scrolling, respectively. + /// + MouseHWheel = 11, +} diff --git a/src/OpenCvSharp/Modules/highgui/Enum/WindowFlags.cs b/src/OpenCvSharp/Modules/highgui/Enum/WindowFlags.cs new file mode 100644 index 000000000..8677f5aa8 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Enum/WindowFlags.cs @@ -0,0 +1,56 @@ + +// ReSharper disable InconsistentNaming + +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Flags for cv::namedWindow +/// +[Flags] +public enum WindowFlags +{ + /// + /// the user can resize the window (no constraint) / + /// also use to switch a fullscreen window to a normal size + /// + Normal = 0x00000000, + + /// + /// the user cannot resize the window, the size is constrainted by the image displayed. + /// + AutoSize = 0x00000001, + + /// + /// window with opengl support + /// + OpenGL = 0x00001000, + +#pragma warning disable CA1069 // Enums should not have duplicate values + + /// + /// change the window to fullscreen + /// + FullScreen = 1, + + /// + /// the image expends as much as it can (no ratio constraint) + /// + FreeRatio = 0x00000100, + + /// + /// the ratio of the image is respected + /// + KeepRatio = 0x00000000, + + /// + /// status bar and tool bar + /// + GuiExpanded = 0x00000000, + + /// + /// old fashious way + /// + GuiNormal = 0x00000010, +} diff --git a/src/OpenCvSharp/Modules/highgui/Enum/WindowPropertyFlags.cs b/src/OpenCvSharp/Modules/highgui/Enum/WindowPropertyFlags.cs new file mode 100644 index 000000000..262acdc74 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Enum/WindowPropertyFlags.cs @@ -0,0 +1,40 @@ +// ReSharper disable CommentTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// Property identifiers for cvGetWindowProperty/cvSetWindowProperty +/// +public enum WindowPropertyFlags +{ + /// + /// fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN) + /// + Fullscreen = 0, + + /// + /// autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE) + /// + AutoSize = 1, + + /// + /// window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO) + /// + AspectRatio = 2, + + /// + /// opengl support + /// + OpenGL = 3, + + /// + /// checks whether the window exists and is visible + /// + Visible = 4, + + /// + /// property to toggle normal window being topmost or not + /// + Topmost = 5 +} diff --git a/src/OpenCvSharp/Modules/highgui/MouseCallback.cs b/src/OpenCvSharp/Modules/highgui/MouseCallback.cs new file mode 100644 index 000000000..9e7ac7897 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/MouseCallback.cs @@ -0,0 +1,19 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// Delegate to be called every time mouse event occurs in the specified window. +/// +/// one of MouseEventTypes +/// x-coordinates of mouse pointer in image coordinates +/// y-coordinates of mouse pointer in image coordinates +/// a combination of MouseEventFlags +/// +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public delegate void MouseCallback( + MouseEventTypes @event, + int x, + int y, + MouseEventFlags flags, + IntPtr userData); diff --git a/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs b/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs new file mode 100644 index 000000000..ba6755356 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs @@ -0,0 +1,18 @@ +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// Delegate to be called every time the slider changes the position. +/// +/// +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public delegate void TrackbarCallback(int pos); + +/// +/// +/// +/// +/// +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public delegate void TrackbarCallbackNative(int pos, IntPtr userData); diff --git a/src/OpenCvSharp/Modules/highgui/Window.cs b/src/OpenCvSharp/Modules/highgui/Window.cs new file mode 100644 index 000000000..d7d47e694 --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Window.cs @@ -0,0 +1,446 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; + +// ReSharper disable UnusedMember.Local + +namespace OpenCvSharp; + +/// +/// Wrapper of HighGUI window +/// +public class Window : DisposableObject +{ + #region Field + + internal static Dictionary Windows = new(); + private static uint windowCount; + + private string name; + private Mat? image; + private MouseCallback? mouseCallback; + // ReSharper disable once IdentifierTypo + private readonly Dictionary trackbars; + private ScopedGCHandle? callbackHandle; + + #endregion + + #region Init and Disposal + + /// + /// Creates a window with a random name + /// + public Window() + : this(DefaultName(), null, WindowFlags.AutoSize) + { + } + + /// + /// Creates a window + /// + /// Name of the window which is used as window identifier and appears in the window caption. + public Window(string name) + : this(name, null, WindowFlags.AutoSize) + { + } + + /// + /// Creates a window + /// + /// Name of the window which is used as window identifier and appears in the window caption. + /// Flags of the window. Currently the only supported flag is WindowMode.AutoSize. + /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. + public Window(string name, WindowFlags flags = WindowFlags.AutoSize) + : this(name, null, flags) + { + } + + /// + /// Creates a window + /// + /// Name of the window which is used as window identifier and appears in the window caption. + /// Image to be shown. + public Window(string name, Mat image) + : this(name, image ?? throw new ArgumentNullException(nameof(image)), WindowFlags.AutoSize) + { + } + + /// + /// Creates a window + /// + /// Name of the window which is used as window identifier and appears in the window caption. + /// Image to be shown. + /// Flags of the window. Currently the only supported flag is WindowMode.AutoSize. + /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. + public Window(string name, Mat? image = null, WindowFlags flags = WindowFlags.AutoSize) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentException("Null or empty window name.", nameof(name)); + + this.name = name; + NativeMethods.HandleException( + NativeMethods.highgui_namedWindow(name, (int) flags)); + + if (image is not null) + ShowImage(image); + + trackbars = new Dictionary(); + + if (!Windows.ContainsKey(name)) + Windows.Add(name, this); + + callbackHandle = null; + } + + /// + /// ウィンドウ名が指定されなかったときに、適当な名前を作成して返す. + /// + /// + private static string DefaultName() + { + return $"window{windowCount++}"; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + foreach (var pair in trackbars) + { + pair.Value?.Dispose(); + } + if (Windows.ContainsKey(name)) + { + Windows.Remove(name); + } + if (callbackHandle is not null && callbackHandle.IsAllocated) + { + callbackHandle.Dispose(); + } + + NativeMethods.HandleException( + NativeMethods.highgui_destroyWindow(name)); + + base.DisposeManaged(); + } + + /// + /// Destroys this window. + /// + public void Close() + { + Dispose(); + } + + /// + /// Destroys all the opened HighGUI windows. + /// + public static void DestroyAllWindows() + { + foreach (var window in Windows.Values) + { + if (window is null || window.IsDisposed) + { + continue; + } + NativeMethods.HandleException( + NativeMethods.highgui_destroyWindow(window.name)); + foreach (var trackbar in window.trackbars.Values) + { + trackbar?.Dispose(); + } + //w.Dispose(); + } + Windows.Clear(); + + NativeMethods.HandleException( + NativeMethods.highgui_destroyAllWindows()); + } + + #endregion + + #region Properties + + /// + /// Gets or sets an image to be shown + /// + public Mat? Image + { + get => image; + set => ShowImage(value); + } + + /// + /// Gets window name + /// + public string Name + { + get => name; + private set => name = value; + } + + /// + /// + /// + internal MouseCallback? MouseCallback + { + get => mouseCallback; + set + { + if (callbackHandle is not null && callbackHandle.IsAllocated) + { + callbackHandle.Dispose(); + } + mouseCallback = value; + callbackHandle = (mouseCallback is null) ? null : new ScopedGCHandle(mouseCallback, GCHandleType.Normal); + } + } + + #endregion + + #region Methods + + /// + /// Creates the trackbar and attaches it to this window + /// + /// Name of created trackbar. + /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); + /// + public CvTrackbar CreateTrackbar(string trackbarName, TrackbarCallback callback) + { + var trackbar = new CvTrackbar(trackbarName, name, callback); + trackbars.Add(trackbarName, trackbar); + return trackbar; + } + + /// + /// Creates the trackbar and attaches it to this window + /// + /// Name of created trackbar. + /// The position of the slider + /// Maximal position of the slider. Minimal position is always 0. + /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); + /// + + public CvTrackbar CreateTrackbar(string trackbarName, int initialPos, int max, TrackbarCallback callback) + { + var trackbar = new CvTrackbar(trackbarName, name, initialPos, max, callback); + trackbars.Add(trackbarName, trackbar); + return trackbar; + } + + /// + /// Display text on the window's image as an overlay for delay milliseconds. This is not editing the image's data. The text is display on the top of the image. + /// + /// Overlay text to write on the window’s image + /// Delay to display the overlay text. If this function is called before the previous overlay text time out, the timer is restarted and the text updated. + /// If this value is zero, the text never disappears. + public void DisplayOverlay(string text, int delayMs) + { + throw new NotImplementedException(); + //Cv.DisplayOverlay(name, text, delayms); + } + + /// + /// + /// + /// Text to write on the window’s statusbar + /// Delay to display the text. If this function is called before the previous text time out, the timer is restarted and the text updated. If this value is zero, the text never disapers. + public void DisplayStatusBar(string text, int delayms) + { + throw new NotImplementedException(); + //Cv.DisplayStatusBar(name, text, delayms); + } + + /// + /// Get Property of the window + /// + /// Property identifier + /// Value of the specified property + public double GetProperty(WindowPropertyFlags propId) + { + return Cv2.GetWindowProperty(name, propId); + } + + /// + /// Sets window position + /// + /// New x coordinate of top-left corner + /// New y coordinate of top-left corner + public void Move(int x, int y) + { + NativeMethods.HandleException( + NativeMethods.highgui_moveWindow(name, x, y)); + } + + /// + /// Sets window size + /// + /// New width + /// New height + public void Resize(int width, int height) + { + NativeMethods.HandleException( + NativeMethods.highgui_resizeWindow(name, width, height)); + } + + /// + /// Set Property of the window + /// + /// Property identifier + /// New value of the specified property + public void SetProperty(WindowPropertyFlags propId, double propValue) + { + Cv2.SetWindowProperty(name, propId, propValue); + } + + /// + /// Shows the image in this window + /// + /// Image to be shown. + public void ShowImage(Mat? img) + { + if (img is not null) + { + image = img; + NativeMethods.HandleException( + NativeMethods.highgui_imshow(name, img.CvPtr)); + GC.KeepAlive(img); + } + } + + /// + /// Shows the image in this window + /// + /// Image to be shown. + public void ShowImage(UMat? img) + { + if (img is not null) + { + //image = img; + NativeMethods.HandleException( + NativeMethods.highgui_imshow_umat(name, img.CvPtr)); + GC.KeepAlive(img); + } + } + + /// + /// get native window handle (HWND in case of Win32 and Widget in case of X Window) + /// + public IntPtr GetHandle() + { + NativeMethods.HandleException( + NativeMethods.highgui_cvGetWindowHandle(name, out var ret)); + return ret; + } + + /// + /// Waits for a pressed key + /// + /// Delay in milliseconds. + /// Key code + public static int WaitKey(int delay = 0) + { + return Cv2.WaitKey(delay); + } + + /// + /// Waits for a pressed key. + /// Similar to #waitKey, but returns full key code. + /// Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc + /// + /// Delay in milliseconds. 0 is the special value that means ”forever” + /// Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed. + public static int WaitKeyEx(int delay = 0) + { + return Cv2.WaitKeyEx(delay); + } + + /// + /// + /// + /// + public static void ShowImages(params Mat[] images) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (images.Length == 0) + return; + + var windows = new List(); + foreach (var img in images) + { + windows.Add(new Window { Image = img }); + } + + WaitKey(); + + foreach (var w in windows) + { + w.Close(); + } + } + + /// + /// + /// + /// + /// + public static void ShowImages(IEnumerable images, IEnumerable names) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (names is null) + throw new ArgumentNullException(nameof(names)); + + var imagesArray = images.ToArray(); + var namesArray = names.ToArray(); + + if (imagesArray.Length == 0) + return; + if (namesArray.Length < imagesArray.Length) + throw new ArgumentException("names.Length < images.Length"); + + var windows = new List(); + for (var i = 0; i < imagesArray.Length; i++) + { + windows.Add(new Window(namesArray[i], image: imagesArray[i])); + } + + Cv2.WaitKey(); + + foreach (var w in windows) + { + w.Close(); + } + } + + /// + /// Retrieves a created window by name + /// + /// + /// + public static Window? GetWindowByName(string name) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException(nameof(name)); + + if (Windows.ContainsKey(name)) + return Windows[name]; + + return null; + } + + /// + /// Sets the callback function for mouse events occuting within the specified window. + /// + /// Reference to the function to be called every time mouse event occurs in the specified window. + /// + public void SetMouseCallback(MouseCallback onMouse, IntPtr userData = default) + { + Cv2.SetMouseCallback(name, onMouse, userData); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/img_hash/AverageHash.cs b/src/OpenCvSharp/Modules/img_hash/AverageHash.cs new file mode 100644 index 000000000..65a7d7810 --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/AverageHash.cs @@ -0,0 +1,76 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// Computes average hash value of the input image. +/// This is a fast image hashing algorithm, but only work on simple case. For more details, +/// please refer to @cite lookslikeit +/// +public class AverageHash : ImgHashBase +{ + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + /// + /// + /// + protected AverageHash(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// + public static AverageHash Create() + { + NativeMethods.HandleException( + NativeMethods.img_hash_AverageHash_create(out var p)); + return new AverageHash(p); + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /* + /// + /// input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1. + /// Hash value of input, it will contain 16 hex decimal number, return type is CV_8U + /// + public override void Compute(InputArray inputArr, OutputArray outputArr) + { + base.Compute(inputArr, outputArr); + }*/ + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_AverageHash_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_AverageHash_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/img_hash/BlockMeanHash.cs b/src/OpenCvSharp/Modules/img_hash/BlockMeanHash.cs new file mode 100644 index 000000000..dbd2dc42c --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/BlockMeanHash.cs @@ -0,0 +1,105 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// Image hash based on block mean. +/// +public class BlockMeanHash : ImgHashBase +{ + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + /// + /// + /// + protected BlockMeanHash(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create BlockMeanHash object + /// + /// + /// + public static BlockMeanHash Create(BlockMeanHashMode mode = BlockMeanHashMode.Mode0) + { + NativeMethods.HandleException( + NativeMethods.img_hash_BlockMeanHash_create((int)mode, out var p)); + return new BlockMeanHash(p); + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + /// + public void SetMode(BlockMeanHashMode mode) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_BlockMeanHash_setMode(ptr, (int)mode)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public double[] GetMean() + { + ThrowIfDisposed(); + using var meanVec = new VectorOfDouble(); + NativeMethods.HandleException( + NativeMethods.img_hash_BlockMeanHash_getMean(ptr, meanVec.CvPtr)); + GC.KeepAlive(this); + return meanVec.ToArray(); + } + + /* + /// + /// + /// Computes block mean hash of the input image + /// + /// input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1. + /// Hash value of input, it will contain 16 hex decimal number, return type is CV_8U + /// + public override void Compute(InputArray inputArr, OutputArray outputArr) + { + base.Compute(inputArr, outputArr); + }*/ + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_BlockMeanHash_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_BlockMeanHash_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/img_hash/ColorMomentHash.cs b/src/OpenCvSharp/Modules/img_hash/ColorMomentHash.cs new file mode 100644 index 000000000..d8287d6b7 --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/ColorMomentHash.cs @@ -0,0 +1,77 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// Image hash based on color moments. +/// +public class ColorMomentHash : ImgHashBase +{ + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + /// + /// + /// + protected ColorMomentHash(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// + public static ColorMomentHash Create() + { + NativeMethods.HandleException( + NativeMethods.img_hash_ColorMomentHash_create(out var p)); + return new ColorMomentHash(p); + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + // ReSharper disable once RedundantOverriddenMember + /// + /// + /// Computes color moment hash of the input, the algorithm is come from the paper "Perceptual Hashing for Color Images Using Invariant Moments" + /// + /// input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1. + /// 42 hash values with type CV_64F(double) + /// + public override void Compute(InputArray inputArr, OutputArray outputArr) + { + base.Compute(inputArr, outputArr); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_ColorMomentHash_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_ColorMomentHash_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/img_hash/Enum/BlockMeanHashMode.cs b/src/OpenCvSharp/Modules/img_hash/Enum/BlockMeanHashMode.cs new file mode 100644 index 000000000..d4d50a039 --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/Enum/BlockMeanHashMode.cs @@ -0,0 +1,17 @@ +namespace OpenCvSharp.ImgHash; + +/// +/// +/// +public enum BlockMeanHashMode +{ + /// + /// use fewer block and generate 16*16/8 uchar hash value + /// + Mode0 = 0, + + /// + /// use block blocks(step sizes/2), generate 31*31/8 + 1 uchar hash value + /// + Mode1 = 1, +} diff --git a/src/OpenCvSharp/Modules/img_hash/ImgHashBase.cs b/src/OpenCvSharp/Modules/img_hash/ImgHashBase.cs new file mode 100644 index 000000000..a9171803a --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/ImgHashBase.cs @@ -0,0 +1,62 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// The base class for image hash algorithms +/// +public abstract class ImgHashBase : Algorithm +{ + /// + /// Computes hash of the input image + /// + /// input image want to compute hash value + /// hash of the image + /// + public virtual void Compute(InputArray inputArr, OutputArray outputArr) + { + ThrowIfDisposed(); + + if (inputArr is null) + throw new ArgumentNullException(nameof(inputArr)); + if (outputArr is null) + throw new ArgumentNullException(nameof(outputArr)); + + inputArr.ThrowIfDisposed(); + outputArr.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.img_hash_ImgHashBase_compute(ptr, inputArr.CvPtr, outputArr.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(inputArr); + outputArr.Fix(); + } + + /// + /// Compare the hash value between inOne and inTwo + /// + /// Hash value one + /// Hash value two + /// value indicate similarity between inOne and inTwo, the meaning of the value vary from algorithms to algorithms + public virtual double Compare(InputArray hashOne, InputArray hashTwo) + { + ThrowIfDisposed(); + + if (hashOne is null) + throw new ArgumentNullException(nameof(hashOne)); + if (hashTwo is null) + throw new ArgumentNullException(nameof(hashTwo)); + + hashOne.ThrowIfDisposed(); + hashTwo.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.img_hash_ImgHashBase_compare(ptr, hashOne.CvPtr, hashTwo.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(hashOne); + GC.KeepAlive(hashOne); + return ret; + } +} diff --git a/src/OpenCvSharp/Modules/img_hash/MarrHildrethHash.cs b/src/OpenCvSharp/Modules/img_hash/MarrHildrethHash.cs new file mode 100644 index 000000000..ec20638f5 --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/MarrHildrethHash.cs @@ -0,0 +1,140 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// Marr-Hildreth Operator Based Hash, slowest but more discriminative. +/// +public class MarrHildrethHash : ImgHashBase +{ + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + /// + /// + /// + protected MarrHildrethHash(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create BlockMeanHash object + /// + /// int scale factor for marr wavelet (default=2). + /// int level of scale factor (default = 1) + /// + public static MarrHildrethHash Create(float alpha = 2.0f, float scale = 1.0f) + { + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_create(alpha, scale, out var p)); + return new MarrHildrethHash(p); + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + /// int scale factor for marr wavelet (default=2). + /// int level of scale factor (default = 1) + public void SetKernelParam(float alpha = 2.0f, float scale = 1.0f) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_setKernelParam(ptr, alpha, scale)); + GC.KeepAlive(this); + } + + /// + /// int scale factor for marr wavelet (default=2). + /// + public float Alpha + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_getAlpha(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_getScale(ptr, out var scale)); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_setKernelParam(ptr, value, scale)); + GC.KeepAlive(this); + } + } + + /// + /// int level of scale factor (default = 1) + /// + public float Scale + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_getScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_getAlpha(ptr, out var alpha)); + NativeMethods.HandleException( + NativeMethods.img_hash_MarrHildrethHash_setKernelParam(ptr, alpha, value)); + GC.KeepAlive(this); + } + } + + // ReSharper disable once RedundantOverriddenMember + /// + /// + /// Computes average hash value of the input image + /// + /// input image want to compute hash value, type should be CV_8UC4, CV_8UC3, CV_8UC1. + /// Hash value of input, it will contain 16 hex decimal number, return type is CV_8U + /// + public override void Compute(InputArray inputArr, OutputArray outputArr) + { + base.Compute(inputArr, outputArr); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_MarrHildrethHash_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_MarrHildrethHash_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/img_hash/PHash.cs b/src/OpenCvSharp/Modules/img_hash/PHash.cs new file mode 100644 index 000000000..b5794423f --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/PHash.cs @@ -0,0 +1,79 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// pHash: Slower than average_hash, but tolerant of minor modifications. +/// This algorithm can combat more variation than averageHash, for more details please refer to @cite lookslikeit +/// +// ReSharper disable once InconsistentNaming +public class PHash : ImgHashBase +{ + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + /// + /// + /// + protected PHash(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// + public static PHash Create() + { + NativeMethods.HandleException( + NativeMethods.img_hash_PHash_create(out var p)); + return new PHash(p); + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + // ReSharper disable once RedundantOverriddenMember + /// + /// + /// Computes pHash value of the input image + /// + /// input image want to compute hash value, type should be CV_8UC4, CV_8UC3, CV_8UC1. + /// Hash value of input, it will contain 8 uchar value + /// + public override void Compute(InputArray inputArr, OutputArray outputArr) + { + base.Compute(inputArr, outputArr); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_PHash_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_PHash_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/img_hash/RadialVarianceHash.cs b/src/OpenCvSharp/Modules/img_hash/RadialVarianceHash.cs new file mode 100644 index 000000000..01b1e14bc --- /dev/null +++ b/src/OpenCvSharp/Modules/img_hash/RadialVarianceHash.cs @@ -0,0 +1,124 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.ImgHash; + +/// +/// +/// Image hash based on Radon transform. +/// +public class RadialVarianceHash : ImgHashBase +{ + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + /// + /// + /// + protected RadialVarianceHash(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create BlockMeanHash object + /// + /// Gaussian kernel standard deviation + /// The number of angles to consider + /// + public static RadialVarianceHash Create(double sigma = 1, int numOfAngleLine = 180) + { + NativeMethods.HandleException( + NativeMethods.img_hash_RadialVarianceHash_create(sigma, numOfAngleLine, out var p)); + return new RadialVarianceHash(p); + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Gaussian kernel standard deviation + /// + public double Sigma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_RadialVarianceHash_getSigma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_RadialVarianceHash_setSigma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The number of angles to consider + /// + public int NumOfAngleLine + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_RadialVarianceHash_getNumOfAngleLine(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.img_hash_RadialVarianceHash_setNumOfAngleLine(ptr, value)); + GC.KeepAlive(this); + } + } + + // ReSharper disable once RedundantOverriddenMember + /// + /// + /// Computes average hash value of the input image + /// + /// input image want to compute hash value, type should be CV_8UC4, CV_8UC3, CV_8UC1. + /// Hash value of input + /// + public override void Compute(InputArray inputArr, OutputArray outputArr) + { + base.Compute(inputArr, outputArr); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_RadialVarianceHash_get(ptr, out var ret)); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.img_hash_Ptr_RadialVarianceHash_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ConvertImageModes.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ConvertImageModes.cs new file mode 100644 index 000000000..86309393b --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ConvertImageModes.cs @@ -0,0 +1,23 @@ + +namespace OpenCvSharp; + +/// +/// +/// +public enum ConvertImageModes +{ + /// + /// + /// + None = 0, + + /// + /// + /// + Flip = 1, + + /// + /// + /// + SwapRB = 2 +} diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs new file mode 100644 index 000000000..ed63d72ff --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs @@ -0,0 +1,76 @@ +#pragma warning disable CA1008 // Enums should have zero value +#pragma warning disable CA2217 // Do not mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// Specifies colorness and Depth of the loaded image +/// +[Flags] +public enum ImreadModes +{ + /// + /// If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). + /// + Unchanged = -1, + + /// + /// If set, always convert image to the single channel grayscale image. + /// + Grayscale = 0, + + /// + /// If set, always convert image to the 3 channel BGR color image. + /// + Color = 1, + + /// + /// If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit. + /// + AnyDepth = 2, + + /// + /// If set, the image is read in any possible color format. + /// + AnyColor = 4, + + /// + /// If set, use the gdal driver for loading the image. + /// + LoadGdal = 8, + + /// + /// If set, always convert image to the single channel grayscale image and the image size reduced 1/2. + /// + ReducedGrayscale2 = 16, + + /// + /// If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2. + /// + ReducedColor2 = 17, + + /// + /// If set, always convert image to the single channel grayscale image and the image size reduced 1/4. + /// + ReducedGrayscale4 = 32, + + /// + /// If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4. + /// + ReducedColor4 = 33, + + /// + /// If set, always convert image to the single channel grayscale image and the image size reduced 1/8. + /// + ReducedGrayscale8 = 64, + + /// + /// If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8. + /// + ReducedColor8 = 65, + + /// + /// If set, do not rotate the image according to EXIF's orientation flag. + /// + IgnoreOrientation = 128 +}; diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteEXRTypeFlags.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteEXRTypeFlags.cs new file mode 100644 index 000000000..83b4e744f --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteEXRTypeFlags.cs @@ -0,0 +1,21 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// +/// +public enum ImwriteEXRTypeFlags +{ + /*IMWRITE_EXR_TYPE_UNIT = 0, //!< not supported */ + + /// + /// store as HALF (FP16) + /// + TypeHalf = 1, + + /// + /// store as FP32 (default) + /// + TypeFloat = 2 +} diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs new file mode 100644 index 000000000..2f1253184 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs @@ -0,0 +1,105 @@ +#pragma warning disable CA1008 // Enums should have zero value +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// The format type IDs for cv::imwrite and cv::inencode +/// +public enum ImwriteFlags +{ + /// + /// For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95. + /// + JpegQuality = 1, + + /// + /// Enable JPEG features, 0 or 1, default is False. + /// + JpegProgressive = 2, + + /// + /// Enable JPEG features, 0 or 1, default is False. + /// + JpegOptimize = 3, + + /// + /// JPEG restart interval, 0 - 65535, default is 0 - no restart. + /// + JpegRstInterval = 4, + + /// + /// Separate luma quality level, 0 - 100, default is 0 - don't use. + /// + JpegLumaQuality = 5, + + /// + /// Separate chroma quality level, 0 - 100, default is 0 - don't use. + /// + JpegChromaQuality = 6, + + /// + /// For PNG, it can be the compression level from 0 to 9. + /// A higher value means a smaller size and longer compression time. Default value is 3. + /// + PngCompression = 16, + + /// + /// One of cv::ImwritePNGFlags, default is IMWRITE_PNG_StrategyDEFAULT. + /// + PngStrategy = 17, + + /// + /// Binary level PNG, 0 or 1, default is 0. + /// + PngBilevel = 18, + + /// + /// For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1. + /// + PxmBinary = 32, + + /// + /// [48] override EXR storage type (FLOAT (FP32) is default) + /// + ExrType = (3 << 4) + 0, /* 48 */ //!< override EXR storage type (FLOAT (FP32) is default) + + /// + /// For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used. + /// + WebPQuality = 64, + + /// + /// For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format + /// + PamTupleType = 128, + + /// + /// For TIFF, use to specify which DPI resolution unit to set; see libtiff documentation for valid values + /// + TiffResUnit = 256, + + /// + /// For TIFF, use to specify the X direction DPI + /// + TiffXDpi = 257, + + /// + /// For TIFF, use to specify the Y direction DPI + /// + TiffYDpi = 258, + + /// + /// For TIFF, use to specify the image compression scheme. + /// See libtiff for integer constants corresponding to compression formats. + /// Note, for images whose depth is CV_32F, only libtiff's SGILOG compression scheme is used. + /// For other supported depths, the compression scheme can be specified by this flag; LZW compression is the default. + /// + TiffCompression = 259, + + /// + /// For JPEG2000, use to specify the target compression rate (multiplied by 1000). + /// The value can be from 0 to 1000. Default is 1000. + /// + Jpeg2000CompressionX1000 = 272 +} diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwritePAMFlags.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwritePAMFlags.cs new file mode 100644 index 000000000..e4bc54b34 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwritePAMFlags.cs @@ -0,0 +1,20 @@ +// ReSharper disable CommentTypo + +namespace OpenCvSharp; + +/// +/// Imwrite PAM specific tupletype flags used to define the 'TUPETYPE' field of a PAM file. +/// +// ReSharper disable once IdentifierTypo +// ReSharper disable once UnusedMember.Global +// ReSharper disable once InconsistentNaming +public enum ImwritePAMFlags +{ +#pragma warning disable CS1591 + FormatNull = 0, + FormatBlackAndWhite = 1, + FormatGrayscale = 2, + FormatGrayscaleAlpha = 3, + FormatRgb = 4, + FormatRgbAlpha = 5, +} diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwritePNGFlags.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwritePNGFlags.cs new file mode 100644 index 000000000..a13548d78 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwritePNGFlags.cs @@ -0,0 +1,46 @@ +// ReSharper disable UnusedMember.Global +// ReSharper disable CommentTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// Imwrite PNG specific flags used to tune the compression algorithm. +/// +/// These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage. +/// The effect of IMWRITE_PNG_StrategyFILTERED is to force more Huffman coding and less string matching; it is somewhat +/// intermediate between IMWRITE_PNG_StrategyDEFAULT and IMWRITE_PNG_StrategyHUFFMAN_ONLY. +/// IMWRITE_PNG_StrategyRLE is designed to be almost as fast as IMWRITE_PNG_StrategyHUFFMAN_ONLY, but give better compression for PNG +/// image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even +/// if it is not set appropriately. IMWRITE_PNG_StrategyFIXED prevents the use of dynamic Huffman codes, allowing for a simpler +/// decoder for special applications. +/// +// ReSharper disable once IdentifierTypo +public enum ImwritePNGFlags +{ + /// + /// Use this value for normal data. + /// + StrategyDefault = 0, + + /// + /// Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat + /// random distribution. In this case, the compression algorithm is tuned to compress them better. + /// + StrategyFiltered = 1, + + /// + /// Use this value to force Huffman encoding only (no string match). + /// + StrategyHuffmanOnly = 2, + + /// + /// Use this value to limit match distances to one (run-length encoding). + /// + StrategyRLE = 3, + + /// + /// Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. + /// + StrategyFixed = 4 +} diff --git a/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs b/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs new file mode 100644 index 000000000..31d989cad --- /dev/null +++ b/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs @@ -0,0 +1,30 @@ +namespace OpenCvSharp; + +/// +/// The format-specific save parameters for cv::imwrite and cv::imencode +/// +// TODO record +[Serializable] +public record ImageEncodingParam +{ + /// + /// format type ID + /// + public ImwriteFlags EncodingId { get; } + + /// + /// value of parameter + /// + public int Value { get; } + + /// + /// Constructor + /// + /// format type ID + /// value of parameter + public ImageEncodingParam(ImwriteFlags id, int value) + { + EncodingId = id; + Value = value; + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/CLAHE.cs b/src/OpenCvSharp/Modules/imgproc/CLAHE.cs new file mode 100644 index 000000000..20ee8c59f --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/CLAHE.cs @@ -0,0 +1,150 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo + +namespace OpenCvSharp; + +/// +/// Contrast Limited Adaptive Histogram Equalization +/// +public sealed class CLAHE : Algorithm +{ + /// + /// cv::Ptr<CLAHE> + /// + private Ptr? ptrObj; + + /// + /// + /// + private CLAHE(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates a predefined CLAHE object + /// + /// + /// + /// + public static CLAHE Create(double clipLimit = 40.0, Size? tileGridSize = null) + { + var tileGridSizeValue = tileGridSize.GetValueOrDefault(new Size(8, 8)); + NativeMethods.HandleException( + NativeMethods.imgproc_createCLAHE( + clipLimit, tileGridSizeValue, out var ptr)); + return new CLAHE(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization. + /// + /// Source image of type CV_8UC1 or CV_16UC1. + /// Destination image. + public void Apply(InputArray src, OutputArray dst) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_CLAHE_apply(ptr, src.CvPtr, dst.CvPtr)); + + dst.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + /// + /// Gets or sets threshold for contrast limiting. + /// + public double ClipLimit + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_CLAHE_getClipLimit(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_CLAHE_setClipLimit(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles. + /// + public Size TilesGridSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_CLAHE_getTilesGridSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_CLAHE_setTilesGridSize(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public void CollectGarbage() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_CLAHE_collectGarbage(ptr)); + GC.KeepAlive(this); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Ptr_CLAHE_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Ptr_CLAHE_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs b/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs new file mode 100644 index 000000000..1bd9e3c89 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs @@ -0,0 +1,233 @@ +using OpenCvSharp.Internal.Util; + +namespace OpenCvSharp; + +/// +/// connected components that is returned from Cv2.ConnectedComponentsEx +/// +public class ConnectedComponents +{ + /// + /// All blobs + /// + public IReadOnlyList Blobs { get; } + + /// + /// destination labeled value + /// + public ReadOnlyArray2D Labels { get; } + + /// + /// The number of labels -1 + /// + public int LabelCount { get; internal set; } + + /// + /// Constructor + /// + /// + /// + /// + internal ConnectedComponents(IReadOnlyList blobs, int[,] labels, int labelCount) + { + Blobs = blobs; + Labels = new ReadOnlyArray2D(labels); + LabelCount = labelCount; + } + + /// + /// Filter a image with the specified label value. + /// + /// Source image. + /// Destination image. + /// Label value. + /// Filtered image. + public void FilterByLabel(Mat src, Mat dst, int labelValue) + => FilterByLabels(src, dst, [labelValue]); + + /// + /// Filter a image with the specified label values. + /// + /// Source image. + /// Destination image. + /// Label values. + /// Filtered image. + public void FilterByLabels(Mat src, Mat dst, IEnumerable labelValues) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (labelValues is null) + throw new ArgumentNullException(nameof(labelValues)); + var labelArray = labelValues.ToArray(); + if (labelArray.Length == 0) + throw new ArgumentException("empty labelValues"); + + foreach (var labelValue in labelArray) + { + if (labelValue < 0 || labelValue >= LabelCount) + throw new ArgumentException("0 <= x < LabelCount"); + } + + // マスク用Matを用意し、Andで切り抜く + using var mask = GetLabelMask(labelArray[0]); + + for (var i = 1; i < labelArray.Length; i++) + { + using var maskI = GetLabelMask(labelArray[i]); + Cv2.BitwiseOr(mask, maskI, mask); + } + src.CopyTo(dst, mask); + } + + /// + /// Filter a image with the specified blob object. + /// + /// Source image. + /// Destination image. + /// Blob value. + /// Filtered image. + public void FilterByBlob(Mat src, Mat dst, Blob blob) + { + if (blob is null) + throw new ArgumentNullException(nameof(blob)); + FilterByLabels(src, dst, [blob.Label]); + } + + /// + /// Filter a image with the specified blob objects. + /// + /// Source image. + /// Destination image. + /// Blob values. + /// Filtered image. + public void FilterByBlobs(Mat src, Mat dst, IEnumerable blobs) + { + FilterByLabels(src, dst, blobs.Select(b => b.Label)); + } + + /// + /// Draws all blobs to the specified image. + /// + /// The target image to be drawn. + public void RenderBlobs(Mat img) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + /* + if (img.Empty()) + throw new ArgumentException("img is empty"); + if (img.Type() != MatType.CV_8UC3) + throw new ArgumentException("img must be CV_8UC3");*/ + if (Blobs is null || Blobs.Count == 0) + throw new OpenCvSharpException("Blobs is empty"); + if (Labels is null) + throw new OpenCvSharpException("Labels is empty"); + + var height = Labels.GetLength(0); + var width = Labels.GetLength(1); + img.Create(new Size(width, height), MatType.CV_8UC3); + + var colors = new Scalar[Blobs.Count]; + colors[0] = Scalar.All(0); + for (var i = 1; i < Blobs.Count; i++) + { + colors[i] = Scalar.RandomColor(); + } + + using var imgt = new Mat(img); + var indexer = imgt.GetIndexer(); + for (var y = 0; y < height; y++) + { + for (var x = 0; x < width; x++) + { + var labelValue = Labels[y, x]; + indexer[y, x] = colors[labelValue].ToVec3b(); + } + } + } + + /// + /// Find the largest blob. + /// + /// the largest blob +#pragma warning disable CA1024 // Use properties where appropriate + public Blob GetLargestBlob() + { + if (Blobs is null || Blobs.Count <= 1) + throw new OpenCvSharpException("Blobs is empty"); + + var max = Blobs[1]; + for (var i = 2; i < Blobs.Count; i++) + { + if (max.Area < Blobs[i].Area) + max = Blobs[i]; + } + return max; + } +#pragma warning restore CA1024 + + /// + /// 指定したラベル値のところのみを非0で残したマスク画像を返す + /// + /// + /// + private Mat GetLabelMask(int label) + { + var rows = Labels.GetLength(0); + var cols = Labels.GetLength(1); + using var labels = Mat.FromPixelData(rows, cols, MatType.CV_32SC1, Labels.GetBuffer()); + using var cmp = new Mat(rows, cols, MatType.CV_32SC1, Scalar.All(label)); + var result = new Mat(); + Cv2.Compare(labels, cmp, result, CmpType.EQ); + return result; + } + +#pragma warning disable CA1034 + /// + /// One blob + /// + public class Blob + { + /// + /// Label value + /// + public int Label { get; internal set; } + + /// + /// Floating point centroid (x,y) + /// + public Point2d Centroid { get; internal set; } + + /// + /// The leftmost (x) coordinate which is the inclusive start of the bounding box in the horizontal direction. + /// + public int Left { get; internal set; } + + /// + /// The topmost (y) coordinate which is the inclusive start of the bounding box in the vertical direction. + /// + public int Top { get; internal set; } + + /// + /// The horizontal size of the bounding box. + /// + public int Width { get; internal set; } + + /// + /// The vertical size of the bounding box. + /// + public int Height { get; internal set; } + + /// + /// The bounding box. + /// + public Rect Rect => new (Left, Top, Width, Height); + + /// + /// The total area (in pixels) of the connected component. + /// + public int Area { get; internal set; } + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs new file mode 100644 index 000000000..66f7d7fbf --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Adaptive thresholding algorithms +/// +/// +///https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L333 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum AdaptiveThresholdTypes +{ + /// + /// It is a mean of block_size × block_size pixel neighborhood, subtracted by param1. + /// + MeanC = 0, + + /// + /// it is a weighted sum (Gaussian) of block_size × block_size pixel neighborhood, subtracted by param1. + /// + GaussianC = 1, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs new file mode 100644 index 000000000..40e8b1679 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs @@ -0,0 +1,274 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable 1591 +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo + +namespace OpenCvSharp; + +/// +/// Color conversion operation for cv::cvtColor +/// +/// +///https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L528 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum ColorConversionCodes +{ + BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image + RGB2RGBA = BGR2BGRA, + + BGRA2BGR = 1, //!< remove alpha channel from RGB or BGR image + RGBA2RGB = BGRA2BGR, + + BGR2RGBA = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel) + RGB2BGRA = BGR2RGBA, + + RGBA2BGR = 3, + BGRA2RGB = RGBA2BGR, + + BGR2RGB = 4, + RGB2BGR = BGR2RGB, + + BGRA2RGBA = 5, + RGBA2BGRA = BGRA2RGBA, + + BGR2GRAY = 6, //!< convert between RGB/BGR and grayscale, @ref convert_rgb_gray "color conversions" + RGB2GRAY = 7, + GRAY2BGR = 8, + GRAY2RGB = GRAY2BGR, + GRAY2BGRA = 9, + GRAY2RGBA = GRAY2BGRA, + BGRA2GRAY = 10, + RGBA2GRAY = 11, + + BGR2BGR565 = 12, //!< convert between RGB/BGR and BGR565 (16-bit images) + RGB2BGR565 = 13, + BGR5652BGR = 14, + BGR5652RGB = 15, + BGRA2BGR565 = 16, + RGBA2BGR565 = 17, + BGR5652BGRA = 18, + BGR5652RGBA = 19, + + GRAY2BGR565 = 20, //!< convert between grayscale to BGR565 (16-bit images) + BGR5652GRAY = 21, + + BGR2BGR555 = 22, //!< convert between RGB/BGR and BGR555 (16-bit images) + RGB2BGR555 = 23, + BGR5552BGR = 24, + BGR5552RGB = 25, + BGRA2BGR555 = 26, + RGBA2BGR555 = 27, + BGR5552BGRA = 28, + BGR5552RGBA = 29, + + GRAY2BGR555 = 30, //!< convert between grayscale and BGR555 (16-bit images) + BGR5552GRAY = 31, + + BGR2XYZ = 32, //!< convert RGB/BGR to CIE XYZ, @ref convert_rgb_xyz "color conversions" + RGB2XYZ = 33, + XYZ2BGR = 34, + XYZ2RGB = 35, + + BGR2YCrCb = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref convert_rgb_ycrcb "color conversions" + RGB2YCrCb = 37, + YCrCb2BGR = 38, + YCrCb2RGB = 39, + + BGR2HSV = 40, //!< convert RGB/BGR to HSV (hue saturation value), @ref convert_rgb_hsv "color conversions" + RGB2HSV = 41, + + BGR2Lab = 44, //!< convert RGB/BGR to CIE Lab, @ref convert_rgb_lab "color conversions" + RGB2Lab = 45, + + BGR2Luv = 50, //!< convert RGB/BGR to CIE Luv, @ref convert_rgb_luv "color conversions" + RGB2Luv = 51, + BGR2HLS = 52, //!< convert RGB/BGR to HLS (hue lightness saturation), @ref convert_rgb_hls "color conversions" + RGB2HLS = 53, + + HSV2BGR = 54, //!< backward conversions to RGB/BGR + HSV2RGB = 55, + + Lab2BGR = 56, + Lab2RGB = 57, + Luv2BGR = 58, + Luv2RGB = 59, + HLS2BGR = 60, + HLS2RGB = 61, + + BGR2HSV_FULL = 66, //!< + RGB2HSV_FULL = 67, + BGR2HLS_FULL = 68, + RGB2HLS_FULL = 69, + + HSV2BGR_FULL = 70, + HSV2RGB_FULL = 71, + HLS2BGR_FULL = 72, + HLS2RGB_FULL = 73, + + LBGR2Lab = 74, + LRGB2Lab = 75, + LBGR2Luv = 76, + LRGB2Luv = 77, + + Lab2LBGR = 78, + Lab2LRGB = 79, + Luv2LBGR = 80, + Luv2LRGB = 81, + + BGR2YUV = 82, //!< convert between RGB/BGR and YUV + RGB2YUV = 83, + YUV2BGR = 84, + YUV2RGB = 85, + + //! YUV 4:2:0 family to RGB + YUV2RGB_NV12 = 90, + YUV2BGR_NV12 = 91, + YUV2RGB_NV21 = 92, + YUV2BGR_NV21 = 93, + YUV420sp2RGB = YUV2RGB_NV21, + YUV420sp2BGR = YUV2BGR_NV21, + + YUV2RGBA_NV12 = 94, + YUV2BGRA_NV12 = 95, + YUV2RGBA_NV21 = 96, + YUV2BGRA_NV21 = 97, + YUV420sp2RGBA = YUV2RGBA_NV21, + YUV420sp2BGRA = YUV2BGRA_NV21, + + YUV2RGB_YV12 = 98, + YUV2BGR_YV12 = 99, + YUV2RGB_IYUV = 100, + YUV2BGR_IYUV = 101, + YUV2RGB_I420 = YUV2RGB_IYUV, + YUV2BGR_I420 = YUV2BGR_IYUV, + YUV420p2RGB = YUV2RGB_YV12, + YUV420p2BGR = YUV2BGR_YV12, + + YUV2RGBA_YV12 = 102, + YUV2BGRA_YV12 = 103, + YUV2RGBA_IYUV = 104, + YUV2BGRA_IYUV = 105, + YUV2RGBA_I420 = YUV2RGBA_IYUV, + YUV2BGRA_I420 = YUV2BGRA_IYUV, + YUV420p2RGBA = YUV2RGBA_YV12, + YUV420p2BGRA = YUV2BGRA_YV12, + + YUV2GRAY_420 = 106, + YUV2GRAY_NV21 = YUV2GRAY_420, + YUV2GRAY_NV12 = YUV2GRAY_420, + YUV2GRAY_YV12 = YUV2GRAY_420, + YUV2GRAY_IYUV = YUV2GRAY_420, + YUV2GRAY_I420 = YUV2GRAY_420, + YUV420sp2GRAY = YUV2GRAY_420, + YUV420p2GRAY = YUV2GRAY_420, + + //! YUV 4:2:2 family to RGB + YUV2RGB_UYVY = 107, + YUV2BGR_UYVY = 108, + //YUV2RGB_VYUY = 109, + //YUV2BGR_VYUY = 110, + YUV2RGB_Y422 = YUV2RGB_UYVY, + YUV2BGR_Y422 = YUV2BGR_UYVY, + YUV2RGB_UYNV = YUV2RGB_UYVY, + YUV2BGR_UYNV = YUV2BGR_UYVY, + + YUV2RGBA_UYVY = 111, + YUV2BGRA_UYVY = 112, + //YUV2RGBA_VYUY = 113, + //YUV2BGRA_VYUY = 114, + YUV2RGBA_Y422 = YUV2RGBA_UYVY, + YUV2BGRA_Y422 = YUV2BGRA_UYVY, + YUV2RGBA_UYNV = YUV2RGBA_UYVY, + YUV2BGRA_UYNV = YUV2BGRA_UYVY, + + YUV2RGB_YUY2 = 115, + YUV2BGR_YUY2 = 116, + YUV2RGB_YVYU = 117, + YUV2BGR_YVYU = 118, + YUV2RGB_YUYV = YUV2RGB_YUY2, + YUV2BGR_YUYV = YUV2BGR_YUY2, + YUV2RGB_YUNV = YUV2RGB_YUY2, + YUV2BGR_YUNV = YUV2BGR_YUY2, + + YUV2RGBA_YUY2 = 119, + YUV2BGRA_YUY2 = 120, + YUV2RGBA_YVYU = 121, + YUV2BGRA_YVYU = 122, + YUV2RGBA_YUYV = YUV2RGBA_YUY2, + YUV2BGRA_YUYV = YUV2BGRA_YUY2, + YUV2RGBA_YUNV = YUV2RGBA_YUY2, + YUV2BGRA_YUNV = YUV2BGRA_YUY2, + + YUV2GRAY_UYVY = 123, + YUV2GRAY_YUY2 = 124, + //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY, + YUV2GRAY_Y422 = YUV2GRAY_UYVY, + YUV2GRAY_UYNV = YUV2GRAY_UYVY, + YUV2GRAY_YVYU = YUV2GRAY_YUY2, + YUV2GRAY_YUYV = YUV2GRAY_YUY2, + YUV2GRAY_YUNV = YUV2GRAY_YUY2, + + //! alpha premultiplication + RGBA2mRGBA = 125, + mRGBA2RGBA = 126, + + //! RGB to YUV 4:2:0 family + RGB2YUV_I420 = 127, + BGR2YUV_I420 = 128, + RGB2YUV_IYUV = RGB2YUV_I420, + BGR2YUV_IYUV = BGR2YUV_I420, + + RGBA2YUV_I420 = 129, + BGRA2YUV_I420 = 130, + RGBA2YUV_IYUV = RGBA2YUV_I420, + BGRA2YUV_IYUV = BGRA2YUV_I420, + RGB2YUV_YV12 = 131, + BGR2YUV_YV12 = 132, + RGBA2YUV_YV12 = 133, + BGRA2YUV_YV12 = 134, + + //! Demosaicing + BayerBG2BGR = 46, + BayerGB2BGR = 47, + BayerRG2BGR = 48, + BayerGR2BGR = 49, + + BayerBG2RGB = BayerRG2BGR, + BayerGB2RGB = BayerGR2BGR, + BayerRG2RGB = BayerBG2BGR, + BayerGR2RGB = BayerGB2BGR, + + BayerBG2GRAY = 86, + BayerGB2GRAY = 87, + BayerRG2GRAY = 88, + BayerGR2GRAY = 89, + + //! Demosaicing using Variable Number of Gradients + BayerBG2BGR_VNG = 62, + BayerGB2BGR_VNG = 63, + BayerRG2BGR_VNG = 64, + BayerGR2BGR_VNG = 65, + + BayerBG2RGB_VNG = BayerRG2BGR_VNG, + BayerGB2RGB_VNG = BayerGR2BGR_VNG, + BayerRG2RGB_VNG = BayerBG2BGR_VNG, + BayerGR2RGB_VNG = BayerGB2BGR_VNG, + + //! Edge-Aware Demosaicing + BayerBG2BGR_EA = 135, + BayerGB2BGR_EA = 136, + BayerRG2BGR_EA = 137, + BayerGR2BGR_EA = 138, + + BayerBG2RGB_EA = BayerRG2BGR_EA, + BayerGB2RGB_EA = BayerGR2BGR_EA, + BayerRG2RGB_EA = BayerBG2BGR_EA, + BayerGR2RGB_EA = BayerGB2BGR_EA, + + COLORCVT_MAX = 139 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ColormapTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ColormapTypes.cs new file mode 100644 index 000000000..a8ca629c7 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ColormapTypes.cs @@ -0,0 +1,32 @@ +#pragma warning disable 1591 + +namespace OpenCvSharp; + +/// +/// GNU Octave/MATLAB equivalent colormaps +/// +public enum ColormapTypes +{ + Autumn = 0, + Bone = 1, + Jet = 2, + Winter = 3, + Rainbow = 4, + Ocean = 5, + Summer = 6, + Spring = 7, + Cool = 8, + Hsv = 9, + Pink = 10, + Hot = 11, + Parula = 12, + Magma = 13, + Inferno = 14, + Plasma = 15, + Viridis = 16, + Cividis = 17, + Twilight = 18, + TwilightShifted = 19, + Turbo = 20, + DeepGreen = 21 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ConnectedComponentsAlgorithmsTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ConnectedComponentsAlgorithmsTypes.cs new file mode 100644 index 000000000..ad0ea9b1a --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ConnectedComponentsAlgorithmsTypes.cs @@ -0,0 +1,45 @@ +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// connected components algorithm +/// +public enum ConnectedComponentsAlgorithmsTypes +{ + /// + /// SAUF algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity + /// + WU = 0, + + /// + /// BBDT algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity + /// + Default = -1, + + /// + /// BBDT algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity + /// + GRANA = 1, + + /// + /// Spaghetti @cite Bolelli2019 algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity. + /// + BOLELLI = 2, + + /// + /// Same as CCL_WU. It is preferable to use the flag with the name of the algorithm (CCL_SAUF) rather than the one with the name of the first author (CCL_WU). + /// + SAUF = 3, + + /// + /// Same as CCL_GRANA. It is preferable to use the flag with the name of the algorithm (CCL_BBDT) rather than the one with the name of the first author (CCL_GRANA). + /// + BBDT = 4, + + /// + /// Same as CCL_BOLELLI. It is preferable to use the flag with the name of the algorithm (CCL_SPAGHETTI) rather than the one with the name of the first author (CCL_BOLELLI). + /// + SPAGHETTI = 5, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ConnectedComponentsTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ConnectedComponentsTypes.cs new file mode 100644 index 000000000..8c4342f71 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ConnectedComponentsTypes.cs @@ -0,0 +1,34 @@ +namespace OpenCvSharp; + +/// +/// components algorithm output formats +/// +public enum ConnectedComponentsTypes +{ + /// + /// The leftmost (x) coordinate which is the inclusive start of the bounding + /// box in the horizontal direction. + /// + Left = 0, + + /// + /// The topmost (y) coordinate which is the inclusive start of the bounding + /// box in the vertical direction. + /// + Top = 1, + + /// + /// The horizontal size of the bounding box + /// + Width = 2, + + /// + /// The vertical size of the bounding box + /// + Height = 3, + + /// + /// The total area (in pixels) of the connected component + /// + Area = 4, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs new file mode 100644 index 000000000..2d6b2c949 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs @@ -0,0 +1,37 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Approximation method (for all the modes, except CV_RETR_RUNS, which uses built-in approximation). +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L431 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum ContourApproximationModes +{ + /// + /// CHAIN_APPROX_NONE - translate all the points from the chain code into points; + /// + ApproxNone = 1, + + /// + /// CHAIN_APPROX_SIMPLE - compress horizontal, vertical, and diagonal segments, that is, the function leaves only their ending points; + /// + ApproxSimple = 2, + + /// + /// CHAIN_APPROX_TC89_L1 - apply one of the flavors of Teh-Chin chain approximation algorithm. + /// + // ReSharper disable once InconsistentNaming + ApproxTC89L1 = 3, + + /// + /// CHAIN_APPROX_TC89_KCOS - apply one of the flavors of Teh-Chin chain approximation algorithm. + /// + // ReSharper disable once InconsistentNaming + ApproxTC89KCOS = 4, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformLabelTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformLabelTypes.cs new file mode 100644 index 000000000..e6d618c73 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformLabelTypes.cs @@ -0,0 +1,19 @@ +namespace OpenCvSharp; + +/// +/// distanceTransform algorithm flags +/// +public enum DistanceTransformLabelTypes +{ + /// + /// each connected component of zeros in src + /// (as well as all the non-zero pixels closest to the connected component) + /// will be assigned the same label + /// + CComp = 0, + + /// + /// each zero pixel (and all the non-zero pixels closest to it) gets its own label. + /// + Pixel = 1, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformMasks.cs b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformMasks.cs new file mode 100644 index 000000000..4437fade6 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformMasks.cs @@ -0,0 +1,29 @@ +#pragma warning disable CA1008 // Enums should have zero value +#pragma warning disable CA2217 // Do not mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// Mask size for distance transform +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L312 +/// +[Flags] +public enum DistanceTransformMasks +{ + /// + /// 3 + /// + Mask3 = 3, + + /// + /// 5 + /// + Mask5 = 5, + + /// + /// + /// + Precise = 0, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs new file mode 100644 index 000000000..647cfaa2d --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs @@ -0,0 +1,55 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Type of distance for cvDistTransform +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L300 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum DistanceTypes +{ + /// + /// User defined distance [CV_DIST_USER] + /// + User = -1, + + /// + /// distance = |x1-x2| + |y1-y2| [CV_DIST_L1] + /// + L1 = 1, + + /// + /// the simple euclidean distance [CV_DIST_L2] + /// + L2 = 2, + + /// + /// distance = max(|x1-x2|,|y1-y2|) [CV_DIST_C] + /// + C = 3, + + /// + /// L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) [CV_DIST_L12] + /// + L12 = 4, + + /// + /// distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 [CV_DIST_FAIR] + /// + Fair = 5, + + /// + /// distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 [CV_DIST_WELSCH] + /// + Welsch = 6, + + /// + /// distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 [CV_DIST_HUBER] + /// + Huber = 7, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs b/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs new file mode 100644 index 000000000..f1e7de2ca --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs @@ -0,0 +1,23 @@ +namespace OpenCvSharp; + +/// +/// Specifies how to flip the array +/// +public enum FlipMode +{ + /// + /// means flipping around x-axis + /// + X = 0, + + /// + /// means flipping around y-axis + /// + Y = 1, + + /// + /// means flipping around both axises + /// + // ReSharper disable once InconsistentNaming + XY = -1 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs b/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs new file mode 100644 index 000000000..ea7e7b8c4 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs @@ -0,0 +1,32 @@ +namespace OpenCvSharp; + +/// +/// floodFill Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered. Upper bits can be 0 or a combination of the following flags: +/// +[Flags] +public enum FloodFillFlags +{ + /// + /// 4-connected line. + /// [= 4] + /// + Link4 = 4, + + /// + /// 8-connected line. + /// [= 8] + /// + Link8 = 8, + + /// + /// If set, the difference between the current pixel and seed pixel is considered. Otherwise, the difference between neighbor pixels is considered (that is, the range is floating). + /// [CV_FLOODFILL_FIXED_RANGE] + /// + FixedRange = 1 << 16, + + /// + /// If set, the function does not change the image ( newVal is ignored), but fills the mask. The flag can be used for the second variant only. + /// [CV_FLOODFILL_MASK_ONLY] + /// + MaskOnly = 1 << 17, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutClasses.cs b/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutClasses.cs new file mode 100644 index 000000000..9bdc67e24 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutClasses.cs @@ -0,0 +1,28 @@ +// ReSharper disable InconsistentNaming +namespace OpenCvSharp; + +/// +/// class of the pixel in GrabCut algorithm +/// +public enum GrabCutClasses +{ + /// + /// an obvious background pixels + /// + BGD = 0, + + /// + /// an obvious foreground (object) pixel + /// + FGD = 1, + + /// + /// a possible background pixel + /// + PR_BGD = 2, + + /// + /// a possible foreground pixel + /// + PR_FGD = 3 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs new file mode 100644 index 000000000..b51ca4610 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs @@ -0,0 +1,28 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// GrabCut algorithm flags +/// +[Flags] +public enum GrabCutModes +{ + /// + /// The function initializes the state and the mask using the provided rectangle. + /// After that it runs iterCount iterations of the algorithm. + /// + InitWithRect = 0, + + /// + /// The function initializes the state using the provided mask. + /// Note that GC_INIT_WITH_RECT and GC_INIT_WITH_MASK can be combined. + /// Then, all the pixels outside of the ROI are automatically initialized with GC_BGD . + /// + InitWithMask = 1, + + /// + /// The value means that the algorithm should just resume. + /// + Eval = 2, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs b/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs new file mode 100644 index 000000000..dde42aa8a --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs @@ -0,0 +1,54 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// Comparison methods for cvCompareHist +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L497 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum HistCompMethods +{ + /// + /// Correlation [CV_COMP_CORREL] + /// + Correl = 0, + + /// + /// Chi-Square [CV_COMP_CHISQR] + /// + Chisqr = 1, + + /// + /// Intersection [CV_COMP_INTERSECT] + /// + Intersect = 2, + + /// + /// Bhattacharyya distance [CV_COMP_BHATTACHARYYA] + /// + Bhattacharyya = 3, + + /// + /// Synonym for HISTCMP_BHATTACHARYYA + /// + Hellinger = Bhattacharyya, + + /// + /// Alternative Chi-Square + /// \f[d(H_1,H_2) = 2 * \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\f] + /// This alternative formula is regularly used for texture comparison. See e.g. @cite Puzicha1997 + /// + ChisqrAlt = 4, + + /// + /// Kullback-Leibler divergence + /// \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] + /// + // ReSharper disable once InconsistentNaming + KLDiv = 5 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/HoughModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/HoughModes.cs new file mode 100644 index 000000000..aa953d7f5 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/HoughModes.cs @@ -0,0 +1,46 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Variants of a Hough transform +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L465 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum HoughModes +{ + /// + /// classical or standard Hough transform. + /// Every line is represented by two floating-point numbers \f$(\rho, \theta)\f$ , + /// where \f$\rho\f$ is a distance between (0,0) point and the line, + /// and \f$\theta\f$ is the angle between x-axis and the normal to the line. + /// Thus, the matrix must be (the created sequence will be) of CV_32FC2 type + /// + Standard = 0, + + /// + /// probabilistic Hough transform (more efficient in case if the picture contains + /// a few long linear segments). It returns line segments rather than the whole line. + /// Each segment is represented by starting and ending points, and the matrix must be + /// (the created sequence will be) of the CV_32SC4 type. + /// + Probabilistic = 1, + + /// + /// multi-scale variant of the classical Hough transform. + /// The lines are encoded the same way as HOUGH_STANDARD. + /// + MultiScale = 2, + + /// + /// basically *21HT*, described in @cite Yuen90 + /// + Gradient = 3, + + /// + /// variation of HOUGH_GRADIENT to get better accuracy + /// + GradientAlt = 4 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs b/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs new file mode 100644 index 000000000..e2bf02006 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs @@ -0,0 +1,56 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Interpolation algorithm +/// +[Flags] +public enum InterpolationFlags +{ + /// + /// Nearest-neighbor interpolation, + /// + Nearest = 0, + + /// + /// Bilinear interpolation (used by default) + /// + Linear = 1, + + /// + /// Bicubic interpolation. + /// + Cubic = 2, + + /// + /// Resampling using pixel area relation. It is the preferred method for image decimation that gives moire-free results. In case of zooming it is similar to CV_INTER_NN method. + /// + Area = 3, + + /// + /// Lanczos interpolation over 8x8 neighborhood + /// + Lanczos4 = 4, + + /// + /// Bit exact bilinear interpolation + /// + LinearExact = 5, + + /// + /// mask for interpolation codes + /// + Max = 7, + + /// + /// Fill all the destination image pixels. If some of them correspond to outliers in the source image, they are set to fillval. + /// + WarpFillOutliers = 8, + + /// + /// Indicates that matrix is inverse transform from destination image to source and, + /// thus, can be used directly for pixel interpolation. Otherwise, the function finds the inverse transform from map_matrix. + /// + WarpInverseMap = 16, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/LineSegmentDetectorModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/LineSegmentDetectorModes.cs new file mode 100644 index 000000000..03c0bda48 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/LineSegmentDetectorModes.cs @@ -0,0 +1,27 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Variants of Line Segment %Detector +/// +[Flags] +public enum LineSegmentDetectorModes : int +{ + /// + /// No refinement applied + /// + RefineNone = 0, + + /// + /// Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations. + /// + RefineStd = 1, + + /// + /// Advanced refinement. Number of false alarms is calculated, lines are + /// refined through increase of precision, decrement in size, etc. + /// + RefineAdv = 2, +} + diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs new file mode 100644 index 000000000..678660284 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs @@ -0,0 +1,31 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1008 // Enums should have zero value +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// Type of the line +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L808 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum LineTypes +{ + /// + /// 8-connected line. + /// + Link8 = 8, + + /// + /// 4-connected line. + /// + Link4 = 4, + + /// + /// Anti-aliased line. + /// + AntiAlias = 16 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/MarkerTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/MarkerTypes.cs new file mode 100644 index 000000000..7772ebe52 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/MarkerTypes.cs @@ -0,0 +1,43 @@ + +namespace OpenCvSharp; + +/// +/// Possible set of marker types used for the cv::drawMarker function +/// +public enum MarkerTypes +{ + /// + /// A crosshair marker shape + /// + Cross = 0, + + /// + /// A 45 degree tilted crosshair marker shape + /// + TiltedCross = 1, + + /// + /// A star marker shape, combination of cross and tilted cross + /// + Star = 2, + + /// + /// A diamond marker shape + /// + Diamond = 3, + + /// + /// A square marker shape + /// + Square = 4, + + /// + /// An upwards pointing triangle marker shape + /// + TriangleUp = 5, + + /// + /// A downwards pointing triangle marker shape + /// + TriangleDown = 6 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs new file mode 100644 index 000000000..2f776e183 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs @@ -0,0 +1,28 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Shape of the structuring element +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L231 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum MorphShapes +{ + /// + /// A rectangular element + /// + Rect = 0, + + /// + /// A cross-shaped element + /// + Cross = 1, + + /// + /// An elliptic element + /// + Ellipse = 2, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs new file mode 100644 index 000000000..445dbe903 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs @@ -0,0 +1,49 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Type of morphological operation +/// +public enum MorphTypes +{ + /// + /// + /// + Erode = 0, + + /// + /// + /// + Dilate = 1, + + /// + /// an opening operation + /// + Open = 2, + + /// + /// a closing operation + /// + Close = 3, + + /// + /// Morphological gradient + /// + Gradient = 4, + + /// + /// "Top hat" + /// + TopHat = 5, + + /// + /// "Black hat" + /// + BlackHat = 6, + + /// + /// "hit and miss" + /// + HitMiss = 7 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs b/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs new file mode 100644 index 000000000..1a04f780e --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs @@ -0,0 +1,20 @@ +#pragma warning disable CA1008 // Enums should have zero value +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +namespace OpenCvSharp; + +/// +/// PixelConnectivity for LineIterator +/// +public enum PixelConnectivity +{ + /// + /// Connectivity 4 (N,S,E,W) + /// + Connectivity4 = 4, + + /// + /// Connectivity 8 (N,S,E,W,NE,SE,SW,NW) + /// + Connectivity8 = 8, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/RectanglesIntersectTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/RectanglesIntersectTypes.cs new file mode 100644 index 000000000..39b0665fe --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/RectanglesIntersectTypes.cs @@ -0,0 +1,22 @@ +namespace OpenCvSharp; + +/// +/// types of intersection between rectangles +/// +public enum RectanglesIntersectTypes +{ + /// + /// No intersection + /// + None = 0, + + /// + /// There is a partial intersection + /// + Partial = 1, + + /// + /// One of the rectangle is fully enclosed in the other + /// + Full = 2 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs new file mode 100644 index 000000000..c7c8dfc22 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs @@ -0,0 +1,43 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// mode of the contour retrieval algorithm +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L414 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum RetrievalModes +{ + /// + /// retrieves only the extreme outer contours. + /// It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for all the contours. + /// + External = 0, + + /// + /// retrieves all of the contours without establishing any hierarchical relationships. + /// + List = 1, + + /// + /// retrieves all of the contours and organizes them into a two-level hierarchy. + /// At the top level, there are external boundaries of the components. + /// At the second level, there are boundaries of the holes. If there is another + /// contour inside a hole of a connected component, it is still put at the top level. + /// + CComp = 2, + + /// + /// retrieves all of the contours and reconstructs a full hierarchy + /// of nested contours. + /// + Tree = 3, + + /// + /// + /// + FloodFill = 4, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs new file mode 100644 index 000000000..7cb17c870 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs @@ -0,0 +1,30 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Comparison methods for cv::matchShapes +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L453 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum ShapeMatchModes +{ + /// + /// \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f] + /// + I1 = 1, + + /// + /// \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f] + /// + I2 = 2, + + /// + /// \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f] + /// + I3 = 3, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs new file mode 100644 index 000000000..e3312ade5 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs @@ -0,0 +1,45 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +/// +/// Specifies the way the template must be compared with image regions +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L3672 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum TemplateMatchModes +{ + /// + /// \f[R(x,y)= \sum _{x',y'} (T(x',y')-I(x+x',y+y'))^2\f] + /// + SqDiff = 0, + + /// + /// \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y')-I(x+x',y+y'))^2}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] + /// + SqDiffNormed = 1, + + /// + /// \f[R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y'))\f] + /// + CCorr = 2, + + /// + /// \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] + /// + CCorrNormed = 3, + + /// + /// \f[R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I'(x+x',y+y'))\f] + /// where + /// \f[\begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array}\f] + /// + CCoeff = 4, + + /// + /// \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f] + /// + CCoeffNormed = 5, +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs new file mode 100644 index 000000000..848fac2e5 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs @@ -0,0 +1,50 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Thresholding type +/// +[Flags] +public enum ThresholdTypes +{ + /// + /// \f[\texttt{dst} (x,y) = \fork{\texttt{maxval}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] + /// + Binary = 0, + + /// + /// \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\f] + /// + BinaryInv = 1, + + /// + /// \f[\texttt{dst} (x,y) = \fork{\texttt{threshold}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] + /// + Trunc = 2, + + /// + /// \f[\texttt{dst} (x,y) = \fork{\texttt{src}(x,y)}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] + /// + Tozero = 3, + + /// + /// \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] + /// + TozeroInv = 4, + + /// + /// + /// + Mask = 7, + + /// + /// flag, use Otsu algorithm to choose the optimal threshold value + /// + Otsu = 8, + + /// + /// flag, use Triangle algorithm to choose the optimal threshold value + /// + Triangle = 16 +} diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/WarpPolarMode.cs b/src/OpenCvSharp/Modules/imgproc/Enum/WarpPolarMode.cs new file mode 100644 index 000000000..72b9c6bdd --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Enum/WarpPolarMode.cs @@ -0,0 +1,20 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Specify the polar mapping mode +/// +[Flags] +public enum WarpPolarMode +{ + /// + /// Remaps an image to/from polar space. + /// + Linear = 0, + + /// + /// Remaps an image to/from semilog-polar space. + /// + Log = 256 +} diff --git a/src/OpenCvSharp/Modules/imgproc/GeneralizedHough.cs b/src/OpenCvSharp/Modules/imgproc/GeneralizedHough.cs new file mode 100644 index 000000000..5e1965447 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/GeneralizedHough.cs @@ -0,0 +1,254 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// finds arbitrary template in the grayscale image using Generalized Hough Transform +/// +public abstract class GeneralizedHough : Algorithm +{ + /// + /// Canny low threshold. + /// + /// + public int CannyLowThresh + { + get + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_getCannyLowThresh(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setCannyLowThresh(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Canny high threshold. + /// + /// + public int CannyHighThresh + { + get + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_getCannyHighThresh(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setCannyHighThresh(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Minimum distance between the centers of the detected objects. + /// + /// + public double MinDist + { + get + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_getMinDist(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setMinDist(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Inverse ratio of the accumulator resolution to the image resolution. + /// + /// + public double Dp + { + get + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_getDp(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setDp(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Maximal size of inner buffers. + /// + /// + public int MaxBufferSize + { + get + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_getMaxBufferSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setMaxBufferSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// set template to search + /// + /// + /// + public void SetTemplate(InputArray templ, Point? templCenter = null) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (templ is null) + throw new ArgumentNullException(nameof(templ)); + templ.ThrowIfDisposed(); + var templCenterValue = templCenter.GetValueOrDefault(new Point(-1, -1)); + + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setTemplate1(ptr, templ.CvPtr, templCenterValue)); + GC.KeepAlive(this); + GC.KeepAlive(templ); + } + + /// + /// set template to search + /// + /// + /// + /// + /// + public virtual void SetTemplate(InputArray edges, InputArray dx, InputArray dy, Point? templCenter = null) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (edges is null) + throw new ArgumentNullException(nameof(edges)); + if (dx is null) + throw new ArgumentNullException(nameof(dx)); + if (dy is null) + throw new ArgumentNullException(nameof(dy)); + edges.ThrowIfDisposed(); + dx.ThrowIfDisposed(); + dy.ThrowIfDisposed(); + var templCenterValue = templCenter.GetValueOrDefault(new Point(-1, -1)); + + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_setTemplate2( + ptr, edges.CvPtr, dx.CvPtr, dy.CvPtr, templCenterValue)); + + GC.KeepAlive(this); + GC.KeepAlive(edges); + GC.KeepAlive(dx); + GC.KeepAlive(dy); + } + + /// + /// find template on image + /// + /// + /// + /// + public virtual void Detect( + InputArray image, OutputArray positions, OutputArray? votes = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (positions is null) + throw new ArgumentNullException(nameof(positions)); + image.ThrowIfDisposed(); + positions.ThrowIfNotReady(); + votes?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_detect1( + ptr, image.CvPtr, positions.CvPtr, Cv2.ToPtr(votes))); + + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(positions); + GC.KeepAlive(votes); + positions.Fix(); + votes?.Fix(); + } + + /// + /// find template on image + /// + /// + /// + /// + /// + /// + public virtual void Detect( + InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray? votes = null) + { + if (edges is null) + throw new ArgumentNullException(nameof(edges)); + if (dx is null) + throw new ArgumentNullException(nameof(dx)); + if (dy is null) + throw new ArgumentNullException(nameof(dy)); + if (positions is null) + throw new ArgumentNullException(nameof(positions)); + edges.ThrowIfDisposed(); + dx.ThrowIfDisposed(); + dy.ThrowIfDisposed(); + positions.ThrowIfNotReady(); + votes?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHough_detect2( + ptr, edges.CvPtr, dx.CvPtr, dy.CvPtr, positions.CvPtr, Cv2.ToPtr(votes))); + + GC.KeepAlive(this); + GC.KeepAlive(edges); + GC.KeepAlive(dx); + GC.KeepAlive(dy); + GC.KeepAlive(positions); + GC.KeepAlive(votes); + positions.Fix(); + votes?.Fix(); + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/GeneralizedHoughBallard.cs b/src/OpenCvSharp/Modules/imgproc/GeneralizedHoughBallard.cs new file mode 100644 index 000000000..5b2d05578 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/GeneralizedHoughBallard.cs @@ -0,0 +1,111 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. +/// Pattern Recognition 13 (2): 111-122. +/// Detects position only without traslation and rotation +/// +public class GeneralizedHoughBallard : GeneralizedHough +{ + /// + /// cv::Ptr<T> object + /// + private Ptr? ptrObj; + + /// + /// + /// + private GeneralizedHoughBallard(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates a predefined GeneralizedHoughBallard object + /// + /// + public static GeneralizedHoughBallard Create() + { + NativeMethods.HandleException( + NativeMethods.imgproc_createGeneralizedHoughBallard(out var ptr)); + return new GeneralizedHoughBallard(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// R-Table levels. + /// + /// + public int Levels + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughBallard_getLevels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughBallard_setLevels(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The accumulator threshold for the template centers at the detection stage. + /// The smaller it is, the more false positions may be detected. + /// + /// + public int VotesThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughBallard_getVotesThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughBallard_setVotesThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Ptr_GeneralizedHoughBallard_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Ptr_GeneralizedHoughBallard_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/GeneralizedHoughGuil.cs b/src/OpenCvSharp/Modules/imgproc/GeneralizedHoughGuil.cs new file mode 100644 index 000000000..5b01479af --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/GeneralizedHoughGuil.cs @@ -0,0 +1,341 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). +/// Bidimensional shape detection using an invariant approach. +/// Pattern Recognition 32 (6): 1025-1038. +/// Detects position, translation and rotation +/// +public class GeneralizedHoughGuil : GeneralizedHough +{ + /// + /// cv::Ptr<T> object + /// + private Ptr? ptrObj; + + /// + /// + /// + private GeneralizedHoughGuil(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates a predefined GeneralizedHoughBallard object + /// + /// + public static GeneralizedHoughGuil Create() + { + NativeMethods.HandleException( + NativeMethods.imgproc_createGeneralizedHoughGuil(out var ptr)); + return new GeneralizedHoughGuil(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Angle difference in degrees between two points in feature. + /// + /// + public double Xi + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getXi(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setXi(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Feature table levels. + /// + /// + public int Levels + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getLevels(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setLevels(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Maximal difference between angles that treated as equal. + /// + /// + public double AngleEpsilon + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getAngleEpsilon(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setAngleEpsilon(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Minimal rotation angle to detect in degrees. + /// + /// + public double MinAngle + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getMinAngle(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setMinAngle(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Maximal rotation angle to detect in degrees. + /// + /// + public double MaxAngle + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getMaxAngle(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setMaxAngle(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Angle step in degrees. + /// + /// + public double AngleStep + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getAngleStep(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setAngleStep(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Angle votes threshold. + /// + /// + public int AngleThresh + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getAngleThresh(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setAngleThresh(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Minimal scale to detect. + /// + /// + public double MinScale + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getMinScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setMinScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Maximal scale to detect. + /// + /// + public double MaxScale + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getMaxScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setMaxScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Scale step. + /// + /// + public double ScaleStep + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getScaleStep(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setScaleStep(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Scale votes threshold. + /// + /// + public int ScaleThresh + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getScaleThresh(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setScaleThresh(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Position votes threshold. + /// + /// + public int PosThresh + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_getPosThresh(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_GeneralizedHoughGuil_setPosThresh(ptr, value)); + GC.KeepAlive(this); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Ptr_GeneralizedHoughGuil_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Ptr_GeneralizedHoughBallard_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/IntelligentScissorsMB.cs b/src/OpenCvSharp/Modules/imgproc/IntelligentScissorsMB.cs new file mode 100644 index 000000000..7b2ffdb99 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/IntelligentScissorsMB.cs @@ -0,0 +1,209 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Segmentation; + +/// +/// Intelligent Scissors image segmentation +/// +/// This class is used to find the path (contour) between two points +/// which can be used for image segmentation. +/// +/// Usage example: +/// @snippet snippets/imgproc_segmentation.cpp usage_example_intelligent_scissors +/// +/// Reference: Intelligent Scissors for Image Composition http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.138.3811&rep=rep1&type=pdf +/// algorithm designed by Eric N. Mortensen and William A. Barrett, Brigham Young University +/// @cite Mortensen95intelligentscissors +/// +public class IntelligentScissorsMB : DisposableCvObject +{ + /// + /// Constructor + /// + public IntelligentScissorsMB() + { + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_new(out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Specify weights of feature functions + /// + /// Consider keeping weights normalized (sum of weights equals to 1.0) + /// Discrete dynamic programming (DP) goal is minimization of costs between pixels. + /// + /// Specify cost of non-edge pixels (default: 0.43f) + /// Specify cost of gradient direction function (default: 0.43f) + /// Specify cost of gradient magnitude function (default: 0.14f) + /// + public IntelligentScissorsMB SetWeights( + float weightNonEdge, float weightGradientDirection, float weightGradientMagnitude) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_setWeights( + ptr, weightNonEdge, weightGradientDirection, weightGradientMagnitude)); + + return this; + } + + /// + /// Specify gradient magnitude max value threshold + /// + /// Zero limit value is used to disable gradient magnitude thresholding (default behavior, as described in original article). + /// Otherwize pixels with `gradient magnitude >= threshold` have zero cost. + /// + /// @note Thresholding should be used for images with irregular regions (to avoid stuck on parameters from high-contract areas, like embedded logos). + /// + /// Specify gradient magnitude max value threshold (default: 0, disabled) + /// + public IntelligentScissorsMB SetGradientMagnitudeMaxLimit( + float gradientMagnitudeThresholdMax = 0.0f) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_setGradientMagnitudeMaxLimit( + ptr, gradientMagnitudeThresholdMax)); + + return this; + } + + /// + /// Switch to "Laplacian Zero-Crossing" edge feature extractor and specify its parameters + /// + /// This feature extractor is used by default according to article. + /// + /// Implementation has additional filtering for regions with low-amplitude noise. + /// This filtering is enabled through parameter of minimal gradient amplitude (use some small value 4, 8, 16). + /// + /// @note Current implementation of this feature extractor is based on processing of grayscale images (color image is converted to grayscale image first). + /// + /// @note Canny edge detector is a bit slower, but provides better results (especially on color images): use setEdgeFeatureCannyParameters(). + /// + /// Minimal gradient magnitude value for edge pixels (default: 0, check is disabled) + /// + public IntelligentScissorsMB SetEdgeFeatureZeroCrossingParameters( + float gradientMagnitudeMinValue = 0.0f) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_setEdgeFeatureZeroCrossingParameters( + ptr, gradientMagnitudeMinValue)); + + return this; + } + + /// + /// Switch edge feature extractor to use Canny edge detector + /// Note: "Laplacian Zero-Crossing" feature extractor is used by default (following to original article) + /// + /// + /// + /// + /// + /// + public IntelligentScissorsMB SetEdgeFeatureCannyParameters( + double threshold1, double threshold2, + int apertureSize = 3, bool l2gradient = false) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_setEdgeFeatureCannyParameters( + ptr, threshold1, threshold2, apertureSize, l2gradient ? 1 : 0)); + + return this; + } + + /// + /// Specify input image and extract image features + /// + /// input image. Type is #CV_8UC1 / #CV_8UC3 + /// + public IntelligentScissorsMB ApplyImage(InputArray image) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_applyImage( + ptr, image.CvPtr)); + + return this; + } + + /// + /// Specify custom features of imput image + /// Customized advanced variant of applyImage() call. + /// + /// Specify cost of non-edge pixels. Type is CV_8UC1. Expected values are `{0, 1}`. + /// Specify gradient direction feature. Type is CV_32FC2. Values are expected to be normalized: `x^2 + y^2 == 1` + /// Specify cost of gradient magnitude function: Type is CV_32FC1. Values should be in range `[0, 1]`. + /// Optional parameter. Must be specified if subset of features is specified (non-specified features are calculated internally) + /// + public IntelligentScissorsMB ApplyImageFeatures( + InputArray nonEdge, InputArray gradientDirection, InputArray gradientMagnitude, + InputArray? image = null) + { + ThrowIfDisposed(); + if (nonEdge is null) + throw new ArgumentNullException(nameof(nonEdge)); + if (gradientDirection is null) + throw new ArgumentNullException(nameof(gradientDirection)); + if (gradientMagnitude is null) + throw new ArgumentNullException(nameof(gradientMagnitude)); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_applyImageFeatures( + ptr, nonEdge.CvPtr, gradientDirection.CvPtr, gradientMagnitude.CvPtr, image?.CvPtr ?? IntPtr.Zero)); + + return this; + } + + /// + /// Prepares a map of optimal paths for the given source point on the image + /// Note: applyImage() / applyImageFeatures() must be called before this call + /// + /// The source point used to find the paths + public void BuildMap(Point sourcePt) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_buildMap( + ptr, sourcePt)); + } + + /// + /// Extracts optimal contour for the given target point on the image + /// Note: buildMap() must be called before this call + /// + /// The target point + /// contour The list of pixels which contains optimal path between the source and the target points of the image. + /// Type is CV_32SC2 (compatible with `std::vector<Point>`) + /// Flag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point) + public void GetContour(Point targetPt, OutputArray contour, bool backward = false) + { + ThrowIfDisposed(); + if (contour is null) + throw new ArgumentNullException(nameof(contour)); + + NativeMethods.HandleException( + NativeMethods.imgproc_segmentation_IntelligentScissorsMB_getContour( + ptr, targetPt, contour.CvPtr, backward ? 1 : 0)); + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/LineIterator.cs b/src/OpenCvSharp/Modules/imgproc/LineIterator.cs new file mode 100644 index 000000000..01c1d28db --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/LineIterator.cs @@ -0,0 +1,298 @@ +using System.Collections; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Contrast Limited Adaptive Histogram Equalization +/// +public sealed class LineIterator : DisposableCvObject, IEnumerable +{ + private readonly Mat img; + private readonly Point pt1; + private readonly Point pt2; + private readonly PixelConnectivity connectivity; + private readonly bool leftToRight; + + /// + /// Constructor + /// + /// + /// + /// + /// + /// + /// + public LineIterator( + Mat img, + Point pt1, + Point pt2, + PixelConnectivity connectivity = PixelConnectivity.Connectivity8, + bool leftToRight = false) + { + this.img = img ?? throw new ArgumentNullException(nameof(img)); + this.pt1 = pt1; + this.pt2 = pt2; + this.connectivity = connectivity; + this.leftToRight = leftToRight; + } + + /// + /// Initializes the iterator + /// + /// + private void Initialize() + { + if (ptr != IntPtr.Zero) + throw new OpenCvSharpException("invalid state"); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_new( + img.CvPtr, pt1, pt2, (int)connectivity, leftToRight ? 1 : 0, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// + /// + /// + public IEnumerator GetEnumerator() + { + Dispose(); + Initialize(); + + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_count_get(ptr, out var count)); + for (var i = 0; i < count; i++) + { + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_getValuePosAndShiftToNext(ptr, out var value, out var pos)); + yield return new Pixel(pos, value); + GC.KeepAlive(this); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + #region Properties + + /// + /// + /// + public IntPtr Ptr + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_ptr_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public IntPtr Ptr0 + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_ptr0_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int Step + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_step_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int ElemSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_elemSize_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int Err + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_err_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int Count + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_count_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int MinusDelta + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_minusDelta_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int PlusDelta + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_plusDelta_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int MinusStep + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_minusStep_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + /// + /// + /// + public int PlusStep + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_LineIterator_plusStep_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + #endregion + +#pragma warning disable CA1034 + /// + /// LineIterator pixel data + /// + public class Pixel + { + /// + /// + /// + public unsafe byte* ValuePointer => (byte*)Ptr.ToPointer(); + + /// + /// + /// + public Point Pos { get; } + + /// + /// + /// + public IntPtr Ptr { get; } + + /// + /// + /// + /// + /// + public T GetValue() where T : struct + { + return Marshal.PtrToStructure(Ptr); + } + + /// + /// + /// + /// + /// + /// + public void SetValue(T value) where T : struct + { + Marshal.StructureToPtr(value, Ptr, false); + } + + /// + /// Constructor + /// + /// + /// + internal Pixel(Point pos, IntPtr ptr) + { + Pos = pos; + Ptr = ptr; + } + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/LineSegmentDetector.cs b/src/OpenCvSharp/Modules/imgproc/LineSegmentDetector.cs new file mode 100644 index 000000000..8f10a8c66 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/LineSegmentDetector.cs @@ -0,0 +1,198 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// Line segment detector class +/// +public class LineSegmentDetector : Algorithm +{ + /// + /// cv::Ptr<LineSegmentDetector> + /// + private readonly Ptr ptrObj; + + /// + /// + /// + protected LineSegmentDetector(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates a smart pointer to a LineSegmentDetector object and initializes it. + /// + /// The way found lines will be refined, see cv::LineSegmentDetectorModes + /// The scale of the image that will be used to find the lines. Range (0..1]. + /// Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale. + /// Bound to the quantization error on the gradient norm. + /// Gradient angle tolerance in degrees. + /// Detection threshold: -log10(NFA) \> log_eps. + /// Used only when advancent refinement is chosen. + /// Minimal density of aligned region points in the enclosing rectangle. + /// Number of bins in pseudo-ordering of gradient modulus. + /// + public static LineSegmentDetector Create( + LineSegmentDetectorModes refine = LineSegmentDetectorModes.RefineNone, + double scale = 0.8, double sigmaScale = 0.6, double quant = 2.0, double angTh = 22.5, + double logEps = 0, double densityTh = 0.7, int nBins = 1024) + { + IntPtr ptr = NativeMethods.imgproc_createLineSegmentDetector( + (int)refine, scale, sigmaScale, quant, angTh, logEps, densityTh, nBins); + return new LineSegmentDetector(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj.Dispose(); + base.DisposeManaged(); + } + + /// + /// Finds lines in the input image. + /// This is the output of the default parameters of the algorithm on the above shown image. + /// + /// A grayscale (CV_8UC1) input image. + /// A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. + /// Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient. + /// Vector of widths of the regions, where the lines are found. E.g. Width of line. + /// Vector of precisions with which the lines are found. + /// Vector containing number of false alarms in the line region, + /// with precision of 10%. The bigger the value, logarithmically better the detection. + public virtual void Detect(InputArray image, OutputArray lines, + OutputArray? width = null, OutputArray? prec = null, OutputArray? nfa = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + image.ThrowIfDisposed(); + lines.ThrowIfNotReady(); + width?.ThrowIfNotReady(); + prec?.ThrowIfNotReady(); + nfa?.ThrowIfNotReady(); + + NativeMethods.imgproc_LineSegmentDetector_detect_OutputArray(ptr, image.CvPtr, lines.CvPtr, + Cv2.ToPtr(width), Cv2.ToPtr(prec), Cv2.ToPtr(nfa)); + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(lines); + GC.KeepAlive(width); + GC.KeepAlive(prec); + GC.KeepAlive(nfa); + lines.Fix(); + width?.Fix(); + prec?.Fix(); + nfa?.Fix(); + } + + /// + /// Finds lines in the input image. + /// This is the output of the default parameters of the algorithm on the above shown image. + /// + /// A grayscale (CV_8UC1) input image. + /// A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. + /// Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient. + /// Vector of widths of the regions, where the lines are found. E.g. Width of line. + /// Vector of precisions with which the lines are found. + /// Vector containing number of false alarms in the line region, + /// with precision of 10%. The bigger the value, logarithmically better the detection. + public virtual void Detect(InputArray image, out Vec4f[] lines, + out double[] width, out double[] prec, out double[] nfa) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using (var linesVec = new VectorOfVec4f()) + using (var widthVec = new VectorOfDouble()) + using (var precVec = new VectorOfDouble()) + using (var nfaVec = new VectorOfDouble()) + { + NativeMethods.imgproc_LineSegmentDetector_detect_vector(ptr, image.CvPtr, + linesVec.CvPtr, widthVec.CvPtr, precVec.CvPtr, nfaVec.CvPtr); + + lines = linesVec.ToArray(); + width = widthVec.ToArray(); + prec = precVec.ToArray(); + nfa = nfaVec.ToArray(); + } + GC.KeepAlive(this); + GC.KeepAlive(image); + } + + /// + /// Draws the line segments on a given image. + /// + /// The image, where the liens will be drawn. + /// Should be bigger or equal to the image, where the lines were found. + /// A vector of the lines that needed to be drawn. + public virtual void DrawSegments(InputOutputArray image, InputArray lines) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + image.ThrowIfNotReady(); + lines.ThrowIfDisposed(); + + NativeMethods.imgproc_LineSegmentDetector_drawSegments(ptr, image.CvPtr, lines.CvPtr); + GC.KeepAlive(this); + GC.KeepAlive(image); + image.Fix(); + GC.KeepAlive(lines); + } + + /// + /// Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. + /// + /// The size of the image, where lines1 and lines2 were found. + /// The first group of lines that needs to be drawn. It is visualized in blue color. + /// The second group of lines. They visualized in red color. + /// Optional image, where the lines will be drawn. + /// The image should be color(3-channel) in order for lines1 and lines2 to be drawn + /// in the above mentioned colors. + /// + public virtual int CompareSegments( + Size size, InputArray lines1, InputArray lines2, InputOutputArray? image = null) + { + if (lines1 is null) + throw new ArgumentNullException(nameof(lines1)); + if (lines2 is null) + throw new ArgumentNullException(nameof(lines2)); + lines1.ThrowIfDisposed(); + lines2.ThrowIfDisposed(); + image?.ThrowIfNotReady(); + + var ret = NativeMethods.imgproc_LineSegmentDetector_compareSegments( + ptr, size, lines1.CvPtr, lines2.CvPtr, Cv2.ToPtr(image)); + GC.KeepAlive(this); + GC.KeepAlive(lines1); + GC.KeepAlive(lines2); + GC.KeepAlive(image); + image?.Fix(); + + return ret; + } + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + var res = NativeMethods.imgproc_Ptr_LineSegmentDetector_get(ptr); + GC.KeepAlive(this); + return res; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.imgproc_Ptr_LineSegmentDetector_delete(ptr); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs b/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs new file mode 100644 index 000000000..2313369c4 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs @@ -0,0 +1,111 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// circle structure retrieved from cvHoughCircle +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public struct CircleSegment : IEquatable +{ + #region Fields + + /// + /// Center coordinate of the circle + /// + public Point2f Center; + + /// + /// Radius + /// + public float Radius; + + #endregion + + #region Init + + /// + /// Constructor + /// + /// center + /// radius + public CircleSegment(Point2f center, float radius) + { + Center = center; + Radius = radius; + } + + #endregion + + #region Operators + + /// + /// Specifies whether this object contains the same members as the specified Object. + /// + /// The Object to test. + /// This method returns true if obj is the same type as this object and has the same members as this object. + public bool Equals(CircleSegment other) + { + return (Center == other.Center && + Math.Abs(Radius - other.Radius) < 1e-9); + } + + /// + /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. + /// + /// A Point to compare. + /// A Point to compare. + /// This operator returns true if the members of left and right are equal; otherwise, false. + public static bool operator ==(CircleSegment lhs, CircleSegment rhs) + { + return lhs.Equals(rhs); + } + + /// + /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. + /// + /// A Point to compare. + /// A Point to compare. + /// This operator returns true if the members of left and right are unequal; otherwise, false. + public static bool operator !=(CircleSegment lhs, CircleSegment rhs) + { + return !lhs.Equals(rhs); + } + + #endregion + + #region Overrided Methods + + /// + /// Specifies whether this object contains the same members as the specified Object. + /// + /// The Object to test. + /// This method returns true if obj is the same type as this object and has the same members as this object. + public override bool Equals(object? obj) + { + return base.Equals(obj); + } + + /// + /// Returns a hash code for this object. + /// + /// An integer value that specifies a hash value for this object. + public override int GetHashCode() + { + return Center.GetHashCode() + Radius.GetHashCode(); + } + + /// + /// Converts this object to a human readable string. + /// + /// A string that represents this object. + public override string ToString() + { + return $"CvCircleSegment (Center:{Center} Radius:{Radius})"; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/imgproc/Model/HierarchyIndex.cs b/src/OpenCvSharp/Modules/imgproc/Model/HierarchyIndex.cs new file mode 100644 index 000000000..6b7c8af8a --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Model/HierarchyIndex.cs @@ -0,0 +1,80 @@ +namespace OpenCvSharp; + +/// +/// Information about the image topology for cv::findContours +/// +public class HierarchyIndex +{ + /// + /// + /// + public int Next { get; set; } + + /// + /// + /// + public int Previous { get; set; } + + /// + /// + /// + public int Child { get; set; } + + /// + /// + /// + public int Parent { get; set; } + + /// + /// + /// + public HierarchyIndex() + { + Next = 0; + Previous = 0; + Child = 0; + Parent = 0; + } + + /// + /// + /// + /// + /// + /// + /// + public HierarchyIndex(int next, int previous, int child, int parent) + { + Next = next; + Previous = previous; + Child = child; + Parent = parent; + } + + /// + /// + /// + /// + /// + // ReSharper disable once InconsistentNaming + public static HierarchyIndex FromVec4i(Vec4i vec) + { + return new HierarchyIndex + { + Next = vec.Item0, + Previous = vec.Item1, + Child = vec.Item2, + Parent = vec.Item3 + }; + } + + /// + /// + /// + /// + // ReSharper disable once InconsistentNaming + public Vec4i ToVec4i() + { + return new Vec4i(Next, Previous, Child, Parent); + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs b/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs new file mode 100644 index 000000000..d5f12359a --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs @@ -0,0 +1,149 @@ +namespace OpenCvSharp; + +/// +/// 2-dimentional line vector +/// +public class Line2D +{ + #region Properties + + /// + /// The X component of the normalized vector collinear to the line + /// + public double Vx { get; } + + /// + /// The Y component of the normalized vector collinear to the line + /// + public double Vy { get; } + + /// + /// X-coordinate of some point on the line + /// + public double X1 { get; } + + /// + /// Y-coordinate of some point on the line + /// + public double Y1 { get; } + + #endregion + + #region Init + + /// + /// Initializes this object + /// + /// The X component of the normalized vector collinear to the line + /// The Y component of the normalized vector collinear to the line + /// Z-coordinate of some point on the line + /// Z-coordinate of some point on the line + public Line2D(double vx, double vy, double x1, double y1) + { + Vx = vx; + Vy = vy; + X1 = x1; + Y1 = y1; + } + + /// + /// Initializes by cvFitLine output + /// + /// The returned value from cvFitLineparam> + public Line2D(float[] line) + { + if (line is null) + throw new ArgumentNullException(nameof(line)); + + Vx = line[0]; + Vy = line[1]; + X1 = line[2]; + Y1 = line[3]; + } + + #endregion + + #region Methods + + /// + /// + /// + /// + public double GetVectorRadian() + { + return Math.Atan2(Vy, Vx); + } + + /// + /// + /// + /// + public double GetVectorAngle() + { + return GetVectorRadian() * 180 / Math.PI; + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + public double Distance(Point point) + { + return Distance(point.X, point.Y); + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + public double Distance(Point2f point) + { + return Distance(point.X, point.Y); + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + public double Distance(Point2d point) + { + return Distance(point.X, point.Y); + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + /// + public double Distance(double x, double y) + { + // 公式で + var m = Vy / Vx; + var n = Y1 - m * X1; + return Math.Abs(y - m * x - n) / Math.Sqrt(1 + m * m); + } + + /// + /// Fits this line to the specified size (for drawing) + /// + /// Width of fit size + /// Height of fit size + /// 1st edge point of fitted line + /// 2nd edge point of fitted line + public void FitSize(int width, int height, out Point pt1, out Point pt2) + { + double t = (width + height); + pt1 = new Point + { + X = (int)Math.Round(X1 - Vx*t), + Y = (int)Math.Round(Y1 - Vy * t) + }; + pt2 = new Point + { + X = (int)Math.Round(X1 + Vx * t), + Y = (int)Math.Round(Y1 + Vy * t) + }; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs b/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs new file mode 100644 index 000000000..ad392a05d --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs @@ -0,0 +1,198 @@ +namespace OpenCvSharp; + +/// +/// A 3-dimensional line object +/// +public class Line3D +{ + /// + /// The X component of the normalized vector collinear to the line + /// + public double Vx { get; } + + /// + /// The Y component of the normalized vector collinear to the line + /// + public double Vy { get; } + + /// + /// The Z component of the normalized vector collinear to the line + /// + public double Vz { get; } + + /// + /// X-coordinate of some point on the line + /// + public double X1 { get; } + + /// + /// Y-coordinate of some point on the line + /// + public double Y1 { get; } + + /// + /// Z-coordinate of some point on the line + /// + public double Z1 { get; } + + /// + /// Initializes this object + /// + /// The X component of the normalized vector collinear to the line + /// The Y component of the normalized vector collinear to the line + /// The Z component of the normalized vector collinear to the line + /// Z-coordinate of some point on the line + /// Z-coordinate of some point on the line + /// Z-coordinate of some point on the line + public Line3D(double vx, double vy, double vz, double x1, double y1, double z1) + { + Vx = vx; + Vy = vy; + Vz = vz; + X1 = x1; + Y1 = y1; + Z1 = z1; + } + + /// + /// Initializes by cvFitLine output + /// + /// The returned value from cvFitLineparam> + public Line3D(float[] line) + { + if (line is null) + throw new ArgumentNullException(nameof(line)); + if (line.Length != 6) + throw new ArgumentException("array.Length != 6", nameof(line)); + + Vx = line[0]; + Vy = line[1]; + Vz = line[2]; + X1 = line[3]; + Y1 = line[4]; + Z1 = line[5]; + } + + /// + /// Perpendicular foot + /// + /// + public Point3d PerpendicularFoot(Point3f point) + { + return PerpendicularFoot(point.X, point.Y, point.Z); + } + + /// + /// Perpendicular foot + /// + /// + public Point3d PerpendicularFoot(Point3d point) + { + return PerpendicularFoot(point.X, point.Y, point.Z); + } + + /// + /// Perpendicular foot + /// + /// + /// + /// + public Point3d PerpendicularFoot(double x, double y, double z) + { + var xa = X1; + var ya = Y1; + var za = Z1; + var xb = X1 + Vx; + var yb = Y1 + Vy; + var zb = Z1 + Vz; + + var k = ((x - xa)*(xb - xa) + (y - ya)*(yb - ya) + (z - za)*(zb - za))/ + (Math.Pow(xb - xa, 2) + Math.Pow(yb - ya, 2) + Math.Pow(zb - za, 2)); + + var hx = k*xb+(1-k)*xa; + var hy = k*yb+(1-k)*ya; + var hz = k*zb+(1-k)*za; + return new Point3d(hx, hy, hz); + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + public double Distance(Point3f point) + { + return Distance(point.X, point.Y, point.Z); + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + public double Distance(Point3d point) + { + return Distance(point.X, point.Y, point.Z); + } + + /// + /// Returns the distance between this line and the specified point + /// + /// + /// + /// + public double Distance(double x, double y, double z) + { + var p = new Point3d(x, y, z); + var a = new Point3d(X1, Y1, Z1); + var b = new Point3d(X1 + Vx, Y1 + Vy, Z1 + Vz); + var ab = new Point3d { X = b.X - a.X, Y = b.Y - a.Y, Z = b.Z - a.Z }; + var ap = new Point3d { X = p.X - a.X, Y = p.Y - a.Y, Z = p.Z - a.Z }; + + // AB, APを外積 -> 平行四辺形Dの面積 + var d = VectorLength(CrossProduct(ab, ap)); + // AB間の距離 + var l = VertexDistance(a, b); + // 平行四辺形の高さ(垂線) + var h = d / l; + return h; + } + + /// + /// ベクトルの外積 + /// + /// + /// + /// + private static Point3d CrossProduct(Point3d vl, Point3d vr) + { + var ret = new Point3d + { + X = (vl.Y*vr.Z) - (vl.Z*vr.Y), + Y = (vl.Z*vr.X) - (vl.X*vr.Z), + Z = (vl.X*vr.Y) - (vl.Y*vr.X) + }; + return ret; + } + + /// + /// ベクトルの長さ(原点からの距離) + /// + /// + /// + private static double VectorLength(Point3d v) + { + return Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z); + } + + /// + /// 2点間(2ベクトル)の距離 + /// + /// + /// + /// + private static double VertexDistance(Point3d p1, Point3d p2) + { + return Math.Sqrt((p2.X - p1.X) * (p2.X - p1.X) + + (p2.Y - p1.Y) * (p2.Y - p1.Y) + + (p2.Z - p1.Z) * (p2.Z - p1.Z)); + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs new file mode 100644 index 000000000..cbc929ed6 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs @@ -0,0 +1,310 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// Line segment structure retrieved from cvHoughLines2 +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public struct LineSegmentPoint : IEquatable +{ + /// + /// 1st Point + /// + public Point P1; + + /// + /// 2nd Point + /// + public Point P2; + + /// + /// Constructor + /// + /// 1st Point + /// 2nd Point + public LineSegmentPoint(Point p1, Point p2) + { + P1 = p1; + P2 = p2; + } + + #region Operators + + /// + /// Specifies whether this object contains the same members as the specified Object. + /// + /// The Object to test. + /// This method returns true if obj is the same type as this object and has the same members as this object. + public bool Equals(LineSegmentPoint other) + { + return (P1 == other.P1 && P2 == other.P2); + } + + /// + /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. + /// + /// A Point to compare. + /// A Point to compare. + /// This operator returns true if the members of left and right are equal; otherwise, false. + public static bool operator ==(LineSegmentPoint lhs, LineSegmentPoint rhs) + { + return lhs.Equals(rhs); + } + + /// + /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. + /// + /// A Point to compare. + /// A Point to compare. + /// This operator returns true if the members of left and right are unequal; otherwise, false. + public static bool operator !=(LineSegmentPoint lhs, LineSegmentPoint rhs) + { + return !lhs.Equals(rhs); + } + + #endregion + + #region Overrided methods + + /// + /// Specifies whether this object contains the same members as the specified Object. + /// + /// The Object to test. + /// This method returns true if obj is the same type as this object and has the same members as this object. + public override bool Equals(object? obj) + { + return base.Equals(obj); + } + + /// + /// Returns a hash code for this object. + /// + /// An integer value that specifies a hash value for this object. + public override int GetHashCode() + { + return P1.GetHashCode() + P2.GetHashCode(); + } + + /// + /// Converts this object to a human readable string. + /// + /// A string that represents this object. + public override string ToString() + { + return $"CvLineSegmentPoint (P1:{P1} P2:{P2})"; + } + + #endregion + + #region Methods + + #region Line and Line + + /// + /// Calculates a intersection of the specified two lines + /// + /// + /// + /// + public static Point? LineIntersection(LineSegmentPoint line1, LineSegmentPoint line2) + { + var x1 = line1.P1.X; + var y1 = line1.P1.Y; + var f1 = line1.P2.X - line1.P1.X; + var g1 = line1.P2.Y - line1.P1.Y; + var x2 = line2.P1.X; + var y2 = line2.P1.Y; + var f2 = line2.P2.X - line2.P1.X; + var g2 = line2.P2.Y - line2.P1.Y; + + double det = f2*g1 - f1*g2; + if (Math.Abs(det) < 1e-9) + { + return null; + } + + var dx = x2 - x1; + var dy = y2 - y1; + var t1 = (f2*dy - g2*dx)/det; + //var t2 = (f1*dy - g1*dx)/det; + + return new Point + { + X = (int) Math.Round(x1 + (f1*t1)), + Y = (int) Math.Round(y1 + (g1*t1)) + }; + } + + /// + /// Calculates a intersection of the specified two lines + /// + /// + /// + public Point? LineIntersection(LineSegmentPoint line) + { + return LineIntersection(this, line); + } + + #endregion + + #region Segment and Segment + + /// + /// Calculates a intersection of the specified two segments + /// + /// + /// + /// + public static Point? SegmentIntersection(LineSegmentPoint seg1, LineSegmentPoint seg2) + { + if (IntersectedSegments(seg1, seg2)) + return LineIntersection(seg1, seg2); + else + return null; + } + + /// + /// Calculates a intersection of the specified two segments + /// + /// + /// + public Point? SegmentIntersection(LineSegmentPoint seg) + { + return SegmentIntersection(this, seg); + } + + /// + /// Returns a boolean value indicating whether the specified two segments intersect. + /// + /// + /// + /// + public static bool IntersectedSegments(LineSegmentPoint seg1, LineSegmentPoint seg2) + { + var p1 = seg1.P1; + var p2 = seg1.P2; + var p3 = seg2.P1; + var p4 = seg2.P2; + + checked + { + if (p1.X >= p2.X) + { + if ((p1.X < p3.X && p1.X < p4.X) || (p2.X > p3.X && p2.X > p4.X)) + return false; + } + else + { + if ((p2.X < p3.X && p2.X < p4.X) || (p1.X > p3.X && p1.X > p4.X)) + return false; + } + if (p1.Y >= p2.Y) + { + if ((p1.Y < p3.Y && p1.Y < p4.Y) || (p2.Y > p3.Y && p2.Y > p4.Y)) + return false; + } + else + { + if ((p2.Y < p3.Y && p2.Y < p4.Y) || (p1.Y > p3.Y && p1.Y > p4.Y)) + return false; + } + + if (((long) (p1.X - p2.X)*(p3.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p3.X))* + ((long) (p1.X - p2.X)*(p4.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p4.X)) > 0) + return false; + if (((long) (p3.X - p4.X)*(p1.Y - p3.Y) + (long) (p3.Y - p4.Y)*(p3.X - p1.X))* + ((long) (p3.X - p4.X)*(p2.Y - p3.Y) + (long) (p3.Y - p4.Y)*(p3.X - p2.X)) > 0) + return false; + } + return true; + } + + /// + /// Returns a boolean value indicating whether the specified two segments intersect. + /// + /// + /// + public bool IntersectedSegments(LineSegmentPoint seg) + { + return IntersectedSegments(this, seg); + } + + #endregion + + #region Line and Segment + + /// + /// Returns a boolean value indicating whether a line and a segment intersect. + /// + /// Line + /// Segment + /// + public static bool IntersectedLineAndSegment(LineSegmentPoint line, LineSegmentPoint seg) + { + var p1 = line.P1; + var p2 = line.P2; + var p3 = seg.P1; + var p4 = seg.P2; + if (((long) (p1.X - p2.X)*(p3.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p3.X))* + ((long) (p1.X - p2.X)*(p4.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p4.X)) > 0) + { + return false; + } + return true; + } + + /// + /// Calculates a intersection of a line and a segment + /// + /// + /// + /// + public static Point? LineAndSegmentIntersection(LineSegmentPoint line, LineSegmentPoint seg) + { + if (IntersectedLineAndSegment(line, seg)) + return LineIntersection(line, seg); + else + return null; + } + + #endregion + + /// + /// + /// + /// + public double Length() + { + return P1.DistanceTo(P2); + } + + /// + /// Translates the Point by the specified amount. + /// + /// The amount to offset the x-coordinate. + /// The amount to offset the y-coordinate. + /// + public void Offset(int x, int y) + { + P1.X += x; + P1.Y += y; + P2.X += x; + P2.Y += y; + } + + /// + /// Translates the Point by the specified amount. + /// + /// The Point used offset this CvPoint. + /// + public void Offset(Point p) + { + Offset(p.X, p.Y); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs new file mode 100644 index 000000000..c4eb2c835 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs @@ -0,0 +1,211 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// Polar line segment retrieved from cvHoughLines2 +/// +[Serializable] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +public struct LineSegmentPolar : IEquatable +{ + /// + /// Length of the line + /// + public float Rho; + + /// + /// Angle of the line (radian) + /// + public float Theta; + + /// + /// Constructor + /// + /// Length of the line + /// Angle of the line (radian) + public LineSegmentPolar(float rho, float theta) + { + Rho = rho; + Theta = theta; + } + + #region Operators + + /// + /// Specifies whether this object contains the same members as the specified Object. + /// + /// The Object to test. + /// This method returns true if obj is the same type as this object and has the same members as this object. + public bool Equals(LineSegmentPolar other) + { + return (Math.Abs(Rho - other.Rho) < 1e-9 && + Math.Abs(Theta - other.Theta) < 1e-9); + } + + /// + /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. + /// + /// A Point to compare. + /// A Point to compare. + /// This operator returns true if the members of left and right are equal; otherwise, false. + public static bool operator ==(LineSegmentPolar lhs, LineSegmentPolar rhs) + { + return lhs.Equals(rhs); + } + + /// + /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. + /// + /// A Point to compare. + /// A Point to compare. + /// This operator returns true if the members of left and right are unequal; otherwise, false. + public static bool operator !=(LineSegmentPolar lhs, LineSegmentPolar rhs) + { + return !lhs.Equals(rhs); + } + + #endregion + + #region Overrided methods + + /// + /// Specifies whether this object contains the same members as the specified Object. + /// + /// The Object to test. + /// This method returns true if obj is the same type as this object and has the same members as this object. + public override bool Equals(object? obj) + { + return base.Equals(obj); + } + + /// + /// Returns a hash code for this object. + /// + /// An integer value that specifies a hash value for this object. + public override int GetHashCode() + { + return Rho.GetHashCode() + Theta.GetHashCode(); + } + + /// + /// Converts this object to a human readable string. + /// + /// A string that represents this object. + public override string ToString() + { + return $"CvLineSegmentPolar (Rho:{Rho} Theta:{Theta})"; + } + #endregion + + #region Methods + + /// + /// Calculates a intersection of the specified two lines + /// + /// + /// + /// + public static Point? LineIntersection(LineSegmentPolar line1, LineSegmentPolar line2) + { + var seg1 = line1.ToSegmentPoint(5000); + var seg2 = line2.ToSegmentPoint(5000); + return LineSegmentPoint.LineIntersection(seg1, seg2); + } + + /// + /// Calculates a intersection of the specified two lines + /// + /// + /// + public Point? LineIntersection(LineSegmentPolar line) + { + return LineIntersection(this, line); + } + + /// + /// Convert To LineSegmentPoint + /// + /// + /// + public LineSegmentPoint ToSegmentPoint(double scale) + { + var cos = Math.Cos(Theta); + var sin = Math.Sin(Theta); + var x0 = cos * Rho; + var y0 = sin * Rho; + var p1 = new Point { X = (int)Math.Round(x0 + scale * -sin), Y = (int)Math.Round(y0 + scale * cos) }; + var p2 = new Point { X = (int)Math.Round(x0 - scale * -sin), Y = (int)Math.Round(y0 - scale * cos) }; + return new LineSegmentPoint(p1, p2); + } + + /// + /// Converts to a line segment with the specified x coordinates at both ends + /// + /// + /// + /// + public LineSegmentPoint ToSegmentPointX(int x1, int x2) + { + if (x1 > x2) + throw new ArgumentException($"{nameof(x1)} > {nameof(x2)}"); + + var y1 = YPosOfLine(x1); + var y2 = YPosOfLine(x2); + if (!y1.HasValue || !y2.HasValue) + throw new OpenCvSharpException("Failed to determine y coordinate."); + + var p1 = new Point(x1, y1.Value); + var p2 = new Point(x2, y2.Value); + return new LineSegmentPoint(p1, p2); + } + + /// + /// Converts to a line segment with the specified y coordinates at both ends + /// + /// + /// + /// + public LineSegmentPoint ToSegmentPointY(int y1, int y2) + { + if (y1 > y2) + throw new ArgumentException($"{nameof(y1)} > {nameof(y2)}"); + + var x1 = XPosOfLine(y1); + var x2 = XPosOfLine(y2); + if (!x1.HasValue || !x2.HasValue) + throw new OpenCvSharpException("Failed to determine x coordinate."); + + var p1 = new Point(x1.Value, y1); + var p2 = new Point(x2.Value, y2); + return new LineSegmentPoint(p1, p2); + } + + /// + /// + /// + /// + /// + public int? XPosOfLine(int y) + { + var axis = new LineSegmentPolar(y, (float)(Math.PI / 2)); // 垂線90度 = x軸に平行 + var node = LineIntersection(axis); + return node?.X; + } + + /// + /// + /// + /// + /// + public int? YPosOfLine(int x) + { + var axis = new LineSegmentPolar(x, 0); // 垂線0度 = y軸に平行 + var node = LineIntersection(axis); + return node?.Y; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/imgproc/Moments.cs b/src/OpenCvSharp/Modules/imgproc/Moments.cs new file mode 100644 index 000000000..219a9fa55 --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Moments.cs @@ -0,0 +1,263 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +#pragma warning disable CA1051 + +namespace OpenCvSharp; + +/// +/// Raster image moments +/// +public class Moments +{ + /// + /// spatial moments + /// + public double M00, M10, M01, M20, M11, M02, M30, M21, M12, M03; + + /// + /// central moments + /// + public double Mu20, Mu11, Mu02, Mu30, Mu21, Mu12, Mu03; + + /// + /// central normalized moments + /// + public double Nu20, Nu11, Nu02, Nu30, Nu21, Nu12, Nu03; + + #region Init & Disposal + /// + /// Default constructor. + /// All moment values are set to 0. + /// + public Moments() + { + M00 = M10 = M01 = M20 = M11 = M02 = M30 = M21 = M12 = M03 = + Mu20 = Mu11 = Mu02 = Mu30 = Mu21 = Mu12 = Mu03 = + Nu20 = Nu11 = Nu02 = Nu30 = Nu21 = Nu12 = Nu03 = 0.0; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Moments(double m00, double m10, double m01, double m20, double m11, + double m02, double m30, double m21, double m12, double m03) + { + Initialize(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (single-channel, 8-bit or floating-point + /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f ) + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public Moments(InputArray array, bool binaryImage = false) + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + array.ThrowIfDisposed(); + InitializeFromInputArray(array, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (8-bit) 2D array + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public Moments(byte[,] array, bool binaryImage = false) + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + var rows = array.GetLength(0); + var cols = array.GetLength(1); + using var arrayMat = Mat.FromPixelData(rows, cols, MatType.CV_8UC1, array); + InitializeFromInputArray(arrayMat, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (floating-point) 2D array + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public Moments(float[,] array, bool binaryImage = false) + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + var rows = array.GetLength(0); + var cols = array.GetLength(1); + using var arrayMat = Mat.FromPixelData(rows, cols, MatType.CV_32FC1, array); + InitializeFromInputArray(arrayMat, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// Array of 2D points + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public Moments(IEnumerable array, bool binaryImage = false) + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + var points = array.ToArray(); + using var pointsMat = Mat.FromPixelData(points.Length, 1, MatType.CV_32SC2, points); + InitializeFromInputArray(pointsMat, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// Array of 2D points + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + public Moments(IEnumerable array, bool binaryImage = false) + { + if (array is null) + throw new ArgumentNullException(nameof(array)); + var points = array.ToArray(); + using var pointsMat = Mat.FromPixelData(points.Length, 1, MatType.CV_32FC2, points); + InitializeFromInputArray(pointsMat, binaryImage); + } + + /// + /// Calculates all of the moments + /// up to the third order of a polygon or rasterized shape. + /// + /// A raster image (single-channel, 8-bit or floating-point + /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f ) + /// If it is true, then all the non-zero image pixels are treated as 1’s + /// + private void InitializeFromInputArray(InputArray array, bool binaryImage) + { + NativeMethods.HandleException( + NativeMethods.imgproc_moments(array.CvPtr, binaryImage ? 1 : 0, out var m)); + GC.KeepAlive(array); + Initialize(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void Initialize(double m00, double m10, double m01, double m20, double m11, + double m02, double m30, double m21, double m12, double m03) + { + M00 = m00; + M10 = m10; + M01 = m01; + M20 = m20; + M11 = m11; + M02 = m02; + M30 = m30; + M21 = m21; + M12 = m12; + M03 = m03; + + double cx = 0, cy = 0, invM00 = 0; + if (Math.Abs(M00) > double.Epsilon) + { + invM00 = 1.0 / M00; + cx = M10 * invM00; + cy = M01 * invM00; + } + + Mu20 = M20 - M10 * cx; + Mu11 = M11 - M10 * cy; + Mu02 = M02 - M01 * cy; + + Mu30 = M30 - cx * (3 * Mu20 + cx * M10); + Mu21 = M21 - cx * (2 * Mu11 + cx * M01) - cy * Mu20; + Mu12 = M12 - cy * (2 * Mu11 + cy * M10) - cx * Mu02; + Mu03 = M03 - cy * (3 * Mu02 + cy * M01); + + var invSqrtM00 = Math.Sqrt(Math.Abs(invM00)); + var s2 = invM00 * invM00; + var s3 = s2 * invSqrtM00; + + Nu20 = Mu20 * s2; + Nu11 = Mu11 * s2; + Nu02 = Mu02 * s2; + Nu30 = Mu30 * s3; + Nu21 = Mu21 * s3; + Nu12 = Mu12 * s3; + Nu03 = Mu03 * s3; + } + + #endregion + + #region Methods + /// + /// computes 7 Hu invariants from the moments + /// + /// + public double[] HuMoments() + { + var hu = new double[7]; + var t0 = Nu30 + Nu12; + var t1 = Nu21 + Nu03; + + double q0 = t0 * t0, q1 = t1 * t1; + + var n4 = 4 * Nu11; + var s = Nu20 + Nu02; + var d = Nu20 - Nu02; + + hu[0] = s; + hu[1] = d * d + n4 * Nu11; + hu[3] = q0 + q1; + hu[5] = d * (q0 - q1) + n4 * t0 * t1; + + t0 *= q0 - 3 * q1; + t1 *= 3 * q0 - q1; + + q0 = Nu30 - 3 * Nu12; + q1 = 3 * Nu21 - Nu03; + + hu[2] = q0 * q0 + q1 * q1; + hu[4] = q0 * t0 + q1 * t1; + hu[6] = q1 * t0 - q0 * t1; + return hu; + } + + #endregion + +#pragma warning disable CA1034 +#pragma warning disable 1591 + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] + public struct NativeStruct + { + public double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ + public double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ + public double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ + } +} diff --git a/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs b/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs new file mode 100644 index 000000000..67cfe59ca --- /dev/null +++ b/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs @@ -0,0 +1,394 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo + +namespace OpenCvSharp; + +/// +/// Planar Subdivision +/// +public class Subdiv2D : DisposableCvObject +{ + #region Init and Disposal + + /// + /// Creates an empty Subdiv2D object. + /// To create a new empty Delaunay subdivision you need to use the #initDelaunay function. + /// + public Subdiv2D() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_new1(out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(Subdiv2D)}"); + } + + /// + /// Creates an empty Subdiv2D object. + /// + /// Rectangle that includes all of the 2D points that are to be added to the subdivision. + public Subdiv2D(Rect rect) + { + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_new2(rect, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException($"Failed to create {nameof(Subdiv2D)}"); + } + + /// + /// Clean up any resources being used. + /// + public void Release() + { + Dispose(); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Constants + +#pragma warning disable 1591 + public const int + PTLOC_ERROR = -2, + PTLOC_OUTSIDE_RECT = -1, + PTLOC_INSIDE = 0, + PTLOC_VERTEX = 1, + PTLOC_ON_EDGE = 2; + public const int + NEXT_AROUND_ORG = 0x00, + NEXT_AROUND_DST = 0x22, + PREV_AROUND_ORG = 0x11, + PREV_AROUND_DST = 0x33, + NEXT_AROUND_LEFT = 0x13, + NEXT_AROUND_RIGHT = 0x31, + PREV_AROUND_LEFT = 0x20, + PREV_AROUND_RIGHT = 0x02; +#pragma warning restore 1591 + + #endregion + + #region Methods + + /// + /// Creates a new empty Delaunay subdivision + /// + /// Rectangle that includes all of the 2D points that are to be added to the subdivision. + public void InitDelaunay(Rect rect) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_initDelaunay(ptr, rect)); + GC.KeepAlive(this); + } + + /// + /// Insert a single point into a Delaunay triangulation. + /// + /// Point to insert. + /// + public int Insert(Point2f pt) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_insert1(ptr, pt, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Insert multiple points into a Delaunay triangulation. + /// + /// Points to insert. + public void Insert(IEnumerable ptVec) + { + ThrowIfDisposed(); + if (ptVec is null) + throw new ArgumentNullException(nameof(ptVec)); + + var ptVecArray = ptVec.CastOrToArray(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_insert2(ptr, ptVecArray, ptVecArray.Length)); + + GC.KeepAlive(this); + } + + /// + /// Returns the location of a point within a Delaunay triangulation. + /// + /// Point to locate. + /// Output edge that the point belongs to or is located to the right of it. + /// Optional output vertex the input point coincides with. + /// an integer which specify one of the following five cases for point location: + /// - The point falls into some facet. The function returns #PTLOC_INSIDE and edge will contain one of edges of the facet. + /// - The point falls onto the edge. The function returns #PTLOC_ON_EDGE and edge will contain this edge. + /// - The point coincides with one of the subdivision vertices. The function returns #PTLOC_VERTEX and vertex will contain a pointer to the vertex. + /// - The point is outside the subdivision reference rectangle. The function returns #PTLOC_OUTSIDE_RECT and no pointers are filled. + /// - One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error processing mode is selected, #PTLOC_ERROR is returned. + public int Locate(Point2f pt, out int edge, out int vertex) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_locate(ptr, pt, out edge, out vertex, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Finds the subdivision vertex closest to the given point. + /// + /// Input point. + /// Output subdivision vertex point. + /// vertex ID. + public int FindNearest(Point2f pt, out Point2f nearestPt) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_findNearest(ptr, pt, out nearestPt, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns a list of all edges. + /// + /// Output vector. + public Vec4f[] GetEdgeList() + { + ThrowIfDisposed(); + using var vec = new VectorOfVec4f(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_getEdgeList(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + + /// + /// Returns a list of the leading edge ID connected to each triangle. + /// The function gives one edge ID for each triangle. + /// + /// Output vector. + public int[] GetLeadingEdgeList() + { + ThrowIfDisposed(); + + using var leadingEdgeList = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_getLeadingEdgeList(ptr, leadingEdgeList.CvPtr)); + + GC.KeepAlive(this); + return leadingEdgeList.ToArray(); + } + + /// + /// Returns a list of all triangles. + /// + /// Output vector. + public Vec6f[] GetTriangleList() + { + ThrowIfDisposed(); + using var vec = new VectorOfVec6f(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_getTriangleList(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + + /// + /// Returns a list of all Voronoi facets. + /// + /// Vector of vertices IDs to consider. For all vertices you can pass empty vector. + /// Output vector of the Voronoi facets. + /// Output vector of the Voronoi facets center points. + public void GetVoronoiFacetList(IEnumerable? idx, out Point2f[][] facetList, out Point2f[] facetCenters) + { + ThrowIfDisposed(); + + int[]? idxArray = idx?.CastOrToArray(); + using var facetListVec = new VectorOfVectorPoint2f(); + using var facetCentersVec = new VectorOfPoint2f(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_getVoronoiFacetList( + ptr, idxArray, idxArray?.Length ?? 0, facetListVec.CvPtr, facetCentersVec.CvPtr)); + GC.KeepAlive(this); + facetList = facetListVec.ToArray(); + facetCenters = facetCentersVec.ToArray(); + } + + /// + /// Returns vertex location from vertex ID. + /// + /// vertex ID. + /// The first edge ID which is connected to the vertex. + /// vertex (x,y) + public Point2f GetVertex(int vertex, out int firstEdge) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_getVertex(ptr, vertex, out firstEdge, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns one of the edges related to the given edge. + /// + /// Subdivision edge ID. + /// Parameter specifying which of the related edges to return. + /// The following values are possible: + /// - NEXT_AROUND_ORG next around the edge origin ( eOnext on the picture below if e is the input edge) + /// - NEXT_AROUND_DST next around the edge vertex ( eDnext ) + /// - PREV_AROUND_ORG previous around the edge origin (reversed eRnext ) + /// - PREV_AROUND_DST previous around the edge destination (reversed eLnext ) + /// - NEXT_AROUND_LEFT next around the left facet ( eLnext ) + /// - NEXT_AROUND_RIGHT next around the right facet ( eRnext ) + /// - PREV_AROUND_LEFT previous around the left facet (reversed eOnext ) + /// - PREV_AROUND_RIGHT previous around the right facet (reversed eDnext ) + /// + public int GetEdge(int edge, NextEdgeType nextEdgeType) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_getEdge(ptr, edge, (int)nextEdgeType, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Subdivision edge ID. + /// + /// Subdivision edge ID. + /// an integer which is next edge ID around the edge origin: eOnext on the picture above if e is the input edge). + public int NextEdge(int edge) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_nextEdge(ptr, edge, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns another edge of the same quad-edge. + /// + /// Subdivision edge ID. + /// Parameter specifying which of the edges of the same quad-edge as the input + /// one to return. The following values are possible: + /// - 0 - the input edge ( e on the picture below if e is the input edge) + /// - 1 - the rotated edge ( eRot ) + /// - 2 - the reversed edge (reversed e (in green)) + /// - 3 - the reversed rotated edge (reversed eRot (in green)) + /// one of the edges ID of the same quad-edge as the input edge. + public int RotateEdge(int edge, int rotate) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_rotateEdge(ptr, edge, rotate, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + /// + public int SymEdge(int edge) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_symEdge(ptr, edge, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the edge origin. + /// + /// Subdivision edge ID. + /// Output vertex location. + /// vertex ID. + public int EdgeOrg(int edge, out Point2f orgPt) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_edgeOrg(ptr, edge, out orgPt, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns the edge destination. + /// + /// Subdivision edge ID. + /// Output vertex location. + /// vertex ID. + public int EdgeDst(int edge, out Point2f dstPt) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.imgproc_Subdiv2D_edgeDst(ptr, edge, out dstPt, out var ret)); + GC.KeepAlive(this); + return ret; + } + + #endregion +} + +/// +/// Parameter for Subdiv2D.GetEdge() specifying which of the related edges to return. +/// +public enum NextEdgeType +{ + /// + /// next around the edge origin ( eOnext on the picture below if e is the input edge) + /// + NEXT_AROUND_ORG = 0x00, + + /// + /// next around the edge vertex ( eDnext ) + /// + NEXT_AROUND_DST = 0x22, + + /// + /// previous around the edge origin (reversed eRnext ) + /// + PREV_AROUND_ORG = 0x11, + + /// + /// previous around the edge destination (reversed eLnext ) + /// + PREV_AROUND_DST = 0x33, + + /// + /// next around the left facet ( eLnext ) + /// + NEXT_AROUND_LEFT = 0x13, + + /// + /// next around the right facet ( eRnext ) + /// + NEXT_AROUND_RIGHT = 0x31, + + /// + /// previous around the left facet (reversed eOnext ) + /// + PREV_AROUND_LEFT = 0x20, + + /// + /// previous around the right facet (reversed eDnext ) + /// + PREV_AROUND_RIGHT = 0x02 +} diff --git a/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs b/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs new file mode 100644 index 000000000..d04ae28cf --- /dev/null +++ b/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs @@ -0,0 +1,183 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1051 + +namespace OpenCvSharp.LineDescriptor; + +/// +/// A class to represent a line +/// +/// As aformentioned, it is been necessary to design a class that fully stores the information needed to +/// characterize completely a line and plot it on image it was extracted from, when required. +/// +/// *KeyLine* class has been created for such goal; it is mainly inspired to Feature2d's KeyPoint class, +/// since KeyLine shares some of* KeyPoint*'s fields, even if a part of them assumes a different +/// meaning, when speaking about lines.In particular: +/// +/// - the* class_id* field is used to gather lines extracted from different octaves which refer to +/// same line inside original image (such lines and the one they represent in original image share +/// the same* class_id* value) +/// - the* angle* field represents line's slope with respect to (positive) X axis +/// - the* pt* field represents line's midpoint +/// - the* response* field is computed as the ratio between the line's length and maximum between +/// image's width and height +/// - the* size* field is the area of the smallest rectangle containing line +/// +/// Apart from fields inspired to KeyPoint class, KeyLines stores information about extremes of line in +/// original image and in octave it was extracted from, about line's length and number of pixels it +/// covers. +/// +[SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] +public readonly struct KeyLine +{ + /// + /// orientation of the line + /// + public readonly float Angle; + + /// + /// object ID, that can be used to cluster keylines by the line they represent + /// + public readonly int ClassId; + + /// + /// octave (pyramid layer), from which the keyline has been extracted + /// + public readonly int Octave; + + /// + /// coordinates of the middlepoint + /// + public readonly Point2f Pt; + + /// + /// the response, by which the strongest keylines have been selected. + /// It's represented by the ratio between line's length and maximum between + /// image's width and height + /// + public readonly float Response; + + /// + /// minimum area containing line + /// + public readonly float Size; + + /// + /// lines' extremes in original image + /// + public readonly float StartPointX; + /// + /// lines' extremes in original image + /// + public readonly float StartPointY; + /// + /// lines' extremes in original image + /// + public readonly float EndPointX; + /// + /// lines' extremes in original image + /// + public readonly float EndPointY; + + /// + /// line's extremes in image it was extracted from + /// + public readonly float SPointInOctaveX; + /// + /// line's extremes in image it was extracted from + /// + public readonly float SPointInOctaveY; + /// + /// line's extremes in image it was extracted from + /// + public readonly float EPointInOctaveX; + /// + /// line's extremes in image it was extracted from + /// + public readonly float EPointInOctaveY; + + /// + /// the length of line + /// + public readonly float LineLength; + + /// + /// number of pixels covered by the line + /// + public readonly int NumOfPixels; + + /// + /// Returns the start point of the line in the original image + /// + public Point2f StartPoint => new (StartPointX, StartPointY); + + /// + /// Returns the end point of the line in the original image + /// + public Point2f EndPoint => new (EndPointX, EndPointY); + + /// + /// Returns the start point of the line in the octave it was extracted from + /// + public Point2f StartPointInOctave => new (SPointInOctaveX, SPointInOctaveY); + + /// + /// Returns the end point of the line in the octave it was extracted from + /// + public Point2f EndPointInOctave => new (EPointInOctaveX, EPointInOctaveY); + + /// + /// Constructor + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public KeyLine( + float angle = default, + int classId = default, + int octave = default, + Point2f pt = default, + float response = default, + float size = default, + float startPointX = default, + float startPointY = default, + float endPointX = default, + float endPointY = default, + float sPointInOctaveX = default, + float sPointInOctaveY = default, + float ePointInOctaveX = default, + float ePointInOctaveY = default, + float lineLength = default, + int numOfPixels = default) + { + Angle = angle; + ClassId = classId; + Octave = octave; + Pt = pt; + Response = response; + Size = size; + StartPointX = startPointX; + StartPointY = startPointY; + EndPointX = endPointX; + EndPointY = endPointY; + SPointInOctaveX = sPointInOctaveX; + SPointInOctaveY = sPointInOctaveY; + EPointInOctaveX = ePointInOctaveX; + EPointInOctaveY = ePointInOctaveY; + LineLength = lineLength; + NumOfPixels = numOfPixels; + } +} diff --git a/src/OpenCvSharp/Modules/line_descriptors/LSDDetector.cs b/src/OpenCvSharp/Modules/line_descriptors/LSDDetector.cs new file mode 100644 index 000000000..b6d24f7dc --- /dev/null +++ b/src/OpenCvSharp/Modules/line_descriptors/LSDDetector.cs @@ -0,0 +1,138 @@ + + +// ReSharper disable UnusedMember.Global + +// https://github.com/opencv/opencv_contrib/blob/33ae078b0989b44ac8d262d210335b04bb268b4d/modules/line_descriptor/src/binary_descriptor.cpp#L1030 +#if false +namespace OpenCvSharp.LineDescriptor +{ + /// + /// Lines extraction methodology + /// ---------------------------- + /// + /// The lines extraction methodology described in the following is mainly based on @cite EDL.The + /// extraction starts with a Gaussian pyramid generated from an original image, downsampled N-1 times, + /// blurred N times, to obtain N layers(one for each octave), with layer 0 corresponding to input + /// image.Then, from each layer (octave) in the pyramid, lines are extracted using LSD algorithm. + /// + /// Differently from EDLine lines extractor used in original article, LSD furnishes information only + /// about lines extremes; thus, additional information regarding slope and equation of line are computed + /// via analytic methods.The number of pixels is obtained using * LineIterator*. Extracted lines are + /// returned in the form of KeyLine objects, but since extraction is based on a method different from + /// the one used in * BinaryDescriptor* class, data associated to a line's extremes in original image and + /// in octave it was extracted from, coincide.KeyLine's field *class_id* is used as an index to + /// indicate the order of extraction of a line inside a single octave. + /// + // ReSharper disable once InconsistentNaming + public class LSDDetector : DisposableCvObject + { + /// + /// Default constructor. + /// + public LSDDetector() + { + NativeMethods.HandleException( + NativeMethods.line_descriptor_LSDDetector_new1(out ptr)); + } + + /// + /// Constructor + /// + /// + public LSDDetector(in LSDParam lsdParam) + { + NativeMethods.HandleException( + NativeMethods.line_descriptor_LSDDetector_new2( + scale: lsdParam.Scale, + sigmaScale: lsdParam.SigmaScale, + quant: lsdParam.Quant, + angTh: lsdParam.AngTh, + logEps: lsdParam.LogEps, + densityTh: lsdParam.DensityTh, + nBins: lsdParam.NBins, + out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.line_descriptor_LSDDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// Detect lines inside an image. + /// + /// input image + /// scale factor used in pyramids generation + /// number of octaves inside pyramid + /// mask matrix to detect only KeyLines of interest + /// vector that will store extracted lines for one or more images + public KeyLine[] Detect(Mat image, int scale, int numOctaves, Mat? mask = null) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); + + using var keypointsVec = new VectorOfKeyLine(); + NativeMethods.HandleException( + NativeMethods.line_descriptor_LSDDetector_detect1( + ptr, image.CvPtr, keypointsVec.CvPtr, scale, numOctaves, mask?.CvPtr ?? IntPtr.Zero)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(mask); + + return keypointsVec.ToArray(); + } + + /// + /// Detect lines inside an image. + /// + /// input images + /// scale factor used in pyramids generation + /// number of octaves inside pyramid + /// vector of mask matrices to detect only KeyLines of interest from each input image + /// set of vectors that will store extracted lines for one or more images + public KeyLine[][] Detect(IEnumerable images, int scale, int numOctaves, IEnumerable? masks = null) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + + var imagesPtrs = images.Select(i => + { + if (i is null) + throw new ArgumentException($"'{nameof(images)}' contains null", nameof(images)); + i.ThrowIfDisposed(); + return i.CvPtr; + }).ToArray(); + var masksPtrs = masks?.Select(i => + { + if (i is null) + throw new ArgumentException($"'{nameof(images)}' contains null", nameof(images)); + i.ThrowIfDisposed(); + return i.CvPtr; + }).ToArray() ?? Array.Empty(); + + using var keypointsVec = new VectorOfVectorKeyLine(); + NativeMethods.HandleException( + NativeMethods.line_descriptor_LSDDetector_detect2( + ptr, + imagesPtrs, imagesPtrs.Length, + keypointsVec.CvPtr, scale, numOctaves, + masksPtrs, masksPtrs.Length)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(masks); + + return keypointsVec.ToArray(); + } + } +} + +#endif diff --git a/src/OpenCvSharp/Modules/line_descriptors/LSDParam.cs b/src/OpenCvSharp/Modules/line_descriptors/LSDParam.cs new file mode 100644 index 000000000..b6d6f6f7b --- /dev/null +++ b/src/OpenCvSharp/Modules/line_descriptors/LSDParam.cs @@ -0,0 +1,26 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp.LineDescriptor; +#pragma warning disable CA1815 +#pragma warning disable 1591 +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public readonly struct LSDParam( + double scale = 0.8, + double sigmaScale = 0.6, + double quant = 2.0, + double angTh = 22.5, + double logEps = 0, + double densityTh = 0.7, + int nBins = 1024) +{ + public readonly double Scale = scale; + public readonly double SigmaScale = sigmaScale; + public readonly double Quant = quant; + public readonly double AngTh = angTh; + public readonly double LogEps = logEps; + public readonly double DensityTh = densityTh; + public readonly int NBins = nBins; +} diff --git a/src/OpenCvSharp/Modules/ml/ANN_MLP.cs b/src/OpenCvSharp/Modules/ml/ANN_MLP.cs new file mode 100644 index 000000000..510267840 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/ANN_MLP.cs @@ -0,0 +1,438 @@ +using System.ComponentModel; +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +/// +/// Artificial Neural Networks - Multi-Layer Perceptrons. +/// +// ReSharper disable once InconsistentNaming +public class ANN_MLP : StatModel +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// Creates instance by raw pointer cv::ml::ANN_MLP* + /// + protected ANN_MLP(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public static ANN_MLP Create() + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_create(out var ptr)); + return new ANN_MLP(ptr); + } + + /// + /// Loads and creates a serialized ANN from a file. + /// Use ANN::save to serialize and store an ANN to disk. + /// Load the ANN from this file again, by calling this function with the path to the file. + /// + /// path to serialized ANN + /// + public static ANN_MLP Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_load(filePath, out var ptr)); + return new ANN_MLP(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public static ANN_MLP LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_loadFromString(strModel, out var ptr)); + return new ANN_MLP(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Termination criteria of the training algorithm. + /// + public TermCriteria TermCriteria + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getTermCriteria(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setTermCriteria(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Strength of the weight gradient term. + /// The recommended value is about 0.1. Default value is 0.1. + /// + // ReSharper disable once IdentifierTypo + public double BackpropWeightScale + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getBackpropWeightScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setBackpropWeightScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Strength of the momentum term (the difference between weights on the 2 previous iterations). + /// This parameter provides some inertia to smooth the random fluctuations of the weights. + /// It can vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or + /// so is good enough. Default value is 0.1. + /// + // ReSharper disable once IdentifierTypo + public double BackpropMomentumScale + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getBackpropMomentumScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setBackpropMomentumScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Initial value Delta_0 of update-values Delta_{ij}. Default value is 0.1. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public double RpropDW0 + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getRpropDW0(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setRpropDW0(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Increase factor eta^+. + /// It must be >1. Default value is 1.2. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public double RpropDWPlus + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getRpropDWPlus(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setRpropDWPlus(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Decrease factor eta^-. + /// It must be \>1. Default value is 0.5. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public double RpropDWMinus + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getRpropDWPlus(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setRpropDWPlus(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Update-values lower limit Delta_{min}. + /// It must be positive. Default value is FLT_EPSILON. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public double RpropDWMin + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getRpropDWMin(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setRpropDWMin(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Update-values upper limit Delta_{max}. + /// It must be >1. Default value is 50. + /// + // ReSharper disable once InconsistentNaming + // ReSharper disable once IdentifierTypo + public double RpropDWMax + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getRpropDWMax(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setRpropDWMax(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Sets training method and common parameters. + /// + /// Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods. + /// passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP and to initialT for ANN_MLP::ANNEAL. + /// passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP and to finalT for ANN_MLP::ANNEAL. + public virtual void SetTrainMethod(TrainingMethods method, double param1 = 0, double param2 = 0) + { + if (!Enum.IsDefined(typeof(TrainingMethods), method)) + throw new InvalidEnumArgumentException(nameof(method), (int)method, typeof(TrainingMethods)); + + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setTrainMethod(ptr, (int)method, param1, param2)); + + GC.KeepAlive(this); + } + + /// + /// Returns current training method + /// + /// + public virtual TrainingMethods GetTrainMethod() + { + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getTrainMethod(ptr, out var ret)); + GC.KeepAlive(this); + return (TrainingMethods) ret; + } + + /// + /// Initialize the activation function for each neuron. + /// Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM. + /// + /// The type of activation function. See ANN_MLP::ActivationFunctions. + /// The first parameter of the activation function, \f$\alpha\f$. Default value is 0. + /// The second parameter of the activation function, \f$\beta\f$. Default value is 0. + public virtual void SetActivationFunction(ActivationFunctions type, double param1 = 0, double param2 = 0) + { + if (!Enum.IsDefined(typeof(ActivationFunctions), type)) + throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ActivationFunctions)); + + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setActivationFunction(ptr, (int)type, param1, param2)); + + GC.KeepAlive(this); + } + + /// + /// Integer vector specifying the number of neurons in each layer including the input and output layers. + /// The very first element specifies the number of elements in the input layer. + /// The last element - number of elements in the output layer.Default value is empty Mat. + /// + /// + public virtual void SetLayerSizes(InputArray layerSizes) + { + ThrowIfDisposed(); + if (layerSizes is null) + throw new ArgumentNullException(nameof(layerSizes)); + + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_setLayerSizes(ptr, layerSizes.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(layerSizes); + } + + /// + /// Integer vector specifying the number of neurons in each layer including the input and output layers. + /// The very first element specifies the number of elements in the input layer. + /// The last element - number of elements in the output layer. + /// + /// + public virtual Mat GetLayerSizes() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ml_ANN_MLP_getLayerSizes(ptr, out var ret)); + + GC.KeepAlive(this); + return new Mat(ret); + } + + #endregion + + #region Types + + /// + /// possible activation functions + /// + public enum ActivationFunctions + { + /// + /// Identity function: $f(x)=x + /// + Identity = 0, + + /// + /// Symmetrical sigmoid: f(x)=\beta*(1-e^{-\alpha x})/(1+e^{-\alpha x} + /// + SigmoidSym = 1, + + /// + /// Gaussian function: f(x)=\beta e^{-\alpha x*x} + /// + Gaussian = 2 + } + + /// + /// Train options + /// + [Flags] + public enum TrainFlags + { + /// + /// Update the network weights, rather than compute them from scratch. + /// In the latter case the weights are initialized using the Nguyen-Widrow algorithm. + /// + UpdateWeights = 1, + + /* */ + /// + /// Do not normalize the input vectors. + /// If this flag is not set, the training algorithm normalizes each input feature + /// independently, shifting its mean value to 0 and making the standard deviation + /// equal to 1. If the network is assumed to be updated frequently, the new + /// training data could be much different from original one. In this case, + /// you should take care of proper normalization. + /// + NoInputScale = 2, + + /// + /// Do not normalize the output vectors. If the flag is not set, + /// the training algorithm normalizes each output feature independently, + /// by transforming it to the certain range depending on the used activation function. + /// + NoOutputScale = 4 + } + + /// + /// Available training methods + /// + public enum TrainingMethods + { + /// + /// The back-propagation algorithm. + /// + BackProp = 0, + + /// + /// The RPROP algorithm. See @cite RPROP93 for details. + /// + RProp = 1 + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_ANN_MLP_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_ANN_MLP_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/Boost.cs b/src/OpenCvSharp/Modules/ml/Boost.cs new file mode 100644 index 000000000..c30722ca4 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/Boost.cs @@ -0,0 +1,199 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +/// +/// Boosted tree classifier derived from DTrees +/// +public class Boost : DTrees +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// Creates instance by raw pointer cv::ml::Boost* + /// + protected Boost(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public new static Boost Create() + { + NativeMethods.HandleException( + NativeMethods.ml_Boost_create(out var ptr)); + return new Boost(ptr); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public new static Boost Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_Boost_load(filePath, out var ptr)); + return new Boost(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public new static Boost LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_Boost_loadFromString(strModel, out var ptr)); + return new Boost(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Type of the boosting algorithm. + /// See Boost::Types. Default value is Boost::REAL. + /// + public Types BoostType + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_Boost_getBoostType(ptr, out var ret)); + GC.KeepAlive(this); + return (Types)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_Boost_setBoostType(ptr, (int) value)); + GC.KeepAlive(this); + } + } + + /// + /// The number of weak classifiers. + /// Default value is 100. + /// + public int WeakCount + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_Boost_getWeakCount(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_Boost_setWeakCount(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// A threshold between 0 and 1 used to save computational time. + /// Samples with summary weight \f$\leq 1 - weight_trim_rate + /// do not participate in the *next* iteration of training. + /// Set this parameter to 0 to turn off this functionality. Default value is 0.95. + /// + public double WeightTrimRate + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_Boost_getWeightTrimRate(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_Boost_setWeightTrimRate(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Types + + /// + /// Boosting type. + /// Gentle AdaBoost and Real AdaBoost are often the preferable choices. + /// + public enum Types + { + /// + /// Discrete AdaBoost. + /// + Discrete = 0, + + /// + /// Real AdaBoost. It is a technique that utilizes confidence-rated predictions + /// and works well with categorical data. + /// + Real = 1, + + /// + /// LogitBoost. It can produce good regression fits. + /// + Logit = 2, + + /// + /// Gentle AdaBoost. It puts less weight on outlier data points and for that + /// reason is often good with regression data. + /// + Gentle = 3 + }; + + #endregion + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_Boost_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_Boost_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/DTrees.cs b/src/OpenCvSharp/Modules/ml/DTrees.cs new file mode 100644 index 000000000..aff241c45 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/DTrees.cs @@ -0,0 +1,463 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.ML; + +/// +/// Decision tree +/// +public class DTrees : StatModel +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// + /// + protected DTrees() + { + ptrObj = null; + } + + /// + /// Creates instance by raw pointer cv::ml::SVM* + /// + protected DTrees(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public static DTrees Create() + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_create(out var ptr)); + return new DTrees(ptr); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public static DTrees Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_DTrees_load(filePath, out var ptr)); + return new DTrees(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public static DTrees LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_DTrees_loadFromString(strModel, out var ptr)); + return new DTrees(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Cluster possible values of a categorical variable into + /// K < =maxCategories clusters to find a suboptimal split. + /// + public int MaxCategories + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getMaxCategories(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setMaxCategories(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The maximum possible depth of the tree. + /// + public int MaxDepth + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getMaxDepth(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setMaxDepth(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// If the number of samples in a node is less than this parameter then the + /// node will not be split. Default value is 10. + /// + public int MinSampleCount + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getMinSampleCount(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setMinSampleCount(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// If CVFolds \> 1 then algorithms prunes the built decision tree using K-fold + /// cross-validation procedure where K is equal to CVFolds. Default value is 10. + /// + // ReSharper disable once InconsistentNaming + public int CVFolds + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getCVFolds(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setCVFolds(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// If true then surrogate splits will be built. + /// These splits allow to work with missing data and compute variable + /// importance correctly. Default value is false. + /// + public bool UseSurrogates + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getUseSurrogates(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setUseSurrogates(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// If true then a pruning will be harsher. + /// This will make a tree more compact and more resistant to the training + /// data noise but a bit less accurate. Default value is true. + /// + // ReSharper disable once InconsistentNaming + public bool Use1SERule + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getUse1SERule(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setUse1SERule(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// If true then pruned branches are physically removed from the tree. + /// Otherwise they are retained and it is possible to get results from the + /// original unpruned (or pruned less aggressively) tree. Default value is true. + /// + public bool TruncatePrunedTree + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getTruncatePrunedTree(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setTruncatePrunedTree(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// Termination criteria for regression trees. + /// If all absolute differences between an estimated value in a node and + /// values of train samples in this node are less than this parameter + /// then the node will not be split further. Default value is 0.01f. + /// + public float RegressionAccuracy + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getRegressionAccuracy(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setRegressionAccuracy(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The array of a priori class probabilities, sorted by the class label value. + /// + public Mat Priors + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getPriors(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + + NativeMethods.HandleException( + NativeMethods.ml_DTrees_setPriors(ptr, value.CvPtr)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Returns indices of root nodes + /// + /// + public int[] GetRoots() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + using var vector = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getRoots(ptr, vector.CvPtr)); + GC.KeepAlive(this); + return vector.ToArray(); + } + + /// + /// Returns all the nodes. + /// all the node indices are indices in the returned vector + /// + public Node[] GetNodes() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + using var vector = new VectorOfDTreesNode(); + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getNodes(ptr, vector.CvPtr)); + GC.KeepAlive(this); + return vector.ToArray(); + } + + /// + /// Returns all the splits. + /// all the split indices are indices in the returned vector + /// + /// + public Split[] GetSplits() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + using var vector = new VectorOfDTreesSplit(); + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getSplits(ptr, vector.CvPtr)); + GC.KeepAlive(this); + return vector.ToArray(); + } + + /// + /// Returns all the bitsets for categorical splits. + /// Split::subsetOfs is an offset in the returned vector + /// + /// + public int[] GetSubsets() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + using var vector = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.ml_DTrees_getSubsets(ptr, vector.CvPtr)); + GC.KeepAlive(this); + return vector.ToArray(); + } + + #endregion + + #region Types + +#pragma warning disable CA1034 +#pragma warning disable CA1051 + /// + /// The class represents a decision tree node. + /// + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] + public struct Node + { + /// + /// Value at the node: a class label in case of classification or estimated + /// function value in case of regression. + /// + public double Value; + + /// + /// Class index normalized to 0..class_count-1 range and assigned to the + /// node. It is used internally in classification trees and tree ensembles. + /// + public int ClassIdx; + + /// + /// Index of the parent node + /// + public int Parent; + + /// + /// Index of the left child node + /// + public int Left; + + /// + /// Index of right child node + /// + public int Right; + + /// + /// Default direction where to go (-1: left or +1: right). It helps in the + /// case of missing values. + /// + public int DefaultDir; + + /// + /// Index of the first split + /// + public int Split; + } + +#pragma warning disable CA1034 + /// + /// The class represents split in a decision tree. + /// + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] + public struct Split + { + /// + /// Index of variable on which the split is created. + /// + public int VarIdx; + + /// + /// If not 0, then the inverse split rule is used (i.e. left and right + /// branches are exchanged in the rule expressions below). + /// + public int Inversed; + + /// + /// The split quality, a positive number. It is used to choose the best split. + /// + public float Quality; + + /// + /// Index of the next split in the list of splits for the node + /// + public int Next; + + /// + /// The threshold value in case of split on an ordered variable. + /// + public float C; + + /// + /// Offset of the bitset used by the split on a categorical variable. + /// + public int SubsetOfs; + } +#pragma warning restore CA1051 + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_DTrees_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_DTrees_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/EM.cs b/src/OpenCvSharp/Modules/ml/EM.cs new file mode 100644 index 000000000..a504b62ce --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/EM.cs @@ -0,0 +1,488 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// The class implements the Expectation Maximization algorithm. +/// +public class EM : Algorithm +{ + private Ptr? ptrObj; + + #region Constants + +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + public const int DEFAULT_NCLUSTERS = 5; + public const int DEFAULT_MAX_ITERS = 100; + // ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + #endregion + + #region Init and Disposal + + /// + /// Creates instance by pointer cv::Ptr<EM> + /// + protected EM(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates empty EM model. + /// + /// + public static EM Create() + { + NativeMethods.HandleException( + NativeMethods.ml_EM_create(out var ret)); + return new EM(ret); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public static EM Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_EM_load(filePath, out var ret)); + return new EM(ret); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public static EM LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_EM_loadFromString(strModel, out var ret)); + return new EM(ret); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// The number of mixture components in the Gaussian mixture model. + /// Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. + /// Some of EM implementation could determine the optimal number of mixtures + /// within a specified value range, but that is not the case in ML yet. + /// + public int ClustersNumber + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_EM_getClustersNumber(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_EM_setClustersNumber(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Constraint on covariance matrices which defines type of matrices. + /// + public int CovarianceMatrixType + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_EM_getCovarianceMatrixType(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_EM_setCovarianceMatrixType(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The termination criteria of the %EM algorithm. + /// The EM algorithm can be terminated by the number of iterations + /// termCrit.maxCount (number of M-steps) or when relative change of likelihood + /// logarithm is less than termCrit.epsilon. + /// Default maximum number of iterations is EM::DEFAULT_MAX_ITERS=100. + /// + public TermCriteria TermCriteria + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_EM_getTermCriteria(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_EM_setTermCriteria(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Returns weights of the mixtures. + /// Returns vector with the number of elements equal to the number of mixtures. + /// + /// + public Mat GetWeights() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_EM_getWeights(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// Returns the cluster centers (means of the Gaussian mixture). + /// Returns matrix with the number of rows equal to the number of mixtures and + /// number of columns equal to the space dimensionality. + /// + /// + public Mat GetMeans() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_EM_getMeans(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// Returns covariation matrices. + /// Returns vector of covariation matrices. Number of matrices is the number of + /// gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality. + /// + public Mat[] GetCovs() + { + ThrowIfDisposed(); + + using var vec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.ml_EM_getCovs(ptr, vec.CvPtr)); + GC.KeepAlive(this); + return vec.ToArray(); + } + + /// + /// Estimate the Gaussian mixture parameters from a samples set. + /// + /// Samples from which the Gaussian mixture model will be estimated. It should be a + /// one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type + /// it will be converted to the inner matrix of such type for the further computing. + /// The optional output matrix that contains a likelihood logarithm value for + /// each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type. + /// The optional output "class label" for each sample: + /// \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable + /// mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type. + /// The optional output matrix that contains posterior probabilities of each Gaussian + /// mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and CV_64FC1 type. + /// + // ReSharper disable once InconsistentNaming + public virtual bool TrainEM( + InputArray samples, + OutputArray? logLikelihoods = null, + OutputArray? labels = null, + OutputArray? probs = null) + { + ThrowIfDisposed(); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + samples.ThrowIfDisposed(); + + logLikelihoods?.ThrowIfNotReady(); + labels?.ThrowIfNotReady(); + probs?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_EM_trainEM( + ptr, + samples.CvPtr, + Cv2.ToPtr(logLikelihoods), + Cv2.ToPtr(labels), + Cv2.ToPtr(probs), + out var ret)); + + logLikelihoods?.Fix(); + labels?.Fix(); + probs?.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(logLikelihoods); + GC.KeepAlive(labels); + GC.KeepAlive(probs); + return ret != 0; + } + + /// + /// Estimate the Gaussian mixture parameters from a samples set. + /// + /// Samples from which the Gaussian mixture model will be estimated. It should be a + /// one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type + /// it will be converted to the inner matrix of such type for the further computing. + /// Initial means \f$a_k\f$ of mixture components. It is a one-channel matrix of + /// \f$nclusters \times dims\f$ size. If the matrix does not have CV_64F type it will be + /// converted to the inner matrix of such type for the further computing. + /// The vector of initial covariance matrices \f$S_k\f$ of mixture components. Each of + /// covariance matrices is a one-channel matrix of \f$dims \times dims\f$ size. If the matrices + /// do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. + /// Initial weights \f$\pi_k\f$ of mixture components. It should be a one-channel + /// floating-point matrix with \f$1 \times nclusters\f$ or \f$nclusters \times 1\f$ size. + /// The optional output matrix that contains a likelihood logarithm value for + /// each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type. + /// The optional output "class label" for each sample: + /// \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable + /// mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type. + /// The optional output matrix that contains posterior probabilities of each Gaussian + /// mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and CV_64FC1 type. + public virtual bool TrainE( + InputArray samples, + InputArray means0, + InputArray? covs0 = null, + InputArray? weights0 = null, + OutputArray? logLikelihoods = null, + OutputArray? labels = null, + OutputArray? probs = null) + { + ThrowIfDisposed(); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + if (means0 is null) + throw new ArgumentNullException(nameof(means0)); + samples.ThrowIfDisposed(); + means0.ThrowIfDisposed(); + + logLikelihoods?.ThrowIfNotReady(); + covs0?.ThrowIfDisposed(); + weights0?.ThrowIfDisposed(); + labels?.ThrowIfNotReady(); + probs?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_EM_trainE( + ptr, + samples.CvPtr, + means0.CvPtr, + Cv2.ToPtr(covs0), + Cv2.ToPtr(weights0), + Cv2.ToPtr(logLikelihoods), + Cv2.ToPtr(labels), + Cv2.ToPtr(probs), + out var ret)); + + logLikelihoods?.Fix(); + labels?.Fix(); + probs?.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(means0); + GC.KeepAlive(covs0); + GC.KeepAlive(weights0); + GC.KeepAlive(logLikelihoods); + GC.KeepAlive(labels); + GC.KeepAlive(probs); + return ret != 0; + } + + /// + /// Estimate the Gaussian mixture parameters from a samples set. + /// + /// Samples from which the Gaussian mixture model will be estimated. It should be a + /// one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type + /// it will be converted to the inner matrix of such type for the further computing. + /// the probabilities + /// The optional output matrix that contains a likelihood logarithm value for + /// each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type. + /// The optional output "class label" for each sample: + /// \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable + /// mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type. + /// The optional output matrix that contains posterior probabilities of each Gaussian + /// mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and CV_64FC1 type. + public virtual bool TrainM( + InputArray samples, + InputArray probs0, + OutputArray? logLikelihoods = null, + OutputArray? labels = null, + OutputArray? probs = null) + { + ThrowIfDisposed(); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + if (probs0 is null) + throw new ArgumentNullException(nameof(probs0)); + samples.ThrowIfDisposed(); + probs0.ThrowIfDisposed(); + + logLikelihoods?.ThrowIfNotReady(); + labels?.ThrowIfNotReady(); + probs?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_EM_trainM( + ptr, + samples.CvPtr, + probs0.CvPtr, + Cv2.ToPtr(logLikelihoods), + Cv2.ToPtr(labels), + Cv2.ToPtr(probs), + out var ret)); + + logLikelihoods?.Fix(); + labels?.Fix(); + probs?.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(probs0); + GC.KeepAlive(logLikelihoods); + GC.KeepAlive(labels); + GC.KeepAlive(probs); + + return ret != 0; + } + + /// + /// Predicts the response for sample + /// + /// A sample for classification. It should be a one-channel matrix of + /// \f$1 \times dims\f$ or \f$dims \times 1\f$ size. + /// Optional output matrix that contains posterior probabilities of each component + /// given the sample. It has \f$1 \times nclusters\f$ size and CV_64FC1 type. + public virtual Vec2d Predict2(InputArray sample, OutputArray? probs = null) + { + ThrowIfDisposed(); + if (sample is null) + throw new ArgumentNullException(nameof(sample)); + sample.ThrowIfDisposed(); + probs?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_EM_predict2(ptr, sample.CvPtr, Cv2.ToPtr(probs), out var ret)); + probs?.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(sample); + GC.KeepAlive(probs); + return ret; + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_EM_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_EM_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} + +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + +/// +/// Type of covariation matrices +/// +public enum EMTypes +{ + /// + /// A scaled identity matrix \f$\mu_k * I\f$. + /// There is the only parameter \f$\mu_k\f$ to be estimated for each matrix. + /// The option may be used in special cases, when the constraint is relevant, + /// or as a first step in the optimization (for example in case when the data is + /// preprocessed with PCA). The results of such preliminary estimation may be + /// passed again to the optimization procedure, this time with covMatType=EM::COV_MAT_DIAGONAL. + /// + CovMatSpherical = 0, + + /// + /// A diagonal matrix with positive diagonal elements. + /// The number of free parameters is d for each matrix. + /// This is most commonly used option yielding good estimation results. + /// + CovMatDiagonal = 1, + + /// + /// A symmetric positively defined matrix. The number of free parameters in each + /// matrix is about \f$d^2/2\f$. It is not recommended to use this option, unless + /// there is pretty accurate initial estimation of the parameters and/or a huge number + /// of training samples. + /// + CovMatGeneric = 2, + + /// + /// + /// + CovMatDefault = CovMatSpherical, +} + +/// +/// The initial step the algorithm starts from +/// +public enum EMStartStep +{ + /// + /// The algorithm starts with E-step. + /// At least, the initial values of mean vectors, CvEMParams.Means must be passed. + /// Optionally, the user may also provide initial values for weights (CvEMParams.Weights) + /// and/or covariation matrices (CvEMParams.Covs). + /// [CvEM::START_E_STEP] + /// + E = 1, + + /// + /// The algorithm starts with M-step. The initial probabilities p_i,k must be provided. + /// [CvEM::START_M_STEP] + /// + M = 2, + + /// + /// No values are required from the user, k-means algorithm is used to estimate initial mixtures parameters. + /// [CvEM::START_AUTO_STEP] + /// + Auto = 0, +} diff --git a/src/OpenCvSharp/Modules/ml/Enum/SampleTypes.cs b/src/OpenCvSharp/Modules/ml/Enum/SampleTypes.cs new file mode 100644 index 000000000..791825efe --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/Enum/SampleTypes.cs @@ -0,0 +1,18 @@ + +namespace OpenCvSharp.ML; + +/// +/// Sample types +/// +public enum SampleTypes +{ + /// + /// each training sample is a row of samples + /// + RowSample = 0, + + /// + /// each training sample occupies a column of samples + /// + ColSample = 1, +} diff --git a/src/OpenCvSharp/Modules/ml/KNearest.cs b/src/OpenCvSharp/Modules/ml/KNearest.cs new file mode 100644 index 000000000..ecfa47f47 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/KNearest.cs @@ -0,0 +1,237 @@ +using OpenCvSharp.Internal; + +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp.ML; + +/// +/// K nearest neighbors classifier +/// +public class KNearest : StatModel +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// Creates instance by raw pointer cv::ml::KNearest* + /// + protected KNearest(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model + /// + /// + public static KNearest Create() + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_create(out var ptr)); + return new KNearest(ptr); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public static KNearest Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_KNearest_load(filePath, out var ptr)); + return new KNearest(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public static KNearest LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_KNearest_loadFromString(strModel, out var ptr)); + return new KNearest(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Default number of neighbors to use in predict method. + /// + public int DefaultK + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_getDefaultK(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_setDefaultK(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Whether classification or regression model should be trained. + /// + public new bool IsClassifier + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_getIsClassifier(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_setIsClassifier(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter for KDTree implementation + /// + public int Emax + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_getEmax(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_setEmax(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Algorithm type, one of KNearest::Types. + /// + public Types AlgorithmType + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_getAlgorithmType(ptr, out var ret)); + GC.KeepAlive(this); + return (Types)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_KNearest_setAlgorithmType(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Finds the neighbors and predicts responses for input vectors. + /// + /// Input samples stored by rows. + /// It is a single-precision floating-point matrix of `[number_of_samples] * k` size. + /// Number of used nearest neighbors. Should be greater than 1. + /// Vector with results of prediction (regression or classification) for each + /// input sample. It is a single-precision floating-point vector with `[number_of_samples]` elements. + /// neighborResponses Optional output values for corresponding neighbors. + /// It is a single-precision floating-point matrix of `[number_of_samples] * k` size. + /// Optional output distances from the input vectors to the corresponding neighbors. + /// It is a single-precision floating-point matrix of `[number_of_samples] * k` size. + /// + public float FindNearest(InputArray samples, int k, OutputArray results, + OutputArray? neighborResponses = null, OutputArray? dist = null) + { + ThrowIfDisposed(); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + if (results is null) + throw new ArgumentNullException(nameof(results)); + samples.ThrowIfDisposed(); + results.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_KNearest_findNearest( + ptr, + samples.CvPtr, k, results.CvPtr, + Cv2.ToPtr(neighborResponses), Cv2.ToPtr(dist), out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(results); + GC.KeepAlive(neighborResponses); + GC.KeepAlive(dist); + results.Fix(); + neighborResponses?.Fix(); + dist?.Fix(); + return ret; + } + + #endregion + + #region Types + + /// + /// Implementations of KNearest algorithm + /// + public enum Types + { +#pragma warning disable 1591 + BruteForce = 1, + KdTree = 2 +#pragma warning restore 1591 + }; + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_KNearest_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_KNearest_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/LogisticRegression.cs b/src/OpenCvSharp/Modules/ml/LogisticRegression.cs new file mode 100644 index 000000000..1b94f4b39 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/LogisticRegression.cs @@ -0,0 +1,305 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +/// +/// Implements Logistic Regression classifier. +/// +public class LogisticRegression : StatModel +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// Creates instance by raw pointer cv::ml::LogisticRegression* + /// + protected LogisticRegression(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public static LogisticRegression Create() + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_create(out var ptr)); + return new LogisticRegression(ptr); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public static LogisticRegression Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_load(filePath, out var ptr)); + return new LogisticRegression(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public static LogisticRegression LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_loadFromString(strModel, out var ptr)); + return new LogisticRegression(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Learning rate + /// + public double LearningRate + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_getLearningRate(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_setLearningRate(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Number of iterations. + /// + public int Iterations + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_getIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_setIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Kind of regularization to be applied. See LogisticRegression::RegKinds. + /// + public RegKinds Regularization + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_getRegularization(ptr, out var ret)); + GC.KeepAlive(this); + return (RegKinds)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_setRegularization(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// Kind of training method used. See LogisticRegression::Methods. + /// + public Methods TrainMethod + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_getTrainMethod(ptr, out var ret)); + GC.KeepAlive(this); + return (Methods)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_setTrainMethod(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// Specifies the number of training samples taken in each step of Mini-Batch Gradient. + /// Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. + /// It has to take values less than the total number of training samples. + /// + public int MiniBatchSize + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_getMiniBatchSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_setMiniBatchSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Termination criteria of the training algorithm. + /// + public TermCriteria TermCriteria + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_getTermCriteria(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_setTermCriteria(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Predicts responses for input samples and returns a float type. + /// + /// The input data for the prediction algorithm. Matrix [m x n], + /// where each row contains variables (features) of one object being classified. + /// Should have data type CV_32F. + /// Predicted labels as a column matrix of type CV_32S. + /// Not used. + /// + public float Predict(InputArray samples, OutputArray? results = null, int flags = 0) + { + ThrowIfDisposed(); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + samples.ThrowIfDisposed(); + results?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_predict(ptr, samples.CvPtr, Cv2.ToPtr(results), flags, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(results); + results?.Fix(); + + return ret; + } + + /// + /// This function returns the trained parameters arranged across rows. + /// For a two class classification problem, it returns a row matrix. + /// It returns learnt parameters of the Logistic Regression as a matrix of type CV_32F. + /// + /// + public Mat GetLearntThetas() + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ml_LogisticRegression_get_learnt_thetas(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + #endregion + + #region Types + + /// + /// Regularization kinds + /// + public enum RegKinds + { + /// + /// Regularization disabled + /// + RegDisable = -1, + + /// + /// L1 norm + /// + RegL1 = 0, + + /// + /// L2 norm + /// + RegL2 = 1 + } + + /// + /// Training methods + /// + public enum Methods + { + /// + /// + /// + Batch = 0, + + /// + /// Set MiniBatchSize to a positive integer when using this method. + /// + MiniBatch = 1 + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_LogisticRegression_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_LogisticRegression_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs b/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs new file mode 100644 index 000000000..8ff5eeb39 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs @@ -0,0 +1,129 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +/// +/// Bayes classifier for normally distributed data +/// +public class NormalBayesClassifier : StatModel +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer cv::ml::NormalBayesClassifier* + /// + protected NormalBayesClassifier(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates empty model. + /// Use StatModel::train to train the model after creation. + /// + /// + public static NormalBayesClassifier Create() + { + NativeMethods.HandleException( + NativeMethods.ml_NormalBayesClassifier_create(out var ptr)); + return new NormalBayesClassifier(ptr); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public static NormalBayesClassifier Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_NormalBayesClassifier_load(filePath, out var ptr)); + return new NormalBayesClassifier(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public static NormalBayesClassifier LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_NormalBayesClassifier_loadFromString(strModel, out var ptr)); + return new NormalBayesClassifier(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Predicts the response for sample(s). + /// + /// + /// + /// + /// + /// + /// + /// The method estimates the most probable classes for input vectors. Input vectors (one or more) + /// are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one + /// output vector outputs. The predicted class for a single input vector is returned by the method. + /// The vector outputProbs contains the output probabilities corresponding to each element of result. + /// + public float PredictProb(InputArray inputs, OutputArray outputs, + OutputArray outputProbs, int flags = 0) + { + ThrowIfDisposed(); + if (inputs is null) + throw new ArgumentNullException(nameof(inputs)); + if (outputs is null) + throw new ArgumentNullException(nameof(outputs)); + if (outputProbs is null) + throw new ArgumentNullException(nameof(outputProbs)); + + inputs.ThrowIfDisposed(); + outputs.ThrowIfNotReady(); + outputProbs.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_NormalBayesClassifier_predictProb( + ptr, inputs.CvPtr, outputs.CvPtr, outputProbs.CvPtr, flags, out var ret)); + outputs.Fix(); + outputProbs.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(inputs); + GC.KeepAlive(outputs); + GC.KeepAlive(outputProbs); + return ret; + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_NormalBayesClassifier_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_NormalBayesClassifier_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/ParamGrid.cs b/src/OpenCvSharp/Modules/ml/ParamGrid.cs new file mode 100644 index 000000000..cc5954aa7 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/ParamGrid.cs @@ -0,0 +1,47 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1051 + +namespace OpenCvSharp.ML; + +/// +/// The structure represents the logarithmic grid range of statmodel parameters. +/// +[SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] +public struct ParamGrid +{ + /// + /// Minimum value of the statmodel parameter. Default value is 0. + /// + public double MinVal; + + /// + /// Maximum value of the statmodel parameter. Default value is 0. + /// + public double MaxVal; + + /// + /// Logarithmic step for iterating the statmodel parameter. + /// + /// + /// The grid determines the following iteration sequence of the statmodel parameter values: + /// \f[(minVal, minVal*step, minVal*{step}^2, \dots, minVal*{logStep}^n),\f] + /// where \f$n\f$ is the maximal index satisfying + /// \f[\texttt{minVal} * \texttt{logStep} ^n < \texttt{maxVal}\f] + /// The grid is logarithmic, so logStep must always be greater then 1. Default value is 1. + /// + public double LogStep; + + /// + /// Constructor with parameters + /// + /// + /// + /// + public ParamGrid(double minVal, double maxVal, double logStep) + { + MinVal = minVal; + MaxVal = maxVal; + LogStep = logStep; + } +} diff --git a/src/OpenCvSharp/Modules/ml/RTrees.cs b/src/OpenCvSharp/Modules/ml/RTrees.cs new file mode 100644 index 000000000..f5c7f0be4 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/RTrees.cs @@ -0,0 +1,183 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +/// +/// The class implements the random forest predictor. +/// +public class RTrees : DTrees +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// Creates instance by raw pointer cv::ml::RTrees* + /// + protected RTrees(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public new static RTrees Create() + { + NativeMethods.HandleException( + NativeMethods.ml_RTrees_create(out var ptr)); + return new RTrees(ptr); + } + + /// + /// Loads and creates a serialized model from a file. + /// + /// + /// + public new static RTrees Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_load(filePath, out var ptr)); + return new RTrees(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// he string variable containing the model you want to load. + /// + public new static RTrees LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_loadFromString(strModel, out var ptr)); + return new RTrees(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// If true then variable importance will be calculated and then + /// it can be retrieved by RTrees::getVarImportance. Default value is false. + /// + public bool CalculateVarImportance + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_getCalculateVarImportance(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_setCalculateVarImportance(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// The size of the randomly selected subset of features at each tree node + /// and that are used to find the best split(s). + /// + public int ActiveVarCount + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_getActiveVarCount(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_setActiveVarCount(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The termination criteria that specifies when the training algorithm stops. + /// + public TermCriteria TermCriteria + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_getTermCriteria(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_setTermCriteria(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Returns the variable importance array. + /// The method returns the variable importance vector, computed at the training + /// stage when CalculateVarImportance is set to true. If this flag was set to false, + /// the empty matrix is returned. + /// + /// + public Mat GetVarImportance() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_RTrees_getVarImportance(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + #endregion + + internal new class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_RTrees_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_RTrees_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/SVM.cs b/src/OpenCvSharp/Modules/ml/SVM.cs new file mode 100644 index 000000000..9c2cc9d3f --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/SVM.cs @@ -0,0 +1,536 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +// ReSharper disable InconsistentNaming +/// +/// Support Vector Machines +/// +public class SVM : StatModel +{ + private Ptr? ptrObj; + + #region Init and Disposal + + /// + /// Creates instance by raw pointer cv::ml::SVM* + /// + protected SVM(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates empty model. + /// Use StatModel::Train to train the model. + /// Since %SVM has several parameters, you may want to find the best + /// parameters for your problem, it can be done with SVM::TrainAuto. + /// + /// + public static SVM Create() + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_create(out var ptr)); + return new SVM(ptr); + } + + /// + /// Loads and creates a serialized svm from a file. + /// Use SVM::save to serialize and store an SVM to disk. + /// Load the SVM from this file again, by calling this function with the path to the file. + /// + /// + /// + public static SVM Load(string filePath) + { + if (filePath is null) + throw new ArgumentNullException(nameof(filePath)); + NativeMethods.HandleException( + NativeMethods.ml_SVM_load(filePath, out var ptr)); + return new SVM(ptr); + } + + /// + /// Loads algorithm from a String. + /// + /// The string variable containing the model you want to load. + /// + public static SVM LoadFromString(string strModel) + { + if (strModel is null) + throw new ArgumentNullException(nameof(strModel)); + NativeMethods.HandleException( + NativeMethods.ml_SVM_loadFromString(strModel, out var ptr)); + return new SVM(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Type of a %SVM formulation. + /// Default value is SVM::C_SVC. + /// + public Types Type + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getType(ptr, out var ret)); + GC.KeepAlive(this); + return (Types)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setType(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter gamma of a kernel function. + /// For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1. + /// + public double Gamma + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getGamma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setGamma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter coef0 of a kernel function. + /// For SVM::POLY or SVM::SIGMOID. Default value is 0. + /// + public double Coef0 + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getCoef0(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setCoef0(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter degree of a kernel function. + /// For SVM::POLY. Default value is 0. + /// + public double Degree + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getDegree(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setDegree(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter C of a %SVM optimization problem. + /// For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0. + /// + public double C + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getC(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setC(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter nu of a %SVM optimization problem. + /// For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0. + /// + public double Nu + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getNu(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setNu(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter epsilon of a %SVM optimization problem. + /// For SVM::EPS_SVR. Default value is 0. + /// + public double P + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getP(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setP(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Optional weights in the SVM::C_SVC problem, assigned to particular classes. + /// + /// + /// They are multiplied by _C_ so the parameter _C_ of class _i_ becomes `classWeights(i) * C`. + /// Thus these weights affect the misclassification penalty for different classes. + /// The larger weight, the larger penalty on misclassification of data from the + /// corresponding class. Default value is empty Mat. + /// + public Mat ClassWeights + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getClassWeights(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + + NativeMethods.HandleException( + NativeMethods.ml_SVM_setClassWeights(ptr, value.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(value); + } + } + + /// + /// Termination criteria of the iterative SVM training procedure + /// which solves a partial case of constrained quadratic optimization problem. + /// + /// + /// You can specify tolerance and/or the maximum number of iterations. + /// Default value is `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`; + /// + public TermCriteria TermCriteria + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getTermCriteria(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setTermCriteria(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Type of a %SVM kernel. See SVM::KernelTypes. Default value is SVM::RBF. + /// + public KernelTypes KernelType + { + get + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getKernelType(ptr, out var ret)); + GC.KeepAlive(this); + return (KernelTypes)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_setKernel(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Trains an %SVM with optimal parameters. + /// + /// the training data that can be constructed using + /// TrainData::create or TrainData::loadFromCSV. + /// Cross-validation parameter. The training set is divided into kFold subsets. + /// One subset is used to test the model, the others form the train set. So, the %SVM algorithm is + /// executed kFold times. + /// grid for C + /// grid for gamma + /// grid for p + /// grid for nu + /// grid for coeff + /// grid for degree + /// If true and the problem is 2-class classification then the method creates + /// more balanced cross-validation subsets that is proportions between classes in subsets are close + /// to such proportion in the whole train dataset. + /// + public bool TrainAuto( + TrainData data, + int kFold = 10, + ParamGrid? cGrid = null, + ParamGrid? gammaGrid = null, + ParamGrid? pGrid = null, + ParamGrid? nuGrid = null, + ParamGrid? coeffGrid = null, + ParamGrid? degreeGrid = null, + bool balanced = false) + { + throw new NotImplementedException(); + /* + var cGridValue = cGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.C)); + var gammaGridValue = gammaGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Gamma)); + var pGridValue = pGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.P)); + var nuGridValue = nuGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Nu)); + var coeffGridValue = coeffGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Coef)); + var degreeGridValue = degreeGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Degree));*/ + } + + /// + /// Retrieves all the support vectors + /// + /// + public Mat GetSupportVectors() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ml_SVM_getSupportVectors(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret); + } + + /// + /// Retrieves the decision function + /// + /// i the index of the decision function. + /// If the problem solved is regression, 1-class or 2-class classification, then + /// there will be just one decision function and the index should always be 0. + /// Otherwise, in the case of N-class classification, there will be N(N-1)/2 decision functions. + /// alpha the optional output vector for weights, corresponding to + /// different support vectors. In the case of linear %SVM all the alpha's will be 1's. + /// the optional output vector of indices of support vectors + /// within the matrix of support vectors (which can be retrieved by SVM::getSupportVectors). + /// In the case of linear %SVM each decision function consists of a single "compressed" support vector. + /// + public double GetDecisionFunction(int i, OutputArray alpha, OutputArray svidx) + { + ThrowIfDisposed(); + if (alpha is null) + throw new ArgumentNullException(nameof(alpha)); + if (svidx is null) + throw new ArgumentNullException(nameof(svidx)); + + alpha.ThrowIfNotReady(); + svidx.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_SVM_getDecisionFunction(ptr, i, alpha.CvPtr, svidx.CvPtr, out var ret)); + + alpha.Fix(); + svidx.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(alpha); + GC.KeepAlive(svidx); + return ret; + } + + /// + /// Generates a grid for SVM parameters. + /// + /// SVM parameters IDs that must be one of the SVM::ParamTypes. + /// The grid is generated for the parameter with this ID. + /// + public static ParamGrid GetDefaultGrid(ParamTypes paramId) + { + NativeMethods.HandleException( + NativeMethods.ml_SVM_getDefaultGrid((int)paramId, out var ret)); + return ret; + } + + #endregion + + #region Types + +#pragma warning disable CA1008 + + /// + /// SVM type + /// + public enum Types + { + /// + /// C-Support Vector Classification. n-class classification (n \f$\geq\f$ 2), + /// allows imperfect separation of classes with penalty multiplier C for outliers. + /// + CSvc = 100, + + /// + /// nu-Support Vector Classification. n-class classification with possible + /// imperfect separation. Parameter \f$\nu\f$ (in the range 0..1, the larger + /// the value, the smoother the decision boundary) is used instead of C. + /// + NuSvc = 101, + + /// + /// Distribution Estimation (One-class %SVM). All the training data are from + /// the same class, %SVM builds a boundary that separates the class from the + /// rest of the feature space. + /// + OneClass = 102, + + /// + /// epsilon-Support Vector Regression. + /// The distance between feature vectors from the training set and the fitting + /// hyper-plane must be less than p. For outliers the penalty multiplier C is used. + /// + EpsSvr = 103, + + /// + /// nu-Support Vector Regression. \f$\nu\f$ is used instead of p. + /// See @cite LibSVM for details. + /// + NuSvr = 104 + } + + /// + /// SVM kernel type + /// + public enum KernelTypes + { + /// + /// Returned by SVM::getKernelType in case when custom kernel has been set + /// + Custom = -1, + + /// + /// Linear kernel. No mapping is done, linear discrimination (or regression) is + /// done in the original feature space. It is the fastest option. \f$K(x_i, x_j) = x_i^T x_j\f$. + /// + Linear = 0, + + /// + /// Polynomial kernel: + /// \f$K(x_i, x_j) = (\gamma x_i^T x_j + coef0)^{degree}, \gamma > 0\f$. + /// + Poly = 1, + + /// + /// Radial basis function (RBF), a good choice in most cases. + /// \f$K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0\f$. + /// + Rbf = 2, + + /// + /// Sigmoid kernel: + /// \f$K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)\f$. + /// + Sigmoid = 3, + + /// + /// Exponential Chi2 kernel, similar to the RBF kernel: + /// \f$K(x_i, x_j) = e^{-\gamma \chi^2(x_i,x_j)}, \chi^2(x_i,x_j) = (x_i-x_j)^2/(x_i+x_j), \gamma > 0\f$. + /// + Chi2 = 4, + + /// + /// Histogram intersection kernel. + /// A fast kernel. \f$K(x_i, x_j) = min(x_i,x_j)\f$. + /// + Inter = 5 + } + + /// + /// SVM params type + /// + public enum ParamTypes + { +#pragma warning disable 1591 + C = 0, + Gamma = 1, + P = 2, + Nu = 3, + Coef = 4, + Degree = 5 +#pragma warning restore 1591 + } + +#pragma warning restore CA1008 + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_SVM_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ml_Ptr_SVM_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ml/StatModel.cs b/src/OpenCvSharp/Modules/ml/StatModel.cs new file mode 100644 index 000000000..5168399d9 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/StatModel.cs @@ -0,0 +1,170 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; + +namespace OpenCvSharp.ML; + +/// +/// Base class for statistical models in ML +/// +public abstract class StatModel : Algorithm +{ + /// + /// Returns the number of variables in training samples + /// + /// + public virtual int GetVarCount() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + NativeMethods.HandleException( + NativeMethods.ml_StatModel_getVarCount(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public new virtual bool Empty() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + NativeMethods.HandleException( + NativeMethods.ml_StatModel_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns true if the model is trained + /// + /// + public virtual bool IsTrained() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + NativeMethods.HandleException( + NativeMethods.ml_StatModel_isTrained(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns true if the model is classifier + /// + /// + public virtual bool IsClassifier() + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + + NativeMethods.HandleException( + NativeMethods.ml_StatModel_isClassifier(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Trains the statistical model + /// + /// training data that can be loaded from file using TrainData::loadFromCSV + /// or created with TrainData::create. + /// optional flags, depending on the model. Some of the models can be updated with the + /// new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP). + /// + public virtual bool Train(TrainData trainData, int flags = 0) + { + throw new NotImplementedException(); + } + + /// + /// Trains the statistical model + /// + /// training samples + /// SampleTypes value + /// vector of responses associated with the training samples. + /// + public virtual bool Train(InputArray samples, SampleTypes layout, InputArray responses) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + if (responses is null) + throw new ArgumentNullException(nameof(responses)); + samples.ThrowIfDisposed(); + responses.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ml_StatModel_train2(ptr, samples.CvPtr, (int)layout, responses.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(responses); + return ret != 0; + } + + /// + /// Computes error on the training or test dataset + /// + /// the training data + /// if true, the error is computed over the test subset of the data, + /// otherwise it's computed over the training subset of the data. Please note that if you + /// loaded a completely different dataset to evaluate already trained classifier, you will + /// probably want not to set the test subset at all with TrainData::setTrainTestSplitRatio + /// and specify test=false, so that the error is computed for the whole new set. Yes, this + /// sounds a bit confusing. + /// the optional output responses. + /// + public virtual float CalcError(TrainData data, bool test, OutputArray resp) + { + throw new NotImplementedException(); + } + + /// + /// Predicts response(s) for the provided sample(s) + /// + /// The input samples, floating-point matrix + /// The optional output matrix of results. + /// The optional flags, model-dependent. + /// + public virtual float Predict(InputArray samples, OutputArray? results = null, Flags flags = 0) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (samples is null) + throw new ArgumentNullException(nameof(samples)); + samples.ThrowIfDisposed(); + results?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ml_StatModel_predict( + ptr, samples.CvPtr, Cv2.ToPtr(results), (int) flags, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(samples); + GC.KeepAlive(results); + results?.Fix(); + return ret; + } + + /// + /// Predict options + /// + [Flags] + [SuppressMessage("Microsoft.Design", "CA1069: Enums should not have duplicate values")] + public enum Flags + { +#pragma warning disable 1591 + UpdateModel = 1, + /// + /// makes the method return the raw results (the sum), not the class label + /// + RawOutput = 1, + CompressedInput = 2, + PreprocessedInput = 4 +#pragma warning restore 1591 + } +} diff --git a/src/OpenCvSharp/Modules/ml/TrainData.cs b/src/OpenCvSharp/Modules/ml/TrainData.cs new file mode 100644 index 000000000..1286d88c2 --- /dev/null +++ b/src/OpenCvSharp/Modules/ml/TrainData.cs @@ -0,0 +1,15 @@ +namespace OpenCvSharp.ML; + +/// +/// +/// +public class TrainData +{ + /// + /// + /// + public TrainData() + { + throw new NotImplementedException(); + } +} diff --git a/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs b/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs new file mode 100644 index 000000000..895cdbac7 --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs @@ -0,0 +1,233 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// Cascade classifier class for object detection. +/// +public class CascadeClassifier : DisposableCvObject +{ + #region Init and Disposal + + /// + /// Default constructor + /// + public CascadeClassifier() + { + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_new(out ptr)); + } + + /// + /// Loads a classifier from a file. + /// + /// Name of the file from which the classifier is loaded. + public CascadeClassifier(string fileName) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (!File.Exists(fileName)) + throw new FileNotFoundException("\""+ fileName + "\"not found", fileName); + + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_newFromFile(fileName, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Methods + + /// + /// Checks whether the classifier has been loaded. + /// + /// + public virtual bool Empty() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Loads a classifier from a file. + /// + /// Name of the file from which the classifier is loaded. + /// The file may contain an old HAAR classifier trained by the haartraining application + /// or a new cascade classifier trained by the traincascade application. + /// + public bool Load(string fileName) + { + ThrowIfDisposed(); + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (!File.Exists(fileName)) + throw new FileNotFoundException("\"" + fileName + "\"not found", fileName); + + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_load(ptr, fileName, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Reads a classifier parameters from a file storage + /// + /// + public virtual bool Read(FileNode fn) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (fn is null) + throw new ArgumentNullException(nameof(fn)); + + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_read(ptr, fn.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(fn); + + return ret != 0; + } + + /// + /// Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. + /// + /// Matrix of the type CV_8U containing an image where objects are detected. + /// Parameter specifying how much the image size is reduced at each image scale. + /// Parameter specifying how many neighbors each candidate rectangle should have to retain it. + /// Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. + /// It is not used for a new cascade. + /// Minimum possible object size. Objects smaller than that are ignored. + /// Maximum possible object size. Objects larger than that are ignored. + /// Vector of rectangles where each rectangle contains the detected object. + public virtual Rect[] DetectMultiScale( + Mat image, + double scaleFactor = 1.1, + int minNeighbors = 3, + HaarDetectionTypes flags = 0, + Size? minSize = null, + Size? maxSize = null) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + var minSize0 = minSize.GetValueOrDefault(new Size()); + var maxSize0 = maxSize.GetValueOrDefault(new Size()); + using var objectsVec = new VectorOfRect(); + + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_detectMultiScale1( + ptr, image.CvPtr, objectsVec.CvPtr, + scaleFactor, minNeighbors, (int) flags, minSize0, maxSize0)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + return objectsVec.ToArray(); + } + + /// + /// Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. + /// + /// Matrix of the type CV_8U containing an image where objects are detected. + /// + /// + /// Parameter specifying how much the image size is reduced at each image scale. + /// Parameter specifying how many neighbors each candidate rectangle should have to retain it. + /// Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. + /// It is not used for a new cascade. + /// Minimum possible object size. Objects smaller than that are ignored. + /// Maximum possible object size. Objects larger than that are ignored. + /// + /// Vector of rectangles where each rectangle contains the detected object. + public virtual Rect[] DetectMultiScale( + Mat image, + out int[] rejectLevels, + out double[] levelWeights, + double scaleFactor = 1.1, + int minNeighbors = 3, + HaarDetectionTypes flags = 0, + Size? minSize = null, + Size? maxSize = null, + bool outputRejectLevels = false) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + var minSize0 = minSize.GetValueOrDefault(new Size()); + var maxSize0 = maxSize.GetValueOrDefault(new Size()); + using var objectsVec = new VectorOfRect(); + using var rejectLevelsVec = new VectorOfInt32(); + using var levelWeightsVec = new VectorOfDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_detectMultiScale2( + ptr, image.CvPtr, objectsVec.CvPtr, rejectLevelsVec.CvPtr, levelWeightsVec.CvPtr, + scaleFactor, minNeighbors, (int) flags, minSize0, maxSize0, outputRejectLevels ? 1 : 0)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + + rejectLevels = rejectLevelsVec.ToArray(); + levelWeights = levelWeightsVec.ToArray(); + return objectsVec.ToArray(); + } + + /// + /// + /// + /// + public bool IsOldFormatCascade() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_isOldFormatCascade(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public virtual Size GetOriginalWindowSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_getOriginalWindowSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// + /// + /// + public int GetFeatureType() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_CascadeClassifier_getFeatureType(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs b/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs new file mode 100644 index 000000000..2322a98d1 --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs @@ -0,0 +1,39 @@ +namespace OpenCvSharp; + +/// +/// Modes of operation for cvHaarDetectObjects +/// +[Flags] +public enum HaarDetectionTypes +{ + /// + /// If it is set, the function uses Canny edge detector to reject some image regions that contain too few or too much edges and thus can not contain the searched object. + /// The particular threshold values are tuned for face detection and in this case the pruning speeds up the processing. + /// [CV_HAAR_DO_CANNY_PRUNING] + /// + DoCannyPruning = 1, + + /// + /// For each scale factor used the function will downscale the image rather than "zoom" the feature coordinates in the classifier cascade. + /// Currently, the option can only be used alone, i.e. the flag can not be set together with the others. + /// [CV_HAAR_SCALE_IMAGE] + /// + ScaleImage = 2, + + /// + /// If it is set, the function finds the largest object (if any) in the image. That is, the output sequence will contain one (or zero) element(s). + /// [CV_HAAR_FIND_BIGGEST_OBJECT] + /// + FindBiggestObject = 4, + + /// + /// It should be used only when FindBiggestObject is set and min_neighbors > 0. + /// If the flag is set, the function does not look for candidates of a smaller size + /// as soon as it has found the object (with enough neighbor candidates) at the current scale. + /// Typically, when min_neighbors is fixed, the mode yields less accurate (a bit larger) object rectangle + /// than the regular single-object mode (flags=FindBiggestObject), + /// but it is much faster, up to an order of magnitude. A greater value of min_neighbors may be specified to improve the accuracy. + /// [CV_HAAR_DO_ROUGH_SEARCH] + /// + DoRoughSearch = 8, +} diff --git a/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs b/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs new file mode 100644 index 000000000..62d1508bf --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs @@ -0,0 +1,2116 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector +/// +public class HOGDescriptor : DisposableCvObject +{ + #region Fields + + /// + /// + /// + public const int L2Hys = 0; + + /// + /// + /// + public const int DefaultNlevels = 64; + + #region DefaultPeopleDetector + + /// + /// Returns coefficients of the classifier trained for people detection (for default window size). + /// + public static readonly float[] DefaultPeopleDetector = + [ + 0.05359386f, -0.14721455f, -0.05532170f, 0.05077307f, + 0.11547081f, -0.04268804f, 0.04635834f, -0.05468199f, 0.08232084f, + 0.10424068f, -0.02294518f, 0.01108519f, 0.01378693f, 0.11193510f, + 0.01268418f, 0.08528346f, -0.06309239f, 0.13054633f, 0.08100729f, + -0.05209739f, -0.04315529f, 0.09341384f, 0.11035026f, -0.07596218f, + -0.05517511f, -0.04465296f, 0.02947334f, 0.04555536f, + -3.55954492e-003f, 0.07818956f, 0.07730991f, 0.07890715f, 0.06222893f, + 0.09001380f, -0.03574381f, 0.03414327f, 0.05677258f, -0.04773581f, + 0.03746637f, -0.03521175f, 0.06955440f, -0.03849038f, 0.01052293f, + 0.01736112f, 0.10867710f, 0.08748853f, 3.29739624e-003f, 0.10907028f, + 0.07913758f, 0.10393070f, 0.02091867f, 0.11594022f, 0.13182420f, + 0.09879354f, 0.05362710f, -0.06745391f, -7.01260753e-003f, + 5.24702156e-003f, 0.03236255f, 0.01407916f, 0.02207983f, 0.02537322f, + 0.04547948f, 0.07200756f, 0.03129894f, -0.06274468f, 0.02107014f, + 0.06035208f, 0.08636236f, 4.53164103e-003f, 0.02193363f, 0.02309801f, + 0.05568166f, -0.02645093f, 0.04448695f, 0.02837519f, 0.08975694f, + 0.04461516f, 0.08975355f, 0.07514391f, 0.02306982f, 0.10410084f, + 0.06368385f, 0.05943464f, 4.58420580e-003f, 0.05220337f, 0.06675851f, + 0.08358569f, 0.06712101f, 0.06559004f, -0.03930482f, -9.15936660e-003f, + -0.05897915f, 0.02816453f, 0.05032348f, 0.06780671f, 0.03377650f, + -6.09417039e-004f, -0.01795146f, -0.03083684f, -0.01302475f, + -0.02972313f, 7.88706727e-003f, -0.03525961f, -2.50397739e-003f, + 0.05245084f, 0.11791293f, -0.02167498f, 0.05299332f, 0.06640524f, + 0.05190265f, -8.27316567e-003f, 0.03033127f, 0.05842173f, + -4.01050318e-003f, -6.25105947e-003f, 0.05862958f, -0.02465461f, + 0.05546781f, -0.08228195f, -0.07234028f, 0.04640540f, -0.01308254f, + -0.02506191f, 0.03100746f, -0.04665651f, -0.04591486f, 0.02949927f, + 0.06035462f, 0.02244646f, -0.01698639f, 0.01040041f, 0.01131170f, + 0.05419579f, -0.02130277f, -0.04321722f, -0.03665198f, 0.01126490f, + -0.02606488f, -0.02228328f, -0.02255680f, -0.03427236f, + -7.75165204e-003f, -0.06195229f, 8.21638294e-003f, 0.09535975f, + -0.03709979f, -0.06942501f, 0.14579427f, -0.05448192f, -0.02055904f, + 0.05747357f, 0.02781788f, -0.07077577f, -0.05178314f, -0.10429011f, + -0.11235505f, 0.07529039f, -0.07559302f, -0.08786739f, 0.02983843f, + 0.02667585f, 0.01382199f, -0.01797496f, -0.03141199f, -0.02098101f, + 0.09029204f, 0.04955018f, 0.13718739f, 0.11379953f, 1.80019124e-003f, + -0.04577610f, -1.11108483e-003f, -0.09470536f, -0.11596080f, + 0.04489342f, 0.01784211f, 3.06850672e-003f, 0.10781866f, + 3.36498418e-003f, -0.10842580f, -0.07436839f, -0.10535070f, + -0.01866805f, 0.16057891f, -5.07316366e-003f, -0.04295658f, + -5.90488780e-003f, 8.82003549e-003f, -0.01492646f, -0.05029279f, + -0.12875880f, 8.78831954e-004f, -0.01297184f, -0.07592774f, + -0.02668831f, -6.93787413e-004f, 0.02406698f, -0.01773298f, + -0.03855745f, -0.05877856f, 0.03259695f, 0.12826584f, 0.06292590f, + -4.10733931e-003f, 0.10996531f, 0.01332991f, 0.02088735f, 0.04037504f, + -0.05210760f, 0.07760046f, 0.06399347f, -0.05751930f, -0.10053057f, + 0.07505023f, -0.02139782f, 0.01796176f, 2.34400877e-003f, -0.04208319f, + 0.07355055f, 0.05093350f, -0.02996780f, -0.02219072f, 0.03355330f, + 0.04418742f, -0.05580705f, -0.05037573f, -0.04548179f, 0.01379514f, + 0.02150671f, -0.02194211f, -0.13682702f, 0.05464972f, 0.01608082f, + 0.05309116f, 0.04701022f, 1.33690401e-003f, 0.07575664f, 0.09625306f, + 8.92647635e-003f, -0.02819123f, 0.10866830f, -0.03439325f, + -0.07092371f, -0.06004780f, -0.02712298f, -7.07467366e-003f, + -0.01637020f, 0.01336790f, -0.10313606f, 0.04906582f, -0.05732445f, + -0.02731079f, 0.01042235f, -0.08340668f, 0.03686501f, 0.06108340f, + 0.01322748f, -0.07809529f, 0.03774724f, -0.03413248f, -0.06096525f, + -0.04212124f, -0.07982176f, -1.25973229e-003f, -0.03045501f, + -0.01236493f, -0.06312395f, 0.04789570f, -0.04602066f, 0.08576570f, + 0.02521080f, 0.02988098f, 0.10314583f, 0.07060035f, 0.04520544f, + -0.04426654f, 0.13146530f, 0.08386490f, 0.02164590f, -2.12280243e-003f, + -0.03686353f, -0.02074944f, -0.03829959f, -0.01530596f, 0.02689708f, + 0.11867401f, -0.06043470f, -0.02785023f, -0.04775074f, 0.04878745f, + 0.06350956f, 0.03494788f, 0.01467400f, 1.17890188e-003f, 0.04379614f, + 2.03681854e-003f, -0.03958609f, -0.01072688f, 6.43705716e-003f, + 0.02996500f, -0.03418507f, -0.01960307f, -0.01219154f, + -4.37000440e-003f, -0.02549453f, 0.02646318f, -0.01632513f, + 6.46516960e-003f, -0.01929734f, 4.78711911e-003f, 0.04962371f, + 0.03809111f, 0.07265724f, 0.05758125f, -0.03741554f, 0.01648608f, + -8.45285598e-003f, 0.03996826f, -0.08185477f, 0.02638875f, + -0.04026615f, -0.02744674f, -0.04071517f, 1.05096330e-003f, + -0.04741232f, -0.06733172f, 8.70434940e-003f, -0.02192543f, + 1.35350740e-003f, -0.03056974f, -0.02975521f, -0.02887780f, + -0.01210713f, -0.04828526f, -0.09066251f, -0.09969629f, -0.03665164f, + -8.88111943e-004f, -0.06826669f, -0.01866150f, -0.03627640f, + -0.01408288f, 0.01874239f, -0.02075835f, 0.09145175f, -0.03547291f, + 0.05396780f, 0.04198981f, 0.01301925f, -0.03384354f, -0.12201976f, + 0.06830920f, -0.03715654f, 9.55848210e-003f, 5.05685573e-003f, + 0.05659294f, 3.90764466e-003f, 0.02808490f, -0.05518097f, -0.03711621f, + -0.02835565f, -0.04420464f, -0.01031947f, 0.01883466f, + -8.49525444e-003f, -0.09419250f, -0.01269387f, -0.02133371f, + -0.10190815f, -0.07844430f, 2.43644323e-003f, -4.09610150e-003f, + 0.01202551f, -0.06452291f, -0.10593818f, -0.02464746f, -0.02199699f, + -0.07401930f, 0.07285886f, 8.87513801e-004f, 9.97662079e-003f, + 8.46779719e-003f, 0.03730333f, -0.02905126f, 0.03573337f, -0.04393689f, + -0.12014472f, 0.03176554f, -2.76015815e-003f, 0.10824566f, 0.05090732f, + -3.30179278e-003f, -0.05123822f, 5.04784798e-003f, -0.05664124f, + -5.99415926e-003f, -0.05341901f, -0.01221393f, 0.01291318f, + 9.91760660e-003f, -7.56987557e-003f, -0.06193124f, -2.24549137e-003f, + 0.01987562f, -0.02018840f, -0.06975540f, -0.06601523f, -0.03349112f, + -0.08910118f, -0.03371435f, -0.07406893f, -0.02248047f, -0.06159951f, + 2.77751544e-003f, -0.05723337f, -0.04792468f, 0.07518548f, + 2.77279224e-003f, 0.04211938f, 0.03100502f, 0.05278448f, 0.03954679f, + -0.03006846f, -0.03851741f, -0.02792403f, -0.02875333f, 0.01531280f, + 0.02186953f, -0.01989829f, 2.50679464e-003f, -0.10258728f, + -0.04785743f, -0.02887216f, 3.85063468e-003f, 0.01112236f, + 8.29218887e-003f, -0.04822981f, -0.04503597f, -0.03713100f, + -0.06988008f, -0.11002295f, -2.69209221e-003f, 1.85383670e-003f, + -0.05921049f, -0.06105053f, -0.08458050f, -0.04527602f, + 8.90329306e-004f, -0.05875023f, -2.68602883e-003f, -0.01591195f, + 0.03631859f, 0.05493166f, 0.07300330f, 5.53333294e-003f, 0.06400407f, + 0.01847740f, -5.76280477e-003f, -0.03210877f, 4.25160583e-003f, + 0.01166520f, -1.44864211e-003f, 0.02253744f, -0.03367080f, 0.06983195f, + -4.22323542e-003f, -8.89401045e-003f, -0.07943393f, 0.05199728f, + 0.06065201f, 0.04133492f, 1.44032843e-003f, -0.09585235f, -0.03964731f, + 0.04232114f, 0.01750465f, -0.04487902f, -7.59733608e-003f, 0.02011171f, + 0.04673622f, 0.09011173f, -0.07869188f, -0.04682482f, -0.05080139f, + -3.99383716e-003f, -0.05346331f, 0.01085723f, -0.03599333f, + -0.07097908f, 0.03551549f, 0.02680387f, 0.03471529f, 0.01790393f, + 0.05471273f, 9.62048303e-003f, -0.03180215f, 0.05864431f, 0.02330614f, + 0.01633144f, -0.05616681f, -0.10245429f, -0.08302189f, 0.07291322f, + -0.01972590f, -0.02619633f, -0.02485327f, -0.04627592f, + 1.48853404e-003f, 0.05514185f, -0.01270860f, -0.01948900f, 0.06373586f, + 0.05002292f, -0.03009798f, 8.76216311e-003f, -0.02474238f, + -0.05504891f, 1.74034527e-003f, -0.03333667f, 0.01524987f, 0.11663762f, + -1.32344989e-003f, -0.06608453f, 0.05687166f, -6.89525274e-004f, + -0.04402352f, 0.09450210f, -0.04222684f, -0.05360983f, 0.01779531f, + 0.02561388f, -0.11075410f, -8.77790991e-003f, -0.01099504f, + -0.10380266f, 0.03103457f, -0.02105741f, -0.07371717f, 0.05146710f, + 0.10581432f, -0.08617968f, -0.02892107f, 0.01092199f, 0.14551543f, + -2.24320893e-003f, -0.05818033f, -0.07390742f, 0.05701261f, + 0.12937020f, -0.04986651f, 0.10182415f, 0.05028650f, 0.12515625f, + 0.09175041f, 0.06404983f, 0.01523394f, 0.09460562f, 0.06106631f, + -0.14266998f, -0.02926703f, 0.02762171f, 0.02164151f, + -9.58488265e-004f, -0.04231362f, -0.09866509f, 0.04322244f, + 0.05872034f, -0.04838847f, 0.06319253f, 0.02443798f, -0.03606876f, + 9.38737206e-003f, 0.04289991f, -0.01027411f, 0.08156885f, 0.08751175f, + -0.13191354f, 8.16054735e-003f, -0.01452161f, 0.02952677f, 0.03615945f, + -2.09128903e-003f, 0.02246693f, 0.09623287f, 0.09412123f, -0.02924758f, + -0.07815186f, -0.02203079f, -2.02566991e-003f, 0.01094733f, + -0.01442332f, 0.02838561f, 0.11882371f, 7.28798332e-003f, -0.10345965f, + 0.07561217f, -0.02049661f, 4.44177445e-003f, 0.01609347f, -0.04893158f, + -0.08758243f, -7.67420698e-003f, 0.08862378f, 0.06098121f, 0.06565887f, + 7.32981879e-003f, 0.03558407f, -0.03874352f, -0.02490055f, + -0.06771075f, 0.09939223f, -0.01066077f, 0.01382995f, -0.07289080f, + 7.47184316e-003f, 0.10621431f, -0.02878659f, 0.02383525f, -0.03274646f, + 0.02137008f, 0.03837290f, 0.02450992f, -0.04296818f, -0.02895143f, + 0.05327370f, 0.01499020f, 0.04998732f, 0.12938657f, 0.09391870f, + 0.04292390f, -0.03359194f, -0.06809492f, 0.01125796f, 0.17290455f, + -0.03430733f, -0.06255233f, -0.01813114f, 0.11726857f, -0.06127599f, + -0.08677909f, -0.03429872f, 0.04684938f, 0.08161420f, 0.03538774f, + 0.01833884f, 0.11321855f, 0.03261845f, -0.04826299f, 0.01752407f, + -0.01796414f, -0.10464549f, -3.30041884e-003f, 2.29343961e-004f, + 0.01457292f, -0.02132982f, -0.02602923f, -9.87351313e-003f, + 0.04273872f, -0.02103316f, -0.07994065f, 0.02614958f, -0.02111666f, + -0.06964913f, -0.13453490f, -0.06861878f, -6.09341264e-003f, + 0.08251446f, 0.15612499f, 2.46531400e-003f, 8.88424646e-003f, + -0.04152999f, 0.02054853f, 0.05277953f, -0.03087788f, 0.02817579f, + 0.13939077f, 0.07641046f, -0.03627627f, -0.03015098f, -0.04041540f, + -0.01360690f, -0.06227205f, -0.02738223f, 0.13577610f, 0.15235767f, + -0.05392922f, -0.11175954f, 0.02157129f, 0.01146481f, -0.05264937f, + -0.06595174f, -0.02749175f, 0.11812254f, 0.17404149f, -0.06137035f, + -0.11003478f, -0.01351621f, -0.01745916f, -0.08577441f, -0.04469909f, + -0.06106115f, 0.10559758f, 0.20806813f, -0.09174948f, 7.09621934e-004f, + 0.03579374f, 0.07215115f, 0.02221742f, 0.01827742f, -7.90785067e-003f, + 0.01489554f, 0.14519960f, -0.06425831f, 0.02990399f, -1.80181325e-003f, + -0.01401528f, -0.04171134f, -3.70530109e-003f, -0.09090481f, + 0.09520713f, 0.08845516f, -0.02651753f, -0.03016730f, 0.02562448f, + 0.03563816f, -0.03817881f, 0.01433385f, 0.02256983f, 0.02872120f, + 0.01001934f, -0.06332260f, 0.04338406f, 0.07001807f, -0.04705722f, + -0.07318907f, 0.02630457f, 0.03106382f, 0.06648342f, 0.10913180f, + -0.01630815f, 0.02910308f, 0.02895109f, 0.08040254f, 0.06969310f, + 0.06797734f, 6.08639978e-003f, 4.16588830e-003f, 0.08926726f, + -0.03123648f, 0.02700146f, 0.01168734f, -0.01631594f, 4.61015804e-003f, + 8.51359498e-003f, -0.03544224f, 0.03571994f, 4.29766066e-003f, + -0.01970077f, -8.79793242e-003f, 0.09607988f, 0.01544222f, + -0.03923707f, 0.07308586f, 0.06061262f, 1.31683104e-004f, + -7.98222050e-003f, 0.02399261f, -0.06084389f, -0.02743429f, + -0.05475523f, -0.04131311f, 0.03559756f, 0.03055342f, 0.02981433f, + 0.14860515f, 0.01766787f, 0.02945257f, 0.04898238f, 0.01026922f, + 0.02811658f, 0.08267091f, 0.02732154f, -0.01237693f, 0.11760156f, + 0.03802063f, -0.03309754f, 5.24957618e-003f, -0.02460510f, 0.02691451f, + 0.05399988f, -0.10133506f, 0.06385437f, -0.01818005f, 0.02259503f, + 0.03573135f, 0.01042848f, -0.04153402f, -0.04043029f, 0.01643575f, + 0.08326677f, 4.61383024e-004f, -0.05308095f, -0.08536223f, + -1.61011645e-003f, -0.02163720f, -0.01783352f, 0.03859637f, + 0.08498885f, -0.01725216f, 0.08625131f, 0.10995087f, 0.09177644f, + 0.08498347f, 0.07646490f, 0.05580502f, 0.02693516f, 0.09996913f, + 0.09070327f, 0.06667200f, 0.05873008f, -0.02247842f, 0.07772321f, + 0.12408436f, 0.12629253f, -8.41997913e-004f, 0.01477783f, 0.09165990f, + -2.98401713e-003f, -0.06466447f, -0.07057302f, 2.09516948e-004f, + 0.02210209f, -0.02158809f, -0.08602506f, -0.02284836f, + 4.01876355e-003f, 9.56660323e-003f, -0.02073978f, -0.04635138f, + -7.59423291e-003f, -0.01377393f, -0.04559359f, -0.13284740f, + -0.08671406f, -0.03654395f, 0.01142869f, 0.03287891f, -0.04392983f, + 0.06142959f, 0.17710890f, 0.10385257f, 0.01329137f, 0.10067633f, + 0.12450829f, -0.04476709f, 0.09049144f, 0.04589312f, 0.11167907f, + 0.08587538f, 0.04767583f, 1.67188141e-003f, 0.02359802f, -0.03808852f, + 0.03126272f, -0.01919029f, -0.05698918f, -0.02365112f, -0.06519032f, + -0.05599358f, -0.07097308f, -0.03301812f, -0.04719102f, -0.02566297f, + 0.01324074f, -0.09230672f, -0.05518232f, -0.04712864f, -0.03380903f, + -0.06719479f, 0.01183908f, -0.09326738f, 0.01642865f, 0.03789867f, + -6.61567831e-003f, 0.07796386f, 0.07246574f, 0.04706347f, -0.02523437f, + -0.01696830f, -0.08068866f, 0.06030888f, 0.10527060f, -0.06611756f, + 0.02977346f, 0.02621830f, 0.01913855f, -0.08479366f, -0.06322418f, + -0.13570616f, -0.07644490f, 9.31900274e-003f, -0.08095149f, + -0.10197903f, -0.05204025f, 0.01413151f, -0.07800411f, -0.01885122f, + -0.07509381f, -0.10136326f, -0.05212355f, -0.09944065f, + -1.33606605e-003f, -0.06342617f, -0.04178550f, -0.12373723f, + -0.02832736f, -0.06057501f, 0.05830070f, 0.07604282f, -0.06462587f, + 8.02447461e-003f, 0.11580125f, 0.12332212f, 0.01978462f, + -2.72378162e-003f, 0.05850752f, -0.04674481f, 0.05148062f, + -2.62542837e-003f, 0.11253355f, 0.09893716f, 0.09785093f, -0.04659257f, + -0.01102429f, -0.07002308f, 0.03088913f, -0.02565549f, -0.07671449f, + 3.17443861e-003f, -0.10783514f, -0.02314270f, -0.11089555f, + -0.01024768f, 0.03116021f, -0.04964825f, 0.02281825f, 5.50005678e-003f, + -0.08427856f, -0.14685495f, -0.07719755f, -0.13342668f, -0.04525511f, + -0.09914210f, 0.02588859f, 0.03469279f, 0.04664020f, 0.11688190f, + 0.09647275f, 0.10857815f, -0.01448726f, 0.04299758f, -0.06763151f, + 1.33257592e-003f, 0.14331576f, 0.07574340f, 0.09166205f, 0.05674926f, + 0.11325553f, -0.01106494f, 0.02062161f, -0.11484840f, -0.07492137f, + -0.02864293f, -0.01275638f, -0.06946032f, -0.10101652f, -0.04113498f, + -0.02214783f, -0.01273942f, -0.07480393f, -0.10556041f, -0.07622112f, + -0.09988393f, -0.11453961f, -0.12073903f, -0.09412795f, -0.07146588f, + -0.04054537f, -0.06127083f, 0.04221122f, 0.07688113f, 0.04099256f, + 0.12663734f, 0.14683802f, 0.21761774f, 0.12525328f, 0.18431792f, + -1.66402373e-003f, 2.37777247e-003f, 0.01445475f, 0.03509416f, + 0.02654697f, 0.01716739f, 0.05374011f, 0.02944174f, 0.11323927f, + -0.01485456f, -0.01611330f, -1.85554172e-003f, -0.01708549f, + -0.05435753f, -0.05302101f, 0.05260378f, -0.03582945f, + -3.42867890e-004f, 1.36076682e-003f, -0.04436073f, -0.04228432f, + 0.03281291f, -0.05480836f, -0.10197772f, -0.07206279f, -0.10741059f, + -0.02366946f, 0.10278475f, -2.74783419e-003f, -0.03242477f, + 0.02308955f, 0.02835869f, 0.10348799f, 0.19580358f, 0.10252027f, + 0.08039929f, 0.05525554f, -0.13250865f, -0.14395352f, 3.13586881e-003f, + -0.03387071f, 8.94669443e-003f, 0.05406157f, -4.97324532e-003f, + -0.01189114f, 2.82919413e-004f, -0.03901557f, -0.04898705f, + 0.02164520f, -0.01382906f, -0.01850416f, 0.01869347f, -0.02450060f, + 0.02291678f, 0.08196463f, 0.03309153f, -0.10629974f, 0.02473924f, + 0.05344394f, -0.02404823f, -0.03243643f, -5.55244600e-003f, + -0.08009996f, 0.02811539f, 0.04235742f, 0.01859004f, 0.04902123f, + -0.01438252f, -0.01526853f, 0.02044195f, -0.05008660f, 0.04244113f, + 0.07611816f, 0.04950470f, -0.06020549f, -4.26026015e-003f, 0.13133512f, + -0.01438738f, -0.01958807f, -0.04044152f, -0.12425045f, + 2.84353318e-003f, -0.05042776f, -0.09121484f, 7.34345755e-003f, + 0.09388847f, 0.11800314f, 4.72295098e-003f, 4.44378285e-003f, + -0.07984917f, -0.03613737f, 0.04490915f, -0.02246483f, 0.04681071f, + 0.05240871f, 0.02157206f, -0.04603431f, -0.01197929f, -0.02748779f, + 0.13621049f, 0.08812155f, -0.07802048f, 4.86458559e-003f, -0.01598836f, + 0.01024450f, -0.03463517f, -0.02304239f, -0.08692665f, 0.06655128f, + 0.05785803f, -0.12640759f, 0.02307472f, 0.07337402f, 0.07525434f, + 0.04943763f, -0.02241034f, -0.09978238f, 0.14487994f, -0.06570521f, + -0.07855482f, 0.02830222f, -5.29603509e-004f, -0.04669895f, + -0.11822784f, -0.12246452f, -0.15365660f, -0.02969127f, 0.08078201f, + 0.13512598f, 0.11505685f, 0.04740673f, 0.01376022f, -0.05852978f, + -0.01537809f, -0.05541119f, 0.02491065f, -0.02870786f, 0.02760978f, + 0.23836176f, 0.22347429f, 0.10306466f, -0.06919070f, -0.10132039f, + -0.20198342f, -0.05040560f, 0.27163076f, 0.36987007f, 0.34540465f, + 0.29095781f, 0.05649706f, 0.04125737f, 0.07505883f, -0.02737836f, + -8.43431335e-003f, 0.07368195f, 0.01653876f, -0.09402955f, + -0.09574359f, 0.01474337f, -0.07128561f, -0.03460737f, 0.11438941f, + 0.13752601f, -0.06385452f, -0.06310338f, 8.19548313e-003f, 0.11622470f, + 5.05133113e-003f, -0.07602754f, 0.06695660f, 0.25723928f, 0.09037900f, + 0.28826267f, 0.13165380f, -0.05312614f, -0.02137198f, -0.03442232f, + -0.06255679f, 0.03899667f, 0.18391028f, 0.26016650f, 0.03374462f, + 0.01860465f, 0.19077586f, 0.18160543f, 3.43634398e-003f, -0.03036782f, + 0.19683038f, 0.35378191f, 0.24968483f, -0.03222649f, 0.28972381f, + 0.43091634f, 0.30778357f, 0.02335266f, -0.09877399f, -6.85245218e-003f, + 0.08945240f, -0.08150686f, 0.02792493f, 0.24806842f, 0.17338486f, + 0.06231801f, -0.10432383f, -0.16653322f, -0.13197899f, -0.08531576f, + -0.19271527f, -0.13536365f, 0.22240199f, 0.39219588f, 0.26597717f, + -0.01231649f, 0.01016179f, 0.13379875f, 0.12018334f, -0.04852953f, + -0.07915270f, 0.07036012f, 3.87723115e-003f, -0.06126805f, + -0.15015170f, -0.11406515f, -0.08556531f, -0.07429333f, -0.16115491f, + 0.13214062f, 0.25691369f, 0.05697750f, 0.06861912f, -6.02903729e-003f, + -7.94562511e-003f, 0.04799571f, 0.06695165f, -0.01926842f, 0.06206308f, + 0.13450983f, -0.06381495f, -2.98370165e-003f, -0.03482971f, + 7.53991678e-003f, 0.03895611f, 0.11464261f, 0.01669971f, + 8.27818643e-003f, -7.49160210e-003f, -0.11712562f, -0.10650621f, + -0.10353880f, -0.04994106f, -7.65618810e-004f, 0.03023767f, + -0.04759270f, -0.07302686f, -0.05825012f, -0.13156348f, -0.10639747f, + -0.19393684f, -0.09973683f, -0.07918908f, 4.63177625e-004f, + -6.61382044e-004f, 0.15853868f, 0.08561199f, -0.07660093f, + -0.08015265f, -0.06164073f, 0.01882577f, -7.29908410e-004f, + 0.06840892f, 0.03843764f, 0.20274927f, 0.22028814f, -5.26101235e-003f, + 0.01452435f, -0.06331623f, 0.02865064f, 0.05673740f, 0.12171564f, + 0.03837196f, 0.03555467f, -0.02662914f, -0.10280123f, -0.06526285f, + -0.11066351f, -0.08988424f, -0.10103678f, 8.10526591e-003f, + 5.95238712e-003f, 0.02617721f, -0.01705742f, -0.10897956f, + -0.08004991f, -0.11271993f, -0.06185647f, -0.06103712f, 0.01597041f, + -0.05923606f, 0.09410726f, 0.22858568f, 0.03263380f, 0.06772990f, + -0.09003516f, 0.01017870f, 0.01931688f, 0.08628357f, -0.01430009f, + 0.10954945f, 0.16612452f, -0.02434544f, -0.03310068f, -0.04236627f, + 0.01212392f, -6.15046406e-003f, 0.06954194f, 0.03015283f, 0.01787957f, + 0.02781667f, -0.05561153f, -8.96244217e-003f, -0.04971489f, + 0.07510284f, 0.01775282f, 0.05889897f, -0.07981427f, 0.03647643f, + -3.73833324e-003f, -0.08894575f, -0.06429435f, -0.08068276f, + 0.03567704f, -0.07131936f, -7.21910037e-003f, -0.09566668f, + 0.17886090f, 0.14911725f, 0.02070032f, -0.05017120f, -0.04992622f, + 0.01570143f, -0.09906903f, 0.06456193f, 0.15329507f, 0.18820767f, + 0.11689861f, -0.01178513f, -0.02225163f, -0.01905318f, 0.10271224f, + -7.27029052e-003f, 0.11664233f, 0.14796902f, 0.07771893f, 0.02400013f, + -0.05361797f, -0.01972888f, 0.01376177f, 0.06740040f, -0.06525395f, + 0.05726178f, -0.02404981f, -0.14018567f, -0.02074987f, -0.04621970f, + -0.04688627f, -0.01842059f, 0.07722727f, -0.04852883f, 0.01529004f, + -0.19639495f, 0.10817073f, 0.03795860f, -0.09435206f, -0.07984378f, + -0.03383440f, 0.11081333f, 0.02237366f, 0.12703256f, 0.21613893f, + 0.02918790f, 4.66472283e-003f, -0.10274266f, -0.04854131f, + -3.46305710e-003f, 0.08652268f, 0.02251546f, 0.09636052f, 0.17180754f, + -0.09272388f, 4.59174305e-004f, -0.11723048f, -0.12210111f, + -0.15547538f, 0.07218186f, -0.05297846f, 0.03779940f, 0.05150875f, + -0.03802310f, 0.03870645f, -0.15250699f, -0.08696499f, -0.02021560f, + 0.04118926f, -0.15177974f, 0.01577647f, 0.10249301f, 7.50041893e-003f, + 0.01721806f, -0.06828983f, -0.02397596f, -0.06598977f, -0.04317593f, + -0.08064980f, 6.66632550e-003f, 0.03333484f, 0.07093620f, 0.08231064f, + -0.06577903f, -0.06698844f, -0.06984019f, -0.06508023f, -0.14145090f, + -0.02393239f, 0.06485303f, 8.83263443e-003f, 0.09251080f, -0.07557579f, + -0.05067699f, -0.09798748f, -0.06703258f, -0.14056294f, 0.03245994f, + 0.12554143f, 0.01761621f, 0.12980327f, -0.04081950f, -0.11906909f, + -0.14813015f, -0.08376863f, -0.12200681f, 0.04988137f, 0.05424247f, + -3.90952639e-003f, 0.03255733f, -0.12717837f, -0.07461493f, + -0.05703964f, -0.01736189f, -0.08026433f, -0.05433894f, -0.01719359f, + 0.02886275f, 0.01772653f, -0.09163518f, 3.57789593e-003f, -0.10129993f, + -0.02653764f, -0.08131415f, -0.03847986f, -7.62157550e-004f, + 0.06486648f, 0.19675669f, -0.04919156f, -0.07059129f, -0.04857785f, + -0.01042383f, -0.08328653f, 0.03660302f, -0.03696846f, 0.04969259f, + 0.08241162f, -0.12514858f, -0.06122676f, -0.03750202f, + 6.52989605e-003f, -0.10247213f, 0.02568346f, 4.51781414e-003f, + -0.03734229f, -0.01131264f, -0.05412074f, 8.89345480e-004f, + -0.12388977f, -0.05959237f, -0.12418608f, -0.06151643f, -0.07310260f, + 0.02441575f, 0.07023528f, -0.07548289f, -7.57147965e-004f, + -0.09061348f, -0.08112976f, -0.06920306f, 9.54394229e-003f, + -0.01219902f, 1.21273217e-003f, -8.88989680e-003f, -0.08309301f, + -0.04552661f, -0.10739882f, -0.05691034f, -0.13928030f, 0.09027749f, + 0.15123098f, 0.03175976f, 0.17763577f, 3.29913251e-004f, 0.05151888f, + -0.09844074f, -0.09475287f, -0.08571247f, 0.16241577f, 0.19336018f, + 8.57454538e-003f, 0.11474732f, -0.01493934f, 0.03352379f, -0.08966240f, + -0.02322310f, 0.02663568f, 0.05448750f, -0.03536883f, -0.07210463f, + -0.06807277f, -0.03121621f, -0.05932408f, -0.17282860f, -0.15873498f, + -0.04956378f, 0.01603377f, -0.12385946f, 0.13878587f, 0.21468069f, + 0.13510075f, 0.20992437f, 0.08845878f, 0.08104013f, 0.03754176f, + 0.12173114f, 0.11103114f, 0.10643122f, 0.13941477f, 0.11640384f, + 0.14786847f, 0.01218238f, 0.01160753f, 0.03547940f, 0.08794311f, + -0.01695384f, -0.07692261f, -0.08236158f, 6.79194089e-003f, + -0.02458403f, 0.13022894f, 0.10953187f, 0.09857773f, 0.04735930f, + -0.04353498f, -0.15173385f, -0.17904443f, -0.10450364f, -0.13418166f, + -0.06633098f, -0.03170381f, -0.06839000f, -0.11350126f, -0.06983913f, + 0.19083543f, 0.17604128f, 0.07730632f, 0.10022651f, 0.36428109f, + 0.28291923f, 0.12688625f, 0.15942036f, 0.14064661f, -0.11201853f, + -0.13969108f, -0.09088077f, -0.14107047f, 0.05117374f, + -2.63348082e-003f, -0.10794610f, -0.09715455f, -0.05284977f, + 0.01565668f, 0.05031200f, 0.07021113f, -0.02963028f, 0.01766960f, + 0.08333644f, -0.03211382f, 4.90096770e-003f, 0.05186674f, -0.05045737f, + -0.09624767f, -0.02525997f, 0.06916669f, 0.01213916f, 0.05333899f, + -0.03443280f, -0.10055527f, -0.06291115f, 5.42851724e-003f, + -6.30360236e-003f, 0.02270257f, -0.01769792f, 0.03273688f, 0.07746078f, + 7.77099328e-003f, 0.05041346f, 0.01648103f, -0.02321534f, -0.09930186f, + -0.02293853f, 0.02034990f, -0.08324204f, 0.08510064f, -0.03732836f, + -0.06465405f, -0.06086946f, 0.13680504f, -0.11469388f, -0.03896406f, + -0.07142810f, 2.67581246e-003f, -0.03639632f, -0.09849060f, + -0.11014334f, 0.17489147f, 0.17610909f, -0.16091567f, -0.07248894f, + 0.01567141f, 0.23742996f, 0.07552249f, -0.06270349f, -0.07303379f, + 0.25442186f, 0.16903116f, -0.08168741f, -0.05913896f, -0.03954096f, + 6.81776879e-003f, -0.05615319f, -0.07303037f, -0.12176382f, + 0.12385108f, 0.22084464f, -0.05543206f, -0.03310431f, 0.05731593f, + 0.19481890f, 0.04016430f, -0.06480758f, -0.12353460f, 0.18733442f, + -0.09631214f, -0.11192076f, 0.12404587f, 0.15671748f, 0.19256128f, + 0.10895617f, 0.03391477f, -0.13032004f, -0.05626907f, -0.09025607f, + 0.23485197f, 0.27812332f, 0.26725492f, 0.07255980f, 0.16565137f, + 0.22388470f, 0.07441066f, -0.21003133f, -0.08075339f, -0.15031935f, + 0.07023834f, 0.10872041f, 0.18156518f, 0.20037253f, 0.13571967f, + -0.11915682f, -0.11131983f, -0.18878011f, 0.06074620f, 0.20578890f, + 0.12413109f, 0.03930207f, 0.29176015f, 0.29502738f, 0.27856228f, + -0.01803601f, 0.16646385f, 0.19268319f, 0.01900682f, 0.06026287f, + 2.35868432e-003f, 0.01558199f, 0.02707230f, 0.11383014f, 0.12103992f, + 0.03907350f, 0.04637353f, 0.09020995f, 0.11919726f, -3.63007211e-003f, + 0.02220155f, 0.10336831f, 0.17351882f, 0.12259731f, 0.18983354f, + 0.15736865f, 0.01160725f, -0.01690723f, -9.69582412e-004f, 0.07213813f, + 0.01161613f, 0.17864859f, 0.24486147f, 0.18208991f, 0.20177495f, + 0.05972528f, -8.93934630e-003f, -0.02316955f, 0.14436610f, 0.14114498f, + 0.05520950f, 0.06353590f, -0.19124921f, 0.10174713f, 0.29414919f, + 0.26448128f, 0.09344960f, 0.15284036f, 0.19797507f, 0.11369792f, + -0.12722753f, -0.21396367f, -0.02008235f, -0.06566695f, -0.01662150f, + -0.03937003f, 0.04778343f, 0.05017274f, -0.02299062f, -0.20208496f, + -0.06395898f, 0.13721776f, 0.22544557f, 0.14888357f, 0.08687132f, + 0.27088094f, 0.32206613f, 0.09782200f, -0.18523243f, -0.17232181f, + -0.01041531f, 0.04008654f, 0.04199702f, -0.08081299f, -0.03755421f, + -0.04809646f, -0.05222081f, -0.21709201f, -0.06622940f, 0.02945281f, + -0.04600435f, -0.05256077f, -0.08432942f, 0.02848100f, 0.03490564f, + 8.28621630e-003f, -0.11051246f, -0.11210597f, -0.01998289f, + -0.05369405f, -0.08869293f, -0.18799506f, -0.05436598f, -0.05011634f, + -0.05419716f, -0.06151857f, -0.10827805f, 0.04346735f, 0.04016083f, + 0.01520820f, -0.12173316f, -0.04880285f, -0.01101406f, 0.03250847f, + -0.06009551f, -0.03082932f, -0.02295134f, -0.06856834f, -0.08775249f, + -0.23793389f, -0.09174541f, -0.05538322f, -0.04321031f, -0.11874759f, + -0.04221844f, -0.06070468f, 0.01194489f, 0.02608565f, -0.03892140f, + -0.01643151f, -0.02602034f, -0.01305472f, 0.03920100f, -0.06514261f, + 0.01126918f, -6.27710763e-003f, -0.02720047f, -0.11133634f, + 0.03300330f, 0.02398472f, 0.04079665f, -0.10564448f, 0.05966159f, + 0.01195221f, -0.03179441f, -0.01692590f, -0.06177841f, 0.01841576f, + -5.51078189e-003f, -0.06821765f, -0.03191888f, -0.09545476f, + 0.03030550f, -0.04896152f, -0.02914624f, -0.13283344f, -0.04783419f, + 6.07836898e-003f, -0.01449538f, -0.13358212f, -0.09687774f, + -0.02813793f, 0.01213498f, 0.06650011f, -0.02039067f, 0.13356198f, + 0.05986415f, -9.12760664e-003f, -0.18780160f, -0.11992817f, + -0.06342237f, 0.01229534f, 0.07143231f, 0.10713009f, 0.11085765f, + 0.06569190f, -0.02956399f, -0.16288325f, -0.13993549f, -0.01292515f, + 0.03833013f, 0.09130384f, -0.05086257f, 0.05617329f, -0.03896667f, + -0.06282311f, -0.11490010f, -0.14264110f, -0.04530499f, 0.01598189f, + 0.09167797f, 0.08663294f, 0.04885277f, -0.05741219f, -0.07565769f, + -0.17136464f, -0.02619422f, -0.02477579f, 0.02679587f, 0.11621952f, + 0.08788391f, 0.15520640f, 0.04709549f, 0.04504483f, -0.10214074f, + -0.12293372f, -0.04820546f, -0.05484834f, 0.05473754f, 0.07346445f, + 0.05577277f, -0.08209965f, 0.03462975f, -0.20962234f, -0.09324598f, + 3.79481679e-003f, 0.03617633f, 0.16742408f, 0.07058107f, 0.10204960f, + -0.06795346f, 3.22807301e-003f, -0.12589309f, -0.17496960f, + 0.02078314f, -0.07694324f, 0.12184640f, 0.08997164f, 0.04793497f, + -0.11383379f, -0.08046359f, -0.25716835f, -0.08080962f, + 6.80711539e-003f, -0.02930280f, -3.04938294e-003f, -0.11106286f, + -0.04628860f, -0.07821649f, 7.70127494e-003f, -0.10247706f, + 1.21042714e-003f, 0.20573859f, -0.03241005f, 8.42972286e-003f, + 0.01946464f, -0.01197973f, -0.14579976f, 0.04233614f, + -4.14096704e-003f, -0.06866436f, -0.02431862f, -0.13529138f, + 1.25891645e-003f, -0.11425111f, -0.04303651f, -0.01694815f, + 0.05720210f, -0.16040207f, 0.02772896f, 0.05498345f, -0.15010567f, + 0.01450866f, 0.02350303f, -0.04301004f, -0.04951802f, 0.21702233f, + -0.03159155f, -0.01963303f, 0.18232647f, -0.03263875f, + -2.88476888e-003f, 0.01587562f, -1.94303901e-003f, -0.07789494f, + 0.04674156f, -6.25576358e-003f, 0.08925962f, 0.21353747f, 0.01254677f, + -0.06999976f, -0.05931328f, -0.01884327f, -0.04306272f, 0.11794136f, + 0.03842728f, -0.03907030f, 0.05636114f, -0.09766009f, -0.02104000f, + 8.72711372e-003f, -0.02736877f, -0.05112274f, 0.16996814f, 0.02955785f, + 0.02094014f, 0.08414304f, -0.03335762f, -0.03617457f, -0.05808248f, + -0.08872101f, 0.02927705f, 0.27077839f, 0.06075108f, 0.07478261f, + 0.15282831f, -0.03908454f, -0.05101782f, -9.51998029e-003f, + -0.03272416f, -0.08735625f, 0.07633440f, -0.07185312f, 0.13841286f, + 0.07812646f, -0.12901451f, -0.05488589f, -0.05644578f, -0.03290703f, + -0.11184757f, 0.03751570f, -0.05978153f, -0.09155276f, 0.05657315f, + -0.04328186f, -0.03047933f, -0.01413135f, -0.10181040f, -0.01384013f, + 0.20132534f, -0.01536873f, -0.07641169f, 0.05906778f, -0.07833145f, + -0.01523801f, -0.07502609f, -0.09461885f, -0.15013233f, 0.16050665f, + 0.09021381f, 0.08473236f, 0.03386267f, -0.09147339f, -0.09170618f, + -0.08498498f, -0.05119187f, -0.10431040f, 0.01041618f, -0.03064913f, + 0.09340212f, 0.06448522f, -0.03881054f, -0.04985436f, -0.14794017f, + -0.05200112f, -0.02144495f, 0.04000821f, 0.12420804f, -0.01851651f, + -0.04116732f, -0.11951703f, -0.04879033f, -0.08722515f, -0.08454733f, + -0.10549165f, 0.11251976f, 0.10766345f, 0.19201984f, 0.06128913f, + -0.02734615f, -0.08834923f, -0.16999826f, -0.03548348f, + -5.36092324e-003f, 0.08297954f, 0.07226378f, 0.04194529f, 0.04668673f, + 8.73902347e-003f, 0.06980139f, 0.05652480f, 0.05879445f, 0.02477076f, + 0.02451423f, 0.12433673f, 0.05600227f, 0.06886370f, 0.03863076f, + 0.07459056f, 0.02264139f, 0.01495469f, 0.06344220f, 0.06945208f, + 0.02931899f, 0.11719371f, 0.04527427f, 0.03248192f, 2.08271481e-003f, + 0.02044626f, 0.11403449f, 0.04303892f, 0.06444661f, 0.04959024f, + 0.08174094f, 0.09240247f, 0.04894639f, 0.02252937f, -0.01652530f, + 0.07587013f, 0.06064249f, 0.13954395f, 0.02772832f, 0.07093039f, + 0.08501238f, 0.01701301f, 0.09055722f, 0.33421436f, 0.20163782f, + 0.09821030f, 0.07951369f, 0.08695120f, -0.12757730f, -0.13865978f, + -0.06610068f, -0.10985506f, 0.03406816f, -0.01116336f, -0.07281768f, + -0.13525715f, -0.12844718f, 0.08956250f, 0.09171610f, 0.10092317f, + 0.23385370f, 0.34489515f, 0.09901748f, 0.02002922f, 0.12335990f, + 0.07606190f, -0.14899330f, -0.15634622f, -0.06494618f, -0.01760547f, + 0.03404277f, -0.13208845f, -0.12101169f, -0.18294574f, -0.16560709f, + 0.02183887f, -0.02752613f, 0.01813638f, 0.02000757f, 0.01319924f, + 0.08030242f, 0.01220535f, 2.98233377e-003f, -0.01307070f, 0.05970297f, + -0.05345284f, -0.03381982f, -9.87543724e-003f, -0.06869387f, + 0.03956730f, -0.03108176f, -0.05732809f, 0.02172386f, 0.04159765f, + 2.62783933e-003f, 0.04813229f, 0.09358983f, -8.18389002e-003f, + 0.01724574f, -0.02547474f, -0.04967288f, -0.02390376f, 0.06640504f, + -0.06306566f, 0.01137518f, 0.05589378f, -0.08237787f, 0.02455001f, + -0.03059422f, -0.08953978f, 0.06851497f, 0.07190268f, -0.07610799f, + 7.87237938e-003f, -7.85830803e-003f, 0.06006952f, -0.01126728f, + -2.85743061e-003f, -0.04772895f, 0.01884944f, 0.15005857f, + -0.06268821f, -0.01989072f, 0.01138399f, 0.08760451f, 0.03879007f, + -9.66926850e-003f, -0.08012961f, 0.06414555f, -0.01362950f, + -0.09135523f, 0.01755159f, 0.04459474f, 0.09650917f, 0.05219948f, + -2.19440833e-003f, -0.07037939f, -0.01599054f, 0.13103317f, + -0.02492603f, -0.01032540f, -0.02903307f, 0.04489160f, 0.05148086f, + 0.01858173f, -0.02919228f, 0.08299296f, -0.04590359f, -0.15745632f, + -0.09068198f, -0.02972453f, 0.12985018f, 0.22320485f, 0.24261914f, + 0.03642650f, -0.05506422f, 2.67413049e-003f, -0.03834032f, 0.06449424f, + 0.03834866f, 0.03816991f, 0.25039271f, 0.34212017f, 0.32433882f, + 0.18824573f, -0.08599839f, -0.17599408f, -0.15317015f, -0.09913155f, + -0.02856072f, -0.05304699f, -1.06437842e-003f, -0.06641813f, + -0.07509298f, 0.01463361f, -0.07551918f, -0.04510373f, + -8.44620075e-003f, 0.01772176f, 0.04068235f, 0.20295307f, 0.15719447f, + 0.05712103f, 0.26296997f, 0.14657754f, 0.01547317f, -0.05052776f, + -0.03881342f, -0.01437883f, -0.04930177f, 0.11719568f, 0.24098417f, + 0.26468599f, 0.31698579f, 0.10103608f, -0.01096375f, -0.01367013f, + 0.17104232f, 0.20065314f, 2.67622480e-003f, -0.01190034f, 0.18301608f, + 0.09459770f, -0.06357619f, -0.06473801f, 0.01377906f, -0.10032775f, + -0.06388740f, 3.80393048e-003f, 0.06206078f, 0.10349120f, 0.26804337f, + 8.17918684e-003f, -0.02314351f, 9.34422202e-003f, 0.09198381f, + 0.03681326f, -8.77339672e-003f, -0.09662418f, -0.02715708f, + 0.13503517f, 0.08962728f, -6.57071499e-003f, -0.03201199f, 0.28510824f, + 0.32095715f, 0.18512695f, -0.14230858f, -0.14048551f, -0.07181299f, + -0.08575408f, -0.08661680f, -0.17416079f, 7.54326640e-004f, + 0.05601677f, 0.13585392f, -0.04960437f, -0.07708392f, 0.10676333f, + -0.04407546f, -0.07209078f, 0.03663663f, 0.28949317f, 0.41127121f, + 0.27431169f, -0.06900328f, -0.21474190f, -0.15578632f, -0.19555484f, + -0.15209621f, -0.11269179f, 0.07416003f, 0.18991330f, 0.26858172f, + 0.01952259f, 0.01017922f, 0.02159843f, -4.95165400e-003f, -0.04368168f, + -0.12721671f, -0.06673957f, -0.11275250f, 0.04413409f, 0.05578312f, + 0.03896771f, 0.03566417f, -0.05871816f, -0.07388090f, -0.17965563f, + -0.08570268f, -0.15273231f, -0.06022318f, -0.06999847f, + -6.81510568e-003f, 0.06294262f, -6.54901436e-004f, -0.01128654f, + -0.02289657f, 0.04849290f, 0.04140804f, 0.23681939f, 0.14545733f, + 0.01989965f, 0.12032662f, 3.87463090e-003f, -6.02597650e-003f, + -0.05919775f, -0.03067224f, -0.07787777f, 0.10834727f, 0.02153730f, + 0.02765649f, 0.03975543f, -0.12182906f, -0.04900113f, -0.09940100f, + -0.06453611f, -0.13757215f, -0.03721382f, 0.02827376f, -0.04351249f, + 0.01907038f, -0.10284120f, -0.05671160f, -0.10760647f, -0.09624009f, + -0.09565596f, -0.01303654f, 0.03080539f, 0.01416511f, 0.05846142f, + -5.42971538e-003f, 0.06221476f, -0.03320325f, -0.06791797f, + -0.05791342f, 0.12851369f, 0.14990346f, 0.03634374f, 0.14262885f, + 0.04330391f, 0.05032569f, -0.05631914f, 0.01606137f, 0.04387223f, + 0.22344995f, 0.15722635f, -0.04693628f, 0.03006579f, -2.52882647e-003f, + 0.05717621f, -0.07529724f, -0.02848588f, -0.06868757f, + -4.51729307e-003f, 0.06466042f, -0.05935378f, -0.04704857f, + -0.07363959f, 0.04843248f, -0.13421375f, -0.09789340f, -0.10255270f, + 0.03509852f, 0.04751543f, -0.03822323f, 0.09740467f, 0.04762916f, + 0.03940146f, -0.08283259f, 0.09552965f, 0.05038739f, 0.21258622f, + 0.09646992f, 0.03241193f, 0.05167701f, 0.04614570f, 0.04330090f, + -0.02671840f, -0.06259909f, -0.02301898f, 0.18829170f, 0.10522786f, + 0.04313190f, 0.01670948f, -0.08421925f, 0.05911417f, -0.10582602f, + -0.04855484f, -0.08373898f, 0.07775915f, 0.03723533f, -0.12047344f, + 4.86345543e-003f, -0.10520902f, 0.06571782f, -0.07528137f, + -0.03245651f, -0.09869066f, -0.02917477f, -0.18293270f, 0.14810945f, + 9.24033765e-003f, -0.04354914f, 0.02266885f, -0.11872729f, + -0.04016589f, 0.02830229f, 0.22539048f, 0.20565644f, 0.16701797f, + 0.09019924f, 0.01300652f, 0.09760600f, -0.03675831f, -0.01935448f, + -0.06894835f, 0.08077277f, 0.19047537f, 0.11312226f, 0.04106043f, + -0.11187182f, 0.04312806f, -0.18548580f, -0.11287174f, -0.08794551f, + 0.02078281f, -0.15295486f, 0.11806386f, -0.01103218f, -0.15971117f, + 0.02153538f, -0.05232147f, -0.10835317f, -0.13910367f, 0.05920752f, + -0.10122602f, 0.20174250f, 0.09105796f, -0.01881348f, 0.09559010f, + -0.03725745f, -0.09442931f, -0.09763174f, 0.05854454f, 0.08287182f, + 0.12919849f, 0.08594352f, -2.49806582e-003f, 0.02398440f, + 5.67950122e-003f, -0.06296340f, -0.12993270f, 0.03855852f, 0.05186560f, + 0.10839908f, -0.03380463f, -0.12654832f, -0.05399339f, -0.07456800f, + -0.04736232f, -0.10164231f, 0.07496139f, 0.08125214f, 0.07656177f, + -0.04999603f, -0.12823077f, -0.07692395f, -0.11317524f, -0.09118655f, + -0.05695669f, 0.10477209f, 0.07468581f, 0.01630048f, -8.00961629e-003f, + -0.06582128f, -0.04019095f, -0.04682907f, -0.01907842f, -0.10997720f, + 0.04911406f, 0.02931030f, 0.04197735f, -0.05773980f, -0.09670641f, + -0.03594951f, -0.03402121f, -0.07149299f, -0.10566200f, 0.10601286f, + 0.06340689f, -0.01518632f, -5.96402306e-003f, -0.07628012f, + -3.52779147e-003f, -0.02683854f, -0.10265494f, -0.02680815f, + 0.16338381f, 0.03103515f, 0.02296976f, 0.01624348f, -0.10831620f, + -0.02314233f, -0.04789969f, -0.05530700f, -0.06461314f, 0.10494506f, + 0.04642856f, -0.07592955f, -0.06197905f, -0.09042154f, -0.01445521f, + -0.04297818f, -0.11262015f, -0.11430512f, 0.03174541f, -0.03677487f, + -0.02963996f, -0.06610169f, -0.13292049f, -0.07059067f, -0.08444111f, + -0.02640536f, -0.07136250f, 0.04559967f, 0.01459980f, 0.17989251f, + 0.04435328f, -0.12464730f, -0.02871115f, -0.10752209f, -0.03393742f, + -0.03791408f, 0.02548251f, 0.01956050f, 0.19245651f, 0.13963254f, + -0.05904696f, -0.07424626f, -0.10411884f, 1.54176133e-003f, + 0.01797429f, 0.13025844f, 0.04547642f, -0.05710349f, -0.10697161f, + -0.13489437f, -0.06515755f, -0.06406886f, -4.08572936e-003f, + -0.01336483f, 0.04368737f, -0.11259720f, -0.05701635f, -0.06469971f, + -0.08346602f, -0.04166770f, -0.05795543f, -0.08247511f, -0.05742628f, + 0.08452254f, -0.03350224f, 0.13980860f, 0.13252275f, 0.07589617f, + 0.07539988f, 0.12155797f, 0.19087289f, 0.15050751f, 0.21250245f, + 0.14206800f, 0.01298489f, 0.07450245f, 0.06559097f, 0.01700557f, + 0.04512971f, 0.16950700f, 0.10261577f, 0.16389982f, 0.05505059f, + -0.03453077f, 0.08622462f, 0.07935954f, 0.03976260f, 0.02036091f, + 3.95744899e-003f, 0.03267065f, 0.15235919f, 0.01297494f, -0.08109194f, + 0.01407558f, 4.40693414e-003f, -0.15157418f, -0.11390478f, + -0.07487597f, -7.81322457e-003f, -0.02749545f, -0.10181408f, + 0.13755716f, 0.14007211f, 0.13482562f, 0.27517235f, 0.34251109f, + 0.07639657f, 0.07268607f, 0.19823882f, 0.16135791f, -0.04186463f, + -0.12784107f, -0.09846287f, 0.03169041f, 0.10974082f, -0.15051922f, + -0.08916726f, -0.07138767f, -0.04153349f, 6.25418453e-003f, + 0.01266654f, 0.10533249f, 0.12749144f, 0.15148053f, 0.01498513f, + 0.06305949f, -0.01247123f, -0.08778401f, -0.08551880f, -0.11955146f, + -0.08493572f, -0.02901620f, -0.02394859f, -0.13427313f, -0.11053200f, + -0.14413260f, -0.15203285f, 0.03972760f, -3.72127310e-004f, + -0.04200919f, 0.06105104f, 0.01904975f, -0.01106191f, + -7.27445772e-003f, -0.01520341f, 1.10228511e-003f, -0.04949187f, + -0.08013099f, 5.72071038e-003f, 0.08415454f, -0.06523152f, 0.03664081f, + -0.02673042f, -0.12066154f, -0.03702074f, 0.06006580f, 0.01628682f, + -6.17772620e-003f, 0.08192339f, -3.41629819e-003f, 0.02870512f, + 0.05807141f, 0.04959986f, 0.04618251f, -0.04901629f, -0.10579574f, + 0.02274442f, 0.12070961f, 2.23597488e-003f, 0.09831765f, -0.03019848f, + -0.11181970f, -0.04961075f, 0.02498928f, -0.03714991f, -0.01619653f, + 0.02643486f, -7.62964319e-003f, -0.02882290f, -0.06242594f, + -0.08439861f, 0.07220893f, 0.07263952f, 0.01561574f, 0.03091968f, + 0.01708712f, -0.03797151f, -3.18561122e-003f, 0.01624021f, + -0.02828573f, 0.11284444f, -1.32280716e-003f, -0.07784860f, + -0.07209100f, 0.03372242f, 0.12154529f, 0.02278104f, -0.05275500f, + -0.01918484f, 0.12989293f, 0.05424401f, 0.02333086f, 0.04029022f, + 0.12392918f, 0.09495489f, 0.09190340f, 0.07935889f, 8.76816828e-003f, + 0.17148446f, -8.51302687e-003f, -0.08011249f, -0.06796283f, + 0.04884845f, 0.01112272f, -0.07835306f, -1.14811445e-003f, + -0.03440760f, 0.02845243f, 0.07695542f, -0.07069533f, -0.01151784f, + -8.53884313e-003f, -0.01662786f, -0.04163864f, 0.05400505f, + 0.02859163f, 0.02921852f, 0.05003135f, -6.85718050e-003f, -0.01632611f, + 0.07780217f, 0.04042810f, -0.01216440f, 3.60914599e-003f, -0.06322435f, + 0.09516726f, 0.12877031f, -9.69162490e-003f, 0.01031179f, 0.05180895f, + -9.34659224e-003f, -0.01644533f, -0.04849347f, -0.04343236f, + 0.10514783f, 0.08046635f, -0.04615205f, -0.03975486f, -0.01485525f, + 0.13096830f, -0.01517950f, -0.06571898f, -0.04016372f, 0.01849786f, + 0.02439670f, 0.08067258f, 1.74824719e-003f, 0.07053747f, 0.08819518f, + -5.08352555e-003f, -0.06550863f, -0.08266170f, -0.07780605f, + 0.01453450f, -0.08756890f, 0.01096501f, -8.71319138e-003f, 0.10110464f, + 0.02420769f, -0.06708383f, 0.02007811f, 5.93133038e-003f, 0.05398923f, + 0.07538138f, 0.02049227f, 0.02242589f, 0.04011070f, -1.44875818e-003f, + -4.19115182e-003f, 0.06367654f, 0.02506934f, 0.02434536f, 0.05879405f, + -8.22952855e-003f, -0.01242441f, 0.04224926f, -0.01754923f, + 0.05958161f, 0.03818886f, -0.01830363f, -0.04308917f, -0.04422197f, + -0.02432721f, 0.02264866f, 2.03751423e-003f, 0.01197031f, 0.04439203f, + 0.12169247f, 0.03602713f, -0.02599251f, -1.98226492e-003f, 0.02046336f, + -0.02639058f, -1.91242550e-003f, -0.09334669f, -0.03595153f, + -9.88179818e-003f, -0.06848445f, -0.04666303f, -0.09955736f, + -0.04206430f, 0.02609075f, 9.09005292e-003f, -0.07138551f, + -4.22313227e-004f, 0.01766645f, 0.02756404f, 0.01308276f, 0.04052891f, + 0.02387515f, 0.05337298f, 0.02500631f, -0.04970853f, -0.12467445f, + 0.17604403f, 0.12256411f, -0.07512254f, 8.70451052e-003f, -0.05697548f, + -0.03626474f, -8.76623299e-003f, -0.01210897f, -0.09451522f, + 0.07490732f, -0.02008001f, -0.02681278f, -0.06463405f, -0.01517507f, + 7.33757764e-003f, 6.07147906e-003f, -0.09316964f, -0.04575328f, + 0.13261597f, 0.15424870f, -0.01655918f, -0.02772390f, -0.05243644f, + -0.02356456f, -0.02351753f, -0.10211615f, -0.12873036f, 0.14549787f, + 0.12519856f, 4.38762689e-003f, 0.02795992f, 0.05170322f, 0.09223596f, + 0.05890015f, 0.02376701f, -0.02777346f, 0.09506908f, 0.02328936f, + -0.02319928f, -0.03218696f, -0.01527841f, -0.01016694f, -0.02674719f, + 0.05137179f, 0.01980666f, 0.06544447f, -0.01746171f, 0.01026380f, + 0.01561806f, 7.97004555e-004f, 0.07601810f, 0.01907250f, -0.03083035f, + -0.05987392f, 0.09242783f, 0.14555025f, 0.01035827f, 0.03092401f, + -0.09562709f, -0.03802354f, 0.02531144f, 0.03079449f, -0.07100715f, + 0.03330721f, -2.69116857e-003f, 0.03167490f, 0.05744999f, 0.03259895f, + 1.91266940e-003f, 0.03194578f, 0.07389776f, 0.02198060f, 0.07633314f, + 0.03293105f, -0.09103648f, 0.04718142f, 0.06102672f, -0.01003063f, + 5.85481385e-003f, -0.01522574f, 0.02323526f, 0.10584345f, + 4.35879454e-003f, 0.06107873f, 0.05868603f, -0.03115531f, 0.01214679f, + 0.08567052f, 3.93926632e-003f, -0.02521488f, -1.88425183e-003f, + 0.02038053f, -6.26854831e-004f, 0.04897438f, -0.04280585f, + -0.04819689f, -0.04812867f, -0.01451186f, 0.05101469f, + -9.01125465e-003f, -0.03333859f, 0.03917955f, 0.04196448f, 0.04292135f, + 0.02809529f, 0.02999715f, 0.04081348f, 9.10039060e-003f, 0.09703232f, + 0.10379741f, 0.02348725f, -4.72756615e-003f, 0.01027325f, 0.10402658f, + 0.12071823f, 0.09817299f, -0.02612033f, 0.03638414f, 0.05896405f, + 0.04865025f, 0.04793910f, -0.03882321f, -0.02962117f, -0.01222268f, + 0.04071597f, 0.01922777f, -0.02287866f, 0.03328381f, 0.01859092f, + 0.09024994f, 0.03804455f, -0.01424510f, 0.01953739f, 0.02509617f, + -0.03390914f, -0.05663941f, -0.01641979f, 0.05848591f, 0.04639670f, + 0.02092116f, 0.12911791f, 0.19918139f, 0.07739855f, -7.25806039e-003f, + 0.04074838f, 0.03183993f, 1.39251316e-003f, -0.01428625f, 0.01865480f, + 0.08529541f, 0.13547510f, 0.11189661f, 0.03998901f, 0.09575938f, + -0.02631102f, -0.03458253f, -0.04749985f, -0.06070716f, + 4.71884012e-003f, 0.06445789f, -0.02450038f, -0.05483776f, + -0.04657237f, -0.02030717f, -0.03480766f, -0.09397731f, -0.06399718f, + -0.01804585f, 5.62348310e-003f, -6.64811488e-003f, -0.06517869f, + 6.96210237e-003f, -0.01860148f, -0.04245830f, -0.05850367f, + -3.24417115e-003f, 0.07700698f, 0.11290991f, 0.09923030f, -0.02970599f, + 0.05592411f, 0.04813979f, -0.09811195f, -0.09357996f, -0.03276114f, + 0.05218338f, 0.04141375f, 3.92977800e-003f, -0.05047480f, 0.15960084f, + 0.04612800f, -0.03114098f, -0.04650044f, -0.03249795f, -0.02425641f, + -0.04311355f, 0.04307659f, -0.09401883f, -0.04742785f, -0.01254499f, + -0.06598741f, 3.41369561e-003f, -0.05620445f, -7.28127593e-003f, + -0.05998361f, -0.03274450f, -0.07376868f, 3.19015374e-003f, + -0.07733069f, 0.05815864f, -0.02471071f, 0.03850617f, 0.13838784f, + 0.15399861f, 0.01731321f, -0.01477586f, 0.10393341f, 0.05159833f, + -0.01945555f, -0.03427503f, -0.04867341f, 0.09237480f, 0.10732719f, + 0.06071450f, -0.01355071f, 0.01844356f, -0.03480803f, -0.03796671f, + 2.15628621e-004f, -0.05440186f, 0.01889855f, -0.01443413f, + -0.02607902f, -0.02938001f, 0.02720689f, -0.06228397f, -0.02970936f, + -0.03426210f, -0.10280876f, -0.06739304f, -0.05227850f, 0.03360292f, + -0.11278441f, -0.06966180f, -0.13937433f, 9.10932291e-003f, + 2.52020749e-004f, -4.07359656e-003f, 0.12310639f, 0.09343060f, + 0.07302511f, 0.03222093f, 0.07532879f, 0.03792387f, -0.04985180f, + 0.01804602f, 0.02694195f, 0.13481498f, 0.04601225f, 0.04106982f, + 0.08511057f, 0.12314661f, 0.01320830f, 0.05044121f, -5.52943908e-003f, + -0.08992624f, -0.02249301f, -0.08181777f, 0.06165213f, -0.03256603f, + -0.01068920f, -0.01323473f, -0.11970232f, -0.04616347f, -0.12088681f, + -0.06762606f, -0.08676834f, -0.06434575f, 0.01772529f, 0.03469615f, + -0.10926618f, 0.03013873f, 0.14030397f, 0.16130108f, 0.17985588f, + 0.11281928f, 0.10530639f, 0.08905948f, 0.07733764f, 0.06695238f, + 0.02142088f, 0.06438877f, 0.09794453f, 0.05745072f, 0.02788557f, + 0.02632830f, 0.07985807f, 4.24902979e-003f, 8.47890321e-003f, + -0.02679466f, -5.28812688e-003f, -0.02162580f, -0.07490715f, + -0.08251337f, -0.02056576f, -0.01026194f, -1.15492963e-003f, + -5.75720915e-004f, -0.07210591f, -0.07320981f, -0.04883312f, + -0.10897151f, -0.07477258f, -0.08867134f, -0.09222437f, -0.10924666f, + -0.10430276f, 0.07953499f, 0.02767959f, 0.11393359f, 0.18779543f, + 0.03313421f, 0.02143700f, 0.05852016f, -2.12067598e-003f, + -3.76984011e-003f, 0.02774167f, -0.03124610f, 0.01465141f, 0.01616004f, + -0.01391913f, -0.04404102f, -0.05444227f, -0.14684731f, -0.15016587f, + 0.04509468f, 1.29563001e-003f, 0.01398350f, 0.05610404f, -0.04868806f, + -0.04776716f, -8.16873740e-003f, -2.30126386e-003f, -0.02286313f, + 0.11983398f, -0.04703261f, -0.08814441f, -0.07585249f, -0.10799607f, + -0.03232087f, 0.01509786f, -0.04843464f, -0.03967846f, 0.09589416f, + 0.01352560f, -0.01458119f, 0.01050829f, -0.03038946f, 0.01608388f, + 1.11975556e-003f, -0.01250656f, 2.86211423e-003f, 0.04333691f, + -0.14603497f, -0.01946543f, -0.02327525f, -0.01973944f, 0.07944400f, + -0.02224544f, -0.06701808f, 0.03476532f, 0.11505594f, -0.02712801f, + -0.01665113f, 0.06315716f, -0.08205860f, 0.07431999f, 0.04915778f, + -0.04468752f, -0.01490402f, 0.07400476f, -0.11650901f, 0.05102430f, + 0.04559118f, -0.05916039f, 0.08840760f, -0.01587902f, -0.14890194f, + 0.07857784f, 0.04710254f, -0.05381983f, -0.07331945f, -0.03604643f, + 0.15611970f, 0.07649943f, -0.05959348f, -0.02776607f, 0.11098688f, + 0.03758875f, -0.04446875f, 0.04933187f, 0.01345535f, 0.06921103f, + 0.07364785f, 0.05518956f, 0.02899585f, 0.09375840f, 0.10518434f, + -0.04420241f, 0.01915282f, -3.56386811e-003f, 0.14586878f, 0.10286101f, + -0.04360626f, -0.12723237f, 0.09076386f, 0.11119842f, -0.06035013f, + 0.09674817f, 0.08938243f, 0.07065924f, 0.02603180f, 5.84815582e-003f, + -0.05922065f, 0.12360309f, 3.59695964e-003f, 2.99844006e-003f, + 0.03697936f, 0.02043072f, 0.04168725f, 0.01025975f, -0.01359980f, + -0.01600920f, 0.02581056f, 0.02329250f, 2.98100687e-003f, 0.01629762f, + 0.06652115f, 0.05855627f, 0.01237463f, -0.01297135f, 0.01761587f, + 0.05090865f, 0.06549342f, -0.04425945f, 2.43203156e-003f, + 3.07327788e-003f, 0.06678630f, -0.04303836f, 0.01082393f, -0.06476044f, + 0.04077786f, 0.12441979f, 0.08237778f, 0.07424165f, 0.04065890f, + 0.06905543f, 0.09556347f, 0.12724875f, -0.02132082f, 0.08514154f, + -0.04175328f, -0.02666954f, 0.01897836f, 0.03317382f, 9.45465732e-003f, + -0.01238974f, -0.04242500f, -0.01419479f, -0.03545213f, -0.02440874f, + 0.08684119f, 0.04212951f, 0.02462858f, -0.01104825f, -5.01706870e-003f, + 0.02968982f, 0.02597476f, -0.01568939f, 0.04514892f, 0.06974549f, + 0.08670278f, 0.06828108f, 0.10238872f, 0.05405957f, 0.06548470f, + -0.03763957f, 0.01366090f, 0.07069602f, 0.05363748f, 0.04798120f, + 0.11706422f, 0.05466456f, -0.01869259f, 0.06344382f, 0.03106543f, + 0.08432506f, -0.02061096f, 0.03821088f, -6.92190882e-003f, + 6.40467042e-003f, -0.01271779f, 6.89014705e-005f, 0.04541415f, + -0.01899539f, -0.05020239f, 0.03000903f, 0.01090422f, 4.52452758e-003f, + 0.02573632f, -0.02388454f, -0.04200457f, 1.72783900e-003f, + -0.05978370f, -0.02720562f, 0.06573715f, 0.01154317f, 0.01265615f, + 0.07375994f, -9.19828378e-003f, -0.04914120f, 0.02124831f, 0.06455322f, + 0.04372910f, -0.03310043f, 0.03605788f, -6.78055827e-003f, + 9.36202332e-003f, 0.01747596f, -0.06406314f, -0.06812935f, 0.08080816f, + -0.02778088f, 0.02735260f, 0.06393493f, 0.06652229f, 0.05676993f, + 0.08640018f, -7.59188086e-003f, -0.02012847f, -0.04741159f, + -0.01657069f, -0.01624399f, 0.05547778f, -2.33309763e-003f, + 0.01120033f, 0.06141156f, -0.06285004f, -0.08732341f, -0.09313398f, + -0.04267832f, 5.57443965e-003f, 0.04809862f, 0.01773641f, + 5.37361018e-003f, 0.14842421f, -0.06298012f, -0.02935147f, 0.11443478f, + -0.05034208f, 5.65494271e-003f, 0.02076526f, -0.04577984f, + -0.04735741f, 0.02961071f, -0.09307127f, -0.04417921f, -0.04990027f, + -0.03940028f, 0.01306016f, 0.06267900f, 0.03758737f, 0.08460117f, + 0.13858789f, 0.04862388f, -0.06319809f, -0.05655516f, 0.01885816f, + -0.03285607f, 0.03371567f, -0.07040928f, -0.04514049f, 0.01392166f, + 0.08184422f, -0.07230316f, 0.02386871f, 0.02184591f, 0.02605764f, + -0.01033954f, 9.29878280e-003f, 7.67351175e-003f, 0.15189242f, + 0.02069071f, -0.09738296f, -0.08894105f, -0.07768748f, 0.02332268f, + -0.01778995f, -0.03258888f, -0.08180822f, -0.08492987f, 0.02290156f, + -0.11368170f, -0.03554465f, -0.04533844f, -0.02861580f, 0.06782424f, + 0.01113123f, 0.02453644f, 0.12721945f, 0.08084814f, -0.03607795f, + 0.01109122f, 0.04803548f, -0.03489929f, 0.03399536f, -0.05682014f, + 8.59533902e-003f, -4.27904585e-003f, 0.03230887f, -0.01300198f, + -0.01038137f, -0.07930113f, 8.33097473e-003f, 0.02296994f, + -0.01306500f, -0.01881626f, 0.04413369f, 0.05729880f, -0.03761553f, + 0.01942326f, 1.64540811e-003f, -0.03811319f, 0.04190650f, -0.14978096f, + -0.04514487f, 0.01209545f, -5.46460645e-003f, -0.01647195f, + 7.63064111e-003f, -0.07494587f, 0.08415288f, 0.10020141f, -0.01228561f, + 0.06553826f, 0.04554005f, 0.07890417f, 0.03041138f, 0.01752007f, + 0.09208256f, -3.74419295e-004f, 0.10549527f, 0.04686913f, 0.01894833f, + -0.02651412f, -4.34682379e-003f, 5.44942822e-003f, 0.01444484f, + 0.05882156f, -0.03336544f, 0.04603891f, -0.10432546f, 0.01923928f, + 0.01842845f, -0.01712168f, -0.02222766f, 0.04693324f, -0.06202956f, + -0.01422159f, 0.08732220f, -0.07706107f, 0.02661049f, -0.04300238f, + -0.03092422f, -0.03552184f, -0.01886088f, -0.04979934f, 0.03906401f, + 0.04608644f, 0.04966111f, 0.04275464f, -0.04621769f, -0.02653212f, + 8.57011229e-003f, 0.03839684f, 0.05818764f, 0.03880796f, + -2.76100676e-004f, 0.03076511f, -0.03266929f, -0.05374557f, + 0.04986527f, -9.45429131e-003f, 0.03582499f, -2.64564669e-003f, + -1.07461517e-003f, 0.02962313f, -0.01483363f, 0.03060869f, 0.02448327f, + 0.01845641f, 0.03282966f, -0.03534438f, -0.01084059f, -0.01119136f, + -1.85360224e-003f, -5.94652840e-004f, -0.04451817f, 2.98327743e-003f, + 0.06272484f, -0.02152076f, -3.05971340e-003f, -0.05070828f, + 0.01531762f, 0.01282815f, 0.05167150f, 9.46266949e-003f, + -3.34558333e-003f, 0.11442288f, -0.03906701f, -2.67325155e-003f, + 0.03069184f, -0.01134165f, 0.02949462f, 0.02879886f, 0.03855566f, + -0.03450781f, 0.09142872f, -0.02156654f, 0.06075062f, -0.06220816f, + 0.01944680f, 6.68372354e-003f, -0.06656796f, 8.70784000e-003f, + 0.03456013f, 0.02434320f, -0.13236357f, -0.04177035f, -0.02069627f, + 0.01068112f, 0.01505432f, -0.07517391f, -3.83571628e-003f, + -0.06298508f, -0.02881260f, -0.13101046f, -0.07221562f, + -5.79945277e-003f, -8.57300125e-003f, 0.03782469f, 0.02762164f, + 0.04942456f, -0.02936396f, 0.09597211f, 0.01921411f, 0.06101191f, + -0.04787507f, -0.01379578f, -7.40224449e-003f, -0.02220136f, + -0.01313756f, 7.77558051e-003f, 0.12296968f, 0.02939998f, 0.03594062f, + -0.07788624f, -0.01133144f, 3.99316690e-004f, -0.06090347f, + -0.01122066f, -4.68682544e-003f, 0.07633100f, -0.06748922f, + -0.05640298f, -0.05265681f, -0.01139122f, -0.01624347f, -0.04715714f, + -0.01099092f, 0.01048561f, 3.28499987e-003f, -0.05810167f, + -0.07699911f, -0.03330683f, 0.04185145f, 0.03478536f, 0.02275165f, + 0.02304766f, 6.66040834e-003f, 0.10968148f, -5.93013782e-003f, + -0.04858336f, -0.04203213f, -0.09316786f, -6.13074889e-003f, + -0.02544625f, 0.01366201f, 9.18555818e-003f, -0.01846578f, + -0.05622401f, -0.03989377f, -0.07810296f, 6.91275718e-003f, + 0.05957597f, -0.03901334f, 0.01572002f, -0.01193903f, + -6.89400872e-003f, -0.03093356f, -0.04136098f, -0.01562869f, + -0.04604580f, 0.02865234f, -0.08678447f, -0.03232484f, -0.05364593f, + -0.01445016f, -0.07003860f, -0.08669746f, -0.04520775f, 0.04274122f, + 0.03117515f, 0.08175703f, 0.01081109f, 0.06379741f, 0.06199206f, + 0.02865988f, 0.02360346f, 0.06725410f, -0.03248780f, -9.37702879e-003f, + 0.08265898f, -0.02245839f, 0.05125763f, -0.01862395f, 0.01973453f, + -0.01994494f, -0.10770868f, 0.03180375f, 3.23935156e-003f, + -0.02142080f, -0.04256190f, 0.04760900f, 0.04282863f, 0.05635953f, + -0.01870849f, 0.05540622f, -0.03042666f, 0.01455277f, -0.06630179f, + -0.05843807f, -0.03739681f, -0.09739155f, -0.03220233f, -0.05620182f, + -0.10381401f, 0.07400211f, 4.20676917e-003f, 0.03258535f, + 2.14308966e-003f, 0.05121966f, -0.01274337f, 0.02384761f, 0.06335578f, + -0.07905591f, 0.08375625f, -0.07898903f, -0.06508528f, -0.02498444f, + 0.06535810f, 0.03970535f, 0.04895468f, -0.01169566f, -0.03980601f, + 0.05682293f, 0.05925463f, -0.01165808f, -0.07936699f, -0.04208954f, + 0.01333987f, 0.09051196f, 0.10098671f, -0.03974256f, 0.01238771f, + -0.07501741f, -0.03655440f, -0.04301528f, 0.09216860f, + 4.63579083e-004f, 0.02851115f, 0.02142735f, 1.28244064e-004f, + 0.02879687f, -0.08554889f, -0.04838862f, 0.08135369f, -0.05756533f, + 0.01413900f, 0.03451880f, -0.06619488f, -0.03053130f, 0.02961676f, + -0.07384635f, 0.01135692f, 0.05283910f, -0.07778034f, -0.02107482f, + -0.05511716f, -0.13473752f, 0.03030157f, 0.06722020f, -0.06218817f, + -0.05826827f, 0.06254654f, 0.02895772f, -0.01664000f, -0.03620280f, + -0.01612278f, -1.46097376e-003f, 0.14013411f, -8.96181818e-003f, + -0.03250246f, 3.38630192e-003f, 2.64779478e-003f, 0.03359732f, + -0.02411991f, -0.04229729f, 0.10666174f, -6.66579151f + ]; + #endregion + + #region DaimlerPeopleDetector + /// + /// This field returns 1981 SVM coeffs obtained from daimler's base. + /// To use these coeffs the detection window size should be (48,96) + /// + public static readonly float[] DaimlerPeopleDetector = + [ + 0.294350f, -0.098796f, -0.129522f, 0.078753f, + 0.387527f, 0.261529f, 0.145939f, 0.061520f, + 0.328699f, 0.227148f, -0.066467f, -0.086723f, + 0.047559f, 0.106714f, 0.037897f, 0.111461f, + -0.024406f, 0.304769f, 0.254676f, -0.069235f, + 0.082566f, 0.147260f, 0.326969f, 0.148888f, + 0.055270f, -0.087985f, 0.261720f, 0.143442f, + 0.026812f, 0.238212f, 0.194020f, 0.056341f, + -0.025854f, -0.034444f, -0.156631f, 0.205174f, + 0.089008f, -0.139811f, -0.100147f, -0.037830f, + -0.029230f, -0.055641f, 0.033248f, -0.016512f, + 0.155244f, 0.247315f, -0.124694f, -0.048414f, + -0.062219f, 0.193683f, 0.004574f, 0.055089f, + 0.093565f, 0.167712f, 0.167581f, 0.018895f, + 0.215258f, 0.122609f, 0.090520f, -0.067219f, + -0.049029f, -0.099615f, 0.241804f, -0.094893f, + -0.176248f, 0.001727f, -0.134473f, 0.104442f, + 0.050942f, 0.081165f, 0.072156f, 0.121646f, + 0.002656f, -0.297974f, -0.133587f, -0.060121f, + -0.092515f, -0.048974f, -0.084754f, -0.180111f, + -0.038590f, 0.086283f, -0.134636f, -0.107249f, + 0.132890f, 0.141556f, 0.249425f, 0.130273f, + -0.030031f, 0.073212f, -0.008155f, 0.019931f, + 0.071688f, 0.000300f, -0.019525f, -0.021725f, + -0.040993f, -0.086841f, 0.070124f, 0.240033f, + 0.265350f, 0.043208f, 0.166754f, 0.091453f, + 0.060916f, -0.036972f, -0.091043f, 0.079873f, + 0.219781f, 0.158102f, -0.140618f, -0.043016f, + 0.124802f, 0.093668f, 0.103208f, 0.094872f, + 0.080541f, 0.137711f, 0.160566f, -0.169231f, + 0.013983f, 0.309508f, -0.004217f, -0.057200f, + -0.064489f, 0.014066f, 0.361009f, 0.251328f, + -0.080983f, -0.044183f, 0.061436f, -0.037381f, + -0.078786f, 0.030993f, 0.066314f, 0.037683f, + 0.152325f, -0.091683f, 0.070203f, 0.217856f, + 0.036435f, -0.076462f, 0.006254f, -0.094431f, + 0.154829f, -0.023038f, -0.196961f, -0.024594f, + 0.178465f, -0.050139f, -0.045932f, -0.000965f, + 0.109112f, 0.046165f, -0.159373f, -0.008713f, + 0.041307f, 0.097129f, -0.057211f, -0.064599f, + 0.077165f, 0.176167f, 0.138322f, 0.065753f, + -0.104950f, 0.017933f, 0.136255f, -0.011598f, + 0.047007f, 0.080550f, 0.068619f, 0.084661f, + -0.035493f, -0.091314f, -0.041411f, 0.060971f, + -0.101912f, -0.079870f, -0.085977f, -0.022686f, + 0.079788f, -0.098064f, -0.054603f, 0.040383f, + 0.300794f, 0.128603f, 0.094844f, 0.047407f, + 0.101825f, 0.061832f, -0.162160f, -0.204553f, + -0.035165f, 0.101450f, -0.016641f, -0.027140f, + -0.134392f, -0.008743f, 0.102331f, 0.114853f, + 0.009644f, 0.062823f, 0.237339f, 0.167843f, + 0.053066f, -0.012592f, 0.043158f, 0.002305f, + 0.065001f, -0.038929f, -0.020356f, 0.152343f, + 0.043469f, -0.029967f, -0.042948f, 0.032481f, + 0.068488f, -0.110840f, -0.111083f, 0.111980f, + -0.002072f, -0.005562f, 0.082926f, 0.006635f, + -0.108153f, 0.024242f, -0.086464f, -0.189884f, + -0.017492f, 0.191456f, -0.007683f, -0.128769f, + -0.038017f, -0.132380f, 0.091926f, 0.079696f, + -0.106728f, -0.007656f, 0.172744f, 0.011576f, + 0.009883f, 0.083258f, -0.026516f, 0.145534f, + 0.153924f, -0.130290f, -0.108945f, 0.124490f, + -0.003186f, -0.100485f, 0.015024f, -0.060512f, + 0.026288f, -0.086713f, -0.169012f, 0.076517f, + 0.215778f, 0.043701f, -0.131642f, -0.012585f, + -0.045181f, -0.118183f, -0.241544f, -0.167293f, + -0.020107f, -0.019917f, -0.101827f, -0.107096f, + -0.010503f, 0.044938f, 0.189680f, 0.217119f, + -0.046086f, 0.044508f, 0.199716f, -0.036004f, + -0.148927f, 0.013355f, -0.078279f, 0.030451f, + 0.056301f, -0.024609f, 0.083224f, 0.099533f, + -0.039432f, -0.138880f, 0.005482f, -0.024120f, + -0.140468f, -0.066381f, -0.017057f, 0.009260f, + -0.058004f, -0.028486f, -0.061610f, 0.007483f, + -0.158309f, -0.150687f, -0.044595f, -0.105121f, + -0.045763f, -0.006618f, -0.024419f, -0.117713f, + -0.119366f, -0.175941f, -0.071542f, 0.119027f, + 0.111362f, 0.043080f, 0.034889f, 0.093003f, + 0.007842f, 0.057368f, -0.108834f, -0.079968f, + 0.230959f, 0.020205f, 0.011470f, 0.098877f, + 0.101310f, -0.030215f, -0.018018f, -0.059552f, + -0.106157f, 0.021866f, -0.036471f, 0.080051f, + 0.041165f, -0.082101f, 0.117726f, 0.030961f, + -0.054763f, -0.084102f, -0.185778f, -0.061305f, + -0.038089f, -0.110728f, -0.264010f, 0.076675f, + -0.077111f, -0.137644f, 0.036232f, 0.277995f, + 0.019116f, 0.107738f, 0.144003f, 0.080304f, + 0.215036f, 0.228897f, 0.072713f, 0.077773f, + 0.120168f, 0.075324f, 0.062730f, 0.122478f, + -0.049008f, 0.164912f, 0.162450f, 0.041246f, + 0.009891f, -0.097827f, -0.038700f, -0.023027f, + -0.120020f, 0.203364f, 0.248474f, 0.149810f, + -0.036276f, -0.082814f, -0.090343f, -0.027143f, + -0.075689f, -0.320310f, -0.000500f, -0.143334f, + -0.065077f, -0.186936f, 0.129372f, 0.116431f, + 0.181699f, 0.170436f, 0.418854f, 0.460045f, + 0.333719f, 0.230515f, 0.047822f, -0.044954f, + -0.068086f, 0.140179f, -0.044821f, 0.085550f, + 0.092483f, -0.107296f, -0.130670f, -0.206629f, + 0.114601f, -0.317869f, -0.076663f, 0.038680f, + 0.212753f, -0.016059f, -0.126526f, -0.163602f, + 0.210154f, 0.099887f, -0.126366f, 0.118453f, + 0.019309f, -0.021611f, -0.096499f, -0.111809f, + -0.200489f, 0.142854f, 0.228840f, -0.353346f, + -0.179151f, 0.116834f, 0.252389f, -0.031728f, + -0.188135f, -0.158998f, 0.386523f, 0.122315f, + 0.209944f, 0.394023f, 0.359030f, 0.260717f, + 0.170335f, 0.013683f, -0.142596f, -0.026138f, + -0.011878f, -0.150519f, 0.047159f, -0.107062f, + -0.147347f, -0.187689f, -0.186027f, -0.208048f, + 0.058468f, -0.073026f, -0.236556f, -0.079788f, + -0.146216f, -0.058563f, -0.101361f, -0.071294f, + -0.071093f, 0.116919f, 0.234304f, 0.306781f, + 0.321866f, 0.240000f, 0.073261f, -0.012173f, + 0.026479f, 0.050173f, 0.166127f, 0.228955f, + 0.061905f, 0.156460f, 0.205990f, 0.120672f, + 0.037350f, 0.167884f, 0.290099f, 0.420900f, + -0.012601f, 0.189839f, 0.306378f, 0.118383f, + -0.095598f, -0.072360f, -0.132496f, -0.224259f, + -0.126021f, 0.022714f, 0.284039f, 0.051369f, + -0.000927f, -0.058735f, -0.083354f, -0.141254f, + -0.187578f, -0.202669f, 0.048902f, 0.246597f, + 0.441863f, 0.342519f, 0.066979f, 0.215286f, + 0.188191f, -0.072240f, -0.208142f, -0.030196f, + 0.178141f, 0.136985f, -0.043374f, -0.181098f, + 0.091815f, 0.116177f, -0.126690f, -0.386625f, + 0.368165f, 0.269149f, -0.088042f, -0.028823f, + 0.092961f, 0.024099f, 0.046112f, 0.176756f, + 0.135849f, 0.124955f, 0.195467f, -0.037218f, + 0.167217f, 0.188938f, 0.053528f, -0.066561f, + 0.133721f, -0.070565f, 0.115898f, 0.152435f, + -0.116993f, -0.110592f, -0.179005f, 0.026668f, + 0.080530f, 0.075084f, -0.070401f, 0.012497f, + 0.021849f, -0.139764f, -0.022020f, -0.096301f, + -0.064954f, -0.127446f, -0.013806f, -0.108315f, + 0.156285f, 0.149867f, -0.011382f, 0.064532f, + 0.029168f, 0.027393f, 0.069716f, 0.153735f, + 0.038459f, 0.230714f, 0.253840f, 0.059522f, + -0.045053f, 0.014083f, 0.071103f, 0.068747f, + 0.095887f, 0.005832f, 0.144887f, 0.026357f, + -0.067359f, -0.044151f, -0.123283f, -0.019911f, + 0.005318f, 0.109208f, -0.003201f, -0.021734f, + 0.142025f, -0.066907f, -0.120070f, -0.188639f, + 0.012472f, -0.048704f, -0.012366f, -0.184828f, + 0.168591f, 0.267166f, 0.058208f, -0.044101f, + 0.033500f, 0.178558f, 0.104550f, 0.122418f, + 0.080177f, 0.173246f, 0.298537f, 0.064173f, + 0.053397f, 0.174341f, 0.230984f, 0.117025f, + 0.166242f, 0.227781f, 0.120623f, 0.176952f, + -0.011393f, -0.086483f, -0.008270f, 0.051700f, + -0.153369f, -0.058837f, -0.057639f, -0.060115f, + 0.026349f, -0.160745f, -0.037894f, -0.048575f, + 0.041052f, -0.022112f, 0.060365f, 0.051906f, + 0.162657f, 0.138519f, -0.050185f, -0.005938f, + 0.071301f, 0.127686f, 0.062342f, 0.144400f, + 0.072600f, 0.198436f, 0.246219f, -0.078185f, + -0.036169f, 0.075934f, 0.047328f, -0.013601f, + 0.087205f, 0.019900f, 0.022606f, -0.015365f, + -0.092506f, 0.075275f, -0.116375f, 0.050500f, + 0.045118f, 0.166567f, 0.072073f, 0.060371f, + 0.131747f, -0.169863f, -0.039352f, -0.047486f, + -0.039797f, -0.204312f, 0.021710f, 0.129443f, + -0.021173f, 0.173416f, -0.070794f, -0.063986f, + 0.069689f, -0.064099f, -0.123201f, -0.017372f, + -0.206870f, 0.065863f, 0.113226f, 0.024707f, + -0.071341f, -0.066964f, -0.098278f, -0.062927f, + 0.075840f, 0.014716f, 0.019378f, 0.132699f, + -0.074191f, -0.089557f, -0.078446f, -0.197488f, + -0.173665f, 0.052583f, 0.044361f, 0.113549f, + 0.098492f, 0.077379f, -0.011146f, -0.192593f, + -0.164435f, 0.045568f, 0.205699f, 0.049187f, + -0.082281f, 0.134874f, 0.185499f, 0.034968f, + -0.119561f, -0.112372f, -0.115091f, -0.054042f, + -0.183816f, -0.078100f, 0.190695f, 0.091617f, + 0.004257f, -0.041135f, -0.061453f, -0.141592f, + -0.194809f, -0.120638f, 0.020168f, 0.109672f, + 0.067398f, -0.015238f, -0.239145f, -0.264671f, + -0.185176f, 0.050472f, 0.020793f, 0.035678f, + 0.022839f, -0.052055f, -0.127968f, -0.113049f, + -0.228416f, -0.258281f, -0.053437f, 0.076424f, + 0.061450f, 0.237478f, 0.003618f, -0.055865f, + -0.108087f, -0.028937f, 0.045585f, 0.052829f, + -0.001471f, 0.022826f, 0.059565f, -0.104430f, + -0.077266f, -0.211882f, -0.212078f, 0.028074f, + 0.075846f, 0.016265f, 0.161879f, 0.134477f, + 0.008935f, -0.048041f, 0.074692f, 0.004928f, + -0.025156f, 0.192874f, 0.074410f, 0.308732f, + 0.267400f, 0.094208f, -0.005251f, 0.042041f, + -0.032148f, 0.015588f, 0.252869f, 0.175302f, + 0.022892f, 0.081673f, 0.063208f, 0.162626f, + 0.194426f, 0.233890f, 0.262292f, 0.186930f, + 0.084079f, -0.286388f, -0.213034f, -0.048867f, + -0.207669f, -0.170050f, 0.011673f, -0.092958f, + -0.192786f, -0.273536f, 0.230904f, 0.266732f, + 0.320519f, 0.297155f, 0.548169f, 0.304922f, + 0.132687f, 0.247333f, 0.212488f, -0.271472f, + -0.142105f, -0.002627f, -0.119215f, 0.128383f, + 0.100079f, -0.057490f, -0.121902f, -0.228892f, + 0.202292f, -0.399795f, -0.371326f, -0.095836f, + -0.063626f, -0.161375f, -0.311180f, -0.294797f, + 0.242122f, 0.011788f, 0.095573f, 0.322523f, + 0.511840f, 0.322880f, 0.313259f, 0.173331f, + 0.002542f, -0.029802f, 0.324766f, -0.326170f, + -0.340547f, -0.138288f, -0.002963f, -0.114060f, + -0.377312f, -0.442570f, 0.212446f, -0.007759f, + -0.011576f, 0.169711f, 0.308689f, 0.317348f, + 0.539390f, 0.332845f, 0.057331f, -0.068180f, + 0.101994f, 0.266995f, 0.209570f, 0.355730f, + 0.091635f, 0.170238f, 0.125215f, 0.274154f, + 0.070223f, 0.025515f, 0.049946f, -0.000550f, + 0.043715f, -0.141843f, 0.020844f, 0.129871f, + 0.256588f, 0.105015f, 0.148339f, 0.170682f, + 0.028792f, 0.074037f, 0.160042f, 0.405137f, + 0.246187f, 0.352160f, 0.168951f, 0.222263f, + 0.264439f, 0.065945f, 0.021963f, -0.075084f, + 0.093105f, 0.027318f, 0.098864f, 0.057566f, + -0.080282f, 0.185032f, 0.314419f, 0.333727f, + 0.125798f, 0.294919f, 0.386002f, 0.217619f, + -0.183517f, -0.278622f, -0.002342f, -0.027821f, + -0.134266f, -0.331843f, -0.008296f, 0.124564f, + 0.053712f, -0.369016f, -0.095036f, 0.209381f, + 0.423760f, 0.371760f, 0.106397f, 0.369408f, + 0.485608f, 0.231201f, -0.138685f, -0.349208f, + -0.070083f, 0.028991f, -0.081630f, -0.395992f, + -0.146791f, -0.027354f, 0.063396f, -0.272484f, + 0.058299f, 0.338207f, 0.110767f, -0.052642f, + -0.233848f, -0.027448f, 0.030328f, 0.155572f, + -0.093826f, 0.019331f, 0.120638f, 0.006292f, + -0.106083f, -0.236290f, -0.140933f, -0.088067f, + -0.025138f, -0.208395f, -0.025502f, 0.144192f, + -0.048353f, -0.106144f, -0.305121f, -0.114147f, + 0.090963f, 0.327727f, 0.035606f, -0.093779f, + 0.002651f, -0.171081f, -0.188131f, -0.216571f, + -0.209101f, -0.054402f, 0.157147f, -0.057127f, + 0.066584f, 0.008988f, 0.041191f, 0.034456f, + -0.078255f, 0.052099f, -0.022239f, 0.066981f, + -0.117520f, -0.072637f, 0.062512f, 0.037570f, + -0.057544f, -0.312359f, 0.034357f, -0.031549f, + 0.002566f, -0.207375f, -0.070654f, -0.018786f, + -0.044815f, -0.012814f, -0.076320f, 0.078183f, + 0.023877f, 0.117078f, 0.022292f, -0.205424f, + -0.060430f, -0.017296f, -0.004827f, -0.321036f, + -0.092155f, 0.038837f, 0.073190f, -0.067513f, + 0.026521f, 0.171945f, 0.087318f, 0.034495f, + -0.034089f, 0.154410f, -0.061431f, 0.007435f, + -0.111094f, -0.095976f, 0.014741f, -0.132324f, + -0.029517f, -0.192160f, 0.098667f, 0.020762f, + 0.177050f, -0.064510f, -0.054437f, -0.058678f, + -0.001858f, 0.167602f, 0.015735f, 0.054338f, + 0.016477f, 0.186381f, -0.010667f, 0.054692f, + 0.126742f, 0.013140f, 0.090353f, -0.133608f, + -0.018017f, -0.152619f, 0.027600f, -0.138700f, + -0.050274f, 0.045141f, -0.118731f, 0.094797f, + -0.167605f, 0.097461f, -0.009131f, 0.199920f, + -0.052976f, 0.158194f, 0.178568f, -0.107600f, + 0.009671f, -0.084072f, -0.040258f, -0.205673f, + 0.102891f, 0.223511f, 0.042699f, 0.118548f, + -0.021274f, 0.110997f, -0.155121f, 0.027696f, + -0.149968f, 0.051552f, -0.129219f, 0.173524f, + 0.073972f, -0.189045f, -0.034523f, -0.106655f, + -0.011843f, -0.197381f, 0.219413f, 0.183197f, + -0.054920f, 0.144955f, 0.036517f, -0.085412f, + -0.229070f, -0.143710f, -0.049486f, 0.156634f, + -0.008673f, -0.064778f, 0.082344f, 0.145673f, + 0.002912f, -0.210121f, -0.116564f, 0.078425f, + 0.220908f, -0.067594f, 0.048610f, 0.084912f, + -0.066202f, -0.112515f, -0.217767f, -0.082640f, + -0.017414f, 0.230265f, -0.070735f, 0.066073f, + 0.215256f, 0.071157f, -0.087220f, -0.202235f, + -0.011918f, 0.099562f, 0.174716f, -0.063845f, + -0.121055f, 0.014367f, 0.132709f, -0.005060f, + -0.244606f, -0.179693f, -0.134690f, 0.023239f, + -0.193116f, -0.076975f, -0.021164f, -0.001938f, + -0.163799f, -0.111437f, -0.210362f, -0.166376f, + 0.034754f, 0.010036f, -0.021917f, 0.068014f, + -0.086893f, -0.251746f, -0.267171f, 0.037383f, + 0.003966f, 0.033571f, -0.151506f, 0.025437f, + -0.020626f, -0.308454f, -0.343143f, -0.092263f, + -0.026261f, -0.028345f, 0.036036f, 0.035169f, + 0.129470f, 0.122205f, 0.015661f, -0.070612f, + -0.094333f, -0.066055f, -0.041083f, 0.159146f, + 0.073184f, 0.110044f, 0.174471f, 0.078069f, + -0.014881f, 0.008116f, 0.013209f, 0.075857f, + 0.195605f, 0.062714f, 0.067955f, 0.056544f, + -0.153908f, -0.141749f, -0.072550f, 0.033523f, + -0.024665f, 0.134487f, 0.079076f, 0.133562f, + 0.227130f, 0.018054f, 0.004928f, 0.169162f, + 0.065152f, 0.072160f, 0.131631f, 0.096303f, + 0.054288f, 0.106256f, 0.114632f, 0.119038f, + 0.515200f, 0.247429f, 0.199134f, 0.211957f, + 0.127558f, -0.294684f, -0.194890f, -0.049988f, + -0.112247f, -0.008122f, -0.006176f, 0.037035f, + -0.110881f, -0.249989f, 0.152434f, 0.234621f, + 0.153340f, 0.349283f, 0.683049f, 0.157174f, + 0.124844f, 0.099136f, 0.064407f, -0.248400f, + -0.155323f, -0.026498f, -0.023450f, 0.049051f, + -0.114187f, 0.007195f, -0.176825f, -0.376926f, + 0.366159f, -0.179938f, -0.148508f, 0.006043f, + 0.170048f, 0.097866f, -0.102658f, -0.260430f, + 0.248868f, 0.037019f, -0.118111f, 0.078176f, + 0.194171f, 0.211328f, 0.368612f, 0.361213f, + 0.130013f, 0.094650f, 0.227396f, -0.178058f, + -0.114782f, -0.008093f, 0.231080f, -0.011843f, + -0.097917f, -0.325788f, 0.141879f, 0.119738f, + -0.230427f, -0.117419f, -0.114153f, 0.037903f, + 0.116383f, 0.218773f, -0.101884f, 0.059466f, + 0.119255f, 0.010874f, -0.031449f, 0.045996f, + 0.119931f, 0.273760f, 0.311700f, 0.261794f, + 0.194809f, 0.339829f, 0.239449f, 0.064140f, + 0.077597f, 0.098996f, 0.143534f, 0.184602f, + 0.037507f, 0.225494f, 0.096142f, -0.147370f, + -0.207833f, -0.174742f, -0.086391f, -0.038942f, + 0.159577f, -0.088492f, -0.000989f, 0.108154f, + -0.025890f, -0.072713f, 0.025997f, -0.006803f, + -0.086879f, -0.011290f, -0.269200f, -0.103450f, + -0.124910f, -0.116340f, 0.141459f, 0.208800f, + 0.042268f, 0.265034f, 0.516474f, 0.217591f, + -0.018843f, -0.313328f, -0.168363f, 0.047129f, + 0.090480f, -0.109852f, -0.018761f, 0.210669f, + 0.281269f, -0.043591f, -0.034147f, -0.237772f, + -0.134843f, -0.072481f, -0.103831f, 0.038355f, + 0.308619f, 0.148023f, -0.045867f, -0.123950f, + -0.210860f, -0.064973f, -0.036308f, -0.046731f, + -0.022099f, 0.095776f, 0.409423f, 0.060635f, + -0.065196f, 0.051828f, 0.027981f, -0.009609f, + -0.137681f, -0.095011f, -0.019045f, 0.177278f, + 0.009759f, -0.092119f, -0.016958f, -0.133860f, + -0.118421f, -0.032039f, -0.006214f, -0.084541f, + 0.063971f, -0.073642f, 0.165676f, 0.110443f, + 0.044131f, 0.046568f, 0.053292f, -0.055466f, + 0.015512f, 0.371947f, 0.232102f, -0.016923f, + 0.103979f, -0.091758f, 0.005907f, 0.209100f, + 0.157433f, 0.030518f, 0.250366f, 0.062322f, + 0.036720f, 0.094676f, 0.017306f, -0.010328f, + -0.079012f, 0.016781f, -0.112435f, 0.061795f, + 0.042543f, -0.126799f, -0.009975f, -0.056760f, + 0.046424f, -0.194712f, -0.139399f, -0.037731f, + 0.157989f, -0.016261f, 0.123345f, 0.230563f, + 0.083300f, -0.016392f, 0.059567f, -0.016035f, + -0.064767f, 0.231945f, 0.156629f, 0.034602f, + 0.145628f, 0.041315f, 0.034535f, 0.019967f, + -0.089188f, -0.012091f, 0.307857f, 0.211405f, + -0.025091f, -0.148249f, -0.129384f, 0.063536f, + -0.068603f, -0.067941f, -0.035104f, 0.210832f, + 0.063810f, 0.062764f, -0.089889f, -0.030554f, + 0.014791f, -0.053362f, -0.037818f, -0.196640f, + 0.008388f, -0.082654f, 0.143056f, 0.064221f, + 0.069795f, 0.191040f, 0.097321f, -0.028679f, + 0.075794f, 0.313154f, 0.086240f, 0.207643f, + 0.017809f, 0.122867f, 0.224586f, 0.167403f, + -0.023884f, 0.047434f, 0.344091f, 0.187745f, + 0.136177f, 0.141738f, 0.063799f, 0.045233f, + -0.077342f, -0.003525f, -0.165041f, -0.025616f, + -0.073745f, 0.164439f, 0.011200f, -0.145896f, + -0.027954f, -0.061987f, -0.039874f, -0.142775f, + 0.151042f, -0.038238f, 0.053152f, 0.078615f, + 0.086061f, 0.100593f, 0.128046f, -0.071006f, + -0.116558f, 0.208445f, 0.051086f, 0.076843f, + 0.023191f, -0.084781f, -0.011790f, 0.147807f, + -0.048554f, -0.113932f, 0.283322f, 0.190934f, + 0.092789f, 0.033018f, -0.142428f, -0.142480f, + -0.099023f, -0.041020f, -0.042760f, 0.203295f, + -0.053475f, 0.042424f, 0.222839f, -0.019167f, + -0.133176f, -0.276216f, -0.031998f, 0.117290f, + 0.177827f, -0.059973f, -0.064744f, -0.117040f, + -0.155482f, -0.099531f, 0.164121f, -0.026682f, + -0.093810f, 0.238993f, -0.006506f, 0.007830f, + 0.065819f, -0.203643f, -0.100925f, -0.053652f, + -0.130770f, 0.026277f, 0.131796f, 0.032742f, + 0.127186f, 0.116694f, -0.161122f, -0.279773f, + -0.252515f, -0.002638f, 0.042812f, 0.096776f, + -0.123280f, 0.064858f, -0.010455f, -0.219760f, + -0.239331f, -0.104363f, -0.058022f, -0.053584f, + 0.025611f, 0.005129f, -0.100418f, -0.045712f, + -0.194418f, -0.126366f, -0.030530f, 0.051168f, + 0.215959f, 0.172402f, -0.054700f, -0.185995f, + -0.278360f, -0.193693f, -0.040309f, 0.003735f, + -0.007770f, 0.123556f, 0.190179f, -0.077315f, + 0.117403f, 0.212942f, 0.012160f, 0.000113f, + 0.027331f, 0.040202f, 0.033293f, 0.219438f, + 0.184174f, 0.259349f, 0.311206f, 0.082547f, + -0.047875f, -0.078417f, 0.010746f, 0.082620f, + 0.311931f, 0.307605f, 0.003863f, 0.021405f, + -0.026388f, -0.019572f, 0.020582f, -0.059353f, + 0.025199f, 0.261319f, 0.086316f, 0.143614f, + 0.107780f, 0.003900f, -0.188397f, -0.038563f, + -0.106045f, -0.125154f, -0.010509f, 0.054021f, + 0.242130f, 0.279152f, 0.215546f, 0.346995f, + 0.440856f, 0.237452f, 0.234154f, 0.301646f, + 0.168929f, -0.208358f, -0.126848f, 0.010260f, + 0.121018f, -0.062975f, -0.052848f, 0.050341f, + -0.061103f, -0.266482f, 0.107186f, 0.140221f, + 0.280065f, 0.287889f, 0.373198f, 0.151596f, + 0.013593f, 0.115616f, 0.014616f, -0.281710f, + -0.237597f, -0.117305f, -0.000034f, -0.136739f, + -0.196275f, -0.095225f, -0.125310f, -0.250514f, + 0.236804f, -0.071805f, -0.037421f, 0.048230f, + 0.321596f, 0.063632f, 0.024039f, -0.029133f, + 0.230983f, 0.160593f, -0.154355f, -0.013086f, + -0.079929f, 0.094692f, 0.160391f, 0.180239f, + 0.053895f, 0.100759f, 0.288631f, 0.038191f, + 0.181692f, 0.229682f, 0.440166f, 0.063401f, + 0.006273f, 0.020865f, 0.338695f, 0.256244f, + -0.043927f, 0.115617f, 0.003296f, 0.173965f, + 0.021318f, -0.040936f, -0.118932f, 0.182380f, + 0.235922f, -0.053233f, -0.015053f, -0.101057f, + 0.095341f, 0.051111f, 0.161831f, 0.032614f, + 0.159496f, 0.072375f, 0.025089f, 0.023748f, + 0.029151f, 0.161284f, -0.117717f, -0.036191f, + -0.176822f, -0.162006f, 0.226542f, -0.078329f, + 0.043079f, -0.119172f, 0.054614f, -0.101365f, + -0.064541f, -0.115304f, 0.135170f, 0.298872f, + 0.098060f, 0.089428f, -0.007497f, 0.110391f, + -0.028824f, 0.020835f, -0.036804f, 0.125411f, + 0.192105f, -0.048931f, 0.003086f, -0.010681f, + 0.074698f, -0.016263f, 0.096063f, 0.060267f, + -0.007277f, 0.139139f, -0.080635f, 0.036628f, + 0.086058f, 0.131979f, 0.085707f, 0.025301f, + 0.226094f, 0.194759f, 0.042193f, -0.157846f, + -0.068402f, -0.141450f, -0.112659f, -0.076305f, + -0.069085f, -0.114332f, -0.102005f, 0.132193f, + -0.067042f, 0.106643f, 0.198964f, 0.171616f, + 0.167237f, -0.033730f, -0.026755f, 0.083621f, + 0.149459f, -0.002799f, -0.000318f, 0.011753f, + 0.065889f, -0.089375f, -0.049610f, 0.224579f, + 0.216548f, -0.034908f, -0.017851f, -0.088144f, + 0.007530f, 0.240268f, 0.073270f, 0.013263f, + 0.175323f, 0.012082f, 0.093993f, 0.015282f, + 0.105854f, 0.107990f, 0.077798f, -0.096166f, + -0.079607f, 0.177820f, 0.142392f, 0.033337f, + -0.078100f, -0.081616f, -0.046993f, 0.139459f, + 0.020272f, -0.123161f, 0.175269f, 0.105217f, + 0.057328f, 0.080909f, -0.012612f, -0.097081f, + 0.082060f, -0.096716f, -0.063921f, 0.201884f, + 0.128166f, -0.035051f, -0.032227f, -0.068139f, + -0.115915f, 0.095080f, -0.086007f, -0.067543f, + 0.030776f, 0.032712f, 0.088937f, 0.054336f, + -0.039329f, -0.114022f, 0.171672f, -0.112321f, + -0.217646f, 0.065186f, 0.060223f, 0.192174f, + 0.055580f, -0.131107f, -0.144338f, 0.056730f, + -0.034707f, -0.081616f, -0.135298f, -0.000614f, + 0.087189f, 0.014614f, 0.067709f, 0.107689f, + 0.225780f, 0.084361f, -0.008544f, 0.051649f, + -0.048369f, -0.037739f, -0.060710f, 0.002654f, + 0.016935f, 0.085563f, -0.015961f, -0.019265f, + 0.111788f, 0.062376f, 0.202019f, 0.047713f, + 0.042261f, 0.069716f, 0.242913f, 0.021052f, + -0.072812f, -0.155920f, -0.026436f, 0.035621f, + -0.079300f, -0.028787f, -0.048329f, 0.084718f, + -0.060565f, -0.083750f, -0.164075f, -0.040742f, + -0.086219f, 0.015271f, -0.005204f, -0.016038f, + 0.045816f, -0.050433f, -0.077652f, 0.117109f, + 0.009611f, -0.009045f, -0.008634f, -0.055373f, + -0.085968f, 0.028527f, -0.054736f, -0.168089f, + 0.175839f, 0.071205f, -0.023603f, 0.037907f, + -0.004561f, -0.022634f, 0.123831f, 0.094469f, + -0.072920f, -0.133642f, -0.014032f, -0.142754f, + -0.026999f, -0.199409f, 0.013268f, 0.226989f, + 0.048650f, -0.170988f, -0.050141f, 0.007880f, + 0.061880f, 0.019078f, -0.043578f, -0.038139f, + 0.134814f, 0.054097f, -0.081670f, 0.176838f, + 0.047920f, -0.038176f, 0.050406f, -0.107181f, + -0.036279f, 0.027060f, 0.081594f, -0.002820f, + 0.090507f, -0.033338f, -0.059571f, 0.013404f, + -0.099860f, 0.073371f, 0.342805f, 0.098305f, + -0.150910f, -0.020822f, -0.056960f, 0.046262f, + -0.043413f, -0.149405f, -0.129105f, -0.010899f, + -0.014229f, -0.179949f, -0.113044f, -0.049468f, + -0.065513f, 0.090269f, -0.011919f, 0.087846f, + 0.095796f, 0.146127f, 0.101599f, 0.078066f, + -0.084348f, -0.100002f, -0.020134f, -0.050169f, + 0.062122f, 0.014640f, 0.019143f, 0.036543f, + 0.180924f, -0.013976f, -0.066768f, -0.001090f, + -0.070419f, -0.004839f, -0.001504f, 0.034483f, + -0.044954f, -0.050336f, -0.088638f, -0.174782f, + -0.116082f, -0.205507f, 0.015587f, -0.042839f, + -0.096879f, -0.144097f, -0.050268f, -0.196796f, + 0.109639f, 0.271411f, 0.173732f, 0.108070f, + 0.156437f, 0.124255f, 0.097242f, 0.238693f, + 0.083941f, 0.109105f, 0.223940f, 0.267188f, + 0.027385f, 0.025819f, 0.125070f, 0.093738f, + 0.040353f, 0.038645f, -0.012730f, 0.144063f, + 0.052931f, -0.009138f, 0.084193f, 0.160272f, + -0.041366f, 0.011951f, -0.121446f, -0.106713f, + -0.047566f, 0.047984f, -0.255224f, -0.076116f, + 0.098685f, -0.150845f, -0.171513f, -0.156590f, + 0.058331f, 0.187493f, 0.413018f, 0.554265f, + 0.372242f, 0.237943f, 0.124571f, 0.110829f, + 0.010322f, -0.174477f, -0.067627f, -0.001979f, + 0.142913f, 0.040597f, 0.019907f, 0.025963f, + -0.043585f, -0.120732f, 0.099937f, 0.091059f, + 0.247307f, 0.204226f, -0.042753f, -0.068580f, + -0.119002f, 0.026722f, 0.034853f, -0.060934f, + -0.025054f, -0.093026f, -0.035372f, -0.233209f, + -0.049869f, -0.039151f, -0.022279f, -0.065380f, + -9.063785f + ]; + #endregion + + #endregion + + #region Init and Disposal + + /// + /// Default constructor + /// + public HOGDescriptor() + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_new1(out ptr)); + } + + /// + /// Creates the HOG descriptor and detector. + /// + /// Detection window size. Align to block size and block stride. + /// Block size in pixels. Align to cell size. Only (16,16) is supported for now. + /// Block stride. It must be a multiple of cell size. + /// Cell size. Only (8, 8) is supported for now. + /// Number of bins. Only 9 bins per cell are supported for now. + /// + /// Gaussian smoothing window parameter. + /// + /// L2-Hys normalization method shrinkage. + /// Flag to specify whether the gamma correction preprocessing is required or not. + /// Maximum number of detection window increases. + public HOGDescriptor( + Size? winSize = null, + Size? blockSize = null, + Size? blockStride = null, + Size? cellSize = null, + int nbins = 9, + int derivAperture = 1, + double winSigma = -1, + HistogramNormType histogramNormType = HistogramNormType.L2Hys, + double l2HysThreshold = 0.2, + bool gammaCorrection = true, + int nlevels = DefaultNlevels) + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_new2( + winSize.GetValueOrDefault(new Size(64, 128)), + blockSize.GetValueOrDefault(new Size(16, 16)), + blockStride.GetValueOrDefault(new Size(8, 8)), + cellSize.GetValueOrDefault(new Size(8, 8)), + nbins, + derivAperture, + winSigma, histogramNormType, + l2HysThreshold, + gammaCorrection ? 1 : 0, + nlevels, out ptr)); + } + + /// + /// Construct from a file containing HOGDescriptor properties and coefficients for the linear SVM classifier. + /// + /// The file name containing HOGDescriptor properties and coefficients for the linear SVM classifier. + public HOGDescriptor(string fileName) + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_new3(fileName, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Properties + + /// + /// Detection window size. Align to block size and block stride. Default value is Size(64,128). + /// + public Size WinSize + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_winSize_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_winSize_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Block size in pixels. Align to cell size. Default value is Size(16,16). + /// + public Size BlockSize + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_blockSize_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_blockSize_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Block stride. It must be a multiple of cell size. Default value is Size(8,8). + /// + public Size BlockStride + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_blockStride_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_blockStride_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Cell size. Default value is Size(8,8). + /// + public Size CellSize + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_cellSize_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_cellSize_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Number of bins used in the calculation of histogram of gradients. Default value is 9. + /// + public int Nbins + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_nbins_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_nbins_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int DerivAperture + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_derivAperture_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_derivAperture_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gaussian smoothing window parameter. + /// +#pragma warning disable CA1721 // Property names should not match get methods + public double WinSigma + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_winSigma_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_winSigma_set(ptr, value)); + GC.KeepAlive(this); + } + } +#pragma warning restore CA1721 + + /// + /// HistogramNormType + /// + public HistogramNormType HistogramNormType + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_histogramNormType_get(ptr, out var ret)); + GC.KeepAlive(this); + return (HistogramNormType)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_histogramNormType_set(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /// + /// L2-Hys normalization method shrinkage. + /// + public double L2HysThreshold + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_L2HysThreshold_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_L2HysThreshold_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Flag to specify whether the gamma correction preprocessing is required or not. + /// + public bool GammaCorrection + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_gammaCorrection_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_gammaCorrection_set(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// Maximum number of detection window increases. Default value is 64 + /// + public int NLevels + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_nlevels_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_nlevels_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Indicates signed gradient will be used or not + /// + public bool SignedGradient + { + get + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_signedGradient_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_signedGradient_set(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Returns coefficients of the classifier trained for people detection (for default window size). + /// + /// + public static float[] GetDefaultPeopleDetector() + { + return DefaultPeopleDetector; + } + + /// + /// This method returns 1981 SVM coeffs obtained from daimler's base. + /// To use these coeffs the detection window size should be (48,96) + /// + /// + public static float[] GetDaimlerPeopleDetector() + { + return DaimlerPeopleDetector; + } + + /// + /// Sets coefficients for the linear SVM classifier. + /// + /// coefficients for the linear SVM classifier. + public virtual void SetSVMDetector(float[] svmDetector) + { + ThrowIfDisposed(); + + using var svmDetectorVec = new VectorOfFloat(svmDetector); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_setSVMDetector(ptr, svmDetectorVec.CvPtr)); + GC.KeepAlive(this); + } + + /// + /// loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file. + /// + /// Path of the file to read. + /// The optional name of the node to read (if empty, the first top-level node will be used). + /// + public virtual bool Load(string fileName, string? objName = null) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_load(ptr, fileName, objName, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file + /// + /// File name + /// Object name + public virtual void Save(string fileName, string? objName = null) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_save(ptr, fileName, objName)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + public int GetDescriptorSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_getDescriptorSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret.ToInt32(); + } + + /// + /// + /// + /// + public bool CheckDetectorSize() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_checkDetectorSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public double GetWinSigma() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_getWinSigma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Computes HOG descriptors of given image. + /// + /// Matrix of the type CV_8U containing an image where HOG features will be calculated. + /// Window stride. It must be a multiple of block stride. + /// Padding + /// Vector of Point + /// Matrix of the type CV_32F + public virtual float[] Compute(Mat img, Size? winStride = null, Size? padding = null, Point[]? locations = null) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + + var winStride0 = winStride.GetValueOrDefault(new Size()); + var padding0 = padding.GetValueOrDefault(new Size()); + using var flVec = new VectorOfFloat(); + var length = locations?.Length ?? 0; + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_compute(ptr, img.CvPtr, flVec.CvPtr, winStride0, padding0, locations, length)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + return flVec.ToArray(); + } + + /// + /// Performs object detection without a multi-scale window. + /// + /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. + /// Threshold for the distance between features and SVM classifying plane. + /// Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient). + /// But if the free coefficient is omitted (which is allowed), you can specify it manually here. + /// Window stride. It must be a multiple of block stride. + /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). + /// + /// Left-top corner points of detected objects boundaries. + public virtual Point[] Detect(Mat img, + double hitThreshold = 0, Size? winStride = null, Size? padding = null, Point[]? searchLocations = null) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + var winStride0 = winStride.GetValueOrDefault(new Size()); + var padding0 = padding.GetValueOrDefault(new Size()); + using var flVec = new VectorOfPoint(); + var slLength = searchLocations?.Length ?? 0; + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_detect1( + ptr, img.CvPtr, flVec.CvPtr, + hitThreshold, winStride0, padding0, searchLocations, slLength)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + return flVec.ToArray(); + } + + /// + /// Performs object detection without a multi-scale window. + /// + /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. + /// + /// Threshold for the distance between features and SVM classifying plane. + /// Usually it is 0 and should be specfied in the detector coefficients (as the last free coefficient). + /// But if the free coefficient is omitted (which is allowed), you can specify it manually here. + /// Window stride. It must be a multiple of block stride. + /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). + /// + /// Left-top corner points of detected objects boundaries. + public virtual Point[] Detect(Mat img, out double[] weights, + double hitThreshold = 0, Size? winStride = null, Size? padding = null, Point[]? searchLocations = null) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + var winStride0 = winStride.GetValueOrDefault(new Size()); + var padding0 = padding.GetValueOrDefault(new Size()); + using var flVec = new VectorOfPoint(); + using var weightsVec = new VectorOfDouble(); + var slLength = searchLocations?.Length ?? 0; + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_detect2( + ptr, img.CvPtr, flVec.CvPtr, weightsVec.CvPtr, + hitThreshold, winStride0, padding0, searchLocations, slLength)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + weights = weightsVec.ToArray(); + return flVec.ToArray(); + } + + + /// + /// Performs object detection with a multi-scale window. + /// + /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. + /// Threshold for the distance between features and SVM classifying plane. + /// Window stride. It must be a multiple of block stride. + /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). + /// Coefficient of the detection window increase. + /// Coefficient to regulate the similarity threshold. + /// When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. + /// Detected objects boundaries. + public virtual Rect[] DetectMultiScale(Mat img, + double hitThreshold = 0, Size? winStride = null, Size? padding = null, double scale=1.05, int groupThreshold = 2) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + var winStride0 = winStride.GetValueOrDefault(new Size()); + var padding0 = padding.GetValueOrDefault(new Size()); + using var flVec = new VectorOfRect(); + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_detectMultiScale1( + ptr, img.CvPtr, flVec.CvPtr, + hitThreshold, winStride0, padding0, scale, groupThreshold)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + return flVec.ToArray(); + } + + /// + /// Performs object detection with a multi-scale window. + /// + /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. + /// + /// Threshold for the distance between features and SVM classifying plane. + /// Window stride. It must be a multiple of block stride. + /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). + /// Coefficient of the detection window increase. + /// Coefficient to regulate the similarity threshold. + /// When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. + /// Detected objects boundaries. + public virtual Rect[] DetectMultiScale(Mat img, out double[] foundWeights, + double hitThreshold = 0, Size? winStride = null, Size? padding = null, double scale = 1.05, int groupThreshold = 2) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + var winStride0 = winStride.GetValueOrDefault(new Size()); + var padding0 = padding.GetValueOrDefault(new Size()); + using var flVec = new VectorOfRect(); + using var foundWeightsVec = new VectorOfDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_detectMultiScale2( + ptr, img.CvPtr, flVec.CvPtr, foundWeightsVec.CvPtr, + hitThreshold, winStride0, padding0, scale, groupThreshold)); + + GC.KeepAlive(this); + foundWeights = foundWeightsVec.ToArray(); + GC.KeepAlive(img); + return flVec.ToArray(); + } + + /// + /// Computes gradients and quantized gradient orientations. + /// + /// Matrix contains the image to be computed + /// Matrix of type CV_32FC2 contains computed gradients + /// Matrix of type CV_8UC2 contains quantized gradient orientations + /// Padding from top-left + /// Padding from bottom-right + public virtual void ComputeGradient(Mat img, Mat grad, Mat angleOfs, Size? paddingTL = null, Size? paddingBR = null) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (grad is null) + throw new ArgumentNullException(nameof(grad)); + if (angleOfs is null) + throw new ArgumentNullException(nameof(angleOfs)); + img.ThrowIfDisposed(); + grad.ThrowIfDisposed(); + angleOfs.ThrowIfDisposed(); + + var paddingTL0 = paddingTL.GetValueOrDefault(new Size()); + var paddingBR0 = paddingBR.GetValueOrDefault(new Size()); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_computeGradient( + ptr, img.CvPtr, grad.CvPtr, angleOfs.CvPtr, paddingTL0, paddingBR0)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + GC.KeepAlive(grad); + GC.KeepAlive(angleOfs); + } + + /// + /// evaluate specified ROI and return confidence value for each location + /// + /// Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. + /// Vector of Point + /// Vector of Point where each Point is detected object's top-left point. + /// confidences + /// Threshold for the distance between features and SVM classifying plane. Usually + /// it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if + /// the free coefficient is omitted (which is allowed), you can specify it manually here + /// winStride + /// padding + public void DetectROI( + Mat img, Point[] locations, out Point[] foundLocations, out double[] confidences, + double hitThreshold = 0, Size? winStride = null, Size? padding = null) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (locations is null) + throw new ArgumentNullException(nameof(locations)); + img.ThrowIfDisposed(); + + var winStride0 = winStride.GetValueOrDefault(new Size()); + var padding0 = padding.GetValueOrDefault(new Size()); + using var flVec = new VectorOfPoint(); + using var cVec = new VectorOfDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_detectROI( + ptr, img.CvPtr, locations, locations.Length, + flVec.CvPtr, cVec.CvPtr, hitThreshold, winStride0, padding0)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + foundLocations = flVec.ToArray(); + confidences = cVec.ToArray(); + } + + /// + /// evaluate specified ROI and return confidence value for each location in multiple scales + /// + /// Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected. + /// Vector of rectangles where each rectangle contains the detected object. + /// Vector of DetectionROI + /// Threshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specified + /// in the detector coefficients (as the last free coefficient). But if the free coefficient is omitted (which is allowed), you can specify it manually here. + /// Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. + public void DetectMultiScaleROI( + Mat img, + out Rect[] foundLocations, + out DetectionROI[] locations, + double hitThreshold = 0, + int groupThreshold = 0) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + using var flVec = new VectorOfRect(); + using var scalesVec = new VectorOfDouble(); + using var locationsVec = new VectorOfVectorPoint(); + using var confidencesVec = new VectorOfVectorDouble(); + + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_detectMultiScaleROI( + ptr, img.CvPtr, flVec.CvPtr, + scalesVec.CvPtr, locationsVec.CvPtr, confidencesVec.CvPtr, + hitThreshold, groupThreshold)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + foundLocations = flVec.ToArray(); + + var s = scalesVec.ToArray(); + var l = locationsVec.ToArray(); + var c = confidencesVec.ToArray(); + + if(s.Length != l.Length || l.Length != c.Length) + throw new OpenCvSharpException("Invalid result data 'locations'"); + locations = new DetectionROI[s.Length]; + for (var i = 0; i < s.Length; i++) + { + locations[i] = new DetectionROI( + scale: s[i], + locations: l[i], + confidences: c[i]); + } + } + + /// + /// Groups the object candidate rectangles. + /// + /// Input/output vector of rectangles. Output vector includes retained and grouped rectangles. (The Python list is not modified in place.) + /// Input/output vector of weights of rectangles. Output vector includes weights of retained and grouped rectangles. (The Python list is not modified in place.) + /// Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. + /// Relative difference between sides of the rectangles to merge them into a group. + public void GroupRectangles(out Rect[] rectList, out double[] weights, int groupThreshold, double eps) + { + ThrowIfDisposed(); + + using var rectListVec = new VectorOfRect(); + using var weightsVec = new VectorOfDouble(); + NativeMethods.HandleException( + NativeMethods.objdetect_HOGDescriptor_groupRectangles( + ptr, rectListVec.CvPtr, weightsVec.CvPtr, groupThreshold, eps)); + + GC.KeepAlive(this); + rectList = rectListVec.ToArray(); + weights = weightsVec.ToArray(); + } + + #endregion +} + +/// +/// struct for detection region of interest (ROI) +/// +public class DetectionROI +{ + /// + /// scale(size) of the bounding box + /// + public double Scale { get; } + + /// + /// set of requested locations to be evaluated + /// + public IReadOnlyList Locations { get; } + + /// + /// vector that will contain confidence values for each location + /// + public IReadOnlyList Confidences { get; } + + /// + /// Constructor + /// + public DetectionROI(double scale, Point[] locations, double[] confidences) + { + Scale = scale; + Locations = locations; + Confidences = confidences; + } +} diff --git a/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs b/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs new file mode 100644 index 000000000..7e8682b6e --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs @@ -0,0 +1,12 @@ +namespace OpenCvSharp; + +/// +/// L2-Hys normalization method +/// +public enum HistogramNormType +{ + /// + /// [HOGDescriptor::L2Hys] + /// + L2Hys = HOGDescriptor.L2Hys, +} diff --git a/src/OpenCvSharp/Modules/objdetect/QRCodeDetector.cs b/src/OpenCvSharp/Modules/objdetect/QRCodeDetector.cs new file mode 100644 index 000000000..571093bed --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/QRCodeDetector.cs @@ -0,0 +1,239 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// +/// +public class QRCodeDetector : DisposableCvObject +{ + /// + /// + /// + public QRCodeDetector() + { + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_new(out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + + /// + /// sets the epsilon used during the horizontal scan of QR code stop marker detection. + /// + /// Epsilon neighborhood, which allows you to determine the horizontal pattern + /// of the scheme 1:1:3:1:1 according to QR code standard. + public void SetEpsX(double epsX) + { + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_setEpsX(ptr, epsX)); + GC.KeepAlive(this); + } + + /// + /// sets the epsilon used during the vertical scan of QR code stop marker detection. + /// + /// Epsilon neighborhood, which allows you to determine the vertical pattern + /// of the scheme 1:1:3:1:1 according to QR code standard. + public void SetEpsY(double epsY) + { + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_setEpsY(ptr, epsY)); + GC.KeepAlive(this); + } + + /// + /// Detects QR code in image and returns the quadrangle containing the code. + /// + /// grayscale or color (BGR) image containing (or not) QR code. + /// Output vector of vertices of the minimum-area quadrangle containing the code. + /// + public bool Detect(InputArray img, out Point2f[] points) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + using var pointsVec = new VectorOfPoint2f(); + + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_detect(ptr, img.CvPtr, pointsVec.CvPtr, out var ret)); + points = pointsVec.ToArray(); + + GC.KeepAlive(img); + GC.KeepAlive(this); + + return ret != 0; + } + + /// + /// Decodes QR code in image once it's found by the detect() method. + /// Returns UTF8-encoded output string or empty string if the code cannot be decoded. + /// + /// grayscale or color (BGR) image containing QR code. + /// Quadrangle vertices found by detect() method (or some other algorithm). + /// The optional output image containing rectified and binarized QR code + /// + public string Decode(InputArray img, IEnumerable points, OutputArray? straightQrCode = null) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (points is null) + throw new ArgumentNullException(nameof(points)); + img.ThrowIfDisposed(); + straightQrCode?.ThrowIfNotReady(); + + using var pointsVec = new VectorOfPoint2f(points); + using var resultString = new StdString(); + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_decode( + ptr, img.CvPtr, pointsVec.CvPtr, Cv2.ToPtr(straightQrCode), resultString.CvPtr)); + + GC.KeepAlive(img); + GC.KeepAlive(points); + GC.KeepAlive(straightQrCode); + GC.KeepAlive(this); + + return resultString.ToString(); + } + + /// + /// Both detects and decodes QR code + /// + /// grayscale or color (BGR) image containing QR code. + /// optional output array of vertices of the found QR code quadrangle. Will be empty if not found. + /// The optional output image containing rectified and binarized QR code + /// + public string DetectAndDecode(InputArray img, out Point2f[] points, OutputArray? straightQrCode = null) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + straightQrCode?.ThrowIfNotReady(); + + using var pointsVec = new VectorOfPoint2f(); + using var resultString = new StdString(); + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_detectAndDecode( + ptr, img.CvPtr, pointsVec.CvPtr, Cv2.ToPtr(straightQrCode), resultString.CvPtr)); + points = pointsVec.ToArray(); + + GC.KeepAlive(img); + GC.KeepAlive(straightQrCode); + GC.KeepAlive(this); + + return resultString.ToString(); + } + + /// + /// Detects QR codes in image and returns the quadrangles containing the codes. + /// + /// grayscale or color (BGR) image containing (or not) QR code. + /// Output vector of vertices of the minimum-area quadrangle containing the codes. + /// + public bool DetectMulti(InputArray img, out Point2f[] points) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + using var pointsVec = new VectorOfPoint2f(); + + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_detectMulti(ptr, img.CvPtr, pointsVec.CvPtr, out var ret)); + points = pointsVec.ToArray(); + + GC.KeepAlive(img); + GC.KeepAlive(this); + + return ret != 0; + } + + /// + /// Decodes QR codes in image once it's found by the detect() method. + /// Returns UTF8-encoded output string or empty string if the code cannot be decoded. + /// + /// grayscale or color (BGR) image containing QR code. + /// Quadrangle vertices found by detect() method (or some other algorithm). + /// UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. + /// + public bool DecodeMulti(InputArray img, IEnumerable points, out string?[] decodedInfo) + { + return DecodeMulti(img, points, out decodedInfo, out _, false); + } + + /// + /// Decodes QR codes in image once it's found by the detect() method. + /// Returns UTF8-encoded output string or empty string if the code cannot be decoded. + /// + /// grayscale or color (BGR) image containing QR code. + /// Quadrangle vertices found by detect() method (or some other algorithm). + /// UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. + /// The optional output image containing rectified and binarized QR code + /// + public bool DecodeMulti(InputArray img, IEnumerable points, out string?[] decodedInfo, out Mat[] straightQrCode) + { + return DecodeMulti(img, points, out decodedInfo, out straightQrCode, true); + } + + + /// + /// Decodes QR codes in image once it's found by the detect() method. + /// Returns UTF8-encoded output string or empty string if the code cannot be decoded. + /// + /// grayscale or color (BGR) image containing QR code. + /// Quadrangle vertices found by detect() method (or some other algorithm). + /// UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. + /// The optional output image containing rectified and binarized QR code + /// to output + /// + protected bool DecodeMulti(InputArray img, IEnumerable points, out string?[] decodedInfo, out Mat[] straightQrCode, bool isOutputStraightQrCode) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (points is null) + throw new ArgumentNullException(nameof(points)); + + img.ThrowIfDisposed(); + + using var decodedInfoVec = new VectorOfString(); + using var pointsVec = new VectorOfPoint2f(points); + + int ret; + if (isOutputStraightQrCode) + { + using var straightQrCodeVec = new VectorOfMat(); + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_decodeMulti( + ptr, img.CvPtr, pointsVec.CvPtr, decodedInfoVec.CvPtr, straightQrCodeVec.CvPtr, out ret)); + straightQrCode = straightQrCodeVec.ToArray(); + } + else + { + NativeMethods.HandleException( + NativeMethods.objdetect_QRCodeDetector_decodeMulti_NoStraightQrCode( + ptr, img.CvPtr, pointsVec.CvPtr, decodedInfoVec.CvPtr, out ret)); + straightQrCode = []; + } + + // decode utf-8 bytes. + decodedInfo = decodedInfoVec.ToArray(); + + GC.KeepAlive(img); + GC.KeepAlive(points); + GC.KeepAlive(this); + + return ret != 0; + } +} diff --git a/src/OpenCvSharp/Modules/objdetect/SimilarRects.cs b/src/OpenCvSharp/Modules/objdetect/SimilarRects.cs new file mode 100644 index 000000000..26f5df290 --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/SimilarRects.cs @@ -0,0 +1,28 @@ + + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp; + +/// +/// Class for grouping object candidates, detected by Cascade Classifier, HOG etc. +/// instance of the class is to be passed to cv::partition (see cxoperations.hpp) +/// +public static class SimilarRects +{ + /// + /// + /// + /// + /// + /// + /// + public static bool Compare(double eps, Rect r1, Rect r2) + { + var delta = eps * (Math.Min(r1.Width, r2.Width) + Math.Min(r1.Height, r2.Height)) * 0.5; + return Math.Abs(r1.X - r2.X) <= delta && + Math.Abs(r1.Y - r2.Y) <= delta && + Math.Abs(r1.X + r1.Width - r2.X - r2.Width) <= delta && + Math.Abs(r1.Y + r1.Height - r2.Y - r2.Height) <= delta; + } +} diff --git a/src/OpenCvSharp/Modules/optflow/CvOptFlow.cs b/src/OpenCvSharp/Modules/optflow/CvOptFlow.cs new file mode 100644 index 000000000..3f672a35a --- /dev/null +++ b/src/OpenCvSharp/Modules/optflow/CvOptFlow.cs @@ -0,0 +1,286 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.OptFlow; + +// ReSharper disable InconsistentNaming +/// +/// cv::optflow functions +/// +public static class CvOptFlow +{ + /// + /// Updates motion history image using the current silhouette + /// + /// Silhouette mask that has non-zero pixels where the motion occurs. + /// Motion history image that is updated by the function (single-channel, 32-bit floating-point). + /// Current time in milliseconds or other units. + /// Maximal duration of the motion track in the same units as timestamp . + public static void UpdateMotionHistory( + InputArray silhouette, InputOutputArray mhi, + double timestamp, double duration) + { + if (silhouette is null) + throw new ArgumentNullException(nameof(silhouette)); + if (mhi is null) + throw new ArgumentNullException(nameof(mhi)); + silhouette.ThrowIfDisposed(); + mhi.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.optflow_motempl_updateMotionHistory( + silhouette.CvPtr, mhi.CvPtr, timestamp, duration)); + + mhi.Fix(); + GC.KeepAlive(silhouette); + GC.KeepAlive(mhi); + } + + /// + /// Computes the motion gradient orientation image from the motion history image + /// + /// Motion history single-channel floating-point image. + /// Output mask image that has the type CV_8UC1 and the same size as mhi. + /// Its non-zero elements mark pixels where the motion gradient data is correct. + /// Output motion gradient orientation image that has the same type and the same size as mhi. + /// Each pixel of the image is a motion orientation, from 0 to 360 degrees. + /// Minimal (or maximal) allowed difference between mhi values within a pixel neighborhood. + /// Maximal (or minimal) allowed difference between mhi values within a pixel neighborhood. + /// That is, the function finds the minimum ( m(x,y) ) and maximum ( M(x,y) ) mhi values over 3x3 neighborhood of each pixel + /// and marks the motion orientation at (x, y) as valid only if: + /// min(delta1, delta2) <= M(x,y)-m(x,y) <= max(delta1, delta2). + /// + public static void CalcMotionGradient( + InputArray mhi, OutputArray mask, OutputArray orientation, + double delta1, double delta2, int apertureSize = 3) + { + if (mhi is null) + throw new ArgumentNullException(nameof(mhi)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + if (orientation is null) + throw new ArgumentNullException(nameof(orientation)); + mhi.ThrowIfDisposed(); + mask.ThrowIfNotReady(); + orientation.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.optflow_motempl_calcMotionGradient( + mhi.CvPtr, mask.CvPtr, orientation.CvPtr, delta1, delta2, apertureSize)); + + mask.Fix(); + orientation.Fix(); + GC.KeepAlive(mhi); + GC.KeepAlive(mask); + GC.KeepAlive(orientation); + } + + /// + /// Computes the global orientation of the selected motion history image part + /// + /// Motion gradient orientation image calculated by the function CalcMotionGradient() . + /// Mask image. It may be a conjunction of a valid gradient mask, also calculated by CalcMotionGradient() , + /// and the mask of a region whose direction needs to be calculated. + /// Motion history image calculated by UpdateMotionHistory() . + /// Timestamp passed to UpdateMotionHistory() . + /// Maximum duration of a motion track in milliseconds, passed to UpdateMotionHistory() . + /// + public static double CalcGlobalOrientation( + InputArray orientation, InputArray mask, InputArray mhi, + double timestamp, double duration) + { + if (orientation is null) + throw new ArgumentNullException(nameof(orientation)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + if (mhi is null) + throw new ArgumentNullException(nameof(mhi)); + orientation.ThrowIfDisposed(); + mask.ThrowIfDisposed(); + mhi.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.optflow_motempl_calcGlobalOrientation( + orientation.CvPtr, mask.CvPtr, mhi.CvPtr, timestamp, duration, out var ret)); + + GC.KeepAlive(orientation); + GC.KeepAlive(mask); + GC.KeepAlive(mhi); + return ret; + } + + /// + /// Splits a motion history image into a few parts corresponding to separate independent motions + /// (for example, left hand, right hand). + /// + /// Motion history image. + /// Image where the found mask should be stored, single-channel, 32-bit floating-point. + /// Vector containing ROIs of motion connected components. + /// Current time in milliseconds or other units. + /// Segmentation threshold that is recommended to be equal to the interval between motion history “steps” or greater. + public static void SegmentMotion( + InputArray mhi, OutputArray segmask, + out Rect[] boundingRects, + double timestamp, double segThresh) + { + if (mhi is null) + throw new ArgumentNullException(nameof(mhi)); + if (segmask is null) + throw new ArgumentNullException(nameof(segmask)); + mhi.ThrowIfDisposed(); + segmask.ThrowIfNotReady(); + + using var br = new VectorOfRect(); + NativeMethods.HandleException( + NativeMethods.optflow_motempl_segmentMotion( + mhi.CvPtr, segmask.CvPtr, br.CvPtr, timestamp, segThresh)); + boundingRects = br.ToArray(); + + segmask.Fix(); + GC.KeepAlive(mhi); + GC.KeepAlive(segmask); + } + + /// + /// computes dense optical flow using Simple Flow algorithm + /// + /// First 8-bit 3-channel image. + /// Second 8-bit 3-channel image + /// Estimated flow + /// Number of layers + /// Size of block through which we sum up when calculate cost function for pixel + /// maximal flow that we search at each level + public static void CalcOpticalFlowSF( + InputArray from, + InputArray to, + OutputArray flow, + int layers, + int averagingBlockSize, + int maxFlow) + { + if (from is null) + throw new ArgumentNullException(nameof(from)); + if (to is null) + throw new ArgumentNullException(nameof(to)); + if (flow is null) + throw new ArgumentNullException(nameof(flow)); + from.ThrowIfDisposed(); + to.ThrowIfDisposed(); + flow.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.optflow_calcOpticalFlowSF1( + from.CvPtr, to.CvPtr, flow.CvPtr, + layers, averagingBlockSize, maxFlow)); + + GC.KeepAlive(from); + GC.KeepAlive(to); + GC.KeepAlive(flow); + } + + /// + /// computes dense optical flow using Simple Flow algorithm + /// + /// First 8-bit 3-channel image. + /// Second 8-bit 3-channel image + /// Estimated flow + /// Number of layers + /// Size of block through which we sum up when calculate cost function for pixel + /// maximal flow that we search at each level + /// vector smooth spatial sigma parameter + /// vector smooth color sigma parameter + /// window size for postprocess cross bilateral filter + /// spatial sigma for postprocess cross bilateralf filter + /// color sigma for postprocess cross bilateral filter + /// threshold for detecting occlusions + /// window size for bilateral upscale operation + /// spatial sigma for bilateral upscale operation + /// color sigma for bilateral upscale operation + /// threshold to detect point with irregular flow - where flow should be recalculated after upscale + public static void CalcOpticalFlowSF( + InputArray from, + InputArray to, + OutputArray flow, + int layers, + int averagingBlockSize, + int maxFlow, + double sigmaDist, + double sigmaColor, + int postprocessWindow, + double sigmaDistFix, + double sigmaColorFix, + double occThr, + int upscaleAveragingRadius, + double upscaleSigmaDist, + double upscaleSigmaColor, + double speedUpThr) + { + if (from is null) + throw new ArgumentNullException(nameof(from)); + if (to is null) + throw new ArgumentNullException(nameof(to)); + if (flow is null) + throw new ArgumentNullException(nameof(flow)); + from.ThrowIfDisposed(); + to.ThrowIfDisposed(); + flow.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.optflow_calcOpticalFlowSF2( + from.CvPtr, to.CvPtr, flow.CvPtr, + layers, averagingBlockSize, maxFlow, + sigmaDist, sigmaColor, postprocessWindow, sigmaDistFix, + sigmaColorFix, occThr, upscaleAveragingRadius, + upscaleSigmaDist, upscaleSigmaColor, speedUpThr)); + + GC.KeepAlive(from); + GC.KeepAlive(to); + GC.KeepAlive(flow); + } + + /// + /// Fast dense optical flow based on PyrLK sparse matches interpolation. + /// + /// first 8-bit 3-channel or 1-channel image. + /// second 8-bit 3-channel or 1-channel image of the same size as from + /// computed flow image that has the same size as from and CV_32FC2 type + /// stride used in sparse match computation. Lower values usually + /// result in higher quality but slow down the algorithm. + /// number of nearest-neighbor matches considered, when fitting a locally affine + /// model. Lower values can make the algorithm noticeably faster at the cost of some quality degradation. + /// parameter defining how fast the weights decrease in the locally-weighted affine + /// fitting. Higher values can help preserve fine details, lower values can help to get rid of the noise in the output flow. + /// defines whether the ximgproc::fastGlobalSmootherFilter() is used for post-processing after interpolation + /// see the respective parameter of the ximgproc::fastGlobalSmootherFilter() + /// see the respective parameter of the ximgproc::fastGlobalSmootherFilter() + public static void CalcOpticalFlowSparseToDense( + InputArray from, + InputArray to, + OutputArray flow, + int gridStep = 8, + int k = 128, + float sigma = 0.05f, + bool usePostProc = true, + float fgsLambda = 500.0f, + float fgsSigma = 1.5f) + { + if (from is null) + throw new ArgumentNullException(nameof(from)); + if (to is null) + throw new ArgumentNullException(nameof(to)); + if (flow is null) + throw new ArgumentNullException(nameof(flow)); + from.ThrowIfDisposed(); + to.ThrowIfDisposed(); + flow.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.optflow_calcOpticalFlowSparseToDense( + from.CvPtr, to.CvPtr, flow.CvPtr, + gridStep, k, sigma, usePostProc ? 1 : 0, fgsLambda, fgsSigma)); + + GC.KeepAlive(from); + GC.KeepAlive(to); + GC.KeepAlive(flow); + } +} diff --git a/src/OpenCvSharp/Modules/photo/CalibrateCRF.cs b/src/OpenCvSharp/Modules/photo/CalibrateCRF.cs new file mode 100644 index 000000000..211610f43 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/CalibrateCRF.cs @@ -0,0 +1,40 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// The base class for camera response calibration algorithms. +/// +// ReSharper disable once InconsistentNaming +public abstract class CalibrateCRF : Algorithm +{ + /// + /// Recovers inverse camera response. + /// + /// vector of input images + /// 256x1 matrix with inverse camera response function + /// vector of exposure time values for each image + public virtual void Process(IEnumerable src, OutputArray dst, IEnumerable times) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (times is null) + throw new ArgumentNullException(nameof(times)); + dst.ThrowIfNotReady(); + + var srcArray = src.Select(x => x.CvPtr).ToArray(); + var timesArray = times.ToArray(); + if (srcArray.Length != timesArray.Length) + throw new OpenCvSharpException("src.Count() != times.Count"); + + NativeMethods.HandleException( + NativeMethods.photo_CalibrateCRF_process(ptr, srcArray, srcArray.Length, dst.CvPtr, timesArray)); + + dst.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } +} diff --git a/src/OpenCvSharp/Modules/photo/CalibrateDebevec.cs b/src/OpenCvSharp/Modules/photo/CalibrateDebevec.cs new file mode 100644 index 000000000..695b961c4 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/CalibrateDebevec.cs @@ -0,0 +1,112 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// CalibrateDebevec object +/// +public class CalibrateDebevec : CalibrateCRF +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer cv::CalibrateDebevec* + /// + protected CalibrateDebevec(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// number of pixel locations to use + /// smoothness term weight. Greater values produce smoother results, + /// but can alter the response. + /// if true sample pixel locations are chosen at random, + /// otherwise the form a rectangular grid. + /// + public static CalibrateDebevec Create(int samples = 70, float lambda = 10.0f, bool random = false) + { + NativeMethods.HandleException( + NativeMethods.photo_createCalibrateDebevec(samples, lambda, random ? 1 : 0, out var ptr)); + return new CalibrateDebevec(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public float Lambda + { + get + { + NativeMethods.HandleException( + NativeMethods.photo_CalibrateDebevec_getLambda(ptr, out var ret)); + return ret; + } + set => + NativeMethods.HandleException( + NativeMethods.photo_CalibrateDebevec_setLambda(ptr, value)); + } + + /// + /// + /// + public float Samples + { + get + { + NativeMethods.HandleException( + NativeMethods.photo_CalibrateDebevec_getSamples(ptr, out var ret)); + return ret; + } + set => + NativeMethods.HandleException( + NativeMethods.photo_CalibrateDebevec_setSamples(ptr, value)); + } + + /// + /// + /// + public bool Random + { + get + { + NativeMethods.HandleException( + NativeMethods.photo_CalibrateDebevec_getRandom(ptr, out var ret)); + return ret != 0; + } + set => + NativeMethods.HandleException( + NativeMethods.photo_CalibrateDebevec_setRandom(ptr, value ? 1 : 0)); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_CalibrateDebevec_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_CalibrateDebevec_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/CalibrateRobertson.cs b/src/OpenCvSharp/Modules/photo/CalibrateRobertson.cs new file mode 100644 index 000000000..da399234d --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/CalibrateRobertson.cs @@ -0,0 +1,107 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// CalibrateRobertson object +/// +public class CalibrateRobertson : CalibrateCRF +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer cv::CalibrateRobertson* + /// + protected CalibrateRobertson(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates CalibrateRobertson object + /// + /// maximal number of Gauss-Seidel solver iterations. + /// target difference between results of two successive steps of the minimization. + /// + public static CalibrateRobertson Create(int maxIter = 30, float threshold = 0.01f) + { + NativeMethods.HandleException( + NativeMethods.photo_createCalibrateRobertson(maxIter, threshold, out var ptr)); + return new CalibrateRobertson(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + public int MaxIter + { + get + { + NativeMethods.HandleException( + NativeMethods.photo_CalibrateRobertson_getMaxIter(ptr, out var ret)); + return ret; + } + set => + NativeMethods.HandleException( + NativeMethods.photo_CalibrateRobertson_setMaxIter(ptr, value)); + } + + /// + /// + /// + public float Threshold + { + get + { + NativeMethods.HandleException( + NativeMethods.photo_CalibrateRobertson_getThreshold(ptr, out var ret)); + return ret; + } + set => + NativeMethods.HandleException( + NativeMethods.photo_CalibrateRobertson_setThreshold(ptr, value)); + } + + /// + /// + /// + public Mat Radiance + { + get + { + var ret = new Mat(); + NativeMethods.HandleException( + NativeMethods.photo_CalibrateRobertson_getRadiance(ptr, ret.CvPtr)); + return ret; + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_CalibrateRobertson_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_CalibrateRobertson_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/EdgePreservingMethods.cs b/src/OpenCvSharp/Modules/photo/EdgePreservingMethods.cs new file mode 100644 index 000000000..44f7f9101 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/EdgePreservingMethods.cs @@ -0,0 +1,19 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// Edge preserving filters +/// +public enum EdgePreservingMethods +{ + /// + ///Recursive Filtering + /// + RecursFilter = 1, + + /// + /// Normalized Convolution Filtering + /// + NormconvFilter = 2 +} diff --git a/src/OpenCvSharp/Modules/photo/InpaintMethod.cs b/src/OpenCvSharp/Modules/photo/InpaintMethod.cs new file mode 100644 index 000000000..c2defe706 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/InpaintMethod.cs @@ -0,0 +1,18 @@ +namespace OpenCvSharp; + +/// +/// The inpainting method +/// +public enum InpaintMethod +{ + /// + /// Navier-Stokes based method. + /// + // ReSharper disable once InconsistentNaming + NS = 0, + + /// + /// The method by Alexandru Telea + /// + Telea = 1, +} diff --git a/src/OpenCvSharp/Modules/photo/MergeDebevec.cs b/src/OpenCvSharp/Modules/photo/MergeDebevec.cs new file mode 100644 index 000000000..e1c1b5d61 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/MergeDebevec.cs @@ -0,0 +1,59 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// The resulting HDR image is calculated as weighted average of the exposures considering exposure +/// values and camera response. +/// +/// For more information see @cite DM97 . +/// +public sealed class MergeDebevec : MergeExposures +{ + private Ptr? ptrObj; + + /// + /// Creates instance by MergeDebevec* + /// + private MergeDebevec(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public static MergeDebevec Create() + { + var ptr = NativeMethods.photo_createMergeDebevec(); + return new MergeDebevec(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + var res = NativeMethods.photo_Ptr_MergeDebevec_get(ptr); + GC.KeepAlive(this); + return res; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.photo_Ptr_MergeDebevec_delete(ptr); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/MergeExposures.cs b/src/OpenCvSharp/Modules/photo/MergeExposures.cs new file mode 100644 index 000000000..e61236195 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/MergeExposures.cs @@ -0,0 +1,44 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// The base class algorithms that can merge exposure sequence to a single image. +/// +public abstract class MergeExposures : Algorithm +{ + /// + /// Merges images. + /// + /// vector of input images + /// result image + /// vector of exposure time values for each image + /// 256x1 matrix with inverse camera response function for each pixel value, it should have the same number of channels as images. + public virtual void Process(IEnumerable src, OutputArray dst, IEnumerable times, InputArray response) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + if (times is null) + throw new ArgumentNullException(nameof(times)); + if (response is null) + throw new ArgumentNullException(nameof(response)); + dst.ThrowIfNotReady(); + + var srcArray = src.Select(s => s.CvPtr).ToArray(); + var timesArray = times as float[] ?? times.ToArray(); + if (srcArray.Length != timesArray.Length) + throw new OpenCvSharpException("src.Count() != times.Count"); + + NativeMethods.photo_MergeExposures_process(ptr, srcArray, srcArray.Length, dst.CvPtr, timesArray, response.CvPtr); + + dst.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + GC.KeepAlive(response); + GC.KeepAlive(srcArray); + GC.KeepAlive(timesArray); + } +} diff --git a/src/OpenCvSharp/Modules/photo/MergeMertens.cs b/src/OpenCvSharp/Modules/photo/MergeMertens.cs new file mode 100644 index 000000000..ef9128f3e --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/MergeMertens.cs @@ -0,0 +1,87 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Pixels are weighted using contrast, saturation and well-exposedness measures, than images are combined using laplacian pyramids. +/// +/// The resulting image weight is constructed as weighted average of contrast, saturation and well-exposedness measures. +/// +/// The resulting image doesn't require tonemapping and can be converted to 8-bit image by multiplying by 255, +/// but it's recommended to apply gamma correction and/or linear tonemapping. +/// +/// For more information see @cite MK07 . +/// +public sealed class MergeMertens : MergeExposures +{ + private Ptr? ptrObj; + + /// + /// Creates instance by MergeMertens* + /// + private MergeMertens(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates the empty model. + /// + /// + public static MergeMertens Create() + { + var ptr = NativeMethods.photo_createMergeMertens(); + return new MergeMertens(ptr); + } + + /// + /// Short version of process, that doesn't take extra arguments. + /// + /// vector of input images + /// result image + public void Process(IEnumerable src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + dst.ThrowIfNotReady(); + + var srcArray = src.Select(s => s.CvPtr).ToArray(); + + NativeMethods.photo_MergeMertens_process(ptr, srcArray, srcArray.Length, dst.CvPtr); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(srcArray); + dst.Fix(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + var res = NativeMethods.photo_Ptr_MergeMertens_get(ptr); + GC.KeepAlive(this); + return res; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.photo_Ptr_MergeMertens_delete(ptr); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/SeamlessCloneMethods.cs b/src/OpenCvSharp/Modules/photo/SeamlessCloneMethods.cs new file mode 100644 index 000000000..d366d22ac --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/SeamlessCloneMethods.cs @@ -0,0 +1,29 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// SeamlessClone method +/// +public enum SeamlessCloneMethods +{ + /// + /// The power of the method is fully expressed when inserting objects with + /// complex outlines into a new background. + /// + NormalClone = 1, + + /// + /// The classic method, color-based selection and alpha masking might be time + /// consuming and often leaves an undesirable halo. Seamless cloning, even averaged + /// with the original image, is not effective. Mixed seamless cloning based on a + /// loose selection proves effective. + /// + MixedClone = 2, + + /// + /// Feature exchange allows the user to easily replace certain features of one + /// object by alternative features. + /// + MonochromeTransfer = 3 +} diff --git a/src/OpenCvSharp/Modules/photo/Tonemap.cs b/src/OpenCvSharp/Modules/photo/Tonemap.cs new file mode 100644 index 000000000..c5c287315 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/Tonemap.cs @@ -0,0 +1,122 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Base class for tonemapping algorithms - tools that are used to map HDR image to 8-bit range. +/// +public class Tonemap : Algorithm +{ + private Ptr? ptrObj; + + /// + /// Constructor used by Tonemap.Create + /// + private Tonemap() + { + } + + /// + /// Constructor used by subclasses + /// + protected Tonemap(IntPtr ptr) + { + this.ptrObj = null; + this.ptr = ptr; + } + + /// + /// Creates simple linear mapper with gamma correction + /// + /// positive value for gamma correction. + /// Gamma value of 1.0 implies no correction, gamma equal to 2.2f is suitable for most displays. + /// Generally gamma > 1 brightens the image and gamma < 1 darkens it. + /// + public static Tonemap Create(float gamma = 1f) + { + NativeMethods.HandleException( + NativeMethods.photo_createTonemap(gamma, out var ptrObjPtr)); + + var ptrObj = new Ptr(ptrObjPtr); + return new Tonemap + { + ptrObj = ptrObj, + ptr = ptrObj.Get() + }; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Tonemaps image + /// + /// source image - CV_32FC3 Mat (float 32 bits 3 channels) + /// destination image - CV_32FC3 Mat with values in [0, 1] range + public virtual void Process(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.photo_Tonemap_process(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Gets or sets positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma + /// equal to 2.2f is suitable for most displays. + /// Generally gamma > 1 brightens the image and gamma < 1 darkens it. + /// + public float Gamma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_Tonemap_getGamma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_Tonemap_setGamma(ptr, value)); + GC.KeepAlive(this); + } + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_Tonemap_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_Tonemap_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/TonemapDrago.cs b/src/OpenCvSharp/Modules/photo/TonemapDrago.cs new file mode 100644 index 000000000..201188098 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/TonemapDrago.cs @@ -0,0 +1,123 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in logarithmic domain. +/// +/// Since it's a global operator the same function is applied to all the pixels, it is controlled by the bias parameter. +/// Optional saturation enhancement is possible as described in @cite FL02. For more information see @cite DM03. +/// +public sealed class TonemapDrago : Tonemap +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + private TonemapDrago(IntPtr ptrObjPtr) + : base(GetEntityPointer(ptrObjPtr, out var po)) + { + ptrObj = po; + } + + private static IntPtr GetEntityPointer(IntPtr ptrObjPtr, out Ptr ptrObj) + { + ptrObj = new Ptr(ptrObjPtr); + return ptrObj.Get(); + } + + /// + /// Creates TonemapDrago object + /// + /// positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma + /// equal to 2.2f is suitable for most displays. + /// Generally gamma > 1 brightens the image and gamma < 1 darkens it. + /// positive saturation enhancement value. 1.0 preserves saturation, values greater + /// than 1 increase saturation and values less than 1 decrease it. + /// value for bias function in [0, 1] range. Values from 0.7 to 0.9 usually give best + /// results, default value is 0.85. + /// + public static TonemapDrago Create(float gamma = 1.0f, float saturation = 1.0f, float bias = 0.85f) + { + NativeMethods.HandleException( + NativeMethods.photo_createTonemapDrago(gamma, saturation, bias, out var ptr)); + return new TonemapDrago(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Gets or sets positive saturation enhancement value. 1.0 preserves saturation, values greater + /// than 1 increase saturation and values less than 1 decrease it. + /// + public float Saturation + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapDrago_getSaturation(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapDrago_setSaturation(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets value for bias function in [0, 1] range. Values from 0.7 to 0.9 usually give best + /// results, default value is 0.85. + /// + public float Bias + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapDrago_getBias(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapDrago_setBias(ptr, value)); + GC.KeepAlive(this); + } + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_TonemapDrago_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_TonemapDrago_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/TonemapMantiuk.cs b/src/OpenCvSharp/Modules/photo/TonemapMantiuk.cs new file mode 100644 index 000000000..c783d058e --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/TonemapMantiuk.cs @@ -0,0 +1,123 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid, +/// transforms contrast values to HVS response and scales the response. After this the image is +/// reconstructed from new contrast values. +/// +/// For more information see @cite MM06. +/// +public sealed class TonemapMantiuk : Tonemap +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + private TonemapMantiuk(IntPtr ptrObjPtr) + : base(GetEntityPointer(ptrObjPtr, out var po)) + { + ptrObj = po; + } + + private static IntPtr GetEntityPointer(IntPtr ptrObjPtr, out Ptr ptrObj) + { + ptrObj = new Ptr(ptrObjPtr); + return ptrObj.Get(); + } + + /// + /// Creates TonemapMantiuk object + /// + /// positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma + /// equal to 2.2f is suitable for most displays. + /// Generally gamma > 1 brightens the image and gamma < 1 darkens it. + /// contrast scale factor. HVS response is multiplied by this parameter, thus compressing + /// dynamic range. Values from 0.6 to 0.9 produce best results. + /// + /// + public static TonemapMantiuk Create(float gamma = 1.0f, float scale = 0.7f, float saturation = 1.0f) + { + NativeMethods.HandleException( + NativeMethods.photo_createTonemapMantiuk(gamma, scale, saturation, out var ptr)); + return new TonemapMantiuk(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Gets or sets contrast scale factor. HVS response is multiplied by this parameter, thus compressing + /// dynamic range. Values from 0.6 to 0.9 produce best results. + /// + public float Scale + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapMantiuk_getScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapMantiuk_setScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets positive saturation enhancement value. 1.0 preserves saturation, values greater + /// than 1 increase saturation and values less than 1 decrease it. + /// + public float Saturation + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapMantiuk_getSaturation(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapMantiuk_setSaturation(ptr, value)); + GC.KeepAlive(this); + } + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_TonemapMantiuk_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_TonemapMantiuk_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/photo/TonemapReinhard.cs b/src/OpenCvSharp/Modules/photo/TonemapReinhard.cs new file mode 100644 index 000000000..46f453b43 --- /dev/null +++ b/src/OpenCvSharp/Modules/photo/TonemapReinhard.cs @@ -0,0 +1,146 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp; + +/// +/// This is a global tonemapping operator that models human visual system. +/// +/// Mapping function is controlled by adaptation parameter, that is computed using light adaptation and +/// color adaptation. For more information see @cite RD05. +/// +public sealed class TonemapReinhard : Tonemap +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + private TonemapReinhard(IntPtr ptrObjPtr) + : base(GetEntityPointer(ptrObjPtr, out var po)) + { + ptrObj = po; + } + + private static IntPtr GetEntityPointer(IntPtr ptrObjPtr, out Ptr ptrObj) + { + ptrObj = new Ptr(ptrObjPtr); + return ptrObj.Get(); + } + + /// + /// Creates TonemapReinhard object + /// + /// positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma + /// equal to 2.2f is suitable for most displays. + /// Generally gamma > 1 brightens the image and gamma < 1 darkens it. + /// result intensity in [-8, 8] range. Greater intensity produces brighter results. + /// light adaptation in [0, 1] range. If 1 adaptation is based only on pixel + /// value, if 0 it's global, otherwise it's a weighted mean of this two cases. + /// chromatic adaptation in [0, 1] range. If 1 channels are treated independently, + /// if 0 adaptation level is the same for each channel. + /// + public static TonemapReinhard Create(float gamma = 1.0f, float intensity = 0.0f, float lightAdapt = 1.0f, float colorAdapt = 0.0f) + { + NativeMethods.HandleException( + NativeMethods.photo_createTonemapReinhard(gamma, intensity, lightAdapt, colorAdapt, out var ptr)); + return new TonemapReinhard(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Gets or sets result intensity in [-8, 8] range. Greater intensity produces brighter results. + /// + public float Intensity + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapReinhard_getIntensity(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapReinhard_setIntensity(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets light adaptation in [0, 1] range. If 1 adaptation is based only on pixel + /// value, if 0 it's global, otherwise it's a weighted mean of this two cases. + /// + public float LightAdaptation + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapReinhard_getLightAdaptation(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapReinhard_setLightAdaptation(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets chromatic adaptation in [0, 1] range. If 1 channels are treated independently, + /// if 0 adaptation level is the same for each channel. + /// + public float ColorAdaptation + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapReinhard_getColorAdaptation(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.photo_TonemapReinhard_setColorAdaptation(ptr, value)); + GC.KeepAlive(this); + } + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_TonemapReinhard_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.photo_Ptr_TonemapReinhard_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/quality/QualityBRISQUE.cs b/src/OpenCvSharp/Modules/quality/QualityBRISQUE.cs new file mode 100644 index 000000000..0e125910e --- /dev/null +++ b/src/OpenCvSharp/Modules/quality/QualityBRISQUE.cs @@ -0,0 +1,141 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.ML; +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo +// ReSharper disable IdentifierTypo +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.Quality; + +/// +/// BRISQUE (Blind/Referenceless Image Spatial Quality Evaluator) is a No Reference Image Quality Assessment (NR-IQA) algorithm. +/// BRISQUE computes a score based on extracting Natural Scene Statistics(https://en.wikipedia.org/wiki/Scene_statistics) +/// and calculating feature vectors. See Mittal et al. @cite Mittal2 for original paper and original implementation @cite Mittal2_software. +/// A trained model is provided in the /samples/ directory and is trained on the LIVE-R2 database @cite Sheikh as in the original implementation. +/// When evaluated against the TID2008 database @cite Ponomarenko, the SROCC is -0.8424 versus the SROCC of -0.8354 in the original implementation. +/// C++ code for the BRISQUE LIVE-R2 trainer and TID2008 evaluator are also provided in the /samples/ directory. +/// +public class QualityBRISQUE : QualityBase +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected QualityBRISQUE(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create an object which calculates quality + /// + /// String which contains a path to the BRISQUE model data, eg. /path/to/brisque_model_live.yml + /// String which contains a path to the BRISQUE range data, eg. /path/to/brisque_range_live.yml + /// + public static QualityBRISQUE Create(string modelFilePath, string rangeFilePath) + { + if (string.IsNullOrEmpty(modelFilePath)) + throw new ArgumentNullException(nameof(modelFilePath)); + if (string.IsNullOrEmpty(rangeFilePath)) + throw new ArgumentNullException(nameof(rangeFilePath)); + + NativeMethods.HandleException( + NativeMethods.quality_createQualityBRISQUE1(modelFilePath, rangeFilePath, out var ptr)); + return new QualityBRISQUE(ptr); + } + + /// + /// Create an object which calculates quality + /// + /// cv::ml::SVM* which contains a loaded BRISQUE model + /// cv::Mat which contains BRISQUE range data + /// + public static QualityBRISQUE Create(SVM model, Mat range) + { + if (model is null) + throw new ArgumentNullException(nameof(model)); + if (range is null) + throw new ArgumentNullException(nameof(range)); + model.ThrowIfDisposed(); + range.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_createQualityBRISQUE2(model.CvPtr, range.CvPtr, out var ptr)); + GC.KeepAlive(model); + GC.KeepAlive(range); + return new QualityBRISQUE(ptr); + } + + /// + /// static method for computing quality + /// + /// image for which to compute quality + /// String which contains a path to the BRISQUE model data, eg. /path/to/brisque_model_live.yml + /// cv::String which contains a path to the BRISQUE range data, eg. /path/to/brisque_range_live.yml + /// cv::Scalar with the score in the first element. The score ranges from 0 (best quality) to 100 (worst quality) + public static Scalar Compute(InputArray img, string modelFilePath, string rangeFilePath) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (string.IsNullOrEmpty(modelFilePath)) + throw new ArgumentNullException(nameof(modelFilePath)); + if (string.IsNullOrEmpty(rangeFilePath)) + throw new ArgumentNullException(nameof(rangeFilePath)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_QualityBRISQUE_staticCompute(img.CvPtr, modelFilePath, rangeFilePath, out var ret)); + + GC.KeepAlive(img); + return ret; + } + + /// + /// static method for computing image features used by the BRISQUE algorithm + /// + /// image (BGR(A) or grayscale) for which to compute features + /// output row vector of features to cv::Mat or cv::UMat + public static void ComputeFeatures(InputArray img, OutputArray features) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (features is null) + throw new ArgumentNullException(nameof(features)); + + NativeMethods.HandleException( + NativeMethods.quality_QualityBRISQUE_computeFeatures(img.CvPtr, features.CvPtr)); + + GC.KeepAlive(img); + GC.KeepAlive(features); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityBRISQUE_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityBRISQUE_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/quality/QualityBase.cs b/src/OpenCvSharp/Modules/quality/QualityBase.cs new file mode 100644 index 000000000..fee1ede62 --- /dev/null +++ b/src/OpenCvSharp/Modules/quality/QualityBase.cs @@ -0,0 +1,68 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Quality; + +/// +/// Quality Base Class +/// +public abstract class QualityBase : Algorithm +{ + /// + /// Implements Algorithm::empty() + /// + /// + public override bool Empty + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.quality_QualityBase_empty(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + } + + /// + /// Returns output quality map that was generated during computation, if supported by the algorithm + /// + /// + public virtual void GetQualityMap(OutputArray dst) + { + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + dst.ThrowIfNotReady(); + NativeMethods.HandleException( + NativeMethods.quality_QualityBase_getQualityMap(ptr, dst.CvPtr)); + dst.Fix(); + } + + /// + /// Compute quality score per channel with the per-channel score in each element of the resulting cv::Scalar. + /// See specific algorithm for interpreting result scores + /// + /// comparison image, or image to evaluate for no-reference quality algorithms + public virtual Scalar Compute(InputArray img) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_QualityBase_compute(ptr, img.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(img); + return ret; + } + + /// + /// Implements Algorithm::clear() + /// + public virtual void Clear() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.quality_QualityBase_clear(ptr)); + GC.KeepAlive(this); + } +} diff --git a/src/OpenCvSharp/Modules/quality/QualityGMSD.cs b/src/OpenCvSharp/Modules/quality/QualityGMSD.cs new file mode 100644 index 000000000..c98485278 --- /dev/null +++ b/src/OpenCvSharp/Modules/quality/QualityGMSD.cs @@ -0,0 +1,96 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo + +namespace OpenCvSharp.Quality; + +/// +/// Full reference GMSD algorithm +/// +public class QualityGMSD : QualityBase +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected QualityGMSD(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create an object which calculates quality + /// + /// input image to use as the source for comparison + /// + public static QualityGMSD Create(InputArray @ref) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + @ref.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_createQualityGMSD(@ref.CvPtr, out var ptr)); + GC.KeepAlive(@ref); + return new QualityGMSD(ptr); + } + + /// + /// static method for computing quality + /// + /// + /// + /// output quality map, or null + /// cv::Scalar with per-channel quality values. Values range from 0 (worst) to 1 (best) + public static Scalar Compute(InputArray @ref, InputArray cmp, OutputArray? qualityMap) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + if (cmp is null) + throw new ArgumentNullException(nameof(cmp)); + @ref.ThrowIfDisposed(); + cmp.ThrowIfDisposed(); + qualityMap?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.quality_QualityGMSD_staticCompute( + @ref.CvPtr, cmp.CvPtr, qualityMap?.CvPtr ?? IntPtr.Zero, out var ret)); + + GC.KeepAlive(@ref); + GC.KeepAlive(cmp); + qualityMap?.Fix(); + return ret; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityGMSD_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityGMSD_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/quality/QualityMSE.cs b/src/OpenCvSharp/Modules/quality/QualityMSE.cs new file mode 100644 index 000000000..28f91c252 --- /dev/null +++ b/src/OpenCvSharp/Modules/quality/QualityMSE.cs @@ -0,0 +1,97 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Quality; + +/// +/// Full reference mean square error algorithm https://en.wikipedia.org/wiki/Mean_squared_error +/// +// ReSharper disable once InconsistentNaming +public class QualityMSE : QualityBase +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected QualityMSE(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create an object which calculates quality + /// + /// input image to use as the source for comparison + /// + public static QualityMSE Create(InputArray @ref) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + @ref.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_createQualityMSE(@ref.CvPtr, out var ptr)); + + GC.KeepAlive(@ref); + return new QualityMSE(ptr); + } + + // TODO support InputArrayOfArrays + // CV_WRAP cv::Scalar compute( InputArrayOfArrays cmpImgs ) CV_OVERRIDE; + + /// + /// static method for computing quality + /// + /// + /// + /// output quality map, or null + /// cv::Scalar with per-channel quality values. Values range from 0 (worst) to 1 (best) + public static Scalar Compute(InputArray @ref, InputArray cmp, OutputArray? qualityMap) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + if (cmp is null) + throw new ArgumentNullException(nameof(cmp)); + @ref.ThrowIfDisposed(); + cmp.ThrowIfDisposed(); + qualityMap?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.quality_QualityMSE_staticCompute( + @ref.CvPtr, cmp.CvPtr, qualityMap?.CvPtr ?? IntPtr.Zero, out var ret)); + + GC.KeepAlive(@ref); + GC.KeepAlive(cmp); + qualityMap?.Fix(); + return ret; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityMSE_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityMSE_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/quality/QualityPSNR.cs b/src/OpenCvSharp/Modules/quality/QualityPSNR.cs new file mode 100644 index 000000000..ee4a5d3b7 --- /dev/null +++ b/src/OpenCvSharp/Modules/quality/QualityPSNR.cs @@ -0,0 +1,121 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Quality; + +/// +/// Full reference peak signal to noise ratio (PSNR) algorithm https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio +/// +public class QualityPSNR : QualityBase +{ + private const double MaxPixelValueDefault = 255; + + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected QualityPSNR(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// get or set the maximum pixel value used for PSNR computation + /// + /// + public double MaxPixelValue + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.quality_QualityPSNR_getMaxPixelValue(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.quality_QualityPSNR_setMaxPixelValue(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Create an object which calculates quality + /// + /// input image to use as the source for comparison + /// maximum per-channel value for any individual pixel; eg 255 for uint8 image + /// + public static QualityPSNR Create(InputArray @ref, double maxPixelValue = MaxPixelValueDefault) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + @ref.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_createQualityPSNR(@ref.CvPtr, maxPixelValue, out var ptr)); + GC.KeepAlive(@ref); + return new QualityPSNR(ptr); + } + + /// + /// static method for computing quality + /// + /// + /// + /// output quality map, or null + /// maximum per-channel value for any individual pixel; eg 255 for uint8 image + /// PSNR value, or double.PositiveInfinity if the MSE between the two images == 0 + public static Scalar Compute(InputArray @ref, InputArray cmp, OutputArray? qualityMap, double maxPixelValue = MaxPixelValueDefault) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + if (cmp is null) + throw new ArgumentNullException(nameof(cmp)); + @ref.ThrowIfDisposed(); + cmp.ThrowIfDisposed(); + qualityMap?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.quality_QualityPSNR_staticCompute( + @ref.CvPtr, cmp.CvPtr, qualityMap?.CvPtr ?? IntPtr.Zero, maxPixelValue, out var ret)); + + GC.KeepAlive(@ref); + GC.KeepAlive(cmp); + qualityMap?.Fix(); + return ret; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityPSNR_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualityPSNR_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/quality/QualitySSIM.cs b/src/OpenCvSharp/Modules/quality/QualitySSIM.cs new file mode 100644 index 000000000..191ce8caf --- /dev/null +++ b/src/OpenCvSharp/Modules/quality/QualitySSIM.cs @@ -0,0 +1,95 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo + +namespace OpenCvSharp.Quality; + +/// +/// Full reference structural similarity algorithm https://en.wikipedia.org/wiki/Structural_similarity +/// +public class QualitySSIM : QualityBase +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected QualitySSIM(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create an object which calculates quality + /// + /// input image to use as the source for comparison + /// + public static QualitySSIM Create(InputArray @ref) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + @ref.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.quality_createQualitySSIM(@ref.CvPtr, out var ptr)); + GC.KeepAlive(@ref); + return new QualitySSIM(ptr); + } + + /// + /// static method for computing quality + /// + /// + /// + /// output quality map, or null + /// cv::Scalar with per-channel quality values. Values range from 0 (worst) to 1 (best) + public static Scalar Compute(InputArray @ref, InputArray cmp, OutputArray? qualityMap) + { + if (@ref is null) + throw new ArgumentNullException(nameof(@ref)); + if (cmp is null) + throw new ArgumentNullException(nameof(cmp)); + @ref.ThrowIfDisposed(); + cmp.ThrowIfDisposed(); + qualityMap?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.quality_QualitySSIM_staticCompute( + @ref.CvPtr, cmp.CvPtr, qualityMap?.CvPtr ?? IntPtr.Zero, out var ret)); + + GC.KeepAlive(@ref); + GC.KeepAlive(cmp); + qualityMap?.Fix(); + return ret; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualitySSIM_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.quality_Ptr_QualitySSIM_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/shape/HausdorffDistanceExtractor.cs b/src/OpenCvSharp/Modules/shape/HausdorffDistanceExtractor.cs new file mode 100644 index 000000000..fd05b6351 --- /dev/null +++ b/src/OpenCvSharp/Modules/shape/HausdorffDistanceExtractor.cs @@ -0,0 +1,120 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// A simple Hausdorff distance measure between shapes defined by contours +/// +/// +/// according to the paper "Comparing Images using the Hausdorff distance." +/// by D.P. Huttenlocher, G.A. Klanderman, and W.J. Rucklidge. (PAMI 1993). : +/// +public class HausdorffDistanceExtractor : ShapeDistanceExtractor +{ + private Ptr? ptrObj; + + #region Init & Disposal + + /// + /// + /// + protected HausdorffDistanceExtractor(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Complete constructor + /// + /// Flag indicating which norm is used to compute the Hausdorff distance (NORM_L1, NORM_L2). + /// fractional value (between 0 and 1). + /// + public static HausdorffDistanceExtractor Create( + DistanceTypes distanceFlag = DistanceTypes.L2, float rankProp = 0.6f) + { + NativeMethods.HandleException( + NativeMethods.shape_createHausdorffDistanceExtractor( + (int) distanceFlag, rankProp, out var ret)); + return new HausdorffDistanceExtractor(ret); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Flag indicating which norm is used to compute the Hausdorff distance (NORM_L1, NORM_L2). + /// + public DistanceTypes DistanceFlag + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_HausdorffDistanceExtractor_getDistanceFlag(ptr, out var ret)); + GC.KeepAlive(this); + return (DistanceTypes)ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_HausdorffDistanceExtractor_setDistanceFlag(ptr, (int) value)); + GC.KeepAlive(this); + } + } + + /// + /// fractional value (between 0 and 1). + /// + public float RankProportion + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_HausdorffDistanceExtractor_getRankProportion(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_HausdorffDistanceExtractor_setRankProportion(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.shape_Ptr_HausdorffDistanceExtractor_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.shape_Ptr_HausdorffDistanceExtractor_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/shape/ShapeContextDistanceExtractor.cs b/src/OpenCvSharp/Modules/shape/ShapeContextDistanceExtractor.cs new file mode 100644 index 000000000..d16b1ab51 --- /dev/null +++ b/src/OpenCvSharp/Modules/shape/ShapeContextDistanceExtractor.cs @@ -0,0 +1,355 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Implementation of the Shape Context descriptor and matching algorithm +/// +/// +/// proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" +/// (PAMI2002). This implementation is packaged in a generic scheme, in order to allow +/// you the implementation of the common variations of the original pipeline. +/// +public class ShapeContextDistanceExtractor : ShapeDistanceExtractor +{ + private Ptr? ptrObj; + + #region Init & Disposal + + /// + /// + /// + protected ShapeContextDistanceExtractor(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Complete constructor + /// + /// The number of angular bins in the shape context descriptor. + /// The number of radial bins in the shape context descriptor. + /// The value of the inner radius. + /// The value of the outer radius. + /// + /// + public static ShapeContextDistanceExtractor Create( + int nAngularBins = 12, int nRadialBins = 4, float innerRadius = 0.2f, + float outerRadius = 2, int iterations = 3) + { + NativeMethods.HandleException( + NativeMethods.shape_createShapeContextDistanceExtractor( + nAngularBins, nRadialBins, innerRadius, outerRadius, iterations, out var ret)); + return new ShapeContextDistanceExtractor(ret); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// The number of angular bins in the shape context descriptor. + /// + public int AngularBins + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getAngularBins(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setAngularBins(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The number of radial bins in the shape context descriptor. + /// + public int RadialBins + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getRadialBins(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setRadialBins(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The value of the inner radius. + /// + public float InnerRadius + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getInnerRadius(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setInnerRadius(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The value of the outer radius. + /// + public float OuterRadius + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getOuterRadius(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setOuterRadius(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool RotationInvariant + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getRotationInvariant(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setRotationInvariant(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// The weight of the shape context distance in the final distance value. + /// + public float ShapeContextWeight + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getShapeContextWeight(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setShapeContextWeight(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The weight of the appearance cost in the final distance value. + /// + public float ImageAppearanceWeight + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getImageAppearanceWeight(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setImageAppearanceWeight(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The weight of the Bending Energy in the final distance value. + /// + public float BendingEnergyWeight + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getBendingEnergyWeight(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setBendingEnergyWeight(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Iterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The value of the standard deviation for the Gaussian window for the image appearance cost. + /// + public float StdDev + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getStdDev(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setStdDev(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + #region Methods + + /// + /// Set the images that correspond to each shape. + /// This images are used in the calculation of the Image Appearance cost. + /// + /// Image corresponding to the shape defined by contours1. + /// Image corresponding to the shape defined by contours2. + public void SetImages(InputArray image1, InputArray image2) + { + ThrowIfDisposed(); + if (image1 is null) + throw new ArgumentNullException(nameof(image1)); + if (image2 is null) + throw new ArgumentNullException(nameof(image2)); + image1.ThrowIfDisposed(); + image2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_setImages(ptr, image1.CvPtr, image2.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(image1); + GC.KeepAlive(image2); + } + + /// + /// Get the images that correspond to each shape. + /// This images are used in the calculation of the Image Appearance cost. + /// + /// Image corresponding to the shape defined by contours1. + /// Image corresponding to the shape defined by contours2. + public void GetImages(OutputArray image1, OutputArray image2) + { + ThrowIfDisposed(); + if (image1 is null) + throw new ArgumentNullException(nameof(image1)); + if (image2 is null) + throw new ArgumentNullException(nameof(image2)); + image1.ThrowIfNotReady(); + image2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.shape_ShapeContextDistanceExtractor_getImages(ptr, image1.CvPtr, image2.CvPtr)); + + image1.Fix(); + image2.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(image1); + GC.KeepAlive(image2); + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.shape_Ptr_ShapeContextDistanceExtractor_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.shape_Ptr_ShapeContextDistanceExtractor_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/shape/ShapeDistanceExtractor.cs b/src/OpenCvSharp/Modules/shape/ShapeDistanceExtractor.cs new file mode 100644 index 000000000..8075e13a3 --- /dev/null +++ b/src/OpenCvSharp/Modules/shape/ShapeDistanceExtractor.cs @@ -0,0 +1,38 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable once InconsistentNaming +/// +/// Abstract base class for shape distance algorithms. +/// +public abstract class ShapeDistanceExtractor : Algorithm +{ + /// + /// Compute the shape distance between two shapes defined by its contours. + /// + /// Contour defining first shape. + /// Contour defining second shape. + /// + public virtual float ComputeDistance(InputArray contour1, InputArray contour2) + { + if (ptr == IntPtr.Zero) + throw new ObjectDisposedException(GetType().Name); + if (contour1 is null) + throw new ArgumentNullException(nameof(contour1)); + if (contour2 is null) + throw new ArgumentNullException(nameof(contour2)); + contour1.ThrowIfDisposed(); + contour2.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.shape_ShapeDistanceExtractor_computeDistance( + ptr, contour1.CvPtr, contour2.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(contour1); + GC.KeepAlive(contour2); + + return ret; + } +} diff --git a/src/OpenCvSharp/Modules/stitching/AffineBestOf2NearestMatcher.cs b/src/OpenCvSharp/Modules/stitching/AffineBestOf2NearestMatcher.cs new file mode 100644 index 000000000..d8a16e3f7 --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/AffineBestOf2NearestMatcher.cs @@ -0,0 +1,62 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Detail; + +/// +/// Features matcher similar to cv::detail::BestOf2NearestMatcher which +/// finds two best matches for each feature and leaves the best one only if the +/// ratio between descriptor distances is greater than the threshold match_conf. +/// +/// Unlike cv::detail::BestOf2NearestMatcher this matcher uses affine +/// transformation (affine transformation estimate will be placed in matches_info). +/// +public class AffineBestOf2NearestMatcher : BestOf2NearestMatcher +{ + /// + /// Constructs a "best of 2 nearest" matcher that expects affine transformation between images + /// + /// whether to use full affine transformation with 6 degress of freedom + /// or reduced transformation with 4 degrees of freedom using only rotation, translation and + /// uniform scaling + /// Should try to use GPU or not + /// Match distances ration threshold + /// Minimum number of matches required for the 2D affine transform + /// estimation used in the inliers classification step + public AffineBestOf2NearestMatcher( + bool fullAffine = false, + bool tryUseGpu = false, + float matchConf = 0.3f, + int numMatchesThresh1 = 6) + : base(Create(fullAffine, tryUseGpu, matchConf, numMatchesThresh1)) + { + } + + private static IntPtr Create( + bool fullAffine, + bool tryUseGpu, + float matchConf, + int numMatchesThresh1) + { + NativeMethods.HandleException( + NativeMethods.stitching_AffineBestOf2NearestMatcher_new( + fullAffine ? 1 : 0, + tryUseGpu ? 1 : 0, + matchConf, + numMatchesThresh1, + out var ptr)); + return ptr; + } + + /// + /// releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero) + { + NativeMethods.HandleException( + NativeMethods.stitching_AffineBestOf2NearestMatcher_delete(ptr)); + ptr = IntPtr.Zero; + } + } +} diff --git a/src/OpenCvSharp/Modules/stitching/BestOf2NearestMatcher.cs b/src/OpenCvSharp/Modules/stitching/BestOf2NearestMatcher.cs new file mode 100644 index 000000000..f6506c2fc --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/BestOf2NearestMatcher.cs @@ -0,0 +1,74 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Detail; + +/// +/// Features matcher which finds two best matches for each feature and leaves the best one only if the +/// ratio between descriptor distances is greater than the threshold match_conf +/// +public class BestOf2NearestMatcher : FeaturesMatcher +{ + /// + /// Constructs a "best of 2 nearest" matcher. + /// + /// Should try to use GPU or not + /// Match distances ration threshold + /// Minimum number of matches required for the 2D projective transform + /// estimation used in the inliers classification step + /// Minimum number of matches required for the 2D projective transform + /// re-estimation on inliers + public BestOf2NearestMatcher( + bool tryUseGpu = false, + float matchConf = 0.3f, + int numMatchesThresh1 = 6, + int numMatchesThresh2 = 6) + : base(Create(tryUseGpu, matchConf, numMatchesThresh1, numMatchesThresh2)) + { + } + + /// + /// Constructor + /// + /// + protected BestOf2NearestMatcher(IntPtr p) : base(p) { } + + private static IntPtr Create( + bool tryUseGpu, + float matchConf, + int numMatchesThresh1, + int numMatchesThresh2) + { + NativeMethods.HandleException( + NativeMethods.stitching_BestOf2NearestMatcher_new( + tryUseGpu ? 1 : 0, + matchConf, + numMatchesThresh1, + numMatchesThresh2, + out var ptr)); + return ptr; + } + + /// + /// releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero) + { + NativeMethods.HandleException( + NativeMethods.stitching_BestOf2NearestMatcher_delete(ptr)); + ptr = IntPtr.Zero; + } + } + + /// + /// Frees unused memory allocated before if there is any. + /// + public override void CollectGarbage() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.stitching_BestOf2NearestMatcher_collectGarbage(ptr)); + GC.KeepAlive(this); + } +} diff --git a/src/OpenCvSharp/Modules/stitching/CvDetail.cs b/src/OpenCvSharp/Modules/stitching/CvDetail.cs new file mode 100644 index 000000000..4fba3d07b --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/CvDetail.cs @@ -0,0 +1,100 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.Detail; + +/// +/// cv::detail functions +/// +public static class CvDetail +{ + /// + /// + /// + /// + /// + /// + public static ImageFeatures[] ComputeImageFeatures( + Feature2D featuresFinder, + IEnumerable images, + IEnumerable? masks = null) + { + if (featuresFinder is null) + throw new ArgumentNullException(nameof(featuresFinder)); + if (images is null) + throw new ArgumentNullException(nameof(images)); + featuresFinder.ThrowIfDisposed(); + + var imagesArray = images as Mat[] ?? images.ToArray(); + if (imagesArray.Length == 0) + throw new ArgumentException("Empty array", nameof(images)); + + var imagesPointers = imagesArray.Select(i => i.CvPtr).ToArray(); + var masksPointers = masks?.Select(i => i.CvPtr).ToArray(); + if (masksPointers is not null && imagesPointers.Length != masksPointers.Length) + throw new ArgumentException("size of images != size of masks"); + + using var wImageFeaturesVec = new VectorOfImageFeatures(); + NativeMethods.HandleException( + NativeMethods.stitching_computeImageFeatures1( + featuresFinder.CvPtr, + imagesPointers, + imagesPointers.Length, + wImageFeaturesVec.CvPtr, + masksPointers)); + + GC.KeepAlive(featuresFinder); + GC.KeepAlive(images); + GC.KeepAlive(masks); + GC.KeepAlive(imagesPointers); + + return wImageFeaturesVec.ToArray(); + } + + /// + /// + /// + /// + /// + /// + public static ImageFeatures ComputeImageFeatures( + Feature2D featuresFinder, + InputArray image, + InputArray? mask = null) + { + if (featuresFinder is null) + throw new ArgumentNullException(nameof(featuresFinder)); + if (image is null) + throw new ArgumentNullException(nameof(image)); + featuresFinder.ThrowIfDisposed(); + image.ThrowIfDisposed(); + + var descriptorsMat = new Mat(); + using var keypointsVec = new VectorOfKeyPoint(); + var wImageFeatures = new WImageFeatures + { + Keypoints = keypointsVec.CvPtr, + Descriptors = descriptorsMat.CvPtr + }; + + unsafe + { + NativeMethods.HandleException( + NativeMethods.stitching_computeImageFeatures2( + featuresFinder.CvPtr, image.CvPtr, &wImageFeatures, mask?.CvPtr ?? IntPtr.Zero)); + } + + GC.KeepAlive(featuresFinder); + GC.KeepAlive(image); + GC.KeepAlive(mask); + GC.KeepAlive(descriptorsMat); + + return new ImageFeatures( + wImageFeatures.ImgIdx, + wImageFeatures.ImgSize, + keypointsVec.ToArray(), + descriptorsMat); + } +} diff --git a/src/OpenCvSharp/Modules/stitching/FeaturesMatcher.cs b/src/OpenCvSharp/Modules/stitching/FeaturesMatcher.cs new file mode 100644 index 000000000..b81d9b06b --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/FeaturesMatcher.cs @@ -0,0 +1,194 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Detail; + +/// +/// Feature matchers base class. +/// +public abstract class FeaturesMatcher : DisposableCvObject +{ + /// + /// Constructor + /// + /// + protected FeaturesMatcher(IntPtr ptr) + : base(ptr) + { + } + + /// + /// Performs images matching. + /// + /// First image features + /// Second image features + /// Found matches + public virtual MatchesInfo Apply( + ImageFeatures features1, ImageFeatures features2) + { + ThrowIfDisposed(); + + if (features1 is null) + throw new ArgumentNullException(nameof(features1)); + if (features2 is null) + throw new ArgumentNullException(nameof(features2)); + if (features1.Descriptors is null) + throw new ArgumentException($"{nameof(features1)}.Descriptors is null", nameof(features1)); + if (features2.Descriptors is null) + throw new ArgumentException($"{nameof(features2)}.Descriptors is null", nameof(features1)); + features1.Descriptors.ThrowIfDisposed(); + features2.Descriptors.ThrowIfDisposed(); + + using var keypointsVec1 = new VectorOfKeyPoint(features1.Keypoints); + using var keypointsVec2 = new VectorOfKeyPoint(features2.Keypoints); + var features1Cpp = new WImageFeatures + { + ImgIdx = features1.ImgIdx, + ImgSize = features1.ImgSize, + Keypoints = keypointsVec1.CvPtr, + Descriptors = features1.Descriptors.CvPtr, + }; + var features2Cpp = new WImageFeatures + { + ImgIdx = features2.ImgIdx, + ImgSize = features2.ImgSize, + Keypoints = keypointsVec2.CvPtr, + Descriptors = features2.Descriptors.CvPtr, + }; + using var matchesVec = new VectorOfDMatch(); + using var inliersMaskVec = new VectorOfByte(); + var h = new Mat(); + NativeMethods.HandleException( + NativeMethods.stitching_FeaturesMatcher_apply( + ptr, + ref features1Cpp, + ref features2Cpp, + out var srcImgIdx, + out var dstImgIdx, + matchesVec.CvPtr, + inliersMaskVec.CvPtr, + out var numInliers, + h.CvPtr, + out var confidence)); + + GC.KeepAlive(this); + + return new MatchesInfo( + srcImgIdx, dstImgIdx, matchesVec.ToArray(), inliersMaskVec.ToArray(), + numInliers, h, confidence); + } + + /// + /// Performs images matching. + /// + /// Features of the source images + /// Mask indicating which image pairs must be matched + /// Found pairwise matches + public virtual MatchesInfo[] Apply( + IEnumerable features, Mat? mask = null) + { + if (features is null) + throw new ArgumentNullException(nameof(features)); + ThrowIfDisposed(); + + var featuresArray = features.CastOrToArray(); + if (featuresArray.Length == 0) + throw new ArgumentException("Empty features array", nameof(features)); + + var keypointVecs = new VectorOfKeyPoint?[featuresArray.Length]; + var wImageFeatures = new WImageFeatures[featuresArray.Length]; + try + { + for (int i = 0; i < featuresArray.Length; i++) + { + if (featuresArray[i].Descriptors is null) + throw new ArgumentException("features contain null descriptor mat", nameof(features)); + featuresArray[i].Descriptors.ThrowIfDisposed(); + + keypointVecs[i] = new VectorOfKeyPoint(); + wImageFeatures[i] = new WImageFeatures + { + ImgIdx = featuresArray[i].ImgIdx, + ImgSize = featuresArray[i].ImgSize, + Keypoints = keypointVecs[i]!.CvPtr, + Descriptors = featuresArray[i].Descriptors.CvPtr, + }; + } + + using var srcImgIndexVecs = new VectorOfInt32(); + using var dstImgIndexVecs = new VectorOfInt32(); + using var matchesVec = new VectorOfVectorDMatch(); + using var inlinersMaskVec = new VectorOfVectorByte(); + using var numInliersVecs = new VectorOfInt32(); + using var hVecs = new VectorOfMat(); + using var confidenceVecs = new VectorOfDouble(); + NativeMethods.HandleException( + NativeMethods.stitching_FeaturesMatcher_apply2( + ptr, + wImageFeatures, wImageFeatures.Length, + mask?.CvPtr ?? IntPtr.Zero, + srcImgIndexVecs.CvPtr, + dstImgIndexVecs.CvPtr, + matchesVec.CvPtr, + inlinersMaskVec.CvPtr, + numInliersVecs.CvPtr, + hVecs.CvPtr, + confidenceVecs.CvPtr + )); + + var srcImgIndices = srcImgIndexVecs.ToArray(); + var dstImgIndices = dstImgIndexVecs.ToArray(); + var matches = matchesVec.ToArray(); + var inlinersMasks = inlinersMaskVec.ToArray(); + var numInliers = numInliersVecs.ToArray(); + var hs = hVecs.ToArray(); + var confidences = confidenceVecs.ToArray(); + var result = new MatchesInfo[srcImgIndices.Length]; + for (int i = 0; i < srcImgIndices.Length; i++) + { + result[i] = new MatchesInfo( + srcImgIndices[i], + dstImgIndices[i], + matches[i], + inlinersMasks[i], + numInliers[i], + hs[i], + confidences[i]); + } + return result; + } + finally + { + foreach (var vec in keypointVecs) + { + vec?.Dispose(); + } + GC.KeepAlive(this); + } + } + + /// + /// True, if it's possible to use the same matcher instance in parallel, false otherwise + /// + /// + public virtual bool IsThreadSafe() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.stitching_FeaturesMatcher_isThreadSafe(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Frees unused memory allocated before if there is any. + /// + public virtual void CollectGarbage() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.stitching_FeaturesMatcher_collectGarbage(ptr)); + GC.KeepAlive(this); + } +} diff --git a/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs b/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs new file mode 100644 index 000000000..072ad05eb --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs @@ -0,0 +1,71 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp.Detail; + +/// +/// Structure containing image keypoints and descriptors. +/// +public class ImageFeatures : IDisposable +{ +#pragma warning disable 1591 + public int ImgIdx { get; } + public Size ImgSize{ get; } + public IReadOnlyList Keypoints{ get; } + public Mat Descriptors{ get; } +#pragma warning restore 1591 + + /// + /// Constructor + /// + /// + /// + /// + /// + public ImageFeatures(int imgIdx, Size imgSize, IReadOnlyList keypoints, Mat descriptors) + { + ImgIdx = imgIdx; + ImgSize = imgSize; + Keypoints = keypoints; + Descriptors = descriptors; + } + + /// + /// Destructor + /// + ~ImageFeatures() + { + Dispose(false); + } + + /// + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + Descriptors.Dispose(); + } + } + + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } +} + +#pragma warning disable 1591 +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +[SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] +public struct WImageFeatures +{ + public int ImgIdx; + public Size ImgSize; + public IntPtr Keypoints; + public IntPtr Descriptors; +} +#pragma warning restore 1591 diff --git a/src/OpenCvSharp/Modules/stitching/MatchesInfo.cs b/src/OpenCvSharp/Modules/stitching/MatchesInfo.cs new file mode 100644 index 000000000..e40051e75 --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/MatchesInfo.cs @@ -0,0 +1,98 @@ +namespace OpenCvSharp.Detail; + +/// +/// Structure containing information about matches between two images. +/// +/// It's assumed that there is a transformation between those images. Transformation may be +/// homography or affine transformation based on selected matcher. +/// +public sealed class MatchesInfo : IDisposable +{ + /// + /// Images indices (optional) + /// + public int SrcImgIdx { get; } + + /// + /// Images indices (optional) + /// + public int DstImgIdx { get; } + + /// + /// + /// + public IReadOnlyList Matches { get; } + + /// + /// Geometrically consistent matches mask + /// + public IReadOnlyList InliersMask { get; } + + /// + /// Number of geometrically consistent matches + /// + public int NumInliers { get; } + + /// + /// Estimated transformation + /// + public Mat H { get; } + + /// + /// Confidence two images are from the same panorama + /// + public double Confidence { get; } + + /// + /// Constructor + /// + /// + /// + /// + /// + /// + /// + /// + public MatchesInfo( + int srcImgIdx, + int dstImgIdx, + IReadOnlyList matches, + IReadOnlyList inliersMask, + int numInliers, + Mat h, + double confidence) + { + SrcImgIdx = srcImgIdx; + DstImgIdx = dstImgIdx; + Matches = matches; + InliersMask = inliersMask; + NumInliers = numInliers; + H = h; + Confidence = confidence; + } + + /// + /// Copy constructor + /// + /// + public MatchesInfo(MatchesInfo other) + { + if (other is null) + throw new ArgumentNullException(nameof(other)); + SrcImgIdx = other.SrcImgIdx; + DstImgIdx = other.DstImgIdx; + Matches = other.Matches; + InliersMask = other.InliersMask; + NumInliers = other.NumInliers; + H = other.H; + Confidence = other.Confidence; + } + + /// + /// Dispose H + /// + public void Dispose() + { + H.Dispose(); + } +} diff --git a/src/OpenCvSharp/Modules/stitching/Stitcher.cs b/src/OpenCvSharp/Modules/stitching/Stitcher.cs new file mode 100644 index 000000000..5dc91b8ae --- /dev/null +++ b/src/OpenCvSharp/Modules/stitching/Stitcher.cs @@ -0,0 +1,564 @@ +using OpenCvSharp.Detail; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Util; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp +{ +#pragma warning disable 1591 + // ReSharper disable InconsistentNaming + + // TODO + namespace Detail + { + public enum WaveCorrectKind + { + Horizontal, + Vertical + } + + public class FeaturesFinder; + + public class BundleAdjusterBase; + + public class WarperCreator; + + public class ExposureCompensator; + + public class SeamFinder; + + public class Blender; + + public class CameraParams; + } + + /// + /// High level image stitcher. + /// It's possible to use this class without being aware of the entire stitching + /// pipeline. However, to be able to achieve higher stitching stability and + /// quality of the final images at least being familiar with the theory is recommended + /// + public sealed class Stitcher : DisposableCvObject + { + private Ptr? ptrObj; + + #region Enum + + public const int ORIG_RESOL = -1; + + /// + /// Status code + /// + public enum Status + { + OK = 0, + ErrorNeedMoreImgs = 1, + ErrorHomographyEstFail = 2, + ErrorCameraParamsAdjustFail = 3 + } + + public enum Mode + { + /// + /// Mode for creating photo panoramas. Expects images under perspective + /// transformation and projects resulting pano to sphere. + /// + Panorama = 0, + + /// + /// Mode for composing scans. Expects images under affine transformation does + /// not compensate exposure by default. + /// + Scans = 1, + } + + #endregion + + #region Init & Disposal + + /// + /// Constructor + /// + /// cv::Stitcher* + private Stitcher(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates a Stitcher configured in one of the stitching modes. + /// + /// Scenario for stitcher operation. This is usually determined by source of images + /// to stitch and their transformation.Default parameters will be chosen for operation in given scenario. + public static Stitcher Create(Mode mode = Mode.Panorama) + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_create((int)mode, out var ret)); + return new Stitcher(ret); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + public double RegistrationResol + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_registrationResol(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, value)); + GC.KeepAlive(this); + } + } + + public double SeamEstimationResol + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_seamEstimationResol(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_setSeamEstimationResol(ptr, value)); + GC.KeepAlive(this); + } + } + + public double CompositingResol + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_compositingResol(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_setCompositingResol(ptr, value)); + GC.KeepAlive(this); + } + } + + public double PanoConfidenceThresh + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_panoConfidenceThresh(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_setPanoConfidenceThresh(ptr, value)); + GC.KeepAlive(this); + } + } + + public bool WaveCorrection + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_waveCorrection(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_setWaveCorrection(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + public WaveCorrectKind WaveCorrectKind + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_waveCorrectKind(ptr, out var ret)); + GC.KeepAlive(this); + return (WaveCorrectKind)ret; + } + set + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_setWaveCorrectKind(ptr, (int)value)); + GC.KeepAlive(this); + } + } + + /* + public FeaturesFinder FeaturesFinder + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public FeaturesMatcher FeaturesMatcher + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public Mat MatchingMask + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public BundleAdjusterBase BundleAdjuster + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public WarperCreator Warper + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public ExposureCompensator ExposureCompensator + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public SeamFinder SeamFinder + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + public Blender Blender + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + */ + + // TODO this should be method? + public IReadOnlyList Component + { + get + { + using var componentVec = new VectorOfInt32(); + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_component(ptr, componentVec.CvPtr)); + GC.KeepAlive(this); + return componentVec.ToArray(); + } + } + + //public CameraParams[] Cameras => throw new NotImplementedException(); + + public double WorkScale + { + get + { + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_workScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + } + + #endregion + + #region Methods + + public Status EstimateTransform(InputArray images) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + images.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_estimateTransform_InputArray1( + ptr, images.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + return (Status)ret; + } + + public Status EstimateTransform(InputArray images, Rect[][] rois) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (rois is null) + throw new ArgumentNullException(nameof(rois)); + images.ThrowIfDisposed(); + + using var roisPointer = new ArrayAddress2(rois); + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_estimateTransform_InputArray2( + ptr, images.CvPtr, + roisPointer.GetPointer(), roisPointer.GetDim1Length(), roisPointer.GetDim2Lengths(), + out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + return (Status)ret; + } + + public Status EstimateTransform(IEnumerable images) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + + var imagesPtrs = images.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_estimateTransform_MatArray1( + ptr, imagesPtrs, imagesPtrs.Length, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + return (Status)ret; + } + + public Status EstimateTransform(IEnumerable images, Rect[][] rois) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (rois is null) + throw new ArgumentNullException(nameof(rois)); + + var imagesPtrs = images.Select(x => x.CvPtr).ToArray(); + using var roisPointer = new ArrayAddress2(rois); + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_estimateTransform_MatArray2( + ptr, imagesPtrs, imagesPtrs.Length, + roisPointer.GetPointer(), roisPointer.GetDim1Length(), roisPointer.GetDim2Lengths(), + out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + return (Status)ret; + } + + public Status ComposePanorama(OutputArray pano) + { + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + pano.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_composePanorama1( + ptr, pano.CvPtr, out var ret)); + + pano.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(pano); + return (Status)ret; + } + + public Status ComposePanorama(InputArray images, OutputArray pano) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + images.ThrowIfDisposed(); + pano.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_composePanorama2_InputArray( + ptr, images.CvPtr, pano.CvPtr, out var ret)); + + pano.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(pano); + return (Status)ret; + } + + public Status ComposePanorama(IEnumerable images, OutputArray pano) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + pano.ThrowIfNotReady(); + + var imagesPtrs = images.Select(x => x.CvPtr).ToArray(); + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_composePanorama2_MatArray( + ptr, imagesPtrs, imagesPtrs.Length, pano.CvPtr, out var ret)); + + pano.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(pano); + return (Status)ret; + } + + /// + /// Try to stitch the given images. + /// + /// Input images. + /// Final pano. + /// Status code. + public Status Stitch(InputArray images, OutputArray pano) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + images.ThrowIfDisposed(); + pano.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_stitch1_InputArray( + ptr, images.CvPtr, pano.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(pano); + pano.Fix(); + + return (Status)ret; + } + + /// + /// Try to stitch the given images. + /// + /// Input images. + /// Final pano. + /// Status code. + public Status Stitch(IEnumerable images, OutputArray pano) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + pano.ThrowIfNotReady(); + + var imagesPtrs = images.Select(x => x.CvPtr).ToArray(); + + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_stitch1_MatArray( + ptr, imagesPtrs, imagesPtrs.Length, pano.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(pano); + pano.Fix(); + + return (Status)ret; + } + + /// + /// Try to stitch the given images. + /// + /// Input images. + /// Region of interest rectangles. + /// Final pano. + /// Status code. + public Status Stitch(InputArray images, Rect[][] rois, OutputArray pano) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (rois is null) + throw new ArgumentNullException(nameof(rois)); + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + images.ThrowIfDisposed(); + pano.ThrowIfNotReady(); + + using var roisPointer = new ArrayAddress2(rois); + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_stitch2_InputArray( + ptr, images.CvPtr, + roisPointer.GetPointer(), roisPointer.GetDim1Length(), roisPointer.GetDim2Lengths(), + pano.CvPtr, out var ret)); + + pano.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(pano); + return (Status)ret; + } + + /// + /// Try to stitch the given images. + /// + /// Input images. + /// Region of interest rectangles. + /// Final pano. + /// Status code. + public Status Stitch(IEnumerable images, Rect[][] rois, OutputArray pano) + { + if (images is null) + throw new ArgumentNullException(nameof(images)); + if (rois is null) + throw new ArgumentNullException(nameof(rois)); + if (pano is null) + throw new ArgumentNullException(nameof(pano)); + pano.ThrowIfNotReady(); + + var imagesPtrs = images.Select(x => x.CvPtr).ToArray(); + + using var roisPointer = new ArrayAddress2(rois); + NativeMethods.HandleException( + NativeMethods.stitching_Stitcher_stitch2_MatArray( + ptr, imagesPtrs, imagesPtrs.Length, + roisPointer.GetPointer(), roisPointer.GetDim1Length(), roisPointer.GetDim2Lengths(), + pano.CvPtr, out var ret)); + + pano.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(images); + GC.KeepAlive(pano); + return (Status)ret; + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.stitching_Ptr_Stitcher_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.stitching_Ptr_Stitcher_delete(ptr)); + base.DisposeUnmanaged(); + } + } + } +} diff --git a/src/OpenCvSharp/Modules/superres/BroxOpticalFlow.cs b/src/OpenCvSharp/Modules/superres/BroxOpticalFlow.cs new file mode 100644 index 000000000..104328eb8 --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/BroxOpticalFlow.cs @@ -0,0 +1,213 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// +/// +// ReSharper disable once IdentifierTypo +public class BroxOpticalFlow : DenseOpticalFlowExt +{ + /// + /// + /// + private Ptr? detectorPtr; + + #region Init & Disposal + + /// + /// + /// + // ReSharper disable once IdentifierTypo + private BroxOpticalFlow() + { + detectorPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal static BroxOpticalFlow FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid pointer"); + + var ptrObj = new Ptr(ptr); + var obj = new BroxOpticalFlow + { + detectorPtr = ptrObj, + ptr = ptrObj.Get() + }; + return obj; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// + /// + public double Alpha + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_getAlpha(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_setAlpha(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double Gamma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_getGamma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_setGamma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double ScaleFactor + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_getScaleFactor(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_setScaleFactor(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int InnerIterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_getInnerIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_setInnerIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int OuterIterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_getOuterIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_setOuterIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int SolverIterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_getSolverIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_BroxOpticalFlow_setSolverIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_BroxOpticalFlow_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_BroxOpticalFlow_delete(ptr)); + Dispose(); + } + } +} diff --git a/src/OpenCvSharp/Modules/superres/DenseOpticalFlowExt.cs b/src/OpenCvSharp/Modules/superres/DenseOpticalFlowExt.cs new file mode 100644 index 000000000..30c453459 --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/DenseOpticalFlowExt.cs @@ -0,0 +1,123 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// +/// +public abstract class DenseOpticalFlowExt : Algorithm +{ + #region Init & Disposal + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateFarneback() + { + NativeMethods.HandleException( + NativeMethods.superres_createOptFlow_Farneback(out var ptr)); + return FarnebackOpticalFlow.FromPtr(ptr); + } + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateFarneback_CUDA() + { + NativeMethods.HandleException( + NativeMethods.superres_createOptFlow_Farneback_CUDA(out var ptr)); + return FarnebackOpticalFlow.FromPtr(ptr); + } + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateDualTVL1() + { + NativeMethods.HandleException( + NativeMethods.superres_createOptFlow_DualTVL1(out var ptr)); + return FarnebackOpticalFlow.FromPtr(ptr); + } + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateDualTVL1_CUDA() + { + NativeMethods.HandleException( + NativeMethods.superres_createOptFlow_DualTVL1_CUDA(out var ptr)); + return FarnebackOpticalFlow.FromPtr(ptr); + } + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreateBrox_CUDA() + { + NativeMethods.HandleException( + NativeMethods.superres_createOptFlow_Brox_CUDA(out var ptr)); + return FarnebackOpticalFlow.FromPtr(ptr); + } + + /// + /// + /// + /// + public static DenseOpticalFlowExt CreatePyrLK_CUDA() + { + NativeMethods.HandleException( + NativeMethods.superres_createOptFlow_PyrLK_CUDA(out var ptr)); + return FarnebackOpticalFlow.FromPtr(ptr); + } + + #endregion + + /// + /// Clear all inner buffers. + /// + public virtual void CollectGarbage() + { + NativeMethods.HandleException( + NativeMethods.superres_DenseOpticalFlowExt_collectGarbage(ptr)); + GC.KeepAlive(this); + } + + /// + /// + /// + /// + /// + /// + /// + public virtual void Calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray? flow2 = null) + { + if (frame0 is null) + throw new ArgumentNullException(nameof(frame0)); + if (frame1 is null) + throw new ArgumentNullException(nameof(frame1)); + if (flow1 is null) + throw new ArgumentNullException(nameof(flow1)); + frame0.ThrowIfDisposed(); + frame1.ThrowIfDisposed(); + flow1.ThrowIfNotReady(); + flow2?.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.superres_DenseOpticalFlowExt_calc( + ptr, frame0.CvPtr, frame1.CvPtr, flow1.CvPtr, Cv2.ToPtr(flow2))); + + GC.KeepAlive(this); + GC.KeepAlive(frame0); + GC.KeepAlive(frame1); + GC.KeepAlive(flow1); + GC.KeepAlive(flow2); + flow1.Fix(); + flow2?.Fix(); + } +} diff --git a/src/OpenCvSharp/Modules/superres/DualTVL1OpticalFlow.cs b/src/OpenCvSharp/Modules/superres/DualTVL1OpticalFlow.cs new file mode 100644 index 000000000..70ddcb822 --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/DualTVL1OpticalFlow.cs @@ -0,0 +1,257 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// +/// +public class DualTVL1OpticalFlow : DenseOpticalFlowExt +{ + /// + /// + /// + private Ptr? detectorPtr; + + #region Init & Disposal + + /// + /// + /// + private DualTVL1OpticalFlow() + { + detectorPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal static DualTVL1OpticalFlow FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid pointer"); + + var ptrObj = new Ptr(ptr); + var obj = new DualTVL1OpticalFlow + { + detectorPtr = ptrObj, + ptr = ptrObj.Get() + }; + return obj; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// + /// + public double Tau + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getTau(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setTau(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double Lambda + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getLambda(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setLambda(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double Theta + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getTheta(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setTheta(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int ScalesNumber + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getScalesNumber(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setScalesNumber(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int WarpingsNumber + { + get + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getWarpingsNumber(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setWarpingsNumber(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double Epsilon + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getEpsilon(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setEpsilon(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Iterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + + /// + /// + /// + public bool UseInitialFlow + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_getUseInitialFlow(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_DualTVL1OpticalFlow_setUseInitialFlow(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_DualTVL1OpticalFlow_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_DualTVL1OpticalFlow_delete(ptr)); + Dispose(); + } + } +} diff --git a/src/OpenCvSharp/Modules/superres/FarnebackOpticalFlow.cs b/src/OpenCvSharp/Modules/superres/FarnebackOpticalFlow.cs new file mode 100644 index 000000000..c3f24ba16 --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/FarnebackOpticalFlow.cs @@ -0,0 +1,233 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// +/// +public class FarnebackOpticalFlow : DenseOpticalFlowExt +{ + /// + /// + /// + private Ptr? detectorPtr; + + #region Init & Disposal + + /// + /// + /// + private FarnebackOpticalFlow() + { + detectorPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal static FarnebackOpticalFlow FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid pointer"); + + var ptrObj = new Ptr(ptr); + var obj = new FarnebackOpticalFlow + { + detectorPtr = ptrObj, + ptr = ptrObj.Get() + }; + return obj; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// + /// + public double PyrScale + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getPyrScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setPyrScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int LevelsNumber + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getLevelsNumber(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setLevelsNumber(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int WindowSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getWindowSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setWindowSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Iterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int PolyN + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getPolyN(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setPolyN(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double PolySigma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getPolySigma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setPolySigma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Flags + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_getFlags(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FarnebackOpticalFlow_setFlags(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_FarnebackOpticalFlow_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_FarnebackOpticalFlow_delete(ptr)); + Dispose(); + } + } +} diff --git a/src/OpenCvSharp/Modules/superres/FrameSource.cs b/src/OpenCvSharp/Modules/superres/FrameSource.cs new file mode 100644 index 000000000..5c32f0bb7 --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/FrameSource.cs @@ -0,0 +1,150 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// +/// +public class FrameSource : DisposableCvObject +{ + private Ptr? ptrObj; + + #region Init & Disposal + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + private static FrameSource FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid FrameSource pointer"); + var obj = new FrameSource(); + var ptrObj = new Ptr(ptr); + obj.ptrObj = ptrObj; + obj.ptr = ptr; + return obj; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Empty() + { + NativeMethods.HandleException( + NativeMethods.superres_createFrameSource_Empty(out var ptr)); + return FromPtr(ptr); + } + + /// + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Video(string fileName) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (!File.Exists(fileName)) + throw new FileNotFoundException("", fileName); + + NativeMethods.HandleException( + NativeMethods.superres_createFrameSource_Video(fileName, out var ptr)); + return FromPtr(ptr); + } + + /// + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Video_CUDA(string fileName) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (!File.Exists(fileName)) + throw new FileNotFoundException("", fileName); + + NativeMethods.HandleException( + NativeMethods.superres_createFrameSource_Video_CUDA(fileName, out var ptr)); + return FromPtr(ptr); + } + + /// + /// + /// + /// + /// + public static FrameSource CreateFrameSource_Camera(int deviceId) + { + NativeMethods.HandleException( + NativeMethods.superres_createFrameSource_Camera(deviceId, out var ptr)); + return FromPtr(ptr); + } + + #endregion + + #region Methods + + /// + /// + /// + /// + public virtual void NextFrame(OutputArray frame) + { + ThrowIfDisposed(); + if (frame is null) + throw new ArgumentNullException(nameof(frame)); + frame.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.superres_FrameSource_nextFrame(ptr, frame.CvPtr)); + + frame.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(frame); + } + + /// + /// + /// + public virtual void Reset() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_FrameSource_reset(ptr)); + GC.KeepAlive(this); + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_FrameSource_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_FrameSource_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/superres/PyrLKOpticalFlow.cs b/src/OpenCvSharp/Modules/superres/PyrLKOpticalFlow.cs new file mode 100644 index 000000000..7ecb649cc --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/PyrLKOpticalFlow.cs @@ -0,0 +1,145 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// +/// +public class PyrLKOpticalFlow : DenseOpticalFlowExt +{ + /// + /// + /// + private Ptr? detectorPtr; + + #region Init & Disposal + + /// + /// + /// + private PyrLKOpticalFlow() + { + detectorPtr = null; + ptr = IntPtr.Zero; + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal static PyrLKOpticalFlow FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid pointer"); + + var ptrObj = new Ptr(ptr); + var obj = new PyrLKOpticalFlow + { + detectorPtr = ptrObj, + ptr = ptrObj.Get() + }; + return obj; + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// + /// + public int WindowSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_PyrLKOpticalFlow_getWindowSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_PyrLKOpticalFlow_setWindowSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int MaxLevel + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_PyrLKOpticalFlow_getMaxLevel(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_PyrLKOpticalFlow_setMaxLevel(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int Iterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_PyrLKOpticalFlow_getIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_PyrLKOpticalFlow_setIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_PyrLKOpticalFlow_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_PyrLKOpticalFlow_delete(ptr)); + Dispose(); + } + } +} diff --git a/src/OpenCvSharp/Modules/superres/SuperResolution.cs b/src/OpenCvSharp/Modules/superres/SuperResolution.cs new file mode 100644 index 000000000..cead10bc6 --- /dev/null +++ b/src/OpenCvSharp/Modules/superres/SuperResolution.cs @@ -0,0 +1,392 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Base class for Super Resolution algorithms. +/// +public class SuperResolution : Algorithm +{ + private Ptr? detectorPtr; + + #region Init & Disposal + + /// + /// Constructor + /// + protected SuperResolution() + { + } + + /// + /// Creates instance from cv::Ptr<T> . + /// ptr is disposed when the wrapper disposes. + /// + /// + internal static SuperResolution FromPtr(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Invalid FrameSource pointer"); + + var ptrObj = new Ptr(ptr); + var obj = new SuperResolution + { + detectorPtr = ptrObj, + ptr = ptrObj.Get() + }; + return obj; + } + + /// + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Create Bilateral TV-L1 Super Resolution. + /// + /// + public static SuperResolution CreateBTVL1() + { + NativeMethods.HandleException( + NativeMethods.superres_createSuperResolution_BTVL1(out var ptr)); + return FromPtr(ptr); + } + + /// + /// Create Bilateral TV-L1 Super Resolution. + /// + /// + public static SuperResolution CreateBTVL1_CUDA() + { + NativeMethods.HandleException( + NativeMethods.superres_createSuperResolution_BTVL1_CUDA(out var ptr)); + return FromPtr(ptr); + } + + #endregion + + #region Methods + + /// + /// Set input frame source for Super Resolution algorithm. + /// + /// Input frame source + public virtual void SetInput(FrameSource fs) + { + ThrowIfDisposed(); + if (fs is null) + throw new ArgumentNullException(nameof(fs)); + fs.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setInput(ptr, fs.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(fs); + } + + /// + /// Process next frame from input and return output result. + /// + /// Output result + public virtual void NextFrame(OutputArray frame) + { + ThrowIfDisposed(); + if (frame is null) + throw new ArgumentNullException(nameof(frame)); + frame.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_nextFrame(ptr, frame.CvPtr)); + frame.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(frame); + } + + /// + /// + public virtual void Reset() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_reset(ptr)); + GC.KeepAlive(this); + } + + /// + /// Clear all inner buffers. + /// + public virtual void CollectGarbage() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_collectGarbage(ptr)); + GC.KeepAlive(this); + } + + /// + /// + /// + protected virtual void InitImpl(FrameSource fs) + { + } + + /// + /// + /// + /// + protected virtual void ProcessImpl(FrameSource fs, OutputArray output) + { + } + + #endregion + + #region Properties + + /// + /// Scale factor + /// + public int Scale + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getScale(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setScale(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Iterations count + /// + public int Iterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Asymptotic value of steepest descent method + /// + public double Tau + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getTau(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setTau(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Weight parameter to balance data term and smoothness term + /// + public double Lambda + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getLambda(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setLambda(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Parameter of spacial distribution in Bilateral-TV + /// + public double Alpha + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getAlpha(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setAlpha(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Kernel size of Bilateral-TV filter + /// + public int KernelSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getKernelSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setKernelSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gaussian blur kernel size + /// + public int BlurKernelSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getBlurKernelSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setBlurKernelSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gaussian blur sigma + /// + public double BlurSigma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getBlurSigma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setBlurSigma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Radius of the temporal search area + /// + public int TemporalAreaRadius + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_getTemporalAreaRadius(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.superres_SuperResolution_setTemporalAreaRadius(ptr, value)); + GC.KeepAlive(this); + } + } + + // TODO + /* + /// + /// Dense optical flow algorithm + /// + public DenseOpticalFlowExt OpticalFlow + { + get + { + ThrowIfDisposed(); + var res = NativeMethods.superres_SuperResolution_getOpticalFlow(ptr); + GC.KeepAlive(this); + } + set + { + ThrowIfDisposed(); + NativeMethods.superres_SuperResolution_setOpticalFlow(ptr, value); + GC.KeepAlive(this); + } + } + */ + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_SuperResolution_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.superres_Ptr_SuperResolution_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/text/BaseOCR.cs b/src/OpenCvSharp/Modules/text/BaseOCR.cs new file mode 100644 index 000000000..f01ffee1e --- /dev/null +++ b/src/OpenCvSharp/Modules/text/BaseOCR.cs @@ -0,0 +1,44 @@ +namespace OpenCvSharp.Text; + +/// +/// base class BaseOCR declares a common API that would be used in a typical text recognition scenario +/// +// ReSharper disable once InconsistentNaming +public abstract class BaseOCR : DisposableCvObject +{ + /// + /// + /// + /// + /// + /// + /// + /// + /// + public abstract void Run( + Mat image, + out string outputText, + out Rect[] componentRects, + out string?[] componentTexts, + out float[] componentConfidences, + ComponentLevels componentLevel = ComponentLevels.Word); + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public abstract void Run( + Mat image, + Mat mask, + out string outputText, + out Rect[] componentRects, + out string?[] componentTexts, + out float[] componentConfidences, + ComponentLevels componentLevel = ComponentLevels.Word); +} diff --git a/src/OpenCvSharp/Modules/text/ComponentLevels.cs b/src/OpenCvSharp/Modules/text/ComponentLevels.cs new file mode 100644 index 000000000..4ba353d58 --- /dev/null +++ b/src/OpenCvSharp/Modules/text/ComponentLevels.cs @@ -0,0 +1,17 @@ +namespace OpenCvSharp.Text; + +/// +/// +/// +public enum ComponentLevels +{ + /// + /// + /// + Word, + + /// + /// + /// + TextLine +} diff --git a/src/OpenCvSharp/Modules/text/CvText.cs b/src/OpenCvSharp/Modules/text/CvText.cs new file mode 100644 index 000000000..5ad1c0509 --- /dev/null +++ b/src/OpenCvSharp/Modules/text/CvText.cs @@ -0,0 +1,50 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.Text; + +/// +/// cv::text functions +/// +public static class CvText +{ + /// + /// Applies the Stroke Width Transform operator followed by filtering of connected components of similar Stroke Widths to + /// return letter candidates. It also chain them by proximity and size, saving the result in chainBBs. + /// + /// input the input image with 3 channels. + /// a boolean value signifying whether the text is darker or lighter than the background, + /// it is observed to reverse the gradient obtained from Scharr operator, and significantly affect the result. + /// an optional Mat of type CV_8UC3 which visualises the detected letters using bounding boxes. + /// an optional parameter which chains the letter candidates according to heuristics in the + /// paper and returns all possible regions where text is likely to occur. + /// a vector of resulting bounding boxes where probability of finding text is high + public static Rect[] DetectTextSWT( + InputArray input, bool darkOnLight, OutputArray? draw = null, OutputArray? chainBBs = null) + { + if (input is null) + throw new ArgumentNullException(nameof(input)); + input.ThrowIfDisposed(); + draw?.ThrowIfNotReady(); + chainBBs?.ThrowIfNotReady(); + + using var result = new VectorOfRect(); + NativeMethods.HandleException( + NativeMethods.text_detectTextSWT( + input.CvPtr, + result.CvPtr, + darkOnLight ? 1 : 0, + draw?.CvPtr ?? IntPtr.Zero, + chainBBs?.CvPtr ?? IntPtr.Zero)); + + GC.KeepAlive(input); + draw?.Fix(); + chainBBs?.Fix(); + + return result.ToArray(); + } +} diff --git a/src/OpenCvSharp/Modules/text/OCRTesseract.cs b/src/OpenCvSharp/Modules/text/OCRTesseract.cs new file mode 100644 index 000000000..d4782fac0 --- /dev/null +++ b/src/OpenCvSharp/Modules/text/OCRTesseract.cs @@ -0,0 +1,209 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp.Text; + +// ReSharper disable InconsistentNaming +/// +/// Recognize text using the tesseract-ocr API. +/// +/// Takes image on input and returns recognized text in the output_text parameter. +/// Optionallyprovides also the Rects for individual text elements found(e.g.words), +/// and the list of those text elements with their confidence values. +/// +public sealed class OCRTesseract : BaseOCR +{ + private Ptr? ptrObj; + + #region Init & Disposal + + /// + /// Constructor + /// + /// + private OCRTesseract(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates an instance of the OCRTesseract class. Initializes Tesseract. + /// + /// datapath the name of the parent directory of tessdata ended with "/", or null to use the system's default directory. + /// an ISO 639-3 code or NULL will default to "eng". + /// specifies the list of characters used for recognition. + /// null defaults to "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ". + /// tesseract-ocr offers different OCR Engine Modes (OEM), + /// by deffault tesseract::OEM_DEFAULT is used.See the tesseract-ocr API documentation for other possible values. + /// tesseract-ocr offers different Page Segmentation Modes (PSM) tesseract::PSM_AUTO (fully automatic layout analysis) is used. + /// See the tesseract-ocr API documentation for other possible values. + public static OCRTesseract Create( + string? datapath = null, + string? language = null, + string? charWhitelist = null, + int oem = 3, + int psmode = 3) + { + NativeMethods.HandleException( + NativeMethods.text_OCRTesseract_create(datapath, language, charWhitelist, oem, psmode, out var p)); + return new OCRTesseract(p); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + #endregion + + #region Methods + + /// + /// Recognize text using the tesseract-ocr API. + /// Takes image on input and returns recognized text in the output_text parameter. + /// Optionally provides also the Rects for individual text elements found(e.g.words), + /// and the list of those text elements with their confidence values. + /// + /// Input image CV_8UC1 or CV_8UC3 + /// Output text of the tesseract-ocr. + /// If provided the method will output a list of Rects for the individual + /// text elements found(e.g.words or text lines). + /// If provided the method will output a list of text strings for the + /// recognition of individual text elements found(e.g.words or text lines). + /// If provided the method will output a list of confidence values + /// for the recognition of individual text elements found(e.g.words or text lines). + /// OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXT_LINE. + public override void Run( + Mat image, + out string outputText, + out Rect[] componentRects, + out string?[] componentTexts, + out float[] componentConfidences, + ComponentLevels componentLevel = ComponentLevels.Word) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using var outputTextString = new StdString(); + using var componentRectsVector = new VectorOfRect(); + using var componentTextsVector = new VectorOfString(); + using var componentConfidencesVector = new VectorOfFloat(); + NativeMethods.HandleException( + NativeMethods.text_OCRTesseract_run1( + ptr, + image.CvPtr, + outputTextString.CvPtr, + componentRectsVector.CvPtr, + componentTextsVector.CvPtr, + componentConfidencesVector.CvPtr, + (int) componentLevel)); + outputText = outputTextString.ToString(); + componentRects = componentRectsVector.ToArray(); + componentTexts = componentTextsVector.ToArray(); + componentConfidences = componentConfidencesVector.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(image); + } + + /// + /// Recognize text using the tesseract-ocr API. + /// Takes image on input and returns recognized text in the output_text parameter. + /// Optionally provides also the Rects for individual text elements found(e.g.words), + /// and the list of those text elements with their confidence values. + /// + /// Input image CV_8UC1 or CV_8UC3 + /// + /// Output text of the tesseract-ocr. + /// If provided the method will output a list of Rects for the individual + /// text elements found(e.g.words or text lines). + /// If provided the method will output a list of text strings for the + /// recognition of individual text elements found(e.g.words or text lines). + /// If provided the method will output a list of confidence values + /// for the recognition of individual text elements found(e.g.words or text lines). + /// OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXT_LINE. + public override void Run( + Mat image, + Mat mask, + out string outputText, + out Rect[] componentRects, + out string?[] componentTexts, + out float[] componentConfidences, + ComponentLevels componentLevel = ComponentLevels.Word) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + image.ThrowIfDisposed(); + mask.ThrowIfDisposed(); + + using var outputTextString = new StdString(); + using var componentRectsVector = new VectorOfRect(); + using var componentTextsVector = new VectorOfString(); + using var componentConfidencesVector = new VectorOfFloat(); + NativeMethods.HandleException( + NativeMethods.text_OCRTesseract_run2( + ptr, + image.CvPtr, + mask.CvPtr, + outputTextString.CvPtr, + componentRectsVector.CvPtr, + componentTextsVector.CvPtr, + componentConfidencesVector.CvPtr, + (int) componentLevel)); + outputText = outputTextString.ToString(); + componentRects = componentRectsVector.ToArray(); + componentTexts = componentTextsVector.ToArray(); + componentConfidences = componentConfidencesVector.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(image); + } + + /// + /// + /// + /// + public void SetWhiteList(string charWhitelist) + { + if (charWhitelist is null) + throw new ArgumentNullException(nameof(charWhitelist)); + + NativeMethods.HandleException( + NativeMethods.text_OCRTesseract_setWhiteList(ptr, charWhitelist)); + + GC.KeepAlive(this); + } + + #endregion + + internal class Ptr : OpenCvSharp.Ptr + { + public Ptr(IntPtr ptr) : base(ptr) + { + } + + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.text_OCRTesseract_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.text_Ptr_OCRTesseract_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/text/TextDetector.cs b/src/OpenCvSharp/Modules/text/TextDetector.cs new file mode 100644 index 000000000..3c9cb298e --- /dev/null +++ b/src/OpenCvSharp/Modules/text/TextDetector.cs @@ -0,0 +1,35 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// An abstract class providing interface for text detection algorithms +/// +public abstract class TextDetector : DisposableCvObject +{ + /// + /// Method that provides a quick and simple interface to detect text inside an image + /// + /// an image to process + /// a vector of Rect that will store the detected word bounding box + /// a vector of float that will be updated with the confidence the classifier has for the selected bounding box + public virtual void Detect(InputArray inputImage, out Rect[] bbox, out float[] confidence) + { + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + inputImage.ThrowIfDisposed(); + + using (var bboxVec = new VectorOfRect()) + using (var confidenceVec = new VectorOfFloat()) + { + NativeMethods.HandleException( + NativeMethods.text_TextDetector_detect(ptr, inputImage.CvPtr, bboxVec.CvPtr, confidenceVec.CvPtr)); + bbox = bboxVec.ToArray(); + confidence = confidenceVec.ToArray(); + } + + GC.KeepAlive(this); + GC.KeepAlive(inputImage); + } +} diff --git a/src/OpenCvSharp/Modules/text/TextDetectorCNN.cs b/src/OpenCvSharp/Modules/text/TextDetectorCNN.cs new file mode 100644 index 000000000..d48ee3e45 --- /dev/null +++ b/src/OpenCvSharp/Modules/text/TextDetectorCNN.cs @@ -0,0 +1,123 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// TextDetectorCNN class provides the functionality of text bounding box detection. +/// +/// +/// This class is representing to find bounding boxes of text words given an input image. +/// This class uses OpenCV dnn module to load pre-trained model described in @cite LiaoSBWL17. +/// The original repository with the modified SSD Caffe version: https://github.com/MhLiao/TextBoxes. +/// Model can be downloaded from[DropBox](https://www.dropbox.com/s/g8pjzv2de9gty8g/TextBoxes_icdar13.caffemodel?dl=0). +/// Modified.prototxt file with the model description can be found in `opencv_contrib/modules/text/samples/textbox.prototxt`. +/// +public class TextDetectorCNN : TextDetector +{ + /// + /// cv::Ptr<T> + /// + private Ptr? objectPtr; + + /// + /// Creates an instance of the TextDetectorCNN class using the provided parameters. + /// + /// the relative or absolute path to the prototxt file describing the classifiers architecture. + /// the relative or absolute path to the file containing the pretrained weights of the model in caffe-binary form. + /// a list of sizes for multiscale detection. The values`[(300,300),(700,500),(700,300),(700,700),(1600,1600)]` + /// are recommended in @cite LiaoSBWL17 to achieve the best quality. + /// + public static TextDetectorCNN Create( + string modelArchFilename, string modelWeightsFilename, IEnumerable detectionSizes) + { + if (string.IsNullOrEmpty(modelArchFilename)) + throw new ArgumentException("empty string", nameof(detectionSizes)); + if (string.IsNullOrEmpty(modelWeightsFilename)) + throw new ArgumentException("empty string", nameof(modelWeightsFilename)); + if (detectionSizes is null) + throw new ArgumentNullException(nameof(detectionSizes)); + + var detectionSizesArray = detectionSizes.ToArray(); + NativeMethods.HandleException( + NativeMethods.text_TextDetectorCNN_create1( + modelArchFilename, modelWeightsFilename, detectionSizesArray, detectionSizesArray.Length, + out var ptr)); + GC.KeepAlive(detectionSizes); + return new TextDetectorCNN(ptr); + } + + /// + /// Creates an instance of the TextDetectorCNN class using the provided parameters. + /// + /// the relative or absolute path to the prototxt file describing the classifiers architecture. + /// the relative or absolute path to the file containing the pretrained weights of the model in caffe-binary form. + /// + public static TextDetectorCNN Create( + string modelArchFilename, string modelWeightsFilename) + { + NativeMethods.HandleException( + NativeMethods.text_TextDetectorCNN_create2( + modelArchFilename, modelWeightsFilename, out var ptr)); + return new TextDetectorCNN(ptr); + } + + internal TextDetectorCNN(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + base.DisposeManaged(); + } + + /// + /// Method that provides a quick and simple interface to detect text inside an image + /// + /// an image to process + /// a vector of Rect that will store the detected word bounding box + /// a vector of float that will be updated with the confidence the classifier has for the selected bounding box + public override void Detect(InputArray inputImage, out Rect[] bbox, out float[] confidence) + { + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + inputImage.ThrowIfDisposed(); + + using var bboxVec = new VectorOfRect(); + using var confidenceVec = new VectorOfFloat(); + NativeMethods.HandleException( + NativeMethods.text_TextDetectorCNN_detect( + ptr, inputImage.CvPtr, bboxVec.CvPtr, confidenceVec.CvPtr)); + bbox = bboxVec.ToArray(); + confidence = confidenceVec.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(inputImage); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.text_Ptr_TextDetectorCNN_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.text_Ptr_TextDetectorCNN_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/tracking/Enum/TrackerTypes.cs b/src/OpenCvSharp/Modules/tracking/Enum/TrackerTypes.cs new file mode 100644 index 000000000..234120fc6 --- /dev/null +++ b/src/OpenCvSharp/Modules/tracking/Enum/TrackerTypes.cs @@ -0,0 +1,12 @@ +namespace OpenCvSharp.Tracking; +// ReSharper disable InconsistentNaming +#pragma warning disable 1591 +public enum TrackerTypes +{ + Boosting, + GOTURN, + TLD, + KCF, + MedianFlow, + MIL, +} diff --git a/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs b/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs new file mode 100644 index 000000000..82662f564 --- /dev/null +++ b/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs @@ -0,0 +1,133 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Tracking; + +// ReSharper disable CommentTypo +// ReSharper disable IdentifierTypo +/// +/// +/// the CSRT tracker +/// The implementation is based on @cite Lukezic_IJCV2018 Discriminative Correlation Filter with Channel and Spatial Reliability +/// +// ReSharper disable once InconsistentNaming +public class TrackerCSRT : Tracker +{ + /// + /// + /// + protected TrackerCSRT(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Constructor + /// + /// + public static TrackerCSRT Create() + { + NativeMethods.HandleException( + NativeMethods.tracking_TrackerCSRT_create1(out var p)); + return new TrackerCSRT(p); + } + + /// + /// Constructor + /// + /// CSRT parameters + /// + public static TrackerCSRT Create(Params parameters) + { + NativeMethods.HandleException( + NativeMethods.tracking_TrackerCSRT_create2(ref parameters, out var p)); + return new TrackerCSRT(p); + } + + /// + /// + /// + /// + public virtual void SetInitialMask(InputArray mask) + { + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + mask.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.tracking_TrackerCSRT_setInitialMask(ptr, mask.CvPtr)); + + GC.KeepAlive(mask); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.tracking_Ptr_TrackerCSRT_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.tracking_Ptr_TrackerCSRT_delete(ptr)); + base.DisposeUnmanaged(); + } + } + +#pragma warning disable CA1034 + /// + /// CSRT Params + /// + [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] + public struct Params + { +#pragma warning disable 1591 + public int UseHog; + public int UseColorNames; + public int UseGray; + public int UseRgb; + public int UseChannelWeights; + public int UseSegmentation; + + /// + /// Window function: "hann", "cheb", "kaiser" + /// + [MarshalAs(UnmanagedType.LPStr)] + public string WindowFunction; + + public float KaiserAlpha; + public float ChebAttenuation; + + public float TemplateSize; + public float GslSigma; + public float HogOrientations; + public float HogClip; + public float Padding; + public float FilterLr; + public float WeightsLr; + public int NumHogChannelsUsed; + public int AdmmIterations; + public int HistogramBins; + public float HistogramLr; + public int BackgroundRatio; + public int NumberOfScales; + public float ScaleSigmaFactor; + public float ScaleModelMaxArea; + public float ScaleLr; + public float ScaleStep; + + /// + /// we lost the target, if the psr is lower than this. + /// + public float PsrThreshold; +#pragma warning restore 1591 + + } +} diff --git a/src/OpenCvSharp/Modules/tracking/TrackerKCF.cs b/src/OpenCvSharp/Modules/tracking/TrackerKCF.cs new file mode 100644 index 000000000..78a5fc578 --- /dev/null +++ b/src/OpenCvSharp/Modules/tracking/TrackerKCF.cs @@ -0,0 +1,148 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp.Tracking; + +/// +/// +/// KCF is a novel tracking framework that utilizes properties of circulant matrix to enhance the processing speed. +/// * This tracking method is an implementation of @cite KCF_ECCV which is extended to KFC with color-names features(@cite KCF_CN). +/// * The original paper of KCF is available at [http://www.robots.ox.ac.uk/~joao/publications/henriques_tpami2015.pdf] +/// * as well as the matlab implementation.For more information about KCF with color-names features, please refer to +/// * [http://www.cvl.isy.liu.se/research/objrec/visualtracking/colvistrack/index.html]. +/// +// ReSharper disable once InconsistentNaming +public class TrackerKCF : Tracker +{ + /// + /// + /// + protected TrackerKCF(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Constructor + /// + /// + public static TrackerKCF Create() + { + NativeMethods.HandleException( + NativeMethods.tracking_TrackerKCF_create1(out var p)); + return new TrackerKCF(p); + } + + /// + /// Constructor + /// + /// KCF parameters TrackerKCF::Params + /// + public static TrackerKCF Create(Params parameters) + { + NativeMethods.HandleException( + NativeMethods.tracking_TrackerKCF_create2(parameters, out var p)); + return new TrackerKCF(p); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.tracking_Ptr_TrackerKCF_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.tracking_Ptr_TrackerKCF_delete(ptr)); + base.DisposeUnmanaged(); + } + } + +#pragma warning disable CA1034 +#pragma warning disable CA1051 + /// + /// + [StructLayout(LayoutKind.Sequential)] + public class Params + { + /// + /// detection confidence threshold + /// + public float DetectThresh; + + /// + /// gaussian kernel bandwidth + /// + public float Sigma; + + /// + /// regularization + /// + public float Lambda; + + /// + /// linear interpolation factor for adaptation + /// + public float InterpFactor; + + /// + /// spatial bandwidth (proportional to target) + /// + public float OutputSigmaFactor; + + /// + /// compression learning rate + /// + public float PcaLearningRate; + + /// + /// activate the resize feature to improve the processing speed + /// + [MarshalAs(UnmanagedType.U1)] + public bool Resize; + + /// + /// split the training coefficients into two matrices + /// + [MarshalAs(UnmanagedType.U1)] + public bool SplitCoeff; + + /// + /// wrap around the kernel values + /// + [MarshalAs(UnmanagedType.U1)] + public bool WrapKernel; + + /// + /// activate the pca method to compress the features + /// + [MarshalAs(UnmanagedType.U1)] + public bool CompressFeature; + + /// + /// threshold for the ROI size + /// + public int MaxPatchSize; + + /// + /// feature size after compression + /// + public int CompressedSize; + + /// + /// compressed descriptors of TrackerKCF::MODE + /// + public int DescPca; + + /// + /// non-compressed descriptors of TrackerKCF::MODE + /// + public int DescNpca; + } +#pragma warning restore CA1051 +} diff --git a/src/OpenCvSharp/Modules/video/BackgroundSubtractor.cs b/src/OpenCvSharp/Modules/video/BackgroundSubtractor.cs new file mode 100644 index 000000000..efe2f5702 --- /dev/null +++ b/src/OpenCvSharp/Modules/video/BackgroundSubtractor.cs @@ -0,0 +1,52 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// The Base Class for Background/Foreground Segmentation. +/// The class is only used to define the common interface for +/// the whole family of background/foreground segmentation algorithms. +/// +public abstract class BackgroundSubtractor : Algorithm +{ + /// + /// the update operator that takes the next video frame and returns the current foreground mask as 8-bit binary image. + /// + /// + /// + /// + public virtual void Apply(InputArray image, OutputArray fgmask, double learningRate = -1) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (fgmask is null) + throw new ArgumentNullException(nameof(fgmask)); + image.ThrowIfDisposed(); + fgmask.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractor_apply(ptr, image.CvPtr, fgmask.CvPtr, learningRate)); + + fgmask.Fix(); + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(fgmask); + } + + /// + /// computes a background image + /// + /// + public virtual void GetBackgroundImage(OutputArray backgroundImage) + { + if (backgroundImage is null) + throw new ArgumentNullException(nameof(backgroundImage)); + backgroundImage.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractor_getBackgroundImage(ptr, backgroundImage.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(backgroundImage); + backgroundImage.Fix(); + } +} diff --git a/src/OpenCvSharp/Modules/video/BackgroundSubtractorKNN.cs b/src/OpenCvSharp/Modules/video/BackgroundSubtractorKNN.cs new file mode 100644 index 000000000..28ae953ac --- /dev/null +++ b/src/OpenCvSharp/Modules/video/BackgroundSubtractorKNN.cs @@ -0,0 +1,267 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// K nearest neigbours algorithm +/// +public class BackgroundSubtractorKNN : BackgroundSubtractor +{ + /// + /// cv::Ptr<T> + /// + private Ptr? objectPtr; + + #region Init & Disposal + + /// + /// Creates KNN Background Subtractor + /// + /// Length of the history. + /// Threshold on the squared distance between the pixel and the sample to decide + /// whether a pixel is close to that sample. This parameter does not affect the background update. + /// If true, the algorithm will detect shadows and mark them. It decreases the + /// speed a bit, so if you do not need this feature, set the parameter to false. + /// + public static BackgroundSubtractorKNN Create( + int history = 500, double dist2Threshold = 400.0, bool detectShadows = true) + { + NativeMethods.HandleException( + NativeMethods.video_createBackgroundSubtractorKNN( + history, dist2Threshold, detectShadows ? 1 : 0, out var ptr)); + return new BackgroundSubtractorKNN(ptr); + } + + internal BackgroundSubtractorKNN(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Gets or sets the number of last frames that affect the background model. + /// + public int History + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getHistory(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setHistory(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the number of data samples in the background model + /// + public int NSamples + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getNSamples(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setNSamples(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the threshold on the squared distance between the pixel and the sample. + /// The threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to a data sample. + /// + public double Dist2Threshold + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getDist2Threshold(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setDist2Threshold(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Returns the number of neighbours, the k in the kNN. + /// K is the number of samples that need to be within dist2Threshold in order to decide that that + /// pixel is matching the kNN background model. + /// + public int KNNSamples + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getkNNSamples(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setkNNSamples(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Returns the shadow detection flag. + /// If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details. + /// + public bool DetectShadows + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getDetectShadows(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setDetectShadows(objectPtr.CvPtr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the shadow value. + /// Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. + /// Value 0 in the mask always means background, 255 means foreground. + /// + public int ShadowValue + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getShadowValue(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setShadowValue(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the shadow threshold. + /// A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in + /// the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel + /// is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, + /// *Detecting Moving Shadows...*, IEEE PAMI,2003. + /// + public double ShadowThreshold + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_getShadowThreshold(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorKNN_setShadowThreshold(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_BackgroundSubtractorKNN_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_BackgroundSubtractorKNN_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/video/BackgroundSubtractorMog2.cs b/src/OpenCvSharp/Modules/video/BackgroundSubtractorMog2.cs new file mode 100644 index 000000000..7d2c0ea65 --- /dev/null +++ b/src/OpenCvSharp/Modules/video/BackgroundSubtractorMog2.cs @@ -0,0 +1,408 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// The Base Class for Background/Foreground Segmentation. +/// The class is only used to define the common interface for +/// the whole family of background/foreground segmentation algorithms. +/// +public class BackgroundSubtractorMOG2 : BackgroundSubtractor +{ + /// + /// cv::Ptr<T> + /// + private Ptr? objectPtr; + + #region Init & Disposal + + /// + /// Creates MOG2 Background Subtractor. + /// + /// Length of the history. + /// Threshold on the squared Mahalanobis distance between the pixel and the model + /// to decide whether a pixel is well described by the background model. This parameter does not affect the background update. + /// If true, the algorithm will detect shadows and mark them. It decreases the speed a bit, + /// so if you do not need this feature, set the parameter to false. + /// + public static BackgroundSubtractorMOG2 Create( + int history = 500, double varThreshold = 16, bool detectShadows = true) + { + NativeMethods.HandleException( + NativeMethods.video_createBackgroundSubtractorMOG2( + history, varThreshold, detectShadows ? 1 : 0, out var ptr)); + return new BackgroundSubtractorMOG2(ptr); + } + + internal BackgroundSubtractorMOG2(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + ptr = IntPtr.Zero; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Gets or sets the number of last frames that affect the background model. + /// + public int History + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getHistory(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setHistory(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the number of gaussian components in the background model. + /// + public int NMixtures + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getNMixtures(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setNMixtures(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the "background ratio" parameter of the algorithm. + /// If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's + /// considered background and added to the model as a center of a new component. It corresponds to TB + /// parameter in the paper. + /// + public double BackgroundRatio + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getBackgroundRatio(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setBackgroundRatio(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the variance threshold for the pixel-model match. + /// The main threshold on the squared Mahalanobis distance to decide if the sample is well described by + /// the background model or not. Related to Cthr from the paper. + /// + public double VarThreshold + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getVarThreshold(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setVarThreshold(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the variance threshold for the pixel-model match used for new mixture component generation. + /// Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the + /// existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it + /// is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg + /// value generates more components. A higher Tg value may result in a small number of components but they can grow too large. + /// + public double VarThresholdGen + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getVarThresholdGen(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setVarThresholdGen(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the initial variance of each gaussian component. + /// + public double VarInit + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getVarInit(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setVarInit(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double VarMin + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getVarMin(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setVarMin(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double VarMax + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getVarMax(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setVarMax(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the complexity reduction threshold. + /// This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05 + /// is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the standard Stauffer&Grimson algorithm. + /// + public double ComplexityReductionThreshold + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getComplexityReductionThreshold(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setComplexityReductionThreshold(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the shadow detection flag. + /// If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details. + /// + public bool DetectShadows + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getDetectShadows(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setDetectShadows(objectPtr.CvPtr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the shadow value. + /// Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. + /// Value 0 in the mask always means background, 255 means foreground. + /// + public int ShadowValue + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getShadowValue(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setShadowValue(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the shadow threshold. + /// A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in + /// the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel + /// is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, + /// *Detecting Moving Shadows...*, IEEE PAMI,2003. + /// + public double ShadowThreshold + { + get + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_getShadowThreshold(objectPtr.CvPtr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + if (objectPtr is null) + throw new NotSupportedException("objectPtr is null"); + NativeMethods.HandleException( + NativeMethods.video_BackgroundSubtractorMOG2_setShadowThreshold(objectPtr.CvPtr, value)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_BackgroundSubtractorMOG2_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_BackgroundSubtractorMOG2_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/video/Enum/MotionTypes.cs b/src/OpenCvSharp/Modules/video/Enum/MotionTypes.cs new file mode 100644 index 000000000..16d350581 --- /dev/null +++ b/src/OpenCvSharp/Modules/video/Enum/MotionTypes.cs @@ -0,0 +1,28 @@ +namespace OpenCvSharp; + +/// +/// [findTransformECC] specifying the type of motion +/// +public enum MotionTypes +{ + /// + /// sets a translational motion model; warpMatrix is \f$2\times 3\f$ with + /// the first \f$2\times 2\f$ part being the unity matrix and the rest two parameters being estimated. + /// + Translation = 0, + + /// + /// sets a Euclidean (rigid) transformation as motion model; three parameters are estimated; warpMatrix is \f$2\times 3\f$. + /// + Euclidean = 1, + + /// + /// sets an affine motion model (DEFAULT); six parameters are estimated; warpMatrix is \f$2\times 3\f$. + /// + Affine = 2, + + /// + /// sets a homography as a motion model; eight parameters are estimated;\`warpMatrix\` is \f$3\times 3\f$. + /// + Homography = 3 +} diff --git a/src/OpenCvSharp/Modules/video/Enum/OpticalFlowFlags.cs b/src/OpenCvSharp/Modules/video/Enum/OpticalFlowFlags.cs new file mode 100644 index 000000000..2898b320d --- /dev/null +++ b/src/OpenCvSharp/Modules/video/Enum/OpticalFlowFlags.cs @@ -0,0 +1,38 @@ +namespace OpenCvSharp; + +/// +/// cv::calcOpticalFlowPyrLK flags +/// +[Flags] +public enum OpticalFlowFlags +{ + /// + /// + /// + None = 0, + + /// + /// + /// + PyrAReady = 1, + + /// + /// + /// + PyrBReady = 2, + + /// + /// + /// + UseInitialFlow = 4, + + /// + /// + /// + LkGetMinEigenvals = 8, + + /// + /// + /// + FarnebackGaussian = 256, +} diff --git a/src/OpenCvSharp/Modules/video/KalmanFilter.cs b/src/OpenCvSharp/Modules/video/KalmanFilter.cs new file mode 100644 index 000000000..f22fd9315 --- /dev/null +++ b/src/OpenCvSharp/Modules/video/KalmanFilter.cs @@ -0,0 +1,348 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Kalman filter. +/// The class implements standard Kalman filter \url{http://en.wikipedia.org/wiki/Kalman_filter}. +/// However, you can modify KalmanFilter::transitionMatrix, KalmanFilter::controlMatrix and +/// KalmanFilter::measurementMatrix to get the extended Kalman filter functionality. +/// +public class KalmanFilter : DisposableCvObject +{ + #region Init & Disposal + + /// + /// the default constructor + /// + public KalmanFilter() + { + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_new1(out ptr)); + } + + /// + /// the full constructor taking the dimensionality of the state, of the measurement and of the control vector + /// + /// + /// + /// + /// + public KalmanFilter(int dynamParams, int measureParams, int controlParams = 0, int type = MatType.CV_32F) + { + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_new2( + dynamParams, measureParams, controlParams, type, out ptr)); + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Properties + + /// + /// predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k) + /// + public Mat StatePre + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_statePre(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = StatePre; + value.CopyTo(get); + } + } + + /// + /// corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) + /// + public Mat StatePost + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_statePost(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = StatePost; + value.CopyTo(get); + } + } + + /// + /// state transition matrix (A) + /// + public Mat TransitionMatrix + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_transitionMatrix(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = TransitionMatrix; + value.CopyTo(get); + } + } + + /// + /// control matrix (B) (not used if there is no control) + /// + public Mat ControlMatrix + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_controlMatrix(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = ControlMatrix; + value.CopyTo(get); + } + } + + /// + /// measurement matrix (H) + /// + public Mat MeasurementMatrix + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_measurementMatrix(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = MeasurementMatrix; + value.CopyTo(get); + } + } + + /// + /// process noise covariance matrix (Q) + /// + public Mat ProcessNoiseCov + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_processNoiseCov(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = ProcessNoiseCov; + value.CopyTo(get); + } + } + + /// + /// measurement noise covariance matrix (R) + /// + public Mat MeasurementNoiseCov + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_measurementNoiseCov(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = MeasurementNoiseCov; + value.CopyTo(get); + } + } + + /// + /// priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/ + /// + public Mat ErrorCovPre + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_errorCovPre(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = ErrorCovPre; + value.CopyTo(get); + } + } + + /// + /// Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R) + /// + public Mat Gain + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_gain(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = Gain; + value.CopyTo(get); + } + } + + /// + /// posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k) + /// + public Mat ErrorCovPost + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_errorCovPost(ptr, out var ret)); + GC.KeepAlive(this); + return new Mat(ret) { IsEnabledDispose = false }; + } + set + { + if (value is null) + throw new ArgumentNullException(nameof(value)); + value.ThrowIfDisposed(); + + using var get = ErrorCovPost; + value.CopyTo(get); + } + } + + #endregion + + #region Methods + + /// + /// re-initializes Kalman filter. The previous content is destroyed. + /// + /// + /// + /// + /// + public void Init(int dynamParams, int measureParams, int controlParams = 0, int type = MatType.CV_32F) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_init( + ptr, dynamParams, measureParams, controlParams, type)); + GC.KeepAlive(this); + } + + /// + /// computes predicted state + /// + /// + /// + public Mat Predict(Mat? control = null) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_predict(ptr, Cv2.ToPtr(control), out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(control); + return new Mat(ret); + } + + /// + /// updates the predicted state from the measurement + /// + /// + /// + public Mat Correct(Mat measurement) + { + ThrowIfDisposed(); + if (measurement is null) + throw new ArgumentNullException(nameof(measurement)); + measurement.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.video_KalmanFilter_correct(ptr, measurement.CvPtr, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(measurement); + return new Mat(ret); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/video/Tracker.cs b/src/OpenCvSharp/Modules/video/Tracker.cs new file mode 100644 index 000000000..5bfac175d --- /dev/null +++ b/src/OpenCvSharp/Modules/video/Tracker.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Base abstract class for the long-term tracker +/// +public abstract class Tracker : Algorithm +{ + internal Ptr? PtrObj { get; private set; } + + /// + /// + /// + /// + protected Tracker(Ptr ptrObj) + { + PtrObj = ptrObj ?? throw new ArgumentNullException(nameof(ptrObj)); + ptr = ptrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + PtrObj?.Dispose(); + PtrObj = null; + base.DisposeManaged(); + } + + /// + /// Initialize the tracker with a know bounding box that surrounding the target + /// + /// The initial frame + /// The initial bounding box + /// + public void Init(Mat image, Rect boundingBox) + { + ThrowIfDisposed(); + + if (image is null) + throw new ArgumentNullException(nameof(image)); + + image.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_Tracker_init(ptr, image.CvPtr, boundingBox)); + GC.KeepAlive(this); + GC.KeepAlive(image); + } + + /// + /// Update the tracker, find the new most likely bounding box for the target + /// + /// The current frame + /// The bounding box that represent the new target location, if true was returned, not modified otherwise + /// True means that target was located and false means that tracker cannot locate target in + /// current frame.Note, that latter *does not* imply that tracker has failed, maybe target is indeed + /// missing from the frame (say, out of sight) + public bool Update(Mat image, ref Rect boundingBox) + { + ThrowIfDisposed(); + + if (image is null) + throw new ArgumentNullException(nameof(image)); + + image.ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.video_Tracker_update(ptr, image.CvPtr, ref boundingBox, out var ret)); + GC.KeepAlive(this); + GC.KeepAlive(image); + + return ret != 0; + } +} diff --git a/src/OpenCvSharp/Modules/video/TrackerGOTURN.cs b/src/OpenCvSharp/Modules/video/TrackerGOTURN.cs new file mode 100644 index 000000000..30355168a --- /dev/null +++ b/src/OpenCvSharp/Modules/video/TrackerGOTURN.cs @@ -0,0 +1,87 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// +/// GOTURN (@cite GOTURN) is kind of trackers based on Convolutional Neural Networks (CNN). +/// +/// +/// * While taking all advantages of CNN trackers, GOTURN is much faster due to offline training without online fine-tuning nature. +/// * GOTURN tracker addresses the problem of single target tracking: given a bounding box label of an object in the first frame of the video, +/// +/// * we track that object through the rest of the video.NOTE: Current method of GOTURN does not handle occlusions; however, it is fairly +/// * robust to viewpoint changes, lighting changes, and deformations. +/// +/// * Inputs of GOTURN are two RGB patches representing Target and Search patches resized to 227x227. +/// * Outputs of GOTURN are predicted bounding box coordinates, relative to Search patch coordinate system, in format X1, Y1, X2, Y2. +/// * Original paper is here: [http://davheld.github.io/GOTURN/GOTURN.pdf] +/// * As long as original authors implementation: [https://github.com/davheld/GOTURN#train-the-tracker] +/// * Implementation of training algorithm is placed in separately here due to 3d-party dependencies: +/// * [https://github.com/Auron-X/GOTURN_Training_Toolkit] +/// * GOTURN architecture goturn.prototxt and trained model goturn.caffemodel are accessible on opencv_extra GitHub repository. +/// +// ReSharper disable once InconsistentNaming +public class TrackerGOTURN : Tracker +{ + /// + /// + /// + protected TrackerGOTURN(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Constructor + /// + /// + public static TrackerGOTURN Create() + { + NativeMethods.HandleException( + NativeMethods.video_TrackerGOTURN_create1(out var p)); + return new TrackerGOTURN(p); + } + + // TODO + /// + /// Constructor + /// + /// GOTURN parameters + /// + public static TrackerGOTURN Create(Params parameters) + { + unsafe + { + NativeMethods.HandleException( + NativeMethods.video_TrackerGOTURN_create2(¶meters, out var p)); + return new TrackerGOTURN(p); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_TrackerGOTURN_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_TrackerGOTURN_delete(ptr)); + base.DisposeUnmanaged(); + } + } + +#pragma warning disable CA1034 + /// + /// + /// + [StructLayout(LayoutKind.Sequential)] + public struct Params; +} diff --git a/src/OpenCvSharp/Modules/video/TrackerMIL.cs b/src/OpenCvSharp/Modules/video/TrackerMIL.cs new file mode 100644 index 000000000..30f40dbd9 --- /dev/null +++ b/src/OpenCvSharp/Modules/video/TrackerMIL.cs @@ -0,0 +1,112 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// +/// The MIL algorithm trains a classifier in an online manner to separate the object from the background. +/// Multiple Instance Learning avoids the drift problem for a robust tracking.The implementation is based on @cite MIL. +/// Original code can be found here [http://vision.ucsd.edu/~bbabenko/project_miltrack.shtml] +/// +// ReSharper disable once InconsistentNaming +public class TrackerMIL : Tracker +{ + /// + /// + /// + protected TrackerMIL(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Constructor + /// + /// + public static TrackerMIL Create() + { + NativeMethods.HandleException( + NativeMethods.video_TrackerMIL_create1(out var p)); + return new TrackerMIL(p); + } + + /// + /// Constructor + /// + /// MIL parameters + /// + public static TrackerMIL Create(Params parameters) + { + unsafe + { + NativeMethods.HandleException( + NativeMethods.video_TrackerMIL_create2(¶meters, out var p)); + return new TrackerMIL(p); + } + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_TrackerMIL_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.video_Ptr_TrackerMIL_delete(ptr)); + base.DisposeUnmanaged(); + } + } + +#pragma warning disable CA1034 +#pragma warning disable CA1051 + /// + /// + [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] + public struct Params + { + /// + /// radius for gathering positive instances during init + /// + public float SamplerInitInRadius; + + /// + /// # negative samples to use during init + /// + public int SamplerInitMaxNegNum; + + /// + /// size of search window + /// + public float SamplerSearchWinSize; + + /// + /// radius for gathering positive instances during tracking + /// + public float SamplerTrackInRadius; + + /// + /// # positive samples to use during tracking + /// + public int SamplerTrackMaxPosNum; + + /// + /// # negative samples to use during tracking + /// + public int SamplerTrackMaxNegNum; + + /// + /// # features + /// + public int FeatureSetNumFeatures; + } +#pragma warning restore CA1051 +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs b/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs new file mode 100644 index 000000000..38114aec2 --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs @@ -0,0 +1,36 @@ + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// channel indices for multi-head camera live streams +/// +public enum CameraChannels +{ + // Data given from depth generator. + + /// + /// Depth values in mm (CV_16UC1) + /// + OpenNI_DepthMap = 0, + + /// + /// XYZ in meters (CV_32FC3) + /// + OpenNI_PointCloudMap = 1, + + /// + /// Disparity in pixels (CV_8UC1) + /// + OpenNI_DisparityMap = 2, + + /// + /// Disparity in pixels (CV_32FC1) + /// + OpenNI_DisparityMap32F = 3, + + /// + /// CV_8UC1 + /// + OpenNI_ValidDepthMask = 4, +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs b/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs new file mode 100644 index 000000000..e3750184f --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs @@ -0,0 +1,17 @@ +namespace OpenCvSharp; + +/// +/// Position in relative units +/// +public enum CapturePosAviRatio +{ + /// + /// Start of the file + /// + Start = 0, + + /// + /// End of the file + /// + End = 1, +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs b/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs new file mode 100644 index 000000000..ed1a4c48c --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs @@ -0,0 +1,22 @@ +namespace OpenCvSharp; + +/// +/// Capture type of CvCapture (Camera or AVI file) +/// +public enum CaptureType +{ + /// + /// Captures from an AVI file + /// + File, + + /// + /// Captures from digital camera + /// + Camera, + + /// + /// + /// + NotSpecified +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoAccelerationType.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoAccelerationType.cs new file mode 100644 index 000000000..25325b10b --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoAccelerationType.cs @@ -0,0 +1,38 @@ + +namespace OpenCvSharp; + +/// +/// Video Acceleration type +/// Used as value in #CAP_PROP_HW_ACCELERATION and #VIDEOWRITER_PROP_HW_ACCELERATION +/// note In case of FFmpeg backend, it translated to enum AVHWDeviceType (https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/hwcontext.h) +/// +public enum VideoAccelerationType +{ + /// + /// Do not require any specific H/W acceleration, prefer software processing. + /// Reading of this value means that special H/W accelerated handling is not added or not detected by OpenCV. + /// + None = 0, + + /// + /// Prefer to use H/W acceleration. If no one supported, then fallback to software processing. + /// note H/W acceleration may require special configuration of used environment. + /// note Results in encoding scenario may differ between software and hardware accelerated encoders. + /// + Any = 1, + + /// + /// DirectX 11 + /// + D3D11 = 2, + + /// + /// VAAPI + /// + VAAPI = 3, + + /// + /// libmfx (Intel MediaSDK/oneVPL) + /// + MFX = 4, +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs new file mode 100644 index 000000000..4d507458a --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs @@ -0,0 +1,175 @@ +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1707 // Underscore + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo +/// +/// Camera device types +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/videoio/include/opencv2/videoio.hpp#L89 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum VideoCaptureAPIs +{ + /// + /// Auto detect == 0 + /// + ANY = 0, + + /// + /// V4L/V4L2 capturing support + /// + V4L = 200, + + /// + /// Same as CAP_V4L + /// + V4L2 = V4L, + + /// + /// IEEE 1394 drivers + /// + FIREWIRE = 300, + + /// + /// Same value as CAP_FIREWIRE + /// + FIREWARE = FIREWIRE, + + /// + /// Same value as CAP_FIREWIRE + /// + IEEE1394 = FIREWIRE, + + /// + /// Same value as CAP_FIREWIRE + /// + DC1394 = FIREWIRE, + + /// + /// Same value as CAP_FIREWIRE + /// + CMU1394 = FIREWIRE, + + /// + /// DirectShow (via videoInput) + /// + DSHOW = 700, + + /// + /// PvAPI, Prosilica GigE SDK + /// + PVAPI = 800, + + /// + /// OpenNI (for Kinect) + /// + OPENNI = 900, + + /// + /// OpenNI (for Asus Xtion) + /// + OPENNI_ASUS = 910, + + /// + /// Android - not used + /// + ANDROID = 1000, + + /// + /// XIMEA Camera API + /// + XIAPI = 1100, + + /// + /// AVFoundation framework for iOS (OS X Lion will have the same API) + /// + AVFOUNDATION = 1200, + + /// + /// Smartek Giganetix GigEVisionSDK + /// + GIGANETIX = 1300, + + /// + /// Microsoft Media Foundation (via videoInput) + /// + MSMF = 1400, + + /// + /// Microsoft Windows Runtime using Media Foundation + /// + WINRT = 1410, + + /// + /// RealSense (former Intel Perceptual Computing SDK) + /// + INTELPERC = 1500, + + /// + /// Synonym for CAP_INTELPERC + /// +#pragma warning disable CA1069 + REALSENSE = 1500, +#pragma warning restore CA1069 + + /// + /// OpenNI2 (for Kinect) + /// + OPENNI2 = 1600, + + /// + /// OpenNI2 (for Asus Xtion and Occipital Structure sensors) + /// + OPENNI2_ASUS = 1610, + + /// + /// gPhoto2 connection + /// + GPHOTO2 = 1700, + + /// + /// GStreamer + /// + GSTREAMER = 1800, + + /// + /// Open and record video file or stream using the FFMPEG library + /// + FFMPEG = 1900, + + /// + /// OpenCV Image Sequence (e.g. img_%02d.jpg) + /// + IMAGES = 2000, + + /// + /// Aravis SDK + /// + ARAVIS = 2100, + + /// + /// Built-in OpenCV MotionJPEG codec + /// + OPENCV_MJPEG = 2200, + + /// + /// Intel MediaSDK + /// + INTEL_MFX = 2300, + + /// + /// XINE engine (Linux) + /// + XINE = 2400, + + /// + /// uEye Camera API + /// + CAP_UEYE = 2500, +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoCapturePara.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoCapturePara.cs new file mode 100644 index 000000000..1512cefce --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoCapturePara.cs @@ -0,0 +1,50 @@ +namespace OpenCvSharp; + +/// +/// Parameters of VideoCapture for hardware acceleration +/// Please check the link below for current HW acceleration types support matrix +/// https://github.com/opencv/opencv/wiki/Video-IO-hardware-acceleration +/// +[Serializable] +public record VideoCapturePara +{ + /// + /// Used as value in #CAP_PROP_HW_ACCELERATION and #VIDEOWRITER_PROP_HW_ACCELERATION + /// note In case of FFmpeg backend, it translated to enum AVHWDeviceType (https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/hwcontext.h) + /// + public VideoAccelerationType AccelerationType { get; } + + /// + /// Hardware device index (select GPU if multiple available). Device enumeration is acceleration type specific. + /// + public int HwDeviceIndex { get; } + + /// + /// Constructor, parameter of VideoCapture for hardware acceleration + /// + public VideoCapturePara() + { + AccelerationType = VideoAccelerationType.Any; + HwDeviceIndex = -1; + } + + /// + /// Constructor, parameter of VideoCapture for hardware acceleration + /// + /// Video Acceleration type + /// Hardware device index + public VideoCapturePara(VideoAccelerationType videoAcceleration, int deviceIndex) + { + AccelerationType = videoAcceleration; + HwDeviceIndex = deviceIndex; + } + + /// + /// Get parameters of VideoCapture for hardware acceleration + /// + public int[] GetParameters() => + [ + (int)VideoCaptureProperties.HwAcceleration, (int)AccelerationType, + (int)VideoCaptureProperties.HwDevice, HwDeviceIndex + ]; +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs new file mode 100644 index 000000000..c77be42c4 --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs @@ -0,0 +1,698 @@ +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp; + +// ReSharper disable InconsistentNaming +/// +/// Property identifiers for CvCapture +/// +/// +/// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/videoio/include/opencv2/videoio.hpp#L133 +/// +[SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] +public enum VideoCaptureProperties +{ + #region Basic + + /// + /// Position in milliseconds from the file beginning + /// + PosMsec = 0, + + /// + /// Position in frames (only for video files) + /// + PosFrames = 1, + + /// + /// Position in relative units (0 - start of the file, 1 - end of the file) + /// + PosAviRatio = 2, + + /// + /// Width of frames in the video stream (only for cameras) + /// + FrameWidth = 3, + + /// + /// Height of frames in the video stream (only for cameras) + /// + FrameHeight = 4, + + /// + /// Frame rate (only for cameras) + /// + Fps = 5, + + /// + /// 4-character code of codec (only for cameras). + /// + // ReSharper disable once InconsistentNaming + FourCC = 6, + + /// + /// Number of frames in the video stream + /// + FrameCount = 7, + + /// + /// The format of the Mat objects returned by retrieve() + /// + Format = 8, + + /// + /// A backend-specific value indicating the current capture mode + /// + Mode = 9, + + /// + /// Brightness of image (only for cameras) + /// + Brightness = 10, + + /// + /// contrast of image (only for cameras) + /// + Contrast = 11, + + /// + /// Saturation of image (only for cameras) + /// + Saturation = 12, + + /// + /// hue of image (only for cameras) + /// + Hue = 13, + + /// + /// Gain of the image (only for cameras) + /// + Gain = 14, + + /// + /// Exposure (only for cameras) + /// + Exposure = 15, + + /// + /// Boolean flags indicating whether images should be converted to RGB + /// + ConvertRgb = 16, + + /// + /// + /// + WhiteBalanceBlueU = 17, + + /// + /// TOWRITE (note: only supported by DC1394 v 2.x backend currently) + /// + Rectification = 18, + + /// + /// + /// + Monocrome = 19, + + /// + /// + /// + Sharpness = 20, + + /// + /// exposure control done by camera, + /// user can adjust refernce level using this feature + /// + AutoExposure = 21, + + /// + /// + /// + Gamma = 22, + + /// + /// + /// + Temperature = 23, + + /// + /// + /// + Trigger = 24, + + /// + /// + /// + TriggerDelay = 25, + + /// + /// + /// + WhiteBalanceRedV = 26, + + /// + /// + /// + Zoom = 27, + + /// + /// + /// + Focus = 28, + + /// + /// + /// + Guid = 29, + + /// + /// + /// + IsoSpeed = 30, + + /// + /// + /// + BackLight = 32, + + /// + /// + /// + Pan = 33, + + /// + /// + /// + Tilt = 34, + + /// + /// + /// + Roll = 35, + + /// + /// + /// + Iris = 36, + + /// + /// Pop up video/camera filter dialog (note: only supported by DSHOW backend currently. Property value is ignored) + /// + Settings = 37, + + /// + /// + /// + BufferSize = 38, + + /// + /// + /// + AutoFocus = 39, + + /// + /// Sample aspect ratio: num/den (num) + /// + SARNum = 40, + + /// + /// Sample aspect ratio: num/den (den) + /// + SARDen = 41, + + /// + /// Current backend (enum VideoCaptureAPIs). Read-only property + /// + Backend = 42, + + /// + /// Video input or Channel Number (only for those cameras that support) + /// + Channel = 43, + + /// + /// enable/ disable auto white-balance + /// + AutoWB = 44, + + /// + /// white-balance color temperature + /// + WBTemperature = 45, + + /// + /// (read-only) codec's pixel format. 4-character code - see VideoWriter::fourcc . Subset of [AV_PIX_FMT_*](https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/raw.c) or -1 if unknown + /// + CodecPixelFormat = 46, + + /// + /// (read-only) Video bitrate in kbits/s + /// + BitRate = 47, + + /// + /// (read-only) Frame rotation defined by stream meta (applicable for FFmpeg back-end only) + /// + OrientationMeta = 48, + + /// + /// if true - rotates output frames of CvCapture considering video file's metadata (applicable for FFmpeg back-end only) (https://github.com/opencv/opencv/issues/15499) + /// + OrientationAuto = 49, + + /// + /// (open-only) Hardware acceleration type (see VideoAccelerationType). + /// Setting supported only via params parameter in cv::VideoCapture constructor / .open() method. + /// Default value is backend-specific. + /// + HwAcceleration = 50, + + /// + /// (open-only) Hardware device index (select GPU if multiple available). Device enumeration is acceleration type specific. + /// + HwDevice = 51, + + #endregion + + #region OpenNI + + // Properties of cameras available through OpenNI interfaces + + /// + /// + /// + OpenNI_OutputMode = 100, + + /// + /// in mm + /// + OpenNI_FrameMaxDepth = 101, + + /// + /// in mm + /// + OpenNI_Baseline = 102, + + /// + /// in pixels + /// + OpenNI_FocalLength = 103, + + /// + /// flag that synchronizes the remapping depth map to image map + /// by changing depth generator's view point (if the flag is "on") or + /// sets this view point to its normal one (if the flag is "off"). + /// + OpenNI_Registration = 104, + + /// + /// + /// + OPENNI_ApproxFrameSync = 105, + + /// + /// + /// + OPENNI_MaxBufferSize = 106, + + /// + /// + /// + OPENNI_CircleBuffer = 107, + + /// + /// + /// + OPENNI_MaxTimeDuration = 108, + + /// + /// + /// + OPENNI_GeneratorPresent = 109, + + /// + /// + /// + OPENNI2_Sync = 110, + + /// + /// + /// + OPENNI2_Mirror = 111, + + /// + /// + /// + OpenNI_DepthGenerator = 1 << 31, + + /// + /// + /// + OpenNI_ImageGenerator = 1 << 30, + + /// + /// + /// + OpenNI_ImageGeneratorPresent = OpenNI_ImageGenerator + OPENNI_GeneratorPresent, + + + /// + /// + /// + OpenNI_ImageGeneratorOutputMode = OpenNI_ImageGenerator + OpenNI_OutputMode, + + /// + /// + /// + OpenNI_DepthGeneratorBaseline = OpenNI_ImageGenerator + OpenNI_Baseline, + + /// + /// + /// + OpenNI_DepthGeneratorFocalLength = OpenNI_ImageGenerator + OpenNI_FocalLength, + + /// + /// + /// + OpenNI_DepthGeneratorRegistrationON = OpenNI_ImageGenerator + OpenNI_Registration, + + #endregion + + #region GStreamer + + // Properties of cameras available through GStreamer interface + + /// + /// default is 1 + /// + GStreamerQueueLength = 200, + + #endregion + + #region PVAPI + + /// + /// ip for anable multicast master mode. 0 for disable multicast + /// + PvAPIMulticastIP = 300, + + /// + /// Determines how a frame is initiated + /// + PVAPI_FrameStartTriggerMode = 301, + + /// + /// Horizontal sub-sampling of the image + /// + PVAPI_DecimationHorizontal = 302, + + /// + /// Vertical sub-sampling of the image + /// + PVAPI_DecimationVertical = 303, + + /// + /// Horizontal binning factor + /// + PVAPI_BinningX = 304, + + /// + /// Vertical binning factor + /// + PVAPI_BinningY = 305, + + /// + /// Pixel format + /// + PVAPI_PixelFormat = 306, + + #endregion + + #region XI + + // Properties of cameras available through XIMEA SDK interface + + /// + /// Change image resolution by binning or skipping. + /// + XI_Downsampling = 400, + + /// + /// Output data format. + /// + XI_DataFormat = 401, + + /// + /// Horizontal offset from the origin to the area of interest (in pixels). + /// + XI_OffsetX = 402, + + /// + /// Vertical offset from the origin to the area of interest (in pixels). + /// + XI_OffsetY = 403, + + /// + /// Defines source of trigger. + /// + XI_TrgSource = 404, + + /// + /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. + /// + XI_TrgSoftware = 405, + + /// + /// Selects general purpose input + /// + XI_GpiSelector = 406, + + /// + /// Set general purpose input mode + /// + XI_GpiMode = 407, + + /// + /// Get general purpose level + /// + XI_GpiLevel = 408, + + /// + /// Selects general purpose output + /// + XI_GpoSelector = 409, + + /// + /// Set general purpose output mode + /// + XI_GpoMode = 410, + + /// + /// Selects camera signalling LED + /// + XI_LedSelector = 411, + + /// + /// Define camera signalling LED functionality + /// + XI_LedMode = 412, + + /// + /// Calculates White Balance(must be called during acquisition) + /// + XI_ManualWB = 413, + + /// + /// Automatic white balance + /// + XI_AutoWB = 414, + + /// + /// Automatic exposure/gain + /// + XI_AEAG = 415, + + /// + /// Exposure priority (0.5 - exposure 50%, gain 50%). + /// + XI_ExpPriority = 416, + + /// + /// Maximum limit of exposure in AEAG procedure + /// + XI_AEMaxLimit = 417, + + /// + /// Maximum limit of gain in AEAG procedure + /// + XI_AGMaxLimit = 418, + + /// + /// Average intensity of output signal AEAG should achieve(in %) + /// + XI_AEAGLevel = 419, + + /// + /// Image capture timeout in milliseconds + /// + XI_Timeout = 420, + + #endregion + + #region iOS + + /// + /// + /// + IOS_DeviceFocus = 9001, + + /// + /// + /// + IOS_DeviceExposure = 9002, + + /// + /// + /// + IOS_DeviceFlash = 9003, + + /// + /// + /// + IOS_DeviceWhiteBalance = 9004, + + /// + /// + /// + IOS_DeviceTorch = 9005, + + #endregion + + #region GIGA + + /// + /// + /// + GIGA_FrameOffsetX = 10001, + + /// + /// + /// + GIGA_FrameOffsetY = 10002, + + /// + /// + /// + GIGA_FrameWidthMax = 10003, + + /// + /// + /// + GIGA_FrameHeightMax = 10004, + + /// + /// + /// + GIGA_FrameSensWidth = 10005, + + /// + /// + /// + GIGA_FrameSensHeight = 10006, + + #endregion + + #region INTELPERC + + /// + /// + /// + INTELPERC_ProfileCount = 11001, + + /// + /// + /// + INTELPERC_ProfileIdx = 11002, + + /// + /// + /// + INTELPERC_DepthLowConfidenceValue = 11003, + + /// + /// + /// + INTELPERC_DepthSaturationValue = 11004, + + /// + /// + /// + INTELPERC_DepthConfidenceThreshold = 11005, + + /// + /// + /// + INTELPERC_DepthFocalLengthHorz = 11006, + + /// + /// + /// + INTELPERC_DepthFocalLengthVert = 11007, + + #endregion + + #region gPhoto2 + + /// + /// Capture only preview from liveview mode. + /// + GPhoto2_Preview = 17001, + + /// + /// Readonly, returns (const char *). + /// + GPhoto2_WidgetEnumerate = 17002, + + /// + /// Trigger, only by set. Reload camera settings. + /// + GPhoto2_ReloadConfig = 17003, + + /// + /// Reload all settings on set. + /// + GPhoto2_ReloadOnChange = 17004, + + /// + /// Collect messages with details. + /// + GPhoto2_CollectMsgs = 17005, + + /// + /// Readonly, returns (const char *). + /// + GPhoto2_FlushMsgs = 17006, + + /// + /// Exposure speed. Can be readonly, depends on camera program. + /// + Speed = 17007, + + /// + /// Aperture. Can be readonly, depends on camera program. + /// + Aperture = 17008, + + /// + /// Camera exposure program. + /// + ExposureProgram = 17009, + + /// + /// Enter liveview mode. + /// + ViewFinder = 17010, + + #endregion +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoWriterPara.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoWriterPara.cs new file mode 100644 index 000000000..04dc64996 --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoWriterPara.cs @@ -0,0 +1,50 @@ +namespace OpenCvSharp; + +/// +/// Parameters of VideoWriter for hardware acceleration +/// Please check the link below for current HW acceleration types support matrix +/// https://github.com/opencv/opencv/wiki/Video-IO-hardware-acceleration +/// +[Serializable] +public record VideoWriterPara +{ + /// + /// Used as value in #CAP_PROP_HW_ACCELERATION and #VIDEOWRITER_PROP_HW_ACCELERATION + /// note In case of FFmpeg backend, it translated to enum AVHWDeviceType (https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/hwcontext.h) + /// + public VideoAccelerationType AccelerationType { get; } + + /// + /// Hardware device index (select GPU if multiple available). Device enumeration is acceleration type specific. + /// + public int HwDeviceIndex { get; } + + /// + /// Constructor, parameter of VideoWriter for hardware acceleration + /// + public VideoWriterPara() + { + AccelerationType = VideoAccelerationType.Any; + HwDeviceIndex = -1; + } + + /// + /// Constructor, parameter of VideoWriter for hardware acceleration + /// + /// Video Acceleration type + /// Hardware device index + public VideoWriterPara(VideoAccelerationType videoAcceleration, int deviceIndex) + { + AccelerationType = videoAcceleration; + HwDeviceIndex = deviceIndex; + } + + /// + /// Get parameters of VideoWriter for hardware acceleration + /// + public int[] GetParameters() => + [ + (int)VideoWriterProperties.HwAcceleration, (int)AccelerationType, + (int)VideoWriterProperties.HwDevice, HwDeviceIndex + ]; +} diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoWriterProperties.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoWriterProperties.cs new file mode 100644 index 000000000..33f2c5b0e --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoWriterProperties.cs @@ -0,0 +1,47 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp; + +/// +/// VideoWriter generic properties identifier. +/// +public enum VideoWriterProperties +{ + /// + /// Current quality (0..100%) of the encoded video stream. Can be adjusted dynamically in some codecs. + /// + Quality = 1, + + /// + /// (Read-only): Size of just encoded video frame. Note that the encoding order may be different from representation order. + /// + FrameBytes = 2, + + /// + /// Number of stripes for parallel encoding. -1 for auto detection. + /// + NStripes = 3, + + /// + /// If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames. + /// + IsColor = 4, + + /// + /// Defaults to CV_8U. + /// + Depth = 5, + + /// + /// (open-only) Hardware acceleration type (see VideoAccelerationType). + /// Setting supported only via params parameter in cv::VideoCapture constructor / .open() method. + /// Default value is backend-specific. + /// + HwAcceleration = 6, + + /// + /// (open-only) Hardware device index (select GPU if multiple available). Device enumeration is acceleration type specific. + /// + HwDevice = 7, + +} diff --git a/src/OpenCvSharp/Modules/videoio/FourCC.cs b/src/OpenCvSharp/Modules/videoio/FourCC.cs new file mode 100644 index 000000000..339d18891 --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/FourCC.cs @@ -0,0 +1,201 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace OpenCvSharp; + +/// +/// 4-character code of codec used to compress the frames. +/// +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")] +// ReSharper disable once InconsistentNaming +public readonly struct FourCC : IEquatable +{ + /// + /// int value + /// + public readonly int Value; + + #region Predefined values + +#pragma warning disable 1591 + // ReSharper disable IdentifierTypo + + public const int Default = -1; + public const int Prompt = -1; + + public static readonly int AVC = FromString(nameof(AVC)); + public static readonly int CVID = FromString(nameof(CVID)); + public static readonly int DIB = FromString(nameof(DIB)); + public static readonly int DIV3 = FromString(nameof(DIV3)); + public static readonly int DIVX = FromString(nameof(DIVX)); + public static readonly int DV25 = FromString(nameof(DV25)); + public static readonly int DV50 = FromString(nameof(DV50)); + public static readonly int DVC = FromString(nameof(DVC)); + public static readonly int DVH1 = FromString(nameof(DVH1)); + public static readonly int DVHD = FromString(nameof(DVHD)); + public static readonly int DVSD = FromString(nameof(DVSD)); + public static readonly int DVSL = FromString(nameof(DVSL)); + public static readonly int H261 = FromString(nameof(H261)); + public static readonly int H263 = FromString(nameof(H263)); + public static readonly int H264 = FromString(nameof(X264)); + public static readonly int H265 = FromString(nameof(H265)); + public static readonly int HEVC = FromString(nameof(HEVC)); + public static readonly int I420 = FromString(nameof(I420)); + public static readonly int IV32 = FromString(nameof(IV32)); + public static readonly int IV41 = FromString(nameof(IV41)); + public static readonly int IV50 = FromString(nameof(IV50)); + public static readonly int IYUB = FromString(nameof(IYUB)); + public static readonly int IYUV = FromString(nameof(IYUV)); + public static readonly int MJPG = FromString(nameof(MJPG)); + public static readonly int M4S2 = FromString(nameof(M4S2)); + public static readonly int MP42 = FromString(nameof(MP42)); + public static readonly int MP43 = FromString(nameof(MP43)); + public static readonly int MP4S = FromString(nameof(MP4S)); + public static readonly int MP4V = FromString(nameof(MP4V)); + public static readonly int MPG1 = FromString(nameof(MPG1)); + public static readonly int MPG2 = FromString(nameof(MPG2)); + public static readonly int MPG4 = FromString(nameof(MPG4)); + public static readonly int MSS1 = FromString(nameof(MSS1)); + public static readonly int MSS2 = FromString(nameof(MSS2)); + public static readonly int MSVC = FromString(nameof(MSVC)); + public static readonly int JPEG = FromString(nameof(JPEG)); + public static readonly int PIM1 = FromString(nameof(PIM1)); + public static readonly int WMV1 = FromString(nameof(WMV1)); + public static readonly int WMV2 = FromString(nameof(WMV2)); + public static readonly int WMV3 = FromString(nameof(WMV3)); + public static readonly int WVC1 = FromString(nameof(WVC1)); + public static readonly int XVID = FromString(nameof(XVID)); + public static readonly int X264 = FromString(nameof(X264)); + + // ReSharper restore IdentifierTypo +#pragma warning restore 1591 + + #endregion + + /// + /// Constructor + /// + /// + public FourCC(int value) + { + Value = value; + } + + /// + /// Create from four characters + /// + /// + /// + /// + /// + /// + public static FourCC FromFourChars(char c1, char c2, char c3, char c4) + { + var value = VideoWriter.FourCC(c1, c2, c3, c4); + return new FourCC(value); + } + + /// + /// Create from string (length == 4) + /// + /// + /// + public static FourCC FromString(string code) + { + if (code is null) + throw new ArgumentNullException(nameof(code)); + if (code.Length == 0) + throw new ArgumentException("code.Length == 0", nameof(code)); + if (code.Length > 4) + throw new ArgumentException("code.Length > 4", nameof(code)); + + // padding + while (code.Length < 4) + { + code += " "; + } + + var value = VideoWriter.FourCC(code[0], code[1], code[2], code[3]); + return new FourCC(value); + } + + /// + /// implicit cast to int + /// + /// + public static implicit operator int(FourCC fourcc) + { + return fourcc.Value; + } + + /// + /// cast to int + /// + /// + public int ToInt32() + { + return Value; + } + + /// + /// implicit cast from int + /// + /// + public static implicit operator FourCC(int code) + { + return new FourCC(code); + } + + /// + /// cast from int + /// + /// + /// + public static FourCC FromInt32(int code) + { + return new FourCC(code); + } + + /// + public override bool Equals(object? obj) + { + if (obj is FourCC enumValue) + return Equals(enumValue); + return false; + } + + /// + public bool Equals(FourCC other) + { + return Value == other.Value; + } + + /// + public override int GetHashCode() + { + return Value.GetHashCode(); + } + + /// + /// + /// + /// + /// + /// + public static bool operator ==(FourCC left, FourCC right) + { + return left.Equals(right); + } + + /// + /// + /// + /// + /// + /// + public static bool operator !=(FourCC left, FourCC right) + { + return !(left == right); + } +} diff --git a/src/OpenCvSharp/Modules/videoio/VideoCapture.cs b/src/OpenCvSharp/Modules/videoio/VideoCapture.cs new file mode 100644 index 000000000..437d4e170 --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/VideoCapture.cs @@ -0,0 +1,1465 @@ +using System.Runtime.InteropServices; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// Video capturing class +/// +public class VideoCapture : DisposableCvObject +{ + /// + /// Capture type (File or Camera) + /// + private CaptureType captureType; + + #region Init and Disposal + + /// + /// Initializes empty capture. + /// To use this, you should call Open. + /// + /// + public VideoCapture() + { + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new1(out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.NotSpecified; + } + + /// + /// Opens a camera for video capturing + /// + /// id of the video capturing device to open. To open default camera using default backend just pass 0. + /// (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) + /// preferred Capture API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. + /// + public VideoCapture(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY) + { + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new3(index, (int) apiPreference, out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.Camera; + } + + /// + /// Opens a camera for video capturing with API Preference and parameters + /// + /// id of the video capturing device to open. To open default camera using default backend just pass 0. + /// (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) + /// preferred Capture API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. + /// The `params` parameter allows to specify extra parameters encoded as pairs `(paramId_1, paramValue_1, paramId_2, paramValue_2, ...)`. + /// See cv::VideoCaptureProperties + /// + public VideoCapture(int index, VideoCaptureAPIs apiPreference, int[] prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new5(index, (int)apiPreference, prms, prms.Length, out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.Camera; + } + + /// + /// Opens a camera for video capturing with API Preference and parameters + /// + /// id of the video capturing device to open. To open default camera using default backend just pass 0. + /// (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) + /// preferred Capture API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. + /// Parameters of VideoCapture for hardware acceleration + /// + public VideoCapture(int index, VideoCaptureAPIs apiPreference, VideoCapturePara prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + var p = prms.GetParameters(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new5(index, (int)apiPreference, p, p.Length, out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.Camera; + } + + /// + /// Opens a camera for video capturing + /// + /// id of the video capturing device to open. To open default camera using default backend just pass 0. + /// (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) + /// preferred Capture API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. + /// + public static VideoCapture FromCamera(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY) + { + return new VideoCapture(index, apiPreference); + } + + /// + /// Opens a video file or a capturing device or an IP video stream for video capturing with API Preference + /// + /// it can be: + /// - name of video file (e.g. `video.avi`) + /// - or image sequence (e.g. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`) + /// - or URL of video stream (e.g. `protocol://host:port/script_name?script_params|auth`). + /// Note that each video stream or IP camera feed has its own URL scheme. Please refer to the + /// documentation of source stream to know the right URL. + /// apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader + /// implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. + /// + public VideoCapture(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new2(fileName, (int)apiPreference, out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.File; + } + + /// + /// Opens a video file or a capturing device or an IP video stream for video capturing with API Preference + /// + /// it can be: + /// - name of video file (eg. `video.avi`) + /// - or image sequence (eg. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`) + /// - or URL of video stream (eg. `protocol://host:port/script_name?script_params|auth`). + /// Note that each video stream or IP camera feed has its own URL scheme. Please refer to the + /// documentation of source stream to know the right URL. + /// apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader + /// implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. + /// The `params` parameter allows to specify extra parameters encoded as pairs `(paramId_1, paramValue_1, paramId_2, paramValue_2, ...)`. + /// See cv::VideoCaptureProperties + /// + public VideoCapture(string fileName, VideoCaptureAPIs apiPreference, int[] prms) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new4(fileName, (int)apiPreference, prms, prms.Length, out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.File; + } + + /// + /// Opens a video file or a capturing device or an IP video stream for video capturing with API Preference + /// + /// it can be: + /// - name of video file (e.g. `video.avi`) + /// - or image sequence (e.g. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`) + /// - or URL of video stream (e.g. `protocol://host:port/script_name?script_params|auth`). + /// Note that each video stream or IP camera feed has its own URL scheme. Please refer to the + /// documentation of source stream to know the right URL. + /// apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader + /// implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. + /// Parameters of VideoCature for hardware acceleration + /// + public VideoCapture(string fileName, VideoCaptureAPIs apiPreference, VideoCapturePara prms) + { + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + var p = prms.GetParameters(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_new4(fileName, (int)apiPreference, p, p.Length, out ptr)); + + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoCapture"); + + captureType = CaptureType.File; + } + + /// + /// Opens a video file or a capturing device or an IP video stream for video capturing with API Preference + /// + /// it can be: + /// - name of video file (e.g. `video.avi`) + /// - or image sequence (e.g. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`) + /// - or URL of video stream (e.g. `protocol://host:port/script_name?script_params|auth`). + /// Note that each video stream or IP camera feed has its own URL scheme. Please refer to the + /// documentation of source stream to know the right URL. + /// apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader + /// implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. + /// + public static VideoCapture FromFile(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY) + => new(fileName, apiPreference); + + /// + /// Initializes from native pointer + /// + /// CvCapture* + internal protected VideoCapture(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + if (ptr != IntPtr.Zero) + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Properties + #region Basic + + /// + /// Gets the capture type (File or Camera) + /// + public CaptureType CaptureType => captureType; + + /// + /// Gets or sets film current position in milliseconds or video capture timestamp + /// + public int PosMsec + { + get => (int)Get(VideoCaptureProperties.PosMsec); + set => Set(VideoCaptureProperties.PosMsec, value); + } + + /// + /// Gets or sets 0-based index of the frame to be decoded/captured next + /// + public int PosFrames + { + get => (int)Get(VideoCaptureProperties.PosFrames); + set + { + if (captureType == CaptureType.Camera) + throw new NotSupportedException("Only for video files"); + Set(VideoCaptureProperties.PosFrames, value); + } + } + + /// + /// Gets or sets relative position of video file + /// + public CapturePosAviRatio PosAviRatio + { + get => (CapturePosAviRatio)(int)Get(VideoCaptureProperties.PosAviRatio); + set + { + if (captureType == CaptureType.Camera) + throw new NotSupportedException("Only for video files"); + Set(VideoCaptureProperties.PosAviRatio, (int)value); + } + } + + /// + /// Gets or sets width of frames in the video stream + /// + public int FrameWidth + { + get => (int)Get(VideoCaptureProperties.FrameWidth); + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.FrameWidth, value); + } + } + + /// + /// Gets or sets height of frames in the video stream + /// + public int FrameHeight + { + get => (int)Get(VideoCaptureProperties.FrameHeight); + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.FrameHeight, value); + } + } + + /// + /// Gets or sets frame rate + /// + public double Fps + { + get => Get(VideoCaptureProperties.Fps); + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Fps, value); + } + } + + /// + /// Gets or sets 4-character code of codec + /// + // ReSharper disable once InconsistentNaming + public string FourCC + { + get + { + var src = (int)Get(VideoCaptureProperties.FourCC); + var bytes = new IntBytes { Value = src }; + char[] fourcc = + [ + Convert.ToChar(bytes.B1), + Convert.ToChar(bytes.B2), + Convert.ToChar(bytes.B3), + Convert.ToChar(bytes.B4) + ]; + return new string(fourcc); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + var v = OpenCvSharp.FourCC.FromString(value); + Set(VideoCaptureProperties.FourCC, v.Value); + } + } + + /// + /// Gets number of frames in video file + /// + public int FrameCount => (int)Get(VideoCaptureProperties.FrameCount); + + /// + /// Gets or sets brightness of image (only for cameras) + /// + public double Brightness + { + get + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + return (int)Get(VideoCaptureProperties.Brightness); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Brightness, value); + } + } + + /// + /// Gets or sets contrast of image (only for cameras) + /// + public double Contrast + { + get + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + return (int)Get(VideoCaptureProperties.Contrast); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Contrast, value); + } + } + + /// + /// Gets or sets saturation of image (only for cameras) + /// + public double Saturation + { + get + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + return (int)Get(VideoCaptureProperties.Saturation); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Saturation, value); + } + } + + /// + /// Gets or sets hue of image (only for cameras) + /// + public double Hue + { + get + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + return (int)Get(VideoCaptureProperties.Hue); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Hue, value); + } + } + + /// + /// The format of the Mat objects returned by retrieve() + /// + public int Format + { + get => (int)Get(VideoCaptureProperties.Format); + set => Set(VideoCaptureProperties.Format, value); + } + + /// + /// A backend-specific value indicating the current capture mode + /// + public int Mode + { + get => (int)Get(VideoCaptureProperties.Mode); + set => Set(VideoCaptureProperties.Mode, value); + } + + /// + /// Gain of the image (only for cameras) + /// + public double Gain + { + get + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + return Get(VideoCaptureProperties.Gain); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Gain, value); + } + } + + /// + /// Exposure (only for cameras) + /// + public double Exposure + { + get + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + return Get(VideoCaptureProperties.Exposure); + } + set + { + if (captureType == CaptureType.File) + throw new NotSupportedException("Only for cameras"); + Set(VideoCaptureProperties.Exposure, value); + } + } + + /// + /// Boolean flags indicating whether images should be converted to RGB + /// + public bool ConvertRgb + { + get => (int)Get(VideoCaptureProperties.ConvertRgb) != 0; + set => Set(VideoCaptureProperties.ConvertRgb, value ? 1 : 0); + } + + /// + /// + /// + public double WhiteBalanceBlueU + { + get => Get(VideoCaptureProperties.WhiteBalanceBlueU); + set => Set(VideoCaptureProperties.WhiteBalanceBlueU, value); + } + + /// + /// TOWRITE (note: only supported by DC1394 v 2.x backend currently) + /// + public double Rectification + { + get => Get(VideoCaptureProperties.Rectification); + set => Set(VideoCaptureProperties.Rectification, value); + } + + /// + /// + /// + public double Monocrome + { + get => Get(VideoCaptureProperties.Monocrome); + set => Set(VideoCaptureProperties.Monocrome, value); + } + + /// + /// + /// + public double Sharpness + { + get => Get(VideoCaptureProperties.Sharpness); + set => Set(VideoCaptureProperties.Sharpness, value); + } + + /// + /// exposure control done by camera, + /// user can adjust refernce level using this feature + /// [CV_CAP_PROP_AUTO_EXPOSURE] + /// + public double AutoExposure + { + get => Get(VideoCaptureProperties.AutoExposure); + set => Set(VideoCaptureProperties.AutoExposure, value); + } + + /// + /// + /// + public double Gamma + { + get => Get(VideoCaptureProperties.Gamma); + set => Set(VideoCaptureProperties.Gamma, value); + } + + /// + /// + /// [CV_CAP_PROP_TEMPERATURE] + /// + public double Temperature + { + get => Get(VideoCaptureProperties.Temperature); + set => Set(VideoCaptureProperties.Temperature, value); + } + + /// + /// + /// + public double Trigger + { + get => Get(VideoCaptureProperties.Trigger); + set => Set(VideoCaptureProperties.Trigger, value); + } + + /// + /// + /// + public double TriggerDelay + { + get => Get(VideoCaptureProperties.TriggerDelay); + set => Set(VideoCaptureProperties.TriggerDelay, value); + } + + /// + /// + /// + public double WhiteBalanceRedV + { + get => Get(VideoCaptureProperties.WhiteBalanceRedV); + set => Set(VideoCaptureProperties.WhiteBalanceRedV, value); + } + + /// + /// + /// + public double Zoom + { + get => Get(VideoCaptureProperties.Zoom); + set => Set(VideoCaptureProperties.Zoom, value); + } + + /// + /// + /// + public double Focus + { + get => Get(VideoCaptureProperties.Focus); + set => Set(VideoCaptureProperties.Focus, value); + } + + /// + /// + /// + public double Guid + { + get => Get(VideoCaptureProperties.Guid); + set => Set(VideoCaptureProperties.Guid, value); + } + + /// + /// + /// + public double IsoSpeed + { + get => Get(VideoCaptureProperties.IsoSpeed); + set => Set(VideoCaptureProperties.IsoSpeed, value); + } + + /// + /// + /// + public double BackLight + { + get => Get(VideoCaptureProperties.BackLight); + set => Set(VideoCaptureProperties.BackLight, value); + } + + /// + /// + /// + public double Pan + { + get => Get(VideoCaptureProperties.Pan); + set => Set(VideoCaptureProperties.Pan, value); + } + + /// + /// + /// + public double Tilt + { + get => Get(VideoCaptureProperties.Tilt); + set => Set(VideoCaptureProperties.Tilt, value); + } + + /// + /// + /// + public double Roll + { + get => Get(VideoCaptureProperties.Roll); + set => Set(VideoCaptureProperties.Roll, value); + } + + /// + /// + /// + public double Iris + { + get => Get(VideoCaptureProperties.Iris); + set => Set(VideoCaptureProperties.Iris, value); + } + + /// + /// + /// + public double Settings + { + get => Get(VideoCaptureProperties.Settings); + set => Set(VideoCaptureProperties.Settings, value); + } + + /// + /// + /// + public double BufferSize + { + get => Get(VideoCaptureProperties.BufferSize); + set => Set(VideoCaptureProperties.BufferSize, value); + } + + /// + /// + /// + public bool AutoFocus + { + get => (int)Get(VideoCaptureProperties.AutoFocus) != 0; + set => Set(VideoCaptureProperties.AutoFocus, value ? 1 : 0); + } + #endregion + + #region OpenNI + // Properties of cameras available through OpenNI interfaces + // ReSharper disable InconsistentNaming + + /// + /// + /// [CV_CAP_PROP_OPENNI_OUTPUT_MODE] + /// + public double OpenNI_OutputMode + { + get => Get(VideoCaptureProperties.OpenNI_OutputMode); + set => Set(VideoCaptureProperties.OpenNI_OutputMode, value); + } + + /// + /// in mm + /// [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH] + /// + public double OpenNI_FrameMaxDepth + { + get => Get(VideoCaptureProperties.OpenNI_FrameMaxDepth); + set => Set(VideoCaptureProperties.OpenNI_FrameMaxDepth, value); + } + + /// + /// in mm + /// [CV_CAP_PROP_OPENNI_BASELINE] + /// + public double OpenNI_Baseline + { + get => Get(VideoCaptureProperties.OpenNI_Baseline); + set => Set(VideoCaptureProperties.OpenNI_Baseline, value); + } + + /// + /// in pixels + /// [CV_CAP_PROP_OPENNI_FOCAL_LENGTH] + /// + public double OpenNI_FocalLength + { + get => Get(VideoCaptureProperties.OpenNI_FocalLength); + set => Set(VideoCaptureProperties.OpenNI_FocalLength, value); + } + + /// + /// flag that synchronizes the remapping depth map to image map + /// by changing depth generator's view point (if the flag is "on") or + /// sets this view point to its normal one (if the flag is "off"). + /// [CV_CAP_PROP_OPENNI_REGISTRATION] + /// + public double OpenNI_Registration + { + get => Get(VideoCaptureProperties.OpenNI_Registration); + set => Set(VideoCaptureProperties.OpenNI_Registration, value); + } + + /// + /// + /// [CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE] + /// + public double OpenNI_ImageGeneratorOutputMode + { + get => Get(VideoCaptureProperties.OpenNI_ImageGeneratorOutputMode); + set => Set(VideoCaptureProperties.OpenNI_ImageGeneratorOutputMode, value); + } + + /// + /// + /// [CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE] + /// + public double OpenNI_DepthGeneratorBaseline + { + get => Get(VideoCaptureProperties.OpenNI_DepthGeneratorBaseline); + set => Set(VideoCaptureProperties.OpenNI_DepthGeneratorBaseline, value); + } + + /// + /// + /// [CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH] + /// + public double OpenNI_DepthGeneratorFocalLength + { + get => Get(VideoCaptureProperties.OpenNI_DepthGeneratorFocalLength); + set => Set(VideoCaptureProperties.OpenNI_DepthGeneratorFocalLength, value); + } + + /// + /// + /// [CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON] + /// + public double OpenNI_DepthGeneratorRegistrationON + { + get => Get(VideoCaptureProperties.OpenNI_DepthGeneratorRegistrationON); + set => Set(VideoCaptureProperties.OpenNI_DepthGeneratorRegistrationON, value); + } + // ReSharper restore InconsistentNaming + #endregion + #region GStreamer + // Properties of cameras available through GStreamer interface + + /// + /// default is 1 + /// [CV_CAP_GSTREAMER_QUEUE_LENGTH] + /// + public double GStreamerQueueLength + { + get => Get(VideoCaptureProperties.GStreamerQueueLength); + set => Set(VideoCaptureProperties.GStreamerQueueLength, value); + } + + /// + /// ip for anable multicast master mode. 0 for disable multicast + /// [CV_CAP_PROP_PVAPI_MULTICASTIP] + /// + // ReSharper disable once InconsistentNaming + public double PvAPIMulticastIP + { + get => Get(VideoCaptureProperties.PvAPIMulticastIP); + set => Set(VideoCaptureProperties.PvAPIMulticastIP, value); + } + + #endregion + #region XI + // Properties of cameras available through XIMEA SDK interface + // ReSharper disable InconsistentNaming + + /// + /// Change image resolution by binning or skipping. + /// [CV_CAP_PROP_XI_DOWNSAMPLING] + /// + public double XI_Downsampling + { + get => Get(VideoCaptureProperties.XI_Downsampling); + set => Set(VideoCaptureProperties.XI_Downsampling, value); + } + + /// + /// Output data format. + /// [CV_CAP_PROP_XI_DATA_FORMAT] + /// + public double XI_DataFormat => Get(VideoCaptureProperties.XI_DataFormat); + + /// + /// Horizontal offset from the origin to the area of interest (in pixels). + /// [CV_CAP_PROP_XI_OFFSET_X] + /// + public double XI_OffsetX + { + get => Get(VideoCaptureProperties.XI_OffsetX); + set => Set(VideoCaptureProperties.XI_OffsetX, value); + } + + /// + /// Vertical offset from the origin to the area of interest (in pixels). + /// [CV_CAP_PROP_XI_OFFSET_Y] + /// + public double XI_OffsetY + { + get => Get(VideoCaptureProperties.XI_OffsetY); + set => Set(VideoCaptureProperties.XI_OffsetY, value); + } + + /// + /// Defines source of trigger. + /// [CV_CAP_PROP_XI_TRG_SOURCE] + /// + public double XI_TrgSource + { + get => Get(VideoCaptureProperties.XI_TrgSource); + set => Set(VideoCaptureProperties.XI_TrgSource, value); + } + + /// + /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. + /// [CV_CAP_PROP_XI_TRG_SOFTWARE] + /// + public double XI_TrgSoftware + { + get => Get(VideoCaptureProperties.XI_TrgSoftware); + set => Set(VideoCaptureProperties.XI_TrgSoftware, value); + } + + /// + /// Selects general purpose input + /// [CV_CAP_PROP_XI_GPI_SELECTOR] + /// + public double XI_GpiSelector + { + get => Get(VideoCaptureProperties.XI_GpiSelector); + set => Set(VideoCaptureProperties.XI_GpiSelector, value); + } + + /// + /// Set general purpose input mode + /// [CV_CAP_PROP_XI_GPI_MODE] + /// + public double XI_GpiMode + { + get => Get(VideoCaptureProperties.XI_GpiMode); + set => Set(VideoCaptureProperties.XI_GpiMode, value); + } + + /// + /// Get general purpose level + /// [CV_CAP_PROP_XI_GPI_LEVEL] + /// + public double XI_GpiLevel + { + get => Get(VideoCaptureProperties.XI_GpiLevel); + set => Set(VideoCaptureProperties.XI_GpiLevel, value); + } + + /// + /// Selects general purpose output + /// [CV_CAP_PROP_XI_GPO_SELECTOR] + /// + public double XI_GpoSelector + { + get => Get(VideoCaptureProperties.XI_GpoSelector); + set => Set(VideoCaptureProperties.XI_GpoSelector, value); + } + + /// + /// Set general purpose output mode + /// [CV_CAP_PROP_XI_GPO_MODE] + /// + public double XI_GpoMode + { + get => Get(VideoCaptureProperties.XI_GpoMode); + set => Set(VideoCaptureProperties.XI_GpoMode, value); + } + + /// + /// Selects camera signalling LED + /// [CV_CAP_PROP_XI_LED_SELECTOR] + /// + public double XI_LedSelector + { + get => Get(VideoCaptureProperties.XI_LedSelector); + set => Set(VideoCaptureProperties.XI_LedSelector, value); + } + + /// + /// Define camera signalling LED functionality + /// [CV_CAP_PROP_XI_LED_MODE] + /// + public double XI_LedMode + { + get => Get(VideoCaptureProperties.XI_LedMode); + set => Set(VideoCaptureProperties.XI_LedMode, value); + } + + /// + /// Calculates White Balance(must be called during acquisition) + /// [CV_CAP_PROP_XI_MANUAL_WB] + /// + public double XI_ManualWB + { + get => Get(VideoCaptureProperties.XI_ManualWB); + set => Set(VideoCaptureProperties.XI_ManualWB, value); + } + + /// + /// Automatic white balance + /// [CV_CAP_PROP_XI_AUTO_WB] + /// + public double XI_AutoWB + { + get => Get(VideoCaptureProperties.XI_AutoWB); + set => Set(VideoCaptureProperties.XI_AutoWB, value); + } + + /// + /// Automatic exposure/gain + /// [CV_CAP_PROP_XI_AEAG] + /// + public double XI_AEAG + { + get => Get(VideoCaptureProperties.XI_AEAG); + set => Set(VideoCaptureProperties.XI_AEAG, value); + } + + /// + /// Exposure priority (0.5 - exposure 50%, gain 50%). + /// [CV_CAP_PROP_XI_EXP_PRIORITY] + /// + public double XI_ExpPriority + { + get => Get(VideoCaptureProperties.XI_ExpPriority); + set => Set(VideoCaptureProperties.XI_ExpPriority, value); + } + + /// + /// Maximum limit of exposure in AEAG procedure + /// [CV_CAP_PROP_XI_AE_MAX_LIMIT] + /// + public double XI_AEMaxLimit + { + get => Get(VideoCaptureProperties.XI_AEMaxLimit); + set => Set(VideoCaptureProperties.XI_AEMaxLimit, value); + } + + /// + /// Maximum limit of gain in AEAG procedure + /// [CV_CAP_PROP_XI_AG_MAX_LIMIT] + /// + public double XI_AGMaxLimit + { + get => Get(VideoCaptureProperties.XI_AGMaxLimit); + set => Set(VideoCaptureProperties.XI_AGMaxLimit, value); + } + + /// + /// default is 1 + /// [CV_CAP_PROP_XI_AEAG_LEVEL] + /// + public double XI_AEAGLevel + { + get => Get(VideoCaptureProperties.XI_AEAGLevel); + set => Set(VideoCaptureProperties.XI_AEAGLevel, value); + } + + /// + /// default is 1 + /// [CV_CAP_PROP_XI_TIMEOUT] + /// + public double XI_Timeout + { + get => Get(VideoCaptureProperties.XI_Timeout); + set => Set(VideoCaptureProperties.XI_Timeout, value); + } + // ReSharper restore InconsistentNaming + #endregion + #endregion + + #region Methods + + /// + /// Opens a video file or a capturing device or an IP video stream for video capturing. + /// + /// it can be: + /// - name of video file (eg. `video.avi`) + /// - or image sequence (eg. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`) + /// - or URL of video stream (eg. `protocol://host:port/script_name?script_params|auth`). + /// Note that each video stream or IP camera feed has its own URL scheme. Please refer to the + /// documentation of source stream to know the right URL. + /// apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader + /// implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. + /// `true` if the file has been successfully opened + public bool Open(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_open1(ptr, fileName, (int)apiPreference, out var ret)); + + GC.KeepAlive(this); + if (ret == 0) + return false; + + captureType = CaptureType.File; + return true; + } + + /// + /// Opens a camera for video capturing + /// + /// id of the video capturing device to open. To open default camera using default backend just pass 0. + /// (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) + /// preferred Capture API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. + /// `true` if the file has been successfully opened + public bool Open(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_open2(ptr, index, (int)apiPreference, out var ret)); + + GC.KeepAlive(this); + if (ret == 0) + return false; + + captureType = CaptureType.Camera; + return true; + } + + /// + /// Returns true if video capturing has been initialized already. + /// + /// + public bool IsOpened() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_isOpened(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Closes video file or capturing device. + /// + /// + public void Release() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_release(ptr)); + } + + /// + /// Grabs the next frame from video file or capturing device. + /// + /// The method/function grabs the next frame from video file or camera and returns true (non-zero) in the case of success. + /// + /// The primary use of the function is in multi-camera environments, especially when the cameras do not + /// have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that + /// call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way + /// the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames + /// from different cameras will be closer in time. + /// + /// Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the + /// correct way of retrieving data from it is to call VideoCapture::grab() first and then call + /// VideoCapture::retrieve() one or more times with different values of the channel parameter. + /// + /// `true` (non-zero) in the case of success. + public bool Grab() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_grab(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Decodes and returns the grabbed video frame. + /// + /// The method decodes and returns the just grabbed frame. If no frames has been grabbed + /// (camera has been disconnected, or there are no more frames in video file), the method returns false + /// and the function returns an empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// the video frame is returned here. If no frames has been grabbed the image will be empty. + /// it could be a frame index or a driver specific flag + /// + public bool Retrieve(OutputArray image, int flag = 0) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_retrieve_OutputArray(ptr, image.CvPtr, flag, out var ret)); + + GC.KeepAlive(this); + image.Fix(); + return ret != 0; + } + + /// + /// Decodes and returns the grabbed video frame. + /// + /// The method decodes and returns the just grabbed frame. If no frames has been grabbed + /// (camera has been disconnected, or there are no more frames in video file), the method returns false + /// and the function returns an empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// the video frame is returned here. If no frames has been grabbed the image will be empty. + /// non-zero streamIdx is only valid for multi-head camera live streams + /// + public bool Retrieve(OutputArray image, CameraChannels streamIdx) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_retrieve_OutputArray(ptr, image.CvPtr, (int)streamIdx, out var ret)); + + GC.KeepAlive(this); + image.Fix(); + return ret != 0; + } + + /// + /// Decodes and returns the grabbed video frame. + /// + /// The method decodes and returns the just grabbed frame. If no frames has been grabbed + /// (camera has been disconnected, or there are no more frames in video file), the method returns false + /// and the function returns an empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// the video frame is returned here. If no frames has been grabbed the image will be empty. + /// it could be a frame index or a driver specific flag + /// + public bool Retrieve(Mat image, int flag = 0) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_retrieve_Mat(ptr, image.CvPtr, flag, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + return ret != 0; + } + + /// + /// Decodes and returns the grabbed video frame. + /// + /// The method decodes and returns the just grabbed frame. If no frames has been grabbed + /// (camera has been disconnected, or there are no more frames in video file), the method returns false + /// and the function returns an empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// the video frame is returned here. If no frames has been grabbed the image will be empty. + /// non-zero streamIdx is only valid for multi-head camera live streams + /// + public bool Retrieve(Mat image, CameraChannels streamIdx) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_retrieve_Mat(ptr, image.CvPtr, (int)streamIdx, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + return ret != 0; + } + + /// + /// Decodes and returns the grabbed video frame. + /// + /// The method decodes and returns the just grabbed frame. If no frames has been grabbed + /// (camera has been disconnected, or there are no more frames in video file), the method returns false + /// and the function returns an empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// the video frame is returned here. If no frames has been grabbed the image will be empty. + public Mat RetrieveMat() + { + ThrowIfDisposed(); + + var mat = new Mat(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_operatorRightShift_Mat(ptr, mat.CvPtr)); + GC.KeepAlive(this); + return mat; + } + + /// + /// Grabs, decodes and returns the next video frame. + /// + /// The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the + /// most convenient method for reading video files or capturing data from decode and returns the just + /// grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more + /// frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// `false` if no frames has been grabbed + public bool Read(OutputArray image) + { + ThrowIfDisposed(); + if(image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_read_OutputArray(ptr, image.CvPtr, out var ret)); + + GC.KeepAlive(this); + image.Fix(); + return ret != 0; + } + + /// + /// Grabs, decodes and returns the next video frame. + /// + /// The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the + /// most convenient method for reading video files or capturing data from decode and returns the just + /// grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more + /// frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()). + /// + /// `false` if no frames has been grabbed + public bool Read(Mat image) + { + ThrowIfDisposed(); + if(image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_read_Mat(ptr, image.CvPtr, out var ret)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + return ret != 0; + } + + /// + /// Sets a property in the VideoCapture. + /// + /// Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) + /// or one from @ref videoio_flags_others + /// Value of the property. + /// `true` if the property is supported by backend used by the VideoCapture instance. + public bool Set(VideoCaptureProperties propertyId, double value) + { + return Set((int)propertyId, value); + } + + /// + /// Sets a property in the VideoCapture. + /// + /// Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) + /// or one from @ref videoio_flags_others + /// Value of the property. + /// `true` if the property is supported by backend used by the VideoCapture instance. + public bool Set(int propertyId, double value) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_set(ptr, propertyId, value, out var ret)); + + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the specified VideoCapture property + /// + /// Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) + /// or one from @ref videoio_flags_others + /// Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoCapture instance. + public double Get(VideoCaptureProperties propertyId) + { + return Get((int)propertyId); + } + + /// + /// Returns the specified VideoCapture property + /// + /// Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) + /// or one from @ref videoio_flags_others + /// Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoCapture instance. + public double Get(int propertyId) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_get(ptr, propertyId, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Returns used backend API name. + /// Note that stream should be opened. + /// + /// + public string GetBackendName() + { + ThrowIfDisposed(); + + using var returnString = new StdString(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_getBackendName(ptr, returnString.CvPtr)); + GC.KeepAlive(this); + return returnString.ToString(); + } + + /// + /// Switches exceptions mode. + /// methods raise exceptions if not successful instead of returning an error code + /// + /// + public void SetExceptionMode(bool enable) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_setExceptionMode(ptr, enable ? 1 : 0)); + GC.KeepAlive(this); + } + + /// + /// query if exception mode is active + /// + /// + public bool GetExceptionMode() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_getExceptionMode(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Wait for ready frames from VideoCapture. + /// + /// The primary use of the function is in multi-camera environments. + /// The method fills the ready state vector, grabs video frame, if camera is ready. + /// + /// After this call use VideoCapture::retrieve() to decode and fetch frame data. + /// + /// input video streams + /// stream indexes with grabbed frames (ready to use .retrieve() to fetch actual frame) + /// number of nanoseconds (0 - infinite) + /// Exception %Exception on stream errors (check .isOpened() + /// to filter out malformed streams) or VideoCapture type is not supported + /// `true if streamReady is not empty + public static bool WaitAny( + IEnumerable streams, + out int[] readyIndex, + long timeoutNs = 0) + { + if (streams is null) + throw new ArgumentNullException(nameof(streams)); + + var streamPtrs = streams.Select(s => + { + if (s is null) + throw new ArgumentException($"{nameof(streams)} contains null", nameof(streams)); + s.ThrowIfDisposed(); + return s.CvPtr; + }).ToArray(); + using var readyIndexVec = new VectorOfInt32(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoCapture_waitAny( + streamPtrs, + (nuint)streamPtrs.Length, + readyIndexVec.CvPtr, + timeoutNs, + out var ret)); + + GC.KeepAlive(streams); + readyIndex = readyIndexVec.ToArray(); + return ret != 0; + } + + #endregion + + /// + /// For accessing each byte of Int32 value + /// + [StructLayout(LayoutKind.Explicit)] + private struct IntBytes + { + [FieldOffset(0)] + public int Value; + [FieldOffset(0)] + public readonly byte B1; + [FieldOffset(1)] + public readonly byte B2; + [FieldOffset(2)] + public readonly byte B3; + [FieldOffset(3)] + public readonly byte B4; + } +} diff --git a/src/OpenCvSharp/Modules/videoio/VideoWriter.cs b/src/OpenCvSharp/Modules/videoio/VideoWriter.cs new file mode 100644 index 000000000..235e238c0 --- /dev/null +++ b/src/OpenCvSharp/Modules/videoio/VideoWriter.cs @@ -0,0 +1,404 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// AVI Video File Writer +/// +public class VideoWriter : DisposableCvObject +{ + #region Init and Disposal + + /// + /// + /// + public VideoWriter() + { + FileName = null; + Fps = -1; + FrameSize = default; + IsColor = true; + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new1(out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). + /// + public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true) + { + FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); + Fps = fps; + FrameSize = frameSize; + IsColor = isColor; + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new2(fileName, fourcc, fps, frameSize, isColor ? 1 : 0, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// allows to specify API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). + /// + public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, bool isColor = true) + { + FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); + Fps = fps; + FrameSize = frameSize; + IsColor = isColor; + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new3(fileName, (int)apiPreference, fourcc, fps, frameSize, isColor ? 1 : 0, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// The `params` parameter allows to specify extra encoder parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) + /// see cv::VideoWriterProperties + /// + public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, int[] prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); + Fps = fps; + FrameSize = frameSize; + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new4(fileName, fourcc, fps, frameSize, prms, prms.Length, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// Parameters of VideoWriter for hardware acceleration + /// + public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, VideoWriterPara prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); + Fps = fps; + FrameSize = frameSize; + var p = prms.GetParameters(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new4(fileName, fourcc, fps, frameSize, p, p.Length, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// allows to specify API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// The `params` parameter allows to specify extra encoder parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) + /// see cv::VideoWriterProperties + /// + public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, int[] prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); + Fps = fps; + FrameSize = frameSize; + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new5(fileName, (int)apiPreference, fourcc, fps, frameSize, prms, prms.Length, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// allows to specify API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// Parameters of VideoWriter for hardware acceleration + /// + public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, VideoWriterPara prms) + { + if (prms is null) + throw new ArgumentNullException(nameof(prms)); + FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); + Fps = fps; + FrameSize = frameSize; + var p = prms.GetParameters(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_new5(fileName, (int)apiPreference, fourcc, fps, frameSize, p, p.Length, out ptr)); + if (ptr == IntPtr.Zero) + throw new OpenCvSharpException("Failed to create VideoWriter"); + } + + /// + /// Initializes from native pointer + /// + /// CvVideoWriter* + internal VideoWriter(IntPtr ptr) + { + this.ptr = ptr; + } + + /// + /// Releases unmanaged resources + /// + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_delete(ptr)); + base.DisposeUnmanaged(); + } + + #endregion + + #region Properties + + /// + /// Get output video file name + /// + public string? FileName { get; private set; } + + /// + /// Frames per second of the output video + /// + public double Fps { get; private set; } + + /// + /// Get size of frame image + /// + public Size FrameSize { get; private set; } + + /// + /// Get whether output frames is color or not + /// + public bool IsColor { get; private set; } + + #endregion + + #region Methods + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). + /// + public bool Open(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true) + { + ThrowIfDisposed(); + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + FileName = fileName; + Fps = fps; + FrameSize = frameSize; + IsColor = isColor; + + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_open1(ptr, fileName, fourcc, fps, frameSize, isColor ? 1 : 0, out var ret)); + + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Creates video writer structure. + /// + /// Name of the output video file. + /// allows to specify API backends to use. Can be used to enforce a specific reader implementation + /// if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. + /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. + /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. + /// Frame rate of the created video stream. + /// Size of video frames. + /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). + /// + public bool Open(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, bool isColor = true) + { + ThrowIfDisposed(); + if (string.IsNullOrEmpty(fileName)) + throw new ArgumentNullException(nameof(fileName)); + + FileName = fileName; + Fps = fps; + FrameSize = frameSize; + IsColor = isColor; + + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_open2(ptr, fileName, (int)apiPreference, fourcc, fps, frameSize, isColor ? 1 : 0, out var ret)); + + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns true if video writer has been successfully initialized. + /// + /// + public bool IsOpened() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_isOpened(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// + /// + /// + public void Release() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_release(ptr)); + GC.KeepAlive(this); + } + + /// + /// Writes/appends one frame to video file. + /// + /// the written frame. + /// + public void Write(InputArray image) + { + ThrowIfDisposed(); + if(image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_write(ptr, image.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + } + + /// + /// Sets a property in the VideoWriter. + /// + /// Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of @ref videoio_flags_others + /// Value of the property. + /// `true` if the property is supported by the backend used by the VideoWriter instance. + public bool Set(VideoWriterProperties propId, double value) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_set(ptr, (int)propId, value, out var ret)); + + GC.KeepAlive(this); + return ret != 0; + } + + /// + /// Returns the specified VideoWriter property + /// + /// Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of @ref videoio_flags_others + /// Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoWriter instance. + public double Get(VideoWriterProperties propId) + { + ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_get(ptr, (int)propId, out var ret)); + + GC.KeepAlive(this); + return ret; + } + + /// + /// Concatenates 4 chars to a fourcc code. + /// This static method constructs the fourcc code of the codec to be used in + /// the constructor VideoWriter::VideoWriter or VideoWriter::open. + /// + // ReSharper disable once InconsistentNaming + public static int FourCC(char c1, char c2, char c3, char c4) + { + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_fourcc((sbyte) c1, (sbyte) c2, (sbyte) c3, (sbyte) c4, out var ret)); + return ret; + } + + /// + /// Concatenates 4 chars to a fourcc code. + /// This static method constructs the fourcc code of the codec to be used in + /// the constructor VideoWriter::VideoWriter or VideoWriter::open. + /// + /// + /// + // ReSharper disable once InconsistentNaming + public static int FourCC(string code) + { + if (code is null) + throw new ArgumentNullException(nameof(code)); + if (code.Length != 4) + throw new ArgumentException("code.Length != 4", nameof(code)); + + return FourCC(code[0], code[1], code[2], code[3]); + } + + /// + /// Returns used backend API name. + /// Note that stream should be opened. + /// + /// + public string GetBackendName() + { + ThrowIfDisposed(); + + using var returnString = new StdString(); + NativeMethods.HandleException( + NativeMethods.videoio_VideoWriter_getBackendName(ptr, returnString.CvPtr)); + + GC.KeepAlive(this); + return returnString.ToString(); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/wechat_qrcode/WeChatQRCode.cs b/src/OpenCvSharp/Modules/wechat_qrcode/WeChatQRCode.cs new file mode 100644 index 000000000..8d64c6555 --- /dev/null +++ b/src/OpenCvSharp/Modules/wechat_qrcode/WeChatQRCode.cs @@ -0,0 +1,106 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// WeChat QRCode includes two CNN-based models: +/// A object detection model and a super resolution model. +/// Object detection model is applied to detect QRCode with the bounding box. +/// super resolution model is applied to zoom in QRCode when it is small. +/// +public class WeChatQRCode : DisposableCvObject +{ + private Ptr? objectPtr; + + internal WeChatQRCode(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Initialize the WeChatQRCode. + /// It includes two models, which are packaged with caffe format. + /// Therefore, there are prototxt and caffe models (In total, four paramenters). + /// + /// prototxt file path for the detector + /// caffe model file path for the detector + /// prototxt file path for the super resolution model + /// caffe file path for the super resolution model + /// + /// + public static WeChatQRCode Create( + string detectorPrototxtPath, + string detectorCaffeModelPath, + string superResolutionPrototxtPath, + string superResolutionCaffeModelPath) + { + if (string.IsNullOrWhiteSpace(detectorPrototxtPath)) + throw new ArgumentException("empty string", nameof(detectorPrototxtPath)); + if (string.IsNullOrWhiteSpace(detectorCaffeModelPath)) + throw new ArgumentException("empty string", nameof(detectorCaffeModelPath)); + if (string.IsNullOrWhiteSpace(superResolutionPrototxtPath)) + throw new ArgumentException("empty string", nameof(superResolutionPrototxtPath)); + if (string.IsNullOrWhiteSpace(superResolutionCaffeModelPath)) + throw new ArgumentException("empty string", nameof(superResolutionCaffeModelPath)); + + NativeMethods.HandleException( + NativeMethods.wechat_qrcode_create1( + detectorPrototxtPath, detectorCaffeModelPath, superResolutionPrototxtPath, superResolutionCaffeModelPath, + out var ptr)); + + return new WeChatQRCode(ptr); + } + + /// + /// Both detects and decodes QR code. + /// To simplify the usage, there is a only API: detectAndDecode + /// + /// supports grayscale or color(BGR) image. + /// optional output array of vertices of the found QR code quadrangle.Will be empty if not found. + /// list of decoded string. + public void DetectAndDecode(InputArray inputImage, out Mat[] bbox, out string[] results) + { + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + inputImage.ThrowIfDisposed(); + + using var bboxVec = new VectorOfMat(); + using var texts = new VectorOfString(); + NativeMethods.HandleException( + NativeMethods.wechat_qrcode_WeChatQRCode_detectAndDecode( + ptr, inputImage.CvPtr, bboxVec.CvPtr, texts.CvPtr)); + + bbox = bboxVec.ToArray(); + results = texts.ToArray(); + GC.KeepAlive(this); + GC.KeepAlive(inputImage); + } + + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.wechat_qrcode_Ptr_WeChatQRCode_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.wechat_qrcode_Ptr_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xfeatures2d/BriefDescriptorExtractor.cs b/src/OpenCvSharp/Modules/xfeatures2d/BriefDescriptorExtractor.cs new file mode 100644 index 000000000..e1c592ec7 --- /dev/null +++ b/src/OpenCvSharp/Modules/xfeatures2d/BriefDescriptorExtractor.cs @@ -0,0 +1,81 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XFeatures2D; + +using DescriptorExtractor = Feature2D; + +/// +/// BRIEF Descriptor +/// +public class BriefDescriptorExtractor : DescriptorExtractor +{ +#pragma warning disable 1591 +// ReSharper disable InconsistentNaming + public const int PATCH_SIZE = 48; + public const int KERNEL_SIZE = 9; +// ReSharper restore InconsistentNaming +#pragma warning restore 1591 + + /// + /// cv::Ptr<T> + /// + private Ptr? ptrObj; + + //internal override IntPtr PtrObj => ptrObj.CvPtr; + + /// + /// + /// + protected BriefDescriptorExtractor() + { + } + + /// + /// Constructor + /// + /// + protected BriefDescriptorExtractor(IntPtr ptr) + { + ptrObj = new Ptr(ptr); + this.ptr = ptrObj.Get(); + } + + /// + /// bytes is a length of descriptor in bytes. It can be equal 16, 32 or 64 bytes. + /// + /// + public static BriefDescriptorExtractor Create(int bytes = 32) + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_BriefDescriptorExtractor_create(bytes, out var p)); + return new BriefDescriptorExtractor(p); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_BriefDescriptorExtractor_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_BriefDescriptorExtractor_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs b/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs new file mode 100644 index 000000000..19161cd6f --- /dev/null +++ b/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once InconsistentNaming + +namespace OpenCvSharp.XFeatures2D; + +/// +/// FREAK implementation +/// +public class FREAK : Feature2D +{ + private Ptr? ptrObj; + + /// + /// + /// + protected FREAK(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// enable orientation normalization + /// enable scale normalization + /// scaling of the description pattern + /// number of octaves covered by the detected keypoints + /// (optional) user defined selected pairs + public static FREAK Create( + bool orientationNormalized = true, + bool scaleNormalized = true, + float patternScale = 22.0f, + int nOctaves = 4, + IEnumerable? selectedPairs = null) + { + var selectedPairsArray = selectedPairs?.ToArray(); + + NativeMethods.HandleException( + NativeMethods.xfeatures2d_FREAK_create( + orientationNormalized ? 1 : 0, + scaleNormalized ? 1 : 0, patternScale, nOctaves, + selectedPairsArray, selectedPairsArray?.Length ?? 0, out var ret)); + return new FREAK(ret); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_FREAK_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_FREAK_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xfeatures2d/LATCH.cs b/src/OpenCvSharp/Modules/xfeatures2d/LATCH.cs new file mode 100644 index 000000000..14d36534b --- /dev/null +++ b/src/OpenCvSharp/Modules/xfeatures2d/LATCH.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.XFeatures2D; + +/// +/// LATCH Descriptor. +/// +/// latch Class for computing the LATCH descriptor. +/// If you find this code useful, please add a reference to the following paper in your work: +/// Gil Levi and Tal Hassner, "LATCH: Learned Arrangements of Three Patch Codes", arXiv preprint arXiv:1501.03719, 15 Jan. 2015. +/// +/// Note: a complete example can be found under /samples/cpp/tutorial_code/xfeatures2D/latch_match.cpp +/// +public class LATCH : Feature2D +{ + private Ptr? ptrObj; + + /// + /// + /// + internal LATCH(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// the size of the descriptor - can be 64, 32, 16, 8, 4, 2 or 1 + /// whether or not the descriptor should compansate for orientation changes. + /// the size of half of the mini-patches size. For example, if we would like to compare triplets of patches of size 7x7x + /// then the half_ssd_size should be (7-1)/2 = 3. + /// sigma value for GaussianBlur smoothing of the source image. Source image will be used without smoothing in case sigma value is 0. + /// Note: the descriptor can be coupled with any keypoint extractor. The only demand is that if you use set rotationInvariance = True then + /// you will have to use an extractor which estimates the patch orientation (in degrees). Examples for such extractors are ORB and SIFT. + public static LATCH Create(int bytes = 32, bool rotationInvariance = true, int halfSsdSize = 3, double sigma = 2.0) + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_LATCH_create( + bytes, rotationInvariance ? 1 : 0, halfSsdSize, sigma, out var ptr)); + return new LATCH(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_LATCH_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_LATCH_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xfeatures2d/LUCID.cs b/src/OpenCvSharp/Modules/xfeatures2d/LUCID.cs new file mode 100644 index 000000000..9ccac389e --- /dev/null +++ b/src/OpenCvSharp/Modules/xfeatures2d/LUCID.cs @@ -0,0 +1,66 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XFeatures2D; + +/// +/// Class implementing the locally uniform comparison image descriptor, described in @cite LUCID. +/// +/// An image descriptor that can be computed very fast, while being +/// about as robust as, for example, SURF or BRIEF. +/// @note It requires a color image as input. +/// +// ReSharper disable once InconsistentNaming +public class LUCID : Feature2D +{ + private Ptr? ptrObj; + + /// + /// + /// + internal LUCID(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// kernel for descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth + /// kernel for blurring image prior to descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth + public static LUCID Create(int lucidKernel = 1, int blurKernel = 2) + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_LUCID_create( + lucidKernel, blurKernel, out var ptr)); + return new LUCID(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_LUCID_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_LUCID_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs b/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs new file mode 100644 index 000000000..ef5083f95 --- /dev/null +++ b/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs @@ -0,0 +1,196 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XFeatures2D; + +/// +/// Class for extracting Speeded Up Robust Features from an image. +/// +public class SURF : Feature2D +{ + private Ptr? detectorPtr; + + #region Init & Disposal + + /// + /// Creates instance by raw pointer cv::SURF* + /// + protected SURF(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// The SURF constructor. + /// + /// Only features with keypoint.hessian larger than that are extracted. + /// The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. + /// If you want to get very large features, use the larger value. If you want just small features, decrease it. + /// The number of images within each octave of a gaussian pyramid. It is set to 2 by default. + /// false means basic descriptors (64 elements each), true means extended descriptors (128 elements each) + /// false means that detector computes orientation of each feature. + /// true means that the orientation is not computed (which is much, much faster). + public static SURF Create(double hessianThreshold, + int nOctaves = 4, int nOctaveLayers = 2, + bool extended = true, bool upright = false) + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_create( + hessianThreshold, nOctaves, nOctaveLayers, + extended ? 1 : 0, upright ? 1 : 0, out var ptr)); + return new SURF(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + #endregion + + #region Properties + + /// + /// Threshold for the keypoint detector. Only features, whose hessian is larger than hessianThreshold + /// are retained by the detector. Therefore, the larger the value, the less keypoints you will get. + /// A good default value could be from 300 to 500, depending from the image contrast. + /// + public double HessianThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_getHessianThreshold(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_setHessianThreshold(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. + /// If you want to get very large features, use the larger value. If you want just small features, decrease it. + /// + public int NOctaves + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_getNOctaves(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_setNOctaves(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// The number of images within each octave of a gaussian pyramid. It is set to 2 by default. + /// + public int NOctaveLayers + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_getNOctaveLayers(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_setNOctaveLayers(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// false means that the basic descriptors (64 elements each) shall be computed. + /// true means that the extended descriptors (128 elements each) shall be computed + /// + public bool Extended + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_getExtended(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_setExtended(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// false means that detector computes orientation of each feature. + /// true means that the orientation is not computed (which is much, much faster). + /// For example, if you match images from a stereo pair, or do image stitching, the matched features + /// likely have very similar angles, and you can speed up feature extraction by setting upright=true. + /// + public bool Upright + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_getUpright(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xfeatures2d_SURF_setUpright(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + #endregion + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_SURF_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_SURF_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs b/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs new file mode 100644 index 000000000..2005313a1 --- /dev/null +++ b/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs @@ -0,0 +1,70 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XFeatures2D; + +/// +/// The "Star" Detector +/// +public class StarDetector : Feature2D +{ + private Ptr? ptrObj; + + /// + /// + /// + internal StarDetector(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Constructor + /// + /// + /// + /// + /// + /// + public static StarDetector Create( + int maxSize = 45, + int responseThreshold = 30, + int lineThresholdProjected = 10, + int lineThresholdBinarized = 8, + int suppressNonmaxSize = 5) + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_StarDetector_create( + maxSize, responseThreshold, lineThresholdProjected, + lineThresholdBinarized, suppressNonmaxSize, out var ret)); + return new StarDetector(ret); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_StarDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xfeatures2d_Ptr_StarDetector_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/CvXImgProc.cs b/src/OpenCvSharp/Modules/ximgproc/CvXImgProc.cs new file mode 100644 index 000000000..567520926 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/CvXImgProc.cs @@ -0,0 +1,1455 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.XImgProc.Segmentation; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XImgProc; + +/// +/// cv::ximgproc functions +/// +public static class CvXImgProc +{ + /// + /// Strategy for the selective search segmentation algorithm. + /// +#pragma warning disable CA1034 // Nested types should not be visible +#pragma warning disable CA1724 // Type names should not match namespaces + public static class Segmentation +#pragma warning restore CA1034 +#pragma warning restore CA1724 + { + /// + /// Create a new color-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategyColor CreateSelectiveSearchSegmentationStrategyColor() + { + return SelectiveSearchSegmentationStrategyColor.Create(); + } + + /// + /// Create a new size-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategySize CreateSelectiveSearchSegmentationStrategySize() + { + return SelectiveSearchSegmentationStrategySize.Create(); + } + + /// + /// Create a new size-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategyTexture CreateSelectiveSearchSegmentationStrategyTexture() + { + return SelectiveSearchSegmentationStrategyTexture.Create(); + } + + /// + /// Create a new fill-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategyFill CreateSelectiveSearchSegmentationStrategyFill() + { + return SelectiveSearchSegmentationStrategyFill.Create(); + } + + /// + /// Create a new multiple strategy + /// + /// + public static SelectiveSearchSegmentationStrategyMultiple CreateSelectiveSearchSegmentationStrategyMultiple() + { + return SelectiveSearchSegmentationStrategyMultiple.Create(); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple CreateSelectiveSearchSegmentationStrategyMultiple( + SelectiveSearchSegmentationStrategy s1) + { + return SelectiveSearchSegmentationStrategyMultiple.Create(s1); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// The second strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple CreateSelectiveSearchSegmentationStrategyMultiple( + SelectiveSearchSegmentationStrategy s1, SelectiveSearchSegmentationStrategy s2) + { + return SelectiveSearchSegmentationStrategyMultiple.Create(s1, s2); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// The second strategy + /// The third strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple CreateSelectiveSearchSegmentationStrategyMultiple( + SelectiveSearchSegmentationStrategy s1, SelectiveSearchSegmentationStrategy s2, SelectiveSearchSegmentationStrategy s3) + { + return SelectiveSearchSegmentationStrategyMultiple.Create(s1, s2, s3); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// The second strategy + /// The third strategy + /// The forth strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple CreateSelectiveSearchSegmentationStrategyMultiple( + SelectiveSearchSegmentationStrategy s1, SelectiveSearchSegmentationStrategy s2, SelectiveSearchSegmentationStrategy s3, SelectiveSearchSegmentationStrategy s4) + { + return SelectiveSearchSegmentationStrategyMultiple.Create(s1, s2, s3, s4); + } + } + + /// + /// run_length_morphology.hpp + /// +#pragma warning disable CA1034 // Nested types should not be visible + public static class RL +#pragma warning restore CA1034 + { + /// + /// Applies a fixed-level threshold to each array element. + /// + /// input array (single-channel). + /// resulting run length encoded image. + /// threshold value. + /// thresholding type (only cv::THRESH_BINARY and cv::THRESH_BINARY_INV are supported) + public static void Threshold(InputArray src, OutputArray rlDest, double thresh, ThresholdTypes type) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (rlDest is null) + throw new ArgumentNullException(nameof(rlDest)); + src.ThrowIfDisposed(); + rlDest.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_threshold(src.CvPtr, rlDest.CvPtr, thresh, (int)type)); + + GC.KeepAlive(src); + rlDest.Fix(); + } + + /// + /// Dilates an run-length encoded binary image by using a specific structuring element. + /// + /// input image + /// result + /// kernel + /// position of the anchor within the element; default value (0, 0) is usually the element center. + public static void Dilate( + InputArray rlSrc, OutputArray rlDest, InputArray rlKernel, Point? anchor = null) + { + if (rlSrc is null) + throw new ArgumentNullException(nameof(rlSrc)); + if (rlDest is null) + throw new ArgumentNullException(nameof(rlDest)); + if (rlKernel is null) + throw new ArgumentNullException(nameof(rlKernel)); + rlSrc.ThrowIfDisposed(); + rlDest.ThrowIfNotReady(); + rlKernel.ThrowIfDisposed(); + + var anchorValue = anchor.GetValueOrDefault(new Point(0, 0)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_dilate(rlSrc.CvPtr, rlDest.CvPtr, rlKernel.CvPtr, anchorValue)); + + GC.KeepAlive(rlSrc); + rlDest.Fix(); + GC.KeepAlive(rlKernel); + } + + /// + /// Erodes an run-length encoded binary image by using a specific structuring element. + /// + /// input image + /// result + /// kernel + /// indicates whether pixel outside the image boundary are assumed to be on + /// (True: works in the same way as the default of cv::erode, False: is a little faster) + /// position of the anchor within the element; default value (0, 0) + /// is usually the element center. + public static void Erode( + InputArray rlSrc, OutputArray rlDest, InputArray rlKernel, bool bBoundaryOn = true, Point? anchor = null) + { + if (rlSrc is null) + throw new ArgumentNullException(nameof(rlSrc)); + if (rlDest is null) + throw new ArgumentNullException(nameof(rlDest)); + if (rlKernel is null) + throw new ArgumentNullException(nameof(rlKernel)); + rlSrc.ThrowIfDisposed(); + rlDest.ThrowIfNotReady(); + rlKernel.ThrowIfDisposed(); + + var anchorValue = anchor.GetValueOrDefault(new Point(0, 0)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_erode(rlSrc.CvPtr, rlDest.CvPtr, rlKernel.CvPtr, bBoundaryOn ? 1 : 0, anchorValue)); + + GC.KeepAlive(rlSrc); + rlDest.Fix(); + GC.KeepAlive(rlKernel); + } + + /// + /// Returns a run length encoded structuring element of the specified size and shape. + /// + /// Element shape that can be one of cv::MorphShapes + /// Size of the structuring element. + /// + public static Mat GetStructuringElement(MorphShapes shape, Size ksize) + { + var ret = new Mat(); + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_getStructuringElement((int)shape, ksize, ret.CvPtr)); + return ret; + } + + /// + /// Paint run length encoded binary image into an image. + /// + /// image to paint into (currently only single channel images). + /// run length encoded image + /// all foreground pixel of the binary image are set to this value + public static void Paint(InputOutputArray image, InputArray rlSrc, Scalar value) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (rlSrc is null) + throw new ArgumentNullException(nameof(rlSrc)); + image.ThrowIfNotReady(); + rlSrc.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_paint(image.CvPtr, rlSrc.CvPtr, value)); + + image.Fix(); + GC.KeepAlive(rlSrc); + } + + /// + /// Check whether a custom-made structuring element can be used with run length morphological operations. + /// (It must consist of a continuous array of single runs per row) + /// + /// + /// + public static bool IsRLMorphologyPossible(InputArray rlStructuringElement) + { + if (rlStructuringElement is null) + throw new ArgumentNullException(nameof(rlStructuringElement)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_isRLMorphologyPossible(rlStructuringElement.CvPtr, out var ret)); + + GC.KeepAlive(rlStructuringElement); + + return ret != 0; + } + + /// + /// Creates a run-length encoded image from a vector of runs (column begin, column end, row) + /// + /// vector of runs + /// result + /// image size (to be used if an "on" boundary should be used in erosion, using the default + /// means that the size is computed from the extension of the input) + public static void CreateRLEImage(IEnumerable runs, OutputArray res, Size? size = null) + { + if (res is null) + throw new ArgumentNullException(nameof(res)); + res.ThrowIfNotReady(); + + var runsArray = runs as Point3i[] ?? runs.ToArray(); + var sizeValue = size.GetValueOrDefault(new Size(0, 0)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_createRLEImage(runsArray, runsArray.Length, res.CvPtr, sizeValue)); + + res.Fix(); + } + + /// + /// Applies a morphological operation to a run-length encoded binary image. + /// + /// input image + /// result + /// all operations supported by cv::morphologyEx (except cv::MORPH_HITMISS) + /// kernel + /// indicates whether pixel outside the image boundary are assumed + /// to be on for erosion operations (True: works in the same way as the default of cv::erode, False: is a little faster) + /// position of the anchor within the element; default value (0, 0) is usually the element center. + public static void MorphologyEx( + InputArray rlSrc, OutputArray rlDest, MorphTypes op, InputArray rlKernel, + bool bBoundaryOnForErosion = true, Point? anchor = null) + { + if (rlSrc is null) + throw new ArgumentNullException(nameof(rlSrc)); + if (rlDest is null) + throw new ArgumentNullException(nameof(rlDest)); + if (rlKernel is null) + throw new ArgumentNullException(nameof(rlKernel)); + rlSrc.ThrowIfDisposed(); + rlDest.ThrowIfNotReady(); + rlKernel.ThrowIfDisposed(); + + var anchorValue = anchor.GetValueOrDefault(new Point(0, 0)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rl_morphologyEx(rlSrc.CvPtr, rlDest.CvPtr, (int)op, rlKernel.CvPtr, bBoundaryOnForErosion ? 1 : 0, anchorValue)); + + GC.KeepAlive(rlSrc); + rlDest.Fix(); + GC.KeepAlive(rlKernel); + } + } + + /// + /// Applies Niblack thresholding to input image. + /// + /// T(x, y)\)}{0}{otherwise}\f] + /// - ** THRESH_BINARY_INV** + /// \f[dst(x, y) = \fork{0}{if \(src(x, y) > T(x, y)\)}{\texttt{maxValue}}{otherwise}\f] + /// where \f$T(x, y)\f$ is a threshold calculated individually for each pixel. + /// The threshold value \f$T(x, y)\f$ is the mean minus \f$ delta \f$ times standard deviation + /// of \f$\texttt{blockSize} \times\texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$. + /// The function can't process the image in-place. + /// ]]> + /// Source 8-bit single-channel image. + /// Destination image of the same size and the same type as src. + /// Non-zero value assigned to the pixels for which the condition is satisfied, + /// used with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. + /// Thresholding type, see cv::ThresholdTypes. + /// Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. + /// The user-adjustable parameter used by Niblack and inspired techniques.For Niblack, + /// this is normally a value between 0 and 1 that is multiplied with the standard deviation and subtracted from the mean. + /// Binarization method to use. By default, Niblack's technique is used. + /// Other techniques can be specified, see cv::ximgproc::LocalBinarizationMethods. + /// The user-adjustable parameter used by Sauvola's technique. This is the dynamic range of standard deviation. + public static void NiblackThreshold( + InputArray src, + OutputArray dst, + double maxValue, + ThresholdTypes type, + int blockSize, + double k, + LocalBinarizationMethods binarizationMethod = LocalBinarizationMethods.Niblack, + double r = 128) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_niBlackThreshold(src.CvPtr, dst.CvPtr, maxValue, (int)type, blockSize, k, (int)binarizationMethod, r)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies a binary blob thinning operation, to achieve a skeletization of the input image. + /// The function transforms a binary blob image into a skeletized form using the technique of Zhang-Suen. + /// + /// Source 8-bit single-channel image, containing binary blobs, with blobs having 255 pixel values. + /// Destination image of the same size and the same type as src. The function can work in-place. + /// Value that defines which thinning algorithm should be used. + public static void Thinning( + InputArray src, OutputArray dst, + ThinningTypes thinningType = ThinningTypes.ZHANGSUEN) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_thinning(src.CvPtr, dst.CvPtr, (int)thinningType)); + + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Performs anisotropic diffusian on an image. + /// The function applies Perona-Malik anisotropic diffusion to an image. + /// + /// Grayscale Source image. + /// Destination image of the same size and the same number of channels as src. + /// The amount of time to step forward by on each iteration (normally, it's between 0 and 1). + /// sensitivity to the edges + /// The number of iterations + public static void AnisotropicDiffusion(InputArray src, OutputArray dst, float alpha, float k, int niters) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_anisotropicDiffusion(src.CvPtr, dst.CvPtr, alpha, k, niters)); + + GC.KeepAlive(src); + dst.Fix(); + } + + #region brightedges.hpp + + /// + /// + /// + /// + /// + /// + /// + /// + public static void BrightEdges(Mat original, Mat edgeView, int contrast = 1, int shortRange = 3, int longRange = 9) + { + if (original is null) + throw new ArgumentNullException(nameof(original)); + if (edgeView is null) + throw new ArgumentNullException(nameof(edgeView)); + original.ThrowIfDisposed(); + edgeView.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_BrightEdges(original.CvPtr, edgeView.CvPtr, contrast, shortRange, longRange)); + + GC.KeepAlive(original); + GC.KeepAlive(edgeView); + } + + #endregion + + #region color_match.hpp + + /// + /// creates a quaternion image. + /// + /// Source 8-bit, 32-bit or 64-bit image, with 3-channel image. + /// result CV_64FC4 a quaternion image( 4 chanels zero channel and B,G,R). + public static void CreateQuaternionImage(InputArray img, OutputArray qimg) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (qimg is null) + throw new ArgumentNullException(nameof(qimg)); + img.ThrowIfDisposed(); + qimg.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createQuaternionImage(img.CvPtr, qimg.CvPtr)); + + GC.KeepAlive(img); + qimg.Fix(); + } + + /// + /// calculates conjugate of a quaternion image. + /// + /// quaternion image. + /// conjugate of qimg + public static void QConj(InputArray qimg, OutputArray qcimg) + { + if (qimg is null) + throw new ArgumentNullException(nameof(qimg)); + if (qcimg is null) + throw new ArgumentNullException(nameof(qcimg)); + qimg.ThrowIfDisposed(); + qcimg.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_qconj(qimg.CvPtr, qcimg.CvPtr)); + + GC.KeepAlive(qimg); + qcimg.Fix(); + } + + /// + /// divides each element by its modulus. + /// + /// quaternion image. + /// conjugate of qimg + public static void QUnitary(InputArray qimg, OutputArray qnimg) + { + if (qimg is null) + throw new ArgumentNullException(nameof(qimg)); + if (qnimg is null) + throw new ArgumentNullException(nameof(qnimg)); + qimg.ThrowIfDisposed(); + qnimg.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_qunitary(qimg.CvPtr, qnimg.CvPtr)); + + GC.KeepAlive(qimg); + qnimg.Fix(); + } + + /// + /// Calculates the per-element quaternion product of two arrays + /// + /// quaternion image. + /// quaternion image. + /// product dst(I)=src1(I) . src2(I) + public static void QMultiply(InputArray src1, InputArray src2, OutputArray dst) + { + if (src1 is null) + throw new ArgumentNullException(nameof(src1)); + if (src2 is null) + throw new ArgumentNullException(nameof(src2)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src1.ThrowIfDisposed(); + src2.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_qmultiply(src1.CvPtr, src2.CvPtr, dst.CvPtr)); + + GC.KeepAlive(src1); + GC.KeepAlive(src2); + dst.Fix(); + } + + /// + /// Performs a forward or inverse Discrete quaternion Fourier transform of a 2D quaternion array. + /// + /// quaternion image. + /// quaternion image in dual space. + /// quaternion image in dual space. only DFT_INVERSE flags is supported + /// true the hypercomplex exponential is to be multiplied on the left (false on the right ). + public static void QDft(InputArray img, OutputArray qimg, DftFlags flags, bool sideLeft) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (qimg is null) + throw new ArgumentNullException(nameof(qimg)); + img.ThrowIfDisposed(); + qimg.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_qdft(img.CvPtr, qimg.CvPtr, (int)flags, sideLeft ? 1 : 0)); + + GC.KeepAlive(img); + qimg.Fix(); + } + + /// + /// Compares a color template against overlapped color image regions. + /// + /// Image where the search is running. It must be 3 channels image + /// Searched template. It must be not greater than the source image and have 3 channels + /// Map of comparison results. It must be single-channel 64-bit floating-point + public static void ColorMatchTemplate(InputArray img, InputArray templ, OutputArray result) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (templ is null) + throw new ArgumentNullException(nameof(templ)); + if (result is null) + throw new ArgumentNullException(nameof(result)); + img.ThrowIfDisposed(); + templ.ThrowIfDisposed(); + result.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_colorMatchTemplate(img.CvPtr, templ.CvPtr, result.CvPtr)); + + GC.KeepAlive(img); + GC.KeepAlive(templ); + result.Fix(); + } + + #endregion + + #region deriche_filter.hpp + + /// + /// Applies Y Deriche filter to an image. + /// + /// Source 8-bit or 16bit image, 1-channel or 3-channel image. + /// result CV_32FC image with same number of channel than _op. + /// double see paper + /// double see paper + public static void GradientDericheY(InputArray op, OutputArray dst, double alpha, double omega) + { + if (op is null) + throw new ArgumentNullException(nameof(op)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + op.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_GradientDericheY(op.CvPtr, dst.CvPtr, alpha, omega)); + + GC.KeepAlive(op); + dst.Fix(); + } + + /// + /// Applies X Deriche filter to an image. + /// + /// Source 8-bit or 16bit image, 1-channel or 3-channel image. + /// result CV_32FC image with same number of channel than _op. + /// double see paper + /// double see paper + public static void GradientDericheX(InputArray op, OutputArray dst, double alpha, double omega) + { + if (op is null) + throw new ArgumentNullException(nameof(op)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + op.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_GradientDericheX(op.CvPtr, dst.CvPtr, alpha, omega)); + + GC.KeepAlive(op); + dst.Fix(); + } + + #endregion + + #region edgeboxes.hpp + + /// + /// Creates a EdgeBoxes + /// + /// step size of sliding window search. + /// nms threshold for object proposals. + /// adaptation rate for nms threshold. + /// min score of boxes to detect. + /// max number of boxes to detect. + /// edge min magnitude. Increase to trade off accuracy for speed. + /// edge merge threshold. Increase to trade off accuracy for speed. + /// cluster min magnitude. Increase to trade off accuracy for speed. + /// max aspect ratio of boxes. + /// minimum area of boxes. + /// affinity sensitivity. + /// scale sensitivity. + /// + public static EdgeBoxes CreateEdgeBoxes( + float alpha = 0.65f, + float beta = 0.75f, + float eta = 1, + float minScore = 0.01f, + int maxBoxes = 10000, + float edgeMinMag = 0.1f, + float edgeMergeThr = 0.5f, + float clusterMinMag = 0.5f, + float maxAspectRatio = 3, + float minBoxArea = 1000, + float gamma = 2, + float kappa = 1.5f) + { + return EdgeBoxes.Create( + alpha, beta, eta, minScore, maxBoxes, edgeMinMag, edgeMergeThr, + clusterMinMag, maxAspectRatio, minBoxArea, gamma, kappa); + } + + #endregion + + #region edge_filter.hpp + + /// + /// Factory method, create instance of DTFilter and produce initialization routines. + /// + /// guided image (used to build transformed distance, which describes edge structure of + /// guided image). + /// sigma_H parameter in the original article, it's similar to the sigma in the + /// coordinate space into bilateralFilter. + /// sigma_r parameter in the original article, it's similar to the sigma in the + /// color space into bilateralFilter. + /// one form three modes DTF_NC, DTF_RF and DTF_IC which corresponds to three modes for + /// filtering 2D signals in the article. + /// optional number of iterations used for filtering, 3 is quite enough. + /// + // ReSharper disable once InconsistentNaming + public static DTFilter CreateDTFilter( + InputArray guide, double sigmaSpatial, double sigmaColor, + EdgeAwareFiltersList mode = EdgeAwareFiltersList.DTF_NC, int numIters = 3) + { + return XImgProc.DTFilter.Create(guide, sigmaSpatial, sigmaColor, mode, numIters); + } + + /// + /// Simple one-line Domain Transform filter call. If you have multiple images to filter with the same + /// guided image then use DTFilter interface to avoid extra computations on initialization stage. + /// + /// guided image (also called as joint image) with unsigned 8-bit or floating-point 32-bit + /// depth and up to 4 channels. + /// filtering image with unsigned 8-bit or floating-point 32-bit depth and up to 4 channels. + /// destination image + /// sigma_H parameter in the original article, it's similar to the sigma in the + /// coordinate space into bilateralFilter. + /// sigma_r parameter in the original article, it's similar to the sigma in the + /// color space into bilateralFilter. + /// one form three modes DTF_NC, DTF_RF and DTF_IC which corresponds to three modes for + /// filtering 2D signals in the article. + /// optional number of iterations used for filtering, 3 is quite enough. + // ReSharper disable once InconsistentNaming + public static void DTFilter(InputArray guide, InputArray src, OutputArray dst, double sigmaSpatial, + double sigmaColor, EdgeAwareFiltersList mode = EdgeAwareFiltersList.DTF_NC, int numIters = 3) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + guide.ThrowIfDisposed(); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_dtFilter(guide.CvPtr, src.CvPtr, dst.CvPtr, sigmaSpatial, sigmaColor, (int)mode, numIters)); + + GC.KeepAlive(guide); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Factory method, create instance of GuidedFilter and produce initialization routines. + /// + /// guided image (or array of images) with up to 3 channels, if it have more then 3 + /// channels then only first 3 channels will be used. + /// radius of Guided Filter. + /// regularization term of Guided Filter. eps^2 is similar to the sigma in the color + /// space into bilateralFilter. + /// + public static GuidedFilter CreateGuidedFilter( + InputArray guide, int radius, double eps) + { + return XImgProc.GuidedFilter.Create(guide, radius, eps); + } + + /// + /// Simple one-line Guided Filter call. + /// + /// If you have multiple images to filter with the same guided image then use GuidedFilter interface to + /// avoid extra computations on initialization stage. + /// + /// guided image (or array of images) with up to 3 channels, if it have more then 3 + /// channels then only first 3 channels will be used. + /// filtering image with any numbers of channels. + /// output image. + /// radius of Guided Filter. + /// regularization term of Guided Filter. eps^2 is similar to the sigma in the color + /// space into bilateralFilter. + /// optional depth of the output image. + public static void GuidedFilter( + InputArray guide, InputArray src, OutputArray dst, + int radius, double eps, int dDepth = -1) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + guide.ThrowIfDisposed(); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_guidedFilter(guide.CvPtr, src.CvPtr, dst.CvPtr, radius, eps, dDepth)); + + GC.KeepAlive(guide); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Factory method, create instance of AdaptiveManifoldFilter and produce some initialization routines. + /// + /// spatial standard deviation. + /// color space standard deviation, it is similar to the sigma in the color space into + /// bilateralFilter. + /// optional, specify perform outliers adjust operation or not, (Eq. 9) in the + /// original paper. + /// + // ReSharper disable once InconsistentNaming + public static AdaptiveManifoldFilter CreateAMFilter( + double sigmaS, double sigmaR, bool adjustOutliers = false) + { + return AdaptiveManifoldFilter.Create(sigmaS, sigmaR, adjustOutliers); + } + + /// + /// Simple one-line Adaptive Manifold Filter call. + /// + /// joint (also called as guided) image or array of images with any numbers of channels. + /// filtering image with any numbers of channels. + /// output image. + /// spatial standard deviation. + /// color space standard deviation, it is similar to the sigma in the color space into + /// bilateralFilter. + /// optional, specify perform outliers adjust operation or not, (Eq. 9) in the + /// original paper. + // ReSharper disable once InconsistentNaming + public static void AMFilter( + InputArray joint, InputArray src, OutputArray dst, double sigmaS, double sigmaR, + bool adjustOutliers = false) + { + if (joint is null) + throw new ArgumentNullException(nameof(joint)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + joint.ThrowIfDisposed(); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_amFilter(joint.CvPtr, src.CvPtr, dst.CvPtr, sigmaS, sigmaR, adjustOutliers ? 1 : 0)); + + GC.KeepAlive(joint); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Applies the joint bilateral filter to an image. + /// + /// Joint 8-bit or floating-point, 1-channel or 3-channel image. + /// Source 8-bit or floating-point, 1-channel or 3-channel image with the same depth as joint image. + /// Destination image of the same size and type as src. + /// Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, + /// it is computed from sigmaSpace. + /// Filter sigma in the color space. A larger value of the parameter means that + /// farther colors within the pixel neighborhood(see sigmaSpace) will be mixed together, resulting in + /// larger areas of semi-equal color. + /// Filter sigma in the coordinate space. A larger value of the parameter means that + /// farther pixels will influence each other as long as their colors are close enough(see sigmaColor). + /// When d\>0 , it specifies the neighborhood size regardless of sigmaSpace.Otherwise, d is + /// proportional to sigmaSpace. + /// + public static void JointBilateralFilter( + InputArray joint, InputArray src, OutputArray dst, int d, + double sigmaColor, double sigmaSpace, BorderTypes borderType = BorderTypes.Default) + { + if (joint is null) + throw new ArgumentNullException(nameof(joint)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + joint.ThrowIfDisposed(); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_jointBilateralFilter( + joint.CvPtr, src.CvPtr, dst.CvPtr, d, sigmaColor, sigmaSpace, (int)borderType)); + + GC.KeepAlive(joint); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Applies the bilateral texture filter to an image. It performs structure-preserving texture filter. + /// For more details about this filter see @cite Cho2014. + /// + /// Source image whose depth is 8-bit UINT or 32-bit FLOAT + /// Destination image of the same size and type as src. + /// Radius of kernel to be used for filtering. It should be positive integer + /// Number of iterations of algorithm, It should be positive integer + /// Controls the sharpness of the weight transition from edges to smooth/texture regions, where + /// a bigger value means sharper transition.When the value is negative, it is automatically calculated. + /// Range blur parameter for texture blurring. Larger value makes result to be more blurred. When the + /// value is negative, it is automatically calculated as described in the paper. + public static void BilateralTextureFilter( + InputArray src, OutputArray dst, int fr = 3, int numIter = 1, double sigmaAlpha = -1.0, double sigmaAvg = -1.0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_bilateralTextureFilter( + src.CvPtr, dst.CvPtr, fr, numIter, sigmaAlpha, sigmaAvg)); + + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Applies the rolling guidance filter to an image. + /// + /// 8-bit or floating-point, 1-channel or 3-channel image. + /// Destination image of the same size and type as src. + /// Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, + /// it is computed from sigmaSpace. + /// Filter sigma in the color space. A larger value of the parameter means that + /// farther colors within the pixel neighborhood(see sigmaSpace) will be mixed together, resulting in + /// larger areas of semi-equal color. + /// Filter sigma in the coordinate space. A larger value of the parameter means that + /// farther pixels will influence each other as long as their colors are close enough(see sigmaColor). + /// When d\>0 , it specifies the neighborhood size regardless of sigmaSpace.Otherwise, d is + /// proportional to sigmaSpace. + /// Number of iterations of joint edge-preserving filtering applied on the source image. + /// + public static void RollingGuidanceFilter( + InputArray src, OutputArray dst, int d = -1, double sigmaColor = 25, + double sigmaSpace = 3, int numOfIter = 4, BorderTypes borderType = BorderTypes.Default) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_rollingGuidanceFilter( + src.CvPtr, dst.CvPtr, d, sigmaColor, sigmaSpace, numOfIter, (int)borderType)); + + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Simple one-line Fast Bilateral Solver filter call. If you have multiple images to filter with the same + /// guide then use FastBilateralSolverFilter interface to avoid extra computations. + /// + /// image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels. + /// source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 4 channels. + /// confidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel. + /// destination image. + /// parameter, that is similar to spatial space sigma (bandwidth) in bilateralFilter. + /// parameter, that is similar to luma space sigma (bandwidth) in bilateralFilter. + /// parameter, that is similar to chroma space sigma (bandwidth) in bilateralFilter. + /// smoothness strength parameter for solver. + /// number of iterations used for solver, 25 is usually enough. + /// convergence tolerance used for solver. + public static void FastBilateralSolverFilter( + InputArray guide, InputArray src, InputArray confidence, + OutputArray dst, double sigmaSpatial = 8, double sigmaLuma = 8, double sigmaChroma = 8, + double lambda = 128.0, int numIter = 25, double maxTol = 1e-5) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (confidence is null) + throw new ArgumentNullException(nameof(confidence)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + guide.ThrowIfDisposed(); + src.ThrowIfDisposed(); + confidence.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_fastBilateralSolverFilter( + guide.CvPtr, src.CvPtr, confidence.CvPtr, dst.CvPtr, sigmaSpatial, sigmaLuma, sigmaChroma, lambda, numIter, maxTol)); + + GC.KeepAlive(guide); + GC.KeepAlive(src); + GC.KeepAlive(confidence); + dst.Fix(); + } + + /// + /// Factory method, create instance of FastGlobalSmootherFilter and execute the initialization routines. + /// + /// image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels. + /// parameter defining the amount of regularization + /// parameter, that is similar to color space sigma in bilateralFilter. + /// internal parameter, defining how much lambda decreases after each iteration. Normally, + /// it should be 0.25. Setting it to 1.0 may lead to streaking artifacts. + /// number of iterations used for filtering, 3 is usually enough. + /// + public static FastGlobalSmootherFilter CreateFastGlobalSmootherFilter( + InputArray guide, double lambda, double sigmaColor, double lambdaAttenuation = 0.25, int numIter = 3) + { + return XImgProc.FastGlobalSmootherFilter.Create(guide, lambda, sigmaColor, lambdaAttenuation, numIter); + } + + /// + /// Simple one-line Fast Global Smoother filter call. If you have multiple images to filter with the same + /// guide then use FastGlobalSmootherFilter interface to avoid extra computations. + /// + /// image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels. + /// source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 4 channels. + /// destination image. + /// parameter defining the amount of regularization + /// parameter, that is similar to color space sigma in bilateralFilter. + /// internal parameter, defining how much lambda decreases after each iteration. Normally, + /// it should be 0.25. Setting it to 1.0 may lead to streaking artifacts. + /// number of iterations used for filtering, 3 is usually enough. + public static void FastGlobalSmootherFilter( + InputArray guide, InputArray src, OutputArray dst, double lambda, double sigmaColor, + double lambdaAttenuation = 0.25, int numIter = 3) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + guide.ThrowIfDisposed(); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_fastGlobalSmootherFilter( + guide.CvPtr, src.CvPtr, dst.CvPtr, lambda, sigmaColor, lambdaAttenuation, numIter)); + + GC.KeepAlive(guide); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// Global image smoothing via L0 gradient minimization. + /// + /// source image for filtering with unsigned 8-bit or signed 16-bit or floating-point depth. + /// destination image. + /// parameter defining the smooth term weight. + /// parameter defining the increasing factor of the weight of the gradient data term. + public static void L0Smooth(InputArray src, OutputArray dst, double lambda = 0.02, double kappa = 2.0) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_l0Smooth( + src.CvPtr, dst.CvPtr, lambda, kappa)); + + GC.KeepAlive(src); + dst.Fix(); + } + + #endregion + + #region edgepreserving_filter.hpp + + /// + /// Smoothes an image using the Edge-Preserving filter. + /// + /// Source 8-bit 3-channel image. + /// Destination image of the same size and type as src. + /// Diameter of each pixel neighborhood that is used during filtering. Must be greater or equal 3. + /// Threshold, which distinguishes between noise, outliers, and data. + public static void EdgePreservingFilter(InputArray src, OutputArray dst, int d, double threshold) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_edgePreservingFilter(src.CvPtr, dst.CvPtr, d, threshold)); + + GC.KeepAlive(src); + dst.Fix(); + } + + #endregion + + #region estimated_covariance.hpp + + /// + /// Computes the estimated covariance matrix of an image using the sliding window forumlation. + /// + /// + /// The window size parameters control the accuracy of the estimation. + /// The sliding window moves over the entire image from the top-left corner + /// to the bottom right corner.Each location of the window represents a sample. + /// If the window is the size of the image, then this gives the exact covariance matrix. + /// For all other cases, the sizes of the window will impact the number of samples + /// and the number of elements in the estimated covariance matrix. + /// + /// The source image. Input image must be of a complex type. + /// The destination estimated covariance matrix. Output matrix will be size (windowRows*windowCols, windowRows*windowCols). + /// The number of rows in the window. + /// The number of cols in the window. + public static void CovarianceEstimation(InputArray src, OutputArray dst, int windowRows, int windowCols) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_covarianceEstimation(src.CvPtr, dst.CvPtr, windowRows, windowCols)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + #endregion + + #region fast_hough_transform.hpp + + /// + /// Calculates 2D Fast Hough transform of an image. + /// + /// The source (input) image. + /// The destination image, result of transformation. + /// The depth of destination image + /// The part of Hough space to calculate, see cv::AngleRangeOption + /// The operation to be applied, see cv::HoughOp + /// Specifies to do or not to do image skewing, see cv::HoughDeskewOption + public static void FastHoughTransform( + InputArray src, + OutputArray dst, + MatType dstMatDepth, + AngleRangeOption angleRange = AngleRangeOption.ARO_315_135, + HoughOP op = HoughOP.FHT_ADD, + HoughDeskewOption makeSkew = HoughDeskewOption.DESKEW) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_FastHoughTransform(src.CvPtr, dst.CvPtr, dstMatDepth, (int)angleRange, (int)op, (int)makeSkew)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Calculates coordinates of line segment corresponded by point in Hough space. + /// + /// + /// If rules parameter set to RO_STRICT then returned line cut along the border of source image. + /// If rules parameter set to RO_WEAK then in case of point, which belongs + /// the incorrect part of Hough image, returned line will not intersect source image. + /// + /// Point in Hough space. + /// The source (input) image of Hough transform. + /// The part of Hough space where point is situated, see cv::AngleRangeOption + /// Specifies to do or not to do image skewing, see cv::HoughDeskewOption + /// Specifies strictness of line segment calculating, see cv::RulesOption + /// Coordinates of line segment corresponded by point in Hough space. + public static Vec4i HoughPoint2Line( + Point houghPoint, + InputArray srcImgInfo, + AngleRangeOption angleRange = AngleRangeOption.ARO_315_135, + HoughDeskewOption makeSkew = HoughDeskewOption.DESKEW, + RulesOption rules = RulesOption.IGNORE_BORDERS) + { + if (srcImgInfo is null) + throw new ArgumentNullException(nameof(srcImgInfo)); + srcImgInfo.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_HoughPoint2Line(houghPoint, srcImgInfo.CvPtr, (int)angleRange, (int)makeSkew, (int)rules, out Vec4i ret)); + GC.KeepAlive(srcImgInfo); + return ret; + } + + #endregion + + #region fast_line_detector.hpp + + /// + /// Creates a smart pointer to a FastLineDetector object and initializes it + /// + /// Segment shorter than this will be discarded + /// A point placed from a hypothesis line segment farther than + /// this will be regarded as an outlier + /// First threshold for hysteresis procedure in Canny() + /// Second threshold for hysteresis procedure in Canny() + /// Aperture size for the sobel operator in Canny() + /// If true, incremental merging of segments will be performed + /// + public static FastLineDetector CreateFastLineDetector( + int lengthThreshold = 10, float distanceThreshold = 1.414213562f, + double cannyTh1 = 50.0, double cannyTh2 = 50.0, int cannyApertureSize = 3, + bool doMerge = false) + { + return FastLineDetector.Create(lengthThreshold, distanceThreshold, cannyTh1, cannyTh2, cannyApertureSize, doMerge); + } + + #endregion + + #region lsc.hpp + + /// + /// Class implementing the LSC (Linear Spectral Clustering) superpixels. + /// + /// The function initializes a SuperpixelLSC object for the input image. It sets the parameters of + /// superpixel algorithm, which are: region_size and ruler.It preallocate some buffers for future + /// computing iterations over the given image.An example of LSC is illustrated in the following picture. + /// For enhanced results it is recommended for color images to preprocess image with little gaussian blur + /// with a small 3 x 3 kernel and additional conversion into CieLAB color space. + /// + /// image Image to segment + /// Chooses an average superpixel size measured in pixels + /// Chooses the enforcement of superpixel compactness factor of superpixel + /// + // ReSharper disable once InconsistentNaming + public static SuperpixelLSC CreateSuperpixelLSC(InputArray image, int regionSize = 10, float ratio = 0.075f) + { + return SuperpixelLSC.Create(image, regionSize, ratio); + } + + #endregion + + #region paillou_filter.hpp + + /// + /// Applies Paillou filter to an image. + /// + /// Source CV_8U(S) or CV_16U(S), 1-channel or 3-channels image. + /// Result CV_32F image with same number of channel than op. + /// double see paper + /// double see paper + public static void GradientPaillouY(InputArray op, OutputArray dst, double alpha, double omega) + { + if (op is null) + throw new ArgumentNullException(nameof(op)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + op.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_GradientPaillouY(op.CvPtr, dst.CvPtr, alpha, omega)); + + GC.KeepAlive(op); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Applies Paillou filter to an image. + /// + /// Source CV_8U(S) or CV_16U(S), 1-channel or 3-channels image. + /// Result CV_32F image with same number of channel than op. + /// double see paper + /// double see paper + public static void GradientPaillouX(InputArray op, OutputArray dst, double alpha, double omega) + { + if (op is null) + throw new ArgumentNullException(nameof(op)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + op.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_GradientPaillouX(op.CvPtr, dst.CvPtr, alpha, omega)); + + GC.KeepAlive(op); + GC.KeepAlive(dst); + dst.Fix(); + } + + #endregion + + #region peilin.hpp + + /// + /// Calculates an affine transformation that normalize given image using Pei&Lin Normalization. + /// + /// Given transformed image. + /// Transformation matrix corresponding to inversed image transformation + public static double[,] PeiLinNormalization(InputArray i) + { + if (i is null) + throw new ArgumentNullException(nameof(i)); + i.ThrowIfDisposed(); + + double[,] ret = new double[2, 3]; + unsafe + { + fixed (double* retPointer = ret) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_PeiLinNormalization_Mat23d(i.CvPtr, retPointer)); + } + } + + GC.KeepAlive(i); + return ret; + } + + /// + /// Calculates an affine transformation that normalize given image using Pei&Lin Normalization. + /// + /// Given transformed image. + /// Inversed image transformation. + public static void PeiLinNormalization(InputArray i, OutputArray t) + { + if (i is null) + throw new ArgumentNullException(nameof(i)); + if (t is null) + throw new ArgumentNullException(nameof(t)); + i.ThrowIfDisposed(); + t.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_PeiLinNormalization_OutputArray(i.CvPtr, t.CvPtr)); + + GC.KeepAlive(i); + t.Fix(); + } + + #endregion + + #region seeds.hpp + + /// + /// Initializes a SuperpixelSEEDS object. + /// + /// The function initializes a SuperpixelSEEDS object for the input image. It stores the parameters of + /// the image: image_width, image_height and image_channels.It also sets the parameters of the SEEDS + /// superpixel algorithm, which are: num_superpixels, num_levels, use_prior, histogram_bins and + /// double_step. + /// + /// The number of levels in num_levels defines the amount of block levels that the algorithm use in the + /// optimization.The initialization is a grid, in which the superpixels are equally distributed through + /// the width and the height of the image.The larger blocks correspond to the superpixel size, and the + /// levels with smaller blocks are formed by dividing the larger blocks into 2 x 2 blocks of pixels, + /// recursively until the smaller block level. An example of initialization of 4 block levels is + /// illustrated in the following figure. + /// + /// Image width. + /// Image height. + /// Number of channels of the image. + /// Desired number of superpixels. Note that the actual number may be smaller + /// due to restrictions(depending on the image size and num_levels). Use getNumberOfSuperpixels() to + /// get the actual number. + /// Number of block levels. The more levels, the more accurate is the segmentation, + /// but needs more memory and CPU time. + /// enable 3x3 shape smoothing term if \>0. A larger value leads to smoother shapes. prior + /// must be in the range[0, 5]. + /// Number of histogram bins. + /// If true, iterate each block level twice for higher accuracy. + /// + // ReSharper disable once InconsistentNaming + public static SuperpixelSEEDS CreateSuperpixelSEEDS( + int imageWidth, int imageHeight, int imageChannels, + int numSuperpixels, int numLevels, int prior = 2, + int histogramBins = 5, bool doubleStep = false) + { + return SuperpixelSEEDS.Create( + imageWidth, imageHeight, imageChannels, numSuperpixels, numLevels, prior, histogramBins, doubleStep); + } + + #endregion + + #region structured_edge_detection.hpp + + /// + /// Creates a RFFeatureGetter + /// + /// + // ReSharper disable once InconsistentNaming + public static RFFeatureGetter CreateRFFeatureGetter() + { + return RFFeatureGetter.Create(); + } + + /// + /// Creates a StructuredEdgeDetection + /// + /// name of the file where the model is stored + /// optional object inheriting from RFFeatureGetter. + /// You need it only if you would like to train your own forest, pass null otherwise + /// + public static StructuredEdgeDetection CreateStructuredEdgeDetection(string model, RFFeatureGetter? howToGetFeatures = null) + { + return StructuredEdgeDetection.Create(model, howToGetFeatures); + } + + #endregion + + #region weighted_median_filter.hpp + + /// + /// Applies weighted median filter to an image. + /// + /// + /// For more details about this implementation, please see @cite zhang2014100+ + /// + /// Joint 8-bit, 1-channel or 3-channel image. + /// Source 8-bit or floating-point, 1-channel or 3-channel image. + /// Destination image. + /// Radius of filtering kernel, should be a positive integer. + /// Filter range standard deviation for the joint image. + /// The type of weight definition, see WMFWeightType + /// A 0-1 mask that has the same size with I. This mask is used to ignore the effect of some pixels. If the pixel value on mask is 0, + /// the pixel will be ignored when maintaining the joint-histogram.This is useful for applications like optical flow occlusion handling. + public static void WeightedMedianFilter( + InputArray joint, InputArray src, OutputArray dst, int r, + double sigma = 25.5, WMFWeightType weightType = WMFWeightType.EXP, Mat? mask = null) + { + if (joint is null) + throw new ArgumentNullException(nameof(joint)); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + joint.ThrowIfDisposed(); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_weightedMedianFilter( + joint.CvPtr, src.CvPtr, dst.CvPtr, r, sigma, (int)weightType, mask?.CvPtr ?? IntPtr.Zero)); + + GC.KeepAlive(joint); + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + GC.KeepAlive(mask); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/ximgproc/EdgeBoxes.cs b/src/OpenCvSharp/Modules/ximgproc/EdgeBoxes.cs new file mode 100644 index 000000000..3622ca242 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/EdgeBoxes.cs @@ -0,0 +1,379 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XImgProc; + +/// +/// Class implementing EdgeBoxes algorithm from @cite ZitnickECCV14edgeBoxes +/// +public class EdgeBoxes : Algorithm +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected EdgeBoxes(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Creates a EdgeBoxes + /// + /// step size of sliding window search. + /// nms threshold for object proposals. + /// adaptation rate for nms threshold. + /// min score of boxes to detect. + /// max number of boxes to detect. + /// edge min magnitude. Increase to trade off accuracy for speed. + /// edge merge threshold. Increase to trade off accuracy for speed. + /// cluster min magnitude. Increase to trade off accuracy for speed. + /// max aspect ratio of boxes. + /// minimum area of boxes. + /// affinity sensitivity. + /// scale sensitivity. + /// + public static EdgeBoxes Create( + float alpha = 0.65f, + float beta = 0.75f, + float eta = 1, + float minScore = 0.01f, + int maxBoxes = 10000, + float edgeMinMag = 0.1f, + float edgeMergeThr = 0.5f, + float clusterMinMag = 0.5f, + float maxAspectRatio = 3, + float minBoxArea = 1000, + float gamma = 2, + float kappa = 1.5f) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_createEdgeBoxes( + alpha, beta, eta, minScore, maxBoxes, edgeMinMag, edgeMergeThr, + clusterMinMag, maxAspectRatio, minBoxArea, gamma, kappa, out var p)); + return new EdgeBoxes(p); + } + + /// + /// Gets or sets the step size of sliding window search. + /// + public virtual float Alpha + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getAlpha(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setAlpha(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the nms threshold for object proposals. + /// + public virtual float Beta + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getBeta(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setBeta(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets adaptation rate for nms threshold. + /// + public virtual float Eta + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getEta(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setEta(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the min score of boxes to detect. + /// + public virtual float MinScore + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getMinScore(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setMinScore(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the max number of boxes to detect. + /// + public virtual int MaxBoxes + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getMaxBoxes(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setMaxBoxes(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the edge min magnitude. + /// + public virtual float EdgeMinMag + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getEdgeMinMag(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setEdgeMinMag(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the edge merge threshold. + /// + public virtual float EdgeMergeThr + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getEdgeMergeThr(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setEdgeMergeThr(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the cluster min magnitude. + /// + public virtual float ClusterMinMag + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getClusterMinMag(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setClusterMinMag(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the max aspect ratio of boxes. + /// + public virtual float MaxAspectRatio + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getMaxAspectRatio(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setMaxAspectRatio(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the minimum area of boxes. + /// + public virtual float MinBoxArea + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getMinBoxArea(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setMinBoxArea(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the affinity sensitivity. + /// + public virtual float Gamma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getGamma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setGamma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets the scale sensitivity. + /// + public virtual float Kappa + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getKappa(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_setKappa(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Returns array containing proposal boxes. + /// + /// edge image. + /// orientation map. + /// proposal boxes. + public virtual void GetBoundingBoxes(InputArray edgeMap, InputArray orientationMap, out Rect[] boxes) + { + ThrowIfDisposed(); + if (edgeMap is null) + throw new ArgumentNullException(nameof(edgeMap)); + if (orientationMap is null) + throw new ArgumentNullException(nameof(orientationMap)); + edgeMap.ThrowIfDisposed(); + orientationMap.ThrowIfDisposed(); + + using var boxesVec = new VectorOfRect(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getBoundingBoxes( + ptr, edgeMap.CvPtr, orientationMap.CvPtr, boxesVec.CvPtr)); + boxes = boxesVec.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(edgeMap); + GC.KeepAlive(orientationMap); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_EdgeBoxes_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_EdgeBoxes_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/AdaptiveManifoldFilter.cs b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/AdaptiveManifoldFilter.cs new file mode 100644 index 000000000..249b911cc --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/AdaptiveManifoldFilter.cs @@ -0,0 +1,246 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Interface for Adaptive Manifold Filter realizations. +/// +/// Below listed optional parameters which may be set up with Algorithm::set function. +/// - member double sigma_s = 16.0 +/// Spatial standard deviation. +/// - member double sigma_r = 0.2 +/// Color space standard deviation. +/// - member int tree_height = -1 +/// Height of the manifold tree (default = -1 : automatically computed). +/// - member int num_pca_iterations = 1 +/// Number of iterations to computed the eigenvector. +/// - member bool adjust_outliers = false +/// Specify adjust outliers using Eq. 9 or not. +/// - member bool use_RNG = true +/// Specify use random number generator to compute eigenvector or not. +/// +// ReSharper disable once InconsistentNaming +public class AdaptiveManifoldFilter : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected AdaptiveManifoldFilter(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Factory method, create instance of AdaptiveManifoldFilter and produce some initialization routines. + /// + /// spatial standard deviation. + /// color space standard deviation, it is similar to the sigma in the color space into + /// bilateralFilter. + /// optional, specify perform outliers adjust operation or not, (Eq. 9) in the + /// original paper. + /// + public static AdaptiveManifoldFilter Create( + double sigmaS, double sigmaR, bool adjustOutliers = false) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_createAMFilter( + sigmaS, sigmaR, adjustOutliers ? 1 : 0, out var p)); + + return new AdaptiveManifoldFilter(p); + } + + #region Properties + + /// + /// + /// + public double SigmaS + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_getSigmaS(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_setSigmaS(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public double SigmaR + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_getSigmaR(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_setSigmaR(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int TreeHeight + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_getTreeHeight(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_setTreeHeight(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public int PCAIterations + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_getPCAIterations(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_setPCAIterations(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool AdjustOutliers + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_getAdjustOutliers(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_setAdjustOutliers(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public bool UseRNG + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_getUseRNG(ptr, out var ret)); + GC.KeepAlive(this); + return ret != 0; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_setUseRNG(ptr, value ? 1 : 0)); + GC.KeepAlive(this); + } + } + + #endregion + + /// + /// Apply high-dimensional filtering using adaptive manifolds. + /// + /// filtering image with any numbers of channels. + /// output image. + /// optional joint (also called as guided) image with any numbers of channels. + public virtual void Filter(InputArray src, OutputArray dst, InputArray? joint = null) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + joint?.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_AdaptiveManifoldFilter_filter( + ptr, src.CvPtr, dst.CvPtr, joint?.CvPtr ?? IntPtr.Zero)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + GC.KeepAlive(joint); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_AdaptiveManifoldFilter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_AdaptiveManifoldFilter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/DTFilter.cs b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/DTFilter.cs new file mode 100644 index 000000000..43fb8d2ad --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/DTFilter.cs @@ -0,0 +1,105 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Interface for realizations of Domain Transform filter. +/// +// ReSharper disable once InconsistentNaming +public class DTFilter : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected DTFilter(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Factory method, create instance of DTFilter and produce initialization routines. + /// + /// guided image (used to build transformed distance, which describes edge structure of + /// guided image). + /// sigma_H parameter in the original article, it's similar to the sigma in the + /// coordinate space into bilateralFilter. + /// sigma_r parameter in the original article, it's similar to the sigma in the + /// color space into bilateralFilter. + /// one form three modes DTF_NC, DTF_RF and DTF_IC which corresponds to three modes for + /// filtering 2D signals in the article. + /// optional number of iterations used for filtering, 3 is quite enough. + /// + public static DTFilter Create( + InputArray guide, double sigmaSpatial, double sigmaColor, + EdgeAwareFiltersList mode = EdgeAwareFiltersList.DTF_NC, int numIters = 3) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + guide.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createDTFilter( + guide.CvPtr, sigmaSpatial, sigmaColor, (int)mode, numIters, out var p)); + + GC.KeepAlive(guide); + return new DTFilter(p); + } + + /// + /// Simple one-line Domain Transform filter call. If you have multiple images to filter with the same + /// guided image then use DTFilter interface to avoid extra computations on initialization stage. + /// + /// + /// + /// + public virtual void Filter(InputArray src, OutputArray dst, int dDepth = -1) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_DTFilter_filter( + ptr, src.CvPtr, dst.CvPtr, dDepth)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_DTFilter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_DTFilter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/FastBilateralSolverFilter.cs b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/FastBilateralSolverFilter.cs new file mode 100644 index 000000000..17f56eba8 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/FastBilateralSolverFilter.cs @@ -0,0 +1,106 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Interface for implementations of Fast Bilateral Solver. +/// +// ReSharper disable once InconsistentNaming +public class FastBilateralSolverFilter : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected FastBilateralSolverFilter(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Factory method, create instance of FastBilateralSolverFilter and execute the initialization routines. + /// + /// image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels. + /// parameter, that is similar to spatial space sigma (bandwidth) in bilateralFilter. + /// parameter, that is similar to luma space sigma (bandwidth) in bilateralFilter. + /// parameter, that is similar to chroma space sigma (bandwidth) in bilateralFilter. + /// smoothness strength parameter for solver. + /// number of iterations used for solver, 25 is usually enough. + /// convergence tolerance used for solver. + /// + public static FastBilateralSolverFilter Create( + InputArray guide, double sigmaSpatial, double sigmaLuma, double sigmaChroma, + double lambda = 128.0, int numIter = 25, double maxTol = 1e-5) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + guide.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createFastBilateralSolverFilter( + guide.CvPtr, sigmaSpatial, sigmaLuma, sigmaChroma, lambda, numIter, maxTol, out var p)); + + GC.KeepAlive(guide); + return new FastBilateralSolverFilter(p); + } + + /// + /// Apply smoothing operation to the source image. + /// + /// source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 3 channels. + /// confidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel. + /// destination image. + public virtual void Filter(InputArray src, InputArray confidence, OutputArray dst) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (confidence is null) + throw new ArgumentNullException(nameof(confidence)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + confidence.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_FastBilateralSolverFilter_filter( + ptr, src.CvPtr, confidence.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(confidence); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_FastBilateralSolverFilter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_FastBilateralSolverFilter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/FastGlobalSmootherFilter.cs b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/FastGlobalSmootherFilter.cs new file mode 100644 index 000000000..1438174fe --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/FastGlobalSmootherFilter.cs @@ -0,0 +1,99 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Interface for implementations of Fast Global Smoother filter. +/// +// ReSharper disable once InconsistentNaming +public class FastGlobalSmootherFilter : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected FastGlobalSmootherFilter(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Factory method, create instance of FastGlobalSmootherFilter and execute the initialization routines. + /// + /// image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels. + /// parameter defining the amount of regularization + /// parameter, that is similar to color space sigma in bilateralFilter. + /// internal parameter, defining how much lambda decreases after each iteration. Normally, + /// it should be 0.25. Setting it to 1.0 may lead to streaking artifacts. + /// number of iterations used for filtering, 3 is usually enough. + /// + public static FastGlobalSmootherFilter Create( + InputArray guide, double lambda, double sigmaColor, double lambdaAttenuation = 0.25, int numIter = 3) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + guide.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createFastGlobalSmootherFilter( + guide.CvPtr, lambda, sigmaColor, lambdaAttenuation, numIter, out var p)); + + GC.KeepAlive(guide); + return new FastGlobalSmootherFilter(p); + } + + /// + /// Apply smoothing operation to the source image. + /// + /// source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 4 channels. + /// destination image. + public virtual void Filter(InputArray src, OutputArray dst) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_FastGlobalSmootherFilter_filter( + ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_FastGlobalSmootherFilter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_FastGlobalSmootherFilter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/GuidedFilter.cs b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/GuidedFilter.cs new file mode 100644 index 000000000..1bace46dc --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/EdgeFilter/GuidedFilter.cs @@ -0,0 +1,99 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Interface for realizations of Guided Filter. +/// +// ReSharper disable once InconsistentNaming +public class GuidedFilter : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected GuidedFilter(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Factory method, create instance of GuidedFilter and produce initialization routines. + /// + /// guided image (or array of images) with up to 3 channels, if it have more then 3 + /// channels then only first 3 channels will be used. + /// radius of Guided Filter. + /// regularization term of Guided Filter. eps^2 is similar to the sigma in the color + /// space into bilateralFilter. + /// + public static GuidedFilter Create( + InputArray guide, int radius, double eps) + { + if (guide is null) + throw new ArgumentNullException(nameof(guide)); + guide.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createGuidedFilter( + guide.CvPtr, radius, eps, out var p)); + + GC.KeepAlive(guide); + return new GuidedFilter(p); + } + + /// + /// Apply Guided Filter to the filtering image. + /// + /// filtering image with any numbers of channels. + /// output image. + /// optional depth of the output image. dDepth can be set to -1, which will be equivalent to src.depth(). + public virtual void Filter(InputArray src, OutputArray dst, int dDepth = -1) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_GuidedFilter_filter( + ptr, src.CvPtr, dst.CvPtr, dDepth)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_GuidedFilter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_GuidedFilter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/AngleRangeOption.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/AngleRangeOption.cs index dd1995e95..a8b217110 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Enum/AngleRangeOption.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/AngleRangeOption.cs @@ -1,69 +1,64 @@ -using System; -using System.Collections.Generic; +namespace OpenCvSharp.XImgProc; -namespace OpenCvSharp.XImgProc +// ReSharper disable InconsistentNaming +/// +/// Specifies the part of Hough space to calculate +/// +/// +/// The enum specifies the part of Hough space to calculate. +/// Each member specifies primarily direction of lines(horizontal or vertical) +/// and the direction of angle changes. +/// Direction of angle changes is from multiples of 90 to odd multiples of 45. +/// The image considered to be written top-down and left-to-right. +/// Angles are started from vertical line and go clockwise. +/// Separate quarters and halves are written in orientation they should be in full Hough space. +/// +public enum AngleRangeOption { - // ReSharper disable InconsistentNaming - /// - /// Specifies the part of Hough space to calculate + /// Vertical primarily direction and clockwise angle changes /// - /// - /// The enum specifies the part of Hough space to calculate. - /// Each member specifies primarily direction of lines(horizontal or vertical) - /// and the direction of angle changes. - /// Direction of angle changes is from multiples of 90 to odd multiples of 45. - /// The image considered to be written top-down and left-to-right. - /// Angles are started from vertical line and go clockwise. - /// Separate quarters and halves are written in orientation they should be in full Hough space. - /// - public enum AngleRangeOption : int - { - /// - /// Vertical primarily direction and clockwise angle changes - /// - ARO_0_45 = 0, + ARO_0_45 = 0, - /// - /// Horizontal primarily direction and counterclockwise angle changes - /// - ARO_45_90 = 1, + /// + /// Horizontal primarily direction and counterclockwise angle changes + /// + ARO_45_90 = 1, - /// - /// Horizontal primarily direction and clockwise angle changes - /// - ARO_90_135 = 2, + /// + /// Horizontal primarily direction and clockwise angle changes + /// + ARO_90_135 = 2, - /// - /// Vertical primarily direction and counterclockwise angle changes - /// - ARO_315_0 = 3, + /// + /// Vertical primarily direction and counterclockwise angle changes + /// + ARO_315_0 = 3, - /// - /// Vertical primarily direction - /// - ARO_315_45 = 4, + /// + /// Vertical primarily direction + /// + ARO_315_45 = 4, - /// - /// Horizontal primarily direction - /// - ARO_45_135 = 5, + /// + /// Horizontal primarily direction + /// + ARO_45_135 = 5, - /// - /// Full set of directions - /// - ARO_315_135 = 6, + /// + /// Full set of directions + /// + ARO_315_135 = 6, - /// - /// 90 +/- atan(0.5), interval approximately from 64.5 to 116.5 degrees. - /// It is used for calculating Fast Hough Transform for images skewed by atan(0.5). - /// - ARO_CTR_HOR = 7, + /// + /// 90 +/- atan(0.5), interval approximately from 64.5 to 116.5 degrees. + /// It is used for calculating Fast Hough Transform for images skewed by atan(0.5). + /// + ARO_CTR_HOR = 7, - /// - /// +/- atan(0.5), interval approximately from 333.5(-26.5) to 26.5 degrees - /// It is used for calculating Fast Hough Transform for images skewed by atan(0.5). - /// - ARO_CTR_VER = 8 - } -} \ No newline at end of file + /// + /// +/- atan(0.5), interval approximately from 333.5(-26.5) to 26.5 degrees + /// It is used for calculating Fast Hough Transform for images skewed by atan(0.5). + /// + ARO_CTR_VER = 8 +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/EdgeAwareFiltersList.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/EdgeAwareFiltersList.cs new file mode 100644 index 000000000..17d472d10 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/EdgeAwareFiltersList.cs @@ -0,0 +1,18 @@ +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.XImgProc; + +/// +/// one form three modes DTF_NC, DTF_RF and DTF_IC which corresponds to three modes for +/// filtering 2D signals in the article. +/// +public enum EdgeAwareFiltersList +{ +#pragma warning disable 1591 + DTF_NC, + DTF_IC, + DTF_RF, + GUIDED_FILTER, + AM_FILTER +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/HoughDeskewOption.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/HoughDeskewOption.cs index 067fdd062..b797b92af 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Enum/HoughDeskewOption.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/HoughDeskewOption.cs @@ -1,27 +1,22 @@ -using System; -using System.Collections.Generic; +namespace OpenCvSharp.XImgProc; -namespace OpenCvSharp.XImgProc +// ReSharper disable InconsistentNaming +/// +/// Specifies to do or not to do skewing of Hough transform image +/// +/// +/// The enum specifies to do or not to do skewing of Hough transform image +/// so it would be no cycling in Hough transform image through borders of image. +/// +public enum HoughDeskewOption { - // ReSharper disable InconsistentNaming - /// - /// Specifies to do or not to do skewing of Hough transform image + /// Use raw cyclic image /// - /// - /// The enum specifies to do or not to do skewing of Hough transform image - /// so it would be no cycling in Hough transform image through borders of image. - /// - public enum HoughDeskewOption : int - { - /// - /// Use raw cyclic image - /// - RAW = 0, + RAW = 0, - /// - /// Prepare deskewed image - /// - DESKEW = 1 - } -} \ No newline at end of file + /// + /// Prepare deskewed image + /// + DESKEW = 1 +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/HoughOP.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/HoughOP.cs index 8bdd7869d..c048f33a3 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Enum/HoughOP.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/HoughOP.cs @@ -1,44 +1,39 @@ -using System; -using System.Collections.Generic; +namespace OpenCvSharp.XImgProc; -namespace OpenCvSharp.XImgProc +// ReSharper disable InconsistentNaming +/// +/// Specifies binary operations. +/// +/// +/// The enum specifies binary operations, that is such ones which involve +/// two operands. Formally, a binary operation @f$ f @f$ on a set @f$ S @f$ +/// is a binary relation that maps elements of the Cartesian product +/// @f$ S \times S @f$ to @f$ S @f$: +/// @f[ f: S \times S \to S @f] +/// +public enum HoughOP { - // ReSharper disable InconsistentNaming - /// - /// Specifies binary operations. + /// Binary minimum operation. The constant specifies the binary minimum operation + /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = \min(x, y) @f] /// - /// - /// The enum specifies binary operations, that is such ones which involve - /// two operands. Formally, a binary operation @f$ f @f$ on a set @f$ S @f$ - /// is a binary relation that maps elements of the Cartesian product - /// @f$ S \times S @f$ to @f$ S @f$: - /// @f[ f: S \times S \to S @f] - /// - public enum HoughOP : int - { - /// - /// Binary minimum operation. The constant specifies the binary minimum operation - /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = \min(x, y) @f] - /// - FHT_MIN = 0, + FHT_MIN = 0, - /// - /// Binary maximum operation. The constant specifies the binary maximum operation - /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = \max(x, y) @f] - /// - FHT_MAX = 1, + /// + /// Binary maximum operation. The constant specifies the binary maximum operation + /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = \max(x, y) @f] + /// + FHT_MAX = 1, - /// - /// Binary addition operation. The constant specifies the binary addition operation - /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = x + y @f] - /// - FHT_ADD = 2, + /// + /// Binary addition operation. The constant specifies the binary addition operation + /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = x + y @f] + /// + FHT_ADD = 2, - /// - /// Binary average operation. The constant specifies the binary average operation - /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = \frac{x + y}{2} @f] - /// - FHT_AVE = 3 - } -} \ No newline at end of file + /// + /// Binary average operation. The constant specifies the binary average operation + /// @f$ f @f$ that is defined as follows: @f[ f(x, y) = \frac{x + y}{2} @f] + /// + FHT_AVE = 3 +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/LocalBinarizationMethods.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/LocalBinarizationMethods.cs new file mode 100644 index 000000000..3bb70d4ab --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/LocalBinarizationMethods.cs @@ -0,0 +1,27 @@ +namespace OpenCvSharp.XImgProc; + +/// +/// Specifies the binarization method to use in cv::ximgproc::niBlackThreshold +/// +public enum LocalBinarizationMethods +{ + /// + /// Classic Niblack binarization. See @cite Niblack1985 . + /// + Niblack = 0, + + /// + /// Sauvola's technique. See @cite Sauvola1997 . + /// + Sauvola = 1, + + /// + /// Wolf's technique. See @cite Wolf2004 . + /// + Wolf = 2, + + /// + /// NICK technique. See @cite Khurshid2009 . + /// + Nick = 3 +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/RulesOption.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/RulesOption.cs index cee568893..75776aa58 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Enum/RulesOption.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/RulesOption.cs @@ -1,26 +1,21 @@ -using System; -using System.Collections.Generic; +namespace OpenCvSharp.XImgProc; -namespace OpenCvSharp.XImgProc +// ReSharper disable InconsistentNaming +/// +/// Specifies the degree of rules validation. +/// +/// +/// The enum specifies the degree of rules validation. This can be used, for example, to choose a proper way of input arguments validation. +/// +public enum RulesOption { - // ReSharper disable InconsistentNaming - /// - /// Specifies the degree of rules validation. + /// Validate each rule in a proper way. /// - /// - /// The enum specifies the degree of rules validation. This can be used, for example, to choose a proper way of input arguments validation. - /// - public enum RulesOption : int - { - /// - /// Validate each rule in a proper way. - /// - STRICT = 0x00, + STRICT = 0x00, - /// - /// Skip validations of image borders. - /// - IGNORE_BORDERS = 0x01, - } -} \ No newline at end of file + /// + /// Skip validations of image borders. + /// + IGNORE_BORDERS = 0x01, +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/SLICType.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/SLICType.cs new file mode 100644 index 000000000..0ee7a4f9c --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/SLICType.cs @@ -0,0 +1,29 @@ +#pragma warning disable CA1008 // Enums should have zero value + +namespace OpenCvSharp.XImgProc; + +/// +/// The algorithm variant to use for SuperpixelSLIC: +/// SLIC segments image using a desired region_size, and in addition SLICO will optimize using adaptive compactness factor, +/// while MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels. +/// +public enum SLICType +{ + /// + /// SLIC(Simple Linear Iterative Clustering) clusters pixels using pixel channels and image plane space + /// to efficiently generate compact, nearly uniform superpixels.The simplicity of approach makes it + /// extremely easy to use a lone parameter specifies the number of superpixels and the efficiency of + /// the algorithm makes it very practical. + /// + SLIC = 100, + + /// + /// SLICO stands for "Zero parameter SLIC" and it is an optimization of baseline SLIC described in @cite Achanta2012. + /// + SLICO = 101, + + /// + /// MSLIC stands for "Manifold SLIC" and it is an optimization of baseline SLIC described in @cite Liu_2017_IEEE. + /// + MSLIC = 102 +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/ThinningTypes.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/ThinningTypes.cs index 64f330e14..bc9b41df4 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Enum/ThinningTypes.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/ThinningTypes.cs @@ -1,24 +1,19 @@ -using System; -using System.Collections.Generic; +namespace OpenCvSharp.XImgProc; -namespace OpenCvSharp.XImgProc +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo +/// +/// thinning algorithm +/// +public enum ThinningTypes { - // ReSharper disable InconsistentNaming - /// - /// thinning algorithm + /// Thinning technique of Zhang-Suen /// - public enum ThinningTypes : int - { - /// - /// Thinning technique of Zhang-Suen - /// - - ZHANGSUEN = 0, + ZHANGSUEN = 0, - /// - /// Thinning technique of Guo-Hall - /// - GUOHALL = 1 - } -} \ No newline at end of file + /// + /// Thinning technique of Guo-Hall + /// + GUOHALL = 1 +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Enum/WMFWeightType.cs b/src/OpenCvSharp/Modules/ximgproc/Enum/WMFWeightType.cs index 52738e7f9..7d7667344 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Enum/WMFWeightType.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Enum/WMFWeightType.cs @@ -1,43 +1,38 @@ -using System; -using System.Collections.Generic; +namespace OpenCvSharp.XImgProc; -namespace OpenCvSharp.XImgProc +// ReSharper disable InconsistentNaming +/// +/// Specifies weight types of weighted median filter. +/// +public enum WMFWeightType { - // ReSharper disable InconsistentNaming - /// - /// Specifies weight types of weighted median filter. + /// \f$exp(-|I1-I2|^2/(2*sigma^2))\f$ /// - public enum WMFWeightType : int - { - /// - /// \f$exp(-|I1-I2|^2/(2*sigma^2))\f$ - /// - EXP, + EXP, - /// - /// \f$(|I1-I2|+sigma)^-1\f$ - /// - IV1, + /// + /// \f$(|I1-I2|+sigma)^-1\f$ + /// + IV1, - /// - /// \f$(|I1-I2|^2+sigma^2)^-1\f$ - /// - IV2, + /// + /// \f$(|I1-I2|^2+sigma^2)^-1\f$ + /// + IV2, - /// - /// \f$dot(I1,I2)/(|I1|*|I2|)\f$ - /// - COS, + /// + /// \f$dot(I1,I2)/(|I1|*|I2|)\f$ + /// + COS, - /// - /// \f$(min(r1,r2)+min(g1,g2)+min(b1,b2))/(max(r1,r2)+max(g1,g2)+max(b1,b2))\f$ - /// - JAC, + /// + /// \f$(min(r1,r2)+min(g1,g2)+min(b1,b2))/(max(r1,r2)+max(g1,g2)+max(b1,b2))\f$ + /// + JAC, - /// - /// unweighted - /// - OFF - } -} \ No newline at end of file + /// + /// unweighted + /// + OFF +} diff --git a/src/OpenCvSharp/Modules/ximgproc/FastLineDetector.cs b/src/OpenCvSharp/Modules/ximgproc/FastLineDetector.cs index e688ac46d..7a3f8f99e 100644 --- a/src/OpenCvSharp/Modules/ximgproc/FastLineDetector.cs +++ b/src/OpenCvSharp/Modules/ximgproc/FastLineDetector.cs @@ -1,184 +1,173 @@ -using System; -using System.Collections.Generic; +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; -namespace OpenCvSharp.XImgProc +namespace OpenCvSharp.XImgProc; + +/// +/// Class implementing the FLD (Fast Line Detector) algorithm described in @cite Lee14. +/// +public class FastLineDetector : Algorithm { - // ReSharper disable InconsistentNaming + private Ptr? detectorPtr; -#if LANG_JP /// - /// SIFT 実装. + /// Creates instance by raw pointer /// -#else + protected FastLineDetector(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + /// - /// SIFT implementation. + /// Releases managed resources /// -#endif - public class FastLineDetector : Algorithm + protected override void DisposeManaged() { - private Ptr detectorPtr; - - #region Init & Disposal - - /// - /// Creates instance by raw pointer cv::FastLineDetector* - /// - protected FastLineDetector(IntPtr p) - { - detectorPtr = new Ptr(p); - ptr = detectorPtr.Get(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - /// - /// Creates a smart pointer to a FastLineDetector object and initializes it - /// - /// Segment shorter than this will be discarded - /// A point placed from a hypothesis line segment farther than - /// this will be regarded as an outlier - /// First threshold for hysteresis procedure in Canny() - /// Second threshold for hysteresis procedure in Canny() - /// Aperturesize for the sobel operator in Canny() - /// If true, incremental merging of segments will be perfomred - /// - public static FastLineDetector Create( - int lengthThreshold = 10, float distanceThreshold = 1.414213562f, - double cannyTh1 = 50.0, double cannyTh2 = 50.0, int cannyApertureSize = 3, - bool doMerge = false) - { - IntPtr p = NativeMethods.ximgproc_createFastLineDetector(lengthThreshold, distanceThreshold, cannyTh1, cannyTh2, - cannyApertureSize, doMerge ? 1 : 0); - return new FastLineDetector(p); - } - - #endregion - - #region Methods - - /// - /// Finds lines in the input image. - /// This is the output of the default parameters of the algorithm on the above shown image. - /// - /// A grayscale (CV_8UC1) input image. If only a roi needs to be - /// selected, use: `fld_ptr-\>detect(image(roi), lines, ...); - /// lines += Scalar(roi.x, roi.y, roi.x, roi.y);` - /// A vector of Vec4f elements specifying the beginning - /// and ending point of a line. Where Vec4f is (x1, y1, x2, y2), - /// point 1 is the start, point 2 - end.Returned lines are directed so that the - /// brighter side is on their left. - public virtual void Detect(InputArray image, OutputArray lines) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (lines == null) - throw new ArgumentNullException(nameof(lines)); - image.ThrowIfDisposed(); - lines.ThrowIfNotReady(); - - NativeMethods.ximgproc_FastLineDetector_detect_OutputArray(ptr, image.CvPtr, lines.CvPtr); - - GC.KeepAlive(image); - lines.Fix(); - } + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } - /// - /// Finds lines in the input image. - /// This is the output of the default parameters of the algorithm on the above shown image. - /// - /// A grayscale (CV_8UC1) input image. If only a roi needs to be - /// selected, use: `fld_ptr-\>detect(image(roi), lines, ...); - /// lines += Scalar(roi.x, roi.y, roi.x, roi.y);` - /// A vector of Vec4f elements specifying the beginning - /// and ending point of a line. Where Vec4f is (x1, y1, x2, y2), - /// point 1 is the start, point 2 - end.Returned lines are directed so that the - /// brighter side is on their left. - public virtual Vec4f[] Detect(InputArray image) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); + /// + /// Creates a smart pointer to a FastLineDetector object and initializes it + /// + /// Segment shorter than this will be discarded + /// A point placed from a hypothesis line segment farther than + /// this will be regarded as an outlier + /// First threshold for hysteresis procedure in Canny() + /// Second threshold for hysteresis procedure in Canny() + /// Aperturesize for the sobel operator in Canny() + /// If true, incremental merging of segments will be perfomred + /// + public static FastLineDetector Create( + int lengthThreshold = 10, float distanceThreshold = 1.414213562f, + double cannyTh1 = 50.0, double cannyTh2 = 50.0, int cannyApertureSize = 3, + bool doMerge = false) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_createFastLineDetector( + lengthThreshold, distanceThreshold, cannyTh1, cannyTh2, cannyApertureSize, doMerge ? 1 : 0, out var p)); + return new FastLineDetector(p); + } - using (var lines = new VectorOfVec4f()) - { - NativeMethods.ximgproc_FastLineDetector_detect_vector(ptr, image.CvPtr, lines.CvPtr); - GC.KeepAlive(image); - return lines.ToArray(); - } - } + /// + /// Finds lines in the input image. + /// This is the output of the default parameters of the algorithm on the above shown image. + /// + /// A grayscale (CV_8UC1) input image. If only a roi needs to be + /// selected, use: `fld_ptr-\>detect(image(roi), lines, ...); + /// lines += Scalar(roi.x, roi.y, roi.x, roi.y);` + /// A vector of Vec4f elements specifying the beginning + /// and ending point of a line. Where Vec4f is (x1, y1, x2, y2), + /// point 1 is the start, point 2 - end.Returned lines are directed so that the + /// brighter side is on their left. + public virtual void Detect(InputArray image, OutputArray lines) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + image.ThrowIfDisposed(); + lines.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_FastLineDetector_detect_OutputArray(ptr, image.CvPtr, lines.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(image); + GC.KeepAlive(lines); + lines.Fix(); + } - /// - /// Draws the line segments on a given image. - /// - /// The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found. - /// A vector of the lines that needed to be drawn. - /// If true, arrow heads will be drawn. - public virtual void DrawSegments(InputOutputArray image, InputArray lines, - bool drawArrow = false) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (lines == null) - throw new ArgumentNullException(nameof(lines)); + /// + /// Finds lines in the input image. + /// This is the output of the default parameters of the algorithm on the above shown image. + /// + /// A grayscale (CV_8UC1) input image. If only a roi needs to be + /// selected, use: `fld_ptr-\>detect(image(roi), lines, ...); + /// lines += Scalar(roi.x, roi.y, roi.x, roi.y);` + /// A vector of Vec4f elements specifying the beginning + /// and ending point of a line. Where Vec4f is (x1, y1, x2, y2), + /// point 1 is the start, point 2 - end.Returned lines are directed so that the + /// brighter side is on their left. + public virtual Vec4f[] Detect(InputArray image) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + using var lines = new VectorOfVec4f(); + NativeMethods.HandleException( + NativeMethods.ximgproc_FastLineDetector_detect_vector(ptr, image.CvPtr, lines.CvPtr)); + GC.KeepAlive(this); + GC.KeepAlive(image); + return lines.ToArray(); + } - NativeMethods.ximgproc_FastLineDetector_drawSegments_InputArray(ptr, image.CvPtr, lines.CvPtr, drawArrow ? 1 : 0); + /// + /// Draws the line segments on a given image. + /// + /// The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found. + /// A vector of the lines that needed to be drawn. + /// If true, arrow heads will be drawn. + public virtual void DrawSegments(InputOutputArray image, InputArray lines, + bool drawArrow = false) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_FastLineDetector_drawSegments_InputArray(ptr, image.CvPtr, lines.CvPtr, drawArrow ? 1 : 0)); + GC.KeepAlive(this); + GC.KeepAlive(image); + image.Fix(); + GC.KeepAlive(lines); + } - image.Fix(); - GC.KeepAlive(lines); - } + /// + /// Draws the line segments on a given image. + /// + /// The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found. + /// A vector of the lines that needed to be drawn. + /// If true, arrow heads will be drawn. + public virtual void DrawSegments(InputOutputArray image, IEnumerable lines, bool drawArrow = false) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + if (lines is null) + throw new ArgumentNullException(nameof(lines)); + + using var linesVec = new VectorOfVec4f(lines); + NativeMethods.HandleException( + NativeMethods.ximgproc_FastLineDetector_drawSegments_vector( + ptr, image.CvPtr, linesVec.CvPtr, drawArrow ? 1 : 0)); + + GC.KeepAlive(this); + GC.KeepAlive(image); + image.Fix(); + } - /// - /// Draws the line segments on a given image. - /// - /// The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found. - /// A vector of the lines that needed to be drawn. - /// If true, arrow heads will be drawn. - public virtual void DrawSegments(InputOutputArray image, IEnumerable lines, - bool drawArrow = false) + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (lines == null) - throw new ArgumentNullException(nameof(lines)); - - using (var linesVec = new VectorOfVec4f(lines)) - { - NativeMethods.ximgproc_FastLineDetector_drawSegments_vector(ptr, image.CvPtr, linesVec.CvPtr, drawArrow ? 1 : 0); - } - - image.Fix(); + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_FastLineDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; } - #endregion - - internal class Ptr : OpenCvSharp.Ptr + protected override void DisposeUnmanaged() { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ximgproc_Ptr_FastLineDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ximgproc_FastLineDetector_delete(ptr); - base.DisposeUnmanaged(); - } + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_FastLineDetector_delete(ptr)); + base.DisposeUnmanaged(); } } } diff --git a/src/OpenCvSharp/Modules/ximgproc/RFFeatureGetter.cs b/src/OpenCvSharp/Modules/ximgproc/RFFeatureGetter.cs new file mode 100644 index 000000000..763d1ca03 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/RFFeatureGetter.cs @@ -0,0 +1,99 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XImgProc; + +/// +/// Helper class for training part of [P. Dollar and C. L. Zitnick. Structured Forests for Fast Edge Detection, 2013]. +/// +// ReSharper disable once InconsistentNaming +public class RFFeatureGetter : Algorithm +{ + internal Ptr? PtrObj { get; private set; } + + /// + /// Creates instance by raw pointer + /// + protected RFFeatureGetter(IntPtr p) + { + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + PtrObj?.Dispose(); + PtrObj = null; + base.DisposeManaged(); + } + + /// + /// Creates a RFFeatureGetter + /// + /// + public static RFFeatureGetter Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_createRFFeatureGetter(out var p)); + return new RFFeatureGetter(p); + } + + /// + /// Extracts feature channels from src. + /// Than StructureEdgeDetection uses this feature space to detect edges. + /// + /// source image to extract features + /// output n-channel floating point feature matrix. + /// gradientNormalizationRadius + /// gradientSmoothingRadius + /// shrinkNumber + /// numberOfOutputChannels + /// numberOfGradientOrientations + public virtual void GetFeatures( + Mat src, + Mat features, + int gnrmRad, + int gsmthRad, + int shrink, + int outNum, + int gradNum) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (features is null) + throw new ArgumentNullException(nameof(features)); + src.ThrowIfDisposed(); + features.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_RFFeatureGetter_getFeatures( + ptr, src.CvPtr, features.CvPtr, gnrmRad, gsmthRad, shrink, outNum, gradNum)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(features); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_RFFeatureGetter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_RFFeatureGetter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/RidgeDetectionFilter.cs b/src/OpenCvSharp/Modules/ximgproc/RidgeDetectionFilter.cs new file mode 100644 index 000000000..d9e980985 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/RidgeDetectionFilter.cs @@ -0,0 +1,103 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp; + +/// +/// Applies Ridge Detection Filter to an input image. +/// +/// Implements Ridge detection similar to the one in [Mathematica](http://reference.wolfram.com/language/ref/RidgeFilter.html) +/// using the eigen values from the Hessian Matrix of the input image using Sobel Derivatives. +/// Additional refinement can be done using Skeletonization and Binarization. Adapted from @cite segleafvein and @cite M_RF +/// +public class RidgeDetectionFilter : Algorithm +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + protected RidgeDetectionFilter(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Create pointer to the Ridge detection filter. + /// + /// Specifies output image depth. Defualt is CV_32FC1 + /// Order of derivative x, default is 1 + /// Order of derivative y, default is 1 + /// Sobel kernel size , default is 3 + /// Converted format for output, default is CV_8UC1 + /// Optional scale value for derivative values, default is 1 + /// Optional bias added to output, default is 0 + /// Pixel extrapolation method, default is BORDER_DEFAULT + /// + public static RidgeDetectionFilter Create( + MatType? ddepth = null, + int dx = 1, + int dy = 1, + int ksize = 3, + MatType? outDtype = null, + double scale = 1, + double delta = 0, + BorderTypes borderType = BorderTypes.Default) + { + var ddepthValue = ddepth.GetValueOrDefault(MatType.CV_32FC1); + var outDtypeValue = outDtype.GetValueOrDefault(MatType.CV_8UC1); + + NativeMethods.HandleException( + NativeMethods.ximgproc_RidgeDetectionFilter_create( + ddepthValue, dx, dy, ksize, + outDtypeValue, scale, delta, (int)borderType, + out var ptr)); + + return new RidgeDetectionFilter(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Apply Ridge detection filter on input image. + /// + /// InputArray as supported by Sobel. img can be 1-Channel or 3-Channels. + /// OutputAray of structure as RidgeDetectionFilter::ddepth. Output image with ridges. + public virtual void GetRidgeFilteredImage(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_RidgeDetectionFilter_getRidgeFilteredImage(ptr, src.CvPtr, dst.CvPtr)); + GC.KeepAlive(this); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_RFFeatureGetter_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_RFFeatureGetter_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Segmentation/GraphSegmentation.cs b/src/OpenCvSharp/Modules/ximgproc/Segmentation/GraphSegmentation.cs new file mode 100644 index 000000000..9ef1d4492 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Segmentation/GraphSegmentation.cs @@ -0,0 +1,152 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XImgProc.Segmentation; + +/// +/// Graph Based Segmentation Algorithm. +/// The class implements the algorithm described in @cite PFF2004. +/// +public class GraphSegmentation : Algorithm +{ + internal Ptr? PtrObj { get; private set; } + + /// + /// Creates instance by raw pointer + /// + protected GraphSegmentation(IntPtr p) + { + PtrObj = new Ptr(p); + ptr = PtrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + PtrObj?.Dispose(); + PtrObj = null; + base.DisposeManaged(); + } + + /// + /// Creates a graph based segmentor + /// + /// The sigma parameter, used to smooth image + /// The k parameter of the algorithm + /// The minimum size of segments + /// + public static GraphSegmentation Create(double sigma= 0.5, float k = 300, int minSize = 100) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createGraphSegmentation(sigma, k, minSize, out var p)); + return new GraphSegmentation(p); + } + + /// + /// + /// + public virtual double Sigma + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_getSigma(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_setSigma(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public virtual float K + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_getK(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_setK(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// + /// + public virtual int MinSize + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_getMinSize(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_setMinSize(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Segment an image and store output in dst + /// + /// The input image. Any number of channel (1 (Eg: Gray), 3 (Eg: RGB), 4 (Eg: RGB-D)) can be provided + /// The output segmentation. It's a CV_32SC1 Mat with the same number of cols and rows as input image, with an unique, sequential, id for each pixel. + public virtual void ProcessImage(InputArray src, OutputArray dst) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_GraphSegmentation_processImage(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_GraphSegmentation_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_GraphSegmentation_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentation.cs b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentation.cs new file mode 100644 index 000000000..edea8c39b --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentation.cs @@ -0,0 +1,230 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XImgProc.Segmentation; + +/// +/// Selective search segmentation algorithm. +/// The class implements the algorithm described in @cite uijlings2013selective. +/// +public class SelectiveSearchSegmentation : Algorithm +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentation(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Create a new SelectiveSearchSegmentation class. + /// + /// + public static SelectiveSearchSegmentation Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentation(out var p)); + return new SelectiveSearchSegmentation(p); + } + + /// + /// Set a image used by switch* functions to initialize the class + /// + /// The image + public virtual void SetBaseImage(InputArray img) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_setBaseImage(ptr, img.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + } + + /// + /// Initialize the class with the 'Single stragegy' parameters describled in @cite uijlings2013selective. + /// + /// The k parameter for the graph segmentation + /// The sigma parameter for the graph segmentation + public virtual void SwitchToSingleStrategy(int k = 200, float sigma = 0.8f) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_switchToSingleStrategy(ptr, k, sigma)); + GC.KeepAlive(this); + } + + /// + /// Initialize the class with the 'Selective search fast' parameters describled in @cite uijlings2013selective. + /// + /// The k parameter for the first graph segmentation + /// The increment of the k parameter for all graph segmentations + /// The sigma parameter for the graph segmentation + public virtual void SwitchToSelectiveSearchFast(int baseK = 150, int incK = 150, float sigma = 0.8f) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_switchToSelectiveSearchFast(ptr, baseK, incK, sigma)); + GC.KeepAlive(this); + } + + /// + /// Initialize the class with the 'Selective search fast' parameters describled in @cite uijlings2013selective. + /// + /// The k parameter for the first graph segmentation + /// The increment of the k parameter for all graph segmentations + /// The sigma parameter for the graph segmentation + public virtual void SwitchToSelectiveSearchQuality(int baseK = 150, int incK = 150, float sigma = 0.8f) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_switchToSelectiveSearchQuality(ptr, baseK, incK, sigma)); + GC.KeepAlive(this); + } + + /// + /// Add a new image in the list of images to process. + /// + /// The image + public virtual void AddImage(InputArray img) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_addImage(ptr, img.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + } + + /// + /// Clear the list of images to process + /// + public virtual void ClearImages() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_clearImages(ptr)); + GC.KeepAlive(this); + } + + /// + /// Add a new graph segmentation in the list of graph segmentations to process. + /// + /// The graph segmentation + public virtual void AddGraphSegmentation(GraphSegmentation g) + { + ThrowIfDisposed(); + if (g is null) + throw new ArgumentNullException(nameof(g)); + g.ThrowIfDisposed(); + + if (g.PtrObj is null) + throw new ArgumentException("PtrObj = null", nameof(g)); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_addGraphSegmentation(ptr, g.PtrObj.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(g); + } + + /// + /// Clear the list of graph segmentations to process + /// + public virtual void ClearGraphSegmentations() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_clearGraphSegmentations(ptr)); + GC.KeepAlive(this); + } + + /// + /// Add a new strategy in the list of strategy to process. + /// + /// The strategy + public virtual void AddStrategy(SelectiveSearchSegmentationStrategy s) + { + ThrowIfDisposed(); + if (s is null) + throw new ArgumentNullException(nameof(s)); + s.ThrowIfDisposed(); + if (s.PtrObj is null) + throw new ArgumentException("s.PtrObj is null"); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_addStrategy(ptr, s.PtrObj.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(s); + } + + /// + /// Clear the list of strategy to process; + /// + public virtual void ClearStrategies() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_clearStrategies(ptr)); + GC.KeepAlive(this); + } + + /// + /// Based on all images, graph segmentations and stragies, computes all possible rects and return them + /// + /// The list of rects. The first ones are more relevents than the lasts ones. + public virtual void Process(out Rect[] rects) + { + ThrowIfDisposed(); + + using var rectsVec = new VectorOfRect(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentation_process(ptr, rectsVec.CvPtr)); + rects = rectsVec.ToArray(); + + GC.KeepAlive(this); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentation_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentation_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs new file mode 100644 index 000000000..eb9723ec6 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs @@ -0,0 +1,274 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XImgProc.Segmentation; + +/// +/// +/// Strategy for the selective search segmentation algorithm. +/// The class implements a generic stragery for the algorithm described in @cite uijlings2013selective. +/// +public abstract class SelectiveSearchSegmentationStrategy : Algorithm +{ + /// + /// + /// + public Ptr? PtrObj { get; private set; } + + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentationStrategy(Ptr ptrObj) + { + PtrObj = ptrObj ?? throw new ArgumentNullException(nameof(ptrObj)); + ptr = ptrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + PtrObj?.Dispose(); + PtrObj = null; + base.DisposeManaged(); + } + + /// + /// Set a initial image, with a segementation. + /// + /// The input image. Any number of channel can be provided + /// A segementation of the image. The parameter must be the same size of img. + /// The sizes of different regions + /// If not set to -1, try to cache pre-computations. If the same set og (img, regions, size) is used, the image_id need to be the same. + public virtual void SetImage(InputArray img, InputArray regions, InputArray sizes, int imageId = -1) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (regions is null) + throw new ArgumentNullException(nameof(regions)); + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + img.ThrowIfDisposed(); + regions.ThrowIfDisposed(); + sizes.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentationStrategy_setImage( + ptr, img.CvPtr, regions.CvPtr, sizes.CvPtr, imageId)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + GC.KeepAlive(regions); + GC.KeepAlive(sizes); + } + + /// + /// Return the score between two regions (between 0 and 1) + /// + /// The first region + /// The second region + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] + public virtual float Get(int r1, int r2) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentationStrategy_get(ptr, r1, r2, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Inform the strategy that two regions will be merged + /// + /// The first region + /// The second region + public virtual void Merge(int r1, int r2) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentationStrategy_merge(ptr, r1, r2)); + GC.KeepAlive(this); + } +} + +/// +/// +/// Color-based strategy for the selective search segmentation algorithm. +/// The class is implemented from the algorithm described in @cite uijlings2013selective. +/// +public class SelectiveSearchSegmentationStrategyColor : SelectiveSearchSegmentationStrategy { + + /// + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentationStrategyColor(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Create a new color-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategyColor Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyColor(out var p)); + return new SelectiveSearchSegmentationStrategyColor(p); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyColor_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyColor_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} + +/// +/// +/// Size-based strategy for the selective search segmentation algorithm. +/// The class is implemented from the algorithm described in @cite uijlings2013selective. +/// +public class SelectiveSearchSegmentationStrategySize : SelectiveSearchSegmentationStrategy +{ + /// + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentationStrategySize(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Create a new size-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategySize Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategySize(out var p)); + return new SelectiveSearchSegmentationStrategySize(p); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategySize_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategySize_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} + +/// +/// Texture-based strategy for the selective search segmentation algorithm. +/// The class is implemented from the algorithm described in @cite uijlings2013selective. +/// +public class SelectiveSearchSegmentationStrategyTexture : SelectiveSearchSegmentationStrategy { + /// + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentationStrategyTexture(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Create a new size-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategyTexture Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyTexture(out var p)); + return new SelectiveSearchSegmentationStrategyTexture(p); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyTexture_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyTexture_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} + +/// +/// Fill-based strategy for the selective search segmentation algorithm. +/// The class is implemented from the algorithm described in @cite uijlings2013selective. +/// +public class SelectiveSearchSegmentationStrategyFill : SelectiveSearchSegmentationStrategy { + /// + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentationStrategyFill(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Create a new fill-based strategy + /// + /// + public static SelectiveSearchSegmentationStrategyFill Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyFill(out var p)); + return new SelectiveSearchSegmentationStrategyFill(p); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyFill_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyFill_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs new file mode 100644 index 000000000..a7ed8e8a8 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs @@ -0,0 +1,184 @@ +using System.Diagnostics.CodeAnalysis; +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XImgProc.Segmentation; + +/// +/// +/// Regroup multiple strategies for the selective search segmentation algorithm +/// +public class SelectiveSearchSegmentationStrategyMultiple : SelectiveSearchSegmentationStrategy +{ + /// + /// Creates instance by raw pointer + /// + protected SelectiveSearchSegmentationStrategyMultiple(IntPtr p) + : base(new Ptr(p)) + { + } + + /// + /// Set a initial image, with a segementation. + /// + /// The input image. Any number of channel can be provided + /// A segementation of the image. The parameter must be the same size of img. + /// The sizes of different regions + /// If not set to -1, try to cache pre-computations. If the same set og (img, regions, size) is used, the image_id need to be the same. + public new virtual void SetImage(InputArray img, InputArray regions, InputArray sizes, int imageId = -1) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (regions is null) + throw new ArgumentNullException(nameof(regions)); + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + img.ThrowIfDisposed(); + regions.ThrowIfDisposed(); + sizes.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentationStrategy_setImage( + ptr, img.CvPtr, regions.CvPtr, sizes.CvPtr, imageId)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + GC.KeepAlive(regions); + GC.KeepAlive(sizes); + } + + /// + /// Return the score between two regions (between 0 and 1) + /// + /// The first region + /// The second region + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] + public new virtual float Get(int r1, int r2) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentationStrategy_get(ptr, r1, r2, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Inform the strategy that two regions will be merged + /// + /// The first region + /// The second region + public new virtual void Merge(int r1, int r2) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_SelectiveSearchSegmentationStrategy_merge(ptr, r1, r2)); + GC.KeepAlive(this); + } + + /// + /// Create a new multiple strategy + /// + /// + public static SelectiveSearchSegmentationStrategyMultiple Create() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple0(out var p)); + return new SelectiveSearchSegmentationStrategyMultiple(p); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple Create( + SelectiveSearchSegmentationStrategy s1) + { + if (s1 is null) + throw new ArgumentNullException(nameof(s1)); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple1(s1.CvPtr, out var p)); + return new SelectiveSearchSegmentationStrategyMultiple(p); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// The second strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple Create( + SelectiveSearchSegmentationStrategy s1, SelectiveSearchSegmentationStrategy s2) + { + if (s1 is null) + throw new ArgumentNullException(nameof(s1)); + if (s2 is null) + throw new ArgumentNullException(nameof(s2)); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple2(s1.CvPtr, s2.CvPtr, out var p)); + return new SelectiveSearchSegmentationStrategyMultiple(p); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// The second strategy + /// The third strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple Create( + SelectiveSearchSegmentationStrategy s1, SelectiveSearchSegmentationStrategy s2, SelectiveSearchSegmentationStrategy s3) + { + if (s1 is null) + throw new ArgumentNullException(nameof(s1)); + if (s2 is null) + throw new ArgumentNullException(nameof(s2)); + if (s3 is null) + throw new ArgumentNullException(nameof(s3)); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple3(s1.CvPtr, s2.CvPtr, s3.CvPtr, out var p)); + return new SelectiveSearchSegmentationStrategyMultiple(p); + } + + /// + /// Create a new multiple strategy and set one subtrategy + /// + /// The first strategy + /// The second strategy + /// The third strategy + /// The forth strategy + /// + public static SelectiveSearchSegmentationStrategyMultiple Create( + SelectiveSearchSegmentationStrategy s1, SelectiveSearchSegmentationStrategy s2, SelectiveSearchSegmentationStrategy s3, SelectiveSearchSegmentationStrategy s4) + { + if (s1 is null) + throw new ArgumentNullException(nameof(s1)); + if (s2 is null) + throw new ArgumentNullException(nameof(s2)); + if (s3 is null) + throw new ArgumentNullException(nameof(s3)); + if (s4 is null) + throw new ArgumentNullException(nameof(s4)); + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple4(s1.CvPtr, s2.CvPtr, s3.CvPtr, s4.CvPtr, out var p)); + return new SelectiveSearchSegmentationStrategyMultiple(p); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyMultiple_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyMultiple_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/StructuredEdgeDetection.cs b/src/OpenCvSharp/Modules/ximgproc/StructuredEdgeDetection.cs new file mode 100644 index 000000000..f7c7943ef --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/StructuredEdgeDetection.cs @@ -0,0 +1,174 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XImgProc; + +/// +/// Class implementing edge detection algorithm from @cite Dollar2013 : +/// +public class StructuredEdgeDetection : Algorithm +{ + private Ptr? ptrObj; + + /// + /// Creates instance by raw pointer + /// + protected StructuredEdgeDetection(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Creates a StructuredEdgeDetection + /// + /// name of the file where the model is stored + /// optional object inheriting from RFFeatureGetter. + /// You need it only if you would like to train your own forest, pass null otherwise + /// + public static StructuredEdgeDetection Create(string model, RFFeatureGetter? howToGetFeatures = null) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_createStructuredEdgeDetection( + model, howToGetFeatures?.PtrObj?.CvPtr ?? IntPtr.Zero, out var p)); + GC.KeepAlive(howToGetFeatures); + return new StructuredEdgeDetection(p); + } + + /// + /// Returns array containing proposal boxes. + /// + /// edge image. + /// orientation map. + /// proposal boxes. + public virtual void GetBoundingBoxes(InputArray edgeMap, InputArray orientationMap, out Rect[] boxes) + { + ThrowIfDisposed(); + if (edgeMap is null) + throw new ArgumentNullException(nameof(edgeMap)); + if (orientationMap is null) + throw new ArgumentNullException(nameof(orientationMap)); + edgeMap.ThrowIfDisposed(); + orientationMap.ThrowIfDisposed(); + + using var boxesVec = new VectorOfRect(); + NativeMethods.HandleException( + NativeMethods.ximgproc_EdgeBoxes_getBoundingBoxes(ptr, edgeMap.CvPtr, orientationMap.CvPtr, boxesVec.CvPtr)); + boxes = boxesVec.ToArray(); + + GC.KeepAlive(this); + GC.KeepAlive(edgeMap); + GC.KeepAlive(orientationMap); + } + + /// + /// The function detects edges in src and draw them to dst. + /// The algorithm underlies this function is much more robust to texture presence, than common approaches, e.g.Sobel + /// + /// source image (RGB, float, in [0;1]) to detect edges + /// destination image (grayscale, float, in [0;1]) where edges are drawn + public virtual void DetectEdges(InputArray src, OutputArray dst) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_StructuredEdgeDetection_detectEdges(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// The function computes orientation from edge image. + /// + /// edge image. + /// orientation image. + public virtual void ComputeOrientation(InputArray src, OutputArray dst) + { + ThrowIfDisposed(); + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_StructuredEdgeDetection_computeOrientation(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + dst.Fix(); + } + + /// + /// The function edgenms in edge image and suppress edges where edge is stronger in orthogonal direction. + /// + /// edge image from detectEdges function. + /// orientation image from computeOrientation function. + /// suppressed image (grayscale, float, in [0;1]) + /// radius for NMS suppression. + /// radius for boundary suppression. + /// multiplier for conservative suppression. + /// enables/disables parallel computing. + public virtual void EdgesNms(InputArray edgeImage, InputArray orientationImage, OutputArray dst, + int r = 2, int s = 0, float m = 1, bool isParallel = true) + { + ThrowIfDisposed(); + if (edgeImage is null) + throw new ArgumentNullException(nameof(edgeImage)); + if (orientationImage is null) + throw new ArgumentNullException(nameof(orientationImage)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + edgeImage.ThrowIfDisposed(); + orientationImage.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_StructuredEdgeDetection_edgesNms( + ptr, edgeImage.CvPtr, orientationImage.CvPtr, dst.CvPtr, r, s, m, isParallel ? 1 : 0)); + + GC.KeepAlive(this); + GC.KeepAlive(edgeImage); + GC.KeepAlive(orientationImage); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_StructuredEdgeDetection_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_StructuredEdgeDetection_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelLSC.cs b/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelLSC.cs new file mode 100644 index 000000000..705730729 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelLSC.cs @@ -0,0 +1,181 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Class implementing the LSC (Linear Spectral Clustering) superpixels +/// algorithm described in @cite LiCVPR2015LSC. +/// +/// LSC(Linear Spectral Clustering) produces compact and uniform superpixels with low +/// computational costs.Basically, a normalized cuts formulation of the superpixel +/// segmentation is adopted based on a similarity metric that measures the color +/// similarity and space proximity between image pixels.LSC is of linear computational +/// complexity and high memory efficiency and is able to preserve global properties of images. +/// +// ReSharper disable once InconsistentNaming +public class SuperpixelLSC : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected SuperpixelLSC(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Class implementing the LSC (Linear Spectral Clustering) superpixels. + /// + /// The function initializes a SuperpixelLSC object for the input image. It sets the parameters of + /// superpixel algorithm, which are: region_size and ruler.It preallocate some buffers for future + /// computing iterations over the given image.An example of LSC is illustrated in the following picture. + /// For enhanced results it is recommended for color images to preprocess image with little gaussian blur + /// with a small 3 x 3 kernel and additional conversion into CieLAB color space. + /// + /// image Image to segment + /// Chooses an average superpixel size measured in pixels + /// Chooses the enforcement of superpixel compactness factor of superpixel + /// + public static SuperpixelLSC Create( + InputArray image, int regionSize = 10, float ratio = 0.075f) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createSuperpixelLSC( + image.CvPtr, regionSize, ratio, out var p)); + + GC.KeepAlive(image); + return new SuperpixelLSC(p); + } + + /// + /// Calculates the actual amount of superpixels on a given segmentation computed and stored in SuperpixelLSC object. + /// + /// + public virtual int GetNumberOfSuperpixels() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelLSC_getNumberOfSuperpixels( + ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Calculates the superpixel segmentation on a given image with the initialized + /// parameters in the SuperpixelLSC object. + /// + /// This function can be called again without the need of initializing the algorithm with + /// createSuperpixelLSC(). This save the computational cost of allocating memory for all the + /// structures of the algorithm. + /// + /// The function computes the superpixels segmentation of an image with the parameters initialized + /// with the function createSuperpixelLSC(). The algorithms starts from a grid of superpixels and + /// then refines the boundaries by proposing updates of edges boundaries. + /// + /// Number of iterations. Higher number improves the result. + public virtual void Iterate(int numIterations = 10) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelLSC_iterate( + ptr, numIterations)); + GC.KeepAlive(this); + } + + /// + /// Returns the segmentation labeling of the image. + /// Each label represents a superpixel, and each pixel is assigned to one superpixel label. + /// + /// The function returns an image with the labels of the superpixel segmentation.The labels are in + /// the range [0, getNumberOfSuperpixels()]. + /// + /// Return: A CV_32SC1 integer array containing the labels of the superpixel + /// segmentation.The labels are in the range[0, getNumberOfSuperpixels()]. + public virtual void GetLabels(OutputArray labelsOut) + { + ThrowIfDisposed(); + if (labelsOut is null) + throw new ArgumentNullException(nameof(labelsOut)); + labelsOut.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelLSC_getLabels( + ptr, labelsOut.CvPtr)); + GC.KeepAlive(this); + labelsOut.Fix(); + } + + /// + /// Returns the mask of the superpixel segmentation stored in SuperpixelLSC object. + /// The function return the boundaries of the superpixel segmentation. + /// + /// Return: CV_8U1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise. + /// If false, the border is only one pixel wide, otherwise all pixels at the border are masked. + public virtual void GetLabelContourMask(OutputArray image, bool thickLine = true) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelLSC_getLabelContourMask( + ptr, image.CvPtr, thickLine ? 1 : 0)); + GC.KeepAlive(this); + image.Fix(); + } + + /// + /// Enforce label connectivity. + /// The function merge component that is too small, assigning the previously found adjacent label + /// to this component.Calling this function may change the final number of superpixels. + /// + /// The minimum element size in percents that should be absorbed into a bigger + /// superpixel.Given resulted average superpixel size valid value should be in 0-100 range, 25 means + /// that less then a quarter sized superpixel should be absorbed, this is default. + public virtual void EnforceLabelConnectivity(int minElementSize = 20) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelLSC_enforceLabelConnectivity( + ptr, minElementSize)); + GC.KeepAlive(this); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_SuperpixelLSC_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_SuperpixelLSC_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelSEEDS.cs b/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelSEEDS.cs new file mode 100644 index 000000000..e80b4a819 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelSEEDS.cs @@ -0,0 +1,183 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels +/// algorithm described in @cite VBRV14. +/// +/// The algorithm uses an efficient hill-climbing algorithm to optimize the superpixels' energy +/// function that is based on color histograms and a boundary term, which is optional.The energy +/// function encourages superpixels to be of the same color, and if the boundary term is activated, the +/// superpixels have smooth boundaries and are of similar shape. In practice it starts from a regular +/// grid of superpixels and moves the pixels or blocks of pixels at the boundaries to refine the +/// solution.The algorithm runs in real-time using a single CPU. +/// +// ReSharper disable once InconsistentNaming +public class SuperpixelSEEDS : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected SuperpixelSEEDS(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Initializes a SuperpixelSEEDS object. + /// + /// The function initializes a SuperpixelSEEDS object for the input image. It stores the parameters of + /// the image: image_width, image_height and image_channels.It also sets the parameters of the SEEDS + /// superpixel algorithm, which are: num_superpixels, num_levels, use_prior, histogram_bins and + /// double_step. + /// + /// The number of levels in num_levels defines the amount of block levels that the algorithm use in the + /// optimization.The initialization is a grid, in which the superpixels are equally distributed through + /// the width and the height of the image.The larger blocks correspond to the superpixel size, and the + /// levels with smaller blocks are formed by dividing the larger blocks into 2 x 2 blocks of pixels, + /// recursively until the smaller block level. An example of initialization of 4 block levels is + /// illustrated in the following figure. + /// + /// Image width. + /// Image height. + /// Number of channels of the image. + /// Desired number of superpixels. Note that the actual number may be smaller + /// due to restrictions(depending on the image size and num_levels). Use getNumberOfSuperpixels() to + /// get the actual number. + /// Number of block levels. The more levels, the more accurate is the segmentation, + /// but needs more memory and CPU time. + /// enable 3x3 shape smoothing term if \>0. A larger value leads to smoother shapes. prior + /// must be in the range[0, 5]. + /// Number of histogram bins. + /// If true, iterate each block level twice for higher accuracy. + /// + public static SuperpixelSEEDS Create( + int imageWidth, int imageHeight, int imageChannels, + int numSuperpixels, int numLevels, int prior = 2, + int histogramBins = 5, bool doubleStep = false) + { + NativeMethods.HandleException( + NativeMethods.ximgproc_createSuperpixelSEEDS( + imageWidth, imageHeight, imageChannels, numSuperpixels, numLevels, prior, + histogramBins, doubleStep ? 1 : 0, out var p)); + + return new SuperpixelSEEDS(p); + } + + /// + /// Calculates the superpixel segmentation on a given image stored in SuperpixelSEEDS object. + /// + /// The function computes the superpixels segmentation of an image with the parameters initialized + /// with the function createSuperpixelSEEDS(). + /// + /// + public virtual int GetNumberOfSuperpixels() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSEEDS_getNumberOfSuperpixels( + ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Input image. Supported formats: CV_8U, CV_16U, CV_32F. Image size & number of + /// channels must match with the initialized image size & channels with the function + /// createSuperpixelSEEDS(). It should be in HSV or Lab color space.Lab is a bit better, but also slower. + /// + /// Supported formats: CV_8U, CV_16U, CV_32F. Image size & number of + /// channels must match with the initialized image size & channels with the function + /// createSuperpixelSEEDS(). It should be in HSV or Lab color space.Lab is a bit better, but also slower. + /// Number of pixel level iterations. Higher number improves the result. + public virtual void Iterate(InputArray img, int numIterations = 10) + { + ThrowIfDisposed(); + if (img is null) + throw new ArgumentNullException(nameof(img)); + img.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSEEDS_iterate( + ptr, img.CvPtr, numIterations)); + + GC.KeepAlive(this); + GC.KeepAlive(img); + } + + /// + /// Returns the segmentation labeling of the image. + /// Each label represents a superpixel, and each pixel is assigned to one superpixel label. + /// + /// The function returns an image with ssthe labels of the superpixel segmentation. The labels are in + /// the range[0, getNumberOfSuperpixels()]. + /// + /// Return: A CV_32UC1 integer array containing the labels of the superpixel + /// segmentation.The labels are in the range[0, getNumberOfSuperpixels()]. + public virtual void GetLabels(OutputArray labelsOut) + { + ThrowIfDisposed(); + if (labelsOut is null) + throw new ArgumentNullException(nameof(labelsOut)); + labelsOut.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSEEDS_getLabels( + ptr, labelsOut.CvPtr)); + GC.KeepAlive(this); + labelsOut.Fix(); + } + + /// + /// Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object. + /// The function return the boundaries of the superpixel segmentation. + /// + /// Return: CV_8U1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise. + /// If false, the border is only one pixel wide, otherwise all pixels at the border are masked. + public virtual void GetLabelContourMask(OutputArray image, bool thickLine = true) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSEEDS_getLabelContourMask( + ptr, image.CvPtr, thickLine ? 1 : 0)); + GC.KeepAlive(this); + image.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_SuperpixelSEEDS_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_SuperpixelSEEDS_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelSLIC.cs b/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelSLIC.cs new file mode 100644 index 000000000..75c656829 --- /dev/null +++ b/src/OpenCvSharp/Modules/ximgproc/Superpixel/SuperpixelSLIC.cs @@ -0,0 +1,183 @@ +using OpenCvSharp.Internal; + +// ReSharper disable once CheckNamespace +namespace OpenCvSharp.XImgProc; + +/// +/// Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels +/// algorithm described in @cite Achanta2012. +/// +// ReSharper disable once InconsistentNaming +// ReSharper disable once IdentifierTypo +public class SuperpixelSLIC : Algorithm +{ + private Ptr? detectorPtr; + + /// + /// Creates instance by raw pointer + /// + protected SuperpixelSLIC(IntPtr p) + { + detectorPtr = new Ptr(p); + ptr = detectorPtr.Get(); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + detectorPtr?.Dispose(); + detectorPtr = null; + base.DisposeManaged(); + } + + /// + /// Initialize a SuperpixelSLIC object. + /// + /// The function initializes a SuperpixelSLIC object for the input image. It sets the parameters of chosen + /// superpixel algorithm, which are: region_size and ruler.It preallocate some buffers for future + /// computing iterations over the given image.For enanched results it is recommended for color images to + /// preprocess image with little gaussian blur using a small 3 x 3 kernel and additional conversion into + /// CieLAB color space.An example of SLIC versus SLICO and MSLIC is ilustrated in the following picture. + /// + /// Image to segment + /// Chooses the algorithm variant to use: + /// SLIC segments image using a desired region_size, and in addition SLICO will optimize using adaptive compactness factor, + /// while MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels. + /// Chooses an average superpixel size measured in pixels + /// Chooses the enforcement of superpixel smoothness factor of superpixel + /// + public static SuperpixelSLIC Create( + InputArray image, + SLICType algorithm = SLICType.SLICO, + int regionSize = 10, + float ruler = 10.0f) + { + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_createSuperpixelSLIC( + image.CvPtr, (int)algorithm, regionSize, ruler, out var p)); + + GC.KeepAlive(image); + return new SuperpixelSLIC(p); + } + + /// + /// Calculates the actual amount of superpixels on a given segmentation computed + /// and stored in SuperpixelSLIC object. + /// + /// + public virtual int GetNumberOfSuperpixels() + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSLIC_getNumberOfSuperpixels( + ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + /// + /// Calculates the superpixel segmentation on a given image with the initialized + /// parameters in the SuperpixelSLIC object. + /// + /// This function can be called again without the need of initializing the algorithm with + /// createSuperpixelSLIC(). This save the computational cost of allocating memory for all the + /// structures of the algorithm. + /// + /// The function computes the superpixels segmentation of an image with the parameters initialized + /// with the function createSuperpixelSLIC(). The algorithms starts from a grid of superpixels and + /// then refines the boundaries by proposing updates of edges boundaries. + /// + /// Number of iterations. Higher number improves the result. + public virtual void Iterate(int numIterations = 10) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSLIC_iterate( + ptr, numIterations)); + GC.KeepAlive(this); + } + + /// + /// Returns the segmentation labeling of the image. + /// Each label represents a superpixel, and each pixel is assigned to one superpixel label. + /// + /// The function returns an image with the labels of the superpixel segmentation. The labels are in + /// the range[0, getNumberOfSuperpixels()]. + /// + /// + public virtual void GetLabels(OutputArray labelsOut) + { + ThrowIfDisposed(); + if (labelsOut is null) + throw new ArgumentNullException(nameof(labelsOut)); + labelsOut.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSLIC_getLabels( + ptr, labelsOut.CvPtr)); + GC.KeepAlive(this); + labelsOut.Fix(); + } + + /// + /// Returns the mask of the superpixel segmentation stored in SuperpixelSLIC object. + /// The function return the boundaries of the superpixel segmentation. + /// + /// Return: CV_8U1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise. + /// If false, the border is only one pixel wide, otherwise all pixels at the border are masked. + public virtual void GetLabelContourMask(OutputArray image, bool thickLine = true) + { + ThrowIfDisposed(); + if (image is null) + throw new ArgumentNullException(nameof(image)); + image.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSLIC_getLabelContourMask( + ptr, image.CvPtr, thickLine ? 1 : 0)); + GC.KeepAlive(this); + image.Fix(); + } + + /// + /// Enforce label connectivity. + /// + /// The function merge component that is too small, assigning the previously found adjacent label + /// to this component.Calling this function may change the final number of superpixels. + /// + /// The minimum element size in percents that should be absorbed into a bigger + /// superpixel.Given resulted average superpixel size valid value should be in 0-100 range, 25 means + /// that less then a quarter sized superpixel should be absorbed, this is default. + public virtual void EnforceLabelConnectivity(int minElementSize = 20) + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.ximgproc_SuperpixelSLIC_enforceLabelConnectivity( + ptr, minElementSize)); + GC.KeepAlive(this); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_SuperpixelSLIC_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.ximgproc_Ptr_SuperpixelSLIC_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xphoto/CvXPhoto.cs b/src/OpenCvSharp/Modules/xphoto/CvXPhoto.cs new file mode 100644 index 000000000..7094b615f --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/CvXPhoto.cs @@ -0,0 +1,288 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XPhoto; + +// ReSharper disable InconsistentNaming +/// +/// cv::xphoto functions +/// +public static class CvXPhoto +{ + #region bm3d_image_denoising.hpp + + /// + /// Performs image denoising using the Block-Matching and 3D-filtering algorithm + /// (http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf) with several computational + /// optimizations.Noise expected to be a gaussian white noise. + /// + /// Input 8-bit or 16-bit 1-channel image. + /// Output image of the first step of BM3D with the same size and type as src. + /// Output image of the second step of BM3D with the same size and type as src. + /// Parameter regulating filter strength. Big h value perfectly removes noise but also + /// removes image details, smaller h value preserves details but also preserves some noise. + /// Size in pixels of the template patch that is used for block-matching. Should be power of 2. + /// Size in pixels of the window that is used to perform block-matching. + /// Affect performance linearly: greater searchWindowsSize - greater denoising time. Must be larger than templateWindowSize. + /// Block matching threshold for the first step of BM3D (hard thresholding), + /// i.e.maximum distance for which two blocks are considered similar.Value expressed in euclidean distance. + /// Block matching threshold for the second step of BM3D (Wiener filtering), + /// i.e.maximum distance for which two blocks are considered similar. Value expressed in euclidean distance. + /// Maximum size of the 3D group for collaborative filtering. + /// Sliding step to process every next reference block. + /// Kaiser window parameter that affects the sidelobe attenuation of the transform of the + /// window.Kaiser window is used in order to reduce border effects.To prevent usage of the window, set beta to zero. + /// Norm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results. + /// Step of BM3D to be executed. Allowed are only BM3D_STEP1 and BM3D_STEPALL. + /// BM3D_STEP2 is not allowed as it requires basic estimate to be present. + /// Type of the orthogonal transform used in collaborative filtering step. + /// Currently only Haar transform is supported. + public static void Bm3dDenoising( + InputArray src, + InputOutputArray dstStep1, + OutputArray dstStep2, + float h = 1, + int templateWindowSize = 4, + int searchWindowSize = 16, + int blockMatchingStep1 = 2500, + int blockMatchingStep2 = 400, + int groupSize = 8, + int slidingStep = 1, + float beta = 2.0f, + NormTypes normType = NormTypes.L2, + Bm3dSteps step = Bm3dSteps.STEPALL, + TransformTypes transformType = TransformTypes.HAAR) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dstStep1 is null) + throw new ArgumentNullException(nameof(dstStep1)); + if (dstStep2 is null) + throw new ArgumentNullException(nameof(dstStep2)); + + src.ThrowIfDisposed(); + dstStep1.ThrowIfNotReady(); + dstStep2.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_bm3dDenoising1( + src.CvPtr, dstStep1.CvPtr, dstStep2.CvPtr, h, templateWindowSize, + searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, + (int) normType, (int) step, (int) transformType)); + + GC.KeepAlive(src); + dstStep1.Fix(); + dstStep2.Fix(); + } + + /// + /// Performs image denoising using the Block-Matching and 3D-filtering algorithm + /// (http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf) with several computational optimizations.Noise expected to be a gaussian white noise. + /// + /// Input 8-bit or 16-bit 1-channel image. + /// Output image with the same size and type as src. + /// Parameter regulating filter strength. Big h value perfectly removes noise but also + /// removes image details, smaller h value preserves details but also preserves some noise. + /// Size in pixels of the template patch that is used for block-matching. Should be power of 2. + /// Size in pixels of the window that is used to perform block-matching. + /// Affect performance linearly: greater searchWindowsSize - greater denoising time. Must be larger than templateWindowSize. + /// Block matching threshold for the first step of BM3D (hard thresholding), + /// i.e.maximum distance for which two blocks are considered similar.Value expressed in euclidean distance. + /// Block matching threshold for the second step of BM3D (Wiener filtering), + /// i.e.maximum distance for which two blocks are considered similar. Value expressed in euclidean distance. + /// Maximum size of the 3D group for collaborative filtering. + /// Sliding step to process every next reference block. + /// Kaiser window parameter that affects the sidelobe attenuation of the transform of the + /// window.Kaiser window is used in order to reduce border effects.To prevent usage of the window, set beta to zero. + /// Norm used to calculate distance between blocks. L2 is slower than L1 but yields more accurate results. + /// Step of BM3D to be executed. Allowed are only BM3D_STEP1 and BM3D_STEPALL. + /// BM3D_STEP2 is not allowed as it requires basic estimate to be present. + /// Type of the orthogonal transform used in collaborative filtering step. + /// Currently only Haar transform is supported. + public static void Bm3dDenoising( + InputArray src, + OutputArray dst, + float h = 1, + int templateWindowSize = 4, + int searchWindowSize = 16, + int blockMatchingStep1 = 2500, + int blockMatchingStep2 = 400, + int groupSize = 8, + int slidingStep = 1, + float beta = 2.0f, + NormTypes normType = NormTypes.L2, + Bm3dSteps step = Bm3dSteps.STEPALL, + TransformTypes transformType = TransformTypes.HAAR) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_bm3dDenoising2( + src.CvPtr, dst.CvPtr, h, templateWindowSize, + searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, + (int) normType, (int) step, (int) transformType)); + + GC.KeepAlive(src); + dst.Fix(); + } + + #endregion + + #region dct_image_denoising.hpp + + /// + /// The function implements simple dct-based denoising + /// + /// + /// http://www.ipol.im/pub/art/2011/ys-dct/ + /// + /// source image + /// destination image + /// expected noise standard deviation + /// size of block side where dct is computed + public static void DctDenoising(Mat src, Mat dst, double sigma, int psize = 16) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.xphoto_dctDenoising(src.CvPtr, dst.CvPtr, sigma, psize)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + #endregion + + #region inpainting.hpp + + /// + /// The function implements different single-image inpainting algorithms. + /// + /// source image, it could be of any type and any number of channels from 1 to 4. In case of 3- and 4-channels images the function expect them in CIELab colorspace or similar one, where first color component shows intensity, while second and third shows colors. Nonetheless you can try any colorspaces. + /// mask (CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels indicate area to be inpainted + /// destination image + /// see OpenCvSharp.XPhoto.InpaintTypes + public static void Inpaint(Mat src, Mat mask, Mat dst, InpaintTypes algorithm) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (mask is null) + throw new ArgumentNullException(nameof(mask)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + mask.ThrowIfDisposed(); + dst.ThrowIfDisposed(); + + NativeMethods.HandleException( + NativeMethods.xphoto_inpaint(src.CvPtr, mask.CvPtr, dst.CvPtr, (int)algorithm)); + + GC.KeepAlive(src); + GC.KeepAlive(mask); + GC.KeepAlive(dst); + } + + #endregion + + #region oilpainting.hpp + + /// + /// oilPainting. + /// See the book @cite Holzmann1988 for details. + /// + /// Input three-channel or one channel image (either CV_8UC3 or CV_8UC1) + /// Output image of the same size and type as src. + /// neighbouring size is 2-size+1 + /// image is divided by dynRatio before histogram processing + /// color space conversion code(see ColorConversionCodes). Histogram will used only first plane + public static void OilPainting( + InputArray src, OutputArray dst, int size, int dynRatio, + ColorConversionCodes? code = null) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_oilPainting( + src.CvPtr, dst.CvPtr, size, dynRatio, + code.HasValue ? (int)code : -1)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + } + + #endregion + + #region white_balance.hpp + + /// + /// Implements an efficient fixed-point approximation for applying channel gains, + /// which is the last step of multiple white balance algorithms. + /// + /// Input three-channel image in the BGR color space (either CV_8UC3 or CV_16UC3) + /// Output image of the same size and type as src. + /// gain for the B channel + /// gain for the G channel + /// gain for the R channel + public static void ApplyChannelGains(InputArray src, OutputArray dst, float gainB, float gainG, float gainR) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_applyChannelGains(src.CvPtr, dst.CvPtr, gainB, gainG, gainR)); + + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Creates an instance of GrayworldWB + /// + /// + public static GrayworldWB CreateGrayworldWB() + { + return GrayworldWB.Create(); + } + + /// + /// Creates an instance of LearningBasedWB + /// + /// Path to a .yml file with the model. If not specified, the default model is used + /// + public static LearningBasedWB CreateLearningBasedWB(string? model) + { + return LearningBasedWB.Create(model); + } + + /// + /// Creates an instance of SimpleWB + /// + /// + public static SimpleWB CreateSimpleWB() + { + return SimpleWB.Create(); + } + + #endregion +} diff --git a/src/OpenCvSharp/Modules/xphoto/Enum/Bm3dSteps.cs b/src/OpenCvSharp/Modules/xphoto/Enum/Bm3dSteps.cs new file mode 100644 index 000000000..61d422ab3 --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/Enum/Bm3dSteps.cs @@ -0,0 +1,26 @@ +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo + +namespace OpenCvSharp.XPhoto; + +/// +/// BM3D algorithm steps +/// +public enum Bm3dSteps +{ + /// + /// Execute all steps of the algorithm + /// + STEPALL = 0, + + /// + /// Execute only first step of the algorithm + /// + STEP1= 1, + + /// + /// Execute only second step of the algorithm + /// + STEP2 = 2 +} diff --git a/src/OpenCvSharp/Modules/xphoto/Enum/InpaintTypes.cs b/src/OpenCvSharp/Modules/xphoto/Enum/InpaintTypes.cs new file mode 100644 index 000000000..da86c4a45 --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/Enum/InpaintTypes.cs @@ -0,0 +1,43 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable IdentifierTypo + +namespace OpenCvSharp.XPhoto; + +/// +/// various inpainting algorithms +/// +public enum InpaintTypes +{ + /// + /// This algorithm searches for dominant correspondences(transformations) of image patches + /// and tries to seamlessly fill-in the area to be inpainted using this transformations inpaint + /// + SHIFTMAP = 0, + + /// + /// Performs Frequency Selective Reconstruction (FSR). + /// One of the two quality profiles BEST and FAST can be chosen, depending on the time available for reconstruction. + /// See @cite GenserPCS2018 and @cite SeilerTIP2015 for details. + /// + /// The algorithm may be utilized for the following areas of application: + /// 1. %Error Concealment (Inpainting). + /// The sampling mask indicates the missing pixels of the distorted input + /// image to be reconstructed. + /// 2. Non-Regular Sampling. + /// For more information on how to choose a good sampling mask, please review + /// @cite GroscheICIP2018 and @cite GroscheIST2018. + /// + /// 1-channel grayscale or 3-channel BGR image are accepted. + /// + /// Conventional accepted ranges: + /// - 0-255 for CV_8U + /// - 0-65535 for CV_16U + /// - 0-1 for CV_32F/CV_64F. + /// + FSR_BEST = 1, + + /// + /// See #INPAINT_FSR_BEST + /// + FSR_FAST = 2 +} diff --git a/src/OpenCvSharp/Modules/xphoto/Enum/TransformTypes.cs b/src/OpenCvSharp/Modules/xphoto/Enum/TransformTypes.cs new file mode 100644 index 000000000..804f9be5e --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/Enum/TransformTypes.cs @@ -0,0 +1,15 @@ +// ReSharper disable IdentifierTypo +// ReSharper disable CommentTypo +// ReSharper disable InconsistentNaming +namespace OpenCvSharp.XPhoto; + +/// +/// BM3D transform types +/// +public enum TransformTypes +{ + /// + /// Un-normalized Haar transform + /// + HAAR = 0 +} diff --git a/src/OpenCvSharp/Modules/xphoto/GrayworldWB.cs b/src/OpenCvSharp/Modules/xphoto/GrayworldWB.cs new file mode 100644 index 000000000..b358d40d1 --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/GrayworldWB.cs @@ -0,0 +1,107 @@ +using OpenCvSharp.Internal; + +// ReSharper disable IdentifierTypo +// ReSharper disable InconsistentNaming +// ReSharper disable CommentTypo + +namespace OpenCvSharp.XPhoto; + +/// +/// Gray-world white balance algorithm. +/// +public class GrayworldWB : WhiteBalancer +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + internal GrayworldWB(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates an instance of GrayworldWB + /// + /// + public static GrayworldWB Create() + { + NativeMethods.HandleException( + NativeMethods.xphoto_createGrayworldWB(out var ptr)); + return new GrayworldWB(ptr); + } + + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Maximum saturation for a pixel to be included in the gray-world assumption. + /// + public float SaturationThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_GrayworldWB_SaturationThreshold_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_GrayworldWB_SaturationThreshold_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Applies white balancing to the input image. + /// + /// Input image + /// White balancing result + public override void BalanceWhite(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_GrayworldWB_balanceWhite(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_GrayworldWB_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_GrayworldWB_delete(ptr)); + base.DisposeUnmanaged(); + } + + } +} diff --git a/src/OpenCvSharp/Modules/xphoto/LearningBasedWB.cs b/src/OpenCvSharp/Modules/xphoto/LearningBasedWB.cs new file mode 100644 index 000000000..233b8c4ae --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/LearningBasedWB.cs @@ -0,0 +1,171 @@ +using OpenCvSharp.Internal; + +namespace OpenCvSharp.XPhoto; + +/// +/// More sophisticated learning-based automatic white balance algorithm. +/// +// ReSharper disable once InconsistentNaming +public class LearningBasedWB : WhiteBalancer +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + internal LearningBasedWB(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates an instance of LearningBasedWB + /// + /// Path to a .yml file with the model. If not specified, the default model is used + /// + public static LearningBasedWB Create(string? model) + { + NativeMethods.HandleException( + NativeMethods.xphoto_createLearningBasedWB(model ?? "", out var ptr)); + return new LearningBasedWB(ptr); + } + + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Defines the size of one dimension of a three-dimensional RGB histogram that is used internally by the algorithm. It often makes sense to increase the number of bins for images with higher bit depth (e.g. 256 bins for a 12 bit image). + /// + public int HistBinNum + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_HistBinNum_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_HistBinNum_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Maximum possible value of the input image (e.g. 255 for 8 bit images, 4095 for 12 bit images) + /// + public int RangeMaxVal + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_RangeMaxVal_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_RangeMaxVal_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Threshold that is used to determine saturated pixels, i.e. pixels where at least one of the channels exceeds + /// + public float SaturationThreshold + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_SaturationThreshold_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_SaturationThreshold_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Applies white balancing to the input image. + /// + /// Input image + /// White balancing result + public override void BalanceWhite(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_balanceWhite(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + /// + /// Implements the feature extraction part of the algorithm. + /// + /// Input three-channel image (BGR color space is assumed). + /// An array of four (r,g) chromaticity tuples corresponding to the features listed above. + public void ExtractSimpleFeatures(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_LearningBasedWB_extractSimpleFeatures(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_LearningBasedWB_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_LearningBasedWB_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xphoto/SimpleWB.cs b/src/OpenCvSharp/Modules/xphoto/SimpleWB.cs new file mode 100644 index 000000000..48cf66ff7 --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/SimpleWB.cs @@ -0,0 +1,194 @@ +using OpenCvSharp.Internal; + +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.XPhoto; + +/// +/// A simple white balance algorithm that works by independently stretching each of the input image channels to the specified range. For increased robustness it ignores the top and bottom p% of pixel values. +/// +public class SimpleWB : WhiteBalancer +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + internal SimpleWB(IntPtr p) + { + ptrObj = new Ptr(p); + ptr = ptrObj.Get(); + } + + /// + /// Creates an instance of SimpleWB + /// + /// + public static SimpleWB Create() + { + NativeMethods.HandleException( + NativeMethods.xphoto_createSimpleWB(out var ptr)); + return new SimpleWB(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Input image range maximum value. + /// + public float InputMax + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_InputMax_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_InputMax_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Input image range minimum value. + /// + public float InputMin + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_InputMin_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_InputMin_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Output image range maximum value. + /// + public float OutputMax + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_OutputMax_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_OutputMax_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Output image range minimum value. + /// + public float OutputMin + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_OutputMin_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_OutputMin_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Percent of top/bottom values to ignore. + /// + public float P + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_P_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_P_set(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Applies white balancing to the input image. + /// + /// Input image + /// White balancing result + public override void BalanceWhite(InputArray src, OutputArray dst) + { + if (src is null) + throw new ArgumentNullException(nameof(src)); + if (dst is null) + throw new ArgumentNullException(nameof(dst)); + src.ThrowIfDisposed(); + dst.ThrowIfNotReady(); + + NativeMethods.HandleException( + NativeMethods.xphoto_SimpleWB_balanceWhite(ptr, src.CvPtr, dst.CvPtr)); + + GC.KeepAlive(this); + GC.KeepAlive(src); + GC.KeepAlive(dst); + dst.Fix(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_SimpleWB_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_SimpleWB_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xphoto/TonemapDurand.cs b/src/OpenCvSharp/Modules/xphoto/TonemapDurand.cs new file mode 100644 index 000000000..aad6c857d --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/TonemapDurand.cs @@ -0,0 +1,172 @@ +using OpenCvSharp.Internal; + +// ReSharper disable UnusedMember.Global + +namespace OpenCvSharp.XPhoto; + +/// +/// This algorithm decomposes image into two layers: base layer and detail layer using bilateral filter +/// and compresses contrast of the base layer thus preserving all the details. +/// +/// This implementation uses regular bilateral filter from OpenCV. +/// +/// Saturation enhancement is possible as in cv::TonemapDrago. +/// +/// For more information see @cite DD02 . +/// +public sealed class TonemapDurand : Tonemap +{ + private Ptr? ptrObj; + + /// + /// Constructor + /// + private TonemapDurand(IntPtr ptrObjPtr) + : base(GetEntityPointer(ptrObjPtr, out var po)) + { + ptrObj = po; + } + + private static IntPtr GetEntityPointer(IntPtr ptrObjPtr, out Ptr ptrObj) + { + ptrObj = new Ptr(ptrObjPtr); + return ptrObj.Get(); + } + + /// + /// Creates TonemapDurand object + /// + /// positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma + /// equal to 2.2f is suitable for most displays. + /// Generally gamma > 1 brightens the image and gamma < 1 darkens it. + /// resulting contrast on logarithmic scale, i. e. log(max / min), where max and min + /// positive saturation enhancement value. 1.0 preserves saturation, values greater + /// than 1 increase saturation and values less than 1 decrease it. + /// bilateral filter sigma in coordinate space + /// bilateral filter sigma in color space + /// + public static TonemapDurand Create( + float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigmaSpace = 2.0f, float sigmaColor = 2.0f) + { + NativeMethods.HandleException( + NativeMethods.xphoto_createTonemapDurand(gamma, contrast, saturation, sigmaSpace, sigmaColor, out var ptr)); + return new TonemapDurand(ptr); + } + + /// + /// Releases managed resources + /// + protected override void DisposeManaged() + { + ptrObj?.Dispose(); + ptrObj = null; + base.DisposeManaged(); + } + + /// + /// Gets or sets positive saturation enhancement value. 1.0 preserves saturation, values greater + /// than 1 increase saturation and values less than 1 decrease it. + /// + public float Saturation + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_getSaturation(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_setSaturation(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets resulting contrast on logarithmic scale, i. e. log(max / min), where max and min + /// + public float Contrast + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_getContrast(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_setContrast(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets bilateral filter sigma in coordinate space + /// + public float SigmaSpace + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_getSigmaSpace(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_setSigmaSpace(ptr, value)); + GC.KeepAlive(this); + } + } + + /// + /// Gets or sets bilateral filter sigma in color space + /// + public float SigmaColor + { + get + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_getSigmaColor(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + set + { + ThrowIfDisposed(); + NativeMethods.HandleException( + NativeMethods.xphoto_TonemapDurand_setSigmaColor(ptr, value)); + GC.KeepAlive(this); + } + } + + private class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_TonemapDurand_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.xphoto_Ptr_TonemapDurand_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharp/Modules/xphoto/WhiteBalancer.cs b/src/OpenCvSharp/Modules/xphoto/WhiteBalancer.cs new file mode 100644 index 000000000..9a7380cad --- /dev/null +++ b/src/OpenCvSharp/Modules/xphoto/WhiteBalancer.cs @@ -0,0 +1,14 @@ +namespace OpenCvSharp.XPhoto; + +/// +/// The base class for auto white balance algorithms. +/// +public abstract class WhiteBalancer : Algorithm +{ + /// + /// Applies white balancing to the input image. + /// + /// Input image + /// White balancing result + public abstract void BalanceWhite(InputArray src, OutputArray dst); +} diff --git a/src/OpenCvSharp/OpenCvSharp.csproj b/src/OpenCvSharp/OpenCvSharp.csproj new file mode 100644 index 000000000..9f75ea387 --- /dev/null +++ b/src/OpenCvSharp/OpenCvSharp.csproj @@ -0,0 +1,74 @@ + + + + netstandard2.0;netstandard2.1;net48;net6.0; + true + true + OpenCvSharp + Key.snk + true + true + OpenCvSharp + false + false + false + Debug;Release;Release-JP + 12 + enable + enable + true + true + https://github.com/shimat/opencvsharp.git + git + snupkg + + + AllEnabledByDefault + + + + + + + + + + + + + + + + PreserveNewest + + + + + + + + + + + + + $(DefineConstants);DOTNET_FRAMEWORK; + + + + TRACE;DOTNETCORE;WINRT + + + + TRACE;DOTNETCORE; + + + + $(DefineConstants);LANG_JP + + + + 1701;1702;CA1303;CA1707;CA1814;CA1401;CA1720;CA2213; + + + diff --git a/src/OpenCvSharp/OpenCvSharp.xproj b/src/OpenCvSharp/OpenCvSharp.xproj deleted file mode 100644 index 7cad9645f..000000000 --- a/src/OpenCvSharp/OpenCvSharp.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - eb310923-197f-4e20-b123-3a3e7f1d5069 - OpenCvSharp - .\obj - .\bin\ - v4.5 - - - 2.0 - - - \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods.cs b/src/OpenCvSharp/PInvoke/NativeMethods.cs deleted file mode 100644 index 37a492dc0..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods.cs +++ /dev/null @@ -1,226 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.InteropServices; -#if DOTNET_FRAMEWORK -using System.Security; -using System.Security.Permissions; -#endif -using OpenCvSharp.Util; - -// ReSharper disable InconsistentNaming -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - /// - /// P/Invoke methods of OpenCV 2.x C++ interface - /// -#if DOTNET_FRAMEWORK - [SuppressUnmanagedCodeSecurity] -#endif - public static partial class NativeMethods - { - /// - /// Is tried P/Invoke once - /// - private static bool tried = false; - - //public const string DllVCRuntime = "vcruntime140"; - //public const string DllMsvcp = "msvcp140"; - public const string DllExtern = "OpenCvSharpExtern"; - public const string Version = "320"; - - private static readonly string[] RuntimeDllNames = - { - //DllVCRuntime, - //DllMsvcp, - }; - - private static readonly string[] OpenCVDllNames = - { - //"opencv_world", - }; - - public const string DllFfmpegX86 = "opencv_ffmpeg" + Version; - public const string DllFfmpegX64 = DllFfmpegX86 + "_64"; - - /// - /// Static constructor - /// -#if DOTNET_FRAMEWORK - [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] -#endif - static NativeMethods() - { - LoadLibraries(WindowsLibraryLoader.Instance.AdditionalPaths); - - // call cv to enable redirecting - TryPInvoke(); - } - - /// - /// Load DLL files dynamically using Win32 LoadLibrary - /// - /// - public static void LoadLibraries(IEnumerable additionalPaths = null) - { - if (IsUnix()) - return; - - string[] ap = additionalPaths == null ? new string[0] : EnumerableEx.ToArray(additionalPaths); - List runtimePaths = new List (ap); -#if DOTNET_FRAMEWORK - runtimePaths.Add(Environment.GetFolderPath(Environment.SpecialFolder.System)); -#endif - foreach (string dll in RuntimeDllNames) - { - WindowsLibraryLoader.Instance.LoadLibrary(dll, runtimePaths); - } - foreach (string dll in OpenCVDllNames) - { - WindowsLibraryLoader.Instance.LoadLibrary(dll + Version, ap); - } - - // calib3d, contrib, core, features2d, flann, highgui, imgproc, legacy, - // ml, nonfree, objdetect, photo, superres, video, videostab - WindowsLibraryLoader.Instance.LoadLibrary(DllExtern, ap); - - // Redirection of error occurred in native library - IntPtr zero = IntPtr.Zero; - IntPtr current = redirectError(ErrorHandlerThrowException, zero, ref zero); - if (current != IntPtr.Zero) - { -#if net20 || net40 || uwp - ErrorHandlerDefault = (CvErrorCallback)Marshal.GetDelegateForFunctionPointer( - current, typeof(CvErrorCallback)); -#else - ErrorHandlerDefault = Marshal.GetDelegateForFunctionPointer(current); -#endif - } - else - { - ErrorHandlerDefault = null; - } - } - - /// - /// Checks whether PInvoke functions can be called - /// - private static void TryPInvoke() - { - if (tried) - return; - tried = true; - - try - { - core_Mat_sizeof(); - } - catch (DllNotFoundException e) - { - var exception = PInvokeHelper.CreateException(e); -#if !uwp && !uap10 - try{Console.WriteLine(exception.Message);} - catch{} -#endif - try{Debug.WriteLine(exception.Message);} - catch{} - throw exception; - } - catch (BadImageFormatException e) - { - var exception = PInvokeHelper.CreateException(e); -#if !uwp && !uap10 - try { Console.WriteLine(exception.Message); } - catch { } -#endif - try { Debug.WriteLine(exception.Message); } - catch { } - throw exception; - } - catch (Exception e) - { - Exception ex = e.InnerException ?? e; -#if !uwp && !uap10 - try{ Console.WriteLine(ex.Message); } - catch{} -#endif - try { Debug.WriteLine(ex.Message); } - catch{} - throw; - } - } - - /// - /// Returns whether the OS is Windows or not - /// - /// - public static bool IsWindows() - { - return !IsUnix(); - } - - /// - /// Returns whether the OS is *nix or not - /// - /// - public static bool IsUnix() - { -#if DOTNET_FRAMEWORK - var p = Environment.OSVersion.Platform; - return (p == PlatformID.Unix || - p == PlatformID.MacOSX || - (int)p == 128); -#elif uap10 - return false; -#else - return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || - RuntimeInformation.IsOSPlatform(OSPlatform.OSX); -#endif - } - - /// - /// Returns whether the runtime is Mono or not - /// - /// - public static bool IsMono() - { - return (Type.GetType("Mono.Runtime") != null); - } - -#region Error redirection - /// - /// Custom error handler to be thrown by OpenCV - /// - public static readonly CvErrorCallback ErrorHandlerThrowException = - delegate(ErrorCode status, string funcName, string errMsg, string fileName, int line, IntPtr userdata) - { - try - { - //cvSetErrStatus(CvStatus.StsOk); - return 0; - } - finally - { - throw new OpenCVException(status, funcName, errMsg, fileName, line); - } - }; - - /// - /// Custom error handler to ignore all OpenCV errors - /// - public static readonly CvErrorCallback ErrorHandlerIgnorance = - delegate(ErrorCode status, string funcName, string errMsg, string fileName, int line, IntPtr userdata) - { - //cvSetErrStatus(CvStatus.StsOk); - return 0; - }; - - /// - /// Default error handler - /// - public static CvErrorCallback ErrorHandlerDefault; -#endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_bgsegm.cs b/src/OpenCvSharp/PInvoke/NativeMethods_bgsegm.cs deleted file mode 100644 index 9f2314610..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_bgsegm.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region BackgroundSubtractorMOG - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr bgsegm_createBackgroundSubtractorMOG( - int history, int nmixtures, double backgroundRatio, double noiseSigma); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_Ptr_BackgroundSubtractorMOG_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr bgsegm_Ptr_BackgroundSubtractorMOG_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorMOG_getHistory(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorMOG_setHistory(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorMOG_getNMixtures(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorMOG_setNMixtures(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorMOG_getBackgroundRatio(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorMOG_setBackgroundRatio(IntPtr ptr, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorMOG_getNoiseSigma(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorMOG_setNoiseSigma(IntPtr ptr, double value); - - #endregion - - #region BackgroundSubtractorGMG - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr bgsegm_createBackgroundSubtractorGMG( - int initializationFrames, double decisionThreshold); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_Ptr_BackgroundSubtractorGMG_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr bgsegm_Ptr_BackgroundSubtractorGMG_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorGMG_getMaxFeatures(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setMaxFeatures(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorGMG_getDefaultLearningRate(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setDefaultLearningRate(IntPtr ptr, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorGMG_getNumFrames(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setNumFrames(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorGMG_getQuantizationLevels(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setQuantizationLevels(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorGMG_getBackgroundPrior(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setBackgroundPrior(IntPtr ptr, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorGMG_getSmoothingRadius(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setSmoothingRadius(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorGMG_getDecisionThreshold(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setDecisionThreshold(IntPtr ptr, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int bgsegm_BackgroundSubtractorGMG_getUpdateBackgroundModel(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setUpdateBackgroundModel(IntPtr ptr, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorGMG_getMinVal(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setMinVal(IntPtr ptr, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double bgsegm_BackgroundSubtractorGMG_getMaxVal(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void bgsegm_BackgroundSubtractorGMG_setMaxVal(IntPtr ptr, double value); - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_flann.cs b/src/OpenCvSharp/PInvoke/NativeMethods_flann.cs deleted file mode 100644 index 5ced00641..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_flann.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; -using OpenCvSharp.Flann; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region Index - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Index_new(IntPtr features, IntPtr @params, int distType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_knnSearch1(IntPtr obj, [In] float[] queries, int queriesLength, [Out] int[] indices, [Out] float[] dists, int knn, IntPtr @params); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_knnSearch2(IntPtr obj, IntPtr queries, IntPtr indices, IntPtr dists, int knn, IntPtr @params); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_knnSearch3(IntPtr obj, IntPtr queries, [Out] int[] indices, [Out] float[] dists, int knn, IntPtr @params); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_radiusSearch1(IntPtr obj, [In] float[] queries, int queriesLength, [Out] int[] indices, int indicesLength, [Out] float[] dists, int dists_length, float radius, int maxResults, IntPtr @params); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_radiusSearch2(IntPtr obj, IntPtr queries, IntPtr indices, IntPtr dists, float radius, int maxResults, IntPtr @params); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Index_radiusSearch3(IntPtr obj, IntPtr queries, [Out] int[] indices, int indicesLength, [Out] float[] dists, int distsLength, float radius, int maxResults, IntPtr @params); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_Index_save(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern int flann_Index_veclen(IntPtr obj); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern int flann_Index_size(IntPtr obj); - #endregion - #region IndexParams - #region IndexParams - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_IndexParams_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_IndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_IndexParams_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_IndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_IndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_IndexParams_getString(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string defaultVal, [MarshalAs(UnmanagedType.LPStr)] StringBuilder result); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int flann_IndexParams_getInt(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int defaultVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern double flann_IndexParams_getDouble(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, double defaultVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_IndexParams_setString(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_IndexParams_setInt(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_IndexParams_setDouble(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_IndexParams_setFloat(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, float value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void flann_IndexParams_setBool(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string key, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_IndexParams_setAlgorithm(IntPtr obj, int value); - #endregion - #region LinearIndexParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_LinearIndexParams_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_LinearIndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_LinearIndexParams_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_LinearIndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_LinearIndexParams_delete(IntPtr obj); - - #endregion - #region KDTreeIndexParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_KDTreeIndexParams_new(int trees); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_KDTreeIndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_KDTreeIndexParams_new(int trees); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_KDTreeIndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_KDTreeIndexParams_delete(IntPtr obj); - - #endregion - #region KMeansIndexParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_KMeansIndexParams_new( - int branching, int iterations, [MarshalAs(UnmanagedType.I4)] FlannCentersInit centersInit, float cbIndex); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_KMeansIndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_KMeansIndexParams_new( - int branching, int iterations, [MarshalAs(UnmanagedType.I4)] FlannCentersInit centersInit, float cbIndex); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_KMeansIndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_KMeansIndexParams_delete(IntPtr obj); - - #endregion - #region CompositeIndexParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_CompositeIndexParams_new(int trees, int branching, int iterations, FlannCentersInit centersInit, float cbIndex); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_CompositeIndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_CompositeIndexParams_new(int trees, int branching, int iterations, FlannCentersInit centersInit, float cbIndex); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_CompositeIndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_CompositeIndexParams_delete(IntPtr obj); - - #endregion - #region AutotunedIndexParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_AutotunedIndexParams_new(float targetPrecision, float buildWeight, float memoryWeight, float sampleFraction); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_AutotunedIndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_AutotunedIndexParams_new(float targetPrecision, float buildWeight, float memoryWeight, float sampleFraction); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_AutotunedIndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_AutotunedIndexParams_delete(IntPtr obj); - - #endregion - #region SavedIndexParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr flann_SavedIndexParams_new([MarshalAs(UnmanagedType.LPStr)] string filename); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_SavedIndexParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_SavedIndexParams_new([MarshalAs(UnmanagedType.LPStr)] string filename); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_SavedIndexParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_SavedIndexParams_delete(IntPtr obj); - - #endregion - #region SearchParams - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_SearchParams_new(int checks, float eps, int sorted); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_SearchParams_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_SearchParams_new(int checks, float eps, int sorted); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr flann_Ptr_SearchParams_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void flann_Ptr_SearchParams_delete(IntPtr obj); - - #endregion - - #endregion - - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern int flann_hierarchicalClustering(IntPtr features, IntPtr centers, IntPtr @params); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_highgui.cs b/src/OpenCvSharp/PInvoke/NativeMethods_highgui.cs deleted file mode 100644 index 403f77686..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_highgui.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_namedWindow([MarshalAs(UnmanagedType.LPStr)] string winname, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_destroyWindow([MarshalAs(UnmanagedType.LPStr)] string winName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void highgui_destroyAllWindows(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_imshow([MarshalAs(UnmanagedType.LPStr)] string winname, IntPtr mat); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int highgui_startWindowThread(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int highgui_waitKey(int delay); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_resizeWindow([MarshalAs(UnmanagedType.LPStr)] string winName, int width, int height); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_moveWindow([MarshalAs(UnmanagedType.LPStr)] string winName, int x, int y); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_setWindowProperty([MarshalAs(UnmanagedType.LPStr)] string winName, int propId, double propValue); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_setWindowTitle([MarshalAs(UnmanagedType.LPStr)] string winname, [MarshalAs(UnmanagedType.LPStr)] string title); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern double highgui_getWindowProperty([MarshalAs(UnmanagedType.LPStr)] string winName, int propId); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_setMouseCallback(string winName, [MarshalAs(UnmanagedType.FunctionPtr)] CvMouseCallback onMouse, IntPtr userData); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int highgui_createTrackbar([MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName, - ref int value, int count, IntPtr onChange, IntPtr userData); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int highgui_getTrackbarPos([MarshalAs(UnmanagedType.LPStr)] string trackbarName, [MarshalAs(UnmanagedType.LPStr)] string winName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void highgui_setTrackbarPos(string trackbarName, string winName, int pos); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int highgui_createButton(string barName, IntPtr onChange, IntPtr userdata, int type, int initialButtonState); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_imgcodecs.cs b/src/OpenCvSharp/PInvoke/NativeMethods_imgcodecs.cs deleted file mode 100644 index e11b02f20..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_imgcodecs.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr imgcodecs_imread(string filename, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int imgcodecs_imreadmulti([MarshalAs(UnmanagedType.LPStr)] string filename, IntPtr mats, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int imgcodecs_imwrite([MarshalAs(UnmanagedType.LPStr)] string filename, IntPtr img, [In] int[] @params, int paramsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgcodecs_imdecode_Mat(IntPtr buf, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgcodecs_imdecode_vector(byte[] buf, IntPtr bufLength, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgcodecs_imdecode_InputArray(IntPtr buf, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int imgcodecs_imencode_vector([MarshalAs(UnmanagedType.LPStr)] string ext, IntPtr img, IntPtr buf, [In] int[] @params, int paramsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void imgcodecs_cvConvertImage_CvArr(IntPtr src, IntPtr dst, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void imgcodecs_cvConvertImage_Mat(IntPtr src, IntPtr dst, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int imgcodecs_cvHaveImageReader([MarshalAs(UnmanagedType.LPStr)] string fileName); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int imgcodecs_cvHaveImageWriter([MarshalAs(UnmanagedType.LPStr)] string fileName); - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_objdetect.cs b/src/OpenCvSharp/PInvoke/NativeMethods_objdetect.cs deleted file mode 100644 index 296ad2c57..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_objdetect.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region LatendSvmDetector - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr objdetect_LatentSvmDetector_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_LatentSvmDetector_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_LatentSvmDetector_clear(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_LatentSvmDetector_empty(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_LatentSvmDetector_load(IntPtr obj, - IntPtr[] fileNames, int fileNamesLength, - IntPtr[] classNames, int classNamesLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_LatentSvmDetector_detect( - IntPtr obj, IntPtr image, IntPtr objectDetections, - float overlapThreshold, int numThreads); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_LatentSvmDetector_getClassNames(IntPtr obj, IntPtr outValues); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr objdetect_LatentSvmDetector_getClassCount(IntPtr obj); - - #endregion - - #region CascadeClassfier - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr objdetect_CascadeClassifier_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr objdetect_CascadeClassifier_newFromFile([MarshalAs(UnmanagedType.LPStr)] string fileName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_CascadeClassifier_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_CascadeClassifier_empty(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int objdetect_CascadeClassifier_load(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fileName); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_CascadeClassifier_detectMultiScale1( - IntPtr obj, IntPtr image, IntPtr objects, - double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_CascadeClassifier_detectMultiScale2( - IntPtr obj, IntPtr image, IntPtr objects, - IntPtr rejectLevels, IntPtr levelWeights, - double scaleFactor, int minNeighbors, int flags, - Size minSize, Size maxSize, int outputRejectLevels); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_CascadeClassifier_isOldFormatCascade(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size objdetect_CascadeClassifier_getOriginalWindowSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_CascadeClassifier_getFeatureType(IntPtr obj); - - #endregion - - #region HOGDescriptor - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_sizeof(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr objdetect_HOGDescriptor_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr objdetect_HOGDescriptor_new2(Size winSize, Size blockSize, Size blockStride, Size cellSize, - int nbins, int derivAperture, double winSigma, [MarshalAs(UnmanagedType.I4)] HistogramNormType histogramNormType, - double l2HysThreshold, int gammaCorrection, int nlevels); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr objdetect_HOGDescriptor_new3([MarshalAs(UnmanagedType.LPStr)] string fileName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_delete(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr objdetect_HOGDescriptor_getDescriptorSize(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_checkDetectorSize(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double objdetect_HOGDescriptor_getWinSigma(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_setSVMDetector(IntPtr self, IntPtr svmdetector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern bool objdetect_HOGDescriptor_load(IntPtr self, [MarshalAs(UnmanagedType.LPStr)] string filename, [MarshalAs(UnmanagedType.LPStr)] string objname); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_save(IntPtr self, [MarshalAs(UnmanagedType.LPStr)] string filename, [MarshalAs(UnmanagedType.LPStr)] string objname); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_compute( - IntPtr self, IntPtr img, IntPtr descriptors, - Size winStride, Size padding, [In] Point[] locations, int locationsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_detect1( - IntPtr self, IntPtr img, IntPtr foundLocations, - double hitThreshold, Size winStride, Size padding, [In] Point[] searchLocations, int searchLocationsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_detect2( - IntPtr self, IntPtr img, IntPtr foundLocations, IntPtr weights, - double hitThreshold, Size winStride, Size padding, [In] Point[] searchLocations, int searchLocationsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_detectMultiScale1( - IntPtr self, IntPtr img, IntPtr foundLocations, - double hitThreshold, Size winStride, Size padding, double scale, int groupThreshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_detectMultiScale2( - IntPtr self, IntPtr img, IntPtr foundLocations, IntPtr foundWeights, - double hitThreshold, Size winStride, Size padding, double scale, int groupThreshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_computeGradient( - IntPtr self, IntPtr img, IntPtr grad, IntPtr angleOfs, Size paddingTL, Size paddingBR); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_detectROI( - IntPtr obj, IntPtr img, - Point[] locations, int locationsLength, - IntPtr foundLocations, IntPtr confidences, - double hitThreshold, Size winStride, Size padding); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_detectMultiScaleROI( - IntPtr obj, IntPtr img, IntPtr foundLocations, - IntPtr roiScales, IntPtr roiLocations, IntPtr roiConfidences, - double hitThreshold, int groupThreshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_readALTModel(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string modelfile); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_groupRectangles(IntPtr obj, - IntPtr rectList, IntPtr weights, int groupThreshold, double eps); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size objdetect_HOGDescriptor_winSize_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size objdetect_HOGDescriptor_blockSize_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size objdetect_HOGDescriptor_blockStride_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size objdetect_HOGDescriptor_cellSize_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_nbins_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_derivAperture_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double objdetect_HOGDescriptor_winSigma_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_histogramNormType_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double objdetect_HOGDescriptor_L2HysThreshold_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_gammaCorrection_get(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int objdetect_HOGDescriptor_nlevels_get(IntPtr self); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_winSize_set(IntPtr self, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_blockSize_set(IntPtr self, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_blockStride_set(IntPtr self, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_cellSize_set(IntPtr self, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_nbins_set(IntPtr self, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_derivAperture_set(IntPtr self, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_winSigma_set(IntPtr self, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_histogramNormType_set(IntPtr self, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_L2HysThreshold_set(IntPtr self, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_gammaCorrection_set(IntPtr self, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_HOGDescriptor_nlevels_set(IntPtr self, int value); - #endregion - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_groupRectangles1(IntPtr rectList, int groupThreshold, double eps); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_groupRectangles2(IntPtr rectList, IntPtr weights, int groupThreshold, double eps); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_groupRectangles3( - IntPtr rectList, int groupThreshold, double eps, IntPtr weights, IntPtr levelWeights); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_groupRectangles4( - IntPtr rectList, IntPtr rejectLevels, IntPtr levelWeights, int groupThreshold, double eps); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void objdetect_groupRectangles_meanshift( - IntPtr rectList, IntPtr foundWeights, IntPtr foundScales, double detectThreshold, Size winDetSize); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_optflow.cs b/src/OpenCvSharp/PInvoke/NativeMethods_optflow.cs deleted file mode 100644 index af25eccd7..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_optflow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void optflow_motempl_updateMotionHistory( - IntPtr silhouette, IntPtr mhi, - double timestamp, double duration); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void optflow_motempl_calcMotionGradient( - IntPtr mhi, IntPtr mask, IntPtr orientation, - double delta1, double delta2, int apertureSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double optflow_motempl_calcGlobalOrientation( - IntPtr orientation, IntPtr mask, - IntPtr mhi, double timestamp, double duration); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void optflow_motempl_segmentMotion( - IntPtr mhi, IntPtr segmask, IntPtr boundingRects, - double timestamp, double segThresh); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void optflow_calcOpticalFlowSF1( - IntPtr from, - IntPtr to, - IntPtr flow, - int layers, - int averagingBlockSize, - int maxFlow); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void optflow_calcOpticalFlowSF2( - IntPtr from, - IntPtr to, - IntPtr flow, - int layers, - int averagingBlockSize, - int maxFlow, - double sigmaDist, - double sigmaColor, - int postprocessWindow, - double sigmaDistFix, - double sigmaColorFix, - double occThr, - int upscaleAveragingRadius, - double upscaleSigmaDist, - double upscaleSigmaColor, - double speedUpThr); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_stdvector.cs b/src/OpenCvSharp/PInvoke/NativeMethods_stdvector.cs deleted file mode 100644 index 25bd0d517..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_stdvector.cs +++ /dev/null @@ -1,439 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using OpenCvSharp.ML; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region uchar - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_uchar_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_uchar_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_uchar_new3([In] byte[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_uchar_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_uchar_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_uchar_copy(IntPtr vector, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_uchar_delete(IntPtr vector); - #endregion - #region char - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_char_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_char_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_char_new3([In] sbyte[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_char_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_char_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_char_copy(IntPtr vector, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_char_delete(IntPtr vector); - #endregion - #region int - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_int32_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_int32_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_int32_new3([In] int[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_int32_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_int32_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_int32_delete(IntPtr vector); - #endregion - #region float - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_float_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_float_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_float_new3([In] float[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_float_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_float_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_float_delete(IntPtr vector); - #endregion - #region double - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_double_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_double_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_double_new3([In] double[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_double_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_double_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_double_delete(IntPtr vector); - #endregion - #region cv::Vec2f - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec2f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec2f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec2f_new3([In] Vec2f[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec2f_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec2f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Vec2f_delete(IntPtr vector); - #endregion - #region cv::Vec3f - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec3f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec3f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec3f_new3([In] Vec3f[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec3f_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec3f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Vec3f_delete(IntPtr vector); - #endregion - #region cv::Vec4f - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4f_new3([In] Vec4f[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4f_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Vec4f_delete(IntPtr vector); - #endregion - #region cv::Vec4i - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4i_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4i_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4i_new3([In] Vec4i[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4i_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec4i_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Vec4i_delete(IntPtr vector); - #endregion - #region cv::Vec6f - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6f_new3([In] Vec6f[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6f_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Vec6f_delete(IntPtr vector); - #endregion - #region cv::Vec6d - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6d_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6d_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6d_new3([In] Vec6d[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6d_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Vec6d_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Vec6d_delete(IntPtr vector); - #endregion - #region cv::Point2i - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2i_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2i_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2i_new3([In] Point[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2i_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2i_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Point2i_delete(IntPtr vector); - #endregion - #region cv::Point2f - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2f_new3([In] Point2f[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2f_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point2f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Point2f_delete(IntPtr vector); - #endregion - #region cv::Point3f - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point3f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point3f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point3f_new3([In] Point3f[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point3f_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Point3f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Point3f_delete(IntPtr vector); - #endregion - #region cv::Rect - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Rect_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Rect_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Rect_new3([In] Rect[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Rect_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Rect_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Rect_delete(IntPtr vector); - #endregion - #region cv::KeyPoint - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_KeyPoint_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_KeyPoint_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_KeyPoint_new3([In]KeyPoint[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_KeyPoint_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_KeyPoint_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_KeyPoint_delete(IntPtr vector); - #endregion - #region cv::KeyPoint - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DMatch_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DMatch_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DMatch_new3([In] DMatch[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DMatch_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DMatch_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_DMatch_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_int_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_int_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_int_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_int_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_int_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_int_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_int_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_float_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_float_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_float_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_float_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_float_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_float_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_float_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_double_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_double_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_double_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_double_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_double_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_double_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_double_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_KeyPoint_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_KeyPoint_new2(IntPtr size); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_KeyPoint_new3( - IntPtr[] values, int size1, int[] size2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_KeyPoint_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_KeyPoint_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_KeyPoint_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_KeyPoint_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_KeyPoint_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_DMatch_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_DMatch_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_DMatch_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_DMatch_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_DMatch_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_DMatch_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_DMatch_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_Point_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_Point_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_Point_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point2f_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point2f_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point2f_getSize1(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_Point2f_getSize2(IntPtr vector, [In, Out] IntPtr[] size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_vector_Point2f_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_Point2f_copy(IntPtr vec, IntPtr[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_vector_Point2f_delete(IntPtr vector); - #endregion - #region vector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_string_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_string_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_string_getSize(IntPtr vec); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_string_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe sbyte* vector_string_elemAt(IntPtr vector, int i); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_string_delete(IntPtr vector); - #endregion - #region cv::Mat - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Mat_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Mat_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Mat_new3(IntPtr data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Mat_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_Mat_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Mat_delete(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Mat_assignToArray(IntPtr vector, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] arr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_Mat_addref(IntPtr vector); - - #endregion - - #region cv::ml::DTrees::Node - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Node_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Node_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Node_new3([In]DTrees.Node[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Node_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Node_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_DTrees_Node_delete(IntPtr vector); - - #endregion - - #region cv::ml::DTrees::Split - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Split_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Split_new2(IntPtr size); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Split_new3([In]DTrees.Split[] data, IntPtr dataLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Split_getSize(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr vector_DTrees_Split_getPointer(IntPtr vector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void vector_DTrees_Split_delete(IntPtr vector); - - #endregion - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_stitching.cs b/src/OpenCvSharp/PInvoke/NativeMethods_stitching.cs deleted file mode 100644 index 13409155a..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_stitching.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr stitching_createStitcher(int try_use_cpu); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Ptr_Stitcher_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr stitching_Ptr_Stitcher_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double stitching_Stitcher_registrationResol(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_setRegistrationResol(IntPtr obj, double resolMpx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double stitching_Stitcher_seamEstimationResol(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_setSeamEstimationResol(IntPtr obj, double resolMpx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double stitching_Stitcher_compositingResol(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_setCompositingResol(IntPtr obj, double resolMpx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double stitching_Stitcher_panoConfidenceThresh(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_setPanoConfidenceThresh(IntPtr obj, double confThresh); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_waveCorrection(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_setWaveCorrection(IntPtr obj, int flag); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_waveCorrectKind(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_setWaveCorrectKind(IntPtr obj, int kind); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_estimateTransform_InputArray1( - IntPtr obj, IntPtr images); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_estimateTransform_InputArray2( - IntPtr obj, IntPtr images, - IntPtr[] rois, int roisSize1, int[] roisSize2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_estimateTransform_MatArray1( - IntPtr obj, IntPtr[] images, int imagesSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_estimateTransform_MatArray2( - IntPtr obj, IntPtr[] images, int imagesSize, - IntPtr[] rois, int roisSize1, int[] roisSize2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_composePanorama1( - IntPtr obj, IntPtr pano); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_composePanorama2_InputArray( - IntPtr obj, IntPtr images, IntPtr pano); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_composePanorama2_MatArray( - IntPtr obj, IntPtr[] images, int imagesSize, IntPtr pano); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_stitch1_InputArray( - IntPtr obj, IntPtr images, IntPtr pano); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_stitch1_MatArray( - IntPtr obj, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] images, int imagesSize, IntPtr pano); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_stitch2_InputArray( - IntPtr obj, IntPtr images, - IntPtr[] rois, int roisSize1, int[] roisSize2, - IntPtr pano); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int stitching_Stitcher_stitch2_MatArray( - IntPtr obj, IntPtr[] images, int imagesSize, - IntPtr[] rois, int roisSize1, int[] roisSize2, - IntPtr pano); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void stitching_Stitcher_component(IntPtr obj, out IntPtr pointer, out int length); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double stitching_Stitcher_workScale(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_superres.cs b/src/OpenCvSharp/PInvoke/NativeMethods_superres.cs deleted file mode 100644 index 5e8028b12..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_superres.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // TODO - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_FrameSource_nextFrame(IntPtr obj, IntPtr frame); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_FrameSource_reset(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createFrameSource_Empty(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr superres_createFrameSource_Video( - [MarshalAs(UnmanagedType.LPStr)] string fileName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr superres_createFrameSource_Video_CUDA( - [MarshalAs(UnmanagedType.LPStr)] string fileName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createFrameSource_Camera(int deviceId); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_Ptr_FrameSource_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_Ptr_FrameSource_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_SuperResolution_setInput(IntPtr obj, IntPtr frameSource); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_SuperResolution_nextFrame(IntPtr obj, IntPtr frame); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_SuperResolution_reset(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_SuperResolution_collectGarbage(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createSuperResolution_BTVL1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createSuperResolution_BTVL1_CUDA(); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern IntPtr superres_createSuperResolution_BTVL1_OCL(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_Ptr_SuperResolution_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_Ptr_SuperResolution_delete(IntPtr ptr); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_DenseOpticalFlowExt_calc( - IntPtr obj, IntPtr frame0, IntPtr frame1, IntPtr flow1, IntPtr flow2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_DenseOpticalFlowExt_collectGarbage(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_Ptr_DenseOpticalFlowExt_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void superres_Ptr_DenseOpticalFlowExt_delete(IntPtr ptr); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createOptFlow_Farneback(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createOptFlow_Farneback_CUDA(); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern IntPtr superres_createOptFlow_Farneback_OCL(); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern IntPtr superres_createOptFlow_Simple(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createOptFlow_DualTVL1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createOptFlow_DualTVL1_CUDA(); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern IntPtr superres_createOptFlow_DualTVL1_OCL(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createOptFlow_Brox_CUDA(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr superres_createOptFlow_PyrLK_CUDA(); - //[DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - //public static extern IntPtr superres_createOptFlow_PyrLK_OCL(); - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_videoio.cs b/src/OpenCvSharp/PInvoke/NativeMethods_videoio.cs deleted file mode 100644 index c04b2bdc4..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_videoio.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // VideoCapture - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr videoio_VideoCapture_new1(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr videoio_VideoCapture_new2([MarshalAs(UnmanagedType.LPStr)] string filename); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr videoio_VideoCapture_new3(int device); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoCapture_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_open1(IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_open2(IntPtr obj, int device); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_isOpened(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoCapture_release(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_grab(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_retrieve(IntPtr obj, IntPtr image, int flag); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoCapture_operatorRightShift_Mat(IntPtr obj, IntPtr image); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoCapture_operatorRightShift_UMat(IntPtr obj, IntPtr image); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_read(IntPtr obj, IntPtr image); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoCapture_set(IntPtr obj, int propId, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double videoio_VideoCapture_get(IntPtr obj, int propId); - - - // VideoWriter - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr videoio_VideoWriter_new1(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr videoio_VideoWriter_new2( - [MarshalAs(UnmanagedType.LPStr)] string filename, int fourcc, double fps, - Size frameSize, int isColor); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoWriter_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoWriter_open( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename, - int fourcc, double fps, Size frameSize, int isColor); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoWriter_isOpened(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoWriter_release(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoWriter_OperatorLeftShift(IntPtr obj, IntPtr image); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void videoio_VideoWriter_write(IntPtr obj, IntPtr image); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoWriter_set(IntPtr obj, int propId, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double videoio_VideoWriter_get(IntPtr obj, int propId); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int videoio_VideoWriter_fourcc(byte c1, byte c2, byte c3, byte c4); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/NativeMethods_xfeatures2d.cs b/src/OpenCvSharp/PInvoke/NativeMethods_xfeatures2d.cs deleted file mode 100644 index 965713984..000000000 --- a/src/OpenCvSharp/PInvoke/NativeMethods_xfeatures2d.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - // BriefDescriptorExtractor - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_BriefDescriptorExtractor_create(int bytes); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_Ptr_BriefDescriptorExtractor_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_BriefDescriptorExtractor_read(IntPtr obj, IntPtr fn); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_BriefDescriptorExtractor_write(IntPtr obj, IntPtr fs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int xfeatures2d_BriefDescriptorExtractor_descriptorSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int xfeatures2d_BriefDescriptorExtractor_descriptorType(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_Ptr_BriefDescriptorExtractor_get(IntPtr ptr); - - // FREAK - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_FREAK_create(int orientationNormalized, - int scaleNormalized, float patternScale, int nOctaves, - int[] selectedPairs, int selectedPairsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_Ptr_FREAK_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_Ptr_FREAK_get(IntPtr ptr); - - // StarDetector - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_StarDetector_create( - int maxSize, int responseThreshold, - int lineThresholdProjected, int lineThresholdBinarized, int suppressNonmaxSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_Ptr_StarDetector_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_Ptr_StarDetector_get(IntPtr ptr); - - // DenseFeatureDetector - /* - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_DenseFeatureDetector_new( - float initFeatureScale, int featureScaleLevels, float featureScaleMul, - int initXyStep, int initImgBound, int varyXyStepWithScale, int varyImgBoundWithScale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_DenseFeatureDetector_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_Ptr_DenseFeatureDetector_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_Ptr_DenseFeatureDetector_delete(IntPtr ptr); - */ - - // SURF - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_SURF_create( - double hessianThreshold, int nOctaves, - int nOctaveLayers, int extended, int upright); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_Ptr_SURF_delete(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_Ptr_SURF_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double xfeatures2d_SURF_getHessianThreshold(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int xfeatures2d_SURF_getNOctaves(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int xfeatures2d_SURF_getNOctaveLayers(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int xfeatures2d_SURF_getExtended(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int xfeatures2d_SURF_getUpright(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_SURF_setHessianThreshold(IntPtr obj, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_SURF_setNOctaves(IntPtr obj, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_SURF_setNOctaveLayers(IntPtr obj, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_SURF_setExtended(IntPtr obj, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_SURF_setUpright(IntPtr obj, int value); - - // SIFT - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_SIFT_create(int nfeatures, int nOctaveLayers, - double contrastThreshold, double edgeThreshold, double sigma); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void xfeatures2d_Ptr_SIFT_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr xfeatures2d_Ptr_SIFT_get(IntPtr ptr); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/Win32API.cs b/src/OpenCvSharp/PInvoke/Win32API.cs deleted file mode 100644 index 0e06d8a3f..000000000 --- a/src/OpenCvSharp/PInvoke/Win32API.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - /// - /// Win32API Wrapper - /// - public static class Win32Api - { - #region Constants - public const int DIB_RGB_COLORS = 0; /* color table in RGBs */ - public const int DIB_PAL_COLORS = 1; /* color table in palette indices */ - - public const int BI_RGB = 0; - public const int BI_RLE8 = 1; - public const int BI_RLE4 = 2; - public const int BI_BITFIELDS = 3; - public const int BI_JPEG = 4; - public const int BI_PNG = 5; - - public const int BLACKONWHITE = 1; - public const int WHITEONBLACK = 2; - public const int COLORONCOLOR = 3; - public const int HALFTONE = 4; - public const int MAXSTRETCHBLTMODE = 4; - - /* Ternary raster operations */ - public const uint SRCCOPY = (uint)0x00CC0020; /* dest = source */ - public const uint SRCPAINT = (uint)0x00EE0086; /* dest = source OR dest */ - public const uint SRCAND = (uint)0x008800C6; /* dest = source AND dest */ - public const uint SRCINVERT = (uint)0x00660046; /* dest = source XOR dest */ - public const uint SRCERASE = (uint)0x00440328; /* dest = source AND (NOT dest ) */ - public const uint NOTSRCCOPY = (uint)0x00330008; /* dest = (NOT source) */ - public const uint NOTSRCERASE = (uint)0x001100A6; /* dest = (NOT src) AND (NOT dest) */ - public const uint MERGECOPY = (uint)0x00C000CA; /* dest = (source AND pattern) */ - public const uint MERGEPAINT = (uint)0x00BB0226; /* dest = (NOT source) OR dest */ - public const uint PATCOPY = (uint)0x00F00021; /* dest = pattern */ - public const uint PATPAINT = (uint)0x00FB0A09; /* dest = DPSnoo */ - public const uint PATINVERT = (uint)0x005A0049; /* dest = pattern XOR dest */ - public const uint DSTINVERT = (uint)0x00550009; /* dest = (NOT dest) */ - public const uint BLACKNESS = (uint)0x00000042; /* dest = BLACK */ - public const uint WHITENESS = (uint)0x00FF0062; /* dest = WHITE */ - public const uint NOMIRRORBITMAP = (uint)0x80000000; /* Do not Mirror the bitmap in this call */ - public const uint CAPTUREBLT = (uint)0x40000000; /* Include layered windows */ - #endregion - - #region Structures - public enum ColorTableType : int - { - Rgb = 0, - Palette = 1, - } - [StructLayout(LayoutKind.Sequential)] - public struct ICONINFO - { - public bool IsIcon; - public int HotSpotX; - public int HotSoptY; - public IntPtr MaskHbitmap; - public IntPtr ColorHbitmap; - } - [StructLayout(LayoutKind.Sequential)] - public struct BITMAPINFOHEADER - { - public UInt32 Size; - public Int32 Width; - public Int32 Height; - public UInt16 Planes; - public UInt16 BitCount; - public UInt32 Compression; - public UInt32 SizeImage; - public Int32 XPelsPerMeter; - public Int32 YPelsPerMeter; - public UInt32 ClrUsed; - public UInt32 ClrImportant; - }; - - [StructLayout(LayoutKind.Sequential)] - public struct RGBQUAD - { - public Byte Blue; - public Byte Green; - public Byte Red; - public Byte Reserved; - }; - - [StructLayout(LayoutKind.Sequential)] - public struct BITMAPINFO - { - public BITMAPINFOHEADER Header; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public RGBQUAD[] Colors; - }; - #endregion - - #region DllImport -#if !uap10 - #region kernel32 - [DllImport("kernel32")] - public static extern IntPtr LoadLibrary(string lpFileName); - [DllImport("kernel32")] - public static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName); - [DllImport("kernel32")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool FreeLibrary(IntPtr hLibModule); - #endregion - #region gdi32 -#if LANG_JP - /// - /// - /// - /// デバイスコンテキストのハンドル - /// 転送先長方形の左上隅の x 座標 - /// 転送先長方形の左上隅の y 座標 - /// 転送元長方形の幅 - /// 転送元長方形の高さ - /// 転送元長方形の左下隅の x 座標 - /// 転送元長方形の左下隅の y 座標 - /// 配列内の最初の走査行 - /// 走査行の数 - /// DIB ビットからなる配列 - /// ビットマップ情報 - /// RGB 値またはパレットインデックス - /// -#else - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// -#endif - [DllImport("gdi32")] - public static extern int SetDIBitsToDevice(IntPtr hdc, Int32 XDest, Int32 YDest, UInt32 dwWidth, UInt32 dwHeight, Int32 XSrc, Int32 YSrc, UInt32 uStartScan, UInt32 cScanLines, IntPtr lpvBits, ref BITMAPINFO lpbmi, UInt32 fuColorUse); - [DllImport("gdi32")] - public static extern int SetDIBitsToDevice(IntPtr hdc, Int32 XDest, Int32 YDest, UInt32 dwWidth, UInt32 dwHeight, Int32 XSrc, Int32 YSrc, UInt32 uStartScan, UInt32 cScanLines, IntPtr lpvBits, IntPtr lpbmi, UInt32 fuColorUse); - [DllImport("gdi32", SetLastError = true)] - public static extern int GetDIBColorTable(IntPtr dc, int index, int entries, [In, Out] RGBQUAD[] colors); - [DllImport("gdi32", SetLastError = true)] - public static extern int GetDIBits(IntPtr dc, IntPtr bmp, int startScan, int scanLineCount, [In, Out] byte[] data, IntPtr info, ColorTableType usage); - [DllImport("gdi32", SetLastError = true)] - public static extern IntPtr CreateCompatibleDC(IntPtr hdc); - [DllImport("user32", SetLastError = true)] - public static extern bool GetIconInfo(IntPtr icon, out ICONINFO info); - [DllImport("user32", SetLastError = true)] - public static extern IntPtr GetDC(IntPtr window); - [DllImport("user32", SetLastError = true)] - public static extern bool ReleaseDC(IntPtr window, IntPtr dc); - [DllImport("gdi32", SetLastError = true)] - public static extern IntPtr SelectObject(IntPtr hdc, IntPtr obj); - [DllImport("gdi32", SetLastError = true)] - public static extern bool DeleteObject(IntPtr handle); - [DllImport("gdi32", SetLastError = true)] - public static extern bool DeleteDC(IntPtr hdc); -#if LANG_JP - /// - /// 指定されたデバイスコンテキストのビットマップ伸縮モードを設定します - /// - /// デバイスコンテキストのハンドル - /// ビットマップの伸縮モード - /// -#else - /// - /// - /// - /// - /// - /// -#endif - [DllImport("gdi32", SetLastError = true)] - public static extern int SetStretchBltMode(IntPtr hdc, int iStretchMode); -#if LANG_JP - /// - /// 指定されたデバイス独立ビットマップ(DIB)内の長方形ピクセルの色データを、指定された長方形へコピーします。 - /// コピー先長方形がコピー元長方形より大きい場合、この関数はコピー先長方形に合わせて、色データの行と列を拡大します。 - /// コピー先長方形がコピー元長方形より小さい場合、この関数は指定されたラスタオペレーションを使って、行と列を縮小します。 - /// - /// デバイスコンテキストのハンドル - /// コピー先長方形の左上隅の x 座標 - /// コピー先長方形の左上隅の y 座標 - /// コピー先長方形の幅 - /// コピー先長方形の高さ - /// コピー元長方形の左上隅の x 座標 - /// コピー元長方形の左上隅の x 座標 - /// コピー元長方形の幅 - /// コピー元長方形の高さ - /// ビットマップのビット - /// ビットマップのデータ - /// データの種類 - /// ラスタオペレーションコード - /// -#else - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// -#endif - [DllImport("gdi32", SetLastError = true)] - public static extern int StretchDIBits(IntPtr hdc, Int32 XDest, Int32 YDest, Int32 nDestWidth, Int32 nDestHeight, Int32 XSrc, Int32 YSrc, Int32 nSrcWidth, Int32 nSrcHeight, IntPtr lpBits, ref BITMAPINFO lpBitsInfo, UInt32 iUsage, UInt32 dwRop); - #endregion -#endif - #endregion - } - -} diff --git a/src/OpenCvSharp/PInvoke/WindowsLibraryLoader.cs b/src/OpenCvSharp/PInvoke/WindowsLibraryLoader.cs deleted file mode 100644 index b4f01696b..000000000 --- a/src/OpenCvSharp/PInvoke/WindowsLibraryLoader.cs +++ /dev/null @@ -1,399 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Handles loading embedded dlls into memory, based on http://stackoverflow.com/questions/666799/embedding-unmanaged-dll-into-a-managed-c-sharp-dll. - /// - /// This code is based on https://github.com/charlesw/tesseract - public sealed class WindowsLibraryLoader - { - #region Singleton pattern - - /// - /// - /// - public static WindowsLibraryLoader Instance { get; } = new WindowsLibraryLoader(); - - #endregion - - /// - /// The default base directory name to copy the assemblies too. - /// - private const string ProcessorArchitecture = "PROCESSOR_ARCHITECTURE"; - private const string DllFileExtension = ".dll"; - private const string DllDirectory = "dll"; - - private readonly List loadedAssemblies = new List(); - - /// - /// Map processor - /// - private readonly Dictionary processorArchitecturePlatforms = - new Dictionary(StringComparer.OrdinalIgnoreCase) - { - {"x86", "x86"}, - {"AMD64", "x64"}, - {"IA64", "Itanium"}, - {"ARM", "WinCE"} - }; - - /// - /// Used as a sanity check for the returned processor architecture to double check the returned value. - /// - private readonly Dictionary processorArchitectureAddressWidthPlatforms = - new Dictionary(StringComparer.OrdinalIgnoreCase) - { - {"x86", 4}, - {"AMD64", 8}, - {"IA64", 8}, - {"ARM", 4} - }; - - /// - /// Additional user-defined DLL paths - /// - public List AdditionalPaths { get; private set; } - - private readonly object syncLock = new object(); - - /// - /// constructor - /// - private WindowsLibraryLoader() - { - AdditionalPaths = new List(); - } - - /// - /// - /// - /// - /// - public bool IsLibraryLoaded(string dllName) - { - lock (syncLock) - { - return loadedAssemblies.Contains(dllName); - } - } - - /// - /// - /// - /// - public bool IsCurrentPlatformSupported() - { -#if DOTNET_FRAMEWORK - return Environment.OSVersion.Platform == PlatformID.Win32NT || - Environment.OSVersion.Platform == PlatformID.Win32Windows; -#elif uap10 - return false; -#else - return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); -#endif - } - - /// - /// - /// - /// - /// - public void LoadLibrary(string dllName, IEnumerable additionalPaths = null) - { - if (!IsCurrentPlatformSupported()) - { - return; - } - - if (additionalPaths == null) - additionalPaths = new string[0]; - - try - { - lock (syncLock) - { - if (loadedAssemblies.Contains(dllName)) - { - return; - } - - var processArch = GetProcessArchitecture(); - IntPtr dllHandle; - string baseDirectory; - - // Try loading from user-defined paths - foreach (string path in additionalPaths) - { - // baseDirectory = Path.GetFullPath(path); - dllHandle = LoadLibraryRaw(dllName, path); - if (dllHandle != IntPtr.Zero) return; - } - - // Try loading from executing assembly domain -#if !netcore50 && !uap10 && !uwp -#if DOTNET_FRAMEWORK - Assembly executingAssembly = Assembly.GetExecutingAssembly(); -#else - Assembly executingAssembly = GetType().GetTypeInfo().Assembly; -#endif - baseDirectory = Path.GetDirectoryName(executingAssembly.Location); - dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); - if (dllHandle != IntPtr.Zero) return; -#endif - - // Fallback to current app domain - // TODO -#if DOTNET_FRAMEWORK - baseDirectory = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory); - dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); - if (dllHandle != IntPtr.Zero) return; -#endif - - // Gets the pathname of the base directory that the assembly resolver uses to probe for assemblies. - // https://github.com/dotnet/corefx/issues/2221 -#if !net20 && !net40 && !uwp - baseDirectory = AppContext.BaseDirectory; - dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); - if (dllHandle != IntPtr.Zero) return; -#endif - -#if uwp - baseDirectory = ""; -#else - // Finally try the working directory - baseDirectory = Path.GetFullPath(System.IO.Directory.GetCurrentDirectory()); -#endif - dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); - if (dllHandle != IntPtr.Zero) return; - - // ASP.NET hack, requires an active context -#if DOTNET_FRAMEWORK - if (System.Web.HttpContext.Current != null) - { - var server = System.Web.HttpContext.Current.Server; - baseDirectory = Path.GetFullPath(server.MapPath("bin")); - dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch); - if (dllHandle != IntPtr.Zero) return; - } -#endif - - StringBuilder errorMessage = new StringBuilder(); - errorMessage.AppendFormat("Failed to find dll \"{0}\", for processor architecture {1}.", dllName, - processArch.Architecture); - if (processArch.HasWarnings) - { - // include process detection warnings - errorMessage.AppendFormat("\r\nWarnings: \r\n{0}", processArch.WarningText()); - } - throw new Exception(errorMessage.ToString()); - } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); - } - } - - /// - /// Get's the current process architecture while keeping track of any assumptions or possible errors. - /// - /// - private ProcessArchitectureInfo GetProcessArchitecture() - { - // BUGBUG: Will this always be reliable? -#if uwp - string processArchitecture = ""; -#else - string processArchitecture = Environment.GetEnvironmentVariable(ProcessorArchitecture); -#endif - var processInfo = new ProcessArchitectureInfo(); - if (!String.IsNullOrEmpty(processArchitecture)) - { - // Sanity check - processInfo.Architecture = processArchitecture; - } - else - { - processInfo.AddWarning("Failed to detect processor architecture, falling back to x86."); - - processInfo.Architecture = (IntPtr.Size == 8) ? "x64" : "x86"; - } - - var addressWidth = processorArchitectureAddressWidthPlatforms[processInfo.Architecture]; - if (addressWidth != IntPtr.Size) - { - if (String.Equals(processInfo.Architecture, "AMD64", StringComparison.OrdinalIgnoreCase) && IntPtr.Size == 4) - { - // fall back to x86 if detected x64 but has an address width of 32 bits. - processInfo.Architecture = "x86"; - processInfo.AddWarning("Expected the detected processing architecture of {0} to have an address width of {1} Bytes but was {2} Bytes, falling back to x86.", processInfo.Architecture, addressWidth, IntPtr.Size); - } - else - { - // no fallback possible - processInfo.AddWarning("Expected the detected processing architecture of {0} to have an address width of {1} Bytes but was {2} Bytes.", processInfo.Architecture, addressWidth, IntPtr.Size); - - } - } - - return processInfo; - } - - private IntPtr LoadLibraryInternal(string dllName, string baseDirectory, ProcessArchitectureInfo processArchInfo) - { - //IntPtr libraryHandle = IntPtr.Zero; - var platformName = GetPlatformName(processArchInfo.Architecture); - var expectedDllDirectory = Path.Combine( - Path.Combine(baseDirectory, DllDirectory), platformName); - //var fileName = FixUpDllFileName(Path.Combine(expectedDllDirectory, dllName)); - - return LoadLibraryRaw(dllName, expectedDllDirectory); - } - - private IntPtr LoadLibraryRaw(string dllName, string baseDirectory) - { - IntPtr libraryHandle = IntPtr.Zero; - var fileName = FixUpDllFileName(Path.Combine(baseDirectory, dllName)); - - // Show where we're trying to load the file from - Debug.WriteLine(String.Format("Trying to load native library \"{0}\"...", fileName)); - -#if uwp || uap10 -#pragma warning disable 0162 - if (true) // TODO -#else - if (File.Exists(fileName)) -#endif - { - // Attempt to load dll - try - { - libraryHandle = Win32LoadLibrary(fileName); - if (libraryHandle != IntPtr.Zero) - { - // library has been loaded - Debug.WriteLine(String.Format( - "Successfully loaded native library \"{0}\".", - fileName)); - loadedAssemblies.Add(dllName); - } - else - { - Debug.WriteLine(String.Format( - "Failed to load native library \"{0}\".\r\nCheck windows event log.", - fileName)); - } - } - catch (Exception e) - { - var lastError = Marshal.GetLastWin32Error(); - Debug.WriteLine(String.Format( - "Failed to load native library \"{0}\".\r\nLast Error:{1}\r\nCheck inner exception and\\or windows event log.\r\nInner Exception: {2}", - fileName, lastError, e)); - } - } - else - { - Debug.WriteLine(String.Format(CultureInfo.CurrentCulture, - "The native library \"{0}\" does not exist.", - fileName)); - } - - return libraryHandle; - } - - /// - /// Determines if the dynamic link library file name requires a suffix - /// and adds it if necessary. - /// - private string FixUpDllFileName(string fileName) - { - if (!String.IsNullOrEmpty(fileName)) - { -#if DOTNET_FRAMEWORK - PlatformID platformId = Environment.OSVersion.Platform; - if ((platformId == PlatformID.Win32S) || - (platformId == PlatformID.Win32Windows) || - (platformId == PlatformID.Win32NT) || - (platformId == PlatformID.WinCE)) -#elif uap10 -#else - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) -#endif - { - if (!fileName.EndsWith(DllFileExtension, - StringComparison.OrdinalIgnoreCase)) - { - return fileName + DllFileExtension; - } - } - } - - return fileName; - } - - /// - /// Given the processor architecture, returns the name of the platform. - /// - private string GetPlatformName(string processorArchitecture) - { - if (String.IsNullOrEmpty(processorArchitecture)) - return null; - - string platformName; - if (processorArchitecturePlatforms.TryGetValue(processorArchitecture, out platformName)) - { - return platformName; - } - - return null; - } - - /// - /// - /// - private class ProcessArchitectureInfo - { - public ProcessArchitectureInfo() - { - Warnings = new List(); - } - - public string Architecture { get; set; } - private List Warnings { get; set; } - - public bool HasWarnings - { - get { return Warnings.Count > 0; } - } - - public void AddWarning(string format, params object[] args) - { - Warnings.Add(String.Format(format, args)); - } - - public string WarningText() - { - return String.Join("\r\n", Warnings.ToArray()); - } - } - -#if DOTNET_FRAMEWORK - private const CharSet DefaultCharSet = CharSet.Auto; -#else - private const CharSet DefaultCharSet = CharSet.Unicode; -#endif - - [DllImport("kernel32", EntryPoint = "LoadLibrary", CallingConvention = CallingConvention.Winapi, - SetLastError = true, CharSet = DefaultCharSet, BestFitMapping = false, ThrowOnUnmappableChar = true)] - private static extern IntPtr Win32LoadLibrary(string dllPath); - } -} diff --git a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d.cs b/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d.cs deleted file mode 100644 index 48feb95e9..000000000 --- a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d.cs +++ /dev/null @@ -1,332 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_Rodrigues(IntPtr src, IntPtr dst, IntPtr jacobian); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_Rodrigues_VecToMat(IntPtr vector, IntPtr matrix, IntPtr jacobian); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_Rodrigues_MatToVec(IntPtr vector, IntPtr matrix, IntPtr jacobian); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_findHomography_InputArray(IntPtr srcPoints, IntPtr dstPoints, - int method, double ransacReprojThreshold, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_findHomography_vector(Point2d[] srcPoints, int srcPointsLength, - Point2d[] dstPoints, int dstPointsLength, int method, double ransacReprojThreshold, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_RQDecomp3x3_InputArray(IntPtr src, IntPtr mtxR, - IntPtr mtxQ, IntPtr qx, IntPtr qy, IntPtr qz, out Vec3d outVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_RQDecomp3x3_Mat(IntPtr src, IntPtr mtxR, IntPtr mtxQ, - IntPtr qx, IntPtr qy, IntPtr qz, out Vec3d outVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_decomposeProjectionMatrix_InputArray(IntPtr projMatrix, - IntPtr cameraMatrix, IntPtr rotMatrix, IntPtr transVect, IntPtr rotMatrixX, - IntPtr rotMatrixY, IntPtr rotMatrixZ, IntPtr eulerAngles); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_decomposeProjectionMatrix_Mat(IntPtr projMatrix, - IntPtr cameraMatrix, IntPtr rotMatrix, IntPtr transVect, IntPtr rotMatrixX, - IntPtr rotMatrixY, IntPtr rotMatrixZ, IntPtr eulerAngles); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_matMulDeriv(IntPtr a, IntPtr b, - IntPtr dABdA, IntPtr dABdB); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_composeRT_InputArray(IntPtr rvec1, IntPtr tvec1, - IntPtr rvec2, IntPtr tvec2, - IntPtr rvec3, IntPtr tvec3, - IntPtr dr3dr1, IntPtr dr3dt1, - IntPtr dr3dr2, IntPtr dr3dt2, - IntPtr dt3dr1, IntPtr dt3dt1, - IntPtr dt3dr2, IntPtr dt3dt2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_composeRT_Mat(IntPtr rvec1, IntPtr tvec1, - IntPtr rvec2, IntPtr tvec2, - IntPtr rvec3, IntPtr tvec3, - IntPtr dr3dr1, IntPtr dr3dt1, - IntPtr dr3dr2, IntPtr dr3dt2, - IntPtr dt3dr1, IntPtr dt3dt1, - IntPtr dt3dr2, IntPtr dt3dt2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_projectPoints_InputArray(IntPtr objectPoints, - IntPtr rvec, IntPtr tvec, - IntPtr cameraMatrix, IntPtr distCoeffs, - IntPtr imagePoints, IntPtr jacobian, - double aspectRatio); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_projectPoints_Mat(IntPtr objectPoints, - IntPtr rvec, IntPtr tvec, - IntPtr cameraMatrix, IntPtr distCoeffs, - IntPtr imagePoints, IntPtr jacobian, - double aspectRatio); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_solvePnP_InputArray(IntPtr selfectPoints, IntPtr imagePoints, IntPtr cameraMatrix, - IntPtr distCoeffs, IntPtr rvec, IntPtr tvec, int useExtrinsicGuess, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_solvePnP_vector(Point3f[] objectPoints, int objectPointsLength, - Point2f[] imagePoints, int imagePointsLength, - double[,] cameraMatrix, double[] distCoeffs, int distCoeffsLength, - [Out] double[] rvec, [Out] double[] tvec, int useExtrinsicGuess, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_solvePnPRansac_InputArray(IntPtr objectPoints, IntPtr imagePoints, - IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr rvec, IntPtr tvec, - int useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, - IntPtr inliers, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_solvePnPRansac_vector(Point3f[] objectPoints, int objectPointsLength, - Point2f[] imagePoints, int imagePointsLength, double[,] cameraMatrix, double[] distCoeffs, int distCoeffsLength, - [Out] double[] rvec, [Out] double[] tvec, int useExtrinsicGuess, int iterationsCount, float reprojectionError, - double confidence, IntPtr inliers, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_initCameraMatrix2D_Mat(IntPtr[] objectPoints, int objectPointsLength, - IntPtr[] imagePoints, int imagePointsLength, - Size imageSize, double aspectRatio); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_initCameraMatrix2D_array(IntPtr[] objectPoints, int opSize1, int[] opSize2, - IntPtr[] imagePoints, int ipSize1, int[] ipSize2, - Size imageSize, double aspectRatio); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_findChessboardCorners_InputArray(IntPtr image, Size patternSize, - IntPtr corners, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_findChessboardCorners_vector(IntPtr image, Size patternSize, - IntPtr corners, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_find4QuadCornerSubpix_InputArray(IntPtr img, IntPtr corners, Size regionSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_find4QuadCornerSubpix_vector(IntPtr img, IntPtr corners, Size regionSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_drawChessboardCorners_InputArray(IntPtr image, Size patternSize, - IntPtr corners, int patternWasFound); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_drawChessboardCorners_array(IntPtr image, Size patternSize, - Point2f[] corners, int cornersLength, int patternWasFound); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_findCirclesGrid_InputArray(IntPtr image, Size patternSize, - IntPtr centers, int flags, IntPtr blobDetector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_findCirclesGrid_vector(IntPtr image, Size patternSize, - IntPtr centers, int flags, IntPtr blobDetector); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double calib3d_calibrateCamera_InputArray( - IntPtr[] objectPoints, int objectPointsSize, - IntPtr[] imagePoints, int imagePointsSize, - Size imageSize, - IntPtr cameraMatrix,IntPtr distCoeffs, - IntPtr rvecs, IntPtr tvecs, - int flags, TermCriteria criteria); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double calib3d_calibrateCamera_vector( - IntPtr[] objectPoints, int opSize1, int[] opSize2, - IntPtr[] imagePoints, int ipSize1, int[] ipSize2, - Size imageSize, - [In, Out] double[,] cameraMatrix, - [In, Out] double[] distCoeffs, int distCoeffsSize, - IntPtr rvecs, IntPtr tvecs, - int flags, TermCriteria criteria); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_calibrationMatrixValues_InputArray( - IntPtr cameraMatrix, - Size imageSize, double apertureWidth, double apertureHeight, out double fovx, out double fovy, - out double focalLength, out Point2d principalPoint, out double aspectRatio); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_calibrationMatrixValues_array( - double[,] cameraMatrix, Size imageSize, - double apertureWidth, double apertureHeight, out double fovx, out double fovy, out double focalLength, - out Point2d principalPoint, out double aspectRatio); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double calib3d_stereoCalibrate_InputArray( - IntPtr[] objectPoints, int opSize, - IntPtr[] imagePoints1, int ip1Size, - IntPtr[] imagePoints2, int ip2Size, - IntPtr cameraMatrix1, - IntPtr distCoeffs1, - IntPtr cameraMatrix2, - IntPtr distCoeffs2, - Size imageSize, - IntPtr R, IntPtr T, - IntPtr E, IntPtr F, - int flags, TermCriteria criteria); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double calib3d_stereoCalibrate_array( - IntPtr[] objectPoints, int opSize1, int[] opSizes2, - IntPtr[] imagePoints1, int ip1Size1, int[] ip1Sizes2, - IntPtr[] imagePoints2, int ip2Size1, int[] ip2Sizes2, - [In, Out] double[,] cameraMatrix1, - [In, Out] double[] distCoeffs1, int dc1Size, - [In, Out] double[,] cameraMatrix2, - [In, Out] double[] distCoeffs2, int dc2Size, - Size imageSize, - IntPtr R, IntPtr T, - IntPtr E, IntPtr F, - int flags, TermCriteria criteria); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_stereoRectify_InputArray( - IntPtr cameraMatrix1, IntPtr distCoeffs1, - IntPtr cameraMatrix2, IntPtr distCoeffs2, - Size imageSize, IntPtr R, IntPtr T, - IntPtr R1, IntPtr R2, - IntPtr P1, IntPtr P2, - IntPtr Q, int flags, - double alpha, Size newImageSize, - out Rect validPixROI1, out Rect validPixROI2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_stereoRectify_array( - double[,] cameraMatrix1, - double[] distCoeffs1, int dc1Size, - double[,] cameraMatrix2, - double[] distCoeffs2, int dc2Size, - Size imageSize, - double[,] R, double[] T, - double[,] R1, double[,] R2, double[,] P1, double[,] P2, - double[,] Q, int flags, double alpha, Size newImageSize, - out Rect validPixROI1, out Rect validPixROI2); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_stereoRectifyUncalibrated_InputArray( - IntPtr points1, IntPtr points2, - IntPtr F, Size imgSize, - IntPtr H1, IntPtr H2, - double threshold); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_stereoRectifyUncalibrated_array( - Point2d[] points1, int points1Size, - Point2d[] points2, int points2Size, - [In] double[,] F, Size imgSize, - [In, Out] double[,] H1, [In, Out] double[,] H2, - double threshold); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float calib3d_rectify3Collinear_InputArray( - IntPtr cameraMatrix1, IntPtr distCoeffs1, - IntPtr cameraMatrix2, IntPtr distCoeffs2, - IntPtr cameraMatrix3, IntPtr distCoeffs3, - IntPtr[] imgpt1, int imgpt1Size, - IntPtr[] imgpt3, int imgpt3Size, - Size imageSize, IntPtr R12, IntPtr T12, - IntPtr R13, IntPtr T13, - IntPtr R1, IntPtr R2, IntPtr R3, - IntPtr P1, IntPtr P2, IntPtr P3, - IntPtr Q, double alpha, Size newImgSize, - out Rect roi1, out Rect roi2, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_getOptimalNewCameraMatrix_InputArray( - IntPtr cameraMatrix, IntPtr distCoeffs, - Size imageSize, double alpha, Size newImgSize, - out Rect validPixROI, int centerPrincipalPoint); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_getOptimalNewCameraMatrix_array( - [In] double[,] cameraMatrix, - [In] double[] distCoeffs, int distCoeffsSize, - Size imageSize, double alpha, Size newImgSize, - out Rect validPixROI, int centerPrincipalPoint, - [In, Out] double[,] outValues); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsToHomogeneous_InputArray( - IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsToHomogeneous_array1( - [In] Vec2f[] src, [In, Out] Vec3f[] dst, int length); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsToHomogeneous_array2( - [In] Vec3f[] src, [In, Out] Vec4f[] dst, int length); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsFromHomogeneous_InputArray( - IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsFromHomogeneous_array1( - [In] Vec3f[] src, [In, Out] Vec2f[] dst, int length); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsFromHomogeneous_array2( - [In] Vec4f[] src, [In, Out] Vec3f[] dst, int length); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_convertPointsHomogeneous( - IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_findFundamentalMat_InputArray( - IntPtr points1, IntPtr points2, - int method, double param1, double param2, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_findFundamentalMat_array( - Point2d[] points1, int points1Size, - Point2d[] points2, int points2Size, - int method, double param1, double param2, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_computeCorrespondEpilines_InputArray( - IntPtr points, int whichImage, IntPtr F, IntPtr lines); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_computeCorrespondEpilines_array2d( - [In] Point2d[] points, int pointsSize, - int whichImage, double[,] F, [In, Out] Point3f[] lines); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_computeCorrespondEpilines_array3d( - [In] Point3d[] points, int pointsSize, - int whichImage, double[,] F, [In, Out] Point3f[] lines); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_triangulatePoints_InputArray( - IntPtr projMatr1, IntPtr projMatr2, - IntPtr projPoints1, IntPtr projPoints2, - IntPtr points4D); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_triangulatePoints_array( - [In] double[,] projMatr1, [In] double[,] projMatr2, - [In] Point2d[] projPoints1, int projPoints1Size, - [In] Point2d[] projPoints2, int projPoints2Size, - [In, Out] Vec4d[] points4D); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_correctMatches_InputArray( - IntPtr F, IntPtr points1, IntPtr points2, - IntPtr newPoints1, IntPtr newPoints2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_correctMatches_array( - double[,] F, Point2d[] points1, int points1Size, - Point2d[] points2, int points2Size, - Point2d[] newPoints1, Point2d[] newPoints2); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_filterSpeckles(IntPtr img, double newVal, int maxSpeckleSize, - double maxDiff, IntPtr buf); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Rect calib3d_getValidDisparityROI(Rect roi1, Rect roi2, - int minDisparity, int numberOfDisparities, int SADWindowSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_validateDisparity(IntPtr disparity, IntPtr cost, - int minDisparity, int numberOfDisparities, int disp12MaxDisp); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_reprojectImageTo3D(IntPtr disparity, IntPtr _3dImage, - IntPtr Q, int handleMissingValues, int ddepth); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_estimateAffine3D(IntPtr src, IntPtr dst, - IntPtr outVal, IntPtr inliers, double ransacThreshold, double confidence); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoBM.cs b/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoBM.cs deleted file mode 100644 index 2abbf6d82..000000000 --- a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoBM.cs +++ /dev/null @@ -1,71 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_Ptr_StereoBM_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_Ptr_StereoBM_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_StereoBM_create(int numDisparities, int blockSize); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoBM_getPreFilterType(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setPreFilterType(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoBM_getPreFilterSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setPreFilterSize(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoBM_getPreFilterCap(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setPreFilterCap(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoBM_getTextureThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setTextureThreshold(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoBM_getUniquenessRatio(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setUniquenessRatio(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoBM_getSmallerBlockSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setSmallerBlockSize(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Rect calib3d_StereoBM_getROI1(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setROI1(IntPtr obj, Rect value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Rect calib3d_StereoBM_getROI2(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoBM_setROI2(IntPtr obj, Rect value); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoMatcher.cs b/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoMatcher.cs deleted file mode 100644 index 2febb3e1c..000000000 --- a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoMatcher.cs +++ /dev/null @@ -1,54 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_compute( - IntPtr obj, IntPtr left, IntPtr right, IntPtr disparity); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoMatcher_getMinDisparity(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_setMinDisparity(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoMatcher_getNumDisparities(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_setNumDisparities(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoMatcher_getBlockSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_setBlockSize(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoMatcher_getSpeckleWindowSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_setSpeckleWindowSize(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoMatcher_getSpeckleRange(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_setSpeckleRange(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoMatcher_getDisp12MaxDiff(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoMatcher_setDisp12MaxDiff(IntPtr obj, int value); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoSGBM.cs b/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoSGBM.cs deleted file mode 100644 index afc72fa5d..000000000 --- a/src/OpenCvSharp/PInvoke/calib3d/NativeMethods_calib3d_StereoSGBM.cs +++ /dev/null @@ -1,56 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_Ptr_StereoSGBM_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_Ptr_StereoSGBM_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr calib3d_StereoSGBM_create( - int minDisparity, int numDisparities, int blockSize, - int P1, int P2, int disp12MaxDiff, - int preFilterCap, int uniquenessRatio, - int speckleWindowSize, int speckleRange, int mode); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoSGBM_getPreFilterCap(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoSGBM_setPreFilterCap(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoSGBM_getUniquenessRatio(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoSGBM_setUniquenessRatio(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoSGBM_getP1(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoSGBM_setP1(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoSGBM_getP2(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoSGBM_setP2(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int calib3d_StereoSGBM_getMode(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void calib3d_StereoSGBM_setMode(IntPtr obj, int value); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/core/NativeMethods_core.cs b/src/OpenCvSharp/PInvoke/core/NativeMethods_core.cs deleted file mode 100644 index dad6fb375..000000000 --- a/src/OpenCvSharp/PInvoke/core/NativeMethods_core.cs +++ /dev/null @@ -1,298 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region Miscellaneous - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_setNumThreads(int nthreads); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_getNumThreads(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_getThreadNum(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void core_getBuildInformation([MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int maxLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern int core_getBuildInformation_length(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern long core_getTickCount(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_getTickFrequency(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern long core_getCPUTickCount(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_checkHardwareSupport(int feature); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_getNumberOfCPUs(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_fastMalloc(IntPtr bufSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_fastFree(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_setUseOptimized(int onoff); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_useOptimized(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr redirectError(CvErrorCallback errCallback, IntPtr userdata, ref IntPtr prevUserdata); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_cvarrToMat(IntPtr arr, int copyData, int allowND, int coiMode); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_extractImageCOI(IntPtr arr, IntPtr coiimg, int coi); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_insertImageCOI(IntPtr coiimg, IntPtr arr, int coi); - #endregion - - #region Array Operations - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_add(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_subtract(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_multiply(IntPtr src1, IntPtr src2, IntPtr dst, double scale, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_divide1(double scale, IntPtr src2, IntPtr dst, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_divide2(IntPtr src1, IntPtr src2, IntPtr dst, double scale, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_scaleAdd(IntPtr src1, double alpha, IntPtr src2,IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_addWeighted(IntPtr src1, double alpha, IntPtr src2, - double beta, double gamma, IntPtr dst, int dtype); - - #endregion - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_convertScaleAbs(IntPtr src, IntPtr dst, double alpha, double beta); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_LUT(IntPtr src, IntPtr lut, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Scalar core_sum(IntPtr src); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_countNonZero(IntPtr src); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_findNonZero(IntPtr src, IntPtr idx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Scalar core_mean(IntPtr src, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_meanStdDev_OutputArray( - IntPtr src, IntPtr mean, IntPtr stddev, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_meanStdDev_Scalar( - IntPtr src, out Scalar mean, out Scalar stddev, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_norm1(IntPtr src1, int normType, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_norm2(IntPtr src1, IntPtr src2, - int normType, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_batchDistance(IntPtr src1, IntPtr src2, - IntPtr dist, int dtype, IntPtr nidx, - int normType, int k, IntPtr mask, - int update, int crosscheck); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_normalize(IntPtr src, IntPtr dst, double alpha, double beta, - int normType, int dtype, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_minMaxLoc1(IntPtr src, out double minVal, out double maxVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_minMaxLoc2(IntPtr src, out double minVal, out double maxVal, - out Point minLoc, out Point maxLoc, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_minMaxIdx1(IntPtr src, out double minVal, out double maxVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_minMaxIdx2(IntPtr src, out double minVal, out double maxVal, - out int minIdx, out int maxIdx, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_reduce(IntPtr src, IntPtr dst, int dim, int rtype, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_merge([MarshalAs(UnmanagedType.LPArray)] IntPtr[] mv, uint count, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_split(IntPtr src, out IntPtr mv); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_mixChannels(IntPtr[] src, uint nsrcs, - IntPtr[] dst, uint ndsts, int[] fromTo, uint npairs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_extractChannel(IntPtr src, IntPtr dst, int coi); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_insertChannel(IntPtr src, IntPtr dst, int coi); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_flip(IntPtr src, IntPtr dst, int flipCode); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_repeat1(IntPtr src, int ny, int nx, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_repeat2(IntPtr src, int ny, int nx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_hconcat1([MarshalAs(UnmanagedType.LPArray)] IntPtr[] src, uint nsrc, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_hconcat2(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_vconcat1([MarshalAs(UnmanagedType.LPArray)] IntPtr[] src, uint nsrc, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_vconcat2(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_bitwise_and(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_bitwise_or(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_bitwise_xor(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_bitwise_not(IntPtr src, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_absdiff(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_inRange_InputArray(IntPtr src, IntPtr lowerb, IntPtr upperb, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_inRange_Scalar(IntPtr src, Scalar lowerb, Scalar upperb, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_compare(IntPtr src1, IntPtr src2, IntPtr dst, int cmpop); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_min1(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_max1(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_min_MatMat(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_min_MatDouble(IntPtr src1, double src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_max_MatMat(IntPtr src1, IntPtr src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_max_MatDouble(IntPtr src1, double src2, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_sqrt(IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_pow_Mat(IntPtr src, double power, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_exp_Mat(IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_log_Mat(IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float core_cubeRoot(float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float core_fastAtan2(float y, float x); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_polarToCart(IntPtr magnitude, IntPtr angle, IntPtr x, IntPtr y, int angleInDegrees); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_cartToPolar(IntPtr x, IntPtr y, IntPtr magnitude, IntPtr angle, int angleInDegrees); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_phase(IntPtr x, IntPtr y, IntPtr angle, int angleInDegrees); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_magnitude_Mat(IntPtr x, IntPtr y, IntPtr magnitude); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_checkRange(IntPtr a, int quiet, out Point pos, double minVal, double maxVal); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_patchNaNs(IntPtr a, double val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_gemm(IntPtr src1, IntPtr src2, double alpha, IntPtr src3, double gamma, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_mulTransposed(IntPtr src, IntPtr dst, int aTa, IntPtr delta, double scale, int dtype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_transpose(IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_transform(IntPtr src, IntPtr dst, IntPtr m); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_perspectiveTransform(IntPtr src, IntPtr dst, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_perspectiveTransform_Mat(IntPtr src, IntPtr dst, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_perspectiveTransform_Point2f(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_perspectiveTransform_Point2d(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_perspectiveTransform_Point3f(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_perspectiveTransform_Point3d(IntPtr src, int srcLength, IntPtr dst, int dstLength, IntPtr m); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_completeSymm(IntPtr mtx, int lowerToUpper); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_setIdentity(IntPtr mtx, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_determinant(IntPtr mtx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Scalar core_trace(IntPtr mtx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_invert(IntPtr src, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_solve(IntPtr src1, IntPtr src2, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_sort(IntPtr src, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_sortIdx(IntPtr src, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_solveCubic(IntPtr coeffs, IntPtr roots); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_solvePoly(IntPtr coeffs, IntPtr roots, int maxIters); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_eigen(IntPtr src, IntPtr eigenvalues, IntPtr eigenvectors); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_calcCovarMatrix_Mat([MarshalAs(UnmanagedType.LPArray)] IntPtr[] samples, - int nsamples, IntPtr covar, IntPtr mean, int flags, int ctype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_calcCovarMatrix_InputArray(IntPtr samples, IntPtr covar, - IntPtr mean, int flags, int ctype); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCACompute(IntPtr data, IntPtr mean, IntPtr eigenvectors, int maxComponents); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCAComputeVar(IntPtr data, IntPtr mean, IntPtr eigenvectors, double retainedVariance); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCAProject(IntPtr data, IntPtr mean, IntPtr eigenvectors, IntPtr result); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCABackProject(IntPtr data, IntPtr mean, IntPtr eigenvectors, IntPtr result); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVDecomp(IntPtr src, IntPtr w, IntPtr u, IntPtr vt, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVBackSubst(IntPtr w, IntPtr u, IntPtr vt, IntPtr rhs, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_Mahalanobis(IntPtr v1, IntPtr v2, IntPtr icovar); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_dft(IntPtr src, IntPtr dst, int flags, int nonzeroRows); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_idft(IntPtr src, IntPtr dst, int flags, int nonzeroRows); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_dct(IntPtr src, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_idct(IntPtr src, IntPtr dst, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_mulSpectrums(IntPtr a, IntPtr b, IntPtr c, int flags, int conjB); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_getOptimalDFTSize(int vecsize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_kmeans(IntPtr data, int k, IntPtr bestLabels, - TermCriteria criteria, int attempts, int flags, IntPtr centers); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_theRNG(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_randu_InputArray(IntPtr dst, IntPtr low, IntPtr high); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_randu_Scalar(IntPtr dst, Scalar low, Scalar high); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_randn_InputArray(IntPtr dst, IntPtr mean, IntPtr stddev); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_randn_Scalar(IntPtr dst, Scalar mean, Scalar stddev); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_randShuffle(IntPtr dst, double iterFactor, ref ulong rng); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_randShuffle(IntPtr dst, double iterFactor, IntPtr rng); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Algorithm.cs b/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Algorithm.cs deleted file mode 100644 index 035c04199..000000000 --- a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Algorithm.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Algorithm_write(IntPtr obj, IntPtr fs); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Algorithm_read(IntPtr obj, IntPtr fn); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Algorithm_empty(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Algorithm_save(IntPtr obj, string filename); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Algorithm_getDefaultName( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Classes.cs b/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Classes.cs deleted file mode 100644 index 6f4794b62..000000000 --- a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Classes.cs +++ /dev/null @@ -1,314 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region Algorithm - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Algorithm_new(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Algorithm_delete(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void core_Algorithm_name(IntPtr self, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Ptr_Algorithm_new(IntPtr rawPtr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Ptr_Algorithm_delete(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Ptr_Algorithm_get(IntPtr ptr); - - #endregion - - #region InputArray / OutputArray - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_InputArray_new_byMat(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_InputArray_new_byMatExpr(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_InputArray_new_byScalar(Scalar val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_InputArray_new_byDouble(double val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_InputArray_new_byGpuMat(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_InputArray_new_byVectorOfMat(IntPtr vector); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_InputArray_delete(IntPtr ia); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_OutputArray_new_byMat(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_OutputArray_new_byGpuMat(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_OutputArray_new_byScalar(Scalar val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_OutputArray_new_byVectorOfMat(IntPtr vector); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_OutputArray_delete(IntPtr oa); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_InputArray_kind(IntPtr ia); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_OutputArray_getMat(IntPtr oa); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Scalar core_OutputArray_getScalar(IntPtr oa); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_OutputArray_getVectorOfMat(IntPtr oa, IntPtr vector); - - #endregion - - #region FileStorage - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_new2( - [MarshalAs(UnmanagedType.LPStr)] string source, - int flags, [MarshalAs(UnmanagedType.LPStr)] string encoding); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_newFromLegacy(IntPtr fs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileStorage_open( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string filename, - int flags, [MarshalAs(UnmanagedType.LPStr)] string encoding); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileStorage_isOpened(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_release(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_releaseAndGetString( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_getFirstTopLevelNode(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_root(IntPtr obj, int streamIdx); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_indexer( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string nodeName); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_toLegacy(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_writeRaw( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fmt, IntPtr vec, IntPtr len); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_writeObj( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_getDefaultObjectName( - [MarshalAs(UnmanagedType.LPStr)] string filename, - [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe sbyte* core_FileStorage_elname(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileStorage_structs(IntPtr obj, out IntPtr resultLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileStorage_state(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_int( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_float( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, float value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_double( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_String( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_Mat( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_SparseMat( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_vectorOfKeyPoint( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_write_vectorOfDMatch( - IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_writeScalar_int(IntPtr fs, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_writeScalar_float(IntPtr fs, float value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_writeScalar_double(IntPtr fs, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileStorage_writeScalar_String(IntPtr fs, [MarshalAs(UnmanagedType.LPStr)] string value); - - #endregion - - #region FileNode - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_new2(IntPtr fs, IntPtr node); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_new3(IntPtr node); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_delete(IntPtr node); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_operatorThis_byString( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string nodeName); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_operatorThis_byInt(IntPtr obj, int i); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_type(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_empty(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isNone(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isSeq(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isMap(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isInt(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isReal(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isString(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_isNamed(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_name( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_size(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_FileNode_toInt(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float core_FileNode_toFloat(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_FileNode_toDouble(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_toString( - IntPtr obj, StringBuilder buf, int bufLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_toMat(IntPtr obj, IntPtr m); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_readRaw( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] string fmt, IntPtr vec, IntPtr len); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_FileNode_readObj(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_int(IntPtr node, out int value, int defaultValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_float(IntPtr node, out float value, float defaultValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_double(IntPtr node, out double value, double defaultValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_String( - IntPtr node, [MarshalAs(UnmanagedType.LPStr)] StringBuilder value, int valueCapacity, - [MarshalAs(UnmanagedType.LPStr)] string defaultValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_Mat(IntPtr node, IntPtr mat, IntPtr defaultMat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_SparseMat(IntPtr node, IntPtr mat, IntPtr defaultMat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_vectorOfKeyPoint(IntPtr node, IntPtr keypoints); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_FileNode_read_vectorOfDMatch(IntPtr node, IntPtr matches); - - #endregion - - #region PCA - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_new2(IntPtr data, IntPtr mean, int flags, - int maxComponents); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_new3(IntPtr data, IntPtr mean, int flags, - double retainedVariance); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCA_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCA_operatorThis(IntPtr obj, IntPtr data, IntPtr mean, - int flags, int maxComponents); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCA_computeVar(IntPtr obj, IntPtr data, IntPtr mean, - int flags, double retainedVariance); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_project1(IntPtr obj, IntPtr vec); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCA_project2(IntPtr obj, IntPtr vec, IntPtr result); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_backProject1(IntPtr obj, IntPtr vec); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_PCA_backProject2(IntPtr obj, IntPtr vec, IntPtr result); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_eigenvectors(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_eigenvalues(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_PCA_mean(IntPtr obj); - #endregion - - #region RNG - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_RNG_fill(ref ulong state, IntPtr mat, int distType, IntPtr a, IntPtr b, int saturateRange); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_RNG_gaussian(ref ulong state, double sigma); - #endregion - - #region SVD - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SVD_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SVD_new2(IntPtr src, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_operatorThis(IntPtr obj, IntPtr src, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_backSubst(IntPtr obj, IntPtr rhs, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_static_compute1(IntPtr src, IntPtr w, IntPtr u, IntPtr vt, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_static_compute2(IntPtr src, IntPtr w, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_static_backSubst(IntPtr w, IntPtr u, IntPtr vt, IntPtr rhs, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SVD_static_solveZ(IntPtr src, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SVD_u(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SVD_w(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SVD_vt(IntPtr obj); - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Mat.cs b/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Mat.cs deleted file mode 100644 index 9ce9defa6..000000000 --- a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_Mat.cs +++ /dev/null @@ -1,623 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_sizeof(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new2(int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new3(int rows, int cols, int type, Scalar scalar); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new4(IntPtr mat, Range rowRange, Range colRange); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new5(IntPtr mat, Range rowRange); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new6(IntPtr mat, [MarshalAs(UnmanagedType.LPArray)] Range[] rowRange); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new7(IntPtr mat, Rect roi); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new8(int rows, int cols, int type, IntPtr data, IntPtr step); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new9(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, - int type, IntPtr data, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] steps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new9(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, - int type, IntPtr data, IntPtr steps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new10(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new11(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sizes, int type, Scalar s); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new_FromIplImage(IntPtr img, int copyData); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_new_FromCvMat(IntPtr mat, int copyData); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_release(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_delete(IntPtr mat); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_adjustROI(IntPtr nativeObj, int dtop, int dbottom, int dleft, int dright); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_assignTo1(IntPtr self, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_assignTo2(IntPtr self, IntPtr m, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_channels(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_checkVector1(IntPtr self, int elemChannels); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_checkVector2(IntPtr self, int elemChannels, int depth); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_checkVector3(IntPtr self, int elemChannels, int depth, int requireContinuous); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_clone(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_col_toMat(IntPtr self, int x); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_col_toMatExpr(IntPtr self, int x); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_cols(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_colRange_toMat(IntPtr self, int startCol, int endCol); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_colRange_toMatExpr(IntPtr self, int startCol, int endCol); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_dims(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_convertTo(IntPtr self, IntPtr m, int rtype, double alpha, double beta); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_copyTo(IntPtr self, IntPtr m, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_create1(IntPtr self, int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_create2(IntPtr self, int ndims, - [MarshalAs(UnmanagedType.LPArray)] int[] sizes, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_cross(IntPtr self, IntPtr m); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe byte* core_Mat_data(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_datastart(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_dataend(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_datalimit(IntPtr self); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_depth(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_diag1(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_diag2(IntPtr self, int d); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_diag3(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_Mat_dot(IntPtr self, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_elemSize(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_elemSize1(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_empty(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_eye(int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_inv1(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_inv2(IntPtr self, int method); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_isContinuous(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_isSubmatrix(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_locateROI(IntPtr self, out Size wholeSize, out Point ofs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_mul1(IntPtr self, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_mul2(IntPtr self, IntPtr m, double scale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_ones1(int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_ones2(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sz, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_reshape1(IntPtr self, int cn); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_reshape2(IntPtr self, int cn, int rows); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_reshape3(IntPtr self, int cn, int newndims, [MarshalAs(UnmanagedType.LPArray)] int[] newsz); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_rows(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_row_toMat(IntPtr self, int y); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_row_toMatExpr(IntPtr self, int y); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_rowRange_toMat(IntPtr self, int startRow, int endRow); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_rowRange_toMatExpr(IntPtr self, int startRow, int endRow); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_setTo_Scalar(IntPtr self, Scalar value, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_setTo_InputArray(IntPtr self, IntPtr value, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size core_Mat_size(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_sizeAt(IntPtr self, int i); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_step11(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_step12(IntPtr self, int i); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern long core_Mat_step(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_stepAt(IntPtr self, int i); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_subMat1(IntPtr self, int rowStart, int rowEnd, int colStart, int colEnd); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_subMat2(IntPtr self, int nRanges, Range[] ranges); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_t(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_Mat_total(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_Mat_type(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_zeros1(int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_zeros2(int ndims, [MarshalAs(UnmanagedType.LPArray)] int[] sz, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern unsafe sbyte* core_Mat_dump(IntPtr self, [MarshalAs(UnmanagedType.LPStr)] string format); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe void core_Mat_dump_delete(sbyte* buf); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_ptr1d(IntPtr self, int i0); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_ptr2d(IntPtr self, int i0, int i1); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_ptr3d(IntPtr self, int i0, int i1, int i2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_ptrnd(IntPtr self, [MarshalAs(UnmanagedType.LPArray)] int[] idx); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_assignment_FromMat(IntPtr self, IntPtr newMat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_assignment_FromMatExpr(IntPtr self, IntPtr newMatExpr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_assignment_FromScalar(IntPtr self, Scalar scalar); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_IplImage(IntPtr self, IntPtr outImage); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_IplImage_alignment(IntPtr self, out IntPtr outImage); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_CvMat(IntPtr self, IntPtr outMat); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorUnaryMinus(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorAdd_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorAdd_MatScalar(IntPtr a, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorAdd_ScalarMat(Scalar s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorMinus_Mat(IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorSubtract_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorSubtract_MatScalar(IntPtr a, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorSubtract_ScalarMat(Scalar s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorMultiply_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorMultiply_MatDouble(IntPtr a, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorMultiply_DoubleMat(double s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorDivide_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorDivide_MatDouble(IntPtr a, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorDivide_DoubleMat(double s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorAnd_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorAnd_MatDouble(IntPtr a, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorAnd_DoubleMat(double s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorOr_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorOr_MatDouble(IntPtr a, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorOr_DoubleMat(double s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorXor_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorXor_MatDouble(IntPtr a, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorXor_DoubleMat(double s, IntPtr a); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorNot(IntPtr a); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorLT_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorLT_DoubleMat(double a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorLT_MatDouble(IntPtr a, double b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorLE_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorLE_DoubleMat(double a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorLE_MatDouble(IntPtr a, double b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorGT_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorGT_DoubleMat(double a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorGT_MatDouble(IntPtr a, double b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorGE_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorGE_DoubleMat(double a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorGE_MatDouble(IntPtr a, double b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorEQ_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorEQ_DoubleMat(double a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorEQ_MatDouble(IntPtr a, double b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorNE_MatMat(IntPtr a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorNE_DoubleMat(double a, IntPtr b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_Mat_operatorNE_MatDouble(IntPtr a, double b); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_abs_Mat(IntPtr e); - - #region nSet - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetB(IntPtr obj, int row, int col, - byte* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetS(IntPtr obj, int row, int col, - short* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetS(IntPtr obj, int row, int col, - ushort* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetI(IntPtr obj, int row, int col, - int* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetF(IntPtr obj, int row, int col, - float* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetD(IntPtr obj, int row, int col, - double* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetVec3b(IntPtr obj, int row, int col, - Vec3b* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetVec3d(IntPtr obj, int row, int col, - Vec3d* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetVec4f(IntPtr obj, int row, int col, - Vec4f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetVec6f(IntPtr obj, int row, int col, - Vec6f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetVec4i(IntPtr obj, int row, int col, - Vec4i* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetPoint(IntPtr obj, int row, int col, - Point* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetPoint2f(IntPtr obj, int row, int col, - Point2f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetPoint2d(IntPtr obj, int row, int col, - Point2d* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetPoint3i(IntPtr obj, int row, int col, - Point3i* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetPoint3f(IntPtr obj, int row, int col, - Point3f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetPoint3d(IntPtr obj, int row, int col, - Point3d* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nSetRect(IntPtr obj, int row, int col, - Rect* vals, int valsLength); - - #endregion - - #region nGet - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetB(IntPtr obj, int row, int col, - byte* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetS(IntPtr obj, int row, int col, - short* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetS(IntPtr obj, int row, int col, - ushort* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetI(IntPtr obj, int row, int col, - int* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetF(IntPtr obj, int row, int col, - float* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetD(IntPtr obj, int row, int col, - double* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetVec3b(IntPtr obj, int row, int col, - Vec3b* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetVec3d(IntPtr obj, int row, int col, - Vec3d* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetVec4f(IntPtr obj, int row, int col, - Vec4f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetVec6f(IntPtr obj, int row, int col, - Vec6f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetVec4i(IntPtr obj, int row, int col, - Vec4i* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetPoint(IntPtr obj, int row, int col, - Point* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetPoint2f(IntPtr obj, int row, int col, - Point2f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetPoint2d(IntPtr obj, int row, int col, - Point2d* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetPoint3i(IntPtr obj, int row, int col, - Point3i* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetPoint3f(IntPtr obj, int row, int col, - Point3f* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetPoint3d(IntPtr obj, int row, int col, - Point3d* vals, int valsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int core_Mat_nGetRect(IntPtr obj, int row, int col, - Rect* vals, int valsLength); - - #endregion - - #region push_back - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Mat(IntPtr self, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_char(IntPtr self, sbyte v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_uchar(IntPtr self, byte v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_short(IntPtr self, short v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_ushort(IntPtr self, ushort v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_int(IntPtr self, int v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_float(IntPtr self, float v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_double(IntPtr self, double v); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec2b(IntPtr self, Vec2b v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec3b(IntPtr self, Vec3b v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec4b(IntPtr self, Vec4b v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec6b(IntPtr self, Vec6b v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec2s(IntPtr self, Vec2s v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec3s(IntPtr self, Vec3s v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec4s(IntPtr self, Vec4s v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec6s(IntPtr self, Vec6s v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec2w(IntPtr self, Vec2w v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec3w(IntPtr self, Vec3w v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec4w(IntPtr self, Vec4w v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec6w(IntPtr self, Vec6w v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec2i(IntPtr self, Vec2i v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec3i(IntPtr self, Vec3i v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec4i(IntPtr self, Vec4i v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec6i(IntPtr self, Vec6i v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec2f(IntPtr self, Vec2f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec3f(IntPtr self, Vec3f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec4f(IntPtr self, Vec4f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec6f(IntPtr self, Vec6f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec2d(IntPtr self, Vec2d v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec3d(IntPtr self, Vec3d v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Vec6d(IntPtr self, Vec6d v); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Point(IntPtr self, Point v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Point2f(IntPtr self, Point2f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Point2d(IntPtr self, Point2d v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Point3i(IntPtr self, Point3i v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Point3f(IntPtr self, Point3f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Point3d(IntPtr self, Point3d v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Size(IntPtr self, Size v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Size2f(IntPtr self, Size2f v); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_push_back_Rect(IntPtr self, Rect v); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_reserve(IntPtr obj, IntPtr sz); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_resize1(IntPtr obj, IntPtr sz); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_resize2(IntPtr obj, IntPtr sz, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_pop_back(IntPtr obj, IntPtr nelems); - #endregion - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_uchar(IntPtr m, MatForeachFunctionByte proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec2b(IntPtr m, MatForeachFunctionVec2b proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec3b(IntPtr m, MatForeachFunctionVec3b proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec4b(IntPtr m, MatForeachFunctionVec4b proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec6b(IntPtr m, MatForeachFunctionVec6b proc); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_short(IntPtr m, MatForeachFunctionInt16 proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec2s(IntPtr m, MatForeachFunctionVec2s proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec3s(IntPtr m, MatForeachFunctionVec3s proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec4s(IntPtr m, MatForeachFunctionVec4s proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec6s(IntPtr m, MatForeachFunctionVec6s proc); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_int(IntPtr m, MatForeachFunctionInt32 proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec2i(IntPtr m, MatForeachFunctionVec2i proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec3i(IntPtr m, MatForeachFunctionVec3i proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec4i(IntPtr m, MatForeachFunctionVec4i proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec6i(IntPtr m, MatForeachFunctionVec6i proc); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_float(IntPtr m, MatForeachFunctionFloat proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec2f(IntPtr m, MatForeachFunctionVec2f proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec3f(IntPtr m, MatForeachFunctionVec3f proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec4f(IntPtr m, MatForeachFunctionVec4f proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec6f(IntPtr m, MatForeachFunctionVec6f proc); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_double(IntPtr m, MatForeachFunctionDouble proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec2d(IntPtr m, MatForeachFunctionVec2d proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec3d(IntPtr m, MatForeachFunctionVec3d proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec4d(IntPtr m, MatForeachFunctionVec4d proc); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_Mat_forEach_Vec6d(IntPtr m, MatForeachFunctionVec6d proc); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_MatExpr.cs b/src/OpenCvSharp/PInvoke/core/NativeMethods_core_MatExpr.cs deleted file mode 100644 index f0b93eca7..000000000 --- a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_MatExpr.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_new2(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_MatExpr_delete(IntPtr expr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_toMat(IntPtr expr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorUnaryMinus_MatExpr(IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorUnaryNot_MatExpr(IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorAdd_MatExprMat(IntPtr e, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorAdd_MatMatExpr(IntPtr m, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorAdd_MatExprScalar(IntPtr e, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorAdd_ScalarMatExpr(Scalar s, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorAdd_MatExprMatExpr(IntPtr e1, IntPtr e2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorSubtract_MatExprMat(IntPtr e, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorSubtract_MatMatExpr(IntPtr m, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorSubtract_MatExprScalar(IntPtr e, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorSubtract_ScalarMatExpr(Scalar s, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorSubtract_MatExprMatExpr(IntPtr e1, IntPtr e2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorMultiply_MatExprMat(IntPtr e, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorMultiply_MatMatExpr(IntPtr m, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorMultiply_MatExprDouble(IntPtr e, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorMultiply_DoubleMatExpr(double s, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorMultiply_MatExprMatExpr(IntPtr e1, IntPtr e2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorDivide_MatExprMat(IntPtr e, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorDivide_MatMatExpr(IntPtr m, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorDivide_MatExprDouble(IntPtr e, double s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorDivide_DoubleMatExpr(double s, IntPtr e); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_operatorDivide_MatExprMatExpr(IntPtr e1, IntPtr e2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_row(IntPtr self, int y); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_col(IntPtr self, int x); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_diag1(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_diag2(IntPtr self, int d); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_submat(IntPtr self, int rowStart, int rowEnd, int colStart, int colEnd); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_cross(IntPtr self, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double core_MatExpr_dot(IntPtr self, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_t(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_inv1(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_inv2(IntPtr self, int method); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_mul_toMatExpr(IntPtr self, IntPtr e, double scale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_MatExpr_mul_toMat(IntPtr self, IntPtr m, double scale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size core_MatExpr_size(IntPtr self); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_MatExpr_type(IntPtr self); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_abs_MatExpr(IntPtr e); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_SparseMat.cs b/src/OpenCvSharp/PInvoke/core/NativeMethods_core_SparseMat.cs deleted file mode 100644 index d2575bb03..000000000 --- a/src/OpenCvSharp/PInvoke/core/NativeMethods_core_SparseMat.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong core_SparseMat_sizeof(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_new2(int dims, int[] sizes, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_new3(IntPtr m); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_operatorAssign_SparseMat(IntPtr obj, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_operatorAssign_Mat(IntPtr obj, IntPtr m); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_clone(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_copyTo_SparseMat(IntPtr obj, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_copyTo_Mat(IntPtr obj, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_convertTo_SparseMat(IntPtr obj, IntPtr m, - int rtype, double alpha); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_convertTo_Mat(IntPtr obj, IntPtr m, int rtype, - double alpha, double beta); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_assignTo(IntPtr obj, IntPtr m, int type); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_create(IntPtr obj, int dims, int[] sizes, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_clear(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_addref(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void core_SparseMat_release(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_elemSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_elemSize1(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_type(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_depth(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_channels(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_size1(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_size2(IntPtr obj, int i); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int core_SparseMat_dims(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_nzcount(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_hash_1d(IntPtr obj, int i0); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_hash_2d(IntPtr obj, int i0, int i1); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_hash_3d(IntPtr obj, int i0, int i1, int i2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_hash_nd(IntPtr obj, int[] idx); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_1d(IntPtr obj, int i0, - int createMissing, ref ulong hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_1d(IntPtr obj, int i0, - int createMissing, IntPtr hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_2d(IntPtr obj, int i0, int i1, - int createMissing, ref ulong hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_2d(IntPtr obj, int i0, int i1, - int createMissing, IntPtr hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_3d(IntPtr obj, int i0, int i1, int i2, - int createMissing, ref ulong hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_3d(IntPtr obj, int i0, int i1, int i2, - int createMissing, IntPtr hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_nd(IntPtr obj, int[] idx, - int createMissing, ref ulong hashval); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr core_SparseMat_ptr_nd(IntPtr obj, int[] idx, - int createMissing, IntPtr hashval); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/cuda/NativeMethods_cuda.cs b/src/OpenCvSharp/PInvoke/cuda/NativeMethods_cuda.cs deleted file mode 100644 index bfd0643fe..000000000 --- a/src/OpenCvSharp/PInvoke/cuda/NativeMethods_cuda.cs +++ /dev/null @@ -1,339 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; -using OpenCvSharp.Cuda; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - #region Device - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_getCudaEnabledDeviceCount(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_setDevice(int device); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_getDevice(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_resetDevice(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_deviceSupports(int feature_set); - - // TargetArchs - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_builtWith(int feature_set); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_has(int major, int minor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_hasPtx(int major, int minor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_hasBin(int major, int minor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_hasEqualOrLessPtx(int major, int minor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_hasEqualOrGreater(int major, int minor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_hasEqualOrGreaterPtx(int major, int minor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_TargetArchs_hasEqualOrGreaterBin(int major, int minor); - - // DeviceInfo - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_DeviceInfo_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_DeviceInfo_new2(int deviceId); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_DeviceInfo_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)] - public static extern void cuda_DeviceInfo_name( - IntPtr obj, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, int bufLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_majorVersion(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_minorVersion(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_multiProcessorCount(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_DeviceInfo_sharedMemPerBlock(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_DeviceInfo_queryMemory( - IntPtr obj, out ulong totalMemory, out ulong freeMemory); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_DeviceInfo_freeMemory(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_DeviceInfo_totalMemory(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_supports(IntPtr obj, int featureSet); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_isCompatible(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_deviceID(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_DeviceInfo_canMapHostMemory(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_printCudaDeviceInfo(int device); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_printShortCudaDeviceInfo(int device); - #endregion - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_registerPageLocked(IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_unregisterPageLocked(IntPtr m); - - #region Stream - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_Stream_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_Stream_new2(IntPtr s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_opAssign(IntPtr left, IntPtr right); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_Stream_queryIfComplete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_waitForCompletion(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueDownload_CudaMem(IntPtr obj, IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueDownload_Mat(IntPtr obj, IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueUpload_CudaMem(IntPtr obj, IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueUpload_Mat(IntPtr obj, IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueCopy(IntPtr obj, IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueMemSet(IntPtr obj, IntPtr src, Scalar val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueMemSet_WithMask(IntPtr obj, IntPtr src, Scalar val, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueConvert( - IntPtr obj, IntPtr src, IntPtr dst, int dtype, double a, double b); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_Stream_enqueueHostCallback( - IntPtr obj, IntPtr callback, IntPtr userData); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_Stream_Null(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_Stream_bool(IntPtr obj); - - #endregion - - #region CascadeClassifier_GPU - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_CascadeClassifier_GPU_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_CascadeClassifier_GPU_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_CascadeClassifier_GPU_new2(string filename); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_CascadeClassifier_GPU_empty(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_CascadeClassifier_GPU_load(IntPtr obj, string filename); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_CascadeClassifier_GPU_release(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_CascadeClassifier_GPU_detectMultiScale1(IntPtr obj, - IntPtr image, IntPtr objectsBuf, double scaleFactor, int minNeighbors, Size minSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_CascadeClassifier_GPU_detectMultiScale2(IntPtr obj, - IntPtr image, IntPtr objectsBuf, Size maxObjectSize, Size minSize, double scaleFactor, - int minNeighbors); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_CascadeClassifier_GPU_findLargestObject_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_CascadeClassifier_GPU_findLargestObject_set(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_CascadeClassifier_GPU_visualizeInPlace_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_CascadeClassifier_GPU_visualizeInPlace_set(IntPtr obj, int value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size cuda_CascadeClassifier_GPU_getClassifierSize(IntPtr obj); - - #endregion - - #region HogDescriptor - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int HOGDescriptor_sizeof(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr HOGDescriptor_new(Size win_size, Size block_size, Size block_stride, Size cell_size, - int nbins, double winSigma, double threshold_L2Hys, bool gamma_correction, int nlevels); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong HOGDescriptor_getDescriptorSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong HOGDescriptor_getBlockHistogramSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int HOGDescriptor_checkDetectorSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double HOGDescriptor_getWinSigma(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_setSVMDetector(IntPtr obj, IntPtr svmdetector); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_detect(IntPtr obj, IntPtr img, IntPtr found_locations, double hit_threshold, Size win_stride, Size padding); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_detectMultiScale(IntPtr obj, IntPtr img, IntPtr found_locations, - double hit_threshold, Size win_stride, Size padding, double scale, int group_threshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_getDescriptors(IntPtr obj, IntPtr img, Size win_stride, IntPtr descriptors, [MarshalAs(UnmanagedType.I4)] DescriptorFormat descr_format); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size HOGDescriptor_win_size_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size HOGDescriptor_block_size_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size HOGDescriptor_block_stride_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size HOGDescriptor_cell_size_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int HOGDescriptor_nbins_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double HOGDescriptor_win_sigma_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double HOGDescriptor_threshold_L2hys_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int HOGDescriptor_nlevels_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int HOGDescriptor_gamma_correction_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_win_size_set(IntPtr obj, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_block_size_set(IntPtr obj, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_block_stride_set(IntPtr obj, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_cell_size_set(IntPtr obj, Size value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_nbins_set(IntPtr obj, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_win_sigma_set(IntPtr obj, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_threshold_L2hys_set(IntPtr obj, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_nlevels_set(IntPtr obj, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void HOGDescriptor_gamma_correction_set(IntPtr obj, int value); - #endregion - - #region MOG_GPU - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG_GPU_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_MOG_GPU_new(int nmixtures); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG_GPU_initialize( - IntPtr obj, Size frameSize, int frameType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG_GPU_operator( - IntPtr obj, IntPtr frame, IntPtr fgmask, float learningRate, IntPtr stream); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG_GPU_getBackgroundImage( - IntPtr obj, IntPtr backgroundImage, IntPtr stream); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG_GPU_release(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int* cuda_MOG_GPU_history(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG_GPU_varThreshold(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG_GPU_backgroundRatio(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG_GPU_noiseSigma(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG2_GPU_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_MOG2_GPU_new(int nmixtures); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG2_GPU_initialize( - IntPtr obj, Size frameSize, int frameType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG2_GPU_operator( - IntPtr obj, IntPtr frame, IntPtr fgmask, float learningRate, IntPtr stream); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG2_GPU_getBackgroundImage( - IntPtr obj, IntPtr backgroundImage, IntPtr stream); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG2_GPU_release(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int* cuda_MOG2_GPU_history(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_varThreshold(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_backgroundRatio(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_varThresholdGen(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_fVarInit(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_fVarMin(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_fVarMax(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_fCT(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_MOG2_GPU_bShadowDetection_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_MOG2_GPU_bShadowDetection_set(IntPtr obj, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe byte* cuda_MOG2_GPU_nShadowDetection(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_MOG2_GPU_fTau(IntPtr obj); - - #endregion - - #region StereoBM_GPU - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_StereoBM_GPU_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_StereoBM_GPU_new2(int preset, int ndisparities, int winSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_StereoBM_GPU_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_StereoBM_GPU_run1(IntPtr obj, IntPtr left, IntPtr right, IntPtr disparity); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_StereoBM_GPU_run2(IntPtr obj, IntPtr left, IntPtr right, IntPtr disparity, IntPtr stream); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_StereoBM_GPU_checkIfGpuCallReasonable(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int* cuda_StereoBM_GPU_preset(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int* cuda_StereoBM_GPU_ndisp(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe int* cuda_StereoBM_GPU_winSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe float* cuda_StereoBM_GPU_avergeTexThreshold(IntPtr obj); - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/cuda/NativeMethods_cuda_GpuMat.cs b/src/OpenCvSharp/PInvoke/cuda/NativeMethods_cuda_GpuMat.cs deleted file mode 100644 index 204205411..000000000 --- a/src/OpenCvSharp/PInvoke/cuda/NativeMethods_cuda_GpuMat.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - #region Init & Disposal - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new2(int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new3(int rows, int cols, int type, IntPtr data, ulong step); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new4(IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new5(IntPtr gpumat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new6(Size size, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new7(Size size, int type, IntPtr data, ulong step); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new8(int rows, int cols, int type, Scalar s); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new9(IntPtr m, Range rowRange, Range colRange); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new10(IntPtr m, Rect roi); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_new11(Size size, int type, Scalar s); - - #endregion - - #region Operators - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_opToMat(IntPtr src); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_opToGpuMat(IntPtr src); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_opAssign(IntPtr left, IntPtr right); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_opRange1(IntPtr src, Rect roi); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_opRange2(IntPtr src, Range rowRange, Range colRange); - - #endregion - - #region Fields - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_flags(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_rows(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_cols(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_GpuMat_step(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe byte* cuda_GpuMat_data(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_refcount(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_datastart(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_dataend(IntPtr obj); - #endregion - - #region Methods - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_upload(IntPtr obj, IntPtr mat); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_download(IntPtr obj, IntPtr mat); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_row(IntPtr obj, int y); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_col(IntPtr obj, int x); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_rowRange(IntPtr obj, int startrow, int endrow); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_colRange(IntPtr obj, int startcol, int endcol); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_clone(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_copyTo1(IntPtr obj, IntPtr m); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_copyTo2(IntPtr obj, IntPtr m, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_convertTo(IntPtr obj, IntPtr m, int rtype, double alpha, double beta); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_assignTo(IntPtr obj, IntPtr m, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_setTo(IntPtr obj, Scalar s, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_reshape(IntPtr obj, int cn, int rows); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_create1(IntPtr obj, int rows, int cols, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_create2(IntPtr obj, Size size, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_release(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_swap(IntPtr obj, IntPtr mat); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_GpuMat_locateROI(IntPtr obj, out Size wholeSize, out Point ofs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_GpuMat_adjustROI(IntPtr obj, int dtop, int dbottom, int dleft, int drightt); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_isContinuous(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_GpuMat_elemSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_GpuMat_elemSize1(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_type(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_depth(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_channels(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ulong cuda_GpuMat_step1(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size cuda_GpuMat_size(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int cuda_GpuMat_empty(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern unsafe byte* cuda_GpuMat_ptr(IntPtr obj, int y); - #endregion - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_createContinuous1( - int rows, int cols, int type, IntPtr gm); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr cuda_createContinuous2( - int rows, int cols, int type); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void cuda_ensureSizeIsEnough( - int rows, int cols, int type, IntPtr m); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/face/NativeMethods_face.cs b/src/OpenCvSharp/PInvoke/face/NativeMethods_face.cs deleted file mode 100644 index 06acf93d9..000000000 --- a/src/OpenCvSharp/PInvoke/face/NativeMethods_face.cs +++ /dev/null @@ -1,25 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr face_createEigenFaceRecognizer( - int numComponents, double threshold); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr face_createFisherFaceRecognizer( - int numComponents, double threshold); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr face_createLBPHFaceRecognizer( - int radius, int neighbors, int gridX, int gridY, double threshold); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/face/NativeMethods_face_BasicFaceRecognizer.cs b/src/OpenCvSharp/PInvoke/face/NativeMethods_face_BasicFaceRecognizer.cs deleted file mode 100644 index 5b50a7053..000000000 --- a/src/OpenCvSharp/PInvoke/face/NativeMethods_face_BasicFaceRecognizer.cs +++ /dev/null @@ -1,46 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int face_BasicFaceRecognizer_getNumComponents(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_setNumComponents(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double face_BasicFaceRecognizer_getThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_setThreshold(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_getProjections(IntPtr obj, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_getLabels(IntPtr obj, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_getEigenValues(IntPtr obj, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_getEigenVectors(IntPtr obj, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_BasicFaceRecognizer_getMean(IntPtr obj, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr face_Ptr_BasicFaceRecognizer_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_Ptr_BasicFaceRecognizer_delete(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/face/NativeMethods_face_FaceRecognizer.cs b/src/OpenCvSharp/PInvoke/face/NativeMethods_face_FaceRecognizer.cs deleted file mode 100644 index df3692371..000000000 --- a/src/OpenCvSharp/PInvoke/face/NativeMethods_face_FaceRecognizer.cs +++ /dev/null @@ -1,53 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_train( - IntPtr obj, IntPtr[] src, int srcLength, int[] labels, int labelsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_update( - IntPtr obj, IntPtr[] src, int srcLength, int[] labels, int labelsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int face_FaceRecognizer_predict1(IntPtr obj, IntPtr src); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_predict2( - IntPtr obj, IntPtr src, out int label, out double confidence); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_save1(IntPtr obj, string filename); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_load1(IntPtr obj, string filename); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_save2(IntPtr obj, IntPtr fs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_load2(IntPtr obj, IntPtr fs); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_setLabelInfo(IntPtr obj, int label, - [MarshalAs(UnmanagedType.LPStr)] string strInfo); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_getLabelInfo(IntPtr obj, int label, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_getLabelsByString(IntPtr obj, - [MarshalAs(UnmanagedType.LPStr)] string str, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double face_FaceRecognizer_getThreshold(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_FaceRecognizer_setThreshold(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr face_Ptr_FaceRecognizer_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_Ptr_FaceRecognizer_delete(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/face/NativeMethods_face_LBPHFaceRecognizer.cs b/src/OpenCvSharp/PInvoke/face/NativeMethods_face_LBPHFaceRecognizer.cs deleted file mode 100644 index daf15af70..000000000 --- a/src/OpenCvSharp/PInvoke/face/NativeMethods_face_LBPHFaceRecognizer.cs +++ /dev/null @@ -1,56 +0,0 @@ - -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int face_LBPHFaceRecognizer_getGridX(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_setGridX(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int face_LBPHFaceRecognizer_getGridY(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_setGridY(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int face_LBPHFaceRecognizer_getRadius(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_setRadius(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int face_LBPHFaceRecognizer_getNeighbors(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_setNeighbors(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double face_LBPHFaceRecognizer_getThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_setThreshold(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_getHistograms(IntPtr obj, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_LBPHFaceRecognizer_getLabels(IntPtr obj, IntPtr dst); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr face_Ptr_LBPHFaceRecognizer_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void face_Ptr_LBPHFaceRecognizer_delete(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d.cs deleted file mode 100644 index bd0c1b0a7..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - // DenseFeatureDetector - /* - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_DenseFeatureDetector_new( - float initFeatureScale, int featureScaleLevels, float featureScaleMul, - int initXyStep, int initImgBound, int varyXyStepWithScale, int varyImgBoundWithScale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DenseFeatureDetector_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_DenseFeatureDetector_info(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_DenseFeatureDetector_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_DenseFeatureDetector_delete(IntPtr ptr); - */ - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_drawKeypoints(IntPtr image, KeyPoint[] keypoints, int keypointsLength, - IntPtr outImage, Scalar color, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_drawMatches1(IntPtr img1, KeyPoint[] keypoints1, int keypoints1Length, - IntPtr img2, KeyPoint[] keypoints2, int keypoints2Length, - DMatch[] matches1to2, int matches1to2Length, IntPtr outImg, - Scalar matchColor, Scalar singlePointColor, - byte[] matchesMask, int matchesMaskLength, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_drawMatches2(IntPtr img1, KeyPoint[] keypoints1, int keypoints1Length, - IntPtr img2, KeyPoint[] keypoints2, int keypoints2Length, - IntPtr[] matches1to2, int matches1to2Size1, int[] matches1to2Size2, - IntPtr outImg, Scalar matchColor, Scalar singlePointColor, - IntPtr[] matchesMask, int matchesMaskSize1, int[] matchesMaskSize2, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_evaluateFeatureDetector( - IntPtr img1, IntPtr img2, IntPtr H1to2, - IntPtr keypoints1, IntPtr keypoints2, - out float repeatability, out int correspCount); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_computeRecallPrecisionCurve( - IntPtr[] matches1to2, int matches1to2Size1, int[] matches1to2Size2, - IntPtr[] correctMatches1to2Mask, int correctMatches1to2MaskSize1, int[] correctMatches1to2MaskSize2, - IntPtr recallPrecisionCurve); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float features2d_getRecall( - Point2f[] recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_getNearestPoint( - Point2f[] recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_AKAZE.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_AKAZE.cs deleted file mode 100644 index e1726352e..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_AKAZE.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_AKAZE_create( - int descriptor_type, int descriptor_size, int descriptor_channels, - float threshold, int nOctaves, int nOctaveLayers, int diffusivity); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_AKAZE_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_AKAZE_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setDescriptorType(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AKAZE_getDescriptorType(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setDescriptorSize(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AKAZE_getDescriptorSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setDescriptorChannels(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AKAZE_getDescriptorChannels(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setThreshold(IntPtr obj, double val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double features2d_AKAZE_getThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setNOctaves(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AKAZE_getNOctaves(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setNOctaveLayers(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AKAZE_getNOctaveLayers(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AKAZE_setDiffusivity(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AKAZE_getDiffusivity(IntPtr obj); - } -} diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_AgastFeatureDetector.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_AgastFeatureDetector.cs deleted file mode 100644 index eef99599f..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_AgastFeatureDetector.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AGAST(IntPtr image, IntPtr keypoints, - int threshold, int nonmaxSuppression, int type); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_AgastFeatureDetector_create( - int threshold, int nonmaxSuppression, int type); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_AgastFeatureDetector_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_AgastFeatureDetector_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AgastFeatureDetector_setThreshold(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AgastFeatureDetector_getThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AgastFeatureDetector_setNonmaxSuppression(IntPtr obj,int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AgastFeatureDetector_getNonmaxSuppression(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_AgastFeatureDetector_setType(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_AgastFeatureDetector_getType(IntPtr obj); - } -} diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_BOW.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_BOW.cs deleted file mode 100644 index 515c55231..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_BOW.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - // BOWTrainer - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWTrainer_add(IntPtr obj, IntPtr descriptors); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWTrainer_getDescriptors(IntPtr obj, IntPtr descriptors); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_BOWTrainer_descriptorsCount(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWTrainer_clear(IntPtr obj); - - - // BOWKMeansTrainer - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWKMeansTrainer_new( - int clusterCount, TermCriteria termcrit, int attempts, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWKMeansTrainer_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWKMeansTrainer_cluster1(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWKMeansTrainer_cluster2(IntPtr obj, IntPtr descriptors); - - - // BOWImgDescriptorExtractor - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWImgDescriptorExtractor_new1_Ptr(IntPtr dextractor, IntPtr dmatcher); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWImgDescriptorExtractor_new2_Ptr(IntPtr dmatcher); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWImgDescriptorExtractor_new1_RawPtr(IntPtr dextractor, IntPtr dmatcher); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWImgDescriptorExtractor_new2_RawPtr(IntPtr dmatcher); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWImgDescriptorExtractor_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWImgDescriptorExtractor_setVocabulary(IntPtr obj, IntPtr vocabulary); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BOWImgDescriptorExtractor_getVocabulary(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWImgDescriptorExtractor_compute11( - IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr imgDescriptor, - IntPtr pointIdxsOfClusters, IntPtr descriptors); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWImgDescriptorExtractor_compute12( - IntPtr obj, IntPtr keypointDescriptors, - IntPtr imgDescriptor, IntPtr pointIdxsOfClusters); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BOWImgDescriptorExtractor_compute2( - IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr imgDescriptor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_BOWImgDescriptorExtractor_descriptorSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_BOWImgDescriptorExtractor_descriptorType(IntPtr obj); - } -} diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_BRISK.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_BRISK.cs deleted file mode 100644 index 6fce0c0aa..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_BRISK.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - // BRISK - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BRISK_create1(int thresh, int octaves, float patternScale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BRISK_create2( - float[] radiusList, int radiusListLength, int[] numberList, int numberListLength, - float dMax, float dMin, - int[] indexChange, int indexChangeLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_BRISK_delete(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_BRISK_get(IntPtr ptr); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_DescriptorExtractor.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_DescriptorExtractor.cs deleted file mode 100644 index aac117799..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_DescriptorExtractor.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // DescriptorExtractor - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorExtractor_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorExtractor_compute1( - IntPtr obj, IntPtr image, IntPtr keypoint, IntPtr descriptors); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorExtractor_compute2( - IntPtr obj, IntPtr[] images, int imagesSize, IntPtr keypoints, - IntPtr[] descriptors, int descriptorsSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_DescriptorExtractor_descriptorSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_DescriptorExtractor_descriptorType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_DescriptorExtractor_empty(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_DescriptorExtractor_create( - [MarshalAs(UnmanagedType.LPStr)] string descriptorExtractorType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_DescriptorExtractor_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_DescriptorExtractor_delete(IntPtr ptr); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_DescriptorMatcher.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_DescriptorMatcher.cs deleted file mode 100644 index 5d11479e3..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_DescriptorMatcher.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // DescriptorMatcher - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_add(IntPtr obj, IntPtr[] descriptors, - int descriptorLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_getTrainDescriptors(IntPtr obj, - IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_clear(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_DescriptorMatcher_empty(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_DescriptorMatcher_isMaskSupported(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_train(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_match1(IntPtr obj, - IntPtr queryDescriptors, IntPtr trainDescriptors, IntPtr matches, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_knnMatch1(IntPtr obj, - IntPtr queryDescriptors, IntPtr trainDescriptors, IntPtr matches, int k, - IntPtr mask, int compactResult); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_radiusMatch1(IntPtr obj, - IntPtr queryDescriptors,IntPtr trainDescriptors, IntPtr matches, float maxDistance, - IntPtr mask, int compactResult); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_match2( - IntPtr obj, IntPtr queryDescriptors, IntPtr matches, - IntPtr[] masks, int masksSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_knnMatch2( - IntPtr obj, IntPtr queryDescriptors, IntPtr matches, - int k, IntPtr[] masks, int masksSize, int compactResult); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_DescriptorMatcher_radiusMatch2( - IntPtr obj, IntPtr queryDescriptors, IntPtr matches, - float maxDistance, IntPtr[] masks, int masksSize, int compactResult); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern IntPtr features2d_DescriptorMatcher_create([MarshalAs(UnmanagedType.LPStr)] string descriptorMatcherType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_DescriptorMatcher_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_DescriptorMatcher_delete(IntPtr ptr); - - // BFMatcher - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_BFMatcher_new(int normType, int crossCheck); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_BFMatcher_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_BFMatcher_isMaskSupported(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_BFMatcher_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_BFMatcher_delete(IntPtr ptr); - - // FlannBasedMatcher - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_FlannBasedMatcher_new( - IntPtr indexParams, IntPtr searchParams); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FlannBasedMatcher_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FlannBasedMatcher_add( - IntPtr obj, IntPtr[] descriptors, int descriptorsSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FlannBasedMatcher_clear(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FlannBasedMatcher_train(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_FlannBasedMatcher_isMaskSupported(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_FlannBasedMatcher_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_FlannBasedMatcher_delete(IntPtr ptr); - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_FastFeatureDetector.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_FastFeatureDetector.cs deleted file mode 100644 index 946e7392b..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_FastFeatureDetector.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FAST1(IntPtr image, IntPtr keypoints, int threshold, int nonmaxSupression); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FAST2(IntPtr image, IntPtr keypoints, int threshold, int nonmaxSupression, int type); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_FastFeatureDetector_create(int threshold, int nonmaxSuppression); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_FastFeatureDetector_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_FastFeatureDetector_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FastFeatureDetector_setThreshold(IntPtr obj, int threshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_FastFeatureDetector_getThreshold(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FastFeatureDetector_setNonmaxSuppression(IntPtr obj, int f); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_FastFeatureDetector_getNonmaxSuppression(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_FastFeatureDetector_setType(IntPtr obj, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_FastFeatureDetector_getType(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_Feature2D.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_Feature2D.cs deleted file mode 100644 index 6fd278992..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_Feature2D.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_Feature2D_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_Feature2D_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Feature2D_detect_Mat1(IntPtr detector, IntPtr image, IntPtr keypoints, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Feature2D_detect_Mat2(IntPtr detector, IntPtr[] images, int imageLength, IntPtr keypoints, IntPtr[] mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Feature2D_detect_InputArray(IntPtr detector, IntPtr image, IntPtr keypoints, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Feature2D_compute1(IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr descriptors); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Feature2D_compute2( - IntPtr detector, IntPtr[] images, int imageLength, - IntPtr keypoints, IntPtr[] descriptors, int descriptorsLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Feature2D_detectAndCompute( - IntPtr detector, IntPtr image, IntPtr mask, - IntPtr keypoints, IntPtr descriptors, int useProvidedKeypoints); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_Feature2D_descriptorSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_Feature2D_descriptorType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_Feature2D_defaultNorm(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_Feature2D_empty(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_GFTTDetector.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_GFTTDetector.cs deleted file mode 100644 index c73e8a672..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_GFTTDetector.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_GFTTDetector_create(int maxCorners, double qualityLevel, - double minDistance, int blockSize, int useHarrisDetector, double k); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_GFTTDetector_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_GFTTDetector_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_setMaxFeatures(IntPtr obj, int maxFeatures); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_GFTTDetector_getMaxFeatures(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_setQualityLevel(IntPtr obj, double qlevel); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double features2d_GFTTDetector_getQualityLevel(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_setMinDistance(IntPtr obj, double minDistance); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double features2d_GFTTDetector_getMinDistance(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_setBlockSize(IntPtr obj, int blockSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_GFTTDetector_getBlockSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_setHarrisDetector(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_GFTTDetector_getHarrisDetector(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_GFTTDetector_setK(IntPtr obj, double k); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double features2d_GFTTDetector_getK(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_KAZE.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_KAZE.cs deleted file mode 100644 index f32a3fc9b..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_KAZE.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_KAZE_create(bool extended, bool upright, float threshold, - int nOctaves, int nOctaveLayers, int diffusivity); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_KAZE_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_KAZE_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KAZE_setDiffusivity(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_KAZE_getDiffusivity(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KAZE_setExtended(IntPtr obj, bool val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern bool features2d_KAZE_getExtended(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KAZE_setNOctaveLayers(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_KAZE_getNOctaveLayers(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KAZE_setNOctaves(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_KAZE_getNOctaves(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KAZE_setThreshold(IntPtr obj, double val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double features2d_KAZE_getThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KAZE_setUpright(IntPtr obj, bool val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern bool features2d_KAZE_getUpright(IntPtr obj); - } -} diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_KeyPointsFilter.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_KeyPointsFilter.cs deleted file mode 100644 index b5730bc71..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_KeyPointsFilter.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KeyPointsFilter_runByImageBorder( - IntPtr keypoints, Size imageSize, int borderSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KeyPointsFilter_runByKeypointSize( - IntPtr keypoints, float minSize, float maxSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KeyPointsFilter_runByPixelsMask( - IntPtr keypoints, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KeyPointsFilter_removeDuplicated( - IntPtr keypoints); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_KeyPointsFilter_retainBest( - IntPtr keypoints, int npoints); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_MSER.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_MSER.cs deleted file mode 100644 index 849abe106..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_MSER.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_MSER_create(int delta, int minArea, int maxArea, - double maxVariation, double minDiversity, int maxEvolution, - double areaThreshold, double minMargin, int edgeBlurSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_MSER_delete(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_MSER_detect(IntPtr obj, IntPtr image, out IntPtr msers, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_MSER_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_MSER_detectRegions( - IntPtr obj, IntPtr image, - IntPtr msers, - IntPtr bboxes); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_MSER_setDelta(IntPtr obj, int delta); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_MSER_getDelta(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_MSER_setMinArea(IntPtr obj, int minArea); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_MSER_getMinArea(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_MSER_setMaxArea(IntPtr obj, int maxArea); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_MSER_getMaxArea(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_MSER_setPass2Only(IntPtr obj, int f); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_MSER_getPass2Only(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_ORB.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_ORB.cs deleted file mode 100644 index 249be698d..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_ORB.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_ORB_create(int nFeatures, float scaleFactor, int nlevels, - int edgeThreshold, - int firstLevel, int wtaK, int scoreType, int patchSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_ORB_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_ORB_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setMaxFeatures(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getMaxFeatures(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setScaleFactor(IntPtr obj, double val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double features2d_ORB_getScaleFactor(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setNLevels(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getNLevels(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setEdgeThreshold(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getEdgeThreshold(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setFirstLevel(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getFirstLevel(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setWTA_K(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getWTA_K(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setScoreType(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getScoreType(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setPatchSize(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getPatchSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_ORB_setFastThreshold(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int features2d_ORB_getFastThreshold(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_SimpleBlobDetector.cs b/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_SimpleBlobDetector.cs deleted file mode 100644 index b12b1752b..000000000 --- a/src/OpenCvSharp/PInvoke/features2d/NativeMethods_features2d_SimpleBlobDetector.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ReSharper disable InconsistentNaming - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_SimpleBlobDetector_create( - ref SimpleBlobDetector.WParams parameters); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr features2d_Ptr_SimpleBlobDetector_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void features2d_Ptr_SimpleBlobDetector_delete(IntPtr ptr); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc.cs b/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc.cs deleted file mode 100644 index 123d57b15..000000000 --- a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc.cs +++ /dev/null @@ -1,459 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getGaussianKernel( - int ksize, double sigma, int ktype); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_getDerivKernels( - IntPtr kx, IntPtr ky,int dx, int dy, int ksize, int normalize, int ktype); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi, int ktype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getStructuringElement(int shape, Size ksize, Point anchor); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_copyMakeBorder(IntPtr src, IntPtr dst, int top, int bottom, int left, - int right, int borderType, Scalar value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_medianBlur(IntPtr src, IntPtr dst, int ksize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GaussianBlur(IntPtr src, IntPtr dst, Size ksize, double sigmaX, - double sigmaY, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_bilateralFilter(IntPtr src, IntPtr dst, int d, double sigmaColor, - double sigmaSpace, int borderType); - - /* - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_adaptiveBilateralFilter(IntPtr src, IntPtr dst, Size ksize, - double sigmaSpace, double maxSigmaColor, CvPoint anchor, int borderType); - */ - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_boxFilter(IntPtr src, IntPtr dst, int ddepth, Size ksize, Point anchor, - int normalize, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_blur(IntPtr src, IntPtr dst, Size ksize, Point anchor, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_filter2D(IntPtr src, IntPtr dst, int ddepth, IntPtr kernel, Point anchor, double delta, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_sepFilter2D(IntPtr src, IntPtr dst, int ddepth, IntPtr kernelX, IntPtr kernelY, Point anchor, double delta, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Sobel(IntPtr src, IntPtr dst, int ddepth, - int dx, int dy, int ksize, double scale, double delta, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Scharr(IntPtr src, IntPtr dst, int ddepth, - int dx, int dy, double scale, double delta, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Laplacian(IntPtr src, IntPtr dst, int ddepth, - int ksize, double scale, double delta, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Canny(IntPtr src, IntPtr edges, - double threshold1, double threshold2, int apertureSize, int L2gradient); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_cornerEigenValsAndVecs(IntPtr src, IntPtr dst,int blockSize, int ksize, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_preCornerDetect(IntPtr src, IntPtr dst, int ksize, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_cornerSubPix(IntPtr image, IntPtr corners, - Size winSize, Size zeroZone, TermCriteria criteria); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_goodFeaturesToTrack(IntPtr src, IntPtr corners, - int maxCorners, double qualityLevel, double minDistance, IntPtr mask, int blockSize, int useHarrisDetector, double k); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_HoughLines(IntPtr src, IntPtr lines, - double rho, double theta, int threshold, double srn, double stn); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_HoughLinesP(IntPtr src, IntPtr lines, - double rho, double theta, int threshold, double minLineLength, double maxLineG); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_HoughCircles(IntPtr src, IntPtr circles, - int method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_erode(IntPtr src, IntPtr dst, IntPtr kernel, Point anchor, int iterations, int borderType, Scalar borderValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_dilate(IntPtr src, IntPtr dst, IntPtr kernel, Point anchor, int iterations, int borderType, Scalar borderValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_morphologyEx(IntPtr src, IntPtr dst, int op, IntPtr kernel, Point anchor, int iterations, int borderType, Scalar borderValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_resize(IntPtr src, IntPtr dst, Size dsize, double fx, double fy, int interpolation); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_warpAffine(IntPtr src, IntPtr dst, IntPtr m, Size dsize, int flags, int borderMode, Scalar borderValue); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_warpPerspective_MisInputArray( - IntPtr src, IntPtr dst, IntPtr m, Size dsize, int flags, int borderMode, Scalar borderValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_warpPerspective_MisArray( - IntPtr src, IntPtr dst, [MarshalAs(UnmanagedType.LPArray)] float[,] m, int mRow, int mCol, - Size dsize, int flags, int borderMode, Scalar borderValue); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_remap(IntPtr src, IntPtr dst, IntPtr map1, IntPtr map2, int interpolation, int borderMode, Scalar borderValue); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convertMaps(IntPtr map1, IntPtr map2, IntPtr dstmap1, IntPtr dstmap2, int dstmap1Type, int nninterpolation); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getRotationMatrix2D(Point2f center, double angle, double scale); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_invertAffineTransform(IntPtr m, IntPtr im); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getPerspectiveTransform1(Point2f[] src, Point2f[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getPerspectiveTransform2(IntPtr src, IntPtr dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getAffineTransform1(Point2f[] src, Point2f[] dst); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getAffineTransform2(IntPtr src, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_getRectSubPix(IntPtr image, Size patchSize, Point2f center, IntPtr patch, int patchType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_logPolar( - IntPtr src, IntPtr dst, Point2f center, double m, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_linearPolar( - IntPtr src, IntPtr dst, Point2f center, double maxRadius, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_integral1(IntPtr src, IntPtr sum, int sdepth); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_integral2(IntPtr src, IntPtr sum, IntPtr sqsum, int sdepth); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_integral3(IntPtr src, IntPtr sum, IntPtr sqsum, IntPtr tilted, int sdepth); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_accumulate(IntPtr src, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_accumulateSquare(IntPtr src, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_accumulateProduct(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_accumulateWeighted(IntPtr src, IntPtr dst, double alpha, IntPtr mask); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_PSNR(IntPtr src1, IntPtr src2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Point2d imgproc_phaseCorrelate(IntPtr src1, IntPtr src2, IntPtr window); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Point2d imgproc_phaseCorrelateRes(IntPtr src1, IntPtr src2, IntPtr window, out double response); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_createHanningWindow(IntPtr dst, Size winSize, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_threshold(IntPtr src, IntPtr dst, double thresh, double maxval, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_adaptiveThreshold(IntPtr src, IntPtr dst, - double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double c); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_pyrDown(IntPtr src, IntPtr dst, Size dstsize, int borderType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_pyrUp(IntPtr src, IntPtr dst, Size dstsize, int borderType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_undistort(IntPtr src, IntPtr dst, - IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr newCameraMatrix); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_initUndistortRectifyMap(IntPtr cameraMatrix,IntPtr distCoeffs, - IntPtr r, IntPtr newCameraMatrix, Size size, int m1Type, IntPtr map1, IntPtr map2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float imgproc_initWideAngleProjMap(IntPtr cameraMatrix, IntPtr distCoeffs, - Size imageSize, int destImageWidth, int m1Type, IntPtr map1, IntPtr map2, - int projType, double alpha); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_getDefaultNewCameraMatrix(IntPtr cameraMatrix, Size imgSize, - int centerPrincipalPoint); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_undistortPoints(IntPtr src, IntPtr dst, - IntPtr cameraMatrix, IntPtr distCoeffs, IntPtr r, IntPtr p); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_calcHist1(IntPtr[] images, int nimages, - int[] channels, IntPtr mask, IntPtr hist, int dims, int[] histSize, - IntPtr[] ranges, int uniform, int accumulate); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_calcBackProject(IntPtr[] images, int nimages, - int[] channels, IntPtr hist, IntPtr backProject, - IntPtr[] ranges, int uniform); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_compareHist1(IntPtr h1, IntPtr h2, int method); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_equalizeHist(IntPtr src, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float imgproc_EMD(IntPtr signature1, IntPtr signature2, - int distType, IntPtr cost, out float lowerBound, IntPtr flow); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_watershed(IntPtr image, IntPtr markers); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_pyrMeanShiftFiltering(IntPtr src, IntPtr dst, - double sp, double sr, int maxLevel, TermCriteria termcrit); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_grabCut(IntPtr img, IntPtr mask, Rect rect, - IntPtr bgdModel, IntPtr fgdModel, - int iterCount, int mode); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_distanceTransformWithLabels(IntPtr src, IntPtr dst, IntPtr labels, - int distanceType, int maskSize, int labelType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_distanceTransform(IntPtr src, IntPtr dst, - int distanceType, int maskSize); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_floodFill1(IntPtr image, - Point seedPoint, Scalar newVal, out Rect rect, - Scalar loDiff, Scalar upDiff, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_floodFill2(IntPtr image, IntPtr mask, - Point seedPoint, Scalar newVal, out Rect rect, - Scalar loDiff, Scalar upDiff, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_cvtColor(IntPtr src, IntPtr dst, int code, int dstCn); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Moments.NativeStruct imgproc_moments(IntPtr arr, int binaryImage); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_matchTemplate( - IntPtr image, IntPtr templ, IntPtr result, int method, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_connectedComponents( - IntPtr image, IntPtr labels, int connectivity, int ltype); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_connectedComponentsWithStats( - IntPtr image, IntPtr labels, IntPtr stats, IntPtr centroids, int connectivity, int ltype); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_findContours1_vector(IntPtr image, out IntPtr contours, - out IntPtr hierarchy, int mode, int method, Point offset); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_findContours1_OutputArray(IntPtr image, out IntPtr contours, - IntPtr hierarchy, int mode, int method, Point offset); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_findContours2_vector(IntPtr image, out IntPtr contours, - int mode, int method, Point offset); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_findContours2_OutputArray(IntPtr image, out IntPtr contours, - int mode, int method, Point offset); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_drawContours_vector(IntPtr image, - IntPtr[] contours, int contoursSize1, int[] contoursSize2, - int contourIdx, Scalar color, int thickness, int lineType, - Vec4i[] hierarchy, int hiearchyLength, int maxLevel, Point offset); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_drawContours_vector(IntPtr image, - IntPtr[] contours, int contoursSize1, int[] contoursSize2, - int contourIdx, Scalar color, int thickness, int lineType, - IntPtr hierarchy, int hiearchyLength, int maxLevel, Point offset); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_drawContours_InputArray(IntPtr image, - IntPtr[] contours, int contoursLength, - int contourIdx, Scalar color, int thickness, int lineType, - IntPtr hierarchy, int maxLevel, Point offset); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_approxPolyDP_InputArray(IntPtr curve, IntPtr approxCurve, - double epsilon, int closed); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_approxPolyDP_Point(Point[] curve, int curveLength, - out IntPtr approxCurve, double epsilon, int closed); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_approxPolyDP_Point2f(Point2f[] curve, int curveLength, - out IntPtr approxCurve, double epsilon, int closed); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_arcLength_InputArray(IntPtr curve, int closed); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_arcLength_Point(Point[] curve, int curveLength, int closed); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_arcLength_Point2f(Point2f[] curve, int curveLength, int closed); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Rect imgproc_boundingRect_InputArray(IntPtr curve); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Rect imgproc_boundingRect_Point(Point[] curve, int curveLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Rect imgproc_boundingRect_Point2f(Point2f[] curve, int curveLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_contourArea_InputArray(IntPtr contour, int oriented); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_contourArea_Point(Point[] contour, int contourLength, int oriented); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_contourArea_Point2f(Point2f[] contour, int contourLength, int oriented); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect imgproc_minAreaRect_InputArray(IntPtr points); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect imgproc_minAreaRect_Point(Point[] points, int pointsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect imgproc_minAreaRect_Point2f(Point2f[] points, int pointsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_minEnclosingCircle_InputArray(IntPtr points, out Point2f center, out float radius); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_minEnclosingCircle_Point(Point[] points, int pointsLength, - out Point2f center, out float radius); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_minEnclosingCircle_Point2f(Point2f[] points, int pointsLength, - out Point2f center, out float radius); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_matchShapes_InputArray(IntPtr contour1, IntPtr contour2, - int method, double parameter); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_matchShapes_Point(Point[] contour1, int contour1Length, - Point[] contour2, int contour2Length, int method, double parameter); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexHull_InputArray(IntPtr points, IntPtr hull, - int clockwise, int returnPoints); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexHull_Point_ReturnsPoints(Point[] points, int pointsLength, - out IntPtr hull, int clockwise); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexHull_Point2f_ReturnsPoints(Point2f[] points, int pointsLength, - out IntPtr hull, int clockwise); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexHull_Point_ReturnsIndices(Point[] points, int pointsLength, - out IntPtr hull, int clockwise); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexHull_Point2f_ReturnsIndices(Point2f[] points, int pointsLength, - out IntPtr hull, int clockwise); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexityDefects_InputArray(IntPtr contour, IntPtr convexHull, - IntPtr convexityDefects); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexityDefects_Point(Point[] contour, int contourLength, int[] convexHull, - int convexHullLength, out IntPtr convexityDefects); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_convexityDefects_Point2f(Point2f[] contour, int contourLength, - int[] convexHull, int convexHullLength, out IntPtr convexityDefects); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_isContourConvex_InputArray(IntPtr contour); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_isContourConvex_Point(Point[] contour, int contourLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_isContourConvex_Point2f(Point2f[] contour, int contourLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float imgproc_intersectConvexConvex_InputArray(IntPtr p1, IntPtr p2, - IntPtr p12, int handleNested); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float imgproc_intersectConvexConvex_Point(Point[] p1, int p1Length, Point[] p2, - int p2Length,out IntPtr p12, int handleNested); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float imgproc_intersectConvexConvex_Point2f(Point2f[] p1, int p1Length, Point2f[] p2, - int p2Length,out IntPtr p12, int handleNested); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect imgproc_fitEllipse_InputArray(IntPtr points); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect imgproc_fitEllipse_Point(Point[] points, int pointsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect imgproc_fitEllipse_Point2f(Point2f[] points, int pointsLength); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fitLine_InputArray(IntPtr points, IntPtr line, - int distType, double param, double reps, double aeps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fitLine_Point(Point[] points, int pointsLength, [In, Out] float[] line, int distType, - double param, double reps, double aeps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fitLine_Point2f(Point2f[] points, int pointsLength, [In, Out] float[] line, - int distType,double param, double reps, double aeps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fitLine_Point3i(Point3i[] points, int pointsLength, [In, Out] float[] line, - int distType,double param, double reps, double aeps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fitLine_Point3f(Point3f[] points, int pointsLength, [In, Out] float[] line, - int distType,double param, double reps, double aeps); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_pointPolygonTest_InputArray(IntPtr contour, Point2f pt, int measureDist); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_pointPolygonTest_Point(Point[] contour, int contourLength, Point2f pt, - int measureDist); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_pointPolygonTest_Point2f(Point2f[] contour, int contourLength, - Point2f pt, int measureDist); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_rotatedRectangleIntersection_OutputArray( - RotatedRect rect1, RotatedRect rect2, IntPtr intersectingRegion); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_rotatedRectangleIntersection_vector( - RotatedRect rect1, RotatedRect rect2, IntPtr intersectingRegion); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_applyColorMap(IntPtr src, IntPtr dst, int colormap); - - - #region Drawing - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_line( - IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_arrowedLine( - IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift, double tipLength); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_rectangle_InputOutputArray( - IntPtr img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_rectangle_Mat( - IntPtr img, Rect rect, Scalar color, int thickness, int lineType, int shift); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_circle(IntPtr img, Point center, int radius, Scalar color, int thickness, int lineType, int shift); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_ellipse1(IntPtr img, Point center, Size axes, - double angle, double startAngle, double endAngle, Scalar color, int thickness, int lineType, int shift); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_ellipse2(IntPtr img, RotatedRect box, Scalar color, int thickness, int lineType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fillConvexPoly_Mat( - IntPtr img, Point[] pts, int npts, Scalar color, int lineType, int shift); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fillConvexPoly_InputOutputArray( - IntPtr img, IntPtr points, Scalar color, int lineType, int shift); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fillPoly_Mat( - IntPtr img, IntPtr[] pts, int[] npts, int ncontours, - Scalar color, int lineType, int shift, Point offset); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_fillPoly_InputOutputArray( - IntPtr img, IntPtr pts, Scalar color, int lineType, int shift, Point offset); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_polylines_Mat( - IntPtr img, IntPtr[] pts, int[] npts, - int ncontours, int isClosed, Scalar color, int thickness, int lineType, int shift); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_polylines_InputOutputArray( - IntPtr img, IntPtr pts, int isClosed, Scalar color, int thickness, int lineType, int shift); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_clipLine1(Size imgSize, ref Point pt1, ref Point pt2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_clipLine2(Rect imgRect, ref Point pt1, ref Point pt2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_ellipse2Poly( - Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, IntPtr pts); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern void core_putText(IntPtr img, [MarshalAs(UnmanagedType.LPStr)] string text, Point org, - int fontFace, double fontScale, Scalar color, - int thickness, int lineType, int bottomLeftOrigin); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true, ExactSpelling = true)] - public static extern Size core_getTextSize([MarshalAs(UnmanagedType.LPStr)] string text, int fontFace, - double fontScale, int thickness, out int baseLine); - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_CLAHE.cs b/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_CLAHE.cs deleted file mode 100644 index 835270b81..000000000 --- a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_CLAHE.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_createCLAHE(double clipLimit, Size tileGridSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Ptr_CLAHE_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_Ptr_CLAHE_get(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_CLAHE_apply(IntPtr obj, IntPtr src, IntPtr dst); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_CLAHE_setClipLimit(IntPtr obj, double clipLimit); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_CLAHE_getClipLimit(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_CLAHE_setTilesGridSize(IntPtr obj, Size tileGridSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Size imgproc_CLAHE_getTilesGridSize(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_CLAHE_collectGarbage(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_GeneralizedHough.cs b/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_GeneralizedHough.cs deleted file mode 100644 index 3b9dab320..000000000 --- a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_GeneralizedHough.cs +++ /dev/null @@ -1,185 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // GeneralizedHough - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setTemplate1( - IntPtr obj, IntPtr templ, Point templCenter); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setTemplate2( - IntPtr obj, IntPtr edges, IntPtr dx, IntPtr dy, Point templCenter); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_detect1( - IntPtr obj, IntPtr image, IntPtr positions, IntPtr votes); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_detect2( - IntPtr obj, IntPtr edges, IntPtr dx, IntPtr dy, IntPtr positions, IntPtr votes); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setCannyLowThresh(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHough_getCannyLowThresh(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setCannyHighThresh(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHough_getCannyHighThresh(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setMinDist(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHough_getMinDist(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setDp(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHough_getDp(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHough_setMaxBufferSize(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHough_getMaxBufferSize(IntPtr obj); - - - - // GeneralizedHoughBallard - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_createGeneralizedHoughBallard(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_Ptr_GeneralizedHoughBallard_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Ptr_GeneralizedHoughBallard_delete(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughBallard_setLevels(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHoughBallard_getLevels(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughBallard_setVotesThreshold(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHoughBallard_getVotesThreshold(IntPtr obj); - - - - // GeneralizedHoughGuil - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_createGeneralizedHoughGuil(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_Ptr_GeneralizedHoughGuil_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Ptr_GeneralizedHoughGuil_delete(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setXi(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getXi(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setLevels(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHoughGuil_getLevels(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setAngleEpsilon(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getAngleEpsilon(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setMinAngle(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getMinAngle(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setMaxAngle(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getMaxAngle(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setAngleStep(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getAngleStep(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setAngleThresh(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHoughGuil_getAngleThresh(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setMinScale(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getMinScale(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setMaxScale(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getMaxScale(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setScaleStep(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double imgproc_GeneralizedHoughGuil_getScaleStep(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setScaleThresh(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHoughGuil_getScaleThresh(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_GeneralizedHoughGuil_setPosThresh(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_GeneralizedHoughGuil_getPosThresh(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_LineIterator.cs b/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_LineIterator.cs deleted file mode 100644 index 541a1f251..000000000 --- a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_LineIterator.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_LineIterator_new( - IntPtr img, Point pt1, Point pt2, int connectivity, int leftToRight); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_LineIterator_operatorEntity(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_operatorPP(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Point imgproc_LineIterator_pos(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_LineIterator_ptr_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_ptr_set(IntPtr obj, IntPtr val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_LineIterator_ptr0_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_step_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_step_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_elemSize_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_elemSize_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_err_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_err_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_count_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_count_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_minusDelta_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_minusDelta_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_plusDelta_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_plusDelta_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_minusStep_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_minusStep_set(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineIterator_plusStep_get(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineIterator_plusStep_set(IntPtr obj, int val); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_LineSegmentDetector.cs b/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_LineSegmentDetector.cs deleted file mode 100644 index f063b6936..000000000 --- a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_LineSegmentDetector.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineSegmentDetector_detect_OutputArray(IntPtr obj, IntPtr image, IntPtr lines, - IntPtr width, IntPtr prec, IntPtr nfa); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineSegmentDetector_detect_vector(IntPtr obj, IntPtr image, IntPtr lines, - IntPtr width, IntPtr prec, IntPtr nfa); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_LineSegmentDetector_drawSegments(IntPtr obj, IntPtr image, IntPtr lines); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_LineSegmentDetector_compareSegments(IntPtr obj, Size size, - IntPtr lines1, IntPtr lines2, IntPtr image); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_createLineSegmentDetector( - int refine, double scale, double sigma_scale, double quant, double ang_th, - double log_eps, double density_th, int n_bins); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Ptr_LineSegmentDetector_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_Ptr_LineSegmentDetector_get(IntPtr obj); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_Subdiv2D.cs b/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_Subdiv2D.cs deleted file mode 100644 index 97b9a9b8d..000000000 --- a/src/OpenCvSharp/PInvoke/imgproc/NativeMethods_imgproc_Subdiv2D.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_Subdiv2D_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr imgproc_Subdiv2D_new2(Rect rect); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_initDelaunay(IntPtr obj, Rect rect); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_insert1(IntPtr obj, Point2f pt); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_insert2(IntPtr obj, [MarshalAs(UnmanagedType.LPArray)] Point2f[] ptArray, int length); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_locate(IntPtr obj, Point2f pt, out int edge, out int vertex); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_findNearest(IntPtr obj, Point2f pt, out Point2f nearestPt); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_getEdgeList(IntPtr obj, out IntPtr edgeList); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_getTriangleList(IntPtr obj, out IntPtr triangleList); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_getVoronoiFacetList(IntPtr obj, [MarshalAs(UnmanagedType.LPArray)] int[] idx, int idxCount, - out IntPtr facetList, out IntPtr facetCenters); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void imgproc_Subdiv2D_getVoronoiFacetList(IntPtr obj, IntPtr idx, int idxCount, - out IntPtr facetList, out IntPtr facetCenters); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Point2f imgproc_Subdiv2D_getVertex(IntPtr obj, int vertex, out int firstEdge); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_getEdge(IntPtr obj, int edge, int nextEdgeType); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_nextEdge(IntPtr obj, int edge); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_rotateEdge(IntPtr obj, int edge, int rotate); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_symEdge(IntPtr obj, int edge); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_edgeOrg(IntPtr obj, int edge, out Point2f orgpt); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int imgproc_Subdiv2D_edgeDst(IntPtr obj, int edge, out Point2f dstpt); - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml.cs deleted file mode 100644 index 8176f7fbf..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_ANN_MLP.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_ANN_MLP.cs deleted file mode 100644 index 1ed74523e..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_ANN_MLP.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setTrainMethod(IntPtr obj, int method, double param1, double param2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_ANN_MLP_getTrainMethod(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setActivationFunction(IntPtr obj, int type, double param1, double param2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setLayerSizes(IntPtr obj, IntPtr layerSizes); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_ANN_MLP_getLayerSizes(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern TermCriteria ml_ANN_MLP_getTermCriteria(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setTermCriteria(IntPtr obj, TermCriteria val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getBackpropWeightScale(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setBackpropWeightScale(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getBackpropMomentumScale(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setBackpropMomentumScale(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getRpropDW0(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setRpropDW0(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getRpropDWPlus(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setRpropDWPlus(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getRpropDWMinus(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setRpropDWMinus(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getRpropDWMin(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setRpropDWMin(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_ANN_MLP_getRpropDWMax(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_ANN_MLP_setRpropDWMax(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_ANN_MLP_getWeights(IntPtr obj, int layerIdx); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_ANN_MLP_create(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_ANN_MLP_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_ANN_MLP_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_ANN_MLP_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_ANN_MLP_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_Boost.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_Boost.cs deleted file mode 100644 index 3d90322c1..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_Boost.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_Boost_getBoostType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Boost_setBoostType(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_Boost_getWeakCount(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Boost_setWeakCount(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_Boost_getWeightTrimRate(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Boost_setWeightTrimRate(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Boost_create(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_Boost_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_Boost_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Boost_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Boost_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_DTrees.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_DTrees.cs deleted file mode 100644 index ac1c6a3f0..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_DTrees.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getMaxCategories(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setMaxCategories(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getMaxDepth(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setMaxDepth(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getMinSampleCount(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setMinSampleCount(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getCVFolds(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setCVFolds(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getUseSurrogates(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setUseSurrogates(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getUse1SERule(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setUse1SERule(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_DTrees_getTruncatePrunedTree(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setTruncatePrunedTree(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float ml_DTrees_getRegressionAccuracy(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setRegressionAccuracy(IntPtr obj, float val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_DTrees_getPriors(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_setPriors(IntPtr obj, IntPtr val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_getRoots(IntPtr obj, IntPtr result); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_getNodes(IntPtr obj, IntPtr result); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_getSplits(IntPtr obj, IntPtr result); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_DTrees_getSubsets(IntPtr obj, IntPtr result); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_DTrees_create(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_DTrees_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_DTrees_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_DTrees_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_DTrees_loadFromString(string strModel); - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_EM.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_EM.cs deleted file mode 100644 index 475af9db4..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_EM.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_EM_getClustersNumber(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_EM_setClustersNumber(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_EM_getCovarianceMatrixType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_EM_setCovarianceMatrixType(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern TermCriteria ml_EM_getTermCriteria(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_EM_setTermCriteria(IntPtr obj, TermCriteria val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_EM_getWeights(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_EM_getMeans(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_EM_getCovs(IntPtr obj, IntPtr covs); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Vec2d ml_EM_predict2(IntPtr model, IntPtr sample, IntPtr probs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_EM_trainEM( - IntPtr obj, IntPtr samples, IntPtr logLikelihoods, IntPtr labels, IntPtr probs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_EM_trainE( - IntPtr model, IntPtr samples, IntPtr means0, IntPtr covs0, IntPtr weights0, - IntPtr logLikelihoods, IntPtr labels, IntPtr probs); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_EM_trainM( - IntPtr model, IntPtr samples, IntPtr probs0, IntPtr logLikelihoods, - IntPtr labels, IntPtr probs); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_EM_create(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_EM_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_EM_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_EM_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_EM_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_KNearest.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_KNearest.cs deleted file mode 100644 index 52a84c212..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_KNearest.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_KNearest_getDefaultK(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_KNearest_setDefaultK(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_KNearest_getIsClassifier(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_KNearest_setIsClassifier(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_KNearest_getEmax(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_KNearest_setEmax(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_KNearest_getAlgorithmType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_KNearest_setAlgorithmType(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float ml_KNearest_findNearest(IntPtr obj, IntPtr samples, int k, - IntPtr results, IntPtr neighborResponses, IntPtr dist); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_KNearest_create(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_KNearest_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_KNearest_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_KNearest_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_KNearest_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_LogisticRegression.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_LogisticRegression.cs deleted file mode 100644 index f7031f3df..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_LogisticRegression.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_LogisticRegression_getLearningRate(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_LogisticRegression_setLearningRate(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_LogisticRegression_getIterations(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_LogisticRegression_setIterations(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_LogisticRegression_getRegularization(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_LogisticRegression_setRegularization(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_LogisticRegression_getTrainMethod(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_LogisticRegression_setTrainMethod(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_LogisticRegression_getMiniBatchSize(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_LogisticRegression_setMiniBatchSize(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern TermCriteria ml_LogisticRegression_getTermCriteria(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_LogisticRegression_setTermCriteria(IntPtr obj, TermCriteria val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float ml_LogisticRegression_predict( - IntPtr obj, IntPtr samples, IntPtr results, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_LogisticRegression_get_learnt_thetas(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_LogisticRegression_create(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_LogisticRegression_delete(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_LogisticRegression_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_LogisticRegression_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_LogisticRegression_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_NormalBayesClassifier.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_NormalBayesClassifier.cs deleted file mode 100644 index 528191a7b..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_NormalBayesClassifier.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float ml_NormalBayesClassifier_predictProb( - IntPtr obj, IntPtr inputs, - IntPtr samples, IntPtr outputProbs, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_NormalBayesClassifier_create(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_NormalBayesClassifier_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_NormalBayesClassifier_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_NormalBayesClassifier_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_NormalBayesClassifier_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_RTrees.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_RTrees.cs deleted file mode 100644 index f081c8206..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_RTrees.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_RTrees_getCalculateVarImportance(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_RTrees_setCalculateVarImportance(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_RTrees_getActiveVarCount(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_RTrees_setActiveVarCount(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern TermCriteria ml_RTrees_getTermCriteria(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_RTrees_setTermCriteria(IntPtr obj, TermCriteria val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_RTrees_getVarImportance(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_RTrees_create(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_RTrees_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_RTrees_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_RTrees_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_RTrees_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_SVM.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_SVM.cs deleted file mode 100644 index d276b1ada..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_SVM.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using OpenCvSharp.ML; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_SVM_getType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setType(IntPtr obj, int val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getGamma(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setGamma(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getCoef0(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setCoef0(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getDegree(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setDegree(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getC(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setC(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getP(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setP(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getNu(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setNu(IntPtr obj, double val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_SVM_getClassWeights(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setClassWeights(IntPtr obj, IntPtr val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern TermCriteria ml_SVM_getTermCriteria(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setTermCriteria(IntPtr obj, TermCriteria val); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_SVM_getKernelType(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_SVM_setKernel(IntPtr obj, int kernelType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_SVM_getSupportVectors(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double ml_SVM_getDecisionFunction( - IntPtr obj, int i, IntPtr alpha, IntPtr svidx); - - // static - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ParamGrid ml_SVM_getDefaultGrid(int paramId); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_SVM_create(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_Ptr_SVM_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_Ptr_SVM_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_SVM_load(string filePath); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ml_SVM_loadFromString(string strModel); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_StatModel.cs b/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_StatModel.cs deleted file mode 100644 index a3ee0e604..000000000 --- a/src/OpenCvSharp/PInvoke/ml/NativeMethods_ml_StatModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_StatModel_clear(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_StatModel_getVarCount(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_StatModel_empty(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_StatModel_isTrained(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_StatModel_isClassifier(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_StatModel_train1( - IntPtr obj, IntPtr trainData, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int ml_StatModel_train2( - IntPtr obj, IntPtr samples, int layout, IntPtr responses); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float ml_StatModel_calcError( - IntPtr obj, IntPtr data, int test, IntPtr resp); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float ml_StatModel_predict( - IntPtr obj, IntPtr samples, IntPtr results, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ml_StatModel_save(IntPtr obj, string filename); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/photo/NativeMethods_photo.cs b/src/OpenCvSharp/PInvoke/photo/NativeMethods_photo.cs deleted file mode 100644 index c6e5c4781..000000000 --- a/src/OpenCvSharp/PInvoke/photo/NativeMethods_photo.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_inpaint(IntPtr src, IntPtr inpaintMask, - IntPtr dst, double inpaintRadius, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_fastNlMeansDenoising(IntPtr src, IntPtr dst, float h, - int templateWindowSize, int searchWindowSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_fastNlMeansDenoisingColored(IntPtr src, IntPtr dst, - float h, float hColor, int templateWindowSize, int searchWindowSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_fastNlMeansDenoisingMulti(IntPtr[] srcImgs, int srcImgsLength, - IntPtr dst, int imgToDenoiseIndex, int temporalWindowSize, - float h, int templateWindowSize, int searchWindowSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_fastNlMeansDenoisingColoredMulti(IntPtr[] srcImgs, int srcImgsLength, - IntPtr dst, int imgToDenoiseIndex, int temporalWindowSize, - float h, float hColor, int templateWindowSize, int searchWindowSize); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_denoise_TVL1( - IntPtr[] observations, int observationsSize, IntPtr result, double lambda, int niters); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_decolor( - IntPtr src, IntPtr grayscale, IntPtr color_boost); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_seamlessClone( - IntPtr src, IntPtr dst, IntPtr mask, Point p, IntPtr blend, int flags); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_colorChange( - IntPtr src, IntPtr mask, IntPtr dst, float red_mul, float green_mul, float blue_mul); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_illuminationChange( - IntPtr src, IntPtr mask, IntPtr dst, float alpha, float beta); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_textureFlattening( - IntPtr src, IntPtr mask, IntPtr dst, - float low_threshold, float high_threshold, int kernel_size); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_edgePreservingFilter( - IntPtr src, IntPtr dst, int flags, float sigma_s, float sigma_r); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_detailEnhance( - IntPtr src, IntPtr dst, float sigma_s, float sigma_r); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_pencilSketch( - IntPtr src, IntPtr dst1, IntPtr dst2, - float sigma_s, float sigma_r, float shade_factor); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_stylization( - IntPtr src, IntPtr dst, float sigma_s, float sigma_r); - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/photo/NativeMethods_photo_HDR.cs b/src/OpenCvSharp/PInvoke/photo/NativeMethods_photo_HDR.cs deleted file mode 100644 index cd06ad24c..000000000 --- a/src/OpenCvSharp/PInvoke/photo/NativeMethods_photo_HDR.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr photo_createCalibrateDebevec(int samples, float lambda, int random); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr photo_createCalibrateRobertson(int maxIter, float threshold); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_Ptr_CalibrateDebevec_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_Ptr_CalibrateRobertson_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr photo_Ptr_CalibrateDebevec_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr photo_Ptr_CalibrateRobertson_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void photo_CalibrateCRF_process( - IntPtr obj, IntPtr[] srcImgs, int srcImgsLength, IntPtr dst, [In, MarshalAs(UnmanagedType.LPArray)] float[] times); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/shape/NativeMethods_shape_ShapeDistanceExtractor.cs b/src/OpenCvSharp/PInvoke/shape/NativeMethods_shape_ShapeDistanceExtractor.cs deleted file mode 100644 index ce2184aa0..000000000 --- a/src/OpenCvSharp/PInvoke/shape/NativeMethods_shape_ShapeDistanceExtractor.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - // ShapeDistanceExtractor - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeDistanceExtractor_computeDistance( - IntPtr obj, IntPtr contour1, IntPtr contour2); - - // ShapeContextDistanceExtractor - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_Ptr_ShapeContextDistanceExtractor_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr shape_Ptr_ShapeContextDistanceExtractor_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setAngularBins(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int shape_ShapeContextDistanceExtractor_getAngularBins(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setRadialBins(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int shape_ShapeContextDistanceExtractor_getRadialBins(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setInnerRadius(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeContextDistanceExtractor_getInnerRadius(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setOuterRadius(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeContextDistanceExtractor_getOuterRadius(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setRotationInvariant(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int shape_ShapeContextDistanceExtractor_getRotationInvariant(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setShapeContextWeight(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeContextDistanceExtractor_getShapeContextWeight(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setImageAppearanceWeight(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeContextDistanceExtractor_getImageAppearanceWeight(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setBendingEnergyWeight(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeContextDistanceExtractor_getBendingEnergyWeight(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setImages(IntPtr obj, IntPtr image1, IntPtr image2); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_getImages(IntPtr obj, IntPtr image1, IntPtr image2); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setIterations(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int shape_ShapeContextDistanceExtractor_getIterations(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_ShapeContextDistanceExtractor_setStdDev(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_ShapeContextDistanceExtractor_getStdDev(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr shape_createShapeContextDistanceExtractor( - int nAngularBins, int nRadialBins, - float innerRadius, float outerRadius, int iterations /*, - const Ptr &comparer = createChiHistogramCostExtractor(), - const Ptr &transformer = createThinPlateSplineShapeTransformer()*/); - - - // HausdorffDistanceExtractor - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_Ptr_HausdorffDistanceExtractor_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr shape_Ptr_HausdorffDistanceExtractor_get(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_HausdorffDistanceExtractor_setDistanceFlag(IntPtr obj, int val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int shape_HausdorffDistanceExtractor_getDistanceFlag(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void shape_HausdorffDistanceExtractor_setRankProportion(IntPtr obj, float val); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern float shape_HausdorffDistanceExtractor_getRankProportion(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr shape_createHausdorffDistanceExtractor(int distanceFlag, float rankProp); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/video/NativeMethods_video.cs b/src/OpenCvSharp/PInvoke/video/NativeMethods_video.cs deleted file mode 100644 index 09cd46bef..000000000 --- a/src/OpenCvSharp/PInvoke/video/NativeMethods_video.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern RotatedRect video_CamShift( - IntPtr probImage, ref Rect window, TermCriteria criteria); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_meanShift( - IntPtr probImage, ref Rect window, TermCriteria criteria); - - // Kalman filter - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_new1(); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_new2(int dynamParams, int measureParams, int controlParams, - int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_KalmanFilter_init(IntPtr obj, int dynamParams, int measureParams, - int controlParams, int type); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_KalmanFilter_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_predict(IntPtr obj, IntPtr control); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_correct(IntPtr obj, IntPtr measurement); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_statePre(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_statePost(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_transitionMatrix(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_controlMatrix(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_measurementMatrix(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_processNoiseCov(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_measurementNoiseCov(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_errorCovPre(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_gain(IntPtr obj); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_KalmanFilter_errorCovPost(IntPtr obj); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_buildOpticalFlowPyramid1( - IntPtr img, IntPtr pyramid, - Size winSize, int maxLevel, int withDerivatives, - int pyrBorder, int derivBorder, int tryReuseInputImage); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_buildOpticalFlowPyramid2( - IntPtr img, IntPtr pyramidVec, - Size winSize, int maxLevel, int withDerivatives, - int pyrBorder, int derivBorder, int tryReuseInputImage); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_calcOpticalFlowPyrLK_InputArray( - IntPtr prevImg, IntPtr nextImg, - IntPtr prevPts, IntPtr nextPts, - IntPtr status, IntPtr err, - Size winSize, int maxLevel, TermCriteria criteria, - int flags, double minEigThreshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_calcOpticalFlowPyrLK_vector( - IntPtr prevImg, IntPtr nextImg, - Point2f[] prevPts, int prevPtsSize, - IntPtr nextPts, IntPtr status, IntPtr err, - Size winSize, int maxLevel, TermCriteria criteria, - int flags, double minEigThreshold); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_calcOpticalFlowFarneback( - IntPtr prev, IntPtr next, - IntPtr flow, double pyrScale, int levels, int winSize, - int iterations, int polyN, double polySigma, int flags); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_estimateRigidTransform( - IntPtr src, IntPtr dst, int fullAffine); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_DenseOpticalFlow_calc( - IntPtr obj, IntPtr i0, IntPtr i1, IntPtr flow); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_DenseOpticalFlow_collectGarbage(IntPtr obj); - - // TODO - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_createOptFlow_DualTVL1(); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_Ptr_DenseOpticalFlow_get(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_Ptr_DenseOpticalFlow_delete(IntPtr ptr); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/video/NativeMethods_video_BackgroundSubtractor.cs b/src/OpenCvSharp/PInvoke/video/NativeMethods_video_BackgroundSubtractor.cs deleted file mode 100644 index 3155e9367..000000000 --- a/src/OpenCvSharp/PInvoke/video/NativeMethods_video_BackgroundSubtractor.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - #region BackgroundSubtractor - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractor_getBackgroundImage(IntPtr self, IntPtr backgroundImage); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractor_apply(IntPtr self, IntPtr image, IntPtr fgmask, double learningRate); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_Ptr_BackgroundSubtractor_delete(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_Ptr_BackgroundSubtractor_get(IntPtr ptr); - - #endregion - - #region BackgroundSubtractorMOG2 - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_createBackgroundSubtractorMOG2( - int history, double varThreshold, int detectShadows); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_Ptr_BackgroundSubtractorMOG2_delete(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_Ptr_BackgroundSubtractorMOG2_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorMOG2_getHistory(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setHistory(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorMOG2_getNMixtures(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setNMixtures(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getBackgroundRatio(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setBackgroundRatio(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getVarThreshold(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setVarThreshold(IntPtr ptr, double value); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getVarThresholdGen(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setVarThresholdGen(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getVarInit(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setVarInit(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getVarMin(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setVarMin(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getVarMax(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setVarMax(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getComplexityReductionThreshold(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setComplexityReductionThreshold(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorMOG2_getDetectShadows(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setDetectShadows(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorMOG2_getShadowValue(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setShadowValue(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorMOG2_getShadowThreshold(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorMOG2_setShadowThreshold(IntPtr ptr, double value); - - #endregion - - #region BackgroundSubtractorKNN - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_createBackgroundSubtractorKNN( - int history, double dist2Threshold, int detectShadows); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_Ptr_BackgroundSubtractorKNN_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr video_Ptr_BackgroundSubtractorKNN_get(IntPtr ptr); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorKNN_getHistory(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setHistory(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorKNN_getNSamples(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setNSamples(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorKNN_getDist2Threshold(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setDist2Threshold(IntPtr ptr, double value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorKNN_getkNNSamples(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setkNNSamples(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorKNN_getDetectShadows(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setDetectShadows(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int video_BackgroundSubtractorKNN_getShadowValue(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setShadowValue(IntPtr ptr, int value); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern double video_BackgroundSubtractorKNN_getShadowThreshold(IntPtr ptr); - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void video_BackgroundSubtractorKNN_setShadowThreshold(IntPtr ptr, double value); - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc.cs b/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc.cs deleted file mode 100644 index acbd4d719..000000000 --- a/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -// ReSharper disable InconsistentNaming - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_niBlackThreshold( - IntPtr src, IntPtr dst, double maxValue, int type, - int blockSize, double delta); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_thinning(IntPtr src, IntPtr dst, int thinningType); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_weightedMedianFilter( - IntPtr joint, IntPtr src, IntPtr dst, - int r, double sigma, int weightType, IntPtr mask); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_covarianceEstimation( - IntPtr src, IntPtr dst, int windowRows, int windowCols); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc_FastHoughTransform.cs b/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc_FastHoughTransform.cs deleted file mode 100644 index d011e78c1..000000000 --- a/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc_FastHoughTransform.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -// ReSharper disable InconsistentNaming - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_FastHoughTransform(IntPtr src, IntPtr dst, - int dstMatDepth, int angleRange, int op, int makeSkew); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Vec4i ximgproc_HoughPoint2Line(Point houghPoint, IntPtr srcImgInfo, - int angleRange, int makeSkew, int rules); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc_FastLineDetector.cs b/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc_FastLineDetector.cs deleted file mode 100644 index 14495f560..000000000 --- a/src/OpenCvSharp/PInvoke/ximgproc/NativeMethods_ximgproc_FastLineDetector.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -// ReSharper disable InconsistentNaming - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - static partial class NativeMethods - { - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_FastLineDetector_delete(IntPtr obj); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ximgproc_Ptr_FastLineDetector_get(IntPtr ptr); - - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_FastLineDetector_detect_OutputArray(IntPtr obj, IntPtr image, IntPtr lines); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_FastLineDetector_detect_vector(IntPtr obj, IntPtr image, IntPtr lines); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_FastLineDetector_drawSegments_InputArray(IntPtr obj, IntPtr image, IntPtr lines, int draw_arrow); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void ximgproc_FastLineDetector_drawSegments_vector(IntPtr obj, IntPtr image, IntPtr lines, int draw_arrow); - - [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern IntPtr ximgproc_createFastLineDetector( - int length_threshold, float distance_threshold, double canny_th1, double canny_th2, int canny_aperture_size, - int do_merge); - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Properties/AssemblyInfo.cs b/src/OpenCvSharp/Properties/AssemblyInfo.cs index 1b908cd89..de287d8f5 100644 --- a/src/OpenCvSharp/Properties/AssemblyInfo.cs +++ b/src/OpenCvSharp/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OpenCvSharp/Util/ArrayAddress.cs b/src/OpenCvSharp/Util/ArrayAddress.cs deleted file mode 100644 index bcc95be39..000000000 --- a/src/OpenCvSharp/Util/ArrayAddress.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp.Util -{ - /// - /// - /// - /// - public class ArrayAddress1 : DisposableObject - { - protected Array array; - protected GCHandle gch; - protected object original; - - /// - /// - /// - /// - public ArrayAddress1(T[] array) - { - if (array == null) - throw new ArgumentNullException(); - this.array = array; - this.gch = GCHandle.Alloc(array, GCHandleType.Pinned); - } - - /// - /// - /// - /// - public ArrayAddress1(IEnumerable enumerable) - : this(EnumerableEx.ToArray(enumerable)) - { - original = enumerable; - } - - /// - /// - /// - /// - public ArrayAddress1(T[,] array) - { - if (array == null) - throw new ArgumentNullException(); - this.array = array; - this.gch = GCHandle.Alloc(array, GCHandleType.Pinned); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - original = null; - base.DisposeManaged(); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - if (gch.IsAllocated) - { - gch.Free(); - } - base.DisposeUnmanaged(); - } - - /// - /// - /// - public IntPtr Pointer - { - get { return gch.AddrOfPinnedObject(); } - } - - /// - /// - /// - /// - /// - public static implicit operator IntPtr(ArrayAddress1 self) - { - return self.Pointer; - } - - /// - /// - /// - public int Length - { - get { return array.Length; } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Util/ArrayAddress2.cs b/src/OpenCvSharp/Util/ArrayAddress2.cs deleted file mode 100644 index 4ec08b36e..000000000 --- a/src/OpenCvSharp/Util/ArrayAddress2.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace OpenCvSharp.Util -{ - /// - /// Class to get address of specified jagged array - /// - /// - public class ArrayAddress2 : DisposableObject - where T : struct - { -#pragma warning disable 1591 - protected T[][] array; - protected GCHandle[] gch; - protected IntPtr[] ptr; - protected object original; - - /// - /// - /// - public ArrayAddress2() - { - } - - /// - /// - /// - /// - public ArrayAddress2(T[][] array) - { - Initialize(array); - } - - /// - /// - /// - /// - public ArrayAddress2(IEnumerable> enumerable) - { - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - original = enumerable; - - var list = new List(); - foreach (IEnumerable e in enumerable) - { - if (e == null) - throw new ArgumentException("enumerable contains null"); - list.Add(new List(e).ToArray()); - } - - Initialize(list.ToArray()); - } - - protected void Initialize(T[][] target) - { - if (target == null) - throw new ArgumentNullException(nameof(target)); - array = target; - - // T[][]をIntPtr[]に変換する - ptr = new IntPtr[array.Length]; - gch = new GCHandle[array.Length]; - for (int i = 0; i < array.Length; i++) - { - T[] elem = array[i]; - if (elem == null/* || elem.Length == 0*/) - { - throw new ArgumentException(string.Format("array[{0}] is not valid array object.", i)); - } - // メモリ確保 - gch[i] = GCHandle.Alloc(elem, GCHandleType.Pinned); - ptr[i] = gch[i].AddrOfPinnedObject(); - } - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - foreach (GCHandle h in gch) - { - if (h.IsAllocated) - { - h.Free(); - } - } - base.DisposeUnmanaged(); - } - -#if LANG_JP -/// -/// ポインタを得る -/// -/// -#else - /// - /// - /// -#endif - public IntPtr[] Pointer - { - get { return ptr; } - } - -#if LANG_JP -/// -/// ポインタへの暗黙のキャスト -/// -/// -/// -#else - /// - /// - /// - /// - /// -#endif - public static implicit operator IntPtr[](ArrayAddress2 self) - { - return self.Pointer; - } - - /// - /// - /// - public int Dim1Length - { - get { return array.Length; } - } - - /// - /// - /// - public int[] Dim2Lengths - { - get - { - var lengths = new int[array.Length]; - for (int i = 0; i < array.Length; i++) - { - lengths[i] = array[i].Length; - } - return lengths; - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Util/DynamicInvoker.cs b/src/OpenCvSharp/Util/DynamicInvoker.cs deleted file mode 100644 index 33d23d745..000000000 --- a/src/OpenCvSharp/Util/DynamicInvoker.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -namespace OpenCvSharp.Util -{ -#if !uap10 -#if LANG_JP - /// - /// 動的にアンマネージのアセンブリにある関数を呼び出すためのクラス - /// - /// 実行させたい関数の定義に合わせたデリゲート -#else - /// - /// - /// - /// -#endif - public class DynamicInvoker : DisposableObject - { -#if LANG_JP - /// - /// 読み込むライブラリの名前 - /// -#else - /// - /// Name of library to be loaded - /// -#endif - public string DllName { get; private set; } - -#if LANG_JP - /// - /// 呼び出す関数の名前 - /// -#else - /// - /// Name of function to be called - /// -#endif - public string FunctionName { get; private set; } - -#if LANG_JP - /// - /// LoadLibraryで得られたポインタ - /// -#else - /// - /// Pointer which retrieved by LoadLibrary - /// -#endif - public IntPtr PtrLib { get; } - -#if LANG_JP - /// - /// GetProcAddressで得られたポインタ - /// -#else - /// - /// Pointer which retrieved by GetProcAddress - /// -#endif - public IntPtr PtrProc { get; } - -#if LANG_JP - /// - /// 呼び出す関数ポインタをデリゲートに変換したものを取得する - /// -#else - /// - /// Delegate which is converted from function pointer - /// -#endif - public T Call { get; private set; } - -#if LANG_JP - /// - /// 初期化 - /// - /// ライブラリの名前 - /// 関数の名前 -#else - /// - /// Constructor - /// - /// Name of library - /// Name of function -#endif - public DynamicInvoker(string dllName, string functionName) - { - if (Platform.OS == OS.Unix) - { - throw new PlatformNotSupportedException("This method is for only Windows"); - } - -#if net20 || net40 - if (!typeof(T).IsSubclassOf(typeof(Delegate))) -#else - if (!typeof(T).GetTypeInfo().IsSubclassOf(typeof(Delegate))) -#endif - throw new OpenCvSharpException("The type argument must be Delegate."); - if (string.IsNullOrEmpty(dllName)) - throw new ArgumentNullException(nameof(dllName)); - if (string.IsNullOrEmpty(functionName)) - throw new ArgumentNullException(nameof(functionName)); - - PtrLib = Win32Api.LoadLibrary(dllName); - if (PtrLib == IntPtr.Zero) - throw new OpenCvSharpException("Failed to load \"{0}\".", dllName); - PtrProc = Win32Api.GetProcAddress(PtrLib, functionName); - if (PtrProc == IntPtr.Zero) - throw new OpenCvSharpException("Failed to get address of function \"{0}\".", functionName); - - DllName = dllName; - FunctionName = functionName; - IsDisposed = false; - -#if net20 || net40 || uwp - Call = (T)(object)Marshal.GetDelegateForFunctionPointer(PtrProc, typeof(T)); -#else - Call = Marshal.GetDelegateForFunctionPointer(PtrProc); -#endif - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - Win32Api.FreeLibrary(PtrLib); - base.DisposeUnmanaged(); - } - } -#endif -} diff --git a/src/OpenCvSharp/Util/EnumerableEx.cs b/src/OpenCvSharp/Util/EnumerableEx.cs deleted file mode 100644 index 2ab8ff3f6..000000000 --- a/src/OpenCvSharp/Util/EnumerableEx.cs +++ /dev/null @@ -1,330 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -#if !net20 -using System.Linq; -#endif -using System.Reflection; - -namespace OpenCvSharp.Util -{ -#if net20 - internal delegate TResult Func(T1 t1); -#endif - - /// - /// IEnumerable<T> extension methods for .NET Framework 2.0 - /// - internal static class EnumerableEx - { - /// - /// Enumerable.Select - /// - /// - /// - /// - /// - /// - public static IEnumerable Select( - IEnumerable enumerable, Func selector) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - if (selector == null) - throw new ArgumentNullException(nameof(selector)); - foreach (TSource elem in enumerable) - { - yield return selector(elem); - } -#else - return enumerable.Select(selector); -#endif - } - - /// - /// Enumerable.Select -> ToArray - /// - /// - /// - /// - /// - /// - public static TResult[] SelectToArray( - IEnumerable enumerable, Func selector) - { -#if net20 - return ToArray(Select(enumerable, selector)); -#else - return enumerable.Select(selector).ToArray(); -#endif - } - - /// - /// Enumerable.Select -> ToArray - /// - /// - /// - /// - /// - /// - public static TResult[] SelectToArray( - IEnumerable enumerable, Func selector) - { -#if net20 - var result = new List(); - foreach (TSource source in enumerable) - { - result.Add(selector(source)); - } - return result.ToArray(); -#else - return enumerable.Cast().Select(selector).ToArray(); -#endif - } - - /// - /// Enumerable.Select -> ToArray - /// - /// - /// - public static IntPtr[] SelectPtrs(IEnumerable enumerable) - { - return SelectToArray(enumerable, delegate(Mat obj) - { - if (obj == null) - throw new ArgumentException("enumerable contains null"); - obj.ThrowIfDisposed(); - return obj.CvPtr; - }); - } - - /// - /// Enumerable.Select -> ToArray - /// - /// - /// - public static IntPtr[] SelectPtrs(IEnumerable enumerable) - { - return SelectToArray(enumerable, delegate(InputArray obj) - { - if (obj == null) - throw new ArgumentException("enumerable contains null"); - obj.ThrowIfDisposed(); - return obj.CvPtr; - }); - } - - /// - /// Enumerable.Where - /// - /// - /// - /// - /// - public static IEnumerable Where( - IEnumerable enumerable, Func predicate) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - if (predicate == null) - throw new ArgumentNullException(nameof(predicate)); - foreach (TSource elem in enumerable) - { - if (predicate(elem)) - yield return elem; - } -#else - return enumerable.Where(predicate); -#endif - } - - /// - /// Enumerable.Where -> ToArray - /// - /// - /// - /// - /// - public static TSource[] WhereToArray( - IEnumerable enumerable, Func predicate) - { -#if net20 - return ToArray(Where(enumerable, predicate)); -#else - return enumerable.Where(predicate).ToArray(); -#endif - } - - /// - /// Enumerable.ToArray - /// - /// - /// - /// - public static TSource[] ToArray(IEnumerable enumerable) - { -#if net20 - if (enumerable == null) - return null; - var arr = enumerable as TSource[]; - if (arr != null) - return arr; - return new List(enumerable).ToArray(); -#else - return enumerable?.ToArray(); -#endif - } - - /// - /// Enumerable.Any - /// - /// - /// - /// - /// - public static bool Any( - IEnumerable enumerable, Func predicate) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - foreach (TSource elem in enumerable) - { - if (predicate(elem)) - return true; - } - return false; -#else - return enumerable.Any(predicate); -#endif - } - - /// - /// Enumerable.Any - /// - /// - /// - /// - public static bool AnyNull(IEnumerable enumerable) - where TSource : class - { - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - -#if net20 - foreach (TSource elem in enumerable) - { - if (elem == null) - return true; - } - return false; -#else - return enumerable.Any(e => e == null); -#endif - } - - /// - /// Enumerable.All - /// - /// - /// - /// - /// - public static bool All( - IEnumerable enumerable, Func predicate) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - foreach (TSource elem in enumerable) - { - if (!predicate(elem)) - return false; - } - return true; -#else - return enumerable.All(predicate); -#endif - } - - /// - /// Enumerable.Count - /// - /// - /// - /// - /// - public static int Count( - IEnumerable enumerable, Func predicate) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - int count = 0; - foreach (TSource elem in enumerable) - { - if (predicate(elem)) - count++; - } - return count; -#else - return enumerable.Count(predicate); -#endif - } - - /// - /// Enumerable.Count - /// - /// - /// - /// - public static int Count(IEnumerable enumerable) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - - TSource[] array = enumerable as TSource[]; - if (array != null) - return array.Length; - - ICollection collection = enumerable as ICollection; - if (collection != null) - return collection.Count; - - int count = 0; - foreach (TSource elem in enumerable) - { - count++; - } - return count; -#else - return enumerable.Count(); -#endif - } - - /// - /// - /// - /// - /// - /// - public static bool IsEmpty(IEnumerable enumerable) - { -#if net20 - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - - foreach (TSource elem in enumerable) - { - return false; - } - return true; -#else - return !enumerable.Any(); -#endif - } - } -} diff --git a/src/OpenCvSharp/Util/MarshalHelper.cs b/src/OpenCvSharp/Util/MarshalHelper.cs deleted file mode 100644 index 33d16c573..000000000 --- a/src/OpenCvSharp/Util/MarshalHelper.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp.Util -{ - /// - /// - /// - public static class MarshalHelper - { - public static int SizeOf() - { -#if net20 || net40 - if (typeof(T).IsValueType) - { - return Marshal.SizeOf(typeof(T)); - } - else - { - return IntPtr.Size; - } -#else - if (typeof(T).GetTypeInfo().IsValueType) - { -#if uwp - return Marshal.SizeOf(typeof(T)); -#else - return Marshal.SizeOf(); -#endif - } - else - { - return IntPtr.Size; - } -#endif - } - - public static T PtrToStructure(IntPtr p) - where T : struct - { -#if net20 || net40 || uwp - return (T)Marshal.PtrToStructure(p, typeof(T)); -#else - return Marshal.PtrToStructure(p); -#endif - } - } -} diff --git a/src/OpenCvSharp/Util/MemoryHelper.cs b/src/OpenCvSharp/Util/MemoryHelper.cs deleted file mode 100644 index 5dfa2cac4..000000000 --- a/src/OpenCvSharp/Util/MemoryHelper.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp.Util -{ - /// - /// - /// - public static class MemoryHelper - { - #region CopyMemory -#if LANG_JP - /// - /// 指定されたメモリブロックの内容を、他の場所へコピーします。 - /// - /// - /// - /// - /// - /// Yanesdk.NET (http://yanesdkdotnet.sourceforge.jp/) の Screen2DGl.cs から借用させて頂きました。 - /// -#else - /// - /// - /// - /// - /// - /// -#endif - public static unsafe void CopyMemory(void* outDest, void* inSrc, uint inNumOfBytes) - { -#if net20 || net40 || uwp - // 転送先をuint幅にalignする - const uint align = sizeof(uint) - 1; - uint offset = (uint)outDest & align; - // ↑ポインタは32bitとは限らないので本来このキャストはuintではダメだが、 - // 今は下位2bitだけあればいいのでこれでOK。 - if (offset != 0) - offset = align - offset; - offset = Math.Min(offset, inNumOfBytes); - - // 先頭の余り部分をbyteでちまちまコピー - byte* srcBytes = (byte*)inSrc; - byte* dstBytes = (byte*)outDest; - for (uint i = 0; i < offset; i++) - dstBytes[i] = srcBytes[i]; - - // uintで一気に転送 - uint* dst = (uint*)((byte*)outDest + offset); - uint* src = (uint*)((byte*)inSrc + offset); - uint numOfUInt = (inNumOfBytes - offset) / sizeof(uint); - for (uint i = 0; i < numOfUInt; i++) - dst[i] = src[i]; - - // 末尾の余り部分をbyteでちまちまコピー - for (uint i = offset + numOfUInt * sizeof(uint); i < inNumOfBytes; i++) - dstBytes[i] = srcBytes[i]; -#else - Buffer.MemoryCopy(inSrc, outDest, inNumOfBytes, inNumOfBytes); -#endif - } - public static unsafe void CopyMemory(void* outDest, void* inSrc, int inNumOfBytes) - { - CopyMemory(outDest, inSrc, (uint)inNumOfBytes); - } - public static unsafe void CopyMemory(IntPtr outDest, IntPtr inSrc, uint inNumOfBytes) - { - CopyMemory(outDest.ToPointer(), inSrc.ToPointer(), inNumOfBytes); - } - public static unsafe void CopyMemory(IntPtr outDest, IntPtr inSrc, int inNumOfBytes) - { - CopyMemory(outDest.ToPointer(), inSrc.ToPointer(), (uint)inNumOfBytes); - } - //[DllImport("kernel32")] - //public static unsafe extern void CopyMemory(void* outDest, void* inSrc, [MarshalAs(UnmanagedType.U4)] int inNumOfBytes); - //[DllImport("kernel32")] - //public static extern void CopyMemory(IntPtr outDest, IntPtr inSrc, [MarshalAs(UnmanagedType.U4)] int inNumOfBytes); -#endregion - - #region ZeroMemory -#if LANG_JP - /// - /// 指定されたメモリブロックの内容を、他の場所へコピーします。 - /// - /// - /// - /// - /// Yanesdk.NET (http://yanesdkdotnet.sourceforge.jp/) の Screen2DGl.cs から借用させて頂きました。 - /// -#else - /// - /// - /// - /// - /// -#endif - public static unsafe void ZeroMemory(void* outDest, uint inNumOfBytes) - { - // 転送先をuint幅にalignする - const uint align = sizeof(uint) - 1; - uint offset = (uint)outDest & align; - // ↑ポインタは32bitとは限らないので本来このキャストはuintではダメだが、 - // 今は下位2bitだけあればいいのでこれでOK。 - if (offset != 0) - offset = align - offset; - offset = Math.Min(offset, inNumOfBytes); - - // 先頭の余り部分をbyteでちまちまコピー - byte* dstBytes = (byte*)outDest; - for (uint i = 0; i < offset; i++) - dstBytes[i] = 0; - - // uintで一気に転送 - uint* dst = (uint*)((byte*)outDest + offset); - uint numOfUInt = (inNumOfBytes - offset) / sizeof(uint); - for (uint i = 0; i < numOfUInt; i++) - dst[i] = 0; - - // 末尾の余り部分をbyteでちまちまコピー - for (uint i = offset + numOfUInt * sizeof(uint); i < inNumOfBytes; i++) - dstBytes[i] = 0; - } - public static unsafe void ZeroMemory(void* outDest, int inNumOfBytes) - { - ZeroMemory(outDest, (uint)inNumOfBytes); - } - public static unsafe void ZeroMemory(IntPtr outDest, uint inNumOfBytes) - { - ZeroMemory(outDest.ToPointer(), inNumOfBytes); - } - public static unsafe void ZeroMemory(IntPtr outDest, int inNumOfBytes) - { - ZeroMemory(outDest.ToPointer(), (uint)inNumOfBytes); - } -#endregion - } -} diff --git a/src/OpenCvSharp/Util/PInvokeHelper.cs b/src/OpenCvSharp/Util/PInvokeHelper.cs deleted file mode 100644 index 689697af1..000000000 --- a/src/OpenCvSharp/Util/PInvokeHelper.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Util -{ - /// - /// - /// - public static class PInvokeHelper - { -#if LANG_JP - /// - /// PInvokeが正常に行えるかチェックする - /// -#else - /// - /// Checks whether PInvoke functions can be called - /// -#endif - public static void TryPInvoke() - { - try - { - NativeMethods.core_Mat_sizeof(); - } - catch (DllNotFoundException e) - { - DllImportError(e); - } - catch (BadImageFormatException e) - { - DllImportError(e); - } - } - - /// - /// DllImportの際にDllNotFoundExceptionかBadImageFormatExceptionが発生した際に呼び出されるメソッド。 - /// エラーメッセージを表示して解決策をユーザに示す。 - /// - /// - public static void DllImportError(Exception ex) - { - throw CreateException(ex); - } - - /// - /// - /// - /// - public static OpenCvSharpException CreateException(Exception ex) - { - StringBuilder message = new StringBuilder(); - if (System.Globalization.CultureInfo.CurrentCulture.Name.Contains("ja")) - { - message.AppendFormat("{0}\n", ex.Message); - message.Append("*** P/Invokeが原因で例外が発生しました。***\n") - .Append("以下の項目を確認して下さい。\n") - .Append("(1) OpenCVのDLLが実行ファイルと同じ場所に置かれていますか? またはパスが正しく通っていますか?\n") - .Append("(2) Visual C++ Redistributable Packageをインストールしましたか?\n") - .Append("(3) OpenCVのDLLやOpenCvSharpの対象プラットフォーム(x86またはx64)と、プロジェクトのプラットフォーム設定が合っていますか?\n") - .Append("\n") - .Append(ex.ToString()); - } - else - { - message.AppendFormat("{0}\n", ex.Message); - message.Append("*** An exception has occurred because of P/Invoke. ***\n") - .Append("Please check the following:\n") - .Append("(1) OpenCV's DLL files exist in the same directory as the executable file.\n") - .Append("(2) Visual C++ Redistributable Package has been installed.\n") - .Append("(3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.\n") - .Append("\n") - .Append(ex.ToString()); - } - return new OpenCvSharpException(message.ToString(), ex); - } - } -} diff --git a/src/OpenCvSharp/Util/Platform.cs b/src/OpenCvSharp/Util/Platform.cs deleted file mode 100644 index 76259e47a..000000000 --- a/src/OpenCvSharp/Util/Platform.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp.Util -{ - // ReSharper disable once InconsistentNaming - internal enum OS - { - Windows, - Unix - } - internal enum Runtime - { - DotNet, - Mono - } - - /// - /// Provides information for the platform which the user is using - /// - internal static class Platform - { - /// - /// OS type - /// - // ReSharper disable once InconsistentNaming - public static readonly OS OS; - /// - /// Runtime type - /// - public static readonly Runtime Runtime; - - static Platform() - { -#if DOTNET_FRAMEWORK - int p = (int)Environment.OSVersion.Platform; - OS = ((p == 4) || (p == 6) || (p == 128)) ? OS.Unix : OS.Windows; -#elif uap10 - OS = OS.Windows; -#else - OS = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) - ? OS.Unix - : OS.Windows; -#endif - Runtime = (Type.GetType("Mono.Runtime") == null) ? Runtime.Mono : Runtime.DotNet; - } - } -} diff --git a/src/OpenCvSharp/Util/PlatformUtil.cs b/src/OpenCvSharp/Util/PlatformUtil.cs deleted file mode 100644 index 6a19e0075..000000000 --- a/src/OpenCvSharp/Util/PlatformUtil.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - internal static class PlatformUtil - { - public static long AlignSize(long sz, int n) - { - return (sz + n - 1) & -n; - } - - public static long TruncateForX86(long value) - { - if (IntPtr.Size == 4) - return (long)((int)value); - else - return value; - } - } -} diff --git a/src/OpenCvSharp/Util/ScopedGCHandle.cs b/src/OpenCvSharp/Util/ScopedGCHandle.cs deleted file mode 100644 index 2ac28e9ea..000000000 --- a/src/OpenCvSharp/Util/ScopedGCHandle.cs +++ /dev/null @@ -1,320 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp.Util -{ -#if LANG_JP - /// - /// IDisposableを実装したGCHandle - /// -#else - /// - /// Original GCHandle that implement IDisposable - /// -#endif - public class ScopedGCHandle : IDisposable - { - private GCHandle handle; - private bool disposed; - - #region Init and Disposal -#if LANG_JP - /// - /// 指定したオブジェクトに System.Runtime.InteropServices.GCHandleType.Normal ハンドルを割り当てます - /// - /// GCの対象からはずすオブジェクト -#else - /// - /// - /// - /// -#endif - public ScopedGCHandle(object value) - { - if (value != null) - { - handle = GCHandle.Alloc(value); - } - disposed = false; - } -#if LANG_JP - /// - /// 指定したオブジェクトに指定した型のハンドルを割り当てます - /// - /// GCの対象からはずすオブジェクト - /// 作成する System.Runtime.InteropServices.GCHandle の型を示す、System.Runtime.InteropServices.GCHandleType 値の 1 つ -#else - /// - /// - /// - /// - /// -#endif - public ScopedGCHandle(object value, GCHandleType type) - { - if (value != null) - { - handle = GCHandle.Alloc(value, type); - } - disposed = false; - } -#if LANG_JP - /// - /// GCHandleから初期化 - /// - /// -#else - /// - /// - /// - /// -#endif - private ScopedGCHandle(GCHandle handle) - { - this.handle = handle; - disposed = false; - } - -#if LANG_JP - /// - /// 指定したオブジェクトに System.Runtime.InteropServices.GCHandleType.Normal ハンドルを割り当てます - /// - /// System.Runtime.InteropServices.GCHandle を使用するオブジェクト - /// オブジェクトをガベージ コレクションから保護する新しい System.Runtime.InteropServices.GCHandle。 - /// System.Runtime.InteropServices.GCHandle は、不要になったときに System.Runtime.InteropServices.GCHandle.Free() で解放する必要があります。 - /// 非プリミティブ (blittable でない) メンバを持つインスタンスは固定できません -#else - /// - /// - /// - /// - /// -#endif - public static ScopedGCHandle Alloc(object value) - { - return new ScopedGCHandle(value); - } -#if LANG_JP - /// - /// 指定したオブジェクトに指定した型のハンドルを割り当てます - /// - /// System.Runtime.InteropServices.GCHandle を使用するオブジェクト - /// 作成する System.Runtime.InteropServices.GCHandle の型を示す、System.Runtime.InteropServices.GCHandleType 値の 1 つ - /// オブジェクトをガベージ コレクションから保護する新しい System.Runtime.InteropServices.GCHandle。 - /// System.Runtime.InteropServices.GCHandle は、不要になったときに System.Runtime.InteropServices.GCHandle.Free() で解放する必要があります。 - /// 非プリミティブ (blittable でない) メンバを持つインスタンスは固定できません -#else - /// - /// - /// - /// - /// - /// -#endif - public static ScopedGCHandle Alloc(object value, GCHandleType type) - { - return new ScopedGCHandle(value, type); - } - -#if LANG_JP - /// - /// GCHandle.Freeによりリソースの解放を行う - /// -#else - /// - /// - /// -#endif - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - /// - /// - /// - /// - protected virtual void Dispose(bool disposing) - { - if (!disposed) - { - if (disposing) - { - } - // Release managed resources. - if (handle.IsAllocated) - { - handle.Free(); - } - disposed = true; - } - } - /// - /// Destructor - /// - ~ScopedGCHandle() - { - Dispose(false); - } - #endregion - - #region Static methods -#if LANG_JP - /// - /// マネージ オブジェクトを識別するハンドルから作成された新しい System.Runtime.InteropServices.GCHandle オブジェクトを返します - /// - /// System.Runtime.InteropServices.GCHandle オブジェクトの作成元のマネージ オブジェクトを識別する System.IntPtr ハンドル - /// value パラメータの値が System.IntPtr.Zero です - /// 値パラメータに対応する新しい System.Runtime.InteropServices.GCHandle オブジェクト -#else - /// - /// - /// - /// - /// -#endif - public static ScopedGCHandle FromIntPtr(IntPtr value) - { - return new ScopedGCHandle(GCHandle.FromIntPtr(value)); - } -#if LANG_JP - /// - /// System.Runtime.InteropServices.GCHandle オブジェクトの内部整数表現を返します - /// - /// 内部整数表現の取得元の System.Runtime.InteropServices.GCHandle オブジェクト - /// System.Runtime.InteropServices.GCHandle オブジェクトを表す System.IntPtr オブジェクト -#else - /// - /// - /// - /// - /// -#endif - public static IntPtr ToIntPtr(ScopedGCHandle value) - { - return GCHandle.ToIntPtr(value.Handle); - } - #endregion - - #region Properties -#if LANG_JP - /// - /// 内部で保持するGCHandle - /// -#else - /// - /// - /// -#endif - public GCHandle Handle - { - get { return handle; } - } -#if LANG_JP - /// - /// ハンドルが割り当てられているかどうかを示す値を取得します - /// -#else - /// - /// - /// -#endif - public bool IsAllocated - { - get { return handle.IsAllocated; } - } -#if LANG_JP - /// - /// ハンドルが表すオブジェクトを取得または設定します - /// -#else - /// - /// - /// -#endif - public object Target - { - get { return handle.Target; } - set { handle.Target = value; } - } - #endregion - - #region Methods -#if LANG_JP - /// - /// System.Runtime.InteropServices.GCHandleType.Pinned ハンドル内のオブジェクトのアドレスを取得します - /// - /// System.IntPtr としての Pinned オブジェクトのアドレス -#else - /// - /// - /// - /// -#endif - public IntPtr AddrOfPinnedObject() - { - return handle.AddrOfPinnedObject(); - } -#if LANG_JP - /// - /// 指定した System.Runtime.InteropServices.GCHandle オブジェクトが、現在の System.Runtime.InteropServices.GCHandle オブジェクトと等しいかどうかを判断します - /// - /// 現在の System.Runtime.InteropServices.GCHandle オブジェクトと比較する System.Runtime.InteropServices.GCHandle オブジェクト - /// -#else - /// - /// - /// - /// - /// -#endif - public override bool Equals(object obj) - { - return handle.Equals(obj); - } -#if LANG_JP - /// - /// System.Runtime.InteropServices.GCHandle を解放します - /// -#else - /// - /// - /// -#endif - public void Free() - { - handle.Free(); - } -#if LANG_JP - /// - /// 現在の System.Runtime.InteropServices.GCHandle オブジェクトの識別子を返します - /// - /// 現在の System.Runtime.InteropServices.GCHandle オブジェクトの識別子 -#else - /// - /// - /// - /// -#endif - public override int GetHashCode() - { - return handle.GetHashCode(); - } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// -#else - /// - /// - /// - /// -#endif - public override string ToString() - { - return handle.ToString(); - } - #endregion - } -} diff --git a/src/OpenCvSharp/Util/StringArrayAddress.cs b/src/OpenCvSharp/Util/StringArrayAddress.cs deleted file mode 100644 index 00717096b..000000000 --- a/src/OpenCvSharp/Util/StringArrayAddress.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Util -{ - /// - /// Class to get address of string array - /// - public class StringArrayAddress : ArrayAddress2 - { - /// - /// - /// - /// - public StringArrayAddress(string[] stringArray) - { - var byteList = new List(); - for (int i = 0; i < stringArray.Length; i++) - { -#if uwp - byteList.Add(Encoding.UTF8.GetBytes(stringArray[i])); // TODO -#else - byteList.Add(Encoding.ASCII.GetBytes(stringArray[i])); -#endif - } - Initialize(byteList.ToArray()); - } - /// - /// - /// - /// - public StringArrayAddress(IEnumerable enumerable) - : this(EnumerableEx.ToArray(enumerable)) - { - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Util/StringHelper.cs b/src/OpenCvSharp/Util/StringHelper.cs deleted file mode 100644 index 490b629c5..000000000 --- a/src/OpenCvSharp/Util/StringHelper.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp.Util -{ - internal static class StringHelper - { - public static unsafe string PtrToStringAnsi(sbyte* p) - { -#if DOTNET_FRAMEWORK - return new string(p); -#else - // memo: https://github.com/dotnet/standard/blob/master/netstandard/ref/mscorlib.cs#L2970 - return Marshal.PtrToStringAnsi(new IntPtr(p)); -#endif - } - - public static unsafe string PtrToStringAnsi(IntPtr p) - { -#if DOTNET_FRAMEWORK - return new string((sbyte*)p); -#else - // memo: https://github.com/dotnet/standard/blob/master/netstandard/ref/mscorlib.cs#L2970 - return Marshal.PtrToStringAnsi(p); -#endif - } - } -} diff --git a/src/OpenCvSharp/Util/StructurePointer.cs b/src/OpenCvSharp/Util/StructurePointer.cs deleted file mode 100644 index 6198ae267..000000000 --- a/src/OpenCvSharp/Util/StructurePointer.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp.Util -{ -#if LANG_JP - /// - /// 構造体とポインタの変換やメモリの解放を自動的にやってくれるクラス (ジェネリック版) - /// - /// -#else - /// - /// Class that converts structure into pointer and cleans up resources automatically (generic version) - /// - /// -#endif - public class StructurePointer - where T : struct - { - -#if LANG_JP - /// - /// 実体ポインタ - /// -#else - /// - /// Pointer - /// -#endif - - public IntPtr Ptr { get; protected set; } -#if LANG_JP - /// - /// 初期化の際に渡された構造体オブジェクト - /// -#else - /// - /// Structure - /// -#endif - public T SrcObj { get; protected set; } -#if LANG_JP - /// - /// 確保したメモリのバイトサイズ - /// -#else - /// - /// Size of allocated memory - /// -#endif - public int Size { get; protected set; } - - -#if LANG_JP - /// - /// 指定した構造体オブジェクトをポインタに変換して初期化 - /// - /// -#else - /// - /// - /// - /// -#endif - public StructurePointer(T obj) - { - SrcObj = obj; - Size = MarshalHelper.SizeOf(); - Ptr = Marshal.AllocHGlobal(Size); - Marshal.StructureToPtr(obj, Ptr, false); - } -#if LANG_JP - /// - /// T型のバイトサイズのポインタを生成して初期化 - /// -#else - /// - /// - /// -#endif - public StructurePointer() - { - SrcObj = default(T); - Size = MarshalHelper.SizeOf(); - Ptr = Marshal.AllocHGlobal(Size); - } - -#if LANG_JP - /// - /// IntPtrへの暗黙の変換 - /// - /// - /// -#else - /// - /// - /// - /// - /// -#endif - public static implicit operator IntPtr(StructurePointer self) - { - return self.Ptr; - } - -#if LANG_JP - /// - /// ポインタから構造体に変換して返す - /// - /// -#else - /// - /// - /// - /// -#endif - public T ToStructure() - { - return MarshalHelper.PtrToStructure(Ptr); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/Util/TimeMeasurer.cs b/src/OpenCvSharp/Util/TimeMeasurer.cs deleted file mode 100644 index b3dbb8dca..000000000 --- a/src/OpenCvSharp/Util/TimeMeasurer.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Diagnostics; - -namespace OpenCvSharp.Util -{ - /// - /// Substitute of System.Action - /// - public delegate void Action(); - - /// - /// - /// - public static class TimeMeasurer - { - /// - /// - /// - /// - /// - public static TimeSpan Measure(Action action) - { - Stopwatch watch = Stopwatch.StartNew(); - action(); - watch.Stop(); - return watch.Elapsed; - } - } -} diff --git a/src/OpenCvSharp/Util/TypeHelper.cs b/src/OpenCvSharp/Util/TypeHelper.cs deleted file mode 100644 index b38db5be0..000000000 --- a/src/OpenCvSharp/Util/TypeHelper.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; - -#pragma warning disable 1591 - -namespace OpenCvSharp.Util -{ - /// - /// - /// - public static class TypeHelper - { -#if LANG_JP -/// -/// ポインタから構造体にキャストを試みる -/// -/// -/// -/// -#else - /// - /// - /// - /// - /// - /// -#endif - public static T ToObject(IntPtr ptr) where T : struct - { - Type t = typeof(T); - // IntPtrはそのまま返す - if (t == typeof(IntPtr)) - { - return (T) (object) ptr; - } - -#if net20 || net40 || uwp - return (T)Marshal.PtrToStructure(ptr, typeof(T)); -#else - return Marshal.PtrToStructure(ptr); -#endif - } - -#if LANG_JP -/// -/// testとtargetが同じ型かどうかチェック -/// -/// source type -/// generic type -/// -#else - /// - /// - /// - /// - /// - /// -#endif - private static bool CheckType(Type test, Type target) - { -#if net20 || net40 - while (test != typeof(object)) - { - if (test.IsGenericType) - { - Type g = test.GetGenericTypeDefinition(); - if (target == g) - { - return true; - } - } - test = test.BaseType; - } -#else - while (test != typeof(object)) - { - if (test.GetTypeInfo().IsGenericType) - { - Type g = test.GetGenericTypeDefinition(); - if (target == g) - { - return true; - } - } - test = test.GetTypeInfo().BaseType; - } -#endif - return false; - } - } -} diff --git a/src/OpenCvSharp/Vector/IStdVector.cs b/src/OpenCvSharp/Vector/IStdVector.cs deleted file mode 100644 index edf30b5bf..000000000 --- a/src/OpenCvSharp/Vector/IStdVector.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Represents std::vector - /// - public interface IStdVector : IDisposable - { - /// - /// vector.size() - /// - int Size { get; } - - /// - /// &vector[0] - /// - IntPtr ElemPtr { get; } - - /// - /// Convert std::vector<T> to managed array T[] - /// - /// - T[] ToArray(); - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfByte.cs b/src/OpenCvSharp/Vector/VectorOfByte.cs deleted file mode 100644 index 631415649..000000000 --- a/src/OpenCvSharp/Vector/VectorOfByte.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfByte : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfByte() - { - ptr = NativeMethods.vector_uchar_new1(); - } - - /// - /// - /// - /// - public VectorOfByte(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_uchar_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfByte(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - byte[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_uchar_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_uchar_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_uchar_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_uchar_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public byte[] ToArray() - { - int size = Size; - if (size == 0) - { - return new byte[0]; - } - byte[] dst = new byte[size]; - Marshal.Copy(ElemPtr, dst, 0, dst.Length); - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfDMatch.cs b/src/OpenCvSharp/Vector/VectorOfDMatch.cs deleted file mode 100644 index c52bf4f21..000000000 --- a/src/OpenCvSharp/Vector/VectorOfDMatch.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfDMatch : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfDMatch() - { - ptr = NativeMethods.vector_DMatch_new1(); - } - - /// - /// - /// - /// - public VectorOfDMatch(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfDMatch(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_DMatch_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfDMatch(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - DMatch[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_DMatch_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_DMatch_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_DMatch_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_DMatch_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public DMatch[] ToArray() - { - int size = Size; - if (size == 0) - { - return new DMatch[0]; - } - DMatch[] dst = new DMatch[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, MarshalHelper.SizeOf()*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfDTreesNode.cs b/src/OpenCvSharp/Vector/VectorOfDTreesNode.cs deleted file mode 100644 index bfbebcda6..000000000 --- a/src/OpenCvSharp/Vector/VectorOfDTreesNode.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; -using OpenCvSharp.ML; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfDTreesNode : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfDTreesNode() - { - ptr = NativeMethods.vector_DTrees_Node_new1(); - } - - /// - /// - /// - /// - public VectorOfDTreesNode(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfDTreesNode(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_DTrees_Node_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfDTreesNode(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - DTrees.Node[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_DTrees_Node_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_DTrees_Node_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_DTrees_Node_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_DTrees_Node_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public DTrees.Node[] ToArray() - { - int size = Size; - if (size == 0) - { - return new DTrees.Node[0]; - } - var dst = new DTrees.Node[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, MarshalHelper.SizeOf() * dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfDTreesSplit.cs b/src/OpenCvSharp/Vector/VectorOfDTreesSplit.cs deleted file mode 100644 index 27a5d8019..000000000 --- a/src/OpenCvSharp/Vector/VectorOfDTreesSplit.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; -using OpenCvSharp.ML; - -namespace OpenCvSharp -{ - /// - /// - /// - internal class VectorOfDTreesSplit : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfDTreesSplit() - { - ptr = NativeMethods.vector_DTrees_Split_new1(); - } - - /// - /// - /// - /// - public VectorOfDTreesSplit(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfDTreesSplit(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_DTrees_Split_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfDTreesSplit(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - DTrees.Split[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_DTrees_Split_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_DTrees_Split_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_DTrees_Split_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_DTrees_Split_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public DTrees.Split[] ToArray() - { - int size = Size; - if (size == 0) - { - return new DTrees.Split[0]; - } - var dst = new DTrees.Split[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, MarshalHelper.SizeOf() * dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfDouble.cs b/src/OpenCvSharp/Vector/VectorOfDouble.cs deleted file mode 100644 index 904df1e0f..000000000 --- a/src/OpenCvSharp/Vector/VectorOfDouble.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfDouble : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfDouble() - { - ptr = NativeMethods.vector_double_new1(); - } - - /// - /// - /// - /// - public VectorOfDouble(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_double_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfDouble(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - double[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_double_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_double_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_double_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_double_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public double[] ToArray() - { - int size = Size; - if (size == 0) - { - return new double[0]; - } - double[] dst = new double[size]; - Marshal.Copy(ElemPtr, dst, 0, dst.Length); - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfFloat.cs b/src/OpenCvSharp/Vector/VectorOfFloat.cs deleted file mode 100644 index 8ccb36dac..000000000 --- a/src/OpenCvSharp/Vector/VectorOfFloat.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfFloat : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfFloat() - { - ptr = NativeMethods.vector_float_new1(); - } - - /// - /// - /// - /// - public VectorOfFloat(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_float_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfFloat(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - float[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_float_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_float_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_float_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_float_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public float[] ToArray() - { - int size = Size; - if (size == 0) - { - return new float[0]; - } - float[] dst = new float[size]; - Marshal.Copy(ElemPtr, dst, 0, dst.Length); - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfInt32.cs b/src/OpenCvSharp/Vector/VectorOfInt32.cs deleted file mode 100644 index 537269e0a..000000000 --- a/src/OpenCvSharp/Vector/VectorOfInt32.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfInt32 : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfInt32() - { - ptr = NativeMethods.vector_int32_new1(); - } - - /// - /// - /// - /// - public VectorOfInt32(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_int32_new2(new IntPtr(size)); - } - - /// - /// - /// - public VectorOfInt32(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfInt32(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - int[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_int32_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_int32_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_int32_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_int32_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public int[] ToArray() - { - int size = Size; - if (size == 0) - { - return new int[0]; - } - int[] dst = new int[size]; - Marshal.Copy(ElemPtr, dst, 0, dst.Length); - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfKeyPoint.cs b/src/OpenCvSharp/Vector/VectorOfKeyPoint.cs deleted file mode 100644 index ea39b2c70..000000000 --- a/src/OpenCvSharp/Vector/VectorOfKeyPoint.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfKeyPoint : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfKeyPoint() - { - ptr = NativeMethods.vector_KeyPoint_new1(); - } - - /// - /// - /// - /// - public VectorOfKeyPoint(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfKeyPoint(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_KeyPoint_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfKeyPoint(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - KeyPoint[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_KeyPoint_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_KeyPoint_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_KeyPoint_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_KeyPoint_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public KeyPoint[] ToArray() - { - int size = Size; - if (size == 0) - { - return new KeyPoint[0]; - } - KeyPoint[] dst = new KeyPoint[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, MarshalHelper.SizeOf() * dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfMat.cs b/src/OpenCvSharp/Vector/VectorOfMat.cs deleted file mode 100644 index 396ceec4b..000000000 --- a/src/OpenCvSharp/Vector/VectorOfMat.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfMat : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfMat() - { - ptr = NativeMethods.vector_Mat_new1(); - } - - /// - /// - /// - /// - public VectorOfMat(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Mat_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfMat(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfMat(IEnumerable mats) - { - if (mats == null) - throw new ArgumentNullException(nameof(mats)); - - var matPointers = EnumerableEx.SelectPtrs(mats); - using (var matPointersPointer = new ArrayAddress1(matPointers)) - { - ptr = NativeMethods.vector_Mat_new3( - matPointersPointer.Pointer, - new IntPtr(matPointers.Length)); - } - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Mat_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Mat_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Mat_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Mat[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// - public T[] ToArray() - where T : Mat, new() - { - int size = Size; - if (size == 0) - return new T[0]; - - T[] dst = new T[size]; - IntPtr[] dstPtr = new IntPtr[size]; - for (int i = 0; i < size; i++) - { - T m = new T(); - dst[i] = m; - dstPtr[i] = m.CvPtr; - } - NativeMethods.vector_Mat_assignToArray(ptr, dstPtr); - - return dst; - } - - /// - /// 各要素の参照カウントを1追加する - /// - public void AddRef() - { - NativeMethods.vector_Mat_addref(ptr); - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfPoint.cs b/src/OpenCvSharp/Vector/VectorOfPoint.cs deleted file mode 100644 index c207638d4..000000000 --- a/src/OpenCvSharp/Vector/VectorOfPoint.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfPoint : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfPoint() - { - ptr = NativeMethods.vector_Point2i_new1(); - } - - /// - /// - /// - /// - public VectorOfPoint(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Point2i_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfPoint(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfPoint(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Point[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Point2i_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Point2i_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Point2i_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Point2i_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Point[] ToArray() - { - int size = Size; - if (size == 0) - { - return new Point[0]; - } - Point[] dst = new Point[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, Point.SizeOf*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfPoint2f.cs b/src/OpenCvSharp/Vector/VectorOfPoint2f.cs deleted file mode 100644 index 2c1c5de02..000000000 --- a/src/OpenCvSharp/Vector/VectorOfPoint2f.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfPoint2f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfPoint2f() - { - ptr = NativeMethods.vector_Point2f_new1(); - } - - /// - /// - /// - /// - public VectorOfPoint2f(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfPoint2f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Point2f_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfPoint2f(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Point2f[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Point2f_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Point2f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Point2f_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Point2f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Point2f[] ToArray() - { - int size = Size; - if (size == 0) - { - return new Point2f[0]; - } - Point2f[] dst = new Point2f[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, Point2f.SizeOf*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfPoint3f.cs b/src/OpenCvSharp/Vector/VectorOfPoint3f.cs deleted file mode 100644 index fae40070b..000000000 --- a/src/OpenCvSharp/Vector/VectorOfPoint3f.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfPoint3f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfPoint3f() - { - ptr = NativeMethods.vector_Point2f_new1(); - } - - /// - /// - /// - /// - public VectorOfPoint3f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Point3f_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfPoint3f(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Point3f[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Point3f_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Point3f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Point3f_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Point3f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Point3f[] ToArray() - { - int size = Size; - if (size == 0) - { - return new Point3f[0]; - } - Point3f[] dst = new Point3f[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, Point3f.SizeOf*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfRect.cs b/src/OpenCvSharp/Vector/VectorOfRect.cs deleted file mode 100644 index 8b42f111b..000000000 --- a/src/OpenCvSharp/Vector/VectorOfRect.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfRect : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfRect() - { - ptr = NativeMethods.vector_Rect_new1(); - } - - /// - /// - /// - /// - public VectorOfRect(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Rect_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfRect(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Rect[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Rect_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Rect_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Rect_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Rect_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Rect[] ToArray() - { - int size = Size; - if (size == 0) - { - return new Rect[0]; - } - Rect[] dst = new Rect[size]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, Rect.SizeOf*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfSByte.cs b/src/OpenCvSharp/Vector/VectorOfSByte.cs deleted file mode 100644 index bd3549602..000000000 --- a/src/OpenCvSharp/Vector/VectorOfSByte.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfSByte : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfSByte() - { - ptr = NativeMethods.vector_char_new1(); - } - - /// - /// - /// - /// - public VectorOfSByte(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_char_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfSByte(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - sbyte[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_char_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_char_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_char_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_char_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public sbyte[] ToArray() - { - int size = Size; - if (size == 0) - { - return new sbyte[0]; - } - byte[] dst = new byte[size]; - Marshal.Copy(ElemPtr, dst, 0, dst.Length); - return EnumerableEx.SelectToArray(dst, b => (sbyte)b); - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfString.cs b/src/OpenCvSharp/Vector/VectorOfString.cs deleted file mode 100644 index 627069972..000000000 --- a/src/OpenCvSharp/Vector/VectorOfString.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfString : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfString() - { - ptr = NativeMethods.vector_string_new1(); - } - - /// - /// - /// - /// - public VectorOfString(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfString(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_string_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_string_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_string_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_string_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public string[] ToArray() - { - int size = Size; - if (size == 0) - return new string[0]; - - var ret = new string[size]; - for (int i = 0; i < size; i++) - { - unsafe - { - sbyte* p = NativeMethods.vector_string_elemAt(ptr, i); - ret[i] = StringHelper.PtrToStringAnsi(p); - } - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVec2f.cs b/src/OpenCvSharp/Vector/VectorOfVec2f.cs deleted file mode 100644 index 06ca6b0af..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVec2f.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVec2f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVec2f() - { - ptr = NativeMethods.vector_Vec2f_new1(); - } - - /// - /// - /// - /// - public VectorOfVec2f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Vec2f_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVec2f(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Vec2f[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Vec2f_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Vec2f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Vec2f_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Vec2f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Vec2f[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// structure that has two float members (ex. CvLineSegmentPolar, CvPoint2D32f, PointF) - /// - public T[] ToArray() where T : struct - { - int typeSize = MarshalHelper.SizeOf(); - if (typeSize != sizeof (float)*2) - { - throw new OpenCvSharpException(); - } - - int arySize = Size; - if (arySize == 0) - { - return new T[0]; - } - else - { - T[] dst = new T[arySize]; - using (ArrayAddress1 dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, typeSize*dst.Length); - } - return dst; - } - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVec3f.cs b/src/OpenCvSharp/Vector/VectorOfVec3f.cs deleted file mode 100644 index 31c1d6a8a..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVec3f.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVec3f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVec3f() - { - ptr = NativeMethods.vector_Vec3f_new1(); - } - - /// - /// - /// - /// - public VectorOfVec3f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Vec3f_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVec3f(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Vec3f[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Vec3f_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Vec3f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Vec3f_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Vec3f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Vec3f[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// structure that has two float members (ex. CvLineSegmentPolar, CvPoint2D32f, PointF) - /// - public T[] ToArray() where T : struct - { - int typeSize = MarshalHelper.SizeOf(); - if (typeSize != sizeof (float)*3) - { - throw new OpenCvSharpException(); - } - - int arySize = Size; - if (arySize == 0) - { - return new T[0]; - } - T[] dst = new T[arySize]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, typeSize*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVec4f.cs b/src/OpenCvSharp/Vector/VectorOfVec4f.cs deleted file mode 100644 index 54f747a88..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVec4f.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVec4f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVec4f() - { - ptr = NativeMethods.vector_Vec4f_new1(); - } - - /// - /// - /// - /// - public VectorOfVec4f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Vec4f_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVec4f(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Vec4f[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Vec4f_new3(array, new IntPtr(array.Length)); - } - - /// - /// - /// - /// - public VectorOfVec4f(IntPtr p) - { - ptr = p; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Vec4f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Vec4f_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Vec4f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Vec4f[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) - /// - public T[] ToArray() where T : struct - { - int typeSize = MarshalHelper.SizeOf(); - if (typeSize != sizeof (float)*4) - { - throw new OpenCvSharpException(); - } - - int arySize = Size; - if (arySize == 0) - { - return new T[0]; - } - T[] dst = new T[arySize]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, typeSize*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVec4i.cs b/src/OpenCvSharp/Vector/VectorOfVec4i.cs deleted file mode 100644 index 517ee6e75..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVec4i.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVec4i : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVec4i() - { - ptr = NativeMethods.vector_Vec4i_new1(); - } - - /// - /// - /// - /// - public VectorOfVec4i(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Vec4i_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVec4i(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfVec4i(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Vec4i[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Vec4i_new3(array, new IntPtr(array.Length)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Vec4i_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Vec4i_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Vec4i_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Vec4i[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) - /// - public T[] ToArray() where T : struct - { - int typeSize = MarshalHelper.SizeOf(); - if (typeSize != sizeof (int)*4) - { - throw new OpenCvSharpException(); - } - - int arySize = Size; - if (arySize == 0) - { - return new T[0]; - } - T[] dst = new T[arySize]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, typeSize*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVec6d.cs b/src/OpenCvSharp/Vector/VectorOfVec6d.cs deleted file mode 100644 index 2abc6a0e6..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVec6d.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVec6d : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVec6d() - { - ptr = NativeMethods.vector_Vec6d_new1(); - } - - /// - /// - /// - /// - public VectorOfVec6d(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Vec6d_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVec6d(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Vec6d[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Vec6d_new3(array, new IntPtr(array.Length)); - } - - /// - /// - /// - /// - public VectorOfVec6d(IntPtr p) - { - ptr = p; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Vec6d_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Vec6d_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Vec6d_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Vec6d[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) - /// - public T[] ToArray() where T : struct - { - int typeSize = MarshalHelper.SizeOf(); - if (typeSize != sizeof (double)*6) - { - throw new OpenCvSharpException(); - } - - int arySize = Size; - if (arySize == 0) - { - return new T[0]; - } - var dst = new T[arySize]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, typeSize*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVec6f.cs b/src/OpenCvSharp/Vector/VectorOfVec6f.cs deleted file mode 100644 index b10ab7cff..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVec6f.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - internal class VectorOfVec6f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVec6f() - { - ptr = NativeMethods.vector_Vec6f_new1(); - } - - /// - /// - /// - /// - public VectorOfVec6f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_Vec6f_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVec6f(IEnumerable data) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - Vec6f[] array = EnumerableEx.ToArray(data); - ptr = NativeMethods.vector_Vec6f_new3(array, new IntPtr(array.Length)); - } - - /// - /// - /// - /// - public VectorOfVec6f(IntPtr p) - { - ptr = p; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_Vec6f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size - { - get { return NativeMethods.vector_Vec6f_getSize(ptr).ToInt32(); } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_Vec6f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Vec6f[] ToArray() - { - return ToArray(); - } - - /// - /// Converts std::vector to managed array - /// - /// structure that has four int members (ex. CvLineSegmentPoint, CvRect) - /// - public T[] ToArray() where T : struct - { - int typeSize = MarshalHelper.SizeOf(); - if (typeSize != sizeof (float)*6) - { - throw new OpenCvSharpException(); - } - - int arySize = Size; - if (arySize == 0) - { - return new T[0]; - } - var dst = new T[arySize]; - using (var dstPtr = new ArrayAddress1(dst)) - { - MemoryHelper.CopyMemory(dstPtr, ElemPtr, typeSize*dst.Length); - } - return dst; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorDMatch.cs b/src/OpenCvSharp/Vector/VectorOfVectorDMatch.cs deleted file mode 100644 index 9b01acec0..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorDMatch.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorDMatch : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorDMatch() - { - ptr = NativeMethods.vector_vector_DMatch_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorDMatch(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_DMatch_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_DMatch_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_DMatch_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector[i].size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - IntPtr[] size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_DMatch_getSize2(ptr, size2Org); - long[] size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_DMatch_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public DMatch[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new DMatch[0][]; - long[] size2 = Size2; - - DMatch[][] ret = new DMatch[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new DMatch[size2[i]]; - } - using (ArrayAddress2 retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_DMatch_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorDouble.cs b/src/OpenCvSharp/Vector/VectorOfVectorDouble.cs deleted file mode 100644 index 1478e0834..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorDouble.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorDouble : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorDouble() - { - ptr = NativeMethods.vector_vector_double_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorDouble(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_double_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_double_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_double_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector[i].size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - IntPtr[] size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_double_getSize2(ptr, size2Org); - long[] size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_double_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public double[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new double[0][]; - long[] size2 = Size2; - - var ret = new double[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new double[size2[i]]; - } - using (var retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_double_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorFloat.cs b/src/OpenCvSharp/Vector/VectorOfVectorFloat.cs deleted file mode 100644 index ca463281e..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorFloat.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorFloat : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorFloat() - { - ptr = NativeMethods.vector_vector_float_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorFloat(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_float_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_float_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_float_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector[i].size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - IntPtr[] size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_float_getSize2(ptr, size2Org); - long[] size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_float_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public float[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new float[0][]; - long[] size2 = Size2; - - var ret = new float[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new float[size2[i]]; - } - using (var retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_float_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorInt.cs b/src/OpenCvSharp/Vector/VectorOfVectorInt.cs deleted file mode 100644 index c7a95f4f8..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorInt.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorInt : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorInt() - { - ptr = NativeMethods.vector_vector_int_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorInt(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_int_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_int_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_int_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector[i].size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - IntPtr[] size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_int_getSize2(ptr, size2Org); - long[] size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_int_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public int[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new int[0][]; - long[] size2 = Size2; - - var ret = new int[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new int[size2[i]]; - } - using (var retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_int_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorKeyPoint.cs b/src/OpenCvSharp/Vector/VectorOfVectorKeyPoint.cs deleted file mode 100644 index 99a7b42e7..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorKeyPoint.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorKeyPoint : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorKeyPoint() - { - ptr = NativeMethods.vector_vector_KeyPoint_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorKeyPoint(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_KeyPoint_new2(new IntPtr(size)); - } - - /// - /// - /// - /// - public VectorOfVectorKeyPoint(KeyPoint[][] values) - { - if (values == null) - throw new ArgumentNullException(nameof(values)); - - using (var aa = new ArrayAddress2(values)) - { - ptr = NativeMethods.vector_vector_KeyPoint_new3( - aa.Pointer, aa.Dim1Length, aa.Dim2Lengths); - } - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_KeyPoint_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_KeyPoint_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector[i].size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - IntPtr[] size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_KeyPoint_getSize2(ptr, size2Org); - long[] size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_KeyPoint_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public KeyPoint[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new KeyPoint[0][]; - long[] size2 = Size2; - - var ret = new KeyPoint[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new KeyPoint[size2[i]]; - } - using (var retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_KeyPoint_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorPoint.cs b/src/OpenCvSharp/Vector/VectorOfVectorPoint.cs deleted file mode 100644 index 99e3a74c3..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorPoint.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorPoint : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorPoint() - { - ptr = NativeMethods.vector_vector_Point_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorPoint(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfVectorPoint(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_Point_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_Point_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_Point_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector.size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - IntPtr[] size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_Point_getSize2(ptr, size2Org); - long[] size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_Point_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Point[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new Point[0][]; - long[] size2 = Size2; - - Point[][] ret = new Point[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new Point[size2[i]]; - } - using (ArrayAddress2 retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_Point_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/Vector/VectorOfVectorPoint2f.cs b/src/OpenCvSharp/Vector/VectorOfVectorPoint2f.cs deleted file mode 100644 index 1fa4e8e02..000000000 --- a/src/OpenCvSharp/Vector/VectorOfVectorPoint2f.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class VectorOfVectorPoint2f : DisposableCvObject, IStdVector - { - /// - /// - /// - public VectorOfVectorPoint2f() - { - ptr = NativeMethods.vector_vector_Point2f_new1(); - } - - /// - /// - /// - /// - public VectorOfVectorPoint2f(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - public VectorOfVectorPoint2f(int size) - { - if (size < 0) - throw new ArgumentOutOfRangeException(nameof(size)); - ptr = NativeMethods.vector_vector_Point2f_new2(new IntPtr(size)); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.vector_vector_Point2f_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// vector.size() - /// - public int Size1 - { - get { return NativeMethods.vector_vector_Point2f_getSize1(ptr).ToInt32(); } - } - - /// - /// - /// - public int Size - { - get { return Size1; } - } - - /// - /// vector[i].size() - /// - public long[] Size2 - { - get - { - int size1 = Size1; - var size2Org = new IntPtr[size1]; - NativeMethods.vector_vector_Point2f_getSize2(ptr, size2Org); - var size2 = new long[size1]; - for (int i = 0; i < size1; i++) - { - size2[i] = size2Org[i].ToInt64(); - } - return size2; - } - } - - /// - /// &vector[0] - /// - public IntPtr ElemPtr - { - get { return NativeMethods.vector_vector_Point2f_getPointer(ptr); } - } - - /// - /// Converts std::vector to managed array - /// - /// - public Point2f[][] ToArray() - { - int size1 = Size1; - if (size1 == 0) - return new Point2f[0][]; - long[] size2 = Size2; - - var ret = new Point2f[size1][]; - for (int i = 0; i < size1; i++) - { - ret[i] = new Point2f[size2[i]]; - } - using (var retPtr = new ArrayAddress2(ret)) - { - NativeMethods.vector_vector_Point2f_copy(ptr, retPtr); - } - return ret; - } - } -} diff --git a/src/OpenCvSharp/modules/bgsegm/BackgroundSubtractorGMG.cs b/src/OpenCvSharp/modules/bgsegm/BackgroundSubtractorGMG.cs deleted file mode 100644 index e9b2540ff..000000000 --- a/src/OpenCvSharp/modules/bgsegm/BackgroundSubtractorGMG.cs +++ /dev/null @@ -1,244 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// Background Subtractor module. Takes a series of images and returns a sequence of mask (8UC1) - /// images of the same size, where 255 indicates Foreground and 0 represents Background. - /// - public class BackgroundSubtractorGMG : BackgroundSubtractor - { - /// - /// cv::Ptr<T> - /// - private Ptr objectPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - /// - public static BackgroundSubtractorGMG Create( - int initializationFrames = 120, double decisionThreshold = 0.8) - { - IntPtr ptr = NativeMethods.bgsegm_createBackgroundSubtractorGMG( - initializationFrames, decisionThreshold); - return new BackgroundSubtractorGMG(ptr); - } - - internal BackgroundSubtractorGMG(IntPtr ptr) - { - this.objectPtr = new Ptr(ptr); - this.ptr = objectPtr.Get(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - objectPtr?.Dispose(); - objectPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int MaxFeatures - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getMaxFeatures(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setMaxFeatures(ptr, value); - } - } - - /// - /// - /// - public double DefaultLearningRate - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getDefaultLearningRate(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setDefaultLearningRate(ptr, value); - } - } - - /// - /// - /// - public int NumFrames - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getNumFrames(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setNumFrames(ptr, value); - } - } - - /// - /// - /// - public int QuantizationLevels - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getQuantizationLevels(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setQuantizationLevels(ptr, value); - } - } - - /// - /// - /// - public double BackgroundPrior - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getBackgroundPrior(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setBackgroundPrior(ptr, value); - } - } - - /// - /// - /// - public int SmoothingRadius - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getSmoothingRadius(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setSmoothingRadius(ptr, value); - } - } - - /// - /// - /// - public double DecisionThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getDecisionThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setDecisionThreshold(ptr, value); - } - } - - /// - /// - /// - public bool UpdateBackgroundModel - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getUpdateBackgroundModel(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setUpdateBackgroundModel(ptr, value ? 1 : 0); - } - } - - /// - /// - /// - public double MinVal - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getMinVal(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setMinVal(ptr, value); - } - } - - /// - /// - /// - public double MaxVal - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorGMG_getMaxVal(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorGMG_setMaxVal(ptr, value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.bgsegm_Ptr_BackgroundSubtractorGMG_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.bgsegm_Ptr_BackgroundSubtractorGMG_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/bgsegm/BackgroundSubtractorMOG.cs b/src/OpenCvSharp/modules/bgsegm/BackgroundSubtractorMOG.cs deleted file mode 100644 index 44e4e82b5..000000000 --- a/src/OpenCvSharp/modules/bgsegm/BackgroundSubtractorMOG.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm - /// - public class BackgroundSubtractorMOG : BackgroundSubtractor - { - /// - /// cv::Ptr<T> - /// - private Ptr objectPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - /// - /// - /// - public static BackgroundSubtractorMOG Create( - int history = 200, int nMixtures = 5, double backgroundRatio = 0.7, double noiseSigma = 0) - { - IntPtr ptr = NativeMethods.bgsegm_createBackgroundSubtractorMOG( - history, nMixtures, backgroundRatio, noiseSigma); - return new BackgroundSubtractorMOG(ptr); - } - - internal BackgroundSubtractorMOG(IntPtr ptr) - { - this.objectPtr = new Ptr(ptr); - this.ptr = objectPtr.Get(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - objectPtr?.Dispose(); - objectPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int History - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorMOG_getHistory(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorMOG_setHistory(ptr, value); - } - } - - /// - /// - /// - public int NMixtures - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorMOG_getNMixtures(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorMOG_setNMixtures(ptr, value); - } - } - - /// - /// - /// - public double BackgroundRatio - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorMOG_getBackgroundRatio(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorMOG_setBackgroundRatio(ptr, value); - } - } - - /// - /// - /// - public double NoiseSigma - { - get - { - ThrowIfDisposed(); - return NativeMethods.bgsegm_BackgroundSubtractorMOG_getNoiseSigma(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.bgsegm_BackgroundSubtractorMOG_setNoiseSigma(ptr, value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.bgsegm_Ptr_BackgroundSubtractorMOG_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.bgsegm_Ptr_BackgroundSubtractorMOG_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/calib3d/Enum/CalibrationFlags.cs b/src/OpenCvSharp/modules/calib3d/Enum/CalibrationFlags.cs deleted file mode 100644 index 75408aea0..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/CalibrationFlags.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvCalibrateCamera2やcvStereoCalibrateの処理フラグ - /// -#else - /// - /// Different flags for cvCalibrateCamera2 and cvStereoCalibrate - /// -#endif - [Flags] - public enum CalibrationFlags : int - { - /// - /// - /// - None = 0, - -#if LANG_JP - /// - /// intrinsic_matrixは最適化が行われた正しい初 期値 fx, fy, cx, cyを含む.このパラメータがセッ トされていない場合,(cx, cy) は最初に画像中心にセットされ(image_size はこの計算に用いられ る),焦点距離は最小二乗法で計算される. - /// -#else - /// - /// The flag allows the function to optimize some or all of the intrinsic parameters, depending on the other flags, but the initial values are provided by the user - /// -#endif - UseIntrinsicGuess = 0x00001, - -#if LANG_JP - /// - /// fx と fy のうちのどちらか一方だけが独立変数であるとし,アスペクト比 fx/fy が intrinsic_matrix の初期値として与えられた値か ら変わらないように最適化処理を行う. - /// この場合,実際に用いられる(fx, fy)の初期値は,行列から与えられる (CV_CALIB_USE_INTRINSIC_GUESSがセットされている場合)か,何らかの方法で推定される(後者の場合は, fx, fy は任意の値にセットされ,それらの比率だけが用いられる). - /// -#else - /// - /// fyk is optimized, but the ratio fxk/fyk is fixed. - /// -#endif - FixAspectRatio = 0x00002, - -#if LANG_JP - /// - /// 主点(光学中心) は最適化中には変化せず,中心または別の指定された場所(このパラメータと同時 に UseIntrinsicGuess がセットされ ている場合)に固定される - /// -#else - /// - /// The principal points are fixed during the optimization. - /// -#endif - FixPrincipalPoint = 0x00004, - -#if LANG_JP - /// - /// 円周方向の歪み係数は0にセットされ,最適化中は変化しない - /// -#else - /// - /// Tangential distortion coefficients are set to zeros and do not change during the optimization. - /// -#endif - ZeroTangentDist = 0x00008, - -#if LANG_JP - /// - /// fxk および fyk が固定される. - /// -#else - /// - /// fxk and fyk are fixed. - /// -#endif - FixFocalLength = 0x00010, - -#if LANG_JP - /// - /// 0 番目の歪み係数(k1)が固定される. - /// -#else - /// - /// The 0-th distortion coefficients (k1) are fixed - /// -#endif - FixK1 = 0x00020, - - -#if LANG_JP - /// - /// 1 番目の歪み係数(k2)が固定される. - /// -#else - /// - /// The 1-th distortion coefficients (k2) are fixed - /// -#endif - FixK2 = 0x00040, - - -#if LANG_JP - /// - /// 4 番目の歪み係数(k3)が固定される. - /// -#else - /// - /// The 4-th distortion coefficients (k3) are fixed - /// -#endif - FixK3 = 0x00080, - - -#if LANG_JP - /// - /// 最適化中に,指定した半径方向の歪み係数を変更しません. - /// CV_CALIB_USE_INTRINSIC_GUESS が指定されている場合は,与えられた distCoeffs 行列の係数が利用されます.そうでない場合は,0が利用されます. - /// -#else - /// - /// Do not change the corresponding radial distortion coefficient during the optimization. - /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. - /// -#endif - FixK4 = 0x00800, - - -#if LANG_JP - /// - /// 最適化中に,指定した半径方向の歪み係数を変更しません. - /// CV_CALIB_USE_INTRINSIC_GUESS が指定されている場合は,与えられた distCoeffs 行列の係数が利用されます.そうでない場合は,0が利用されます. - /// -#else - /// - /// Do not change the corresponding radial distortion coefficient during the optimization. - /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. - /// -#endif - FixK5 = 0x01000, - - -#if LANG_JP - /// - /// 最適化中に,指定した半径方向の歪み係数を変更しません. - /// CV_CALIB_USE_INTRINSIC_GUESS が指定されている場合は,与えられた distCoeffs 行列の係数が利用されます.そうでない場合は,0が利用されます. - /// -#else - /// - /// Do not change the corresponding radial distortion coefficient during the optimization. - /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. - /// -#endif - FixK6 = 0x02000, - -#if LANG_JP - /// - /// 係数 k4, k5, k6 を有効にします. - /// 後方互換性を保つためには,このフラグを明示的に指定して,キャリブレーション関数が rational モデルを利用して8個の係数を返すようにします. - /// このフラグが指定されない場合,関数は5つの歪み係数のみを計算し ます. - /// -#else - /// - /// Enable coefficients k4, k5 and k6. - /// To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function - /// use the rational model and return 8 coefficients. If the flag is not set, the function will compute only 5 distortion coefficients. - /// -#endif - RationalModel = 0x04000, - - /// - /// - /// - ThinPrismModel = 0x08000, - - /// - /// - /// - FixS1S2S3S4 = 0x08000, - -#if LANG_JP - /// - /// これがセットされた場合,外部パラメータのみが最適化されるように, camera_matrix1,2 と dist_coeffs1,2 が固定される. - /// -#else - /// - /// If it is set, camera_matrix1,2, as well as dist_coeffs1,2 are fixed, so that only extrinsic parameters are optimized. - /// -#endif - FixIntrinsic = 0x00100, - -#if LANG_JP - /// - /// 強制的に,fx0=fx1, fy0=fy1 とする. - /// -#else - /// - /// Enforces fx0=fx1 and fy0=fy1. CV_CALIB_ZERO_TANGENT_DIST - Tangential distortion coefficients for each camera are set to zeros and fixed there. - /// -#endif - SameFocalLength = 0x00200, - - /// - /// for stereo rectification - /// - ZeroDisparity = 0x00400, - } -} - - - diff --git a/src/OpenCvSharp/modules/calib3d/Enum/ChessboardFlags.cs b/src/OpenCvSharp/modules/calib3d/Enum/ChessboardFlags.cs deleted file mode 100644 index 0d2a5271c..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/ChessboardFlags.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvFindChessboardCornersの処理フラグ - /// -#else - /// - /// Various operation flags for cvFindChessboardCorners - /// -#endif - [Flags] - public enum ChessboardFlags - { - /// - /// - /// - None = 0, - -#if LANG_JP - /// - /// 画像を二値化する際に,固定の閾値を使うのではなく,(画像の平均輝度値から計算される)適応的な閾値を用いる - /// -#else - /// - /// Use adaptive thresholding to convert the image to black-n-white, rather than a fixed threshold level (computed from the average image brightness). - /// -#endif - AdaptiveThresh = 1, - - -#if LANG_JP - /// - /// 固定閾値処理または適応的閾値処理を行う前に,cvNormalizeHistを用いて画像を正規化する - /// -#else - /// - /// Normalize the image using cvNormalizeHist before applying fixed or adaptive thresholding. - /// -#endif - NormalizeImage = 2, - - -#if LANG_JP - /// - /// 輪郭の探索 段階で抽出される間違った四角形を無視するために,追加基準(輪郭面積,周囲長,形は正方形など)を使用する - /// -#else - /// - /// Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads that are extracted at the contour retrieval stage. - /// -#endif - FilterQuads = 4, - - /// - /// - /// - FastCheck = 8 - } -} diff --git a/src/OpenCvSharp/modules/calib3d/Enum/FindCirclesGridFlags.cs b/src/OpenCvSharp/modules/calib3d/Enum/FindCirclesGridFlags.cs deleted file mode 100644 index 5cdf751db..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/FindCirclesGridFlags.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -namespace OpenCvSharp -{ - /// - /// Method for solving a PnP problem: - /// - [Flags] - public enum FindCirclesGridFlags : int - { - /// - /// uses symmetric pattern of circles. - /// - SymmetricGrid = 1, - - /// - /// uses asymmetric pattern of circles. - /// - AsymmetricGrid = 2, - - /// - /// uses a special algorithm for grid detection. It is more robust to perspective distortions but much more sensitive to background clutter. - /// - Clustering = 4, - } -} diff --git a/src/OpenCvSharp/modules/calib3d/Enum/FundamentalMatMethod.cs b/src/OpenCvSharp/modules/calib3d/Enum/FundamentalMatMethod.cs deleted file mode 100644 index 1dc19b2f1..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/FundamentalMatMethod.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 基礎行列の計算手法 - /// -#else - /// - /// Method for computing the fundamental matrix - /// -#endif - [Flags] - public enum FundamentalMatMethod : int - { -#if LANG_JP - /// - /// 7-pointアルゴリズム. N == 7 - /// -#else - /// - /// for 7-point algorithm. N == 7 - /// -#endif - Point7 = 1, - -#if LANG_JP - /// - /// 8-pointアルゴリズム. N > 8 - /// -#else - /// - /// for 8-point algorithm. N >= 8 - /// [CV_FM_8POINT] - /// -#endif - Point8 = 2, - -#if LANG_JP - /// - /// LMedSアルゴリズム. N >= 8 - /// -#else - /// - /// for LMedS algorithm. N > 8 - /// -#endif - LMedS = 4, - - -#if LANG_JP - /// - /// RANSAC アルゴリズム. N > 8 - /// [CV_FM_RANSAC] - /// -#else - /// - /// for RANSAC algorithm. N > 8 - /// -#endif - Ransac = 8, - } -} diff --git a/src/OpenCvSharp/modules/calib3d/Enum/HomographyMethods.cs b/src/OpenCvSharp/modules/calib3d/Enum/HomographyMethods.cs deleted file mode 100644 index e61a3f9ce..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/HomographyMethods.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// ホモグラフィ行列を計算するための手法 - /// -#else - /// - /// The method used to computed homography matrix - /// -#endif - [Flags] - public enum HomographyMethods : int - { -#if LANG_JP - /// - /// 全ての点のペアを利用する標準的な手法 - /// -#else - /// - /// Regular method using all the point pairs - /// -#endif - None = 0, - - -#if LANG_JP - /// - /// LMedS推定によるロバストな手法 - /// -#else - /// - /// Least-Median robust method - /// -#endif - LMedS = 4, - - -#if LANG_JP - /// - /// RANSACアルゴリズムに基づくロバストな手法 - /// -#else - /// - /// RANSAC-based robust method - /// -#endif - Ransac = 8, - - /// - /// RHO algorithm - /// - Rho = 16, - } -} diff --git a/src/OpenCvSharp/modules/calib3d/Enum/SolvePnPFlags.cs b/src/OpenCvSharp/modules/calib3d/Enum/SolvePnPFlags.cs deleted file mode 100644 index a28659007..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/SolvePnPFlags.cs +++ /dev/null @@ -1,39 +0,0 @@ - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// Method for solving a PnP problem: - /// - public enum SolvePnPFlags : int - { - /// - /// Iterative method is based on Levenberg-Marquardt optimization. - /// In this case the function finds such a pose that minimizes reprojection error, - /// that is the sum of squared distances between the observed projections imagePoints and the projected (using projectPoints() ) objectPoints . - /// - Iterative = 0, - - /// - /// Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the paper “EPnP: Efficient Perspective-n-Point Camera Pose Estimation”. - /// - EPNP = 1, - - /// - /// Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang“Complete Solution Classification for - /// the Perspective-Three-Point Problem”. In this case the function requires exactly four object and image points. - /// - P3P = 2, - - /// - /// Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP" - /// - DLS = 3, - - /// - /// A.Penate-Sanchez, J.Andrade-Cetto, F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation" - /// - UPNP = 4, - } -} diff --git a/src/OpenCvSharp/modules/calib3d/Enum/StereoRectificationFlags.cs b/src/OpenCvSharp/modules/calib3d/Enum/StereoRectificationFlags.cs deleted file mode 100644 index e306822fe..000000000 --- a/src/OpenCvSharp/modules/calib3d/Enum/StereoRectificationFlags.cs +++ /dev/null @@ -1,40 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 輪郭の近似手法 - /// -#else - /// - /// The operation flags for cvStereoRectify - /// -#endif - public enum StereoRectificationFlags : int - { -#if LANG_JP - /// - /// フラグなし (=0). - /// 利用できる画像領域が最大になるように(エピポーラ線の傾きに従って)片方の画像を水平・垂直方向に移動する. - /// -#else - /// - /// Default value (=0). - /// the function can shift one of the image in horizontal or vertical direction (depending on the orientation of epipolar lines) in order to maximise the useful image area. - /// -#endif - None = 0, - - -#if LANG_JP - /// - /// 平行化後のビューにおいて各カメラの主点(光学中心)が同じ座標になるようにする. - /// -#else - /// - /// the function makes the principal points of each camera have the same pixel coordinates in the rectified views. - /// -#endif - ZeroDisparity = 1024, - }; -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/calib3d/StereoBM.cs b/src/OpenCvSharp/modules/calib3d/StereoBM.cs deleted file mode 100644 index e0384986b..000000000 --- a/src/OpenCvSharp/modules/calib3d/StereoBM.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming -#pragma warning disable 1591 - -#if LANG_JP - /// - /// セミグローバルブロックマッチングアルゴリズムを用てステレオ対応点探索を行うためのクラス - /// -#else - /// - /// Semi-Global Stereo Matching - /// -#endif - public class StereoBM : StereoMatcher - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// constructor - /// - protected StereoBM(IntPtr ptr) - : base(ptr) - { - ptrObj = new Ptr(ptr); - } - - /// - /// - /// - /// - /// - /// - public static StereoBM Create(int numDisparities = 0, int blockSize = 21) - { - IntPtr ptrObj = NativeMethods.calib3d_StereoBM_create(numDisparities, blockSize); - return new StereoBM(ptrObj); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int PreFilterType - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getPreFilterType(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setPreFilterType(ptr, value); - } - } - - /// - /// - /// - public int PreFilterSize - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getPreFilterSize(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setPreFilterSize(ptr, value); - } - } - - /// - /// - /// - public int PreFilterCap - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getPreFilterCap(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setPreFilterCap(ptr, value); - } - } - - /// - /// - /// - public int TextureThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getTextureThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setTextureThreshold(ptr, value); - } - } - - /// - /// - /// - public int UniquenessRatio - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getUniquenessRatio(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setUniquenessRatio(ptr, value); - } - } - - /// - /// - /// - public int SmallerBlockSize - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getSmallerBlockSize(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setSmallerBlockSize(ptr, value); - } - } - - /// - /// - /// - public Rect ROI1 - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getROI1(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setROI1(ptr, value); - } - } - - /// - /// - /// - public Rect ROI2 - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoBM_getROI2(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoBM_setROI2(ptr, value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.calib3d_Ptr_StereoBM_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.calib3d_Ptr_StereoBM_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/calib3d/StereoMatcher.cs b/src/OpenCvSharp/modules/calib3d/StereoMatcher.cs deleted file mode 100644 index 157bc211c..000000000 --- a/src/OpenCvSharp/modules/calib3d/StereoMatcher.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming -#pragma warning disable 1591 - - /// - /// The base class for stereo correspondence algorithms. - /// - public class StereoMatcher : Algorithm - { - /// - /// constructor - /// - protected StereoMatcher(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// Computes disparity map for the specified stereo pair - /// - /// Left 8-bit single-channel image. - /// Right image of the same size and the same type as the left one. - /// Output disparity map. It has the same size as the input images. Some algorithms, - /// like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map(where each disparity value has 4 fractional bits), - /// whereas other algorithms output 32 - bit floating - point disparity map. - public virtual void Compute(InputArray left, InputArray right, OutputArray disparity) - { - if (left == null) - throw new ArgumentNullException(nameof(left)); - if (right == null) - throw new ArgumentNullException(nameof(right)); - if (disparity == null) - throw new ArgumentNullException(nameof(disparity)); - left.ThrowIfDisposed(); - right.ThrowIfDisposed(); - disparity.ThrowIfNotReady(); - NativeMethods.calib3d_StereoMatcher_compute(ptr, left.CvPtr, right.CvPtr, disparity.CvPtr); - GC.KeepAlive(left); - GC.KeepAlive(right); - disparity.Fix(); - } - - #region Properties - - /// - /// - /// - public int MinDisparity - { - get - { - return NativeMethods.calib3d_StereoMatcher_getMinDisparity(ptr); - } - set - { - NativeMethods.calib3d_StereoMatcher_setMinDisparity(ptr, value); - } - } - - /// - /// - /// - public int NumDisparities - { - get - { - return NativeMethods.calib3d_StereoMatcher_getNumDisparities(ptr); - } - set - { - NativeMethods.calib3d_StereoMatcher_setNumDisparities(ptr, value); - } - } - - /// - /// - /// - public int BlockSize - { - get - { - return NativeMethods.calib3d_StereoMatcher_getBlockSize(ptr); - } - set - { - NativeMethods.calib3d_StereoMatcher_setBlockSize(ptr, value); - } - } - - /// - /// - /// - public int SpeckleWindowSize - { - get - { - return NativeMethods.calib3d_StereoMatcher_getSpeckleWindowSize(ptr); - } - set - { - NativeMethods.calib3d_StereoMatcher_setSpeckleWindowSize(ptr, value); - } - } - - /// - /// - /// - public int SpeckleRange - { - get - { - return NativeMethods.calib3d_StereoMatcher_getSpeckleRange(ptr); - } - set - { - NativeMethods.calib3d_StereoMatcher_setSpeckleRange(ptr, value); - } - } - - /// - /// - /// - public int Disp12MaxDiff - { - get - { - return NativeMethods.calib3d_StereoMatcher_getDisp12MaxDiff(ptr); - } - set - { - NativeMethods.calib3d_StereoMatcher_setDisp12MaxDiff(ptr, value); - } - } - - #endregion - - } -} diff --git a/src/OpenCvSharp/modules/calib3d/StereoSGBM.cs b/src/OpenCvSharp/modules/calib3d/StereoSGBM.cs deleted file mode 100644 index 64c35c09a..000000000 --- a/src/OpenCvSharp/modules/calib3d/StereoSGBM.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming -#pragma warning disable 1591 - - /// - /// - /// - public enum StereoSGBMMode - { - SGBM = 0, - HH = 1, - } - -#if LANG_JP - /// - /// セミグローバルブロックマッチングアルゴリズムを用てステレオ対応点探索を行うためのクラス - /// -#else - /// - /// Semi-Global Stereo Matching - /// -#endif - public class StereoSGBM : StereoMatcher - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// constructor - /// - protected StereoSGBM(IntPtr ptr) : base(ptr) - { - ptrObj = new Ptr(ptr); - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static StereoSGBM Create( - int minDisparity, int numDisparities, int blockSize, - int p1 = 0, int p2 = 0, int disp12MaxDiff = 0, - int preFilterCap = 0, int uniquenessRatio = 0, - int speckleWindowSize = 0, int speckleRange = 0, - StereoSGBMMode mode = StereoSGBMMode.SGBM) - { - IntPtr ptrObj = NativeMethods.calib3d_StereoSGBM_create( - minDisparity, numDisparities, blockSize, - p1, p2, disp12MaxDiff, preFilterCap, uniquenessRatio, - speckleWindowSize, speckleRange, (int) mode); - return new StereoSGBM(ptrObj); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int PreFilterCap - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoSGBM_getPreFilterCap(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoSGBM_setPreFilterCap(ptr, value); - } - } - - /// - /// - /// - public int UniquenessRatio - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoSGBM_getUniquenessRatio(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoSGBM_setUniquenessRatio(ptr, value); - } - } - - /// - /// - /// - public int P1 - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoSGBM_getP1(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoSGBM_setP1(ptr, value); - } - } - - /// - /// - /// - public int P2 - { - get - { - ThrowIfDisposed(); - return NativeMethods.calib3d_StereoSGBM_getP2(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoSGBM_setP2(ptr, value); - } - } - - /// - /// - /// - public StereoSGBMMode Mode - { - get - { - ThrowIfDisposed(); - return (StereoSGBMMode)NativeMethods.calib3d_StereoSGBM_getMode(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.calib3d_StereoSGBM_setMode(ptr, (int)value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.calib3d_Ptr_StereoSGBM_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.calib3d_Ptr_StereoSGBM_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Algorithm.cs b/src/OpenCvSharp/modules/core/Algorithm.cs deleted file mode 100644 index 63b3df7cf..000000000 --- a/src/OpenCvSharp/modules/core/Algorithm.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Base class for high-level OpenCV algorithms - /// - public abstract class Algorithm : DisposableCvObject - { - /// - /// Stores algorithm parameters in a file storage - /// - /// - public virtual void Write(FileStorage fs) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - - NativeMethods.core_Algorithm_write(ptr, fs.CvPtr); - } - - /// - /// Reads algorithm parameters from a file storage - /// - /// - public virtual void Read(FileNode fn) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (fn == null) - throw new ArgumentNullException(nameof(fn)); - - NativeMethods.core_Algorithm_read(ptr, fn.CvPtr); - } - - /// - /// Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read - /// - /// - public virtual bool Empty - { - get - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - - return NativeMethods.core_Algorithm_empty(ptr) != 0; - } - } - - /// - /// Saves the algorithm to a file. - /// In order to make this method work, the derived class must - /// implement Algorithm::write(FileStorage fs). - /// - /// - public virtual void Save(string filename) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (filename == null) - throw new ArgumentNullException(nameof(filename)); - - NativeMethods.core_Algorithm_save(ptr, filename); - } - - /// - /// Returns the algorithm string identifier. - /// This string is used as top level xml/yml node tag when the object - /// is saved to a file or string. - /// - /// - public virtual String GetDefaultName() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - - var buf = new StringBuilder(1024); - NativeMethods.core_Algorithm_getDefaultName(ptr, buf, buf.Capacity); - return buf.ToString(); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/AlgorithmParamType.cs b/src/OpenCvSharp/modules/core/Enum/AlgorithmParamType.cs deleted file mode 100644 index f2e58e8db..000000000 --- a/src/OpenCvSharp/modules/core/Enum/AlgorithmParamType.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - /// - /// cv::Algorithm parameter type - /// - public enum AlgorithmParamType : int - { - Int = 0, - Boolean = 1, - Real = 2, - String = 3, - Mat = 4, - MatVector = 5, - Algorithm = 6, - Float = 7, - UnsignedInt = 8, - UInt64 = 9, - Short = 10, - UChar = 11 - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/CmpTypes.cs b/src/OpenCvSharp/modules/core/Enum/CmpTypes.cs deleted file mode 100644 index 8a79cadb8..000000000 --- a/src/OpenCvSharp/modules/core/Enum/CmpTypes.cs +++ /dev/null @@ -1,88 +0,0 @@ - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// cvCmp, cvCmpS等のメソッドで用いる, CvArrの比較方法 - /// -#else - /// - /// The flag specifying the relation between the elements to be checked - /// -#endif - public enum CmpTypes : int - { -#if LANG_JP - /// - /// src1(I) と value は等しい - /// -#else - /// - /// src1(I) "equal to" src2(I) - /// -#endif - EQ = 0, - - -#if LANG_JP - /// - /// src1(I) は value より大きい - /// -#else - /// - /// src1(I) "greater than" src2(I) - /// -#endif - GT = 1, - - -#if LANG_JP - /// - /// src1(I) は value より大きいか等しい - /// -#else - /// - /// src1(I) "greater or equal" src2(I) - /// -#endif - GE = 2, - - -#if LANG_JP - /// - /// src1(I) は value より小さい - /// -#else - /// - /// src1(I) "less than" src2(I) - /// -#endif - LT = 3, - - -#if LANG_JP - /// - /// src1(I) は value より小さいか等しい - /// -#else - /// - /// src1(I) "less or equal" src2(I) - /// -#endif - LE = 4, - - -#if LANG_JP - /// - /// src1(I) と value は等しくない - /// -#else - /// - /// src1(I) "not equal to" src2(I) - /// -#endif - NE = 5, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/CovarFlags.cs b/src/OpenCvSharp/modules/core/Enum/CovarFlags.cs deleted file mode 100644 index ad8e418f4..000000000 --- a/src/OpenCvSharp/modules/core/Enum/CovarFlags.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// CovarMatrixの処理フラグ - /// -#else - /// - /// Operation flags for Covariation - /// -#endif - [Flags] - public enum CovarFlags : int - { -#if LANG_JP - /// - /// scale * [vects[0]-avg,vects[1]-avg,...]^T * [vects[0]-avg,vects[1]-avg,...] - /// すなわち,共変動行列はcount×countである. そのような一般的でない共変動行列は, - /// 非常に大きなベクトル集合に対する高速な主成分分析のために使用される(例えば,顔認識のための固有顔). - /// この「スクランブルされた」行列の固有値は,真共変動行列の固有値と一致し, - /// そして「真の」固有ベクトルは「スクランブルされた」共変動行列の固有ベクトルから容易に計算できる. - /// -#else - /// - /// scale * [vects[0]-avg,vects[1]-avg,...]^T * [vects[0]-avg,vects[1]-avg,...] - /// that is, the covariation matrix is count×count. Such an unusual covariation matrix is used for fast PCA of a set of very large vectors - /// (see, for example, Eigen Faces technique for face recognition). Eigenvalues of this "scrambled" matrix will match to the eigenvalues of - /// the true covariation matrix and the "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariation matrix. - /// -#endif - Scrambled = 0, - - -#if LANG_JP - /// - /// scale * [vects[0]-avg,vects[1]-avg,...]*[vects[0]-avg,vects[1]-avg,...]^T - /// つまり,cov_matはすべての入力ベクトルの要素の合計と同じサイズの一般的な共変動行列となる. - /// CV_COVAR_SCRAMBLEDとCV_COVAR_NORMALのどちらか一つは必ず指定されなくてはならない. - /// -#else - /// - /// scale * [vects[0]-avg,vects[1]-avg,...]*[vects[0]-avg,vects[1]-avg,...]^T - /// that is, cov_mat will be a usual covariation matrix with the same linear size as the total number of elements in every input vector. - /// One and only one of CV_COVAR_SCRAMBLED and CV_COVAR_NORMAL must be specified - /// -#endif - Normal = 1, - - -#if LANG_JP - /// - /// このフラグが指定された場合,関数は入力ベクトルから平均を計算せず,引数で指定された平均ベクトルを使用する. - /// 平均が何らかの方法で既に計算されている場合,または共変動行列が部分的に計算されている場合 (この場合,avgは入力ベクトルの一部の平均ではなく,全ての平均ベクトルである)に有用である. - /// -#else - /// - /// If the flag is specified, the function does not calculate avg from the input vectors, - /// but, instead, uses the passed avg vector. This is useful if avg has been already calculated somehow, - /// or if the covariation matrix is calculated by parts - in this case, avg is not a mean vector of the input sub-set of vectors, - /// but rather the mean vector of the whole set. - /// -#endif - UseAvg = 2, - - -#if LANG_JP - /// - /// このフラグが指定された場合, 共変動行列は入力ベクトルの数によってスケーリングされる. - /// -#else - /// - /// If the flag is specified, the covariation matrix is scaled by the number of input vectors. - /// -#endif - Scale = 4, - - -#if LANG_JP - /// - /// 全ての入力ベクトルは単一の行列(vects[0])の行として保存されることを意味する. - /// そしてavgは適切な大きさの1行のベクトルでなければならない. - /// -#else - /// - /// Means that all the input vectors are stored as rows of a single matrix, vects[0].count is ignored in this case, - /// and avg should be a single-row vector of an appropriate size. - /// -#endif - Rows = 8, - - -#if LANG_JP - /// - /// 全ての入力ベクトルは単一の行列(vects[0])の列として保存されることを意味する.そしてavgは適切な大きさの1列のベクトルでなければならない. - /// -#else - /// - /// Means that all the input vectors are stored as columns of a single matrix, vects[0].count is ignored in this case, - /// and avg should be a single-column vector of an appropriate size. - /// -#endif - Cols = 16, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/CpuFeatures.cs b/src/OpenCvSharp/modules/core/Enum/CpuFeatures.cs deleted file mode 100644 index d2e9d7791..000000000 --- a/src/OpenCvSharp/modules/core/Enum/CpuFeatures.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// - /// - public enum CpuFeatures : int - { -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - MMX = 1, - SSE = 2, - SSE2 = 3, - SSE3 = 4, - SSSE3 = 5, - SSE4_1 = 6, - SSE4_2 = 7, - POPCNT = 8, - - AVX = 10, - AVX2 = 11, - FMA3 = 12, - - AVX_512F = 13, - AVX_512BW = 14, - AVX_512CD = 15, - AVX_512DQ = 16, - AVX_512ER = 17, - AVX_512IFMA512 = 18, - AVX_512PF = 19, - AVX_512VBMI = 20, - AVX_512VL = 21, - - NEON = 100 - } -} - - diff --git a/src/OpenCvSharp/modules/core/Enum/CriteriaType.cs b/src/OpenCvSharp/modules/core/Enum/CriteriaType.cs deleted file mode 100644 index 1e96d6713..000000000 --- a/src/OpenCvSharp/modules/core/Enum/CriteriaType.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 終了条件の種類 - /// -#else - /// - /// Type of termination criteria - /// -#endif - [Flags] - public enum CriteriaType : int - { -#if LANG_JP - /// - /// 繰り返し回数による条件 - /// -#else - /// - /// the maximum number of iterations or elements to compute - /// -#endif - Count = 1, - - -#if LANG_JP - /// - /// 繰り返し回数による条件 - /// -#else - /// - /// the maximum number of iterations or elements to compute - /// -#endif - MaxIter = Count, - - -#if LANG_JP - /// - /// 目標精度(ε)による条件 - /// -#else - /// - /// the desired accuracy or change in parameters at which the iterative algorithm stops - /// -#endif - Eps = 2, - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/Enum/DctFlags.cs b/src/OpenCvSharp/modules/core/Enum/DctFlags.cs deleted file mode 100644 index 67c4edb86..000000000 --- a/src/OpenCvSharp/modules/core/Enum/DctFlags.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cv::dct の変換フラグ - /// -#else - /// - /// Transformation flags for cv::dct - /// -#endif - [Flags] -// ReSharper disable once InconsistentNaming - public enum DctFlags - { - /// - /// - /// - None = 0, - -#if LANG_JP - /// - /// 1次元または2次元の逆変換を行う.結果のスケーリングは行わない. - /// Forward と Inverse は,もちろん同時には指定できない. - /// -#else - /// - /// Do inverse 1D or 2D transform. - /// (Forward and Inverse are mutually exclusive, of course.) - /// -#endif - Inverse = 1, - - -#if LANG_JP - /// - /// 入力配列のそれぞれの行に対して独立に,順変換あるいは逆変換を行う. - /// このフラグは複数のベクトルの同時変換を許可し, - /// オーバーヘッド(一つの計算の何倍も大きくなることもある)を減らすためや, - /// 3次元以上の高次元に対して変換を行うために使用される. - /// [CV_DXT_ROWS] - /// -#else - /// - /// Do forward or inverse transform of every individual row of the input matrix. - /// This flag allows user to transform multiple vectors simultaneously and can be used to decrease the overhead - /// (which is sometimes several times larger than the processing itself), to do 3D and higher-dimensional transforms etc. - /// [CV_DXT_ROWS] - /// -#endif - Rows = 4, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/DecompTypes.cs b/src/OpenCvSharp/modules/core/Enum/DecompTypes.cs deleted file mode 100644 index f4ce1f84f..000000000 --- a/src/OpenCvSharp/modules/core/Enum/DecompTypes.cs +++ /dev/null @@ -1,66 +0,0 @@ - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// 逆行列を求める手法 - /// -#else - /// - /// Inversion methods - /// -#endif - public enum DecompTypes : int - { -#if LANG_JP - /// - /// 最適なピボット選択によるガウスの消去法 - /// [CV_LU] - /// -#else - /// - /// Gaussian elimination with the optimal pivot element chosen. - /// -#endif - - LU = 0, - -#if LANG_JP - /// - /// 特異値分解 - /// [CV_SVD] - /// -#else - /// - /// singular value decomposition (SVD) method; - /// the system can be over-defined and/or the matrix src1 can be singular - /// -#endif - SVD = 1, - - /// - /// eigenvalue decomposition; the matrix src1 must be symmetrical - /// - Eig = 2, - - /// - /// Cholesky \f$LL^T\f$ factorization; the matrix src1 must be symmetrical - /// and positively defined - /// - Cholesky = 3, - - /// - /// QR factorization; the system can be over-defined and/or the matrix - /// src1 can be singular - /// - QR = 4, - - /// - /// while all the previous flags are mutually exclusive, - /// this flag can be used together with any of the previous - /// - Normal = 16, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/DftFlags.cs b/src/OpenCvSharp/modules/core/Enum/DftFlags.cs deleted file mode 100644 index 980c79709..000000000 --- a/src/OpenCvSharp/modules/core/Enum/DftFlags.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvDFTの変換フラグ - /// -#else - /// - /// Transformation flags for cvDFT - /// -#endif - [Flags] - public enum DftFlags : int - { - /// - /// - /// - None = 0, - -#if LANG_JP - /// - /// 1次元または2次元の逆変換を行う.結果のスケーリングは行わない. - /// Forward と Inverse は,もちろん同時には指定できない. - /// -#else - /// - /// Do inverse 1D or 2D transform. The result is not scaled. - /// (Forward and Inverse are mutually exclusive, of course.) - /// -#endif - Inverse = 1, - - -#if LANG_JP - /// - /// 結果を配列要素数で割り,スケーリングする.通常は Inverse と同時に用いる. - /// ショートカットとして InvScale を用いても良い. - /// [CV_DXT_SCALE] - /// -#else - /// - /// Scale the result: divide it by the number of array elements. Usually, it is combined with Inverse. - /// -#endif - Scale = 2, - -#if LANG_JP - /// - /// 入力配列のそれぞれの行に対して独立に,順変換あるいは逆変換を行う. - /// このフラグは複数のベクトルの同時変換を許可し, - /// オーバーヘッド(一つの計算の何倍も大きくなることもある)を減らすためや, - /// 3次元以上の高次元に対して変換を行うために使用される. - /// -#else - /// - /// Do forward or inverse transform of every individual row of the input matrix. - /// This flag allows user to transform multiple vectors simultaneously and can be used to decrease the overhead - /// (which is sometimes several times larger than the processing itself), to do 3D and higher-dimensional transforms etc. - /// -#endif - Rows = 4, - - /// - /// performs a forward transformation of 1D or 2D real array; the result, - /// though being a complex array, has complex-conjugate symmetry (*CCS*, - /// see the function description below for details), and such an array can - /// be packed into a real array of the same size as input, which is the fastest - /// option and which is what the function does by default; however, you may - /// wish to get a full complex array (for simpler spectrum analysis, and so on) - - /// pass the flag to enable the function to produce a full-size complex output array. - /// - ComplexOutput = 16, - - /// - /// performs an inverse transformation of a 1D or 2D complex array; - /// the result is normally a complex array of the same size, however, - /// if the input array has conjugate-complex symmetry (for example, - /// it is a result of forward transformation with DFT_COMPLEX_OUTPUT flag), - /// the output is a real array; while the function itself does not - /// check whether the input is symmetrical or not, you can pass the flag - /// and then the function will assume the symmetry and produce the real - /// output array (note that when the input is packed into a real array - /// and inverse transformation is executed, the function treats the input - /// as a packed complex-conjugate symmetrical array, and the output - /// will also be a real array). - /// - RealOutput = 32, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/DistributionType.cs b/src/OpenCvSharp/modules/core/Enum/DistributionType.cs deleted file mode 100644 index 7fde85fd7..000000000 --- a/src/OpenCvSharp/modules/core/Enum/DistributionType.cs +++ /dev/null @@ -1,38 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvRandArrメソッド等で用いる, 分布のタイプ - /// -#else - /// - /// Distribution type for cvRandArr, etc. - /// -#endif - public enum DistributionType : int - { -#if LANG_JP - /// - /// 一様分布 - /// -#else - /// - /// Uniform distribution - /// -#endif - Uniform = 0, - - -#if LANG_JP - /// - /// 正規分布(ガウス分布) - /// -#else - /// - /// Normal or Gaussian distribution - /// -#endif - Normal = 1, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/DumpFormat.cs b/src/OpenCvSharp/modules/core/Enum/DumpFormat.cs deleted file mode 100644 index da60df48b..000000000 --- a/src/OpenCvSharp/modules/core/Enum/DumpFormat.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Output string format of Mat.Dump() - /// - public enum DumpFormat - { - /// - /// Default format. - /// [1, 2, 3, 4, 5, 6; \n - /// 7, 8, 9, ... ] - /// - Default, - - /// - /// Python format. - /// [[[1, 2, 3], [4, 5, 6]], \n - /// [[7, 8, 9], ... ] - /// - Python, - - /// - /// NumPy format. - /// array([[[1, 2, 3], [4, 5, 6]], \n - /// [[7, 8, 9], .... ]]], type='uint8'); - /// - NumPy, - - /// - /// CSV format. - /// 1, 2, 3, 4, 5, 6\n - /// 7, 8, 9, ... - /// - Csv, - - /// - /// C language format. - /// {1, 2, 3, 4, 5, 6, \n - /// 7, 8, 9, ...}; - /// - C, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/ErrorCode.cs b/src/OpenCvSharp/modules/core/Enum/ErrorCode.cs deleted file mode 100644 index c025b7b8b..000000000 --- a/src/OpenCvSharp/modules/core/Enum/ErrorCode.cs +++ /dev/null @@ -1,262 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// Error status codes - /// - public enum ErrorCode - { - /* this part of CVStatus is compatible with IPLStatus - Some of below symbols are not [yet] used in OpenCV - */ - - // ReSharper disable InconsistentNaming - - /// - /// everithing is ok [CV_StsOk] - /// - StsOk = 0, - - /// - /// pseudo error for back trace [CV_StsBackTrace] - /// - StsBackTrace = -1, - - /// - /// unknown /unspecified error [CV_StsError] - /// - StsError = -2, - - /// - /// internal error (bad state) [CV_StsInternal] - /// - StsInternal = -3, - - /// - /// insufficient memory [CV_StsNoMem] - /// - StsNoMem = -4, - - /// - /// function arg/param is bad [CV_StsBadArg] - /// - StsBadArg = -5, - - /// - /// unsupported function [CV_StsBadFunc] - /// - StsBadFunc = -6, - - /// - /// iter. didn't converge [CV_StsNoConv] - /// - StsNoConv = -7, - - /// - /// tracing [CV_StsAutoTrace] - /// - StsAutoTrace = -8, - - - /// - /// image header is NULL [CV_HeaderIsNull] - /// - HeaderIsNull = -9, - - /// - /// image size is invalid [CV_BadImageSize] - /// - BadImageSize = -10, - - /// - /// offset is invalid [CV_BadOffset] - /// - BadOffset = -11, - - /// - /// [CV_BadOffset] - /// - BadDataPtr = -12, - - /// - /// [CV_BadStep] - /// - BadStep = -13, - - /// - /// [CV_BadModelOrChSeq] - /// - BadModelOrChSeq = -14, - - /// - /// [CV_BadNumChannels] - /// - BadNumChannels = -15, - - /// - /// [CV_BadNumChannel1U] - /// - BadNumChannel1U = -16, - - /// - /// [CV_BadDepth] - /// - BadDepth = -17, - - /// - /// [CV_BadAlphaChannel] - /// - BadAlphaChannel = -18, - - /// - /// [CV_BadOrder] - /// - BadOrder = -19, - - /// - /// [CV_BadOrigin] - /// - BadOrigin = -20, - - /// - /// [CV_BadAlign] - /// - BadAlign = -21, - - /// - /// [CV_BadCallBack] - /// - BadCallBack = -22, - - /// - /// [CV_BadTileSize] - /// - BadTileSize = -23, - - /// - /// [CV_BadCOI] - /// - BadCOI = -24, - - /// - /// [CV_BadROISize] - /// - BadROISize = -25, - - /// - /// [CV_MaskIsTiled] - /// - MaskIsTiled = -26, - - /// - /// null pointer [CV_StsNullPtr] - /// - StsNullPtr = -27, - - /// - /// incorrect vector length [CV_StsVecLengthErr] - /// - StsVecLengthErr = -28, - - /// - /// incorr. filter structure content [CV_StsFilterStructContentErr] - /// - StsFilterStructContentErr = -29, - - /// - /// incorr. transform kernel content [CV_StsKernelStructContentErr] - /// - StsKernelStructContentErr = -30, - - /// - /// incorrect filter ofset value [CV_StsFilterOffsetErr] - /// - StsFilterOffsetErr = -31, - - /*extra for CV */ - - /// - /// the input/output structure size is incorrect [CV_StsBadSize] - /// - StsBadSize = -201, - - /// - /// division by zero [CV_StsDivByZero] - /// - StsDivByZero = -202, - - /// - /// in-place operation is not supported [CV_StsInplaceNotSupported] - /// - StsInplaceNotSupported = -203, - - /// - /// request can't be completed [CV_StsObjectNotFound] - /// - StsObjectNotFound = -204, - - /// - /// formats of input/output arrays differ [CV_StsUnmatchedFormats] - /// - StsUnmatchedFormats = -205, - - /// - /// flag is wrong or not supported [CV_StsBadFlag] - /// - StsBadFlag = -206, - - /// - /// bad CvPoint [CV_StsBadPoint] - /// - StsBadPoint = -207, - - /// - /// bad format of mask (neither 8uC1 nor 8sC1) [CV_StsBadMask] - /// - StsBadMask = -208, - - /// - /// sizes of input/output structures do not match [CV_StsUnmatchedSizes] - /// - StsUnmatchedSizes = -209, - - /// - /// the data format/type is not supported by the function [CV_StsUnsupportedFormat] - /// - StsUnsupportedFormat = -210, - - /// - /// some of parameters are out of range [CV_StsOutOfRange] - /// - StsOutOfRange = -211, - - /// - /// invalid syntax/structure of the parsed file [CV_StsParseError] - /// - StsParseError = -212, - - /// - /// the requested function/feature is not implemented [CV_StsNotImplemented] - /// - StsNotImplemented = -213, - - /// - /// an allocated block has been corrupted [CV_StsBadMemBlock] - /// - StsBadMemBlock = -214, - - /// - /// assertion failed - /// - StsAssert = -215, - -#pragma warning disable 1591 - GpuNotSupported = -216, - GpuApiCallError = -217, - OpenGlNotSupported = -218, - OpenGlApiCallError = -219, - OpenCLApiCallError = -220, - OpenCLDoubleNotSupported = -221, - OpenCLInitError = -222, - OpenCLNoAMDBlasFft = -223 - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/GemmFlags.cs b/src/OpenCvSharp/modules/core/Enum/GemmFlags.cs deleted file mode 100644 index 5ce9c62c4..000000000 --- a/src/OpenCvSharp/modules/core/Enum/GemmFlags.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// cv::GEMMメソッドの操作フラグ - /// -#else - /// - /// The operation flags for cv::GEMM - /// -#endif - [Flags] - public enum GemmFlags : int - { - /// - /// - /// - None = 0, - -#if LANG_JP - /// - /// src1を転置 - /// -#else - /// - /// Transpose src1 - /// -#endif - - A_T = 1, - - -#if LANG_JP - /// - /// src2を転置 - /// -#else - /// - /// Transpose src2 - /// -#endif - B_T = 2, - - -#if LANG_JP - /// - /// src3を転置 - /// -#else - /// - /// Transpose src3 - /// -#endif - C_T = 4, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/HersheyFonts.cs b/src/OpenCvSharp/modules/core/Enum/HersheyFonts.cs deleted file mode 100644 index 7afff47ff..000000000 --- a/src/OpenCvSharp/modules/core/Enum/HersheyFonts.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// フォント名の識別子.現在はHershey fontsの一部のみサポートされている. - /// フォント名のフラグにはイタリックフラグ(Italic)を合成することができる. - /// -#else - /// - /// Font name identifier. - /// Only a subset of Hershey fonts (http://sources.isc.org/utils/misc/hershey-font.txt) are supported now. - /// -#endif - [Flags] - public enum HersheyFonts : int - { - /// - /// normal size sans-serif font - /// - HersheySimplex = 0, - - /// - /// small size sans-serif font - /// - HersheyPlain = 1, - - /// - /// normal size sans-serif font (more complex than HERSHEY_SIMPLEX) - /// - HersheyDuplex = 2, - - /// - /// normal size serif font - /// - HersheyComplex = 3, - - /// - /// normal size serif font (more complex than HERSHEY_COMPLEX) - /// - HersheyTriplex = 4, - - /// - /// smaller version of HERSHEY_COMPLEX - /// - HersheyComplexSmall = 5, - - /// - /// hand-writing style font - /// - HersheyScriptSimplex = 6, - - /// - /// more complex variant of HERSHEY_SCRIPT_SIMPLEX - /// - HersheyScriptComplex = 7, - - /// - /// flag for italic font - /// - Italic = 16 - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/InOutArrayKind.cs b/src/OpenCvSharp/modules/core/Enum/InOutArrayKind.cs deleted file mode 100644 index b86b4ebf4..000000000 --- a/src/OpenCvSharp/modules/core/Enum/InOutArrayKind.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#pragma warning disable 1591 - - /// - /// - /// - [Flags] - public enum InOutArrayKind - { - None = 0 << InputArray.KIND_SHIFT, - Mat = 1 << InputArray.KIND_SHIFT, - Matx = 2 << InputArray.KIND_SHIFT, - StdVector = 3 << InputArray.KIND_SHIFT, - VectorVector = 4 << InputArray.KIND_SHIFT, - VectorMat = 5 << InputArray.KIND_SHIFT, - Expr = 6 << InputArray.KIND_SHIFT, - OpenGLBuffer = 7 << InputArray.KIND_SHIFT, - OpenGLTexture = 8 << InputArray.KIND_SHIFT, - GpuMat = 9 << InputArray.KIND_SHIFT, - OclMat = 10 << InputArray.KIND_SHIFT, - - FixedType = 0x8000 << InputArray.KIND_SHIFT, - FixedSize = 0x4000 << InputArray.KIND_SHIFT, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/KMeansFlags.cs b/src/OpenCvSharp/modules/core/Enum/KMeansFlags.cs deleted file mode 100644 index c55d153c2..000000000 --- a/src/OpenCvSharp/modules/core/Enum/KMeansFlags.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cv::kmeans の処理フラグ - /// -#else - /// - /// Miscellaneous flags for cv::kmeans - /// -#endif - [Flags] - public enum KMeansFlags : int - { - /// - /// Select random initial centers in each attempt. - /// - RandomCenters = 0, - - /// - /// Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007]. - /// - PpCenters = 2, - - /// - /// During the first (and possibly the only) attempt, use the - /// user-supplied labels instead of computing them from the initial centers. - /// For the second and further attempts, use the random or semi-random centers. - /// Use one of KMEANS_\*_CENTERS flag to specify the exact method. - /// - UseInitialLabels = 1, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/MatDiagType.cs b/src/OpenCvSharp/modules/core/Enum/MatDiagType.cs deleted file mode 100644 index fb8a9261a..000000000 --- a/src/OpenCvSharp/modules/core/Enum/MatDiagType.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - -#if LANG_JP - /// - /// diagonal type - /// -#else - /// - /// diagonal type - /// -#endif - public enum MatDiagType : int - { -#if LANG_JP - /// - /// a diagonal from the upper half - /// [< 0] - /// -#else - /// - /// a diagonal from the upper half - /// [< 0] - /// -#endif - Upper = -1, -#if LANG_JP - /// - /// Main dialonal - /// [= 0] - /// -#else - /// - /// Main dialonal - /// [= 0] - /// -#endif - Main = 0, -#if LANG_JP - /// - /// a diagonal from the lower half - /// [> 0] - /// -#else - /// - /// a diagonal from the lower half - /// [> 0] - /// -#endif - Lower = +1, - } -} - - diff --git a/src/OpenCvSharp/modules/core/Enum/NormTypes.cs b/src/OpenCvSharp/modules/core/Enum/NormTypes.cs deleted file mode 100644 index cb27cfdd6..000000000 --- a/src/OpenCvSharp/modules/core/Enum/NormTypes.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// 正規化のタイプ - /// -#else - /// - /// Type of norm - /// -#endif - [Flags] - public enum NormTypes : int - { - /// - /// - /// - - INF = 1, - -#if LANG_JP - /// - /// 配列のL1-norm(絶対値の合計)を正規化 - /// -#else - /// - /// The L1-norm (sum of absolute values) of the array is normalized. - /// -#endif - L1 = 2, - - -#if LANG_JP - /// - /// 配列のL2-norm(ユークリッド距離)を正規化 - /// -#else - /// - /// The (Euclidean) L2-norm of the array is normalized. - /// -#endif - L2 = 4, - - /// - /// - /// - L2SQR = 5, - - /// - /// - /// - Hamming = 6, - - /// - /// - /// - Hamming2 = 7, - - /// - /// - /// - Relative = 8, - -#if LANG_JP - /// - /// 配列の値が指定の範囲に収まるようにスケーリングとシフトを行う - /// -#else - /// - /// The array values are scaled and shifted to the specified range. - /// -#endif - MinMax = 32, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/ReduceDimension.cs b/src/OpenCvSharp/modules/core/Enum/ReduceDimension.cs deleted file mode 100644 index 8f51c73d6..000000000 --- a/src/OpenCvSharp/modules/core/Enum/ReduceDimension.cs +++ /dev/null @@ -1,54 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvReduceで、配列をどのように縮小するかを示すインデックス - /// -#else - /// - /// The dimension index along which the matrix is reduce. - /// -#endif - public enum ReduceDimension - { -#if LANG_JP - /// - /// 行列を1行ベクトルに縮小する - /// [= 0] - /// -#else - /// - /// The matrix is reduced to a single row. - /// [= 0] - /// -#endif - Row = 0, - -#if LANG_JP - /// - /// 行列を1列ベクトルに縮小する - /// [= 1] - /// -#else - /// - /// The matrix is reduced to a single column. - /// [= 1] - /// -#endif - Column = 1, - -#if LANG_JP - /// - /// 出力行列のサイズから次元を解析し,自動的に選択する - /// [= -1] - /// -#else - /// - /// The dimension is chosen automatically by analysing the dst size. - /// [= -1] - /// -#endif - Auto = -1 - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/ReduceTypes.cs b/src/OpenCvSharp/modules/core/Enum/ReduceTypes.cs deleted file mode 100644 index 62a6bdc78..000000000 --- a/src/OpenCvSharp/modules/core/Enum/ReduceTypes.cs +++ /dev/null @@ -1,62 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvReduceで用いる縮小処理の種類 - /// -#else - /// - /// The reduction operations for cvReduce - /// -#endif - public enum ReduceTypes : int - { -#if LANG_JP - /// - /// 出力は各行(または各列)の総和 - /// -#else - /// - /// The output is the sum of all the matrix rows/columns. - /// -#endif - Sum = 0, - - -#if LANG_JP - /// - /// 出力は各行(または各列)の平均ベクトル - /// -#else - /// - /// The output is the mean vector of all the matrix rows/columns. - /// -#endif - Avg = 1, - - -#if LANG_JP - /// - /// 出力は各行(または各列)における最大値 - /// -#else - /// - /// The output is the maximum (column/row-wise) of all the matrix rows/columns. - /// -#endif - Max = 2, - - -#if LANG_JP - /// - /// 出力は各行(または各列)における最小値 - /// -#else - /// - /// The output is the minimum (column/row-wise) of all the matrix rows/columns. - /// -#endif - Min = 3, - } -} diff --git a/src/OpenCvSharp/modules/core/Enum/SortFlags.cs b/src/OpenCvSharp/modules/core/Enum/SortFlags.cs deleted file mode 100644 index 2d736f0e9..000000000 --- a/src/OpenCvSharp/modules/core/Enum/SortFlags.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cv::sortで用いる、配列の並び順指定 - /// -#else - /// - /// Signals an error and raises the exception. - /// -#endif - [Flags] - public enum SortFlags : int - { - /// - /// each matrix row is sorted independently - /// - EveryRow = 0, - - /// - /// each matrix column is sorted independently; - /// this flag and the previous one are mutually exclusive. - /// - EveryColumn = 1, - - /// - /// each matrix row is sorted in the ascending order. - /// - Ascending = 0, - - /// - /// each matrix row is sorted in the descending order; - /// this flag and the previous one are also mutually exclusive. - /// - Descending = 16, - } -} diff --git a/src/OpenCvSharp/modules/core/FileNode.cs b/src/OpenCvSharp/modules/core/FileNode.cs deleted file mode 100644 index 1c60fe1be..000000000 --- a/src/OpenCvSharp/modules/core/FileNode.cs +++ /dev/null @@ -1,435 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// File Storage Node class - /// - public class FileNode : DisposableCvObject - { - #region Init & Disposal - - /// - /// The default constructor - /// - public FileNode() - { - ptr = NativeMethods.core_FileNode_new1(); - } - - /// - /// Initializes from cv::FileNode* - /// - /// - public FileNode(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_FileNode_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Cast - - /// - /// Returns the node content as an integer. If the node stores floating-point number, it is rounded. - /// - /// - /// - public static explicit operator int(FileNode node) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return NativeMethods.core_FileNode_toInt(node.CvPtr); - } - - /// - /// Returns the node content as float - /// - /// - /// - public static explicit operator float(FileNode node) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return NativeMethods.core_FileNode_toFloat(node.CvPtr); - } - - /// - /// Returns the node content as double - /// - /// - /// - public static explicit operator double(FileNode node) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - return NativeMethods.core_FileNode_toDouble(node.CvPtr); - } - - /// - /// Returns the node content as text string - /// - /// - /// - public static explicit operator string(FileNode node) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - var buf = new StringBuilder(1 << 16); - NativeMethods.core_FileNode_toString(node.CvPtr, buf, buf.Capacity); - return buf.ToString(); - } - - /// - /// Returns the node content as OpenCV Mat - /// - /// - /// - public static explicit operator Mat(FileNode node) - { - if (node == null) - throw new ArgumentNullException(nameof(node)); - node.ThrowIfDisposed(); - - var matrix = new Mat(); - NativeMethods.core_FileNode_toMat(node.CvPtr, matrix.CvPtr); - return matrix; - } - - #endregion - - #region Properties - - /// - /// returns element of a mapping node - /// - public FileNode this[string nodeName] - { - get - { - ThrowIfDisposed(); - if (nodeName == null) - throw new ArgumentNullException(nameof(nodeName)); - IntPtr node = NativeMethods.core_FileNode_operatorThis_byString(ptr, nodeName); - if (node == IntPtr.Zero) - return null; - return new FileNode(node); - } - } - - /// - /// returns element of a sequence node - /// - public FileNode this[int i] - { - get - { - ThrowIfDisposed(); - IntPtr node = NativeMethods.core_FileNode_operatorThis_byInt(ptr, i); - if (node == IntPtr.Zero) - return null; - return new FileNode(node); - } - } - - /// - /// Returns true if the node is empty - /// - /// - public bool Empty - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_empty(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node is a "none" object - /// - /// - public bool IsNone - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isNone(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node is a sequence - /// - /// - public bool IsSeq - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isSeq(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node is a mapping - /// - /// - public bool IsMap - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isMap(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node is an integer - /// - /// - public bool IsInt - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isInt(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node is a floating-point number - /// - /// - public bool IsReal - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isReal(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node is a text string - /// - /// - public bool IsString - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isString(ptr); - return ret != 0; - } - } - - /// - /// Returns true if the node has a name - /// - /// - public bool IsNamed - { - get - { - ThrowIfDisposed(); - int ret = NativeMethods.core_FileNode_isNamed(ptr); - return ret != 0; - } - } - - /// - /// Returns the node name or an empty string if the node is nameless - /// - /// - public string Name - { - get - { - ThrowIfDisposed(); - var buf = new StringBuilder(1024); - NativeMethods.core_FileNode_name(ptr, buf, buf.Capacity); - return buf.ToString(); - } - } - - /// - /// Returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. - /// - /// - public long Size - { - get - { - ThrowIfDisposed(); - return NativeMethods.core_FileNode_size(ptr).ToInt64(); - } - } - - #endregion - - #region Methods - - /// - /// Reads node elements to the buffer with the specified format - /// - /// - /// - /// - public void ReadRaw(string fmt, IntPtr vec, long len) - { - ThrowIfDisposed(); - if (fmt == null) - throw new ArgumentNullException(nameof(fmt)); - NativeMethods.core_FileNode_readRaw(ptr, fmt, vec, new IntPtr(len)); - } - - /// - /// Reads the registered object and returns pointer to it - /// - /// - public IntPtr ReadObj() - { - ThrowIfDisposed(); - return NativeMethods.core_FileNode_readObj(ptr); - } - - #region Read - - /// - /// - /// - /// - /// - public int ReadInt(int defaultValue = default(int)) - { - int value; - NativeMethods.core_FileNode_read_int(ptr, out value, defaultValue); - return value; - } - - /// - /// - /// - /// - /// - public float ReadFloat(float defaultValue = default(float)) - { - float value; - NativeMethods.core_FileNode_read_float(ptr, out value, defaultValue); - return value; - } - - /// - /// - /// - /// - /// - public double ReadDouble(double defaultValue = default(double)) - { - double value; - NativeMethods.core_FileNode_read_double(ptr, out value, defaultValue); - return value; - } - - /// - /// - /// - /// - /// - public string ReadString(string defaultValue = default(string)) - { - var value = new StringBuilder(65536); - NativeMethods.core_FileNode_read_String(ptr, value, value.Capacity, defaultValue); - return value.ToString(); - } - - /// - /// - /// - /// - /// - public Mat ReadMat(Mat defaultMat = null) - { - var value = new Mat(); - try - { - NativeMethods.core_FileNode_read_Mat(ptr, value.CvPtr, Cv2.ToPtr(defaultMat)); - } - catch - { - value.Dispose(); - throw; - } - return value; - } - - /// - /// - /// - /// - /// - public SparseMat ReadSparseMat(SparseMat defaultMat = null) - { - var value = new SparseMat(); - try - { - NativeMethods.core_FileNode_read_SparseMat(ptr, value.CvPtr, Cv2.ToPtr(defaultMat)); - } - catch - { - value.Dispose(); - throw; - } - return value; - } - - /// - /// - /// - /// - public KeyPoint[] ReadKeyPoints() - { - using (var valueVector = new VectorOfKeyPoint()) - { - NativeMethods.core_FileNode_read_vectorOfKeyPoint(ptr, valueVector.CvPtr); - return valueVector.ToArray(); - } - } - - /// - /// - /// - /// - public DMatch[] ReadDMatches() - { - using (var valueVector = new VectorOfDMatch()) - { - NativeMethods.core_FileNode_read_vectorOfDMatch(ptr, valueVector.CvPtr); - return valueVector.ToArray(); - } - } - - #endregion - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/FileStorage.cs b/src/OpenCvSharp/modules/core/FileStorage.cs deleted file mode 100644 index 7c20f7f70..000000000 --- a/src/OpenCvSharp/modules/core/FileStorage.cs +++ /dev/null @@ -1,494 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// XML/YAML File Storage Class. - /// - public class FileStorage : DisposableCvObject - { - #region Init & Disposal - - /// - /// Default constructor. - /// You should call FileStorage::open() after initialization. - /// - public FileStorage() - { - ptr = NativeMethods.core_FileStorage_new1(); - } - - /// - /// The full constructor - /// - /// Name of the file to open or the text string to read the data from. - /// Extension of the file (.xml or .yml/.yaml) determines its format - /// (XML or YAML respectively). Also you can append .gz to work with - /// compressed files, for example myHugeMatrix.xml.gz. - /// If both FileStorage::WRITE and FileStorage::MEMORY flags are specified, - /// source is used just to specify the output file format - /// (e.g. mydata.xml, .yml etc.). - /// - /// Encoding of the file. Note that UTF-16 XML encoding is not supported - /// currently and you should use 8-bit encoding instead of it. - public FileStorage(string source, Mode flags, string encoding = null) - { - if (source == null) - throw new ArgumentNullException(nameof(source)); - ptr = NativeMethods.core_FileStorage_new2(source, (int)flags, encoding); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_FileStorage_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties - - /// - /// Returns the specified element of the top-level mapping - /// - /// - /// - public FileNode this[string nodeName] - { - get - { - ThrowIfDisposed(); - if (nodeName == null) - throw new ArgumentNullException(nameof(nodeName)); - IntPtr node = NativeMethods.core_FileStorage_indexer(ptr, nodeName); - if (node == IntPtr.Zero) - return null; - return new FileNode(node); - } - } - - /// - /// the currently written element - /// - public string ElName - { - get - { - ThrowIfDisposed(); - unsafe - { - sbyte* buf = NativeMethods.core_FileStorage_elname(ptr); - if (buf == null) - return null; - return StringHelper.PtrToStringAnsi(buf); ; - } - } - } - - /// - /// the stack of written structures - /// - public byte[] Structs - { - get - { - ThrowIfDisposed(); - - IntPtr length; - IntPtr buf = NativeMethods.core_FileStorage_structs(ptr, out length); - byte[] result = new byte[length.ToInt32()]; - Marshal.Copy(buf, result, 0, result.Length); - return result; - } - } - - /// - /// the writer state - /// - public int State - { - get - { - ThrowIfDisposed(); - return NativeMethods.core_FileStorage_state(ptr); - } - } - - #endregion - - #region Methods - - /// - /// operator that performs PCA. The previously stored data, if any, is released - /// - /// - /// - /// Encoding of the file. Note that UTF-16 XML encoding is not supported - /// currently and you should use 8-bit encoding instead of it. - /// - public virtual bool Open(string fileName, Mode flags, string encoding = null) - { - ThrowIfDisposed(); - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - int ret = NativeMethods.core_FileStorage_open(ptr, fileName, (int)flags, encoding); - return ret != 0; - } - - /// - /// Returns true if the object is associated with currently opened file. - /// - /// - public virtual bool IsOpened() - { - ThrowIfDisposed(); - return NativeMethods.core_FileStorage_isOpened(ptr) != 0; - } - - /// - /// Closes the file and releases all the memory buffers - /// - public virtual void Release() - { - ThrowIfDisposed(); - Dispose(); - } - - /// - /// Closes the file, releases all the memory buffers and returns the text string - /// - /// - public string ReleaseAndGetString() - { - ThrowIfDisposed(); - var buf = new StringBuilder(1 << 16); - NativeMethods.core_FileStorage_releaseAndGetString(ptr, buf, buf.Capacity); - ptr = IntPtr.Zero; - Dispose(); - return buf.ToString(); - } - - /// - /// Returns the first element of the top-level mapping - /// - /// - public FileNode GetFirstTopLevelNode() - { - ThrowIfDisposed(); - IntPtr node = NativeMethods.core_FileStorage_getFirstTopLevelNode(ptr); - if (node == IntPtr.Zero) - return null; - return new FileNode(node); - } - - /// - /// Returns the top-level mapping. YAML supports multiple streams - /// - /// - /// - public FileNode Root(int streamidx = 0) - { - ThrowIfDisposed(); - IntPtr node = NativeMethods.core_FileStorage_root(ptr, streamidx); - if (node == IntPtr.Zero) - return null; - return new FileNode(node); - } - - /// - /// Writes one or more numbers of the specified format to the currently written structure - /// - /// - /// - /// - public void WriteRaw(string fmt, IntPtr vec, long len) - { - ThrowIfDisposed(); - throw new NotImplementedException(); - } - - /// - /// Writes the registered C structure (CvMat, CvMatND, CvSeq). See cvWrite() - /// - /// - /// - public void WriteObj(string name, IntPtr obj) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - NativeMethods.core_FileStorage_writeObj(ptr, name, obj); - } - - /// - /// Returns the normalized object name for the specified file name - /// - /// - /// - public static string GetDefaultObjectName(string fileName) - { - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); -#if !uwp - if (!File.Exists(fileName)) - throw new FileNotFoundException("", fileName); -#endif - - var buf = new StringBuilder(1 << 16); - NativeMethods.core_FileStorage_getDefaultObjectName(fileName, buf, buf.Capacity); - return buf.ToString(); - } - - #region Write - - /// - /// - /// - /// - /// - public void Write(string name, int value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - NativeMethods.core_FileStorage_write_int(ptr, name, value); - } - - /// - /// - /// - /// - /// - public void Write(string name, float value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - NativeMethods.core_FileStorage_write_float(ptr, name, value); - } - - /// - /// - /// - /// - /// - public void Write(string name, double value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - NativeMethods.core_FileStorage_write_double(ptr, name, value); - } - - /// - /// - /// - /// - /// - public void Write(string name, string value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (value == null) - throw new ArgumentNullException(nameof(value)); - NativeMethods.core_FileStorage_write_String(ptr, name, value); - } - - /// - /// - /// - /// - /// - public void Write(string name, Mat value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (value == null) - throw new ArgumentNullException(nameof(value)); - NativeMethods.core_FileStorage_write_Mat(ptr, name, value.CvPtr); - GC.KeepAlive(value); - } - - /// - /// - /// - /// - /// - public void Write(string name, SparseMat value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (value == null) - throw new ArgumentNullException(nameof(value)); - NativeMethods.core_FileStorage_write_SparseMat(ptr, name, value.CvPtr); - GC.KeepAlive(value); - } - - /// - /// - /// - /// - /// - public void Write(string name, IEnumerable value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (value == null) - throw new ArgumentNullException(nameof(value)); - using (var valueVector = new VectorOfKeyPoint(value)) - { - NativeMethods.core_FileStorage_write_vectorOfKeyPoint(ptr, name, valueVector.CvPtr); - } - } - - /// - /// - /// - /// - /// - public void Write(string name, IEnumerable value) - { - ThrowIfDisposed(); - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (value == null) - throw new ArgumentNullException(nameof(value)); - using (var valueVector = new VectorOfDMatch(value)) - { - NativeMethods.core_FileStorage_write_vectorOfDMatch(ptr, name, valueVector.CvPtr); - } - } - - /// - /// - /// - /// - public void WriteScalar(int value) - { - ThrowIfDisposed(); - NativeMethods.core_FileStorage_writeScalar_int(ptr, value); - } - - /// - /// - /// - /// - public void WriteScalar(float value) - { - ThrowIfDisposed(); - NativeMethods.core_FileStorage_writeScalar_float(ptr, value); - } - - /// - /// - /// - /// - public void WriteScalar(double value) - { - ThrowIfDisposed(); - NativeMethods.core_FileStorage_writeScalar_double(ptr, value); - } - - /// - /// - /// - /// - public void WriteScalar(string value) - { - ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - NativeMethods.core_FileStorage_writeScalar_String(ptr, value); - } - - #endregion - - #endregion - -#if LANG_JP - /// - /// FileStorageのモード - /// -#else - /// - /// File storage mode - /// -#endif - [Flags] - public enum Mode - { -#if LANG_JP - /// - /// データ読み込みのためのファイルオープン - /// -#else - /// - /// The storage is open for reading - /// -#endif - Read = 0, - -#if LANG_JP - /// - /// データ書き込みのためのファイルオープン - /// [CV_STORAGE_WRITE] - /// -#else - /// - /// The storage is open for writing - /// [CV_STORAGE_WRITE] - /// -#endif - Write = 1, - -#if LANG_JP - /// - /// データ追加書き込みのためのファイルオープン - /// -#else - /// - /// The storage is open for appending - /// -#endif - Append = 2, - - /// - /// flag, read data from source or write data to the internal buffer - /// (which is returned by FileStorage::release) - /// - Memory = 4, - - /// - /// mask for format flags - /// - FotmatMask = (7 << 3), - - /// - /// flag, auto format - /// - FormatAuto = 0, - - /// - /// flag, XML format - /// - FormatXml = (1 << 3), - - /// - /// flag, YAML format - /// - FormatYaml = (2 << 3), - } - } -} diff --git a/src/OpenCvSharp/modules/core/InputArray.cs b/src/OpenCvSharp/modules/core/InputArray.cs deleted file mode 100644 index d411e13ee..000000000 --- a/src/OpenCvSharp/modules/core/InputArray.cs +++ /dev/null @@ -1,486 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenCvSharp.Cuda; - -namespace OpenCvSharp -{ - /// - /// Proxy datatype for passing Mat's and vector<>'s as input parameters - /// - public class InputArray : DisposableCvObject - { - private object obj; - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - public const int KIND_SHIFT = 16; - public const int KIND_MASK = ~(0x8000 << KIND_SHIFT | 0x4000 << KIND_SHIFT) - (1 << KIND_SHIFT) + 1; -// ReSharper restore InconsistentNaming -#pragma warning restore 1591 - - #region Init & Disposal - /// - /// - /// - /// - internal InputArray(IntPtr ptr) - { - this.ptr = ptr; - this.obj = null; - } - - /// - /// - /// - /// - internal InputArray(Mat mat) - { - if (mat == null) - ptr = IntPtr.Zero; - else - ptr = NativeMethods.core_InputArray_new_byMat(mat.CvPtr); - obj = mat; - } - - /// - /// - /// - /// - internal InputArray(MatExpr expr) - { - if (expr == null) - ptr = IntPtr.Zero; - else - ptr = NativeMethods.core_InputArray_new_byMatExpr(expr.CvPtr); - obj = null; - } - - /// - /// - /// - /// - internal InputArray(Scalar val) - { - ptr = NativeMethods.core_InputArray_new_byScalar(val); - } - - /// - /// - /// - /// - internal InputArray(double val) - { - ptr = NativeMethods.core_InputArray_new_byDouble(val); - } - - /// - /// - /// - /// - internal InputArray(GpuMat mat) - { - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - ptr = NativeMethods.core_InputArray_new_byGpuMat(mat.CvPtr); - obj = mat; - } - - /// - /// - /// - /// - internal InputArray(IEnumerable mat) - { - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - using (var matVector = new VectorOfMat(mat)) - { - ptr = NativeMethods.core_InputArray_new_byVectorOfMat(matVector.CvPtr); - } - obj = mat; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_InputArray_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator InputArray(Mat mat) - { - return Create(mat); - } - - /// - /// - /// - /// - /// - public static implicit operator InputArray(MatExpr expr) - { - return Create(expr); - } - - /// - /// - /// - /// - /// - public static implicit operator InputArray(Scalar val) - { - return Create(val); - } - - /// - /// - /// - /// - /// - public static implicit operator InputArray(double val) - { - return Create(val); - } - - /// - /// - /// - /// - /// - public static implicit operator InputArray(GpuMat mat) - { - return Create(mat); - } - - /// - /// - /// - /// - /// - public static explicit operator InputArray(List mats) - { - return Create(mats); - } - - /// - /// - /// - /// - /// - public static explicit operator InputArray(Mat[] mats) - { - return Create((IEnumerable)mats); - } - - #endregion - - #region Methods - - /// - /// - /// - public InOutArrayKind Kind - { - get - { - ThrowIfDisposed(); - return (InOutArrayKind)NativeMethods.core_InputArray_kind(ptr); - } - } - - /// - /// Creates a proxy class of the specified Mat - /// - /// - /// - public static InputArray Create(Mat mat) - { - return new InputArray(mat); - } - - /// - /// Creates a proxy class of the specified MatExpr - /// - /// - /// - public static InputArray Create(MatExpr expr) - { - return new InputArray(expr); - } - - /// - /// Creates a proxy class of the specified Scalar - /// - /// - /// - public static InputArray Create(Scalar val) - { - return new InputArray(val); - } - - /// - /// Creates a proxy class of the specified double - /// - /// - /// - public static InputArray Create(double val) - { - return new InputArray(val); - } - - /// - /// Creates a proxy class of the specified GpuMat - /// - /// - /// - public static InputArray Create(GpuMat mat) - { - return new InputArray(mat); - } - - /// - /// Creates a proxy class of the specified array of Mat - /// - /// - /// - public static InputArray Create(IEnumerable matVector) - { - return new InputArray(matVector); - } - - /// - /// Creates a proxy class of the specified list - /// - /// Array object - /// - public static InputArray Create(IEnumerable enumerable) - where T : struct - { - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - List list = new List(enumerable); - return Create(list.ToArray()); - } - - /// - /// Creates a proxy class of the specified list - /// - /// Array object - /// Matrix depth and channels for converting array to cv::Mat - /// - public static InputArray Create(IEnumerable enumerable, MatType type) - where T : struct - { - if (enumerable == null) - throw new ArgumentNullException(nameof(enumerable)); - List list = new List(enumerable); - return Create(list.ToArray(), type); - } - - /// - /// Creates a proxy class of the specified list - /// - /// Array object - /// - public static InputArray Create(T[] array) - where T : struct - { - MatType type = EstimateType(typeof(T)); - return Create(array, type); - } - - /// - /// Creates a proxy class of the specified list - /// - /// Array object - /// Matrix depth and channels for converting array to cv::Mat - /// - public static InputArray Create(T[] array, MatType type) - where T : struct - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - if (array.Length == 0) - throw new ArgumentException("array.Length == 0"); - - int rows = array.Length; - Mat mat = new Mat(rows, 1, type, array); - return new InputArray(mat); - } - - /// - /// Creates a proxy class of the specified list - /// - /// Array object - /// - public static InputArray Create(T[,] array) - where T : struct - { - MatType type = EstimateType(typeof(T)); - return Create(array, type); - } - - /// - /// Creates a proxy class of the specified list - /// - /// Array object - /// Matrix depth and channels for converting array to cv::Mat - /// - public static InputArray Create(T[,] array, MatType type) - where T : struct - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - int rows = array.GetLength(0); - int cols = array.GetLength(1); - if (rows == 0) - throw new ArgumentException("array.GetLength(0) == 0"); - if (cols == 0) - throw new ArgumentException("array.GetLength(1) == 0"); - Mat mat = new Mat(rows, cols, type, array); - return new InputArray(mat); - } - - /// - /// - /// - /// - /// - private static MatType EstimateType(Type t) - { -#if net20 || net40 - if(!t.IsValueType) -#else - if(!t.GetTypeInfo().IsValueType) -#endif - throw new ArgumentException(); - - // Primitive types -#if netcore50 || uap10 || uwp - if (t == typeof(byte)) - return MatType.CV_8UC1; - if (t == typeof(sbyte)) - return MatType.CV_8SC1; - if (t == typeof(ushort) || t == typeof(char)) - return MatType.CV_16UC1; - if (t == typeof(short)) - return MatType.CV_16SC1; - if (t == typeof(int) || t == typeof(uint)) - return MatType.CV_32SC1; - if (t == typeof(float)) - return MatType.CV_32FC1; - if (t == typeof(double)) - return MatType.CV_64FC1; -#else - TypeCode code = Type.GetTypeCode(t); - switch (code) - { - case TypeCode.Byte: - return MatType.CV_8UC1; - case TypeCode.SByte: - return MatType.CV_8SC1; - case TypeCode.UInt16: - return MatType.CV_16UC1; - case TypeCode.Int16: - case TypeCode.Char: - return MatType.CV_16SC1; - case TypeCode.UInt32: - case TypeCode.Int32: - return MatType.CV_32SC1; - case TypeCode.Single: - return MatType.CV_32FC1; - case TypeCode.Double: - return MatType.CV_64FC1; - } -#endif - - // OpenCV struct types - if (t == typeof(Point)) - return MatType.CV_32SC2; - if (t == typeof(Point2f)) - return MatType.CV_32FC2; - if (t == typeof(Point2d)) - return MatType.CV_64FC2; - if (t == typeof(Point3i)) - return MatType.CV_32SC3; - if (t == typeof(Point3f)) - return MatType.CV_32FC3; - if (t == typeof(Point3d)) - return MatType.CV_32FC3; - if (t == typeof(Range)) - return MatType.CV_32SC2; - if (t == typeof(Rangef)) - return MatType.CV_32FC2; - if (t == typeof(Rect)) - return MatType.CV_32SC4; - if (t == typeof(Size)) - return MatType.CV_32SC2; - if (t == typeof(Size2f)) - return MatType.CV_32FC2; - - if (t == typeof(Vec2b)) - return MatType.CV_8UC2; - if (t == typeof(Vec3b)) - return MatType.CV_8UC3; - if (t == typeof(Vec4b)) - return MatType.CV_8UC4; - if (t == typeof(Vec6b)) - return MatType.CV_8UC(6); - if (t == typeof(Vec2s)) - return MatType.CV_16SC2; - if (t == typeof(Vec3s)) - return MatType.CV_16SC3; - if (t == typeof(Vec4s)) - return MatType.CV_16SC4; - if (t == typeof(Vec6s)) - return MatType.CV_16SC(6); - if (t == typeof(Vec2w)) - return MatType.CV_16UC2; - if (t == typeof(Vec3w)) - return MatType.CV_16UC3; - if (t == typeof(Vec4w)) - return MatType.CV_16UC4; - if (t == typeof(Vec6w)) - return MatType.CV_16UC(6); - if (t == typeof(Vec2s)) - return MatType.CV_32SC2; - if (t == typeof(Vec3s)) - return MatType.CV_32SC3; - if (t == typeof(Vec4s)) - return MatType.CV_32SC4; - if (t == typeof(Vec6s)) - return MatType.CV_32SC(6); - if (t == typeof(Vec2f)) - return MatType.CV_32FC2; - if (t == typeof(Vec3f)) - return MatType.CV_32FC3; - if (t == typeof(Vec4f)) - return MatType.CV_32FC4; - if (t == typeof(Vec6f)) - return MatType.CV_32FC(6); - if (t == typeof(Vec2d)) - return MatType.CV_64FC2; - if (t == typeof(Vec3d)) - return MatType.CV_64FC3; - if (t == typeof(Vec4d)) - return MatType.CV_64FC4; - if (t == typeof(Vec6d)) - return MatType.CV_64FC(6); - - throw new ArgumentException("Not supported value type for InputArray"); - } -#endregion - } -} diff --git a/src/OpenCvSharp/modules/core/InputOutputArray.cs b/src/OpenCvSharp/modules/core/InputOutputArray.cs deleted file mode 100644 index 73f626a18..000000000 --- a/src/OpenCvSharp/modules/core/InputOutputArray.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; -using OpenCvSharp; - -namespace OpenCvSharp -{ - /// - /// Proxy datatype for passing Mat's and vector<>'s as input parameters. - /// Synonym for OutputArray. - /// - public class InputOutputArray : OutputArray - { - /// - /// - /// - /// - internal InputOutputArray(Mat mat) - : base(mat) - { - } - - #region Cast - /// - /// - /// - /// - /// - public static implicit operator InputOutputArray(Mat mat) - { - return new InputOutputArray(mat); - } - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/Mat.cs b/src/OpenCvSharp/modules/core/Mat/Mat.cs deleted file mode 100644 index 401dc3007..000000000 --- a/src/OpenCvSharp/modules/core/Mat/Mat.cs +++ /dev/null @@ -1,5341 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// OpenCV C++ n-dimensional dense array class (cv::Mat) - /// - public partial class Mat : DisposableCvObject - { - #region Init & Disposal - -#if LANG_JP -/// -/// OpenCVネイティブの cv::Mat* ポインタから初期化 -/// -/// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public Mat(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Native object address is NULL"); - this.ptr = ptr; - } - -#if LANG_JP -/// -/// 空の行列として初期化 -/// -#else - /// - /// Creates empty Mat - /// -#endif - public Mat() - { - ptr = NativeMethods.core_Mat_new1(); - } - -#if LANG_JP -/// -/// 画像ファイルから読み込んで初期化 (cv::imread) -/// -/// 読み込まれる画像ファイル名 -/// 画像読み込みフラグ. -#else - /// - /// Loads an image from a file. (cv::imread) - /// - /// Name of file to be loaded. - /// Specifies color type of the loaded image -#endif - public Mat(string fileName, ImreadModes flags = ImreadModes.Color) - { - if (string.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); -#if !uwp - if (!File.Exists(fileName)) - throw new FileNotFoundException("", fileName); -#endif - ptr = NativeMethods.imgcodecs_imread(fileName, (int) flags); - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列として初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - public Mat(int rows, int cols, MatType type) - { - ptr = NativeMethods.core_Mat_new2(rows, cols, type); - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列として初期化 -/// -/// 2次元配列のサイズ: Size(cols, rows) . Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - public Mat(Size size, MatType type) - { - ptr = NativeMethods.core_Mat_new2(size.Height, size.Width, type); - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, -/// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public Mat(int rows, int cols, MatType type, Scalar s) - { - ptr = NativeMethods.core_Mat_new3(rows, cols, type, s); - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 -/// -/// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, -/// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public Mat(Size size, MatType type, Scalar s) - { - ptr = NativeMethods.core_Mat_new3(size.Height, size.Width, type, s); - } - -#if LANG_JP -/// -/// 他の行列の部分行列として初期化 -/// -/// 作成された行列に(全体的,部分的に)割り当てられる配列. -/// これらのコンストラクタによってデータがコピーされる事はありません. -/// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, -/// 関連した参照カウンタがあれば,それがインクリメントされます. -/// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も -/// 変更することになります.もし部分配列の独立したコピーが必要ならば, -/// Mat.Clone() を利用してください. -/// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. -/// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public Mat(Mat m, Range rowRange, Range? colRange = null) - { - if (colRange.HasValue) - ptr = NativeMethods.core_Mat_new4(m.ptr, rowRange, colRange.Value); - else - ptr = NativeMethods.core_Mat_new5(m.ptr, rowRange); - } - -#if LANG_JP -/// -/// 他の行列の部分行列として初期化 -/// -/// 作成された行列に(全体的,部分的に)割り当てられる配列. -/// これらのコンストラクタによってデータがコピーされる事はありません. -/// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, -/// 関連した参照カウンタがあれば,それがインクリメントされます. -/// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も -/// 変更することになります.もし部分配列の独立したコピーが必要ならば, -/// Mat.Clone() を利用してください. -/// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public Mat(Mat m, params Range[] ranges) - { - ptr = NativeMethods.core_Mat_new6(m.ptr, ranges); - } - -#if LANG_JP -/// -/// 他の行列の部分行列として初期化 -/// -/// 作成された行列に(全体的,部分的に)割り当てられる配列. -/// これらのコンストラクタによってデータがコピーされる事はありません. -/// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, -/// 関連した参照カウンタがあれば,それがインクリメントされます. -/// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も -/// 変更することになります.もし部分配列の独立したコピーが必要ならば, -/// Mat.Clone() を利用してください. -/// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public Mat(Mat m, Rect roi) - { - ptr = NativeMethods.core_Mat_new7(m.ptr, roi); - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 行列の各行が占めるバイト数を指定できます. -/// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. -/// このパラメータが指定されない場合,パディングは存在しないとみなされ, -/// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public Mat(int rows, int cols, MatType type, IntPtr data, long step = 0) - { - ptr = NativeMethods.core_Mat_new8(rows, cols, type, data, new IntPtr(step)); - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 行列の各行が占めるバイト数を指定できます. -/// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. -/// このパラメータが指定されない場合,パディングは存在しないとみなされ, -/// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public Mat(int rows, int cols, MatType type, Array data, long step = 0) - { - GCHandle handle = AllocGCHandle(data); - ptr = NativeMethods.core_Mat_new8(rows, cols, type, - handle.AddrOfPinnedObject(), new IntPtr(step)); - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// Array of integers specifying an n-dimensional array shape. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 多次元配列における ndims-1 個のステップを表す配列 -/// (最後のステップは常に要素サイズになります).これが指定されないと, -/// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public Mat(IEnumerable sizes, MatType type, IntPtr data, IEnumerable steps = null) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - if (data == IntPtr.Zero) - throw new ArgumentNullException(nameof(data)); - int[] sizesArray = EnumerableEx.ToArray(sizes); - if (steps == null) - { - ptr = NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, type, data, IntPtr.Zero); - } - else - { - IntPtr[] stepsArray = EnumerableEx.SelectToArray(steps, delegate(long s) - { - return new IntPtr(s); - }); - ptr = NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, type, data, stepsArray); - } - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 多次元配列における ndims-1 個のステップを表す配列 -/// (最後のステップは常に要素サイズになります).これが指定されないと, -/// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public Mat(IEnumerable sizes, MatType type, Array data, IEnumerable steps = null) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - if (data == null) - throw new ArgumentNullException(nameof(data)); - - GCHandle handle = AllocGCHandle(data); - int[] sizesArray = EnumerableEx.ToArray(sizes); - if (steps == null) - { - ptr = NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, - type, handle.AddrOfPinnedObject(), IntPtr.Zero); - } - else - { - IntPtr[] stepsArray = EnumerableEx.SelectToArray(steps, delegate(long s) - { - return new IntPtr(s); - }); - ptr = NativeMethods.core_Mat_new9(sizesArray.Length, sizesArray, - type, handle.AddrOfPinnedObject(), stepsArray); - } - } - -#if LANG_JP -/// -/// N次元行列として初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - public Mat(IEnumerable sizes, MatType type) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - - int[] sizesArray = EnumerableEx.ToArray(sizes); - ptr = NativeMethods.core_Mat_new10(sizesArray.Length, sizesArray, type); - } - -#if LANG_JP -/// -/// N次元行列として初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -/// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, -/// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -/// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, -/// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public Mat(IEnumerable sizes, MatType type, Scalar s) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - int[] sizesArray = EnumerableEx.ToArray(sizes); - ptr = NativeMethods.core_Mat_new11(sizesArray.Length, sizesArray, type, s); - } - -#if LANG_JP -/// -/// リソースの解放 -/// -#else - /// - /// Releases the resources - /// -#endif - public void Release() - { - Dispose(); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_Mat_delete(ptr); - base.DisposeUnmanaged(); - } - - #region Static Initializers - -#if LANG_JP - /// - /// System.IO.StreamのインスタンスからMatを生成する - /// - /// - /// - /// -#else - /// - /// Creates the Mat instance from System.IO.Stream - /// - /// - /// - /// -#endif - public static Mat FromStream(Stream stream, ImreadModes mode) - { - if (stream == null) - throw new ArgumentNullException(nameof(stream)); - if (stream.Length > Int32.MaxValue) - throw new ArgumentException("Not supported stream (too long)"); - - byte[] buf = new byte[stream.Length]; - long currentPosition = stream.Position; - try - { - stream.Position = 0; - int count = 0; - while (count < stream.Length) - { - int bytesRead = stream.Read(buf, count, buf.Length - count); - if (bytesRead == 0) - { - break; - } - count += bytesRead; - } - } - finally - { - stream.Position = currentPosition; - } - return FromImageData(buf, mode); - } - -#if LANG_JP -/// -/// 画像データ(JPEG等の画像をメモリに展開したもの)からMatを生成する (cv::decode) -/// -/// -/// -/// -#else - /// - /// Creates the Mat instance from image data (using cv::decode) - /// - /// - /// - /// -#endif - public static Mat ImDecode(byte[] imageBytes, ImreadModes mode = ImreadModes.Color) - { - if (imageBytes == null) - throw new ArgumentNullException(nameof(imageBytes)); - return Cv2.ImDecode(imageBytes, mode); - } - -#if LANG_JP -/// -/// 画像データ(JPEG等の画像をメモリに展開したもの)からMatを生成する (cv::decode) -/// -/// -/// -/// -#else - /// - /// Creates the Mat instance from image data (using cv::decode) - /// - /// - /// - /// -#endif - public static Mat FromImageData(byte[] imageBytes, ImreadModes mode = ImreadModes.Color) - { - return ImDecode(imageBytes, mode); - } - - #endregion - - #endregion - - #region Static - - /// - /// sizeof(cv::Mat) - /// - public static readonly int SizeOf = (int) NativeMethods.core_Mat_sizeof(); - - #region Diag - - /// - /// Extracts a diagonal from a matrix, or creates a diagonal matrix. - /// - /// - /// - public static Mat Diag(Mat d) - { - IntPtr retPtr = NativeMethods.core_Mat_diag3(d.CvPtr); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region Eye - - /// - /// Returns an identity matrix of the specified size and type. - /// - /// Alternative to the matrix size specification Size(cols, rows) . - /// Created matrix type. - /// - public static MatExpr Eye(Size size, MatType type) - { - return Eye(size.Height, size.Width, type); - } - - /// - /// Returns an identity matrix of the specified size and type. - /// - /// Number of rows. - /// Number of columns. - /// Created matrix type. - /// - public static MatExpr Eye(int rows, int cols, MatType type) - { - IntPtr retPtr = NativeMethods.core_Mat_eye(rows, cols, type); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - - #endregion - - #region Ones - - /// - /// Returns an array of all 1’s of the specified size and type. - /// - /// Number of rows. - /// Number of columns. - /// Created matrix type. - /// - public static MatExpr Ones(int rows, int cols, MatType type) - { - IntPtr retPtr = NativeMethods.core_Mat_ones1(rows, cols, type); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - - /// - /// Returns an array of all 1’s of the specified size and type. - /// - /// Alternative to the matrix size specification Size(cols, rows) . - /// Created matrix type. - /// - public static MatExpr Ones(Size size, MatType type) - { - return Ones(size.Height, size.Width, type); - } - - /// - /// Returns an array of all 1’s of the specified size and type. - /// - /// Created matrix type. - /// Array of integers specifying the array shape. - /// - public static MatExpr Ones(MatType type, params int[] sizes) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - - IntPtr retPtr = NativeMethods.core_Mat_ones2(sizes.Length, sizes, type); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - - #endregion - - #region Zeros - - /// - /// Returns a zero array of the specified size and type. - /// - /// Number of rows. - /// Number of columns. - /// Created matrix type. - /// - public static MatExpr Zeros(int rows, int cols, MatType type) - { - IntPtr retPtr = NativeMethods.core_Mat_zeros1(rows, cols, type); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - - /// - /// Returns a zero array of the specified size and type. - /// - /// Alternative to the matrix size specification Size(cols, rows) . - /// Created matrix type. - /// - public static MatExpr Zeros(Size size, MatType type) - { - return Zeros(size.Height, size.Width, type); - } - - /// - /// Returns a zero array of the specified size and type. - /// - /// Created matrix type. - /// - /// - public static MatExpr Zeros(MatType type, params int[] sizes) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - - IntPtr retPtr = NativeMethods.core_Mat_zeros2(sizes.Length, sizes, type); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - - #endregion - - #endregion - - #region Operators - - #region Unary - - /// - /// - /// - /// - /// - public static MatExpr operator -(Mat mat) - { - IntPtr expr = NativeMethods.core_Mat_operatorUnaryMinus(mat.CvPtr); - return new MatExpr(expr); - } - - /// - /// - /// - /// - /// - public static Mat operator +(Mat mat) - { - return mat; - } - - #endregion - - #region Binary - - #region + - - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - - IntPtr retPtr = NativeMethods.core_Mat_operatorAdd_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(Mat a, Scalar s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - - IntPtr retPtr = NativeMethods.core_Mat_operatorAdd_MatScalar(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(Scalar s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorAdd_ScalarMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region - - - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorSubtract_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(Mat a, Scalar s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorSubtract_MatScalar(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(Scalar s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorSubtract_ScalarMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region * - - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorMultiply_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(Mat a, double s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorMultiply_MatDouble(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(double s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorMultiply_DoubleMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region / - - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorDivide_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(Mat a, double s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorDivide_MatDouble(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(double s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorDivide_DoubleMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region And - - /// - /// - /// - /// - /// - /// - public static MatExpr operator &(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorAnd_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator &(Mat a, double s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorAnd_MatDouble(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator &(double s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorAnd_DoubleMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region Or - - /// - /// - /// - /// - /// - /// - public static MatExpr operator |(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorOr_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator |(Mat a, double s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorOr_MatDouble(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator |(double s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorOr_DoubleMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region Xor - - /// - /// - /// - /// - /// - /// - public static MatExpr operator ^(Mat a, Mat b) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorXor_MatMat(a.CvPtr, b.CvPtr); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator ^(Mat a, double s) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorXor_MatDouble(a.CvPtr, s); - return new MatExpr(retPtr); - } - - /// - /// - /// - /// - /// - /// - public static MatExpr operator ^(double s, Mat a) - { - if (a == null) - throw new ArgumentNullException(nameof(a)); - a.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorXor_DoubleMat(s, a.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #region Not - - /// - /// - /// - /// - /// - public static MatExpr operator ~(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - m.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_operatorNot(m.CvPtr); - return new MatExpr(retPtr); - } - - #endregion - - #endregion - - #endregion - - #region Comparison - - /// - /// operator < - /// - /// - /// - public MatExpr LessThan(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - - IntPtr expr = NativeMethods.core_Mat_operatorLT_MatMat(ptr, m.CvPtr); - MatExpr ret = new MatExpr(expr); - - GC.KeepAlive(m); - return ret; - } - - /// - /// operator < - /// - /// - /// - public MatExpr LessThan(double d) - { - IntPtr expr = NativeMethods.core_Mat_operatorLT_MatDouble(ptr, d); - MatExpr ret = new MatExpr(expr); - - return ret; - } - - /// - /// operator <= - /// - /// - /// - public MatExpr LessThanOrEqual(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - - IntPtr expr = NativeMethods.core_Mat_operatorLE_MatMat(ptr, m.CvPtr); - MatExpr ret = new MatExpr(expr); - - GC.KeepAlive(m); - return ret; - } - - /// - /// operator <= - /// - /// - /// - public MatExpr LessThanOrEqual(double d) - { - IntPtr expr = NativeMethods.core_Mat_operatorLE_MatDouble(ptr, d); - MatExpr ret = new MatExpr(expr); - - return ret; - } - - /// - /// operator == - /// - /// - /// - public MatExpr Equals(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - - IntPtr expr = NativeMethods.core_Mat_operatorEQ_MatMat(ptr, m.CvPtr); - MatExpr ret = new MatExpr(expr); - - GC.KeepAlive(m); - return ret; - } - - /// - /// operator == - /// - /// - /// - public MatExpr Equals(double d) - { - IntPtr expr = NativeMethods.core_Mat_operatorEQ_MatDouble(ptr, d); - MatExpr ret = new MatExpr(expr); - - return ret; - } - - /// - /// operator != - /// - /// - /// - public MatExpr NotEquals(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - - IntPtr expr = NativeMethods.core_Mat_operatorNE_MatMat(ptr, m.CvPtr); - MatExpr ret = new MatExpr(expr); - - GC.KeepAlive(m); - return ret; - } - - /// - /// operator != - /// - /// - /// - public MatExpr NotEquals(double d) - { - IntPtr expr = NativeMethods.core_Mat_operatorNE_MatDouble(ptr, d); - MatExpr ret = new MatExpr(expr); - - return ret; - } - - /// - /// operator > - /// - /// - /// - public MatExpr GreaterThan(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - - IntPtr expr = NativeMethods.core_Mat_operatorGT_MatMat(ptr, m.CvPtr); - MatExpr ret = new MatExpr(expr); - - GC.KeepAlive(m); - return ret; - } - - /// - /// operator > - /// - /// - /// - public MatExpr GreaterThan(double d) - { - IntPtr expr = NativeMethods.core_Mat_operatorGT_MatDouble(ptr, d); - MatExpr ret = new MatExpr(expr); - - return ret; - } - - /// - /// operator >= - /// - /// - /// - public MatExpr GreaterThanOrEqual(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - - IntPtr expr = NativeMethods.core_Mat_operatorGE_MatMat(ptr, m.CvPtr); - MatExpr ret = new MatExpr(expr); - - GC.KeepAlive(m); - return ret; - } - - /// - /// operator >= - /// - /// - /// - public MatExpr GreaterThanOrEqual(double d) - { - IntPtr expr = NativeMethods.core_Mat_operatorGE_MatDouble(ptr, d); - MatExpr ret = new MatExpr(expr); - - return ret; - } - - #endregion - - #region Public Methods - - #region Mat Indexers - - /// - /// Extracts a rectangular submatrix. - /// - /// Start row of the extracted submatrix. The upper boundary is not included. - /// End row of the extracted submatrix. The upper boundary is not included. - /// Start column of the extracted submatrix. The upper boundary is not included. - /// End column of the extracted submatrix. The upper boundary is not included. - /// - public Mat this[int rowStart, int rowEnd, int colStart, int colEnd] - { - get { return SubMat(rowStart, rowEnd, colStart, colEnd); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - //if (Type() != value.Type()) - // throw new ArgumentException("Mat type mismatch"); - if (Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - Mat sub = SubMat(rowStart, rowEnd, colStart, colEnd); - if (sub.Size() != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - value.CopyTo(sub); - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Start and end row of the extracted submatrix. The upper boundary is not included. - /// To select all the rows, use Range.All(). - /// Start and end column of the extracted submatrix. - /// The upper boundary is not included. To select all the columns, use Range.All(). - /// - public Mat this[Range rowRange, Range colRange] - { - get { return SubMat(rowRange, colRange); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - //if (Type() != value.Type()) - // throw new ArgumentException("Mat type mismatch"); - if (Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - Mat sub = SubMat(rowRange, colRange); - if (sub.Size() != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - value.CopyTo(sub); - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Extracted submatrix specified as a rectangle. - /// - public Mat this[Rect roi] - { - get { return SubMat(roi); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - //if (Type() != value.Type()) - // throw new ArgumentException("Mat type mismatch"); - if (Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - if (roi.Size != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - Mat sub = SubMat(roi); - value.CopyTo(sub); - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Array of selected ranges along each array dimension. - /// - public Mat this[params Range[] ranges] - { - get { return SubMat(ranges); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - //if (Type() != value.Type()) - // throw new ArgumentException("Mat type mismatch"); - - Mat sub = SubMat(ranges); - - int dims = Dims(); - if (dims != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - for (int i = 0; i < dims; i++) - { - if (sub.Size(i) != value.Size(i)) - throw new ArgumentException("Size mismatch at dimension " + i); - } - - value.CopyTo(sub); - } - } - - #endregion - - #region MatExpr Indexers - - #region SubMat - - /// - /// - /// - public class MatExprIndexer : MatExprRangeIndexer - { - /// - /// - /// - /// - protected internal MatExprIndexer(Mat parent) - : base(parent) - { - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Start row of the extracted submatrix. The upper boundary is not included. - /// End row of the extracted submatrix. The upper boundary is not included. - /// Start column of the extracted submatrix. The upper boundary is not included. - /// End column of the extracted submatrix. The upper boundary is not included. - /// - public override MatExpr this[int rowStart, int rowEnd, int colStart, int colEnd] - { - get { return parent.SubMat(rowStart, rowEnd, colStart, colEnd); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - Mat submat = parent.SubMat(rowStart, rowEnd, colStart, colEnd); - NativeMethods.core_Mat_assignment_FromMatExpr(submat.CvPtr, value.CvPtr); - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Start and end row of the extracted submatrix. The upper boundary is not included. - /// To select all the rows, use Range.All(). - /// Start and end column of the extracted submatrix. - /// The upper boundary is not included. To select all the columns, use Range.All(). - /// - public override MatExpr this[Range rowRange, Range colRange] - { - get { return parent.SubMat(rowRange, colRange); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - Mat submat = parent.SubMat(rowRange, colRange); - NativeMethods.core_Mat_assignment_FromMatExpr(submat.CvPtr, value.CvPtr); - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Extracted submatrix specified as a rectangle. - /// - public override MatExpr this[Rect roi] - { - get { return parent.SubMat(roi); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - Mat submat = parent.SubMat(roi); - NativeMethods.core_Mat_assignment_FromMatExpr(submat.CvPtr, value.CvPtr); - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Array of selected ranges along each array dimension. - /// - public override MatExpr this[params Range[] ranges] - { - get { return parent.SubMat(ranges); } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - Mat submat = parent.SubMat(ranges); - NativeMethods.core_Mat_assignment_FromMatExpr(submat.CvPtr, value.CvPtr); - } - } - } - - /// - /// Indexer to access partial Mat as MatExpr - /// - /// - public MatExprIndexer Expr - { - get { return matExprIndexer ?? (matExprIndexer = new MatExprIndexer(this)); } - } - - private MatExprIndexer matExprIndexer; - - #endregion - - #region ColExpr - - /// - /// Mat column's indexer object - /// - public class ColExprIndexer : MatRowColExprIndexer - { - /// - /// - /// - /// - protected internal ColExprIndexer(Mat parent) - : base(parent) - { - } - - /// - /// Creates a matrix header for the specified matrix column. - /// - /// A 0-based column index. - /// - public override MatExpr this[int x] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matExprPtr = NativeMethods.core_Mat_col_toMatExpr(parent.ptr, x); - MatExpr matExpr = new MatExpr(matExprPtr); - return matExpr; - } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - parent.ThrowIfDisposed(); - IntPtr colMatPtr = NativeMethods.core_Mat_col_toMat(parent.ptr, x); - NativeMethods.core_Mat_assignment_FromMatExpr(colMatPtr, value.CvPtr); - NativeMethods.core_Mat_delete(colMatPtr); - } - } - - /// - /// Creates a matrix header for the specified column span. - /// - /// An inclusive 0-based start index of the column span. - /// An exclusive 0-based ending index of the column span. - /// - public override MatExpr this[int startCol, int endCol] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matExprPtr = NativeMethods.core_Mat_colRange_toMatExpr(parent.ptr, startCol, endCol); - MatExpr matExpr = new MatExpr(matExprPtr); - return matExpr; - } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - parent.ThrowIfDisposed(); - IntPtr colMatPtr = NativeMethods.core_Mat_colRange_toMat(parent.ptr, startCol, endCol); - NativeMethods.core_Mat_assignment_FromMatExpr(colMatPtr, value.CvPtr); - NativeMethods.core_Mat_delete(colMatPtr); - } - } - } - - /// - /// Indexer to access Mat column as MatExpr - /// - /// - public ColExprIndexer ColExpr - { - get { return colExprIndexer ?? (colExprIndexer = new ColExprIndexer(this)); } - } - - private ColExprIndexer colExprIndexer; - - #endregion - - #region RowExpr - - /// - /// Mat row's indexer object - /// - public class RowExprIndexer : MatRowColExprIndexer - { - /// - /// - /// - /// - protected internal RowExprIndexer(Mat parent) - : base(parent) - { - } - - /// - /// Creates a matrix header for the specified matrix row. [Mat::row] - /// - /// A 0-based row index. - /// - public override MatExpr this[int y] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matExprPtr = NativeMethods.core_Mat_row_toMatExpr(parent.ptr, y); - MatExpr matExpr = new MatExpr(matExprPtr); - return matExpr; - } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - parent.ThrowIfDisposed(); - IntPtr rowMatPtr = NativeMethods.core_Mat_row_toMat(parent.ptr, y); - NativeMethods.core_Mat_assignment_FromMatExpr(rowMatPtr, value.CvPtr); - NativeMethods.core_Mat_delete(rowMatPtr); - } - } - - /// - /// Creates a matrix header for the specified row span. (Mat::rowRange) - /// - /// An inclusive 0-based start index of the row span. - /// An exclusive 0-based ending index of the row span. - /// - public override MatExpr this[int startRow, int endRow] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matExprPtr = NativeMethods.core_Mat_rowRange_toMatExpr(parent.ptr, startRow, endRow); - MatExpr matExpr = new MatExpr(matExprPtr); - return matExpr; - } - set - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - parent.ThrowIfDisposed(); - IntPtr rowMatPtr = NativeMethods.core_Mat_rowRange_toMat(parent.ptr, startRow, endRow); - NativeMethods.core_Mat_assignment_FromMatExpr(rowMatPtr, value.CvPtr); - } - } - } - - /// - /// Indexer to access Mat row as MatExpr - /// - /// - public RowExprIndexer RowExpr - { - get { return rowExprIndexer ?? (rowExprIndexer = new RowExprIndexer(this)); } - } - - private RowExprIndexer rowExprIndexer; - - #endregion - - #endregion - - #region AdjustROI - - /// - /// Adjusts a submatrix size and position within the parent matrix. - /// - /// Shift of the top submatrix boundary upwards. - /// Shift of the bottom submatrix boundary downwards. - /// Shift of the left submatrix boundary to the left. - /// Shift of the right submatrix boundary to the right. - /// - public Mat AdjustROI(int dtop, int dbottom, int dleft, int dright) - { - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_adjustROI(ptr, dtop, dbottom, dleft, dright); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region AssignTo - - /// - /// Provides a functional form of convertTo. - /// - /// Destination array. - /// Desired destination array depth (or -1 if it should be the same as the source type). - public void AssignTo(Mat m, MatType type) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(nameof(m)); - NativeMethods.core_Mat_assignTo2(ptr, m.CvPtr, type); - } - - /// - /// Provides a functional form of convertTo. - /// - /// Destination array. - public void AssignTo(Mat m) - { - NativeMethods.core_Mat_assignTo1(ptr, m.CvPtr); - } - - #endregion - - #region Channels - - /// - /// Returns the number of matrix channels. - /// - /// - public int Channels() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_channels(ptr); - } - - #endregion - - #region CheckVector - - /// - /// - /// - /// - /// - public int CheckVector(int elemChannels) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_checkVector1(ptr, elemChannels); - } - - /// - /// - /// - /// - /// - /// - public int CheckVector(int elemChannels, int depth) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_checkVector2(ptr, elemChannels, depth); - } - - /// - /// - /// - /// - /// - /// - /// - public int CheckVector(int elemChannels, int depth, bool requireContinuous) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_checkVector3( - ptr, elemChannels, depth, requireContinuous ? 1 : 0); - } - - #endregion - - #region Clone - - /// - /// Creates a full copy of the matrix. - /// - /// - public Mat Clone() - { - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_clone(ptr); - Mat retVal = new Mat(retPtr); - return retVal; - } - - /// - /// Returns the partial Mat of the specified Mat - /// - /// - /// - public Mat Clone(Rect roi) - { - using (var part = new Mat(this, roi)) - { - return part.Clone(); - } - } - - #endregion - - #region Cols - - /// - /// the number of columns or -1 when the array has more than 2 dimensions - /// - /// - public int Cols - { - get - { - //行列データが新たに確保された場合に対応できない。 - //if (colsVal == int.MinValue) - //{ - // colsVal = NativeMethods.core_Mat_cols(ptr); - //} - //return colsVal; - return NativeMethods.core_Mat_cols(ptr); - } - } - - /// - /// the number of columns or -1 when the array has more than 2 dimensions - /// - /// - public int Width - { - get - { - //if (colsVal == int.MinValue) - //{ - // colsVal = Cols; - //} - //return colsVal; - return NativeMethods.core_Mat_cols(ptr); - } - } - - //private int colsVal = int.MinValue; - - #endregion - - #region Dims - - /// - /// the array dimensionality, >= 2 - /// - public int Dims() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_dims(ptr); - } - - #endregion - - #region ConvertTo - - /// - /// Converts an array to another data type with optional scaling. - /// - /// output matrix; if it does not have a proper size or type before the operation, it is reallocated. - /// desired output matrix type or, rather, the depth since the number of channels are the same as the input has; - /// if rtype is negative, the output matrix will have the same type as the input. - /// optional scale factor. - /// optional delta added to the scaled values. - public void ConvertTo(Mat m, MatType rtype, double alpha = 1, double beta = 0) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(nameof(m)); - NativeMethods.core_Mat_convertTo(ptr, m.CvPtr, rtype, alpha, beta); - } - - #endregion - - #region CopyTo - - /// - /// Copies the matrix to another one. - /// - /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. - public void CopyTo(Mat m) - { - CopyTo(m, null); - } - - /// - /// Copies the matrix to another one. - /// - /// Destination matrix. If it does not have a proper size or type before the operation, it is reallocated. - /// Operation mask. Its non-zero elements indicate which matrix elements need to be copied. - public void CopyTo(Mat m, Mat mask) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(nameof(m)); - IntPtr maskPtr = Cv2.ToPtr(mask); - NativeMethods.core_Mat_copyTo(ptr, m.CvPtr, maskPtr); - } - - #endregion - - #region Create - - /// - /// Allocates new array data if needed. - /// - /// New number of rows. - /// New number of columns. - /// New matrix type. - public void Create(int rows, int cols, MatType type) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_create1(ptr, rows, cols, type); - } - - /// - /// Allocates new array data if needed. - /// - /// Alternative new matrix size specification: Size(cols, rows) - /// New matrix type. - public void Create(Size size, MatType type) - { - Create(size.Height, size.Width, type); - } - - /// - /// Allocates new array data if needed. - /// - /// Array of integers specifying a new array shape. - /// New matrix type. - public void Create(MatType type, params int[] sizes) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - if (sizes.Length < 2) - throw new ArgumentException("sizes.Length < 2"); - NativeMethods.core_Mat_create2(ptr, sizes.Length, sizes, type); - } - - #endregion - - #region Cross - - /// - /// Computes a cross-product of two 3-element vectors. - /// - /// Another cross-product operand. - /// - public Mat Cross(Mat m) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(nameof(m)); - IntPtr retPtr = NativeMethods.core_Mat_cross(ptr, m.CvPtr); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region Data - - /// - /// pointer to the data - /// - public IntPtr Data - { - get - { - unsafe - { - return new IntPtr(DataPointer); - } - } - } - - /// - /// unsafe pointer to the data - /// - public unsafe byte* DataPointer - { - get - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_data(ptr); - } - } - - /// - /// The pointer that is possible to compute a relative sub-array position in the main container array using locateROI() - /// - public IntPtr DataStart - { - get - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_datastart(ptr); - } - } - - /// - /// The pointer that is possible to compute a relative sub-array position in the main container array using locateROI() - /// - public IntPtr DataEnd - { - get - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_dataend(ptr); - } - } - - /// - /// The pointer that is possible to compute a relative sub-array position in the main container array using locateROI() - /// - public IntPtr DataLimit - { - get - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_datalimit(ptr); - } - } - - #endregion - - #region Depth - - /// - /// Returns the depth of a matrix element. - /// - /// - public int Depth() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_depth(ptr); - } - - #endregion - - #region Diag - - /// - /// Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values: - /// - /// Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values: - /// - public Mat Diag(MatDiagType d = MatDiagType.Main) - { - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_diag2(ptr, (int) d); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region Dot - - /// - /// Computes a dot-product of two vectors. - /// - /// another dot-product operand. - /// - public double Dot(Mat m) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(nameof(m)); - return NativeMethods.core_Mat_dot(ptr, m.CvPtr); - } - - #endregion - - #region ElemSize - - /// - /// Returns the matrix element size in bytes. - /// - /// - public int ElemSize() - { - ThrowIfDisposed(); - return (int) NativeMethods.core_Mat_elemSize(ptr); - } - - #endregion - - #region ElemSize1 - - /// - /// Returns the size of each matrix element channel in bytes. - /// - /// - public int ElemSize1() - { - ThrowIfDisposed(); - return (int) NativeMethods.core_Mat_elemSize1(ptr); - } - - #endregion - - #region Empty - - /// - /// Returns true if the array has no elements. - /// - /// - public bool Empty() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_empty(ptr) != 0; - } - - #endregion - - #region Inv - - /// - /// Inverses a matrix. - /// - /// Matrix inversion method - /// - public Mat Inv(DecompTypes method = DecompTypes.LU) - { - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_inv2(ptr, (int) method); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region IsContinuous - - /// - /// Reports whether the matrix is continuous or not. - /// - /// - public bool IsContinuous() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_isContinuous(ptr) != 0; - } - - #endregion - - #region IsSubmatrix - - /// - /// Returns whether this matrix is a part of other matrix or not. - /// - /// - public bool IsSubmatrix() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_isSubmatrix(ptr) != 0; - } - - #endregion - - #region LocateROI - - /// - /// Locates the matrix header within a parent matrix. - /// - /// Output parameter that contains the size of the whole matrix containing *this as a part. - /// Output parameter that contains an offset of *this inside the whole matrix. - public void LocateROI(out Size wholeSize, out Point ofs) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_locateROI(ptr, out wholeSize, out ofs); - } - - #endregion - - #region Mul - - /// - /// Performs an element-wise multiplication or division of the two matrices. - /// - /// - /// - /// - public MatExpr Mul(Mat m, double scale = 1) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(); - IntPtr mPtr = m.CvPtr; - IntPtr retPtr = NativeMethods.core_Mat_mul2(ptr, mPtr, scale); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - - #endregion - - #region Reshape - - /// - /// Changes the shape and/or the number of channels of a 2D matrix without copying the data. - /// - /// New number of channels. If the parameter is 0, the number of channels remains the same. - /// New number of rows. If the parameter is 0, the number of rows remains the same. - /// - public Mat Reshape(int cn, int rows = 0) - { - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_reshape2(ptr, cn, rows); - Mat retVal = new Mat(retPtr); - return retVal; - } - - /// - /// Changes the shape and/or the number of channels of a 2D matrix without copying the data. - /// - /// New number of channels. If the parameter is 0, the number of channels remains the same. - /// New number of rows. If the parameter is 0, the number of rows remains the same. - /// - public Mat Reshape(int cn, params int[] newDims) - { - ThrowIfDisposed(); - if (newDims == null) - throw new ArgumentNullException(nameof(newDims)); - IntPtr retPtr = NativeMethods.core_Mat_reshape3(ptr, cn, newDims.Length, newDims); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region Rows - - /// - /// the number of rows or -1 when the array has more than 2 dimensions - /// - public int Rows - { - get - { - //if (rowsVal == int.MinValue) - //{ - // rowsVal = NativeMethods.core_Mat_rows(ptr); - //} - //return rowsVal; - return NativeMethods.core_Mat_rows(ptr); - } - } - - /// - /// the number of rows or -1 when the array has more than 2 dimensions - /// - /// - public int Height - { - get - { - //if (rowsVal == int.MinValue) - //{ - // rowsVal = Rows; - //} - //return rowsVal; - return NativeMethods.core_Mat_rows(ptr); - } - } - - //private int rowsVal = int.MinValue; - - #endregion - - #region SetTo - - /// - /// Sets all or some of the array elements to the specified value. - /// - /// - /// - /// - public Mat SetTo(Scalar value, Mat mask = null) - { - ThrowIfDisposed(); - IntPtr maskPtr = Cv2.ToPtr(mask); - IntPtr retPtr = NativeMethods.core_Mat_setTo_Scalar(ptr, value, maskPtr); - Mat retVal = new Mat(retPtr); - GC.KeepAlive(mask); - return retVal; - } - - /// - /// Sets all or some of the array elements to the specified value. - /// - /// - /// - /// - public Mat SetTo(InputArray value, Mat mask = null) - { - ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - IntPtr maskPtr = Cv2.ToPtr(mask); - IntPtr retPtr = NativeMethods.core_Mat_setTo_InputArray(ptr, value.CvPtr, maskPtr); - Mat retVal = new Mat(retPtr); - GC.KeepAlive(mask); - return retVal; - } - - #endregion - - #region Size - - /// - /// Returns a matrix size. - /// - /// - public Size Size() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_size(ptr); - } - - /// - /// Returns a matrix size. - /// - /// - /// - public int Size(int dim) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_sizeAt(ptr, dim); - } - - #endregion - - #region Step - - /// - /// - /// - /// - public long Step() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_step(ptr); - } - - /// - /// - /// - /// - /// - public long Step(int i) - { - ThrowIfDisposed(); - return (long) NativeMethods.core_Mat_stepAt(ptr, i); - } - - #endregion - - #region Step1 - - /// - /// Returns a normalized step. - /// - /// - public long Step1() - { - ThrowIfDisposed(); - return (long) NativeMethods.core_Mat_step11(ptr); - } - - /// - /// Returns a normalized step. - /// - /// - /// - public long Step1(int i) - { - ThrowIfDisposed(); - return (long) NativeMethods.core_Mat_step12(ptr, i); - } - - #endregion - - #region T - - /// - /// Transposes a matrix. - /// - /// - public Mat T() - { - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_t(ptr); - Mat retVal = new Mat(retPtr); - return retVal; - } - - #endregion - - #region Total - - /// - /// Returns the total number of array elements. - /// - /// - public long Total() - { - ThrowIfDisposed(); - return (long) NativeMethods.core_Mat_total(ptr); - } - - #endregion - - #region Type - - /// - /// Returns the type of a matrix element. - /// - /// - public MatType Type() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_type(ptr); - } - - #endregion - - #region ToString - - /// - /// Returns a string that represents this Mat. - /// - /// - public override string ToString() - { - return "Mat [ " + - Rows + "*" + Cols + "*" + Type().ToString() + - ", IsContinuous=" + IsContinuous() + ", IsSubmatrix=" + IsSubmatrix() + - ", Ptr=0x" + Convert.ToString(ptr.ToInt64(), 16) + - ", Data=0x" + Convert.ToString(Data.ToInt64(), 16) + - " ]"; - } - - #endregion - - #region Dump - - /// - /// Returns a string that represents each element value of Mat. - /// This method corresponds to std::ostream << Mat - /// - /// - /// - public string Dump(DumpFormat format = DumpFormat.Default) - { - ThrowIfDisposed(); - string formatStr = GetDumpFormatString(format); - unsafe - { - sbyte* buf = null; - try - { - buf = NativeMethods.core_Mat_dump(ptr, formatStr); - return StringHelper.PtrToStringAnsi(buf); - } - finally - { - if (buf != null) - NativeMethods.core_Mat_dump_delete(buf); - } - } - } - - private static string GetDumpFormatString(DumpFormat format) - { - if (format == DumpFormat.Default) - return null; - - string name = Enum.GetName(typeof(DumpFormat), format); - if (name == null) - throw new ArgumentException(); - return name.ToLower(); - } - - #endregion - - #region EmptyClone - -#if LANG_JP -/// -/// このMatと同じサイズ・ビット深度・チャネル数を持つ -/// Matオブジェクトを新たに作成し、返す -/// -/// コピーされた画像 -#else - /// - /// Makes a Mat that have the same size, depth and channels as this image - /// - /// -#endif - public Mat EmptyClone() - { - return new Mat(Size(), Type()); - } - - #endregion - - #region Ptr - - /// - /// Returns a pointer to the specified matrix row. - /// - /// Index along the dimension 0 - /// - public IntPtr Ptr(int i0) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_ptr1d(ptr, i0); - } - - /// - /// Returns a pointer to the specified matrix element. - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// - public IntPtr Ptr(int i0, int i1) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_ptr2d(ptr, i0, i1); - } - - /// - /// Returns a pointer to the specified matrix element. - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// - public IntPtr Ptr(int i0, int i1, int i2) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_ptr3d(ptr, i0, i1, i2); - } - - /// - /// Returns a pointer to the specified matrix element. - /// - /// Array of Mat::dims indices. - /// - public IntPtr Ptr(params int[] idx) - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_ptrnd(ptr, idx); - } - - #endregion - - #region Element Indexer - - /// - /// Mat Indexer - /// - /// - public sealed class Indexer : MatIndexer where T : struct - { - private readonly long ptrVal; - - internal Indexer(Mat parent) - : base(parent) - { - ptrVal = parent.Data.ToInt64(); - } - - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override T this[int i0] - { - get - { - IntPtr p = new IntPtr(ptrVal + (steps[0] * i0)); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = new IntPtr(ptrVal + (steps[0] * i0)); - Marshal.StructureToPtr(value, p, false); - } - } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override T this[int i0, int i1] - { - get - { - IntPtr p = new IntPtr(ptrVal + (steps[0] * i0) + (steps[1] * i1)); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = new IntPtr(ptrVal + (steps[0] * i0) + (steps[1] * i1)); - Marshal.StructureToPtr(value, p, false); - } - } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override T this[int i0, int i1, int i2] - { - get - { - IntPtr p = new IntPtr(ptrVal + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = new IntPtr(ptrVal + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - Marshal.StructureToPtr(value, p, false); - } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override T this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - IntPtr p = new IntPtr(ptrVal + offset); - return MarshalHelper.PtrToStructure(p); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - IntPtr p = new IntPtr(ptrVal + offset); - Marshal.StructureToPtr(value, p, false); - } - } - } - - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - /// - public Indexer GetGenericIndexer() where T : struct - { - return new Indexer(this); - } - - #endregion - - #region Get/Set - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public T Get(int i0) where T : struct - { - return new Indexer(this)[i0]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public T Get(int i0, int i1) where T : struct - { - return new Indexer(this)[i0, i1]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public T Get(int i0, int i1, int i2) where T : struct - { - return new Indexer(this)[i0, i1, i2]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public T Get(params int[] idx) where T : struct - { - return new Indexer(this)[idx]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public T At(int i0) where T : struct - { - return new Indexer(this)[i0]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public T At(int i0, int i1) where T : struct - { - return new Indexer(this)[i0, i1]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public T At(int i0, int i1, int i2) where T : struct - { - return new Indexer(this)[i0, i1, i2]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public T At(params int[] idx) where T : struct - { - return new Indexer(this)[idx]; - } - - - /// - /// Set a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// - public void Set(int i0, T value) where T : struct - { - (new Indexer(this))[i0] = value; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// - public void Set(int i0, int i1, T value) where T : struct - { - (new Indexer(this))[i0, i1] = value; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// - public void Set(int i0, int i1, int i2, T value) where T : struct - { - (new Indexer(this)[i0, i1, i2]) = value; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Array of Mat::dims indices. - /// - public void Set(int[] idx, T value) where T : struct - { - (new Indexer(this)[idx]) = value; - } - - #endregion - - #region Col/ColRange - - /* - /// - /// - /// - /// - /// - public Mat Col(int x) - { - ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_col_toMat(ptr, x); - return new Mat(matPtr); - } - */ - - /// - /// - /// - /// - /// - /// - public Mat ColRange(int startCol, int endCol) - { - ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_colRange_toMat(ptr, startCol, endCol); - return new Mat(matPtr); - } - - /// - /// - /// - /// - /// - public Mat ColRange(Range range) - { - return ColRange(range.Start, range.End); - } - - - /// - /// Mat column's indexer object - /// - public class ColIndexer : MatRowColIndexer - { - /// - /// - /// - /// - protected internal ColIndexer(Mat parent) - : base(parent) - { - } - - /// - /// Creates a matrix header for the specified matrix column. - /// - /// A 0-based column index. - /// - public override Mat this[int x] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_col_toMat(parent.ptr, x); - Mat mat = new Mat(matPtr); - return mat; - } - set - { - parent.ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - if (parent.Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - IntPtr matPtr = NativeMethods.core_Mat_col_toMat(parent.ptr, x); - Mat mat = new Mat(matPtr); - if (mat.Size() != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - value.CopyTo(mat); - } - } - - /// - /// Creates a matrix header for the specified column span. - /// - /// An inclusive 0-based start index of the column span. - /// An exclusive 0-based ending index of the column span. - /// - public override Mat this[int startCol, int endCol] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_colRange_toMat(parent.ptr, startCol, endCol); - Mat mat = new Mat(matPtr); - return mat; - } - set - { - parent.ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - if (parent.Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - IntPtr colMatPtr = NativeMethods.core_Mat_colRange_toMat(parent.ptr, startCol, endCol); - Mat colMat = new Mat(colMatPtr); - if (colMat.Size() != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - value.CopyTo(colMat); - } - } - } - - /// - /// Indexer to access Mat column as Mat - /// - /// - public ColIndexer Col - { - get { return colIndexer ?? (colIndexer = new ColIndexer(this)); } - } - - private ColIndexer colIndexer; - - #endregion - - #region Row/RowRange - - /* - /// - /// - /// - /// - /// - public Mat Row(int y) - { - ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_row_toMat(ptr, y); - return new Mat(matPtr); - } - */ - - /// - /// - /// - /// - /// - /// - public Mat RowRange(int startRow, int endRow) - { - ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_rowRange_toMat(ptr, startRow, endRow); - return new Mat(matPtr); - } - - /// - /// - /// - /// - /// - public Mat RowRange(Range range) - { - return RowRange(range.Start, range.End); - } - - /// - /// Mat row's indexer object - /// - public class RowIndexer : MatRowColIndexer - { - /// - /// - /// - /// - protected internal RowIndexer(Mat parent) - : base(parent) - { - } - - /// - /// Creates a matrix header for the specified matrix column. - /// - /// A 0-based column index. - /// - public override Mat this[int x] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_row_toMat(parent.ptr, x); - Mat mat = new Mat(matPtr); - return mat; - } - set - { - parent.ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - if (parent.Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - IntPtr matPtr = NativeMethods.core_Mat_row_toMat(parent.ptr, x); - Mat mat = new Mat(matPtr); - if (mat.Size() != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - value.CopyTo(mat); - } - } - - /// - /// Creates a matrix header for the specified column span. - /// - /// An inclusive 0-based start index of the column span. - /// An exclusive 0-based ending index of the column span. - /// - public override Mat this[int startCol, int endCol] - { - get - { - parent.ThrowIfDisposed(); - IntPtr matPtr = NativeMethods.core_Mat_rowRange_toMat(parent.ptr, startCol, endCol); - Mat mat = new Mat(matPtr); - return mat; - } - set - { - parent.ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - value.ThrowIfDisposed(); - if (parent.Dims() != value.Dims()) - throw new ArgumentException("Dimension mismatch"); - - IntPtr matPtr = NativeMethods.core_Mat_rowRange_toMat(parent.ptr, startCol, endCol); - Mat mat = new Mat(matPtr); - if (mat.Size() != value.Size()) - throw new ArgumentException("Specified ROI != mat.Size()"); - value.CopyTo(mat); - } - } - } - - /// - /// Indexer to access Mat row as Mat - /// - /// - public RowIndexer Row - { - get { return rowIndexer ?? (rowIndexer = new RowIndexer(this)); } - } - - private RowIndexer rowIndexer; - - #endregion - - #region SubMat - - /// - /// - /// - /// - /// - /// - /// - /// - public Mat SubMat(int rowStart, int rowEnd, int colStart, int colEnd) - { - if (rowStart >= rowEnd) - throw new ArgumentException("rowStart >= rowEnd"); - if (colStart >= colEnd) - throw new ArgumentException("colStart >= colEnd"); - - ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_Mat_subMat1(ptr, rowStart, rowEnd, colStart, colEnd); - Mat retVal = new Mat(retPtr); - return retVal; - } - - /// - /// - /// - /// - /// - /// - public Mat SubMat(Range rowRange, Range colRange) - { - return SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); - } - - /// - /// - /// - /// - /// - public Mat SubMat(Rect roi) - { - return SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); - } - - - /// - /// - /// - /// - /// - public Mat SubMat(params Range[] ranges) - { - throw new NotImplementedException(); - /* - if (ranges == null) - throw new ArgumentNullException(); - - ThrowIfDisposed(); - CvSlice[] slices = new CvSlice[ranges.Length]; - for (int i = 0; i < ranges.Length; i++) - { - slices[i] = ranges[i]; - } - - IntPtr retPtr = NativeMethods.core_Mat_subMat1(ptr, ranges.Length, ranges); - Mat retVal = new Mat(retPtr); - return retVal;*/ - } - - #endregion - - #region GetArray - - private void CheckArgumentsForConvert(int row, int col, Array data, - params MatType[] acceptableTypes) - { - ThrowIfDisposed(); - if (row < 0 || row >= Rows) - throw new ArgumentOutOfRangeException(nameof(row)); - if (col < 0 || col >= Cols) - throw new ArgumentOutOfRangeException(nameof(col)); - if (data == null) - throw new ArgumentNullException(nameof(data)); - - MatType t = Type(); - if (data == null || data.Length % t.Channels != 0) - throw new OpenCvSharpException( - "Provided data element number ({0}) should be multiple of the Mat channels count ({1})", - data.Length, t.Channels); - - if (acceptableTypes != null && acceptableTypes.Length > 0) - { - bool isValidDepth = EnumerableEx.Any(acceptableTypes, delegate(MatType type) - { - return type == t; - }); - if (!isValidDepth) - throw new OpenCvSharpException("Mat data type is not compatible: " + t); - } - } - - private void CheckArgumentsForConvert(int row, int col, Array data, int dataDimension, - params MatType[] acceptableTypes) - { - ThrowIfDisposed(); - if (row < 0 || row >= Rows) - throw new ArgumentOutOfRangeException(nameof(row)); - if (col < 0 || col >= Cols) - throw new ArgumentOutOfRangeException(nameof(col)); - if (data == null) - throw new ArgumentNullException(nameof(data)); - - MatType t = Type(); - if (data == null || (data.Length * dataDimension) % t.Channels != 0) - throw new OpenCvSharpException( - "Provided data element number ({0}) should be multiple of the Mat channels count ({1})", - data.Length, t.Channels); - - if (acceptableTypes != null && acceptableTypes.Length > 0) - { - bool isValidDepth = EnumerableEx.Any(acceptableTypes, delegate(MatType type) - { - return type == t; - }); - if (!isValidDepth) - throw new OpenCvSharpException("Mat data type is not compatible: " + t); - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, byte[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_8S, MatType.CV_8U); - unsafe - { - fixed (byte* pData = data) - { - NativeMethods.core_Mat_nGetB(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, byte[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_8S, MatType.CV_8U); - unsafe - { - fixed (byte* pData = data) - { - NativeMethods.core_Mat_nGetB(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, short[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16S, MatType.CV_16U); - unsafe - { - fixed (short* pData = data) - { - NativeMethods.core_Mat_nGetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, short[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16S, MatType.CV_16U); - unsafe - { - fixed (short* pData = data) - { - NativeMethods.core_Mat_nGetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, ushort[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16S, MatType.CV_16U); - unsafe - { - fixed (ushort* pData = data) - { - NativeMethods.core_Mat_nGetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, ushort[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16S, MatType.CV_16U); - unsafe - { - fixed (ushort* pData = data) - { - NativeMethods.core_Mat_nGetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, int[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32S); - unsafe - { - fixed (int* pData = data) - { - NativeMethods.core_Mat_nGetI(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, int[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32S); - unsafe - { - fixed (int* pData = data) - { - NativeMethods.core_Mat_nGetI(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, float[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32F); - unsafe - { - fixed (float* pData = data) - { - NativeMethods.core_Mat_nGetF(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, float[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32F); - unsafe - { - fixed (float* pData = data) - { - NativeMethods.core_Mat_nGetF(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, double[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64F); - unsafe - { - fixed (double* pData = data) - { - NativeMethods.core_Mat_nGetD(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, double[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64F); - unsafe - { - fixed (double* pData = data) - { - NativeMethods.core_Mat_nGetD(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public double[] GetArray(int row, int col) - { - ThrowIfDisposed(); - if (row < 0 || row >= Rows) - throw new ArgumentOutOfRangeException(nameof(row)); - if (col < 0 || col >= Cols) - throw new ArgumentOutOfRangeException(nameof(col)); - - double[] ret = new double[Channels()]; - unsafe - { - fixed (double* pData = ret) - { - NativeMethods.core_Mat_nGetD(ptr, row, col, pData, ret.Length); - return ret; - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec3b[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_8UC3); - unsafe - { - fixed (Vec3b* pData = data) - { - NativeMethods.core_Mat_nGetVec3b(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec3b[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_8UC3); - unsafe - { - fixed (Vec3b* pData = data) - { - NativeMethods.core_Mat_nGetVec3b(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec3d[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64FC3); - unsafe - { - fixed (Vec3d* pData = data) - { - NativeMethods.core_Mat_nGetVec3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec3d[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64FC3); - unsafe - { - fixed (Vec3d* pData = data) - { - NativeMethods.core_Mat_nGetVec3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec4f[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32FC4); - unsafe - { - fixed (Vec4f* pData = data) - { - NativeMethods.core_Mat_nGetVec4f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec4f[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32FC4); - unsafe - { - fixed (Vec4f* pData = data) - { - NativeMethods.core_Mat_nGetVec4f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec6f[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32FC(6)); - unsafe - { - fixed (Vec6f* pData = data) - { - NativeMethods.core_Mat_nGetVec6f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec6f[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32FC(6)); - unsafe - { - fixed (Vec6f* pData = data) - { - NativeMethods.core_Mat_nGetVec6f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec4i[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32SC4); - unsafe - { - fixed (Vec4i* pData = data) - { - NativeMethods.core_Mat_nGetVec4i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Vec4i[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32SC4); - unsafe - { - fixed (Vec4i* pData = data) - { - NativeMethods.core_Mat_nGetVec4i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32SC2); - unsafe - { - fixed (Point* pData = data) - { - NativeMethods.core_Mat_nGetPoint(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32SC2); - unsafe - { - fixed (Point* pData = data) - { - NativeMethods.core_Mat_nGetPoint(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point2f[] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32FC2); - unsafe - { - fixed (Point2f* pData = data) - { - NativeMethods.core_Mat_nGetPoint2f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point2f[,] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32FC2); - unsafe - { - fixed (Point2f* pData = data) - { - NativeMethods.core_Mat_nGetPoint2f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point2d[] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_64FC2); - unsafe - { - fixed (Point2d* pData = data) - { - NativeMethods.core_Mat_nGetPoint2d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point2d[,] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_64FC2); - unsafe - { - fixed (Point2d* pData = data) - { - NativeMethods.core_Mat_nGetPoint2d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point3i[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32SC3); - unsafe - { - fixed (Point3i* pData = data) - { - NativeMethods.core_Mat_nGetPoint3i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point3i[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32SC3); - unsafe - { - fixed (Point3i* pData = data) - { - NativeMethods.core_Mat_nGetPoint3i(ptr, row, col, pData, data.Length); - } - } - } - - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point3f[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32FC3); - unsafe - { - fixed (Point3f* pData = data) - { - NativeMethods.core_Mat_nGetPoint3f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point3f[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32FC3); - unsafe - { - fixed (Point3f* pData = data) - { - NativeMethods.core_Mat_nGetPoint3f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point3d[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_64FC3); - unsafe - { - fixed (Point3d* pData = data) - { - NativeMethods.core_Mat_nGetPoint3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Point3d[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_64FC3); - unsafe - { - fixed (Point3d* pData = data) - { - NativeMethods.core_Mat_nGetPoint3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Rect[] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32SC4); - unsafe - { - fixed (Rect* pData = data) - { - NativeMethods.core_Mat_nGetRect(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, Rect[,] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32SC4); - unsafe - { - fixed (Rect* pData = data) - { - NativeMethods.core_Mat_nGetRect(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, DMatch[] data) - { - CheckArgumentsForConvert(row, col, data); - unsafe - { - Vec4f[] dataV = new Vec4f[data.Length]; - fixed (Vec4f* pData = dataV) - { - NativeMethods.core_Mat_nGetVec4f(ptr, row, col, pData, dataV.Length); - for (int i = 0; i < data.Length; i++) - { - data[i] = (DMatch) dataV[i]; - } - } - } - } - - /// - /// Get the data of this matrix as array - /// - /// - /// - /// - public void GetArray(int row, int col, DMatch[,] data) - { - CheckArgumentsForConvert(row, col, data); - int dim0 = data.GetLength(0); - int dim1 = data.GetLength(1); - unsafe - { - Vec4f[,] dataV = new Vec4f[dim0, dim1]; - fixed (Vec4f* pData = dataV) - { - NativeMethods.core_Mat_nGetVec4f(ptr, row, col, pData, dataV.Length); - for (int i = 0; i < dim0; i++) - { - for (int j = 0; j < dim1; j++) - { - data[i, j] = (DMatch) dataV[i, j]; - } - } - } - } - } - - #endregion - - #region SetArray - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params byte[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_8U); - unsafe - { - fixed (byte* pData = data) - { - NativeMethods.core_Mat_nSetB(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, byte[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_8U); - unsafe - { - fixed (byte* pData = data) - { - NativeMethods.core_Mat_nSetB(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params short[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16SC1, MatType.CV_16U); - unsafe - { - fixed (short* pData = data) - { - NativeMethods.core_Mat_nSetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, short[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16SC1, MatType.CV_16U); - unsafe - { - fixed (short* pData = data) - { - NativeMethods.core_Mat_nSetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params ushort[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16S, MatType.CV_16U); - unsafe - { - fixed (ushort* pData = data) - { - NativeMethods.core_Mat_nSetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, ushort[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_16S, MatType.CV_16U); - unsafe - { - fixed (ushort* pData = data) - { - NativeMethods.core_Mat_nSetS(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params int[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32S); - unsafe - { - fixed (int* pData = data) - { - NativeMethods.core_Mat_nSetI(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, int[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32S); - unsafe - { - fixed (int* pData = data) - { - NativeMethods.core_Mat_nSetI(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params float[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32F); - unsafe - { - fixed (float* pData = data) - { - NativeMethods.core_Mat_nSetF(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, float[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_32F); - unsafe - { - fixed (float* pData = data) - { - NativeMethods.core_Mat_nSetF(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params double[] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64F); - unsafe - { - fixed (double* pData = data) - { - NativeMethods.core_Mat_nSetD(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, double[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64F); - unsafe - { - fixed (double* pData = data) - { - NativeMethods.core_Mat_nSetD(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Vec3b[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_8UC3); - unsafe - { - fixed (Vec3b* pData = data) - { - NativeMethods.core_Mat_nSetVec3b(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Vec3b[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_8UC3); - unsafe - { - fixed (Vec3b* pData = data) - { - NativeMethods.core_Mat_nSetVec3b(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Vec3d[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_64FC3); - unsafe - { - fixed (Vec3d* pData = data) - { - NativeMethods.core_Mat_nSetVec3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Vec3d[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_64FC3); - unsafe - { - fixed (Vec3d* pData = data) - { - NativeMethods.core_Mat_nSetVec3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Vec4f[] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32FC4); - unsafe - { - fixed (Vec4f* pData = data) - { - NativeMethods.core_Mat_nSetVec4f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Vec4f[,] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32FC4); - unsafe - { - fixed (Vec4f* pData = data) - { - NativeMethods.core_Mat_nSetVec4f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Vec6f[] data) - { - CheckArgumentsForConvert(row, col, data, 6, MatType.CV_32FC(6)); - unsafe - { - fixed (Vec6f* pData = data) - { - NativeMethods.core_Mat_nSetVec6f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Vec6f[,] data) - { - CheckArgumentsForConvert(row, col, data, 6, MatType.CV_32FC(6)); - unsafe - { - fixed (Vec6f* pData = data) - { - NativeMethods.core_Mat_nSetVec6f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Vec4i[] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32SC4); - unsafe - { - fixed (Vec4i* pData = data) - { - NativeMethods.core_Mat_nSetVec4i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Vec4i[,] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32SC4); - unsafe - { - fixed (Vec4i* pData = data) - { - NativeMethods.core_Mat_nSetVec4i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Point[] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32SC2); - unsafe - { - fixed (Point* pData = data) - { - NativeMethods.core_Mat_nSetPoint(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Point[,] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32SC2); - unsafe - { - fixed (Point* pData = data) - { - NativeMethods.core_Mat_nSetPoint(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Point2f[] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32FC2); - unsafe - { - fixed (Point2f* pData = data) - { - NativeMethods.core_Mat_nSetPoint2f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Point2f[,] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_32FC2); - unsafe - { - fixed (Point2f* pData = data) - { - NativeMethods.core_Mat_nSetPoint2f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Point2d[] data) - { - CheckArgumentsForConvert(row, col, data, 2, MatType.CV_64FC2); - unsafe - { - fixed (Point2d* pData = data) - { - NativeMethods.core_Mat_nSetPoint2d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Point2d[,] data) - { - CheckArgumentsForConvert(row, col, data, MatType.CV_64FC2); - unsafe - { - fixed (Point2d* pData = data) - { - NativeMethods.core_Mat_nSetPoint2d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Point3i[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32SC3); - unsafe - { - fixed (Point3i* pData = data) - { - NativeMethods.core_Mat_nSetPoint3i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Point3i[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32SC3); - unsafe - { - fixed (Point3i* pData = data) - { - NativeMethods.core_Mat_nSetPoint3i(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Point3f[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32FC3); - unsafe - { - fixed (Point3f* pData = data) - { - NativeMethods.core_Mat_nSetPoint3f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Point3f[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_32FC3); - unsafe - { - fixed (Point3f* pData = data) - { - NativeMethods.core_Mat_nSetPoint3f(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Point3d[] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_64FC3); - unsafe - { - fixed (Point3d* pData = data) - { - NativeMethods.core_Mat_nSetPoint3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Point3d[,] data) - { - CheckArgumentsForConvert(row, col, data, 3, MatType.CV_64FC3); - unsafe - { - fixed (Point3d* pData = data) - { - NativeMethods.core_Mat_nSetPoint3d(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params Rect[] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32SC4); - unsafe - { - fixed (Rect* pData = data) - { - NativeMethods.core_Mat_nSetRect(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, Rect[,] data) - { - CheckArgumentsForConvert(row, col, data, 4, MatType.CV_32SC4); - unsafe - { - fixed (Rect* pData = data) - { - NativeMethods.core_Mat_nSetRect(ptr, row, col, pData, data.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, params DMatch[] data) - { - CheckArgumentsForConvert(row, col, data); - Vec4f[] dataV = EnumerableEx.SelectToArray(data, d => (Vec4f) d); - unsafe - { - fixed (Vec4f* pData = dataV) - { - NativeMethods.core_Mat_nSetVec4f(ptr, row, col, pData, dataV.Length); - } - } - } - - /// - /// Set the specified array data to this matrix - /// - /// - /// - /// - public void SetArray(int row, int col, DMatch[,] data) - { - CheckArgumentsForConvert(row, col, data); - Vec4f[] dataV = EnumerableEx.SelectToArray(data, (DMatch d) => (Vec4f) d); - unsafe - { - fixed (Vec4f* pData = dataV) - { - NativeMethods.core_Mat_nSetVec4f(ptr, row, col, pData, dataV.Length); - } - } - } - - #endregion - - #region Reserve - - /// - /// reserves enough space to fit sz hyper-planes - /// - /// - public void Reserve(long sz) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_reserve(ptr, new IntPtr(sz)); - } - - #endregion - - #region Resize - - /// - /// resizes matrix to the specified number of hyper-planes - /// - /// - public void Resize(long sz) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_resize1(ptr, new IntPtr(sz)); - } - - /// - /// resizes matrix to the specified number of hyper-planes; initializes the newly added elements - /// - /// - /// - public void Resize(long sz, Scalar s) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_resize2(ptr, new IntPtr(sz), s); - } - - #endregion - - #region PushBack - - /// - /// Adds elements to the bottom of the matrix. (Mat.push_back) - /// - /// Added line(s) - public void Add(Mat m) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(); - m.ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Mat(ptr, m.CvPtr); - } - - /// - /// Adds elements to the bottom of the matrix. (Mat.push_back) - /// - /// Added line(s) - public void PushBack(Mat m) - { - Add(m); - } - - #endregion - - #region PopBack - - /// - /// removes several hyper-planes from bottom of the matrix (Mat.pop_back) - /// - /// - public void PopBack(long nElems = 1) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_pop_back(ptr, new IntPtr(nElems)); - } - - #endregion - - #region To* - - /// - /// Encodes an image into a memory buffer. - /// - /// Encodes an image into a memory buffer. - /// Format-specific parameters. - /// - public byte[] ToBytes(string ext = ".png", int[] prms = null) - { - return ImEncode(ext, prms); - } - - /// - /// Encodes an image into a memory buffer. - /// - /// Encodes an image into a memory buffer. - /// Format-specific parameters. - /// - public byte[] ToBytes(string ext = ".png", params ImageEncodingParam[] prms) - { - return ImEncode(ext, prms); - } - - /// - /// Converts Mat to System.IO.MemoryStream - /// - /// - /// - /// - public MemoryStream ToMemoryStream(string ext = ".png", params ImageEncodingParam[] prms) - { - return new MemoryStream(ToBytes(ext, prms)); - } - - /// - /// Writes image data encoded from this Mat to System.IO.Stream - /// - /// - /// - /// - /// - public void WriteToStream(Stream stream, string ext = ".png", params ImageEncodingParam[] prms) - { - if (stream == null) - throw new ArgumentNullException(nameof(stream)); - byte[] imageBytes = ToBytes(ext, prms); - stream.Write(imageBytes, 0, imageBytes.Length); - } - - #endregion - - #region DrawMarker - -#pragma warning disable 1591 - - public void DrawMarker( - int x, int y, Scalar color, - MarkerStyle style = MarkerStyle.Cross, - int size = 10, - LineTypes lineType = LineTypes.Link8, - int thickness = 1) - { - int r = size / 2; - - switch (style) - { - case MarkerStyle.CircleLine: - Circle(x, y, r, color, thickness, lineType); - break; - case MarkerStyle.CircleFilled: - Circle(x, y, r, color, -1, lineType); - break; - case MarkerStyle.Cross: - Line(x, y - r, x, y + r, color, thickness, lineType); - Line(x - r, y, x + r, y, color, thickness, lineType); - break; - case MarkerStyle.TiltedCross: - Line(x - r, y - r, x + r, y + r, color, thickness, lineType); - Line(x + r, y - r, x - r, y + r, color, thickness, lineType); - break; - case MarkerStyle.CircleAndCross: - Circle(x, y, r, color, thickness, lineType); - Line(x, y - r, x, y + r, color, thickness, lineType); - Line(x - r, y, x + r, y, color, thickness, lineType); - break; - case MarkerStyle.CircleAndTiltedCross: - Circle(x, y, r, color, thickness, lineType); - Line(x - r, y - r, x + r, y + r, color, thickness, lineType); - Line(x + r, y - r, x - r, y + r, color, thickness, lineType); - break; - case MarkerStyle.DiamondLine: - case MarkerStyle.DiamondFilled: - { - int r2 = (int) (size * Math.Sqrt(2) / 2.0); - Point[] pts = - { - new Point(x, y - r2), - new Point(x + r2, y), - new Point(x, y + r2), - new Point(x - r2, y) - }; - switch (style) - { - case MarkerStyle.DiamondLine: - Polylines(new[] {pts}, true, color, thickness, lineType); - break; - case MarkerStyle.DiamondFilled: - FillConvexPoly(pts, color, lineType); - break; - } - - } - break; - case MarkerStyle.SquareLine: - case MarkerStyle.SquareFilled: - { - Point[] pts = - { - new Point(x - r, y - r), - new Point(x + r, y - r), - new Point(x + r, y + r), - new Point(x - r, y + r) - }; - switch (style) - { - case MarkerStyle.SquareLine: - Polylines(new[] {pts}, true, color, thickness, lineType); - break; - case MarkerStyle.SquareFilled: - FillConvexPoly(pts, color, lineType); - break; - } - } - break; - default: - throw new NotImplementedException(); - } - } -#pragma warning restore 1591 - - #endregion - - /// - /// - /// - /// - /// - public Mat Alignment(int n = 4) - { - int newCols = Cv2.AlignSize(Cols, n); - Mat pMat = new Mat(Rows, newCols, Type()); - Mat roiMat = new Mat(pMat, new Rect(0, 0, Cols, Rows)); - CopyTo(roiMat); - return roiMat; - } - - /// - /// Creates type-specific Mat instance from this. - /// - /// - /// - public TMat Cast() - where TMat : Mat - { - var type = typeof(TMat); - - return (TMat) Activator.CreateInstance(type, this); - /* -#if net20 || net40 - var constructor = type.GetConstructor(new[] {typeof (Mat)}); -#else - var constructor = type.GetTypeInfo().GetConstructor(new[] { typeof(Mat) }); -#endif - if (constructor == null) - throw new OpenCvSharpException("Failed to cast to {0}", type.Name); - return (TMat)constructor.Invoke(new object[] {this});*/ - } - - #region ForEach - -// ReSharper disable InconsistentNaming - - /// - /// - /// - /// - public unsafe void ForEachAsByte(MatForeachFunctionByte operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_uchar(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec2b(MatForeachFunctionVec2b operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec2b(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec3b(MatForeachFunctionVec3b operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec3b(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec4b(MatForeachFunctionVec4b operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec4b(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec6b(MatForeachFunctionVec6b operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec6b(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsInt16(MatForeachFunctionInt16 operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_short(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec2s(MatForeachFunctionVec2s operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec2s(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec3s(MatForeachFunctionVec3s operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec3s(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec4s(MatForeachFunctionVec4s operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec4s(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec6s(MatForeachFunctionVec6s operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec6s(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsInt32(MatForeachFunctionInt32 operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_int(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec2i(MatForeachFunctionVec2i operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec2i(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec3i(MatForeachFunctionVec3i operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec3i(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec4i(MatForeachFunctionVec4i operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec4i(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec6i(MatForeachFunctionVec6i operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec6i(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsFloat(MatForeachFunctionFloat operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_float(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec2f(MatForeachFunctionVec2f operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec2f(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec3f(MatForeachFunctionVec3f operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec3f(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec4f(MatForeachFunctionVec4f operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec4f(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec6f(MatForeachFunctionVec6f operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec6f(ptr, operation); - - GC.KeepAlive(operation); - } - - - /// - /// - /// - /// - public unsafe void ForEachAsDouble(MatForeachFunctionDouble operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_double(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec2d(MatForeachFunctionVec2d operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec2d(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec3d(MatForeachFunctionVec3d operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec3d(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec4d(MatForeachFunctionVec4d operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec4d(ptr, operation); - - GC.KeepAlive(operation); - } - - /// - /// - /// - /// - public unsafe void ForEachAsVec6d(MatForeachFunctionVec6d operation) - { - ThrowIfDisposed(); - if (operation == null) - throw new ArgumentNullException(nameof(operation)); - - NativeMethods.core_Mat_forEach_Vec6d(ptr, operation); - - GC.KeepAlive(operation); - } - -// ReSharper restore InconsistentNaming - - #endregion - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatIndexer.cs b/src/OpenCvSharp/modules/core/Mat/MatIndexer.cs deleted file mode 100644 index b2ec0da5a..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatIndexer.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Abstract definition of Mat indexer - /// - /// - public abstract class MatIndexer where T : struct - { - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public abstract T this[int i0] { get; set; } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public abstract T this[int i0, int i1] { get; set; } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public abstract T this[int i0, int i1, int i2] { get; set; } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public abstract T this[params int[] idx] { get; set; } - - /// - /// Parent matrix object - /// - protected readonly Mat parent; - - /// - /// Step byte length for each dimension - /// - protected readonly long[] steps; - - /// - /// Constructor - /// - /// - internal MatIndexer(Mat parent) - { - this.parent = parent; - - int dims = parent.Dims(); - steps = new long[dims]; - for (int i = 0; i < dims; i++) - { - steps[i] = (long)parent.Step(i); - } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfByte.cs b/src/OpenCvSharp/modules/core/Mat/MatOfByte.cs deleted file mode 100644 index d3f17a7bc..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfByte.cs +++ /dev/null @@ -1,700 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 8UC1 (cv::Mat_<uchar>) - /// - public class MatOfByte : Mat - { - private static readonly MatType ThisType = MatType.CV_8UC1; - private const int ThisDepth = MatType.CV_8U; - private const int ThisChannels = 1; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfByte() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfByte(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfByte(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfByte(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfByte(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfByte(int rows, int cols, byte s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfByte(Size size, byte s) - : base(size, ThisType, s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfByte(MatOfByte m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfByte(MatOfByte m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfByte(MatOfByte m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfByte(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfByte(int rows, int cols, byte[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfByte(int rows, int cols, byte[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfByte(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfByte(IEnumerable sizes, byte[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfByte(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfByte(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfByte(IEnumerable sizes, byte s) - : base(sizes, ThisType, s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte *ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override byte this[int i0] - { - get - { - return *(ptr + (steps[0] * i0)); - } - set - { - *(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override byte this[int i0, int i1] - { - get - { - return *(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override byte this[int i0, int i1, int i2] - { - get - { - return *(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override byte this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(ptr + offset) = value; - } - } - } - - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfByte FromArray(params byte[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length / ThisChannels; - var mat = new MatOfByte(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfByte FromArray(byte[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfByte(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfByte FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override byte[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new byte[0]; - byte[] arr = new byte[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override byte[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new byte[0, 0]; - byte[,] arr = new byte[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(byte value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_uchar(ptr, value); - } - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public void Add(sbyte value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_char(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfByte3.cs b/src/OpenCvSharp/modules/core/Mat/MatOfByte3.cs deleted file mode 100644 index 129c078a0..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfByte3.cs +++ /dev/null @@ -1,705 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 8UC3 (cv::Mat_<cv::Vec3b>) - /// - public class MatOfByte3 : Mat - { - private static readonly MatType ThisType = MatType.CV_8UC3; - private const int ThisDepth = MatType.CV_8U; - private const int ThisChannels = 3; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfByte3() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfByte3(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfByte3(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfByte3(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfByte3(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfByte3(int rows, int cols, Vec3b s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfByte3(Size size, Vec3b s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfByte3(MatOfByte3 m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfByte3(MatOfByte3 m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfByte3(MatOfByte3 m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfByte3(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfByte3(int rows, int cols, Vec3b[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfByte3(int rows, int cols, Vec3b[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfByte3(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfByte3(IEnumerable sizes, Vec3b[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfByte3(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfByte3(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfByte3(IEnumerable sizes, Vec3b s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Vec3b this[int i0] - { - get - { - return *(Vec3b*)(ptr + (steps[0] * i0)); - } - set - { - *(Vec3b*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Vec3b this[int i0, int i1] - { - get - { - return *(Vec3b*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Vec3b*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Vec3b this[int i0, int i1, int i2] - { - get - { - return *(Vec3b*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Vec3b*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Vec3b this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Vec3b*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Vec3b*)(ptr + offset) = value; - } - } - } - /// - /// - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfByte3 FromArray(params Vec3b[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfByte3(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfByte3 FromArray(Vec3b[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfByte3(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfByte3 FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Vec3b[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Vec3b[0]; - Vec3b[] arr = new Vec3b[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// - /// - /// - public byte[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new byte[0]; - byte[] arr = new byte[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Vec3b[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Vec3b[0, 0]; - Vec3b[,] arr = new Vec3b[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Vec3b value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Vec3b(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfDMatch.cs b/src/OpenCvSharp/modules/core/Mat/MatOfDMatch.cs deleted file mode 100644 index d254bf59f..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfDMatch.cs +++ /dev/null @@ -1,501 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::DMatch (cv::Mat_<cv::Vec4f>) - /// - public class MatOfDMatch : Mat - { - private static readonly MatType ThisType = MatType.CV_32FC4; - private const int ThisDepth = MatType.CV_32F; // int x 3, float x 1 - private const int ThisChannels = 4; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfDMatch() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfDMatch(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfDMatch(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfDMatch(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfDMatch(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDMatch(int rows, int cols, DMatch s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDMatch(Size size, DMatch s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfDMatch(MatOfDMatch m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfDMatch(MatOfDMatch m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfDMatch(MatOfDMatch m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfDMatch(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDMatch(IEnumerable sizes, DMatch s) - : base(sizes, ThisType, (Scalar)s) - { - } - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override DMatch this[int i0] - { - get - { - return (DMatch)(*(Vec4f*)(ptr + (steps[0] * i0))); - } - set - { - *(Vec4f*)(ptr + (steps[0] * i0)) = (Vec4f)value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override DMatch this[int i0, int i1] - { - get - { - return (DMatch)(*(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1))); - } - set - { - *(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = (Vec4f)value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override DMatch this[int i0, int i1, int i2] - { - get - { - return (DMatch)(*(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2))); - } - set - { - *(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = (Vec4f)value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override DMatch this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return (DMatch)(*(Vec4f*)(ptr + offset)); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Vec4f*)(ptr + offset) = (Vec4f)value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDMatch FromArray(params DMatch[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfDMatch(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDMatch FromArray(DMatch[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfDMatch(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDMatch FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override DMatch[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new DMatch[0]; - DMatch[] arr = new DMatch[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override DMatch[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new DMatch[0, 0]; - DMatch[,] arr = new DMatch[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(DMatch value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Vec4f(ptr, (Vec4f)value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfDouble.cs b/src/OpenCvSharp/modules/core/Mat/MatOfDouble.cs deleted file mode 100644 index 694b33492..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfDouble.cs +++ /dev/null @@ -1,707 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 64FC1 (cv::Mat_<double>) - /// - public class MatOfDouble : Mat - { - private static readonly MatType ThisType = MatType.CV_64FC1; - private const int ThisDepth = MatType.CV_64F; - private const int ThisChannels = 1; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfDouble() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfDouble(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfDouble(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfDouble(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfDouble(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDouble(int rows, int cols, double s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDouble(Size size, double s) - : base(size, ThisType, s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfDouble(MatOfDouble m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfDouble(MatOfDouble m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfDouble(MatOfDouble m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfDouble(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfDouble(int rows, int cols, double[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfDouble(int rows, int cols, double[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfDouble(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfDouble(IEnumerable sizes, double[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfDouble(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfDouble(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDouble(IEnumerable sizes, double s) - : base(sizes, ThisType, s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte *ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override double this[int i0] - { - get - { - return *(double*)(ptr + (steps[0] * i0)); - } - set - { - *(double*)(ptr + (steps[0] * i0)) = value; - } - } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override double this[int i0, int i1] - { - get - { - return *(double*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(double*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override double this[int i0, int i1, int i2] - { - get - { - return *(double*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(double*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override double this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(double*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(double*)(ptr + offset) = value; - } - } - } - - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDouble FromArray(params double[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length / ThisChannels; - var mat = new MatOfDouble(numElems, 1); - - IntPtr ptr = mat.Ptr(0, 0); - Marshal.Copy(arr, 0, ptr, arr.Length); - //mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDouble FromArray(double[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfDouble(rows, cols); - - unsafe - { - void* dst = mat.Ptr(0, 0).ToPointer(); - fixed (double* src = arr) - { - MemoryHelper.CopyMemory(dst, src, rows * cols * sizeof(double)); - } - } - //mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDouble FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override double[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new double[0]; - double[] arr = new double[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override double[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new double[0, 0]; - double[,] arr = new double[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(double value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_double(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfDouble3.cs b/src/OpenCvSharp/modules/core/Mat/MatOfDouble3.cs deleted file mode 100644 index a615bd2a4..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfDouble3.cs +++ /dev/null @@ -1,702 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Vec3d [CV_64FC3] (cv::Mat_<cv::Vec3d>) - /// - public class MatOfDouble3 : Mat - { - private static readonly MatType ThisType = MatType.CV_64FC3; - private const int ThisDepth = MatType.CV_64F; - private const int ThisChannels = 3; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfDouble3() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfDouble3(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfDouble3(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfDouble3(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfDouble3(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDouble3(int rows, int cols, Vec3d s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDouble3(Size size, Vec3d s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfDouble3(MatOfDouble3 m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfDouble3(MatOfDouble3 m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfDouble3(MatOfDouble3 m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfDouble3(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfDouble3(int rows, int cols, Vec3d[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfDouble3(int rows, int cols, Vec3d[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfDouble3(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfDouble3(IEnumerable sizes, Vec3d[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfDouble3(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfDouble3(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfDouble3(IEnumerable sizes, Vec3d s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Vec3d this[int i0] - { - get - { - return *(Vec3d*)(ptr + (steps[0] * i0)); - } - set - { - *(Vec3d*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Vec3d this[int i0, int i1] - { - get - { - return *(Vec3d*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Vec3d*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Vec3d this[int i0, int i1, int i2] - { - get - { - return *(Vec3d*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Vec3d*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Vec3d this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Vec3d*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Vec3d*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDouble3 FromArray(params Vec3d[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfDouble3(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDouble3 FromArray(Vec3d[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfDouble3(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfDouble3 FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Vec3d[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Vec3d[0]; - Vec3d[] arr = new Vec3d[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public double[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new double[0]; - double[] arr = new double[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Vec3d[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Vec3d[0, 0]; - Vec3d[,] arr = new Vec3d[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Vec3d value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Vec3d(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfFloat.cs b/src/OpenCvSharp/modules/core/Mat/MatOfFloat.cs deleted file mode 100644 index a0692d882..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfFloat.cs +++ /dev/null @@ -1,689 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 32FC1 (cv::Mat_<float>) - /// - public class MatOfFloat : Mat - { - private static readonly MatType ThisType = MatType.CV_32FC1; - private const int ThisDepth = MatType.CV_32F; - private const int ThisChannels = 1; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfFloat() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfFloat(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfFloat(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfFloat(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfFloat(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat(int rows, int cols, float s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat(Size size, float s) - : base(size, ThisType, s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfFloat(MatOfFloat m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfFloat(MatOfFloat m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfFloat(MatOfFloat m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat(int rows, int cols, float[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat(int rows, int cols, float[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat(IEnumerable sizes, float[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfFloat(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat(IEnumerable sizes, float s) - : base(sizes, ThisType, s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte *ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override float this[int i0] - { - get - { - return *(float*)(ptr + (steps[0] * i0)); - } - set - { - *(float*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override float this[int i0, int i1] - { - get - { - return *(float*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(float*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override float this[int i0, int i1, int i2] - { - get - { - return *(float*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(float*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override float this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(float*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(float*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat FromArray(params float[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length / ThisChannels; - var mat = new MatOfFloat(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat FromArray(float[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfFloat(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override float[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new float[0]; - float[] arr = new float[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override float[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new float[0, 0]; - float[,] arr = new float[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(float value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_float(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfFloat4.cs b/src/OpenCvSharp/modules/core/Mat/MatOfFloat4.cs deleted file mode 100644 index dfaf80301..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfFloat4.cs +++ /dev/null @@ -1,708 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 32FC4 (cv::Mat_<cv::Vec4f>) - /// - public class MatOfFloat4 : Mat - { - private static readonly MatType ThisType = MatType.CV_32FC4; - private const int ThisDepth = MatType.CV_32F; - private const int ThisChannels = 4; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfFloat4() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfFloat4(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfFloat4(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfFloat4(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfFloat4(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat4(int rows, int cols, Vec4f s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat4(Size size, Vec4f s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfFloat4(MatOfFloat4 m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfFloat4(MatOfFloat4 m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfFloat4(MatOfFloat4 m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat4(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat4(int rows, int cols, Vec4f[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat4(int rows, int cols, Vec4f[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat4(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat4(IEnumerable sizes, Vec4f[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat4(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfFloat4(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat4(IEnumerable sizes, Vec4f s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Vec4f this[int i0] - { - get - { - return *(Vec4f*)(ptr + (steps[0] * i0)); - } - set - { - *(Vec4f*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Vec4f this[int i0, int i1] - { - get - { - return *(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Vec4f this[int i0, int i1, int i2] - { - get - { - return *(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Vec4f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Vec4f this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Vec4f*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Vec4f*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat4 FromArray(params Vec4f[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfFloat4(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat4 FromArray(Vec4f[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfFloat4(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat4 FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Vec4f[] ToArray() - { - /*int num = CheckVector(ThisChannels, ThisDepth); - if (num < 0) - throw new OpenCvSharpException("Native Mat has unexpected type or size: " + ToString());*/ - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Vec4f[0]; - Vec4f[] arr = new Vec4f[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// - /// - /// - public float[] ToPrimitiveArray() - { - /*int num = CheckVector(ThisChannels, ThisDepth); - if (num < 0) - throw new OpenCvSharpException("Native Mat has unexpected type or size: " + ToString());*/ - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new float[0]; - float[] arr = new float[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Vec4f[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Vec4f[0, 0]; - Vec4f[,] arr = new Vec4f[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Vec4f value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Vec4f(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfFloat6.cs b/src/OpenCvSharp/modules/core/Mat/MatOfFloat6.cs deleted file mode 100644 index 10c556be3..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfFloat6.cs +++ /dev/null @@ -1,704 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 32FC6 (cv::Mat_<cv::Vec6f>) - /// - public class MatOfFloat6 : Mat - { - private static readonly MatType ThisType = MatType.CV_32FC(6); - private const int ThisDepth = MatType.CV_32F; - private const int ThisChannels = 6; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfFloat6() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfFloat6(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfFloat6(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfFloat6(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfFloat6(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat6(int rows, int cols, Vec6f s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat6(Size size, Vec6f s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfFloat6(MatOfFloat6 m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfFloat6(MatOfFloat6 m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfFloat6(MatOfFloat6 m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat6(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat6(int rows, int cols, Vec6f[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfFloat6(int rows, int cols, Vec6f[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat6(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat6(IEnumerable sizes, Vec6f[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfFloat6(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfFloat6(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfFloat6(IEnumerable sizes, Vec6f s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Vec6f this[int i0] - { - get - { - return *(Vec6f*)(ptr + (steps[0] * i0)); - } - set - { - *(Vec6f*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Vec6f this[int i0, int i1] - { - get - { - return *(Vec6f*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Vec6f*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Vec6f this[int i0, int i1, int i2] - { - get - { - return *(Vec6f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Vec6f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Vec6f this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Vec6f*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Vec6f*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat6 FromArray(params Vec6f[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfFloat6(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat6 FromArray(Vec6f[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfFloat6(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfFloat6 FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Vec6f[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Vec6f[0]; - Vec6f[] arr = new Vec6f[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// - /// - /// - public float[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new float[0]; - float[] arr = new float[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Vec6f[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Vec6f[0, 0]; - Vec6f[,] arr = new Vec6f[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Vec6f value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Vec6f(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfInt.cs b/src/OpenCvSharp/modules/core/Mat/MatOfInt.cs deleted file mode 100644 index d287aa8c6..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfInt.cs +++ /dev/null @@ -1,691 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 32SC1 (cv::Mat_<int>) - /// - public class MatOfInt : Mat - { - private static readonly MatType ThisType = MatType.CV_32SC1; - private const int ThisDepth = MatType.CV_32S; - private const int ThisChannels = 1; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfInt() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfInt(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfInt(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfInt(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfInt(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfInt(int rows, int cols, int s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfInt(Size size, int s) - : base(size, ThisType, s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfInt(MatOfInt m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfInt(MatOfInt m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfInt(MatOfInt m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfInt(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfInt(int rows, int cols, int[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfInt(int rows, int cols, int[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfInt(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfInt(IEnumerable sizes, int[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfInt(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfInt(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfInt(IEnumerable sizes, int s) - : base(sizes, ThisType, s) - { - } - - #endregion - - #region Indexer - - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*) parent.Data.ToPointer(); - } - - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override int this[int i0] - { - get { return *(int*) (ptr + (steps[0]*i0)); } - set { *(int*) (ptr + (steps[0]*i0)) = value; } - } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override int this[int i0, int i1] - { - get { return *(int*) (ptr + (steps[0]*i0) + (steps[1]*i1)); } - set { *(int*) (ptr + (steps[0]*i0) + (steps[1]*i1)) = value; } - } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override int this[int i0, int i1, int i2] - { - get { return *(int*) (ptr + (steps[0]*i0) + (steps[1]*i1) + (steps[2]*i2)); } - set { *(int*) (ptr + (steps[0]*i0) + (steps[1]*i1) + (steps[2]*i2)) = value; } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override int this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i]*idx[i]; - } - return *(int*) (ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i]*idx[i]; - } - *(int*) (ptr + offset) = value; - } - } - } - - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - - #endregion - - #region FromArray - -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfInt FromArray(params int[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/ThisChannels; - var mat = new MatOfInt(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfInt FromArray(int[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfInt(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfInt FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - - #endregion - - #region ToArray - - /// - /// Convert this mat to managed array - /// - /// - public override int[] ToArray() - { - long numOfElems = (long) Total(); - if (numOfElems == 0) - return new int[0]; - int[] arr = new int[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - - /// - /// Convert this mat to managed rectangular array - /// - /// - public override int[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new int[0, 0]; - int[,] arr = new int[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - - #endregion - - #region GetEnumerator - - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(int value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_int(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfInt4.cs b/src/OpenCvSharp/modules/core/Mat/MatOfInt4.cs deleted file mode 100644 index 0918f3e15..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfInt4.cs +++ /dev/null @@ -1,690 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 32SC1 (cv::Mat_<int>) - /// - public class MatOfInt4 : Mat - { - private static readonly MatType ThisType = MatType.CV_32SC4; - private const int ThisDepth = MatType.CV_32S; - private const int ThisChannels = 4; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfInt4() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfInt4(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfInt4(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfInt4(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfInt4(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfInt4(int rows, int cols, int s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfInt4(Size size, int s) - : base(size, ThisType, s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfInt4(MatOfInt4 m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfInt4(MatOfInt4 m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfInt4(MatOfInt4 m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfInt4(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfInt4(int rows, int cols, Vec4i[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfInt4(int rows, int cols, Vec4i[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfInt4(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfInt4(IEnumerable sizes, Vec4i[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfInt4(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfInt4(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfInt4(IEnumerable sizes, Vec4i s) - : base(sizes, ThisType, new Scalar(s.Item0, s.Item1, s.Item2, s.Item3)) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte *ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Vec4i this[int i0] - { - get - { - return *(Vec4i*)(ptr + (steps[0] * i0)); - } - set - { - *(Vec4i*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Vec4i this[int i0, int i1] - { - get - { - return *(Vec4i*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Vec4i*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Vec4i this[int i0, int i1, int i2] - { - get - { - return *(Vec4i*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Vec4i*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Vec4i this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Vec4i*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Vec4i*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfInt4 FromArray(params Vec4i[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfInt4(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfInt4 FromArray(Vec4i[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfInt4(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfInt4 FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Vec4i[] ToArray() - { - long numOfElems = Total(); - if (numOfElems == 0) - return new Vec4i[0]; - var arr = new Vec4i[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Vec4i[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Vec4i[0, 0]; - var arr = new Vec4i[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - var indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Vec4i value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Vec4i(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfPoint.cs b/src/OpenCvSharp/modules/core/Mat/MatOfPoint.cs deleted file mode 100644 index b604690fe..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfPoint.cs +++ /dev/null @@ -1,702 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Point [CV_32SC2] (cv::Mat_<cv::Point>) - /// - public class MatOfPoint : Mat - { - private static readonly MatType ThisType = MatType.CV_32SC2; - private const int ThisDepth = MatType.CV_32S; - private const int ThisChannels = 2; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfPoint() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfPoint(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfPoint(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfPoint(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfPoint(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint(int rows, int cols, Point s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint(Size size, Point s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfPoint(MatOfPoint m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfPoint(MatOfPoint m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfPoint(MatOfPoint m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint(int rows, int cols, Point[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint(int rows, int cols, Point[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint(IEnumerable sizes, Point[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfPoint(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint(IEnumerable sizes, Point s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Point this[int i0] - { - get - { - return *(Point*)(ptr + (steps[0] * i0)); - } - set - { - *(Point*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Point this[int i0, int i1] - { - get - { - return *(Point*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Point*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Point this[int i0, int i1, int i2] - { - get - { - return *(Point*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Point*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Point this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Point*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Point*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint FromArray(params Point[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfPoint(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint FromArray(Point[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfPoint(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Point[] ToArray() - { - long numOfElems = Total(); - if (numOfElems == 0) - return new Point[0]; - var arr = new Point[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public int[] ToPrimitiveArray() - { - long numOfElems = Total(); - if (numOfElems == 0) - return new int[0]; - int[] arr = new int[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Point[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Point[0, 0]; - var arr = new Point[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Point value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Point(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfPoint2d.cs b/src/OpenCvSharp/modules/core/Mat/MatOfPoint2d.cs deleted file mode 100644 index 21733b04f..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfPoint2d.cs +++ /dev/null @@ -1,705 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Point [CV_64FC2] (cv::Mat_<cv::Point2d>) - /// - public class MatOfPoint2d : Mat - { - private static readonly MatType ThisType = MatType.CV_64FC2; - private const int ThisDepth = MatType.CV_64F; - private const int ThisChannels = 2; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfPoint2d() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfPoint2d(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfPoint2d(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfPoint2d(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfPoint2d(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint2d(int rows, int cols, Point2d s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint2d(Size size, Point2d s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfPoint2d(MatOfPoint2d m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfPoint2d(MatOfPoint2d m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfPoint2d(MatOfPoint2d m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint2d(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint2d(int rows, int cols, Point2d[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint2d(int rows, int cols, Point2d[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint2d(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint2d(IEnumerable sizes, Point2d[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint2d(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfPoint2d(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint2d(IEnumerable sizes, Point2d s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Point2d this[int i0] - { - get - { - return *(Point2d*)(ptr + (steps[0] * i0)); - } - set - { - *(Point2d*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Point2d this[int i0, int i1] - { - get - { - return *(Point2d*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Point2d*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Point2d this[int i0, int i1, int i2] - { - get - { - return *(Point2d*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Point2d*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Point2d this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Point2d*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Point2d*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint2d FromArray(params Point2d[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfPoint2d(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint2d FromArray(Point2d[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfPoint2d(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint2d FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Point2d[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Point2d[0]; - Point2d[] arr = new Point2d[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public double[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new double[0]; - double[] arr = new double[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Point2d[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Point2d[0, 0]; - Point2d[,] arr = new Point2d[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Point2d value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Point2d(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfPoint2f.cs b/src/OpenCvSharp/modules/core/Mat/MatOfPoint2f.cs deleted file mode 100644 index 4f1a0ab28..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfPoint2f.cs +++ /dev/null @@ -1,706 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Point [CV_32FC2] (cv::Mat_<cv::Point2f>) - /// - public class MatOfPoint2f : Mat - { - private static readonly MatType ThisType = MatType.CV_32FC2; - private const int ThisDepth = MatType.CV_32F; - private const int ThisChannels = 2; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfPoint2f() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfPoint2f(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfPoint2f(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfPoint2f(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfPoint2f(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint2f(int rows, int cols, Point2f s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint2f(Size size, Point2f s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfPoint2f(MatOfPoint2f m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfPoint2f(MatOfPoint2f m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfPoint2f(MatOfPoint2f m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint2f(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint2f(int rows, int cols, Point2f[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint2f(int rows, int cols, Point2f[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint2f(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint2f(IEnumerable sizes, Point2f[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint2f(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfPoint2f(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint2f(IEnumerable sizes, Point2f s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - this.ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Point2f this[int i0] - { - get - { - return *(Point2f*)(ptr + (steps[0] * i0)); - } - set - { - *(Point2f*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Point2f this[int i0, int i1] - { - get - { - return *(Point2f*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Point2f*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Point2f this[int i0, int i1, int i2] - { - get - { - return *(Point2f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Point2f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Point2f this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Point2f*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Point2f*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint2f FromArray(params Point2f[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfPoint2f(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint2f FromArray(Point2f[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfPoint2f(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint2f FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Point2f[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Point2f[0]; - Point2f[] arr = new Point2f[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - - /// - /// Convert this mat to managed array - /// - /// - public float[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new float[0]; - float[] arr = new float[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Point2f[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Point2f[0, 0]; - Point2f[,] arr = new Point2f[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Point2f value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Point2f(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfPoint3d.cs b/src/OpenCvSharp/modules/core/Mat/MatOfPoint3d.cs deleted file mode 100644 index 01aa5c495..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfPoint3d.cs +++ /dev/null @@ -1,702 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Point3d [CV_64FC3] (cv::Mat_<cv::Point3d>) - /// - public class MatOfPoint3d : Mat - { - private static readonly MatType ThisType = MatType.CV_64FC3; - private const int ThisDepth = MatType.CV_64F; - private const int ThisChannels = 3; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfPoint3d() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfPoint3d(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfPoint3d(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfPoint3d(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfPoint3d(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3d(int rows, int cols, Point3d s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3d(Size size, Point3d s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfPoint3d(MatOfPoint3d m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfPoint3d(MatOfPoint3d m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfPoint3d(MatOfPoint3d m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3d(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3d(int rows, int cols, Point3d[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3d(int rows, int cols, Point3d[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3d(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3d(IEnumerable sizes, Point3d[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3d(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfPoint3d(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3d(IEnumerable sizes, Point3d s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Point3d this[int i0] - { - get - { - return *(Point3d*)(ptr + (steps[0] * i0)); - } - set - { - *(Point3d*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Point3d this[int i0, int i1] - { - get - { - return *(Point3d*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Point3d*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Point3d this[int i0, int i1, int i2] - { - get - { - return *(Point3d*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Point3d*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Point3d this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Point3d*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Point3d*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3d FromArray(params Point3d[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfPoint3d(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3d FromArray(Point3d[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfPoint3d(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3d FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Point3d[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Point3d[0]; - var arr = new Point3d[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public double[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new double[0]; - var arr = new double[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Point3d[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Point3d[0, 0]; - var arr = new Point3d[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Point3d value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Point3d(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfPoint3f.cs b/src/OpenCvSharp/modules/core/Mat/MatOfPoint3f.cs deleted file mode 100644 index ac6360108..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfPoint3f.cs +++ /dev/null @@ -1,702 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Point3f [CV_32FC3] (cv::Mat_<cv::Point3f>) - /// - public class MatOfPoint3f : Mat - { - private static readonly MatType ThisType = MatType.CV_32FC3; - private const int ThisDepth = MatType.CV_32F; - private const int ThisChannels = 3; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfPoint3f() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfPoint3f(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfPoint3f(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfPoint3f(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfPoint3f(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3f(int rows, int cols, Point3f s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3f(Size size, Point3f s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfPoint3f(MatOfPoint3f m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfPoint3f(MatOfPoint3f m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfPoint3f(MatOfPoint3f m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3f(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3f(int rows, int cols, Point3f[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3f(int rows, int cols, Point3f[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3f(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3f(IEnumerable sizes, Point3f[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3f(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfPoint3f(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3f(IEnumerable sizes, Point3f s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Point3f this[int i0] - { - get - { - return *(Point3f*)(ptr + (steps[0] * i0)); - } - set - { - *(Point3f*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Point3f this[int i0, int i1] - { - get - { - return *(Point3f*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Point3f*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Point3f this[int i0, int i1, int i2] - { - get - { - return *(Point3f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Point3f*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Point3f this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Point3f*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Point3f*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3f FromArray(params Point3f[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfPoint3f(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3f FromArray(Point3f[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfPoint3f(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3f FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Point3f[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Point3f[0]; - var arr = new Point3f[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public float[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new float[0]; - var arr = new float[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Point3f[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Point3f[0, 0]; - var arr = new Point3f[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Point3f value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Point3f(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfPoint3i.cs b/src/OpenCvSharp/modules/core/Mat/MatOfPoint3i.cs deleted file mode 100644 index 4475d51c6..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfPoint3i.cs +++ /dev/null @@ -1,702 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Point3i [CV_32SC3] (cv::Mat_<cv::Point3i>) - /// - public class MatOfPoint3i : Mat - { - private static readonly MatType ThisType = MatType.CV_32SC3; - private const int ThisDepth = MatType.CV_32S; - private const int ThisChannels = 3; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfPoint3i() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfPoint3i(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfPoint3i(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfPoint3i(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfPoint3i(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3i(int rows, int cols, Point3i s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3i(Size size, Point3i s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfPoint3i(MatOfPoint3i m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfPoint3i(MatOfPoint3i m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfPoint3i(MatOfPoint3i m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3i(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3i(int rows, int cols, Point3i[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfPoint3i(int rows, int cols, Point3i[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3i(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3i(IEnumerable sizes, Point3i[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfPoint3i(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfPoint3i(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfPoint3i(IEnumerable sizes, Point3i s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Point3i this[int i0] - { - get - { - return *(Point3i*)(ptr + (steps[0] * i0)); - } - set - { - *(Point3i*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Point3i this[int i0, int i1] - { - get - { - return *(Point3i*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Point3i*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Point3i this[int i0, int i1, int i2] - { - get - { - return *(Point3i*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Point3i*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Point3i this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Point3i*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Point3i*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3i FromArray(params Point3i[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfPoint3i(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3i FromArray(Point3i[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfPoint3i(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfPoint3i FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Point3i[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Point3i[0]; - var arr = new Point3i[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public int[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new int[0]; - int[] arr = new int[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Point3i[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Point3i[0, 0]; - Point3i[,] arr = new Point3i[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Point3i value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Point3i(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfRect.cs b/src/OpenCvSharp/modules/core/Mat/MatOfRect.cs deleted file mode 100644 index 47c3f5267..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfRect.cs +++ /dev/null @@ -1,704 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is cv::Rect [CV_32SC4] (cv::Mat_<cv::Rect>) - /// - public class MatOfRect : Mat - { - private static readonly MatType ThisType = MatType.CV_32SC4; - private const int ThisDepth = MatType.CV_32S; - private const int ThisChannels = 4; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfRect() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfRect(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfRect(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfRect(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfRect(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfRect(int rows, int cols, Rect s) - : base(rows, cols, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfRect(Size size, Rect s) - : base(size, ThisType, (Scalar)s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfRect(MatOfRect m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfRect(MatOfRect m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfRect(MatOfRect m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfRect(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfRect(int rows, int cols, Rect[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfRect(int rows, int cols, Rect[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfRect(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfRect(IEnumerable sizes, Rect[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfRect(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfRect(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfRect(IEnumerable sizes, Rect s) - : base(sizes, ThisType, (Scalar)s) - { - } - - #endregion - - #region Indexer - /// - /// - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override Rect this[int i0] - { - get - { - return *(Rect*)(ptr + (steps[0] * i0)); - } - set - { - *(Rect*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override Rect this[int i0, int i1] - { - get - { - return *(Rect*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(Rect*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override Rect this[int i0, int i1, int i2] - { - get - { - return *(Rect*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(Rect*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override Rect this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(Rect*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(Rect*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfRect FromArray(params Rect[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length/* / ThisChannels*/; - var mat = new MatOfRect(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfRect FromArray(Rect[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfRect(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfRect FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override Rect[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new Rect[0]; - var arr = new Rect[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed array - /// - /// - public int[] ToPrimitiveArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new int[0]; - int[] arr = new int[numOfElems * ThisChannels]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override Rect[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new Rect[0, 0]; - var arr = new Rect[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(Rect value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_Rect(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfShort.cs b/src/OpenCvSharp/modules/core/Mat/MatOfShort.cs deleted file mode 100644 index 1b928dbbc..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfShort.cs +++ /dev/null @@ -1,692 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 16SC1 (cv::Mat_<short>) - /// - public class MatOfShort : Mat - { - private static readonly MatType ThisType = MatType.CV_16SC1; - private const int ThisDepth = MatType.CV_16S; - private const int ThisChannels = 1; - - #region Init - -#if LANG_JP -/// -/// Creates empty Mat -/// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfShort() - : base() - { - } - -#if LANG_JP -/// -/// OpenCVネイティブの cv::Mat* ポインタから初期化 -/// -/// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfShort(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP -/// -/// Matオブジェクトから初期化 -/// -/// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfShort(Mat mat) - : base(mat) - { - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列として初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfShort(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列として初期化 -/// -/// 2次元配列のサイズ: Size(cols, rows) . -/// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfShort(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, -/// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfShort(int rows, int cols, short s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP -/// -/// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 -/// -/// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. -/// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, -/// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfShort(Size size, short s) - : base(size, ThisType, s) - { - } - -#if LANG_JP -/// -/// 他の行列の部分行列として初期化 -/// -/// 作成された行列に(全体的,部分的に)割り当てられる配列. -/// これらのコンストラクタによってデータがコピーされる事はありません. -/// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, -/// 関連した参照カウンタがあれば,それがインクリメントされます. -/// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も -/// 変更することになります.もし部分配列の独立したコピーが必要ならば, -/// Mat.Clone() を利用してください. -/// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. -/// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfShort(MatOfShort m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP -/// -/// 他の行列の部分行列として初期化 -/// -/// 作成された行列に(全体的,部分的に)割り当てられる配列. -/// これらのコンストラクタによってデータがコピーされる事はありません. -/// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, -/// 関連した参照カウンタがあれば,それがインクリメントされます. -/// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も -/// 変更することになります.もし部分配列の独立したコピーが必要ならば, -/// Mat.Clone() を利用してください. -/// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfShort(MatOfShort m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP -/// -/// 他の行列の部分行列として初期化 -/// -/// 作成された行列に(全体的,部分的に)割り当てられる配列. -/// これらのコンストラクタによってデータがコピーされる事はありません. -/// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, -/// 関連した参照カウンタがあれば,それがインクリメントされます. -/// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も -/// 変更することになります.もし部分配列の独立したコピーが必要ならば, -/// Mat.Clone() を利用してください. -/// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfShort(MatOfShort m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 行列の各行が占めるバイト数を指定できます. -/// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. -/// このパラメータが指定されない場合,パディングは存在しないとみなされ, -/// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfShort(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 行列の各行が占めるバイト数を指定できます. -/// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. -/// このパラメータが指定されない場合,パディングは存在しないとみなされ, -/// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfShort(int rows, int cols, short[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// 2次元配列における行数. -/// 2次元配列における列数. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 行列の各行が占めるバイト数を指定できます. -/// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. -/// このパラメータが指定されない場合,パディングは存在しないとみなされ, -/// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfShort(int rows, int cols, short[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// Array of integers specifying an n-dimensional array shape. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 多次元配列における ndims-1 個のステップを表す配列 -/// (最後のステップは常に要素サイズになります).これが指定されないと, -/// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfShort(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 多次元配列における ndims-1 個のステップを表す配列 -/// (最後のステップは常に要素サイズになります).これが指定されないと, -/// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfShort(IEnumerable sizes, short[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP -/// -/// 利用者が別に確保したデータで初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -/// ユーザデータへのポインタ. data と step パラメータを引数にとる -/// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す -/// 行列ヘッダを初期化します.つまり,データのコピーは行われません. -/// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. -/// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. -/// 多次元配列における ndims-1 個のステップを表す配列 -/// (最後のステップは常に要素サイズになります).これが指定されないと, -/// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfShort(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP -/// -/// N次元行列として初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfShort(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP -/// -/// N次元行列として初期化 -/// -/// n-次元配列の形状を表す,整数型の配列. -/// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, -/// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfShort(IEnumerable sizes, short s) - : base(sizes, ThisType, s) - { - } - - #endregion - - #region Indexer - - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte* ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*) parent.Data.ToPointer(); - } - - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override short this[int i0] - { - get { return *(short*) (ptr + (steps[0] * i0)); } - set { *(short*) (ptr + (steps[0] * i0)) = value; } - } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override short this[int i0, int i1] - { - get { return *(short*) (ptr + (steps[0] * i0) + (steps[1] * i1)); } - set { *(short*) (ptr + (steps[0] * i0) + (steps[1] * i1)) = value; } - } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override short this[int i0, int i1, int i2] - { - get { return *(short*) (ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); } - set { *(short*) (ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override short this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(short*) (ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(short*) (ptr + offset) = value; - } - } - } - - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - - #endregion - - #region FromArray - -#if LANG_JP -/// -/// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする -/// -/// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfShort FromArray(params short[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length / ThisChannels; - var mat = new MatOfShort(numElems, 1); - //mat.SetArray(0, 0, arr); - IntPtr ptr = mat.Ptr(0, 0); - Marshal.Copy(arr, 0, ptr, arr.Length); - return mat; - } - -#if LANG_JP -/// -/// M x N の行列として初期化し、指定した配列からデータをコピーする -/// -/// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfShort FromArray(short[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfShort(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } - -#if LANG_JP -/// -/// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする -/// -/// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfShort FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - - #endregion - - #region ToArray - - /// - /// Convert this mat to managed array - /// - /// - public override short[] ToArray() - { - long numOfElems = (long) Total(); - if (numOfElems == 0) - return new short[0]; - short[] arr = new short[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - - /// - /// Convert this mat to managed rectangular array - /// - /// - public override short[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new short[0, 0]; - short[,] arr = new short[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - - #endregion - - #region GetEnumerator - - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(short value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_short(ptr, value); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfT.cs b/src/OpenCvSharp/modules/core/Mat/MatOfT.cs deleted file mode 100644 index 8570367d3..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfT.cs +++ /dev/null @@ -1,764 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - /// - /// Type-specific abstract matrix - /// - /// Element Type - /// For return value type of re-defined Mat methods - public abstract class Mat : Mat, ICollection - where TElem : struct - where TInherit : Mat, new() - { - private Mat sourceMat; - - #region Init & Disposal - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - protected Mat() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - protected Mat(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - protected Mat(Mat mat) - : base(mat.CvPtr) - { - // 作成元への参照を残す。元がGCに回収されないように。 - sourceMat = mat; - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - protected Mat(int rows, int cols, MatType type) - : base(rows, cols, type) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - protected Mat(Size size, MatType type) - : base(size, type) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - protected Mat(int rows, int cols, MatType type, Scalar s) - : base(rows, cols, type, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - protected Mat(Size size, MatType type, Scalar s) - : base(size, type, s) - { - } - - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - protected Mat(Mat m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - protected Mat(Mat m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - protected Mat(Mat m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - protected Mat(int rows, int cols, MatType type, IntPtr data, long step = 0) - : base(rows, cols, type, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - protected Mat(int rows, int cols, MatType type, Array data, long step = 0) - : base(rows, cols, type, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - protected Mat(IEnumerable sizes, MatType type, IntPtr data, IEnumerable steps = null) - : base(sizes, type, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - protected Mat(IEnumerable sizes, MatType type, Array data, IEnumerable steps = null) - : base(sizes, type, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - protected Mat(IEnumerable sizes, MatType type) - : base(sizes, type) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - protected Mat(IEnumerable sizes, MatType type, Scalar s) - : base(sizes, type, s) - { - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - // sourceMat.Disposeに解放を任せるのでここでは何もしない - sourceMat = null; - base.DisposeManaged(); - } - - #endregion - - #region Abstract Methods - /// - /// Gets type-specific indexer for accessing each element - /// - /// - public abstract MatIndexer GetIndexer(); - - /// - /// Gets read-only enumerator - /// - /// - public abstract IEnumerator GetEnumerator(); - /// - /// For non-generic IEnumerable - /// - /// - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// - /// Convert this mat to managed array - /// - /// - public abstract TElem[] ToArray(); - - /// - /// Convert this mat to managed rectangular array - /// - /// - public abstract TElem[,] ToRectangularArray(); - #endregion - - #region Mat Methods - /// - /// - /// - /// - /// - protected TInherit Wrap(Mat mat) - { - TInherit ret = new TInherit(); - mat.AssignTo(ret); - return ret; - } - - #region Clone - - /// - /// Creates a full copy of the matrix. - /// - /// - public new TInherit Clone() - { - Mat result = base.Clone(); - return Wrap(result); - } - #endregion - #region Reshape - - /// - /// Changes the shape of channels of a 2D matrix without copying the data. - /// - /// New number of rows. If the parameter is 0, the number of rows remains the same. - /// - public TInherit Reshape(int rows) - { - Mat result = base.Reshape(0, rows); - return Wrap(result); - } - - /// - /// Changes the shape of a 2D matrix without copying the data. - /// - /// New number of rows. If the parameter is 0, the number of rows remains the same. - /// - public TInherit Reshape(params int[] newDims) - { - Mat result = base.Reshape(0, newDims); - return Wrap(result); - } - - #endregion - #region T - - /// - /// Transposes a matrix. - /// - /// - public new TInherit T() - { - Mat result = base.T(); - return Wrap(result); - } - - #endregion - - #region SubMat - /// - /// Extracts a rectangular submatrix. - /// - /// Start row of the extracted submatrix. The upper boundary is not included. - /// End row of the extracted submatrix. The upper boundary is not included. - /// Start column of the extracted submatrix. The upper boundary is not included. - /// End column of the extracted submatrix. The upper boundary is not included. - /// - public new TInherit SubMat(int rowStart, int rowEnd, int colStart, int colEnd) - { - Mat result = base.SubMat(rowStart, rowEnd, colStart, colEnd); - return Wrap(result); - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Start and end row of the extracted submatrix. The upper boundary is not included. - /// To select all the rows, use Range.All(). - /// Start and end column of the extracted submatrix. - /// The upper boundary is not included. To select all the columns, use Range.All(). - /// - public new TInherit SubMat(Range rowRange, Range colRange) - { - return this.SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Extracted submatrix specified as a rectangle. - /// - public new TInherit SubMat(Rect roi) - { - return this.SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Array of selected ranges along each array dimension. - /// - public new TInherit SubMat(params Range[] ranges) - { - Mat result = base.SubMat(ranges); - return Wrap(result); - } - - #endregion - #region Mat Indexers - /// - /// Extracts a rectangular submatrix. - /// - /// Start row of the extracted submatrix. The upper boundary is not included. - /// End row of the extracted submatrix. The upper boundary is not included. - /// Start column of the extracted submatrix. The upper boundary is not included. - /// End column of the extracted submatrix. The upper boundary is not included. - /// - public new TInherit this[int rowStart, int rowEnd, int colStart, int colEnd] - { - get - { - Mat result = base[rowStart, rowEnd, colStart, colEnd]; - return Wrap(result); - } - set - { - base[rowStart, rowEnd, colStart, colEnd] = value; - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Start and end row of the extracted submatrix. The upper boundary is not included. - /// To select all the rows, use Range.All(). - /// Start and end column of the extracted submatrix. - /// The upper boundary is not included. To select all the columns, use Range.All(). - /// - public new TInherit this[Range rowRange, Range colRange] - { - get - { - Mat result = base[rowRange, colRange]; - return Wrap(result); - } - set - { - base[rowRange, colRange] = value; - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Extracted submatrix specified as a rectangle. - /// - public new TInherit this[Rect roi] - { - get - { - Mat result = base[roi]; - return Wrap(result); - } - set - { - base[roi] = value; - } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Array of selected ranges along each array dimension. - /// - public new TInherit this[params Range[] ranges] - { - get - { - Mat result = base[ranges]; - return Wrap(result); - } - set - { - base[ranges] = value; - } - } - #endregion - - #endregion - - #region ICollection - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public abstract void Add(TElem value); - - /// - /// Removes the first occurrence of a specific object from the ICollection<T>. - /// - /// The object to remove from the ICollection<T>. - /// true if item was successfully removed from the ICollection<T> otherwise, false. - /// This method also returns false if item is not found in the original ICollection<T>. - public bool Remove(TElem item) - { - throw new NotImplementedException(); - } - - /// - /// Determines whether the ICollection<T> contains a specific value. - /// - /// The object to locate in the ICollection<T>. - /// true if item is found in the ICollection<T> otherwise, false. - public bool Contains(TElem item) - { - return IndexOf(item) >= 0; - } - - /// - /// Determines the index of a specific item in the list. - /// - /// The object to locate in the list. - /// The index of value if found in the list; otherwise, -1. - public int IndexOf(TElem item) - { - TElem[] array = ToArray(); - return Array.IndexOf(array, item); - } - - /// - /// Removes all items from the ICollection<T>. - /// - public void Clear() - { - ThrowIfDisposed(); - NativeMethods.core_Mat_pop_back(ptr, new IntPtr((long)Total())); - } - - /// - /// Copies the elements of the ICollection<T> to an Array, starting at a particular Array index. - /// - /// The one-dimensional Array that is the destination of the elements copied from ICollection<T>. - /// The Array must have zero-based indexing. - /// The zero-based index in array at which copying begins. - public void CopyTo(TElem[] array, int arrayIndex) - { - ThrowIfDisposed(); - - if (array == null) - throw new ArgumentNullException(nameof(array)); - TElem[] result = ToArray(); - if (array.Length > result.Length + arrayIndex) - throw new ArgumentException("Too short array.Length"); - Array.Copy(result, 0, array, arrayIndex, result.Length); - } - - /// - /// Returns the total number of matrix elements (Mat.total) - /// - /// Total number of list(Mat) elements - public int Count - { - get - { - ThrowIfDisposed(); - return (int)NativeMethods.core_Mat_total(ptr); - } - } - - /// - /// Gets a value indicating whether the IList is read-only. - /// - /// - public bool IsReadOnly { get { return false; }} - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/MatOfUShort.cs b/src/OpenCvSharp/modules/core/Mat/MatOfUShort.cs deleted file mode 100644 index 4e4575c23..000000000 --- a/src/OpenCvSharp/modules/core/Mat/MatOfUShort.cs +++ /dev/null @@ -1,690 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// A matrix whose element is 16UC1 (cv::Mat_<ushort>) - /// - public class MatOfUShort : Mat - { - private static readonly MatType ThisType = MatType.CV_16UC1; - private const int ThisDepth = MatType.CV_16U; - private const int ThisChannels = 1; - - #region Init - -#if LANG_JP - /// - /// Creates empty Mat - /// -#else - /// - /// Creates empty Mat - /// -#endif - public MatOfUShort() - : base() - { - } - -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::Mat* pointer - /// - /// -#endif - public MatOfUShort(IntPtr ptr) - : base(ptr) - { - } - -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else - /// - /// Initializes by Mat object - /// - /// Managed Mat object -#endif - public MatOfUShort(Mat mat) - : base(mat) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. -#endif - public MatOfUShort(int rows, int cols) - : base(rows, cols, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . - /// Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else - /// - /// constructs 2D matrix of the specified size and type - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. -#endif - public MatOfUShort(Size size) - : base(size, ThisType) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfUShort(int rows, int cols, ushort s) - : base(rows, cols, ThisType, s) - { - } - -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constucts 2D matrix and fills it with the specified Scalar value. - /// - /// 2D array size: Size(cols, rows) . In the Size() constructor, - /// the number of rows and the number of columns go in the reverse order. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfUShort(Size size, ushort s) - : base(size, ThisType, s) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat::clone() . - /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. - /// Use Range.All to take all the rows. - /// Range of the m columns to take. Use Range.All to take all the columns. -#endif - public MatOfUShort(MatOfUShort m, Range rowRange, Range? colRange = null) - : base(m, rowRange, colRange) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Array of selected ranges of m along each dimensionality. -#endif - public MatOfUShort(MatOfUShort m, params Range[] ranges) - : base(m, ranges) - { - } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else - /// - /// creates a matrix header for a part of the bigger matrix - /// - /// Array that (as a whole or partly) is assigned to the constructed matrix. - /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array - /// is constructed and associated with it. The reference counter, if any, is incremented. - /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . - /// If you want to have an independent copy of the sub-array, use Mat.Clone() . - /// Region of interest. -#endif - public MatOfUShort(MatOfUShort m, Rect roi) - : base(m, roi) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfUShort(int rows, int cols, IntPtr data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfUShort(int rows, int cols, ushort[] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Number of rows in a 2D array. - /// Number of columns in a 2D array. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. - /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif - public MatOfUShort(int rows, int cols, ushort[,] data, long step = 0) - : base(rows, cols, ThisType, data, step) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfUShort(IEnumerable sizes, IntPtr data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfUShort(IEnumerable sizes, ushort[] data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else - /// - /// constructor for matrix headers pointing to user-allocated data - /// - /// Array of integers specifying an n-dimensional array shape. - /// Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. - /// Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. - /// This operation is very efficient and can be used to process external data using OpenCV functions. - /// The external data is not automatically deallocated, so you should take care of it. - /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). - /// If not specified, the matrix is assumed to be continuous. -#endif - public MatOfUShort(IEnumerable sizes, Array data, IEnumerable steps = null) - : base(sizes, ThisType, data, steps) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. -#endif - public MatOfUShort(IEnumerable sizes) - : base(sizes, ThisType) - { - } - -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else - /// - /// constructs n-dimensional matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// An optional value to initialize each matrix element with. - /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif - public MatOfUShort(IEnumerable sizes, ushort s) - : base(sizes, ThisType, s) - { - } - - #endregion - - #region Indexer - /// - /// Matrix indexer - /// - public sealed unsafe class Indexer : MatIndexer - { - private readonly byte *ptr; - - internal Indexer(Mat parent) - : base(parent) - { - ptr = (byte*)parent.Data.ToPointer(); - } - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// A value to the specified array element. - public override ushort this[int i0] - { - get - { - return *(ushort*)(ptr + (steps[0] * i0)); - } - set - { - *(ushort*)(ptr + (steps[0] * i0)) = value; - } - } - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// A value to the specified array element. - public override ushort this[int i0, int i1] - { - get - { - return *(ushort*)(ptr + (steps[0] * i0) + (steps[1] * i1)); - } - set - { - *(ushort*)(ptr + (steps[0] * i0) + (steps[1] * i1)) = value; - } - } - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// A value to the specified array element. - public override ushort this[int i0, int i1, int i2] - { - get - { - return *(ushort*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)); - } - set - { - *(ushort*)(ptr + (steps[0] * i0) + (steps[1] * i1) + (steps[2] * i2)) = value; - } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// A value to the specified array element. - public override ushort this[params int[] idx] - { - get - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - return *(ushort*)(ptr + offset); - } - set - { - long offset = 0; - for (int i = 0; i < idx.Length; i++) - { - offset += steps[i] * idx[i]; - } - *(ushort*)(ptr + offset) = value; - } - } - } - /// - /// Gets a type-specific indexer. The indexer has getters/setters to access each matrix element. - /// - /// - public override MatIndexer GetIndexer() - { - return new Indexer(this); - } - #endregion - - #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfUShort FromArray(params ushort[] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int numElems = arr.Length / ThisChannels; - var mat = new MatOfUShort(numElems, 1); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as M x N matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfUShort FromArray(ushort[,] arr) - { - if (arr == null) - throw new ArgumentNullException(nameof(arr)); - if (arr.Length == 0) - throw new ArgumentException("arr.Length == 0"); - - int rows = arr.GetLength(0); - int cols = arr.GetLength(1); - var mat = new MatOfUShort(rows, cols); - mat.SetArray(0, 0, arr); - return mat; - } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else - /// - /// Initializes as N x 1 matrix and copys array data to this - /// - /// Source array data to be copied to this -#endif - public static MatOfUShort FromArray(IEnumerable enumerable) - { - return FromArray(EnumerableEx.ToArray(enumerable)); - } - #endregion - - #region ToArray - /// - /// Convert this mat to managed array - /// - /// - public override ushort[] ToArray() - { - long numOfElems = (long)Total(); - if (numOfElems == 0) - return new ushort[0]; - ushort[] arr = new ushort[numOfElems]; - GetArray(0, 0, arr); - return arr; - } - /// - /// Convert this mat to managed rectangular array - /// - /// - public override ushort[,] ToRectangularArray() - { - if (Rows == 0 || Cols == 0) - return new ushort[0, 0]; - ushort[,] arr = new ushort[Rows, Cols]; - GetArray(0, 0, arr); - return arr; - } - #endregion - - #region GetEnumerator - /// - /// - /// - /// - public override IEnumerator GetEnumerator() - { - ThrowIfDisposed(); - Indexer indexer = new Indexer(this); - - int dims = Dims(); - if (dims == 2) - { - int rows = Rows; - int cols = Cols; - for (int r = 0; r < rows; r++) - { - for (int c = 0; c < cols; c++) - { - yield return indexer[r, c]; - } - } - } - else - { - throw new NotImplementedException("GetEnumerator supports only 2-dimensional Mat"); - } - } - #endregion - - /// - /// Adds elements to the bottom of the matrix. (Mat::push_back) - /// - /// Added element(s) - public override void Add(ushort value) - { - ThrowIfDisposed(); - NativeMethods.core_Mat_push_back_ushort(ptr, value); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Mat/Mat_CvMethods.cs b/src/OpenCvSharp/modules/core/Mat/Mat_CvMethods.cs deleted file mode 100644 index 9b8218d83..000000000 --- a/src/OpenCvSharp/modules/core/Mat/Mat_CvMethods.cs +++ /dev/null @@ -1,2619 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - partial class Mat - { - #region core - - /// - /// Computes absolute value of each matrix element - /// - /// - public MatExpr Abs() - { - return Cv2.Abs(this); - } - -#if LANG_JP - /// - /// スケーリング後,絶対値を計算し,結果を結果を 8 ビットに変換します. - /// - /// オプションのスケールファクタ. [既定値は1] - /// スケーリングされた値に加えられるオプション値. [既定値は0] - /// -#else - /// - /// Scales, computes absolute values and converts the result to 8-bit. - /// - /// The optional scale factor. [By default this is 1] - /// The optional delta added to the scaled values. [By default this is 0] - /// -#endif - public Mat ConvertScaleAbs(double alpha = 1, double beta = 0) - { - var dst = new Mat(); - Cv2.ConvertScaleAbs(this, dst, alpha, beta); - return dst; - } - - /// - /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) - /// - /// Look-up table of 256 elements. - /// In the case of multi-channel source array, the table should either have - /// a single channel (in this case the same table is used for all channels) - /// or the same number of channels as in the source array - /// - /// - public Mat LUT(InputArray lut, int interpolation = 0) - { - var dst = new Mat(); - Cv2.LUT(this, lut, dst, interpolation); - return dst; - } - - /// - /// transforms array of numbers using a lookup table: dst(i)=lut(src(i)) - /// - /// Look-up table of 256 elements. - /// In the case of multi-channel source array, the table should either have - /// a single channel (in this case the same table is used for all channels) - /// or the same number of channels as in the source array - /// - /// - public Mat LUT(byte[] lut, int interpolation = 0) - { - var dst = new Mat(); - Cv2.LUT(this, lut, dst, interpolation); - return dst; - } - - /// - /// computes sum of array elements - /// - /// - public Scalar Sum() - { - return Cv2.Sum(this); - } - - /// - /// computes the number of nonzero array elements - /// - /// number of non-zero elements in mtx - public int CountNonZero() - { - return Cv2.CountNonZero(this); - } - - /// - /// returns the list of locations of non-zero pixels - /// - /// - public Mat FindNonZero() - { - var idx = new Mat(); - Cv2.FindNonZero(this, idx); - return idx; - } - - /// - /// computes mean value of selected array elements - /// - /// The optional operation mask - /// - public Scalar Mean(InputArray mask = null) - { - return Cv2.Mean(this, mask); - } - - /// - /// computes mean value and standard deviation of all or selected array elements - /// - /// The output parameter: computed mean value - /// The output parameter: computed standard deviation - /// The optional operation mask - public void MeanStdDev(OutputArray mean, OutputArray stddev, InputArray mask = null) - { - Cv2.MeanStdDev(this, mean, stddev, mask); - } - - /// - /// computes norm of the selected array part - /// - /// Type of the norm - /// The optional operation mask - /// - public double Norm(NormTypes normType = NormTypes.L2, InputArray mask = null) - { - return Cv2.Norm(this, normType, mask); - } - - /// - /// scales and shifts array elements so that either the specified norm (alpha) - /// or the minimum (alpha) and maximum (beta) array values get the specified values - /// - /// The norm value to normalize to or the lower range boundary - /// in the case of range normalization - /// The upper range boundary in the case of range normalization; - /// not used for norm normalization - /// The normalization type - /// When the parameter is negative, - /// the destination array will have the same type as src, - /// otherwise it will have the same number of channels as src and the depth =CV_MAT_DEPTH(rtype) - /// The optional operation mask - /// - public Mat Normalize(double alpha = 1, double beta = 0, - NormTypes normType = NormTypes.L2, int dtype = -1, InputArray mask = null) - { - var dst = new Mat(); - Cv2.Normalize(this, dst, alpha, beta, normType, dtype, mask); - return dst; - } - - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// Pointer to returned minimum value - /// Pointer to returned maximum value - public void MinMaxLoc(out double minVal, out double maxVal) - { - Cv2.MinMaxLoc(this, out minVal, out maxVal); - } - - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// Pointer to returned minimum location - /// Pointer to returned maximum location - public void MinMaxLoc(out Point minLoc, out Point maxLoc) - { - Cv2.MinMaxLoc(this, out minLoc, out maxLoc); - } - - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// Pointer to returned minimum value - /// Pointer to returned maximum value - /// Pointer to returned minimum location - /// Pointer to returned maximum location - /// The optional mask used to select a sub-array - public void MinMaxLoc(out double minVal, out double maxVal, - out Point minLoc, out Point maxLoc, InputArray mask = null) - { - Cv2.MinMaxLoc(this, out minVal, out maxVal, out minLoc, out maxLoc, mask); - } - - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// Pointer to returned minimum value - /// Pointer to returned maximum value - public void MinMaxIdx(out double minVal, out double maxVal) - { - Cv2.MinMaxIdx(this, out minVal, out maxVal); - } - - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// - /// - public void MinMaxIdx(out int minIdx, out int maxIdx) - { - Cv2.MinMaxIdx(this, out minIdx, out maxIdx); - } - - /// - /// finds global minimum and maximum array elements and returns their values and their locations - /// - /// Pointer to returned minimum value - /// Pointer to returned maximum value - /// - /// - /// - public void MinMaxIdx(out double minVal, out double maxVal, - out int minIdx, out int maxIdx, InputArray mask = null) - { - Cv2.MinMaxIdx(this, out minVal, out maxVal, out minIdx, out maxIdx, mask); - } - - /// - /// transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows - /// - /// The dimension index along which the matrix is reduced. - /// 0 means that the matrix is reduced to a single row and 1 means that the matrix is reduced to a single column - /// - /// When it is negative, the destination vector will have - /// the same type as the source matrix, otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels()) - /// - public Mat Reduce(ReduceDimension dim, ReduceTypes rtype, int dtype) - { - var dst = new Mat(); - Cv2.Reduce(this, dst, dim, rtype, dtype); - return dst; - } - - /// - /// Copies each plane of a multi-channel array to a dedicated array - /// - /// The number of arrays must match mtx.channels() . - /// The arrays themselves will be reallocated if needed - public Mat[] Split() - { - return Cv2.Split(this); - } - - /// - /// extracts a single channel from src (coi is 0-based index) - /// - /// - /// - public Mat ExtractChannel(int coi) - { - var dst = new Mat(); - Cv2.ExtractChannel(this, dst, coi); - return dst; - } - - /// - /// inserts a single channel to dst (coi is 0-based index) - /// - /// - /// - public void InsertChannel(InputOutputArray dst, int coi) - { - Cv2.InsertChannel(this, dst, coi); - } - - /// - /// reverses the order of the rows, columns or both in a matrix - /// - /// Specifies how to flip the array: - /// 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, - /// and negative (e.g., -1) means flipping around both axes. See also the discussion below for the formulas. - /// The destination array; will have the same size and same type as src - public Mat Flip(FlipMode flipCode) - { - var dst = new Mat(); - Cv2.Flip(this, dst, flipCode); - return dst; - } - - /// - /// replicates the input matrix the specified number of times in the horizontal and/or vertical direction - /// - /// How many times the src is repeated along the vertical axis - /// How many times the src is repeated along the horizontal axis - /// - public Mat Repeat(int ny, int nx) - { - var dst = new Mat(); - Cv2.Repeat(this, ny, nx, dst); - return dst; - } - - /// - /// set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb) - /// - /// The inclusive lower boundary array of the same size and type as src - /// The exclusive upper boundary array of the same size and type as src - /// The destination array, will have the same size as src and CV_8U type - public Mat InRange(InputArray lowerb, InputArray upperb) - { - var dst = new Mat(); - Cv2.InRange(this, lowerb, upperb, dst); - return dst; - } - - /// - /// set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb) - /// - /// The inclusive lower boundary array of the same size and type as src - /// The exclusive upper boundary array of the same size and type as src - /// The destination array, will have the same size as src and CV_8U type - public Mat InRange(Scalar lowerb, Scalar upperb) - { - var dst = new Mat(); - Cv2.InRange(this, lowerb, upperb, dst); - return dst; - } - - /// - /// computes square root of each matrix element (dst = src**0.5) - /// - /// The destination array; will have the same size and the same type as src - public Mat Sqrt() - { - var dst = new Mat(); - Cv2.Sqrt(this, dst); - return dst; - } - - /// - /// raises the input matrix elements to the specified power (b = a**power) - /// - /// The exponent of power - /// The destination array; will have the same size and the same type as src - public Mat Pow(double power) - { - var dst = new Mat(); - Cv2.Pow(this, power, dst); - return dst; - } - - /// - /// computes exponent of each matrix element (dst = e**src) - /// - /// The destination array; will have the same size and same type as src - public Mat Exp() - { - var dst = new Mat(); - Cv2.Exp(this, dst); - return dst; - } - - /// - /// computes natural logarithm of absolute value of each matrix element: dst = log(abs(src)) - /// - /// The destination array; will have the same size and same type as src - public Mat Log() - { - var dst = new Mat(); - Cv2.Log(this, dst); - return dst; - } - - /// - /// checks that each matrix element is within the specified range. - /// - /// The flag indicating whether the functions quietly - /// return false when the array elements are out of range, - /// or they throw an exception. - /// - public bool CheckRange(bool quiet = true) - { - return Cv2.CheckRange(this, quiet); - } - - /// - /// checks that each matrix element is within the specified range. - /// - /// The flag indicating whether the functions quietly - /// return false when the array elements are out of range, - /// or they throw an exception. - /// The optional output parameter, where the position of - /// the first outlier is stored. - /// The inclusive lower boundary of valid values range - /// The exclusive upper boundary of valid values range - /// - public bool CheckRange(bool quiet, out Point pos, - double minVal = double.MinValue, double maxVal = double.MaxValue) - { - return Cv2.CheckRange(this, quiet, out pos, minVal, maxVal); - } - - /// - /// converts NaN's to the given number - /// - /// - public void PatchNaNs(double val = 0) - { - Cv2.PatchNaNs(this, val); - } - - /// - /// multiplies matrix by its transposition from the left or from the right - /// - /// Specifies the multiplication ordering; see the description below - /// The optional delta matrix, subtracted from src before the - /// multiplication. When the matrix is empty ( delta=Mat() ), it’s assumed to be - /// zero, i.e. nothing is subtracted, otherwise if it has the same size as src, - /// then it’s simply subtracted, otherwise it is "repeated" to cover the full src - /// and then subtracted. Type of the delta matrix, when it's not empty, must be the - /// same as the type of created destination matrix, see the rtype description - /// The optional scale factor for the matrix product - /// When it’s negative, the destination matrix will have the - /// same type as src . Otherwise, it will have type=CV_MAT_DEPTH(rtype), - /// which should be either CV_32F or CV_64F - public Mat MulTransposed(bool aTa, InputArray delta = null, double scale = 1, int dtype = -1) - { - var dst = new Mat(); - Cv2.MulTransposed(this, dst, aTa, delta, scale, dtype); - return dst; - } - - /// - /// transposes the matrix - /// - /// The destination array of the same type as src - public Mat Transpose() - { - var dst = new Mat(); - Cv2.Transpose(this, dst); - return dst; - } - - /// - /// performs affine transformation of each element of multi-channel input matrix - /// - /// The transformation matrix - /// The destination array; will have the same size and depth as src and as many channels as mtx.rows - public Mat Transform(InputArray m) - { - var dst = new Mat(); - Cv2.Transform(this, dst, m); - return dst; - } - - /// - /// performs perspective transformation of each element of multi-channel input matrix - /// - /// 3x3 or 4x4 transformation matrix - /// The destination array; it will have the same size and same type as src - public Mat PerspectiveTransform(InputArray m) - { - var dst = new Mat(); - Cv2.PerspectiveTransform(this, dst, m); - return dst; - } - - /// - /// extends the symmetrical matrix from the lower half or from the upper half - /// - /// If true, the lower half is copied to the upper half, - /// otherwise the upper half is copied to the lower half - public void CompleteSymm(bool lowerToUpper = false) - { - Cv2.CompleteSymm(this, lowerToUpper); - } - - /// - /// initializes scaled identity matrix (not necessarily square). - /// - /// The value to assign to the diagonal elements - public void SetIdentity(Scalar? s = null) - { - Cv2.SetIdentity(this, s); - } - - /// - /// computes determinant of a square matrix. - /// The input matrix must have CV_32FC1 or CV_64FC1 type and square size. - /// - /// determinant of the specified matrix. - public double Determinant() - { - return Cv2.Determinant(this); - } - - /// - /// computes trace of a matrix - /// - /// - public Scalar Trace() - { - return Cv2.Trace(this); - } - - /// - /// sorts independently each matrix row or each matrix column - /// - /// The operation flags, a combination of the SortFlag values - /// The destination array of the same size and the same type as src - public Mat Sort(SortFlags flags) - { - var dst = new Mat(); - Cv2.Sort(this, dst, flags); - return dst; - } - - /// - /// sorts independently each matrix row or each matrix column - /// - /// The operation flags, a combination of SortFlag values - /// The destination integer array of the same size as src - public Mat SortIdx(SortFlags flags) - { - var dst = new Mat(); - Cv2.SortIdx(this, dst, flags); - return dst; - } - - /// - /// Performs a forward Discrete Fourier transform of 1D or 2D floating-point array. - /// - /// Transformation flags, a combination of the DftFlag2 values - /// When the parameter != 0, the function assumes that - /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) - /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, - /// thus the function can handle the rest of the rows more efficiently and - /// thus save some time. This technique is very useful for computing array cross-correlation - /// or convolution using DFT - /// The destination array, which size and type depends on the flags - public Mat Dft(DftFlags flags = 0, int nonzeroRows = 0) - { - var dst = new Mat(); - Cv2.Dft(this, dst, flags, nonzeroRows); - return dst; - } - - /// - /// Performs an inverse Discrete Fourier transform of 1D or 2D floating-point array. - /// - /// Transformation flags, a combination of the DftFlag2 values - /// When the parameter != 0, the function assumes that - /// only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) - /// or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, - /// thus the function can handle the rest of the rows more efficiently and - /// thus save some time. This technique is very useful for computing array cross-correlation - /// or convolution using DFT - /// The destination array, which size and type depends on the flags - public Mat Idft(DftFlags flags = 0, int nonzeroRows = 0) - { - var dst = new Mat(); - Cv2.Idft(this, dst, flags, nonzeroRows); - return dst; - } - - /// - /// performs forward or inverse 1D or 2D Discrete Cosine Transformation - /// - /// Transformation flags, a combination of DctFlag2 values - /// The destination array; will have the same size and same type as src - public Mat Dct(DctFlags flags = 0) - { - var dst = new Mat(); - Cv2.Dct(this, dst, flags); - return dst; - } - - /// - /// performs inverse 1D or 2D Discrete Cosine Transformation - /// - /// Transformation flags, a combination of DctFlag2 values - /// The destination array; will have the same size and same type as src - public Mat Idct(DctFlags flags = 0) - { - var dst = new Mat(); - Cv2.Idct(this, dst, flags); - return dst; - } - - /// - /// fills array with uniformly-distributed random numbers from the range [low, high) - /// - /// The inclusive lower boundary of the generated random numbers - /// The exclusive upper boundary of the generated random numbers - public void Randu(InputArray low, InputArray high) - { - Cv2.Randu(this, low, high); - } - - /// - /// fills array with uniformly-distributed random numbers from the range [low, high) - /// - /// The inclusive lower boundary of the generated random numbers - /// The exclusive upper boundary of the generated random numbers - public void Randu(Scalar low, Scalar high) - { - Cv2.Randu(this, low, high); - } - - /// - /// fills array with normally-distributed random numbers with the specified mean and the standard deviation - /// - /// The mean value (expectation) of the generated random numbers - /// The standard deviation of the generated random numbers - public void Randn(InputArray mean, InputArray stddev) - { - Cv2.Randn(this, mean, stddev); - } - - /// - /// fills array with normally-distributed random numbers with the specified mean and the standard deviation - /// - /// The mean value (expectation) of the generated random numbers - /// The standard deviation of the generated random numbers - public void Randn(Scalar mean, Scalar stddev) - { - Cv2.Randn(this, mean, stddev); - } - - /// - /// shuffles the input array elements - /// - /// The scale factor that determines the number of random swap operations. - /// The optional random number generator used for shuffling. - /// If it is null, theRng() is used instead. - /// The input/output numerical 1D array - public void RandShuffle(double iterFactor, RNG rng = null) - { - Cv2.RandShuffle(this, iterFactor, rng); - } - - #region Drawing - - #region Line - -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 線分の1番目の端点x - /// 線分の1番目の端点y - /// 線分の2番目の端点x - /// 線分の2番目の端点y - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a line segment connecting two points - /// - /// First point's x-coordinate of the line segment. - /// First point's y-coordinate of the line segment. - /// Second point's x-coordinate of the line segment. - /// Second point's y-coordinate of the line segment. - /// Line color. - /// Line thickness. [By default this is 1] - /// Type of the line. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public void Line(int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Line(this, pt1X, pt1Y, pt2X, pt2Y, color, thickness, lineType, shift); - } - -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 線分の1番目の端点 - /// 線分の2番目の端点 - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a line segment connecting two points - /// - /// First point of the line segment. - /// Second point of the line segment. - /// Line color. - /// Line thickness. [By default this is 1] - /// Type of the line. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public void Line( - Point pt1, Point pt2, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Line(this, pt1, pt2, color, thickness, lineType, shift); - } - - #endregion - - #region Rectangle - -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 矩形の一つの頂点 - /// 矩形の反対側の頂点 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws simple, thick or filled rectangle - /// - /// One of the rectangle vertices. - /// Opposite rectangle vertex. - /// Line color (RGB) or brightness (grayscale image). - /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] - /// Type of the line, see cvLine description. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public void Rectangle( - Point pt1, Point pt2, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Rectangle(this, pt1, pt2, color, thickness, lineType, shift); - } - -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 矩形 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws simple, thick or filled rectangle - /// - /// Rectangle. - /// Line color (RGB) or brightness (grayscale image). - /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] - /// Type of the line, see cvLine description. [By default this is LineType.Link8] - /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif - public void Rectangle( - Rect rect, Scalar color, int thickness = 1, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Rectangle(this, rect, color, thickness, lineType, shift); - } - - #endregion - - #region Circle - -#if LANG_JP - /// - /// 円を描画する - /// - /// 円の中心のx座標 - /// 円の中心のy座標 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a circle - /// - /// X-coordinate of the center of the circle. - /// Y-coordinate of the center of the circle. - /// Radius of the circle. - /// Circle color. - /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] - /// Type of the circle boundary. [By default this is LineType.Link8] - /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif - public void Circle(int centerX, int centerY, int radius, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Circle(this, centerX, centerY, radius, color, thickness, lineType, shift); - } - -#if LANG_JP - /// - /// 円を描画する - /// - /// 円の中心 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else - /// - /// Draws a circle - /// - /// Center of the circle. - /// Radius of the circle. - /// Circle color. - /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] - /// Type of the circle boundary. [By default this is LineType.Link8] - /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif - public void Circle(Point center, int radius, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Circle(this, center, radius, color, thickness, lineType, shift); - } - - #endregion - - #region Ellipse - -#if LANG_JP - /// - /// 枠だけの楕円,楕円弧,もしくは塗りつぶされた扇形の楕円を描画する - /// - /// 楕円の中心 - /// 楕円の軸の長さ - /// 回転角度 - /// 楕円弧の開始角度 - /// 楕円弧の終了角度 - /// 楕円の色 - /// 楕円弧の線の幅 [既定値は1] - /// 楕円弧の線の種類 [既定値はLineType.Link8] - /// 中心座標と軸の長さの小数点以下の桁を表すビット数 [既定値は0] -#else - /// - /// Draws simple or thick elliptic arc or fills ellipse sector - /// - /// Center of the ellipse. - /// Length of the ellipse axes. - /// Rotation angle. - /// Starting angle of the elliptic arc. - /// Ending angle of the elliptic arc. - /// Ellipse color. - /// Thickness of the ellipse arc. [By default this is 1] - /// Type of the ellipse boundary. [By default this is LineType.Link8] - /// Number of fractional bits in the center coordinates and axes' values. [By default this is 0] -#endif - public void Ellipse( - Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Ellipse(this, center, axes, angle, startAngle, endAngle, color, thickness, lineType, shift); - } - -#if LANG_JP - /// - /// 枠だけの楕円,もしくは塗りつぶされた楕円を描画する - /// - /// 描画したい楕円を囲む矩形領域. - /// 楕円の色. - /// 楕円境界線の幅.[既定値は1] - /// 楕円境界線の種類.[既定値はLineType.Link8] -#else - /// - /// Draws simple or thick elliptic arc or fills ellipse sector - /// - /// The enclosing box of the ellipse drawn - /// Ellipse color. - /// Thickness of the ellipse boundary. [By default this is 1] - /// Type of the ellipse boundary. [By default this is LineType.Link8] -#endif - public void Ellipse(RotatedRect box, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8) - { - Cv2.Ellipse(this, box, color, thickness, lineType); - } - - #endregion - - #region FillConvexPoly - -#if LANG_JP - /// - /// 塗りつぶされた凸ポリゴンを描きます. - /// - /// ポリゴンの頂点. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. -#else - /// - /// Fills a convex polygon. - /// - /// The polygon vertices - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates -#endif - public void FillConvexPoly(IEnumerable pts, Scalar color, - LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.FillConvexPoly(this, pts, color, lineType, shift); - } - - #endregion - - #region FillPoly - -#if LANG_JP - /// - /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします. - /// - /// ポリゴンの配列.各要素は,点の配列で表現されます. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. - /// -#else - /// - /// Fills the area bounded by one or more polygons - /// - /// Array of polygons, each represented as an array of points - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates - /// -#endif - public void FillPoly(IEnumerable> pts, Scalar color, - LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) - { - Cv2.FillPoly(this, pts, color, lineType, shift, offset); - } - - #endregion - - #region Polylines - - /// - /// draws one or more polygonal curves - /// - /// - /// - /// - /// - /// - /// - public void Polylines(IEnumerable> pts, bool isClosed, Scalar color, - int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) - { - Cv2.Polylines(this, pts, isClosed, color, thickness, lineType, shift); - } - - #endregion - - #region PutText - - /// - /// renders text string in the image - /// - /// - /// - /// - /// - /// - /// - /// - /// - public void PutText(string text, Point org, - HersheyFonts fontFace, double fontScale, Scalar color, - int thickness = 1, - LineTypes lineType = LineTypes.Link8, - bool bottomLeftOrigin = false) - { - Cv2.PutText(this, text, org, fontFace, fontScale, color, thickness, lineType, bottomLeftOrigin); - } - - #endregion - - #region ImEncode / ToBytes - - /// - /// Encodes an image into a memory buffer. - /// - /// Encodes an image into a memory buffer. - /// Format-specific parameters. - /// - public byte[] ImEncode(string ext = ".png", int[] prms = null) - { - byte[] buf; - Cv2.ImEncode(ext, this, out buf, prms); - return buf; - } - - /// - /// Encodes an image into a memory buffer. - /// - /// Encodes an image into a memory buffer. - /// Format-specific parameters. - /// - public byte[] ImEncode(string ext = ".png", params ImageEncodingParam[] prms) - { - byte[] buf; - Cv2.ImEncode(ext, this, out buf, prms); - return buf; - } - - #endregion - - #region ImWrite / SaveImage - - /// - /// Saves an image to a specified file. - /// - /// - /// - /// - public bool ImWrite(string fileName, int[] prms = null) - { - return Cv2.ImWrite(fileName, this, prms); - } - - /// - /// Saves an image to a specified file. - /// - /// - /// - /// - public bool ImWrite(string fileName, params ImageEncodingParam[] prms) - { - return Cv2.ImWrite(fileName, this, prms); - } - - /// - /// Saves an image to a specified file. - /// - /// - /// - /// - public bool SaveImage(string fileName, int[] prms = null) - { - return Cv2.ImWrite(fileName, this, prms); - } - - /// - /// Saves an image to a specified file. - /// - /// - /// - /// - public bool SaveImage(string fileName, params ImageEncodingParam[] prms) - { - return Cv2.ImWrite(fileName, this, prms); - } - - #endregion - - #endregion - - #endregion - - #region imgproc - - /// - /// Forms a border around the image - /// - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// Specify how much pixels in each direction from the source image rectangle one needs to extrapolate - /// The border type - /// The border value if borderType == Constant - public Mat CopyMakeBorder(int top, int bottom, int left, int right, BorderTypes borderType, Scalar? value = null) - { - var dst = new Mat(); - Cv2.CopyMakeBorder(this, dst, top, bottom, left, right, borderType, value); - return dst; - } - - /// - /// Smoothes image using median filter. - /// The source image must have 1-, 3- or 4-channel and - /// its depth should be CV_8U , CV_16U or CV_32F. - /// - /// The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ... - /// The destination array; will have the same size and the same type as src. - public Mat MedianBlur(int ksize) - { - var dst = new Mat(); - Cv2.MedianBlur(this, dst, ksize); - return dst; - } - - /// - /// Blurs an image using a Gaussian filter. - /// The input image can have any number of channels, which are processed independently, - /// but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. - /// - /// Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. - /// Or, they can be zero’s and then they are computed from sigma* . - /// Gaussian kernel standard deviation in X direction. - /// Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, - /// if both sigmas are zeros, they are computed from ksize.width and ksize.height, - /// respectively (see getGaussianKernel() for details); to fully control the result - /// regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY. - /// pixel extrapolation method - public Mat GaussianBlur(Size ksize, double sigmaX, - double sigmaY = 0, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.GaussianBlur(this, dst, ksize, sigmaX, sigmaY, borderType); - return dst; - } - - /// - /// Applies bilateral filter to the image - /// The source image must be a 8-bit or floating-point, 1-channel or 3-channel image. - /// - /// The diameter of each pixel neighborhood, that is used during filtering. - /// If it is non-positive, it's computed from sigmaSpace - /// Filter sigma in the color space. - /// Larger value of the parameter means that farther colors within the pixel neighborhood - /// will be mixed together, resulting in larger areas of semi-equal color - /// Filter sigma in the coordinate space. - /// Larger value of the parameter means that farther pixels will influence each other - /// (as long as their colors are close enough; see sigmaColor). Then d>0 , it specifies - /// the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace - /// - /// The destination image; will have the same size and the same type as src - public Mat BilateralFilter(int d, double sigmaColor, double sigmaSpace, - BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.BilateralFilter(this, dst, d, sigmaColor, sigmaSpace, borderType); - return dst; - } - - /* - /// - /// Applies the adaptive bilateral filter to an image. - /// - /// The kernel size. This is the neighborhood where the local variance will be calculated, - /// and where pixels will contribute (in a weighted manner). - /// Filter sigma in the coordinate space. - /// Larger value of the parameter means that farther pixels will influence each other - /// (as long as their colors are close enough; see sigmaColor). Then d>0, it specifies the neighborhood - /// size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace. - /// Maximum allowed sigma color (will clamp the value calculated in the - /// ksize neighborhood. Larger value of the parameter means that more dissimilar pixels will - /// influence each other (as long as their colors are close enough; see sigmaColor). - /// Then d>0, it specifies the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace. - /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center - /// Pixel extrapolation method. - /// The destination image; will have the same size and the same type as src - public Mat AdaptiveBilateralFilter(Size ksize, double sigmaSpace, - double maxSigmaColor = 20.0, Point? anchor = null, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.AdaptiveBilateralFilter(this, dst, ksize, sigmaSpace, maxSigmaColor, anchor, borderType); - return dst; - } - */ - - /// - /// Smoothes image using box filter - /// - /// - /// The smoothing kernel size - /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center - /// Indicates, whether the kernel is normalized by its area or not - /// The border mode used to extrapolate pixels outside of the image - /// The destination image; will have the same size and the same type as src - public Mat BoxFilter(MatType ddepth, Size ksize, Point? anchor = null, - bool normalize = true, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.BoxFilter(this, dst, ddepth, ksize, anchor, normalize, borderType); - return dst; - } - - /// - /// Smoothes image using normalized box filter - /// - /// The smoothing kernel size - /// The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center - /// The border mode used to extrapolate pixels outside of the image - /// The destination image; will have the same size and the same type as src - public Mat Blur(Size ksize, Point? anchor = null, - BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.Blur(this, dst, ksize, anchor, borderType); - return dst; - } - - /// - /// Convolves an image with the kernel - /// - /// The desired depth of the destination image. If it is negative, it will be the same as src.depth() - /// Convolution kernel (or rather a correlation kernel), - /// a single-channel floating point matrix. If you want to apply different kernels to - /// different channels, split the image into separate color planes using split() and process them individually - /// The anchor of the kernel that indicates the relative position of - /// a filtered point within the kernel. The anchor should lie within the kernel. - /// The special default value (-1,-1) means that the anchor is at the kernel center - /// The optional value added to the filtered pixels before storing them in dst - /// The pixel extrapolation method - /// The destination image. It will have the same size and the same number of channels as src - public Mat Filter2D(MatType ddepth, InputArray kernel, Point? anchor = null, - double delta = 0, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.Filter2D(this, dst, ddepth, kernel, anchor, delta, borderType); - return dst; - } - - /// - /// Applies separable linear filter to an image - /// - /// The destination image depth - /// The coefficients for filtering each row - /// The coefficients for filtering each column - /// The anchor position within the kernel; The default value (-1, 1) means that the anchor is at the kernel center - /// The value added to the filtered results before storing them - /// The pixel extrapolation method - /// The destination image; will have the same size and the same number of channels as src - public Mat SepFilter2D(MatType ddepth, InputArray kernelX, InputArray kernelY, - Point? anchor = null, double delta = 0, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.SepFilter2D(this, dst, ddepth, kernelX, kernelY, anchor, delta, borderType); - return dst; - } - - /// - /// Calculates the first, second, third or mixed image derivatives using an extended Sobel operator - /// - /// The destination image depth - /// Order of the derivative x - /// Order of the derivative y - /// Size of the extended Sobel kernel, must be 1, 3, 5 or 7 - /// The optional scale factor for the computed derivative values (by default, no scaling is applied - /// The optional delta value, added to the results prior to storing them in dst - /// The pixel extrapolation method - /// The destination image; will have the same size and the same number of channels as src - public Mat Sobel(MatType ddepth, int xorder, int yorder, - int ksize = 3, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.Sobel(this, dst, ddepth, xorder, yorder, ksize, scale, delta, borderType); - return dst; - } - - /// - /// Calculates the first x- or y- image derivative using Scharr operator - /// - /// The destination image depth - /// Order of the derivative x - /// Order of the derivative y - /// The optional scale factor for the computed derivative values (by default, no scaling is applie - /// The optional delta value, added to the results prior to storing them in dst - /// The pixel extrapolation method - /// The destination image; will have the same size and the same number of channels as src - public Mat Scharr(MatType ddepth, int xorder, int yorder, - double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.Scharr(this, dst, ddepth, xorder, yorder, scale, delta, borderType); - return dst; - } - - /// - /// Calculates the Laplacian of an image - /// - /// The desired depth of the destination image - /// The aperture size used to compute the second-derivative filters - /// The optional scale factor for the computed Laplacian values (by default, no scaling is applied - /// The optional delta value, added to the results prior to storing them in dst - /// The pixel extrapolation method - /// Destination image; will have the same size and the same number of channels as src - public Mat Laplacian(MatType ddepth, - int ksize = 1, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.Laplacian(this, dst, ddepth, ksize, scale, delta, borderType); - return dst; - } - -#if LANG_JP - /// - /// Cannyアルゴリズムを用いて,画像のエッジを検出します. - /// - /// ヒステリシスが存在する処理の,1番目の閾値 - /// ヒステリシスが存在する処理の,2番目の閾値 - /// Sobelオペレータのアパーチャサイズ [既定値はApertureSize.Size3] - /// 画像勾配の強度を求めるために,より精度の高い L2ノルムを利用するか,L1ノルムで十分(false)かを指定します. [既定値はfalse] - /// 出力されるエッジのマップ. image と同じサイズ,同じ型 -#else - /// - /// Finds edges in an image using Canny algorithm. - /// - /// The first threshold for the hysteresis procedure - /// The second threshold for the hysteresis procedure - /// Aperture size for the Sobel operator [By default this is ApertureSize.Size3] - /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] - /// The output edge map. It will have the same size and the same type as image -#endif -// ReSharper disable once InconsistentNaming - public Mat Canny(double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false) - { - var dst = new Mat(); - Cv2.Canny(this, dst, threshold1, threshold2, apertureSize, L2gradient); - return dst; - } - - /// - /// computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix. - /// - /// - /// - /// - public Mat CornerEigenValsAndVecs(int blockSize, int ksize, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.CornerEigenValsAndVecs(this, dst, blockSize, ksize, borderType); - return dst; - } - - /// - /// computes another complex cornerness criteria at each pixel - /// - /// - /// - public Mat PreCornerDetect(int ksize, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.PreCornerDetect(this, dst, ksize, borderType); - return dst; - } - - /// - /// adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria - /// - /// Initial coordinates of the input corners and refined coordinates provided for output. - /// Half of the side length of the search window. - /// Half of the size of the dead region in the middle of the search zone - /// over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities - /// of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size. - /// Criteria for termination of the iterative process of corner refinement. - /// That is, the process of corner position refinement stops either after criteria.maxCount iterations - /// or when the corner position moves by less than criteria.epsilon on some iteration. - /// - public Point2f[] CornerSubPix(IEnumerable inputCorners, - Size winSize, Size zeroZone, TermCriteria criteria) - { - return Cv2.CornerSubPix(this, inputCorners, winSize, zeroZone, criteria); - } - - /// - /// Finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima. - /// Input matrix must be 8-bit or floating-point 32-bit, single-channel image. - /// - /// Maximum number of corners to return. If there are more corners than are found, - /// the strongest of them is returned. - /// Parameter characterizing the minimal accepted quality of image corners. - /// The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue - /// or the Harris function response (see cornerHarris() ). The corners with the quality measure less than - /// the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01, - /// then all the corners with the quality measure less than 15 are rejected. - /// Minimum possible Euclidean distance between the returned corners. - /// Optional region of interest. If the image is not empty - /// (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region - /// in which the corners are detected. - /// Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. - /// Parameter indicating whether to use a Harris detector - /// Free parameter of the Harris detector. - /// Output vector of detected corners. - public Point2f[] GoodFeaturesToTrack( - int maxCorners, double qualityLevel, double minDistance, - InputArray mask, int blockSize, bool useHarrisDetector, double k) - { - return Cv2.GoodFeaturesToTrack(this, maxCorners, qualityLevel, - minDistance, mask, blockSize, useHarrisDetector, k); - } - -#if LANG_JP - /// - /// 標準ハフ変換を用いて,2値画像から直線を検出します. - /// - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// マルチスケールハフ変換において,距離分解能 rho の除数となる値.[既定値は0] - /// マルチスケールハフ変換において,角度分解能 theta の除数となる値. [既定値は0] - /// 検出された直線.各直線は,2要素のベクトル (rho, theta) で表現されます. - /// rho は原点(画像の左上コーナー)からの距離, theta はラジアン単位で表される直線の回転角度です -#else - /// - /// Finds lines in a binary image using standard Hough transform. - /// The input matrix must be 8-bit, single-channel, binary source image. - /// This image may be modified by the function. - /// - /// Distance resolution of the accumulator in pixels - /// Angle resolution of the accumulator in radians - /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) - /// For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0] - /// For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0] - /// The output vector of lines. Each line is represented by a two-element vector (rho, theta) . - /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians -#endif - public LineSegmentPolar[] HoughLines(double rho, double theta, int threshold, - double srn = 0, double stn = 0) - { - return Cv2.HoughLines(this, rho, theta, threshold, srn, stn); - } - -#if LANG_JP - /// - /// 確率的ハフ変換を利用して,2値画像から線分を検出します. - /// - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// 最小の線分長.これより短い線分は棄却されます. [既定値は0] - /// 2点が同一線分上にあると見なす場合に許容される最大距離. [既定値は0] - /// 検出された線分.各線分は,4要素のベクトル (x1, y1, x2, y2) で表現されます. -#else - /// - /// Finds lines segments in a binary image using probabilistic Hough transform. - /// - /// Distance resolution of the accumulator in pixels - /// Angle resolution of the accumulator in radians - /// The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ) - /// The minimum line length. Line segments shorter than that will be rejected. [By default this is 0] - /// The maximum allowed gap between points on the same line to link them. [By default this is 0] - /// The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2) -#endif - public LineSegmentPoint[] HoughLinesP(double rho, double theta, int threshold, - double minLineLength = 0, double maxLineGap = 0) - { - return Cv2.HoughLinesP(this, rho, theta, threshold, minLineLength, maxLineGap); - } - -#if LANG_JP - /// - /// ハフ変換を用いて,グレースケール画像から円を検出します. - /// - /// 現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている. - /// 画像分解能に対する投票分解能の比率の逆数. - /// 検出される円の中心同士の最小距離. - /// 手法依存の1番目のパラメータ.[既定値は100] - /// 手法依存の2番目のパラメータ.[既定値は100] - /// 円の半径の最小値 [既定値は0] - /// 円の半径の最大値 [既定値は0] - /// 検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます -#else - /// - /// Finds circles in a grayscale image using a Hough transform. - /// The input matrix must be 8-bit, single-channel and grayscale. - /// - /// Currently, the only implemented method is HoughCirclesMethod.Gradient - /// The inverse ratio of the accumulator resolution to the image resolution. - /// Minimum distance between the centers of the detected circles. - /// The first method-specific parameter. [By default this is 100] - /// The second method-specific parameter. [By default this is 100] - /// Minimum circle radius. [By default this is 0] - /// Maximum circle radius. [By default this is 0] - /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) -#endif - public CircleSegment[] HoughCircles(HoughMethods method, double dp, double minDist, - double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) - { - return Cv2.HoughCircles(this, method, dp, minDist, param1, param2, minRadius, maxRadius); - } - -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の膨張を行います. - /// - /// 膨張に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 膨張が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderTypes.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] - /// src と同じサイズ,同じ型の出力画像 -#else - /// - /// Dilates an image by using a specific structuring element. - /// - /// The structuring element used for dilation. If element=new Mat() , a 3x3 rectangular structuring element is used - /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center - /// The number of times dilation is applied. [By default this is 1] - /// The pixel extrapolation method. [By default this is BorderTypes.Constant] - /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] - /// The destination image. It will have the same size and the same type as src -#endif - public Mat Dilate(InputArray element, Point? anchor = null, int iterations = 1, - BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) - { - var dst = new Mat(); - Cv2.Dilate(this, dst, element, anchor, iterations, borderType, borderValue); - return dst; - } - -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の収縮を行います. - /// - /// 収縮に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形の構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 収縮が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderTypes.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] - /// src と同じサイズ,同じ型の出力画像 -#else - /// - /// Erodes an image by using a specific structuring element. - /// - /// The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used - /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center - /// The number of times erosion is applied - /// The pixel extrapolation method - /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] - /// The destination image. It will have the same size and the same type as src -#endif - public Mat Erode(InputArray element, Point? anchor = null, int iterations = 1, - BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) - { - var dst = new Mat(); - Cv2.Erode(this, dst, element, anchor, iterations, borderType, borderValue); - return dst; - } - -#if LANG_JP - /// - /// 高度なモルフォロジー変換を行います. - /// - /// モルフォロジー演算の種類 - /// 構造要素 - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します. - /// 収縮と膨張が適用される回数. [既定値は1] - /// ピクセル外挿手法. [既定値はBorderTypes.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()] - /// src と同じサイズ,同じ型の出力画像 -#else - /// - /// Performs advanced morphological transformations - /// - /// Type of morphological operation - /// Structuring element - /// Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center - /// Number of times erosion and dilation are applied. [By default this is 1] - /// The pixel extrapolation method. [By default this is BorderTypes.Constant] - /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] - /// Destination image. It will have the same size and the same type as src -#endif - public Mat MorphologyEx(MorphTypes op, InputArray element, - Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, - Scalar? borderValue = null) - { - var dst = new Mat(); - Cv2.MorphologyEx(this, dst, op, element, anchor, iterations, borderType, borderValue); - return dst; - } - - /// - /// Resizes an image. - /// - /// output image size; if it equals zero, it is computed as: - /// dsize = Size(round(fx*src.cols), round(fy*src.rows)) - /// Either dsize or both fx and fy must be non-zero. - /// scale factor along the horizontal axis; when it equals 0, - /// it is computed as: (double)dsize.width/src.cols - /// scale factor along the vertical axis; when it equals 0, - /// it is computed as: (double)dsize.height/src.rows - /// interpolation method - /// output image; it has the size dsize (when it is non-zero) or the size computed - /// from src.size(), fx, and fy; the type of dst is the same as of src. - public Mat Resize(Size dsize, double fx = 0, double fy = 0, - InterpolationFlags interpolation = InterpolationFlags.Linear) - { - var dst = new Mat(); - Cv2.Resize(this, dst, dsize, fx, fy, interpolation); - return dst; - } - - /// - /// Applies an affine transformation to an image. - /// - /// output image that has the size dsize and the same type as src. - /// 2x3 transformation matrix. - /// size of the output image. - /// combination of interpolation methods and the optional flag - /// WARP_INVERSE_MAP that means that M is the inverse transformation (dst -> src) . - /// pixel extrapolation method; when borderMode=BORDER_TRANSPARENT, - /// it means that the pixels in the destination image corresponding to the "outliers" - /// in the source image are not modified by the function. - /// value used in case of a constant border; by default, it is 0. - public Mat WarpAffine(InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) - { - var dst = new Mat(); - Cv2.WarpAffine(this, dst, m, dsize, flags, borderMode, borderValue); - return dst; - } - - /// - /// Applies a perspective transformation to an image. - /// - /// 3x3 transformation matrix. - /// size of the output image. - /// combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) - /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). - /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). - /// value used in case of a constant border; by default, it equals 0. - /// output image that has the size dsize and the same type as src. - public Mat WarpPerspective(Mat m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) - { - var dst = new Mat(); - Cv2.WarpPerspective(this, dst, m, dsize, flags, borderMode, borderValue); - return dst; - } - - /// - /// Applies a generic geometrical transformation to an image. - /// - /// The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2. - /// The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively. - /// Interpolation method. The method INTER_AREA is not supported by this function. - /// Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, - /// it means that the pixels in the destination image that corresponds to the "outliers" in - /// the source image are not modified by the function. - /// Value used in case of a constant border. By default, it is 0. - /// Destination image. It has the same size as map1 and the same type as src - public Mat Remap(InputArray map1, InputArray map2, InterpolationFlags interpolation = InterpolationFlags.Linear, - BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null) - { - var dst = new Mat(); - Cv2.Remap(this, dst, map1, map2, interpolation, borderMode, borderValue); - return dst; - } - - /// - /// Inverts an affine transformation. - /// - /// Output reverse affine transformation. - public Mat InvertAffineTransform() - { - var dst = new Mat(); - Cv2.InvertAffineTransform(this, dst); - return dst; - } - - /// - /// Retrieves a pixel rectangle from an image with sub-pixel accuracy. - /// - /// Size of the extracted patch. - /// Floating point coordinates of the center of the extracted rectangle - /// within the source image. The center must be inside the image. - /// Depth of the extracted pixels. By default, they have the same depth as src. - /// Extracted patch that has the size patchSize and the same number of channels as src . - public Mat GetRectSubPix(Size patchSize, Point2f center, int patchType = -1) - { - var dst = new Mat(); - Cv2.GetRectSubPix(this, patchSize, center, dst, patchType); - return dst; - } - - /// - /// Adds an image to the accumulator. - /// - /// Optional operation mask. - /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. - public Mat Accumulate(InputArray mask) - { - var dst = new Mat(); - Cv2.Accumulate(this, dst, mask); - return dst; - } - - /// - /// Adds the square of a source image to the accumulator. - /// - /// Optional operation mask. - /// Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. - public Mat AccumulateSquare(InputArray mask) - { - var dst = new Mat(); - Cv2.AccumulateSquare(this, dst, mask); - return dst; - } - - /// - /// Computes a Hanning window coefficients in two dimensions. - /// - /// The window size specifications - /// Created array type - public void CreateHanningWindow(Size winSize, MatType type) - { - Cv2.CreateHanningWindow(this, winSize, type); - } - - /// - /// Applies a fixed-level threshold to each array element. - /// The input matrix must be single-channel, 8-bit or 32-bit floating point. - /// - /// threshold value. - /// maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. - /// thresholding type (see the details below). - /// output array of the same size and type as src. - public Mat Threshold(double thresh, double maxval, ThresholdTypes type) - { - var dst = new Mat(); - Cv2.Threshold(this, dst, thresh, maxval, type); - return dst; - } - - /// - /// Applies an adaptive threshold to an array. - /// Source matrix must be 8-bit single-channel image. - /// - /// Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. - /// Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C . - /// Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV . - /// Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. - /// Constant subtracted from the mean or weighted mean (see the details below). - /// Normally, it is positive but may be zero or negative as well. - /// Destination image of the same size and the same type as src. - public Mat AdaptiveThreshold(double maxValue, AdaptiveThresholdTypes adaptiveMethod, - ThresholdTypes thresholdType, int blockSize, double c) - { - var dst = new Mat(); - Cv2.AdaptiveThreshold(this, dst, maxValue, adaptiveMethod, - thresholdType, blockSize, c); - return dst; - } - - /// - /// Blurs an image and downsamples it. - /// - /// size of the output image; by default, it is computed as Size((src.cols+1)/2 - /// - /// - public Mat PyrDown(Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.PyrDown(this, dst, dstSize, borderType); - return dst; - } - - /// - /// Upsamples an image and then blurs it. - /// - /// size of the output image; by default, it is computed as Size(src.cols*2, (src.rows*2) - /// - /// - public Mat PyrUp(Size? dstSize = null, BorderTypes borderType = BorderTypes.Default) - { - var dst = new Mat(); - Cv2.PyrUp(this, dst, dstSize, borderType); - return dst; - } - - /// - /// corrects lens distortion for the given camera matrix and distortion coefficients - /// - /// Input camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, - /// or 8 elements. If the vector is null, the zero distortion coefficients are assumed. - /// Camera matrix of the distorted image. - /// By default, it is the same as cameraMatrix but you may additionally scale - /// and shift the result by using a different matrix. - /// Output (corrected) image that has the same size and type as src . - public Mat Undistort(InputArray cameraMatrix, InputArray distCoeffs, InputArray newCameraMatrix = null) - { - var dst = new Mat(); - Cv2.Undistort(this, dst, cameraMatrix, distCoeffs, newCameraMatrix); - return dst; - } - - /// - /// returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true) - /// - /// Camera view image size in pixels. - /// Location of the principal point in the new camera matrix. - /// The parameter indicates whether this location should be at the image center or not. - /// the camera matrix that is either an exact copy of the input cameraMatrix - /// (when centerPrinicipalPoint=false), or the modified one (when centerPrincipalPoint=true). - public Mat GetDefaultNewCameraMatrix(Size? imgSize = null, bool centerPrincipalPoint = false) - { - return Cv2.GetDefaultNewCameraMatrix(this, imgSize, centerPrincipalPoint); - } - - /// - /// Computes the ideal point coordinates from the observed point coordinates. - /// Input matrix is an observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). - /// - /// Camera matrix - /// Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. - /// If the vector is null, the zero distortion coefficients are assumed. - /// Rectification transformation in the object space (3x3 matrix). - /// R1 or R2 computed by stereoRectify() can be passed here. - /// If the matrix is empty, the identity transformation is used. - /// New camera matrix (3x3) or new projection matrix (3x4). - /// P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, - /// the identity new camera matrix is used. - /// Output ideal point coordinates after undistortion and reverse perspective transformation. - /// If matrix P is identity or omitted, dst will contain normalized point coordinates. - public Mat UndistortPoints( - InputArray cameraMatrix, InputArray distCoeffs, - InputArray r = null, InputArray p = null) - { - var dst = new Mat(); - Cv2.UndistortPoints(this, dst, cameraMatrix, distCoeffs, r, p); - return dst; - } - - /// - /// Normalizes the grayscale image brightness and contrast by normalizing its histogram. - /// The source matrix is 8-bit single channel image. - /// - /// The destination image; will have the same size and the same type as src - public Mat EqualizeHist() - { - var dst = new Mat(); - Cv2.EqualizeHist(this, dst); - return dst; - } - - /// - /// Performs a marker-based image segmentation using the watershed algorithm. - /// Input matrix is 8-bit 3-channel image. - /// - /// Input/output 32-bit single-channel image (map) of markers. - /// It should have the same size as image. - public void Watershed(InputOutputArray markers) - { - Cv2.Watershed(this, markers); - } - - /// - /// Performs initial step of meanshift segmentation of an image. - /// The source matrix is 8-bit, 3-channel image. - /// - /// The spatial window radius. - /// The color window radius. - /// Maximum level of the pyramid for the segmentation. - /// Termination criteria: when to stop meanshift iterations. - /// The destination image of the same format and the same size as the source. - public Mat PyrMeanShiftFiltering(double sp, double sr, int maxLevel = 1, TermCriteria? termcrit = null) - { - var dst = new Mat(); - Cv2.PyrMeanShiftFiltering(this, dst, sp, sr, maxLevel, termcrit); - return dst; - } - - /// - /// Segments the image using GrabCut algorithm. - /// The input is 8-bit 3-channel image. - /// - /// Input/output 8-bit single-channel mask. - /// The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. - /// Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD - /// ROI containing a segmented object. The pixels outside of the ROI are - /// marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT. - /// Temporary array for the background model. Do not modify it while you are processing the same image. - /// Temporary arrays for the foreground model. Do not modify it while you are processing the same image. - /// Number of iterations the algorithm should make before returning the result. - /// Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL . - /// Operation mode that could be one of GrabCutFlag value. - public void GrabCut(InputOutputArray mask, Rect rect, - InputOutputArray bgdModel, InputOutputArray fgdModel, - int iterCount, GrabCutModes mode) - { - Cv2.GrabCut(this, mask, rect, bgdModel, fgdModel, iterCount, mode); - } - - /// - /// Fills a connected component with the given color. - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// - /// Starting point. - /// New value of the repainted domain pixels. - /// - public int FloodFill(Point seedPoint, Scalar newVal) - { - return Cv2.FloodFill(this, seedPoint, newVal); - } - - /// - /// Fills a connected component with the given color. - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// - /// Starting point. - /// New value of the repainted domain pixels. - /// Optional output parameter set by the function to the - /// minimum bounding rectangle of the repainted domain. - /// Maximal lower brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Maximal upper brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Operation flags. Lower bits contain a connectivity value, - /// 4 (default) or 8, used within the function. Connectivity determines which - /// neighbors of a pixel are considered. - /// - public int FloodFill( - Point seedPoint, Scalar newVal, out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, - FloodFillFlags flags = FloodFillFlags.Link4) - { - return Cv2.FloodFill(this, seedPoint, newVal, out rect, - loDiff, upDiff, flags); - } - - /// - /// Fills a connected component with the given color. - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// - /// (For the second function only) Operation mask that should be a single-channel 8-bit image, - /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of - /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, - /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask - /// in multiple calls to the function to make sure the filled area does not overlap. - /// Starting point. - /// New value of the repainted domain pixels. - /// - public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal) - { - return Cv2.FloodFill(this, mask, seedPoint, newVal); - } - - /// - /// Fills a connected component with the given color. - /// Input/output 1- or 3-channel, 8-bit, or floating-point image. - /// It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the - /// second variant of the function. See the details below. - /// - /// (For the second function only) Operation mask that should be a single-channel 8-bit image, - /// 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of - /// initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, - /// an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask - /// in multiple calls to the function to make sure the filled area does not overlap. - /// Starting point. - /// New value of the repainted domain pixels. - /// Optional output parameter set by the function to the - /// minimum bounding rectangle of the repainted domain. - /// Maximal lower brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Maximal upper brightness/color difference between the currently - /// observed pixel and one of its neighbors belonging to the component, or a seed pixel - /// being added to the component. - /// Operation flags. Lower bits contain a connectivity value, - /// 4 (default) or 8, used within the function. Connectivity determines which - /// neighbors of a pixel are considered. - /// - public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal, - out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, - FloodFillFlags flags = FloodFillFlags.Link4) - { - return Cv2.FloodFill(this, mask, seedPoint, - newVal, out rect, loDiff, upDiff, flags); - } - -#if LANG_JP - /// - /// 画像の色空間を変換します. - /// - /// 色空間の変換コード. - /// 出力画像のチャンネル数.この値が 0 の場合,チャンネル数は src と code から自動的に求められます - /// src と同じサイズ,同じタイプの出力画像 -#else - /// - /// Converts image from one color space to another - /// - /// The color space conversion code - /// The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code - /// The destination image; will have the same size and the same depth as src -#endif - public Mat CvtColor(ColorConversionCodes code, int dstCn = 0) - { - var dst = new Mat(); - Cv2.CvtColor(this, dst, code, dstCn); - return dst; - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// The input is a raster image (single-channel, 8-bit or floating-point 2D array). - /// - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public Moments Moments(bool binaryImage = false) - { - return new Moments(this, binaryImage); - } - - /// - /// Computes the proximity map for the raster template and the image where the template is searched for - /// The input is Image where the search is running; should be 8-bit or 32-bit floating-point. - /// - /// Searched template; must be not greater than the source image and have the same data type - /// Specifies the comparison method - /// A map of comparison results; will be single-channel 32-bit floating-point. - /// If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1). - public Mat MatchTemplate(InputArray templ, TemplateMatchModes method) - { - var dst = new Mat(); - Cv2.MatchTemplate(this, templ, dst, method); - return dst; - } - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// destination labeled image - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// The number of labels - public int ConnectedComponents(OutputArray labels, - PixelConnectivity connectivity = PixelConnectivity.Connectivity8) - { - return ConnectedComponents(labels, connectivity, MatType.CV_32S); - } - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// destination labeled image - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// output image label type. Currently CV_32S and CV_16U are supported. - /// The number of labels - public int ConnectedComponents(OutputArray labels, - PixelConnectivity connectivity, MatType ltype) - { - return Cv2.ConnectedComponents(this, labels, connectivity, ltype); - } - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// destination labeled rectangular array - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// The number of labels - public int ConnectedComponents(out int[,] labels, PixelConnectivity connectivity) - { - return Cv2.ConnectedComponents(this, out labels, connectivity); - } - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// destination labeled image - /// statistics output for each label, including the background label, - /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) - /// where COLUMN is one of cv::ConnectedComponentsTypes - /// floating point centroid (x,y) output for each label, - /// including the background label - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// - public int ConnectedComponentsWithStats( - OutputArray labels, OutputArray stats, OutputArray centroids, - PixelConnectivity connectivity = PixelConnectivity.Connectivity8) - { - return ConnectedComponentsWithStats(labels, stats, centroids, connectivity, MatType.CV_32S); - } - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// destination labeled image - /// statistics output for each label, including the background label, - /// see below for available statistics. Statistics are accessed via stats(label, COLUMN) - /// where COLUMN is one of cv::ConnectedComponentsTypes - /// floating point centroid (x,y) output for each label, - /// including the background label - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// output image label type. Currently CV_32S and CV_16U are supported. - /// - public int ConnectedComponentsWithStats( - OutputArray labels, OutputArray stats, OutputArray centroids, - PixelConnectivity connectivity, MatType ltype) - { - return Cv2.ConnectedComponentsWithStats(this, labels, stats, centroids, connectivity, ltype); - } - - /// - /// computes the connected components labeled image of boolean image. - /// image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 - /// represents the background label. ltype specifies the output label image type, an important - /// consideration based on the total number of labels or alternatively the total number of - /// pixels in the source image. - /// - /// 8 or 4 for 8-way or 4-way connectivity respectively - /// - public ConnectedComponents ConnectedComponentsEx(PixelConnectivity connectivity = PixelConnectivity.Connectivity8) - { - return Cv2.ConnectedComponentsEx(this, connectivity); - } - -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else - /// - /// Finds contours in a binary image. - /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. - /// - /// Detected contours. Each contour is stored as a vector of points. - /// Optional output vector, containing information about the image topology. - /// It has as many elements as the number of contours. For each i-th contour contours[i], - /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next - /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. - /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif - public void FindContours(out Point[][] contours, out HierarchyIndex[] hierarchy, - RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - Cv2.FindContours(this, out contours, out hierarchy, mode, method, offset); - } - -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else - /// - /// Finds contours in a binary image. - /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. - /// - /// Detected contours. Each contour is stored as a vector of points. - /// Optional output vector, containing information about the image topology. - /// It has as many elements as the number of contours. For each i-th contour contours[i], - /// the members of the elements hierarchy[i] are set to 0-based indices in contours of the next - /// and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. - /// If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif - public void FindContours(out Mat[] contours, OutputArray hierarchy, - RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - Cv2.FindContours(this, out contours, hierarchy, mode, method, offset); - } - -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else - /// - /// Finds contours in a binary image. - /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. - /// - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. - /// Detected contours. Each contour is stored as a vector of points. -#endif - public Point[][] FindContoursAsArray(RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - return Cv2.FindContoursAsArray(this, mode, method, offset); - } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else - /// - /// Finds contours in a binary image. - /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. - /// Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours. - /// - /// Contour retrieval mode - /// Contour approximation method - /// Optional offset by which every contour point is shifted. - /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. - /// Detected contours. Each contour is stored as a vector of points. -#endif - public MatOfPoint[] FindContoursAsMat(RetrievalModes mode, ContourApproximationModes method, Point? offset = null) - { - return Cv2.FindContoursAsMat(this, mode, method, offset); - } - -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else - /// - /// Draws contours in the image - /// - /// All the input contours. Each contour is stored as a point vector. - /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. - /// Color of the contours. - /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), - /// the contour interiors are drawn. - /// Line connectivity. - /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours - /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. - /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, - /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account - /// when there is hierarchy available. - /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif - public void DrawContours( - IEnumerable> contours, - int contourIdx, - Scalar color, - int thickness = 1, - LineTypes lineType = LineTypes.Link8, - IEnumerable hierarchy = null, - int maxLevel = Int32.MaxValue, - Point? offset = null) - { - Cv2.DrawContours(this, contours, contourIdx, color, - thickness, lineType, hierarchy, maxLevel, offset); - } - -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 出力画像 - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else - /// - /// Draws contours in the image - /// - /// Destination image. - /// All the input contours. Each contour is stored as a point vector. - /// Parameter indicating a contour to draw. If it is negative, all the contours are drawn. - /// Color of the contours. - /// Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), - /// the contour interiors are drawn. - /// Line connectivity. - /// Optional information about hierarchy. It is only needed if you want to draw only some of the contours - /// Maximal level for drawn contours. If it is 0, only the specified contour is drawn. - /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, - /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account - /// when there is hierarchy available. - /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif - public void DrawContours( - InputOutputArray image, - IEnumerable contours, - int contourIdx, - Scalar color, - int thickness = 1, - LineTypes lineType = LineTypes.Link8, - Mat hierarchy = null, - int maxLevel = Int32.MaxValue, - Point? offset = null) - { - Cv2.DrawContours(image, contours, contourIdx, color, - thickness, lineType, hierarchy, maxLevel, offset); - } - - /// - /// Approximates contour or a curve using Douglas-Peucker algorithm. - /// The input is the polygon or curve to approximate and - /// it must be 1 x N or N x 1 matrix of type CV_32SC2 or CV_32FC2. - /// - /// Specifies the approximation accuracy. - /// This is the maximum distance between the original curve and its approximation. - /// The result of the approximation; - /// The type should match the type of the input curve - /// The result of the approximation; - /// The type should match the type of the input curve -// ReSharper disable once InconsistentNaming - public Mat ApproxPolyDP(double epsilon, bool closed) - { - var dst = new Mat(); - Cv2.ApproxPolyDP(this, dst, epsilon, closed); - return dst; - } - - /// - /// Calculates a contour perimeter or a curve length. - /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - /// Indicates, whether the curve is closed or not - /// - public double ArcLength(bool closed) - { - return Cv2.ArcLength(this, closed); - } - - /// - /// Calculates the up-right bounding rectangle of a point set. - /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - /// Minimal up-right bounding rectangle for the specified point set. - public Rect BoundingRect() - { - return Cv2.BoundingRect(this); - } - - /// - /// Calculates the contour area. - /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - /// - /// - public double ContourArea(bool oriented = false) - { - return Cv2.ContourArea(this, oriented); - } - - /// - /// Finds the minimum area rotated rectangle enclosing a 2D point set. - /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - /// - public RotatedRect MinAreaRect() - { - return Cv2.MinAreaRect(this); - } - - /// - /// Finds the minimum area circle enclosing a 2D point set. - /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix. - /// - /// The output center of the circle - /// The output radius of the circle - public void MinEnclosingCircle(out Point2f center, out float radius) - { - Cv2.MinEnclosingCircle(this, out center, out radius); - } - - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// - /// The output convex hull. It is either a vector of points that form the - /// hull (must have the same type as the input points), or a vector of 0-based point - /// indices of the hull points in the original array (since the set of convex hull - /// points is a subset of the original point set). - public Mat ConvexHull(InputArray points, bool clockwise = false, bool returnPoints = true) - { - var dst = new Mat(); - Cv2.ConvexHull(points, dst, clockwise, returnPoints); - return dst; - } - - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of points that form the - /// hull (must have the same type as the input points). - public Point[] ConvexHullPoints(InputArray points, bool clockwise = false) - { - var dst = new MatOfPoint(); - Cv2.ConvexHull(points, dst, clockwise, true); - return dst.ToArray(); - } - - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of points that form the - /// hull (must have the same type as the input points). - public Point2f[] ConvexHullFloatPoints(InputArray points, bool clockwise = false) - { - var dst = new MatOfPoint2f(); - Cv2.ConvexHull(points, dst, clockwise, true); - return dst.ToArray(); - } - - /// - /// Computes convex hull for a set of 2D points. - /// - /// The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix - /// If true, the output convex hull will be oriented clockwise, - /// otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate - /// system is assumed - the origin is at the top-left corner, x axis is oriented to the right, - /// and y axis is oriented downwards. - /// The output convex hull. It is a vector of 0-based point - /// indices of the hull points in the original array (since the set of convex hull - /// points is a subset of the original point set). - public int[] ConvexHullIndices(InputArray points, bool clockwise = false) - { - var dst = new MatOfInt(); - Cv2.ConvexHull(points, dst, clockwise, false); - return dst.ToArray(); - } - - /// - /// Computes the contour convexity defects - /// - /// Convex hull obtained using convexHull() that - /// should contain indices of the contour points that make the hull. - /// The output vector of convexity defects. - /// Each convexity defect is represented as 4-element integer vector - /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), - /// where indices are 0-based indices in the original contour of the convexity defect beginning, - /// end and the farthest point, and fixpt_depth is fixed-point approximation - /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. - /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. - public Mat ConvexityDefects(InputArray convexHull) - { - var dst = new Mat(); - Cv2.ConvexityDefects(this, convexHull, dst); - return dst; - } - - /// - /// Computes the contour convexity defects - /// - /// Convex hull obtained using convexHull() that - /// should contain indices of the contour points that make the hull. - /// The output vector of convexity defects. - /// Each convexity defect is represented as 4-element integer vector - /// (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), - /// where indices are 0-based indices in the original contour of the convexity defect beginning, - /// end and the farthest point, and fixpt_depth is fixed-point approximation - /// (with 8 fractional bits) of the distance between the farthest contour point and the hull. - /// That is, to get the floating-point value of the depth will be fixpt_depth/256.0. - public Vec4i[] ConvexityDefectsAsVec(InputArray convexHull) - { - var dst = new MatOfInt4(); - Cv2.ConvexityDefects(this, convexHull, dst); - return dst.ToArray(); - } - - /// - /// Returns true if the contour is convex. - /// Does not support contours with self-intersection - /// - /// - public bool IsContourConvex() - { - return Cv2.IsContourConvex(this); - } - - /// - /// Fits ellipse to the set of 2D points. - /// - /// - public RotatedRect FitEllipse() - { - return Cv2.FitEllipse(this); - } - - /// - /// Fits line to the set of 2D points using M-estimator algorithm. - /// The input is vector of 2D points. - /// - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - /// Output line parameters. - public Line2D FitLine2D(DistanceTypes distType, double param, double reps, double aeps) - { - var line = new MatOfFloat(); - Cv2.FitLine(this, line, distType, param, reps, aeps); - return new Line2D(line.ToArray()); - } - - /// - /// Fits line to the set of 3D points using M-estimator algorithm. - /// The input is vector of 3D points. - /// - /// Distance used by the M-estimator - /// Numerical parameter ( C ) for some types of distances. - /// If it is 0, an optimal value is chosen. - /// Sufficient accuracy for the radius - /// (distance between the coordinate origin and the line). - /// Sufficient accuracy for the angle. - /// 0.01 would be a good default value for reps and aeps. - /// Output line parameters. - public Line3D FitLine3D(DistanceTypes distType, double param, double reps, double aeps) - { - var line = new MatOfFloat(); - Cv2.FitLine(this, line, distType, param, reps, aeps); - return new Line3D(line.ToArray()); - } - - /// - /// Checks if the point is inside the contour. - /// Optionally computes the signed distance from the point to the contour boundary. - /// - /// Point tested against the contour. - /// If true, the function estimates the signed distance - /// from the point to the nearest contour edge. Otherwise, the function only checks - /// if the point is inside a contour or not. - /// Positive (inside), negative (outside), or zero (on an edge) value. - public double PointPolygonTest(Point2f pt, bool measureDist) - { - return Cv2.PointPolygonTest(this, pt, measureDist); - } - - /// - /// Computes the distance transform map - /// - /// - /// - public MatOfFloat DistanceTransform(DistanceTypes distanceType, DistanceMaskSize maskSize) - { - var dst = new MatOfFloat(); - Cv2.DistanceTransform(this, dst, distanceType, maskSize); - return dst; - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/MatExpr.cs b/src/OpenCvSharp/modules/core/MatExpr.cs deleted file mode 100644 index b2053e477..000000000 --- a/src/OpenCvSharp/modules/core/MatExpr.cs +++ /dev/null @@ -1,1005 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// Matrix expression - /// - public sealed partial class MatExpr : DisposableCvObject - { - #region Init & Disposal - - /// - /// - /// - /// - internal MatExpr(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// - /// - /// - internal MatExpr(Mat mat) - { - if(mat == null) - throw new ArgumentNullException(nameof(mat)); - ptr = NativeMethods.core_MatExpr_new2(mat.CvPtr); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_MatExpr_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Mat(MatExpr self) - { - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_toMat(self.ptr); - Mat retVal = new Mat(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - - /// - /// - /// - /// - public Mat ToMat() - { - return (Mat)this; - } - - /// - /// - /// - /// - /// - public static implicit operator MatExpr(Mat mat) - { - return new MatExpr(mat); - } - - /// - /// - /// - /// - /// - public static MatExpr FromMat(Mat mat) - { - return new MatExpr(mat); - } - - #endregion - - #region Operators - #region Unary - /// - /// - /// - /// - /// - public static MatExpr operator +(MatExpr e) - { - return e; - } - - /// - /// - /// - /// - /// - public static MatExpr operator -(MatExpr e) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorUnaryMinus_MatExpr(e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - - /// - /// - /// - /// - /// - public static MatExpr operator ~(MatExpr e) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorUnaryNot_MatExpr(e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region + - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(MatExpr e, Mat m) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - e.ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorAdd_MatExprMat(e.CvPtr, m.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(Mat m, MatExpr e) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - if (e == null) - throw new ArgumentNullException(nameof(e)); - m.ThrowIfDisposed(); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorAdd_MatMatExpr(m.CvPtr, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(MatExpr e, Scalar s) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorAdd_MatExprScalar(e.CvPtr, s); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(Scalar s, MatExpr e) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorAdd_ScalarMatExpr(s, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator +(MatExpr e1, MatExpr e2) - { - if (e1 == null) - throw new ArgumentNullException(nameof(e1)); - if (e2 == null) - throw new ArgumentNullException(nameof(e2)); - e1.ThrowIfDisposed(); - e2.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorAdd_MatExprMatExpr(e1.CvPtr, e2.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region - - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(MatExpr e, Mat m) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - e.ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorSubtract_MatExprMat(e.CvPtr, m.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(Mat m, MatExpr e) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - if (e == null) - throw new ArgumentNullException(nameof(e)); - m.ThrowIfDisposed(); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorSubtract_MatMatExpr(m.CvPtr, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(MatExpr e, Scalar s) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorSubtract_MatExprScalar(e.CvPtr, s); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(Scalar s, MatExpr e) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorSubtract_ScalarMatExpr(s, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator -(MatExpr e1, MatExpr e2) - { - if (e1 == null) - throw new ArgumentNullException(nameof(e1)); - if (e2 == null) - throw new ArgumentNullException(nameof(e2)); - e1.ThrowIfDisposed(); - e2.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorSubtract_MatExprMatExpr(e1.CvPtr, e2.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region * - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(MatExpr e, Mat m) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - e.ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorMultiply_MatExprMat(e.CvPtr, m.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(Mat m, MatExpr e) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - if (e == null) - throw new ArgumentNullException(nameof(e)); - m.ThrowIfDisposed(); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorMultiply_MatMatExpr(m.CvPtr, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(MatExpr e, double s) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorMultiply_MatExprDouble(e.CvPtr, s); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(double s, MatExpr e) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorMultiply_DoubleMatExpr(s, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator *(MatExpr e1, MatExpr e2) - { - if (e1 == null) - throw new ArgumentNullException(nameof(e1)); - if (e2 == null) - throw new ArgumentNullException(nameof(e2)); - e1.ThrowIfDisposed(); - e2.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorMultiply_MatExprMatExpr(e1.CvPtr, e2.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region / - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(MatExpr e, Mat m) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - if (m == null) - throw new ArgumentNullException(nameof(m)); - e.ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorDivide_MatExprMat(e.CvPtr, m.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(Mat m, MatExpr e) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - if (e == null) - throw new ArgumentNullException(nameof(e)); - m.ThrowIfDisposed(); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorDivide_MatMatExpr(m.CvPtr, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(MatExpr e, double s) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorDivide_MatExprDouble(e.CvPtr, s); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(double s, MatExpr e) - { - if (e == null) - throw new ArgumentNullException(nameof(e)); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorDivide_DoubleMatExpr(s, e.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public static MatExpr operator /(MatExpr e1, MatExpr e2) - { - if (e1 == null) - throw new ArgumentNullException(nameof(e1)); - if (e2 == null) - throw new ArgumentNullException(nameof(e2)); - e1.ThrowIfDisposed(); - e2.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_operatorDivide_MatExprMatExpr(e1.CvPtr, e2.CvPtr); - return new MatExpr(retPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #endregion - - #region Methods - - #region Indexers - /// - /// - /// - /// - /// - /// - /// - /// - public MatExpr this[int rowStart, int rowEnd, int colStart, int colEnd] - { - get - { - ThrowIfDisposed(); - return SubMat(rowStart, rowEnd, colStart, colEnd); - } - } - - /// - /// - /// - /// - /// - /// - public MatExpr this[Range rowRange, Range colRange] - { - get - { - ThrowIfDisposed(); - return SubMat(rowRange, colRange); - } - set - { - ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - MatExpr subMatExpr = SubMat(rowRange, colRange); - NativeMethods.core_Mat_assignment_FromMatExpr(subMatExpr.CvPtr, value.CvPtr); - } - } - - /// - /// - /// - /// - /// - public MatExpr this[Rect roi] - { - get - { - ThrowIfDisposed(); - return SubMat(roi); - } - set - { - ThrowIfDisposed(); - if (value == null) - throw new ArgumentNullException(nameof(value)); - MatExpr subMatExpr = SubMat(roi); - NativeMethods.core_Mat_assignment_FromMatExpr(subMatExpr.CvPtr, value.CvPtr); - } - } - #endregion - - #region Col - /// - /// - /// - public class ColIndexer : MatExprRowColIndexer - { - /// - /// - /// - /// - protected internal ColIndexer(MatExpr parent) - : base(parent) - { - } - - /// - /// - /// - /// - /// - public override MatExpr this[int x] - { - get - { - parent.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_MatExpr_col(parent.CvPtr, x); - return new MatExpr(retPtr); - } - } - } - /// - /// - /// - public ColIndexer Col - { - get - { - if (col == null) - col = new ColIndexer(this); - return col; - } - } - private ColIndexer col = null; - #endregion - #region Cross - /// - /// - /// - /// - /// - public Mat Cross(Mat m) - { - ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_cross(ptr, m.CvPtr); - Mat retVal = new Mat(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region Diag - /// - /// - /// - /// - /// - public MatExpr Diag(int d = 0) - { - ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_diag2(ptr, d); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region Dot - /// - /// - /// - /// - /// - public double Dot(Mat m) - { - ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - return NativeMethods.core_MatExpr_dot(ptr, m.CvPtr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region Inv - /// - /// - /// - /// - /// - public MatExpr Inv(DecompTypes method = DecompTypes.LU) - { - ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_inv2(ptr, (int)method); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region Mul - /// - /// - /// - /// - /// - /// - public MatExpr Mul(MatExpr e, double scale = 1.0) - { - ThrowIfDisposed(); - e.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_mul_toMatExpr(ptr, e.CvPtr, scale); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public MatExpr Mul(Mat m, double scale = 1.0) - { - ThrowIfDisposed(); - m.ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_mul_toMat(ptr, m.CvPtr, scale); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region Row - /// - /// - /// - public class RowIndexer : MatExprRowColIndexer - { - /// - /// - /// - /// - protected internal RowIndexer(MatExpr parent) - : base(parent) - { - } - /// - /// - /// - /// - /// - public override MatExpr this[int y] - { - get - { - parent.ThrowIfDisposed(); - IntPtr retPtr = NativeMethods.core_MatExpr_row(parent.CvPtr, y); - return new MatExpr(retPtr); - } - } - } - /// - /// - /// - public RowIndexer Row - { - get - { - if(row == null) - row = new RowIndexer(this); - return row; - } - } - private RowIndexer row = null; - #endregion - #region - /// - /// - /// - public Size Size - { - get - { - ThrowIfDisposed(); - try - { - return NativeMethods.core_MatExpr_size(ptr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - } - #endregion - #region SubMat - /// - /// - /// - /// - /// - /// - /// - /// - public MatExpr SubMat(int rowStart, int rowEnd, int colStart, int colEnd) - { - ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_submat(ptr, rowStart, rowEnd, colStart, colEnd); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - /// - /// - /// - /// - /// - /// - public MatExpr SubMat(Range rowRange, Range colRange) - { - return SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End); - } - /// - /// - /// - /// - /// - public MatExpr SubMat(Rect roi) - { - return SubMat(roi.Y, roi.Y + roi.Height, roi.X, roi.X + roi.Width); - } - #endregion - #region T - /// - /// - /// - /// - public MatExpr T() - { - ThrowIfDisposed(); - try - { - IntPtr retPtr = NativeMethods.core_MatExpr_t(ptr); - MatExpr retVal = new MatExpr(retPtr); - return retVal; - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - #endregion - #region Type - /// - /// - /// - public MatType Type - { - get - { - ThrowIfDisposed(); - try - { - return (MatType)NativeMethods.core_MatExpr_type(ptr); - } - catch (BadImageFormatException ex) - { - throw PInvokeHelper.CreateException(ex); - } - } - } - #endregion - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/MatExprRangeIndexer.cs b/src/OpenCvSharp/modules/core/MatExprRangeIndexer.cs deleted file mode 100644 index d772ff066..000000000 --- a/src/OpenCvSharp/modules/core/MatExprRangeIndexer.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// - /// - public abstract class MatExprRangeIndexer - { - /// - /// - /// - protected readonly Mat parent; - - /// - /// - /// - /// - protected internal MatExprRangeIndexer(Mat parent) - { - this.parent = parent; - } - - /// - /// Creates a matrix header for the specified matrix row/column. - /// - /// - /// - /// - /// - /// - public abstract MatExpr this[int rowStart, int rowEnd, int colStart, int colEnd] { get; set; } - - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - /// - public abstract MatExpr this[Range rowRange, Range colRange] { get; set; } - - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - public virtual MatExpr this[Rect roi] - { - get { return this[roi.Top, roi.Bottom, roi.Left, roi.Right]; } - set { this[roi.Top, roi.Bottom, roi.Left, roi.Right] = value; } - } - - /// - /// Extracts a rectangular submatrix. - /// - /// Array of selected ranges along each array dimension. - /// - public abstract MatExpr this[params Range[] ranges] { get; set; } - - /// - /// Creates a matrix header for the specified matrix row/column. - /// - /// - /// - /// - /// - /// - public MatExpr Get(int rowStart, int rowEnd, int colStart, int colEnd) - { - return this[rowStart, rowEnd, colStart, colEnd]; - } - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - /// - public MatExpr Get(Range rowRange, Range colRange) - { - return this[rowRange, colRange]; - } - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - public MatExpr Get(Rect roi) - { - return this[roi]; - } - - /// - /// Sets a matrix header for the specified matrix row/column. - /// - /// - /// - /// - /// - /// - /// - public void Set(int rowStart, int rowEnd, int colStart, int colEnd, MatExpr value) - { - this[rowStart, rowEnd, colStart, colEnd] = value; - } - - /// - /// Sets a matrix header for the specified matrix row/column span. - /// - /// - /// - /// - /// - public void Set(Range rowRange, Range colRange, MatExpr value) - { - this[rowRange, colRange] = value; - } - /// - /// Sets a matrix header for the specified matrix row/column span. - /// - /// - /// - /// - public void Set(Rect roi, MatExpr value) - { - this[roi] = value; - } - } -} diff --git a/src/OpenCvSharp/modules/core/MatExprRowColIndexer.cs b/src/OpenCvSharp/modules/core/MatExprRowColIndexer.cs deleted file mode 100644 index bf3624887..000000000 --- a/src/OpenCvSharp/modules/core/MatExprRowColIndexer.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// - /// - public abstract class MatExprRowColIndexer - { - /// - /// - /// - protected readonly MatExpr parent; - - /// - /// - /// - /// - protected internal MatExprRowColIndexer(MatExpr parent) - { - this.parent = parent; - } - - /// - /// - /// - /// - /// - public abstract MatExpr this[int pos] { get; } - - /// - /// - /// - /// - /// - public virtual MatExpr Get(int pos) - { - return this[pos]; - } - } -} diff --git a/src/OpenCvSharp/modules/core/MatExpr_CvMethods.cs b/src/OpenCvSharp/modules/core/MatExpr_CvMethods.cs deleted file mode 100644 index 62cedc6fe..000000000 --- a/src/OpenCvSharp/modules/core/MatExpr_CvMethods.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - partial class MatExpr - { - /// - /// Computes absolute value of each matrix element - /// - /// - public MatExpr Abs() - { - return Cv2.Abs(this); - } - } -} diff --git a/src/OpenCvSharp/modules/core/MatRowColExprIndexer.cs b/src/OpenCvSharp/modules/core/MatRowColExprIndexer.cs deleted file mode 100644 index 4888723d0..000000000 --- a/src/OpenCvSharp/modules/core/MatRowColExprIndexer.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// - /// - public abstract class MatRowColExprIndexer - { - /// - /// - /// - protected readonly Mat parent; - - /// - /// - /// - /// - protected internal MatRowColExprIndexer(Mat parent) - { - this.parent = parent; - } - - /// - /// Creates a matrix header for the specified matrix row/column. - /// - /// - /// - public abstract MatExpr this[int pos] { get; set; } - - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - /// - public abstract MatExpr this[int start, int end] { get; set; } - - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - public virtual MatExpr this[Range range] - { - get { return this[range.Start, range.End]; } - set { this[range.Start, range.End] = value; } - } - - /// - /// Creates a matrix header for the specified matrix row/column. - /// - /// - /// - public MatExpr Get(int pos) - { - return this[pos]; - } - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - /// - public MatExpr Get(int start, int end) - { - return this[start, end]; - } - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - public MatExpr Get(Range range) - { - return this[range]; - } - - /// - /// Sets a matrix header for the specified matrix row/column. - /// - /// - /// - /// - public void Set(int pos, MatExpr value) - { - this[pos] = value; - } - - /// - /// Sets a matrix header for the specified matrix row/column span. - /// - /// - /// - /// - /// - public void Set(int start, int end, MatExpr value) - { - this[start, end] = value; - } - /// - /// Sets a matrix header for the specified matrix row/column span. - /// - /// - /// - /// - public void Set(Range range, MatExpr value) - { - this[range] = value; - } - } -} diff --git a/src/OpenCvSharp/modules/core/MatRowColIndexer.cs b/src/OpenCvSharp/modules/core/MatRowColIndexer.cs deleted file mode 100644 index 4db3fcf2e..000000000 --- a/src/OpenCvSharp/modules/core/MatRowColIndexer.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// - /// - public abstract class MatRowColIndexer - { - /// - /// - /// - protected readonly Mat parent; - - /// - /// - /// - /// - protected internal MatRowColIndexer(Mat parent) - { - this.parent = parent; - } - - /// - /// Creates/Sets a matrix header for the specified matrix row/column. - /// - /// - /// - public abstract Mat this[int pos] { get; set; } - - /// - /// Creates/Sets a matrix header for the specified row/column span. - /// - /// - /// - /// - public abstract Mat this[int start, int end] { get; set; } - - /// - /// Creates/Sets a matrix header for the specified row/column span. - /// - /// - /// - public virtual Mat this[Range range] - { - get { return this[range.Start, range.End]; } - } - - /// - /// Creates a matrix header for the specified matrix row/column. - /// - /// - /// - public virtual Mat Get(int pos) - { - return this[pos]; - } - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - /// - public virtual Mat Get(int start, int end) - { - return this[start, end]; - } - /// - /// Creates a matrix header for the specified row/column span. - /// - /// - /// - public virtual Mat Get(Range range) - { - return this[range]; - } - - /// - /// Creates/Sets a matrix header for the specified matrix row/column. - /// - /// - /// - public virtual void Set(int pos, Mat value) - { - this[pos] = value; - } - - /// - /// Creates/Sets a matrix header for the specified row/column span. - /// - /// - /// - /// - public virtual void Set(int start, int end, Mat value) - { - this[start, end] = value; - } - - /// - /// Creates/Sets a matrix header for the specified row/column span. - /// - /// - /// - public virtual void Set(Range range, Mat value) - { - this[range.Start, range.End] = value; - } - } -} diff --git a/src/OpenCvSharp/modules/core/OutputArray.cs b/src/OpenCvSharp/modules/core/OutputArray.cs deleted file mode 100644 index 2bd12c6ed..000000000 --- a/src/OpenCvSharp/modules/core/OutputArray.cs +++ /dev/null @@ -1,258 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Cuda; - -namespace OpenCvSharp -{ - /// - /// Proxy datatype for passing Mat's and List<>'s as output parameters - /// - public class OutputArray : DisposableCvObject - { - private readonly object obj; - - #region Init & Disposal - /// - /// - /// - /// - internal OutputArray(Mat mat) - { - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - ptr = NativeMethods.core_OutputArray_new_byMat(mat.CvPtr); - obj = mat; - } - - /// - /// - /// - /// - internal OutputArray(GpuMat mat) - { - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - ptr = NativeMethods.core_OutputArray_new_byGpuMat(mat.CvPtr); - obj = mat; - } - - /// - /// - /// - /// - internal OutputArray(IEnumerable mat) - { - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - using (var matVector = new VectorOfMat(mat)) - { - ptr = NativeMethods.core_OutputArray_new_byVectorOfMat(matVector.CvPtr); - } - obj = mat; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_OutputArray_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Cast - /// - /// - /// - /// - /// - public static implicit operator OutputArray(Mat mat) - { - return new OutputArray(mat); - } - - /// - /// - /// - /// - /// - public static implicit operator OutputArray(GpuMat mat) - { - return new OutputArray(mat); - } - - #endregion - - #region Operators - #endregion - - #region Methods - /// - /// - /// - /// - public bool IsMat() - { - return obj is Mat; - } - - /// - /// - /// - /// - public virtual Mat GetMat() - { - return obj as Mat; - } - - /// - /// - /// - /// - public bool IsGpuMat() - { - return obj is GpuMat; - } - - /// - /// - /// - /// - public virtual Mat GetGpuMat() - { - return obj as GpuMat; - } - - /// - /// - /// - /// - public bool IsVectorOfMat() - { - return obj is IEnumerable; - } - - /// - /// - /// - /// - public virtual IEnumerable GetVectorOfMat() - { - return obj as IEnumerable; - } - - /// - /// - /// - public virtual void AssignResult() - { - if (!IsReady()) - throw new NotSupportedException(); - - // OutputArrayの実体が cv::Mat のとき - if (IsMat()) - { - // 実は、何もしなくても結果入ってるっぽい? - /* - Mat mat = GetMat(); - // OutputArrayからMatオブジェクトを取得 - IntPtr outMat = NativeMethods.core_OutputArray_getMat(ptr); - // ポインタをセット - //NativeMethods.core_Mat_assignment_FromMat(mat.CvPtr, outMat); - NativeMethods.core_Mat_assignTo(outMat, mat.CvPtr); - // OutputArrayから取り出したMatをdelete - NativeMethods.core_Mat_delete(outMat); - */ - } - else if (IsGpuMat()) - { - // do nothing - } - else - { - throw new OpenCvSharpException("Not supported OutputArray-compatible type"); - } - } - - /// - /// - /// - public void Fix() - { - AssignResult(); - Dispose(); - } - - /// - /// - /// - /// - public bool IsReady() - { - return - ptr != IntPtr.Zero && - !IsDisposed && - obj != null && - (IsMat() || IsGpuMat()); - } - /// - /// - /// - /// - public void ThrowIfNotReady() - { - if (!IsReady()) - throw new OpenCvSharpException("Invalid OutputArray"); - } - - /// - /// Creates a proxy class of the specified matrix - /// - /// - /// - public static OutputArray Create(Mat mat) - { - return new OutputArray(mat); - } - - /// - /// Creates a proxy class of the specified matrix - /// - /// - /// - public static OutputArray Create(GpuMat mat) - { - return new OutputArray(mat); - } - - /// - /// Creates a proxy class of the specified list - /// - /// - /// - /// - public static OutputArrayOfStructList Create(List list) - where T : struct - { - if (list == null) - throw new ArgumentNullException(nameof(list)); - return new OutputArrayOfStructList(list); - } - - /// - /// Creates a proxy class of the specified list - /// - /// - /// - public static OutputArrayOfMatList Create(List list) - { - if (list == null) - throw new ArgumentNullException(nameof(list)); - return new OutputArrayOfMatList(list); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/OutputArrayOfMatList.cs b/src/OpenCvSharp/modules/core/OutputArrayOfMatList.cs deleted file mode 100644 index a6dcc6af2..000000000 --- a/src/OpenCvSharp/modules/core/OutputArrayOfMatList.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - /// - /// Proxy datatype for passing Mat's and List<>'s as output parameters - /// - public sealed class OutputArrayOfMatList : OutputArray - { - private List list; - - /// - /// - /// - /// - internal OutputArrayOfMatList(List list) - : base(list) - { - if (list == null) - throw new ArgumentNullException(nameof(list)); - this.list = list; - } - - /// - /// - /// - /// - public override IEnumerable GetVectorOfMat() - { - return list; - } - - /// - /// - /// - public override void AssignResult() - { - if (!IsReady()) - throw new NotSupportedException(); - - // Matで結果取得 - using (var vectorOfMat = new VectorOfMat()) - { - NativeMethods.core_OutputArray_getVectorOfMat(ptr, vectorOfMat.CvPtr); - list.Clear(); - list.AddRange(vectorOfMat.ToArray()); - } - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - list = null; - base.DisposeManaged(); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/OutputArrayOfStructList.cs b/src/OpenCvSharp/modules/core/OutputArrayOfStructList.cs deleted file mode 100644 index 10948227f..000000000 --- a/src/OpenCvSharp/modules/core/OutputArrayOfStructList.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// Proxy datatype for passing Mat's and List<>'s as output parameters - /// - public sealed class OutputArrayOfStructList : OutputArray - where T : struct - { - private List list; - - /// - /// - /// - /// - internal OutputArrayOfStructList(List list) - : base(new Mat()) - { - if (list == null) - throw new ArgumentNullException(nameof(list)); - this.list = list; - } - - /// - /// - /// - public override void AssignResult() - { - if (!IsReady()) - throw new NotSupportedException(); - - // Matで結果取得 - IntPtr matPtr = NativeMethods.core_OutputArray_getMat(ptr); - using (Mat mat = new Mat(matPtr)) - { - // 配列サイズ - int size = mat.Rows * mat.Cols; - // 配列にコピー - T[] array = new T[size]; - using (ArrayAddress1 aa = new ArrayAddress1(array)) - { - int elemSize = MarshalHelper.SizeOf(); - MemoryHelper.CopyMemory(aa.Pointer, mat.Data, size * elemSize); - } - // リストにコピー - list.Clear(); - list.AddRange(array); - } - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - list = null; - base.DisposeManaged(); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/PCA.cs b/src/OpenCvSharp/modules/core/PCA.cs deleted file mode 100644 index 24669c01e..000000000 --- a/src/OpenCvSharp/modules/core/PCA.cs +++ /dev/null @@ -1,266 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Principal Component Analysis - /// - public class PCA : DisposableCvObject - { - #region Init & Disposal - - /// - /// - /// - public PCA() - { - ptr = NativeMethods.core_PCA_new1(); - } - - /// - /// - /// - /// - /// - /// - /// - public PCA(InputArray data, InputArray mean, Flags flags, int maxComponents = 0) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - data.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - ptr = NativeMethods.core_PCA_new2(data.CvPtr, mean.CvPtr, (int)flags, maxComponents); - } - - /// - /// - /// - /// - /// - /// - /// - public PCA(InputArray data, InputArray mean, Flags flags, double retainedVariance) - { - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - data.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - ptr = NativeMethods.core_PCA_new3(data.CvPtr, mean.CvPtr, (int)flags, retainedVariance); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_PCA_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties - /// - /// eigenvalues of the covariation matrix - /// - public Mat Eigenvectors - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_PCA_eigenvectors(ptr); - return new Mat(ret); - } - } - - /// - /// eigenvalues of the covariation matrix - /// - public Mat Eigenvalues - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_PCA_eigenvalues(ptr); - return new Mat(ret); - } - } - - /// - /// mean value subtracted before the projection and added after the back projection - /// - public Mat Mean - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_PCA_mean(ptr); - return new Mat(ret); - } - } - - #endregion - - #region Methods - - /// - /// operator that performs PCA. The previously stored data, if any, is released - /// - /// - /// - /// - /// - /// - public PCA Compute(InputArray data, InputArray mean, Flags flags, int maxComponents = 0) - { - ThrowIfDisposed(); - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - data.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - NativeMethods.core_PCA_operatorThis(ptr, data.CvPtr, mean.CvPtr, (int)flags, maxComponents); - return this; - } - - /// - /// operator that performs PCA. The previously stored data, if any, is released - /// - /// - /// - /// - /// - /// - public PCA ComputeVar(InputArray data, InputArray mean, Flags flags, double retainedVariance) - { - ThrowIfDisposed(); - if (data == null) - throw new ArgumentNullException(nameof(data)); - if (mean == null) - throw new ArgumentNullException(nameof(mean)); - data.ThrowIfDisposed(); - mean.ThrowIfDisposed(); - NativeMethods.core_PCA_computeVar(ptr, data.CvPtr, mean.CvPtr, (int)flags, retainedVariance); - return this; - } - - /// - /// projects vector from the original space to the principal components subspace - /// - /// - /// - public Mat Project(InputArray vec) - { - ThrowIfDisposed(); - if (vec == null) - throw new ArgumentNullException(nameof(vec)); - vec.ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_PCA_project1(ptr, vec.CvPtr); - return new Mat(ret); - } - /// - /// projects vector from the original space to the principal components subspace - /// - /// - /// - public void Project(InputArray vec, OutputArray result) - { - ThrowIfDisposed(); - if (vec == null) - throw new ArgumentNullException(nameof(vec)); - if (result == null) - throw new ArgumentNullException(nameof(result)); - vec.ThrowIfDisposed(); - result.ThrowIfNotReady(); - NativeMethods.core_PCA_project2(ptr, vec.CvPtr, result.CvPtr); - result.Fix(); - } - - /// - /// reconstructs the original vector from the projection - /// - /// - /// - public Mat BackProject(InputArray vec) - { - ThrowIfDisposed(); - if (vec == null) - throw new ArgumentNullException(nameof(vec)); - vec.ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_PCA_backProject1(ptr, vec.CvPtr); - return new Mat(ret); - } - /// - /// reconstructs the original vector from the projection - /// - /// - /// - public void BackProject(InputArray vec, OutputArray result) - { - ThrowIfDisposed(); - if (vec == null) - throw new ArgumentNullException(nameof(vec)); - if (result == null) - throw new ArgumentNullException(nameof(result)); - vec.ThrowIfDisposed(); - result.ThrowIfNotReady(); - NativeMethods.core_PCA_backProject2(ptr, vec.CvPtr, result.CvPtr); - result.Fix(); - } - #endregion - -#if LANG_JP - /// - /// PCAの操作フラグ - /// -#else - /// - /// Flags for PCA operations - /// -#endif - [System.Flags] - public enum Flags : int - { -#if LANG_JP - /// - /// 行としてベクトルが保存される(つまり,あるベクトルの全ての要素は連続的に保存される) - /// -#else - /// - /// The vectors are stored as rows (i.e. all the components of a certain vector are stored continously) - /// -#endif - DataAsRow = 0, - - -#if LANG_JP - /// - /// 列としてベクトルが保存される(つまり,あるベクトル成分に属する値は連続的に保存される) - /// -#else - /// - /// The vectors are stored as columns (i.e. values of a certain vector component are stored continuously) - /// -#endif - DataAsCol = 1, - - -#if LANG_JP - /// - /// 事前に計算された平均ベクトルを用いる - /// -#else - /// - /// Use pre-computed average vector - /// -#endif - UseAvg = 2, - } - } -} diff --git a/src/OpenCvSharp/modules/core/RNG.cs b/src/OpenCvSharp/modules/core/RNG.cs deleted file mode 100644 index 33d654f11..000000000 --- a/src/OpenCvSharp/modules/core/RNG.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Random Number Generator. - /// The class implements RNG using Multiply-with-Carry algorithm. - /// - /// operations.hpp - public class RNG - { - private ulong state; - - /// - /// - /// - public ulong State - { - get { return state; } - set { state = value; } - } - - #region Init & Disposal - - /// - /// - /// - public RNG() - { - this.state = 0xffffffff; - } - - /// - /// - /// - /// - public RNG(ulong state) - { - this.state = (state != 0) ? state : 0xffffffff; - } - - #endregion - - #region Cast - - /// - /// - /// - /// - /// - public static explicit operator byte(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return (byte) self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator sbyte(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return (sbyte)self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator ushort(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return (ushort)self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator short(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return (short)self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator uint(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator int(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return (int)self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator float(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return self.Next() * 2.3283064365386962890625e-10f; - } - - /// - /// - /// - /// - /// - public static explicit operator double(RNG self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - uint t = self.Next(); - return (((ulong)t << 32) | self.Next()) * 5.4210108624275221700372640043497e-20; - } - - #endregion - - #region Methods - - /// - /// updates the state and returns the next 32-bit unsigned integer random number - /// - /// - public uint Next() - { - state = (ulong)(uint)State * /*CV_RNG_COEFF*/ 4164903690U + (uint)(State >> 32); - return (uint)State; - } - - /// - /// returns a random integer sampled uniformly from [0, N). - /// - /// - /// - public uint Run(uint n) - { - return (uint)Uniform(0, n); - } - - /// - /// - /// - /// - public uint Run() - { - return Next(); - } - - /// - /// returns uniformly distributed integer random number from [a,b) range - /// - /// - /// - /// - public int Uniform(int a, int b) - { - return a == b ? a : (int)(Next() % (b - a) + a); - } - - /// - /// returns uniformly distributed floating-point random number from [a,b) range - /// - /// - /// - /// - public float Uniform(float a, float b) - { - return ((float)this) * (b - a) + a; - } - - /// - /// returns uniformly distributed double-precision floating-point random number from [a,b) range - /// - /// - /// - /// - public double Uniform(double a, double b) - { - return ((double)this) * (b - a) + a; - } - - /// - /// - /// - /// - /// - /// - /// - /// - public void Fill(InputOutputArray mat, DistributionType distType, InputArray a, InputArray b, - bool saturateRange = false) - { - if (mat == null) - throw new ArgumentNullException(nameof(mat)); - if (a == null) - throw new ArgumentNullException(nameof(a)); - if (b == null) - throw new ArgumentNullException(nameof(b)); - mat.ThrowIfNotReady(); - a.ThrowIfDisposed(); - b.ThrowIfDisposed(); - NativeMethods.core_RNG_fill(ref state, mat.CvPtr, (int) distType, a.CvPtr, b.CvPtr, saturateRange ? 1 : 0); - mat.Fix(); - } - - /// - /// returns Gaussian random variate with mean zero. - /// - /// - /// - public double Gaussian(double sigma) - { - return NativeMethods.core_RNG_gaussian(ref state, sigma); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/RNG_MT19937.cs b/src/OpenCvSharp/modules/core/RNG_MT19937.cs deleted file mode 100644 index 70396cc88..000000000 --- a/src/OpenCvSharp/modules/core/RNG_MT19937.cs +++ /dev/null @@ -1,216 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Mersenne Twister random number generator - /// - /// operations.hpp - // ReSharper disable once InconsistentNaming - public class RNG_MT19937 - { - private static class PeriodParameters - { - public const int N = 624, M = 397; - } - private readonly uint[] state; - private int mti; - - #region Init & Disposal - - /// - /// - /// - public RNG_MT19937() - : this(5489U) - { - } - - /// - /// - /// - /// - public RNG_MT19937(uint s) - { - state = new uint[PeriodParameters.N]; - Seed(s); - } - - #endregion - - #region Cast - - /// - /// - /// - /// - /// - public static explicit operator uint(RNG_MT19937 self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator int(RNG_MT19937 self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return (int)self.Next(); - } - - /// - /// - /// - /// - /// - public static explicit operator float(RNG_MT19937 self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - return self.Next() * (1.0f / 4294967296.0f); - } - - /// - /// - /// - /// - /// - public static explicit operator double(RNG_MT19937 self) - { - if (self == null) - throw new ArgumentNullException(nameof(self)); - uint a = self.Next() >> 5; - uint b = self.Next() >> 6; - return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - public void Seed(uint s) - { - state[0] = s; - for (mti = 1; mti < PeriodParameters.N; mti++) - { - /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ - state[mti] = (uint) (1812433253U * (state[mti - 1] ^ (state[mti - 1] >> 30)) + mti); - } - } - - /// - /// updates the state and returns the next 32-bit unsigned integer random number - /// - /// - public uint Next() - { - /* mag01[x] = x * MATRIX_A for x=0,1 */ - uint[] mag01 = { 0x0U, /*MATRIX_A*/ 0x9908b0dfU }; - - const uint UPPER_MASK = 0x80000000U; - const uint LOWER_MASK = 0x7fffffffU; - const int N = PeriodParameters.N; - const int M = PeriodParameters.M; - - /* generate N words at one time */ - uint y; - if (mti >= N) - { - int kk = 0; - - for (; kk < N - M; ++kk) - { - y = (state[kk] & UPPER_MASK) | (state[kk + 1] & LOWER_MASK); - state[kk] = state[kk + M] ^ (y >> 1) ^ mag01[y & 0x1U]; - } - - for (; kk < N - 1; ++kk) - { - y = (state[kk] & UPPER_MASK) | (state[kk + 1] & LOWER_MASK); - state[kk] = state[kk + (M - N)] ^ (y >> 1) ^ mag01[y & 0x1U]; - } - - y = (state[N - 1] & UPPER_MASK) | (state[0] & LOWER_MASK); - state[N - 1] = state[M - 1] ^ (y >> 1) ^ mag01[y & 0x1U]; - - mti = 0; - } - - y = state[mti++]; - - /* Tempering */ - y ^= (y >> 11); - y ^= (y << 7) & 0x9d2c5680U; - y ^= (y << 15) & 0xefc60000U; - y ^= (y >> 18); - - return y; - } - - /// - /// returns a random integer sampled uniformly from [0, N). - /// - /// - /// - public uint Run(uint b) - { - return Next() % b; - } - - /// - /// - /// - /// - public uint Run() - { - return Next(); - } - - /// - /// returns uniformly distributed integer random number from [a,b) range - /// - /// - /// - /// - public int Uniform(int a, int b) - { - return (int)(Next() % (b - a) + a); - } - - /// - /// returns uniformly distributed floating-point random number from [a,b) range - /// - /// - /// - /// - public float Uniform(float a, float b) - { - return ((float)this) * (b - a) + a; - } - - /// - /// returns uniformly distributed double-precision floating-point random number from [a,b) range - /// - /// - /// - /// - public double Uniform(double a, double b) - { - return ((double)this) * (b - a) + a; - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/SVD.cs b/src/OpenCvSharp/modules/core/SVD.cs deleted file mode 100644 index de56ee1fe..000000000 --- a/src/OpenCvSharp/modules/core/SVD.cs +++ /dev/null @@ -1,263 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Singular Value Decomposition class - /// - public class SVD : DisposableCvObject - { - #region Init & Disposal - - /// - /// the default constructor - /// - public SVD() - { - ptr = NativeMethods.core_SVD_new1(); - } - /// - /// the constructor that performs SVD - /// - /// - /// - public SVD(InputArray src, Flags flags = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - ptr = NativeMethods.core_SVD_new2(src.CvPtr, (int)flags); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_SVD_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties - /// - /// eigenvalues of the covariation matrix - /// - public Mat U - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_SVD_u(ptr); - return new Mat(ret); - } - } - - /// - /// eigenvalues of the covariation matrix - /// - public Mat W - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_SVD_w(ptr); - return new Mat(ret); - } - } - - /// - /// mean value subtracted before the projection and added after the back projection - /// - public Mat Vt - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.core_SVD_vt(ptr); - return new Mat(ret); - } - } - #endregion - - #region Methods - /// - /// the operator that performs SVD. The previously allocated SVD::u, SVD::w are SVD::vt are released. - /// - /// - /// - /// - public SVD Run(InputArray src, Flags flags = 0) - { - ThrowIfDisposed(); - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - NativeMethods.core_SVD_operatorThis(ptr, src.CvPtr, (int)flags); - return this; - } - - /// - /// performs back substitution, so that dst is the solution or pseudo-solution of m*dst = rhs, where m is the decomposed matrix - /// - /// - /// - /// - public void BackSubst(InputArray rhs, OutputArray dst) - { - ThrowIfDisposed(); - if (rhs == null) - throw new ArgumentNullException(nameof(rhs)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - rhs.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_SVD_backSubst(ptr, rhs.CvPtr, dst.CvPtr); - } - #endregion - - #region Static - - /// - /// decomposes matrix and stores the results to user-provided matrices - /// - /// - /// - /// - /// - /// - public static void Compute(InputArray src, OutputArray w, - OutputArray u, OutputArray vt, Flags flags = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (w == null) - throw new ArgumentNullException(nameof(w)); - if (u == null) - throw new ArgumentNullException(nameof(u)); - if (vt == null) - throw new ArgumentNullException(nameof(vt)); - src.ThrowIfDisposed(); - w.ThrowIfNotReady(); - u.ThrowIfNotReady(); - vt.ThrowIfNotReady(); - NativeMethods.core_SVD_static_compute1(src.CvPtr, w.CvPtr, u.CvPtr, vt.CvPtr, (int)flags); - w.Fix(); - u.Fix(); - vt.Fix(); - } - - /// - /// computes singular values of a matrix - /// - /// - /// - /// - public static void Compute(InputArray src, OutputArray w, Flags flags = 0) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (w == null) - throw new ArgumentNullException(nameof(w)); - src.ThrowIfDisposed(); - w.ThrowIfNotReady(); - NativeMethods.core_SVD_static_compute2(src.CvPtr, w.CvPtr, (int)flags); - w.Fix(); - } - - /// - /// performs back substitution - /// - /// - /// - /// - /// - /// - public static void BackSubst(InputArray w, InputArray u, - InputArray vt, InputArray rhs, OutputArray dst) - { - if (w == null) - throw new ArgumentNullException(nameof(w)); - if (u == null) - throw new ArgumentNullException(nameof(u)); - if (vt == null) - throw new ArgumentNullException(nameof(vt)); - if (rhs == null) - throw new ArgumentNullException(nameof(rhs)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - w.ThrowIfDisposed(); - u.ThrowIfDisposed(); - vt.ThrowIfDisposed(); - rhs.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_SVD_static_backSubst(w.CvPtr, u.CvPtr, vt.CvPtr, rhs.CvPtr, dst.CvPtr); - dst.Fix(); - } - - /// - /// finds dst = arg min_{|dst|=1} |m*dst| - /// - /// - /// - public static void SolveZ(InputArray src, OutputArray dst) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - NativeMethods.core_SVD_static_solveZ(src.CvPtr, dst.CvPtr); - dst.Fix(); - } - - #endregion - -#if LANG_JP - /// - /// VDの操作フラグ - /// -#else - /// - /// Operation flags for SVD - /// -#endif - [Flags] - public enum Flags - { - /// - /// - /// - None = 0, - -#if LANG_JP - /// - /// 計算中に行列Aの変更を行うことができる.このフラグの指定は処理速度を向上させる. - /// -#else - /// - /// enables modification of matrix src1 during the operation. It speeds up the processing. - /// -#endif - ModifyA = 1, - - /// - /// indicates that only a vector of singular values `w` is to be processed, - /// while u and vt will be set to empty matrices - /// -// ReSharper disable once InconsistentNaming - NoUV = 2, - - /// - /// when the matrix is not square, by default the algorithm produces u and - /// vt matrices of sufficiently large size for the further A reconstruction; - /// if, however, FULL_UV flag is specified, u and vt will be full-size square - /// orthogonal matrices. - /// -// ReSharper disable once InconsistentNaming - FullUV = 4, - } - } -} diff --git a/src/OpenCvSharp/modules/core/SparseMat.cs b/src/OpenCvSharp/modules/core/SparseMat.cs deleted file mode 100644 index ae5c58b0d..000000000 --- a/src/OpenCvSharp/modules/core/SparseMat.cs +++ /dev/null @@ -1,882 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// Sparse matrix class. - /// - public class SparseMat : DisposableCvObject - { - #region Init & Disposal - -#if LANG_JP - /// - /// OpenCVネイティブの cv::SparseMat* ポインタから初期化 - /// - /// -#else - /// - /// Creates from native cv::SparseMat* pointer - /// - /// -#endif - public SparseMat(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Native object address is NULL"); - this.ptr = ptr; - } - -#if LANG_JP - /// - /// 空の疎行列として初期化 - /// -#else - /// - /// Creates empty SparseMat - /// -#endif - public SparseMat() - { - ptr = NativeMethods.core_SparseMat_new1(); - } - - -#if LANG_JP - /// - /// N次元疎行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else - /// - /// constructs n-dimensional sparse matrix - /// - /// Array of integers specifying an n-dimensional array shape. - /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, - /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif - public SparseMat(IEnumerable sizes, MatType type) - { - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - - int[] sizesArray = EnumerableEx.ToArray(sizes); - ptr = NativeMethods.core_SparseMat_new2(sizesArray.Length, sizesArray, type); - } - -#if LANG_JP - /// - /// cv::Matデータから初期化 - /// - /// cv::Matオブジェクトへの参照. -#else - /// - /// converts old-style CvMat to the new matrix; the data is not copied by default - /// - /// cv::Mat object -#endif - public SparseMat(Mat m) - { - if (m == null) - throw new ArgumentNullException(nameof(m)); - m.ThrowIfDisposed(); - ptr = NativeMethods.core_SparseMat_new3(m.CvPtr); - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException(); - } - -#if LANG_JP - /// - /// リソースの解放 - /// -#else - /// - /// Releases the resources - /// -#endif - public void Release() - { - Dispose(); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.core_SparseMat_delete(ptr); - base.DisposeUnmanaged(); - } - - #region Static Initializers - - /// - /// - /// - /// - /// - public static SparseMat FromMat(Mat mat) - { - return new SparseMat(mat); - } - - #endregion - - #endregion - - #region Static - /// - /// sizeof(cv::Mat) - /// - public static readonly int SizeOf = (int)NativeMethods.core_SparseMat_sizeof(); - - #endregion - - #region Public Methods - - /// - /// Assignment operator. This is O(1) operation, i.e. no data is copied - /// - /// - /// - public SparseMat AssignFrom(SparseMat m) - { - ThrowIfDisposed(); - if(m == null) - throw new ArgumentNullException(nameof(m)); - NativeMethods.core_SparseMat_operatorAssign_SparseMat(ptr, m.CvPtr); - return this; - } - - /// - /// Assignment operator. equivalent to the corresponding constructor. - /// - /// - /// - public SparseMat AssignFrom(Mat m) - { - ThrowIfDisposed(); - if (m == null) - throw new ArgumentNullException(nameof(m)); - NativeMethods.core_SparseMat_operatorAssign_Mat(ptr, m.CvPtr); - return this; - } - - /// - /// creates full copy of the matrix - /// - /// - public SparseMat Clone() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.core_SparseMat_clone(ptr); - return new SparseMat(p); - } - - /// - /// copies all the data to the destination matrix. All the previous content of m is erased. - /// - /// - public void CopyTo(SparseMat m) - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_copyTo_SparseMat(ptr, m.CvPtr); - } - /// - /// converts sparse matrix to dense matrix. - /// - /// - public void CopyTo(Mat m) - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_copyTo_Mat(ptr, m.CvPtr); - } - - /// - /// multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type - /// - /// - /// - /// - public void ConvertTo(SparseMat m, int rtype, double alpha = 1) - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_convertTo_SparseMat(ptr, m.CvPtr, rtype, alpha); - } - - /// - /// converts sparse matrix to dense n-dim matrix with optional type conversion and scaling. - /// - /// - /// The output matrix data type. When it is =-1, the output array will have the same data type as (*this) - /// The scale factor - /// The optional delta added to the scaled values before the conversion - public void ConvertTo(Mat m, int rtype, double alpha = 1, double beta = 0) - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_convertTo_SparseMat(ptr, m.CvPtr, rtype, alpha); - } - - /// - /// not used now - /// - /// - /// - public void AssignTo(SparseMat m, int type = -1) - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_assignTo(ptr, m.CvPtr, type); - } - - /// - /// Reallocates sparse matrix. - /// If the matrix already had the proper size and type, - /// it is simply cleared with clear(), otherwise, - /// the old matrix is released (using release()) and the new one is allocated. - /// - /// - /// - public void Create(MatType type, params int[] sizes) - { - ThrowIfDisposed(); - if (sizes == null) - throw new ArgumentNullException(nameof(sizes)); - if (sizes.Length == 1) - throw new ArgumentException("sizes is empty"); - NativeMethods.core_SparseMat_create(ptr, sizes.Length, sizes, type); - } - - /// - /// sets all the sparse matrix elements to 0, which means clearing the hash table. - /// - public void Clear() - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_clear(ptr); - } - - /// - /// manually increments the reference counter to the header. - /// - public void Addref() - { - ThrowIfDisposed(); - NativeMethods.core_SparseMat_addref(ptr); - } - - /// - /// returns the size of each element in bytes (not including the overhead - the space occupied by SparseMat::Node elements) - /// - /// - public int ElemSize() - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_elemSize(ptr); - - } - - /// - /// returns elemSize()/channels() - /// - /// - public int ElemSize1() - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_elemSize1(ptr); - - } - - /// - /// Returns the type of sparse matrix element. - /// - /// - public MatType Type() - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_type(ptr); - } - - /// - /// Returns the depth of sparse matrix element. - /// - /// - public int Depth() - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_depth(ptr); - } - - /// - /// Returns the matrix dimensionality - /// - public int Dims() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_dims(ptr); - } - - /// - /// Returns the number of sparse matrix channels. - /// - /// - public int Channels() - { - ThrowIfDisposed(); - return NativeMethods.core_Mat_channels(ptr); - } - - /// - /// Returns the array of sizes, or null if the matrix is not allocated - /// - /// - public int[] Size() - { - ThrowIfDisposed(); - - IntPtr sizePtr = NativeMethods.core_SparseMat_size1(ptr); - if (sizePtr == IntPtr.Zero) - return null; - - int length = Dims(); - int[] size = new int[length]; - Marshal.Copy(sizePtr, size, 0, length); - return size; - } - - /// - /// Returns the size of i-th matrix dimension (or 0) - /// - /// - /// - public int Size(int dim) - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_size2(ptr, dim); - } - - #region Hash - - /// - /// Computes the element hash value (1D case) - /// - /// Index along the dimension 0 - /// - public long Hash(int i0) - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_hash_1d(ptr, i0).ToInt64(); - } - - /// - /// Computes the element hash value (2D case) - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// - public long Hash(int i0, int i1) - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_hash_2d(ptr, i0, i1).ToInt64(); - } - - /// - /// Computes the element hash value (3D case) - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// - public long Hash(int i0, int i1, int i2) - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_hash_3d(ptr, i0, i1, i2).ToInt64(); - } - - /// - /// Computes the element hash value (nD case) - /// - /// Array of Mat::dims indices. - /// - public long Hash(params int[] idx) - { - ThrowIfDisposed(); - return NativeMethods.core_SparseMat_hash_nd(ptr, idx).ToInt64(); - } - - #endregion - #region Ptr - - /// - /// Low-level element-access function. - /// - /// Index along the dimension 0 - /// Create new element with 0 value if it does not exist in SparseMat. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public IntPtr Ptr(int i0, bool createMissing, long? hashVal = null) - { - //ThrowIfDisposed(); - if (hashVal.HasValue) - { - ulong hashVal0 = (ulong)hashVal.Value; - return NativeMethods.core_SparseMat_ptr_1d( - ptr, i0, createMissing ? 1 : 0, ref hashVal0); - } - return NativeMethods.core_SparseMat_ptr_1d( - ptr, i0, createMissing ? 1 : 0, IntPtr.Zero); - } - - /// - /// Low-level element-access function. - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Create new element with 0 value if it does not exist in SparseMat. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public IntPtr Ptr(int i0, int i1, bool createMissing, long? hashVal = null) - { - //ThrowIfDisposed(); - if (hashVal.HasValue) - { - ulong hashVal0 = (ulong)hashVal.Value; - return NativeMethods.core_SparseMat_ptr_2d( - ptr, i0, i1, createMissing ? 1 : 0, ref hashVal0); - } - return NativeMethods.core_SparseMat_ptr_2d( - ptr, i0, i1, createMissing ? 1 : 0, IntPtr.Zero); - } - - /// - /// Low-level element-access function. - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// Create new element with 0 value if it does not exist in SparseMat. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public IntPtr Ptr(int i0, int i1, int i2, bool createMissing, long? hashVal = null) - { - //ThrowIfDisposed(); - if (hashVal.HasValue) - { - ulong hashVal0 = (ulong)hashVal.Value; - return NativeMethods.core_SparseMat_ptr_3d( - ptr, i0, i1, i2, createMissing ? 1 : 0, ref hashVal0); - } - return NativeMethods.core_SparseMat_ptr_3d( - ptr, i0, i1, i2, createMissing ? 1 : 0, IntPtr.Zero); - } - - /// - /// Low-level element-access function. - /// - /// Array of Mat::dims indices. - /// Create new element with 0 value if it does not exist in SparseMat. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public IntPtr Ptr(int[] idx, bool createMissing, long? hashVal = null) - { - //ThrowIfDisposed(); - if (hashVal.HasValue) - { - ulong hashVal0 = (ulong)hashVal.Value; - return NativeMethods.core_SparseMat_ptr_nd( - ptr, idx, createMissing ? 1 : 0, ref hashVal0); - } - return NativeMethods.core_SparseMat_ptr_nd( - ptr, idx, createMissing ? 1 : 0, IntPtr.Zero); - } - - #endregion - #region Find - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, null. - /// - /// Index along the dimension 0 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T? Find(int i0, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(i0, false, hashVal); - if (p == IntPtr.Zero) - return null; - - return MarshalHelper.PtrToStructure(p); - } - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, null. - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T? Find(int i0, int i1, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(i0, i1, false, hashVal); - if (p == IntPtr.Zero) - return null; - - return MarshalHelper.PtrToStructure(p); - } - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, null. - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T? Find(int i0, int i1, int i2, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(i0, i1, i2, false, hashVal); - if (p == IntPtr.Zero) - return null; - - return MarshalHelper.PtrToStructure(p); - } - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, null. - /// - /// Array of Mat::dims indices. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T? Find(int[] idx, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(idx, false, hashVal); - if (p == IntPtr.Zero) - return null; - - return MarshalHelper.PtrToStructure(p); - } - - #endregion - #region Value - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). - /// - /// Index along the dimension 0 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T Value(int i0, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(i0, false, hashVal); - if (p == IntPtr.Zero) - return default(T); - - return MarshalHelper.PtrToStructure(p); - } - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T Value(int i0, int i1, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(i0, i1, false, hashVal); - if (p == IntPtr.Zero) - return default(T); - - return MarshalHelper.PtrToStructure(p); - } - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T Value(int i0, int i1, int i2, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(i0, i1, i2, false, hashVal); - if (p == IntPtr.Zero) - return default(T); - - return MarshalHelper.PtrToStructure(p); - } - - /// - /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). - /// - /// Array of Mat::dims indices. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// - public T Value(int[] idx, long? hashVal = null) - where T : struct - { - IntPtr p = Ptr(idx, false, hashVal); - if (p == IntPtr.Zero) - return default(T); - - return MarshalHelper.PtrToStructure(p); - } - - #endregion - #region Element Indexer - - /// - /// Mat Indexer - /// - /// - public sealed class Indexer : SparseMatIndexer where T : struct - { - internal Indexer(SparseMat parent) - : base(parent) - { - } - - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public override T this[int i0, long? hashVal = null] - { - get - { - IntPtr p = parent.Ptr(i0, true, hashVal); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = parent.Ptr(i0, true, hashVal); - Marshal.StructureToPtr(value, p, false); - } - } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public override T this[int i0, int i1, long? hashVal = null] - { - get - { - IntPtr p = parent.Ptr(i0, i1, true, hashVal); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = parent.Ptr(i0, i1, true, hashVal); - Marshal.StructureToPtr(value, p, false); - } - } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public override T this[int i0, int i1, int i2, long? hashVal = null] - { - get - { - IntPtr p = parent.Ptr(i0, i1, i2, true, hashVal); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = parent.Ptr(i0, i1, i2, true, hashVal); - Marshal.StructureToPtr(value, p, false); - } - } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public override T this[int[] idx, long? hashVal = null] - { - get - { - IntPtr p = parent.Ptr(idx, true, hashVal); - return MarshalHelper.PtrToStructure(p); - } - set - { - IntPtr p = parent.Ptr(idx, true, hashVal); - Marshal.StructureToPtr(value, p, false); - } - } - } - - /// - /// Gets a type-specific indexer. - /// The indexer has getters/setters to access each matrix element. - /// - /// - /// - public Indexer Ref() where T : struct - { - return new Indexer(this); - } - /// - /// Gets a type-specific indexer. - /// The indexer has getters/setters to access each matrix element. - /// - /// - /// - public Indexer GetIndexer() where T : struct - { - return new Indexer(this); - } - - #endregion - #region Get/Set - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public T Get(int i0, long? hashVal = null) where T : struct - { - return new Indexer(this)[i0, hashVal]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public T Get(int i0, int i1, long? hashVal = null) where T : struct - { - return new Indexer(this)[i0, i1, hashVal]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public T Get(int i0, int i1, int i2, long? hashVal = null) where T : struct - { - return new Indexer(this)[i0, i1, i2, hashVal]; - } - - /// - /// Returns a value to the specified array element. - /// - /// - /// Array of Mat::dims indices. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public T Get(int[] idx, long? hashVal = null) where T : struct - { - return new Indexer(this)[idx, hashVal]; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// - /// - public void Set(int i0, T value, long? hashVal = null) where T : struct - { - (new Indexer(this))[i0, hashVal] = value; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - public void Set(int i0, int i1, T value, long? hashVal = null) where T : struct - { - (new Indexer(this))[i0, i1, hashVal] = value; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - public void Set(int i0, int i1, int i2, T value, long? hashVal = null) where T : struct - { - (new Indexer(this)[i0, i1, i2, hashVal]) = value; - } - - /// - /// Set a value to the specified array element. - /// - /// - /// Array of Mat::dims indices. - /// - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - public void Set(int[] idx, T value, long? hashVal = null) where T : struct - { - (new Indexer(this)[idx, hashVal]) = value; - } - - #endregion - - #region ToString - - /// - /// Returns a string that represents this Mat. - /// - /// - public override string ToString() - { - return "Mat [ " + - "Dims=" + Dims() + - "Type=" + Type().ToString() + - " ]"; - } - - #endregion - - #endregion - } - -} diff --git a/src/OpenCvSharp/modules/core/SparseMatIndexer.cs b/src/OpenCvSharp/modules/core/SparseMatIndexer.cs deleted file mode 100644 index 5178964fe..000000000 --- a/src/OpenCvSharp/modules/core/SparseMatIndexer.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Abstract definition of Mat indexer - /// - /// - public abstract class SparseMatIndexer where T : struct - { - /// - /// 1-dimensional indexer - /// - /// Index along the dimension 0 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public abstract T this[int i0, long? hashVal = null] { get; set; } - - /// - /// 2-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public abstract T this[int i0, int i1, long? hashVal = null] { get; set; } - - /// - /// 3-dimensional indexer - /// - /// Index along the dimension 0 - /// Index along the dimension 1 - /// Index along the dimension 2 - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public abstract T this[int i0, int i1, int i2, long? hashVal = null] { get; set; } - - /// - /// n-dimensional indexer - /// - /// Array of Mat::dims indices. - /// If hashVal is not null, the element hash value is not computed but hashval is taken instead. - /// A value to the specified array element. - public abstract T this[int[] idx, long? hashVal = null] { get; set; } - - /// - /// Parent matrix object - /// - protected readonly SparseMat parent; - - /// - /// Constructor - /// - /// - internal SparseMatIndexer(SparseMat parent) - { - this.parent = parent; - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/DMatch.cs b/src/OpenCvSharp/modules/core/Struct/DMatch.cs deleted file mode 100644 index 5756027e6..000000000 --- a/src/OpenCvSharp/modules/core/Struct/DMatch.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 2つのキーポイントディスクリプタ同士のマッチング情報 - /// -#else - /// - /// Struct for matching: query descriptor index, train descriptor index, train image index and distance between descriptors. - /// -#endif - public struct DMatch - { -#if LANG_JP - /// - /// クエリディスクリプタインデックス - /// -#else - /// - /// query descriptor index - /// -#endif - public int QueryIdx; - -#if LANG_JP - /// - /// 訓練ディスクリプタインデックス - /// -#else - /// - /// train descriptor index - /// -#endif - public int TrainIdx; - -#if LANG_JP - /// - /// 訓練画像インデックス - /// -#else - /// - /// train image index - /// -#endif - public int ImgIdx; - - - /// - /// - /// - public float Distance; - - /// - /// - /// - /// - public static DMatch Empty() - { - return new DMatch(-1, -1, -1, Single.MaxValue); - } - - /// - /// - /// - /// - /// - /// - public DMatch(int queryIdx, int trainIdx, float distance) : - this(queryIdx, trainIdx, -1, distance) - { - } - /// - /// - /// - /// - /// - /// - /// - public DMatch(int queryIdx, int trainIdx, int imgIdx, float distance) - { - QueryIdx = queryIdx; - TrainIdx = trainIdx; - ImgIdx = imgIdx; - Distance = distance; - } - - /// - /// Compares by distance (less is beter) - /// - /// - /// - /// - public static bool operator <(DMatch d1, DMatch d2) - { - return d1.Distance < d2.Distance; - } - /// - /// Compares by distance (less is beter) - /// - /// - /// - /// - public static bool operator >(DMatch d1, DMatch d2) - { - return d1.Distance > d2.Distance; - } - - /// - /// - /// - /// - /// - public static explicit operator Vec4f(DMatch self) - { - return new Vec4f(self.QueryIdx, self.TrainIdx, self.ImgIdx, self.Distance); - } - /// - /// - /// - /// - /// - public static explicit operator DMatch(Vec4f v) - { - return new DMatch((int)v.Item0, (int)v.Item1, (int)v.Item2, v.Item3); - } - - /// - /// - /// - /// - public override string ToString() - { - return String.Format("DMatch (QueryIdx:{0}, TrainIdx:{1}, ImgIdx:{2}, Distance:{3})", - QueryIdx, TrainIdx, ImgIdx, Distance); - } - } - -} diff --git a/src/OpenCvSharp/modules/core/Struct/IVec.cs b/src/OpenCvSharp/modules/core/Struct/IVec.cs deleted file mode 100644 index d101b7611..000000000 --- a/src/OpenCvSharp/modules/core/Struct/IVec.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// - /// - /// - public interface IVec where T : struct - { - /// - /// - /// - /// - /// - T this[int i] { get; set; } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/KeyPoint.cs b/src/OpenCvSharp/modules/core/Struct/KeyPoint.cs deleted file mode 100644 index 69984db00..000000000 --- a/src/OpenCvSharp/modules/core/Struct/KeyPoint.cs +++ /dev/null @@ -1,288 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 特徴点検出器のためのデータ構造体 - /// -#else - /// - /// Data structure for salient point detectors - /// -#endif - [Serializable] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct KeyPoint : IEquatable - { - #region Properties - -#if LANG_JP - /// - /// 特徴点の座標 - /// -#else - /// - /// Coordinate of the point - /// -#endif - public Point2f Pt; - -#if LANG_JP - /// - /// 特徴点のサイズ - /// -#else - /// - /// Feature size - /// -#endif - public float Size; - -#if LANG_JP - /// - /// 特徴点の向き(度数法)。 向きが定義されない、若しくは計算されない場合には負数。 - /// -#else - /// - /// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) - /// -#endif - public float Angle; - -#if LANG_JP - /// - /// 特徴点の強さ(もっとも顕著なキーポイントを求めるために使われる) - /// -#else - /// - /// Feature strength (can be used to select only the most prominent key points) - /// -#endif - public float Response; - -#if LANG_JP - /// - /// 特徴点が見つかったscale-spaceのoctave。サイズと相関がある場合がある。 - /// -#else - /// - /// Scale-space octave in which the feature has been found; may correlate with the size - /// -#endif - public int Octave; - -#if LANG_JP - /// - /// 特徴点のクラス(特徴点分類機または物体検出器において用いられる) - /// -#else - /// - /// Point class (can be used by feature classifiers or object detectors) - /// -#endif - public int ClassId; - - #endregion - - #region Constructors - -#if LANG_JP - /// - /// 初期化 - /// - /// 特徴点の座標 - /// 特徴点のサイズ - /// 特徴点の向き(度数法)。 向きが定義されない、若しくは計算されない場合には負数。 - /// 特徴点の強さ(もっとも顕著なキーポイントを求めるために使われる) - /// 特徴点が見つかったscale-spaceのoctave。サイズと相関がある場合がある。 - /// 特徴点のクラス(特徴点分類機または物体検出器において用いられる) -#else - /// - /// Complete constructor - /// - /// Coordinate of the point - /// Feature size - /// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) - /// Feature strength (can be used to select only the most prominent key points) - /// Scale-space octave in which the feature has been found; may correlate with the size - /// Point class (can be used by feature classifiers or object detectors) -#endif - public KeyPoint(Point2f pt, float size, float angle = -1, float response = 0, int octave = 0, - int classId = -1) - { - Pt = pt; - Size = size; - Angle = angle; - Response = response; - Octave = octave; - ClassId = classId; - } - -#if LANG_JP - /// - /// 初期化 - /// - /// 特徴点のx座標 - /// 特徴点のy座標 - /// 特徴点のサイズ - /// 特徴点の向き(度数法)。 向きが定義されない、若しくは計算されない場合には負数。 - /// 特徴点の強さ(もっとも顕著なキーポイントを求めるために使われる) - /// 特徴点が見つかったscale-spaceのoctave。サイズと相関がある場合がある。 - /// 特徴点のクラス(特徴点分類機または物体検出器において用いられる) -#else - /// - /// Complete constructor - /// - /// X-coordinate of the point - /// Y-coordinate of the point - /// Feature size - /// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) - /// Feature strength (can be used to select only the most prominent key points) - /// Scale-space octave in which the feature has been found; may correlate with the size - /// Point class (can be used by feature classifiers or object detectors) -#endif - public KeyPoint(float x, float y, float size, float angle = -1, float response = 0, int octave = 0, - int classId = -1) - : this(new Point2f(x, y), size, angle, response, octave, classId) - { - } - - #endregion - - #region Operators - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(KeyPoint obj) - { - return ( - this.Pt == obj.Pt && - this.Size == obj.Size && - this.Angle == obj.Angle && - this.Response == obj.Response && - this.Octave == obj.Octave && - this.ClassId == obj.ClassId - ); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(KeyPoint lhs, KeyPoint rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(KeyPoint lhs, KeyPoint rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region Overrided Methods - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - unchecked - { - return ( - this.Pt.GetHashCode() + - this.Size.GetHashCode() + - this.Angle.GetHashCode() + - this.Response.GetHashCode() + - this.Octave.GetHashCode() + - this.ClassId.GetHashCode() - ); - } - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return String.Format("[Pt:{0}, Size:{1}, Angle:{2}, Response:{3}, Octave:{4}, ClassId:{5}]", Pt, Size, Angle, - Response, Octave, ClassId); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/MatType.cs b/src/OpenCvSharp/modules/core/Struct/MatType.cs deleted file mode 100644 index f57fdf3df..000000000 --- a/src/OpenCvSharp/modules/core/Struct/MatType.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -// ReSharper disable InconsistentNaming -#pragma warning disable 1591 - - /// - /// Matrix data type (depth and number of channels) - /// - public struct MatType : IEquatable, IEquatable - { - /// - /// Entity value - /// - public int Value; - - /// - /// - /// - /// - public MatType(int value) - { - Value = value; - } - - /// - /// - /// - /// - /// - public static implicit operator int(MatType self) - { - return self.Value; - } - - /// - /// - /// - /// - /// - public static implicit operator MatType(int value) - { - return new MatType(value); - } - - /// - /// - /// - public int Depth - { - get { return Value & (CV_DEPTH_MAX - 1); } - } - - /// - /// - /// - public bool IsInteger - { - get { return Depth < CV_32F; } - } - - /// - /// - /// - public int Channels - { - get { return (Value >> CV_CN_SHIFT) + 1; } - } - - public bool Equals(MatType other) - { - return Value == other.Value; - } - - public bool Equals(int other) - { - return Value == other; - } - - public override bool Equals(object other) - { - if (other == null) - return false; - if (other.GetType() != typeof (MatType)) - return false; - return Equals((MatType) other); - } - - public static bool operator ==(MatType self, MatType other) - { - return self.Equals(other); - } - - public static bool operator !=(MatType self, MatType other) - { - return !self.Equals(other); - } - - public static bool operator ==(MatType self, int other) - { - return self.Equals(other); - } - - public static bool operator !=(MatType self, int other) - { - return !self.Equals(other); - } - - public override int GetHashCode() - { - return Value.GetHashCode(); - } - - /// - /// - /// - /// - public override string ToString() - { - string s; - switch (Depth) - { - case CV_8U: - s = "CV_8U"; - break; - case CV_8S: - s = "CV_8S"; - break; - case CV_16U: - s = "CV_16U"; - break; - case CV_16S: - s = "CV_16S"; - break; - case CV_32S: - s = "CV_32S"; - break; - case CV_32F: - s = "CV_32F"; - break; - case CV_64F: - s = "CV_64F"; - break; - case CV_USRTYPE1: - s = "CV_USRTYPE1"; - break; - default: - throw new OpenCvSharpException("Unsupported CvType value: " + Value); - } - - int ch = Channels; - if (ch <= 4) - return s + "C" + ch; - else - return s + "C(" + ch + ")"; - } - - private const int CV_CN_MAX = 512, - CV_CN_SHIFT = 3, - CV_DEPTH_MAX = (1 << CV_CN_SHIFT); - - /// - /// type depth constants - /// - public const int - CV_8U = 0, - CV_8S = 1, - CV_16U = 2, - CV_16S = 3, - CV_32S = 4, - CV_32F = 5, - CV_64F = 6, - CV_USRTYPE1 = 7; - - /// - /// predefined type constants - /// - public static readonly MatType - CV_8UC1 = CV_8UC(1), - CV_8UC2 = CV_8UC(2), - CV_8UC3 = CV_8UC(3), - CV_8UC4 = CV_8UC(4), - CV_8SC1 = CV_8SC(1), - CV_8SC2 = CV_8SC(2), - CV_8SC3 = CV_8SC(3), - CV_8SC4 = CV_8SC(4), - CV_16UC1 = CV_16UC(1), - CV_16UC2 = CV_16UC(2), - CV_16UC3 = CV_16UC(3), - CV_16UC4 = CV_16UC(4), - CV_16SC1 = CV_16SC(1), - CV_16SC2 = CV_16SC(2), - CV_16SC3 = CV_16SC(3), - CV_16SC4 = CV_16SC(4), - CV_32SC1 = CV_32SC(1), - CV_32SC2 = CV_32SC(2), - CV_32SC3 = CV_32SC(3), - CV_32SC4 = CV_32SC(4), - CV_32FC1 = CV_32FC(1), - CV_32FC2 = CV_32FC(2), - CV_32FC3 = CV_32FC(3), - CV_32FC4 = CV_32FC(4), - CV_64FC1 = CV_64FC(1), - CV_64FC2 = CV_64FC(2), - CV_64FC3 = CV_64FC(3), - CV_64FC4 = CV_64FC(4); - - - public static MatType CV_8UC(int ch) - { - return MakeType(CV_8U, ch); - } - - public static MatType CV_8SC(int ch) - { - return MakeType(CV_8S, ch); - } - - public static MatType CV_16UC(int ch) - { - return MakeType(CV_16U, ch); - } - - public static MatType CV_16SC(int ch) - { - return MakeType(CV_16S, ch); - } - - public static MatType CV_32SC(int ch) - { - return MakeType(CV_32S, ch); - } - - public static MatType CV_32FC(int ch) - { - return MakeType(CV_32F, ch); - } - - public static MatType CV_64FC(int ch) - { - return MakeType(CV_64F, ch); - } - - public static MatType MakeType(int depth, int channels) - { - if (channels <= 0 || channels >= CV_CN_MAX) - throw new OpenCvSharpException("Channels count should be 1.." + (CV_CN_MAX - 1)); - if (depth < 0 || depth >= CV_DEPTH_MAX) - throw new OpenCvSharpException("Data type depth should be 0.." + (CV_DEPTH_MAX - 1)); - return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT); - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Point.cs b/src/OpenCvSharp/modules/core/Struct/Point.cs deleted file mode 100644 index f39a63aa4..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Point.cs +++ /dev/null @@ -1,414 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Point : IEquatable - { - /// - /// - /// - public int X; - - /// - /// - /// - public int Y; - - /// - /// - /// - public const int SizeOf = sizeof (int) + sizeof (int); - - /// - /// - /// - /// - /// - public Point(int x, int y) - { - X = x; - Y = y; - } - - /// - /// - /// - /// - /// - public Point(double x, double y) - { - X = (int) x; - Y = (int) y; - } - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Vec2i(Point point) - { - return new Vec2i(point.X, point.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Point(Vec2i vec) - { - return new Point(vec.Item0, vec.Item1); - } - - #endregion - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Point obj) - { - return (this.X == obj.X && this.Y == obj.Y); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two Point objects. The result specifies whether the values of the X and Y properties of the two Point objects are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Point lhs, Point rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two Point objects. The result specifies whether the values of the X or Y properties of the two Point objects are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif - public static bool operator !=(Point lhs, Point rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else - /// - /// Unary plus operator - /// - /// - /// -#endif - public static Point operator +(Point pt) - { - return pt; - } - -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else - /// - /// Unary minus operator - /// - /// - /// -#endif - public static Point operator -(Point pt) - { - return new Point(-pt.X, -pt.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point operator +(Point p1, Point p2) - { - return new Point(p1.X + p2.X, p1.Y + p2.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point operator -(Point p1, Point p2) - { - return new Point(p1.X - p2.X, p1.Y - p2.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point operator *(Point pt, double scale) - { - return new Point((int) (pt.X*scale), (int) (pt.Y*scale)); - } - - #endregion - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1})", X, Y); - } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// - /// -#else - /// - /// Returns the distance between the specified two points - /// - /// - /// - /// -#endif - public static double Distance(Point p1, Point p2) - { - return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); - } - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else - /// - /// Returns the distance between the specified two points - /// - /// - /// -#endif - public double DistanceTo(Point p) - { - return Distance(this, p); - } - -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// - /// -#else - /// - /// Calculates the dot product of two 2D vectors. - /// - /// - /// - /// -#endif - public static double DotProduct(Point p1, Point p2) - { - return p1.X*p2.X + p1.Y*p2.Y; - } - -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// -#else - /// - /// Calculates the dot product of two 2D vectors. - /// - /// - /// -#endif - public double DotProduct(Point p) - { - return DotProduct(this, p); - } - -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// - /// -#else - /// - /// Calculates the cross product of two 2D vectors. - /// - /// - /// - /// -#endif - public static double CrossProduct(Point p1, Point p2) - { - return p1.X*p2.Y - p2.X*p1.Y; - } - -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// -#else - /// - /// Calculates the cross product of two 2D vectors. - /// - /// - /// -#endif - public double CrossProduct(Point p) - { - return CrossProduct(this, p); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/Struct/Point2d.cs b/src/OpenCvSharp/modules/core/Struct/Point2d.cs deleted file mode 100644 index 35679ec7a..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Point2d.cs +++ /dev/null @@ -1,423 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Point2d : IEquatable - { - /// - /// - /// - public double X; - - /// - /// - /// - public double Y; - - /// - /// - /// - public const int SizeOf = sizeof (double) + sizeof (double); - - /// - /// - /// - /// - /// - public Point2d(double x, double y) - { - X = x; - Y = y; - } - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Point(Point2d self) - { - return new Point((int) self.X, (int) self.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Point2d(Point point) - { - return new Point2d(point.X, point.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Vec2d(Point2d point) - { - return new Vec2d(point.X, point.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Point2d(Vec2d vec) - { - return new Point2d(vec.Item0, vec.Item1); - } - - #endregion - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Point2d obj) - { - return (this.X == obj.X && this.Y == obj.Y); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Point2d lhs, Point2d rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif - public static bool operator !=(Point2d lhs, Point2d rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else - /// - /// Unary plus operator - /// - /// - /// -#endif - public static Point2d operator +(Point2d pt) - { - return pt; - } - -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else - /// - /// Unary minus operator - /// - /// - /// -#endif - public static Point2d operator -(Point2d pt) - { - return new Point2d(-pt.X, -pt.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point2d operator +(Point2d p1, Point2d p2) - { - return new Point2d(p1.X + p2.X, p1.Y + p2.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point2d operator -(Point2d p1, Point2d p2) - { - return new Point2d(p1.X - p2.X, p1.Y - p2.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point2d operator *(Point2d pt, double scale) - { - return new Point2d((float) (pt.X*scale), (float) (pt.Y*scale)); - } - - #endregion - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1})", X, Y); - } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// - /// -#else - /// - /// Returns the distance between the specified two points - /// - /// - /// - /// -#endif - public static double Distance(Point2d p1, Point2d p2) - { - return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); - } - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else - /// - /// Returns the distance between the specified two points - /// - /// - /// -#endif - public double DistanceTo(Point2d p) - { - return Distance(this, p); - } - -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// - /// -#else - /// - /// Calculates the dot product of two 2D vectors. - /// - /// - /// - /// -#endif - public static double DotProduct(Point2d p1, Point2d p2) - { - return p1.X*p2.X + p1.Y*p2.Y; - } - -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// -#else - /// - /// Calculates the dot product of two 2D vectors. - /// - /// - /// -#endif - public double DotProduct(Point2d p) - { - return DotProduct(this, p); - } - -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// - /// -#else - /// - /// Calculates the cross product of two 2D vectors. - /// - /// - /// - /// -#endif - public static double CrossProduct(Point2d p1, Point2d p2) - { - return p1.X*p2.Y - p2.X*p1.Y; - } - -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// -#else - /// - /// Calculates the cross product of two 2D vectors. - /// - /// - /// -#endif - public double CrossProduct(Point2d p) - { - return CrossProduct(this, p); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Point2f.cs b/src/OpenCvSharp/modules/core/Struct/Point2f.cs deleted file mode 100644 index 780797e79..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Point2f.cs +++ /dev/null @@ -1,421 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Point2f : IEquatable - { - /// - /// - /// - public float X; - - /// - /// - /// - public float Y; - - /// - /// - /// - public const int SizeOf = sizeof (float) + sizeof (float); - - /// - /// - /// - /// - /// - public Point2f(float x, float y) - { - X = x; - Y = y; - } - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Point(Point2f self) - { - return new Point((int) self.X, (int) self.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Point2f(Point point) - { - return new Point2f(point.X, point.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Vec2f(Point2f point) - { - return new Vec2f(point.X, point.Y); - } - - /// - /// - /// - /// - /// - public static implicit operator Point2f(Vec2f vec) - { - return new Point2f(vec.Item0, vec.Item1); - } - - #endregion - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Point2f obj) - { - return (this.X == obj.X && this.Y == obj.Y); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Point2f lhs, Point2f rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif - public static bool operator !=(Point2f lhs, Point2f rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else - /// - /// Unary plus operator - /// - /// - /// -#endif - public static Point2f operator +(Point2f pt) - { - return pt; - } - -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else - /// - /// Unary minus operator - /// - /// - /// -#endif - public static Point2f operator -(Point2f pt) - { - return new Point2f(-pt.X, -pt.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point2f operator +(Point2f p1, Point2f p2) - { - return new Point2f(p1.X + p2.X, p1.Y + p2.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point2f operator -(Point2f p1, Point2f p2) - { - return new Point2f(p1.X - p2.X, p1.Y - p2.Y); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point2f operator *(Point2f pt, double scale) - { - return new Point2f((float) (pt.X*scale), (float) (pt.Y*scale)); - } - - #endregion - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1})", X, Y); - } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// - /// -#else - /// - /// Returns the distance between the specified two points - /// - /// - /// - /// -#endif - public static double Distance(Point2f p1, Point2f p2) - { - return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); - } - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else - /// - /// Returns the distance between the specified two points - /// - /// - /// -#endif - public double DistanceTo(Point2f p) - { - return Distance(this, p); - } - -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// - /// -#else - /// - /// Calculates the dot product of two 2D vectors. - /// - /// - /// - /// -#endif - public static double DotProduct(Point2f p1, Point2f p2) - { - return p1.X*p2.X + p1.Y*p2.Y; - } - -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// -#else - /// - /// Calculates the dot product of two 2D vectors. - /// - /// - /// -#endif - public double DotProduct(Point2f p) - { - return DotProduct(this, p); - } - -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// - /// -#else - /// - /// Calculates the cross product of two 2D vectors. - /// - /// - /// - /// -#endif - public static double CrossProduct(Point2f p1, Point2f p2) - { - return p1.X*p2.Y - p2.X*p1.Y; - } - -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// -#else - /// - /// Calculates the cross product of two 2D vectors. - /// - /// - /// -#endif - public double CrossProduct(Point2f p) - { - return CrossProduct(this, p); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Point3d.cs b/src/OpenCvSharp/modules/core/Struct/Point3d.cs deleted file mode 100644 index 6136b7c72..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Point3d.cs +++ /dev/null @@ -1,290 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Point3d : IEquatable - { - /// - /// - /// - public double X; - - /// - /// - /// - public double Y; - - /// - /// - /// - public double Z; - - /// - /// - /// - public const int SizeOf = sizeof (double) + sizeof (double) + sizeof (double); - - /// - /// - /// - /// - /// - /// - public Point3d(double x, double y, double z) - { - X = x; - Y = y; - Z = z; - } - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Vec3d(Point3d point) - { - return new Vec3d(point.X, point.Y, point.Z); - } - - /// - /// - /// - /// - /// - public static implicit operator Point3d(Vec3d vec) - { - return new Point3d(vec.Item0, vec.Item1, vec.Item2); - } - - #endregion - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Point3d obj) - { - return (this.X == obj.X && this.Y == obj.Y && this.Z == obj.Z); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Point3d lhs, Point3d rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif - public static bool operator !=(Point3d lhs, Point3d rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else - /// - /// Unary plus operator - /// - /// - /// -#endif - public static Point3d operator +(Point3d pt) - { - return pt; - } - -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else - /// - /// Unary minus operator - /// - /// - /// -#endif - public static Point3d operator -(Point3d pt) - { - return new Point3d(-pt.X, -pt.Y, -pt.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3d operator +(Point3d p1, Point3d p2) - { - return new Point3d(p1.X + p2.X, p1.Y + p2.Y, p1.Z + p2.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3d operator -(Point3d p1, Point3d p2) - { - return new Point3d(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3d operator *(Point3d pt, double scale) - { - return new Point3d(pt.X*scale, pt.Y*scale, pt.Z*scale); - } - - #endregion - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1} z:{2})", X, Y, Z); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Point3f.cs b/src/OpenCvSharp/modules/core/Struct/Point3f.cs deleted file mode 100644 index 050f43aba..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Point3f.cs +++ /dev/null @@ -1,290 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Point3f : IEquatable - { - /// - /// - /// - public float X; - - /// - /// - /// - public float Y; - - /// - /// - /// - public float Z; - - /// - /// - /// - public const int SizeOf = sizeof (float) + sizeof (float) + sizeof (float); - - /// - /// - /// - /// - /// - /// - public Point3f(float x, float y, float z) - { - X = x; - Y = y; - Z = z; - } - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Vec3f(Point3f point) - { - return new Vec3f(point.X, point.Y, point.Z); - } - - /// - /// - /// - /// - /// - public static implicit operator Point3f(Vec3f vec) - { - return new Point3f(vec.Item0, vec.Item1, vec.Item2); - } - - #endregion - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Point3f obj) - { - return (this.X == obj.X && this.Y == obj.Y && this.Z == obj.Z); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Point3f lhs, Point3f rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif - public static bool operator !=(Point3f lhs, Point3f rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else - /// - /// Unary plus operator - /// - /// - /// -#endif - public static Point3f operator +(Point3f pt) - { - return pt; - } - -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else - /// - /// Unary minus operator - /// - /// - /// -#endif - public static Point3f operator -(Point3f pt) - { - return new Point3f(-pt.X, -pt.Y, -pt.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3f operator +(Point3f p1, Point3f p2) - { - return new Point3f(p1.X + p2.X, p1.Y + p2.Y, p1.Z + p2.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3f operator -(Point3f p1, Point3f p2) - { - return new Point3f(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3f operator *(Point3f pt, double scale) - { - return new Point3f((float) (pt.X*scale), (float) (pt.Y*scale), (float) (pt.Z*scale)); - } - - #endregion - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1} z:{2})", X, Y, Z); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/Struct/Point3i.cs b/src/OpenCvSharp/modules/core/Struct/Point3i.cs deleted file mode 100644 index a68eb2839..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Point3i.cs +++ /dev/null @@ -1,290 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Point3i : IEquatable - { - /// - /// - /// - public int X; - - /// - /// - /// - public int Y; - - /// - /// - /// - public int Z; - - /// - /// - /// - public const int SizeOf = sizeof (int) + sizeof (int) + sizeof (int); - - /// - /// - /// - /// - /// - /// - public Point3i(int x, int y, int z) - { - X = x; - Y = y; - Z = z; - } - - #region Cast - - /// - /// - /// - /// - /// - public static implicit operator Vec3i(Point3i point) - { - return new Vec3i(point.X, point.Y, point.Z); - } - - /// - /// - /// - /// - /// - public static implicit operator Point3i(Vec3i vec) - { - return new Point3i(vec.Item0, vec.Item1, vec.Item2); - } - - #endregion - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Point3i obj) - { - return (this.X == obj.X && this.Y == obj.Y && this.Z == obj.Z); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Point3i lhs, Point3i rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif - public static bool operator !=(Point3i lhs, Point3i rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else - /// - /// Unary plus operator - /// - /// - /// -#endif - public static Point3i operator +(Point3i pt) - { - return pt; - } - -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else - /// - /// Unary minus operator - /// - /// - /// -#endif - public static Point3i operator -(Point3i pt) - { - return new Point3i(-pt.X, -pt.Y, -pt.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3i operator +(Point3i p1, Point3i p2) - { - return new Point3i(p1.X + p2.X, p1.Y + p2.Y, p1.Z + p2.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3i operator -(Point3i p1, Point3i p2) - { - return new Point3i(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z); - } - -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts point by a certain offset - /// - /// - /// - /// -#endif - public static Point3i operator *(Point3i pt, double scale) - { - return new Point3i((int) (pt.X*scale), (int) (pt.Y*scale), (int) (pt.Z*scale)); - } - - #endregion - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1} z:{2})", X, Y, Z); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Range.cs b/src/OpenCvSharp/modules/core/Struct/Range.cs deleted file mode 100644 index 51c0dd9b4..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Range.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Range - { - /// - /// - /// - public int Start; - - /// - /// - /// - public int End; - - /// - /// - /// - /// - /// - public Range(int start, int end) - { - Start = start; - End = end; - } - - /// - /// - /// - public static Range All - { - get { return new Range(Int32.MinValue, Int32.MaxValue); } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Rangef.cs b/src/OpenCvSharp/modules/core/Struct/Rangef.cs deleted file mode 100644 index 2e2a591af..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Rangef.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// float Range class - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Rangef - { - /// - /// - /// - public float Start; - - /// - /// - /// - public float End; - - /// - /// - /// - /// - /// - public Rangef(float start, float end) - { - Start = start; - End = end; - } - - /// - /// - /// - /// - /// - public static implicit operator Range(Rangef range) - { - return new Range((int)range.Start, (int)range.End); - } - - /// - /// - /// - public static Range All - { - get { return new Range(Int32.MinValue, Int32.MaxValue); } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Rect.cs b/src/OpenCvSharp/modules/core/Struct/Rect.cs deleted file mode 100644 index 912ee36a8..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Rect.cs +++ /dev/null @@ -1,713 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// Stores a set of four integers that represent the location and size of a rectangle - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Rect : IEquatable - { - #region Field - - /// - /// - /// - public int X; - - /// - /// - /// - public int Y; - - /// - /// - /// - public int Width; - - /// - /// - /// - public int Height; - - /// - /// sizeof(Rect) - /// - public const int SizeOf = sizeof (int)*4; - -#if LANG_JP - /// - /// プロパティを初期化しない状態の Rect 構造体を表します。 - /// -#else - /// - /// Represents a Rect structure with its properties left uninitialized. - /// -#endif - public static readonly Rect Empty = new Rect(); - - #endregion - - /// - /// Initializes a new instance of the Rectangle class with the specified location and size. - /// - /// The x-coordinate of the upper-left corner of the rectangle. - /// The y-coordinate of the upper-left corner of the rectangle. - /// The width of the rectangle. - /// The height of the rectangle. - public Rect(int x, int y, int width, int height) - { - X = x; - Y = y; - Width = width; - Height = height; - } - - /// - /// Initializes a new instance of the Rectangle class with the specified location and size. - /// - /// A Point that represents the upper-left corner of the rectangular region. - /// A Size that represents the width and height of the rectangular region. - public Rect(Point location, Size size) - { - X = location.X; - Y = location.Y; - Width = size.Width; - Height = size.Height; - } - - /// - /// Creates a Rectangle structure with the specified edge locations. - /// - /// The x-coordinate of the upper-left corner of this Rectangle structure. - /// The y-coordinate of the upper-left corner of this Rectangle structure. - /// The x-coordinate of the lower-right corner of this Rectangle structure. - /// The y-coordinate of the lower-right corner of this Rectangle structure. -// ReSharper disable once InconsistentNaming - public static Rect FromLTRB(int left, int top, int right, int bottom) - { - Rect r = new Rect - { - X = left, - Y = top, - Width = right - left + 1, - Height = bottom - top + 1 - }; - - if (r.Width < 0) - throw new ArgumentException("right > left"); - if (r.Height < 0) - throw new ArgumentException("bottom > top"); - return r; - } - - #region Operators - - #region == / != - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Rect obj) - { - return (X == obj.X && Y == obj.Y && Width == obj.Width && Height == obj.Height); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two Rect objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Rect lhs, Rect rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two Rect objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(Rect lhs, Rect rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region + / - - -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts rectangle by a certain offset - /// - /// - /// - /// -#endif - public static Rect operator +(Rect rect, Point pt) - { - return new Rect(rect.X + pt.X, rect.Y + pt.Y, rect.Width, rect.Height); - } - -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts rectangle by a certain offset - /// - /// - /// - /// -#endif - public static Rect operator -(Rect rect, Point pt) - { - return new Rect(rect.X - pt.X, rect.Y - pt.Y, rect.Width, rect.Height); - } - -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else - /// - /// Expands or shrinks rectangle by a certain amount - /// - /// - /// - /// -#endif - public static Rect operator +(Rect rect, Size size) - { - return new Rect(rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); - } - -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else - /// - /// Expands or shrinks rectangle by a certain amount - /// - /// - /// - /// -#endif - public static Rect operator -(Rect rect, Size size) - { - return new Rect(rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); - } - - #endregion - - #region & / | - -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Determines the Rect structure that represents the intersection of two rectangles. - /// - /// A rectangle to intersect. - /// A rectangle to intersect. - /// -#endif - public static Rect operator &(Rect a, Rect b) - { - return Intersect(a, b); - } - -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Gets a Rect structure that contains the union of two Rect structures. - /// - /// A rectangle to union. - /// A rectangle to union. - /// -#endif - public static Rect operator |(Rect a, Rect b) - { - return Union(a, b); - } - - #endregion - - #endregion - - #region Properties - -#if LANG_JP - /// - /// 上端のy座標 - /// -#else - /// - /// Gets the y-coordinate of the top edge of this Rect structure. - /// -#endif - public int Top - { - get { return Y; } - set { Y = value; } - } - -#if LANG_JP - /// - /// 下端のy座標 (Y + Height) - /// -#else - /// - /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect structure. - /// -#endif - public int Bottom - { - get { return Y + Height - 1; } - } - -#if LANG_JP - /// - /// 左端のx座標 - /// -#else - /// - /// Gets the x-coordinate of the left edge of this Rect structure. - /// -#endif - public int Left - { - get { return X; } - set { X = value; } - } - -#if LANG_JP - /// - /// 右端のx座標 (X + Width) - /// -#else - /// - /// Gets the x-coordinate that is the sum of X and Width property values of this Rect structure. - /// -#endif - public int Right - { - get { return X + Width - 1; } - } - -#if LANG_JP - /// - /// 矩形の左上頂点の位置 [Point(X, Y)] - /// -#else - /// - /// Coordinate of the left-most rectangle corner [Point(X, Y)] - /// -#endif - public Point Location - { - get { return new Point(X, Y); } - set - { - X = value.X; - Y = value.Y; - } - } - -#if LANG_JP - /// - /// 矩形の大きさ [CvSize(Width, Height)] - /// -#else - /// - /// Size of the rectangle [CvSize(Width, Height)] - /// -#endif - public Size Size - { - get { return new Size(Width, Height); } - set - { - Width = value.Width; - Height = value.Height; - } - } - -#if LANG_JP - /// - /// 左上の頂点 - /// -#else - /// - /// Coordinate of the left-most rectangle corner [Point(X, Y)] - /// -#endif - public Point TopLeft - { - get { return new Point(X, Y); } - } - -#if LANG_JP - /// - /// 右下の頂点 - /// -#else - /// - /// Coordinate of the right-most rectangle corner [Point(X+Width, Y+Height)] - /// -#endif - public Point BottomRight - { - get { return new Point(X + Width - 1, Y + Height - 1); } - } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// x座標 - /// y座標 - /// -#else - /// - /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. - /// - /// x-coordinate of the point - /// y-coordinate of the point - /// -#endif - public bool Contains(int x, int y) - { - return (X <= x && Y <= y && X + Width - 1 > x && Y + Height - 1 > y); - } - -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// 点 - /// -#else - /// - /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. - /// - /// point - /// -#endif - public bool Contains(Point pt) - { - return Contains(pt.X, pt.Y); - } - -#if LANG_JP - /// - /// 指定した矩形がこの矩形に含まれているかどうかを判断する - /// - /// 矩形 - /// -#else - /// - /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. - /// - /// rectangle - /// -#endif - public bool Contains(Rect rect) - { - return X <= rect.X && - (rect.X + rect.Width) <= (X + Width) && - Y <= rect.Y && - (rect.Y + rect.Height) <= (Y + Height); - } - -#if LANG_JP - /// - /// このRectを指定の量だけ膨らませる - /// - /// 水平方向の膨張量 - /// 垂直方向の膨張量 -#else - /// - /// Inflates this Rect by the specified amount. - /// - /// The amount to inflate this Rectangle horizontally. - /// The amount to inflate this Rectangle vertically. -#endif - public void Inflate(int width, int height) - { - X -= width; - Y -= height; - Width += (2*width); - Height += (2*height); - } - -#if LANG_JP - /// - /// このRectを指定の量だけ膨らませる - /// - /// この四角形の膨張量 -#else - /// - /// Inflates this Rect by the specified amount. - /// - /// The amount to inflate this rectangle. -#endif - public void Inflate(Size size) - { - - Inflate(size.Width, size.Height); - } - -#if LANG_JP - /// - /// このRectを指定の量だけ膨らませる - /// - /// 対象の矩形 - /// 水平方向の膨張量 - /// 垂直方向の膨張量 - /// -#else - /// - /// Creates and returns an inflated copy of the specified Rect structure. - /// - /// The Rectangle with which to start. This rectangle is not modified. - /// The amount to inflate this Rectangle horizontally. - /// The amount to inflate this Rectangle vertically. - /// -#endif - public static Rect Inflate(Rect rect, int x, int y) - { - rect.Inflate(x, y); - return rect; - } - -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Determines the Rect structure that represents the intersection of two rectangles. - /// - /// A rectangle to intersect. - /// A rectangle to intersect. - /// -#endif - public static Rect Intersect(Rect a, Rect b) - { - int x1 = Math.Max(a.X, b.X); - int x2 = Math.Min(a.X + a.Width, b.X + b.Width); - int y1 = Math.Max(a.Y, b.Y); - int y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); - - if (x2 >= x1 && y2 >= y1) - return new Rect(x1, y1, x2 - x1, y2 - y1); - return Empty; - } - -#if LANG_JP - /// - /// 2 つの矩形の交差部分を表す矩形を取得する - /// - /// - /// -#else - /// - /// Determines the Rect structure that represents the intersection of two rectangles. - /// - /// A rectangle to intersect. - /// -#endif - public Rect Intersect(Rect rect) - { - return Intersect(this, rect); - } - -#if LANG_JP - /// - /// 指定した矩形がこの矩形と交差するかどうか判定する - /// - /// 矩形 - /// -#else - /// - /// Determines if this rectangle intersects with rect. - /// - /// Rectangle - /// -#endif - public bool IntersectsWith(Rect rect) - { - return ( - (X < rect.X + rect.Width) && - (X + Width > rect.X) && - (Y < rect.Y + rect.Height) && - (Y + Height > rect.Y) - ); - } - -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// -#else - /// - /// Gets a Rect structure that contains the union of two Rect structures. - /// - /// A rectangle to union. - /// -#endif - public Rect Union(Rect rect) - { - return Union(this, rect); - } - -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Gets a Rect structure that contains the union of two Rect structures. - /// - /// A rectangle to union. - /// A rectangle to union. - /// -#endif - public static Rect Union(Rect a, Rect b) - { - int x1 = Math.Min(a.X, b.X); - int x2 = Math.Max(a.X + a.Width, b.X + b.Width); - int y1 = Math.Min(a.Y, b.Y); - int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); - - return new Rect(x1, y1, x2 - x1, y2 - y1); - } - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode() ^ Width.GetHashCode() ^ Height.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1} width:{2} height:{3})", X, Y, Width, Height); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/Struct/Rectf.cs b/src/OpenCvSharp/modules/core/Struct/Rectf.cs deleted file mode 100644 index 951a3dd69..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Rectf.cs +++ /dev/null @@ -1,677 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Rectf : IEquatable - { - #region Field - /// - /// - /// - public float X; - /// - /// - /// - public float Y; - /// - /// - /// - public float Width; - /// - /// - /// - public float Height; - /// - /// sizeof(Rect) - /// - public const int SizeOf = sizeof(float) * 4; - -#if LANG_JP - /// - /// プロパティを初期化しない状態の CvRect 構造体を表します。 - /// -#else - /// - /// Represents a CvRect structure with its properties left uninitialized. - /// -#endif - public static readonly Rectf Empty = new Rectf(); - #endregion - - /// - /// - /// - /// - /// - /// - /// - public Rectf(float x, float y, float width, float height) - { - X = x; - Y = y; - Width = width; - Height = height; - } - - /// - /// - /// - /// - /// - public Rectf(Point2f location, Size2f size) - { - X = location.X; - Y = location.Y; - Width = size.Width; - Height = size.Height; - } - - /// - /// - /// - /// - /// - /// - /// - public static Rectf FromLTRB(float left, float top, float right, float bottom) - { - Rectf r = new Rectf - { - X = left, - Y = top, - Width = right - left + 1, - Height = bottom - top + 1 - }; - - if (r.Width < 0) - throw new ArgumentException("right > left"); - if (r.Height < 0) - throw new ArgumentException("bottom > top"); - return r; - } - - #region Operators - #region == / != -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Rectf obj) - { - return (X == obj.X && Y == obj.Y && Width == obj.Width && Height == obj.Height); - } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two Rectf objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Rectf lhs, Rectf rhs) - { - return lhs.Equals(rhs); - } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two Rectf objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(Rectf lhs, Rectf rhs) - { - return !lhs.Equals(rhs); - } - #endregion - #region + / - -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts rectangle by a certain offset - /// - /// - /// - /// -#endif - public static Rectf operator +(Rectf rect, Point2f pt) - { - return new Rectf(rect.X + pt.X, rect.Y + pt.Y, rect.Width, rect.Height); - } -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else - /// - /// Shifts rectangle by a certain offset - /// - /// - /// - /// -#endif - public static Rectf operator -(Rectf rect, Point2f pt) - { - return new Rectf(rect.X - pt.X, rect.Y - pt.Y, rect.Width, rect.Height); - } - -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else - /// - /// Expands or shrinks rectangle by a certain amount - /// - /// - /// - /// -#endif - public static Rectf operator +(Rectf rect, Size2f size) - { - return new Rectf(rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); - } -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else - /// - /// Expands or shrinks rectangle by a certain amount - /// - /// - /// - /// -#endif - public static Rectf operator -(Rectf rect, Size2f size) - { - return new Rectf(rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); - } - #endregion - #region & / | -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Determines the CvRect structure that represents the intersection of two rectangles. - /// - /// A rectangle to intersect. - /// A rectangle to intersect. - /// -#endif - public static Rectf operator &(Rectf a, Rectf b) - { - return Intersect(a, b); - } - -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Gets a CvRect structure that contains the union of two CvRect structures. - /// - /// A rectangle to union. - /// A rectangle to union. - /// -#endif - public static Rectf operator |(Rectf a, Rectf b) - { - return Union(a, b); - } - #endregion - #endregion - - #region Properties -#if LANG_JP - /// - /// 上端のy座標 - /// -#else - /// - /// Gets the y-coordinate of the top edge of this CvRect structure. - /// -#endif - public float Top - { - get { return Y; } - set { Y = value; } - } -#if LANG_JP - /// - /// 下端のy座標 (Y + Height) - /// -#else - /// - /// Gets the y-coordinate that is the sum of the Y and Height property values of this CvRect structure. - /// -#endif - public float Bottom - { - get { return Y + Height - 1; } - } -#if LANG_JP - /// - /// 左端のx座標 - /// -#else - /// - /// Gets the x-coordinate of the left edge of this CvRect structure. - /// -#endif - public float Left - { - get { return X; } - set { X = value; } - } -#if LANG_JP - /// - /// 右端のx座標 (X + Width) - /// -#else - /// - /// Gets the x-coordinate that is the sum of X and Width property values of this CvRect structure. - /// -#endif - public float Right - { - get { return X + Width - 1; } - } - -#if LANG_JP - /// - /// 矩形の左上頂点の位置 [Point2f(X, Y)] - /// -#else - /// - /// Coordinate of the left-most rectangle corner [Point2f(X, Y)] - /// -#endif - public Point2f Location - { - get { return new Point2f(X, Y); } - set - { - X = value.X; - Y = value.Y; - } - } -#if LANG_JP - /// - /// 矩形の大きさ [CvSize(Width, Height)] - /// -#else - /// - /// Size of the rectangle [CvSize(Width, Height)] - /// -#endif - public Size2f Size - { - get { return new Size2f(Width, Height); } - set - { - Width = value.Width; - Height = value.Height; - } - } - -#if LANG_JP - /// - /// 左上の頂点 - /// -#else - /// - /// Coordinate of the left-most rectangle corner [Point2f(X, Y)] - /// -#endif - public Point2f TopLeft - { - get { return new Point2f(X, Y); } - } -#if LANG_JP - /// - /// 右下の頂点 - /// -#else - /// - /// Coordinate of the right-most rectangle corner [Point2f(X+Width, Y+Height)] - /// -#endif - public Point2f BottomRight - { - get { return new Point2f(X + Width - 1, Y + Height - 1); } - } - #endregion - - #region Methods - -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// x座標 - /// y座標 - /// -#else - /// - /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. - /// - /// x-coordinate of the point - /// y-coordinate of the point - /// -#endif - public bool Contains(float x, float y) - { - return (X <= x && Y <= y && X + Width - 1 > x && Y + Height - 1 > y); - } -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// 点 - /// -#else - /// - /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. - /// - /// point - /// -#endif - public bool Contains(Point2f pt) - { - return Contains(pt.X, pt.Y); - } -#if LANG_JP - /// - /// 指定した矩形がこの矩形に含まれているかどうかを判断する - /// - /// 矩形 - /// -#else - /// - /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. - /// - /// rectangle - /// -#endif - public bool Contains(Rectf rect) - { - return X <= rect.X && - (rect.X + rect.Width) <= (X + Width) && - Y <= rect.Y && - (rect.Y + rect.Height) <= (Y + Height); - } - -#if LANG_JP - /// - /// このCvRectを指定の量だけ膨らませる - /// - /// 水平方向の膨張量 - /// 垂直方向の膨張量 -#else - /// - /// Inflates this Rect by the specified amount. - /// - /// The amount to inflate this Rectangle horizontally. - /// The amount to inflate this Rectangle vertically. -#endif - public void Inflate(float width, float height) - { - X -= width; - Y -= height; - Width += (2 * width); - Height += (2 * height); - } -#if LANG_JP - /// - /// このCvRectを指定の量だけ膨らませる - /// - /// この四角形の膨張量 -#else - /// - /// Inflates this Rect by the specified amount. - /// - /// The amount to inflate this rectangle. -#endif - public void Inflate(Size2f size) - { - - Inflate(size.Width, size.Height); - } -#if LANG_JP - /// - /// このCvRectを指定の量だけ膨らませる - /// - /// 対象の矩形 - /// 水平方向の膨張量 - /// 垂直方向の膨張量 - /// -#else - /// - /// Creates and returns an inflated copy of the specified CvRect structure. - /// - /// The Rectangle with which to start. This rectangle is not modified. - /// The amount to inflate this Rectangle horizontally. - /// The amount to inflate this Rectangle vertically. - /// -#endif - public static Rect Inflate(Rect rect, int x, int y) - { - rect.Inflate(x, y); - return rect; - } - -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Determines the CvRect structure that represents the intersection of two rectangles. - /// - /// A rectangle to intersect. - /// A rectangle to intersect. - /// -#endif - public static Rectf Intersect(Rectf a, Rectf b) - { - float x1 = Math.Max(a.X, b.X); - float x2 = Math.Min(a.X + a.Width, b.X + b.Width); - float y1 = Math.Max(a.Y, b.Y); - float y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); - - if (x2 >= x1 && y2 >= y1) - return new Rectf(x1, y1, x2 - x1, y2 - y1); - return Empty; - } -#if LANG_JP - /// - /// 2 つの矩形の交差部分を表す矩形を取得する - /// - /// - /// -#else - /// - /// Determines the CvRect structure that represents the intersection of two rectangles. - /// - /// A rectangle to intersect. - /// -#endif - public Rectf Intersect(Rectf rect) - { - return Intersect(this, rect); - } - -#if LANG_JP - /// - /// 指定した矩形がこの矩形と交差するかどうか判定する - /// - /// 矩形 - /// -#else - /// - /// Determines if this rectangle intersects with rect. - /// - /// Rectangle - /// -#endif - public bool IntersectsWith(Rectf rect) - { - return ( - (X < rect.X + rect.Width) && - (X + Width > rect.X) && - (Y < rect.Y + rect.Height) && - (Y + Height > rect.Y) - ); - } - -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// -#else - /// - /// Gets a CvRect structure that contains the union of two CvRect structures. - /// - /// A rectangle to union. - /// -#endif - public Rectf Union(Rectf rect) - { - return Union(this, rect); - } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else - /// - /// Gets a CvRect structure that contains the union of two CvRect structures. - /// - /// A rectangle to union. - /// A rectangle to union. - /// -#endif - public static Rectf Union(Rectf a, Rectf b) - { - float x1 = Math.Min(a.X, b.X); - float x2 = Math.Max(a.X + a.Width, b.X + b.Width); - float y1 = Math.Min(a.Y, b.Y); - float y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); - - return new Rectf(x1, y1, x2 - x1, y2 - y1); - } - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode() ^ Width.GetHashCode() ^ Height.GetHashCode(); - } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(x:{0} y:{1} width:{2} height:{3})", X, Y, Width, Height); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/RotatedRect.cs b/src/OpenCvSharp/modules/core/Struct/RotatedRect.cs deleted file mode 100644 index cede70f70..000000000 --- a/src/OpenCvSharp/modules/core/Struct/RotatedRect.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [StructLayout(LayoutKind.Sequential)] - public struct RotatedRect - { - /// - /// the rectangle mass center - /// - public Point2f Center; - - /// - /// width and height of the rectangle - /// - public Size2f Size; - - /// - /// the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle. - /// - public float Angle; - - /// - /// - /// - /// - /// - /// - public RotatedRect(Point2f center, Size2f size, float angle) - { - Center = center; - Size = size; - Angle = angle; - } - - /// - /// returns 4 vertices of the rectangle - /// - /// - public Point2f[] Points() - { - double angle = Angle*Math.PI/180.0; - float b = (float) Math.Cos(angle)*0.5f; - float a = (float) Math.Sin(angle)*0.5f; - - Point2f[] pt = new Point2f[4]; - pt[0].X = Center.X - a*Size.Height - b*Size.Width; - pt[0].Y = Center.Y + b*Size.Height - a*Size.Width; - pt[1].X = Center.X + a*Size.Height - b*Size.Width; - pt[1].Y = Center.Y - b*Size.Height - a*Size.Width; - pt[2].X = 2*Center.X - pt[0].X; - pt[2].Y = 2*Center.Y - pt[0].Y; - pt[3].X = 2*Center.X - pt[1].X; - pt[3].Y = 2*Center.Y - pt[1].Y; - return pt; - } - - /// - /// returns the minimal up-right rectangle containing the rotated rectangle - /// - /// - public Rect BoundingRect() - { - Point2f[] pt = Points(); - Rect r = new Rect - { - X = (int)Math.Floor(Math.Min(Math.Min(Math.Min(pt[0].X, pt[1].X), pt[2].X), pt[3].X)), - Y = (int)Math.Floor(Math.Min(Math.Min(Math.Min(pt[0].Y, pt[1].Y), pt[2].Y), pt[3].Y)), - Width = (int)Math.Ceiling(Math.Max(Math.Max(Math.Max(pt[0].X, pt[1].X), pt[2].X), pt[3].X)), - Height = (int)Math.Ceiling(Math.Max(Math.Max(Math.Max(pt[0].Y, pt[1].Y), pt[2].Y), pt[3].Y)) - }; - r.Width -= r.X - 1; - r.Height -= r.Y - 1; - return r; - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Scalar.cs b/src/OpenCvSharp/modules/core/Struct/Scalar.cs deleted file mode 100644 index 70a731ca0..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Scalar.cs +++ /dev/null @@ -1,1195 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - public struct Scalar : IEquatable - { - #region Field - - /// - /// - /// - public double Val0; - - /// - /// - /// - public double Val1; - - /// - /// - /// - public double Val2; - - /// - /// - /// - public double Val3; - - /// - /// - /// - public double this[int i] - { - get - { - switch (i) - { - case 0: - return Val0; - case 1: - return Val1; - case 2: - return Val2; - case 3: - return Val3; - default: - throw new IndexOutOfRangeException(); - } - } - set - { - switch (i) - { - case 0: - Val0 = value; - break; - case 1: - Val1 = value; - break; - case 2: - Val2 = value; - break; - case 3: - Val3 = value; - break; - default: - throw new IndexOutOfRangeException(); - } - } - } - - #endregion - - #region Init - - /// - /// - /// - /// - public Scalar(double v0) - : this(v0, 0, 0, 0) - { - } - - /// - /// - /// - /// - /// - public Scalar(double v0, double v1) - : this(v0, v1, 0, 0) - { - } - - /// - /// - /// - /// - /// - /// - public Scalar(double v0, double v1, double v2) - : this(v0, v1, v2, 0) - { - } - - /// - /// - /// - /// - /// - /// - /// - public Scalar(double v0, double v1, double v2, double v3) - { - Val0 = v0; - Val1 = v1; - Val2 = v2; - Val3 = v3; - } - - /// - /// - /// - /// - /// - /// - public static Scalar FromRgb(int r, int g, int b) - { - return new Scalar(b, g, r); - } - - /// - /// - /// - public static Scalar RandomColor() - { - var buf = new byte[3]; - random.NextBytes(buf); - return new Scalar(buf[0], buf[1], buf[2]); - } - - private static readonly Random random = new Random(); - - #endregion - - #region Cast - - /// - /// - /// - /// - /// - public static explicit operator double(Scalar self) - { - return self.Val0; - } - - /// - /// - /// - /// - /// - public static implicit operator Scalar(double val) - { - return new Scalar(val); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(DMatch d) - { - return new Scalar(d.QueryIdx, d.TrainIdx, d.ImgIdx, d.Distance); - } - - /// - /// - /// - /// - /// - public static explicit operator DMatch(Scalar self) - { - return new DMatch((int) self.Val0, (int) self.Val1, (int) self.Val2, (float) self.Val3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec3b v) - { - return new Scalar(v.Item0, v.Item1, v.Item2); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec3f v) - { - return new Scalar(v.Item0, v.Item1, v.Item2); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec4f v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec6f v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec3d v) - { - return new Scalar(v.Item0, v.Item1, v.Item2); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec4d v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec6d v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point p) - { - return new Scalar(p.X, p.Y); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point2f p) - { - return new Scalar(p.X, p.Y); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point2d p) - { - return new Scalar(p.X, p.Y); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point3i p) - { - return new Scalar(p.X, p.Y, p.Z); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point3f p) - { - return new Scalar(p.X, p.Y, p.Z); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point3d p) - { - return new Scalar(p.X, p.Y, p.Z); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Rect p) - { - return new Scalar(p.X, p.Y, p.Width, p.Height); - } - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - int result = Val0.GetHashCode() ^ Val1.GetHashCode() ^ Val2.GetHashCode() ^ Val3.GetHashCode(); - return result; - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return String.Format("[{0}, {1}, {2}, {3}]", Val0, Val1, Val2, Val3); - } - - #endregion - - #region Operators - - /// - /// - /// - /// - /// - /// - public static bool operator ==(Scalar s1, Scalar s2) - { - return s1.Equals(s2); - } - - /// - /// - /// - /// - /// - /// - public static bool operator !=(Scalar s1, Scalar s2) - { - return !s1.Equals(s2); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - /// - public static Scalar All(double v) - { - return new Scalar(v, v, v, v); - } - - /// - /// - /// - /// - /// - /// - public Scalar Mul(Scalar it, double scale) - { - return new Scalar(Val0*it.Val0*scale, Val1*it.Val1*scale, - Val2*it.Val2*scale, Val3*it.Val3*scale); - } - - /// - /// - /// - /// - /// - public Scalar Mul(Scalar it) - { - return Mul(it, 1); - } - - /// - /// - /// - /// - public Scalar Conj() - { - return new Scalar(Val0, -Val1, -Val2, -Val3); - } - - /// - /// - /// - /// - public bool IsReal() - { - return Val1 == 0 && Val2 == 0 && Val3 == 0; - } - - /// - /// - /// - /// - public Vec3b ToVec3b() - { - return new Vec3b((byte)Val0, (byte)Val1, (byte)Val2); - } - - /// - /// - /// - /// - /// - public bool Equals(Scalar other) - { - return Val0 == other.Val0 && - Val1 == other.Val1 && - Val2 == other.Val2 && - Val3 == other.Val3; - } - - #endregion - - #region Existing Color Constants - - /// - /// #F0F8FF - /// - public static readonly Scalar AliceBlue = FromRgb(240, 248, 255); - - /// - /// #FAEBD7 - /// - public static readonly Scalar AntiqueWhite = FromRgb(250, 235, 215); - - /// - /// #00FFFF - /// - public static readonly Scalar Aqua = FromRgb(0, 255, 255); - - /// - /// #7FFFD4 - /// - public static readonly Scalar Aquamarine = FromRgb(127, 255, 212); - - /// - /// #F0FFFF - /// - public static readonly Scalar Azure = FromRgb(240, 255, 255); - - /// - /// #F5F5DC - /// - public static readonly Scalar Beige = FromRgb(245, 245, 220); - - /// - /// #FFE4C4 - /// - public static readonly Scalar Bisque = FromRgb(255, 228, 196); - - /// - /// #000000 - /// - public static readonly Scalar Black = FromRgb(0, 0, 0); - - /// - /// #FFEBCD - /// - public static readonly Scalar BlanchedAlmond = FromRgb(255, 235, 205); - - /// - /// #0000FF - /// - public static readonly Scalar Blue = FromRgb(0, 0, 255); - - /// - /// #8A2BE2 - /// - public static readonly Scalar BlueViolet = FromRgb(138, 43, 226); - - /// - /// #A52A2A - /// - public static readonly Scalar Brown = FromRgb(165, 42, 42); - - /// - /// #DEB887 - /// - public static readonly Scalar BurlyWood = FromRgb(222, 184, 135); - - /// - /// #5F9EA0 - /// - public static readonly Scalar CadetBlue = FromRgb(95, 158, 160); - - /// - /// #7FFF00 - /// - public static readonly Scalar Chartreuse = FromRgb(127, 255, 0); - - /// - /// #D2691E - /// - public static readonly Scalar Chocolate = FromRgb(210, 105, 30); - - /// - /// #FF7F50 - /// - public static readonly Scalar Coral = FromRgb(255, 127, 80); - - /// - /// #6495ED - /// - public static readonly Scalar CornflowerBlue = FromRgb(100, 149, 237); - - /// - /// #FFF8DC - /// - public static readonly Scalar Cornsilk = FromRgb(255, 248, 220); - - /// - /// #DC143C - /// - public static readonly Scalar Crimson = FromRgb(220, 20, 60); - - /// - /// #00FFFF - /// - public static readonly Scalar Cyan = FromRgb(0, 255, 255); - - /// - /// #00008B - /// - public static readonly Scalar DarkBlue = FromRgb(0, 0, 139); - - /// - /// #008B8B - /// - public static readonly Scalar DarkCyan = FromRgb(0, 139, 139); - - /// - /// #B8860B - /// - public static readonly Scalar DarkGoldenrod = FromRgb(184, 134, 11); - - /// - /// #A9A9A9 - /// - public static readonly Scalar DarkGray = FromRgb(169, 169, 169); - - /// - /// #006400 - /// - public static readonly Scalar DarkGreen = FromRgb(0, 100, 0); - - /// - /// #BDB76B - /// - public static readonly Scalar DarkKhaki = FromRgb(189, 183, 107); - - /// - /// #8B008B - /// - public static readonly Scalar DarkMagenta = FromRgb(139, 0, 139); - - /// - /// #556B2F - /// - public static readonly Scalar DarkOliveGreen = FromRgb(85, 107, 47); - - /// - /// #FF8C00 - /// - public static readonly Scalar DarkOrange = FromRgb(255, 140, 0); - - /// - /// #9932CC - /// - public static readonly Scalar DarkOrchid = FromRgb(153, 50, 204); - - /// - /// #8B0000 - /// - public static readonly Scalar DarkRed = FromRgb(139, 0, 0); - - /// - /// #E9967A - /// - public static readonly Scalar DarkSalmon = FromRgb(233, 150, 122); - - /// - /// #8FBC8F - /// - public static readonly Scalar DarkSeaGreen = FromRgb(143, 188, 139); - - /// - /// #483D8B - /// - public static readonly Scalar DarkSlateBlue = FromRgb(72, 61, 139); - - /// - /// #2F4F4F - /// - public static readonly Scalar DarkSlateGray = FromRgb(47, 79, 79); - - /// - /// #00CED1 - /// - public static readonly Scalar DarkTurquoise = FromRgb(0, 206, 209); - - /// - /// #9400D3 - /// - public static readonly Scalar DarkViolet = FromRgb(148, 0, 211); - - /// - /// #FF1493 - /// - public static readonly Scalar DeepPink = FromRgb(255, 20, 147); - - /// - /// #00BFFF - /// - public static readonly Scalar DeepSkyBlue = FromRgb(0, 191, 255); - - /// - /// #696969 - /// - public static readonly Scalar DimGray = FromRgb(105, 105, 105); - - /// - /// #1E90FF - /// - public static readonly Scalar DodgerBlue = FromRgb(30, 144, 255); - - /// - /// #B22222 - /// - public static readonly Scalar Firebrick = FromRgb(178, 34, 34); - - /// - /// #FFFAF0 - /// - public static readonly Scalar FloralWhite = FromRgb(255, 250, 240); - - /// - /// #228B22 - /// - public static readonly Scalar ForestGreen = FromRgb(34, 139, 34); - - /// - /// #FF00FF - /// - public static readonly Scalar Fuchsia = FromRgb(255, 0, 255); - - /// - /// #DCDCDC - /// - public static readonly Scalar Gainsboro = FromRgb(220, 220, 220); - - /// - /// #F8F8FF - /// - public static readonly Scalar GhostWhite = FromRgb(248, 248, 255); - - /// - /// #FFD700 - /// - public static readonly Scalar Gold = FromRgb(255, 215, 0); - - /// - /// #DAA520 - /// - public static readonly Scalar Goldenrod = FromRgb(218, 165, 32); - - /// - /// #808080 - /// - public static readonly Scalar Gray = FromRgb(128, 128, 128); - - /// - /// #008000 - /// - public static readonly Scalar Green = FromRgb(0, 128, 0); - - /// - /// #ADFF2F - /// - public static readonly Scalar GreenYellow = FromRgb(173, 255, 47); - - /// - /// #F0FFF0 - /// - public static readonly Scalar Honeydew = FromRgb(240, 255, 240); - - /// - /// #FF69B4 - /// - public static readonly Scalar HotPink = FromRgb(255, 105, 180); - - /// - /// #CD5C5C - /// - public static readonly Scalar IndianRed = FromRgb(205, 92, 92); - - /// - /// #4B0082 - /// - public static readonly Scalar Indigo = FromRgb(75, 0, 130); - - /// - /// #FFFFF0 - /// - public static readonly Scalar Ivory = FromRgb(255, 255, 240); - - /// - /// #F0E68C - /// - public static readonly Scalar Khaki = FromRgb(240, 230, 140); - - /// - /// #E6E6FA - /// - public static readonly Scalar Lavender = FromRgb(230, 230, 250); - - /// - /// #FFF0F5 - /// - public static readonly Scalar LavenderBlush = FromRgb(255, 240, 245); - - /// - /// #7CFC00 - /// - public static readonly Scalar LawnGreen = FromRgb(124, 252, 0); - - /// - /// #FFFACD - /// - public static readonly Scalar LemonChiffon = FromRgb(255, 250, 205); - - /// - /// #ADD8E6 - /// - public static readonly Scalar LightBlue = FromRgb(173, 216, 230); - - /// - /// #F08080 - /// - public static readonly Scalar LightCoral = FromRgb(240, 128, 128); - - /// - /// #E0FFFF - /// - public static readonly Scalar LightCyan = FromRgb(224, 255, 255); - - /// - /// #FAFAD2 - /// - public static readonly Scalar LightGoldenrodYellow = FromRgb(250, 250, 210); - - /// - /// #D3D3D3 - /// - public static readonly Scalar LightGray = FromRgb(211, 211, 211); - - /// - /// #90EE90 - /// - public static readonly Scalar LightGreen = FromRgb(144, 238, 144); - - /// - /// #FFB6C1 - /// - public static readonly Scalar LightPink = FromRgb(255, 182, 193); - - /// - /// #FFA07A - /// - public static readonly Scalar LightSalmon = FromRgb(255, 160, 122); - - /// - /// #20B2AA - /// - public static readonly Scalar LightSeaGreen = FromRgb(32, 178, 170); - - /// - /// #87CEFA - /// - public static readonly Scalar LightSkyBlue = FromRgb(135, 206, 250); - - /// - /// #778899 - /// - public static readonly Scalar LightSlateGray = FromRgb(119, 136, 153); - - /// - /// #B0C4DE - /// - public static readonly Scalar LightSteelBlue = FromRgb(176, 196, 222); - - /// - /// #FFFFE0 - /// - public static readonly Scalar LightYellow = FromRgb(255, 255, 224); - - /// - /// #00FF00 - /// - public static readonly Scalar Lime = FromRgb(0, 255, 0); - - /// - /// #32CD32 - /// - public static readonly Scalar LimeGreen = FromRgb(50, 205, 50); - - /// - /// #FAF0E6 - /// - public static readonly Scalar Linen = FromRgb(250, 240, 230); - - /// - /// #FF00FF - /// - public static readonly Scalar Magenta = FromRgb(255, 0, 255); - - /// - /// #800000 - /// - public static readonly Scalar Maroon = FromRgb(128, 0, 0); - - /// - /// #66CDAA - /// - public static readonly Scalar MediumAquamarine = FromRgb(102, 205, 170); - - /// - /// #0000CD - /// - public static readonly Scalar MediumBlue = FromRgb(0, 0, 205); - - /// - /// #BA55D3 - /// - public static readonly Scalar MediumOrchid = FromRgb(186, 85, 211); - - /// - /// #9370DB - /// - public static readonly Scalar MediumPurple = FromRgb(147, 112, 219); - - /// - /// #3CB371 - /// - public static readonly Scalar MediumSeaGreen = FromRgb(60, 179, 113); - - /// - /// #7B68EE - /// - public static readonly Scalar MediumSlateBlue = FromRgb(123, 104, 238); - - /// - /// #00FA9A - /// - public static readonly Scalar MediumSpringGreen = FromRgb(0, 250, 154); - - /// - /// #48D1CC - /// - public static readonly Scalar MediumTurquoise = FromRgb(72, 209, 204); - - /// - /// #C71585 - /// - public static readonly Scalar MediumVioletRed = FromRgb(199, 21, 133); - - /// - /// #191970 - /// - public static readonly Scalar MidnightBlue = FromRgb(25, 25, 112); - - /// - /// #F5FFFA - /// - public static readonly Scalar MintCream = FromRgb(245, 255, 250); - - /// - /// #FFE4E1 - /// - public static readonly Scalar MistyRose = FromRgb(255, 228, 225); - - /// - /// #FFE4B5 - /// - public static readonly Scalar Moccasin = FromRgb(255, 228, 181); - - /// - /// #FFDEAD - /// - public static readonly Scalar NavajoWhite = FromRgb(255, 222, 173); - - /// - /// #000080 - /// - public static readonly Scalar Navy = FromRgb(0, 0, 128); - - /// - /// #FDF5E6 - /// - public static readonly Scalar OldLace = FromRgb(253, 245, 230); - - /// - /// #808000 - /// - public static readonly Scalar Olive = FromRgb(128, 128, 0); - - /// - /// #6B8E23 - /// - public static readonly Scalar OliveDrab = FromRgb(107, 142, 35); - - /// - /// #FFA500 - /// - public static readonly Scalar Orange = FromRgb(255, 165, 0); - - /// - /// #FF4500 - /// - public static readonly Scalar OrangeRed = FromRgb(255, 69, 0); - - /// - /// #DA70D6 - /// - public static readonly Scalar Orchid = FromRgb(218, 112, 214); - - /// - /// #EEE8AA - /// - public static readonly Scalar PaleGoldenrod = FromRgb(238, 232, 170); - - /// - /// #98FB98 - /// - public static readonly Scalar PaleGreen = FromRgb(152, 251, 152); - - /// - /// #AFEEEE - /// - public static readonly Scalar PaleTurquoise = FromRgb(175, 238, 238); - - /// - /// #DB7093 - /// - public static readonly Scalar PaleVioletRed = FromRgb(219, 112, 147); - - /// - /// #FFEFD5 - /// - public static readonly Scalar PapayaWhip = FromRgb(255, 239, 213); - - /// - /// #FFDAB9 - /// - public static readonly Scalar PeachPuff = FromRgb(255, 218, 185); - - /// - /// #CD853F - /// - public static readonly Scalar Peru = FromRgb(205, 133, 63); - - /// - /// #FFC0CB - /// - public static readonly Scalar Pink = FromRgb(255, 192, 203); - - /// - /// #DDA0DD - /// - public static readonly Scalar Plum = FromRgb(221, 160, 221); - - /// - /// #B0E0E6 - /// - public static readonly Scalar PowderBlue = FromRgb(176, 224, 230); - - /// - /// #800080 - /// - public static readonly Scalar Purple = FromRgb(128, 0, 128); - - /// - /// #FF0000 - /// - public static readonly Scalar Red = FromRgb(255, 0, 0); - - /// - /// #BC8F8F - /// - public static readonly Scalar RosyBrown = FromRgb(188, 143, 143); - - /// - /// #4169E1 - /// - public static readonly Scalar RoyalBlue = FromRgb(65, 105, 225); - - /// - /// #8B4513 - /// - public static readonly Scalar SaddleBrown = FromRgb(139, 69, 19); - - /// - /// #FA8072 - /// - public static readonly Scalar Salmon = FromRgb(250, 128, 114); - - /// - /// #F4A460 - /// - public static readonly Scalar SandyBrown = FromRgb(244, 164, 96); - - /// - /// #2E8B57 - /// - public static readonly Scalar SeaGreen = FromRgb(46, 139, 87); - - /// - /// #FFF5EE - /// - public static readonly Scalar SeaShell = FromRgb(255, 245, 238); - - /// - /// #A0522D - /// - public static readonly Scalar Sienna = FromRgb(160, 82, 45); - - /// - /// #C0C0C0 - /// - public static readonly Scalar Silver = FromRgb(192, 192, 192); - - /// - /// #87CEEB - /// - public static readonly Scalar SkyBlue = FromRgb(135, 206, 235); - - /// - /// #6A5ACD - /// - public static readonly Scalar SlateBlue = FromRgb(106, 90, 205); - - /// - /// #708090 - /// - public static readonly Scalar SlateGray = FromRgb(112, 128, 144); - - /// - /// #FFFAFA - /// - public static readonly Scalar Snow = FromRgb(255, 250, 250); - - /// - /// #00FF7F - /// - public static readonly Scalar SpringGreen = FromRgb(0, 255, 127); - - /// - /// #4682B4 - /// - public static readonly Scalar SteelBlue = FromRgb(70, 130, 180); - - /// - /// #D2B48C - /// - public static readonly Scalar Tan = FromRgb(210, 180, 140); - - /// - /// #008080 - /// - public static readonly Scalar Teal = FromRgb(0, 128, 128); - - /// - /// #D8BFD8 - /// - public static readonly Scalar Thistle = FromRgb(216, 191, 216); - - /// - /// #FF6347 - /// - public static readonly Scalar Tomato = FromRgb(255, 99, 71); - - /// - /// #40E0D0 - /// - public static readonly Scalar Turquoise = FromRgb(64, 224, 208); - - /// - /// #EE82EE - /// - public static readonly Scalar Violet = FromRgb(238, 130, 238); - - /// - /// #F5DEB3 - /// - public static readonly Scalar Wheat = FromRgb(245, 222, 179); - - /// - /// #FFFFFF - /// - public static readonly Scalar White = FromRgb(255, 255, 255); - - /// - /// #F5F5F5 - /// - public static readonly Scalar WhiteSmoke = FromRgb(245, 245, 245); - - /// - /// #FFFF00 - /// - public static readonly Scalar Yellow = FromRgb(255, 255, 0); - - /// - /// #9ACD32 - /// - public static readonly Scalar YellowGreen = FromRgb(154, 205, 50); - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Size.cs b/src/OpenCvSharp/modules/core/Struct/Size.cs deleted file mode 100644 index 3417d0c72..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Size.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Size : IEquatable - { - /// - /// - /// - public int Width; - /// - /// - /// - public int Height; - - /// - /// - /// - /// - /// - public Size(int width, int height) - { - Width = width; - Height = height; - } - /// - /// - /// - /// - /// - public Size(double width, double height) - { - Width = (int)width; - Height = (int)height; - } - - /// - /// - /// - public static Size Zero - { - get { return new Size();} - } - - #region Operators -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Size obj) - { - return (this.Width == obj.Width && this.Height == obj.Height); - } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Size lhs, Size rhs) - { - return lhs.Equals(rhs); - } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(Size lhs, Size rhs) - { - return !lhs.Equals(rhs); - } - #endregion - - #region Override -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return Width.GetHashCode() ^ Height.GetHashCode(); - } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(width:{0} height:{1})", Width, Height); - } - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Size2f.cs b/src/OpenCvSharp/modules/core/Struct/Size2f.cs deleted file mode 100644 index 3601c2b9d..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Size2f.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Size2f : IEquatable - { - /// - /// - /// - public float Width; - - /// - /// - /// - public float Height; - - /// - /// - /// - /// - /// - public Size2f(float width, float height) - { - Width = width; - Height = height; - } - - /// - /// - /// - /// - /// - public Size2f(double width, double height) - { - Width = (int) width; - Height = (int) height; - } - - #region Operators - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(Size2f obj) - { - return (Width == obj.Width && Height == obj.Height); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(Size2f lhs, Size2f rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(Size2f lhs, Size2f rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region Override - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return Width.GetHashCode() ^ Height.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("(width:{0} height:{1})", Width, Height); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/TermCriteria.cs b/src/OpenCvSharp/modules/core/Struct/TermCriteria.cs deleted file mode 100644 index 282138896..000000000 --- a/src/OpenCvSharp/modules/core/Struct/TermCriteria.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// The class defining termination criteria for iterative algorithms. - /// - public struct TermCriteria - { - /// - /// the type of termination criteria: COUNT, EPS or COUNT + EPS - /// - public CriteriaType Type; - - /// - /// the maximum number of iterations/elements - /// - public int MaxCount; - - /// - /// the desired accuracy - /// - public double Epsilon; - - /// - /// full constructor - /// - /// - /// - /// - public TermCriteria(CriteriaType type, int maxCount, double epsilon) - : this() - { - Type = type; - MaxCount = maxCount; - Epsilon = epsilon; - } - - /// - /// full constructor with both type (count | epsilon) - /// - /// - /// - public static TermCriteria Both(int maxCount, double epsilon) - { - return new TermCriteria - { - Type = CriteriaType.Count | CriteriaType.Eps, - MaxCount = maxCount, - Epsilon = epsilon, - }; - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Vecb.cs b/src/OpenCvSharp/modules/core/Struct/Vecb.cs deleted file mode 100644 index 83436361d..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Vecb.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// 2-Tuple of byte (System.Byte) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec2b : IVec - { - /// - /// The value of the first component of this object. - /// - public byte Item0; - /// - /// The value of the second component of this object. - /// - public byte Item1; - - /// - /// Initializer - /// - /// - /// - public Vec2b(byte item0, byte item1) - { - Item0 = item0; - Item1 = item1; - } - - /// - /// Indexer - /// - /// - /// - public byte this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 3-Tuple of byte (System.Byte) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec3b : IVec - { - /// - /// The value of the first component of this object. - /// - public byte Item0; - /// - /// The value of the second component of this object. - /// - public byte Item1; - /// - /// The value of the third component of this object. - /// - public byte Item2; - - /// - /// Initializer - /// - /// - /// - /// - public Vec3b(byte item0, byte item1, byte item2) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - } - - /// - /// Indexer - /// - /// - /// - public byte this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of byte (System.Byte) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec4b : IVec - { - /// - /// The value of the first component of this object. - /// - public byte Item0; - - /// - /// The value of the second component of this object. - /// - public byte Item1; - - /// - /// The value of the third component of this object. - /// - public byte Item2; - - /// - /// The value of the fourth component of this object. - /// - public byte Item3; - - /// - /// Initializer - /// - /// - /// - /// - /// - public Vec4b(byte item0, byte item1, byte item2, byte item3) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - } - - /// - /// Indexer - /// - /// - /// - public byte this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 6-Tuple of byte (System.Byte) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec6b : IVec - { - /// - /// The value of the first component of this object. - /// - public byte Item0; - - /// - /// The value of the second component of this object. - /// - public byte Item1; - - /// - /// The value of the third component of this object. - /// - public byte Item2; - - /// - /// The value of the fourth component of this object. - /// - public byte Item3; - - /// - /// The value of the fifth component of this object. - /// - public byte Item4; - - /// - /// The value of the sizth component of this object. - /// - public byte Item5; - - /// - /// Initializer - /// - /// - /// - /// - /// - /// - /// - public Vec6b(byte item0, byte item1, byte item2, byte item3, byte item4, byte item5) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - Item4 = item4; - Item5 = item5; - } - - /// - /// Indexer - /// - /// - /// - public byte this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - case 4: return Item4; - case 5: return Item5; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - case 4: Item4 = value; break; - case 5: Item5 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Vecd.cs b/src/OpenCvSharp/modules/core/Struct/Vecd.cs deleted file mode 100644 index 110f4144a..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Vecd.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// 2-Tuple of double (System.Double) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec2d : IVec - { - /// - /// The value of the first component of this object. - /// - public double Item0; - /// - /// The value of the second component of this object. - /// - public double Item1; - - /// - /// Initializer - /// - /// - /// - public Vec2d(double item0, double item1) - { - Item0 = item0; - Item1 = item1; - } - - /// - /// Indexer - /// - /// - /// - public double this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 3-Tuple of double (System.Double) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec3d : IVec - { - /// - /// The value of the first component of this object. - /// - public double Item0; - /// - /// The value of the second component of this object. - /// - public double Item1; - /// - /// The value of the third component of this object. - /// - public double Item2; - - /// - /// Initializer - /// - /// - /// - /// - public Vec3d(double item0, double item1, double item2) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - } - - /// - /// Indexer - /// - /// - /// - public double this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of double (System.Double) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec4d : IVec - { - /// - /// The value of the first component of this object. - /// - public double Item0; - - /// - /// The value of the second component of this object. - /// - public double Item1; - - /// - /// The value of the third component of this object. - /// - public double Item2; - - /// - /// The value of the fourth component of this object. - /// - public double Item3; - - /// - /// Initializer - /// - /// - /// - /// - /// - public Vec4d(double item0, double item1, double item2, double item3) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - } - - /// - /// Indexer - /// - /// - /// - public double this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 6-Tuple of double (System.Double) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec6d : IVec - { - /// - /// The value of the first component of this object. - /// - public double Item0; - - /// - /// The value of the second component of this object. - /// - public double Item1; - - /// - /// The value of the third component of this object. - /// - public double Item2; - - /// - /// The value of the fourth component of this object. - /// - public double Item3; - - /// - /// The value of the fifth component of this object. - /// - public double Item4; - - /// - /// The value of the sixth component of this object. - /// - public double Item5; - - /// - /// Initializer - /// - /// - /// - /// - /// - /// - /// - public Vec6d(double item0, double item1, double item2, double item3, double item4, double item5) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - Item4 = item4; - Item5 = item5; - } - - /// - /// Indexer - /// - /// - /// - public double this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - case 4: return Item4; - case 5: return Item5; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - case 4: Item4 = value; break; - case 5: Item5 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Vecf.cs b/src/OpenCvSharp/modules/core/Struct/Vecf.cs deleted file mode 100644 index f63e59847..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Vecf.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// 2-Tuple of float (System.Single) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec2f : IVec - { - /// - /// The value of the first component of this object. - /// - public float Item0; - /// - /// The value of the second component of this object. - /// - public float Item1; - - /// - /// Initializer - /// - /// - /// - public Vec2f(float item0, float item1) - { - Item0 = item0; - Item1 = item1; - } - - /// - /// Indexer - /// - /// - /// - public float this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 3-Tuple of float (System.Single) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec3f : IVec - { - /// - /// The value of the first component of this object. - /// - public float Item0; - /// - /// The value of the second component of this object. - /// - public float Item1; - /// - /// The value of the third component of this object. - /// - public float Item2; - - /// - /// Initializer - /// - /// - /// - /// - public Vec3f(float item0, float item1, float item2) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - } - - /// - /// Indexer - /// - /// - /// - public float this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of float (System.Single) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec4f : IVec - { - /// - /// The value of the first component of this object. - /// - public float Item0; - - /// - /// The value of the second component of this object. - /// - public float Item1; - - /// - /// The value of the third component of this object. - /// - public float Item2; - - /// - /// The value of the fourth component of this object. - /// - public float Item3; - - /// - /// Initializer - /// - /// - /// - /// - /// - public Vec4f(float item0, float item1, float item2, float item3) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - } - - /// - /// Indexer - /// - /// - /// - public float this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 6-Tuple of float (System.Single) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec6f : IVec - { - /// - /// The value of the first component of this object. - /// - public float Item0; - - /// - /// The value of the second component of this object. - /// - public float Item1; - - /// - /// The value of the third component of this object. - /// - public float Item2; - - /// - /// The value of the fourth component of this object. - /// - public float Item3; - - /// - /// The value of the fifth component of this object. - /// - public float Item4; - - /// - /// The value of the sixth component of this object. - /// - public float Item5; - - /// - /// Initializer - /// - /// - /// - /// - /// - /// - /// - public Vec6f(float item0, float item1, float item2, float item3, float item4, float item5) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - Item4 = item4; - Item5 = item5; - } - - /// - /// Indexer - /// - /// - /// - public float this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - case 4: return Item4; - case 5: return Item5; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - case 4: Item4 = value; break; - case 5: Item5 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Veci.cs b/src/OpenCvSharp/modules/core/Struct/Veci.cs deleted file mode 100644 index 3bbd17c84..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Veci.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// 2-Tuple of int (System.Int32) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec2i : IVec - { - /// - /// The value of the first component of this object. - /// - public int Item0; - /// - /// The value of the second component of this object. - /// - public int Item1; - - /// - /// Initializer - /// - /// - /// - public Vec2i(int item0, int item1) - { - Item0 = item0; - Item1 = item1; - } - - /// - /// Indexer - /// - /// - /// - public int this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 3-Tuple of int (System.Int32) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec3i : IVec - { - /// - /// The value of the first component of this object. - /// - public int Item0; - /// - /// The value of the second component of this object. - /// - public int Item1; - /// - /// The value of the third component of this object. - /// - public int Item2; - - /// - /// Initializer - /// - /// - /// - /// - public Vec3i(int item0, int item1, int item2) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - } - - /// - /// Indexer - /// - /// - /// - public int this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of int (System.Int32) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec4i : IVec - { - /// - /// The value of the first component of this object. - /// - public int Item0; - - /// - /// The value of the second component of this object. - /// - public int Item1; - - /// - /// The value of the third component of this object. - /// - public int Item2; - - /// - /// The value of the fourth component of this object. - /// - public int Item3; - - /// - /// Initializer - /// - /// - /// - /// - /// - public Vec4i(int item0, int item1, int item2, int item3) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - } - - /// - /// Indexer - /// - /// - /// - public int this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 6-Tuple of int (System.Int32) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec6i : IVec - { - /// - /// The value of the first component of this object. - /// - public int Item0; - - /// - /// The value of the second component of this object. - /// - public int Item1; - - /// - /// The value of the third component of this object. - /// - public int Item2; - - /// - /// The value of the fourth component of this object. - /// - public int Item3; - - /// - /// The value of the fourth component of this object. - /// - public int Item4; - - /// - /// The value of the sixth component of this object. - /// - public int Item5; - - /// - /// Initializer - /// - /// - /// - /// - /// - /// - /// - public Vec6i(int item0, int item1, int item2, int item3, int item4, int item5) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - Item4 = item4; - Item5 = item5; - } - - /// - /// Indexer - /// - /// - /// - public int this[int i] - { - get - { - switch (i) - { - case 0: return Item0; - case 1: return Item1; - case 2: return Item2; - case 3: return Item3; - case 4: return Item4; - case 5: return Item5; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: Item0 = value; break; - case 1: Item1 = value; break; - case 2: Item2 = value; break; - case 3: Item3 = value; break; - case 4: Item4 = value; break; - case 5: Item5 = value; break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } -} diff --git a/src/OpenCvSharp/modules/core/Struct/Vecs.cs b/src/OpenCvSharp/modules/core/Struct/Vecs.cs deleted file mode 100644 index b92a0098f..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Vecs.cs +++ /dev/null @@ -1,347 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// 2-Tuple of short (System.Int16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec2s : IVec - { - /// - /// The value of the first component of this object. - /// - public short Item0; - - /// - /// The value of the second component of this object. - /// - public short Item1; - - /// - /// Initializer - /// - /// - /// - public Vec2s(short item0, short item1) - { - Item0 = item0; - Item1 = item1; - } - - /// - /// Indexer - /// - /// - /// - public short this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 3-Tuple of short (System.Int16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec3s : IVec - { - /// - /// The value of the first component of this object. - /// - public short Item0; - - /// - /// The value of the second component of this object. - /// - public short Item1; - - /// - /// The value of the third component of this object. - /// - public short Item2; - - /// - /// Initializer - /// - /// - /// - /// - public Vec3s(short item0, short item1, short item2) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - } - - /// - /// Indexer - /// - /// - /// - public short this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - case 2: - return Item2; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - case 2: - Item2 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of short (System.Int16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec4s : IVec - { - /// - /// The value of the first component of this object. - /// - public short Item0; - - /// - /// The value of the second component of this object. - /// - public short Item1; - - /// - /// The value of the third component of this object. - /// - public short Item2; - - /// - /// The value of the fourth component of this object. - /// - public short Item3; - - /// - /// Initializer - /// - /// - /// - /// - /// - public Vec4s(short item0, short item1, short item2, short item3) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - } - - /// - /// Indexer - /// - /// - /// - public short this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - case 2: - return Item2; - case 3: - return Item3; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - case 2: - Item2 = value; - break; - case 3: - Item3 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 6-Tuple of short (System.Int16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec6s : IVec - { - /// - /// The value of the first component of this object. - /// - public short Item0; - - /// - /// The value of the second component of this object. - /// - public short Item1; - - /// - /// The value of the third component of this object. - /// - public short Item2; - - /// - /// The value of the fourth component of this object. - /// - public short Item3; - - /// - /// The value of the fifth component of this object. - /// - public short Item4; - - /// - /// The value of the sixth component of this object. - /// - public short Item5; - - /// - /// Initializer - /// - /// - /// - /// - /// - /// - /// - public Vec6s(short item0, short item1, short item2, short item3, short item4, short item5) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - Item4 = item4; - Item5 = item5; - } - - /// - /// Indexer - /// - /// - /// - public short this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - case 2: - return Item2; - case 3: - return Item3; - case 4: - return Item4; - case 5: - return Item5; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - case 2: - Item2 = value; - break; - case 3: - Item3 = value; - break; - case 4: - Item4 = value; - break; - case 5: - Item5 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/core/Struct/Vecw.cs b/src/OpenCvSharp/modules/core/Struct/Vecw.cs deleted file mode 100644 index c32ed45d2..000000000 --- a/src/OpenCvSharp/modules/core/Struct/Vecw.cs +++ /dev/null @@ -1,347 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// 2-Tuple of ushort (System.UInt16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec2w : IVec - { - /// - /// The value of the first component of this object. - /// - public ushort Item0; - - /// - /// The value of the second component of this object. - /// - public ushort Item1; - - /// - /// Initializer - /// - /// - /// - public Vec2w(ushort item0, ushort item1) - { - Item0 = item0; - Item1 = item1; - } - - /// - /// Indexer - /// - /// - /// - public ushort this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 3-Tuple of ushort (System.UInt16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec3w : IVec - { - /// - /// The value of the first component of this object. - /// - public ushort Item0; - - /// - /// The value of the second component of this object. - /// - public ushort Item1; - - /// - /// The value of the third component of this object. - /// - public ushort Item2; - - /// - /// Initializer - /// - /// - /// - /// - public Vec3w(ushort item0, ushort item1, ushort item2) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - } - - /// - /// Indexer - /// - /// - /// - public ushort this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - case 2: - return Item2; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - case 2: - Item2 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of ushort (System.UInt16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec4w : IVec - { - /// - /// The value of the first component of this object. - /// - public ushort Item0; - - /// - /// The value of the second component of this object. - /// - public ushort Item1; - - /// - /// The value of the third component of this object. - /// - public ushort Item2; - - /// - /// The value of the fourth component of this object. - /// - public ushort Item3; - - /// - /// Initializer - /// - /// - /// - /// - /// - public Vec4w(ushort item0, ushort item1, ushort item2, ushort item3) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - } - - /// - /// Indexer - /// - /// - /// - public ushort this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - case 2: - return Item2; - case 3: - return Item3; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - case 2: - Item2 = value; - break; - case 3: - Item3 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } - - /// - /// 4-Tuple of ushort (System.UInt16) - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Vec6w : IVec - { - /// - /// The value of the first component of this object. - /// - public ushort Item0; - - /// - /// The value of the second component of this object. - /// - public ushort Item1; - - /// - /// The value of the third component of this object. - /// - public ushort Item2; - - /// - /// The value of the fourth component of this object. - /// - public ushort Item3; - - /// - /// The value of the fifth component of this object. - /// - public ushort Item4; - - /// - /// The value of the sixth component of this object. - /// - public ushort Item5; - - /// - /// Initializer - /// - /// - /// - /// - /// - /// - /// - public Vec6w(ushort item0, ushort item1, ushort item2, ushort item3, ushort item4, ushort item5) - { - Item0 = item0; - Item1 = item1; - Item2 = item2; - Item3 = item3; - Item4 = item4; - Item5 = item5; - } - - /// - /// Indexer - /// - /// - /// - public ushort this[int i] - { - get - { - switch (i) - { - case 0: - return Item0; - case 1: - return Item1; - case 2: - return Item2; - case 3: - return Item3; - case 4: - return Item4; - case 5: - return Item5; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - set - { - switch (i) - { - case 0: - Item0 = value; - break; - case 1: - Item1 = value; - break; - case 2: - Item2 = value; - break; - case 3: - Item3 = value; - break; - case 4: - Item4 = value; - break; - case 5: - Item5 = value; - break; - default: - throw new ArgumentOutOfRangeException(nameof(i)); - } - } - } - } -} diff --git a/src/OpenCvSharp/modules/cuda/DeviceInfo.cs b/src/OpenCvSharp/modules/cuda/DeviceInfo.cs deleted file mode 100644 index 5a428a0ab..000000000 --- a/src/OpenCvSharp/modules/cuda/DeviceInfo.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Cuda -{ - /// - /// Gives information about the given GPU - /// - public sealed class DeviceInfo : DisposableGpuObject - { - /// - /// Creates DeviceInfo object for the current GPU - /// - public DeviceInfo() - { - Cv2.ThrowIfGpuNotAvailable(); - ptr = NativeMethods.cuda_DeviceInfo_new1(); - } - - /// - /// Creates DeviceInfo object for the given GPU - /// - /// - public DeviceInfo(int deviceId) - { - Cv2.ThrowIfGpuNotAvailable(); - ptr = NativeMethods.cuda_DeviceInfo_new2(deviceId); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.cuda_DeviceInfo_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// - /// - public int DeviceId - { - get - { - return NativeMethods.cuda_DeviceInfo_deviceID(ptr); - } - } - - /// - /// - /// - public string Name - { - get - { - var buf = new StringBuilder(1 << 16); - NativeMethods.cuda_DeviceInfo_name(ptr, buf, buf.Capacity); - return buf.ToString(); - } - } - - /// - /// Return compute capability versions - /// - public int MajorVersion - { - get - { - return NativeMethods.cuda_DeviceInfo_majorVersion(ptr); - } - } - - /// - /// Return compute capability versions - /// - public int MinorVersion - { - get - { - return NativeMethods.cuda_DeviceInfo_minorVersion(ptr); - } - } - - /// - /// - /// - public int MultiProcessorCount - { - get - { - return NativeMethods.cuda_DeviceInfo_multiProcessorCount(ptr); - } - } - - /// - /// - /// - public long SharedMemPerBlock - { - get - { - return (long)NativeMethods.cuda_DeviceInfo_sharedMemPerBlock(ptr); - } - } - - /// - /// - /// - public void QueryMemory(out long totalMemory, out long freeMemory) - { - ulong t, f; - NativeMethods.cuda_DeviceInfo_queryMemory(ptr, out t, out f); - totalMemory = (long)t; - freeMemory = (long)f; - } - - /// - /// - /// - public long FreeMemory - { - get - { - return (long)NativeMethods.cuda_DeviceInfo_freeMemory(ptr); - } - } - - /// - /// - /// - public long TotalMemory - { - get - { - return (long)NativeMethods.cuda_DeviceInfo_totalMemory(ptr); - } - } - - /// - /// Checks whether device supports the given feature - /// - /// - /// - public bool Supports(FeatureSet featureSet) - { - return NativeMethods.cuda_DeviceInfo_supports(ptr, (int)featureSet) != 0; - } - - /// - /// Checks whether the GPU module can be run on the given device - /// - /// - public bool IsCompatible - { - get - { - return NativeMethods.cuda_DeviceInfo_isCompatible(ptr) != 0; - } - } - - /// - /// - /// - /// - public bool CanMapHostMemory - { - get - { - return NativeMethods.cuda_DeviceInfo_canMapHostMemory(ptr) != 0; - } - } - } -} diff --git a/src/OpenCvSharp/modules/face/FaceRecognizer.cs b/src/OpenCvSharp/modules/face/FaceRecognizer.cs deleted file mode 100644 index be7f01efd..000000000 --- a/src/OpenCvSharp/modules/face/FaceRecognizer.cs +++ /dev/null @@ -1,306 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp.Face -{ - /// - /// Abstract base class for all face recognition models. - /// All face recognition models in OpenCV are derived from the abstract base class FaceRecognizer, which - /// provides a unified access to all face recongition algorithms in OpenCV. - /// - public class FaceRecognizer : Algorithm - { - /// - /// - /// - private Ptr recognizerPtr; - - #region Init & Disposal - - /// - /// - /// - protected FaceRecognizer() - { - recognizerPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static FaceRecognizer FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(FaceRecognizer)}> pointer"); - var ptrObj = new Ptr(ptr); - var detector = new FaceRecognizer - { - recognizerPtr = ptrObj, - ptr = ptrObj.Get() - }; - return detector; - } - - /// - /// - /// - /// - /// - /// - public static BasicFaceRecognizer CreateEigenFaceRecognizer(int numComponents = 0, double threshold = Double.MaxValue) - { - IntPtr p = NativeMethods.face_createEigenFaceRecognizer(numComponents, threshold); - return BasicFaceRecognizer.FromPtr(p); - } - - /// - /// - /// - /// - /// - /// - public static BasicFaceRecognizer CreateFisherFaceRecognizer( - int numComponents = 0, double threshold = Double.MaxValue) - { - IntPtr p = NativeMethods.face_createFisherFaceRecognizer(numComponents, threshold); - return BasicFaceRecognizer.FromPtr(p); - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static LBPHFaceRecognizer CreateLBPHFaceRecognizer(int radius = 1, int neighbors = 8, - int gridX = 8, int gridY = 8, double threshold = Double.MaxValue) - { - IntPtr p = NativeMethods.face_createLBPHFaceRecognizer(radius, neighbors, gridX, gridY, threshold); - return LBPHFaceRecognizer.FromPtr(p); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - recognizerPtr?.Dispose(); - recognizerPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// Trains a FaceRecognizer with given data and associated labels. - /// - /// - /// - public virtual void Train(IEnumerable src, IEnumerable labels) - { - ThrowIfDisposed(); - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - IntPtr[] srcArray = EnumerableEx.SelectPtrs(src); - int[] labelsArray = EnumerableEx.ToArray(labels); - NativeMethods.face_FaceRecognizer_train( - ptr, srcArray, srcArray.Length, labelsArray, labelsArray.Length); - } - - /// - /// Updates a FaceRecognizer with given data and associated labels. - /// - /// - /// - public void Update(IEnumerable src, IEnumerable labels) - { - ThrowIfDisposed(); - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (labels == null) - throw new ArgumentNullException(nameof(labels)); - IntPtr[] srcArray = EnumerableEx.SelectPtrs(src); - int[] labelsArray = EnumerableEx.ToArray(labels); - NativeMethods.face_FaceRecognizer_update( - ptr, srcArray, srcArray.Length, labelsArray, labelsArray.Length); - } - - /// - /// Gets a prediction from a FaceRecognizer. - /// - /// - /// - public virtual int Predict(InputArray src) - { - ThrowIfDisposed(); - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - return NativeMethods.face_FaceRecognizer_predict1(ptr, src.CvPtr); - } - - /// - /// Predicts the label and confidence for a given sample. - /// - /// - /// - /// - public virtual void Predict(InputArray src, out int label, out double confidence) - { - ThrowIfDisposed(); - if (src == null) - throw new ArgumentNullException(nameof(src)); - src.ThrowIfDisposed(); - NativeMethods.face_FaceRecognizer_predict2(ptr, src.CvPtr, out label, out confidence); - } - - /// - /// Serializes this object to a given filename. - /// - /// - public new virtual void Save(string fileName) - { - ThrowIfDisposed(); - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - NativeMethods.face_FaceRecognizer_save1(ptr, fileName); - } - - /// - /// Deserializes this object from a given filename. - /// - /// - public virtual void Load(string fileName) - { - ThrowIfDisposed(); - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - NativeMethods.face_FaceRecognizer_load1(ptr, fileName); - } - - /// - /// Serializes this object to a given cv::FileStorage. - /// - /// - public virtual void Save(FileStorage fs) - { - ThrowIfDisposed(); - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - NativeMethods.face_FaceRecognizer_save2(ptr, fs.CvPtr); - } - - /// - /// Deserializes this object from a given cv::FileStorage. - /// - /// - public virtual void Load(FileStorage fs) - { - ThrowIfDisposed(); - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - NativeMethods.face_FaceRecognizer_load2(ptr, fs.CvPtr); - } - - /// - /// Sets string info for the specified model's label. - /// The string info is replaced by the provided value if it was set before for the specified label. - /// - /// - /// - public void SetLabelInfo(int label, string strInfo) - { - ThrowIfDisposed(); - if (strInfo == null) - throw new ArgumentNullException(nameof(strInfo)); - NativeMethods.face_FaceRecognizer_setLabelInfo(ptr, label, strInfo); - } - - /// - /// Gets string information by label. - /// If an unknown label id is provided or there is no label information associated with the specified - /// label id the method returns an empty string. - /// - /// - /// - public string GetLabelInfo(int label) - { - ThrowIfDisposed(); - using (var resultVector = new VectorOfByte()) - { - NativeMethods.face_FaceRecognizer_getLabelInfo(ptr, label, resultVector.CvPtr); - return StringHelper.PtrToStringAnsi(resultVector.ElemPtr); - } - } - - /// - /// Gets vector of labels by string. - /// The function searches for the labels containing the specified sub-string in the associated string info. - /// - /// - /// - public int[] GetLabelsByString(string str) - { - ThrowIfDisposed(); - if (str == null) - throw new ArgumentNullException(nameof(str)); - using (var resultVector = new VectorOfInt32()) - { - NativeMethods.face_FaceRecognizer_getLabelsByString(ptr, str, resultVector.CvPtr); - return resultVector.ToArray(); - } - } - - /// - /// threshold parameter accessor - required for default BestMinDist collector - /// - /// - public double GetThreshold() - { - ThrowIfDisposed(); - return NativeMethods.face_FaceRecognizer_getThreshold(ptr); - } - - /// - /// Sets threshold of model - /// - /// - public void SetThreshold(double val) - { - ThrowIfDisposed(); - NativeMethods.face_FaceRecognizer_setThreshold(ptr, val); - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.face_Ptr_FaceRecognizer_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.face_FaceRecognizer_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/features2d/AKAZE.cs b/src/OpenCvSharp/modules/features2d/AKAZE.cs deleted file mode 100644 index 6e4fddfed..000000000 --- a/src/OpenCvSharp/modules/features2d/AKAZE.cs +++ /dev/null @@ -1,220 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - -#if LANG_JP - /// - /// AKAZE 実装 - /// -#else - /// - /// Class implementing the AKAZE keypoint detector and descriptor extractor, - /// described in @cite ANB13 - /// - /// - /// AKAZE descriptors can only be used with KAZE or AKAZE keypoints. - /// Try to avoid using *extract* and *detect* instead of *operator()* due to performance reasons. - /// .. [ANB13] Fast Explicit Diffusion for Accelerated Features in Nonlinear Scale - /// Spaces. Pablo F. Alcantarilla, Jesús Nuevo and Adrien Bartoli. - /// In British Machine Vision Conference (BMVC), Bristol, UK, September 2013. - /// -#endif - // ReSharper disable once InconsistentNaming - public class AKAZE : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected AKAZE(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// The AKAZE constructor - /// - /// - /// - /// - /// - /// - /// - /// - public static AKAZE Create( - OpenCvSharp.AKAZEDescriptorType descriptorType = OpenCvSharp.AKAZEDescriptorType.MLDB, - int descriptorSize = 0, - int descriptorChannels = 3, - float threshold = 0.001f, - int nOctaves = 4, - int nOctaveLayers = 4, - KAZEDiffusivity diffusivity = KAZEDiffusivity.DiffPmG2) - { - IntPtr ptr = NativeMethods.features2d_AKAZE_create( - (int) descriptorType, descriptorSize, descriptorChannels, - threshold, nOctaves, nOctaveLayers, (int) diffusivity); - return new AKAZE(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public AKAZEDescriptorType AKAZEDescriptorType // avoid name conflict - { - get - { - ThrowIfDisposed(); - return (AKAZEDescriptorType)NativeMethods.features2d_AKAZE_getDescriptorType(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setDescriptorType(ptr, (int)value); - } - } - - /// - /// - /// - public int AKAZEDescriptorSize // avoid name conflict - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AKAZE_getDescriptorSize(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setDescriptorSize(ptr, value); - } - } - - /// - /// - /// - public int AKAZEDescriptorChannels // avoid name conflict - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AKAZE_getDescriptorChannels(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setDescriptorChannels(ptr, value); - } - } - - /// - /// - /// - public double Threshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AKAZE_getThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setThreshold(ptr, value); - } - } - - /// - /// - /// - public int NOctaves - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AKAZE_getNOctaves(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setNOctaves(ptr, value); - } - } - - /// - /// - /// - public int NOctaveLayers - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AKAZE_getNOctaveLayers(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setNOctaveLayers(ptr, value); - } - } - - /// - /// - /// - public int Diffusivity - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AKAZE_getDiffusivity(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AKAZE_setDiffusivity(ptr, value); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_AKAZE_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_AKAZE_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/AgastFeatureDetector.cs b/src/OpenCvSharp/modules/features2d/AgastFeatureDetector.cs deleted file mode 100644 index 7f7a81b48..000000000 --- a/src/OpenCvSharp/modules/features2d/AgastFeatureDetector.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// AGAST 実装 - /// -#else - /// - /// Detects corners using the AGAST algorithm - /// -#endif - public class AgastFeatureDetector : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - -#pragma warning disable 1591 - public const int - AGAST_5_8 = 0, - AGAST_7_12d = 1, - AGAST_7_12s = 2, - OAST_9_16 = 3, - THRESHOLD = 10000, - NONMAX_SUPPRESSION = 10001; -#pragma warning restore 1591 - - #region Init & Disposal - - /// - /// - /// - protected AgastFeatureDetector(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// The AgastFeatureDetector constructor - /// - /// threshold on difference between intensity of the central pixel - /// and pixels of a circle around this pixel. - /// if true, non-maximum suppression is applied to detected corners (keypoints). - /// - public static AgastFeatureDetector Create( int threshold=10, - bool nonmaxSuppression=true, - AGASTType type = AGASTType.OAST_9_16) - { - IntPtr ptr = NativeMethods.features2d_AgastFeatureDetector_create( - threshold, nonmaxSuppression ? 1 : 0, (int)type); - return new AgastFeatureDetector(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// threshold on difference between intensity of the central pixel and pixels of a circle around this pixel. - /// - public int Threshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AgastFeatureDetector_getThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AgastFeatureDetector_setThreshold(ptr, value); - } - } - - /// - /// if true, non-maximum suppression is applied to detected corners (keypoints). - /// - public int NonmaxSuppression - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_AgastFeatureDetector_getNonmaxSuppression(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AgastFeatureDetector_setNonmaxSuppression(ptr, value); - } - } - - /// - /// type one of the four neighborhoods as defined in the paper - /// - public AGASTType Type - { - get - { - ThrowIfDisposed(); - return (AGASTType)NativeMethods.features2d_AgastFeatureDetector_getType(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_AgastFeatureDetector_setType(ptr, (int)value); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_AgastFeatureDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_AgastFeatureDetector_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/BFMatcher.cs b/src/OpenCvSharp/modules/features2d/BFMatcher.cs deleted file mode 100644 index ae2f92f42..000000000 --- a/src/OpenCvSharp/modules/features2d/BFMatcher.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Brute-force descriptor matcher. - /// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. - /// - public class BFMatcher : DescriptorMatcher - { - private Ptr detectorPtr; - - //internal override IntPtr PtrObj => detectorPtr.CvPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - public BFMatcher(NormTypes normType = NormTypes.L2, bool crossCheck = false) - { - ptr = NativeMethods.features2d_BFMatcher_new((int) normType, crossCheck ? 1 : 0); - detectorPtr = null; - } - - /// - /// Creates instance by cv::Ptr<T> - /// - internal BFMatcher(Ptr detectorPtr) - { - this.detectorPtr = detectorPtr; - this.ptr = detectorPtr.Get(); - } - - /// - /// Creates instance by raw pointer T* - /// - internal BFMatcher(IntPtr rawPtr) - { - detectorPtr = null; - ptr = rawPtr; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal new static BFMatcher FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid cv::Ptr pointer"); - var ptrObj = new Ptr(ptr); - return new BFMatcher(ptrObj); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - if (detectorPtr != null) - { - detectorPtr.Dispose(); - detectorPtr = null; - ptr = IntPtr.Zero; - } - base.DisposeManaged(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeUnmanaged() - { - if (detectorPtr == null && ptr != IntPtr.Zero) - NativeMethods.features2d_BFMatcher_delete(ptr); - ptr = IntPtr.Zero; - base.DisposeUnmanaged(); - } - - #endregion - - #region Methods - - /// - /// Return true if the matcher supports mask in match methods. - /// - /// - public override bool IsMaskSupported() - { - ThrowIfDisposed(); - return NativeMethods.features2d_BFMatcher_isMaskSupported(ptr) != 0; - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_BFMatcher_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_BFMatcher_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/BOWImgDescriptorExtractor.cs b/src/OpenCvSharp/modules/features2d/BOWImgDescriptorExtractor.cs deleted file mode 100644 index bcf3898d0..000000000 --- a/src/OpenCvSharp/modules/features2d/BOWImgDescriptorExtractor.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Brute-force descriptor matcher. - /// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. - /// - public class BOWImgDescriptorExtractor : DisposableCvObject - { - /// - /// The constructor. - /// - /// Descriptor extractor that is used to compute descriptors for an input image and its keypoints. - /// Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image. - public BOWImgDescriptorExtractor(Feature2D dextractor, DescriptorMatcher dmatcher) - { - if (dextractor == null) - throw new ArgumentNullException(nameof(dextractor)); - if (dmatcher == null) - throw new ArgumentNullException(nameof(dmatcher)); - - ptr = NativeMethods.features2d_BOWImgDescriptorExtractor_new1_RawPtr(dextractor.CvPtr, dmatcher.CvPtr); - - GC.KeepAlive(dextractor); - GC.KeepAlive(dmatcher); - } - - /// - /// The constructor. - /// - /// Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image. - public BOWImgDescriptorExtractor(DescriptorMatcher dmatcher) - { - if (dmatcher == null) - throw new ArgumentNullException(nameof(dmatcher)); - - ptr = NativeMethods.features2d_BOWImgDescriptorExtractor_new2_RawPtr(dmatcher.CvPtr); - GC.KeepAlive(dmatcher); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_BOWImgDescriptorExtractor_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// Sets a visual vocabulary. - /// - /// Vocabulary (can be trained using the inheritor of BOWTrainer ). - /// Each row of the vocabulary is a visual word(cluster center). - public void SetVocabulary(Mat vocabulary) - { - ThrowIfDisposed(); - if (vocabulary == null) - throw new ArgumentNullException(nameof(vocabulary)); - NativeMethods.features2d_BOWImgDescriptorExtractor_setVocabulary(ptr, vocabulary.CvPtr); - GC.KeepAlive(vocabulary); - } - - /// - /// Returns the set vocabulary. - /// - /// - public Mat GetVocabulary() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.features2d_BOWImgDescriptorExtractor_getVocabulary(ptr); - return new Mat(p); - } - - /// - /// Computes an image descriptor using the set visual vocabulary. - /// - /// Image, for which the descriptor is computed. - /// Keypoints detected in the input image. - /// Computed output image descriptor. - /// pointIdxsOfClusters Indices of keypoints that belong to the cluster. - /// This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster(word of vocabulary) returned if it is non-zero. - /// Descriptors of the image keypoints that are returned if they are non-zero. - public void Compute(InputArray image, ref KeyPoint[] keypoints, OutputArray imgDescriptor, - out int[][] pointIdxsOfClusters, Mat descriptors = null) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (imgDescriptor == null) - throw new ArgumentNullException(nameof(imgDescriptor)); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - using (var pointIdxsOfClustersVec = new VectorOfVectorInt()) - { - NativeMethods.features2d_BOWImgDescriptorExtractor_compute11(ptr, image.CvPtr, keypointsVec.CvPtr, - imgDescriptor.CvPtr, pointIdxsOfClustersVec.CvPtr, Cv2.ToPtr(descriptors)); - keypoints = keypointsVec.ToArray(); - pointIdxsOfClusters = pointIdxsOfClustersVec.ToArray(); - } - GC.KeepAlive(image); - GC.KeepAlive(imgDescriptor); - GC.KeepAlive(descriptors); - } - - /// - /// Computes an image descriptor using the set visual vocabulary. - /// - /// Computed descriptors to match with vocabulary. - /// Computed output image descriptor. - /// Indices of keypoints that belong to the cluster. - /// This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster(word of vocabulary) returned if it is non-zero. - public void Compute(InputArray keypointDescriptors, OutputArray imgDescriptor, out int[][] pointIdxsOfClusters) - { - ThrowIfDisposed(); - if (keypointDescriptors == null) - throw new ArgumentNullException(nameof(keypointDescriptors)); - if (imgDescriptor == null) - throw new ArgumentNullException(nameof(imgDescriptor)); - - using (var pointIdxsOfClustersVec = new VectorOfVectorInt()) - { - NativeMethods.features2d_BOWImgDescriptorExtractor_compute12( - ptr, keypointDescriptors.CvPtr, imgDescriptor.CvPtr, pointIdxsOfClustersVec.CvPtr); - pointIdxsOfClusters = pointIdxsOfClustersVec.ToArray(); - } - GC.KeepAlive(keypointDescriptors); - GC.KeepAlive(imgDescriptor); - } - - /// - /// Computes an image descriptor using the set visual vocabulary. - /// - /// Image, for which the descriptor is computed. - /// Keypoints detected in the input image. - /// Computed output image descriptor. - public void Compute2(Mat image, ref KeyPoint[] keypoints, Mat imgDescriptor) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (imgDescriptor == null) - throw new ArgumentNullException(nameof(imgDescriptor)); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_BOWImgDescriptorExtractor_compute2( - ptr, image.CvPtr, keypointsVec.CvPtr, imgDescriptor.CvPtr); - keypoints = keypointsVec.ToArray(); - } - GC.KeepAlive(image); - GC.KeepAlive(imgDescriptor); - } - - /// - /// Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0. - /// - /// - public int DescriptorSize() - { - ThrowIfDisposed(); - return NativeMethods.features2d_BOWImgDescriptorExtractor_descriptorSize(ptr); - } - - /// - /// Returns an image descriptor type. - /// - /// - public int DescriptorType() - { - ThrowIfDisposed(); - return NativeMethods.features2d_BOWImgDescriptorExtractor_descriptorType(ptr); - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/BOWKMeansTrainer.cs b/src/OpenCvSharp/modules/features2d/BOWKMeansTrainer.cs deleted file mode 100644 index 775db8447..000000000 --- a/src/OpenCvSharp/modules/features2d/BOWKMeansTrainer.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Brute-force descriptor matcher. - /// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. - /// - public class BOWKMeansTrainer : BOWTrainer - { - /// - /// - /// - /// - /// - /// - /// - public BOWKMeansTrainer(int clusterCount, TermCriteria? termcrit = null, - int attempts = 3, KMeansFlags flags = KMeansFlags.PpCenters) - { - var termCritValue = termcrit.GetValueOrDefault(new TermCriteria()); - ptr = NativeMethods.features2d_BOWKMeansTrainer_new(clusterCount, termCritValue, attempts, (int)flags); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_BOWKMeansTrainer_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// Clusters train descriptors. - /// - /// - public override Mat Cluster() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.features2d_BOWKMeansTrainer_cluster1(ptr); - return new Mat(p); - } - - /// - /// Clusters train descriptors. - /// - /// Descriptors to cluster. Each row of the descriptors matrix is a descriptor. Descriptors are not added to the inner train descriptor set. - /// The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object - /// are clustered.In the second variant, input descriptors are clustered. - /// - public override Mat Cluster(Mat descriptors) - { - ThrowIfDisposed(); - descriptors.ThrowIfDisposed(); - IntPtr p = NativeMethods.features2d_BOWKMeansTrainer_cluster2(ptr, descriptors.CvPtr); - GC.KeepAlive(descriptors); - return new Mat(p); - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/BOWTrainer.cs b/src/OpenCvSharp/modules/features2d/BOWTrainer.cs deleted file mode 100644 index 1e1330bc8..000000000 --- a/src/OpenCvSharp/modules/features2d/BOWTrainer.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Brute-force descriptor matcher. - /// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. - /// - public abstract class BOWTrainer : DisposableCvObject - { - /// - /// Adds descriptors to a training set. - /// - /// descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a descriptor. - /// The training set is clustered using clustermethod to construct the vocabulary. - public void Add(Mat descriptors) - { - if (descriptors == null) - throw new ArgumentNullException(nameof(descriptors)); - NativeMethods.features2d_BOWTrainer_add(ptr, descriptors.CvPtr); - GC.KeepAlive(descriptors); - } - - /// - /// Returns a training set of descriptors. - /// - /// - public Mat[] GetDescriptors() - { - using (var descriptors = new VectorOfMat()) - { - NativeMethods.features2d_BOWTrainer_getDescriptors(ptr, descriptors.CvPtr); - return descriptors.ToArray(); - } - } - - /// - /// Returns the count of all descriptors stored in the training set. - /// - /// - public int DescriptorsCount() - { - return NativeMethods.features2d_BOWTrainer_descriptorsCount(ptr); - } - - /// - /// - /// - public virtual void Clear() - { - NativeMethods.features2d_BOWTrainer_clear(ptr); - } - - /// - /// Clusters train descriptors. - /// - /// - public abstract Mat Cluster(); - - /// - /// Clusters train descriptors. - /// - /// Descriptors to cluster. Each row of the descriptors matrix is a descriptor. Descriptors are not added to the inner train descriptor set. - /// The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object - /// are clustered.In the second variant, input descriptors are clustered. - /// - public abstract Mat Cluster(Mat descriptors); - } -} diff --git a/src/OpenCvSharp/modules/features2d/BRISK.cs b/src/OpenCvSharp/modules/features2d/BRISK.cs deleted file mode 100644 index 664b4a345..000000000 --- a/src/OpenCvSharp/modules/features2d/BRISK.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - -#if LANG_JP - /// - /// BRISK 実装 - /// -#else - /// - /// BRISK implementation - /// -#endif - // ReSharper disable once InconsistentNaming - public class BRISK : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected BRISK() - : base() - { - } - - /// - /// - /// - /// - protected BRISK(IntPtr p) - : base() - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// - /// - /// - /// - /// - public static BRISK Create(int thresh = 30, int octaves = 3, float patternScale = 1.0f) - { - IntPtr p = NativeMethods.features2d_BRISK_create1(thresh, octaves, patternScale); - return new BRISK(p); - } - - /// - /// custom setup - /// - /// - /// - /// - /// - /// - /// - public static BRISK Create( - IEnumerable radiusList, IEnumerable numberList, - float dMax = 5.85f, float dMin = 8.2f, - IEnumerable indexChange = null) - { - if (radiusList == null) - throw new ArgumentNullException(nameof(radiusList)); - if (numberList == null) - throw new ArgumentNullException(nameof(numberList)); - float[] radiusListArray = EnumerableEx.ToArray(radiusList); - int[] numberListArray = EnumerableEx.ToArray(numberList); - int[] indexChangeArray = EnumerableEx.ToArray(indexChange); - - IntPtr p = NativeMethods.features2d_BRISK_create2( - radiusListArray, radiusListArray.Length, - numberListArray, numberListArray.Length, - dMax, dMin, - indexChangeArray, indexChangeArray.Length); - return new BRISK(p); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_BRISK_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_BRISK_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/DescriptorMatcher.cs b/src/OpenCvSharp/modules/features2d/DescriptorMatcher.cs deleted file mode 100644 index 35fa75e97..000000000 --- a/src/OpenCvSharp/modules/features2d/DescriptorMatcher.cs +++ /dev/null @@ -1,395 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// - /// - public class DescriptorMatcher : Algorithm - { - /// - /// - /// - private Ptr detectorPtr; - - //internal virtual IntPtr PtrObj => detectorPtr.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected DescriptorMatcher() - { - detectorPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Create descriptor matcher by type name. - /// - /// - /// - public static DescriptorMatcher Create(string descriptorMatcherType) - { - if (String.IsNullOrEmpty(descriptorMatcherType)) - throw new ArgumentNullException(nameof(descriptorMatcherType)); - - switch (descriptorMatcherType) - { - case "FlannBased": - return new FlannBasedMatcher(); - - case "BruteForce": // L2 - return new BFMatcher(NormTypes.L2); - - case "BruteForce-SL2": // Squared L2 - return new BFMatcher(NormTypes.L2SQR); - - case "BruteForce-L1": - return new BFMatcher(NormTypes.L1); - - case "BruteForce-Hamming": - case "BruteForce-HammingLUT": - return new BFMatcher(NormTypes.Hamming); - - case "BruteForce-Hamming(2)": - return new BFMatcher(NormTypes.Hamming2); - - default: - throw new OpenCvSharpException("Unknown matcher name '{0}'", descriptorMatcherType); - } - /* - IntPtr ptr; - try - { - ptr = NativeMethods.features2d_FeatureDetector_create(descriptorMatcherType); - } - catch (OpenCvSharpException) - { - throw new OpenCvSharpException( - "matcher name '{0}' is not valid.", descriptorMatcherType); - } - return FromPtr(ptr);*/ - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static DescriptorMatcher FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid cv::Ptr pointer"); - var ptrObj = new Ptr(ptr); - var detector = new DescriptorMatcher - { - detectorPtr = ptrObj, - ptr = ptrObj.Get() - }; - return detector; - } - - /// - /// Creates instance from raw pointer T* - /// - /// - internal static DescriptorMatcher FromRawPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid DescriptorMatcher pointer"); - var detector = new DescriptorMatcher - { - detectorPtr = null, - ptr = ptr - }; - return detector; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// Add descriptors to train descriptor collection. - /// - /// Descriptors to add. Each descriptors[i] is a descriptors set from one image. - public virtual void Add(IEnumerable descriptors) - { - ThrowIfDisposed(); - if (descriptors == null) - throw new ArgumentNullException(nameof(descriptors)); - - Mat[] descriptorsArray = EnumerableEx.ToArray(descriptors); - if (descriptorsArray.Length == 0) - return; - - IntPtr[] descriptorsPtrs = EnumerableEx.SelectPtrs(descriptorsArray); - NativeMethods.features2d_DescriptorMatcher_add(ptr, descriptorsPtrs, descriptorsPtrs.Length); - } - - /// - /// Get train descriptors collection. - /// - /// - public Mat[] GetTrainDescriptors() - { - ThrowIfDisposed(); - using (var matVec = new VectorOfMat()) - { - NativeMethods.features2d_DescriptorMatcher_getTrainDescriptors(ptr, matVec.CvPtr); - return matVec.ToArray(); - } - } - - /// - /// Clear train descriptors collection. - /// - public virtual void Clear() - { - ThrowIfDisposed(); - NativeMethods.features2d_DescriptorMatcher_clear(ptr); - } - - /// - /// Return true if there are not train descriptors in collection. - /// - /// - public virtual new bool Empty() - { - ThrowIfDisposed(); - return NativeMethods.features2d_DescriptorMatcher_empty(ptr) != 0; - } - - /// - /// Return true if the matcher supports mask in match methods. - /// - /// - public virtual bool IsMaskSupported() - { - ThrowIfDisposed(); - return NativeMethods.features2d_DescriptorMatcher_isMaskSupported(ptr) != 0; - } - - /// - /// Train matcher (e.g. train flann index). - /// In all methods to match the method train() is run every time before matching. - /// Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation - /// of this method, other matchers really train their inner structures - /// (e.g. FlannBasedMatcher trains flann::Index). So nonempty implementation - /// of train() should check the class object state and do traing/retraining - /// only if the state requires that (e.g. FlannBasedMatcher trains flann::Index - /// if it has not trained yet or if new descriptors have been added to the train collection). - /// - public virtual void Train() - { - ThrowIfDisposed(); - NativeMethods.features2d_DescriptorMatcher_train(ptr); - } - - #region *Match - - /// - /// Find one best match for each query descriptor (if mask is empty). - /// - /// - /// - /// - /// - public DMatch[] Match(Mat queryDescriptors, Mat trainDescriptors, Mat mask = null) - { - ThrowIfDisposed(); - if (queryDescriptors == null) - throw new ArgumentNullException(nameof(queryDescriptors)); - if (trainDescriptors == null) - throw new ArgumentNullException(nameof(trainDescriptors)); - using (var matchesVec = new VectorOfDMatch()) - { - NativeMethods.features2d_DescriptorMatcher_match1( - ptr, queryDescriptors.CvPtr, trainDescriptors.CvPtr, - matchesVec.CvPtr, Cv2.ToPtr(mask)); - return matchesVec.ToArray(); - } - } - - /// - /// Find k best matches for each query descriptor (in increasing order of distances). - /// compactResult is used when mask is not empty. If compactResult is false matches - /// vector will have the same size as queryDescriptors rows. If compactResult is true - /// matches vector will not contain matches for fully masked out query descriptors. - /// - /// - /// - /// - /// - /// - /// - public DMatch[][] KnnMatch(Mat queryDescriptors, Mat trainDescriptors, - int k, Mat mask = null, bool compactResult = false) - { - ThrowIfDisposed(); - if (queryDescriptors == null) - throw new ArgumentNullException(nameof(queryDescriptors)); - if (trainDescriptors == null) - throw new ArgumentNullException(nameof(trainDescriptors)); - using (var matchesVec = new VectorOfVectorDMatch()) - { - NativeMethods.features2d_DescriptorMatcher_knnMatch1( - ptr, queryDescriptors.CvPtr, trainDescriptors.CvPtr, - matchesVec.CvPtr, k, Cv2.ToPtr(mask), compactResult ? 1 : 0); - return matchesVec.ToArray(); - } - } - - /// - /// Find best matches for each query descriptor which have distance less than - /// maxDistance (in increasing order of distances). - /// - /// - /// - /// - /// - /// - /// - public DMatch[][] RadiusMatch(Mat queryDescriptors, Mat trainDescriptors, - float maxDistance, Mat mask = null, bool compactResult = false) - { - ThrowIfDisposed(); - if (queryDescriptors == null) - throw new ArgumentNullException(nameof(queryDescriptors)); - if (trainDescriptors == null) - throw new ArgumentNullException(nameof(trainDescriptors)); - using (var matchesVec = new VectorOfVectorDMatch()) - { - NativeMethods.features2d_DescriptorMatcher_radiusMatch1( - ptr, queryDescriptors.CvPtr, trainDescriptors.CvPtr, - matchesVec.CvPtr, maxDistance, Cv2.ToPtr(mask), compactResult ? 1 : 0); - return matchesVec.ToArray(); - } - } - - /// - /// Find one best match for each query descriptor (if mask is empty). - /// - /// - /// - /// - public DMatch[] Match(Mat queryDescriptors, Mat[] masks = null) - { - ThrowIfDisposed(); - if (queryDescriptors == null) - throw new ArgumentNullException(nameof(queryDescriptors)); - - var masksPtrs = new IntPtr[0]; - if (masks != null) - { - masksPtrs = EnumerableEx.SelectPtrs(masks); - } - - using (var matchesVec = new VectorOfDMatch()) - { - NativeMethods.features2d_DescriptorMatcher_match2( - ptr, queryDescriptors.CvPtr, matchesVec.CvPtr, masksPtrs, masksPtrs.Length); - return matchesVec.ToArray(); - } - } - - /// - /// Find k best matches for each query descriptor (in increasing order of distances). - /// compactResult is used when mask is not empty. If compactResult is false matches - /// vector will have the same size as queryDescriptors rows. If compactResult is true - /// matches vector will not contain matches for fully masked out query descriptors. - /// - /// - /// - /// - /// - /// - public DMatch[][] KnnMatch(Mat queryDescriptors, int k, Mat[] masks = null, bool compactResult = false) - { - ThrowIfDisposed(); - if (queryDescriptors == null) - throw new ArgumentNullException(nameof(queryDescriptors)); - - var masksPtrs = new IntPtr[0]; - if (masks != null) - { - masksPtrs = EnumerableEx.SelectPtrs(masks); - } - - using (var matchesVec = new VectorOfVectorDMatch()) - { - NativeMethods.features2d_DescriptorMatcher_knnMatch2( - ptr, queryDescriptors.CvPtr, matchesVec.CvPtr, k, - masksPtrs, masksPtrs.Length, compactResult ? 1 : 0); - return matchesVec.ToArray(); - } - } - - /// - /// Find best matches for each query descriptor which have distance less than - /// maxDistance (in increasing order of distances). - /// - /// - /// - /// - /// - /// - public DMatch[][] RadiusMatch(Mat queryDescriptors, float maxDistance, Mat[] masks = null, bool compactResult = false) - { - ThrowIfDisposed(); - if (queryDescriptors == null) - throw new ArgumentNullException(nameof(queryDescriptors)); - - var masksPtrs = new IntPtr[0]; - if (masks != null) - { - masksPtrs = EnumerableEx.SelectPtrs(masks); - } - - using (var matchesVec = new VectorOfVectorDMatch()) - { - NativeMethods.features2d_DescriptorMatcher_radiusMatch2( - ptr, queryDescriptors.CvPtr, matchesVec.CvPtr, maxDistance, - masksPtrs, masksPtrs.Length, compactResult ? 1 : 0); - return matchesVec.ToArray(); - } - } - - #endregion - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_DescriptorMatcher_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_DescriptorMatcher_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/Enum/AGASTType.cs b/src/OpenCvSharp/modules/features2d/Enum/AGASTType.cs deleted file mode 100644 index 7fa19c79b..000000000 --- a/src/OpenCvSharp/modules/features2d/Enum/AGASTType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming -#pragma warning disable 1591 - - /// - /// AGAST type one of the four neighborhoods as defined in the paper - /// - public enum AGASTType : int - { - AGAST_5_8 = 0, - AGAST_7_12d = 1, - AGAST_7_12s = 2, - OAST_9_16 = 3, - } -} diff --git a/src/OpenCvSharp/modules/features2d/Enum/AKAZEDescriptorType.cs b/src/OpenCvSharp/modules/features2d/Enum/AKAZEDescriptorType.cs deleted file mode 100644 index 13d796396..000000000 --- a/src/OpenCvSharp/modules/features2d/Enum/AKAZEDescriptorType.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// cv::AKAZE descriptor type - /// - - public enum AKAZEDescriptorType : int - { - /// - /// Upright descriptors, not invariant to rotation - /// - KAZEUpright = 2, - - /// - /// - /// - KAZE = 3, - - /// - /// - /// - MLDBUpright = 4, - - /// - /// Upright descriptors, not invariant to rotation - /// - MLDB = 5 - } -} diff --git a/src/OpenCvSharp/modules/features2d/Enum/DrawMatchesFlags.cs b/src/OpenCvSharp/modules/features2d/Enum/DrawMatchesFlags.cs deleted file mode 100644 index ba39ff0af..000000000 --- a/src/OpenCvSharp/modules/features2d/Enum/DrawMatchesFlags.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// - /// - [Flags] - public enum DrawMatchesFlags : int - { - /// - /// Output image matrix will be created (Mat::create), - /// i.e. existing memory of output image may be reused. - /// Two source image, matches and single keypoints will be drawn. - /// For each keypoint only the center point will be drawn (without - /// the circle around keypoint with keypoint size and orientation). - /// - Default = 0, - - /// - /// Output image matrix will not be created (Mat::create). - /// Matches will be drawn on existing content of output image. - /// - DrawOverOutImg = 1, - - /// - /// Single keypoints will not be drawn. - /// - NotDrawSinglePoints = 2, - - /// - /// For each keypoint the circle around keypoint with keypoint size and - /// orientation will be drawn. - /// - DrawRichKeypoints = 4 - } -} - - diff --git a/src/OpenCvSharp/modules/features2d/Enum/FASTType.cs b/src/OpenCvSharp/modules/features2d/Enum/FASTType.cs deleted file mode 100644 index ea9775d37..000000000 --- a/src/OpenCvSharp/modules/features2d/Enum/FASTType.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming -#pragma warning disable 1591 - - /// - /// AGAST type one of the four neighborhoods as defined in the paper - /// - public enum FASTType : int - { - TYPE_5_8 = 0, - TYPE_7_12 = 1, - TYPE_9_16 = 2, - } -} diff --git a/src/OpenCvSharp/modules/features2d/Enum/KAZEDiffusivity.cs b/src/OpenCvSharp/modules/features2d/Enum/KAZEDiffusivity.cs deleted file mode 100644 index 96cc3ca82..000000000 --- a/src/OpenCvSharp/modules/features2d/Enum/KAZEDiffusivity.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// cv::KAZE diffusivity type - /// -// ReSharper disable once InconsistentNaming - public enum KAZEDiffusivity : int - { - /// - /// - /// - DiffPmG1 = 0, - - /// - /// - /// - DiffPmG2 = 1, - - /// - /// - /// - DiffWeickert = 2, - - /// - /// - /// - DiffCharbonnier = 3, - } -} diff --git a/src/OpenCvSharp/modules/features2d/Enum/ORBScore.cs b/src/OpenCvSharp/modules/features2d/Enum/ORBScore.cs deleted file mode 100644 index 403136d54..000000000 --- a/src/OpenCvSharp/modules/features2d/Enum/ORBScore.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - - -namespace OpenCvSharp -{ - /// - /// cv::ORB score flags - /// - public enum ORBScore : int - { - /// - /// - /// - Fast = 1, - - /// - /// - /// - Harris = 0, - } -} diff --git a/src/OpenCvSharp/modules/features2d/FastFeatureDetector.cs b/src/OpenCvSharp/modules/features2d/FastFeatureDetector.cs deleted file mode 100644 index 77ed68226..000000000 --- a/src/OpenCvSharp/modules/features2d/FastFeatureDetector.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// Detects corners using FAST algorithm by E. Rosten - /// -#else - /// - /// Detects corners using FAST algorithm by E. Rosten - /// -#endif - public class FastFeatureDetector : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected FastFeatureDetector(IntPtr ptr) - { - ptrObj = new Ptr(ptr); - ptr = ptrObj.Get(); - } - - /// - /// - /// - /// - /// - public static FastFeatureDetector Create(int threshold = 10, bool nonmaxSuppression = true) - { - IntPtr ptr = NativeMethods.features2d_FastFeatureDetector_create(threshold, nonmaxSuppression ? 1 : 0); - return new FastFeatureDetector(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int Threshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_FastFeatureDetector_getThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_FastFeatureDetector_setThreshold(ptr, value); - } - } - - /// - /// - /// - public bool NonmaxSuppression - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_FastFeatureDetector_getNonmaxSuppression(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_FastFeatureDetector_setNonmaxSuppression(ptr, value ? 1 : 0); - } - } - - /// - /// - /// - public int Type - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_FastFeatureDetector_getType(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_FastFeatureDetector_setType(ptr, value); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_FastFeatureDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_FastFeatureDetector_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/Feature2D.cs b/src/OpenCvSharp/modules/features2d/Feature2D.cs deleted file mode 100644 index 4a16c7028..000000000 --- a/src/OpenCvSharp/modules/features2d/Feature2D.cs +++ /dev/null @@ -1,311 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// Abstract base class for 2D image feature detectors and descriptor extractors - /// - public class Feature2D : Algorithm - { - /// - /// cv::Ptr<T> - /// - private Ptr ptrObj; - - //internal virtual IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - internal Feature2D() - { - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static Feature2D FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid cv::Ptr pointer"); - var ptrObj = new Ptr(ptr); - var detector = new Feature2D - { - ptrObj = ptrObj, - ptr = ptrObj.Get() - }; - return detector; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - /// - public virtual int DescriptorSize - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_Feature2D_descriptorSize(ptr); - } - } - - /// - /// - /// - /// - public virtual int DescriptorType - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_Feature2D_descriptorType(ptr); - } - } - - /// - /// - /// - /// - public virtual int DefaultNorm - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_Feature2D_defaultNorm(ptr); - } - } - - #endregion - - #region Methods - - /// - /// Return true if detector object is empty - /// - /// - public new virtual bool Empty() - { - ThrowIfDisposed(); - return NativeMethods.features2d_Feature2D_empty(ptr) != 0; - } - - /// - /// Detect keypoints in an image. - /// - /// The image. - /// Mask specifying where to look for keypoints (optional). - /// Must be a char matrix with non-zero values in the region of interest. - /// The detected keypoints. - public KeyPoint[] Detect(Mat image, Mat mask = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - ThrowIfDisposed(); - - image.ThrowIfDisposed(); - try - { - using (var keypoints = new VectorOfKeyPoint()) - { - NativeMethods.features2d_Feature2D_detect_Mat1(ptr, image.CvPtr, keypoints.CvPtr, Cv2.ToPtr(mask)); - return keypoints.ToArray(); - } - } - finally - { - GC.KeepAlive(image); - GC.KeepAlive(mask); - } - } - - /// - /// Detect keypoints in an image. - /// - /// The image. - /// Mask specifying where to look for keypoints (optional). - /// Must be a char matrix with non-zero values in the region of interest. - /// The detected keypoints. - public KeyPoint[] Detect(InputArray image, Mat mask = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - ThrowIfDisposed(); - - image.ThrowIfDisposed(); - try - { - using (var keypoints = new VectorOfKeyPoint()) - { - NativeMethods.features2d_Feature2D_detect_InputArray(ptr, image.CvPtr, keypoints.CvPtr, - Cv2.ToPtr(mask)); - return keypoints.ToArray(); - } - } - finally - { - GC.KeepAlive(image); - GC.KeepAlive(mask); - } - } - - /// - /// Detect keypoints in an image set. - /// - /// Image collection. - /// Masks for image set. masks[i] is a mask for images[i]. - /// Collection of keypoints detected in an input images. keypoints[i] is a set of keypoints detected in an images[i]. - public KeyPoint[][] Detect(IEnumerable images, IEnumerable masks = null) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - ThrowIfDisposed(); - - Mat[] imagesArray = EnumerableEx.ToArray(images); - IntPtr[] imagesPtr = new IntPtr[imagesArray.Length]; - for (int i = 0; i < imagesArray.Length; i++) - imagesPtr[i] = imagesArray[i].CvPtr; - - using (var keypoints = new VectorOfVectorKeyPoint()) - { - if (masks == null) - { - NativeMethods.features2d_Feature2D_detect_Mat2( - ptr, imagesPtr, imagesArray.Length, keypoints.CvPtr, null); - } - else - { - IntPtr[] masksPtr = EnumerableEx.SelectPtrs(masks); - if (masksPtr.Length != imagesArray.Length) - throw new ArgumentException("masks.Length != images.Length"); - NativeMethods.features2d_Feature2D_detect_Mat2( - ptr, imagesPtr, imagesArray.Length, keypoints.CvPtr, masksPtr); - } - return keypoints.ToArray(); - } - } - - /// - /// Compute the descriptors for a set of keypoints in an image. - /// - /// The image. - /// The input keypoints. Keypoints for which a descriptor cannot be computed are removed. - /// Copmputed descriptors. Row i is the descriptor for keypoint i.param> - public virtual void Compute(InputArray image, ref KeyPoint[] keypoints, OutputArray descriptors) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - ThrowIfDisposed(); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_Feature2D_compute1(ptr, image.CvPtr, keypointsVec.CvPtr, descriptors.CvPtr); - keypoints = keypointsVec.ToArray(); - } - } - - /// - /// Compute the descriptors for a keypoints collection detected in image collection. - /// - /// Image collection. - /// Input keypoints collection. keypoints[i] is keypoints detected in images[i]. - /// Keypoints for which a descriptor cannot be computed are removed. - /// Descriptor collection. descriptors[i] are descriptors computed for set keypoints[i]. - public virtual void Compute(IEnumerable images, ref KeyPoint[][] keypoints, IEnumerable descriptors) - { - ThrowIfDisposed(); - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (descriptors == null) - throw new ArgumentNullException(nameof(descriptors)); - - IntPtr[] imagesPtrs = EnumerableEx.SelectPtrs(images); - IntPtr[] descriptorsPtrs = EnumerableEx.SelectPtrs(descriptors); - - using (var keypointsVec = new VectorOfVectorKeyPoint(keypoints)) - { - NativeMethods.features2d_Feature2D_compute2( - ptr, imagesPtrs, imagesPtrs.Length, keypointsVec.CvPtr, - descriptorsPtrs, descriptorsPtrs.Length); - - keypoints = keypointsVec.ToArray(); - } - } - - /// - /// Detects keypoints and computes the descriptors - /// - /// - /// - /// - /// - /// - public virtual void DetectAndCompute( - InputArray image, - InputArray mask, - out KeyPoint[] keypoints, - OutputArray descriptors, - bool useProvidedKeypoints = false) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (descriptors == null) - throw new ArgumentNullException(nameof(descriptors)); - image.ThrowIfDisposed(); - if (mask != null) - mask.ThrowIfDisposed(); - - using (var keypointsVec = new VectorOfKeyPoint()) - { - NativeMethods.features2d_Feature2D_detectAndCompute( - ptr, image.CvPtr, Cv2.ToPtr(mask), keypointsVec.CvPtr, descriptors.CvPtr, useProvidedKeypoints ? 1 : 0); - keypoints = keypointsVec.ToArray(); - } - - GC.KeepAlive(image); - GC.KeepAlive(mask); - descriptors.Fix(); - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_Feature2D_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_Feature2D_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/FlannBasedMatcher.cs b/src/OpenCvSharp/modules/features2d/FlannBasedMatcher.cs deleted file mode 100644 index 841ff7045..000000000 --- a/src/OpenCvSharp/modules/features2d/FlannBasedMatcher.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Flann; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Brute-force descriptor matcher. - /// For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. - /// - public class FlannBasedMatcher : DescriptorMatcher - { - private Ptr detectorPtr; - private IndexParams indexParams; - private SearchParams searchParams; - - //internal override IntPtr PtrObj => detectorPtr.CvPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - public FlannBasedMatcher(IndexParams indexParams = null, SearchParams searchParams = null) - { - indexParams?.ThrowIfDisposed(); - searchParams?.ThrowIfDisposed(); - - IntPtr indexParamsPtr = indexParams?.PtrObj.CvPtr ?? IntPtr.Zero; - IntPtr searchParamsPtr = searchParams?.PtrObj.CvPtr ?? IntPtr.Zero; - ptr = NativeMethods.features2d_FlannBasedMatcher_new(indexParamsPtr, searchParamsPtr); - this.indexParams = indexParams; - this.searchParams = searchParams; - } - - /// - /// Creates instance by cv::Ptr<T> - /// - internal FlannBasedMatcher(Ptr detectorPtr) - { - this.detectorPtr = detectorPtr; - this.ptr = detectorPtr.Get(); - } - - /// - /// Creates instance by raw pointer T* - /// - internal FlannBasedMatcher(IntPtr rawPtr) - { - detectorPtr = null; - ptr = rawPtr; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal new static FlannBasedMatcher FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid cv::Ptr pointer"); - var ptrObj = new Ptr(ptr); - return new FlannBasedMatcher(ptrObj); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - if (detectorPtr != null) - { - detectorPtr.Dispose(); - detectorPtr = null; - ptr = IntPtr.Zero; - } - base.DisposeManaged(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeUnmanaged() - { - if (detectorPtr == null && ptr != IntPtr.Zero) - NativeMethods.features2d_FlannBasedMatcher_delete(ptr); - indexParams = null; - searchParams = null; - ptr = IntPtr.Zero; - base.DisposeUnmanaged(); - } - - #endregion - - #region Methods - - /// - /// Return true if the matcher supports mask in match methods. - /// - /// - public override bool IsMaskSupported() - { - ThrowIfDisposed(); - return NativeMethods.features2d_FlannBasedMatcher_isMaskSupported(ptr) != 0; - } - - /// - /// Add descriptors to train descriptor collection. - /// - /// Descriptors to add. Each descriptors[i] is a descriptors set from one image. - public override void Add(IEnumerable descriptors) - { - ThrowIfDisposed(); - if (descriptors == null) - throw new ArgumentNullException(nameof(descriptors)); - - Mat[] descriptorsArray = EnumerableEx.ToArray(descriptors); - if (descriptorsArray.Length == 0) - return; - - IntPtr[] descriptorsPtrs = EnumerableEx.SelectPtrs(descriptorsArray); - NativeMethods.features2d_DescriptorMatcher_add(ptr, descriptorsPtrs, descriptorsPtrs.Length); - } - - /// - /// Clear train descriptors collection. - /// - public override void Clear() - { - ThrowIfDisposed(); - NativeMethods.features2d_FlannBasedMatcher_clear(ptr); - } - - /// - /// Train matcher (e.g. train flann index). - /// In all methods to match the method train() is run every time before matching. - /// Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation - /// of this method, other matchers really train their inner structures - /// (e.g. FlannBasedMatcher trains flann::Index). So nonempty implementation - /// of train() should check the class object state and do traing/retraining - /// only if the state requires that (e.g. FlannBasedMatcher trains flann::Index - /// if it has not trained yet or if new descriptors have been added to the train collection). - /// - public override void Train() - { - ThrowIfDisposed(); - NativeMethods.features2d_FlannBasedMatcher_train(ptr); - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_FlannBasedMatcher_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_FlannBasedMatcher_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/GFTTDetector.cs b/src/OpenCvSharp/modules/features2d/GFTTDetector.cs deleted file mode 100644 index c7cdeec7c..000000000 --- a/src/OpenCvSharp/modules/features2d/GFTTDetector.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Good Features To Track Detector - /// - public class GFTTDetector : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static GFTTDetector Create( - int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 1, - int blockSize = 3, bool useHarrisDetector = false, double k = 0.04) - { - IntPtr ptr = NativeMethods.features2d_GFTTDetector_create( - maxCorners, qualityLevel, minDistance, - blockSize, useHarrisDetector ? 1 : 0, k); - return new GFTTDetector(ptr); - } - - /// - /// - /// - /// - protected GFTTDetector(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int MaxFeatures - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_GFTTDetector_getMaxFeatures(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_GFTTDetector_setMaxFeatures(ptr, value); - } - } - - /// - /// - /// - public double QualityLevel - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_GFTTDetector_getQualityLevel(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_GFTTDetector_setQualityLevel(ptr, value); - } - } - - /// - /// - /// - public double MinDistance - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_GFTTDetector_getMinDistance(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_GFTTDetector_setMinDistance(ptr, value); - } - } - - - /// - /// - /// - public int BlockSize - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_GFTTDetector_getBlockSize(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_GFTTDetector_setBlockSize(ptr, value); - } - } - - - /// - /// - /// - public bool HarrisDetector - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_GFTTDetector_getHarrisDetector(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_GFTTDetector_setHarrisDetector(ptr, value ? 1 : 0); - } - } - - - /// - /// - /// - public double K - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_GFTTDetector_getK(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_GFTTDetector_setK(ptr, value); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_GFTTDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_GFTTDetector_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/KAZE.cs b/src/OpenCvSharp/modules/features2d/KAZE.cs deleted file mode 100644 index d72a04795..000000000 --- a/src/OpenCvSharp/modules/features2d/KAZE.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - -#if LANG_JP - /// - /// KAZE 実装 - /// -#else - /// - /// Class implementing the KAZE keypoint detector and descriptor extractor - /// -#endif - // ReSharper disable once InconsistentNaming - public class KAZE : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected KAZE(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// The KAZE constructor - /// - /// Set to enable extraction of extended (128-byte) descriptor. - /// Set to enable use of upright descriptors (non rotation-invariant). - /// Detector response threshold to accept point - /// Maximum octave evolution of the image - /// Default number of sublevels per scale level - /// Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or DIFF_CHARBONNIER - public static KAZE Create( - bool extended = false, bool upright = false, float threshold = 0.001f, - int nOctaves = 4, int nOctaveLayers = 4, KAZEDiffusivity diffusivity = KAZEDiffusivity.DiffPmG2) - { - IntPtr ptr = NativeMethods.features2d_KAZE_create( - extended, upright, threshold, - nOctaves, nOctaveLayers, (int) diffusivity); - return new KAZE(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int Diffusivity - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_KAZE_getDiffusivity(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_KAZE_setDiffusivity(ptr, value); - } - } - - /// - /// - /// - public bool Extended - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_KAZE_getExtended(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_KAZE_setExtended(ptr, value); - } - } - - - /// - /// - /// - public int NOctaveLayers - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_KAZE_getNOctaveLayers(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_KAZE_setNOctaveLayers(ptr, value); - } - } - - - /// - /// - /// - public int NOctaves - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_KAZE_getNOctaves(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_KAZE_setNOctaves(ptr, value); - } - } - - - /// - /// - /// - public double Threshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_KAZE_getThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_KAZE_setThreshold(ptr, value); - } - } - - - /// - /// - /// - public bool Upright - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_KAZE_getUpright(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_KAZE_setUpright(ptr, value); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_KAZE_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_KAZE_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/KeyPointsFilter.cs b/src/OpenCvSharp/modules/features2d/KeyPointsFilter.cs deleted file mode 100644 index 77e57b42d..000000000 --- a/src/OpenCvSharp/modules/features2d/KeyPointsFilter.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// A class filters a vector of keypoints. - /// - public static class KeyPointsFilter - { - /// - /// Remove keypoints within borderPixels of an image edge. - /// - /// - /// - /// - /// - public static KeyPoint[] RunByImageBorder(IEnumerable keypoints, Size imageSize, int borderSize) - { - if (keypoints == null) - throw new ArgumentNullException(nameof(keypoints)); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_KeyPointsFilter_runByImageBorder( - keypointsVec.CvPtr, imageSize, borderSize); - return keypointsVec.ToArray(); - } - } - - /// - /// Remove keypoints of sizes out of range. - /// - /// - /// - /// - /// - public static KeyPoint[] RunByKeypointSize(IEnumerable keypoints, float minSize, - float maxSize = Single.MaxValue) - { - if (keypoints == null) - throw new ArgumentNullException(nameof(keypoints)); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_KeyPointsFilter_runByKeypointSize( - keypointsVec.CvPtr, minSize, maxSize); - return keypointsVec.ToArray(); - } - } - - /// - /// Remove keypoints from some image by mask for pixels of this image. - /// - /// - /// - /// - public static KeyPoint[] RunByPixelsMask(IEnumerable keypoints, Mat mask) - { - if (keypoints == null) - throw new ArgumentNullException(nameof(keypoints)); - if (mask == null) - throw new ArgumentNullException(nameof(mask)); - mask.ThrowIfDisposed(); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_KeyPointsFilter_runByPixelsMask( - keypointsVec.CvPtr, mask.CvPtr); - GC.KeepAlive(mask); - return keypointsVec.ToArray(); - } - } - - /// - /// Remove duplicated keypoints. - /// - /// - /// - public static KeyPoint[] RemoveDuplicated(IEnumerable keypoints) - { - if (keypoints == null) - throw new ArgumentNullException(nameof(keypoints)); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_KeyPointsFilter_removeDuplicated(keypointsVec.CvPtr); - return keypointsVec.ToArray(); - } - } - - /// - /// Retain the specified number of the best keypoints (according to the response) - /// - /// - /// - /// - public static KeyPoint[] RetainBest(IEnumerable keypoints, int npoints) - { - if (keypoints == null) - throw new ArgumentNullException(nameof(keypoints)); - - using (var keypointsVec = new VectorOfKeyPoint(keypoints)) - { - NativeMethods.features2d_KeyPointsFilter_retainBest( - keypointsVec.CvPtr, npoints); - return keypointsVec.ToArray(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/MSER.cs b/src/OpenCvSharp/modules/features2d/MSER.cs deleted file mode 100644 index edb54be19..000000000 --- a/src/OpenCvSharp/modules/features2d/MSER.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -// ReSharper disable once InconsistentNaming - -#if LANG_JP - /// - /// MSER (Maximal Stable Extremal Regions) 抽出機 - /// -#else - /// - /// Maximal Stable Extremal Regions class - /// -#endif - // ReSharper disable once InconsistentNaming - public class MSER : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// Creates instance by raw pointer cv::MSER* - /// - protected MSER(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - -#if LANG_JP - /// - /// MSERのパラメータを生成する - /// - /// delta, in the code, it compares (size_{i}-size_{i-delta})/size_{i-delta} - /// prune the area which smaller than min_area - /// prune the area which bigger than max_area - /// prune the area have simliar size to its children - /// trace back to cut off mser with diversity < min_diversity - /// for color image, the evolution steps - /// the area threshold to cause re-initialize - /// ignore too small margin - /// the aperture size for edge blur -#else - /// - /// Creates MSER parameters - /// - /// delta, in the code, it compares (size_{i}-size_{i-delta})/size_{i-delta} - /// prune the area which smaller than min_area - /// prune the area which bigger than max_area - /// prune the area have simliar size to its children - /// trace back to cut off mser with diversity < min_diversity - /// for color image, the evolution steps - /// the area threshold to cause re-initialize - /// ignore too small margin - /// the aperture size for edge blur -#endif - public static MSER Create( - int delta = 5, - int minArea = 60, - int maxArea = 14400, - double maxVariation = 0.25, - double minDiversity = 0.2, - int maxEvolution = 200, - double areaThreshold = 1.01, - double minMargin = 0.003, - int edgeBlurSize = 5) - { - IntPtr ptr = NativeMethods.features2d_MSER_create(delta, minArea, maxArea, maxVariation, minDiversity, - maxEvolution, areaThreshold, minMargin, edgeBlurSize); - return new MSER(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int Delta - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_MSER_getDelta(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_MSER_setDelta(ptr, value); - } - } - - /// - /// - /// - public int MinArea - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_MSER_getMinArea(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_MSER_setMinArea(ptr, value); - } - } - - /// - /// - /// - public int MaxArea - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_MSER_getMaxArea(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_MSER_setMaxArea(ptr, value); - } - } - - /// - /// - /// - public bool Pass2Only - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_MSER_getPass2Only(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_MSER_setDelta(ptr, value ? 1 : 0); - } - } - - #endregion - - #region Methods - - /// - /// - /// - /// - /// - /// - public virtual void DetectRegions( - InputArray image, out Point[][] msers, out Rect[] bboxes) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - using (var msersVec = new VectorOfVectorPoint()) - using (var bboxesVec = new VectorOfRect()) - { - NativeMethods.features2d_MSER_detectRegions( - ptr, image.CvPtr, msersVec.CvPtr, bboxesVec.CvPtr); - msers = msersVec.ToArray(); - bboxes = bboxesVec.ToArray(); - } - - GC.KeepAlive(image); - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_MSER_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_MSER_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/ORB.cs b/src/OpenCvSharp/modules/features2d/ORB.cs deleted file mode 100644 index 409853ed9..000000000 --- a/src/OpenCvSharp/modules/features2d/ORB.cs +++ /dev/null @@ -1,257 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - -#if LANG_JP - /// - /// ORB 実装 - /// -#else - /// - /// Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor - /// - /// - /// described in @cite RRKB11 . The algorithm uses FAST in pyramids to detect stable keypoints, - /// selects the strongest features using FAST or Harris response, finds their orientation - /// using first-order moments and computes the descriptors using BRIEF (where the coordinates - /// of random point pairs (or k-tuples) are rotated according to the measured orientation). - /// -#endif - // ReSharper disable once InconsistentNaming - public class ORB : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected ORB(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static ORB Create( - int nFeatures = 500, float scaleFactor = 1.2f, int nLevels = 8, - int edgeThreshold = 31, int firstLevel = 0, int wtaK = 2, - ORBScore scoreType = ORBScore.Harris, int patchSize = 31) - { - IntPtr ptr = NativeMethods.features2d_ORB_create( - nFeatures, scaleFactor, nLevels, edgeThreshold, - firstLevel, wtaK, (int)scoreType, patchSize); - return new ORB(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int MaxFeatures - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getMaxFeatures(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setMaxFeatures(ptr, value); - } - } - - /// - /// - /// - public double ScaleFactor - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getScaleFactor(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setScaleFactor(ptr, value); - } - } - - - /// - /// - /// - public int NLevels - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getNLevels(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setNLevels(ptr, value); - } - } - - - /// - /// - /// - public int EdgeThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getEdgeThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setEdgeThreshold(ptr, value); - } - } - - - /// - /// - /// - public int FirstLevel - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getFirstLevel(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setFirstLevel(ptr, value); - } - } - - - /// - /// - /// -// ReSharper disable once InconsistentNaming - public int WTA_K - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getWTA_K(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setWTA_K(ptr, value); - } - } - - - /// - /// - /// - public int ScoreType - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getScoreType(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setScoreType(ptr, value); - } - } - - - /// - /// - /// - public int PatchSize - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getPatchSize(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setPatchSize(ptr, value); - } - } - - - /// - /// - /// - public int FastThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.features2d_ORB_getFastThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.features2d_ORB_setFastThreshold(ptr, value); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_ORB_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_ORB_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/features2d/SimpleBlobDetector.cs b/src/OpenCvSharp/modules/features2d/SimpleBlobDetector.cs deleted file mode 100644 index 323090128..000000000 --- a/src/OpenCvSharp/modules/features2d/SimpleBlobDetector.cs +++ /dev/null @@ -1,233 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ - /// - /// Class for extracting blobs from an image. - /// - public class SimpleBlobDetector : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - /// - /// SimpleBlobDetector parameters - /// - public class Params - { - internal WParams data; - - /// - /// - /// - public Params() - { - data = new WParams - { - thresholdStep = 10, - minThreshold = 50, - maxThreshold = 220, - minRepeatability = 2, - minDistBetweenBlobs = 10, - filterByColor = 1, - blobColor = 0, - filterByArea = 1, - minArea = 25, - maxArea = 5000, - filterByCircularity = 0, - minCircularity = 0.8f, - maxCircularity = Single.MaxValue, - filterByInertia = 1, - minInertiaRatio = 0.1f, - maxInertiaRatio = Single.MaxValue, - filterByConvexity = 1, - minConvexity = 0.95f, - maxConvexity = Single.MaxValue - }; - } - -#pragma warning disable 1591 - public float ThresholdStep - { - get { return data.thresholdStep; } - set { data.thresholdStep = value; } - } - public float MinThreshold - { - get { return data.minThreshold; } - set { data.minThreshold = value; } - } - public float MaxThreshold - { - get { return data.maxThreshold; } - set { data.maxThreshold = value; } - } - public uint MinRepeatability - { - get { return data.minRepeatability; } - set { data.minRepeatability = value; } - } - public float MinDistBetweenBlobs - { - get { return data.minDistBetweenBlobs; } - set { data.minDistBetweenBlobs = value; } - } - - public bool FilterByColor - { - get { return data.filterByColor != 0; } - set { data.filterByColor = (value ? 1 : 0); } - } - public byte BlobColor - { - get { return data.blobColor; } - set { data.blobColor = value; } - } - - public bool FilterByArea - { - get { return data.filterByArea != 0; } - set { data.filterByArea = (value ? 1 : 0); } - } - public float MinArea{ - get { return data.minArea; } - set { data.minArea = value; } - } - public float MaxArea - { - get { return data.maxArea; } - set { data.maxArea = value; } - } - - public bool FilterByCircularity - { - get { return data.filterByCircularity != 0; } - set { data.filterByCircularity = (value ? 1 : 0); } - } - public float MinCircularity{ - get { return data.minCircularity; } - set { data.minCircularity = value; } - } - public float MaxCircularity - { - get { return data.maxCircularity; } - set { data.maxCircularity = value; } - } - - public bool FilterByInertia - { - get { return data.filterByInertia != 0; } - set { data.filterByInertia = (value ? 1 : 0); } - } - public float MinInertiaRatio{ - get { return data.minInertiaRatio; } - set { data.minInertiaRatio = value; } - } - public float MaxInertiaRatio - { - get { return data.maxInertiaRatio; } - set { data.maxInertiaRatio = value; } - } - - public bool FilterByConvexity - { - get { return data.filterByConvexity != 0; } - set { data.filterByConvexity = (value ? 1 : 0); } - } - public float MinConvexity{ - get { return data.minConvexity; } - set { data.minConvexity = value; } - } - public float MaxConvexity - { - get { return data.maxConvexity; } - set { data.maxConvexity = value; } - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct WParams - { - public float thresholdStep; - public float minThreshold; - public float maxThreshold; - public uint minRepeatability; // size_t - public float minDistBetweenBlobs; - - public int filterByColor; - public byte blobColor; - - public int filterByArea; - public float minArea, maxArea; - - public int filterByCircularity; - public float minCircularity, maxCircularity; - - public int filterByInertia; - public float minInertiaRatio, maxInertiaRatio; - - public int filterByConvexity; - public float minConvexity, maxConvexity; -#pragma warning restore 1591 - } - - #region Init & Disposal - - /// - /// - /// - protected SimpleBlobDetector(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// - /// - /// - public static SimpleBlobDetector Create(Params parameters = null) - { - if (parameters == null) - parameters = new Params(); - IntPtr ptr = NativeMethods.features2d_SimpleBlobDetector_create(ref parameters.data); - return new SimpleBlobDetector(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.features2d_Ptr_SimpleBlobDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.features2d_Ptr_SimpleBlobDetector_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/FlannCentersInit.cs b/src/OpenCvSharp/modules/flann/FlannCentersInit.cs deleted file mode 100644 index 7cc86c494..000000000 --- a/src/OpenCvSharp/modules/flann/FlannCentersInit.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ - -#if LANG_JP - /// - /// k-means クラスタリングの初期中心を選択するアルゴリズム. - /// -#else - /// - /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. - /// -#endif - public enum FlannCentersInit : int - { -#if LANG_JP - /// - /// ランダムに初期クラスタ中心を選択 - /// [flann_centers_init_t::CENTERS_RANDOM] - /// -#else - /// - /// picks the initial cluster centers randomly - /// [flann_centers_init_t::CENTERS_RANDOM] - /// -#endif - Random = 0, - -#if LANG_JP - /// - /// Gonzalesのアルゴリズムを用いて初期クラスタ中心を選択 - /// [flann_centers_init_t::CENTERS_GONZALES] - /// -#else - /// - /// picks the initial centers using Gonzales’ algorithm - /// [flann_centers_init_t::CENTERS_GONZALES] - /// -#endif - Gonzales = 1, - -#if LANG_JP - /// - /// arthur_kmeanspp_2007 で提案されたアルゴリズムを用いて初期クラスタ中心を選択 - /// [flann_centers_init_t::CENTERS_KMEANSPP] - /// -#else - /// - /// picks the initial centers using the algorithm suggested in [arthur_kmeanspp_2007] - /// [flann_centers_init_t::CENTERS_KMEANSPP] - /// -#endif - KMeansPP = 2 - - } -} - - diff --git a/src/OpenCvSharp/modules/flann/FlannDistance.cs b/src/OpenCvSharp/modules/flann/FlannDistance.cs deleted file mode 100644 index 7fb22ac76..000000000 --- a/src/OpenCvSharp/modules/flann/FlannDistance.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - - /// - /// - /// - public enum FlannDistance - { - Euclidean = 1, - L2 = 1, - Manhattan = 2, - L1 = 2, - Minkowski = 3, - Max = 4, - HistIntersect = 5, - Hellinger = 6, - ChiSquare = 7, - CS = 7, - KullbackLeibler = 8, - KL = 8, - Hamming = 9, - } -} diff --git a/src/OpenCvSharp/modules/flann/Index.cs b/src/OpenCvSharp/modules/flann/Index.cs deleted file mode 100644 index 5fb908f4c..000000000 --- a/src/OpenCvSharp/modules/flann/Index.cs +++ /dev/null @@ -1,322 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// FLANN 最近傍インデックスクラス - /// -#else - /// - /// The FLANN nearest neighbor index class. - /// -#endif - public class Index : DisposableCvObject - { - #region Init & Disposal - -#if LANG_JP - /// - /// 与えられたデータセットの最近傍探索インデックスを作成します. - /// - /// インデックス作成対象となる特徴(点)が格納された, CV_32F 型の行列.この行列のサイズは matrix is num _ features x feature _ dimensionality となります - /// params – インデックスパラメータを含む構造体.作成されるインデックスの種類は,このパラメータの種類に依存します - /// -#else - /// - /// Constructs a nearest neighbor search index for a given dataset. - /// - /// features – Matrix of type CV _ 32F containing the features(points) to index. The size of the matrix is num _ features x feature _ dimensionality. - /// Structure containing the index parameters. The type of index that will be constructed depends on the type of this parameter. - /// -#endif - public Index(InputArray features, IndexParams @params, FlannDistance distType = FlannDistance.L2) - { - if (features == null) - throw new ArgumentNullException(nameof(features)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - - ptr = NativeMethods.flann_Index_new(features.CvPtr, @params.CvPtr, (int)distType); - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Failed to create Index"); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Index_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Methods - #region KnnSearch -#if LANG_JP - /// - /// 複数のクエリ点に対するk-近傍探索を行います. - /// - /// クエリ点 - /// 求められた最近傍のインデックス - /// 求められた最近傍までの距離 - /// この個数分の最近傍を求めます - /// 探索パラメータ -#else - /// - /// Performs a K-nearest neighbor search for multiple query points. - /// - /// The query points, one per row - /// Indices of the nearest neighbors found - /// Distances to the nearest neighbors found - /// Number of nearest neighbors to search for - /// Search parameters -#endif - public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int knn, SearchParams @params) - { - if (queries == null) - throw new ArgumentNullException(nameof(queries)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - if (queries.Length == 0) - throw new ArgumentException(); - if (knn < 1) - throw new ArgumentOutOfRangeException(nameof(knn)); - - indices = new int[knn]; - dists = new float[knn]; - - NativeMethods.flann_Index_knnSearch1(ptr, queries, queries.Length, indices, dists, knn, @params.CvPtr); - } -#if LANG_JP - /// - /// 複数のクエリ点に対するk-近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します - /// 求められた最近傍のインデックス - /// 求められた最近傍までの距離 - /// この個数分の最近傍を求めます - /// 探索パラメータ -#else - /// - /// Performs a K-nearest neighbor search for multiple query points. - /// - /// The query points, one per row - /// Indices of the nearest neighbors found - /// Distances to the nearest neighbors found - /// Number of nearest neighbors to search for - /// Search parameters -#endif - public void KnnSearch(Mat queries, Mat indices, Mat dists, int knn, SearchParams @params) - { - if (queries == null) - throw new ArgumentNullException(nameof(queries)); - if (indices == null) - throw new ArgumentNullException(nameof(indices)); - if (dists == null) - throw new ArgumentNullException(nameof(dists)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - - NativeMethods.flann_Index_knnSearch2(ptr, queries.CvPtr, indices.CvPtr, dists.CvPtr, knn, @params.CvPtr); - } -#if LANG_JP - /// - /// 複数のクエリ点に対するk-近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します - /// 求められた最近傍のインデックス - /// 求められた最近傍までの距離 - /// この個数分の最近傍を求めます - /// 探索パラメータ -#else - /// - /// Performs a K-nearest neighbor search for multiple query points. - /// - /// The query points, one per row - /// Indices of the nearest neighbors found - /// Distances to the nearest neighbors found - /// Number of nearest neighbors to search for - /// Search parameters -#endif - public void KnnSearch(Mat queries, out int[] indices, out float[] dists, int knn, SearchParams @params) - { - if (queries == null) - throw new ArgumentNullException(nameof(queries)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - if (knn < 1) - throw new ArgumentOutOfRangeException(nameof(knn)); - - indices = new int[knn]; - dists = new float[knn]; - - NativeMethods.flann_Index_knnSearch3(ptr, queries.CvPtr, indices, dists, knn, @params.CvPtr); - } - #endregion - #region RadiusSearch -#if LANG_JP - /// - /// 与えられたクエリ点に対するradius 最近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します [入力] - /// 求められた最近傍のインデックス [出力] - /// 求められた最近傍までの距離 [出力] - /// 探索範囲 - /// - /// 探索パラメータ -#else - /// - /// Performs a radius nearest neighbor search for a given query point. - /// - /// The query point - /// Indices of the nearest neighbors found - /// Distances to the nearest neighbors found - /// Number of nearest neighbors to search for - /// - /// Search parameters -#endif - public void RadiusSearch(float[] queries, int[] indices, float[] dists, float radius, int maxResults, SearchParams @params) - { - if (queries == null) - throw new ArgumentNullException(nameof(queries)); - if (indices == null) - throw new ArgumentNullException(nameof(indices)); - if (dists == null) - throw new ArgumentNullException(nameof(dists)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - - NativeMethods.flann_Index_radiusSearch1(ptr, queries, queries.Length, indices, indices.Length, dists, dists.Length, radius, maxResults, @params.CvPtr); - } -#if LANG_JP - /// - /// 与えられたクエリ点に対するradius 最近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します [入力] - /// 求められた最近傍のインデックス [出力] - /// 求められた最近傍までの距離 [出力] - /// 探索範囲 - /// - /// 探索パラメータ -#else - /// - /// Performs a radius nearest neighbor search for a given query point. - /// - /// The query point - /// Indices of the nearest neighbors found - /// Distances to the nearest neighbors found - /// Number of nearest neighbors to search for - /// - /// Search parameters -#endif - public void RadiusSearch(Mat queries, Mat indices, Mat dists, float radius, int maxResults, SearchParams @params) - { - if (queries == null) - throw new ArgumentNullException(nameof(queries)); - if (indices == null) - throw new ArgumentNullException(nameof(indices)); - if (dists == null) - throw new ArgumentNullException(nameof(dists)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - - NativeMethods.flann_Index_radiusSearch2(ptr, queries.CvPtr, indices.CvPtr, dists.CvPtr, radius, maxResults, @params.CvPtr); - } -#if LANG_JP - /// - /// 与えられたクエリ点に対するradius 最近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します [入力] - /// 求められた最近傍のインデックス [出力] - /// 求められた最近傍までの距離 [出力] - /// 探索範囲 - /// - /// 探索パラメータ -#else - /// - /// Performs a radius nearest neighbor search for a given query point. - /// - /// The query point - /// Indices of the nearest neighbors found - /// Distances to the nearest neighbors found - /// Number of nearest neighbors to search for - /// - /// Search parameters -#endif - public void RadiusSearch(Mat queries, int[] indices, float[] dists, float radius, int maxResults, SearchParams @params) - { - if (queries == null) - throw new ArgumentNullException(nameof(queries)); - if (indices == null) - throw new ArgumentNullException(nameof(indices)); - if (dists == null) - throw new ArgumentNullException(nameof(dists)); - if (@params == null) - throw new ArgumentNullException(nameof(@params)); - - NativeMethods.flann_Index_radiusSearch3(ptr, queries.CvPtr, indices, indices.Length, dists, dists.Length, radius, maxResults, @params.CvPtr); - } - #endregion - #region Save -#if LANG_JP - /// - /// インデックスをファイルに保存します. - /// - /// インデックスを保存するファイル名 -#else - /// - /// Saves the index to a file. - /// - /// The file to save the index to -#endif - public void Save(string filename) - { - if (string.IsNullOrEmpty(filename)) - throw new ArgumentNullException(nameof(filename)); - NativeMethods.flann_Index_save(ptr, filename); - } - #endregion - /* - #region VecLen -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - public int VecLen() - { - return FlannInvoke.flann_Index_veclen(ptr); - } - #endregion - #region Size -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - public int Size() - { - return FlannInvoke.flann_Index_size(ptr); - } - #endregion - //*/ - #endregion - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/AutotunedIndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/AutotunedIndexParams.cs deleted file mode 100644 index 0c98a7d16..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/AutotunedIndexParams.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// 階層型 k-means tree で表現されるインデックス. - /// -#else - /// - /// hierarchical k-means tree. - /// -#endif - public class AutotunedIndexParams : IndexParams - { -#if LANG_JP - /// - /// - /// - /// どれだけ厳密な最近傍を返すかという,最近傍探索の近似の割合を指定する 0から1の間の値.このパラメータが大きくなると,より正確な結果が得られますが,探索時間が長くなります.最適な値は,アプリケーションに依存します - /// 最近傍探索時間に対するインデックスの構築時間の重要度を指定します. - /// その後のインデックス探索時間が高速になるならば,インデックスの構築時間が長くても良いというアプリケーションが存在する一方で,インデックスの探索時間が多少長くなっても,できるだけ高速にインデックスを構築する必要があるアプリケーションもあります - /// これは,(インデックスの構築時間と探索時間)とインデックスの占有メモリとの,トレードオフを指定するのに利用されます. - /// 1より小さい値は消費時間を重要視し,1より大きい値はメモリ使用量を重要視します - /// パラメータの自動設定アルゴリズムにおけるデータ集合の比率を示す,0から1の間の値. - /// 全データ集合を用いてアルゴリズムを実行すると,最も正確な結果が得られますが,巨大なデータ集合に対しては長い計算時間がかかります. - /// このような場合,データをある比率分だけ使うことでアルゴリズムを高速化し,なおかつ,最適なパラメータの良い近似となる結果を得ることができます -#else - /// - /// - /// - /// Is a number between 0 and 1 specifying the percentage of the approximate nearest-neighbor searches that return the exact nearest-neighbor. - /// Using a higher value for this parameter gives more accurate results, but the search takes longer. The optimum value usually depends on the application. - /// Specifies the importance of the index build time raported to the nearest-neighbor search time. - /// In some applications it’s acceptable for the index build step to take a long time if the subsequent searches in the index can be performed very fast. - /// In other applications it’s required that the index be build as fast as possible even if that leads to slightly longer search times. - /// Is used to specify the tradeoff between time (index build time and search time) and memory used by the index. - /// A value less than 1 gives more importance to the time spent and a value greater than 1 gives more importance to the memory usage. - /// Is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. - /// Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. - /// In such case using just a fraction of the data helps speeding up this algorithm while still giving good approximations of the optimum parameters. -#endif - public AutotunedIndexParams(float targetPrecision = 0.9f, float buildWeight = 0.01f, float memoryWeight = 0, float sampleFraction = 0.1f) - { - IntPtr p = NativeMethods.flann_Ptr_AutotunedIndexParams_new(targetPrecision, buildWeight, memoryWeight, sampleFraction); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(AutotunedIndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected AutotunedIndexParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_AutotunedIndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_AutotunedIndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/CompositeIndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/CompositeIndexParams.cs deleted file mode 100644 index 5fabe5017..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/CompositeIndexParams.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// ランダム kd-tree と 階層的 k-means tree の組み合わせでインデックスが表現されます. - /// -#else - /// - /// When using a parameters object of this type the index created combines the randomized kd-trees and the hierarchical k-means tree. - /// -#endif - public class CompositeIndexParams : IndexParams - { -#if LANG_JP - /// - /// - /// - /// 並列な kd-tree の個数.[1..16] の範囲が適切な値です - /// 階層型 k-means tree で利用される branching ファクタ - /// k-means tree を作成する際の,k-means クラスタリングステージでの反復数の上限.ここで -1 は,k-means クラスタリングが収束するまで続けられることを意味します - /// k-means クラスタリングの初期中心を選択するアルゴリズム. - /// このパラメータ(クラスタ境界インデックス)は,階層的 k-means tree の探索方法に影響を与えます. cb_index が0の場合,最も近い中心のクラスタが,次に探索される k-means 領域になります.0より大きい値の場合も,領域サイズが考慮されます -#else - /// - /// - /// - /// The number of parallel kd-trees to use. Good values are in the range [1..16] - /// The branching factor to use for the hierarchical k-means tree - /// The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence - /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. - /// This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When cb_index is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. -#endif - public CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11, - FlannCentersInit centersInit = FlannCentersInit.Random, float cbIndex = 0.2f) - { - IntPtr p = NativeMethods.flann_Ptr_CompositeIndexParams_new(trees, branching, iterations, centersInit, cbIndex); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(AutotunedIndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected CompositeIndexParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_CompositeIndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_CompositeIndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/IndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/IndexParams.cs deleted file mode 100644 index a6b00fddf..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/IndexParams.cs +++ /dev/null @@ -1,185 +0,0 @@ -using System; -using System.Text; - -namespace OpenCvSharp.Flann -{ - /// - /// - /// - public class IndexParams : DisposableCvObject - { - internal OpenCvSharp.Ptr PtrObj { get; set; } - - /// - /// - /// - public IndexParams() - : base() - { - IntPtr p = NativeMethods.flann_Ptr_IndexParams_new(); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(IndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected IndexParams(OpenCvSharp.Ptr ptrObj) - : base() - { - PtrObj = ptrObj; - ptr = PtrObj?.Get() ?? IntPtr.Zero; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - PtrObj?.Dispose(); - PtrObj = null; - base.DisposeManaged(); - } - - #region Methods - #region Get** - /// - /// - /// - /// - /// - /// - public string GetString(string key, string defaultVal) - { - StringBuilder sb = new StringBuilder(1024); - NativeMethods.flann_IndexParams_getString(ptr, key, defaultVal, sb); - return sb.ToString(); - } - /// - /// - /// - /// - /// - public string GetString(string key) - { - return GetString(key, null); - } - - /// - /// - /// - /// - /// - /// - public int GetInt(string key, int defaultVal) - { - return NativeMethods.flann_IndexParams_getInt(ptr, key, defaultVal); - } - /// - /// - /// - /// - /// - public int GetInt(string key) - { - return GetInt(key, -1); - } - /// - /// - /// - /// - /// - /// - public double GetDouble(string key, double defaultVal) - { - return NativeMethods.flann_IndexParams_getDouble(ptr, key, defaultVal); - } - /// - /// - /// - /// - /// - public double GetDouble(string key) - { - return GetDouble(key, -1); - } - #endregion - #region Set** - /// - /// - /// - /// - /// - public void SetString(string key, string value) - { - NativeMethods.flann_IndexParams_setString(ptr, key, value); - } - /// - /// - /// - /// - /// - public void SetInt(string key, int value) - { - NativeMethods.flann_IndexParams_setInt(ptr, key, value); - } - /// - /// - /// - /// - /// - public void SetDouble(string key, double value) - { - NativeMethods.flann_IndexParams_setDouble(ptr, key, value); - } - /// - /// - /// - /// - /// - public void SetFloat(string key, float value) - { - NativeMethods.flann_IndexParams_setFloat(ptr, key, value); - } - /// - /// - /// - /// - /// - public void SetBool(string key, bool value) - { - NativeMethods.flann_IndexParams_setBool(ptr, key, value ? 1 : 0); - } - /// - /// - /// - /// - public void SetAlgorithm(int value) - { - NativeMethods.flann_IndexParams_setAlgorithm(ptr, value); - } - #endregion - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_IndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_IndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/KDTreeIndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/KDTreeIndexParams.cs deleted file mode 100644 index e6a80977e..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/KDTreeIndexParams.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// ランダム kd-tree の集合でインデックスが表現され,これは並列に探索されます. - /// -#else - /// - /// When passing an object of this type the index constructed will consist of a set - /// of randomized kd-trees which will be searched in parallel. - /// -#endif - public class KDTreeIndexParams : IndexParams - { -#if LANG_JP - /// - /// - /// - /// 並列な kd-tree の個数.[1..16] の範囲が適切な値です -#else - /// - /// - /// - /// The number of parallel kd-trees to use. Good values are in the range [1..16] -#endif - public KDTreeIndexParams(int trees = 4) - { - IntPtr p = NativeMethods.flann_Ptr_KDTreeIndexParams_new(trees); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(AutotunedIndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected KDTreeIndexParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_KDTreeIndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_KDTreeIndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/KMeansIndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/KMeansIndexParams.cs deleted file mode 100644 index 4209d6ee0..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/KMeansIndexParams.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// 階層型 k-means tree でインデックスが表現されます. - /// -#else - /// - /// When passing an object of this type the index constructed will be a hierarchical k-means tree. - /// -#endif - public class KMeansIndexParams : IndexParams - { -#if LANG_JP - /// - /// - /// - /// 階層型 k-means tree で利用される branching ファクタ - /// k-means tree を作成する際の,k-means クラスタリングステージでの反復数の上限.ここで -1 は,k-means クラスタリングが収束するまで続けられることを意味します - /// k-means クラスタリングの初期中心を選択するアルゴリズム. - /// このパラメータ(クラスタ境界インデックス)は,階層的 k-means tree の探索方法に影響を与えます. cb_index が0の場合,最も近い中心のクラスタが,次に探索される k-means 領域になります.0より大きい値の場合も,領域サイズが考慮されます -#else - /// - /// - /// - /// The branching factor to use for the hierarchical k-means tree - /// The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence - /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. - /// This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When cb_index is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. -#endif - public KMeansIndexParams(int branching = 32, int iterations = 11, FlannCentersInit centersInit = FlannCentersInit.Random, float cbIndex = 0.2f) - { - IntPtr p = NativeMethods.flann_Ptr_KMeansIndexParams_new(branching, iterations, centersInit, cbIndex); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(AutotunedIndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected KMeansIndexParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_KMeansIndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_KMeansIndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/LinearIndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/LinearIndexParams.cs deleted file mode 100644 index fc0597261..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/LinearIndexParams.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// 線形のブルートフォース探索が行われます - /// -#else - /// - /// the index will perform a linear, brute-force search. - /// -#endif - public class LinearIndexParams : IndexParams - { - /// - /// - /// - public LinearIndexParams() - { - IntPtr p = NativeMethods.flann_Ptr_LinearIndexParams_new(); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(LinearIndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected LinearIndexParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_LinearIndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_LinearIndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/SavedIndexParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/SavedIndexParams.cs deleted file mode 100644 index e6453eac7..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/SavedIndexParams.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp.Flann -{ -#if LANG_JP - /// - /// ディスクにあらかじめ保存されたデータを読み出すために利用されます. - /// -#else - /// - /// This object type is used for loading a previously saved index from the disk. - /// -#endif - public class SavedIndexParams : IndexParams - { - /// - /// - /// - /// - public SavedIndexParams(string fileName) - { - if (string.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); - - IntPtr p = NativeMethods.flann_Ptr_SavedIndexParams_new(fileName); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(SavedIndexParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected SavedIndexParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_SavedIndexParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_SavedIndexParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/flann/IndexParams/SearchParams.cs b/src/OpenCvSharp/modules/flann/IndexParams/SearchParams.cs deleted file mode 100644 index 9d0516237..000000000 --- a/src/OpenCvSharp/modules/flann/IndexParams/SearchParams.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; - -namespace OpenCvSharp.Flann -{ - /// - /// - /// - public class SearchParams : IndexParams - { - /// - /// - /// - /// - /// - /// - public SearchParams(int checks = 32, float eps = 0.0f, bool sorted = true) - : base(null) - { - IntPtr p = NativeMethods.flann_Ptr_SearchParams_new(checks, eps, sorted ? 1 : 0); - if (p == IntPtr.Zero) - throw new OpenCvSharpException($"Failed to create {nameof(SearchParams)}"); - - PtrObj = new Ptr(p); - ptr = PtrObj.Get(); - } - - /// - /// - /// - protected SearchParams(OpenCvSharp.Ptr ptrObj) - : base(ptrObj) - { - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.flann_Ptr_SearchParams_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.flann_Ptr_SearchParams_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/highgui/CvTrackbar.cs b/src/OpenCvSharp/modules/highgui/CvTrackbar.cs deleted file mode 100644 index cff33d995..000000000 --- a/src/OpenCvSharp/modules/highgui/CvTrackbar.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// CvWindowに貼り付けて操作するトラックバー - /// -#else - /// - /// Trackbar that is shown on CvWindow - /// -#endif - public class CvTrackbar : DisposableObject - { - private readonly string name; - private readonly string window; - private int value; - private readonly int max; - private readonly int result; - private readonly object userdata; - private readonly Delegate callback; - private CvTrackbarCallback2Native callbackNative; - private GCHandle gchValue; - private GCHandle gchCallback; - private GCHandle gchCallbackNative; - private GCHandle gchUserdata; - - #region Init and Disposal - -#if LANG_JP - /// - /// 初期化(目盛りは0~100) - /// - /// トラックバーの名前 - /// トラックバーの親ウィンドウ名 - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Constructor (value=0, max=100) - /// - /// Trackbar name - /// Window name - /// Callback handler -#endif - public CvTrackbar(string name, string window, CvTrackbarCallback callback) - : this(name, window, 0, 100, callback) - { - } - -#if LANG_JP - /// - /// 初期化(目盛りは0~100) - /// - /// トラックバーの名前 - /// トラックバーの親ウィンドウ名 - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Constructor (value=0, max=100) - /// - /// Trackbar name - /// Window name - /// Callback handler -#endif - public CvTrackbar(string name, string window, CvTrackbarCallback2 callback) - : this(name, window, 0, 100, callback, null) - { - } - -#if LANG_JP - /// - /// 初期化 - /// - /// トラックバーの名前 - /// トラックバーの親ウィンドウ名 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Constructor - /// - /// Trackbar name - /// Window name - /// Initial slider position - /// The upper limit of the range this trackbar is working with. - /// Callback handler -#endif - public CvTrackbar(string name, string window, int value, int max, CvTrackbarCallback callback) - { - if (string.IsNullOrEmpty(name)) - throw new ArgumentNullException(nameof(name)); - if (string.IsNullOrEmpty(window)) - throw new ArgumentNullException(nameof(window)); - if (callback == null) - throw new ArgumentNullException(nameof(callback)); - - this.name = name; - this.window = window; - this.value = value; - this.max = max; - this.callback = callback; - - // userdata wrapper - callbackNative = delegate (int pos, IntPtr ud) - { - callback(pos); - }; - - //gchValue = GCHandle.Alloc(value, GCHandleType.Pinned); - gchCallback = GCHandle.Alloc(callback); - gchCallbackNative = GCHandle.Alloc(callbackNative); - IntPtr callbackPtr = Marshal.GetFunctionPointerForDelegate(callbackNative); - - result = NativeMethods.highgui_createTrackbar(name, window, ref this.value, max, callbackPtr, IntPtr.Zero); - - if (result == 0) - throw new OpenCvSharpException("Failed to create CvTrackbar."); - } - -#if LANG_JP - /// - /// 初期化 - /// - /// トラックバーの名前 - /// トラックバーの親ウィンドウ名 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート - /// -#else - /// - /// Constructor - /// - /// Trackbar name - /// Window name - /// Initial slider position - /// The upper limit of the range this trackbar is working with. - /// Callback handler - /// -#endif - public CvTrackbar(string name, string window, int value, int max, CvTrackbarCallback2 callback, object userdata) - { - if (string.IsNullOrEmpty(name)) - throw new ArgumentNullException(nameof(name)); - if (string.IsNullOrEmpty(window)) - throw new ArgumentNullException(nameof(window)); - if (callback == null) - throw new ArgumentNullException(nameof(callback)); - - this.name = name; - this.window = window; - this.value = value; - this.max = max; - this.callback = callback; - this.userdata = userdata; - - // userdataをIntPtrに変換 - IntPtr userdataPtr; - if (userdata != null) - { - gchUserdata = GCHandle.Alloc(userdata); - userdataPtr = GCHandle.ToIntPtr(gchUserdata); - } - else - { - userdataPtr = IntPtr.Zero; - } - - this.callback = callback; - // コールバックdelegateを、userdataをobjectとするように変換 - callbackNative = delegate (int pos, IntPtr ud) - { - if (ud == IntPtr.Zero) - { - callback(pos, null); - } - else - { - GCHandle gch = GCHandle.FromIntPtr(ud); - callback(pos, gch.Target); - } - }; - - // コールバックdelegateをポインタに変換 - gchCallback = GCHandle.Alloc(callback); - gchCallbackNative = GCHandle.Alloc(callbackNative); - IntPtr callbackPtr = Marshal.GetFunctionPointerForDelegate(callbackNative); - - //gchValue = GCHandle.Alloc(value, GCHandleType.Pinned); - - result = NativeMethods.highgui_createTrackbar(name, window, ref this.value, max, callbackPtr, userdataPtr); - - if (result == 0) - throw new OpenCvSharpException("Failed to create CvTrackbar."); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - if (gchCallback.IsAllocated) - gchCallback.Free(); - if (gchValue.IsAllocated) - gchValue.Free(); - if (gchUserdata.IsAllocated) - gchUserdata.Free(); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties -#if LANG_JP - /// - /// トラックバーの名前を取得する - /// -#else - /// - /// Name of this trackbar - /// -#endif - public string TrackbarName - { - get { return name; } - } - -#if LANG_JP - /// - /// 親ウィンドウの名前を取得する - /// -#else - /// - /// Name of parent window - /// -#endif - public string WindowName - { - get { return window; } - } - -#if LANG_JP - /// - /// トラックバーの現在の値を取得・設定する - /// -#else - /// - /// Gets or sets a numeric value that represents the current position of the scroll box on the track bar. - /// -#endif - public int Pos - { - get { return NativeMethods.highgui_getTrackbarPos(name, window); } - set { NativeMethods.highgui_setTrackbarPos(name, window, value); } - } - -#if LANG_JP - /// - /// トラックバーの目盛りの最大値を取得する - /// -#else - /// - /// Gets the upper limit of the range this trackbar is working with. - /// -#endif - public int Max - { - get { return max; } - } - -#if LANG_JP - /// - /// スライダが動いた際のコールバックイベントデリゲートを取得する - /// -#else - /// - /// Gets the callback delegate which occurs when the Value property of a track bar changes, either by movement of the scroll box or by manipulation in code. - /// -#endif - public Delegate Callback - { - get { return callback; } - } - -#if LANG_JP - /// - /// - /// -#else - /// - /// - /// -#endif - public object Userdata - { - get { return userdata; } - } - - -#if LANG_JP - /// - /// - /// -#else - /// - /// - /// -#endif - public int Result - { - get { return result; } - } - #endregion - - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/highgui/Enum/ButtonTypes.cs b/src/OpenCvSharp/modules/highgui/Enum/ButtonTypes.cs deleted file mode 100644 index 04374a3b3..000000000 --- a/src/OpenCvSharp/modules/highgui/Enum/ButtonTypes.cs +++ /dev/null @@ -1,52 +0,0 @@ - -namespace OpenCvSharp -{ - // TODO support createButton - -#if LANG_JP - /// - /// cv::createButton で用いるボタンの種類 - /// -#else - /// - /// Button type flags (cv::createButton) - /// -#endif - public enum ButtonTypes : int - { -#if LANG_JP - /// - /// 通常のプッシュボタン. - /// -#else - /// - /// The button will be a push button. - /// -#endif - PushButton = 0, - -#if LANG_JP - /// - /// チェックボックスボタン - /// -#else - /// - /// The button will be a checkbox button. - /// -#endif - Checkbox = 1, - -#if LANG_JP - /// - /// ラジオボックスボタン. - /// 同じボタンバー(同じライン上)にあるラジオボックスは,排他的です. - /// つまり,同時に1つしか選択できません. - /// -#else - /// - /// The button will be a radiobox button. The radiobox on the same buttonbar (same line) are exclusive; one on can be select at the time. - /// -#endif - Radiobox = 2, - } -} diff --git a/src/OpenCvSharp/modules/highgui/Enum/MouseEvent.cs b/src/OpenCvSharp/modules/highgui/Enum/MouseEvent.cs deleted file mode 100644 index a4d667fa0..000000000 --- a/src/OpenCvSharp/modules/highgui/Enum/MouseEvent.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// マウスイベント - /// -#else - /// - /// Mouse events - /// -#endif - [Flags] - public enum MouseEvent : int - { - /// - /// [EVENT_MOUSEMOVE] - /// - MouseMove = 0, - /// - /// [EVENT_LBUTTONDOWN] - /// - LButtonDown = 1, - /// - /// [EVENT_RBUTTONDOWN] - /// - RButtonDown = 2, - /// - /// [CV_EVENT_MBUTTONDOWN] - /// - MButtonDown = 3, - /// - /// [EVENT_LBUTTONUP] - /// - LButtonUp = 4, - /// - /// [EVENT_RBUTTONUP] - /// - RButtonUp = 5, - /// - /// [EVENT_MBUTTONUP] - /// - MButtonUp = 6, - /// - /// [EVENT_LBUTTONDBLCLK] - /// - LButtonDoubleClick = 7, - /// - /// [EVENT_RBUTTONDBLCLK] - /// - RButtonDoubleClick = 8, - /// - /// [EVENT_MBUTTONDBLCLK] - /// - MButtonDoubleClick = 9, - /// - /// [EVENT_MOUSEWHEEL] - /// - MouseWheel = 8, - /// - /// [EVENT_MOUSEHWHEEL] - /// - MouseHWheel = 9, - - /// - /// [EVENT_FLAG_LBUTTON] - /// - FlagLButton = 1, - /// - /// [EVENT_FLAG_RBUTTON] - /// - FlagRButton = 2, - /// - /// [EVENT_FLAG_MBUTTON] - /// - FlagMButton = 4, - /// - /// [EVENT_FLAG_CTRLKEY] - /// - FlagCtrlKey = 8, - /// - /// [EVENT_FLAG_SHIFTKEY] - /// - FlagShiftKey = 16, - /// - /// [EVENT_FLAG_ALTKEY] - /// - FlagAltKey = 32, - } -} diff --git a/src/OpenCvSharp/modules/highgui/Enum/WindowMode.cs b/src/OpenCvSharp/modules/highgui/Enum/WindowMode.cs deleted file mode 100644 index 8d590e245..000000000 --- a/src/OpenCvSharp/modules/highgui/Enum/WindowMode.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvNamedWindowで使用するウィンドウのフラグ - /// -#else - /// - /// Flags for the window - /// -#endif - [Flags] - public enum WindowMode : int - { - /// - /// the user can resize the window (no constraint) / - /// also use to switch a fullscreen window to a normal size - /// - Normal = 0x00000000, - -#if LANG_JP - /// - /// 表示される画像サイズに合わせてウィンドウサイズが自動的に調整される - /// -#else - /// - /// the user cannot resize the window, the size is constrainted by the image displayed - /// -#endif - AutoSize = 0x00000001, - - /// - /// window with opengl support - /// - OpenGL = 0x00001000, - - /// - /// change the window to fullscreen - /// - FullScreen = 1, - - /// - /// the image expends as much as it can (no ratio constraint) - /// - FreeRatio = 0x00000100, - - /// - /// the ratio of the image is respected - /// - KeepRatio = 0x00000000 - } -} diff --git a/src/OpenCvSharp/modules/highgui/Enum/WindowProperty.cs b/src/OpenCvSharp/modules/highgui/Enum/WindowProperty.cs deleted file mode 100644 index d84fcdeed..000000000 --- a/src/OpenCvSharp/modules/highgui/Enum/WindowProperty.cs +++ /dev/null @@ -1,35 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// ウィンドウのプロパティを取得・設定する際のプロパティID(cvGetWindowProperty/cvSetWindowProperty) - /// -#else - /// - /// Property identifiers for cvGetWindowProperty/cvSetWindowProperty - /// -#endif - public enum WindowProperty : int - { - /// - /// fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN) - /// - Fullscreen = 0, - - /// - /// autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE) - /// - AutoSize = 1, - - /// - /// window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO) - /// - AspectRatio = 2, - - /// - /// opengl support - /// - OpenGL = 3, - } -} diff --git a/src/OpenCvSharp/modules/highgui/FourCC.cs b/src/OpenCvSharp/modules/highgui/FourCC.cs deleted file mode 100644 index 9985a8947..000000000 --- a/src/OpenCvSharp/modules/highgui/FourCC.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// OpenCvのcvXXX関数のラッパー。 - /// -#else - /// - /// Managed wrapper of all OpenCV functions - /// -#endif - public static class FourCCCalcurator - { - // ReSharper disable InconsistentNaming - - /// - /// 4つの文字からFOURCCの整数値を得る - /// - /// - /// - /// - /// - /// - public static int Run(byte c1, byte c2, byte c3, byte c4) - { - return (((c1) & 255) + (((c2) & 255) << 8) + (((c3) & 255) << 16) + (((c4) & 255) << 24)); - } - - /// - /// 4つの文字からFOURCCの整数値を得る - /// - /// - /// - /// - /// - /// - public static int Run(char c1, char c2, char c3, char c4) - { - byte b1 = System.Convert.ToByte(c1); - byte b2 = System.Convert.ToByte(c2); - byte b3 = System.Convert.ToByte(c3); - byte b4 = System.Convert.ToByte(c4); - return Run(b1, b2, b3, b4); - } - - /// - /// 4つの文字からFOURCCの整数値を得る - /// - /// - /// - public static int Run(string fourcc) - { - if (string.IsNullOrEmpty(fourcc)) - return -1; - if (fourcc.Length != 4) - throw new ArgumentOutOfRangeException(nameof(fourcc)); - byte c1 = System.Convert.ToByte(fourcc[0]); - byte c2 = System.Convert.ToByte(fourcc[1]); - byte c3 = System.Convert.ToByte(fourcc[2]); - byte c4 = System.Convert.ToByte(fourcc[3]); - return Run(c1, c2, c3, c4); - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/highgui/Window.cs b/src/OpenCvSharp/modules/highgui/Window.cs deleted file mode 100644 index 858996ebd..000000000 --- a/src/OpenCvSharp/modules/highgui/Window.cs +++ /dev/null @@ -1,835 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// HighGUIウィンドウのラッパー - /// -#else - /// - /// Wrapper of HighGUI window - /// -#endif - public class Window : DisposableObject - { - #region Field - - internal static Dictionary Windows = new Dictionary(); - private static uint windowCount = 0; - - private string name; - private Mat image; - private CvMouseCallback mouseCallback; - private readonly Dictionary trackbars; - private ScopedGCHandle callbackHandle; - - #endregion - - #region Init and Disposal - -#if LANG_JP - /// - /// 適当なウィンドウ名で初期化 - /// -#else - /// - /// Creates a window with a random name - /// -#endif - public Window() - : this(DefaultName(), WindowMode.AutoSize, null) - { - } - -#if LANG_JP - /// - /// 適当なウィンドウ名で、始めから表示しておく画像を指定して初期化 - /// - /// ウィンドウに表示する画像 -#else - /// - /// Creates a window with a random name and a specified image - /// - /// -#endif - public Window(Mat image) - : this(DefaultName(), WindowMode.AutoSize, image) - { - - } - -#if LANG_JP - /// - /// 適当なウィンドウ名で、画像の表示モードを指定して初期化 - /// - /// ウィンドウのフラグ - /// ウィンドウに表示する画像 -#else - /// - /// Creates a window with a specified image and flag - /// - /// Flags of the window. Currently the only supported flag is WindowMode.AutoSize. - /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. - /// -#endif - public Window(WindowMode flags, Mat image) - : this(DefaultName(), flags, image) - { - } - -#if LANG_JP - /// - /// ウィンドウ名を指定して初期化 - /// - /// ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される. -#else - /// - /// Creates a window - /// - /// Name of the window which is used as window identifier and appears in the window caption. -#endif - public Window(string name) - : this(name, WindowMode.AutoSize, null) - { - } - -#if LANG_JP - /// - /// ウィンドウ名と画像の表示モードを指定して初期化 - /// - /// ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される. - /// ウィンドウのフラグ -#else - /// - /// Creates a window - /// - /// Name of the window which is used as window identifier and appears in the window caption. - /// Flags of the window. Currently the only supported flag is WindowMode.AutoSize. - /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. -#endif - public Window(string name, WindowMode flags) - : this(name, flags, null) - { - } - -#if LANG_JP - /// - /// ウィンドウ名と始めから表示しておく画像を指定して初期化 - /// - /// ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される. - /// ウィンドウに表示する画像 -#else - /// - /// Creates a window - /// - /// Name of the window which is used as window identifier and appears in the window caption. - /// Image to be shown. -#endif - public Window(string name, Mat image) - : this(name, WindowMode.AutoSize, image) - { - } - -#if LANG_JP - /// - /// ウィンドウ名と画像の表示モードと始めから表示しておく画像を指定して初期化 - /// - /// ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される. - /// ウィンドウのフラグ - /// ウィンドウに表示する画像 -#else - /// - /// Creates a window - /// - /// Name of the window which is used as window identifier and appears in the window caption. - /// Flags of the window. Currently the only supported flag is WindowMode.AutoSize. - /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. - /// Image to be shown. -#endif - public Window(string name, WindowMode flags, Mat image) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - - this.name = name; - NativeMethods.highgui_namedWindow(name, (int) flags); - - this.image = image; - ShowImage(image); - trackbars = new Dictionary(); - if (!Windows.ContainsKey(name)) - { - Windows.Add(name, this); - } - this.callbackHandle = null; - } - - /// - /// ウィンドウ名が指定されなかったときに、適当な名前を作成して返す. - /// - /// - private static string DefaultName() - { - return string.Format("window{0}", windowCount++); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - foreach (KeyValuePair pair in trackbars) - { - pair.Value?.Dispose(); - } - if (Windows.ContainsKey(name)) - { - Windows.Remove(name); - } - if (callbackHandle != null && callbackHandle.IsAllocated) - { - callbackHandle.Dispose(); - } - base.DisposeManaged(); - } - -#if LANG_JP - /// - /// ウィンドウを閉じる - /// -#else - /// - /// Destroys this window. - /// -#endif - public void Close() - { - Dispose(); - } - -#if LANG_JP - /// - /// 全ての HighGUI ウィンドウを破棄する - /// -#else - /// - /// Destroys all the opened HighGUI windows. - /// -#endif - public static void DestroyAllWindows() - { - foreach (KeyValuePair wpair in Windows) - { - Window w = wpair.Value; - if (w == null || w.IsDisposed) - { - continue; - } - NativeMethods.highgui_destroyWindow(w.name); - foreach (KeyValuePair tpair in w.trackbars) - { - if (tpair.Value != null) - { - tpair.Value.Dispose(); - } - } - //w.Dispose(); - } - Windows.Clear(); - NativeMethods.highgui_destroyAllWindows(); - } - - #endregion - - #region Properties - -#if LANG_JP - /// - /// 表示する画像を取得・設定する - /// -#else - /// - /// Gets or sets an image to be shown - /// -#endif - public Mat Image - { - get { return image; } - set { ShowImage(value); } - } - -#if LANG_JP - /// - /// ウィンドウの名前を取得する - /// -#else - /// - /// Gets window name - /// -#endif - public string Name - { - get { return name; } - private set { name = value; } - } - -#if LANG_JP - /// - /// ウィンドウハンドルを取得する - /// -#else - /// - /// Gets window handle - /// -#endif - public IntPtr Handle - { - get - { - throw new NotImplementedException(); - //return OpenCvSharp.NativeMethods.cvGetWindowHandle(name); - } - } - - /// - /// - /// - internal CvMouseCallback MouseCallback - { - get { return mouseCallback; } - set - { - if (callbackHandle != null && callbackHandle.IsAllocated) - { - callbackHandle.Dispose(); - } - mouseCallback = value; - callbackHandle = new ScopedGCHandle(mouseCallback, GCHandleType.Normal); - } - } - -#if LANG_JP - /// - /// マウスイベントが発生したときのイベントハンドラ - /// -#else - /// - /// Event handler to be called every time mouse event occurs in the specified window. - /// -#endif - public event CvMouseCallback OnMouseCallback - { - add - { - if (value == null) - throw new ArgumentNullException(); - if (callbackHandle != null && callbackHandle.IsAllocated) - callbackHandle.Dispose(); - - mouseCallback += value; - callbackHandle = new ScopedGCHandle(mouseCallback, GCHandleType.Normal); - NativeMethods.highgui_setMouseCallback(name, mouseCallback, IntPtr.Zero); - } - remove - { - if (value == null) - throw new ArgumentNullException(); - if (callbackHandle != null && callbackHandle.IsAllocated) - callbackHandle.Dispose(); - - mouseCallback -= value; - callbackHandle = new ScopedGCHandle(mouseCallback, GCHandleType.Normal); - NativeMethods.highgui_setMouseCallback(name, mouseCallback, IntPtr.Zero); - } - } - -#if LANG_JP - /// - /// Qtを有効にしてビルドされたhighguiライブラリであればtrueを返す - /// -#else - /// - /// Returns true if the library is compiled with Qt - /// -#endif - public static bool HasQt - { - get - { - throw new NotImplementedException(); - //return OpenCvSharp.NativeMethods.HasQt; - } - } - - #endregion - - #region Methods - - #region CreateTrackbar - -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Creates the trackbar and attaches it to this window - /// - /// Name of created trackbar. - /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); - /// -#endif - public CvTrackbar CreateTrackbar(string name, CvTrackbarCallback callback) - { - CvTrackbar trackbar = new CvTrackbar(name, this.name, callback); - trackbars.Add(name, trackbar); - return trackbar; - } - -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Creates the trackbar and attaches it to this window - /// - /// Name of created trackbar. - /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); - /// -#endif - public CvTrackbar CreateTrackbar(string name, CvTrackbarCallback2 callback) - { - CvTrackbar trackbar = new CvTrackbar(name, this.name, callback); - trackbars.Add(name, trackbar); - return trackbar; - } - -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Creates the trackbar and attaches it to this window - /// - /// Name of created trackbar. - /// The position of the slider - /// Maximal position of the slider. Minimal position is always 0. - /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); - /// -#endif - public CvTrackbar CreateTrackbar(string name, int value, int max, CvTrackbarCallback callback) - { - CvTrackbar trackbar = new CvTrackbar(name, this.name, value, max, callback); - trackbars.Add(name, trackbar); - return trackbar; - } - -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else - /// - /// Creates the trackbar and attaches it to this window - /// - /// Name of created trackbar. - /// The position of the slider - /// Maximal position of the slider. Minimal position is always 0. - /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); - /// -#endif - public CvTrackbar CreateTrackbar(string name, int value, int max, CvTrackbarCallback2 callback) - { - CvTrackbar trackbar = new CvTrackbar(name, this.name, value, max, callback, null); - trackbars.Add(name, trackbar); - return trackbar; - } - -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート - /// -#else - /// - /// Creates the trackbar and attaches it to this window - /// - /// Name of created trackbar. - /// The position of the slider - /// Maximal position of the slider. Minimal position is always 0. - /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); - /// - /// -#endif - public CvTrackbar CreateTrackbar2(string name, int value, int max, CvTrackbarCallback2 callback, object userdata) - { - CvTrackbar trackbar = new CvTrackbar(name, this.name, value, max, callback, userdata); - trackbars.Add(name, trackbar); - return trackbar; - } - - #endregion - - #region DisplayOverlay - -#if LANG_JP - /// - /// ウィンドウ画像上に,delay ミリ秒間だけテキストをオーバレイ表示します.これは,画像データを変更しません.テキストは画像の一番上に表示されます. - /// - /// ウィンドウ画像上に描画される,オーバレイテキスト. - /// オーバレイテキストを表示する時間.直前のオーバレイテキストがタイムアウトするより前に,この関数が呼ばれると,タイマーは再起動されてテキストが更新されます.この値が0の場合,テキストは表示されません. -#else - /// - /// Display text on the window's image as an overlay for delay milliseconds. This is not editing the image's data. The text is display on the top of the image. - /// - /// Overlay text to write on the window’s image - /// Delay to display the overlay text. If this function is called before the previous overlay text time out, the timer is restarted and the text updated. . If this value is zero, the text never disapers. -#endif - public void DisplayOverlay(string text, int delayms) - { - throw new NotImplementedException(); - //Cv.DisplayOverlay(name, text, delayms); - } - - #endregion - - #region DisplayStatusBar - -#if LANG_JP - /// - /// ウィンドウのステータスバーに,delay ミリ秒間だけテキストを表示します. - /// - /// ウィンドウのステータスバー上に描画されるテキスト. - /// テキストが表示される時間.直前のテキストがタイムアウトするより前に,この関数が呼ばれると,タイマーは再起動されてテキストが更新されます.この値が0の場合,テキストは表示されません. -#else - /// - /// - /// - /// Text to write on the window’s statusbar - /// Delay to display the text. If this function is called before the previous text time out, the timer is restarted and the text updated. If this value is zero, the text never disapers. -#endif - public void DisplayStatusBar(string text, int delayms) - { - throw new NotImplementedException(); - //Cv.DisplayStatusBar(name, text, delayms); - } - - #endregion - - #region GetProperty - -#if LANG_JP - /// - /// ウィンドウのプロパティを取得する - /// - /// プロパティの種類 - /// プロパティの値 -#else - /// - /// Get Property of the window - /// - /// Property identifier - /// Value of the specified property -#endif - public double GetProperty(WindowProperty propId) - { - return Cv2.GetWindowProperty(name, propId); - } - - #endregion - - #region LoadWindowParameters - -#if LANG_JP - /// - /// ウィンドウのパラメータを読み込みます. - /// -#else - /// - /// Load parameters of the window. - /// -#endif - public void LoadWindowParameters() - { - throw new NotImplementedException(); - //Cv.LoadWindowParameters(name); - } - - #endregion - - #region Move - -#if LANG_JP - /// - /// ウィンドウの位置を変更する - /// - /// 左上のコーナーの新しい x 座標 - /// 左上のコーナーの新しい y 座標 -#else - /// - /// Sets window position - /// - /// New x coordinate of top-left corner - /// New y coordinate of top-left corner -#endif - public void Move(int x, int y) - { - NativeMethods.highgui_moveWindow(name, x, y); - } - - #endregion - - #region Resize - -#if LANG_JP - /// - /// ウィンドウサイズを変更する - /// - /// 新しい幅 - /// 新しい高さ -#else - /// - /// Sets window size - /// - /// New width - /// New height -#endif - public void Resize(int width, int height) - { - NativeMethods.highgui_resizeWindow(name, width, height); - } - - #endregion - - #region SaveWindowParameters - -#if LANG_JP - /// - /// ウィンドウのパラメータを保存します. - /// -#else - /// - /// Save parameters of the window. - /// -#endif - public void SaveWindowParameters() - { - throw new NotImplementedException(); - //Cv.SaveWindowParameters(name); - } - - #endregion - - #region SetProperty - -#if LANG_JP - /// - /// ウィンドウのプロパティを設定する - /// - /// プロパティの種類 - /// プロパティに設定する値 -#else - /// - /// Set Property of the window - /// - /// Property identifier - /// New value of the specified property -#endif - public void SetProperty(WindowProperty propId, double propValue) - { - Cv2.SetWindowProperty(name, propId, propValue); - } - - #endregion - - #region ShowImage - -#if LANG_JP - /// - /// 指定したウィンドウ内に画像を表示する(cvShowImage相当). - /// このウィンドウのフラグに AutoSize が指定されていた場合は,画像はオリジナルサイズで表示される. - /// それ以外の場合,ウィンドウサイズに合わせて 表示画像サイズが変更される. - /// - /// 画像ヘッダ -#else - /// - /// Shows the image in this window - /// - /// Image to be shown. -#endif - public void ShowImage(Mat img) - { - if (img != null) - { - this.image = img; - NativeMethods.highgui_imshow(name, img.CvPtr); - } - } - - #endregion - - #region WaitKey - -#if LANG_JP - /// - /// 何かキーが押されるまで待機する. - /// - /// 押されたキーのキーコード -#else - /// - /// Waits for a pressed key - /// - /// Key code -#endif - public static int WaitKey() - { - return NativeMethods.highgui_waitKey(0); - } - -#if LANG_JP - /// - /// 何かキーが押されるか、若しくはdelayで指定した時間(ミリ秒)待機する。 - /// - /// 遅延時間(ミリ秒) - /// キーが押された場合はそのキーコードを,キーが押されないまま指定されたタイムアウト時間が過ぎてしまった場合は -1 -#else - /// - /// Waits for a pressed key - /// - /// Delay in milliseconds. - /// Key code -#endif - public static int WaitKey(int delay) - { - return NativeMethods.highgui_waitKey(delay); - } - - #endregion - - #region ShowImages - -#if LANG_JP - /// - /// 引数に指定した画像をそれぞれ別のウィンドウで表示し、キー入力待ち状態にする。 - /// - /// 表示させる画像。任意の個数を指定できる。 -#else - /// - /// - /// - /// -#endif - public static void ShowImages(params Mat[] images) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (images.Length == 0) - return; - - var windows = new List(); - foreach (Mat img in images) - { - windows.Add(new Window(img)); - } - - WaitKey(); - - foreach (Window w in windows) - { - w.Close(); - } - } - - /// - /// - /// - /// - /// - public static void ShowImages(IEnumerable images, IEnumerable names) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (names == null) - throw new ArgumentNullException(nameof(names)); - - Mat[] imagesArray = EnumerableEx.ToArray(images); - string[] namesArray = EnumerableEx.ToArray(names); - - if (imagesArray.Length == 0) - return; - if (namesArray.Length < imagesArray.Length) - throw new ArgumentException("names.Length < images.Length"); - - List windows = new List(); - for (int i = 0; i < imagesArray.Length; i++) - { - windows.Add(new Window(namesArray[i], imagesArray[i])); - } - - Cv2.WaitKey(); - - foreach (Window w in windows) - { - w.Close(); - } - } - - #endregion - - #region GetWindowByName - -#if LANG_JP - /// - /// 指定した名前に対応するウィンドウを得る - /// - /// -#else - /// - /// Retrieves a created window by name - /// - /// - /// -#endif - public static Window GetWindowByName(string name) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(nameof(name)); - } - if (Windows.ContainsKey(name)) - { - return Windows[name]; - } - else - { - return null; - } - } - - #endregion - - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/imgcodecs/Enum/ConvertImageModes.cs b/src/OpenCvSharp/modules/imgcodecs/Enum/ConvertImageModes.cs deleted file mode 100644 index d357a1ccc..000000000 --- a/src/OpenCvSharp/modules/imgcodecs/Enum/ConvertImageModes.cs +++ /dev/null @@ -1,24 +0,0 @@ - -namespace OpenCvSharp -{ - /// - /// - /// - public enum ConvertImageModes : int - { - /// - /// - /// - None = 0, - - /// - /// - /// - Flip = 1, - - /// - /// - /// - SwapRB = 2 - } -} diff --git a/src/OpenCvSharp/modules/imgcodecs/Enum/ImreadModes.cs b/src/OpenCvSharp/modules/imgcodecs/Enum/ImreadModes.cs deleted file mode 100644 index 7776a48b6..000000000 --- a/src/OpenCvSharp/modules/imgcodecs/Enum/ImreadModes.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvLoadImageで用いる読み込みフラグ . - /// -#else - /// - /// Specifies colorness and Depth of the loaded image - /// -#endif - [Flags] - public enum ImreadModes : int - { - #if LANG_JP - /// - /// 8 ビット,カラーまたはグレースケール [CV_LOAD_IMAGE_UNCHANGED] - /// -#else - /// - /// If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). - /// -#endif - Unchanged = -1, - - -#if LANG_JP - /// - /// 8 ビット,グレースケール [CV_LOAD_IMAGE_GRAYSCALE] - /// -#else - /// - /// If set, always convert image to the single channel grayscale image. - /// -#endif - GrayScale = 0, - - -#if LANG_JP - /// - /// AnyDepth と併用されない限り 8 ビット,カラー [CV_LOAD_IMAGE_COLOR] - /// -#else - /// - /// If set, always convert image to the 3 channel BGR color image. - /// -#endif - Color = 1, - - -#if LANG_JP - /// - ///任意のデプス,グレー [CV_LOAD_IMAGE_ANYDEPTH] - /// -#else - /// - /// If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit. - /// -#endif - AnyDepth = 2, - - -#if LANG_JP - /// - /// 8 ビット,カラーまたはグレースケール [CV_LOAD_IMAGE_ANYCOLOR]. - /// AnyDepth と併用可能. - /// -#else - /// - /// If set, the image is read in any possible color format. - /// -#endif - AnyColor = 4, - - /// - /// If set, use the gdal driver for loading the image. - /// - LoadGdal = 8, - }; -} diff --git a/src/OpenCvSharp/modules/imgcodecs/Enum/ImwriteFlags.cs b/src/OpenCvSharp/modules/imgcodecs/Enum/ImwriteFlags.cs deleted file mode 100644 index 9d2a1fdda..000000000 --- a/src/OpenCvSharp/modules/imgcodecs/Enum/ImwriteFlags.cs +++ /dev/null @@ -1,89 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cv::imwrite, cv::inencode で用いるエンコードの種類 - /// -#else - /// - /// The format type IDs for cv::imwrite and cv::inencode - /// -#endif - public enum ImwriteFlags : int - { -#if LANG_JP - /// - /// JPEGの場合のフラグ。0から100の値を取る(大きいほど高品質)。デフォルト値は95。 - /// -#else - /// - /// For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95. - /// -#endif - JpegQuality = 1, - - /// - /// Enable JPEG features, 0 or 1, default is False. - /// - JpegProgressive = 2, - - /// - /// Enable JPEG features, 0 or 1, default is False. - /// - JpegOptimize = 3, - - /// - /// JPEG restart interval, 0 - 65535, default is 0 - no restart. - /// - JpegRstInterval = 4, - - /// - /// Separate luma quality level, 0 - 100, default is 0 - don't use. - /// - JpegLumaQuality = 5, - - /// - /// Separate chroma quality level, 0 - 100, default is 0 - don't use. - /// - JpegChromaQuality = 6, - -#if LANG_JP - /// - /// PNGの場合のフラグ。圧縮レベルを0から9の値で指定する(大きいほど高圧縮率で、かつ圧縮に時間を要する)。デフォルト値は3。 - /// -#else - /// - /// For PNG, it can be the compression level from 0 to 9. - /// A higher value means a smaller size and longer compression time. Default value is 3. - /// -#endif - PngCompression = 16, - - /// - /// One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_DEFAULT. - /// - PngStrategy = 17, - - /// - /// Binary level PNG, 0 or 1, default is 0. - /// - PngBilevel = 18, - -#if LANG_JP - /// - /// PPM, PGM, PBMの場合のフラグ。フォーマットをバイナリ(1)かアスキー(0)かで指定する。デフォルト値は1。 - /// -#else - /// - /// For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1. - /// -#endif - PxmBinary = 32, - - /// - /// For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used. - /// - WebPQuality = 64 - } -} diff --git a/src/OpenCvSharp/modules/imgcodecs/ImageEncodingParam.cs b/src/OpenCvSharp/modules/imgcodecs/ImageEncodingParam.cs deleted file mode 100644 index a29ce89c9..000000000 --- a/src/OpenCvSharp/modules/imgcodecs/ImageEncodingParam.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cv::imwrite, cv::imencode で用いるエンコードパラメータ - /// -#else - /// - /// The format-specific save parameters for cv::imwrite and cv::imencode - /// -#endif - [Serializable] - public class ImageEncodingParam - { -#if LANG_JP - /// - /// エンコードの種類 - /// -#else - /// - /// format type ID - /// -#endif - public ImwriteFlags EncodingId { get; set; } - -#if LANG_JP - /// - /// パラメータの値 - /// -#else - /// - /// value of parameter - /// -#endif - public int Value { get; set; } - - -#if LANG_JP - /// - /// 初期化 - /// - /// エンコードの種類 - /// パラメータの値 -#else - /// - /// Constructor - /// - /// format type ID - /// value of parameter -#endif - public ImageEncodingParam(ImwriteFlags id, int value) - { - EncodingId = id; - Value = value; - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/CLAHE.cs b/src/OpenCvSharp/modules/imgproc/CLAHE.cs deleted file mode 100644 index 7b3223e57..000000000 --- a/src/OpenCvSharp/modules/imgproc/CLAHE.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Contrast Limited Adaptive Histogram Equalization - /// - // ReSharper disable once InconsistentNaming - public sealed class CLAHE : Algorithm - { - /// - /// cv::Ptr<CLAHE> - /// - private Ptr ptrObj; - - /// - /// - /// - private CLAHE(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates a predefined CLAHE object - /// - /// - /// - /// - public static CLAHE Create(double clipLimit = 40.0, Size? tileGridSize = null) - { - IntPtr ptr = NativeMethods.imgproc_createCLAHE( - clipLimit, tileGridSize.GetValueOrDefault(new Size(8, 8))); - return new CLAHE(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - /// - /// - /// - /// - /// - public void Apply(InputArray src, OutputArray dst) - { - ThrowIfDisposed(); - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - src.ThrowIfDisposed(); - dst.ThrowIfNotReady(); - - NativeMethods.imgproc_CLAHE_apply(ptr, src.CvPtr, dst.CvPtr); - - dst.Fix(); - GC.KeepAlive(src); - } - - /// - /// - /// - /// - public void SetClipLimit(double clipLimit) - { - ThrowIfDisposed(); - NativeMethods.imgproc_CLAHE_setClipLimit(ptr, clipLimit); - } - - /// - /// - /// - /// - public double GetClipLimit() - { - ThrowIfDisposed(); - return NativeMethods.imgproc_CLAHE_getClipLimit(ptr); - } - - /// - /// - /// - public double ClipLimit - { - get { return GetClipLimit(); } - set { SetClipLimit(value); } - } - - /// - /// - /// - /// - public void SetTilesGridSize(Size tileGridSize) - { - ThrowIfDisposed(); - NativeMethods.imgproc_CLAHE_setTilesGridSize(ptr, tileGridSize); - } - - /// - /// - /// - /// - public Size GetTilesGridSize() - { - ThrowIfDisposed(); - return NativeMethods.imgproc_CLAHE_getTilesGridSize(ptr); - } - - /// - /// - /// - public Size TilesGridSize - { - get { return GetTilesGridSize(); } - set { SetTilesGridSize(value); } - } - - - /// - /// - /// - public void CollectGarbage() - { - ThrowIfDisposed(); - NativeMethods.imgproc_CLAHE_collectGarbage(ptr); - } - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.imgproc_Ptr_CLAHE_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.imgproc_Ptr_CLAHE_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/ConnectedComponent.cs b/src/OpenCvSharp/modules/imgproc/ConnectedComponent.cs deleted file mode 100644 index 63539674f..000000000 --- a/src/OpenCvSharp/modules/imgproc/ConnectedComponent.cs +++ /dev/null @@ -1,245 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// connected components that is returned from Cv2.ConnectedComponentsEx - /// - public class ConnectedComponents - { - /// - /// All blobs - /// - public ReadOnlyCollection Blobs { get; internal set; } - - /// - /// destination labeled value - /// - public int[,] Labels { get; internal set; } - - /// - /// The number of labels -1 - /// - public int LabelCount { get; internal set; } - - /// - /// Constructor - /// - /// - /// - /// - internal ConnectedComponents(IList blobs, int[,] labels, int labelCount) - { - Blobs = new ReadOnlyCollection(blobs); - Labels = labels; - LabelCount = labelCount; - } - - /// - /// Filter a image with the specified label value. - /// - /// Source image. - /// Destination image. - /// Label value. - /// Filtered image. - public Mat FilterByLabel(Mat src, Mat dst, int labelValue) - { - return FilterByLabels(src, dst, new[] { labelValue }); - } - - /// - /// Filter a image with the specified label values. - /// - /// Source image. - /// Destination image. - /// Label values. - /// Filtered image. - public Mat FilterByLabels(Mat src, Mat dst, IEnumerable labelValues) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (labelValues == null) - throw new ArgumentNullException(nameof(labelValues)); - int[] labelArray = EnumerableEx.ToArray(labelValues); - if (labelArray.Length == 0) - throw new ArgumentException("empty labelValues"); - - foreach (int labelValue in labelArray) - { - if (labelValue < 0 || labelValue >= LabelCount) - throw new ArgumentException("0 <= x < LabelCount"); - } - - // マスク用Matを用意し、Andで切り抜く - using (Mat mask = GetLabelMask(labelArray[0])) - { - for (int i = 1; i < labelArray.Length; i++) - { - using (var maskI = GetLabelMask(labelArray[i])) - { - Cv2.BitwiseOr(mask, maskI, mask); - } - } - src.CopyTo(dst, mask); - return dst; - } - } - - /// - /// Filter a image with the specified blob object. - /// - /// Source image. - /// Destination image. - /// Blob value. - /// Filtered image. - public Mat FilterByBlob(Mat src, Mat dst, Blob blob) - { - return FilterByLabels(src, dst, new[] { blob.Label }); - } - - /// - /// Filter a image with the specified blob objects. - /// - /// Source image. - /// Destination image. - /// Blob values. - /// Filtered image. - public Mat FilterBlobs(Mat src, Mat dst, IEnumerable blobs) - { - return FilterByLabels(src, dst, EnumerableEx.Select(blobs, b => b.Label)); - } - - /// - /// Draws all blobs to the specified image. - /// - /// The target image to be drawn. - public void RenderBlobs(Mat img) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - /* - if (img.Empty()) - throw new ArgumentException("img is empty"); - if (img.Type() != MatType.CV_8UC3) - throw new ArgumentException("img must be CV_8UC3");*/ - if (Blobs == null || Blobs.Count == 0) - throw new OpenCvSharpException("Blobs is empty"); - if (Labels == null) - throw new OpenCvSharpException("Labels is empty"); - - int height = Labels.GetLength(0); - int width = Labels.GetLength(1); - img.Create(new Size(width, height), MatType.CV_8UC3); - - Scalar[] colors = new Scalar[Blobs.Count]; - colors[0] = Scalar.All(0); - for (int i = 1; i < Blobs.Count; i++) - { - colors[i] = Scalar.RandomColor(); - } - - using (var imgt = new MatOfByte3(img)) - { - var indexer = imgt.GetIndexer(); - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - int labelValue = Labels[y, x]; - indexer[y, x] = colors[labelValue].ToVec3b(); - } - } - } - } - - /// - /// Find the largest blob. - /// - /// the largest blob - public Blob GetLargestBlob() - { - if (Blobs == null || Blobs.Count <= 1) - throw new OpenCvSharpException("Blobs is empty"); - - Blob max = Blobs[1]; - for (int i = 2; i < Blobs.Count; i++) - { - if (max.Area < Blobs[i].Area) - max = Blobs[i]; - } - return max; - } - - /// - /// 指定したラベル値のところのみを非0で残したマスク画像を返す - /// - /// - /// - private Mat GetLabelMask(int label) - { - int rows = Labels.GetLength(0); - int cols = Labels.GetLength(1); - using (var labels = new Mat(rows, cols, MatType.CV_32SC1, Labels)) - using (var cmp = new Mat(rows, cols, MatType.CV_32SC1, Scalar.All(label))) - { - Mat result = new Mat(); - Cv2.Compare(labels, cmp, result, CmpTypes.EQ); - return result; - } - } - - /// - /// One blob - /// - public class Blob - { - /// - /// Label value - /// - public int Label { get; internal set; } - - /// - /// Floating point centroid (x,y) - /// - public Point2d Centroid { get; internal set; } - - /// - /// The leftmost (x) coordinate which is the inclusive start of the bounding box in the horizontal direction. - /// - public int Left { get; internal set; } - - /// - /// The topmost (y) coordinate which is the inclusive start of the bounding box in the vertical direction. - /// - public int Top { get; internal set; } - - /// - /// The horizontal size of the bounding box. - /// - public int Width { get; internal set; } - - /// - /// The vertical size of the bounding box. - /// - public int Height { get; internal set; } - - /// - /// The bounding box. - /// - public Rect Rect - { - get { return new Rect(Left, Top, Width, Height); } - } - - /// - /// The total area (in pixels) of the connected component. - /// - public int Area { get; internal set; } - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/AdaptiveThresholdTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/AdaptiveThresholdTypes.cs deleted file mode 100644 index e9aae27d3..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/AdaptiveThresholdTypes.cs +++ /dev/null @@ -1,38 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 適応的閾値処理で使用するアルゴリズムの種類 - /// -#else - /// - /// Adaptive thresholding algorithms - /// -#endif - public enum AdaptiveThresholdTypes : int - { -#if LANG_JP - /// - /// 注目ピクセルの block_size × block_size 隣接領域の平均から,param1 を引いた値を閾値とする. - /// -#else - /// - /// It is a mean of block_size × block_size pixel neighborhood, subtracted by param1. - /// -#endif - MeanC = 0, - - -#if LANG_JP - /// - /// 注目ピクセルの block_size × block_size 隣接領域の重み付き総和(ガウシアン)から param1 を引いた値を閾値とする. - /// -#else - /// - /// it is a weighted sum (Gaussian) of block_size × block_size pixel neighborhood, subtracted by param1. - /// -#endif - GaussianC = 1, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/BorderTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/BorderTypes.cs deleted file mode 100644 index cda6a841f..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/BorderTypes.cs +++ /dev/null @@ -1,71 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvCopyMakeBorderで指定する, 境界線のタイプ - /// -#else - /// - /// Type of the border to create around the copied source image rectangle - /// -#endif - public enum BorderTypes : int - { -#if LANG_JP - /// - /// 境界はこの関数の最後のパラメータとして渡された定数 value で埋められる. - /// `iiiiii|abcdefgh|iiiiiii` with some specified `i` - /// -#else - /// - /// Border is filled with the fixed value, passed as last parameter of the function. - /// `iiiiii|abcdefgh|iiiiiii` with some specified `i` - /// -#endif - Constant = 0, - -#if LANG_JP - /// - /// 画像の最も上/下の行と最も左/右の列(画像領域の一番外側の値)を用いて境界線を生成する. - /// `aaaaaa|abcdefgh|hhhhhhh` - /// -#else - /// - /// The pixels from the top and bottom rows, the left-most and right-most columns are replicated to fill the border. - /// `aaaaaa|abcdefgh|hhhhhhh` - /// -#endif - Replicate = 1, - - /// - /// `fedcba|abcdefgh|hgfedcb` - /// - Reflect = 2, - - /// - /// `cdefgh|abcdefgh|abcdefg` - /// - Wrap = 3, - - /// - /// `gfedcb|abcdefgh|gfedcba` - /// - Reflect101 = 4, - - /// - /// `uvwxyz|absdefgh|ijklmno` - /// - Transparent = 5, - - /// - /// same as BORDER_REFLECT_101 - /// - Default = Reflect101, - - /// - /// do not look outside of ROI - /// - Isolated = 16, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ColorConversionCodes.cs b/src/OpenCvSharp/modules/imgproc/Enum/ColorConversionCodes.cs deleted file mode 100644 index 9180356ae..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ColorConversionCodes.cs +++ /dev/null @@ -1,272 +0,0 @@ - -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 色空間の変換の方法 - /// -#else - /// - /// Color conversion operation for cv::cvtColor - /// -#endif - public enum ColorConversionCodes : int - { - BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image - RGB2RGBA = BGR2BGRA, - - BGRA2BGR = 1, //!< remove alpha channel from RGB or BGR image - RGBA2RGB = BGRA2BGR, - - BGR2RGBA = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel) - RGB2BGRA = BGR2RGBA, - - RGBA2BGR = 3, - BGRA2RGB = RGBA2BGR, - - BGR2RGB = 4, - RGB2BGR = BGR2RGB, - - BGRA2RGBA = 5, - RGBA2BGRA = BGRA2RGBA, - - BGR2GRAY = 6, //!< convert between RGB/BGR and grayscale, @ref convert_rgb_gray "color conversions" - RGB2GRAY = 7, - GRAY2BGR = 8, - GRAY2RGB = GRAY2BGR, - GRAY2BGRA = 9, - GRAY2RGBA = GRAY2BGRA, - BGRA2GRAY = 10, - RGBA2GRAY = 11, - - BGR2BGR565 = 12, //!< convert between RGB/BGR and BGR565 (16-bit images) - RGB2BGR565 = 13, - BGR5652BGR = 14, - BGR5652RGB = 15, - BGRA2BGR565 = 16, - RGBA2BGR565 = 17, - BGR5652BGRA = 18, - BGR5652RGBA = 19, - - GRAY2BGR565 = 20, //!< convert between grayscale to BGR565 (16-bit images) - BGR5652GRAY = 21, - - BGR2BGR555 = 22, //!< convert between RGB/BGR and BGR555 (16-bit images) - RGB2BGR555 = 23, - BGR5552BGR = 24, - BGR5552RGB = 25, - BGRA2BGR555 = 26, - RGBA2BGR555 = 27, - BGR5552BGRA = 28, - BGR5552RGBA = 29, - - GRAY2BGR555 = 30, //!< convert between grayscale and BGR555 (16-bit images) - BGR5552GRAY = 31, - - BGR2XYZ = 32, //!< convert RGB/BGR to CIE XYZ, @ref convert_rgb_xyz "color conversions" - RGB2XYZ = 33, - XYZ2BGR = 34, - XYZ2RGB = 35, - - BGR2YCrCb = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref convert_rgb_ycrcb "color conversions" - RGB2YCrCb = 37, - YCrCb2BGR = 38, - YCrCb2RGB = 39, - - BGR2HSV = 40, //!< convert RGB/BGR to HSV (hue saturation value), @ref convert_rgb_hsv "color conversions" - RGB2HSV = 41, - - BGR2Lab = 44, //!< convert RGB/BGR to CIE Lab, @ref convert_rgb_lab "color conversions" - RGB2Lab = 45, - - BGR2Luv = 50, //!< convert RGB/BGR to CIE Luv, @ref convert_rgb_luv "color conversions" - RGB2Luv = 51, - BGR2HLS = 52, //!< convert RGB/BGR to HLS (hue lightness saturation), @ref convert_rgb_hls "color conversions" - RGB2HLS = 53, - - HSV2BGR = 54, //!< backward conversions to RGB/BGR - HSV2RGB = 55, - - Lab2BGR = 56, - Lab2RGB = 57, - Luv2BGR = 58, - Luv2RGB = 59, - HLS2BGR = 60, - HLS2RGB = 61, - - BGR2HSV_FULL = 66, //!< - RGB2HSV_FULL = 67, - BGR2HLS_FULL = 68, - RGB2HLS_FULL = 69, - - HSV2BGR_FULL = 70, - HSV2RGB_FULL = 71, - HLS2BGR_FULL = 72, - HLS2RGB_FULL = 73, - - LBGR2Lab = 74, - LRGB2Lab = 75, - LBGR2Luv = 76, - LRGB2Luv = 77, - - Lab2LBGR = 78, - Lab2LRGB = 79, - Luv2LBGR = 80, - Luv2LRGB = 81, - - BGR2YUV = 82, //!< convert between RGB/BGR and YUV - RGB2YUV = 83, - YUV2BGR = 84, - YUV2RGB = 85, - - //! YUV 4:2:0 family to RGB - YUV2RGB_NV12 = 90, - YUV2BGR_NV12 = 91, - YUV2RGB_NV21 = 92, - YUV2BGR_NV21 = 93, - YUV420sp2RGB = YUV2RGB_NV21, - YUV420sp2BGR = YUV2BGR_NV21, - - YUV2RGBA_NV12 = 94, - YUV2BGRA_NV12 = 95, - YUV2RGBA_NV21 = 96, - YUV2BGRA_NV21 = 97, - YUV420sp2RGBA = YUV2RGBA_NV21, - YUV420sp2BGRA = YUV2BGRA_NV21, - - YUV2RGB_YV12 = 98, - YUV2BGR_YV12 = 99, - YUV2RGB_IYUV = 100, - YUV2BGR_IYUV = 101, - YUV2RGB_I420 = YUV2RGB_IYUV, - YUV2BGR_I420 = YUV2BGR_IYUV, - YUV420p2RGB = YUV2RGB_YV12, - YUV420p2BGR = YUV2BGR_YV12, - - YUV2RGBA_YV12 = 102, - YUV2BGRA_YV12 = 103, - YUV2RGBA_IYUV = 104, - YUV2BGRA_IYUV = 105, - YUV2RGBA_I420 = YUV2RGBA_IYUV, - YUV2BGRA_I420 = YUV2BGRA_IYUV, - YUV420p2RGBA = YUV2RGBA_YV12, - YUV420p2BGRA = YUV2BGRA_YV12, - - YUV2GRAY_420 = 106, - YUV2GRAY_NV21 = YUV2GRAY_420, - YUV2GRAY_NV12 = YUV2GRAY_420, - YUV2GRAY_YV12 = YUV2GRAY_420, - YUV2GRAY_IYUV = YUV2GRAY_420, - YUV2GRAY_I420 = YUV2GRAY_420, - YUV420sp2GRAY = YUV2GRAY_420, - YUV420p2GRAY = YUV2GRAY_420, - - //! YUV 4:2:2 family to RGB - YUV2RGB_UYVY = 107, - YUV2BGR_UYVY = 108, - //YUV2RGB_VYUY = 109, - //YUV2BGR_VYUY = 110, - YUV2RGB_Y422 = YUV2RGB_UYVY, - YUV2BGR_Y422 = YUV2BGR_UYVY, - YUV2RGB_UYNV = YUV2RGB_UYVY, - YUV2BGR_UYNV = YUV2BGR_UYVY, - - YUV2RGBA_UYVY = 111, - YUV2BGRA_UYVY = 112, - //YUV2RGBA_VYUY = 113, - //YUV2BGRA_VYUY = 114, - YUV2RGBA_Y422 = YUV2RGBA_UYVY, - YUV2BGRA_Y422 = YUV2BGRA_UYVY, - YUV2RGBA_UYNV = YUV2RGBA_UYVY, - YUV2BGRA_UYNV = YUV2BGRA_UYVY, - - YUV2RGB_YUY2 = 115, - YUV2BGR_YUY2 = 116, - YUV2RGB_YVYU = 117, - YUV2BGR_YVYU = 118, - YUV2RGB_YUYV = YUV2RGB_YUY2, - YUV2BGR_YUYV = YUV2BGR_YUY2, - YUV2RGB_YUNV = YUV2RGB_YUY2, - YUV2BGR_YUNV = YUV2BGR_YUY2, - - YUV2RGBA_YUY2 = 119, - YUV2BGRA_YUY2 = 120, - YUV2RGBA_YVYU = 121, - YUV2BGRA_YVYU = 122, - YUV2RGBA_YUYV = YUV2RGBA_YUY2, - YUV2BGRA_YUYV = YUV2BGRA_YUY2, - YUV2RGBA_YUNV = YUV2RGBA_YUY2, - YUV2BGRA_YUNV = YUV2BGRA_YUY2, - - YUV2GRAY_UYVY = 123, - YUV2GRAY_YUY2 = 124, - //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY, - YUV2GRAY_Y422 = YUV2GRAY_UYVY, - YUV2GRAY_UYNV = YUV2GRAY_UYVY, - YUV2GRAY_YVYU = YUV2GRAY_YUY2, - YUV2GRAY_YUYV = YUV2GRAY_YUY2, - YUV2GRAY_YUNV = YUV2GRAY_YUY2, - - //! alpha premultiplication - RGBA2mRGBA = 125, - mRGBA2RGBA = 126, - - //! RGB to YUV 4:2:0 family - RGB2YUV_I420 = 127, - BGR2YUV_I420 = 128, - RGB2YUV_IYUV = RGB2YUV_I420, - BGR2YUV_IYUV = BGR2YUV_I420, - - RGBA2YUV_I420 = 129, - BGRA2YUV_I420 = 130, - RGBA2YUV_IYUV = RGBA2YUV_I420, - BGRA2YUV_IYUV = BGRA2YUV_I420, - RGB2YUV_YV12 = 131, - BGR2YUV_YV12 = 132, - RGBA2YUV_YV12 = 133, - BGRA2YUV_YV12 = 134, - - //! Demosaicing - BayerBG2BGR = 46, - BayerGB2BGR = 47, - BayerRG2BGR = 48, - BayerGR2BGR = 49, - - BayerBG2RGB = BayerRG2BGR, - BayerGB2RGB = BayerGR2BGR, - BayerRG2RGB = BayerBG2BGR, - BayerGR2RGB = BayerGB2BGR, - - BayerBG2GRAY = 86, - BayerGB2GRAY = 87, - BayerRG2GRAY = 88, - BayerGR2GRAY = 89, - - //! Demosaicing using Variable Number of Gradients - BayerBG2BGR_VNG = 62, - BayerGB2BGR_VNG = 63, - BayerRG2BGR_VNG = 64, - BayerGR2BGR_VNG = 65, - - BayerBG2RGB_VNG = BayerRG2BGR_VNG, - BayerGB2RGB_VNG = BayerGR2BGR_VNG, - BayerRG2RGB_VNG = BayerBG2BGR_VNG, - BayerGR2RGB_VNG = BayerGB2BGR_VNG, - - //! Edge-Aware Demosaicing - BayerBG2BGR_EA = 135, - BayerGB2BGR_EA = 136, - BayerRG2BGR_EA = 137, - BayerGR2BGR_EA = 138, - - BayerBG2RGB_EA = BayerRG2BGR_EA, - BayerGB2RGB_EA = BayerGR2BGR_EA, - BayerRG2RGB_EA = BayerBG2BGR_EA, - BayerGR2RGB_EA = BayerGB2BGR_EA, - - COLORCVT_MAX = 139 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ColormapTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/ColormapTypes.cs deleted file mode 100644 index 58f115043..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ColormapTypes.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ - /// - /// GNU Octave/MATLAB equivalent colormaps - /// - public enum ColormapTypes : int - { - Autumn = 0, - Bone = 1, - Jet = 2, - Winter = 3, - Rainbow = 4, - Ocean = 5, - Summer = 6, - Spring = 7, - Cool = 8, - Hsv = 9, - Pink = 10, - Hot = 11, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ConnectedComponentsTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/ConnectedComponentsTypes.cs deleted file mode 100644 index cc1520033..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ConnectedComponentsTypes.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// components algorithm output formats - /// - public enum ConnectedComponentsTypes - { - /// - /// The leftmost (x) coordinate which is the inclusive start of the bounding - /// box in the horizontal direction. - /// - Left = 0, - - /// - /// The topmost (y) coordinate which is the inclusive start of the bounding - /// box in the vertical direction. - /// - Top = 1, - - /// - /// The horizontal size of the bounding box - /// - Width = 2, - - /// - /// The vertical size of the bounding box - /// - Height = 3, - - /// - /// The total area (in pixels) of the connected component - /// - Area = 4, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ContourApproximationModes.cs b/src/OpenCvSharp/modules/imgproc/Enum/ContourApproximationModes.cs deleted file mode 100644 index 83fe8ea9e..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ContourApproximationModes.cs +++ /dev/null @@ -1,64 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 輪郭の近似手法 - /// -#else - /// - /// Approximation method (for all the modes, except CV_RETR_RUNS, which uses built-in approximation). - /// -#endif - public enum ContourApproximationModes : int - { -#if LANG_JP - /// - /// [CHAIN_APPROX_NONE] - /// -#else - /// - /// CHAIN_APPROX_NONE - translate all the points from the chain code into points; - /// -#endif - ApproxNone = 1, - - -#if LANG_JP - /// - /// 水平・垂直・斜めの線分を圧縮し,それらの端点のみを残します.例えば,まっすぐな矩形の輪郭線は,4つの点にエンコードされます. [CV_CHAIN_APPROX_SIMPLE] - /// -#else - /// - /// CHAIN_APPROX_SIMPLE - compress horizontal, vertical, and diagonal segments, that is, the function leaves only their ending points; - /// -#endif - ApproxSimple = 2, - - -#if LANG_JP - /// - /// Teh-Chinチェーン近似アルゴリズムの1つを適用します. TehChin89 を参照してください. [CV_CHAIN_APPROX_TC89_L1] - /// -#else - /// - /// CHAIN_APPROX_TC89_L1 - apply one of the flavors of Teh-Chin chain approximation algorithm. - /// -#endif -// ReSharper disable once InconsistentNaming - ApproxTC89L1 = 3, - - -#if LANG_JP - /// - /// Teh-Chinチェーン近似アルゴリズムの1つを適用します. TehChin89 を参照してください. [CV_CHAIN_APPROX_TC89_KCOS] - /// -#else - /// - /// CHAIN_APPROX_TC89_KCOS - apply one of the flavors of Teh-Chin chain approximation algorithm. - /// -#endif -// ReSharper disable once InconsistentNaming - ApproxTC89KCOS = 4, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/DistanceMaskSize.cs b/src/OpenCvSharp/modules/imgproc/Enum/DistanceMaskSize.cs deleted file mode 100644 index d5e45631c..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/DistanceMaskSize.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 距離変換 (distance transform) のマスクサイズ - /// -#else - /// - /// Mask size for distance transform - /// -#endif - [Flags] - public enum DistanceMaskSize : int - { - /// - /// 3 - /// - Mask3 = 3, - - /// - /// 5 - /// - Mask5 = 5, - - /// - /// - /// - Precise = 0, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/DistanceTransformLabelTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/DistanceTransformLabelTypes.cs deleted file mode 100644 index 45d0db6a7..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/DistanceTransformLabelTypes.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// distanceTransform algorithm flags - /// - public enum DistanceTransformLabelTypes : int - { - /// - /// each connected component of zeros in src - /// (as well as all the non-zero pixels closest to the connected component) - /// will be assigned the same label - /// - CComp = 0, - - /// - /// each zero pixel (and all the non-zero pixels closest to it) gets its own label. - /// - Pixel = 1, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/DistanceTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/DistanceTypes.cs deleted file mode 100644 index 992ec29b3..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/DistanceTypes.cs +++ /dev/null @@ -1,55 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvDistTransformで指定する距離の種類 - /// -#else - /// - /// Type of distance for cvDistTransform - /// -#endif - public enum DistanceTypes : int - { - /// - /// User defined distance [CV_DIST_USER] - /// - User = -1, - - /// - /// distance = |x1-x2| + |y1-y2| [CV_DIST_L1] - /// - L1 = 1, - - /// - /// the simple euclidean distance [CV_DIST_L2] - /// - L2 = 2, - - /// - /// distance = max(|x1-x2|,|y1-y2|) [CV_DIST_C] - /// - C = 3, - - /// - /// L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) [CV_DIST_L12] - /// - L12 = 4, - - /// - /// distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 [CV_DIST_FAIR] - /// - Fair = 5, - - /// - /// distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 [CV_DIST_WELSCH] - /// - Welsch = 6, - - /// - /// distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 [CV_DIST_HUBER] - /// - Huber = 7, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/FlipMode.cs b/src/OpenCvSharp/modules/imgproc/Enum/FlipMode.cs deleted file mode 100644 index be9090801..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/FlipMode.cs +++ /dev/null @@ -1,50 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 配列の反転方法 - /// -#else - /// - /// Specifies how to flip the array - /// -#endif - public enum FlipMode : int - { -#if LANG_JP - /// - /// x軸周りでの反転 - /// -#else - /// - /// means flipping around x-axis - /// -#endif - X = 0, - - -#if LANG_JP - /// - /// y軸周りでの反転 - /// -#else - /// - /// means flipping around y-axis - /// -#endif - Y = 1, - - -#if LANG_JP - /// - /// 両軸周りでの反転 - /// -#else - /// - /// means flipping around both axises - /// -#endif - XY = -1 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/FloodFillFlags.cs b/src/OpenCvSharp/modules/imgproc/Enum/FloodFillFlags.cs deleted file mode 100644 index 86481c75b..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/FloodFillFlags.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// floodFillの処理フラグ - /// -#else - /// - /// floodFill Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered. Upper bits can be 0 or a combination of the following flags: - /// -#endif - [Flags] - public enum FloodFillFlags : int - { -#if LANG_JP - /// - /// 4連結による線分 - /// [= 4] - /// -#else - /// - /// 4-connected line. - /// [= 4] - /// -#endif - Link4 = 4, - -#if LANG_JP - /// - /// 8連結による線分 - /// [= 8] - /// -#else - /// - /// 8-connected line. - /// [= 8] - /// -#endif - Link8 = 8, - -#if LANG_JP - /// - /// If set, the difference between the current pixel and seed pixel is considered. Otherwise, the difference between neighbor pixels is considered (that is, the range is floating). - /// [CV_FLOODFILL_FIXED_RANGE] - /// -#else - /// - /// If set, the difference between the current pixel and seed pixel is considered. Otherwise, the difference between neighbor pixels is considered (that is, the range is floating). - /// [CV_FLOODFILL_FIXED_RANGE] - /// -#endif - FixedRange = 1 << 16, - - -#if LANG_JP - /// - /// If set, the function does not change the image ( newVal is ignored), but fills the mask. The flag can be used for the second variant only. - /// [CV_FLOODFILL_MASK_ONLY] - /// -#else - /// - /// If set, the function does not change the image ( newVal is ignored), but fills the mask. The flag can be used for the second variant only. - /// [CV_FLOODFILL_MASK_ONLY] - /// -#endif - MaskOnly = 1 << 17, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/GrabCutClasses.cs b/src/OpenCvSharp/modules/imgproc/Enum/GrabCutClasses.cs deleted file mode 100644 index 7338e2962..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/GrabCutClasses.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// class of the pixel in GrabCut algorithm - /// - public enum GrabCutClasses - { - /// - /// an obvious background pixels - /// - BGD = 0, - - /// - /// an obvious foreground (object) pixel - /// - FGD = 1, - - /// - /// a possible background pixel - /// - PR_BGD = 2, - - /// - /// a possible foreground pixel - /// - PR_FGD = 3 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/GrabCutModes.cs b/src/OpenCvSharp/modules/imgproc/Enum/GrabCutModes.cs deleted file mode 100644 index 07dc05917..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/GrabCutModes.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// GrabCutの処理フラグ - /// -#else - /// - /// GrabCut algorithm flags - /// -#endif - [Flags] - public enum GrabCutModes - { -#if LANG_JP - /// - /// 与えられた矩形を用いて,状態とマスクを初期化します. - /// その後,アルゴリズムが iterCount 回繰り返されます. - /// -#else - /// - /// The function initializes the state and the mask using the provided rectangle. - /// After that it runs iterCount iterations of the algorithm. - /// -#endif - InitWithRect = 0, - - -#if LANG_JP - /// - /// 与えられたマスクを用いて状態を初期化します. - /// GC_INIT_WITH_RECT と GC_INIT_WITH_MASK は,一緒に使うことができる - /// ことに注意してください.そして,ROIの外側の全ピクセルは自動的に - /// GC_BGD として初期化されます. - /// -#else - /// - /// The function initializes the state using the provided mask. - /// Note that GC_INIT_WITH_RECT and GC_INIT_WITH_MASK can be combined. - /// Then, all the pixels outside of the ROI are automatically initialized with GC_BGD . - /// -#endif - InitWithMask = 1, - - -#if LANG_JP - /// - /// アルゴリズムがすぐに再開することを意味する値. - /// -#else - /// - /// The value means that the algorithm should just resume. - /// -#endif - Eval = 2, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/HistCompMethods.cs b/src/OpenCvSharp/modules/imgproc/Enum/HistCompMethods.cs deleted file mode 100644 index 1c8c7d54c..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/HistCompMethods.cs +++ /dev/null @@ -1,80 +0,0 @@ -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvCompareHistで用いる、CvHistogramの比較方法 - /// -#else - /// - /// Comparison methods for cvCompareHist - /// -#endif - public enum HistCompMethods : int - { -#if LANG_JP - /// - /// 相関 [CV_COMP_CORREL] - /// -#else - /// - /// Correlation [CV_COMP_CORREL] - /// -#endif - Correl = 0, - - -#if LANG_JP - /// - /// カイ二乗 [CV_COMP_CHISQR] - /// -#else - /// - /// Chi-Square [CV_COMP_CHISQR] - /// -#endif - Chisqr = 1, - - -#if LANG_JP - /// - /// 交差 [CV_COMP_INTERSECT] - /// -#else - /// - /// Intersection [CV_COMP_INTERSECT] - /// -#endif - Intersect = 2, - - -#if LANG_JP - /// - /// Bhattacharyya距離 [CV_COMP_BHATTACHARYYA]. 正規化されたヒストグラムでのみ実行可能である. - /// -#else - /// - /// Bhattacharyya distance [CV_COMP_BHATTACHARYYA] - /// -#endif - Bhattacharyya = 3, - - /// - /// Synonym for HISTCMP_BHATTACHARYYA - /// - Hellinger = Bhattacharyya, - - /// - /// Alternative Chi-Square - /// \f[d(H_1,H_2) = 2 * \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\f] - /// This alternative formula is regularly used for texture comparison. See e.g. @cite Puzicha1997 - /// - ChisqrAlt = 4, - - /// - /// Kullback-Leibler divergence - /// \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] - /// -// ReSharper disable once InconsistentNaming - KLDiv = 5 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/HoughMethods.cs b/src/OpenCvSharp/modules/imgproc/Enum/HoughMethods.cs deleted file mode 100644 index 11111917d..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/HoughMethods.cs +++ /dev/null @@ -1,44 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// ハフ変換の種類 - /// -#else - /// - /// Variants of a Hough transform - /// -#endif - public enum HoughMethods : int - { - /* */ - /// - /// classical or standard Hough transform. - /// Every line is represented by two floating-point numbers \f$(\rho, \theta)\f$ , - /// where \f$\rho\f$ is a distance between (0,0) point and the line, - /// and \f$\theta\f$ is the angle between x-axis and the normal to the line. - /// Thus, the matrix must be (the created sequence will be) of CV_32FC2 type - /// - Standard = 0, - - /// - /// probabilistic Hough transform (more efficient in case if the picture contains - /// a few long linear segments). It returns line segments rather than the whole line. - /// Each segment is represented by starting and ending points, and the matrix must be - /// (the created sequence will be) of the CV_32SC4 type. - /// - Probabilistic = 1, - - /// - /// multi-scale variant of the classical Hough transform. - /// The lines are encoded the same way as HOUGH_STANDARD. - /// - MultiScale = 2, - - /// - /// basically *21HT*, described in @cite Yuen90 - /// - Gradient = 3 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/InterpolationFlags.cs b/src/OpenCvSharp/modules/imgproc/Enum/InterpolationFlags.cs deleted file mode 100644 index 43b971732..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/InterpolationFlags.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 画像の補間方法 - /// -#else - /// - /// Interpolation algorithm - /// -#endif - [Flags] - public enum InterpolationFlags : int - { -#if LANG_JP - /// - /// 最近隣接補間 - /// -#else - /// - /// Nearest-neighbor interpolation, - /// -#endif - Nearest = 0, - -#if LANG_JP - /// - /// バイリニア補間 - /// -#else - /// - /// Bilinear interpolation (used by default) - /// -#endif - Linear = 1, - -#if LANG_JP - /// - /// バイキュービック補間 - /// -#else - /// - /// Bicubic interpolation. - /// -#endif - Cubic = 2, - -#if LANG_JP - /// - /// ピクセル領域の関係を用いてリサンプリングする.画像縮小の際は,モアレの無い処理結果を得ることができる手法である.拡大の際は,CV_INTER_NN と同様 . - /// -#else - /// - /// Resampling using pixel area relation. It is the preferred method for image decimation that gives moire-free results. In case of zooming it is similar to CV_INTER_NN method. - /// -#endif - Area = 3, - - /// - /// Lanczos interpolation over 8x8 neighborhood - /// - Lanczos4 = 4, - - /// - /// mask for interpolation codes - /// - Max = 7, - -#if LANG_JP - /// - /// 出力画像の全ピクセルの値を埋める.対応ピクセルが入力画像外であるようなピクセルである場合は, fillvalがセットされる - /// -#else - /// - /// Fill all the destination image pixels. If some of them correspond to outliers in the source image, they are set to fillval. - /// -#endif - WarpFillOutliers = 8, - -#if LANG_JP - /// - /// このフラグは map_matrixが出力画像から入力画像への逆変換のための行列であることを意味するので,直接ピクセル補間に用いることができる. - /// これがセットされていない場合,この関数は map_matrix を使って逆変換を計算する. - /// -#else - /// - /// Indicates that matrix is inverse transform from destination image to source and, - /// thus, can be used directly for pixel interpolation. Otherwise, the function finds the inverse transform from map_matrix. - /// -#endif - WarpInverseMap = 16, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/LineSegmentDetectorModes.cs b/src/OpenCvSharp/modules/imgproc/Enum/LineSegmentDetectorModes.cs deleted file mode 100644 index f85d2a25c..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/LineSegmentDetectorModes.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// Variants of Line Segment %Detector - /// - public enum LineSegmentDetectorModes : int - { - /// - /// No refinement applied - /// - RefineNone = 0, - - /// - /// Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations. - /// - RefineStd = 1, - - /// - /// Advanced refinement. Number of false alarms is calculated, lines are - /// refined through increase of precision, decrement in size, etc. - /// - RefineAdv = 2, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/LineTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/LineTypes.cs deleted file mode 100644 index af5edd182..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/LineTypes.cs +++ /dev/null @@ -1,35 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 線分の種類 - /// -#else - /// - /// Type of the line - /// -#endif - public enum LineTypes : int - { - /// - /// - /// - Filled = -1, - - /// - /// 8-connected line. - /// - Link8 = 8, - - /// - /// 4-connected line. - /// - Link4 = 4, - - /// - /// Antialiased line. - /// - AntiAlias = 16 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/MarkerStyle.cs b/src/OpenCvSharp/modules/imgproc/Enum/MarkerStyle.cs deleted file mode 100644 index 91b75783d..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/MarkerStyle.cs +++ /dev/null @@ -1,125 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// Mat.DrawMarkerで用いるマーカーの形状 - /// -#else - /// - /// Marker styles for Mat.DrawMarker - /// -#endif - public enum MarkerStyle : int - { -#if LANG_JP - /// - /// 円(線のみ) - /// -#else - /// - /// A circle polyline - /// -#endif - CircleLine, - -#if LANG_JP - /// - /// 円(塗りつぶし) - /// -#else - /// - /// A filled circle - /// -#endif - CircleFilled, - -#if LANG_JP - /// - /// 十字 - /// -#else - /// - /// A cross - /// -#endif - Cross, - -#if LANG_JP - /// - /// バツ - /// -#else - /// - /// A tilted cross - /// -#endif - TiltedCross, - -#if LANG_JP - /// - /// 円と十字 - /// -#else - /// - /// A circle and a cross - /// -#endif - CircleAndCross, - -#if LANG_JP - /// - /// 円とバツ - /// -#else - /// - /// A circle and a tilted cross - /// -#endif - CircleAndTiltedCross, - -#if LANG_JP - /// - /// 菱形(線のみ) - /// -#else - /// - /// A diamond polyline - /// -#endif - DiamondLine, - -#if LANG_JP - /// - /// 菱形(塗りつぶし) - /// -#else - /// - /// A filled diamond - /// -#endif - DiamondFilled, - -#if LANG_JP - /// - /// 正方形(線のみ) - /// -#else - /// - /// A square polyline - /// -#endif - SquareLine, - -#if LANG_JP - /// - /// 正方形(塗りつぶし) - /// -#else - /// - /// A filledsquare - /// -#endif - SquareFilled, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/MorphShapes.cs b/src/OpenCvSharp/modules/imgproc/Enum/MorphShapes.cs deleted file mode 100644 index d760bd4e1..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/MorphShapes.cs +++ /dev/null @@ -1,50 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 構造要素の形状 - /// -#else - /// - /// Shape of the structuring element - /// -#endif - public enum MorphShapes : int - { -#if LANG_JP - /// - /// 矩形 - /// -#else - /// - /// A rectangular element - /// -#endif - Rect = 0, - - -#if LANG_JP - /// - /// 十字型 - /// -#else - /// - /// A cross-shaped element - /// -#endif - Cross = 1, - - -#if LANG_JP - /// - /// 楕円 - /// -#else - /// - /// An elliptic element - /// -#endif - Ellipse = 2, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/MorphTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/MorphTypes.cs deleted file mode 100644 index 431f8c688..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/MorphTypes.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// モルフォロジー演算の種類 - /// -#else - /// - /// Type of morphological operation - /// -#endif - [Flags] - public enum MorphTypes : int - { - /// - /// - /// - ERODE = 0, - - /// - /// - /// - DILATE = 1, - -#if LANG_JP - /// - /// オープニング [CV_MOP_OPEN]. - /// dst=open(src,element)=dilate(erode(src,element),element) - /// -#else - /// - /// Opening - /// -#endif - Open = 2, - - -#if LANG_JP - /// - /// クロージング [CV_MOP_CLOSE]. - /// dst=close(src,element)=erode(dilate(src,element),element) - /// -#else - /// - /// Closing - /// -#endif - Close = 3, - - -#if LANG_JP - /// - /// モルフォロジー勾配(エッジ検出) [CV_MOP_GRADIENT]. - /// dst=morph_grad(src,element)=dilate(src,element)-erode(src,element) - /// -#else - /// - /// Morphological gradient - /// -#endif - Gradient = 4, - - -#if LANG_JP - /// - /// トップハット変換(top hat) [CV_MOP_TOPHAT]. - /// dst=tophat(src,element)=src-open(src,element) - /// -#else - /// - /// "Top hat" - /// -#endif - TopHat = 5, - - -#if LANG_JP - /// - /// ブラックハット変換(black hat) [CV_MOP_BLACKHAT] - /// dst=blackhat(src,element)=close(src,element)-src - /// -#else - /// - /// "Black hat" - /// -#endif - BlackHat = 6, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/PixelConnectivity.cs b/src/OpenCvSharp/modules/imgproc/Enum/PixelConnectivity.cs deleted file mode 100644 index 093aaec12..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/PixelConnectivity.cs +++ /dev/null @@ -1,38 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// CvLineIteratorにおける、走査した線分の接続性 - /// -#else - /// - /// PixelConnectivity for LineIterator - /// -#endif - public enum PixelConnectivity : int - { -#if LANG_JP - /// - /// 周囲4方向(上下左右) - /// -#else - /// - /// Connectivity 4 (N,S,E,W) - /// -#endif - Connectivity4 = 4, - - -#if LANG_JP - /// - /// 周囲8方向 - /// -#else - /// - /// Connectivity 8 (N,S,E,W,NE,SE,SW,NW) - /// -#endif - Connectivity8 = 8, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ProjectionType.cs b/src/OpenCvSharp/modules/imgproc/Enum/ProjectionType.cs deleted file mode 100644 index 9caf14f9e..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ProjectionType.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// cv::initWideAngleProjMap flags - /// - public enum ProjectionType : int - { - /// - /// - /// - None = 0, - - /// - /// - /// - SphericalOrtho = 0, - - /// - /// - /// - SphericalEqRect = 1, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/RectanglesIntersectTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/RectanglesIntersectTypes.cs deleted file mode 100644 index 920e0ff81..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/RectanglesIntersectTypes.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// types of intersection between rectangles - /// - public enum RectanglesIntersectTypes - { - /// - /// No intersection - /// - None = 0, - - /// - /// There is a partial intersection - /// - Partial = 1, - - /// - /// One of the rectangle is fully enclosed in the other - /// - Full = 2 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/RetrievalModes.cs b/src/OpenCvSharp/modules/imgproc/Enum/RetrievalModes.cs deleted file mode 100644 index 9a8926de1..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/RetrievalModes.cs +++ /dev/null @@ -1,80 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 輪郭の抽出モード - /// -#else - /// - /// mode of the contour retrieval algorithm - /// -#endif - public enum RetrievalModes : int - { -#if LANG_JP - /// - /// 最も外側の輪郭のみ抽出 - /// -#else - /// - /// retrieves only the extreme outer contours. - /// It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for all the contours. - /// -#endif - External = 0, - -#if LANG_JP - /// - /// 全ての輪郭を抽出し,リストに追加 - /// [CV_RETR_LIST] - /// -#else - /// - /// retrieves all of the contours without establishing any hierarchical relationships. - /// -#endif - List = 1, - - -#if LANG_JP - /// - /// 全ての輪郭を抽出し,二つのレベルを持つ階層構造を構成する.1番目のレベルは連結成分の外側の境界線,2番目のレベルは穴(連結成分の内側に存在する)の境界線 - /// -#else - /// - /// retrieves all of the contours and organizes them into a two-level hierarchy. - /// At the top level, there are external boundaries of the components. - /// At the second level, there are boundaries of the holes. If there is another - /// contour inside a hole of a connected component, it is still put at the top level. - /// -#endif - CComp = 2, - - -#if LANG_JP - /// - /// 全ての輪郭を抽出し,枝分かれした輪郭を完全に表現する階層構造を構成する - /// -#else - /// - /// retrieves all of the contours and reconstructs a full hierarchy - /// of nested contours. - /// -#endif - Tree = 3, - - -#if LANG_JP - /// - /// - /// [CV_RETR_FLOODFILL] - /// -#else - /// - /// - /// -#endif - FloodFill = 4, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ShapeMatchModes.cs b/src/OpenCvSharp/modules/imgproc/Enum/ShapeMatchModes.cs deleted file mode 100644 index 095255054..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ShapeMatchModes.cs +++ /dev/null @@ -1,30 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cv::matchShapesで用いる比較手法 - /// -#else - /// - /// Comparison methods for cv::matchShapes - /// -#endif - public enum ShapeMatchModes : int - { - /// - /// \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f] - /// - I1 = 1, - - /// - /// \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f] - /// - I2 = 2, - - /// - /// \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f] - /// - I3 = 3, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/TemplateMatchModes.cs b/src/OpenCvSharp/modules/imgproc/Enum/TemplateMatchModes.cs deleted file mode 100644 index 39fc164a1..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/TemplateMatchModes.cs +++ /dev/null @@ -1,47 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// テンプレートマッチングの方法 - /// -#else - /// - /// Specifies the way the template must be compared with image regions - /// -#endif - public enum TemplateMatchModes : int - { - /// - /// \f[R(x,y)= \sum _{x',y'} (T(x',y')-I(x+x',y+y'))^2\f] - /// - SqDiff = 0, - - /// - /// \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y')-I(x+x',y+y'))^2}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] - /// - SqDiffNormed = 1, - - /// - /// \f[R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y'))\f] - /// - CCorr = 2, - - /// - /// \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] - /// - CCorrNormed = 3, - - /// - /// \f[R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I'(x+x',y+y'))\f] - /// where - /// \f[\begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array}\f] - /// - CCoeff = 4, - - /// - /// \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f] - /// - CCoeffNormed = 5, - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Enum/ThresholdTypes.cs b/src/OpenCvSharp/modules/imgproc/Enum/ThresholdTypes.cs deleted file mode 100644 index fb5d5272a..000000000 --- a/src/OpenCvSharp/modules/imgproc/Enum/ThresholdTypes.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 閾値処理の種類 - /// -#else - /// - /// Thresholding type - /// -#endif - [Flags] - public enum ThresholdTypes : int - { - /// - /// \f[\texttt{dst} (x,y) = \fork{\texttt{maxval}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] - /// - Binary = 0, - - /// - /// \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\f] - /// - BinaryInv = 1, - - /// - /// \f[\texttt{dst} (x,y) = \fork{\texttt{threshold}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] - /// - Trunc = 2, - - /// - /// \f[\texttt{dst} (x,y) = \fork{\texttt{src}(x,y)}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] - /// - Tozero = 3, - - /// - /// \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] - /// - TozeroInv = 4, - - /// - /// - /// - Mask = 7, - - /// - /// flag, use Otsu algorithm to choose the optimal threshold value - /// - Otsu = 8, - - /// - /// flag, use Triangle algorithm to choose the optimal threshold value - /// - Triangle = 16 - } -} diff --git a/src/OpenCvSharp/modules/imgproc/GeneralizedHough.cs b/src/OpenCvSharp/modules/imgproc/GeneralizedHough.cs deleted file mode 100644 index e7bc651c4..000000000 --- a/src/OpenCvSharp/modules/imgproc/GeneralizedHough.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// finds arbitrary template in the grayscale image using Generalized Hough Transform - /// - public abstract class GeneralizedHough : Algorithm - { - /// - /// Canny low threshold. - /// - /// - public int CannyLowThresh - { - get - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.imgproc_GeneralizedHough_getCannyLowThresh(ptr); - } - set - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - NativeMethods.imgproc_GeneralizedHough_setCannyLowThresh(ptr, value); - } - } - - /// - /// Canny high threshold. - /// - /// - public int CannyHighThresh - { - get - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.imgproc_GeneralizedHough_getCannyHighThresh(ptr); - } - set - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - NativeMethods.imgproc_GeneralizedHough_setCannyHighThresh(ptr, value); - } - } - - /// - /// Minimum distance between the centers of the detected objects. - /// - /// - public double MinDist - { - get - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.imgproc_GeneralizedHough_getMinDist(ptr); - } - set - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - NativeMethods.imgproc_GeneralizedHough_setMinDist(ptr, value); - } - } - - /// - /// Inverse ratio of the accumulator resolution to the image resolution. - /// - /// - public double Dp - { - get - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.imgproc_GeneralizedHough_getDp(ptr); - } - set - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - NativeMethods.imgproc_GeneralizedHough_setDp(ptr, value); - } - } - - /// - /// Maximal size of inner buffers. - /// - /// - public int MaxBufferSize - { - get - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.imgproc_GeneralizedHough_getMaxBufferSize(ptr); - } - set - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - NativeMethods.imgproc_GeneralizedHough_setMaxBufferSize(ptr, value); - } - } - - /// - /// set template to search - /// - /// - /// - public void SetTemplate(InputArray templ, Point? templCenter = null) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (templ == null) - throw new ArgumentNullException(nameof(templ)); - templ.ThrowIfDisposed(); - var templCenterValue = templCenter.GetValueOrDefault(new Point(-1, -1)); - - NativeMethods.imgproc_GeneralizedHough_setTemplate1(ptr, templ.CvPtr, templCenterValue); - - GC.KeepAlive(templ); - } - - /// - /// set template to search - /// - /// - /// - /// - /// - public virtual void SetTemplate(InputArray edges, InputArray dx, InputArray dy, Point? templCenter = null) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (edges == null) - throw new ArgumentNullException(nameof(edges)); - if (dx == null) - throw new ArgumentNullException(nameof(dx)); - if (dy == null) - throw new ArgumentNullException(nameof(dy)); - edges.ThrowIfDisposed(); - dx.ThrowIfDisposed(); - dy.ThrowIfDisposed(); - var templCenterValue = templCenter.GetValueOrDefault(new Point(-1, -1)); - - NativeMethods.imgproc_GeneralizedHough_setTemplate2( - ptr, edges.CvPtr, dx.CvPtr, dy.CvPtr, templCenterValue); - - GC.KeepAlive(edges); - GC.KeepAlive(dx); - GC.KeepAlive(dy); - } - - /// - /// find template on image - /// - /// - /// - /// - public virtual void Detect( - InputArray image, OutputArray positions, OutputArray votes = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (positions == null) - throw new ArgumentNullException(nameof(positions)); - image.ThrowIfDisposed(); - positions.ThrowIfNotReady(); - if (votes != null) - votes.ThrowIfNotReady(); - - NativeMethods.imgproc_GeneralizedHough_detect1( - ptr, image.CvPtr, positions.CvPtr, Cv2.ToPtr(votes)); - - GC.KeepAlive(image); - positions.Fix(); - if (votes != null) - votes.Fix(); - } - - /// - /// find template on image - /// - /// - /// - /// - /// - /// - public virtual void Detect( - InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = null) - { - if (edges == null) - throw new ArgumentNullException(nameof(edges)); - if (dx == null) - throw new ArgumentNullException(nameof(dx)); - if (dy == null) - throw new ArgumentNullException(nameof(dy)); - if (positions == null) - throw new ArgumentNullException(nameof(positions)); - edges.ThrowIfDisposed(); - dx.ThrowIfDisposed(); - dy.ThrowIfDisposed(); - positions.ThrowIfNotReady(); - if (votes != null) - votes.ThrowIfNotReady(); - - NativeMethods.imgproc_GeneralizedHough_detect2( - ptr, edges.CvPtr, dx.CvPtr, dy.CvPtr, positions.CvPtr, Cv2.ToPtr(votes)); - - GC.KeepAlive(edges); - GC.KeepAlive(dx); - GC.KeepAlive(dy); - positions.Fix(); - if (votes != null) - votes.Fix(); - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/GeneralizedHoughBallard.cs b/src/OpenCvSharp/modules/imgproc/GeneralizedHoughBallard.cs deleted file mode 100644 index 86fd0c83f..000000000 --- a/src/OpenCvSharp/modules/imgproc/GeneralizedHoughBallard.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. - /// Pattern Recognition 13 (2): 111-122. - /// Detects position only without traslation and rotation - /// - public class GeneralizedHoughBallard : GeneralizedHough - { - /// - /// cv::Ptr<T> object - /// - private Ptr ptrObj; - - /// - /// - /// - private GeneralizedHoughBallard(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates a predefined GeneralizedHoughBallard object - /// - /// - public static GeneralizedHoughBallard Create() - { - IntPtr ptr = NativeMethods.imgproc_createGeneralizedHoughBallard(); - return new GeneralizedHoughBallard(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - /// - /// R-Table levels. - /// - /// - public int Levels - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughBallard_getLevels(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughBallard_setLevels(ptr, value); - } - } - - /// - /// The accumulator threshold for the template centers at the detection stage. - /// The smaller it is, the more false positions may be detected. - /// - /// - public int VotesThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughBallard_getVotesThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughBallard_setVotesThreshold(ptr, value); - } - } - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.imgproc_Ptr_GeneralizedHoughBallard_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.imgproc_Ptr_GeneralizedHoughBallard_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/GeneralizedHoughGuil.cs b/src/OpenCvSharp/modules/imgproc/GeneralizedHoughGuil.cs deleted file mode 100644 index cb14e82e9..000000000 --- a/src/OpenCvSharp/modules/imgproc/GeneralizedHoughGuil.cs +++ /dev/null @@ -1,281 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). - /// Bidimensional shape detection using an invariant approach. - /// Pattern Recognition 32 (6): 1025-1038. - /// Detects position, traslation and rotation - /// - public class GeneralizedHoughGuil : GeneralizedHough - { - /// - /// cv::Ptr<T> object - /// - private Ptr ptrObj; - - /// - /// - /// - private GeneralizedHoughGuil(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates a predefined GeneralizedHoughBallard object - /// - /// - public static GeneralizedHoughGuil Create() - { - IntPtr ptr = NativeMethods.imgproc_createGeneralizedHoughGuil(); - return new GeneralizedHoughGuil(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - /// - /// Angle difference in degrees between two points in feature. - /// - /// - public double Xi - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getXi(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setXi(ptr, value); - } - } - - /// - /// Feature table levels. - /// - /// - public int Levels - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getLevels(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setLevels(ptr, value); - } - } - - /// - /// Maximal difference between angles that treated as equal. - /// - /// - public double AngleEpsilon - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getAngleEpsilon(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setAngleEpsilon(ptr, value); - } - } - - /// - /// Minimal rotation angle to detect in degrees. - /// - /// - public double MinAngle - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getMinAngle(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setMinAngle(ptr, value); - } - } - - /// - /// Maximal rotation angle to detect in degrees. - /// - /// - public double MaxAngle - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getMaxAngle(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setMaxAngle(ptr, value); - } - } - - /// - /// Angle step in degrees. - /// - /// - public double AngleStep - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getAngleStep(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setAngleStep(ptr, value); - } - } - - /// - /// Angle votes threshold. - /// - /// - public int AngleThresh - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getAngleThresh(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setAngleThresh(ptr, value); - } - } - - /// - /// Minimal scale to detect. - /// - /// - public double MinScale - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getMinScale(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setMinScale(ptr, value); - } - } - - /// - /// Maximal scale to detect. - /// - /// - public double MaxScale - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getMaxScale(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setMaxScale(ptr, value); - } - } - - /// - /// Scale step. - /// - /// - public double ScaleStep - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getScaleStep(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setScaleStep(ptr, value); - } - } - - /// - /// Scale votes threshold. - /// - /// - public int ScaleThresh - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getScaleThresh(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setScaleThresh(ptr, value); - } - } - - /// - /// Position votes threshold. - /// - /// - public int PosThresh - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_GeneralizedHoughGuil_getPosThresh(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.imgproc_GeneralizedHoughGuil_setPosThresh(ptr, value); - } - } - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.imgproc_Ptr_GeneralizedHoughGuil_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.imgproc_Ptr_GeneralizedHoughBallard_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/LineIterator.cs b/src/OpenCvSharp/modules/imgproc/LineIterator.cs deleted file mode 100644 index 6cd0da288..000000000 --- a/src/OpenCvSharp/modules/imgproc/LineIterator.cs +++ /dev/null @@ -1,281 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// Contrast Limited Adaptive Histogram Equalization - /// - public sealed class LineIterator : DisposableCvObject, IEnumerable - { - private readonly Mat img; - private readonly Point pt1; - private readonly Point pt2; - private readonly PixelConnectivity connectivity; - private readonly bool leftToRight; - - /// - /// Constructor - /// - /// - /// - /// - /// - /// - /// - public LineIterator( - Mat img, - Point pt1, - Point pt2, - PixelConnectivity connectivity = PixelConnectivity.Connectivity8, - bool leftToRight = false) - { - if (img == null) - throw new ArgumentNullException(nameof(img)); - this.img = img; - this.pt1 = pt1; - this.pt2 = pt2; - this.connectivity = connectivity; - this.leftToRight = leftToRight; - } - - /// - /// Intializes the iterator - /// - /// - private void Initialize() - { - if (ptr != IntPtr.Zero) - throw new OpenCvSharpException("invalid state"); - img.ThrowIfDisposed(); - - ptr = NativeMethods.imgproc_LineIterator_new( - img.CvPtr, pt1, pt2, (int)connectivity, leftToRight ? 1 : 0); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.imgproc_LineIterator_delete(ptr); - base.DisposeUnmanaged(); - } - - /// - /// - /// - /// - public IEnumerator GetEnumerator() - { - //if (disposed) - // throw new ObjectDisposedException(GetType().Name); - Dispose(); - Initialize(); - - int count = NativeMethods.imgproc_LineIterator_count_get(ptr); - for (int i = 0; i < count; i++) - { - Point pos = NativeMethods.imgproc_LineIterator_pos(ptr); - IntPtr value = NativeMethods.imgproc_LineIterator_operatorEntity(ptr); - yield return new Pixel(pos, value); - - NativeMethods.imgproc_LineIterator_operatorPP(ptr); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - #region Properties - - /// - /// - /// - public IntPtr Ptr - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_ptr_get(ptr); - } - } - - /// - /// - /// - public IntPtr Ptr0 - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_ptr0_get(ptr); - } - } - - /// - /// - /// - public int Step - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_step_get(ptr); - } - } - - /// - /// - /// - public int ElemSize - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_elemSize_get(ptr); - } - } - - /// - /// - /// - public int Err - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_err_get(ptr); - } - } - - /// - /// - /// - public int Count - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_count_get(ptr); - } - } - - /// - /// - /// - public int MinusDelta - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_minusDelta_get(ptr); - } - } - - /// - /// - /// - public int PlusDelta - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_plusDelta_get(ptr); - } - } - - /// - /// - /// - public int MinusStep - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_minusStep_get(ptr); - } - } - - /// - /// - /// - public int PlusStep - { - get - { - ThrowIfDisposed(); - return NativeMethods.imgproc_LineIterator_plusStep_get(ptr); - } - } - - #endregion - - /// - /// LineIterator pixel data - /// - public class Pixel - { - /// - /// - /// - public unsafe byte* ValuePointer { get; } - - /// - /// - /// - public Point Pos { get; private set; } - - /// - /// - /// - public IntPtr Value - { - get - { - unsafe - { - return new IntPtr(ValuePointer); - } - } - } - - /// - /// - /// - /// - /// - public T GetValue() where T : struct - { - return MarshalHelper.PtrToStructure(Value); - } - - /// - /// - /// - /// - /// - /// - public void SetValue(T value) where T : struct - { - Marshal.StructureToPtr(value, Value, false); - } - - /// - /// Constructor - /// - /// - /// - internal unsafe Pixel(Point pos, IntPtr value) - { - Pos = pos; - ValuePointer = (byte*)value.ToPointer(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/LineSegmentDetector.cs b/src/OpenCvSharp/modules/imgproc/LineSegmentDetector.cs deleted file mode 100644 index 637c60091..000000000 --- a/src/OpenCvSharp/modules/imgproc/LineSegmentDetector.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// Line segment detector class - /// - public class LineSegmentDetector : Algorithm - { - /// - /// cv::Ptr<LineSegmentDetector> - /// - private Ptr ptrObj; - - /// - /// - /// - protected LineSegmentDetector(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates a smart pointer to a LineSegmentDetector object and initializes it. - /// - /// The way found lines will be refined, see cv::LineSegmentDetectorModes - /// The scale of the image that will be used to find the lines. Range (0..1]. - /// Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale. - /// Bound to the quantization error on the gradient norm. - /// Gradient angle tolerance in degrees. - /// Detection threshold: -log10(NFA) \> log_eps. - /// Used only when advancent refinement is chosen. - /// Minimal density of aligned region points in the enclosing rectangle. - /// Number of bins in pseudo-ordering of gradient modulus. - /// - public static LineSegmentDetector Create( - LineSegmentDetectorModes refine = LineSegmentDetectorModes.RefineNone, - double scale = 0.8, double sigmaScale = 0.6, double quant = 2.0, double angTh = 22.5, - double logEps = 0, double densityTh = 0.7, int nBins = 1024) - { - IntPtr ptr = NativeMethods.imgproc_createLineSegmentDetector( - (int)refine, scale, sigmaScale, quant, angTh, logEps, densityTh, nBins); - return new LineSegmentDetector(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - /// - /// Finds lines in the input image. - /// This is the output of the default parameters of the algorithm on the above shown image. - /// - /// A grayscale (CV_8UC1) input image. - /// A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. - /// Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient. - /// Vector of widths of the regions, where the lines are found. E.g. Width of line. - /// Vector of precisions with which the lines are found. - /// Vector containing number of false alarms in the line region, - /// with precision of 10%. The bigger the value, logarithmically better the detection. - public virtual void Detect(InputArray image, OutputArray lines, - OutputArray width = null, OutputArray prec = null, OutputArray nfa = null) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (lines == null) - throw new ArgumentNullException(nameof(lines)); - image.ThrowIfDisposed(); - lines.ThrowIfNotReady(); - width?.ThrowIfNotReady(); - prec?.ThrowIfNotReady(); - nfa?.ThrowIfNotReady(); - - NativeMethods.imgproc_LineSegmentDetector_detect_OutputArray(ptr, image.CvPtr, lines.CvPtr, - Cv2.ToPtr(width), Cv2.ToPtr(prec), Cv2.ToPtr(nfa)); - - GC.KeepAlive(image); - lines.Fix(); - width?.Fix(); - prec?.Fix(); - nfa?.Fix(); - } - - /// - /// Finds lines in the input image. - /// This is the output of the default parameters of the algorithm on the above shown image. - /// - /// A grayscale (CV_8UC1) input image. - /// A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. - /// Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient. - /// Vector of widths of the regions, where the lines are found. E.g. Width of line. - /// Vector of precisions with which the lines are found. - /// Vector containing number of false alarms in the line region, - /// with precision of 10%. The bigger the value, logarithmically better the detection. - public virtual void Detect(InputArray image, out Vec4f[] lines, - out double[] width, out double[] prec, out double[] nfa) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - using (var linesVec = new VectorOfVec4f()) - using (var widthVec = new VectorOfDouble()) - using (var precVec = new VectorOfDouble()) - using (var nfaVec = new VectorOfDouble()) - { - NativeMethods.imgproc_LineSegmentDetector_detect_vector(ptr, image.CvPtr, - linesVec.CvPtr, widthVec.CvPtr, precVec.CvPtr, nfaVec.CvPtr); - - lines = linesVec.ToArray(); - width = widthVec.ToArray(); - prec = precVec.ToArray(); - nfa = nfaVec.ToArray(); - } - - GC.KeepAlive(image); - } - - /// - /// Draws the line segments on a given image. - /// - /// The image, where the liens will be drawn. - /// Should be bigger or equal to the image, where the lines were found. - /// A vector of the lines that needed to be drawn. - public virtual void DrawSegments(InputOutputArray image, InputArray lines) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (lines == null) - throw new ArgumentNullException(nameof(lines)); - image.ThrowIfNotReady(); - lines.ThrowIfDisposed(); - - NativeMethods.imgproc_LineSegmentDetector_drawSegments(ptr, image.CvPtr, lines.CvPtr); - - image.Fix(); - GC.KeepAlive(lines); - } - - /// - /// Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. - /// - /// The size of the image, where lines1 and lines2 were found. - /// The first group of lines that needs to be drawn. It is visualized in blue color. - /// The second group of lines. They visualized in red color. - /// Optional image, where the lines will be drawn. - /// The image should be color(3-channel) in order for lines1 and lines2 to be drawn - /// in the above mentioned colors. - /// - public virtual int CompareSegments( - Size size, InputArray lines1, InputArray lines2, InputOutputArray image = null) - { - if (lines1 == null) - throw new ArgumentNullException(nameof(lines1)); - if (lines2 == null) - throw new ArgumentNullException(nameof(lines2)); - lines1.ThrowIfDisposed(); - lines2.ThrowIfDisposed(); - image?.ThrowIfNotReady(); - - var ret = NativeMethods.imgproc_LineSegmentDetector_compareSegments( - ptr, size, lines1.CvPtr, lines2.CvPtr, Cv2.ToPtr(image)); - - GC.KeepAlive(lines1); - GC.KeepAlive(lines2); - image?.Fix(); - - return ret; - } - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.imgproc_Ptr_LineSegmentDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.imgproc_Ptr_LineSegmentDetector_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Model/CircleSegment.cs b/src/OpenCvSharp/modules/imgproc/Model/CircleSegment.cs deleted file mode 100644 index 276792ea3..000000000 --- a/src/OpenCvSharp/modules/imgproc/Model/CircleSegment.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvHoughCirclesで得られる、円のデータ(中心と半径) - /// -#else - /// - /// circle structure retrieved from cvHoughCircle - /// -#endif - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct CircleSegment : IEquatable - { - #region Fields -#if LANG_JP - /// - /// 円の中心 - /// -#else - /// - /// Center coordinate of the circle - /// -#endif - public Point2f Center; -#if LANG_JP - /// - /// 半径 - /// -#else - /// - /// Radius - /// -#endif - public float Radius; - #endregion - - #region Init -#if LANG_JP - /// - /// 初期化 - /// - /// 円の中心 - /// 半径 -#else - /// - /// Constructor - /// - /// center - /// radius -#endif - public CircleSegment(Point2f center, float radius) - { - this.Center = center; - this.Radius = radius; - } - #endregion - - #region Operators -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(CircleSegment obj) - { - return (this.Center == obj.Center && this.Radius == obj.Radius); - } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(CircleSegment lhs, CircleSegment rhs) - { - return lhs.Equals(rhs); - } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(CircleSegment lhs, CircleSegment rhs) - { - return !lhs.Equals(rhs); - } - #endregion - - #region Overrided Methods -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return Center.GetHashCode() + Radius.GetHashCode(); - } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("CvCircleSegment (Center:{0} Radius:{1})", Center, Radius); - } - #endregion - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Model/HierarchyIndex.cs b/src/OpenCvSharp/modules/imgproc/Model/HierarchyIndex.cs deleted file mode 100644 index aa53371b8..000000000 --- a/src/OpenCvSharp/modules/imgproc/Model/HierarchyIndex.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - /// - /// Information about the image topology for cv::findContours - /// - public class HierarchyIndex - { - /// - /// - /// - public int Next { get; set; } - - /// - /// - /// - public int Previous { get; set; } - - /// - /// - /// - public int Child { get; set; } - - /// - /// - /// - public int Parent { get; set; } - - /// - /// - /// - public HierarchyIndex() - { - Next = 0; - Previous = 0; - Child = 0; - Parent = 0; - } - - /// - /// - /// - /// - /// - /// - /// - public HierarchyIndex(int next, int previous, int child, int parent) - { - Next = next; - Previous = previous; - Child = child; - Parent = parent; - } - - /// - /// - /// - /// - /// - public static HierarchyIndex FromVec4i(Vec4i vec) - { - return new HierarchyIndex - { - Next = vec.Item0, - Previous = vec.Item1, - Child = vec.Item2, - Parent = vec.Item3 - }; - } - - /// - /// - /// - /// - public Vec4i ToVec4i() - { - return new Vec4i(Next, Previous, Child, Parent); - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Model/Line2D.cs b/src/OpenCvSharp/modules/imgproc/Model/Line2D.cs deleted file mode 100644 index 0692cd02a..000000000 --- a/src/OpenCvSharp/modules/imgproc/Model/Line2D.cs +++ /dev/null @@ -1,221 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 始点と変化量であらわされる、2次元の直線を表すオブジェクト - /// -#else - /// - /// 2-dimentional line vector - /// -#endif - public class Line2D - { - #region Properties -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// -#else - /// - /// The X component of the normalized vector collinear to the line - /// -#endif - public double Vx { get; set; } -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// -#else - /// - /// The Y component of the normalized vector collinear to the line - /// -#endif - public double Vy { get; set; } -#if LANG_JP - /// - /// 直線上の点のx座標 - /// -#else - /// - /// X-coordinate of some point on the line - /// -#endif - public double X1 { get; set; } -#if LANG_JP - /// - /// 直線上の点のy座標 - /// -#else - /// - /// Y-coordinate of some point on the line - /// -#endif - public double Y1 { get; set; } - #endregion - - #region Init -#if LANG_JP - /// - /// 初期化 - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// 直線上の点のx座標 - /// 直線上の点のy座標 -#else - /// - /// Initializes this object - /// - /// The X component of the normalized vector collinear to the line - /// The Y component of the normalized vector collinear to the line - /// Z-coordinate of some point on the line - /// Z-coordinate of some point on the line -#endif - public Line2D(double vx, double vy, double x1, double y1) - { - Vx = vx; - Vy = vy; - X1 = x1; - Y1 = y1; - } -#if LANG_JP - /// - /// cvFitLineの出力(float[4])から初期化 - /// - /// cvFitLineの出力結果 -#else - /// - /// Initializes by cvFitLine output - /// - /// The returned value from cvFitLineparam> -#endif - public Line2D(float[] line) - : this(line[0], line[1], line[2], line[3]) - { - } - #endregion - - #region Methods - - /// - /// - /// - /// - public double GetVectorRadian() - { - return Math.Atan2(Vy, Vx); - } - /// - /// - /// - /// - public double GetVectorAngle() - { - return GetVectorRadian() * 180 / Math.PI; - } - -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// -#endif - public double Distance(Point point) - { - return Distance(point.X, point.Y); - } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// -#endif - public double Distance(Point2f point) - { - return Distance(point.X, point.Y); - } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// -#endif - public double Distance(Point2d point) - { - return Distance(point.X, point.Y); - } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// - /// -#endif - public double Distance(double x, double y) - { - // 公式で - double m = Vy / Vx; - double n = Y1 - m * X1; - return Math.Abs(y - m * x - n) / Math.Sqrt(1 + m * m); - } - -#if LANG_JP - /// - /// 指定したサイズに直線を合わせて、その端点を返す (描画用途) - /// - /// 合わせこむサイズの幅 - /// 合わせこむサイズの高さ - /// 端点1つ目 - /// 端点2つ目 -#else - /// - /// Fits this line to the specified size (for drawing) - /// - /// Width of fit size - /// Height of fit size - /// 1st edge point of fitted line - /// 2nd edge point of fitted line -#endif - public void FitSize(int width, int height, out Point pt1, out Point pt2) - { - double t = (width + height); - pt1 = new Point - { - X = (int)Math.Round(X1 - Vx*t), - Y = (int)Math.Round(Y1 - Vy * t) - }; - pt2 = new Point - { - X = (int)Math.Round(X1 + Vx * t), - Y = (int)Math.Round(Y1 + Vy * t) - }; - } - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/imgproc/Model/Line3D.cs b/src/OpenCvSharp/modules/imgproc/Model/Line3D.cs deleted file mode 100644 index 657e7de72..000000000 --- a/src/OpenCvSharp/modules/imgproc/Model/Line3D.cs +++ /dev/null @@ -1,294 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - -#if LANG_JP - /// - /// 3次元空間上の直線 - /// -#else - /// - /// A 3-dimensional line object - /// -#endif - public class Line3D - { - #region Properties -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// -#else - /// - /// The X component of the normalized vector collinear to the line - /// -#endif - public double Vx { get; set; } -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// -#else - /// - /// The Y component of the normalized vector collinear to the line - /// -#endif - public double Vy { get; set; } -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (z成分) - /// -#else - /// - /// The Z component of the normalized vector collinear to the line - /// -#endif - public double Vz { get; set; } -#if LANG_JP - /// - /// 直線上の点のx座標 - /// -#else - /// - /// X-coordinate of some point on the line - /// -#endif - public double X1 { get; set; } -#if LANG_JP - /// - /// 直線上の点のy座標 - /// -#else - /// - /// Y-coordinate of some point on the line - /// -#endif - public double Y1 { get; set; } -#if LANG_JP - /// - /// 直線上の点のz座標 - /// -#else - /// - /// Z-coordinate of some point on the line - /// -#endif - public double Z1 { get; set; } - #endregion - - #region Initialization -#if LANG_JP - /// - /// 初期化 - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// 直線に乗るように正規化された方向ベクトル (z成分) - /// 直線上の点のx座標 - /// 直線上の点のy座標 - /// 直線上の点のz座標 -#else - /// - /// Initializes this object - /// - /// The X component of the normalized vector collinear to the line - /// The Y component of the normalized vector collinear to the line - /// The Z component of the normalized vector collinear to the line - /// Z-coordinate of some point on the line - /// Z-coordinate of some point on the line - /// Z-coordinate of some point on the line -#endif - public Line3D(double vx, double vy, double vz, double x1, double y1, double z1) - { - Vx = vx; - Vy = vy; - Vz = vz; - X1 = x1; - Y1 = y1; - Z1 = z1; - } -#if LANG_JP - /// - /// cvFitLineの出力(float[6])から初期化 - /// - /// cvFitLineの出力結果 -#else - /// - /// Initializes by cvFitLine output - /// - /// The returned value from cvFitLineparam> -#endif - public Line3D(float[] line) - : this(line[0], line[1], line[2], line[3], line[4], line[5]) - { - } - #endregion - - #region Methods -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - public Point3d PerpendicularFoot(Point3f point) - { - return PerpendicularFoot(point.X, point.Y, point.Z); - } -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - public Point3d PerpendicularFoot(Point3d point) - { - return PerpendicularFoot(point.X, point.Y, point.Z); - } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// - /// - /// -#endif - public Point3d PerpendicularFoot(double x, double y, double z) - { - double xa = X1; - double ya = Y1; - double za = Z1; - double xb = X1 + Vx; - double yb = Y1 + Vy; - double zb = Z1 + Vz; - - double k = ((x - xa)*(xb - xa) + (y - ya)*(yb - ya) + (z - za)*(zb - za))/ - (Math.Pow(xb - xa, 2) + Math.Pow(yb - ya, 2) + Math.Pow(zb - za, 2)); - - double hx = k*xb+(1-k)*xa; - double hy = k*yb+(1-k)*ya; - double hz = k*zb+(1-k)*za; - return new Point3d(hx, hy, hz); - } - - -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// -#endif - public double Distance(Point3f point) - { - return Distance(point.X, point.Y, point.Z); - } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// -#endif - public double Distance(Point3d point) - { - return Distance(point.X, point.Y, point.Z); - } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// - /// - /// -#else - /// - /// Returns the distance between this line and the specified point - /// - /// - /// - /// -#endif - public double Distance(double x, double y, double z) - { - var p = new Point3d(x, y, z); - var a = new Point3d(X1, Y1, Z1); - var b = new Point3d(X1 + Vx, Y1 + Vy, Z1 + Vz); - var ab = new Point3d { X = b.X - a.X, Y = b.Y - a.Y, Z = b.Z - a.Z }; - var ap = new Point3d { X = p.X - a.X, Y = p.Y - a.Y, Z = p.Z - a.Z }; - - // AB, APを外積 -> 平行四辺形Dの面積 - double d = VectorLength(CrossProduct(ab, ap)); - // AB間の距離 - double l = VertexDistance(a, b); - // 平行四辺形の高さ(垂線) - double h = d / l; - return h; - } - - /// - /// ベクトルの外積 - /// - /// - /// - /// - private Point3d CrossProduct(Point3d vl, Point3d vr) - { - var ret = new Point3d - { - X = (vl.Y*vr.Z) - (vl.Z*vr.Y), - Y = (vl.Z*vr.X) - (vl.X*vr.Z), - Z = (vl.X*vr.Y) - (vl.Y*vr.X) - }; - return ret; - } - /// - /// ベクトルの長さ(原点からの距離) - /// - /// - /// - private double VectorLength(Point3d v) - { - return Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z); - } - /// - /// 2点間(2ベクトル)の距離 - /// - /// - /// - /// - private double VertexDistance(Point3d p1, Point3d p2) - { - return Math.Sqrt((p2.X - p1.X) * (p2.X - p1.X) + - (p2.Y - p1.Y) * (p2.Y - p1.Y) + - (p2.Z - p1.Z) * (p2.Z - p1.Z)); - } - #endregion - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/imgproc/Model/LineSegmentPoint.cs b/src/OpenCvSharp/modules/imgproc/Model/LineSegmentPoint.cs deleted file mode 100644 index 84b89da0d..000000000 --- a/src/OpenCvSharp/modules/imgproc/Model/LineSegmentPoint.cs +++ /dev/null @@ -1,487 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvHoughLines2で得られる、両端の点で表現される線分 - /// -#else - /// - /// Line segment structure retrieved from cvHoughLines2 - /// -#endif - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct LineSegmentPoint : IEquatable - { - #region Fields - -#if LANG_JP - /// - /// 1つ目の点 - /// -#else - /// - /// 1st Point - /// -#endif - public Point P1; - -#if LANG_JP - /// - /// 2つ目の点 - /// -#else - /// - /// 2nd Point - /// -#endif - public Point P2; - - #endregion - - #region Init - -#if LANG_JP - /// - /// 初期化 - /// - /// 1つ目の点 - /// 2つ目の点 -#else - /// - /// Constructor - /// - /// 1st Point - /// 2nd Point -#endif - public LineSegmentPoint(Point p1, Point p2) - { - this.P1 = p1; - this.P2 = p2; - } - - #endregion - - #region Operators - -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(LineSegmentPoint obj) - { - return (this.P1 == obj.P1 && this.P2 == obj.P2); - } - -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(LineSegmentPoint lhs, LineSegmentPoint rhs) - { - return lhs.Equals(rhs); - } - -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(LineSegmentPoint lhs, LineSegmentPoint rhs) - { - return !lhs.Equals(rhs); - } - - #endregion - - #region Overrided methods - -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } - -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return P1.GetHashCode() + P2.GetHashCode(); - } - -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("CvLineSegmentPoint (P1:{0} P2:{1})", P1, P2); - } - - #endregion - - #region Methods - - #region Line and Line - -#if LANG_JP - /// - /// 2直線の交点を求める (線分としてではなく直線として) - /// - /// - /// - /// -#else - /// - /// Calculates a intersection of the specified two lines - /// - /// - /// - /// -#endif - public static Point? LineIntersection(LineSegmentPoint line1, LineSegmentPoint line2) - { - int x1 = line1.P1.X; - int y1 = line1.P1.Y; - int f1 = line1.P2.X - line1.P1.X; - int g1 = line1.P2.Y - line1.P1.Y; - int x2 = line2.P1.X; - int y2 = line2.P1.Y; - int f2 = line2.P2.X - line2.P1.X; - int g2 = line2.P2.Y - line2.P1.Y; - - double det = f2*g1 - f1*g2; - if (det == 0) - { - return null; - } - - int dx = x2 - x1; - int dy = y2 - y1; - double t1 = (f2*dy - g2*dx)/det; - double t2 = (f1*dy - g1*dx)/det; - - return new Point - { - X = (int) Math.Round(x1 + (f1*t1)), - Y = (int) Math.Round(y1 + (g1*t1)) - }; - } - -#if LANG_JP - /// - /// 2直線の交点を求める (線分としてではなく直線として) - /// - /// - /// -#else - /// - /// Calculates a intersection of the specified two lines - /// - /// - /// -#endif - public Point? LineIntersection(LineSegmentPoint line) - { - return LineIntersection(this, line); - } - - #endregion - - #region Segment and Segment - -#if LANG_JP - /// - /// 線分同士の交点を求める - /// - /// - /// - /// -#else - /// - /// Calculates a intersection of the specified two segments - /// - /// - /// - /// -#endif - public static Point? SegmentIntersection(LineSegmentPoint seg1, LineSegmentPoint seg2) - { - if (IntersectedSegments(seg1, seg2)) - return LineIntersection(seg1, seg2); - else - return null; - } - -#if LANG_JP - /// - /// 線分同士の交点を求める - /// - /// - /// -#else - /// - /// Calculates a intersection of the specified two segments - /// - /// - /// -#endif - public Point? SegmentIntersection(LineSegmentPoint seg) - { - return SegmentIntersection(this, seg); - } - -#if LANG_JP - /// - /// 2つの線分が交差しているかどうかを返す - /// - /// - /// - /// -#else - /// - /// Returns a boolean value indicating whether the specified two segments intersect. - /// - /// - /// - /// -#endif - public static bool IntersectedSegments(LineSegmentPoint seg1, LineSegmentPoint seg2) - { - Point p1 = seg1.P1; - Point p2 = seg1.P2; - Point p3 = seg2.P1; - Point p4 = seg2.P2; - - checked - { - if (p1.X >= p2.X) - { - if ((p1.X < p3.X && p1.X < p4.X) || (p2.X > p3.X && p2.X > p4.X)) - return false; - } - else - { - if ((p2.X < p3.X && p2.X < p4.X) || (p1.X > p3.X && p1.X > p4.X)) - return false; - } - if (p1.Y >= p2.Y) - { - if ((p1.Y < p3.Y && p1.Y < p4.Y) || (p2.Y > p3.Y && p2.Y > p4.Y)) - return false; - } - else - { - if ((p2.Y < p3.Y && p2.Y < p4.Y) || (p1.Y > p3.Y && p1.Y > p4.Y)) - return false; - } - - if (((long) (p1.X - p2.X)*(p3.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p3.X))* - ((long) (p1.X - p2.X)*(p4.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p4.X)) > 0) - return false; - if (((long) (p3.X - p4.X)*(p1.Y - p3.Y) + (long) (p3.Y - p4.Y)*(p3.X - p1.X))* - ((long) (p3.X - p4.X)*(p2.Y - p3.Y) + (long) (p3.Y - p4.Y)*(p3.X - p2.X)) > 0) - return false; - } - return true; - } - -#if LANG_JP - /// - /// 2つの線分が交差しているかどうかを返す - /// - /// - /// -#else - /// - /// Returns a boolean value indicating whether the specified two segments intersect. - /// - /// - /// -#endif - public bool IntersectedSegments(LineSegmentPoint seg) - { - return IntersectedSegments(this, seg); - } - - #endregion - - #region Line and Segment - -#if LANG_JP - /// - /// 直線と線分が交差しているかを調べる - /// - /// 線分 - /// 直線 - /// -#else - /// - /// Returns a boolean value indicating whether a line and a segment intersect. - /// - /// Line - /// Segment - /// -#endif - public static bool IntersectedLineAndSegment(LineSegmentPoint line, LineSegmentPoint seg) - { - Point p1 = line.P1; - Point p2 = line.P2; - Point p3 = seg.P1; - Point p4 = seg.P2; - if (((long) (p1.X - p2.X)*(p3.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p3.X))* - ((long) (p1.X - p2.X)*(p4.Y - p1.Y) + (long) (p1.Y - p2.Y)*(p1.X - p4.X)) > 0) - { - return false; - } - return true; - } - -#if LANG_JP - /// - /// 直線と線分の交点を求める - /// - /// - /// - /// -#else - /// - /// Calculates a intersection of a line and a segment - /// - /// - /// - /// -#endif - public static Point? LineAndSegmentIntersection(LineSegmentPoint line, LineSegmentPoint seg) - { - if (IntersectedLineAndSegment(line, seg)) - return LineIntersection(line, seg); - else - return null; - } - - #endregion - -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else - /// - /// - /// - /// - /// -#endif - public double Length(LineSegmentPoint s) - { - return P1.DistanceTo(P2); - } - -#if LANG_JP - /// - /// この CvLineSegmentPoint を指定の量だけ平行移動する - /// - /// x 座標のオフセット量 - /// y 座標のオフセット量 - /// -#else - /// - /// Translates the Point by the specified amount. - /// - /// The amount to offset the x-coordinate. - /// The amount to offset the y-coordinate. - /// -#endif - public void Offset(int x, int y) - { - P1.X += x; - P1.Y += y; - P2.X += x; - P2.Y += y; - } - -#if LANG_JP - /// - /// この CvLineSegmentPoint を指定の量だけ平行移動する - /// - /// オフセットに使用する CvPoint - /// -#else - /// - /// Translates the Point by the specified amount. - /// - /// The Point used offset this CvPoint. - /// -#endif - public void Offset(Point p) - { - Offset(p.X, p.Y); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Model/LineSegmentPolar.cs b/src/OpenCvSharp/modules/imgproc/Model/LineSegmentPolar.cs deleted file mode 100644 index 73d5202b9..000000000 --- a/src/OpenCvSharp/modules/imgproc/Model/LineSegmentPolar.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvHoughLines2で得られる、極座標系で表現される線分 - /// -#else - /// - /// Polar line segment retrieved from cvHoughLines2 - /// -#endif - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct LineSegmentPolar : IEquatable - { - #region Fields -#if LANG_JP - /// - /// 線分の長さ - /// -#else - /// - /// Length of the line - /// -#endif - public float Rho; -#if LANG_JP - /// - /// 線分の角度(ラジアン) - /// -#else - /// - /// Angle of the line (radian) - /// -#endif - public float Theta; - #endregion - - #region Init -#if LANG_JP - /// - /// 初期化 - /// - /// 線分の長さ - /// 線分の角度(ラジアン) -#else - /// - /// Constructor - /// - /// Length of the line - /// Angle of the line (radian) -#endif - public LineSegmentPolar(float rho, float theta) - { - this.Rho = rho; - this.Theta = theta; - } - #endregion - - #region Operators -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public bool Equals(LineSegmentPolar obj) - { - return (this.Rho == obj.Rho && this.Theta == obj.Theta); - } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif - public static bool operator ==(LineSegmentPolar lhs, LineSegmentPolar rhs) - { - return lhs.Equals(rhs); - } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else - /// - /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. - /// - /// A Point to compare. - /// A Point to compare. - /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif - public static bool operator !=(LineSegmentPolar lhs, LineSegmentPolar rhs) - { - return !lhs.Equals(rhs); - } - #endregion - - #region Overrided methods -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else - /// - /// Specifies whether this object contains the same members as the specified Object. - /// - /// The Object to test. - /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif - public override bool Equals(object obj) - { - return base.Equals(obj); - } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else - /// - /// Returns a hash code for this object. - /// - /// An integer value that specifies a hash value for this object. -#endif - public override int GetHashCode() - { - return Rho.GetHashCode() + Theta.GetHashCode(); - } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else - /// - /// Converts this object to a human readable string. - /// - /// A string that represents this object. -#endif - public override string ToString() - { - return string.Format("CvLineSegmentPolar (Rho:{0} Theta:{1})", Rho, Theta); - } - #endregion - - #region Methods -#if LANG_JP - /// - /// 2直線の交点を求める - /// - /// - /// - /// -#else - /// - /// Calculates a intersection of the specified two lines - /// - /// - /// - /// -#endif - public static Point? LineIntersection(LineSegmentPolar line1, LineSegmentPolar line2) - { - var seg1 = line1.ToSegmentPoint(5000); - var seg2 = line2.ToSegmentPoint(5000); - return LineSegmentPoint.LineIntersection(seg1, seg2); - } -#if LANG_JP - /// - /// 2直線の交点を求める (線分としてではなく直線として) - /// - /// - /// -#else - /// - /// Calculates a intersection of the specified two lines - /// - /// - /// -#endif - public Point? LineIntersection(LineSegmentPolar line) - { - return LineIntersection(this, line); - } - - /// - /// CvLineSegmentPointに変換する - /// - /// - /// - public LineSegmentPoint ToSegmentPoint(double scale) - { - double cos = Math.Cos(Theta); - double sin = Math.Sin(Theta); - double x0 = cos * Rho; - double y0 = sin * Rho; - var p1 = new Point { X = (int)Math.Round(x0 + scale * -sin), Y = (int)Math.Round(y0 + scale * cos) }; - var p2 = new Point { X = (int)Math.Round(x0 - scale * -sin), Y = (int)Math.Round(y0 - scale * cos) }; - return new LineSegmentPoint(p1, p2); - } - /// - /// 指定したx座標を両端とするような線分に変換する - /// - /// - /// - /// - public LineSegmentPoint ToSegmentPointX(int x1, int x2) - { - if (x1 > x2) - throw new ArgumentOutOfRangeException(); - - int? y1 = YPosOfLine(x1); - int? y2 = YPosOfLine(x2); - if (!y1.HasValue || !y2.HasValue) - throw new Exception(); - - var p1 = new Point(x1, y1.Value); - var p2 = new Point(x2, y2.Value); - return new LineSegmentPoint(p1, p2); - } - /// - /// 指定したy座標を両端とするような線分に変換する - /// - /// - /// - /// - public LineSegmentPoint ToSegmentPointY(int y1, int y2) - { - if (y1 > y2) - throw new ArgumentOutOfRangeException(); - - int? x1 = XPosOfLine(y1); - int? x2 = XPosOfLine(y2); - if (!x1.HasValue || !x2.HasValue) - throw new Exception(); - - var p1 = new Point(x1.Value, y1); - var p2 = new Point(x2.Value, y2); - return new LineSegmentPoint(p1, p2); - } - - /// - /// 指定したy座標を通るときのx座標を求める - /// - /// - /// - public int? XPosOfLine(int y) - { - var axis = new LineSegmentPolar(y, (float)(Math.PI / 2)); // 垂線90度 = x軸に平行 - Point? node = LineIntersection(axis); - if (node.HasValue) - return node.Value.X; - else - return null; - } - /// - /// 指定したx座標を通るときのy座標を求める - /// - /// - /// - public int? YPosOfLine(int x) - { - var axis = new LineSegmentPolar(x, (float)0); // 垂線0度 = y軸に平行 - Point? node = LineIntersection(axis); - if (node.HasValue) - return node.Value.Y; - else - return null; - } - #endregion - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Moments.cs b/src/OpenCvSharp/modules/imgproc/Moments.cs deleted file mode 100644 index 9924a7fa5..000000000 --- a/src/OpenCvSharp/modules/imgproc/Moments.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// Raster image moments - /// - public class Moments - { - /// - /// spatial moments - /// - public double M00, M10, M01, M20, M11, M02, M30, M21, M12, M03; - - /// - /// central moments - /// - public double Mu20, Mu11, Mu02, Mu30, Mu21, Mu12, Mu03; - - /// - /// central normalized moments - /// - public double Nu20, Nu11, Nu02, Nu30, Nu21, Nu12, Nu03; - - #region Init & Disposal - /// - /// Default constructor. - /// All moment values are set to 0. - /// - public Moments() - { - M00 = M10 = M01 = M20 = M11 = M02 = M30 = M21 = M12 = M03 = - Mu20 = Mu11 = Mu02 = Mu30 = Mu21 = Mu12 = Mu03 = - Nu20 = Nu11 = Nu02 = Nu30 = Nu21 = Nu12 = Nu03 = 0.0; - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public Moments(double m00, double m10, double m01, double m20, double m11, - double m02, double m30, double m21, double m12, double m03) - { - Initialize(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03); - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (single-channel, 8-bit or floating-point - /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f ) - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public Moments(InputArray array, bool binaryImage = false) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - array.ThrowIfDisposed(); - InitializeFromInputArray(array, binaryImage); - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (8-bit) 2D array - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public Moments(byte[,] array, bool binaryImage = false) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - int rows = array.GetLength(0); - int cols = array.GetLength(1); - using (var arrayMat = new Mat(rows, cols, MatType.CV_8UC1, array)) - { - InitializeFromInputArray(arrayMat, binaryImage); - } - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (floating-point) 2D array - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public Moments(float[,] array, bool binaryImage = false) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - int rows = array.GetLength(0); - int cols = array.GetLength(1); - using (var arrayMat = new Mat(rows, cols, MatType.CV_32FC1, array)) - { - InitializeFromInputArray(arrayMat, binaryImage); - } - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// Array of 2D points - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public Moments(IEnumerable array, bool binaryImage = false) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - Point[] points = EnumerableEx.ToArray(array); - using (var pointsMat = new Mat(points.Length, 1, MatType.CV_32SC2, points)) - { - InitializeFromInputArray(pointsMat, binaryImage); - } - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// Array of 2D points - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - public Moments(IEnumerable array, bool binaryImage = false) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - Point2f[] points = EnumerableEx.ToArray(array); - using (var pointsMat = new Mat(points.Length, 1, MatType.CV_32FC2, points)) - { - InitializeFromInputArray(pointsMat, binaryImage); - } - } - - /// - /// Calculates all of the moments - /// up to the third order of a polygon or rasterized shape. - /// - /// A raster image (single-channel, 8-bit or floating-point - /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f ) - /// If it is true, then all the non-zero image pixels are treated as 1’s - /// - private void InitializeFromInputArray(InputArray array, bool binaryImage) - { - var m = NativeMethods.imgproc_moments(array.CvPtr, binaryImage ? 1 : 0); - Initialize(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03); - } - - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - private void Initialize(double m00, double m10, double m01, double m20, double m11, - double m02, double m30, double m21, double m12, double m03) - { - M00 = m00; - M10 = m10; - M01 = m01; - M20 = m20; - M11 = m11; - M02 = m02; - M30 = m30; - M21 = m21; - M12 = m12; - M03 = m03; - - double cx = 0, cy = 0, invM00 = 0; - if (Math.Abs(M00) > Double.Epsilon) - { - invM00 = 1.0 / M00; - cx = M10 * invM00; - cy = M01 * invM00; - } - - Mu20 = M20 - M10 * cx; - Mu11 = M11 - M10 * cy; - Mu02 = M02 - M01 * cy; - - Mu30 = M30 - cx * (3 * Mu20 + cx * M10); - Mu21 = M21 - cx * (2 * Mu11 + cx * M01) - cy * Mu20; - Mu12 = M12 - cy * (2 * Mu11 + cy * M10) - cx * Mu02; - Mu03 = M03 - cy * (3 * Mu02 + cy * M01); - - double invSqrtM00 = Math.Sqrt(Math.Abs(invM00)); - double s2 = invM00 * invM00; - double s3 = s2 * invSqrtM00; - - Nu20 = Mu20 * s2; - Nu11 = Mu11 * s2; - Nu02 = Mu02 * s2; - Nu30 = Mu30 * s3; - Nu21 = Mu21 * s3; - Nu12 = Mu12 * s3; - Nu03 = Mu03 * s3; - } - - #endregion - - #region Methods - /// - /// computes 7 Hu invariants from the moments - /// - /// - public double[] HuMoments() - { - double[] hu = new double[7]; - double t0 = Nu30 + Nu12; - double t1 = Nu21 + Nu03; - - double q0 = t0 * t0, q1 = t1 * t1; - - double n4 = 4 * Nu11; - double s = Nu20 + Nu02; - double d = Nu20 - Nu02; - - hu[0] = s; - hu[1] = d * d + n4 * Nu11; - hu[3] = q0 + q1; - hu[5] = d * (q0 - q1) + n4 * t0 * t1; - - t0 *= q0 - 3 * q1; - t1 *= 3 * q0 - q1; - - q0 = Nu30 - 3 * Nu12; - q1 = 3 * Nu21 - Nu03; - - hu[2] = q0 * q0 + q1 * q1; - hu[4] = q0 * t0 + q1 * t1; - hu[6] = q1 * t0 - q0 * t1; - return hu; - } - - #endregion - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] -#pragma warning disable 1591 - public struct NativeStruct - { - public double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ - public double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ - public double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ - } - } -} diff --git a/src/OpenCvSharp/modules/imgproc/Subdiv2D.cs b/src/OpenCvSharp/modules/imgproc/Subdiv2D.cs deleted file mode 100644 index a505c2491..000000000 --- a/src/OpenCvSharp/modules/imgproc/Subdiv2D.cs +++ /dev/null @@ -1,371 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// - /// -#else - /// - /// - /// -#endif - public class Subdiv2D : DisposableCvObject - { - #region Init and Disposal - -#if LANG_JP - /// - /// デフォルトのパラメータで初期化. - /// 実際は numberOfDisparities だけは指定する必要がある. - /// -#else - /// - /// Default constructor - /// -#endif - public Subdiv2D() - { - ptr = NativeMethods.imgproc_Subdiv2D_new1(); - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException(); - } - -#if LANG_JP - /// - /// Subdiv2D コンストラクタ - /// - /// -#else - /// - /// Subdiv2D Constructor - /// - /// -#endif - public Subdiv2D(Rect rect) - { - ptr = NativeMethods.imgproc_Subdiv2D_new2(rect); - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException(); - } - -#if LANG_JP - /// - /// リソースの解放 - /// -#else - /// - /// Clean up any resources being used. - /// -#endif - public void Release() - { - Dispose(); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.imgproc_Subdiv2D_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Constants - /// - /// - /// - public const int - PTLOC_ERROR = -2, - PTLOC_OUTSIDE_RECT = -1, - PTLOC_INSIDE = 0, - PTLOC_VERTEX = 1, - PTLOC_ON_EDGE = 2; - /// - /// - /// - public const int - NEXT_AROUND_ORG = 0x00, - NEXT_AROUND_DST = 0x22, - PREV_AROUND_ORG = 0x11, - PREV_AROUND_DST = 0x33, - NEXT_AROUND_LEFT = 0x13, - NEXT_AROUND_RIGHT = 0x31, - PREV_AROUND_LEFT = 0x20, - PREV_AROUND_RIGHT = 0x02; - #endregion - - #region Methods - #region InitDelaunay - /// - /// - /// - /// - public void InitDelaunay(Rect rect) - { - ThrowIfDisposed(); - NativeMethods.imgproc_Subdiv2D_initDelaunay(ptr, rect); - } - #endregion - #region Insert - /// - /// - /// - /// - /// - public int Insert(Point2f pt) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_insert1(ptr, pt); - } - /// - /// - /// - /// - public void Insert(Point2f[] ptvec) - { - ThrowIfDisposed(); - if (ptvec == null) - throw new ArgumentNullException(nameof(ptvec)); - NativeMethods.imgproc_Subdiv2D_insert2(ptr, ptvec, ptvec.Length); - } - /// - /// - /// - /// - public void Insert(IEnumerable ptvec) - { - if (ptvec == null) - throw new ArgumentNullException(nameof(ptvec)); - Insert(new List(ptvec).ToArray()); - } - #endregion - #region Locate - /// - /// - /// - /// - /// - /// - /// - public int Locate(Point2f pt, out int edge, out int vertex) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_locate(ptr, pt, out edge, out vertex); - } - #endregion - #region FindNearest - /// - /// - /// - /// - /// - public int FindNearest(Point2f pt) - { - Point2f nearestPt; - return FindNearest(pt, out nearestPt); - } - /// - /// - /// - /// - /// - /// - public int FindNearest(Point2f pt, out Point2f nearestPt) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_findNearest(ptr, pt, out nearestPt); - } - #endregion - #region GetEdgeList - /// - /// - /// - /// - public Vec4f[] GetEdgeList() - { - ThrowIfDisposed(); - IntPtr p; - NativeMethods.imgproc_Subdiv2D_getEdgeList(ptr, out p); - using (VectorOfVec4f vec = new VectorOfVec4f(p)) - { - return vec.ToArray(); - } - } - #endregion - #region GetTriangleList - /// - /// - /// - /// - public Vec6f[] GetTriangleList() - { - ThrowIfDisposed(); - IntPtr p; - NativeMethods.imgproc_Subdiv2D_getTriangleList(ptr, out p); - using (VectorOfVec6f vec = new VectorOfVec6f(p)) - { - return vec.ToArray(); - } - } - #endregion - #region GetVoronoiFacetList - /// - /// - /// - /// - /// - /// - public void GetVoronoiFacetList(IEnumerable idx, out Point2f[][] facetList, out Point2f[] facetCenters) - { - ThrowIfDisposed(); - - IntPtr facetListPtr, facetCentersPtr; - if (idx == null) - { - NativeMethods.imgproc_Subdiv2D_getVoronoiFacetList(ptr, IntPtr.Zero, 0, out facetListPtr, out facetCentersPtr); - } - else - { - int[] idxArray = EnumerableEx.ToArray(idx); - NativeMethods.imgproc_Subdiv2D_getVoronoiFacetList(ptr, idxArray, idxArray.Length, out facetListPtr, out facetCentersPtr); - } - - using (VectorOfVectorPoint2f facetListVec = new VectorOfVectorPoint2f(facetListPtr)) - { - facetList = facetListVec.ToArray(); - } - using (VectorOfPoint2f facetCentersVec = new VectorOfPoint2f(facetCentersPtr)) - { - facetCenters = facetCentersVec.ToArray(); - } - } - #endregion - #region GetVertex - /// - /// - /// - /// - /// - public Point2f GetVertex(int vertex) - { - int firstEdge; - return GetVertex(vertex, out firstEdge); - } - /// - /// - /// - /// - /// - /// - public Point2f GetVertex(int vertex, out int firstEdge) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_getVertex(ptr, vertex, out firstEdge); - } - #endregion - #region GetEdge - /// - /// - /// - /// - /// - /// - public int GetEdge(int edge, int nextEdgeType) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_getEdge(ptr, edge, nextEdgeType); - } - #endregion - #region NextEdge - /// - /// - /// - /// - /// - public int NextEdge(int edge) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_nextEdge(ptr, edge); - } - #endregion - #region RotateEdge - /// - /// - /// - /// - /// - /// - public int RotateEdge(int edge, int rotate) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_rotateEdge(ptr, edge, rotate); - } - #endregion - #region SymEdge - /// - /// - /// - /// - /// - public int SymEdge(int edge) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_symEdge(ptr, edge); - } - #endregion - #region EdgeOrg - /// - /// - /// - /// - /// - public int EdgeOrg(int edge) - { - Point2f orgpt; - return EdgeOrg(edge, out orgpt); - } - /// - /// - /// - /// - /// - /// - public int EdgeOrg(int edge, out Point2f orgpt) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_edgeOrg(ptr, edge, out orgpt); - } - #endregion - #region EdgeDst - /// - /// - /// - /// - /// - public int EdgeDst(int edge) - { - Point2f dstpt; - return EdgeDst(edge, out dstpt); - } - /// - /// - /// - /// - /// - /// - public int EdgeDst(int edge, out Point2f dstpt) - { - ThrowIfDisposed(); - return NativeMethods.imgproc_Subdiv2D_edgeDst(ptr, edge, out dstpt); - } - #endregion - #endregion - } -} diff --git a/src/OpenCvSharp/modules/ml/ANN_MLP.cs b/src/OpenCvSharp/modules/ml/ANN_MLP.cs deleted file mode 100644 index 465d1d39b..000000000 --- a/src/OpenCvSharp/modules/ml/ANN_MLP.cs +++ /dev/null @@ -1,289 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ -#if LANG_JP - /// - /// MLPモデルクラス - /// -#else - /// - /// Artificial Neural Networks - Multi-Layer Perceptrons. - /// -#endif - // ReSharper disable once InconsistentNaming - public class ANN_MLP : StatModel - { - private Ptr ptrObj; - - #region Init and Disposal - /// - /// Creates instance by raw pointer cv::ml::ANN_MLP* - /// - protected ANN_MLP(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model. - /// - /// - public static ANN_MLP Create() - { - IntPtr ptr = NativeMethods.ml_ANN_MLP_create(); - return new ANN_MLP(ptr); - } - - /// - /// Loads and creates a serialized ANN from a file. - /// Use ANN::save to serialize and store an ANN to disk. - /// Load the ANN from this file again, by calling this function with the path to the file. - /// - /// - /// - public static ANN_MLP Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_ANN_MLP_load(filePath); - return new ANN_MLP(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static ANN_MLP LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_ANN_MLP_loadFromString(strModel); - return new ANN_MLP(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Termination criteria of the training algorithm. - /// - public TermCriteria TermCriteria - { - get { return NativeMethods.ml_ANN_MLP_getTermCriteria(ptr); } - set { NativeMethods.ml_ANN_MLP_setTermCriteria(ptr, value); } - } - - /// - /// Strength of the weight gradient term. - /// The recommended value is about 0.1. Default value is 0.1. - /// - public double BackpropWeightScale - { - get { return NativeMethods.ml_ANN_MLP_getBackpropWeightScale(ptr); } - set { NativeMethods.ml_ANN_MLP_setBackpropWeightScale(ptr, value); } - } - - /// - /// Strength of the momentum term (the difference between weights on the 2 previous iterations). - /// This parameter provides some inertia to smooth the random fluctuations of the weights. - /// It can vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or - /// so is good enough. Default value is 0.1. - /// - public double BackpropMomentumScale - { - get { return NativeMethods.ml_ANN_MLP_getBackpropMomentumScale(ptr); } - set { NativeMethods.ml_ANN_MLP_setBackpropMomentumScale(ptr, value); } - } - - /// - /// Initial value Delta_0 of update-values Delta_{ij}. Default value is 0.1. - /// -// ReSharper disable once InconsistentNaming - public double RpropDW0 - { - get { return NativeMethods.ml_ANN_MLP_getRpropDW0(ptr); } - set { NativeMethods.ml_ANN_MLP_setRpropDW0(ptr, value); } - } - - /// - /// Increase factor eta^+. - /// It must be >1. Default value is 1.2. - /// -// ReSharper disable once InconsistentNaming - public double RpropDWPlus - { - get { return NativeMethods.ml_ANN_MLP_getRpropDWPlus(ptr); } - set { NativeMethods.ml_ANN_MLP_setRpropDWPlus(ptr, value); } - } - - /// - /// Decrease factor eta^-. - /// It must be \>1. Default value is 0.5. - /// -// ReSharper disable once InconsistentNaming - public double RpropDWMinus - { - get { return NativeMethods.ml_ANN_MLP_getRpropDWPlus(ptr); } - set { NativeMethods.ml_ANN_MLP_setRpropDWPlus(ptr, value); } - } - - /// - /// Update-values lower limit Delta_{min}. - /// It must be positive. Default value is FLT_EPSILON. - /// -// ReSharper disable once InconsistentNaming - public double RpropDWMin - { - get { return NativeMethods.ml_ANN_MLP_getRpropDWMin(ptr); } - set { NativeMethods.ml_ANN_MLP_setRpropDWMin(ptr, value); } - } - - /// - /// Update-values upper limit Delta_{max}. - /// It must be >1. Default value is 50. - /// -// ReSharper disable once InconsistentNaming - public double RpropDWMax - { - get { return NativeMethods.ml_ANN_MLP_getRpropDWMax(ptr); } - set { NativeMethods.ml_ANN_MLP_setRpropDWMax(ptr, value); } - } - - #endregion - - #region Methods - - /// - /// Integer vector specifying the number of neurons in each layer including the input and output layers. - /// The very first element specifies the number of elements in the input layer. - /// The last element - number of elements in the output layer.Default value is empty Mat. - /// - /// - public virtual void SetLayerSizes(InputArray layerSizes) - { - ThrowIfDisposed(); - if (layerSizes == null) - throw new ArgumentNullException(nameof(layerSizes)); - NativeMethods.ml_ANN_MLP_setLayerSizes(ptr, layerSizes.CvPtr); - } - - /// - /// Integer vector specifying the number of neurons in each layer including the input and output layers. - /// The very first element specifies the number of elements in the input layer. - /// The last element - number of elements in the output layer. - /// - /// - public virtual Mat GetLayerSizes() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.ml_ANN_MLP_getLayerSizes(ptr); - return new Mat(p); - } - - #endregion - - #region Types - - /// - /// possible activation functions - /// - public enum ActivationFunctions - { - /// - /// Identity function: $f(x)=x - /// - Identity = 0, - - /// - /// Symmetrical sigmoid: f(x)=\beta*(1-e^{-\alpha x})/(1+e^{-\alpha x} - /// - SigmoidSym = 1, - - /// - /// Gaussian function: f(x)=\beta e^{-\alpha x*x} - /// - Gaussian = 2 - } - - /// - /// Train options - /// - [Flags] - public enum TrainFlags - { - /// - /// Update the network weights, rather than compute them from scratch. - /// In the latter case the weights are initialized using the Nguyen-Widrow algorithm. - /// - UpdateWeights = 1, - - /* */ - /// - /// Do not normalize the input vectors. - /// If this flag is not set, the training algorithm normalizes each input feature - /// independently, shifting its mean value to 0 and making the standard deviation - /// equal to 1. If the network is assumed to be updated frequently, the new - /// training data could be much different from original one. In this case, - /// you should take care of proper normalization. - /// - NoInputScale = 2, - - /// - /// Do not normalize the output vectors. If the flag is not set, - /// the training algorithm normalizes each output feature independently, - /// by transforming it to the certain range depending on the used activation function. - /// - NoOutputScale = 4 - } - - /// - /// Available training methods - /// - public enum TrainingMethods - { - /// - /// The back-propagation algorithm. - /// - BackProp = 0, - - /// - /// The RPROP algorithm. See @cite RPROP93 for details. - /// - RProp = 1 - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_ANN_MLP_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_ANN_MLP_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/ml/Boost.cs b/src/OpenCvSharp/modules/ml/Boost.cs deleted file mode 100644 index 813325b4b..000000000 --- a/src/OpenCvSharp/modules/ml/Boost.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ - /// - /// Boosted tree classifier derived from DTrees - /// - public class Boost : DTrees - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::Boost* - /// - protected Boost(IntPtr p) - : base() - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model. - /// - /// - public new static Boost Create() - { - IntPtr ptr = NativeMethods.ml_Boost_create(); - return new Boost(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public new static Boost Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_Boost_load(filePath); - return new Boost(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public new static Boost LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_Boost_loadFromString(strModel); - return new Boost(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Type of the boosting algorithm. - /// See Boost::Types. Default value is Boost::REAL. - /// - public Types BoostType - { - get - { - ThrowIfDisposed(); - return (Types) NativeMethods.ml_Boost_getBoostType(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.ml_Boost_setBoostType(ptr, (int) value); - } - } - - /// - /// The number of weak classifiers. - /// Default value is 100. - /// - public int WeakCount - { - get - { - ThrowIfDisposed(); - return NativeMethods.ml_Boost_getWeakCount(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.ml_Boost_setWeakCount(ptr, value); - } - } - - /// - /// A threshold between 0 and 1 used to save computational time. - /// Samples with summary weight \f$\leq 1 - weight_trim_rate - /// do not participate in the *next* iteration of training. - /// Set this parameter to 0 to turn off this functionality. Default value is 0.95. - /// - public double WeightTrimRate - { - get - { - ThrowIfDisposed(); - return NativeMethods.ml_Boost_getWeightTrimRate(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.ml_Boost_setWeightTrimRate(ptr, value); - } - } - - #endregion - - #region Types - - /// - /// Boosting type. - /// Gentle AdaBoost and Real AdaBoost are often the preferable choices. - /// - public enum Types - { - /// - /// Discrete AdaBoost. - /// - Discrete = 0, - - /// - /// Real AdaBoost. It is a technique that utilizes confidence-rated predictions - /// and works well with categorical data. - /// - Real = 1, - - /// - /// LogitBoost. It can produce good regression fits. - /// - Logit = 2, - - /// - /// Gentle AdaBoost. It puts less weight on outlier data points and for that - /// reason is often good with regression data. - /// - Gentle = 3 - }; - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_Boost_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_Boost_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/DTrees.cs b/src/OpenCvSharp/modules/ml/DTrees.cs deleted file mode 100644 index 4503a446a..000000000 --- a/src/OpenCvSharp/modules/ml/DTrees.cs +++ /dev/null @@ -1,361 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ -#if LANG_JP - /// - /// 決定木クラス - /// -#else - /// - /// Decision tree - /// -#endif - public class DTrees : StatModel - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// - /// - protected DTrees() - { - ptrObj = null; - } - - /// - /// Creates instance by raw pointer cv::ml::SVM* - /// - protected DTrees(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model. - /// - /// - public static DTrees Create() - { - IntPtr ptr = NativeMethods.ml_DTrees_create(); - return new DTrees(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public static DTrees Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_DTrees_load(filePath); - return new DTrees(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static DTrees LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_DTrees_loadFromString(strModel); - return new DTrees(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Cluster possible values of a categorical variable into - /// K < =maxCategories clusters to find a suboptimal split. - /// - public int MaxCategories - { - get { return NativeMethods.ml_DTrees_getMaxCategories(ptr); } - set { NativeMethods.ml_DTrees_setMaxCategories(ptr, value); } - } - - /// - /// The maximum possible depth of the tree. - /// - public int MaxDepth - { - get { return NativeMethods.ml_DTrees_getMaxDepth(ptr); } - set { NativeMethods.ml_DTrees_setMaxDepth(ptr, value); } - } - - /// - /// If the number of samples in a node is less than this parameter then the - /// node will not be split. Default value is 10. - /// - public int MinSampleCount - { - get { return NativeMethods.ml_DTrees_getMinSampleCount(ptr); } - set { NativeMethods.ml_DTrees_setMinSampleCount(ptr, value); } - } - - /// - /// If CVFolds \> 1 then algorithms prunes the built decision tree using K-fold - /// cross-validation procedure where K is equal to CVFolds. Default value is 10. - /// -// ReSharper disable once InconsistentNaming - public int CVFolds - { - get { return NativeMethods.ml_DTrees_getCVFolds(ptr); } - set { NativeMethods.ml_DTrees_setCVFolds(ptr, value); } - } - - /// - /// If true then surrogate splits will be built. - /// These splits allow to work with missing data and compute variable - /// importance correctly. Default value is false. - /// - public bool UseSurrogates - { - get { return NativeMethods.ml_DTrees_getUseSurrogates(ptr) != 0; } - set { NativeMethods.ml_DTrees_setUseSurrogates(ptr, value ? 1 : 0); } - } - - /// - /// If true then a pruning will be harsher. - /// This will make a tree more compact and more resistant to the training - /// data noise but a bit less accurate. Default value is true. - /// -// ReSharper disable once InconsistentNaming - public bool Use1SERule - { - get { return NativeMethods.ml_DTrees_getUse1SERule(ptr) != 0; } - set { NativeMethods.ml_DTrees_setUse1SERule(ptr, value ? 1 : 0); } - } - - /// - /// If true then pruned branches are physically removed from the tree. - /// Otherwise they are retained and it is possible to get results from the - /// original unpruned (or pruned less aggressively) tree. Default value is true. - /// - public bool TruncatePrunedTree - { - get { return NativeMethods.ml_DTrees_getTruncatePrunedTree(ptr) != 0; } - set { NativeMethods.ml_DTrees_setTruncatePrunedTree(ptr, value ? 1 : 0); } - } - - /// - /// Termination criteria for regression trees. - /// If all absolute differences between an estimated value in a node and - /// values of train samples in this node are less than this parameter - /// then the node will not be split further. Default value is 0.01f. - /// - public float RegressionAccuracy - { - get { return NativeMethods.ml_DTrees_getRegressionAccuracy(ptr); } - set { NativeMethods.ml_DTrees_setRegressionAccuracy(ptr, value); } - } - - /// - /// The array of a priori class probabilities, sorted by the class label value. - /// - public Mat Priors - { - get - { - IntPtr p = NativeMethods.ml_DTrees_getPriors(ptr); - return new Mat(p); - } - set { NativeMethods.ml_DTrees_setPriors(ptr, value.CvPtr); } - } - - #endregion - - #region Methods - - /// - /// Returns indices of root nodes - /// - /// - public int[] GetRoots() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - - using (var vector = new VectorOfInt32()) - { - NativeMethods.ml_DTrees_getRoots(ptr, vector.CvPtr); - return vector.ToArray(); - } - } - - /// - /// Returns all the nodes. - /// all the node indices are indices in the returned vector - /// - public Node[] GetNodes() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - - using (var vector = new VectorOfDTreesNode()) - { - NativeMethods.ml_DTrees_getNodes(ptr, vector.CvPtr); - return vector.ToArray(); - } - } - - /// - /// Returns all the splits. - /// all the split indices are indices in the returned vector - /// - /// - public Split[] GetSplits() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - - using (var vector = new VectorOfDTreesSplit()) - { - NativeMethods.ml_DTrees_getSplits(ptr, vector.CvPtr); - return vector.ToArray(); - } - } - - /// - /// Returns all the bitsets for categorical splits. - /// Split::subsetOfs is an offset in the returned vector - /// - /// - public int[] GetSubsets() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - - using (var vector = new VectorOfInt32()) - { - NativeMethods.ml_DTrees_getSubsets(ptr, vector.CvPtr); - return vector.ToArray(); - } - } - - #endregion - - #region Types - - /// - /// The class represents a decision tree node. - /// - public struct Node - { - /// - /// Value at the node: a class label in case of classification or estimated - /// function value in case of regression. - /// - public double Value; - - /// - /// Class index normalized to 0..class_count-1 range and assigned to the - /// node. It is used internally in classification trees and tree ensembles. - /// - public int ClassIdx; - - /// - /// Index of the parent node - /// - public int Parent; - - /// - /// Index of the left child node - /// - public int Left; - - /// - /// Index of right child node - /// - public int Right; - - /// - /// Default direction where to go (-1: left or +1: right). It helps in the - /// case of missing values. - /// - public int DefaultDir; - - /// - /// Index of the first split - /// - public int Split; - } - - /// - /// The class represents split in a decision tree. - /// - public struct Split - { - /// - /// Index of variable on which the split is created. - /// - public int VarIdx; - - /// - /// If not 0, then the inverse split rule is used (i.e. left and right - /// branches are exchanged in the rule expressions below). - /// - public int Inversed; - - /// - /// The split quality, a positive number. It is used to choose the best split. - /// - public float Quality; - - /// - /// Index of the next split in the list of splits for the node - /// - public int Next; - - /// - /// The threshold value in case of split on an ordered variable. - /// - public float C; - - /// - /// Offset of the bitset used by the split on a categorical variable. - /// - public int SubsetOfs; - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_DTrees_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_DTrees_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/EM.cs b/src/OpenCvSharp/modules/ml/EM.cs deleted file mode 100644 index cfddf3bbc..000000000 --- a/src/OpenCvSharp/modules/ml/EM.cs +++ /dev/null @@ -1,435 +0,0 @@ -using System; -using OpenCvSharp.ML; - -// ReSharper disable once InconsistentNaming - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// EMモデルクラス - /// -#else - /// - /// The class implements the Expectation Maximization algorithm. - /// -#endif - public class EM : Algorithm - { - private Ptr ptrObj; - - #region Constants - -#pragma warning disable 1591 - // ReSharper disable InconsistentNaming - public const int DEFAULT_NCLUSTERS = 5; - public const int DEFAULT_MAX_ITERS = 100; - // ReSharper restore InconsistentNaming -#pragma warning restore 1591 - - #endregion - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::EM* - /// - protected EM(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates empty EM model. - /// - /// - public static EM Create() - { - IntPtr ptr = NativeMethods.ml_SVM_create(); - return new EM(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public static EM Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_EM_load(filePath); - return new EM(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static EM LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_EM_loadFromString(strModel); - return new EM(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// The number of mixture components in the Gaussian mixture model. - /// Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. - /// Some of EM implementation could determine the optimal number of mixtures - /// within a specified value range, but that is not the case in ML yet. - /// - public int ClustersNumber - { - get { return NativeMethods.ml_EM_getClustersNumber(ptr); } - set { NativeMethods.ml_EM_setClustersNumber(ptr, value); } - } - - /// - /// Constraint on covariance matrices which defines type of matrices. - /// - public int CovarianceMatrixType - { - get { return NativeMethods.ml_EM_getCovarianceMatrixType(ptr); } - set { NativeMethods.ml_EM_setCovarianceMatrixType(ptr, value); } - } - - /// - /// The termination criteria of the %EM algorithm. - /// The EM algorithm can be terminated by the number of iterations - /// termCrit.maxCount (number of M-steps) or when relative change of likelihood - /// logarithm is less than termCrit.epsilon. - /// Default maximum number of iterations is EM::DEFAULT_MAX_ITERS=100. - /// - public TermCriteria TermCriteria - { - get { return NativeMethods.ml_EM_getTermCriteria(ptr); } - set { NativeMethods.ml_EM_setTermCriteria(ptr, value); } - } - - #endregion - - #region Methods - - /// - /// Returns weights of the mixtures. - /// Returns vector with the number of elements equal to the number of mixtures. - /// - /// - public Mat GetWeights() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.ml_EM_getWeights(ptr); - return new Mat(p); - } - - /// - /// Returns the cluster centers (means of the Gaussian mixture). - /// Returns matrix with the number of rows equal to the number of mixtures and - /// number of columns equal to the space dimensionality. - /// - /// - public Mat GetMeans() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.ml_EM_getMeans(ptr); - return new Mat(p); - } - - /// - /// Returns covariation matrices. - /// Returns vector of covariation matrices. Number of matrices is the number of - /// gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality. - /// - public Mat[] GetCovs() - { - ThrowIfDisposed(); - - using (var vec = new VectorOfMat()) - { - NativeMethods.ml_EM_getCovs(ptr, vec.CvPtr); - return vec.ToArray(); - } - - } - -#if LANG_JP - /// - /// サンプル集合からガウス混合パラメータを推定する - /// - /// - /// - /// - /// - /// - /// - /// -#else - /// - /// Estimates Gaussian mixture parameters from the sample set - /// - /// - /// - /// - /// - /// - /// - /// -#endif - public virtual bool TrainE( - InputArray samples, - InputArray means0, - InputArray covs0 = null, - InputArray weights0 = null, - OutputArray logLikelihoods = null, - OutputArray labels = null, - OutputArray probs = null) - { - ThrowIfDisposed(); - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - if (means0 == null) - throw new ArgumentNullException(nameof(means0)); - samples.ThrowIfDisposed(); - means0.ThrowIfDisposed(); - - logLikelihoods?.ThrowIfNotReady(); - covs0?.ThrowIfDisposed(); - weights0?.ThrowIfDisposed(); - labels?.ThrowIfNotReady(); - probs?.ThrowIfNotReady(); - - int ret = NativeMethods.ml_EM_trainE( - ptr, - samples.CvPtr, - means0.CvPtr, - Cv2.ToPtr(covs0), - Cv2.ToPtr(weights0), - Cv2.ToPtr(logLikelihoods), - Cv2.ToPtr(labels), - Cv2.ToPtr(probs)); - - logLikelihoods?.Fix(); - labels?.Fix(); - probs?.Fix(); - GC.KeepAlive(samples); - GC.KeepAlive(means0); - GC.KeepAlive(covs0); - GC.KeepAlive(weights0); - - return ret != 0; - } - -#if LANG_JP - /// - /// サンプル集合からガウス混合パラメータを推定する - /// - /// - /// - /// - /// - /// -#else - /// - /// Estimates Gaussian mixture parameters from the sample set - /// - /// - /// - /// - /// - /// -#endif - public virtual bool TrainM( - InputArray samples, - InputArray probs0, - OutputArray logLikelihoods = null, - OutputArray labels = null, - OutputArray probs = null) - { - ThrowIfDisposed(); - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - if (probs0 == null) - throw new ArgumentNullException(nameof(probs0)); - samples.ThrowIfDisposed(); - probs0.ThrowIfDisposed(); - - logLikelihoods?.ThrowIfNotReady(); - labels?.ThrowIfNotReady(); - probs?.ThrowIfNotReady(); - - int ret = NativeMethods.ml_EM_trainM( - ptr, - samples.CvPtr, - probs0.CvPtr, - Cv2.ToPtr(logLikelihoods), - Cv2.ToPtr(labels), - Cv2.ToPtr(probs)); - - logLikelihoods?.Fix(); - labels?.Fix(); - probs?.Fix(); - GC.KeepAlive(samples); - GC.KeepAlive(probs0); - - return ret != 0; - } - -#if LANG_JP - /// - /// サンプルに対する応答を予測する - /// - /// - /// -#else - /// - /// Predicts the response for sample - /// - /// - /// -#endif - public virtual Vec2d Predict2(InputArray sample, OutputArray probs = null) - { - ThrowIfDisposed(); - if (sample == null) - throw new ArgumentNullException(nameof(sample)); - sample.ThrowIfDisposed(); - probs?.ThrowIfNotReady(); - - Vec2d ret = NativeMethods.ml_EM_predict2(ptr, sample.CvPtr, Cv2.ToPtr(probs)); - probs?.Fix(); - GC.KeepAlive(sample); - return ret; - } - - #endregion - - #region Types - - /// - /// Type of covariation matrices - /// - public enum Types - { - /// - /// A scaled identity matrix \f$\mu_k * I\f$. - /// There is the only parameter \f$\mu_k\f$ to be estimated for each matrix. - /// The option may be used in special cases, when the constraint is relevant, - /// or as a first step in the optimization (for example in case when the data is - /// preprocessed with PCA). The results of such preliminary estimation may be - /// passed again to the optimization procedure, this time with covMatType=EM::COV_MAT_DIAGONAL. - /// - CovMatSpherical = 0, - - /// - /// A diagonal matrix with positive diagonal elements. - /// The number of free parameters is d for each matrix. - /// This is most commonly used option yielding good estimation results. - /// - CovMatDiagonal = 1, - - /// - /// A symmetric positively defined matrix. The number of free parameters in each - /// matrix is about \f$d^2/2\f$. It is not recommended to use this option, unless - /// there is pretty accurate initial estimation of the parameters and/or a huge number - /// of training samples. - /// - CovMatGeneric = 2, - - /// - /// - /// - CovMatDefault = CovMatSpherical, - } - -#if LANG_JP - /// - /// アルゴリズムをスタートする最初のステップ - /// -#else - /// - /// The initial step the algorithm starts from - /// -#endif - public enum StartStep : int - { -#if LANG_JP - /// - /// アルゴリズムはE-stepでスタートする. 少なくとも平均ベクトルの初期値 CvEMParams.Means が渡されなければならない. - /// オプションとして,ユーザは重み(CvEMParams.Weights)と/または共変動行列(CvEMParams.Covs)を与えることもできる. - /// [CvEM::START_E_STEP] - /// -#else - /// - /// The algorithm starts with E-step. - /// At least, the initial values of mean vectors, CvEMParams.Means must be passed. - /// Optionally, the user may also provide initial values for weights (CvEMParams.Weights) - /// and/or covariation matrices (CvEMParams.Covs). - /// [CvEM::START_E_STEP] - /// -#endif - E = 1, -#if LANG_JP - /// - /// アルゴリズムはM-stepでスタートする.初期確率 p_i,k が与えられなければならない. - /// [CvEM::START_M_STEP] - /// -#else - /// - /// The algorithm starts with M-step. The initial probabilities p_i,k must be provided. - /// [CvEM::START_M_STEP] - /// -#endif - M = 2, -#if LANG_JP - /// - /// ユーザから必要な値が指定されない場合,k-meansアルゴリズムが混合分布パラメータの初期値推定に用いられる. - /// [CvEM::START_AUTO_STEP] - /// -#else - /// - /// No values are required from the user, k-means algorithm is used to estimate initial mixtures parameters. - /// [CvEM::START_AUTO_STEP] - /// -#endif - Auto = 0, - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_EM_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_EM_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/Enum/SampleTypes.cs b/src/OpenCvSharp/modules/ml/Enum/SampleTypes.cs deleted file mode 100644 index fbe845f27..000000000 --- a/src/OpenCvSharp/modules/ml/Enum/SampleTypes.cs +++ /dev/null @@ -1,19 +0,0 @@ - -namespace OpenCvSharp.ML -{ - /// - /// Sample types - /// - public enum SampleTypes : int - { - /// - /// each training sample is a row of samples - /// - RowSample = 0, - - /// - /// each training sample occupies a column of samples - /// - ColSample = 1, - } -} diff --git a/src/OpenCvSharp/modules/ml/KNearest.cs b/src/OpenCvSharp/modules/ml/KNearest.cs deleted file mode 100644 index 3108f6c03..000000000 --- a/src/OpenCvSharp/modules/ml/KNearest.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ -#if LANG_JP - /// - /// K近傍法モデルクラス - /// -#else - /// - /// K nearest neighbors classifier - /// -#endif - public class KNearest : StatModel - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::KNearest* - /// - protected KNearest(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model - /// - /// - public static KNearest Create() - { - IntPtr ptr = NativeMethods.ml_KNearest_create(); - return new KNearest(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public static KNearest Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_KNearest_load(filePath); - return new KNearest(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static KNearest LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_KNearest_loadFromString(strModel); - return new KNearest(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Default number of neighbors to use in predict method. - /// - public int DefaultK - { - get { return NativeMethods.ml_KNearest_getDefaultK(ptr); } - set { NativeMethods.ml_KNearest_setDefaultK(ptr, value); } - } - - /// - /// Whether classification or regression model should be trained. - /// - public new bool IsClassifier - { - get { return NativeMethods.ml_KNearest_getIsClassifier(ptr) != 0; } - set { NativeMethods.ml_KNearest_setIsClassifier(ptr, value ? 1 : 0); } - } - - /// - /// Parameter for KDTree implementation - /// - public int Emax - { - get { return NativeMethods.ml_KNearest_getEmax(ptr); } - set { NativeMethods.ml_KNearest_setEmax(ptr, value); } - } - - /// - /// Algorithm type, one of KNearest::Types. - /// - public Types AlgorithmType - { - get { return (Types)NativeMethods.ml_KNearest_getAlgorithmType(ptr); } - set { NativeMethods.ml_KNearest_setAlgorithmType(ptr, (int)value); } - } - - #endregion - - #region Methods - - /// - /// Finds the neighbors and predicts responses for input vectors. - /// - /// Input samples stored by rows. - /// It is a single-precision floating-point matrix of `[number_of_samples] * k` size. - /// Number of used nearest neighbors. Should be greater than 1. - /// Vector with results of prediction (regression or classification) for each - /// input sample. It is a single-precision floating-point vector with `[number_of_samples]` elements. - /// neighborResponses Optional output values for corresponding neighbors. - /// It is a single-precision floating-point matrix of `[number_of_samples] * k` size. - /// Optional output distances from the input vectors to the corresponding neighbors. - /// It is a single-precision floating-point matrix of `[number_of_samples] * k` size. - /// - public float FindNearest(InputArray samples, int k, OutputArray results, - OutputArray neighborResponses = null, OutputArray dist = null) - { - ThrowIfDisposed(); - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - if (results == null) - throw new ArgumentNullException(nameof(results)); - samples.ThrowIfDisposed(); - results.ThrowIfNotReady(); - - float ret = NativeMethods.ml_KNearest_findNearest( - ptr, - samples.CvPtr, k, results.CvPtr, - Cv2.ToPtr(neighborResponses), Cv2.ToPtr(dist)); - - GC.KeepAlive(samples); - results.Fix(); - neighborResponses?.Fix(); - dist?.Fix(); - return ret; - } - - #endregion - - #region Types - - /// - /// Implementations of KNearest algorithm - /// - public enum Types - { -#pragma warning disable 1591 - BruteForce = 1, - KdTree = 2 -#pragma warning restore 1591 - }; - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_KNearest_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_KNearest_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/LogisticRegression.cs b/src/OpenCvSharp/modules/ml/LogisticRegression.cs deleted file mode 100644 index 477079076..000000000 --- a/src/OpenCvSharp/modules/ml/LogisticRegression.cs +++ /dev/null @@ -1,235 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ - /// - /// Implements Logistic Regression classifier. - /// - public class LogisticRegression : StatModel - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::LogisticRegression* - /// - protected LogisticRegression(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model. - /// - /// - public static LogisticRegression Create() - { - IntPtr ptr = NativeMethods.ml_LogisticRegression_create(); - return new LogisticRegression(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public static LogisticRegression Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_LogisticRegression_load(filePath); - return new LogisticRegression(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static LogisticRegression LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_LogisticRegression_loadFromString(strModel); - return new LogisticRegression(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Learning rate - /// - public double LearningRate - { - get { return NativeMethods.ml_LogisticRegression_getLearningRate(ptr); } - set { NativeMethods.ml_LogisticRegression_setLearningRate(ptr, value); } - } - - /// - /// Number of iterations. - /// - public int Iterations - { - get { return NativeMethods.ml_LogisticRegression_getIterations(ptr); } - set { NativeMethods.ml_LogisticRegression_setIterations(ptr, value); } - } - - /// - /// Kind of regularization to be applied. See LogisticRegression::RegKinds. - /// - public RegKinds Regularization - { - get { return (RegKinds)NativeMethods.ml_LogisticRegression_getRegularization(ptr); } - set { NativeMethods.ml_LogisticRegression_setRegularization(ptr, (int)value); } - } - - /// - /// Kind of training method used. See LogisticRegression::Methods. - /// - public Methods TrainMethod - { - get { return (Methods)NativeMethods.ml_LogisticRegression_getTrainMethod(ptr); } - set { NativeMethods.ml_LogisticRegression_setTrainMethod(ptr, (int)value); } - } - - /// - /// Specifies the number of training samples taken in each step of Mini-Batch Gradient. - /// Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. - /// It has to take values less than the total number of training samples. - /// - public int MiniBatchSize - { - get { return NativeMethods.ml_LogisticRegression_getMiniBatchSize(ptr); } - set { NativeMethods.ml_LogisticRegression_setMiniBatchSize(ptr, value); } - } - - /// - /// Termination criteria of the training algorithm. - /// - public TermCriteria TermCriteria - { - get { return NativeMethods.ml_LogisticRegression_getTermCriteria(ptr); } - set { NativeMethods.ml_LogisticRegression_setTermCriteria(ptr, value); } - } - - #endregion - - #region Methods - - /// - /// Predicts responses for input samples and returns a float type. - /// - /// The input data for the prediction algorithm. Matrix [m x n], - /// where each row contains variables (features) of one object being classified. - /// Should have data type CV_32F. - /// Predicted labels as a column matrix of type CV_32S. - /// Not used. - /// - public float Predict(InputArray samples, OutputArray results = null, int flags = 0) - { - ThrowIfDisposed(); - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - samples.ThrowIfDisposed(); - if (results != null) - results.ThrowIfNotReady(); - - float ret = NativeMethods.ml_LogisticRegression_predict(ptr, samples.CvPtr, Cv2.ToPtr(results), flags); - - GC.KeepAlive(samples); - if (results != null) - results.Fix(); - - return ret; - } - - /// - /// This function returns the trained paramters arranged across rows. - /// For a two class classifcation problem, it returns a row matrix. - /// It returns learnt paramters of the Logistic Regression as a matrix of type CV_32F. - /// - /// - public Mat GetLearntThetas() - { - ThrowIfDisposed(); - - IntPtr p = NativeMethods.ml_LogisticRegression_get_learnt_thetas(ptr); - return new Mat(p); - } - - #endregion - - #region Types - - /// - /// Regularization kinds - /// - public enum RegKinds - { - /// - /// Regularization disabled - /// - RegDisable = -1, - - /// - /// L1 norm - /// - RegL1 = 0, - - /// - /// L2 norm - /// - RegL2 = 1 - } - - /// - /// Training methods - /// - public enum Methods - { - /// - /// - /// - Batch = 0, - - /// - /// Set MiniBatchSize to a positive integer when using this method. - /// - MiniBatch = 1 - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_LogisticRegression_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_LogisticRegression_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/ml/NormalBayesClassifier.cs b/src/OpenCvSharp/modules/ml/NormalBayesClassifier.cs deleted file mode 100644 index 1d5bf1be2..000000000 --- a/src/OpenCvSharp/modules/ml/NormalBayesClassifier.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ -#if LANG_JP - /// - /// 正規分布データに対するベイズ分類器クラス - /// -#else - /// - /// Bayes classifier for normally distributed data - /// -#endif - public class NormalBayesClassifier : StatModel - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::NormalBayesClassifier* - /// - protected NormalBayesClassifier(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates empty model. - /// Use StatModel::train to train the model after creation. - /// - /// - public static NormalBayesClassifier Create() - { - IntPtr ptr = NativeMethods.ml_NormalBayesClassifier_create(); - return new NormalBayesClassifier(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public static NormalBayesClassifier Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_NormalBayesClassifier_load(filePath); - return new NormalBayesClassifier(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static NormalBayesClassifier LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_NormalBayesClassifier_loadFromString(strModel); - return new NormalBayesClassifier(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - #endregion - - #region Methods - - /// - /// Predicts the response for sample(s). - /// - /// - /// - /// - /// - /// - /// - /// The method estimates the most probable classes for input vectors. Input vectors (one or more) - /// are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one - /// output vector outputs. The predicted class for a single input vector is returned by the method. - /// The vector outputProbs contains the output probabilities corresponding to each element of result. - /// - public float PredictProb(InputArray inputs, OutputArray outputs, - OutputArray outputProbs, int flags = 0) - { - ThrowIfDisposed(); - if (inputs == null) - throw new ArgumentNullException(nameof(inputs)); - if (outputs == null) - throw new ArgumentNullException(nameof(outputs)); - if (outputProbs == null) - throw new ArgumentNullException(nameof(outputProbs)); - - inputs.ThrowIfDisposed(); - outputs.ThrowIfNotReady(); - outputProbs.ThrowIfNotReady(); - - float result = NativeMethods.ml_NormalBayesClassifier_predictProb( - ptr, inputs.CvPtr, outputs.CvPtr, outputProbs.CvPtr, flags); - outputs.Fix(); - outputProbs.Fix(); - GC.KeepAlive(inputs); - return result; - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_NormalBayesClassifier_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_NormalBayesClassifier_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/ParamGrid.cs b/src/OpenCvSharp/modules/ml/ParamGrid.cs deleted file mode 100644 index 1aed57ccb..000000000 --- a/src/OpenCvSharp/modules/ml/ParamGrid.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ - /// - /// The structure represents the logarithmic grid range of statmodel parameters. - /// - public struct ParamGrid - { - /// - /// Minimum value of the statmodel parameter. Default value is 0. - /// - public double MinVal; - - /// - /// Maximum value of the statmodel parameter. Default value is 0. - /// - public double MaxVal; - - /// - /// Logarithmic step for iterating the statmodel parameter. - /// - /// - /// The grid determines the following iteration sequence of the statmodel parameter values: - /// \f[(minVal, minVal*step, minVal*{step}^2, \dots, minVal*{logStep}^n),\f] - /// where \f$n\f$ is the maximal index satisfying - /// \f[\texttt{minVal} * \texttt{logStep} ^n < \texttt{maxVal}\f] - /// The grid is logarithmic, so logStep must always be greater then 1. Default value is 1. - /// - public double LogStep; - - /// - /// Constructor with parameters - /// - /// - /// - /// - public ParamGrid(double minVal, double maxVal, double logStep) - { - MinVal = minVal; - MaxVal = maxVal; - LogStep = logStep; - } - } -} diff --git a/src/OpenCvSharp/modules/ml/RTrees.cs b/src/OpenCvSharp/modules/ml/RTrees.cs deleted file mode 100644 index 41d5e82cf..000000000 --- a/src/OpenCvSharp/modules/ml/RTrees.cs +++ /dev/null @@ -1,172 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp.ML -{ -#if LANG_JP - /// - /// ランダムツリークラス - /// -#else - /// - /// The class implements the random forest predictor. - /// -#endif - public class RTrees : DTrees - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::RTrees* - /// - protected RTrees(IntPtr p) - : base() - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model. - /// - /// - public new static RTrees Create() - { - IntPtr ptr = NativeMethods.ml_RTrees_create(); - return new RTrees(ptr); - } - - /// - /// Loads and creates a serialized model from a file. - /// - /// - /// - public new static RTrees Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_RTrees_load(filePath); - return new RTrees(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public new static RTrees LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_RTrees_loadFromString(strModel); - return new RTrees(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// If true then variable importance will be calculated and then - /// it can be retrieved by RTrees::getVarImportance. Default value is false. - /// - public bool CalculateVarImportance - { - get - { - ThrowIfDisposed(); - return NativeMethods.ml_RTrees_getCalculateVarImportance(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.ml_RTrees_setCalculateVarImportance(ptr, value ? 1 : 0); - } - } - - /// - /// The size of the randomly selected subset of features at each tree node - /// and that are used to find the best split(s). - /// - public bool ActiveVarCount - { - get - { - ThrowIfDisposed(); - return NativeMethods.ml_RTrees_getActiveVarCount(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.ml_RTrees_setActiveVarCount(ptr, value ? 1 : 0); - } - } - - /// - /// The termination criteria that specifies when the training algorithm stops. - /// - public TermCriteria TermCriteria - { - get - { - ThrowIfDisposed(); - return NativeMethods.ml_RTrees_getTermCriteria(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.ml_RTrees_setTermCriteria(ptr, value); - } - } - - #endregion - - #region Methods - - /// - /// Returns the variable importance array. - /// The method returns the variable importance vector, computed at the training - /// stage when CalculateVarImportance is set to true. If this flag was set to false, - /// the empty matrix is returned. - /// - /// - public Mat GetVarImportance() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.ml_RTrees_getVarImportance(ptr); - return new Mat(p); - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_RTrees_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_RTrees_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/SVM.cs b/src/OpenCvSharp/modules/ml/SVM.cs deleted file mode 100644 index 6f048086b..000000000 --- a/src/OpenCvSharp/modules/ml/SVM.cs +++ /dev/null @@ -1,442 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// SVM model classifier - /// -#else - /// - /// Support Vector Machines - /// -#endif - - public class SVM : StatModel - { - private Ptr ptrObj; - - #region Init and Disposal - - /// - /// Creates instance by raw pointer cv::ml::SVM* - /// - protected SVM(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates empty model. - /// Use StatModel::Train to train the model. - /// Since %SVM has several parameters, you may want to find the best - /// parameters for your problem, it can be done with SVM::TrainAuto. - /// - /// - public static SVM Create() - { - IntPtr ptr = NativeMethods.ml_SVM_create(); - return new SVM(ptr); - } - - /// - /// Loads and creates a serialized svm from a file. - /// Use SVM::save to serialize and store an SVM to disk. - /// Load the SVM from this file again, by calling this function with the path to the file. - /// - /// - /// - public static SVM Load(string filePath) - { - if (filePath == null) - throw new ArgumentNullException(nameof(filePath)); - IntPtr ptr = NativeMethods.ml_SVM_load(filePath); - return new SVM(ptr); - } - - /// - /// Loads algorithm from a String. - /// - /// he string variable containing the model you want to load. - /// - public static SVM LoadFromString(string strModel) - { - if (strModel == null) - throw new ArgumentNullException(nameof(strModel)); - IntPtr ptr = NativeMethods.ml_SVM_loadFromString(strModel); - return new SVM(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Type of a %SVM formulation. - /// Default value is SVM::C_SVC. - /// - public Types Type - { - get { return (Types)NativeMethods.ml_SVM_getType(ptr); } - set { NativeMethods.ml_SVM_setType(ptr, (int)value); } - } - - /// - /// Parameter gamma of a kernel function. - /// For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1. - /// - public double Gamma - { - get { return NativeMethods.ml_SVM_getGamma(ptr); } - set { NativeMethods.ml_SVM_setGamma(ptr, value); } - } - - /// - /// Parameter coef0 of a kernel function. - /// For SVM::POLY or SVM::SIGMOID. Default value is 0. - /// - public double Coef0 - { - get { return NativeMethods.ml_SVM_getCoef0(ptr); } - set { NativeMethods.ml_SVM_setCoef0(ptr, value); } - } - - /// - /// Parameter degree of a kernel function. - /// For SVM::POLY. Default value is 0. - /// - public double Degree - { - get { return NativeMethods.ml_SVM_getDegree(ptr); } - set { NativeMethods.ml_SVM_setDegree(ptr, value); } - } - - /// - /// Parameter C of a %SVM optimization problem. - /// For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0. - /// - public double C - { - get { return NativeMethods.ml_SVM_getC(ptr); } - set { NativeMethods.ml_SVM_setC(ptr, value); } - } - - /// - /// Parameter nu of a %SVM optimization problem. - /// For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0. - /// - public double Nu - { - get { return NativeMethods.ml_SVM_getNu(ptr); } - set { NativeMethods.ml_SVM_setNu(ptr, value); } - } - - /// - /// Parameter epsilon of a %SVM optimization problem. - /// For SVM::EPS_SVR. Default value is 0. - /// - public double P - { - get { return NativeMethods.ml_SVM_getP(ptr); } - set { NativeMethods.ml_SVM_setP(ptr, value); } - } - - /// - /// Optional weights in the SVM::C_SVC problem, assigned to particular classes. - /// - /// - /// They are multiplied by _C_ so the parameter _C_ of class _i_ becomes `classWeights(i) * C`. - /// Thus these weights affect the misclassification penalty for different classes. - /// The larger weight, the larger penalty on misclassification of data from the - /// corresponding class. Default value is empty Mat. - /// - public Mat ClassWeights - { - get - { - IntPtr p = NativeMethods.ml_SVM_getClassWeights(ptr); - return new Mat(p); - } - set - { - NativeMethods.ml_SVM_setClassWeights(ptr, value.CvPtr); - } - } - - /// - /// Termination criteria of the iterative SVM training procedure - /// which solves a partial case of constrained quadratic optimization problem. - /// - /// - /// You can specify tolerance and/or the maximum number of iterations. - /// Default value is `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`; - /// - public TermCriteria TermCriteria - { - get { return NativeMethods.ml_SVM_getTermCriteria(ptr); } - set { NativeMethods.ml_SVM_setTermCriteria(ptr, value); } - } - - /// - /// Type of a %SVM kernel. See SVM::KernelTypes. Default value is SVM::RBF. - /// - public KernelTypes KernelType - { - get { return (KernelTypes)NativeMethods.ml_SVM_getKernelType(ptr); } - set { NativeMethods.ml_SVM_setKernel(ptr, (int)value); } - } - - #endregion - - #region Methods - - /// - /// Initialize with custom kernel. - /// - /// - public void SetCustomKernel(Kernel kernel) - { - throw new NotImplementedException(); - } - - /// - /// Trains an %SVM with optimal parameters. - /// - /// the training data that can be constructed using - /// TrainData::create or TrainData::loadFromCSV. - /// Cross-validation parameter. The training set is divided into kFold subsets. - /// One subset is used to test the model, the others form the train set. So, the %SVM algorithm is - /// executed kFold times. - /// grid for C - /// grid for gamma - /// grid for p - /// grid for nu - /// grid for coeff - /// grid for degree - /// If true and the problem is 2-class classification then the method creates - /// more balanced cross-validation subsets that is proportions between classes in subsets are close - /// to such proportion in the whole train dataset. - /// - public bool TrainAuto(TrainData data, int kFold = 10, - ParamGrid? cGrid = null, - ParamGrid? gammaGrid = null, - ParamGrid? pGrid = null, - ParamGrid? nuGrid = null, - ParamGrid? coeffGrid = null, - ParamGrid? degreeGrid = null, - bool balanced = false) - { - throw new NotImplementedException(); - /* - var cGridValue = cGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.C)); - var gammaGridValue = gammaGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Gamma)); - var pGridValue = pGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.P)); - var nuGridValue = nuGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Nu)); - var coeffGridValue = coeffGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Coef)); - var degreeGridValue = degreeGrid.GetValueOrDefault(GetDefaultGrid(ParamTypes.Degree));*/ - } - - /// - /// Retrieves all the support vectors - /// - /// - public Mat GetSupportVectors() - { - ThrowIfDisposed(); - IntPtr p = NativeMethods.ml_SVM_getSupportVectors(ptr); - return new Mat(p); - } - - /// - /// Retrieves the decision function - /// - /// i the index of the decision function. - /// If the problem solved is regression, 1-class or 2-class classification, then - /// there will be just one decision function and the index should always be 0. - /// Otherwise, in the case of N-class classification, there will be N(N-1)/2 decision functions. - /// alpha the optional output vector for weights, corresponding to - /// different support vectors. In the case of linear %SVM all the alpha's will be 1's. - /// the optional output vector of indices of support vectors - /// within the matrix of support vectors (which can be retrieved by SVM::getSupportVectors). - /// In the case of linear %SVM each decision function consists of a single "compressed" support vector. - /// - public double GetDecisionFunction(int i, OutputArray alpha, OutputArray svidx) - { - ThrowIfDisposed(); - if (alpha == null) - throw new ArgumentNullException(nameof(alpha)); - if (svidx == null) - throw new ArgumentNullException(nameof(svidx)); - - alpha.ThrowIfNotReady(); - svidx.ThrowIfNotReady(); - double ret = NativeMethods.ml_SVM_getDecisionFunction(ptr, i, alpha.CvPtr, svidx.CvPtr); - alpha.Fix(); - svidx.Fix(); - return ret; - } - - /// - /// Generates a grid for SVM parameters. - /// - /// SVM parameters IDs that must be one of the SVM::ParamTypes. - /// The grid is generated for the parameter with this ID. - /// - public static ParamGrid GetDefaultGrid(ParamTypes paramId) - { - return NativeMethods.ml_SVM_getDefaultGrid((int)paramId); - } - - #endregion - - #region Types - - /// - /// - /// - public class Kernel - { - /// - /// - /// - public Kernel() - { - throw new NotImplementedException(); - } - } - - /// - /// SVM type - /// - public enum Types - { - /// - /// C-Support Vector Classification. n-class classification (n \f$\geq\f$ 2), - /// allows imperfect separation of classes with penalty multiplier C for outliers. - /// - CSvc = 100, - - /// - /// nu-Support Vector Classification. n-class classification with possible - /// imperfect separation. Parameter \f$\nu\f$ (in the range 0..1, the larger - /// the value, the smoother the decision boundary) is used instead of C. - /// - NuSvc = 101, - - /// - /// Distribution Estimation (One-class %SVM). All the training data are from - /// the same class, %SVM builds a boundary that separates the class from the - /// rest of the feature space. - /// - OneClass = 102, - - /// - /// epsilon-Support Vector Regression. - /// The distance between feature vectors from the training set and the fitting - /// hyper-plane must be less than p. For outliers the penalty multiplier C is used. - /// - EpsSvr = 103, - - /// - /// nu-Support Vector Regression. \f$\nu\f$ is used instead of p. - /// See @cite LibSVM for details. - /// - NuSvr = 104 - } - - /// - /// SVM kernel type - /// - public enum KernelTypes - { - /// - /// Returned by SVM::getKernelType in case when custom kernel has been set - /// - Custom = -1, - - /// - /// Linear kernel. No mapping is done, linear discrimination (or regression) is - /// done in the original feature space. It is the fastest option. \f$K(x_i, x_j) = x_i^T x_j\f$. - /// - Linear = 0, - - /// - /// Polynomial kernel: - /// \f$K(x_i, x_j) = (\gamma x_i^T x_j + coef0)^{degree}, \gamma > 0\f$. - /// - Poly = 1, - - /// - /// Radial basis function (RBF), a good choice in most cases. - /// \f$K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0\f$. - /// - Rbf = 2, - - /// - /// Sigmoid kernel: - /// \f$K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)\f$. - /// - Sigmoid = 3, - - /// - /// Exponential Chi2 kernel, similar to the RBF kernel: - /// \f$K(x_i, x_j) = e^{-\gamma \chi^2(x_i,x_j)}, \chi^2(x_i,x_j) = (x_i-x_j)^2/(x_i+x_j), \gamma > 0\f$. - /// - Chi2 = 4, - - /// - /// Histogram intersection kernel. - /// A fast kernel. \f$K(x_i, x_j) = min(x_i,x_j)\f$. - /// - Inter = 5 - } - - /// - /// SVM params type - /// - public enum ParamTypes - { -#pragma warning disable 1591 - C = 0, - Gamma = 1, - P = 2, - Nu = 3, - Coef = 4, - Degree = 5 -#pragma warning restore 1591 - }; - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.ml_Ptr_SVM_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.ml_Ptr_SVM_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/ml/StatModel.cs b/src/OpenCvSharp/modules/ml/StatModel.cs deleted file mode 100644 index 20eef9312..000000000 --- a/src/OpenCvSharp/modules/ml/StatModel.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ -#if LANG_JP - /// - /// ML 統計モデルのための基本クラス - /// -#else - /// - /// Base class for statistical models in ML - /// -#endif - public abstract class StatModel : Algorithm - { - #region Init and Disposal - -#if LANG_JP - /// - /// 初期化 - /// -#else - /// - /// Default constructor - /// -#endif - protected StatModel() - { - } - - #endregion - - #region Methods - - /// - /// Returns the number of variables in training samples - /// - /// - public virtual int GetVarCount() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.ml_StatModel_getVarCount(ptr); - } - - /// - /// - /// - /// - public virtual new bool Empty() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.ml_StatModel_empty(ptr) != 0; - } - - /// - /// Returns true if the model is trained - /// - /// - public virtual bool IsTrained() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.ml_StatModel_isTrained(ptr) != 0; - } - - /// - /// Returns true if the model is classifier - /// - /// - public virtual bool IsClassifier() - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - return NativeMethods.ml_StatModel_isClassifier(ptr) != 0; - } - - /// - /// Trains the statistical model - /// - /// training data that can be loaded from file using TrainData::loadFromCSV - /// or created with TrainData::create. - /// optional flags, depending on the model. Some of the models can be updated with the - /// new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP). - /// - public virtual bool Train(TrainData trainData, int flags = 0) - { - throw new NotImplementedException(); - } - - /// - /// Trains the statistical model - /// - /// training samples - /// SampleTypes value - /// vector of responses associated with the training samples. - /// - public virtual bool Train(InputArray samples, SampleTypes layout, InputArray responses) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - if (responses == null) - throw new ArgumentNullException(nameof(responses)); - samples.ThrowIfDisposed(); - responses.ThrowIfDisposed(); - - int ret = NativeMethods.ml_StatModel_train2(ptr, samples.CvPtr, (int)layout, responses.CvPtr); - GC.KeepAlive(samples); - GC.KeepAlive(responses); - return ret != 0; - } - - /// - /// Computes error on the training or test dataset - /// - /// the training data - /// if true, the error is computed over the test subset of the data, - /// otherwise it's computed over the training subset of the data. Please note that if you - /// loaded a completely different dataset to evaluate already trained classifier, you will - /// probably want not to set the test subset at all with TrainData::setTrainTestSplitRatio - /// and specify test=false, so that the error is computed for the whole new set. Yes, this - /// sounds a bit confusing. - /// the optional output responses. - /// - public virtual float CalcError(TrainData data, bool test, OutputArray resp) - { - throw new NotImplementedException(); - } - - /// - /// Predicts response(s) for the provided sample(s) - /// - /// The input samples, floating-point matrix - /// The optional output matrix of results. - /// The optional flags, model-dependent. - /// - public virtual float Predict(InputArray samples, OutputArray results = null, Flags flags = 0) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (samples == null) - throw new ArgumentNullException(nameof(samples)); - samples.ThrowIfDisposed(); - if (results != null) - results.ThrowIfNotReady(); - - float ret = NativeMethods.ml_StatModel_predict( - ptr, samples.CvPtr, Cv2.ToPtr(results), (int)flags); - - GC.KeepAlive(samples); - if (results != null) - results.Fix(); - return ret; - } - - #endregion - - #region Types - - /// - /// Predict options - /// - [FlagsAttribute] - public enum Flags - { -#pragma warning disable 1591 - UpdateModel = 1, - /// - /// makes the method return the raw results (the sum), not the class label - /// - RawOutput = 1, - CompressedInput = 2, - PreprocessedInput = 4 -#pragma warning restore 1591 - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/ml/TrainData.cs b/src/OpenCvSharp/modules/ml/TrainData.cs deleted file mode 100644 index 4d982a4dd..000000000 --- a/src/OpenCvSharp/modules/ml/TrainData.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace OpenCvSharp.ML -{ - /// - /// - /// - public class TrainData - { - /// - /// - /// - public TrainData() - { - throw new NotImplementedException(); - } - } -} diff --git a/src/OpenCvSharp/modules/objdetect/CascadeClassifier.cs b/src/OpenCvSharp/modules/objdetect/CascadeClassifier.cs deleted file mode 100644 index 36c7f1468..000000000 --- a/src/OpenCvSharp/modules/objdetect/CascadeClassifier.cs +++ /dev/null @@ -1,199 +0,0 @@ - -using System; -using System.IO; - -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - /// - /// Cascade classifier class for object detection. - /// - public class CascadeClassifier : DisposableCvObject - { - #region Init and Disposal - - /// - /// Default constructor - /// - public CascadeClassifier() - { - ptr = NativeMethods.objdetect_CascadeClassifier_new(); - } - - /// - /// Loads a classifier from a file. - /// - /// Name of the file from which the classifier is loaded. - public CascadeClassifier(string fileName) - { - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); -#if !uwp - if (!File.Exists(fileName)) - throw new FileNotFoundException("\""+ fileName + "\"not found", fileName); -#endif - ptr = NativeMethods.objdetect_CascadeClassifier_newFromFile(fileName); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.objdetect_CascadeClassifier_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Methods - - /// - /// Checks whether the classifier has been loaded. - /// - /// - public virtual bool Empty() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_CascadeClassifier_empty(ptr) != 0; - } - - /// - /// Loads a classifier from a file. - /// - /// Name of the file from which the classifier is loaded. - /// The file may contain an old HAAR classifier trained by the haartraining application - /// or a new cascade classifier trained by the traincascade application. - /// - public bool Load(string fileName) - { - ThrowIfDisposed(); - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); -#if !uwp - if (!File.Exists(fileName)) - throw new FileNotFoundException("\"" + fileName + "\"not found", fileName); -#endif - return NativeMethods.objdetect_CascadeClassifier_load(ptr, fileName) != 0; - } - - //public virtual bool read( const FileNode& node ); - - /// - /// Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. - /// - /// Matrix of the type CV_8U containing an image where objects are detected. - /// Parameter specifying how much the image size is reduced at each image scale. - /// Parameter specifying how many neighbors each candidate rectangle should have to retain it. - /// Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. - /// It is not used for a new cascade. - /// Minimum possible object size. Objects smaller than that are ignored. - /// Maximum possible object size. Objects larger than that are ignored. - /// Vector of rectangles where each rectangle contains the detected object. - public virtual Rect[] DetectMultiScale( - Mat image, - double scaleFactor = 1.1, - int minNeighbors = 3, - HaarDetectionType flags = 0, - Size? minSize = null, - Size? maxSize = null) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - Size minSize0 = minSize.GetValueOrDefault(new Size()); - Size maxSize0 = maxSize.GetValueOrDefault(new Size()); - - using (var objectsVec = new VectorOfRect()) - { - NativeMethods.objdetect_CascadeClassifier_detectMultiScale1( - ptr, image.CvPtr, objectsVec.CvPtr, - scaleFactor, minNeighbors, (int)flags, minSize0, maxSize0); - return objectsVec.ToArray(); - } - } - - /// - /// Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. - /// - /// Matrix of the type CV_8U containing an image where objects are detected. - /// - /// - /// Parameter specifying how much the image size is reduced at each image scale. - /// Parameter specifying how many neighbors each candidate rectangle should have to retain it. - /// Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. - /// It is not used for a new cascade. - /// Minimum possible object size. Objects smaller than that are ignored. - /// Maximum possible object size. Objects larger than that are ignored. - /// - /// Vector of rectangles where each rectangle contains the detected object. - public virtual Rect[] DetectMultiScale( - Mat image, - out int[] rejectLevels, - out double[] levelWeights, - double scaleFactor = 1.1, - int minNeighbors = 3, - HaarDetectionType flags = 0, - Size? minSize = null, - Size? maxSize = null, - bool outputRejectLevels = false) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - Size minSize0 = minSize.GetValueOrDefault(new Size()); - Size maxSize0 = maxSize.GetValueOrDefault(new Size()); - - using (var objectsVec = new VectorOfRect()) - using (var rejectLevelsVec = new VectorOfInt32()) - using (var levelWeightsVec = new VectorOfDouble()) - { - NativeMethods.objdetect_CascadeClassifier_detectMultiScale2( - ptr, image.CvPtr, objectsVec.CvPtr, rejectLevelsVec.CvPtr, levelWeightsVec.CvPtr, - scaleFactor, minNeighbors, (int)flags, minSize0, maxSize0, outputRejectLevels ? 1 : 0); - - rejectLevels = rejectLevelsVec.ToArray(); - levelWeights = levelWeightsVec.ToArray(); - return objectsVec.ToArray(); - } - } - - /// - /// - /// - /// - public bool IsOldFormatCascade() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_CascadeClassifier_isOldFormatCascade(ptr) != 0; - } - - /// - /// - /// - /// - public virtual Size GetOriginalWindowSize() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_CascadeClassifier_getOriginalWindowSize(ptr); - } - - /// - /// - /// - /// - public int GetFeatureType() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_CascadeClassifier_getFeatureType(ptr); - } - -#endregion - } - -} diff --git a/src/OpenCvSharp/modules/objdetect/Enum/HaarDetectionType.cs b/src/OpenCvSharp/modules/objdetect/Enum/HaarDetectionType.cs deleted file mode 100644 index b28c07da9..000000000 --- a/src/OpenCvSharp/modules/objdetect/Enum/HaarDetectionType.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvHaarDetectObjectsの処理モード - /// -#else - /// - /// Modes of operation for cvHaarDetectObjects - /// -#endif - [Flags] - public enum HaarDetectionType : int - { -#if LANG_JP - /// - /// これがセットされると,関数は Canny エッジ検出器を 非常に多くのエッジを含む(あるいは非常に少ないエッジしか含まない) 画像領域を, - /// 探索オブジェクトを含まない領域と見なして棄却する. 顔検出用には特別な閾値が調整されており,この場合,枝刈りにより処理が 高速化される. - /// [CV_HAAR_DO_CANNY_PRUNING] - /// -#else - /// - /// If it is set, the function uses Canny edge detector to reject some image regions that contain too few or too much edges and thus can not contain the searched object. - /// The particular threshold values are tuned for face detection and in this case the pruning speeds up the processing. - /// [CV_HAAR_DO_CANNY_PRUNING] - /// -#endif - DoCannyPruning = 1, - - -#if LANG_JP - /// - /// スケーリングされる度に,関数は, 分類カスケード中の特徴の座標系を 「拡大」するのではなく,逆に画像を縮小する. - /// 現在は,単体でのみ用いることができるオプションである. つまり,このフラグは他のものと併用はできない. - /// [CV_HAAR_SCALE_IMAGE] - /// -#else - /// - /// For each scale factor used the function will downscale the image rather than "zoom" the feature coordinates in the classifier cascade. - /// Currently, the option can only be used alone, i.e. the flag can not be set together with the others. - /// [CV_HAAR_SCALE_IMAGE] - /// -#endif - ScaleImage = 2, - - -#if LANG_JP - /// - /// これがセットされると,関数は,(もし存在すれば)画像中の最大のオブジェクトを検出する. つまり,出力シーケンスは一つ(あるいは 0)のエレメントを持つ. - /// [CV_HAAR_FIND_BIGGEST_OBJECT] - /// -#else - /// - /// If it is set, the function finds the largest object (if any) in the image. That is, the output sequence will contain one (or zero) element(s). - /// [CV_HAAR_FIND_BIGGEST_OBJECT] - /// -#endif - FindBiggestObject = 4, - - -#if LANG_JP - /// - /// FindBiggestObject がセットされており,min_neighbors > 0 である場合にのみ利用されるべきである. - /// このフラグがセットされると,関数は,現在のスケールにおいて, オブジェクトが検出(かつ,その近傍に充分に候補が検出)された後に, - /// それより小さいサイズの候補を探索しなくなる. min_neighbors が固定されていると, 大抵の場合,このモードは通常のシングルオブジェクトモード - /// (flags=FindBiggestObject)よりも不正確な(少しだけ大きい)オブジェクト矩形を返す. しかし,このモードはずっと高速であり,最大で10倍程度の速度差になる. - /// 正確さを増すために,min_neighbors に大き な値を指定することができる. - /// [CV_HAAR_DO_ROUGH_SEARCH] - /// -#else - /// - /// It should be used only when FindBiggestObject is set and min_neighbors > 0. - /// If the flag is set, the function does not look for candidates of a smaller size - /// as soon as it has found the object (with enough neighbor candidates) at the current scale. - /// Typically, when min_neighbors is fixed, the mode yields less accurate (a bit larger) object rectangle - /// than the regular single-object mode (flags=FindBiggestObject), - /// but it is much faster, up to an order of magnitude. A greater value of min_neighbors may be specified to improve the accuracy. - /// [CV_HAAR_DO_ROUGH_SEARCH] - /// -#endif - DoRoughSearch = 8, - } -} diff --git a/src/OpenCvSharp/modules/objdetect/HOGDescriptor.cs b/src/OpenCvSharp/modules/objdetect/HOGDescriptor.cs deleted file mode 100644 index 9d418bcf9..000000000 --- a/src/OpenCvSharp/modules/objdetect/HOGDescriptor.cs +++ /dev/null @@ -1,1986 +0,0 @@ -using System; - -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector - /// -#else - /// - /// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector - /// -#endif - public class HOGDescriptor : DisposableCvObject - { - #region Fields - - /// - /// - /// - public const int L2Hys = 0; - /// - /// - /// - public const int DefaultNlevels = 64; - /// - /// sizeof(HOGDescriptor) - /// - public static readonly int SizeOf = NativeMethods.objdetect_HOGDescriptor_sizeof(); - - #region DefaultPeopleDetector - - /// - /// Returns coefficients of the classifier trained for people detection (for default window size). - /// - public static readonly float[] DefaultPeopleDetector = - { - 0.05359386f, -0.14721455f, -0.05532170f, 0.05077307f, - 0.11547081f, -0.04268804f, 0.04635834f, -0.05468199f, 0.08232084f, - 0.10424068f, -0.02294518f, 0.01108519f, 0.01378693f, 0.11193510f, - 0.01268418f, 0.08528346f, -0.06309239f, 0.13054633f, 0.08100729f, - -0.05209739f, -0.04315529f, 0.09341384f, 0.11035026f, -0.07596218f, - -0.05517511f, -0.04465296f, 0.02947334f, 0.04555536f, - -3.55954492e-003f, 0.07818956f, 0.07730991f, 0.07890715f, 0.06222893f, - 0.09001380f, -0.03574381f, 0.03414327f, 0.05677258f, -0.04773581f, - 0.03746637f, -0.03521175f, 0.06955440f, -0.03849038f, 0.01052293f, - 0.01736112f, 0.10867710f, 0.08748853f, 3.29739624e-003f, 0.10907028f, - 0.07913758f, 0.10393070f, 0.02091867f, 0.11594022f, 0.13182420f, - 0.09879354f, 0.05362710f, -0.06745391f, -7.01260753e-003f, - 5.24702156e-003f, 0.03236255f, 0.01407916f, 0.02207983f, 0.02537322f, - 0.04547948f, 0.07200756f, 0.03129894f, -0.06274468f, 0.02107014f, - 0.06035208f, 0.08636236f, 4.53164103e-003f, 0.02193363f, 0.02309801f, - 0.05568166f, -0.02645093f, 0.04448695f, 0.02837519f, 0.08975694f, - 0.04461516f, 0.08975355f, 0.07514391f, 0.02306982f, 0.10410084f, - 0.06368385f, 0.05943464f, 4.58420580e-003f, 0.05220337f, 0.06675851f, - 0.08358569f, 0.06712101f, 0.06559004f, -0.03930482f, -9.15936660e-003f, - -0.05897915f, 0.02816453f, 0.05032348f, 0.06780671f, 0.03377650f, - -6.09417039e-004f, -0.01795146f, -0.03083684f, -0.01302475f, - -0.02972313f, 7.88706727e-003f, -0.03525961f, -2.50397739e-003f, - 0.05245084f, 0.11791293f, -0.02167498f, 0.05299332f, 0.06640524f, - 0.05190265f, -8.27316567e-003f, 0.03033127f, 0.05842173f, - -4.01050318e-003f, -6.25105947e-003f, 0.05862958f, -0.02465461f, - 0.05546781f, -0.08228195f, -0.07234028f, 0.04640540f, -0.01308254f, - -0.02506191f, 0.03100746f, -0.04665651f, -0.04591486f, 0.02949927f, - 0.06035462f, 0.02244646f, -0.01698639f, 0.01040041f, 0.01131170f, - 0.05419579f, -0.02130277f, -0.04321722f, -0.03665198f, 0.01126490f, - -0.02606488f, -0.02228328f, -0.02255680f, -0.03427236f, - -7.75165204e-003f, -0.06195229f, 8.21638294e-003f, 0.09535975f, - -0.03709979f, -0.06942501f, 0.14579427f, -0.05448192f, -0.02055904f, - 0.05747357f, 0.02781788f, -0.07077577f, -0.05178314f, -0.10429011f, - -0.11235505f, 0.07529039f, -0.07559302f, -0.08786739f, 0.02983843f, - 0.02667585f, 0.01382199f, -0.01797496f, -0.03141199f, -0.02098101f, - 0.09029204f, 0.04955018f, 0.13718739f, 0.11379953f, 1.80019124e-003f, - -0.04577610f, -1.11108483e-003f, -0.09470536f, -0.11596080f, - 0.04489342f, 0.01784211f, 3.06850672e-003f, 0.10781866f, - 3.36498418e-003f, -0.10842580f, -0.07436839f, -0.10535070f, - -0.01866805f, 0.16057891f, -5.07316366e-003f, -0.04295658f, - -5.90488780e-003f, 8.82003549e-003f, -0.01492646f, -0.05029279f, - -0.12875880f, 8.78831954e-004f, -0.01297184f, -0.07592774f, - -0.02668831f, -6.93787413e-004f, 0.02406698f, -0.01773298f, - -0.03855745f, -0.05877856f, 0.03259695f, 0.12826584f, 0.06292590f, - -4.10733931e-003f, 0.10996531f, 0.01332991f, 0.02088735f, 0.04037504f, - -0.05210760f, 0.07760046f, 0.06399347f, -0.05751930f, -0.10053057f, - 0.07505023f, -0.02139782f, 0.01796176f, 2.34400877e-003f, -0.04208319f, - 0.07355055f, 0.05093350f, -0.02996780f, -0.02219072f, 0.03355330f, - 0.04418742f, -0.05580705f, -0.05037573f, -0.04548179f, 0.01379514f, - 0.02150671f, -0.02194211f, -0.13682702f, 0.05464972f, 0.01608082f, - 0.05309116f, 0.04701022f, 1.33690401e-003f, 0.07575664f, 0.09625306f, - 8.92647635e-003f, -0.02819123f, 0.10866830f, -0.03439325f, - -0.07092371f, -0.06004780f, -0.02712298f, -7.07467366e-003f, - -0.01637020f, 0.01336790f, -0.10313606f, 0.04906582f, -0.05732445f, - -0.02731079f, 0.01042235f, -0.08340668f, 0.03686501f, 0.06108340f, - 0.01322748f, -0.07809529f, 0.03774724f, -0.03413248f, -0.06096525f, - -0.04212124f, -0.07982176f, -1.25973229e-003f, -0.03045501f, - -0.01236493f, -0.06312395f, 0.04789570f, -0.04602066f, 0.08576570f, - 0.02521080f, 0.02988098f, 0.10314583f, 0.07060035f, 0.04520544f, - -0.04426654f, 0.13146530f, 0.08386490f, 0.02164590f, -2.12280243e-003f, - -0.03686353f, -0.02074944f, -0.03829959f, -0.01530596f, 0.02689708f, - 0.11867401f, -0.06043470f, -0.02785023f, -0.04775074f, 0.04878745f, - 0.06350956f, 0.03494788f, 0.01467400f, 1.17890188e-003f, 0.04379614f, - 2.03681854e-003f, -0.03958609f, -0.01072688f, 6.43705716e-003f, - 0.02996500f, -0.03418507f, -0.01960307f, -0.01219154f, - -4.37000440e-003f, -0.02549453f, 0.02646318f, -0.01632513f, - 6.46516960e-003f, -0.01929734f, 4.78711911e-003f, 0.04962371f, - 0.03809111f, 0.07265724f, 0.05758125f, -0.03741554f, 0.01648608f, - -8.45285598e-003f, 0.03996826f, -0.08185477f, 0.02638875f, - -0.04026615f, -0.02744674f, -0.04071517f, 1.05096330e-003f, - -0.04741232f, -0.06733172f, 8.70434940e-003f, -0.02192543f, - 1.35350740e-003f, -0.03056974f, -0.02975521f, -0.02887780f, - -0.01210713f, -0.04828526f, -0.09066251f, -0.09969629f, -0.03665164f, - -8.88111943e-004f, -0.06826669f, -0.01866150f, -0.03627640f, - -0.01408288f, 0.01874239f, -0.02075835f, 0.09145175f, -0.03547291f, - 0.05396780f, 0.04198981f, 0.01301925f, -0.03384354f, -0.12201976f, - 0.06830920f, -0.03715654f, 9.55848210e-003f, 5.05685573e-003f, - 0.05659294f, 3.90764466e-003f, 0.02808490f, -0.05518097f, -0.03711621f, - -0.02835565f, -0.04420464f, -0.01031947f, 0.01883466f, - -8.49525444e-003f, -0.09419250f, -0.01269387f, -0.02133371f, - -0.10190815f, -0.07844430f, 2.43644323e-003f, -4.09610150e-003f, - 0.01202551f, -0.06452291f, -0.10593818f, -0.02464746f, -0.02199699f, - -0.07401930f, 0.07285886f, 8.87513801e-004f, 9.97662079e-003f, - 8.46779719e-003f, 0.03730333f, -0.02905126f, 0.03573337f, -0.04393689f, - -0.12014472f, 0.03176554f, -2.76015815e-003f, 0.10824566f, 0.05090732f, - -3.30179278e-003f, -0.05123822f, 5.04784798e-003f, -0.05664124f, - -5.99415926e-003f, -0.05341901f, -0.01221393f, 0.01291318f, - 9.91760660e-003f, -7.56987557e-003f, -0.06193124f, -2.24549137e-003f, - 0.01987562f, -0.02018840f, -0.06975540f, -0.06601523f, -0.03349112f, - -0.08910118f, -0.03371435f, -0.07406893f, -0.02248047f, -0.06159951f, - 2.77751544e-003f, -0.05723337f, -0.04792468f, 0.07518548f, - 2.77279224e-003f, 0.04211938f, 0.03100502f, 0.05278448f, 0.03954679f, - -0.03006846f, -0.03851741f, -0.02792403f, -0.02875333f, 0.01531280f, - 0.02186953f, -0.01989829f, 2.50679464e-003f, -0.10258728f, - -0.04785743f, -0.02887216f, 3.85063468e-003f, 0.01112236f, - 8.29218887e-003f, -0.04822981f, -0.04503597f, -0.03713100f, - -0.06988008f, -0.11002295f, -2.69209221e-003f, 1.85383670e-003f, - -0.05921049f, -0.06105053f, -0.08458050f, -0.04527602f, - 8.90329306e-004f, -0.05875023f, -2.68602883e-003f, -0.01591195f, - 0.03631859f, 0.05493166f, 0.07300330f, 5.53333294e-003f, 0.06400407f, - 0.01847740f, -5.76280477e-003f, -0.03210877f, 4.25160583e-003f, - 0.01166520f, -1.44864211e-003f, 0.02253744f, -0.03367080f, 0.06983195f, - -4.22323542e-003f, -8.89401045e-003f, -0.07943393f, 0.05199728f, - 0.06065201f, 0.04133492f, 1.44032843e-003f, -0.09585235f, -0.03964731f, - 0.04232114f, 0.01750465f, -0.04487902f, -7.59733608e-003f, 0.02011171f, - 0.04673622f, 0.09011173f, -0.07869188f, -0.04682482f, -0.05080139f, - -3.99383716e-003f, -0.05346331f, 0.01085723f, -0.03599333f, - -0.07097908f, 0.03551549f, 0.02680387f, 0.03471529f, 0.01790393f, - 0.05471273f, 9.62048303e-003f, -0.03180215f, 0.05864431f, 0.02330614f, - 0.01633144f, -0.05616681f, -0.10245429f, -0.08302189f, 0.07291322f, - -0.01972590f, -0.02619633f, -0.02485327f, -0.04627592f, - 1.48853404e-003f, 0.05514185f, -0.01270860f, -0.01948900f, 0.06373586f, - 0.05002292f, -0.03009798f, 8.76216311e-003f, -0.02474238f, - -0.05504891f, 1.74034527e-003f, -0.03333667f, 0.01524987f, 0.11663762f, - -1.32344989e-003f, -0.06608453f, 0.05687166f, -6.89525274e-004f, - -0.04402352f, 0.09450210f, -0.04222684f, -0.05360983f, 0.01779531f, - 0.02561388f, -0.11075410f, -8.77790991e-003f, -0.01099504f, - -0.10380266f, 0.03103457f, -0.02105741f, -0.07371717f, 0.05146710f, - 0.10581432f, -0.08617968f, -0.02892107f, 0.01092199f, 0.14551543f, - -2.24320893e-003f, -0.05818033f, -0.07390742f, 0.05701261f, - 0.12937020f, -0.04986651f, 0.10182415f, 0.05028650f, 0.12515625f, - 0.09175041f, 0.06404983f, 0.01523394f, 0.09460562f, 0.06106631f, - -0.14266998f, -0.02926703f, 0.02762171f, 0.02164151f, - -9.58488265e-004f, -0.04231362f, -0.09866509f, 0.04322244f, - 0.05872034f, -0.04838847f, 0.06319253f, 0.02443798f, -0.03606876f, - 9.38737206e-003f, 0.04289991f, -0.01027411f, 0.08156885f, 0.08751175f, - -0.13191354f, 8.16054735e-003f, -0.01452161f, 0.02952677f, 0.03615945f, - -2.09128903e-003f, 0.02246693f, 0.09623287f, 0.09412123f, -0.02924758f, - -0.07815186f, -0.02203079f, -2.02566991e-003f, 0.01094733f, - -0.01442332f, 0.02838561f, 0.11882371f, 7.28798332e-003f, -0.10345965f, - 0.07561217f, -0.02049661f, 4.44177445e-003f, 0.01609347f, -0.04893158f, - -0.08758243f, -7.67420698e-003f, 0.08862378f, 0.06098121f, 0.06565887f, - 7.32981879e-003f, 0.03558407f, -0.03874352f, -0.02490055f, - -0.06771075f, 0.09939223f, -0.01066077f, 0.01382995f, -0.07289080f, - 7.47184316e-003f, 0.10621431f, -0.02878659f, 0.02383525f, -0.03274646f, - 0.02137008f, 0.03837290f, 0.02450992f, -0.04296818f, -0.02895143f, - 0.05327370f, 0.01499020f, 0.04998732f, 0.12938657f, 0.09391870f, - 0.04292390f, -0.03359194f, -0.06809492f, 0.01125796f, 0.17290455f, - -0.03430733f, -0.06255233f, -0.01813114f, 0.11726857f, -0.06127599f, - -0.08677909f, -0.03429872f, 0.04684938f, 0.08161420f, 0.03538774f, - 0.01833884f, 0.11321855f, 0.03261845f, -0.04826299f, 0.01752407f, - -0.01796414f, -0.10464549f, -3.30041884e-003f, 2.29343961e-004f, - 0.01457292f, -0.02132982f, -0.02602923f, -9.87351313e-003f, - 0.04273872f, -0.02103316f, -0.07994065f, 0.02614958f, -0.02111666f, - -0.06964913f, -0.13453490f, -0.06861878f, -6.09341264e-003f, - 0.08251446f, 0.15612499f, 2.46531400e-003f, 8.88424646e-003f, - -0.04152999f, 0.02054853f, 0.05277953f, -0.03087788f, 0.02817579f, - 0.13939077f, 0.07641046f, -0.03627627f, -0.03015098f, -0.04041540f, - -0.01360690f, -0.06227205f, -0.02738223f, 0.13577610f, 0.15235767f, - -0.05392922f, -0.11175954f, 0.02157129f, 0.01146481f, -0.05264937f, - -0.06595174f, -0.02749175f, 0.11812254f, 0.17404149f, -0.06137035f, - -0.11003478f, -0.01351621f, -0.01745916f, -0.08577441f, -0.04469909f, - -0.06106115f, 0.10559758f, 0.20806813f, -0.09174948f, 7.09621934e-004f, - 0.03579374f, 0.07215115f, 0.02221742f, 0.01827742f, -7.90785067e-003f, - 0.01489554f, 0.14519960f, -0.06425831f, 0.02990399f, -1.80181325e-003f, - -0.01401528f, -0.04171134f, -3.70530109e-003f, -0.09090481f, - 0.09520713f, 0.08845516f, -0.02651753f, -0.03016730f, 0.02562448f, - 0.03563816f, -0.03817881f, 0.01433385f, 0.02256983f, 0.02872120f, - 0.01001934f, -0.06332260f, 0.04338406f, 0.07001807f, -0.04705722f, - -0.07318907f, 0.02630457f, 0.03106382f, 0.06648342f, 0.10913180f, - -0.01630815f, 0.02910308f, 0.02895109f, 0.08040254f, 0.06969310f, - 0.06797734f, 6.08639978e-003f, 4.16588830e-003f, 0.08926726f, - -0.03123648f, 0.02700146f, 0.01168734f, -0.01631594f, 4.61015804e-003f, - 8.51359498e-003f, -0.03544224f, 0.03571994f, 4.29766066e-003f, - -0.01970077f, -8.79793242e-003f, 0.09607988f, 0.01544222f, - -0.03923707f, 0.07308586f, 0.06061262f, 1.31683104e-004f, - -7.98222050e-003f, 0.02399261f, -0.06084389f, -0.02743429f, - -0.05475523f, -0.04131311f, 0.03559756f, 0.03055342f, 0.02981433f, - 0.14860515f, 0.01766787f, 0.02945257f, 0.04898238f, 0.01026922f, - 0.02811658f, 0.08267091f, 0.02732154f, -0.01237693f, 0.11760156f, - 0.03802063f, -0.03309754f, 5.24957618e-003f, -0.02460510f, 0.02691451f, - 0.05399988f, -0.10133506f, 0.06385437f, -0.01818005f, 0.02259503f, - 0.03573135f, 0.01042848f, -0.04153402f, -0.04043029f, 0.01643575f, - 0.08326677f, 4.61383024e-004f, -0.05308095f, -0.08536223f, - -1.61011645e-003f, -0.02163720f, -0.01783352f, 0.03859637f, - 0.08498885f, -0.01725216f, 0.08625131f, 0.10995087f, 0.09177644f, - 0.08498347f, 0.07646490f, 0.05580502f, 0.02693516f, 0.09996913f, - 0.09070327f, 0.06667200f, 0.05873008f, -0.02247842f, 0.07772321f, - 0.12408436f, 0.12629253f, -8.41997913e-004f, 0.01477783f, 0.09165990f, - -2.98401713e-003f, -0.06466447f, -0.07057302f, 2.09516948e-004f, - 0.02210209f, -0.02158809f, -0.08602506f, -0.02284836f, - 4.01876355e-003f, 9.56660323e-003f, -0.02073978f, -0.04635138f, - -7.59423291e-003f, -0.01377393f, -0.04559359f, -0.13284740f, - -0.08671406f, -0.03654395f, 0.01142869f, 0.03287891f, -0.04392983f, - 0.06142959f, 0.17710890f, 0.10385257f, 0.01329137f, 0.10067633f, - 0.12450829f, -0.04476709f, 0.09049144f, 0.04589312f, 0.11167907f, - 0.08587538f, 0.04767583f, 1.67188141e-003f, 0.02359802f, -0.03808852f, - 0.03126272f, -0.01919029f, -0.05698918f, -0.02365112f, -0.06519032f, - -0.05599358f, -0.07097308f, -0.03301812f, -0.04719102f, -0.02566297f, - 0.01324074f, -0.09230672f, -0.05518232f, -0.04712864f, -0.03380903f, - -0.06719479f, 0.01183908f, -0.09326738f, 0.01642865f, 0.03789867f, - -6.61567831e-003f, 0.07796386f, 0.07246574f, 0.04706347f, -0.02523437f, - -0.01696830f, -0.08068866f, 0.06030888f, 0.10527060f, -0.06611756f, - 0.02977346f, 0.02621830f, 0.01913855f, -0.08479366f, -0.06322418f, - -0.13570616f, -0.07644490f, 9.31900274e-003f, -0.08095149f, - -0.10197903f, -0.05204025f, 0.01413151f, -0.07800411f, -0.01885122f, - -0.07509381f, -0.10136326f, -0.05212355f, -0.09944065f, - -1.33606605e-003f, -0.06342617f, -0.04178550f, -0.12373723f, - -0.02832736f, -0.06057501f, 0.05830070f, 0.07604282f, -0.06462587f, - 8.02447461e-003f, 0.11580125f, 0.12332212f, 0.01978462f, - -2.72378162e-003f, 0.05850752f, -0.04674481f, 0.05148062f, - -2.62542837e-003f, 0.11253355f, 0.09893716f, 0.09785093f, -0.04659257f, - -0.01102429f, -0.07002308f, 0.03088913f, -0.02565549f, -0.07671449f, - 3.17443861e-003f, -0.10783514f, -0.02314270f, -0.11089555f, - -0.01024768f, 0.03116021f, -0.04964825f, 0.02281825f, 5.50005678e-003f, - -0.08427856f, -0.14685495f, -0.07719755f, -0.13342668f, -0.04525511f, - -0.09914210f, 0.02588859f, 0.03469279f, 0.04664020f, 0.11688190f, - 0.09647275f, 0.10857815f, -0.01448726f, 0.04299758f, -0.06763151f, - 1.33257592e-003f, 0.14331576f, 0.07574340f, 0.09166205f, 0.05674926f, - 0.11325553f, -0.01106494f, 0.02062161f, -0.11484840f, -0.07492137f, - -0.02864293f, -0.01275638f, -0.06946032f, -0.10101652f, -0.04113498f, - -0.02214783f, -0.01273942f, -0.07480393f, -0.10556041f, -0.07622112f, - -0.09988393f, -0.11453961f, -0.12073903f, -0.09412795f, -0.07146588f, - -0.04054537f, -0.06127083f, 0.04221122f, 0.07688113f, 0.04099256f, - 0.12663734f, 0.14683802f, 0.21761774f, 0.12525328f, 0.18431792f, - -1.66402373e-003f, 2.37777247e-003f, 0.01445475f, 0.03509416f, - 0.02654697f, 0.01716739f, 0.05374011f, 0.02944174f, 0.11323927f, - -0.01485456f, -0.01611330f, -1.85554172e-003f, -0.01708549f, - -0.05435753f, -0.05302101f, 0.05260378f, -0.03582945f, - -3.42867890e-004f, 1.36076682e-003f, -0.04436073f, -0.04228432f, - 0.03281291f, -0.05480836f, -0.10197772f, -0.07206279f, -0.10741059f, - -0.02366946f, 0.10278475f, -2.74783419e-003f, -0.03242477f, - 0.02308955f, 0.02835869f, 0.10348799f, 0.19580358f, 0.10252027f, - 0.08039929f, 0.05525554f, -0.13250865f, -0.14395352f, 3.13586881e-003f, - -0.03387071f, 8.94669443e-003f, 0.05406157f, -4.97324532e-003f, - -0.01189114f, 2.82919413e-004f, -0.03901557f, -0.04898705f, - 0.02164520f, -0.01382906f, -0.01850416f, 0.01869347f, -0.02450060f, - 0.02291678f, 0.08196463f, 0.03309153f, -0.10629974f, 0.02473924f, - 0.05344394f, -0.02404823f, -0.03243643f, -5.55244600e-003f, - -0.08009996f, 0.02811539f, 0.04235742f, 0.01859004f, 0.04902123f, - -0.01438252f, -0.01526853f, 0.02044195f, -0.05008660f, 0.04244113f, - 0.07611816f, 0.04950470f, -0.06020549f, -4.26026015e-003f, 0.13133512f, - -0.01438738f, -0.01958807f, -0.04044152f, -0.12425045f, - 2.84353318e-003f, -0.05042776f, -0.09121484f, 7.34345755e-003f, - 0.09388847f, 0.11800314f, 4.72295098e-003f, 4.44378285e-003f, - -0.07984917f, -0.03613737f, 0.04490915f, -0.02246483f, 0.04681071f, - 0.05240871f, 0.02157206f, -0.04603431f, -0.01197929f, -0.02748779f, - 0.13621049f, 0.08812155f, -0.07802048f, 4.86458559e-003f, -0.01598836f, - 0.01024450f, -0.03463517f, -0.02304239f, -0.08692665f, 0.06655128f, - 0.05785803f, -0.12640759f, 0.02307472f, 0.07337402f, 0.07525434f, - 0.04943763f, -0.02241034f, -0.09978238f, 0.14487994f, -0.06570521f, - -0.07855482f, 0.02830222f, -5.29603509e-004f, -0.04669895f, - -0.11822784f, -0.12246452f, -0.15365660f, -0.02969127f, 0.08078201f, - 0.13512598f, 0.11505685f, 0.04740673f, 0.01376022f, -0.05852978f, - -0.01537809f, -0.05541119f, 0.02491065f, -0.02870786f, 0.02760978f, - 0.23836176f, 0.22347429f, 0.10306466f, -0.06919070f, -0.10132039f, - -0.20198342f, -0.05040560f, 0.27163076f, 0.36987007f, 0.34540465f, - 0.29095781f, 0.05649706f, 0.04125737f, 0.07505883f, -0.02737836f, - -8.43431335e-003f, 0.07368195f, 0.01653876f, -0.09402955f, - -0.09574359f, 0.01474337f, -0.07128561f, -0.03460737f, 0.11438941f, - 0.13752601f, -0.06385452f, -0.06310338f, 8.19548313e-003f, 0.11622470f, - 5.05133113e-003f, -0.07602754f, 0.06695660f, 0.25723928f, 0.09037900f, - 0.28826267f, 0.13165380f, -0.05312614f, -0.02137198f, -0.03442232f, - -0.06255679f, 0.03899667f, 0.18391028f, 0.26016650f, 0.03374462f, - 0.01860465f, 0.19077586f, 0.18160543f, 3.43634398e-003f, -0.03036782f, - 0.19683038f, 0.35378191f, 0.24968483f, -0.03222649f, 0.28972381f, - 0.43091634f, 0.30778357f, 0.02335266f, -0.09877399f, -6.85245218e-003f, - 0.08945240f, -0.08150686f, 0.02792493f, 0.24806842f, 0.17338486f, - 0.06231801f, -0.10432383f, -0.16653322f, -0.13197899f, -0.08531576f, - -0.19271527f, -0.13536365f, 0.22240199f, 0.39219588f, 0.26597717f, - -0.01231649f, 0.01016179f, 0.13379875f, 0.12018334f, -0.04852953f, - -0.07915270f, 0.07036012f, 3.87723115e-003f, -0.06126805f, - -0.15015170f, -0.11406515f, -0.08556531f, -0.07429333f, -0.16115491f, - 0.13214062f, 0.25691369f, 0.05697750f, 0.06861912f, -6.02903729e-003f, - -7.94562511e-003f, 0.04799571f, 0.06695165f, -0.01926842f, 0.06206308f, - 0.13450983f, -0.06381495f, -2.98370165e-003f, -0.03482971f, - 7.53991678e-003f, 0.03895611f, 0.11464261f, 0.01669971f, - 8.27818643e-003f, -7.49160210e-003f, -0.11712562f, -0.10650621f, - -0.10353880f, -0.04994106f, -7.65618810e-004f, 0.03023767f, - -0.04759270f, -0.07302686f, -0.05825012f, -0.13156348f, -0.10639747f, - -0.19393684f, -0.09973683f, -0.07918908f, 4.63177625e-004f, - -6.61382044e-004f, 0.15853868f, 0.08561199f, -0.07660093f, - -0.08015265f, -0.06164073f, 0.01882577f, -7.29908410e-004f, - 0.06840892f, 0.03843764f, 0.20274927f, 0.22028814f, -5.26101235e-003f, - 0.01452435f, -0.06331623f, 0.02865064f, 0.05673740f, 0.12171564f, - 0.03837196f, 0.03555467f, -0.02662914f, -0.10280123f, -0.06526285f, - -0.11066351f, -0.08988424f, -0.10103678f, 8.10526591e-003f, - 5.95238712e-003f, 0.02617721f, -0.01705742f, -0.10897956f, - -0.08004991f, -0.11271993f, -0.06185647f, -0.06103712f, 0.01597041f, - -0.05923606f, 0.09410726f, 0.22858568f, 0.03263380f, 0.06772990f, - -0.09003516f, 0.01017870f, 0.01931688f, 0.08628357f, -0.01430009f, - 0.10954945f, 0.16612452f, -0.02434544f, -0.03310068f, -0.04236627f, - 0.01212392f, -6.15046406e-003f, 0.06954194f, 0.03015283f, 0.01787957f, - 0.02781667f, -0.05561153f, -8.96244217e-003f, -0.04971489f, - 0.07510284f, 0.01775282f, 0.05889897f, -0.07981427f, 0.03647643f, - -3.73833324e-003f, -0.08894575f, -0.06429435f, -0.08068276f, - 0.03567704f, -0.07131936f, -7.21910037e-003f, -0.09566668f, - 0.17886090f, 0.14911725f, 0.02070032f, -0.05017120f, -0.04992622f, - 0.01570143f, -0.09906903f, 0.06456193f, 0.15329507f, 0.18820767f, - 0.11689861f, -0.01178513f, -0.02225163f, -0.01905318f, 0.10271224f, - -7.27029052e-003f, 0.11664233f, 0.14796902f, 0.07771893f, 0.02400013f, - -0.05361797f, -0.01972888f, 0.01376177f, 0.06740040f, -0.06525395f, - 0.05726178f, -0.02404981f, -0.14018567f, -0.02074987f, -0.04621970f, - -0.04688627f, -0.01842059f, 0.07722727f, -0.04852883f, 0.01529004f, - -0.19639495f, 0.10817073f, 0.03795860f, -0.09435206f, -0.07984378f, - -0.03383440f, 0.11081333f, 0.02237366f, 0.12703256f, 0.21613893f, - 0.02918790f, 4.66472283e-003f, -0.10274266f, -0.04854131f, - -3.46305710e-003f, 0.08652268f, 0.02251546f, 0.09636052f, 0.17180754f, - -0.09272388f, 4.59174305e-004f, -0.11723048f, -0.12210111f, - -0.15547538f, 0.07218186f, -0.05297846f, 0.03779940f, 0.05150875f, - -0.03802310f, 0.03870645f, -0.15250699f, -0.08696499f, -0.02021560f, - 0.04118926f, -0.15177974f, 0.01577647f, 0.10249301f, 7.50041893e-003f, - 0.01721806f, -0.06828983f, -0.02397596f, -0.06598977f, -0.04317593f, - -0.08064980f, 6.66632550e-003f, 0.03333484f, 0.07093620f, 0.08231064f, - -0.06577903f, -0.06698844f, -0.06984019f, -0.06508023f, -0.14145090f, - -0.02393239f, 0.06485303f, 8.83263443e-003f, 0.09251080f, -0.07557579f, - -0.05067699f, -0.09798748f, -0.06703258f, -0.14056294f, 0.03245994f, - 0.12554143f, 0.01761621f, 0.12980327f, -0.04081950f, -0.11906909f, - -0.14813015f, -0.08376863f, -0.12200681f, 0.04988137f, 0.05424247f, - -3.90952639e-003f, 0.03255733f, -0.12717837f, -0.07461493f, - -0.05703964f, -0.01736189f, -0.08026433f, -0.05433894f, -0.01719359f, - 0.02886275f, 0.01772653f, -0.09163518f, 3.57789593e-003f, -0.10129993f, - -0.02653764f, -0.08131415f, -0.03847986f, -7.62157550e-004f, - 0.06486648f, 0.19675669f, -0.04919156f, -0.07059129f, -0.04857785f, - -0.01042383f, -0.08328653f, 0.03660302f, -0.03696846f, 0.04969259f, - 0.08241162f, -0.12514858f, -0.06122676f, -0.03750202f, - 6.52989605e-003f, -0.10247213f, 0.02568346f, 4.51781414e-003f, - -0.03734229f, -0.01131264f, -0.05412074f, 8.89345480e-004f, - -0.12388977f, -0.05959237f, -0.12418608f, -0.06151643f, -0.07310260f, - 0.02441575f, 0.07023528f, -0.07548289f, -7.57147965e-004f, - -0.09061348f, -0.08112976f, -0.06920306f, 9.54394229e-003f, - -0.01219902f, 1.21273217e-003f, -8.88989680e-003f, -0.08309301f, - -0.04552661f, -0.10739882f, -0.05691034f, -0.13928030f, 0.09027749f, - 0.15123098f, 0.03175976f, 0.17763577f, 3.29913251e-004f, 0.05151888f, - -0.09844074f, -0.09475287f, -0.08571247f, 0.16241577f, 0.19336018f, - 8.57454538e-003f, 0.11474732f, -0.01493934f, 0.03352379f, -0.08966240f, - -0.02322310f, 0.02663568f, 0.05448750f, -0.03536883f, -0.07210463f, - -0.06807277f, -0.03121621f, -0.05932408f, -0.17282860f, -0.15873498f, - -0.04956378f, 0.01603377f, -0.12385946f, 0.13878587f, 0.21468069f, - 0.13510075f, 0.20992437f, 0.08845878f, 0.08104013f, 0.03754176f, - 0.12173114f, 0.11103114f, 0.10643122f, 0.13941477f, 0.11640384f, - 0.14786847f, 0.01218238f, 0.01160753f, 0.03547940f, 0.08794311f, - -0.01695384f, -0.07692261f, -0.08236158f, 6.79194089e-003f, - -0.02458403f, 0.13022894f, 0.10953187f, 0.09857773f, 0.04735930f, - -0.04353498f, -0.15173385f, -0.17904443f, -0.10450364f, -0.13418166f, - -0.06633098f, -0.03170381f, -0.06839000f, -0.11350126f, -0.06983913f, - 0.19083543f, 0.17604128f, 0.07730632f, 0.10022651f, 0.36428109f, - 0.28291923f, 0.12688625f, 0.15942036f, 0.14064661f, -0.11201853f, - -0.13969108f, -0.09088077f, -0.14107047f, 0.05117374f, - -2.63348082e-003f, -0.10794610f, -0.09715455f, -0.05284977f, - 0.01565668f, 0.05031200f, 0.07021113f, -0.02963028f, 0.01766960f, - 0.08333644f, -0.03211382f, 4.90096770e-003f, 0.05186674f, -0.05045737f, - -0.09624767f, -0.02525997f, 0.06916669f, 0.01213916f, 0.05333899f, - -0.03443280f, -0.10055527f, -0.06291115f, 5.42851724e-003f, - -6.30360236e-003f, 0.02270257f, -0.01769792f, 0.03273688f, 0.07746078f, - 7.77099328e-003f, 0.05041346f, 0.01648103f, -0.02321534f, -0.09930186f, - -0.02293853f, 0.02034990f, -0.08324204f, 0.08510064f, -0.03732836f, - -0.06465405f, -0.06086946f, 0.13680504f, -0.11469388f, -0.03896406f, - -0.07142810f, 2.67581246e-003f, -0.03639632f, -0.09849060f, - -0.11014334f, 0.17489147f, 0.17610909f, -0.16091567f, -0.07248894f, - 0.01567141f, 0.23742996f, 0.07552249f, -0.06270349f, -0.07303379f, - 0.25442186f, 0.16903116f, -0.08168741f, -0.05913896f, -0.03954096f, - 6.81776879e-003f, -0.05615319f, -0.07303037f, -0.12176382f, - 0.12385108f, 0.22084464f, -0.05543206f, -0.03310431f, 0.05731593f, - 0.19481890f, 0.04016430f, -0.06480758f, -0.12353460f, 0.18733442f, - -0.09631214f, -0.11192076f, 0.12404587f, 0.15671748f, 0.19256128f, - 0.10895617f, 0.03391477f, -0.13032004f, -0.05626907f, -0.09025607f, - 0.23485197f, 0.27812332f, 0.26725492f, 0.07255980f, 0.16565137f, - 0.22388470f, 0.07441066f, -0.21003133f, -0.08075339f, -0.15031935f, - 0.07023834f, 0.10872041f, 0.18156518f, 0.20037253f, 0.13571967f, - -0.11915682f, -0.11131983f, -0.18878011f, 0.06074620f, 0.20578890f, - 0.12413109f, 0.03930207f, 0.29176015f, 0.29502738f, 0.27856228f, - -0.01803601f, 0.16646385f, 0.19268319f, 0.01900682f, 0.06026287f, - 2.35868432e-003f, 0.01558199f, 0.02707230f, 0.11383014f, 0.12103992f, - 0.03907350f, 0.04637353f, 0.09020995f, 0.11919726f, -3.63007211e-003f, - 0.02220155f, 0.10336831f, 0.17351882f, 0.12259731f, 0.18983354f, - 0.15736865f, 0.01160725f, -0.01690723f, -9.69582412e-004f, 0.07213813f, - 0.01161613f, 0.17864859f, 0.24486147f, 0.18208991f, 0.20177495f, - 0.05972528f, -8.93934630e-003f, -0.02316955f, 0.14436610f, 0.14114498f, - 0.05520950f, 0.06353590f, -0.19124921f, 0.10174713f, 0.29414919f, - 0.26448128f, 0.09344960f, 0.15284036f, 0.19797507f, 0.11369792f, - -0.12722753f, -0.21396367f, -0.02008235f, -0.06566695f, -0.01662150f, - -0.03937003f, 0.04778343f, 0.05017274f, -0.02299062f, -0.20208496f, - -0.06395898f, 0.13721776f, 0.22544557f, 0.14888357f, 0.08687132f, - 0.27088094f, 0.32206613f, 0.09782200f, -0.18523243f, -0.17232181f, - -0.01041531f, 0.04008654f, 0.04199702f, -0.08081299f, -0.03755421f, - -0.04809646f, -0.05222081f, -0.21709201f, -0.06622940f, 0.02945281f, - -0.04600435f, -0.05256077f, -0.08432942f, 0.02848100f, 0.03490564f, - 8.28621630e-003f, -0.11051246f, -0.11210597f, -0.01998289f, - -0.05369405f, -0.08869293f, -0.18799506f, -0.05436598f, -0.05011634f, - -0.05419716f, -0.06151857f, -0.10827805f, 0.04346735f, 0.04016083f, - 0.01520820f, -0.12173316f, -0.04880285f, -0.01101406f, 0.03250847f, - -0.06009551f, -0.03082932f, -0.02295134f, -0.06856834f, -0.08775249f, - -0.23793389f, -0.09174541f, -0.05538322f, -0.04321031f, -0.11874759f, - -0.04221844f, -0.06070468f, 0.01194489f, 0.02608565f, -0.03892140f, - -0.01643151f, -0.02602034f, -0.01305472f, 0.03920100f, -0.06514261f, - 0.01126918f, -6.27710763e-003f, -0.02720047f, -0.11133634f, - 0.03300330f, 0.02398472f, 0.04079665f, -0.10564448f, 0.05966159f, - 0.01195221f, -0.03179441f, -0.01692590f, -0.06177841f, 0.01841576f, - -5.51078189e-003f, -0.06821765f, -0.03191888f, -0.09545476f, - 0.03030550f, -0.04896152f, -0.02914624f, -0.13283344f, -0.04783419f, - 6.07836898e-003f, -0.01449538f, -0.13358212f, -0.09687774f, - -0.02813793f, 0.01213498f, 0.06650011f, -0.02039067f, 0.13356198f, - 0.05986415f, -9.12760664e-003f, -0.18780160f, -0.11992817f, - -0.06342237f, 0.01229534f, 0.07143231f, 0.10713009f, 0.11085765f, - 0.06569190f, -0.02956399f, -0.16288325f, -0.13993549f, -0.01292515f, - 0.03833013f, 0.09130384f, -0.05086257f, 0.05617329f, -0.03896667f, - -0.06282311f, -0.11490010f, -0.14264110f, -0.04530499f, 0.01598189f, - 0.09167797f, 0.08663294f, 0.04885277f, -0.05741219f, -0.07565769f, - -0.17136464f, -0.02619422f, -0.02477579f, 0.02679587f, 0.11621952f, - 0.08788391f, 0.15520640f, 0.04709549f, 0.04504483f, -0.10214074f, - -0.12293372f, -0.04820546f, -0.05484834f, 0.05473754f, 0.07346445f, - 0.05577277f, -0.08209965f, 0.03462975f, -0.20962234f, -0.09324598f, - 3.79481679e-003f, 0.03617633f, 0.16742408f, 0.07058107f, 0.10204960f, - -0.06795346f, 3.22807301e-003f, -0.12589309f, -0.17496960f, - 0.02078314f, -0.07694324f, 0.12184640f, 0.08997164f, 0.04793497f, - -0.11383379f, -0.08046359f, -0.25716835f, -0.08080962f, - 6.80711539e-003f, -0.02930280f, -3.04938294e-003f, -0.11106286f, - -0.04628860f, -0.07821649f, 7.70127494e-003f, -0.10247706f, - 1.21042714e-003f, 0.20573859f, -0.03241005f, 8.42972286e-003f, - 0.01946464f, -0.01197973f, -0.14579976f, 0.04233614f, - -4.14096704e-003f, -0.06866436f, -0.02431862f, -0.13529138f, - 1.25891645e-003f, -0.11425111f, -0.04303651f, -0.01694815f, - 0.05720210f, -0.16040207f, 0.02772896f, 0.05498345f, -0.15010567f, - 0.01450866f, 0.02350303f, -0.04301004f, -0.04951802f, 0.21702233f, - -0.03159155f, -0.01963303f, 0.18232647f, -0.03263875f, - -2.88476888e-003f, 0.01587562f, -1.94303901e-003f, -0.07789494f, - 0.04674156f, -6.25576358e-003f, 0.08925962f, 0.21353747f, 0.01254677f, - -0.06999976f, -0.05931328f, -0.01884327f, -0.04306272f, 0.11794136f, - 0.03842728f, -0.03907030f, 0.05636114f, -0.09766009f, -0.02104000f, - 8.72711372e-003f, -0.02736877f, -0.05112274f, 0.16996814f, 0.02955785f, - 0.02094014f, 0.08414304f, -0.03335762f, -0.03617457f, -0.05808248f, - -0.08872101f, 0.02927705f, 0.27077839f, 0.06075108f, 0.07478261f, - 0.15282831f, -0.03908454f, -0.05101782f, -9.51998029e-003f, - -0.03272416f, -0.08735625f, 0.07633440f, -0.07185312f, 0.13841286f, - 0.07812646f, -0.12901451f, -0.05488589f, -0.05644578f, -0.03290703f, - -0.11184757f, 0.03751570f, -0.05978153f, -0.09155276f, 0.05657315f, - -0.04328186f, -0.03047933f, -0.01413135f, -0.10181040f, -0.01384013f, - 0.20132534f, -0.01536873f, -0.07641169f, 0.05906778f, -0.07833145f, - -0.01523801f, -0.07502609f, -0.09461885f, -0.15013233f, 0.16050665f, - 0.09021381f, 0.08473236f, 0.03386267f, -0.09147339f, -0.09170618f, - -0.08498498f, -0.05119187f, -0.10431040f, 0.01041618f, -0.03064913f, - 0.09340212f, 0.06448522f, -0.03881054f, -0.04985436f, -0.14794017f, - -0.05200112f, -0.02144495f, 0.04000821f, 0.12420804f, -0.01851651f, - -0.04116732f, -0.11951703f, -0.04879033f, -0.08722515f, -0.08454733f, - -0.10549165f, 0.11251976f, 0.10766345f, 0.19201984f, 0.06128913f, - -0.02734615f, -0.08834923f, -0.16999826f, -0.03548348f, - -5.36092324e-003f, 0.08297954f, 0.07226378f, 0.04194529f, 0.04668673f, - 8.73902347e-003f, 0.06980139f, 0.05652480f, 0.05879445f, 0.02477076f, - 0.02451423f, 0.12433673f, 0.05600227f, 0.06886370f, 0.03863076f, - 0.07459056f, 0.02264139f, 0.01495469f, 0.06344220f, 0.06945208f, - 0.02931899f, 0.11719371f, 0.04527427f, 0.03248192f, 2.08271481e-003f, - 0.02044626f, 0.11403449f, 0.04303892f, 0.06444661f, 0.04959024f, - 0.08174094f, 0.09240247f, 0.04894639f, 0.02252937f, -0.01652530f, - 0.07587013f, 0.06064249f, 0.13954395f, 0.02772832f, 0.07093039f, - 0.08501238f, 0.01701301f, 0.09055722f, 0.33421436f, 0.20163782f, - 0.09821030f, 0.07951369f, 0.08695120f, -0.12757730f, -0.13865978f, - -0.06610068f, -0.10985506f, 0.03406816f, -0.01116336f, -0.07281768f, - -0.13525715f, -0.12844718f, 0.08956250f, 0.09171610f, 0.10092317f, - 0.23385370f, 0.34489515f, 0.09901748f, 0.02002922f, 0.12335990f, - 0.07606190f, -0.14899330f, -0.15634622f, -0.06494618f, -0.01760547f, - 0.03404277f, -0.13208845f, -0.12101169f, -0.18294574f, -0.16560709f, - 0.02183887f, -0.02752613f, 0.01813638f, 0.02000757f, 0.01319924f, - 0.08030242f, 0.01220535f, 2.98233377e-003f, -0.01307070f, 0.05970297f, - -0.05345284f, -0.03381982f, -9.87543724e-003f, -0.06869387f, - 0.03956730f, -0.03108176f, -0.05732809f, 0.02172386f, 0.04159765f, - 2.62783933e-003f, 0.04813229f, 0.09358983f, -8.18389002e-003f, - 0.01724574f, -0.02547474f, -0.04967288f, -0.02390376f, 0.06640504f, - -0.06306566f, 0.01137518f, 0.05589378f, -0.08237787f, 0.02455001f, - -0.03059422f, -0.08953978f, 0.06851497f, 0.07190268f, -0.07610799f, - 7.87237938e-003f, -7.85830803e-003f, 0.06006952f, -0.01126728f, - -2.85743061e-003f, -0.04772895f, 0.01884944f, 0.15005857f, - -0.06268821f, -0.01989072f, 0.01138399f, 0.08760451f, 0.03879007f, - -9.66926850e-003f, -0.08012961f, 0.06414555f, -0.01362950f, - -0.09135523f, 0.01755159f, 0.04459474f, 0.09650917f, 0.05219948f, - -2.19440833e-003f, -0.07037939f, -0.01599054f, 0.13103317f, - -0.02492603f, -0.01032540f, -0.02903307f, 0.04489160f, 0.05148086f, - 0.01858173f, -0.02919228f, 0.08299296f, -0.04590359f, -0.15745632f, - -0.09068198f, -0.02972453f, 0.12985018f, 0.22320485f, 0.24261914f, - 0.03642650f, -0.05506422f, 2.67413049e-003f, -0.03834032f, 0.06449424f, - 0.03834866f, 0.03816991f, 0.25039271f, 0.34212017f, 0.32433882f, - 0.18824573f, -0.08599839f, -0.17599408f, -0.15317015f, -0.09913155f, - -0.02856072f, -0.05304699f, -1.06437842e-003f, -0.06641813f, - -0.07509298f, 0.01463361f, -0.07551918f, -0.04510373f, - -8.44620075e-003f, 0.01772176f, 0.04068235f, 0.20295307f, 0.15719447f, - 0.05712103f, 0.26296997f, 0.14657754f, 0.01547317f, -0.05052776f, - -0.03881342f, -0.01437883f, -0.04930177f, 0.11719568f, 0.24098417f, - 0.26468599f, 0.31698579f, 0.10103608f, -0.01096375f, -0.01367013f, - 0.17104232f, 0.20065314f, 2.67622480e-003f, -0.01190034f, 0.18301608f, - 0.09459770f, -0.06357619f, -0.06473801f, 0.01377906f, -0.10032775f, - -0.06388740f, 3.80393048e-003f, 0.06206078f, 0.10349120f, 0.26804337f, - 8.17918684e-003f, -0.02314351f, 9.34422202e-003f, 0.09198381f, - 0.03681326f, -8.77339672e-003f, -0.09662418f, -0.02715708f, - 0.13503517f, 0.08962728f, -6.57071499e-003f, -0.03201199f, 0.28510824f, - 0.32095715f, 0.18512695f, -0.14230858f, -0.14048551f, -0.07181299f, - -0.08575408f, -0.08661680f, -0.17416079f, 7.54326640e-004f, - 0.05601677f, 0.13585392f, -0.04960437f, -0.07708392f, 0.10676333f, - -0.04407546f, -0.07209078f, 0.03663663f, 0.28949317f, 0.41127121f, - 0.27431169f, -0.06900328f, -0.21474190f, -0.15578632f, -0.19555484f, - -0.15209621f, -0.11269179f, 0.07416003f, 0.18991330f, 0.26858172f, - 0.01952259f, 0.01017922f, 0.02159843f, -4.95165400e-003f, -0.04368168f, - -0.12721671f, -0.06673957f, -0.11275250f, 0.04413409f, 0.05578312f, - 0.03896771f, 0.03566417f, -0.05871816f, -0.07388090f, -0.17965563f, - -0.08570268f, -0.15273231f, -0.06022318f, -0.06999847f, - -6.81510568e-003f, 0.06294262f, -6.54901436e-004f, -0.01128654f, - -0.02289657f, 0.04849290f, 0.04140804f, 0.23681939f, 0.14545733f, - 0.01989965f, 0.12032662f, 3.87463090e-003f, -6.02597650e-003f, - -0.05919775f, -0.03067224f, -0.07787777f, 0.10834727f, 0.02153730f, - 0.02765649f, 0.03975543f, -0.12182906f, -0.04900113f, -0.09940100f, - -0.06453611f, -0.13757215f, -0.03721382f, 0.02827376f, -0.04351249f, - 0.01907038f, -0.10284120f, -0.05671160f, -0.10760647f, -0.09624009f, - -0.09565596f, -0.01303654f, 0.03080539f, 0.01416511f, 0.05846142f, - -5.42971538e-003f, 0.06221476f, -0.03320325f, -0.06791797f, - -0.05791342f, 0.12851369f, 0.14990346f, 0.03634374f, 0.14262885f, - 0.04330391f, 0.05032569f, -0.05631914f, 0.01606137f, 0.04387223f, - 0.22344995f, 0.15722635f, -0.04693628f, 0.03006579f, -2.52882647e-003f, - 0.05717621f, -0.07529724f, -0.02848588f, -0.06868757f, - -4.51729307e-003f, 0.06466042f, -0.05935378f, -0.04704857f, - -0.07363959f, 0.04843248f, -0.13421375f, -0.09789340f, -0.10255270f, - 0.03509852f, 0.04751543f, -0.03822323f, 0.09740467f, 0.04762916f, - 0.03940146f, -0.08283259f, 0.09552965f, 0.05038739f, 0.21258622f, - 0.09646992f, 0.03241193f, 0.05167701f, 0.04614570f, 0.04330090f, - -0.02671840f, -0.06259909f, -0.02301898f, 0.18829170f, 0.10522786f, - 0.04313190f, 0.01670948f, -0.08421925f, 0.05911417f, -0.10582602f, - -0.04855484f, -0.08373898f, 0.07775915f, 0.03723533f, -0.12047344f, - 4.86345543e-003f, -0.10520902f, 0.06571782f, -0.07528137f, - -0.03245651f, -0.09869066f, -0.02917477f, -0.18293270f, 0.14810945f, - 9.24033765e-003f, -0.04354914f, 0.02266885f, -0.11872729f, - -0.04016589f, 0.02830229f, 0.22539048f, 0.20565644f, 0.16701797f, - 0.09019924f, 0.01300652f, 0.09760600f, -0.03675831f, -0.01935448f, - -0.06894835f, 0.08077277f, 0.19047537f, 0.11312226f, 0.04106043f, - -0.11187182f, 0.04312806f, -0.18548580f, -0.11287174f, -0.08794551f, - 0.02078281f, -0.15295486f, 0.11806386f, -0.01103218f, -0.15971117f, - 0.02153538f, -0.05232147f, -0.10835317f, -0.13910367f, 0.05920752f, - -0.10122602f, 0.20174250f, 0.09105796f, -0.01881348f, 0.09559010f, - -0.03725745f, -0.09442931f, -0.09763174f, 0.05854454f, 0.08287182f, - 0.12919849f, 0.08594352f, -2.49806582e-003f, 0.02398440f, - 5.67950122e-003f, -0.06296340f, -0.12993270f, 0.03855852f, 0.05186560f, - 0.10839908f, -0.03380463f, -0.12654832f, -0.05399339f, -0.07456800f, - -0.04736232f, -0.10164231f, 0.07496139f, 0.08125214f, 0.07656177f, - -0.04999603f, -0.12823077f, -0.07692395f, -0.11317524f, -0.09118655f, - -0.05695669f, 0.10477209f, 0.07468581f, 0.01630048f, -8.00961629e-003f, - -0.06582128f, -0.04019095f, -0.04682907f, -0.01907842f, -0.10997720f, - 0.04911406f, 0.02931030f, 0.04197735f, -0.05773980f, -0.09670641f, - -0.03594951f, -0.03402121f, -0.07149299f, -0.10566200f, 0.10601286f, - 0.06340689f, -0.01518632f, -5.96402306e-003f, -0.07628012f, - -3.52779147e-003f, -0.02683854f, -0.10265494f, -0.02680815f, - 0.16338381f, 0.03103515f, 0.02296976f, 0.01624348f, -0.10831620f, - -0.02314233f, -0.04789969f, -0.05530700f, -0.06461314f, 0.10494506f, - 0.04642856f, -0.07592955f, -0.06197905f, -0.09042154f, -0.01445521f, - -0.04297818f, -0.11262015f, -0.11430512f, 0.03174541f, -0.03677487f, - -0.02963996f, -0.06610169f, -0.13292049f, -0.07059067f, -0.08444111f, - -0.02640536f, -0.07136250f, 0.04559967f, 0.01459980f, 0.17989251f, - 0.04435328f, -0.12464730f, -0.02871115f, -0.10752209f, -0.03393742f, - -0.03791408f, 0.02548251f, 0.01956050f, 0.19245651f, 0.13963254f, - -0.05904696f, -0.07424626f, -0.10411884f, 1.54176133e-003f, - 0.01797429f, 0.13025844f, 0.04547642f, -0.05710349f, -0.10697161f, - -0.13489437f, -0.06515755f, -0.06406886f, -4.08572936e-003f, - -0.01336483f, 0.04368737f, -0.11259720f, -0.05701635f, -0.06469971f, - -0.08346602f, -0.04166770f, -0.05795543f, -0.08247511f, -0.05742628f, - 0.08452254f, -0.03350224f, 0.13980860f, 0.13252275f, 0.07589617f, - 0.07539988f, 0.12155797f, 0.19087289f, 0.15050751f, 0.21250245f, - 0.14206800f, 0.01298489f, 0.07450245f, 0.06559097f, 0.01700557f, - 0.04512971f, 0.16950700f, 0.10261577f, 0.16389982f, 0.05505059f, - -0.03453077f, 0.08622462f, 0.07935954f, 0.03976260f, 0.02036091f, - 3.95744899e-003f, 0.03267065f, 0.15235919f, 0.01297494f, -0.08109194f, - 0.01407558f, 4.40693414e-003f, -0.15157418f, -0.11390478f, - -0.07487597f, -7.81322457e-003f, -0.02749545f, -0.10181408f, - 0.13755716f, 0.14007211f, 0.13482562f, 0.27517235f, 0.34251109f, - 0.07639657f, 0.07268607f, 0.19823882f, 0.16135791f, -0.04186463f, - -0.12784107f, -0.09846287f, 0.03169041f, 0.10974082f, -0.15051922f, - -0.08916726f, -0.07138767f, -0.04153349f, 6.25418453e-003f, - 0.01266654f, 0.10533249f, 0.12749144f, 0.15148053f, 0.01498513f, - 0.06305949f, -0.01247123f, -0.08778401f, -0.08551880f, -0.11955146f, - -0.08493572f, -0.02901620f, -0.02394859f, -0.13427313f, -0.11053200f, - -0.14413260f, -0.15203285f, 0.03972760f, -3.72127310e-004f, - -0.04200919f, 0.06105104f, 0.01904975f, -0.01106191f, - -7.27445772e-003f, -0.01520341f, 1.10228511e-003f, -0.04949187f, - -0.08013099f, 5.72071038e-003f, 0.08415454f, -0.06523152f, 0.03664081f, - -0.02673042f, -0.12066154f, -0.03702074f, 0.06006580f, 0.01628682f, - -6.17772620e-003f, 0.08192339f, -3.41629819e-003f, 0.02870512f, - 0.05807141f, 0.04959986f, 0.04618251f, -0.04901629f, -0.10579574f, - 0.02274442f, 0.12070961f, 2.23597488e-003f, 0.09831765f, -0.03019848f, - -0.11181970f, -0.04961075f, 0.02498928f, -0.03714991f, -0.01619653f, - 0.02643486f, -7.62964319e-003f, -0.02882290f, -0.06242594f, - -0.08439861f, 0.07220893f, 0.07263952f, 0.01561574f, 0.03091968f, - 0.01708712f, -0.03797151f, -3.18561122e-003f, 0.01624021f, - -0.02828573f, 0.11284444f, -1.32280716e-003f, -0.07784860f, - -0.07209100f, 0.03372242f, 0.12154529f, 0.02278104f, -0.05275500f, - -0.01918484f, 0.12989293f, 0.05424401f, 0.02333086f, 0.04029022f, - 0.12392918f, 0.09495489f, 0.09190340f, 0.07935889f, 8.76816828e-003f, - 0.17148446f, -8.51302687e-003f, -0.08011249f, -0.06796283f, - 0.04884845f, 0.01112272f, -0.07835306f, -1.14811445e-003f, - -0.03440760f, 0.02845243f, 0.07695542f, -0.07069533f, -0.01151784f, - -8.53884313e-003f, -0.01662786f, -0.04163864f, 0.05400505f, - 0.02859163f, 0.02921852f, 0.05003135f, -6.85718050e-003f, -0.01632611f, - 0.07780217f, 0.04042810f, -0.01216440f, 3.60914599e-003f, -0.06322435f, - 0.09516726f, 0.12877031f, -9.69162490e-003f, 0.01031179f, 0.05180895f, - -9.34659224e-003f, -0.01644533f, -0.04849347f, -0.04343236f, - 0.10514783f, 0.08046635f, -0.04615205f, -0.03975486f, -0.01485525f, - 0.13096830f, -0.01517950f, -0.06571898f, -0.04016372f, 0.01849786f, - 0.02439670f, 0.08067258f, 1.74824719e-003f, 0.07053747f, 0.08819518f, - -5.08352555e-003f, -0.06550863f, -0.08266170f, -0.07780605f, - 0.01453450f, -0.08756890f, 0.01096501f, -8.71319138e-003f, 0.10110464f, - 0.02420769f, -0.06708383f, 0.02007811f, 5.93133038e-003f, 0.05398923f, - 0.07538138f, 0.02049227f, 0.02242589f, 0.04011070f, -1.44875818e-003f, - -4.19115182e-003f, 0.06367654f, 0.02506934f, 0.02434536f, 0.05879405f, - -8.22952855e-003f, -0.01242441f, 0.04224926f, -0.01754923f, - 0.05958161f, 0.03818886f, -0.01830363f, -0.04308917f, -0.04422197f, - -0.02432721f, 0.02264866f, 2.03751423e-003f, 0.01197031f, 0.04439203f, - 0.12169247f, 0.03602713f, -0.02599251f, -1.98226492e-003f, 0.02046336f, - -0.02639058f, -1.91242550e-003f, -0.09334669f, -0.03595153f, - -9.88179818e-003f, -0.06848445f, -0.04666303f, -0.09955736f, - -0.04206430f, 0.02609075f, 9.09005292e-003f, -0.07138551f, - -4.22313227e-004f, 0.01766645f, 0.02756404f, 0.01308276f, 0.04052891f, - 0.02387515f, 0.05337298f, 0.02500631f, -0.04970853f, -0.12467445f, - 0.17604403f, 0.12256411f, -0.07512254f, 8.70451052e-003f, -0.05697548f, - -0.03626474f, -8.76623299e-003f, -0.01210897f, -0.09451522f, - 0.07490732f, -0.02008001f, -0.02681278f, -0.06463405f, -0.01517507f, - 7.33757764e-003f, 6.07147906e-003f, -0.09316964f, -0.04575328f, - 0.13261597f, 0.15424870f, -0.01655918f, -0.02772390f, -0.05243644f, - -0.02356456f, -0.02351753f, -0.10211615f, -0.12873036f, 0.14549787f, - 0.12519856f, 4.38762689e-003f, 0.02795992f, 0.05170322f, 0.09223596f, - 0.05890015f, 0.02376701f, -0.02777346f, 0.09506908f, 0.02328936f, - -0.02319928f, -0.03218696f, -0.01527841f, -0.01016694f, -0.02674719f, - 0.05137179f, 0.01980666f, 0.06544447f, -0.01746171f, 0.01026380f, - 0.01561806f, 7.97004555e-004f, 0.07601810f, 0.01907250f, -0.03083035f, - -0.05987392f, 0.09242783f, 0.14555025f, 0.01035827f, 0.03092401f, - -0.09562709f, -0.03802354f, 0.02531144f, 0.03079449f, -0.07100715f, - 0.03330721f, -2.69116857e-003f, 0.03167490f, 0.05744999f, 0.03259895f, - 1.91266940e-003f, 0.03194578f, 0.07389776f, 0.02198060f, 0.07633314f, - 0.03293105f, -0.09103648f, 0.04718142f, 0.06102672f, -0.01003063f, - 5.85481385e-003f, -0.01522574f, 0.02323526f, 0.10584345f, - 4.35879454e-003f, 0.06107873f, 0.05868603f, -0.03115531f, 0.01214679f, - 0.08567052f, 3.93926632e-003f, -0.02521488f, -1.88425183e-003f, - 0.02038053f, -6.26854831e-004f, 0.04897438f, -0.04280585f, - -0.04819689f, -0.04812867f, -0.01451186f, 0.05101469f, - -9.01125465e-003f, -0.03333859f, 0.03917955f, 0.04196448f, 0.04292135f, - 0.02809529f, 0.02999715f, 0.04081348f, 9.10039060e-003f, 0.09703232f, - 0.10379741f, 0.02348725f, -4.72756615e-003f, 0.01027325f, 0.10402658f, - 0.12071823f, 0.09817299f, -0.02612033f, 0.03638414f, 0.05896405f, - 0.04865025f, 0.04793910f, -0.03882321f, -0.02962117f, -0.01222268f, - 0.04071597f, 0.01922777f, -0.02287866f, 0.03328381f, 0.01859092f, - 0.09024994f, 0.03804455f, -0.01424510f, 0.01953739f, 0.02509617f, - -0.03390914f, -0.05663941f, -0.01641979f, 0.05848591f, 0.04639670f, - 0.02092116f, 0.12911791f, 0.19918139f, 0.07739855f, -7.25806039e-003f, - 0.04074838f, 0.03183993f, 1.39251316e-003f, -0.01428625f, 0.01865480f, - 0.08529541f, 0.13547510f, 0.11189661f, 0.03998901f, 0.09575938f, - -0.02631102f, -0.03458253f, -0.04749985f, -0.06070716f, - 4.71884012e-003f, 0.06445789f, -0.02450038f, -0.05483776f, - -0.04657237f, -0.02030717f, -0.03480766f, -0.09397731f, -0.06399718f, - -0.01804585f, 5.62348310e-003f, -6.64811488e-003f, -0.06517869f, - 6.96210237e-003f, -0.01860148f, -0.04245830f, -0.05850367f, - -3.24417115e-003f, 0.07700698f, 0.11290991f, 0.09923030f, -0.02970599f, - 0.05592411f, 0.04813979f, -0.09811195f, -0.09357996f, -0.03276114f, - 0.05218338f, 0.04141375f, 3.92977800e-003f, -0.05047480f, 0.15960084f, - 0.04612800f, -0.03114098f, -0.04650044f, -0.03249795f, -0.02425641f, - -0.04311355f, 0.04307659f, -0.09401883f, -0.04742785f, -0.01254499f, - -0.06598741f, 3.41369561e-003f, -0.05620445f, -7.28127593e-003f, - -0.05998361f, -0.03274450f, -0.07376868f, 3.19015374e-003f, - -0.07733069f, 0.05815864f, -0.02471071f, 0.03850617f, 0.13838784f, - 0.15399861f, 0.01731321f, -0.01477586f, 0.10393341f, 0.05159833f, - -0.01945555f, -0.03427503f, -0.04867341f, 0.09237480f, 0.10732719f, - 0.06071450f, -0.01355071f, 0.01844356f, -0.03480803f, -0.03796671f, - 2.15628621e-004f, -0.05440186f, 0.01889855f, -0.01443413f, - -0.02607902f, -0.02938001f, 0.02720689f, -0.06228397f, -0.02970936f, - -0.03426210f, -0.10280876f, -0.06739304f, -0.05227850f, 0.03360292f, - -0.11278441f, -0.06966180f, -0.13937433f, 9.10932291e-003f, - 2.52020749e-004f, -4.07359656e-003f, 0.12310639f, 0.09343060f, - 0.07302511f, 0.03222093f, 0.07532879f, 0.03792387f, -0.04985180f, - 0.01804602f, 0.02694195f, 0.13481498f, 0.04601225f, 0.04106982f, - 0.08511057f, 0.12314661f, 0.01320830f, 0.05044121f, -5.52943908e-003f, - -0.08992624f, -0.02249301f, -0.08181777f, 0.06165213f, -0.03256603f, - -0.01068920f, -0.01323473f, -0.11970232f, -0.04616347f, -0.12088681f, - -0.06762606f, -0.08676834f, -0.06434575f, 0.01772529f, 0.03469615f, - -0.10926618f, 0.03013873f, 0.14030397f, 0.16130108f, 0.17985588f, - 0.11281928f, 0.10530639f, 0.08905948f, 0.07733764f, 0.06695238f, - 0.02142088f, 0.06438877f, 0.09794453f, 0.05745072f, 0.02788557f, - 0.02632830f, 0.07985807f, 4.24902979e-003f, 8.47890321e-003f, - -0.02679466f, -5.28812688e-003f, -0.02162580f, -0.07490715f, - -0.08251337f, -0.02056576f, -0.01026194f, -1.15492963e-003f, - -5.75720915e-004f, -0.07210591f, -0.07320981f, -0.04883312f, - -0.10897151f, -0.07477258f, -0.08867134f, -0.09222437f, -0.10924666f, - -0.10430276f, 0.07953499f, 0.02767959f, 0.11393359f, 0.18779543f, - 0.03313421f, 0.02143700f, 0.05852016f, -2.12067598e-003f, - -3.76984011e-003f, 0.02774167f, -0.03124610f, 0.01465141f, 0.01616004f, - -0.01391913f, -0.04404102f, -0.05444227f, -0.14684731f, -0.15016587f, - 0.04509468f, 1.29563001e-003f, 0.01398350f, 0.05610404f, -0.04868806f, - -0.04776716f, -8.16873740e-003f, -2.30126386e-003f, -0.02286313f, - 0.11983398f, -0.04703261f, -0.08814441f, -0.07585249f, -0.10799607f, - -0.03232087f, 0.01509786f, -0.04843464f, -0.03967846f, 0.09589416f, - 0.01352560f, -0.01458119f, 0.01050829f, -0.03038946f, 0.01608388f, - 1.11975556e-003f, -0.01250656f, 2.86211423e-003f, 0.04333691f, - -0.14603497f, -0.01946543f, -0.02327525f, -0.01973944f, 0.07944400f, - -0.02224544f, -0.06701808f, 0.03476532f, 0.11505594f, -0.02712801f, - -0.01665113f, 0.06315716f, -0.08205860f, 0.07431999f, 0.04915778f, - -0.04468752f, -0.01490402f, 0.07400476f, -0.11650901f, 0.05102430f, - 0.04559118f, -0.05916039f, 0.08840760f, -0.01587902f, -0.14890194f, - 0.07857784f, 0.04710254f, -0.05381983f, -0.07331945f, -0.03604643f, - 0.15611970f, 0.07649943f, -0.05959348f, -0.02776607f, 0.11098688f, - 0.03758875f, -0.04446875f, 0.04933187f, 0.01345535f, 0.06921103f, - 0.07364785f, 0.05518956f, 0.02899585f, 0.09375840f, 0.10518434f, - -0.04420241f, 0.01915282f, -3.56386811e-003f, 0.14586878f, 0.10286101f, - -0.04360626f, -0.12723237f, 0.09076386f, 0.11119842f, -0.06035013f, - 0.09674817f, 0.08938243f, 0.07065924f, 0.02603180f, 5.84815582e-003f, - -0.05922065f, 0.12360309f, 3.59695964e-003f, 2.99844006e-003f, - 0.03697936f, 0.02043072f, 0.04168725f, 0.01025975f, -0.01359980f, - -0.01600920f, 0.02581056f, 0.02329250f, 2.98100687e-003f, 0.01629762f, - 0.06652115f, 0.05855627f, 0.01237463f, -0.01297135f, 0.01761587f, - 0.05090865f, 0.06549342f, -0.04425945f, 2.43203156e-003f, - 3.07327788e-003f, 0.06678630f, -0.04303836f, 0.01082393f, -0.06476044f, - 0.04077786f, 0.12441979f, 0.08237778f, 0.07424165f, 0.04065890f, - 0.06905543f, 0.09556347f, 0.12724875f, -0.02132082f, 0.08514154f, - -0.04175328f, -0.02666954f, 0.01897836f, 0.03317382f, 9.45465732e-003f, - -0.01238974f, -0.04242500f, -0.01419479f, -0.03545213f, -0.02440874f, - 0.08684119f, 0.04212951f, 0.02462858f, -0.01104825f, -5.01706870e-003f, - 0.02968982f, 0.02597476f, -0.01568939f, 0.04514892f, 0.06974549f, - 0.08670278f, 0.06828108f, 0.10238872f, 0.05405957f, 0.06548470f, - -0.03763957f, 0.01366090f, 0.07069602f, 0.05363748f, 0.04798120f, - 0.11706422f, 0.05466456f, -0.01869259f, 0.06344382f, 0.03106543f, - 0.08432506f, -0.02061096f, 0.03821088f, -6.92190882e-003f, - 6.40467042e-003f, -0.01271779f, 6.89014705e-005f, 0.04541415f, - -0.01899539f, -0.05020239f, 0.03000903f, 0.01090422f, 4.52452758e-003f, - 0.02573632f, -0.02388454f, -0.04200457f, 1.72783900e-003f, - -0.05978370f, -0.02720562f, 0.06573715f, 0.01154317f, 0.01265615f, - 0.07375994f, -9.19828378e-003f, -0.04914120f, 0.02124831f, 0.06455322f, - 0.04372910f, -0.03310043f, 0.03605788f, -6.78055827e-003f, - 9.36202332e-003f, 0.01747596f, -0.06406314f, -0.06812935f, 0.08080816f, - -0.02778088f, 0.02735260f, 0.06393493f, 0.06652229f, 0.05676993f, - 0.08640018f, -7.59188086e-003f, -0.02012847f, -0.04741159f, - -0.01657069f, -0.01624399f, 0.05547778f, -2.33309763e-003f, - 0.01120033f, 0.06141156f, -0.06285004f, -0.08732341f, -0.09313398f, - -0.04267832f, 5.57443965e-003f, 0.04809862f, 0.01773641f, - 5.37361018e-003f, 0.14842421f, -0.06298012f, -0.02935147f, 0.11443478f, - -0.05034208f, 5.65494271e-003f, 0.02076526f, -0.04577984f, - -0.04735741f, 0.02961071f, -0.09307127f, -0.04417921f, -0.04990027f, - -0.03940028f, 0.01306016f, 0.06267900f, 0.03758737f, 0.08460117f, - 0.13858789f, 0.04862388f, -0.06319809f, -0.05655516f, 0.01885816f, - -0.03285607f, 0.03371567f, -0.07040928f, -0.04514049f, 0.01392166f, - 0.08184422f, -0.07230316f, 0.02386871f, 0.02184591f, 0.02605764f, - -0.01033954f, 9.29878280e-003f, 7.67351175e-003f, 0.15189242f, - 0.02069071f, -0.09738296f, -0.08894105f, -0.07768748f, 0.02332268f, - -0.01778995f, -0.03258888f, -0.08180822f, -0.08492987f, 0.02290156f, - -0.11368170f, -0.03554465f, -0.04533844f, -0.02861580f, 0.06782424f, - 0.01113123f, 0.02453644f, 0.12721945f, 0.08084814f, -0.03607795f, - 0.01109122f, 0.04803548f, -0.03489929f, 0.03399536f, -0.05682014f, - 8.59533902e-003f, -4.27904585e-003f, 0.03230887f, -0.01300198f, - -0.01038137f, -0.07930113f, 8.33097473e-003f, 0.02296994f, - -0.01306500f, -0.01881626f, 0.04413369f, 0.05729880f, -0.03761553f, - 0.01942326f, 1.64540811e-003f, -0.03811319f, 0.04190650f, -0.14978096f, - -0.04514487f, 0.01209545f, -5.46460645e-003f, -0.01647195f, - 7.63064111e-003f, -0.07494587f, 0.08415288f, 0.10020141f, -0.01228561f, - 0.06553826f, 0.04554005f, 0.07890417f, 0.03041138f, 0.01752007f, - 0.09208256f, -3.74419295e-004f, 0.10549527f, 0.04686913f, 0.01894833f, - -0.02651412f, -4.34682379e-003f, 5.44942822e-003f, 0.01444484f, - 0.05882156f, -0.03336544f, 0.04603891f, -0.10432546f, 0.01923928f, - 0.01842845f, -0.01712168f, -0.02222766f, 0.04693324f, -0.06202956f, - -0.01422159f, 0.08732220f, -0.07706107f, 0.02661049f, -0.04300238f, - -0.03092422f, -0.03552184f, -0.01886088f, -0.04979934f, 0.03906401f, - 0.04608644f, 0.04966111f, 0.04275464f, -0.04621769f, -0.02653212f, - 8.57011229e-003f, 0.03839684f, 0.05818764f, 0.03880796f, - -2.76100676e-004f, 0.03076511f, -0.03266929f, -0.05374557f, - 0.04986527f, -9.45429131e-003f, 0.03582499f, -2.64564669e-003f, - -1.07461517e-003f, 0.02962313f, -0.01483363f, 0.03060869f, 0.02448327f, - 0.01845641f, 0.03282966f, -0.03534438f, -0.01084059f, -0.01119136f, - -1.85360224e-003f, -5.94652840e-004f, -0.04451817f, 2.98327743e-003f, - 0.06272484f, -0.02152076f, -3.05971340e-003f, -0.05070828f, - 0.01531762f, 0.01282815f, 0.05167150f, 9.46266949e-003f, - -3.34558333e-003f, 0.11442288f, -0.03906701f, -2.67325155e-003f, - 0.03069184f, -0.01134165f, 0.02949462f, 0.02879886f, 0.03855566f, - -0.03450781f, 0.09142872f, -0.02156654f, 0.06075062f, -0.06220816f, - 0.01944680f, 6.68372354e-003f, -0.06656796f, 8.70784000e-003f, - 0.03456013f, 0.02434320f, -0.13236357f, -0.04177035f, -0.02069627f, - 0.01068112f, 0.01505432f, -0.07517391f, -3.83571628e-003f, - -0.06298508f, -0.02881260f, -0.13101046f, -0.07221562f, - -5.79945277e-003f, -8.57300125e-003f, 0.03782469f, 0.02762164f, - 0.04942456f, -0.02936396f, 0.09597211f, 0.01921411f, 0.06101191f, - -0.04787507f, -0.01379578f, -7.40224449e-003f, -0.02220136f, - -0.01313756f, 7.77558051e-003f, 0.12296968f, 0.02939998f, 0.03594062f, - -0.07788624f, -0.01133144f, 3.99316690e-004f, -0.06090347f, - -0.01122066f, -4.68682544e-003f, 0.07633100f, -0.06748922f, - -0.05640298f, -0.05265681f, -0.01139122f, -0.01624347f, -0.04715714f, - -0.01099092f, 0.01048561f, 3.28499987e-003f, -0.05810167f, - -0.07699911f, -0.03330683f, 0.04185145f, 0.03478536f, 0.02275165f, - 0.02304766f, 6.66040834e-003f, 0.10968148f, -5.93013782e-003f, - -0.04858336f, -0.04203213f, -0.09316786f, -6.13074889e-003f, - -0.02544625f, 0.01366201f, 9.18555818e-003f, -0.01846578f, - -0.05622401f, -0.03989377f, -0.07810296f, 6.91275718e-003f, - 0.05957597f, -0.03901334f, 0.01572002f, -0.01193903f, - -6.89400872e-003f, -0.03093356f, -0.04136098f, -0.01562869f, - -0.04604580f, 0.02865234f, -0.08678447f, -0.03232484f, -0.05364593f, - -0.01445016f, -0.07003860f, -0.08669746f, -0.04520775f, 0.04274122f, - 0.03117515f, 0.08175703f, 0.01081109f, 0.06379741f, 0.06199206f, - 0.02865988f, 0.02360346f, 0.06725410f, -0.03248780f, -9.37702879e-003f, - 0.08265898f, -0.02245839f, 0.05125763f, -0.01862395f, 0.01973453f, - -0.01994494f, -0.10770868f, 0.03180375f, 3.23935156e-003f, - -0.02142080f, -0.04256190f, 0.04760900f, 0.04282863f, 0.05635953f, - -0.01870849f, 0.05540622f, -0.03042666f, 0.01455277f, -0.06630179f, - -0.05843807f, -0.03739681f, -0.09739155f, -0.03220233f, -0.05620182f, - -0.10381401f, 0.07400211f, 4.20676917e-003f, 0.03258535f, - 2.14308966e-003f, 0.05121966f, -0.01274337f, 0.02384761f, 0.06335578f, - -0.07905591f, 0.08375625f, -0.07898903f, -0.06508528f, -0.02498444f, - 0.06535810f, 0.03970535f, 0.04895468f, -0.01169566f, -0.03980601f, - 0.05682293f, 0.05925463f, -0.01165808f, -0.07936699f, -0.04208954f, - 0.01333987f, 0.09051196f, 0.10098671f, -0.03974256f, 0.01238771f, - -0.07501741f, -0.03655440f, -0.04301528f, 0.09216860f, - 4.63579083e-004f, 0.02851115f, 0.02142735f, 1.28244064e-004f, - 0.02879687f, -0.08554889f, -0.04838862f, 0.08135369f, -0.05756533f, - 0.01413900f, 0.03451880f, -0.06619488f, -0.03053130f, 0.02961676f, - -0.07384635f, 0.01135692f, 0.05283910f, -0.07778034f, -0.02107482f, - -0.05511716f, -0.13473752f, 0.03030157f, 0.06722020f, -0.06218817f, - -0.05826827f, 0.06254654f, 0.02895772f, -0.01664000f, -0.03620280f, - -0.01612278f, -1.46097376e-003f, 0.14013411f, -8.96181818e-003f, - -0.03250246f, 3.38630192e-003f, 2.64779478e-003f, 0.03359732f, - -0.02411991f, -0.04229729f, 0.10666174f, -6.66579151f - }; - #endregion - - #region DaimlerPeopleDetector - /// - /// This field returns 1981 SVM coeffs obtained from daimler's base. - /// To use these coeffs the detection window size should be (48,96) - /// - public static readonly float[] DaimlerPeopleDetector = - { - 0.294350f, -0.098796f, -0.129522f, 0.078753f, - 0.387527f, 0.261529f, 0.145939f, 0.061520f, - 0.328699f, 0.227148f, -0.066467f, -0.086723f, - 0.047559f, 0.106714f, 0.037897f, 0.111461f, - -0.024406f, 0.304769f, 0.254676f, -0.069235f, - 0.082566f, 0.147260f, 0.326969f, 0.148888f, - 0.055270f, -0.087985f, 0.261720f, 0.143442f, - 0.026812f, 0.238212f, 0.194020f, 0.056341f, - -0.025854f, -0.034444f, -0.156631f, 0.205174f, - 0.089008f, -0.139811f, -0.100147f, -0.037830f, - -0.029230f, -0.055641f, 0.033248f, -0.016512f, - 0.155244f, 0.247315f, -0.124694f, -0.048414f, - -0.062219f, 0.193683f, 0.004574f, 0.055089f, - 0.093565f, 0.167712f, 0.167581f, 0.018895f, - 0.215258f, 0.122609f, 0.090520f, -0.067219f, - -0.049029f, -0.099615f, 0.241804f, -0.094893f, - -0.176248f, 0.001727f, -0.134473f, 0.104442f, - 0.050942f, 0.081165f, 0.072156f, 0.121646f, - 0.002656f, -0.297974f, -0.133587f, -0.060121f, - -0.092515f, -0.048974f, -0.084754f, -0.180111f, - -0.038590f, 0.086283f, -0.134636f, -0.107249f, - 0.132890f, 0.141556f, 0.249425f, 0.130273f, - -0.030031f, 0.073212f, -0.008155f, 0.019931f, - 0.071688f, 0.000300f, -0.019525f, -0.021725f, - -0.040993f, -0.086841f, 0.070124f, 0.240033f, - 0.265350f, 0.043208f, 0.166754f, 0.091453f, - 0.060916f, -0.036972f, -0.091043f, 0.079873f, - 0.219781f, 0.158102f, -0.140618f, -0.043016f, - 0.124802f, 0.093668f, 0.103208f, 0.094872f, - 0.080541f, 0.137711f, 0.160566f, -0.169231f, - 0.013983f, 0.309508f, -0.004217f, -0.057200f, - -0.064489f, 0.014066f, 0.361009f, 0.251328f, - -0.080983f, -0.044183f, 0.061436f, -0.037381f, - -0.078786f, 0.030993f, 0.066314f, 0.037683f, - 0.152325f, -0.091683f, 0.070203f, 0.217856f, - 0.036435f, -0.076462f, 0.006254f, -0.094431f, - 0.154829f, -0.023038f, -0.196961f, -0.024594f, - 0.178465f, -0.050139f, -0.045932f, -0.000965f, - 0.109112f, 0.046165f, -0.159373f, -0.008713f, - 0.041307f, 0.097129f, -0.057211f, -0.064599f, - 0.077165f, 0.176167f, 0.138322f, 0.065753f, - -0.104950f, 0.017933f, 0.136255f, -0.011598f, - 0.047007f, 0.080550f, 0.068619f, 0.084661f, - -0.035493f, -0.091314f, -0.041411f, 0.060971f, - -0.101912f, -0.079870f, -0.085977f, -0.022686f, - 0.079788f, -0.098064f, -0.054603f, 0.040383f, - 0.300794f, 0.128603f, 0.094844f, 0.047407f, - 0.101825f, 0.061832f, -0.162160f, -0.204553f, - -0.035165f, 0.101450f, -0.016641f, -0.027140f, - -0.134392f, -0.008743f, 0.102331f, 0.114853f, - 0.009644f, 0.062823f, 0.237339f, 0.167843f, - 0.053066f, -0.012592f, 0.043158f, 0.002305f, - 0.065001f, -0.038929f, -0.020356f, 0.152343f, - 0.043469f, -0.029967f, -0.042948f, 0.032481f, - 0.068488f, -0.110840f, -0.111083f, 0.111980f, - -0.002072f, -0.005562f, 0.082926f, 0.006635f, - -0.108153f, 0.024242f, -0.086464f, -0.189884f, - -0.017492f, 0.191456f, -0.007683f, -0.128769f, - -0.038017f, -0.132380f, 0.091926f, 0.079696f, - -0.106728f, -0.007656f, 0.172744f, 0.011576f, - 0.009883f, 0.083258f, -0.026516f, 0.145534f, - 0.153924f, -0.130290f, -0.108945f, 0.124490f, - -0.003186f, -0.100485f, 0.015024f, -0.060512f, - 0.026288f, -0.086713f, -0.169012f, 0.076517f, - 0.215778f, 0.043701f, -0.131642f, -0.012585f, - -0.045181f, -0.118183f, -0.241544f, -0.167293f, - -0.020107f, -0.019917f, -0.101827f, -0.107096f, - -0.010503f, 0.044938f, 0.189680f, 0.217119f, - -0.046086f, 0.044508f, 0.199716f, -0.036004f, - -0.148927f, 0.013355f, -0.078279f, 0.030451f, - 0.056301f, -0.024609f, 0.083224f, 0.099533f, - -0.039432f, -0.138880f, 0.005482f, -0.024120f, - -0.140468f, -0.066381f, -0.017057f, 0.009260f, - -0.058004f, -0.028486f, -0.061610f, 0.007483f, - -0.158309f, -0.150687f, -0.044595f, -0.105121f, - -0.045763f, -0.006618f, -0.024419f, -0.117713f, - -0.119366f, -0.175941f, -0.071542f, 0.119027f, - 0.111362f, 0.043080f, 0.034889f, 0.093003f, - 0.007842f, 0.057368f, -0.108834f, -0.079968f, - 0.230959f, 0.020205f, 0.011470f, 0.098877f, - 0.101310f, -0.030215f, -0.018018f, -0.059552f, - -0.106157f, 0.021866f, -0.036471f, 0.080051f, - 0.041165f, -0.082101f, 0.117726f, 0.030961f, - -0.054763f, -0.084102f, -0.185778f, -0.061305f, - -0.038089f, -0.110728f, -0.264010f, 0.076675f, - -0.077111f, -0.137644f, 0.036232f, 0.277995f, - 0.019116f, 0.107738f, 0.144003f, 0.080304f, - 0.215036f, 0.228897f, 0.072713f, 0.077773f, - 0.120168f, 0.075324f, 0.062730f, 0.122478f, - -0.049008f, 0.164912f, 0.162450f, 0.041246f, - 0.009891f, -0.097827f, -0.038700f, -0.023027f, - -0.120020f, 0.203364f, 0.248474f, 0.149810f, - -0.036276f, -0.082814f, -0.090343f, -0.027143f, - -0.075689f, -0.320310f, -0.000500f, -0.143334f, - -0.065077f, -0.186936f, 0.129372f, 0.116431f, - 0.181699f, 0.170436f, 0.418854f, 0.460045f, - 0.333719f, 0.230515f, 0.047822f, -0.044954f, - -0.068086f, 0.140179f, -0.044821f, 0.085550f, - 0.092483f, -0.107296f, -0.130670f, -0.206629f, - 0.114601f, -0.317869f, -0.076663f, 0.038680f, - 0.212753f, -0.016059f, -0.126526f, -0.163602f, - 0.210154f, 0.099887f, -0.126366f, 0.118453f, - 0.019309f, -0.021611f, -0.096499f, -0.111809f, - -0.200489f, 0.142854f, 0.228840f, -0.353346f, - -0.179151f, 0.116834f, 0.252389f, -0.031728f, - -0.188135f, -0.158998f, 0.386523f, 0.122315f, - 0.209944f, 0.394023f, 0.359030f, 0.260717f, - 0.170335f, 0.013683f, -0.142596f, -0.026138f, - -0.011878f, -0.150519f, 0.047159f, -0.107062f, - -0.147347f, -0.187689f, -0.186027f, -0.208048f, - 0.058468f, -0.073026f, -0.236556f, -0.079788f, - -0.146216f, -0.058563f, -0.101361f, -0.071294f, - -0.071093f, 0.116919f, 0.234304f, 0.306781f, - 0.321866f, 0.240000f, 0.073261f, -0.012173f, - 0.026479f, 0.050173f, 0.166127f, 0.228955f, - 0.061905f, 0.156460f, 0.205990f, 0.120672f, - 0.037350f, 0.167884f, 0.290099f, 0.420900f, - -0.012601f, 0.189839f, 0.306378f, 0.118383f, - -0.095598f, -0.072360f, -0.132496f, -0.224259f, - -0.126021f, 0.022714f, 0.284039f, 0.051369f, - -0.000927f, -0.058735f, -0.083354f, -0.141254f, - -0.187578f, -0.202669f, 0.048902f, 0.246597f, - 0.441863f, 0.342519f, 0.066979f, 0.215286f, - 0.188191f, -0.072240f, -0.208142f, -0.030196f, - 0.178141f, 0.136985f, -0.043374f, -0.181098f, - 0.091815f, 0.116177f, -0.126690f, -0.386625f, - 0.368165f, 0.269149f, -0.088042f, -0.028823f, - 0.092961f, 0.024099f, 0.046112f, 0.176756f, - 0.135849f, 0.124955f, 0.195467f, -0.037218f, - 0.167217f, 0.188938f, 0.053528f, -0.066561f, - 0.133721f, -0.070565f, 0.115898f, 0.152435f, - -0.116993f, -0.110592f, -0.179005f, 0.026668f, - 0.080530f, 0.075084f, -0.070401f, 0.012497f, - 0.021849f, -0.139764f, -0.022020f, -0.096301f, - -0.064954f, -0.127446f, -0.013806f, -0.108315f, - 0.156285f, 0.149867f, -0.011382f, 0.064532f, - 0.029168f, 0.027393f, 0.069716f, 0.153735f, - 0.038459f, 0.230714f, 0.253840f, 0.059522f, - -0.045053f, 0.014083f, 0.071103f, 0.068747f, - 0.095887f, 0.005832f, 0.144887f, 0.026357f, - -0.067359f, -0.044151f, -0.123283f, -0.019911f, - 0.005318f, 0.109208f, -0.003201f, -0.021734f, - 0.142025f, -0.066907f, -0.120070f, -0.188639f, - 0.012472f, -0.048704f, -0.012366f, -0.184828f, - 0.168591f, 0.267166f, 0.058208f, -0.044101f, - 0.033500f, 0.178558f, 0.104550f, 0.122418f, - 0.080177f, 0.173246f, 0.298537f, 0.064173f, - 0.053397f, 0.174341f, 0.230984f, 0.117025f, - 0.166242f, 0.227781f, 0.120623f, 0.176952f, - -0.011393f, -0.086483f, -0.008270f, 0.051700f, - -0.153369f, -0.058837f, -0.057639f, -0.060115f, - 0.026349f, -0.160745f, -0.037894f, -0.048575f, - 0.041052f, -0.022112f, 0.060365f, 0.051906f, - 0.162657f, 0.138519f, -0.050185f, -0.005938f, - 0.071301f, 0.127686f, 0.062342f, 0.144400f, - 0.072600f, 0.198436f, 0.246219f, -0.078185f, - -0.036169f, 0.075934f, 0.047328f, -0.013601f, - 0.087205f, 0.019900f, 0.022606f, -0.015365f, - -0.092506f, 0.075275f, -0.116375f, 0.050500f, - 0.045118f, 0.166567f, 0.072073f, 0.060371f, - 0.131747f, -0.169863f, -0.039352f, -0.047486f, - -0.039797f, -0.204312f, 0.021710f, 0.129443f, - -0.021173f, 0.173416f, -0.070794f, -0.063986f, - 0.069689f, -0.064099f, -0.123201f, -0.017372f, - -0.206870f, 0.065863f, 0.113226f, 0.024707f, - -0.071341f, -0.066964f, -0.098278f, -0.062927f, - 0.075840f, 0.014716f, 0.019378f, 0.132699f, - -0.074191f, -0.089557f, -0.078446f, -0.197488f, - -0.173665f, 0.052583f, 0.044361f, 0.113549f, - 0.098492f, 0.077379f, -0.011146f, -0.192593f, - -0.164435f, 0.045568f, 0.205699f, 0.049187f, - -0.082281f, 0.134874f, 0.185499f, 0.034968f, - -0.119561f, -0.112372f, -0.115091f, -0.054042f, - -0.183816f, -0.078100f, 0.190695f, 0.091617f, - 0.004257f, -0.041135f, -0.061453f, -0.141592f, - -0.194809f, -0.120638f, 0.020168f, 0.109672f, - 0.067398f, -0.015238f, -0.239145f, -0.264671f, - -0.185176f, 0.050472f, 0.020793f, 0.035678f, - 0.022839f, -0.052055f, -0.127968f, -0.113049f, - -0.228416f, -0.258281f, -0.053437f, 0.076424f, - 0.061450f, 0.237478f, 0.003618f, -0.055865f, - -0.108087f, -0.028937f, 0.045585f, 0.052829f, - -0.001471f, 0.022826f, 0.059565f, -0.104430f, - -0.077266f, -0.211882f, -0.212078f, 0.028074f, - 0.075846f, 0.016265f, 0.161879f, 0.134477f, - 0.008935f, -0.048041f, 0.074692f, 0.004928f, - -0.025156f, 0.192874f, 0.074410f, 0.308732f, - 0.267400f, 0.094208f, -0.005251f, 0.042041f, - -0.032148f, 0.015588f, 0.252869f, 0.175302f, - 0.022892f, 0.081673f, 0.063208f, 0.162626f, - 0.194426f, 0.233890f, 0.262292f, 0.186930f, - 0.084079f, -0.286388f, -0.213034f, -0.048867f, - -0.207669f, -0.170050f, 0.011673f, -0.092958f, - -0.192786f, -0.273536f, 0.230904f, 0.266732f, - 0.320519f, 0.297155f, 0.548169f, 0.304922f, - 0.132687f, 0.247333f, 0.212488f, -0.271472f, - -0.142105f, -0.002627f, -0.119215f, 0.128383f, - 0.100079f, -0.057490f, -0.121902f, -0.228892f, - 0.202292f, -0.399795f, -0.371326f, -0.095836f, - -0.063626f, -0.161375f, -0.311180f, -0.294797f, - 0.242122f, 0.011788f, 0.095573f, 0.322523f, - 0.511840f, 0.322880f, 0.313259f, 0.173331f, - 0.002542f, -0.029802f, 0.324766f, -0.326170f, - -0.340547f, -0.138288f, -0.002963f, -0.114060f, - -0.377312f, -0.442570f, 0.212446f, -0.007759f, - -0.011576f, 0.169711f, 0.308689f, 0.317348f, - 0.539390f, 0.332845f, 0.057331f, -0.068180f, - 0.101994f, 0.266995f, 0.209570f, 0.355730f, - 0.091635f, 0.170238f, 0.125215f, 0.274154f, - 0.070223f, 0.025515f, 0.049946f, -0.000550f, - 0.043715f, -0.141843f, 0.020844f, 0.129871f, - 0.256588f, 0.105015f, 0.148339f, 0.170682f, - 0.028792f, 0.074037f, 0.160042f, 0.405137f, - 0.246187f, 0.352160f, 0.168951f, 0.222263f, - 0.264439f, 0.065945f, 0.021963f, -0.075084f, - 0.093105f, 0.027318f, 0.098864f, 0.057566f, - -0.080282f, 0.185032f, 0.314419f, 0.333727f, - 0.125798f, 0.294919f, 0.386002f, 0.217619f, - -0.183517f, -0.278622f, -0.002342f, -0.027821f, - -0.134266f, -0.331843f, -0.008296f, 0.124564f, - 0.053712f, -0.369016f, -0.095036f, 0.209381f, - 0.423760f, 0.371760f, 0.106397f, 0.369408f, - 0.485608f, 0.231201f, -0.138685f, -0.349208f, - -0.070083f, 0.028991f, -0.081630f, -0.395992f, - -0.146791f, -0.027354f, 0.063396f, -0.272484f, - 0.058299f, 0.338207f, 0.110767f, -0.052642f, - -0.233848f, -0.027448f, 0.030328f, 0.155572f, - -0.093826f, 0.019331f, 0.120638f, 0.006292f, - -0.106083f, -0.236290f, -0.140933f, -0.088067f, - -0.025138f, -0.208395f, -0.025502f, 0.144192f, - -0.048353f, -0.106144f, -0.305121f, -0.114147f, - 0.090963f, 0.327727f, 0.035606f, -0.093779f, - 0.002651f, -0.171081f, -0.188131f, -0.216571f, - -0.209101f, -0.054402f, 0.157147f, -0.057127f, - 0.066584f, 0.008988f, 0.041191f, 0.034456f, - -0.078255f, 0.052099f, -0.022239f, 0.066981f, - -0.117520f, -0.072637f, 0.062512f, 0.037570f, - -0.057544f, -0.312359f, 0.034357f, -0.031549f, - 0.002566f, -0.207375f, -0.070654f, -0.018786f, - -0.044815f, -0.012814f, -0.076320f, 0.078183f, - 0.023877f, 0.117078f, 0.022292f, -0.205424f, - -0.060430f, -0.017296f, -0.004827f, -0.321036f, - -0.092155f, 0.038837f, 0.073190f, -0.067513f, - 0.026521f, 0.171945f, 0.087318f, 0.034495f, - -0.034089f, 0.154410f, -0.061431f, 0.007435f, - -0.111094f, -0.095976f, 0.014741f, -0.132324f, - -0.029517f, -0.192160f, 0.098667f, 0.020762f, - 0.177050f, -0.064510f, -0.054437f, -0.058678f, - -0.001858f, 0.167602f, 0.015735f, 0.054338f, - 0.016477f, 0.186381f, -0.010667f, 0.054692f, - 0.126742f, 0.013140f, 0.090353f, -0.133608f, - -0.018017f, -0.152619f, 0.027600f, -0.138700f, - -0.050274f, 0.045141f, -0.118731f, 0.094797f, - -0.167605f, 0.097461f, -0.009131f, 0.199920f, - -0.052976f, 0.158194f, 0.178568f, -0.107600f, - 0.009671f, -0.084072f, -0.040258f, -0.205673f, - 0.102891f, 0.223511f, 0.042699f, 0.118548f, - -0.021274f, 0.110997f, -0.155121f, 0.027696f, - -0.149968f, 0.051552f, -0.129219f, 0.173524f, - 0.073972f, -0.189045f, -0.034523f, -0.106655f, - -0.011843f, -0.197381f, 0.219413f, 0.183197f, - -0.054920f, 0.144955f, 0.036517f, -0.085412f, - -0.229070f, -0.143710f, -0.049486f, 0.156634f, - -0.008673f, -0.064778f, 0.082344f, 0.145673f, - 0.002912f, -0.210121f, -0.116564f, 0.078425f, - 0.220908f, -0.067594f, 0.048610f, 0.084912f, - -0.066202f, -0.112515f, -0.217767f, -0.082640f, - -0.017414f, 0.230265f, -0.070735f, 0.066073f, - 0.215256f, 0.071157f, -0.087220f, -0.202235f, - -0.011918f, 0.099562f, 0.174716f, -0.063845f, - -0.121055f, 0.014367f, 0.132709f, -0.005060f, - -0.244606f, -0.179693f, -0.134690f, 0.023239f, - -0.193116f, -0.076975f, -0.021164f, -0.001938f, - -0.163799f, -0.111437f, -0.210362f, -0.166376f, - 0.034754f, 0.010036f, -0.021917f, 0.068014f, - -0.086893f, -0.251746f, -0.267171f, 0.037383f, - 0.003966f, 0.033571f, -0.151506f, 0.025437f, - -0.020626f, -0.308454f, -0.343143f, -0.092263f, - -0.026261f, -0.028345f, 0.036036f, 0.035169f, - 0.129470f, 0.122205f, 0.015661f, -0.070612f, - -0.094333f, -0.066055f, -0.041083f, 0.159146f, - 0.073184f, 0.110044f, 0.174471f, 0.078069f, - -0.014881f, 0.008116f, 0.013209f, 0.075857f, - 0.195605f, 0.062714f, 0.067955f, 0.056544f, - -0.153908f, -0.141749f, -0.072550f, 0.033523f, - -0.024665f, 0.134487f, 0.079076f, 0.133562f, - 0.227130f, 0.018054f, 0.004928f, 0.169162f, - 0.065152f, 0.072160f, 0.131631f, 0.096303f, - 0.054288f, 0.106256f, 0.114632f, 0.119038f, - 0.515200f, 0.247429f, 0.199134f, 0.211957f, - 0.127558f, -0.294684f, -0.194890f, -0.049988f, - -0.112247f, -0.008122f, -0.006176f, 0.037035f, - -0.110881f, -0.249989f, 0.152434f, 0.234621f, - 0.153340f, 0.349283f, 0.683049f, 0.157174f, - 0.124844f, 0.099136f, 0.064407f, -0.248400f, - -0.155323f, -0.026498f, -0.023450f, 0.049051f, - -0.114187f, 0.007195f, -0.176825f, -0.376926f, - 0.366159f, -0.179938f, -0.148508f, 0.006043f, - 0.170048f, 0.097866f, -0.102658f, -0.260430f, - 0.248868f, 0.037019f, -0.118111f, 0.078176f, - 0.194171f, 0.211328f, 0.368612f, 0.361213f, - 0.130013f, 0.094650f, 0.227396f, -0.178058f, - -0.114782f, -0.008093f, 0.231080f, -0.011843f, - -0.097917f, -0.325788f, 0.141879f, 0.119738f, - -0.230427f, -0.117419f, -0.114153f, 0.037903f, - 0.116383f, 0.218773f, -0.101884f, 0.059466f, - 0.119255f, 0.010874f, -0.031449f, 0.045996f, - 0.119931f, 0.273760f, 0.311700f, 0.261794f, - 0.194809f, 0.339829f, 0.239449f, 0.064140f, - 0.077597f, 0.098996f, 0.143534f, 0.184602f, - 0.037507f, 0.225494f, 0.096142f, -0.147370f, - -0.207833f, -0.174742f, -0.086391f, -0.038942f, - 0.159577f, -0.088492f, -0.000989f, 0.108154f, - -0.025890f, -0.072713f, 0.025997f, -0.006803f, - -0.086879f, -0.011290f, -0.269200f, -0.103450f, - -0.124910f, -0.116340f, 0.141459f, 0.208800f, - 0.042268f, 0.265034f, 0.516474f, 0.217591f, - -0.018843f, -0.313328f, -0.168363f, 0.047129f, - 0.090480f, -0.109852f, -0.018761f, 0.210669f, - 0.281269f, -0.043591f, -0.034147f, -0.237772f, - -0.134843f, -0.072481f, -0.103831f, 0.038355f, - 0.308619f, 0.148023f, -0.045867f, -0.123950f, - -0.210860f, -0.064973f, -0.036308f, -0.046731f, - -0.022099f, 0.095776f, 0.409423f, 0.060635f, - -0.065196f, 0.051828f, 0.027981f, -0.009609f, - -0.137681f, -0.095011f, -0.019045f, 0.177278f, - 0.009759f, -0.092119f, -0.016958f, -0.133860f, - -0.118421f, -0.032039f, -0.006214f, -0.084541f, - 0.063971f, -0.073642f, 0.165676f, 0.110443f, - 0.044131f, 0.046568f, 0.053292f, -0.055466f, - 0.015512f, 0.371947f, 0.232102f, -0.016923f, - 0.103979f, -0.091758f, 0.005907f, 0.209100f, - 0.157433f, 0.030518f, 0.250366f, 0.062322f, - 0.036720f, 0.094676f, 0.017306f, -0.010328f, - -0.079012f, 0.016781f, -0.112435f, 0.061795f, - 0.042543f, -0.126799f, -0.009975f, -0.056760f, - 0.046424f, -0.194712f, -0.139399f, -0.037731f, - 0.157989f, -0.016261f, 0.123345f, 0.230563f, - 0.083300f, -0.016392f, 0.059567f, -0.016035f, - -0.064767f, 0.231945f, 0.156629f, 0.034602f, - 0.145628f, 0.041315f, 0.034535f, 0.019967f, - -0.089188f, -0.012091f, 0.307857f, 0.211405f, - -0.025091f, -0.148249f, -0.129384f, 0.063536f, - -0.068603f, -0.067941f, -0.035104f, 0.210832f, - 0.063810f, 0.062764f, -0.089889f, -0.030554f, - 0.014791f, -0.053362f, -0.037818f, -0.196640f, - 0.008388f, -0.082654f, 0.143056f, 0.064221f, - 0.069795f, 0.191040f, 0.097321f, -0.028679f, - 0.075794f, 0.313154f, 0.086240f, 0.207643f, - 0.017809f, 0.122867f, 0.224586f, 0.167403f, - -0.023884f, 0.047434f, 0.344091f, 0.187745f, - 0.136177f, 0.141738f, 0.063799f, 0.045233f, - -0.077342f, -0.003525f, -0.165041f, -0.025616f, - -0.073745f, 0.164439f, 0.011200f, -0.145896f, - -0.027954f, -0.061987f, -0.039874f, -0.142775f, - 0.151042f, -0.038238f, 0.053152f, 0.078615f, - 0.086061f, 0.100593f, 0.128046f, -0.071006f, - -0.116558f, 0.208445f, 0.051086f, 0.076843f, - 0.023191f, -0.084781f, -0.011790f, 0.147807f, - -0.048554f, -0.113932f, 0.283322f, 0.190934f, - 0.092789f, 0.033018f, -0.142428f, -0.142480f, - -0.099023f, -0.041020f, -0.042760f, 0.203295f, - -0.053475f, 0.042424f, 0.222839f, -0.019167f, - -0.133176f, -0.276216f, -0.031998f, 0.117290f, - 0.177827f, -0.059973f, -0.064744f, -0.117040f, - -0.155482f, -0.099531f, 0.164121f, -0.026682f, - -0.093810f, 0.238993f, -0.006506f, 0.007830f, - 0.065819f, -0.203643f, -0.100925f, -0.053652f, - -0.130770f, 0.026277f, 0.131796f, 0.032742f, - 0.127186f, 0.116694f, -0.161122f, -0.279773f, - -0.252515f, -0.002638f, 0.042812f, 0.096776f, - -0.123280f, 0.064858f, -0.010455f, -0.219760f, - -0.239331f, -0.104363f, -0.058022f, -0.053584f, - 0.025611f, 0.005129f, -0.100418f, -0.045712f, - -0.194418f, -0.126366f, -0.030530f, 0.051168f, - 0.215959f, 0.172402f, -0.054700f, -0.185995f, - -0.278360f, -0.193693f, -0.040309f, 0.003735f, - -0.007770f, 0.123556f, 0.190179f, -0.077315f, - 0.117403f, 0.212942f, 0.012160f, 0.000113f, - 0.027331f, 0.040202f, 0.033293f, 0.219438f, - 0.184174f, 0.259349f, 0.311206f, 0.082547f, - -0.047875f, -0.078417f, 0.010746f, 0.082620f, - 0.311931f, 0.307605f, 0.003863f, 0.021405f, - -0.026388f, -0.019572f, 0.020582f, -0.059353f, - 0.025199f, 0.261319f, 0.086316f, 0.143614f, - 0.107780f, 0.003900f, -0.188397f, -0.038563f, - -0.106045f, -0.125154f, -0.010509f, 0.054021f, - 0.242130f, 0.279152f, 0.215546f, 0.346995f, - 0.440856f, 0.237452f, 0.234154f, 0.301646f, - 0.168929f, -0.208358f, -0.126848f, 0.010260f, - 0.121018f, -0.062975f, -0.052848f, 0.050341f, - -0.061103f, -0.266482f, 0.107186f, 0.140221f, - 0.280065f, 0.287889f, 0.373198f, 0.151596f, - 0.013593f, 0.115616f, 0.014616f, -0.281710f, - -0.237597f, -0.117305f, -0.000034f, -0.136739f, - -0.196275f, -0.095225f, -0.125310f, -0.250514f, - 0.236804f, -0.071805f, -0.037421f, 0.048230f, - 0.321596f, 0.063632f, 0.024039f, -0.029133f, - 0.230983f, 0.160593f, -0.154355f, -0.013086f, - -0.079929f, 0.094692f, 0.160391f, 0.180239f, - 0.053895f, 0.100759f, 0.288631f, 0.038191f, - 0.181692f, 0.229682f, 0.440166f, 0.063401f, - 0.006273f, 0.020865f, 0.338695f, 0.256244f, - -0.043927f, 0.115617f, 0.003296f, 0.173965f, - 0.021318f, -0.040936f, -0.118932f, 0.182380f, - 0.235922f, -0.053233f, -0.015053f, -0.101057f, - 0.095341f, 0.051111f, 0.161831f, 0.032614f, - 0.159496f, 0.072375f, 0.025089f, 0.023748f, - 0.029151f, 0.161284f, -0.117717f, -0.036191f, - -0.176822f, -0.162006f, 0.226542f, -0.078329f, - 0.043079f, -0.119172f, 0.054614f, -0.101365f, - -0.064541f, -0.115304f, 0.135170f, 0.298872f, - 0.098060f, 0.089428f, -0.007497f, 0.110391f, - -0.028824f, 0.020835f, -0.036804f, 0.125411f, - 0.192105f, -0.048931f, 0.003086f, -0.010681f, - 0.074698f, -0.016263f, 0.096063f, 0.060267f, - -0.007277f, 0.139139f, -0.080635f, 0.036628f, - 0.086058f, 0.131979f, 0.085707f, 0.025301f, - 0.226094f, 0.194759f, 0.042193f, -0.157846f, - -0.068402f, -0.141450f, -0.112659f, -0.076305f, - -0.069085f, -0.114332f, -0.102005f, 0.132193f, - -0.067042f, 0.106643f, 0.198964f, 0.171616f, - 0.167237f, -0.033730f, -0.026755f, 0.083621f, - 0.149459f, -0.002799f, -0.000318f, 0.011753f, - 0.065889f, -0.089375f, -0.049610f, 0.224579f, - 0.216548f, -0.034908f, -0.017851f, -0.088144f, - 0.007530f, 0.240268f, 0.073270f, 0.013263f, - 0.175323f, 0.012082f, 0.093993f, 0.015282f, - 0.105854f, 0.107990f, 0.077798f, -0.096166f, - -0.079607f, 0.177820f, 0.142392f, 0.033337f, - -0.078100f, -0.081616f, -0.046993f, 0.139459f, - 0.020272f, -0.123161f, 0.175269f, 0.105217f, - 0.057328f, 0.080909f, -0.012612f, -0.097081f, - 0.082060f, -0.096716f, -0.063921f, 0.201884f, - 0.128166f, -0.035051f, -0.032227f, -0.068139f, - -0.115915f, 0.095080f, -0.086007f, -0.067543f, - 0.030776f, 0.032712f, 0.088937f, 0.054336f, - -0.039329f, -0.114022f, 0.171672f, -0.112321f, - -0.217646f, 0.065186f, 0.060223f, 0.192174f, - 0.055580f, -0.131107f, -0.144338f, 0.056730f, - -0.034707f, -0.081616f, -0.135298f, -0.000614f, - 0.087189f, 0.014614f, 0.067709f, 0.107689f, - 0.225780f, 0.084361f, -0.008544f, 0.051649f, - -0.048369f, -0.037739f, -0.060710f, 0.002654f, - 0.016935f, 0.085563f, -0.015961f, -0.019265f, - 0.111788f, 0.062376f, 0.202019f, 0.047713f, - 0.042261f, 0.069716f, 0.242913f, 0.021052f, - -0.072812f, -0.155920f, -0.026436f, 0.035621f, - -0.079300f, -0.028787f, -0.048329f, 0.084718f, - -0.060565f, -0.083750f, -0.164075f, -0.040742f, - -0.086219f, 0.015271f, -0.005204f, -0.016038f, - 0.045816f, -0.050433f, -0.077652f, 0.117109f, - 0.009611f, -0.009045f, -0.008634f, -0.055373f, - -0.085968f, 0.028527f, -0.054736f, -0.168089f, - 0.175839f, 0.071205f, -0.023603f, 0.037907f, - -0.004561f, -0.022634f, 0.123831f, 0.094469f, - -0.072920f, -0.133642f, -0.014032f, -0.142754f, - -0.026999f, -0.199409f, 0.013268f, 0.226989f, - 0.048650f, -0.170988f, -0.050141f, 0.007880f, - 0.061880f, 0.019078f, -0.043578f, -0.038139f, - 0.134814f, 0.054097f, -0.081670f, 0.176838f, - 0.047920f, -0.038176f, 0.050406f, -0.107181f, - -0.036279f, 0.027060f, 0.081594f, -0.002820f, - 0.090507f, -0.033338f, -0.059571f, 0.013404f, - -0.099860f, 0.073371f, 0.342805f, 0.098305f, - -0.150910f, -0.020822f, -0.056960f, 0.046262f, - -0.043413f, -0.149405f, -0.129105f, -0.010899f, - -0.014229f, -0.179949f, -0.113044f, -0.049468f, - -0.065513f, 0.090269f, -0.011919f, 0.087846f, - 0.095796f, 0.146127f, 0.101599f, 0.078066f, - -0.084348f, -0.100002f, -0.020134f, -0.050169f, - 0.062122f, 0.014640f, 0.019143f, 0.036543f, - 0.180924f, -0.013976f, -0.066768f, -0.001090f, - -0.070419f, -0.004839f, -0.001504f, 0.034483f, - -0.044954f, -0.050336f, -0.088638f, -0.174782f, - -0.116082f, -0.205507f, 0.015587f, -0.042839f, - -0.096879f, -0.144097f, -0.050268f, -0.196796f, - 0.109639f, 0.271411f, 0.173732f, 0.108070f, - 0.156437f, 0.124255f, 0.097242f, 0.238693f, - 0.083941f, 0.109105f, 0.223940f, 0.267188f, - 0.027385f, 0.025819f, 0.125070f, 0.093738f, - 0.040353f, 0.038645f, -0.012730f, 0.144063f, - 0.052931f, -0.009138f, 0.084193f, 0.160272f, - -0.041366f, 0.011951f, -0.121446f, -0.106713f, - -0.047566f, 0.047984f, -0.255224f, -0.076116f, - 0.098685f, -0.150845f, -0.171513f, -0.156590f, - 0.058331f, 0.187493f, 0.413018f, 0.554265f, - 0.372242f, 0.237943f, 0.124571f, 0.110829f, - 0.010322f, -0.174477f, -0.067627f, -0.001979f, - 0.142913f, 0.040597f, 0.019907f, 0.025963f, - -0.043585f, -0.120732f, 0.099937f, 0.091059f, - 0.247307f, 0.204226f, -0.042753f, -0.068580f, - -0.119002f, 0.026722f, 0.034853f, -0.060934f, - -0.025054f, -0.093026f, -0.035372f, -0.233209f, - -0.049869f, -0.039151f, -0.022279f, -0.065380f, - -9.063785f - }; - #endregion - - #endregion - - #region Init and Disposal - -#if LANG_JP - /// - /// HOG ディスクリプタおよび検出器を作成します - /// -#else - /// - /// Default constructor - /// -#endif - public HOGDescriptor() - { - ptr = NativeMethods.objdetect_HOGDescriptor_new1(); - } - -#if LANG_JP - /// - /// HOG ディスクリプタおよび検出器を作成します - /// - /// 検出窓サイズ.ブロックのサイズと移動量に合わせる必要があります. - /// ピクセル単位で表されるブロックサイズ.セルサイズに合わせる必要があります. - /// ブロックの移動量.セルサイズの倍数でなければいけません. - /// セルサイズ. - /// ビンの個数. - /// - /// ガウシアン平滑化窓パラメータ. - /// - /// L2-Hys 正規化縮小処理の閾値. - /// 前処理としてガンマ補正を行うか否か,を指定します. - /// 検出窓拡大回数の最大値 -#else - /// - /// Creates the HOG descriptor and detector. - /// - /// Detection window size. Align to block size and block stride. - /// Block size in pixels. Align to cell size. Only (16,16) is supported for now. - /// Block stride. It must be a multiple of cell size. - /// Cell size. Only (8, 8) is supported for now. - /// Number of bins. Only 9 bins per cell are supported for now. - /// - /// Gaussian smoothing window parameter. - /// - /// L2-Hys normalization method shrinkage. - /// Flag to specify whether the gamma correction preprocessing is required or not. - /// Maximum number of detection window increases. -#endif - public HOGDescriptor( - Size? winSize = null, - Size? blockSize = null, - Size? blockStride = null, - Size? cellSize = null, - int nbins = 9, - int derivAperture = 1, - double winSigma = -1, - HistogramNormType histogramNormType = HistogramNormType.L2Hys, - double l2HysThreshold = 0.2, - bool gammaCorrection = true, - int nlevels = DefaultNlevels) - { - ptr = NativeMethods.objdetect_HOGDescriptor_new2( - winSize.GetValueOrDefault(new Size(64, 128)), - blockSize.GetValueOrDefault(new Size(16, 16)), - blockStride.GetValueOrDefault(new Size(8, 8)), - cellSize.GetValueOrDefault(new Size(8, 8)), - nbins, - derivAperture, - winSigma, histogramNormType, - l2HysThreshold, - gammaCorrection ? 1 : 0, - nlevels); - } -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// - /// - /// -#endif - public HOGDescriptor(string fileName) - { - ptr = NativeMethods.objdetect_HOGDescriptor_new3(fileName); - } - -#if LANG_JP - /// - /// ポインタから初期化 - /// - /// class HOGDescriptor* -#else - /// - /// Initializes from pointer - /// - /// class HOGDescriptor* -#endif - public HOGDescriptor(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.objdetect_HOGDescriptor_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties - /// - /// - /// - public Size WinSize - { - get { return NativeMethods.objdetect_HOGDescriptor_winSize_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_winSize_set(ptr, value); } - } - /// - /// - /// - public Size BlockSize - { - get { return NativeMethods.objdetect_HOGDescriptor_blockSize_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_blockSize_set(ptr, value); } - } - /// - /// - /// - public Size BlockStride - { - get { return NativeMethods.objdetect_HOGDescriptor_blockStride_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_blockStride_set(ptr, value); } - } - /// - /// - /// - public Size CellSize - { - get { return NativeMethods.objdetect_HOGDescriptor_cellSize_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_cellSize_set(ptr, value); } - } - /// - /// - /// - public int Nbins - { - get { return NativeMethods.objdetect_HOGDescriptor_nbins_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_nbins_set(ptr, value); } - } - /// - /// - /// - public int DerivAperture - { - get { return NativeMethods.objdetect_HOGDescriptor_derivAperture_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_derivAperture_set(ptr, value); } - } - /// - /// - /// - public double WinSigma - { - get { return NativeMethods.objdetect_HOGDescriptor_winSigma_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_winSigma_set(ptr, value); } - } - /// - /// - /// - public HistogramNormType HistogramNormType - { - get { return (HistogramNormType)NativeMethods.objdetect_HOGDescriptor_histogramNormType_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_histogramNormType_set(ptr, (int)value); } - } - /// - /// - /// - public double L2HysThreshold - { - get { return NativeMethods.objdetect_HOGDescriptor_L2HysThreshold_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_L2HysThreshold_set(ptr, value); } - } - /// - /// - /// - public bool GammaCorrection - { - get { return NativeMethods.objdetect_HOGDescriptor_gammaCorrection_get(ptr) != 0; } - set { NativeMethods.objdetect_HOGDescriptor_gammaCorrection_set(ptr, value ? 1 : 0); } - } - /// - /// - /// - public int NLevels - { - get { return NativeMethods.objdetect_HOGDescriptor_nlevels_get(ptr); } - set { NativeMethods.objdetect_HOGDescriptor_nlevels_set(ptr, value); } - } - #endregion - - #region Methods -#if LANG_JP - /// - /// (デフォルトの窓サイズで)人検出用に学習された分類器の係数を返します. - /// - /// -#else - /// - /// Returns coefficients of the classifier trained for people detection (for default window size). - /// - /// -#endif - public static float[] GetDefaultPeopleDetector() - { - return DefaultPeopleDetector; - } - -#if LANG_JP - /// - /// - /// - /// -#else - /// - /// This method returns 1981 SVM coeffs obtained from daimler's base. - /// To use these coeffs the detection window size should be (48,96) - /// - /// -#endif - public static float[] GetDaimlerPeopleDetector() - { - return DaimlerPeopleDetector; - } - -#if LANG_JP - /// - /// 線形SVM分類器に,係数をセットします. - /// - /// -#else - /// - /// - /// - /// -#endif - public virtual void SetSVMDetector(float[] svmDetector) - { - ThrowIfDisposed(); - - using (var svmDetectorVec = new VectorOfFloat(svmDetector)) - { - NativeMethods.objdetect_HOGDescriptor_setSVMDetector(ptr, svmDetectorVec.CvPtr); - } - } - - /// - /// - /// - /// - /// - /// - public virtual bool Load(string fileName, string objName = null) - { - ThrowIfDisposed(); - return NativeMethods.objdetect_HOGDescriptor_load(ptr, fileName, objName); - } - - /// - /// - /// - /// - /// - public virtual void Save(string fileName, string objName = null) - { - ThrowIfDisposed(); - NativeMethods.objdetect_HOGDescriptor_save(ptr, fileName, objName); - } - - /// - /// - /// - /// - public int GetDescriptorSize() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_HOGDescriptor_getDescriptorSize(ptr).ToInt32(); - } - - /// - /// - /// - /// - public bool CheckDetectorSize() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_HOGDescriptor_checkDetectorSize(ptr) != 0; - } - - /// - /// - /// - /// - public double GetWinSigma() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_HOGDescriptor_getWinSigma(ptr); - } - - /// - /// - /// - /// - /// - /// - /// - /// - public virtual float[] Compute(Mat img, Size? winStride = null, Size? padding = null, Point[] locations = null) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - - Size winStride0 = winStride.GetValueOrDefault(new Size()); - Size padding0 = padding.GetValueOrDefault(new Size()); - using (var flVec = new VectorOfFloat()) - { - int length = locations?.Length ?? 0; - NativeMethods.objdetect_HOGDescriptor_compute(ptr, img.CvPtr, flVec.CvPtr, winStride0, padding0, locations, length); - return flVec.ToArray(); - } - } - - - /// - /// Performs object detection without a multi-scale window. - /// - /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. - /// Threshold for the distance between features and SVM classifying plane. - /// Usually it is 0 and should be specfied in the detector coefficients (as the last free coefficient). - /// But if the free coefficient is omitted (which is allowed), you can specify it manually here. - /// Window stride. It must be a multiple of block stride. - /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). - /// - /// Left-top corner points of detected objects boundaries. - public virtual Point[] Detect(Mat img, - double hitThreshold = 0, Size? winStride = null, Size? padding = null, Point[] searchLocations = null) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - - Size winStride0 = winStride.GetValueOrDefault(new Size()); - Size padding0 = padding.GetValueOrDefault(new Size()); - using (var flVec = new VectorOfPoint()) - { - int slLength = searchLocations?.Length ?? 0; - NativeMethods.objdetect_HOGDescriptor_detect1(ptr, img.CvPtr, flVec.CvPtr, - hitThreshold, winStride0, padding0, searchLocations, slLength); - GC.KeepAlive(img); - return flVec.ToArray(); - } - } - - /// - /// Performs object detection without a multi-scale window. - /// - /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. - /// - /// Threshold for the distance between features and SVM classifying plane. - /// Usually it is 0 and should be specfied in the detector coefficients (as the last free coefficient). - /// But if the free coefficient is omitted (which is allowed), you can specify it manually here. - /// Window stride. It must be a multiple of block stride. - /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). - /// - /// Left-top corner points of detected objects boundaries. - public virtual Point[] Detect(Mat img, out double[] weights, - double hitThreshold = 0, Size? winStride = null, Size? padding = null, Point[] searchLocations = null) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - - Size winStride0 = winStride.GetValueOrDefault(new Size()); - Size padding0 = padding.GetValueOrDefault(new Size()); - using (var flVec = new VectorOfPoint()) - using (var weightsVec = new VectorOfDouble()) - { - int slLength = searchLocations?.Length ?? 0; - NativeMethods.objdetect_HOGDescriptor_detect2(ptr, img.CvPtr, flVec.CvPtr, weightsVec.CvPtr, - hitThreshold, winStride0, padding0, searchLocations, slLength); - GC.KeepAlive(img); - weights = weightsVec.ToArray(); - return flVec.ToArray(); - } - } - - - /// - /// Performs object detection with a multi-scale window. - /// - /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. - /// Threshold for the distance between features and SVM classifying plane. - /// Window stride. It must be a multiple of block stride. - /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). - /// Coefficient of the detection window increase. - /// Coefficient to regulate the similarity threshold. - /// When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. - /// Detected objects boundaries. - public virtual Rect[] DetectMultiScale(Mat img, - double hitThreshold = 0, Size? winStride = null, Size? padding = null, double scale=1.05, int groupThreshold = 2) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - - Size winStride0 = winStride.GetValueOrDefault(new Size()); - Size padding0 = padding.GetValueOrDefault(new Size()); - using (var flVec = new VectorOfRect()) - { - NativeMethods.objdetect_HOGDescriptor_detectMultiScale1(ptr, img.CvPtr, flVec.CvPtr, - hitThreshold, winStride0, padding0, scale, groupThreshold); - GC.KeepAlive(img); - return flVec.ToArray(); - } - } - - /// - /// Performs object detection with a multi-scale window. - /// - /// Source image. CV_8UC1 and CV_8UC4 types are supported for now. - /// - /// Threshold for the distance between features and SVM classifying plane. - /// Window stride. It must be a multiple of block stride. - /// Mock parameter to keep the CPU interface compatibility. It must be (0,0). - /// Coefficient of the detection window increase. - /// Coefficient to regulate the similarity threshold. - /// When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. - /// Detected objects boundaries. - public virtual Rect[] DetectMultiScale(Mat img, out double[] foundWeights, - double hitThreshold = 0, Size? winStride = null, Size? padding = null, double scale = 1.05, int groupThreshold = 2) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - - Size winStride0 = winStride.GetValueOrDefault(new Size()); - Size padding0 = padding.GetValueOrDefault(new Size()); - using (var flVec = new VectorOfRect()) - using (var foundWeightsVec = new VectorOfDouble()) - { - NativeMethods.objdetect_HOGDescriptor_detectMultiScale2(ptr, img.CvPtr, flVec.CvPtr, foundWeightsVec.CvPtr, - hitThreshold, winStride0, padding0, scale, groupThreshold); - foundWeights = foundWeightsVec.ToArray(); - GC.KeepAlive(img); - return flVec.ToArray(); - } - } - - - /// - /// - /// - /// - /// - /// - /// - /// - public virtual void ComputeGradient(Mat img, Mat grad, Mat angleOfs, Size? paddingTL = null, Size? paddingBR = null) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (grad == null) - throw new ArgumentNullException(nameof(grad)); - if (angleOfs == null) - throw new ArgumentNullException(nameof(angleOfs)); - img.ThrowIfDisposed(); - grad.ThrowIfDisposed(); - angleOfs.ThrowIfDisposed(); - - Size paddingTL0 = paddingTL.GetValueOrDefault(new Size()); - Size paddingBR0 = paddingBR.GetValueOrDefault(new Size()); - NativeMethods.objdetect_HOGDescriptor_computeGradient(ptr, img.CvPtr, grad.CvPtr, angleOfs.CvPtr, paddingTL0, paddingBR0); - } - - - /// - /// evaluate specified ROI and return confidence value for each location - /// - /// - /// - /// - /// - /// - /// - /// - public void DetectROI( - Mat img, Point[] locations, out Point[] foundLocations, out double[] confidences, - double hitThreshold = 0, Size? winStride = null, Size? padding = null) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - if (locations == null) - throw new ArgumentNullException(nameof(locations)); - img.ThrowIfDisposed(); - - Size winStride0 = winStride.GetValueOrDefault(new Size()); - Size padding0 = padding.GetValueOrDefault(new Size()); - using (var flVec = new VectorOfPoint()) - using (var cVec = new VectorOfDouble()) - { - NativeMethods.objdetect_HOGDescriptor_detectROI(ptr, img.CvPtr, locations, locations.Length, - flVec.CvPtr, cVec.CvPtr, hitThreshold, winStride0, padding0); - foundLocations = flVec.ToArray(); - confidences = cVec.ToArray(); - } - } - - /// - /// evaluate specified ROI and return confidence value for each location in multiple scales - /// - /// - /// - /// - /// - /// - public void DetectMultiScaleROI( - Mat img, - out Rect[] foundLocations, - out DetectionROI[] locations, - double hitThreshold = 0, - int groupThreshold = 0) - { - ThrowIfDisposed(); - if (img == null) - throw new ArgumentNullException(nameof(img)); - img.ThrowIfDisposed(); - - using (var flVec = new VectorOfRect()) - using (var scalesVec = new VectorOfDouble()) - using (var locationsVec = new VectorOfVectorPoint()) - using (var confidencesVec = new VectorOfVectorDouble()) - { - NativeMethods.objdetect_HOGDescriptor_detectMultiScaleROI( - ptr, img.CvPtr, flVec.CvPtr, - scalesVec.CvPtr, locationsVec.CvPtr, confidencesVec.CvPtr, - hitThreshold, groupThreshold); - foundLocations = flVec.ToArray(); - - double[] s = scalesVec.ToArray(); - Point[][] l = locationsVec.ToArray(); - double[][] c = confidencesVec.ToArray(); - - if(s.Length != l.Length || l.Length != c.Length) - throw new OpenCvSharpException("Invalid result data 'locations'"); - locations = new DetectionROI[s.Length]; - for (int i = 0; i < s.Length; i++) - { - locations[i] = new DetectionROI - { - Scale = s[i], - Locations = l[i], - Confidences = c[i] - }; - } - } - } - - /// - /// read/parse Dalal's alt model file - /// - /// - public void ReadALTModel(string modelFile) - { - ThrowIfDisposed(); - NativeMethods.objdetect_HOGDescriptor_readALTModel(ptr, modelFile); - } - /// - /// - /// - /// - /// - /// - /// - public void GroupRectangles(out Rect[] rectList, out double[] weights, int groupThreshold, double eps) - { - ThrowIfDisposed(); - - using (var rectListVec = new VectorOfRect()) - using (var weightsVec = new VectorOfDouble()) - { - NativeMethods.objdetect_HOGDescriptor_groupRectangles( - ptr, rectListVec.CvPtr, weightsVec.CvPtr, groupThreshold, eps); - rectList = rectListVec.ToArray(); - weights = weightsVec.ToArray(); - } - } - - #endregion - } - - /// - /// struct for detection region of interest (ROI) - /// - public class DetectionROI - { - /// - /// scale(size) of the bounding box - /// - public double Scale { get; set; } - /// - /// set of requrested locations to be evaluated - /// - public Point[] Locations { get; set; } - /// - /// vector that will contain confidence values for each location - /// - public double[] Confidences { get; set; } - } -} diff --git a/src/OpenCvSharp/modules/objdetect/HistogramNormType.cs b/src/OpenCvSharp/modules/objdetect/HistogramNormType.cs deleted file mode 100644 index b82881b40..000000000 --- a/src/OpenCvSharp/modules/objdetect/HistogramNormType.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - -#if LANG_JP - /// - /// - /// -#else - /// - /// - /// -#endif - public enum HistogramNormType : int - { -#if LANG_JP - /// - /// - /// [HOGDescriptor::L2Hys] - /// -#else - /// - /// - /// [HOGDescriptor::L2Hys] - /// -#endif - L2Hys = HOGDescriptor.L2Hys, - } -} - - diff --git a/src/OpenCvSharp/modules/objdetect/LatendSvmDetector.cs b/src/OpenCvSharp/modules/objdetect/LatendSvmDetector.cs deleted file mode 100644 index 2e06cfaaa..000000000 --- a/src/OpenCvSharp/modules/objdetect/LatendSvmDetector.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - /// - /// Find rectangular regions in the given image that are likely - /// to contain objects and corresponding confidence levels - /// - public class LatentSvmDetector : DisposableCvObject - { - /// - /// Structure contains the detection information. - /// - public class ObjectDetection - { - /// - /// - /// - /// - /// - /// - public ObjectDetection(Rect? rect = null, float score = 0, int classId = -1) - { - Rect = rect.GetValueOrDefault(new Rect()); - Score = score; - ClassId = classId; - } - - /// - /// bounding box for a detected object - /// - public Rect Rect { get; set; } - /// - /// confidence level - /// - public float Score { get; set; } - /// - /// class (model or detector) ID that detect an object - /// - public int ClassId { get; set; } - } - - #region Init and Disposal - - /// - /// Default constructor - /// - public LatentSvmDetector() - { - ptr = NativeMethods.objdetect_LatentSvmDetector_new(); - } - - /// - /// Creates the HOG descriptor and detector. - /// - /// A set of filenames storing the trained detectors (models). Each file contains one model. - /// See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/. - /// A set of trained models names. If it’s empty then the name of each model will be - /// constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat". - public LatentSvmDetector(IEnumerable fileNames, IEnumerable classNames) - : this() - { - Load(fileNames, classNames); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.objdetect_LatentSvmDetector_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Methods - - /// - /// Clear all trained models and their names stored in an class object. - /// - public virtual void Clear() - { - ThrowIfDisposed(); - NativeMethods.objdetect_LatentSvmDetector_clear(ptr); - } - /// - /// - /// - public virtual bool Empty() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_LatentSvmDetector_empty(ptr) != 0; - } - /// - /// - /// - /// A set of filenames storing the trained detectors (models). Each file contains one model. - /// See examples of such files here /opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/. - /// A set of trained models names. If it’s empty then the name of each model will be - /// constructed from the name of file containing the model. E.g. the model stored in "/home/user/cat.xml" will get the name "cat". - public virtual bool Load(IEnumerable fileNames, IEnumerable classNames) - { - ThrowIfDisposed(); - if (fileNames == null) - throw new ArgumentNullException(nameof(fileNames)); - if (classNames == null) - throw new ArgumentNullException(nameof(classNames)); - - using (var fn = new StringArrayAddress(fileNames)) - using (var cn = new StringArrayAddress(classNames)) - { - return NativeMethods.objdetect_LatentSvmDetector_load( - ptr, fn.Pointer, fn.Dim1Length, cn.Pointer, cn.Dim1Length) != 0; - } - } - - /// - /// Find rectangular regions in the given image that are likely to contain objects of - /// loaded classes (models) and corresponding confidence levels. - /// - /// An image. - /// Threshold for the non-maximum suppression algorithm. - /// Number of threads used in parallel version of the algorithm. - /// The detections: rectangulars, scores and class IDs. - public virtual ObjectDetection[] Detect(Mat image, - float overlapThreshold = 0.5f, int numThreads = -1) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - using (var odVec = new VectorOfVec6d()) - { - NativeMethods.objdetect_LatentSvmDetector_detect( - ptr, image.CvPtr, odVec.CvPtr, overlapThreshold, numThreads); - - return EnumerableEx.SelectToArray(odVec.ToArray(), v => - new ObjectDetection - { - Rect = new Rect((int)v.Item0, (int)v.Item1, (int)v.Item2, (int)v.Item3), - Score = (float)v.Item4, - ClassId = (int)v.Item5 - } - ); - } - } - - /// - /// Return the class (model) names that were passed in constructor or method load or extracted from models filenames in those methods. - /// - /// - public string[] GetClassNames() - { - using (var outVec = new VectorOfString()) - { - NativeMethods.objdetect_LatentSvmDetector_getClassNames(ptr, outVec.CvPtr); - return outVec.ToArray(); - } - } - - /// - /// Return a count of loaded models (classes). - /// - /// - public long GetClassCount() - { - ThrowIfDisposed(); - return NativeMethods.objdetect_LatentSvmDetector_getClassCount(ptr).ToInt64(); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/objdetect/SimilarRects.cs b/src/OpenCvSharp/modules/objdetect/SimilarRects.cs deleted file mode 100644 index 36047683e..000000000 --- a/src/OpenCvSharp/modules/objdetect/SimilarRects.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -// ReSharper disable InconsistentNaming - -namespace OpenCvSharp -{ - /// - /// Class for grouping object candidates, detected by Cascade Classifier, HOG etc. - /// instance of the class is to be passed to cv::partition (see cxoperations.hpp) - /// - public static class SimilarRects - { - /// - /// - /// - /// - /// - /// - /// - public static bool Compare(double eps, Rect r1, Rect r2) - { - double delta = eps * (Math.Min(r1.Width, r2.Width) + Math.Min(r1.Height, r2.Height)) * 0.5; - return Math.Abs(r1.X - r2.X) <= delta && - Math.Abs(r1.Y - r2.Y) <= delta && - Math.Abs(r1.X + r1.Width - r2.X - r2.Width) <= delta && - Math.Abs(r1.Y + r1.Height - r2.Y - r2.Height) <= delta; - } - } - -} diff --git a/src/OpenCvSharp/modules/photo/CalibrateCRF.cs b/src/OpenCvSharp/modules/photo/CalibrateCRF.cs deleted file mode 100644 index c49ee75bc..000000000 --- a/src/OpenCvSharp/modules/photo/CalibrateCRF.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ - /// - /// The base class for camera response calibration algorithms. - /// - public abstract class CalibrateCRF : Algorithm - { - /// - /// Recovers inverse camera response. - /// - /// vector of input images - /// 256x1 matrix with inverse camera response function - /// vector of exposure time values for each image - public virtual void Process(IEnumerable src, OutputArray dst, IEnumerable times) - { - if (src == null) - throw new ArgumentNullException(nameof(src)); - if (dst == null) - throw new ArgumentNullException(nameof(dst)); - if (times == null) - throw new ArgumentNullException(nameof(times)); - dst.ThrowIfNotReady(); - - IntPtr[] srcArray = EnumerableEx.SelectPtrs(src); - float[] timesArray = EnumerableEx.ToArray(times); - if (srcArray.Length != timesArray.Length) - throw new OpenCvSharpException("src.Count() != times.Count"); - - NativeMethods.photo_CalibrateCRF_process(ptr, srcArray, srcArray.Length, dst.CvPtr, timesArray); - - dst.Fix(); - GC.KeepAlive(src); - } - } -} diff --git a/src/OpenCvSharp/modules/photo/CalibrateDebevec.cs b/src/OpenCvSharp/modules/photo/CalibrateDebevec.cs deleted file mode 100644 index 88e60d039..000000000 --- a/src/OpenCvSharp/modules/photo/CalibrateDebevec.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// The base class for camera response calibration algorithms. - /// - public class CalibrateDebevec : CalibrateCRF - { - private Ptr ptrObj; - - /// - /// Creates instance by raw pointer cv::ml::Boost* - /// - protected CalibrateDebevec(IntPtr p) - : base() - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates the empty model. - /// - /// number of pixel locations to use - /// smoothness term weight. Greater values produce smoother results, - /// but can alter the response. - /// if true sample pixel locations are chosen at random, - /// otherwise the form a rectangular grid. - /// - public static CalibrateDebevec Create(int samples = 70, float lambda = 10.0f, bool random = false) - { - IntPtr ptr = NativeMethods.photo_createCalibrateDebevec(samples, lambda, random ? 1 : 0); - return new CalibrateDebevec(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.photo_Ptr_CalibrateDebevec_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.photo_Ptr_CalibrateDebevec_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/photo/EdgePreservingMethods.cs b/src/OpenCvSharp/modules/photo/EdgePreservingMethods.cs deleted file mode 100644 index 20800f79b..000000000 --- a/src/OpenCvSharp/modules/photo/EdgePreservingMethods.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// Edge preserving filters - /// - public enum EdgePreservingMethods - { - /// - /// - /// - RecursFilter = 1, - - /// - /// - /// - NormconvFilter = 2 - } -} diff --git a/src/OpenCvSharp/modules/photo/InpaintMethod.cs b/src/OpenCvSharp/modules/photo/InpaintMethod.cs deleted file mode 100644 index 7e27e1cbd..000000000 --- a/src/OpenCvSharp/modules/photo/InpaintMethod.cs +++ /dev/null @@ -1,43 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvInpaintの修復方法 - /// -#else - /// - /// The inpainting method - /// -#endif - public enum InpaintMethod - { -#if LANG_JP - /// - /// ナビエ・ストークス(Navier-Stokes)ベースの手法 - /// [CV_INPAINT_NS] - /// -#else - /// - /// Navier-Stokes based method. - /// [CV_INPAINT_NS] - /// -#endif -// ReSharper disable once InconsistentNaming - NS = 0, - - -#if LANG_JP - /// - /// Alexandru Teleaによる手法 - /// [CV_INPAINT_TELEA] - /// -#else - /// - /// The method by Alexandru Telea - /// [CV_INPAINT_TELEA] - /// -#endif - Telea = 1, - } -} diff --git a/src/OpenCvSharp/modules/photo/SeamlessCloneMethods.cs b/src/OpenCvSharp/modules/photo/SeamlessCloneMethods.cs deleted file mode 100644 index 2257eefa1..000000000 --- a/src/OpenCvSharp/modules/photo/SeamlessCloneMethods.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace OpenCvSharp -{ - /// - /// SeamlessClone method - /// - public enum SeamlessCloneMethods - { - /// - /// The power of the method is fully expressed when inserting objects with - /// complex outlines into a new background. - /// - NormalClone = 1, - - /// - /// The classic method, color-based selection and alpha masking might be time - /// consuming and often leaves an undesirable halo. Seamless cloning, even averaged - /// with the original image, is not effective. Mixed seamless cloning based on a - /// loose selection proves effective. - /// - MixedClone = 2, - - /// - /// Feature exchange allows the user to easily replace certain features of one - /// object by alternative features. - /// - MonochromeTransfer = 3 - } -} diff --git a/src/OpenCvSharp/modules/shape/HausdorffDistanceExtractor.cs b/src/OpenCvSharp/modules/shape/HausdorffDistanceExtractor.cs deleted file mode 100644 index 00ce08ced..000000000 --- a/src/OpenCvSharp/modules/shape/HausdorffDistanceExtractor.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// A simple Hausdorff distance measure between shapes defined by contours - /// - /// - /// according to the paper "Comparing Images using the Hausdorff distance." - /// by D.P. Huttenlocher, G.A. Klanderman, and W.J. Rucklidge. (PAMI 1993). : - /// - public class HausdorffDistanceExtractor : ShapeDistanceExtractor - { - private Ptr ptrObj; - - #region Init & Disposal - - /// - /// - /// - protected HausdorffDistanceExtractor(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Complete constructor - /// - /// Flag indicating which norm is used to compute the Hausdorff distance (NORM_L1, NORM_L2). - /// fractional value (between 0 and 1). - /// - public static HausdorffDistanceExtractor Create( - DistanceTypes distanceFlag = DistanceTypes.L2, float rankProp = 0.6f) - { - IntPtr ptr = NativeMethods.shape_createHausdorffDistanceExtractor( - (int)distanceFlag, rankProp); - return new HausdorffDistanceExtractor(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Flag indicating which norm is used to compute the Hausdorff distance (NORM_L1, NORM_L2). - /// - public DistanceTypes DistanceFlag - { - get - { - ThrowIfDisposed(); - return (DistanceTypes)NativeMethods.shape_HausdorffDistanceExtractor_getDistanceFlag(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_HausdorffDistanceExtractor_setDistanceFlag(ptr, (int)value); - } - } - - /// - /// fractional value (between 0 and 1). - /// - public float RankProportion - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_HausdorffDistanceExtractor_getRankProportion(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_HausdorffDistanceExtractor_setRankProportion(ptr, value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.shape_Ptr_HausdorffDistanceExtractor_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.shape_Ptr_HausdorffDistanceExtractor_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/shape/ShapeContextDistanceExtractor.cs b/src/OpenCvSharp/modules/shape/ShapeContextDistanceExtractor.cs deleted file mode 100644 index 5131079ef..000000000 --- a/src/OpenCvSharp/modules/shape/ShapeContextDistanceExtractor.cs +++ /dev/null @@ -1,296 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Implementation of the Shape Context descriptor and matching algorithm - /// - /// - /// proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" - /// (PAMI2002). This implementation is packaged in a generic scheme, in order to allow - /// you the implementation of the common variations of the original pipeline. - /// - public class ShapeContextDistanceExtractor : ShapeDistanceExtractor - { - private Ptr ptrObj; - - #region Init & Disposal - - /// - /// - /// - protected ShapeContextDistanceExtractor(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Complete constructor - /// - /// The number of angular bins in the shape context descriptor. - /// The number of radial bins in the shape context descriptor. - /// The value of the inner radius. - /// The value of the outer radius. - /// - /// - public static ShapeContextDistanceExtractor Create( - int nAngularBins = 12, int nRadialBins = 4, float innerRadius = 0.2f, - float outerRadius = 2, int iterations = 3) - { - IntPtr ptr = NativeMethods.shape_createShapeContextDistanceExtractor( - nAngularBins, nRadialBins, innerRadius, outerRadius, iterations); - return new ShapeContextDistanceExtractor(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// The number of angular bins in the shape context descriptor. - /// - public int AngularBins - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getAngularBins(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setAngularBins(ptr, value); - } - } - - /// - /// The number of radial bins in the shape context descriptor. - /// - public int RadialBins - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getRadialBins(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setRadialBins(ptr, value); - } - } - - /// - /// The value of the inner radius. - /// - public float InnerRadius - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getInnerRadius(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setInnerRadius(ptr, value); - } - } - - /// - /// The value of the outer radius. - /// - public float OuterRadius - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getOuterRadius(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setOuterRadius(ptr, value); - } - } - - /// - /// - /// - public bool RotationInvariant - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getRotationInvariant(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setRotationInvariant(ptr, value ? 1 : 0); - } - } - - /// - /// The weight of the shape context distance in the final distance value. - /// - public float ShapeContextWeight - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getShapeContextWeight(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setShapeContextWeight(ptr, value); - } - } - - /// - /// The weight of the appearance cost in the final distance value. - /// - public float ImageAppearanceWeight - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getImageAppearanceWeight(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setImageAppearanceWeight(ptr, value); - } - } - - /// - /// The weight of the Bending Energy in the final distance value. - /// - public float BendingEnergyWeight - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getBendingEnergyWeight(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setBendingEnergyWeight(ptr, value); - } - } - - /// - /// - /// - public int Iterations - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getIterations(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setIterations(ptr, value); - } - } - - /// - /// The value of the standard deviation for the Gaussian window for the image appearance cost. - /// - public float StdDev - { - get - { - ThrowIfDisposed(); - return NativeMethods.shape_ShapeContextDistanceExtractor_getStdDev(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setStdDev(ptr, value); - } - } - - #endregion - - #region Methods - - /// - /// Set the images that correspond to each shape. - /// This images are used in the calculation of the Image Appearance cost. - /// - /// Image corresponding to the shape defined by contours1. - /// Image corresponding to the shape defined by contours2. - public void SetImages(InputArray image1, InputArray image2) - { - ThrowIfDisposed(); - if (image1 == null) - throw new ArgumentNullException(nameof(image1)); - if (image2 == null) - throw new ArgumentNullException(nameof(image2)); - image1.ThrowIfDisposed(); - image2.ThrowIfDisposed(); - NativeMethods.shape_ShapeContextDistanceExtractor_setImages(ptr, image1.CvPtr, image2.CvPtr); - GC.KeepAlive(image1); - GC.KeepAlive(image2); - } - - /// - /// Get the images that correspond to each shape. - /// This images are used in the calculation of the Image Appearance cost. - /// - /// Image corresponding to the shape defined by contours1. - /// Image corresponding to the shape defined by contours2. - public void GetImages(OutputArray image1, OutputArray image2) - { - ThrowIfDisposed(); - if (image1 == null) - throw new ArgumentNullException(nameof(image1)); - if (image2 == null) - throw new ArgumentNullException(nameof(image2)); - image1.ThrowIfNotReady(); - image2.ThrowIfNotReady(); - NativeMethods.shape_ShapeContextDistanceExtractor_getImages(ptr, image1.CvPtr, image2.CvPtr); - image1.Fix(); - image2.Fix(); - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.shape_Ptr_HausdorffDistanceExtractor_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.shape_Ptr_ShapeContextDistanceExtractor_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/shape/ShapeDistanceExtractor.cs b/src/OpenCvSharp/modules/shape/ShapeDistanceExtractor.cs deleted file mode 100644 index 49a32bb70..000000000 --- a/src/OpenCvSharp/modules/shape/ShapeDistanceExtractor.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable once InconsistentNaming - - /// - /// Abstract base class for shape distance algorithms. - /// - public abstract class ShapeDistanceExtractor : Algorithm - { - /// - /// Compute the shape distance between two shapes defined by its contours. - /// - /// Contour defining first shape. - /// Contour defining second shape. - /// - public virtual float ComputeDistance(InputArray contour1, InputArray contour2) - { - if (ptr == IntPtr.Zero) - throw new ObjectDisposedException(GetType().Name); - if (contour1 == null) - throw new ArgumentNullException(nameof(contour1)); - if (contour2 == null) - throw new ArgumentNullException(nameof(contour2)); - contour1.ThrowIfDisposed(); - contour2.ThrowIfDisposed(); - - float ret = NativeMethods.shape_ShapeDistanceExtractor_computeDistance( - ptr, contour1.CvPtr, contour2.CvPtr); - - GC.KeepAlive(contour1); - GC.KeepAlive(contour2); - - return ret; - } - } -} diff --git a/src/OpenCvSharp/modules/stitching/Stitcher.cs b/src/OpenCvSharp/modules/stitching/Stitcher.cs deleted file mode 100644 index 5d40a0d0c..000000000 --- a/src/OpenCvSharp/modules/stitching/Stitcher.cs +++ /dev/null @@ -1,462 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using OpenCvSharp.Detail; -using OpenCvSharp.Util; - -namespace OpenCvSharp -{ -#pragma warning disable 1591 - // ReSharper disable InconsistentNaming - - // TODO - namespace Detail - { - public enum WaveCorrectKind - { - Horizontal, - Vertical - } - - public class FeaturesFinder - { - } - - public class FeaturesMatcher - { - } - - public class BundleAdjusterBase - { - } - - public class WarperCreator - { - } - - public class ExposureCompensator - { - } - - public class SeamFinder - { - } - - public class Blender - { - } - - public class CameraParams - { - } - } - - /// - /// High level image stitcher. - /// It's possible to use this class without being aware of the entire stitching - /// pipeline. However, to be able to achieve higher stitching stability and - /// quality of the final images at least being familiar with the theory is recommended - /// - public sealed class Stitcher : DisposableCvObject - { - private Ptr ptrObj; - - #region Enum - - public const int ORIG_RESOL = -1; - - /// - /// Status code - /// - public enum Status - { - OK, - ErrorNeedMoreImgs, - } - - - #endregion - - #region Init & Disposal - - /// - /// Constructor - /// - /// cv::Stitcher* - private Stitcher(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Creates a stitcher with the default parameters. - /// - /// Flag indicating whether GPU should be used - /// whenever it's possible. - public static Stitcher Create(bool tryUseGpu = false) - { - IntPtr p = NativeMethods.stitching_createStitcher(tryUseGpu ? 1 : 0); - return new Stitcher(p); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - public double RegistrationResol - { - get { return NativeMethods.stitching_Stitcher_registrationResol(ptr); } - set { NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, value); } - } - - public double SeamEstimationResol - { - get { return NativeMethods.stitching_Stitcher_seamEstimationResol(ptr); } - set { NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, value); } - } - - public double CompositingResol - { - get { return NativeMethods.stitching_Stitcher_compositingResol(ptr); } - set { NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, value); } - } - - public double PanoConfidenceThresh - { - get { return NativeMethods.stitching_Stitcher_panoConfidenceThresh(ptr); } - set { NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, value); } - } - - public bool WaveCorrection - { - get { return NativeMethods.stitching_Stitcher_waveCorrection(ptr) != 0; } - set { NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, value ? 1 : 0); } - } - - public WaveCorrectKind WaveCorrectKind - { - get { return (WaveCorrectKind)NativeMethods.stitching_Stitcher_waveCorrectKind(ptr); } - set { NativeMethods.stitching_Stitcher_setRegistrationResol(ptr, (int)value); } - } - - public FeaturesFinder FeaturesFinder - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - - public FeaturesMatcher FeaturesMatcher - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public Mat MatchingMask - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public BundleAdjusterBase BundleAdjuster - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public WarperCreator Warper - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public ExposureCompensator ExposureCompensator - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public SeamFinder SeamFinder - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public Blender Blender - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public int[] Component - { - get - { - IntPtr pointer; - int length; - NativeMethods.stitching_Stitcher_component(ptr, out pointer, out length); - - int[] ret = new int[length]; - Marshal.Copy(pointer, ret, 0, length); - return ret; - } - } - - public CameraParams[] Cameras - { - get { throw new NotImplementedException(); } - } - - public double WorkScale - { - get { return NativeMethods.stitching_Stitcher_workScale(ptr); } - } - - #endregion - - #region Methods - - public Status EstimateTransform(InputArray images) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - images.ThrowIfDisposed(); - - int status = NativeMethods.stitching_Stitcher_estimateTransform_InputArray1( - ptr, images.CvPtr); - return (Status)status; - } - - public Status EstimateTransform(InputArray images, Rect[][] rois) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (rois == null) - throw new ArgumentNullException(nameof(rois)); - images.ThrowIfDisposed(); - - using (var roisPointer = new ArrayAddress2(rois)) - { - int status = NativeMethods.stitching_Stitcher_estimateTransform_InputArray2( - ptr, images.CvPtr, - roisPointer.Pointer, roisPointer.Dim1Length, roisPointer.Dim2Lengths); - return (Status)status; - } - } - - public Status EstimateTransform(IEnumerable images) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - - IntPtr[] imagesPtrs = EnumerableEx.SelectPtrs(images); - - int status = NativeMethods.stitching_Stitcher_estimateTransform_MatArray1( - ptr, imagesPtrs, imagesPtrs.Length); - - GC.KeepAlive(imagesPtrs); - return (Status)status; - } - - public Status EstimateTransform(IEnumerable images, Rect[][] rois) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (rois == null) - throw new ArgumentNullException(nameof(rois)); - - IntPtr[] imagesPtrs = EnumerableEx.SelectPtrs(images); - - using (var roisPointer = new ArrayAddress2(rois)) - { - int status = NativeMethods.stitching_Stitcher_estimateTransform_MatArray2( - ptr, imagesPtrs, imagesPtrs.Length, - roisPointer.Pointer, roisPointer.Dim1Length, roisPointer.Dim2Lengths); - - GC.KeepAlive(imagesPtrs); - return (Status)status; - } - } - - public Status ComposePanorama(OutputArray pano) - { - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - pano.ThrowIfNotReady(); - - int status = NativeMethods.stitching_Stitcher_composePanorama1( - ptr, pano.CvPtr); - pano.Fix(); - return (Status)status; - } - - public Status ComposePanorama(InputArray images, OutputArray pano) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - images.ThrowIfDisposed(); - pano.ThrowIfNotReady(); - - int status = NativeMethods.stitching_Stitcher_composePanorama2_InputArray( - ptr, images.CvPtr, pano.CvPtr); - pano.Fix(); - return (Status)status; - } - - public Status ComposePanorama(IEnumerable images, OutputArray pano) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - pano.ThrowIfNotReady(); - - IntPtr[] imagesPtrs = EnumerableEx.SelectPtrs(images); - int status = NativeMethods.stitching_Stitcher_composePanorama2_MatArray( - ptr, imagesPtrs, imagesPtrs.Length, pano.CvPtr); - pano.Fix(); - GC.KeepAlive(imagesPtrs); - return (Status)status; - } - - /// - /// Try to stitch the given images. - /// - /// Input images. - /// Final pano. - /// Status code. - public Status Stitch(InputArray images, OutputArray pano) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - images.ThrowIfDisposed(); - pano.ThrowIfNotReady(); - - Status status = (Status)NativeMethods.stitching_Stitcher_stitch1_InputArray( - ptr, images.CvPtr, pano.CvPtr); - - pano.Fix(); - - return status; - } - - /// - /// Try to stitch the given images. - /// - /// Input images. - /// Final pano. - /// Status code. - public Status Stitch(IEnumerable images, OutputArray pano) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - pano.ThrowIfNotReady(); - - IntPtr[] imagesPtrs = EnumerableEx.SelectPtrs(images); - - Status status = (Status)NativeMethods.stitching_Stitcher_stitch1_MatArray( - ptr, imagesPtrs, imagesPtrs.Length, pano.CvPtr); - - GC.KeepAlive(imagesPtrs); - pano.Fix(); - - return status; - } - - /// - /// Try to stitch the given images. - /// - /// Input images. - /// Region of interest rectangles. - /// Final pano. - /// Status code. - public Status Stitch(InputArray images, Rect[][] rois, OutputArray pano) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (rois == null) - throw new ArgumentNullException(nameof(rois)); - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - images.ThrowIfDisposed(); - pano.ThrowIfNotReady(); - - using (var roisPointer = new ArrayAddress2(rois)) - { - int status = NativeMethods.stitching_Stitcher_stitch2_InputArray( - ptr, images.CvPtr, - roisPointer.Pointer, roisPointer.Dim1Length, roisPointer.Dim2Lengths, - pano.CvPtr); - pano.Fix(); - return (Status)status; - } - } - - /// - /// Try to stitch the given images. - /// - /// Input images. - /// Region of interest rectangles. - /// Final pano. - /// Status code. - public Status Stitch(IEnumerable images, Rect[][] rois, OutputArray pano) - { - if (images == null) - throw new ArgumentNullException(nameof(images)); - if (rois == null) - throw new ArgumentNullException(nameof(rois)); - if (pano == null) - throw new ArgumentNullException(nameof(pano)); - pano.ThrowIfNotReady(); - - IntPtr[] imagesPtrs = EnumerableEx.SelectPtrs(images); - - using (var roisPointer = new ArrayAddress2(rois)) - { - int status = NativeMethods.stitching_Stitcher_stitch2_MatArray( - ptr, imagesPtrs, imagesPtrs.Length, - roisPointer.Pointer, roisPointer.Dim1Length, roisPointer.Dim2Lengths, - pano.CvPtr); - pano.Fix(); - return (Status)status; - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.stitching_Ptr_Stitcher_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.stitching_Ptr_Stitcher_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/superres/DenseOpticalFlowExt.cs b/src/OpenCvSharp/modules/superres/DenseOpticalFlowExt.cs deleted file mode 100644 index 57881cd49..000000000 --- a/src/OpenCvSharp/modules/superres/DenseOpticalFlowExt.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// - /// - public abstract class DenseOpticalFlowExt : Algorithm - { - #region Init & Disposal - - /// - /// - /// - protected DenseOpticalFlowExt() - { - } - - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateFarneback() - { - IntPtr ptr = NativeMethods.superres_createOptFlow_Farneback(); - return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateFarneback_CUDA() - { - IntPtr ptr = NativeMethods.superres_createOptFlow_Farneback_CUDA(); - return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateFarneback_OCL() - { - throw new NotImplementedException(); - //IntPtr ptr = NativeMethods.superres_createOptFlow_Farneback_OCL(); - //return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateSimple() - { - throw new NotImplementedException(); - //IntPtr ptr = NativeMethods.superres_createOptFlow_Simple(); - //return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateDualTVL1() - { - IntPtr ptr = NativeMethods.superres_createOptFlow_Farneback(); - return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateDualTVL1_CUDA() - { - IntPtr ptr = NativeMethods.superres_createOptFlow_Farneback_CUDA(); - return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateDualTVL1_OCL() - { - throw new NotImplementedException(); - //IntPtr ptr = NativeMethods.superres_createOptFlow_Farneback_OCL(); - //return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - public static DenseOpticalFlowExt CreateBrox_CUDA() - { - IntPtr ptr = NativeMethods.superres_createOptFlow_Brox_CUDA(); - return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - public static DenseOpticalFlowExt CreatePyrLK_CUDA() - { - IntPtr ptr = NativeMethods.superres_createOptFlow_PyrLK_CUDA(); - return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - public static DenseOpticalFlowExt CreatePyrLK_OCL() - { - throw new NotImplementedException(); - //IntPtr ptr = NativeMethods.superres_createOptFlow_PyrLK_OCL(); - //return DenseOpticalFlowExtImpl.FromPtr(ptr); - } - - #endregion - - /// - /// Clear all inner buffers. - /// - public virtual void CollectGarbage() - { - } - - /// - /// - /// - /// - /// - /// - /// - public abstract void Calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = null); - } -} diff --git a/src/OpenCvSharp/modules/superres/DenseOpticalFlowExtImpl.cs b/src/OpenCvSharp/modules/superres/DenseOpticalFlowExtImpl.cs deleted file mode 100644 index e50c3abd2..000000000 --- a/src/OpenCvSharp/modules/superres/DenseOpticalFlowExtImpl.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// - /// - internal sealed class DenseOpticalFlowExtImpl : DenseOpticalFlowExt - { - /// - /// - /// - private Ptr detectorPtr; - - #region Init & Disposal - - /// - /// - /// - private DenseOpticalFlowExtImpl() - { - detectorPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static DenseOpticalFlowExtImpl FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid DenseOpticalFlowExt pointer"); - - var ptrObj = new Ptr(ptr); - var obj = new DenseOpticalFlowExtImpl - { - detectorPtr = ptrObj, - ptr = ptrObj.Get() - }; - return obj; - } - - /// - /// Creates instance from raw pointer T* - /// - /// - internal static DenseOpticalFlowExtImpl FromRawPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid DenseOpticalFlowExt pointer"); - var obj = new DenseOpticalFlowExtImpl - { - detectorPtr = null, - ptr = ptr - }; - return obj; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - /// - /// - /// - public override void Calc( - InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = null) - { - if (frame0 == null) - throw new ArgumentNullException(nameof(frame0)); - if (frame1 == null) - throw new ArgumentNullException(nameof(frame1)); - if (flow1 == null) - throw new ArgumentNullException(nameof(flow1)); - frame0.ThrowIfDisposed(); - frame1.ThrowIfDisposed(); - flow1.ThrowIfNotReady(); - if (flow2 != null) - flow2.ThrowIfNotReady(); - - NativeMethods.superres_DenseOpticalFlowExt_calc( - ptr, frame0.CvPtr, frame1.CvPtr, flow1.CvPtr, Cv2.ToPtr(flow2)); - - flow1.Fix(); - if (flow2 != null) - flow2.Fix(); - } - - /// - /// - /// - public override void CollectGarbage() - { - NativeMethods.superres_DenseOpticalFlowExt_collectGarbage(ptr); - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.superres_Ptr_DenseOpticalFlowExt_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.superres_Ptr_DenseOpticalFlowExt_delete(ptr); - base.Dispose(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/superres/FrameSource.cs b/src/OpenCvSharp/modules/superres/FrameSource.cs deleted file mode 100644 index 0ab0b3d68..000000000 --- a/src/OpenCvSharp/modules/superres/FrameSource.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.IO; - -namespace OpenCvSharp -{ - /// - /// - /// - public abstract class FrameSource : DisposableCvObject - { - #region Init & Disposal - - /// - /// - /// - protected FrameSource() - { - } - - /// - /// - /// - /// - public static FrameSource CreateEmptySource() - { - IntPtr ptr = NativeMethods.superres_createFrameSource_Empty(); - return FrameSourceImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - /// - public static FrameSource CreateVideoSource(string fileName) - { - if (String.IsNullOrEmpty("fileName")) - throw new ArgumentNullException(nameof(fileName)); -#if !uwp - if (!File.Exists(fileName)) - throw new FileNotFoundException("", fileName); -#endif - IntPtr ptr = NativeMethods.superres_createFrameSource_Video(fileName); - return FrameSourceImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - /// - public static FrameSource CreateVideoSourceCuda(string fileName) - { - if (String.IsNullOrEmpty("fileName")) - throw new ArgumentNullException(nameof(fileName)); -#if !uwp - if (!File.Exists(fileName)) - throw new FileNotFoundException("", fileName); -#endif - IntPtr ptr = NativeMethods.superres_createFrameSource_Video_CUDA(fileName); - return FrameSourceImpl.FromPtr(ptr); - } - - /// - /// - /// - /// - /// - public static FrameSource CreateCameraSource(int deviceId) - { - IntPtr ptr = NativeMethods.superres_createFrameSource_Camera(deviceId); - return FrameSourceImpl.FromPtr(ptr); - } - -#endregion - -#region Methods - - /// - /// - /// - /// - public abstract void NextFrame(OutputArray frame); - - /// - /// - /// - public abstract void Reset(); - -#endregion - } -} diff --git a/src/OpenCvSharp/modules/superres/FrameSourceImpl.cs b/src/OpenCvSharp/modules/superres/FrameSourceImpl.cs deleted file mode 100644 index 60d8763de..000000000 --- a/src/OpenCvSharp/modules/superres/FrameSourceImpl.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// - /// - internal sealed class FrameSourceImpl : FrameSource - { - private Ptr ptrObj; - - #region Init & Disposal - - /// - /// - /// - private FrameSourceImpl() - { - ptrObj = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static FrameSource FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid FrameSource pointer"); - var obj = new FrameSourceImpl(); - var ptrObj = new Ptr(ptr); - obj.ptrObj = ptrObj; - obj.ptr = ptr; - return obj; - } - - /// - /// Creates instance from raw pointer T* - /// - /// - internal static FrameSource FromRawPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid FrameSource pointer"); - var obj = new FrameSourceImpl - { - ptrObj = null, - ptr = ptr - }; - return obj; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - public override void NextFrame(OutputArray frame) - { - ThrowIfDisposed(); - if (frame == null) - throw new ArgumentNullException(nameof(frame)); - frame.ThrowIfNotReady(); - NativeMethods.superres_FrameSource_nextFrame(ptr, frame.CvPtr); - frame.Fix(); - } - /// - /// - /// - public override void Reset() - { - ThrowIfDisposed(); - NativeMethods.superres_FrameSource_reset(ptr); - } - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.superres_Ptr_FrameSource_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.superres_Ptr_FrameSource_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/superres/SuperResolution.cs b/src/OpenCvSharp/modules/superres/SuperResolution.cs deleted file mode 100644 index 324aa6b3f..000000000 --- a/src/OpenCvSharp/modules/superres/SuperResolution.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// Base class for Super Resolution algorithms. - /// - public abstract class SuperResolution : Algorithm - { - /// - /// - /// - protected FrameSource frameSource; - /// - /// - /// - protected bool firstCall; - - #region Init & Disposal - - /// - /// - /// - protected SuperResolution() - { - frameSource = null; - firstCall = true; - } - - /// - /// Create Bilateral TV-L1 Super Resolution. - /// - /// - public static SuperResolution CreateBTVL1() - { - IntPtr ptr = NativeMethods.superres_createSuperResolution_BTVL1(); - return SuperResolutionImpl.FromPtr(ptr); - } - /// - /// Create Bilateral TV-L1 Super Resolution. - /// - /// - public static SuperResolution CreateBTVL1_CUDA() - { - IntPtr ptr = NativeMethods.superres_createSuperResolution_BTVL1_CUDA(); - return SuperResolutionImpl.FromPtr(ptr); - } - /// - /// Create Bilateral TV-L1 Super Resolution. - /// - /// - public static SuperResolution CreateBTVL1_OCL() - { - throw new NotImplementedException(); - //IntPtr ptr = NativeMethods.superres_createSuperResolution_BTVL1_OCL(); - //return SuperResolutionImpl.FromPtr(ptr); - } - - #endregion - - #region Methods - - /// - /// Set input frame source for Super Resolution algorithm. - /// - /// Input frame source - public virtual void SetInput(FrameSource fs) - { - frameSource = fs; - } - - /// - /// Process next frame from input and return output result. - /// - /// Output result - public virtual void NextFrame(OutputArray frame) - { - if (firstCall) - { - InitImpl(frameSource); - firstCall = false; - } - - ProcessImpl(frameSource, frame); - } - - /// - /// - /// - public virtual void Reset() - { - frameSource.Reset(); - firstCall = true; - } - - /// - /// Clear all inner buffers. - /// - public virtual void CollectGarbage() - { - } - - /// - /// - /// - /// - protected abstract void InitImpl(FrameSource fs); - /// - /// - /// - /// - /// - protected abstract void ProcessImpl(FrameSource fs, OutputArray output); - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/superres/SuperResolutionImpl.cs b/src/OpenCvSharp/modules/superres/SuperResolutionImpl.cs deleted file mode 100644 index d3d1ff6c8..000000000 --- a/src/OpenCvSharp/modules/superres/SuperResolutionImpl.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// class for defined Super Resolution algorithm. - /// - internal sealed class SuperResolutionImpl : SuperResolution - { - /// - /// - /// - private Ptr detectorPtr; - - #region Init & Disposal - - /// - /// - /// - private SuperResolutionImpl() - { - detectorPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static SuperResolutionImpl FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid FrameSource pointer"); - - var ptrObj = new Ptr(ptr); - var obj = new SuperResolutionImpl - { - detectorPtr = ptrObj, - ptr = ptrObj.Get() - }; - return obj; - } - - /// - /// Creates instance from raw pointer T* - /// - /// - internal static SuperResolutionImpl FromRawPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid FrameSource pointer"); - var obj = new SuperResolutionImpl - { - detectorPtr = null, - ptr = ptr - }; - return obj; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - public override void SetInput(FrameSource fs) - { - ThrowIfDisposed(); - if (fs == null) - throw new ArgumentNullException(nameof(fs)); - NativeMethods.superres_SuperResolution_setInput(ptr, fs.CvPtr); - } - - /// - /// - /// - /// - public override void NextFrame(OutputArray frame) - { - ThrowIfDisposed(); - if (frame == null) - throw new ArgumentNullException(nameof(frame)); - frame.ThrowIfNotReady(); - NativeMethods.superres_SuperResolution_nextFrame(ptr, frame.CvPtr); - frame.Fix(); - } - - /// - /// - /// - public override void Reset() - { - ThrowIfDisposed(); - NativeMethods.superres_SuperResolution_reset(ptr); - } - - /// - /// - /// - public override void CollectGarbage() - { - ThrowIfDisposed(); - NativeMethods.superres_SuperResolution_collectGarbage(ptr); - } - - /// - /// - /// - /// - protected override void InitImpl(FrameSource fs) - { - // ネイティブ実装なので特別に空で。 - } - - /// - /// - /// - /// - /// - protected override void ProcessImpl(FrameSource fs, OutputArray output) - { - // ネイティブ実装なので特別に空で。 - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.superres_Ptr_SuperResolution_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.superres_Ptr_SuperResolution_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/video/BackgroundSubtractor.cs b/src/OpenCvSharp/modules/video/BackgroundSubtractor.cs deleted file mode 100644 index 4208535d7..000000000 --- a/src/OpenCvSharp/modules/video/BackgroundSubtractor.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - /// - /// The Base Class for Background/Foreground Segmentation. - /// The class is only used to define the common interface for - /// the whole family of background/foreground segmentation algorithms. - /// - public abstract class BackgroundSubtractor : Algorithm - { - /// - /// the update operator that takes the next video frame and returns the current foreground mask as 8-bit binary image. - /// - /// - /// - /// - public virtual void Apply(InputArray image, OutputArray fgmask, double learningRate = -1) - { - if (image == null) - throw new ArgumentNullException(nameof(image)); - if (fgmask == null) - throw new ArgumentNullException(nameof(fgmask)); - image.ThrowIfDisposed(); - fgmask.ThrowIfNotReady(); - - NativeMethods.video_BackgroundSubtractor_apply(ptr, image.CvPtr, fgmask.CvPtr, learningRate); - - fgmask.Fix(); - GC.KeepAlive(image); - } - - /// - /// computes a background image - /// - /// - public virtual void GetBackgroundImage(OutputArray backgroundImage) - { - if (backgroundImage == null) - throw new ArgumentNullException(nameof(backgroundImage)); - backgroundImage.ThrowIfNotReady(); - - NativeMethods.video_BackgroundSubtractor_getBackgroundImage(ptr, backgroundImage.CvPtr); - - backgroundImage.Fix(); - } - } -} diff --git a/src/OpenCvSharp/modules/video/BackgroundSubtractorKNN.cs b/src/OpenCvSharp/modules/video/BackgroundSubtractorKNN.cs deleted file mode 100644 index aed853e4c..000000000 --- a/src/OpenCvSharp/modules/video/BackgroundSubtractorKNN.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// K nearest neigbours algorithm - /// - public class BackgroundSubtractorKNN : BackgroundSubtractor - { - /// - /// cv::Ptr<T> - /// - private Ptr objectPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - /// - /// - public static BackgroundSubtractorKNN Create( - int history=500, double dist2Threshold=400.0, bool detectShadows=true) - { - IntPtr ptr = NativeMethods.video_createBackgroundSubtractorKNN( - history, dist2Threshold, detectShadows ? 1 : 0); - return new BackgroundSubtractorKNN(ptr); - } - - internal BackgroundSubtractorKNN(IntPtr ptr) - { - this.objectPtr = new Ptr(ptr); - this.ptr = objectPtr.Get(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - objectPtr?.Dispose(); - objectPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int History - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getHistory(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setHistory(ptr, value); - } - } - - /// - /// - /// - public int NSamples - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getNSamples(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setNSamples(ptr, value); - } - } - - /// - /// - /// - public double Dist2Threshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getDist2Threshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setDist2Threshold(ptr, value); - } - } - - /// - /// - /// - public int KNNSamples - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getkNNSamples(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setkNNSamples(ptr, value); - } - } - - /// - /// - /// - public bool DetectShadows - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getDetectShadows(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setDetectShadows(ptr, value ? 1 : 0); - } - } - - /// - /// - /// - public int ShadowValue - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getShadowValue(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setShadowValue(ptr, value); - } - } - - /// - /// - /// - public double ShadowThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorKNN_getShadowThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorKNN_setShadowThreshold(ptr, value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.video_Ptr_BackgroundSubtractorKNN_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.video_Ptr_BackgroundSubtractorKNN_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/video/BackgroundSubtractorMog2.cs b/src/OpenCvSharp/modules/video/BackgroundSubtractorMog2.cs deleted file mode 100644 index 07299813c..000000000 --- a/src/OpenCvSharp/modules/video/BackgroundSubtractorMog2.cs +++ /dev/null @@ -1,280 +0,0 @@ -using System; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// The Base Class for Background/Foreground Segmentation. - /// The class is only used to define the common interface for - /// the whole family of background/foreground segmentation algorithms. - /// - public class BackgroundSubtractorMOG2 : BackgroundSubtractor - { - /// - /// cv::Ptr<T> - /// - private Ptr objectPtr; - - #region Init & Disposal - - /// - /// - /// - /// - /// - /// - /// - public static BackgroundSubtractorMOG2 Create( - int history = 500, double varThreshold = 16, bool detectShadows = true) - { - IntPtr ptr = NativeMethods.video_createBackgroundSubtractorMOG2( - history, varThreshold, detectShadows ? 1 : 0); - return new BackgroundSubtractorMOG2(ptr); - } - - internal BackgroundSubtractorMOG2(IntPtr ptr) - { - this.objectPtr = new Ptr(ptr); - this.ptr = objectPtr.Get(); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - objectPtr?.Dispose(); - objectPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int History - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getHistory(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setHistory(ptr, value); - } - } - - /// - /// - /// - public int NMixtures - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getNMixtures(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setNMixtures(ptr, value); - } - } - - /// - /// - /// - public double BackgroundRatio - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getBackgroundRatio(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setBackgroundRatio(ptr, value); - } - } - - /// - /// - /// - public double VarThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getHistory(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setVarThreshold(ptr, value); - } - } - - /// - /// - /// - public double VarThresholdGen - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getVarThresholdGen(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setVarThresholdGen(ptr, value); - } - } - - /// - /// - /// - public double VarInit - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getVarInit(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setVarInit(ptr, value); - } - } - - /// - /// - /// - public double VarMin - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getVarMin(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setVarMin(ptr, value); - } - } - - /// - /// - /// - public double VarMax - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getVarMax(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setVarMax(ptr, value); - } - } - - /// - /// - /// - public double ComplexityReductionThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getComplexityReductionThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setComplexityReductionThreshold(ptr, value); - } - } - - /// - /// - /// - public bool DetectShadows - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getDetectShadows(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setDetectShadows(ptr, value ? 1 : 0); - } - } - - /// - /// - /// - public int ShadowValue - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getShadowValue(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setShadowValue(ptr, value); - } - } - - /// - /// - /// - public double ShadowThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.video_BackgroundSubtractorMOG2_getShadowThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.video_BackgroundSubtractorMOG2_setShadowThreshold(ptr, value); - } - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.video_Ptr_BackgroundSubtractorMOG2_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.video_Ptr_BackgroundSubtractorMOG2_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} \ No newline at end of file diff --git a/src/OpenCvSharp/modules/video/DenseOpticalFlow.cs b/src/OpenCvSharp/modules/video/DenseOpticalFlow.cs deleted file mode 100644 index badef590d..000000000 --- a/src/OpenCvSharp/modules/video/DenseOpticalFlow.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// - /// - public abstract class DenseOpticalFlow : Algorithm - { - #region Init & Disposal - - /// - /// - /// - protected DenseOpticalFlow() - { - } - - /// - /// - /// - /// - public static DenseOpticalFlow CreateOptFlow_DualTVL1() - { - IntPtr ptr = NativeMethods.video_createOptFlow_DualTVL1(); - return DenseOpticalFlowImpl.FromPtr(ptr); - } - - #endregion - - /// - /// Clear all inner buffers. - /// - public virtual void CollectGarbage() - { - } - - /// - /// - /// - /// - /// - /// - public abstract void Calc(InputArray frame0, InputArray frame1, InputOutputArray flow); - } -} diff --git a/src/OpenCvSharp/modules/video/DenseOpticalFlowImpl.cs b/src/OpenCvSharp/modules/video/DenseOpticalFlowImpl.cs deleted file mode 100644 index fd43f983c..000000000 --- a/src/OpenCvSharp/modules/video/DenseOpticalFlowImpl.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - - /// - /// - /// - internal sealed class DenseOpticalFlowImpl : DenseOpticalFlow - { - /// - /// - /// - private Ptr detectorPtr; - - #region Init & Disposal - - /// - /// - /// - private DenseOpticalFlowImpl() - { - detectorPtr = null; - ptr = IntPtr.Zero; - } - - /// - /// Creates instance from cv::Ptr<T> . - /// ptr is disposed when the wrapper disposes. - /// - /// - internal static DenseOpticalFlowImpl FromPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid DenseOpticalFlow pointer"); - - var ptrObj = new Ptr(ptr); - var obj = new DenseOpticalFlowImpl - { - detectorPtr = ptrObj, - ptr = ptrObj.Get() - }; - return obj; - } - - /// - /// Creates instance from raw pointer T* - /// - /// - internal static DenseOpticalFlowImpl FromRawPtr(IntPtr ptr) - { - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Invalid DenseOpticalFlow pointer"); - var obj = new DenseOpticalFlowImpl - { - detectorPtr = null, - ptr = ptr - }; - return obj; - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - /// - /// - /// - /// - /// - /// - public override void Calc( - InputArray frame0, InputArray frame1, InputOutputArray flow) - { - ThrowIfDisposed(); - if (frame0 == null) - throw new ArgumentNullException(nameof(frame0)); - if (frame1 == null) - throw new ArgumentNullException(nameof(frame1)); - if (flow == null) - throw new ArgumentNullException(nameof(flow)); - frame0.ThrowIfDisposed(); - frame1.ThrowIfDisposed(); - flow.ThrowIfNotReady(); - - NativeMethods.video_DenseOpticalFlow_calc( - ptr, frame0.CvPtr, frame1.CvPtr, flow.CvPtr); - - flow.Fix(); - } - - /// - /// - /// - public override void CollectGarbage() - { - ThrowIfDisposed(); - NativeMethods.video_DenseOpticalFlow_collectGarbage(ptr); - } - - #endregion - - internal class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.superres_Ptr_DenseOpticalFlowExt_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.superres_Ptr_DenseOpticalFlowExt_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/video/KalmanFilter.cs b/src/OpenCvSharp/modules/video/KalmanFilter.cs deleted file mode 100644 index 7452bb5f1..000000000 --- a/src/OpenCvSharp/modules/video/KalmanFilter.cs +++ /dev/null @@ -1,229 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenCvSharp -{ - /// - /// Kalman filter. - /// The class implements standard Kalman filter \url{http://en.wikipedia.org/wiki/Kalman_filter}. - /// However, you can modify KalmanFilter::transitionMatrix, KalmanFilter::controlMatrix and - /// KalmanFilter::measurementMatrix to get the extended Kalman filter functionality. - /// - public class KalmanFilter : DisposableCvObject - { - #region Init & Disposal - - /// - /// the default constructor - /// - public KalmanFilter() - { - ptr = NativeMethods.video_KalmanFilter_new1(); - } - - /// - /// the full constructor taking the dimensionality of the state, of the measurement and of the control vector - /// - /// - /// - /// - /// - public KalmanFilter(int dynamParams, int measureParams, int controlParams = 0, int type = MatType.CV_32F) - { - ptr = NativeMethods.video_KalmanFilter_new2( - dynamParams, measureParams, controlParams, type); - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.video_KalmanFilter_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties - /// - /// predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k) - /// - public Mat StatePre - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_statePre(ptr); - return new Mat(ret); - } - } - - /// - /// corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) - /// - public Mat StatePost - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_statePost(ptr); - return new Mat(ret); - } - } - - /// - /// state transition matrix (A) - /// - public Mat TransitionMatrix - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_transitionMatrix(ptr); - return new Mat(ret); - } - } - - /// - /// control matrix (B) (not used if there is no control) - /// - public Mat ControlMatrix - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_controlMatrix(ptr); - return new Mat(ret); - } - } - - /// - /// measurement matrix (H) - /// - public Mat MeasurementMatrix - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_measurementMatrix(ptr); - return new Mat(ret); - } - } - - /// - /// process noise covariance matrix (Q) - /// - public Mat ProcessNoiseCov - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_processNoiseCov(ptr); - return new Mat(ret); - } - } - - /// - /// measurement noise covariance matrix (R) - /// - public Mat MeasurementNoiseCov - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_measurementNoiseCov(ptr); - return new Mat(ret); - } - } - - /// - /// priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/ - /// - public Mat ErrorCovPre - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_errorCovPre(ptr); - return new Mat(ret); - } - } - - /// - /// Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R) - /// - public Mat Gain - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_gain(ptr); - return new Mat(ret); - } - } - - /// - /// posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k) - /// - public Mat ErrorCovPost - { - get - { - ThrowIfDisposed(); - IntPtr ret = NativeMethods.video_KalmanFilter_errorCovPost(ptr); - return new Mat(ret); - } - } - - #endregion - - #region Methods - - /// - /// re-initializes Kalman filter. The previous content is destroyed. - /// - /// - /// - /// - /// - public void Init(int dynamParams, int measureParams, int controlParams = 0, int type = MatType.CV_32F) - { - ThrowIfDisposed(); - NativeMethods.video_KalmanFilter_init(ptr, - dynamParams, measureParams, controlParams, type); - } - - /// - /// computes predicted state - /// - /// - /// - public Mat Predict(Mat control = null) - { - ThrowIfDisposed(); - - IntPtr ret = NativeMethods.video_KalmanFilter_predict(ptr, Cv2.ToPtr(control)); - return new Mat(ret); - } - - /// - /// updates the predicted state from the measurement - /// - /// - /// - public Mat Correct(Mat measurement) - { - ThrowIfDisposed(); - if (measurement == null) - throw new ArgumentNullException(nameof(measurement)); - measurement.ThrowIfDisposed(); - - IntPtr ret = NativeMethods.video_KalmanFilter_correct(ptr, measurement.CvPtr); - return new Mat(ret); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/video/OpticalFlowFlags.cs b/src/OpenCvSharp/modules/video/OpticalFlowFlags.cs deleted file mode 100644 index f0da5461e..000000000 --- a/src/OpenCvSharp/modules/video/OpticalFlowFlags.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp -{ - /// - /// cv::calcOpticalFlowPyrLK flags - /// - [Flags] - public enum OpticalFlowFlags : int - { - /// - /// - /// - None = 0, - - /// - /// - /// - PyrAReady = 1, - - /// - /// - /// - PyrBReady = 2, - - /// - /// - /// - UseInitialFlow = 4, - - /// - /// - /// - LkGetMinEigenvals = 8, - - /// - /// - /// - FarnebackGaussian = 256, - } -} diff --git a/src/OpenCvSharp/modules/videoio/Enum/CameraChannels.cs b/src/OpenCvSharp/modules/videoio/Enum/CameraChannels.cs deleted file mode 100644 index dca6b73d0..000000000 --- a/src/OpenCvSharp/modules/videoio/Enum/CameraChannels.cs +++ /dev/null @@ -1,44 +0,0 @@ - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// マルチヘッドカメラから取得する画像のチャネル - /// -#else - /// - /// channel indices for multi-head camera live streams - /// -#endif - public enum CameraChannels : int - { - // Data given from depth generator. - - /// - /// Depth values in mm (CV_16UC1) - /// - OpenNI_DepthMap = 0, - - /// - /// XYZ in meters (CV_32FC3) - /// - OpenNI_PointCloudMap = 1, - - /// - /// Disparity in pixels (CV_8UC1) - /// - OpenNI_DisparityMap = 2, - - /// - /// Disparity in pixels (CV_32FC1) - /// - OpenNI_DisparityMap32F = 3, - - /// - /// CV_8UC1 - /// - OpenNI_ValidDepthMask = 4, - } -} diff --git a/src/OpenCvSharp/modules/videoio/Enum/CaptureDevice.cs b/src/OpenCvSharp/modules/videoio/Enum/CaptureDevice.cs deleted file mode 100644 index 13ec06adc..000000000 --- a/src/OpenCvSharp/modules/videoio/Enum/CaptureDevice.cs +++ /dev/null @@ -1,142 +0,0 @@ - -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// カメラキャプチャの初期化に用いるカメラのデバイス - /// -#else - /// - /// Camera device types - /// -#endif - public enum CaptureDevice : int - { - /// - /// autodetect - /// - Any = 0, - - /// - /// platform native - /// - VFW = 200, - - /// - /// platform native - /// - V4L = 200, - - /// - /// platform native - /// - V4L2 = V4L, - - /// - /// IEEE 1394 drivers - /// - Firewire = 300, - - /// - /// IEEE 1394 drivers - /// - Fireware = Firewire, - - /// - /// IEEE 1394 drivers - /// - IEEE1394 = Firewire, - - /// - /// IEEE 1394 drivers - /// - DC1394 = Firewire, - - /// - /// IEEE 1394 drivers - /// - CMU1394 = Firewire, - - /// - /// QuickTime - /// - Qt = 500, - - /// - /// Unicap drivers - /// - Unicap = 600, - - /// - /// DirectShow (via videoInput) - /// - DShow = 700, - - /// - /// PvAPI, Prosilica GigE SDK - /// - PVAPI = 800, - - /// - /// OpenNI (for Kinect) - /// - OpenNI = 900, - - /// - /// OpenNI (for Asus Xtion) - /// - OpenNI_ASUS = 910, - - /// - /// Android - /// - Android = 1000, - - /// - /// XIMEA Camera API - /// - XIAPI = 1100, - - /// - /// AVFoundation framework for iOS (OS X Lion will have the same API) - /// - AVFoundation = 1200, - - /// - /// Smartek Giganetix GigEVisionSDK - /// - Giganetix = 1300, - - /// - /// Microsoft Media Foundation (via videoInput) - /// - MSMF = 1400, - - /// - /// Microsoft Windows Runtime using Media Foundation - /// - WinRT = 1410, - - /// - /// Intel Perceptual Computing SDK - /// - IntelPERC = 1500, - - /// - /// OpenNI2 (for Kinect) - /// - OpenNI2 = 1600, - - /// - /// OpenNI2 (for Asus Xtion and Occipital Structure sensors) - /// - OpenNI2_ASUS = 1610, - - /// - /// gPhoto2 connection - /// - GPhoto2 = 1700, - } -} diff --git a/src/OpenCvSharp/modules/videoio/Enum/CapturePosRatio.cs b/src/OpenCvSharp/modules/videoio/Enum/CapturePosRatio.cs deleted file mode 100644 index f14423052..000000000 --- a/src/OpenCvSharp/modules/videoio/Enum/CapturePosRatio.cs +++ /dev/null @@ -1,39 +0,0 @@ - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// ビデオファイル内の相対的な位置 - /// -#else - /// - /// Position in relative units - /// -#endif - public enum CapturePosAviRatio : int - { -#if LANG_JP - /// - /// ファイルの最初 - /// -#else - /// - /// Start of the file - /// -#endif - Start = 0, - -#if LANG_JP - /// - /// ファイルの最後 - /// -#else - /// - /// End of the file - /// -#endif - End = 1, - } -} diff --git a/src/OpenCvSharp/modules/videoio/Enum/CaptureProperty.cs b/src/OpenCvSharp/modules/videoio/Enum/CaptureProperty.cs deleted file mode 100644 index 7ce131078..000000000 --- a/src/OpenCvSharp/modules/videoio/Enum/CaptureProperty.cs +++ /dev/null @@ -1,744 +0,0 @@ -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// CvCaptureのプロパティID - /// -#else - /// - /// Property identifiers for CvCapture - /// -#endif - public enum CaptureProperty - { - #region Basic - -#if LANG_JP - /// - /// ファイル中の現在の位置(ミリ秒単位),あるいはビデオキャプチャのタイムスタンプ値 - /// -#else - /// - /// Position in milliseconds from the file beginning - /// -#endif - PosMsec = 0, - - -#if LANG_JP - /// - /// 次にデコード/キャプチャされるフレームのインデックス.0 から始まる - /// -#else - /// - /// Position in frames (only for video files) - /// -#endif - PosFrames = 1, - -#if LANG_JP - /// - /// ビデオファイル内の相対的な位置 (0 - ファイルの最初,1 - ファイルの最後) - /// -#else - /// - /// Position in relative units (0 - start of the file, 1 - end of the file) - /// -#endif - PosAviRatio = 2, - -#if LANG_JP - /// - /// ビデオストリーム中のフレームの幅 - /// -#else - /// - /// Width of frames in the video stream (only for cameras) - /// -#endif - FrameWidth = 3, - -#if LANG_JP - /// - /// ビデオストリーム中のフレームの高さ - /// -#else - /// - /// Height of frames in the video stream (only for cameras) - /// -#endif - FrameHeight = 4, - -#if LANG_JP - /// - /// フレームレート - /// -#else - /// - /// Frame rate (only for cameras) - /// -#endif - Fps = 5, - -#if LANG_JP - /// - /// コーデックを表す 4 文字 - /// -#else - /// - /// 4-character code of codec (only for cameras). - /// -#endif - // ReSharper disable once InconsistentNaming - FourCC = 6, - -#if LANG_JP - /// - /// ビデオファイル中のフレーム数 - /// -#else - /// - /// Number of frames in the video stream - /// -#endif - FrameCount = 7, - -#if LANG_JP - /// - /// retrieve() によって返されるMat オブジェクトのフォーマット. - /// -#else - /// - /// The format of the Mat objects returned by retrieve() - /// -#endif - Format = 8, - -#if LANG_JP - /// - /// 現在のキャプチャモードを表す,バックエンド固有の値. - /// -#else - /// - /// A backend-specific value indicating the current capture mode - /// -#endif - Mode = 9, - -#if LANG_JP - /// - /// 明度 - /// -#else - /// - /// Brightness of image (only for cameras) - /// -#endif - Brightness = 10, - - -#if LANG_JP - /// - /// コントラスト - /// -#else - /// - /// contrast of image (only for cameras) - /// -#endif - Contrast = 11, - -#if LANG_JP - /// - /// 彩度 - /// -#else - /// - /// Saturation of image (only for cameras) - /// -#endif - Saturation = 12, - - -#if LANG_JP - /// - /// 色相 - /// -#else - /// - /// hue of image (only for cameras) - /// -#endif - Hue = 13, - - -#if LANG_JP - /// - /// 画像のゲイン(カメラの場合のみ). - /// -#else - /// - /// Gain of the image (only for cameras) - /// -#endif - Gain = 14, - - -#if LANG_JP - /// - /// 露出(カメラの場合のみ). - /// -#else - /// - /// Exposure (only for cameras) - /// -#endif - Exposure = 15, - - -#if LANG_JP - /// - /// 画像がRGBに変換されるか否かを表す,ブール値のフラグ. - /// -#else - /// - /// Boolean flags indicating whether images should be converted to RGB - /// -#endif - ConvertRgb = 16, - - - /// - /// - /// - WhiteBalanceBlueU = 17, - - -#if LANG_JP - /// - /// TOWRITE(注意:現在のところ,DC1394 v 2.x バックエンドでのみサポートされます). - /// -#else - /// - /// TOWRITE (note: only supported by DC1394 v 2.x backend currently) - /// -#endif - Rectification = 18, - - /// - /// - /// - Monocrome = 19, - - /// - /// - /// - Sharpness = 20, - - /// - /// exposure control done by camera, - /// user can adjust refernce level using this feature - /// - AutoExposure = 21, - - /// - /// - /// - Gamma = 22, - - /// - /// - /// - Temperature = 23, - - /// - /// - /// - Trigger = 24, - - /// - /// - /// - TriggerDelay = 25, - - /// - /// - /// - WhiteBalanceRedV = 26, - - /// - /// - /// - Zoom = 27, - - /// - /// - /// - Focus = 28, - - /// - /// - /// - Guid = 29, - - /// - /// - /// - IsoSpeed = 30, - - /// - /// - /// - BackLight = 32, - - /// - /// - /// - Pan = 33, - - /// - /// - /// - Tilt = 34, - - /// - /// - /// - Roll = 35, - - /// - /// - /// - Iris = 36, - - /// - /// - /// - Settings = 37, - - #endregion - - #region OpenNI - - // Properties of cameras available through OpenNI interfaces - - /// - /// - /// - OpenNI_OutputMode = 100, - - /// - /// in mm - /// - OpenNI_FrameMaxDepth = 101, - - /// - /// in mm - /// - OpenNI_Baseline = 102, - - /// - /// in pixels - /// - OpenNI_FocalLength = 103, - - /// - /// flag that synchronizes the remapping depth map to image map - /// by changing depth generator's view point (if the flag is "on") or - /// sets this view point to its normal one (if the flag is "off"). - /// - OpenNI_Registration = 104, - - /// - /// - /// - OPENNI_ApproxFrameSync = 105, - - /// - /// - /// - OPENNI_MaxBufferSize = 106, - - /// - /// - /// - OPENNI_CircleBuffer = 107, - - /// - /// - /// - OPENNI_MaxTimeDuration = 108, - - /// - /// - /// - OPENNI_GeneratorPresent = 109, - - /// - /// - /// - OPENNI2_Sync = 110, - - /// - /// - /// - OPENNI2_Mirror = 111, - - /// - /// - /// - OpenNI_DepthGenerator = 1 << 31, - - /// - /// - /// - OpenNI_ImageGenerator = 1 << 30, - - /// - /// - /// - OpenNI_ImageGeneratorPresent = OpenNI_ImageGenerator + OPENNI_GeneratorPresent, - - - /// - /// - /// - OpenNI_ImageGeneratorOutputMode = OpenNI_ImageGenerator + OpenNI_OutputMode, - - /// - /// - /// - OpenNI_DepthGeneratorBaseline = OpenNI_ImageGenerator + OpenNI_Baseline, - - /// - /// - /// - OpenNI_DepthGeneratorFocalLength = OpenNI_ImageGenerator + OpenNI_FocalLength, - - /// - /// - /// - OpenNI_DepthGeneratorRegistrationON = OpenNI_ImageGenerator + OpenNI_Registration, - - #endregion - - #region GStreamer - - // Properties of cameras available through GStreamer interface - - /// - /// default is 1 - /// - GStreamerQueueLength = 200, - - #endregion - - #region PVAPI - - /// - /// ip for anable multicast master mode. 0 for disable multicast - /// - PvAPIMulticastIP = 300, - - /// - /// Determines how a frame is initiated - /// - PVAPI_FrameStartTriggerMode = 301, - - /// - /// Horizontal sub-sampling of the image - /// - PVAPI_DecimationHorizontal = 302, - - /// - /// Vertical sub-sampling of the image - /// - PVAPI_DecimationVertical = 303, - - /// - /// Horizontal binning factor - /// - PVAPI_BinningX = 304, - - /// - /// Vertical binning factor - /// - PVAPI_BinningY = 305, - - /// - /// Pixel format - /// - PVAPI_PixelFormat = 306, - - #endregion - - #region XI - - // Properties of cameras available through XIMEA SDK interface - - /// - /// Change image resolution by binning or skipping. - /// - XI_Downsampling = 400, - - /// - /// Output data format. - /// - XI_DataFormat = 401, - - /// - /// Horizontal offset from the origin to the area of interest (in pixels). - /// - XI_OffsetX = 402, - - /// - /// Vertical offset from the origin to the area of interest (in pixels). - /// - XI_OffsetY = 403, - - /// - /// Defines source of trigger. - /// - XI_TrgSource = 404, - - /// - /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. - /// - XI_TrgSoftware = 405, - - /// - /// Selects general purpose input - /// - XI_GpiSelector = 406, - - /// - /// Set general purpose input mode - /// - XI_GpiMode = 407, - - /// - /// Get general purpose level - /// - XI_GpiLevel = 408, - - /// - /// Selects general purpose output - /// - XI_GpoSelector = 409, - - /// - /// Set general purpose output mode - /// - XI_GpoMode = 410, - - /// - /// Selects camera signalling LED - /// - XI_LedSelector = 411, - - /// - /// Define camera signalling LED functionality - /// - XI_LedMode = 412, - - /// - /// Calculates White Balance(must be called during acquisition) - /// - XI_ManualWB = 413, - - /// - /// Automatic white balance - /// - XI_AutoWB = 414, - - /// - /// Automatic exposure/gain - /// - XI_AEAG = 415, - - /// - /// Exposure priority (0.5 - exposure 50%, gain 50%). - /// - XI_ExpPriority = 416, - - /// - /// Maximum limit of exposure in AEAG procedure - /// - XI_AEMaxLimit = 417, - - /// - /// Maximum limit of gain in AEAG procedure - /// - XI_AGMaxLimit = 418, - - /// - /// Average intensity of output signal AEAG should achieve(in %) - /// - XI_AEAGLevel = 419, - - /// - /// Image capture timeout in milliseconds - /// - XI_Timeout = 420, - - #endregion - - #region iOS - - /// - /// - /// - IOS_DeviceFocus = 9001, - - /// - /// - /// - IOS_DeviceExposure = 9002, - - /// - /// - /// - IOS_DeviceFlash = 9003, - - /// - /// - /// - IOS_DeviceWhiteBalance = 9004, - - /// - /// - /// - IOS_DeviceTorch = 9005, - - #endregion - - #region GIGA - - /// - /// - /// - GIGA_FrameOffsetX = 10001, - - /// - /// - /// - GIGA_FrameOffsetY = 10002, - - /// - /// - /// - GIGA_FrameWidthMax = 10003, - - /// - /// - /// - GIGA_FrameHeightMax = 10004, - - /// - /// - /// - GIGA_FrameSensWidth = 10005, - - /// - /// - /// - GIGA_FrameSensHeight = 10006, - - #endregion - - #region INTELPERC - - /// - /// - /// - INTELPERC_ProfileCount = 11001, - - /// - /// - /// - INTELPERC_ProfileIdx = 11002, - - /// - /// - /// - INTELPERC_DepthLowConfidenceValue = 11003, - - /// - /// - /// - INTELPERC_DepthSaturationValue = 11004, - - /// - /// - /// - INTELPERC_DepthConfidenceThreshold = 11005, - - /// - /// - /// - INTELPERC_DepthFocalLengthHorz = 11006, - - /// - /// - /// - INTELPERC_DepthFocalLengthVert = 11007, - - #endregion - - #region gPhoto2 - - /// - /// Capture only preview from liveview mode. - /// - GPhoto2_Preview = 17001, - - /// - /// Readonly, returns (const char *). - /// - GPhoto2_WidgetEnumerate = 17002, - - /// - /// Trigger, only by set. Reload camera settings. - /// - GPhoto2_ReloadConfig = 17003, - - /// - /// Reload all settings on set. - /// - GPhoto2_ReloadOnChange = 17004, - - /// - /// Collect messages with details. - /// - GPhoto2_CollectMsgs = 17005, - - /// - /// Readonly, returns (const char *). - /// - GPhoto2_FlushMsgs = 17006, - - /// - /// Exposure speed. Can be readonly, depends on camera program. - /// - Speed = 17007, - - /// - /// Aperture. Can be readonly, depends on camera program. - /// - Aperture = 17008, - - /// - /// Camera exposure program. - /// - ExposureProgram = 17009, - - /// - /// Enter liveview mode. - /// - ViewFinder = 17010, - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/videoio/Enum/CaptureType.cs b/src/OpenCvSharp/modules/videoio/Enum/CaptureType.cs deleted file mode 100644 index 96a11a37f..000000000 --- a/src/OpenCvSharp/modules/videoio/Enum/CaptureType.cs +++ /dev/null @@ -1,44 +0,0 @@ - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// CvCaptureのキャプチャタイプ(カメラorファイル) - /// -#else - /// - /// Capture type of CvCapture (Camera or AVI file) - /// -#endif - public enum CaptureType - { -#if LANG_JP - /// - /// AVIファイルからのキャプチャ - /// -#else - /// - /// Captures from an AVI file - /// -#endif - File, - - -#if LANG_JP - /// - /// カメラからのキャプチャ - /// -#else - /// - /// Captures from digital camera - /// -#endif - Camera, - - - /// - /// - /// - NotSpecified - } -} diff --git a/src/OpenCvSharp/modules/videoio/Enum/FourCC.cs b/src/OpenCvSharp/modules/videoio/Enum/FourCC.cs deleted file mode 100644 index 34731c119..000000000 --- a/src/OpenCvSharp/modules/videoio/Enum/FourCC.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -#pragma warning disable 1591 - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// フレームを圧縮するためのコーデックを表す4文字 - /// -#else - /// - /// 4-character code of codec used to compress the frames. - /// -#endif - public enum FourCC - { - Default = -1, - Prompt = -1, - CVID = 1145656899, - DIB = 541215044, - DIVX = 1482049860, - H261 = 825635400, - H263 = 859189832, - H264 = 875967048, - IV32 = 842225225, - IV41 = 825513545, - IV50 = 808801865, - IYUB = 1448433993, - MJPG = 1196444237, - MP42 = 842289229, - MP43 = 859066445, - MPG4 = 877088845, - MSVC = 1129730893, - PIM1 = 827148624, - XVID = 1145656920, - } -} diff --git a/src/OpenCvSharp/modules/videoio/VideoCapture.cs b/src/OpenCvSharp/modules/videoio/VideoCapture.cs deleted file mode 100644 index 791b7bff1..000000000 --- a/src/OpenCvSharp/modules/videoio/VideoCapture.cs +++ /dev/null @@ -1,2102 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// ビデオキャプチャ - /// -#else - /// - /// Video capturing class - /// -#endif - public class VideoCapture : DisposableCvObject - { -#if LANG_JP - /// - /// キャプチャの種類 (File or Camera) - /// -#else - /// - /// Capture type (File or Camera) - /// -#endif - private CaptureType captureType; - - #region Init and Disposal - -#if LANG_JP - /// - /// 空の状態で初期化. 後でOpenが必要. - /// - /// -#else - /// - /// Initializes empty capture. - /// To use this, you should call Open. - /// - /// -#endif - public VideoCapture() - { - try - { - ptr = NativeMethods.videoio_VideoCapture_new1(); - } - catch (Exception e) - { - throw new OpenCvSharpException("Failed to create VideoCapture", e); - } - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Failed to create VideoCapture"); - - captureType = CaptureType.NotSpecified; - } - -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある. - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. - /// -#endif - public VideoCapture(int index) - { - try - { - ptr = NativeMethods.videoio_VideoCapture_new3(index); - } - catch (Exception e) - { - throw new OpenCvSharpException("Failed to create VideoCapture", e); - } - if (ptr == IntPtr.Zero) - { - throw new OpenCvSharpException("Failed to create VideoCapture"); - } - captureType = CaptureType.Camera; - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラの種類 - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Device type - /// -#endif - public VideoCapture(CaptureDevice device) - : this((int)device) - { - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラの種類 - /// 使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある. - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Device type - /// Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. - /// -#endif - public VideoCapture(CaptureDevice device, int index) - : this((int)device + index) - { - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある. - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. - /// -#endif - public static VideoCapture FromCamera(int index) - { - return new VideoCapture(index); - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラの種類 - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Device type - /// -#endif - public static VideoCapture FromCamera(CaptureDevice device) - { - return new VideoCapture(device); - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラの種類 - /// 使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある. - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Device type - /// Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. - /// -#endif - public static VideoCapture FromCamera(CaptureDevice device, int index) - { - return new VideoCapture((int)device + index); - } - -#if LANG_JP - /// - /// ファイルからのビデオキャプチャを初期化する - /// - /// ビデオファイル名 - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading the video stream from the specified file. - /// After the allocated structure is not used any more it should be released by cvReleaseCapture function. - /// - /// Name of the video file. - /// -#endif - public VideoCapture(string fileName) - { - if (string.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); - /*if (!File.Exists(fileName)) - throw new FileNotFoundException("File not found", fileName);*/ - - ptr = NativeMethods.videoio_VideoCapture_new2(fileName); - - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Failed to create VideoCapture"); - - captureType = CaptureType.File; - } - -#if LANG_JP - /// - /// ファイルからのビデオキャプチャを初期化する - /// - /// ビデオファイル名 - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading the video stream from the specified file. - /// After the allocated structure is not used any more it should be released by cvReleaseCapture function. - /// - /// Name of the video file. - /// -#endif - public static VideoCapture FromFile(string fileName) - { - return new VideoCapture(fileName); - } - - /// - /// Initializes from native pointer - /// - /// CvCapture* - protected internal VideoCapture(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.videoio_VideoCapture_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties - #region Basic -#if LANG_JP - /// - /// キャプチャの種類 (File or Camera) - /// -#else - /// - /// Gets the capture type (File or Camera) - /// -#endif - public CaptureType CaptureType - { - get { return captureType; } - } - -#if LANG_JP - /// - /// ファイル中の現在の位置(ミリ秒単位),あるいはビデオキャプチャのタイムスタンプ値を取得・設定する - /// -#else - /// - /// Gets or sets film current position in milliseconds or video capture timestamp - /// -#endif - public int PosMsec - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.PosMsec); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.PosMsec, value); - } - } - -#if LANG_JP - /// - /// 次にデコード/キャプチャされるフレームのインデックス(0からはじまる)を取得・設定する(設定はビデオファイルのみ) - /// -#else - /// - /// Gets or sets 0-based index of the frame to be decoded/captured next - /// -#endif - public int PosFrames - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.PosFrames); - } - set - { - if (captureType == CaptureType.Camera) - throw new NotSupportedException("Only for video files"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.PosFrames, value); - } - } - -#if LANG_JP - /// - /// ビデオファイル内の相対的な位置を取得・設定する(設定はビデオファイルのみ) - /// -#else - /// - /// Gets or sets relative position of video file - /// -#endif - public CapturePosAviRatio PosAviRatio - { - get - { - return (CapturePosAviRatio)(int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.PosAviRatio); - } - set - { - if (captureType == CaptureType.Camera) - throw new NotSupportedException("Only for video files"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.PosAviRatio, (int)value); - } - } - -#if LANG_JP - /// - /// ビデオストリーム中のフレームの幅を取得・設定する(設定はカメラのみ) - /// -#else - /// - /// Gets or sets width of frames in the video stream - /// -#endif - public int FrameWidth - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.FrameWidth); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.FrameWidth, value); - } - } - -#if LANG_JP - /// - /// ビデオストリーム中のフレームの高さを取得・設定する(設定はカメラのみ) - /// -#else - /// - /// Gets or sets height of frames in the video stream - /// -#endif - public int FrameHeight - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.FrameHeight); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.FrameHeight, value); - } - } - -#if LANG_JP - /// - /// フレームレートを取得・設定する(設定はカメラのみ) - /// -#else - /// - /// Gets or sets frame rate - /// -#endif - public double Fps - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Fps); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Fps, value); - } - } - -#if LANG_JP - /// - /// コーデックを表す4文字を取得・設定する(設定はカメラのみ). - /// 例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// -#else - /// - /// Gets or sets 4-character code of codec - /// -#endif -// ReSharper disable InconsistentNaming - public string FourCC -// ReSharper restore InconsistentNaming - { - get - { - int src = (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.FourCC); - IntBytes bytes = new IntBytes { Value = src }; - char[] fourcc = { - Convert.ToChar(bytes.B1), - Convert.ToChar(bytes.B2), - Convert.ToChar(bytes.B3), - Convert.ToChar(bytes.B4) - }; - return new string(fourcc); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - if (value.Length != 4) - throw new ArgumentException("Length of the argument string must be 4"); - - byte c1 = Convert.ToByte(value[0]); - byte c2 = Convert.ToByte(value[1]); - byte c3 = Convert.ToByte(value[2]); - byte c4 = Convert.ToByte(value[3]); - int v = FourCCCalcurator.Run(c1, c2, c3, c4); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.FourCC, v); - } - } - -#if LANG_JP - /// - /// ビデオファイル中のフレーム数を取得する - /// -#else - /// - /// Gets number of frames in video file - /// -#endif - public int FrameCount - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.FrameCount); - } - } - -#if LANG_JP - /// - /// 明度を取得・設定する - /// -#else - /// - /// Gets or sets brightness of image (only for cameras) - /// -#endif - public double Brightness - { - get - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Brightness); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Brightness, value); - } - } - -#if LANG_JP - /// - /// コンストラストを取得・設定する - /// -#else - /// - /// Gets or sets contrast of image (only for cameras) - /// -#endif - public double Contrast - { - get - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Contrast); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Contrast, value); - } - } - -#if LANG_JP - /// - /// 彩度を取得・設定する - /// -#else - /// - /// Gets or sets saturation of image (only for cameras) - /// -#endif - public double Saturation - { - get - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Saturation); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Saturation, value); - } - } - -#if LANG_JP - /// - /// 色相を取得・設定する - /// -#else - /// - /// Gets or sets hue of image (only for cameras) - /// -#endif - public double Hue - { - get - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Hue); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Hue, value); - } - } - -#if LANG_JP - /// - /// retrieve() によって返されるMat オブジェクトのフォーマット. - /// -#else - /// - /// The format of the Mat objects returned by retrieve() - /// -#endif - public int Format - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Format); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Format, value); - } - } - - -#if LANG_JP - /// - /// 現在のキャプチャモードを表す,バックエンド固有の値. - /// -#else - /// - /// A backend-specific value indicating the current capture mode - /// -#endif - public int Mode - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Mode); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Mode, value); - } - } - - -#if LANG_JP - /// - /// 画像のゲイン(カメラの場合のみ). - /// -#else - /// - /// Gain of the image (only for cameras) - /// -#endif - public double Gain - { - get - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Gain); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Gain, value); - } - } - - -#if LANG_JP - /// - /// 露出(カメラの場合のみ). - /// -#else - /// - /// Exposure (only for cameras) - /// -#endif - public double Exposure - { - get - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Exposure); - } - set - { - if (captureType == CaptureType.File) - throw new NotSupportedException("Only for cameras"); - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Exposure, value); - } - } - - -#if LANG_JP - /// - /// 画像がRGBに変換されるか否かを表す,ブール値のフラグ. - /// -#else - /// - /// Boolean flags indicating whether images should be converted to RGB - /// -#endif - public bool ConvertRgb - { - get - { - return (int)NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.ConvertRgb) != 0; - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.ConvertRgb, value ? 0 : 1); - } - } - - - /// - /// - /// - public double WhiteBalanceBlueU - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.WhiteBalanceBlueU); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.WhiteBalanceBlueU, value); - } - } - - -#if LANG_JP - /// - /// TOWRITE(注意:現在のところ,DC1394 v 2.x バックエンドでのみサポートされます). - /// -#else - /// - /// TOWRITE (note: only supported by DC1394 v 2.x backend currently) - /// -#endif - public double Rectification - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Rectification); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Rectification, value); - } - } - - /// - /// - /// - public double Monocrome - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Monocrome); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Monocrome, value); - } - } - - /// - /// - /// - public double Sharpness - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Sharpness); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Sharpness, value); - } - } - - /// - /// exposure control done by camera, - /// user can adjust refernce level using this feature - /// [CV_CAP_PROP_AUTO_EXPOSURE] - /// - public double AutoExposure - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.AutoExposure); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.AutoExposure, value); - } - } - - /// - /// - /// - public double Gamma - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Gamma); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Gamma, value); - } - } - - /// - /// - /// [CV_CAP_PROP_TEMPERATURE] - /// - public double Temperature - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Temperature); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Temperature, value); - } - } - - /// - /// - /// - public double Trigger - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Trigger); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Trigger, value); - } - } - - /// - /// - /// - public double TriggerDelay - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.TriggerDelay); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.TriggerDelay, value); - } - } - - /// - /// - /// - public double WhiteBalanceRedV - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.WhiteBalanceRedV); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.WhiteBalanceRedV, value); - } - } - - /// - /// - /// - public double Zoom - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Zoom); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Zoom, value); - } - } - - /// - /// - /// - public double Focus - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Focus); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Focus, value); - } - } - - /// - /// - /// - public double Guid - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Guid); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Guid, value); - } - } - - /// - /// - /// - public double IsoSpeed - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.IsoSpeed); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.IsoSpeed, value); - } - } - - /// - /// - /// - public double BackLight - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.BackLight); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.BackLight, value); - } - } - - /// - /// - /// - public double Pan - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Pan); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Pan, value); - } - } - - /// - /// - /// - public double Tilt - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Tilt); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Tilt, value); - } - } - - /// - /// - /// - public double Roll - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Roll); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Roll, value); - } - } - - /// - /// - /// - public double Iris - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Iris); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Iris, value); - } - } - - /// - /// - /// - public double Settings - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.Settings); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.Settings, value); - } - } - - #endregion - - #region OpenNI - // Properties of cameras available through OpenNI interfaces -// ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// - /// [CV_CAP_PROP_OPENNI_OUTPUT_MODE] - /// -#else - /// - /// - /// [CV_CAP_PROP_OPENNI_OUTPUT_MODE] - /// -#endif - public double OpenNI_OutputMode - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_OutputMode); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_OutputMode, value); - } - } - -#if LANG_JP - /// - /// in mm - /// [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH] - /// -#else - /// - /// in mm - /// [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH] - /// -#endif - public double OpenNI_FrameMaxDepth - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_FrameMaxDepth); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_FrameMaxDepth, value); - } - } - -#if LANG_JP - /// - /// in mm - /// [CV_CAP_PROP_OPENNI_BASELINE] - /// -#else - /// - /// in mm - /// [CV_CAP_PROP_OPENNI_BASELINE] - /// -#endif - public double OpenNI_Baseline - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_Baseline); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_Baseline, value); - } - } - -#if LANG_JP - /// - /// in pixels - /// [CV_CAP_PROP_OPENNI_FOCAL_LENGTH] - /// -#else - /// - /// in pixels - /// [CV_CAP_PROP_OPENNI_FOCAL_LENGTH] - /// -#endif - public double OpenNI_FocalLength - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_FocalLength); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_FocalLength, value); - } - } - -#if LANG_JP - /// - /// flag that synchronizes the remapping depth map to image map - /// by changing depth generator's view point (if the flag is "on") or - /// sets this view point to its normal one (if the flag is "off"). - /// [CV_CAP_PROP_OPENNI_REGISTRATION] - /// -#else - /// - /// flag that synchronizes the remapping depth map to image map - /// by changing depth generator's view point (if the flag is "on") or - /// sets this view point to its normal one (if the flag is "off"). - /// [CV_CAP_PROP_OPENNI_REGISTRATION] - /// -#endif - public double OpenNI_Registration - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_Registration); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_Registration, value); - } - } - -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE] - /// -#else - /// - /// - /// [CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE] - /// -#endif - public double OpenNI_ImageGeneratorOutputMode - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_ImageGeneratorOutputMode); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_ImageGeneratorOutputMode, value); - } - } - -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE] - /// -#else - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE] - /// -#endif - public double OpenNI_DepthGeneratorBaseline - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_DepthGeneratorBaseline); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_DepthGeneratorBaseline, value); - } - } - -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH] - /// -#else - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH] - /// -#endif - public double OpenNI_DepthGeneratorFocalLength - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_DepthGeneratorFocalLength); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_DepthGeneratorFocalLength, value); - } - } - -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON] - /// -#else - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON] - /// -#endif - public double OpenNI_DepthGeneratorRegistrationON - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.OpenNI_DepthGeneratorRegistrationON); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.OpenNI_DepthGeneratorRegistrationON, value); - } - } -// ReSharper restore InconsistentNaming - #endregion - #region GStreamer - // Properties of cameras available through GStreamer interface - -#if LANG_JP - /// - /// default is 1 - /// [CV_CAP_GSTREAMER_QUEUE_LENGTH] - /// -#else - /// - /// default is 1 - /// [CV_CAP_GSTREAMER_QUEUE_LENGTH] - /// -#endif - public double GStreamerQueueLength - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.GStreamerQueueLength); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.GStreamerQueueLength, value); - } - } - -#if LANG_JP - /// - /// ip for anable multicast master mode. 0 for disable multicast - /// [CV_CAP_PROP_PVAPI_MULTICASTIP] - /// -#else - /// - /// ip for anable multicast master mode. 0 for disable multicast - /// [CV_CAP_PROP_PVAPI_MULTICASTIP] - /// -#endif -// ReSharper disable InconsistentNaming - public double PvAPIMulticastIP -// ReSharper restore InconsistentNaming - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.PvAPIMulticastIP); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.PvAPIMulticastIP, value); - } - } - #endregion - #region XI - // Properties of cameras available through XIMEA SDK interface -// ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// Change image resolution by binning or skipping. - /// [CV_CAP_PROP_XI_DOWNSAMPLING] - /// -#else - /// - /// Change image resolution by binning or skipping. - /// [CV_CAP_PROP_XI_DOWNSAMPLING] - /// -#endif - public double XI_Downsampling - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_Downsampling); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_Downsampling, value); - } - } - -#if LANG_JP - /// - /// Output data format. - /// [CV_CAP_PROP_XI_DATA_FORMAT] - /// -#else - /// - /// Output data format. - /// [CV_CAP_PROP_XI_DATA_FORMAT] - /// -#endif - public double XI_DataFormat - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_DataFormat); - } - } - -#if LANG_JP - /// - /// Horizontal offset from the origin to the area of interest (in pixels). - /// [CV_CAP_PROP_XI_OFFSET_X] - /// -#else - /// - /// Horizontal offset from the origin to the area of interest (in pixels). - /// [CV_CAP_PROP_XI_OFFSET_X] - /// -#endif - public double XI_OffsetX - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_OffsetX); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_OffsetX, value); - } - } - -#if LANG_JP - /// - /// Vertical offset from the origin to the area of interest (in pixels). - /// [CV_CAP_PROP_XI_OFFSET_Y] - /// -#else - /// - /// Vertical offset from the origin to the area of interest (in pixels). - /// [CV_CAP_PROP_XI_OFFSET_Y] - /// -#endif - public double XI_OffsetY - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_OffsetY); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_OffsetY, value); - } - } - -#if LANG_JP - /// - /// Defines source of trigger. - /// [CV_CAP_PROP_XI_TRG_SOURCE] - /// -#else - /// - /// Defines source of trigger. - /// [CV_CAP_PROP_XI_TRG_SOURCE] - /// -#endif - public double XI_TrgSource - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_TrgSource); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_TrgSource, value); - } - } - -#if LANG_JP - /// - /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. - /// [CV_CAP_PROP_XI_TRG_SOFTWARE] - /// -#else - /// - /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. - /// [CV_CAP_PROP_XI_TRG_SOFTWARE] - /// -#endif - public double XI_TrgSoftware - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_TrgSoftware); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_TrgSoftware, value); - } - } - -#if LANG_JP - /// - /// Selects general purpose input - /// [CV_CAP_PROP_XI_GPI_SELECTOR] - /// -#else - /// - /// Selects general purpose input - /// [CV_CAP_PROP_XI_GPI_SELECTOR] - /// -#endif - public double XI_GpiSelector - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_GpiSelector); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_GpiSelector, value); - } - } - -#if LANG_JP - /// - /// Set general purpose input mode - /// [CV_CAP_PROP_XI_GPI_MODE] - /// -#else - /// - /// Set general purpose input mode - /// [CV_CAP_PROP_XI_GPI_MODE] - /// -#endif - public double XI_GpiMode - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_GpiMode); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_GpiMode, value); - } - } - -#if LANG_JP - /// - /// Get general purpose level - /// [CV_CAP_PROP_XI_GPI_LEVEL] - /// -#else - /// - /// Get general purpose level - /// [CV_CAP_PROP_XI_GPI_LEVEL] - /// -#endif - public double XI_GpiLevel - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_GpiLevel); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_GpiLevel, value); - } - } - -#if LANG_JP - /// - /// Selects general purpose output - /// [CV_CAP_PROP_XI_GPO_SELECTOR] - /// -#else - /// - /// Selects general purpose output - /// [CV_CAP_PROP_XI_GPO_SELECTOR] - /// -#endif - public double XI_GpoSelector - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_GpoSelector); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_GpoSelector, value); - } - } - -#if LANG_JP - /// - /// Set general purpose output mode - /// [CV_CAP_PROP_XI_GPO_MODE] - /// -#else - /// - /// Set general purpose output mode - /// [CV_CAP_PROP_XI_GPO_MODE] - /// -#endif - public double XI_GpoMode - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_GpoMode); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_GpoMode, value); - } - } - -#if LANG_JP - /// - /// Selects camera signalling LED - /// [CV_CAP_PROP_XI_LED_SELECTOR] - /// -#else - /// - /// Selects camera signalling LED - /// [CV_CAP_PROP_XI_LED_SELECTOR] - /// -#endif - public double XI_LedSelector - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_LedSelector); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_LedSelector, value); - } - } - -#if LANG_JP - /// - /// Define camera signalling LED functionality - /// [CV_CAP_PROP_XI_LED_MODE] - /// -#else - /// - /// Define camera signalling LED functionality - /// [CV_CAP_PROP_XI_LED_MODE] - /// -#endif - public double XI_LedMode - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_LedMode); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_LedMode, value); - } - } - -#if LANG_JP - /// - /// Calculates White Balance(must be called during acquisition) - /// [CV_CAP_PROP_XI_MANUAL_WB] - /// -#else - /// - /// Calculates White Balance(must be called during acquisition) - /// [CV_CAP_PROP_XI_MANUAL_WB] - /// -#endif - public double XI_ManualWB - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_ManualWB); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_ManualWB, value); - } - } - -#if LANG_JP - /// - /// Automatic white balance - /// [CV_CAP_PROP_XI_AUTO_WB] - /// -#else - /// - /// Automatic white balance - /// [CV_CAP_PROP_XI_AUTO_WB] - /// -#endif - public double XI_AutoWB - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_AutoWB); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_AutoWB, value); - } - } - -#if LANG_JP - /// - /// Automatic exposure/gain - /// [CV_CAP_PROP_XI_AEAG] - /// -#else - /// - /// Automatic exposure/gain - /// [CV_CAP_PROP_XI_AEAG] - /// -#endif - public double XI_AEAG - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_AEAG); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_AEAG, value); - } - } - -#if LANG_JP - /// - /// Exposure priority (0.5 - exposure 50%, gain 50%). - /// [CV_CAP_PROP_XI_EXP_PRIORITY] - /// -#else - /// - /// Exposure priority (0.5 - exposure 50%, gain 50%). - /// [CV_CAP_PROP_XI_EXP_PRIORITY] - /// -#endif - public double XI_ExpPriority - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_ExpPriority); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_ExpPriority, value); - } - } - -#if LANG_JP - /// - /// Maximum limit of exposure in AEAG procedure - /// [CV_CAP_PROP_XI_AE_MAX_LIMIT] - /// -#else - /// - /// Maximum limit of exposure in AEAG procedure - /// [CV_CAP_PROP_XI_AE_MAX_LIMIT] - /// -#endif - public double XI_AEMaxLimit - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_AEMaxLimit); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_AEMaxLimit, value); - } - } - -#if LANG_JP - /// - /// Maximum limit of gain in AEAG procedure - /// [CV_CAP_PROP_XI_AG_MAX_LIMIT] - /// -#else - /// - /// Maximum limit of gain in AEAG procedure - /// [CV_CAP_PROP_XI_AG_MAX_LIMIT] - /// -#endif - public double XI_AGMaxLimit - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_AGMaxLimit); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_AGMaxLimit, value); - } - } - -#if LANG_JP - /// - /// default is 1 - /// [CV_CAP_PROP_XI_AEAG_LEVEL] - /// -#else - /// - /// default is 1 - /// [CV_CAP_PROP_XI_AEAG_LEVEL] - /// -#endif - public double XI_AEAGLevel - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_AEAGLevel); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_AEAGLevel, value); - } - } - -#if LANG_JP - /// - /// default is 1 - /// [CV_CAP_PROP_XI_TIMEOUT] - /// -#else - /// - /// default is 1 - /// [CV_CAP_PROP_XI_TIMEOUT] - /// -#endif - public double XI_Timeout - { - get - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)CaptureProperty.XI_Timeout); - } - set - { - NativeMethods.videoio_VideoCapture_set(ptr, (int)CaptureProperty.XI_Timeout, value); - } - } -// ReSharper restore InconsistentNaming - #endregion - #endregion - - #region Methods - #region Get -#if LANG_JP - /// - /// ビデオキャプチャのプロパティを取得する - /// - /// プロパティID - /// プロパティの値 -#else - /// - /// Retrieves the specified property of camera or video file. - /// - /// property identifier. - /// property value -#endif - public double Get(CaptureProperty propertyId) - { - return NativeMethods.videoio_VideoCapture_get(ptr, (int)propertyId); - } -#if LANG_JP - /// - /// ビデオキャプチャのプロパティを取得する - /// - /// プロパティID - /// プロパティの値 -#else - /// - /// Retrieves the specified property of camera or video file. - /// - /// property identifier. - /// property value -#endif - public double Get(int propertyId) - { - return NativeMethods.videoio_VideoCapture_get(ptr, propertyId); - } - #endregion - #region Grab -#if LANG_JP - /// - /// カメラやファイルからフレームを取り出す.取り出されたフレームは内部的に保存される. - /// 取り出されたフレームをユーザ側で利用するためには,cvRetrieveFrame を用いるべきである. - /// - /// -#else - /// - /// Grabs the frame from camera or file. The grabbed frame is stored internally. - /// The purpose of this function is to grab frame fast that is important for syncronization in case of reading from several cameras simultaneously. - /// The grabbed frames are not exposed because they may be stored in compressed format (as defined by camera/driver). - /// To retrieve the grabbed frame, cvRetrieveFrame should be used. - /// - /// -#endif - public bool Grab() - { - ThrowIfDisposed(); - return NativeMethods.videoio_VideoCapture_grab(ptr) != 0; - } - #endregion - #region Retrieve -#if LANG_JP - /// - /// GrabFrame 関数によって取り出された画像への参照を返す. - /// - /// - /// non-zero streamIdx is only valid for multi-head camera live streams - /// 1フレームの画像 (GC禁止フラグが立っている). キャプチャできなかった場合はnull. -#else - /// - /// Decodes and returns the grabbed video frame. - /// - /// - /// non-zero streamIdx is only valid for multi-head camera live streams - /// -#endif - public bool Retrieve(Mat image, int channel = 0) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - return NativeMethods.videoio_VideoCapture_retrieve(ptr, image.CvPtr, channel) != 0; - } - -#if LANG_JP - /// - /// GrabFrame 関数によって取り出された画像への参照を返す. - /// 返された画像は,ユーザが解放したり,変更したりするべきではない. - /// - /// - /// non-zero streamIdx is only valid for multi-head camera live streams - /// 1フレームの画像 (GC禁止フラグが立っている). キャプチャできなかった場合はnull. -#else - /// - /// Returns the pointer to the image grabbed with cvGrabFrame function. - /// The returned image should not be released or modified by user. - /// - /// - /// non-zero streamIdx is only valid for multi-head camera live streams - /// -#endif - public bool Retrieve(Mat image, CameraChannels streamIdx = CameraChannels.OpenNI_DepthMap) - { - ThrowIfDisposed(); - if (image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - return NativeMethods.videoio_VideoCapture_retrieve(ptr, image.CvPtr, (int)streamIdx) != 0; - } - -#if LANG_JP - /// - /// GrabFrame 関数によって取り出された画像への参照を返す. - /// -#else - /// - /// Decodes and returns the grabbed video frame. - /// - /// -#endif - public Mat RetrieveMat() - { - ThrowIfDisposed(); - - var mat = new Mat(); - NativeMethods.videoio_VideoCapture_operatorRightShift_Mat(ptr, mat.CvPtr); - return mat; - } - - #endregion - #region Read -#if LANG_JP - /// - /// カメラやビデオファイルから一つのフレームを取り出し,それを展開して返す. - /// この関数は,単純にcvGrabFrame とcvRetrieveFrame をまとめて呼び出しているだけである. - /// 返された画像は,ユーザが解放したり,変更したりするべきではない. - /// - /// 1フレームの画像 (GC禁止フラグが立っている). キャプチャできなかった場合はnull. -#else - /// - /// Grabs a frame from camera or video file, decompresses and returns it. - /// This function is just a combination of cvGrabFrame and cvRetrieveFrame in one call. - /// The returned image should not be released or modified by user. - /// - /// -#endif - public bool Read(Mat image) - { - ThrowIfDisposed(); - if(image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - - //NativeMethods.videoio_VideoCapture_read(ptr, image.CvPtr); - /* - bool grabbed = NativeMethods.videoio_VideoCapture_grab(ptr) != 0; - if (!grabbed) - return false; - */ - NativeMethods.videoio_VideoCapture_operatorRightShift_Mat(ptr, image.CvPtr); - GC.KeepAlive(image); - return true; - } - #endregion - #region Set -#if LANG_JP - /// - /// ビデオキャプチャのプロパティをセットする - /// - /// プロパティID - /// プロパティの値 - /// -#else - /// - /// Sets the specified property of video capturing. - /// - /// property identifier. - /// value of the property. - /// -#endif - public int Set(CaptureProperty propertyId, double value) - { - return NativeMethods.videoio_VideoCapture_set(ptr, (int)propertyId, value); - } -#if LANG_JP - /// - /// ビデオキャプチャのプロパティをセットする - /// - /// プロパティID - /// プロパティの値 - /// -#else - /// - /// Sets the specified property of video capturing. - /// - /// property identifier. - /// value of the property. - /// -#endif - public int Set(int propertyId, double value) - { - return NativeMethods.videoio_VideoCapture_set(ptr, propertyId, value); - } - #endregion - #region Open -#if LANG_JP - /// - /// 指定されたビデオファイルをオープンします. - /// - /// - /// -#else - /// - /// Opens the specified video file - /// - /// - /// -#endif - public void Open(string fileName) - { - ThrowIfDisposed(); - NativeMethods.videoio_VideoCapture_open1(ptr, fileName); - captureType = CaptureType.File; - } - -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある. - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. - /// -#endif - public void Open(int index) - { - ThrowIfDisposed(); - try - { - NativeMethods.videoio_VideoCapture_open2(ptr, index); - } - catch (Exception e) - { - throw new OpenCvSharpException("Failed to create CvCapture", e); - } - captureType = CaptureType.Camera; - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラの種類 - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Device type - /// -#endif - public void Open(CaptureDevice device) - { - Open((int)device); - } -#if LANG_JP - /// - /// カメラからのビデオキャプチャを初期化する. - /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). - /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). - /// - /// 使われるカメラの種類 - /// 使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある. - /// -#else - /// - /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. - /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394). - /// - /// Device type - /// Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. - /// -#endif - public void Open(CaptureDevice device, int index) - { - Open((int)device + index); - } - #endregion - #region Release -#if LANG_JP - /// - /// Closes video file or capturing device. - /// - /// -#else - /// - /// Closes video file or capturing device. - /// - /// -#endif - public void Release() - { - ThrowIfDisposed(); - NativeMethods.videoio_VideoCapture_release(ptr); - } - #endregion - #region IsOpened - /// - /// Returns true if video capturing has been initialized already. - /// - /// - public bool IsOpened() - { - ThrowIfDisposed(); - return NativeMethods.videoio_VideoCapture_isOpened(ptr) != 0; - } - #endregion - #endregion - - /// - /// For accessing each byte of Int32 value - /// - [StructLayout(LayoutKind.Explicit)] - private struct IntBytes - { - [FieldOffset(0)] - public int Value; - [FieldOffset(0)] - public readonly byte B1; - [FieldOffset(1)] - public readonly byte B2; - [FieldOffset(2)] - public readonly byte B3; - [FieldOffset(3)] - public readonly byte B4; - } - } -} diff --git a/src/OpenCvSharp/modules/videoio/VideoWriter.cs b/src/OpenCvSharp/modules/videoio/VideoWriter.cs deleted file mode 100644 index 6b5f649ef..000000000 --- a/src/OpenCvSharp/modules/videoio/VideoWriter.cs +++ /dev/null @@ -1,375 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// AVIビデオ出力機 - /// -#else - /// - /// AVI Video File Writer - /// -#endif - public class VideoWriter : DisposableCvObject - { - #region Init and Disposal - - /// - /// - /// - public VideoWriter() - { - FileName = null; - Fps = -1; - FrameSize = Size.Zero; - IsColor = true; - ptr = NativeMethods.videoio_VideoWriter_new1(); - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Failed to create VideoWriter"); - } - -#if LANG_JP - /// - /// ビデオライタを作成する. - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else - /// - /// Creates video writer structure. - /// - /// Name of the output video file. - /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. - /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. - /// Framerate of the created video stream. - /// Size of video frames. - /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). -#endif - public VideoWriter(string fileName, string fourcc, double fps, Size frameSize, bool isColor = true) - : this(fileName, FourCCCalcurator.Run(fourcc), fps, frameSize, isColor) - { - } - -#if LANG_JP - /// - /// ビデオライタを作成し、返す. - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else - /// - /// Creates video writer structure. - /// - /// Name of the output video file. - /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. - /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. - /// Framerate of the created video stream. - /// Size of video frames. - /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). - /// -#endif - public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true) - : this(fileName, (int)fourcc, fps, frameSize, isColor) - { - } - -#if LANG_JP - /// - /// ビデオライタを作成し、返す. - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else - /// - /// Creates video writer structure. - /// - /// Name of the output video file. - /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. - /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. - /// Framerate of the created video stream. - /// Size of video frames. - /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). - /// -#endif - public VideoWriter(string fileName, int fourcc, double fps, Size frameSize, bool isColor = true) - { - if (fileName == null) - throw new ArgumentNullException(); - - FileName = fileName; - Fps = fps; - FrameSize = frameSize; - IsColor = isColor; - ptr = NativeMethods.videoio_VideoWriter_new2(fileName, fourcc, fps, frameSize, isColor ? 1 : 0); - if (ptr == IntPtr.Zero) - throw new OpenCvSharpException("Failed to create VideoWriter"); - } - - /// - /// Initializes from native pointer - /// - /// CvVideoWriter* - internal VideoWriter(IntPtr ptr) - { - this.ptr = ptr; - } - - /// - /// Releases unmanaged resources - /// - protected override void DisposeUnmanaged() - { - NativeMethods.videoio_VideoWriter_delete(ptr); - base.DisposeUnmanaged(); - } - - #endregion - - #region Properties -#if LANG_JP - /// - /// 出力するビデオファイルの名前を取得する - /// -#else - /// - /// Get output video file name - /// -#endif - public string FileName { get; private set; } - -#if LANG_JP - /// - /// 作成されたビデオストリームのフレームレートを取得する - /// -#else - /// - /// Frames per second of the output vide - /// -#endif - public double Fps { get; private set; } - -#if LANG_JP - /// - /// ビデオフレームのサイズを取得する - /// -#else - /// - /// Get size of frame image - /// -#endif - public Size FrameSize { get; private set; } - -#if LANG_JP - /// - /// カラーフレームかどうかの値を取得する - /// -#else - /// - /// Get whether output frames is color or not - /// -#endif - public bool IsColor { get; private set; } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// ビデオライタを開く - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else - /// - /// Creates video writer structure. - /// - /// Name of the output video file. - /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. - /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. - /// Framerate of the created video stream. - /// Size of video frames. - /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). - /// -#endif - public void Open(string fileName, string fourcc, double fps, Size frameSize, bool isColor = true) - { - Open(fileName, FourCCCalcurator.Run(fourcc), fps, frameSize, isColor); - } - -#if LANG_JP - /// - /// ビデオライタを開く - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else - /// - /// Creates video writer structure. - /// - /// Name of the output video file. - /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. - /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. - /// Framerate of the created video stream. - /// Size of video frames. - /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). - /// -#endif - public void Open(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true) - { - Open(fileName, (int)fourcc, fps, frameSize, isColor); - } - -#if LANG_JP - /// - /// ビデオライタを開く - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else - /// - /// Creates video writer structure. - /// - /// Name of the output video file. - /// 4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. - /// Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog. - /// Framerate of the created video stream. - /// Size of video frames. - /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). - /// -#endif - public void Open(string fileName, int fourcc, double fps, Size frameSize, bool isColor = true) - { - ThrowIfDisposed(); - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentNullException(nameof(fileName)); - - FileName = fileName; - Fps = fps; - FrameSize = frameSize; - IsColor = isColor; - NativeMethods.videoio_VideoWriter_open(ptr, fileName, fourcc, fps, frameSize, isColor ? 1 : 0); - } - - /// - /// Returns true if video writer has been successfully initialized. - /// - /// - public bool IsOpened() - { - ThrowIfDisposed(); - return NativeMethods.videoio_VideoWriter_isOpened(ptr) != 0; - } - - /// - /// - /// - /// - public void Release() - { - ThrowIfDisposed(); - NativeMethods.videoio_VideoWriter_release(ptr); - } - -#if LANG_JP - /// - /// 一つのフレームをビデオファイルに書き込む/追加する - /// - /// 書き込まれるフレーム - /// -#else - /// - /// Writes/appends one frame to video file. - /// - /// the written frame. - /// -#endif - public void Write(Mat image) - { - ThrowIfDisposed(); - if(image == null) - throw new ArgumentNullException(nameof(image)); - image.ThrowIfDisposed(); - NativeMethods.videoio_VideoWriter_write(ptr, image.CvPtr); - } - - /// - /// Concatenates 4 chars to a fourcc code. - /// This static method constructs the fourcc code of the codec to be used in - /// the constructor VideoWriter::VideoWriter or VideoWriter::open. - /// - /// - /// - /// - /// - /// -// ReSharper disable once InconsistentNaming - public static int FourCC(char c1, char c2, char c3, char c4) - { - return NativeMethods.videoio_VideoWriter_fourcc((byte) c1, (byte) c2, (byte) c3, (byte) c4); - } - - /// - /// Concatenates 4 chars to a fourcc code. - /// This static method constructs the fourcc code of the codec to be used in - /// the constructor VideoWriter::VideoWriter or VideoWriter::open. - /// - /// - /// - // ReSharper disable once InconsistentNaming - public static int FourCC(string code) - { - if (code == null) - throw new ArgumentNullException(nameof(code)); - if (code.Length != 4) - throw new ArgumentException("code.Length != 4", nameof(code)); - - return FourCC(code[0], code[1], code[2], code[3]); - } - - #endregion - } -} diff --git a/src/OpenCvSharp/modules/xfeatures2d/BriefDescriptorExtractor.cs b/src/OpenCvSharp/modules/xfeatures2d/BriefDescriptorExtractor.cs deleted file mode 100644 index b62a0b8b9..000000000 --- a/src/OpenCvSharp/modules/xfeatures2d/BriefDescriptorExtractor.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; - -namespace OpenCvSharp.XFeatures2D -{ - using DescriptorExtractor = Feature2D; - - /// - /// BRIEF Descriptor - /// - public class BriefDescriptorExtractor : DescriptorExtractor - { -#pragma warning disable 1591 -// ReSharper disable InconsistentNaming - public const int PATCH_SIZE = 48; - public const int KERNEL_SIZE = 9; -// ReSharper restore InconsistentNaming -#pragma warning restore 1591 - - /// - /// cv::Ptr<T> - /// - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - /// - /// - /// - protected BriefDescriptorExtractor() - { - } - - /// - /// Constructor - /// - /// - protected BriefDescriptorExtractor(IntPtr ptr) - { - ptrObj = new Ptr(ptr); - ptr = ptrObj.Get(); - } - - /// - /// bytes is a length of descriptor in bytes. It can be equal 16, 32 or 64 bytes. - /// - /// - public static BriefDescriptorExtractor Create(int bytes = 32) - { - IntPtr p = NativeMethods.xfeatures2d_BriefDescriptorExtractor_create(bytes); - return new BriefDescriptorExtractor(p); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.xfeatures2d_Ptr_BriefDescriptorExtractor_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.xfeatures2d_Ptr_BriefDescriptorExtractor_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/xfeatures2d/FREAK.cs b/src/OpenCvSharp/modules/xfeatures2d/FREAK.cs deleted file mode 100644 index 917ba2e6b..000000000 --- a/src/OpenCvSharp/modules/xfeatures2d/FREAK.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using OpenCvSharp.Util; - -// ReSharper disable once InconsistentNaming - -namespace OpenCvSharp.XFeatures2D -{ -#if LANG_JP - /// - /// FREAK 実装 - /// -#else - /// - /// FREAK implementation - /// -#endif - public class FREAK : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - protected FREAK(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - - /// - /// Constructor - /// - /// enable orientation normalization - /// enable scale normalization - /// scaling of the description pattern - /// number of octaves covered by the detected keypoints - /// (optional) user defined selected pairs - public static FREAK Create( - bool orientationNormalized = true, - bool scaleNormalized = true, - float patternScale = 22.0f, - int nOctaves = 4, - IEnumerable selectedPairs = null) - { - int[] selectedPairsArray = EnumerableEx.ToArray(selectedPairs); - int selectedPairslength = selectedPairs == null ? 0 : selectedPairsArray.Length; - - IntPtr ptr = NativeMethods.xfeatures2d_FREAK_create(orientationNormalized ? 1 : 0, - scaleNormalized ? 1 : 0, patternScale, nOctaves, - selectedPairsArray, selectedPairslength); - return new FREAK(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.xfeatures2d_Ptr_FREAK_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.xfeatures2d_Ptr_FREAK_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/xfeatures2d/SIFT.cs b/src/OpenCvSharp/modules/xfeatures2d/SIFT.cs deleted file mode 100644 index 335650e9c..000000000 --- a/src/OpenCvSharp/modules/xfeatures2d/SIFT.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenCvSharp.XFeatures2D -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// SIFT 実装. - /// -#else - /// - /// SIFT implementation. - /// -#endif - public class SIFT : Feature2D - { - private Ptr detectorPtr; - - #region Init & Disposal - - /// - /// Creates instance by raw pointer cv::SIFT* - /// - protected SIFT(IntPtr p) - { - detectorPtr = new Ptr(p); - ptr = detectorPtr.Get(); - } - - /// - /// The SIFT constructor. - /// - /// The number of best features to retain. - /// The features are ranked by their scores (measured in SIFT algorithm as the local contrast) - /// The number of layers in each octave. 3 is the value used in D. Lowe paper. - /// The number of octaves is computed automatically from the image resolution. - /// The contrast threshold used to filter out weak features in semi-uniform - /// (low-contrast) regions. The larger the threshold, the less features are produced by the detector. - /// The threshold used to filter out edge-like features. Note that the its meaning is - /// different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are filtered out (more features are retained). - /// The sigma of the Gaussian applied to the input image at the octave #0. - /// If your image is captured with a weak camera with soft lenses, you might want to reduce the number. - public static SIFT Create(int nFeatures = 0, int nOctaveLayers = 3, - double contrastThreshold = 0.04, double edgeThreshold = 10, - double sigma = 1.6) - { - IntPtr ptr = NativeMethods.xfeatures2d_SIFT_create( - nFeatures, nOctaveLayers, - contrastThreshold, edgeThreshold, sigma); - return new SIFT(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.xfeatures2d_Ptr_SIFT_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.xfeatures2d_Ptr_SIFT_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/xfeatures2d/SURF.cs b/src/OpenCvSharp/modules/xfeatures2d/SURF.cs deleted file mode 100644 index d12001646..000000000 --- a/src/OpenCvSharp/modules/xfeatures2d/SURF.cs +++ /dev/null @@ -1,187 +0,0 @@ - -using System; - -namespace OpenCvSharp.XFeatures2D -{ -#if LANG_JP - /// - /// SURF(Speeded Up Robust Features) を抽出するためのクラス. - /// -#else - /// - /// Class for extracting Speeded Up Robust Features from an image. - /// -#endif - public class SURF : Feature2D - { - private Ptr detectorPtr; - - #region Init & Disposal - - /// - /// Creates instance by raw pointer cv::SURF* - /// - protected SURF(IntPtr p) - { - detectorPtr = new Ptr(p); - ptr = detectorPtr.Get(); - } - -#if LANG_JP - /// - /// SURF初期化 - /// - /// keypoint.hessian の値がこの閾値よりも大きい特徴だけが検出される - /// - /// - /// false:基本的なディスクリプタ(64要素), true:拡張されたディスクリプタ(128要素) - /// -#else - /// - /// The SURF constructor. - /// - /// Only features with keypoint.hessian larger than that are extracted. - /// The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. - /// If you want to get very large features, use the larger value. If you want just small features, decrease it. - /// The number of images within each octave of a gaussian pyramid. It is set to 2 by default. - /// false means basic descriptors (64 elements each), true means extended descriptors (128 elements each) - /// false means that detector computes orientation of each feature. - /// true means that the orientation is not computed (which is much, much faster). -#endif - public static SURF Create(double hessianThreshold, - int nOctaves = 4, int nOctaveLayers = 2, - bool extended = true, bool upright = false) - { - IntPtr ptr = NativeMethods.xfeatures2d_SURF_create( - hessianThreshold, nOctaves, nOctaveLayers, - extended ? 1 : 0, upright ? 1 : 0); - return new SURF(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - detectorPtr?.Dispose(); - detectorPtr = null; - base.DisposeManaged(); - } - - #endregion - - #region Properties - - /// - /// Threshold for the keypoint detector. Only features, whose hessian is larger than hessianThreshold - /// are retained by the detector. Therefore, the larger the value, the less keypoints you will get. - /// A good default value could be from 300 to 500, depending from the image contrast. - /// - public double HessianThreshold - { - get - { - ThrowIfDisposed(); - return NativeMethods.xfeatures2d_SURF_getHessianThreshold(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.xfeatures2d_SURF_setHessianThreshold(ptr, value); - } - } - - /// - /// The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. - /// If you want to get very large features, use the larger value. If you want just small features, decrease it. - /// - public int NOctaves - { - get - { - ThrowIfDisposed(); - return NativeMethods.xfeatures2d_SURF_getNOctaves(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.xfeatures2d_SURF_setNOctaves(ptr, value); - } - } - - /// - /// The number of images within each octave of a gaussian pyramid. It is set to 2 by default. - /// - public int NOctaveLayers - { - get - { - ThrowIfDisposed(); - return NativeMethods.xfeatures2d_SURF_getNOctaveLayers(ptr); - } - set - { - ThrowIfDisposed(); - NativeMethods.xfeatures2d_SURF_setNOctaveLayers(ptr, value); - } - } - - /// - /// false means that the basic descriptors (64 elements each) shall be computed. - /// true means that the extended descriptors (128 elements each) shall be computed - /// - public bool Extended - { - get - { - ThrowIfDisposed(); - return NativeMethods.xfeatures2d_SURF_getExtended(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.xfeatures2d_SURF_setExtended(ptr, value ? 1 : 0); - } - } - - /// - /// false means that detector computes orientation of each feature. - /// true means that the orientation is not computed (which is much, much faster). - /// For example, if you match images from a stereo pair, or do image stitching, the matched features - /// likely have very similar angles, and you can speed up feature extraction by setting upright=true. - /// - public bool Upright - { - get - { - ThrowIfDisposed(); - return NativeMethods.xfeatures2d_SURF_getUpright(ptr) != 0; - } - set - { - ThrowIfDisposed(); - NativeMethods.xfeatures2d_SURF_setUpright(ptr, value ? 1 : 0); - } - } - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.xfeatures2d_Ptr_SURF_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.xfeatures2d_Ptr_SURF_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/modules/xfeatures2d/StarDetector.cs b/src/OpenCvSharp/modules/xfeatures2d/StarDetector.cs deleted file mode 100644 index 7dbbf0107..000000000 --- a/src/OpenCvSharp/modules/xfeatures2d/StarDetector.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; - -namespace OpenCvSharp.XFeatures2D -{ -#if LANG_JP - /// - /// Star Detector - /// -#else - /// - /// The "Star" Detector - /// -#endif - [Serializable] - public class StarDetector : Feature2D - { - private Ptr ptrObj; - - //internal override IntPtr PtrObj => ptrObj.CvPtr; - - #region Init & Disposal - - /// - /// - /// - internal StarDetector(IntPtr p) - { - ptrObj = new Ptr(p); - ptr = ptrObj.Get(); - } - -#if LANG_JP - /// - /// 初期化 - /// - /// - /// - /// - /// - /// -#else - /// - /// Constructor - /// - /// - /// - /// - /// - /// -#endif - public static StarDetector Create( - int maxSize = 45, - int responseThreshold = 30, - int lineThresholdProjected = 10, - int lineThresholdBinarized = 8, - int suppressNonmaxSize = 5) - { - IntPtr ptr = NativeMethods.xfeatures2d_StarDetector_create( - maxSize, responseThreshold, lineThresholdProjected, - lineThresholdBinarized, suppressNonmaxSize); - return new StarDetector(ptr); - } - - /// - /// Releases managed resources - /// - protected override void DisposeManaged() - { - ptrObj?.Dispose(); - ptrObj = null; - base.DisposeManaged(); - } - - #endregion - - #region Methods - - #endregion - - internal new class Ptr : OpenCvSharp.Ptr - { - public Ptr(IntPtr ptr) : base(ptr) - { - } - - public override IntPtr Get() - { - return NativeMethods.xfeatures2d_Ptr_StarDetector_get(ptr); - } - - protected override void DisposeUnmanaged() - { - NativeMethods.xfeatures2d_Ptr_StarDetector_delete(ptr); - base.DisposeUnmanaged(); - } - } - } -} diff --git a/src/OpenCvSharp/project.json b/src/OpenCvSharp/project.json deleted file mode 100644 index 3a24570bb..000000000 --- a/src/OpenCvSharp/project.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "version": "1.0.0-*", - "dependencies": { - }, - "frameworks": { - "netstandard1.6": { - "imports": "dnxcore50", - "dependencies": { - "NETStandard.Library": "1.6.1" - } - }, - "netcoreapp1.0": { - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "buildOptions": { - "define": [ "netcoreapp10" ] - } - }, /* - "netcore50": { - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "buildOptions": { - "define": [ "netcore50" ] - } - }, - "portable45-net45+win8+wpa81": { - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "buildOptions": { - "define": [ "uwp" ] - } - },*/ - "uap10.0": { - "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" - }, - "buildOptions": { - "define": [ "uap10" ] - } - }, - "net20": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Security": "2.0.0.0", - "System.Web": "2.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net20" ] - } - }, - "net40": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Security": "4.0.0.0", - "System.Web": "4.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net40" ] - } - }, - "net46": { - "dependencies": { - }, - "frameworkAssemblies": { - "System.Security": "4.0.0.0", - "System.Web": "4.0.0.0" - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net46" ] - } - } - }, - - "buildOptions": { - "xmlDoc": true, - "optimize": true, - "keyFile": "Key.snk", - "allowUnsafe": true, - "copyToOutput": { "include": [ "OpenCvSharp.dll.config" ] } - }, - "configurations": { - "Release-JP": { - "buildOptions": { - "define": [ "LANG_JP" ] - } - } - } -} diff --git a/src/OpenCvSharp/project.lock.json b/src/OpenCvSharp/project.lock.json deleted file mode 100644 index 34187b712..000000000 --- a/src/OpenCvSharp/project.lock.json +++ /dev/null @@ -1,10269 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETCoreApp,Version=v1.0": { - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "debian.8-x64" - } - } - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.23-x64" - } - } - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.24-x64" - } - } - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.13.2-x64" - } - } - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.42.1-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "rhel.7-x64" - } - } - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.14.04-x64" - } - } - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.04-x64" - } - } - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.10-x64" - } - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - } - }, - ".NETFramework,Version=v2.0": {}, - ".NETFramework,Version=v4.0": {}, - ".NETFramework,Version=v4.6": {}, - ".NETStandard,Version=v1.6": { - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "debian.8-x64" - } - } - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.23-x64" - } - } - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.24-x64" - } - } - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.13.2-x64" - } - } - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.42.1-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "rhel.7-x64" - } - } - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.14.04-x64" - } - } - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.04-x64" - } - } - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.10-x64" - } - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - } - }, - "UAP,Version=v10.0": { - "Microsoft.CSharp/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Dynamic.Runtime": "4.0.0", - "System.Globalization": "4.0.10", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.0", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/netcore50/Microsoft.CSharp.dll": {} - }, - "runtime": { - "lib/netcore50/Microsoft.CSharp.dll": {} - } - }, - "Microsoft.NETCore/5.0.0": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.0", - "Microsoft.NETCore.Targets": "1.0.0", - "Microsoft.VisualBasic": "10.0.0", - "System.AppContext": "4.0.0", - "System.Collections": "4.0.10", - "System.Collections.Concurrent": "4.0.10", - "System.Collections.Immutable": "1.1.37", - "System.ComponentModel": "4.0.0", - "System.ComponentModel.Annotations": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tools": "4.0.0", - "System.Diagnostics.Tracing": "4.0.20", - "System.Dynamic.Runtime": "4.0.10", - "System.Globalization": "4.0.10", - "System.Globalization.Calendars": "4.0.0", - "System.Globalization.Extensions": "4.0.0", - "System.IO": "4.0.10", - "System.IO.Compression": "4.0.0", - "System.IO.Compression.ZipFile": "4.0.0", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.IO.UnmanagedMemoryStream": "4.0.0", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.Linq.Parallel": "4.0.0", - "System.Linq.Queryable": "4.0.0", - "System.Net.Http": "4.0.0", - "System.Net.NetworkInformation": "4.0.0", - "System.Net.Primitives": "4.0.10", - "System.Numerics.Vectors": "4.1.0", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.DispatchProxy": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Metadata": "1.0.22", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.Numerics": "4.0.0", - "System.Security.Claims": "4.0.0", - "System.Security.Principal": "4.0.0", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10", - "System.Threading.Tasks.Dataflow": "4.5.25", - "System.Threading.Tasks.Parallel": "4.0.0", - "System.Threading.Timer": "4.0.0", - "System.Xml.ReaderWriter": "4.0.10", - "System.Xml.XDocument": "4.0.10" - } - }, - "Microsoft.NETCore.Platforms/1.0.0": { - "type": "package" - }, - "Microsoft.NETCore.Portable.Compatibility/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Runtime": "1.0.0" - }, - "compile": { - "ref/netcore50/System.ComponentModel.DataAnnotations.dll": {}, - "ref/netcore50/System.Core.dll": {}, - "ref/netcore50/System.Net.dll": {}, - "ref/netcore50/System.Numerics.dll": {}, - "ref/netcore50/System.Runtime.Serialization.dll": {}, - "ref/netcore50/System.ServiceModel.Web.dll": {}, - "ref/netcore50/System.ServiceModel.dll": {}, - "ref/netcore50/System.Windows.dll": {}, - "ref/netcore50/System.Xml.Linq.dll": {}, - "ref/netcore50/System.Xml.Serialization.dll": {}, - "ref/netcore50/System.Xml.dll": {}, - "ref/netcore50/System.dll": {}, - "ref/netcore50/mscorlib.dll": {} - }, - "runtime": { - "lib/netcore50/System.ComponentModel.DataAnnotations.dll": {}, - "lib/netcore50/System.Core.dll": {}, - "lib/netcore50/System.Net.dll": {}, - "lib/netcore50/System.Numerics.dll": {}, - "lib/netcore50/System.Runtime.Serialization.dll": {}, - "lib/netcore50/System.ServiceModel.Web.dll": {}, - "lib/netcore50/System.ServiceModel.dll": {}, - "lib/netcore50/System.Windows.dll": {}, - "lib/netcore50/System.Xml.Linq.dll": {}, - "lib/netcore50/System.Xml.Serialization.dll": {}, - "lib/netcore50/System.Xml.dll": {}, - "lib/netcore50/System.dll": {} - }, - "runtimeTargets": { - "runtimes/aot/lib/netcore50/System.ComponentModel.DataAnnotations.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Core.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Net.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Numerics.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Runtime.Serialization.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.ServiceModel.Web.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.ServiceModel.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Windows.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Xml.Linq.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Xml.Serialization.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.Xml.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/System.dll": { - "assetType": "runtime", - "rid": "aot" - }, - "runtimes/aot/lib/netcore50/mscorlib.dll": { - "assetType": "runtime", - "rid": "aot" - } - } - }, - "Microsoft.NETCore.Runtime/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.1", - "Microsoft.NETCore.Runtime.Native": "1.0.1" - } - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.1": { - "type": "package" - }, - "Microsoft.NETCore.Runtime.Native/1.0.1": { - "type": "package" - }, - "Microsoft.NETCore.Targets/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.0", - "Microsoft.NETCore.Targets.UniversalWindowsPlatform": "5.0.0" - } - }, - "Microsoft.NETCore.Targets.UniversalWindowsPlatform/5.0.0": { - "type": "package" - }, - "Microsoft.NETCore.UniversalWindowsPlatform/5.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore": "5.0.0", - "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "Microsoft.NETCore.Runtime": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.0", - "System.ComponentModel.EventBasedAsync": "4.0.10", - "System.Data.Common": "4.0.0", - "System.Diagnostics.Contracts": "4.0.0", - "System.Diagnostics.StackTrace": "4.0.0", - "System.IO.IsolatedStorage": "4.0.0", - "System.Net.Http.Rtc": "4.0.0", - "System.Net.Requests": "4.0.10", - "System.Net.Sockets": "4.0.0", - "System.Net.WebHeaderCollection": "4.0.0", - "System.Numerics.Vectors.WindowsRuntime": "4.0.0", - "System.Reflection.Context": "4.0.0", - "System.Runtime.InteropServices.WindowsRuntime": "4.0.0", - "System.Runtime.Serialization.Json": "4.0.1", - "System.Runtime.Serialization.Primitives": "4.1.0", - "System.Runtime.Serialization.Xml": "4.1.0", - "System.Runtime.WindowsRuntime": "4.0.10", - "System.Runtime.WindowsRuntime.UI.Xaml": "4.0.0", - "System.ServiceModel.Duplex": "4.0.0", - "System.ServiceModel.Http": "4.0.10", - "System.ServiceModel.NetTcp": "4.0.0", - "System.ServiceModel.Primitives": "4.0.0", - "System.ServiceModel.Security": "4.0.0", - "System.Text.Encoding.CodePages": "4.0.0", - "System.Xml.XmlSerializer": "4.0.10" - } - }, - "Microsoft.VisualBasic/10.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Dynamic.Runtime": "4.0.10", - "System.Globalization": "4.0.10", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/netcore50/Microsoft.VisualBasic.dll": {} - }, - "runtime": { - "lib/netcore50/Microsoft.VisualBasic.dll": {} - } - }, - "Microsoft.Win32.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20", - "System.Runtime.InteropServices": "4.0.20" - }, - "compile": { - "ref/dotnet/Microsoft.Win32.Primitives.dll": {} - }, - "runtime": { - "lib/dotnet/Microsoft.Win32.Primitives.dll": {} - } - }, - "System.AppContext/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.AppContext.dll": {} - }, - "runtime": { - "lib/netcore50/System.AppContext.dll": {} - } - }, - "System.Collections/4.0.10": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Collections.dll": {} - }, - "runtime": { - "lib/netcore50/System.Collections.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Collections.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Collections.Concurrent/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.Concurrent.dll": {} - } - }, - "System.Collections.Immutable/1.1.37": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.Immutable.dll": {} - } - }, - "System.Collections.NonGeneric/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Collections.NonGeneric.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.NonGeneric.dll": {} - } - }, - "System.Collections.Specialized/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections.NonGeneric": "4.0.0", - "System.Globalization": "4.0.10", - "System.Globalization.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Collections.Specialized.dll": {} - }, - "runtime": { - "lib/dotnet/System.Collections.Specialized.dll": {} - } - }, - "System.ComponentModel/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ComponentModel.dll": {} - }, - "runtime": { - "lib/netcore50/System.ComponentModel.dll": {} - } - }, - "System.ComponentModel.Annotations/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.ComponentModel": "4.0.0", - "System.Globalization": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.ComponentModel.Annotations.dll": {} - }, - "runtime": { - "lib/dotnet/System.ComponentModel.Annotations.dll": {} - } - }, - "System.ComponentModel.EventBasedAsync/4.0.10": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.ComponentModel.EventBasedAsync.dll": {} - }, - "runtime": { - "lib/dotnet/System.ComponentModel.EventBasedAsync.dll": {} - } - }, - "System.Data.Common/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Collections.NonGeneric": "4.0.0", - "System.Globalization": "4.0.10", - "System.IO": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Data.Common.dll": {} - }, - "runtime": { - "lib/dotnet/System.Data.Common.dll": {} - } - }, - "System.Diagnostics.Contracts/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Diagnostics.Contracts.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Contracts.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Contracts.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.Debug/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Diagnostics.Debug.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Debug.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.StackTrace/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Diagnostics.StackTrace.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.StackTrace.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.StackTrace.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.Tools/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Diagnostics.Tools.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Tools.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tools.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Diagnostics.Tracing/4.0.20": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Globalization": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.0", - "System.Text.Encoding": "4.0.0", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Diagnostics.Tracing.dll": {} - }, - "runtime": { - "lib/netcore50/System.Diagnostics.Tracing.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tracing.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Dynamic.Runtime/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.ObjectModel": "4.0.0", - "System.Reflection": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Dynamic.Runtime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Dynamic.Runtime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Dynamic.Runtime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Globalization/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Globalization.dll": {} - }, - "runtime": { - "lib/netcore50/System.Globalization.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Globalization.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Globalization.Calendars/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Globalization.Calendars.dll": {} - }, - "runtime": { - "lib/netcore50/System.Globalization.Calendars.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Globalization.Calendars.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Globalization.Extensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Globalization.Extensions.dll": {} - }, - "runtime": { - "lib/dotnet/System.Globalization.Extensions.dll": {} - } - }, - "System.IO/4.0.10": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Runtime": "4.0.20", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.0", - "System.Threading": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/dotnet/System.IO.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.IO.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.IO.Compression/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.IO": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.InteropServices": "4.0.0", - "System.Text.Encoding": "4.0.0", - "System.Threading": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/netcore50/System.IO.Compression.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.Compression.dll": {} - } - }, - "System.IO.Compression.ZipFile/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.10", - "System.IO.Compression": "4.0.0", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.Encoding": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/dotnet/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.IO": "4.0.10", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.WindowsRuntime": "4.0.0", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Overlapped": "4.0.0", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.FileSystem.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/dotnet/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.IO.IsolatedStorage/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.IsolatedStorage.dll": {} - }, - "runtime": { - "lib/netcore50/System.IO.IsolatedStorage.dll": {} - } - }, - "System.IO.UnmanagedMemoryStream/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.10", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.IO.UnmanagedMemoryStream.dll": {} - }, - "runtime": { - "lib/dotnet/System.IO.UnmanagedMemoryStream.dll": {} - } - }, - "System.Linq/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Linq.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.IO": "4.0.0", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.Expressions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Linq.Expressions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Linq.Parallel/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Collections.Concurrent": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Linq.Parallel.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.Parallel.dll": {} - } - }, - "System.Linq.Queryable/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Linq.Queryable.dll": {} - }, - "runtime": { - "lib/netcore50/System.Linq.Queryable.dll": {} - } - }, - "System.Net.Http/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Net.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.WindowsRuntime": "4.0.10", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Net.Http.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Http.dll": {} - } - }, - "System.Net.Http.Rtc/4.0.0": { - "type": "package", - "dependencies": { - "System.Net.Http": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Net.Http.Rtc.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Http.Rtc.dll": {} - } - }, - "System.Net.NetworkInformation/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Runtime.InteropServices.WindowsRuntime": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Net.NetworkInformation.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.NetworkInformation.dll": {} - } - }, - "System.Net.Primitives/4.0.10": { - "type": "package", - "dependencies": { - "System.Private.Networking": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Net.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Primitives.dll": {} - } - }, - "System.Net.Requests/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.IO": "4.0.10", - "System.Net.Http": "4.0.0", - "System.Net.Primitives": "4.0.10", - "System.Net.WebHeaderCollection": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Net.Requests.dll": {} - }, - "runtime": { - "lib/dotnet/System.Net.Requests.dll": {} - } - }, - "System.Net.Sockets/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.Networking": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Net.Sockets.dll": {} - }, - "runtime": { - "lib/netcore50/System.Net.Sockets.dll": {} - } - }, - "System.Net.WebHeaderCollection/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections.NonGeneric": "4.0.0", - "System.Collections.Specialized": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Net.WebHeaderCollection.dll": {} - }, - "runtime": { - "lib/dotnet/System.Net.WebHeaderCollection.dll": {} - } - }, - "System.Numerics.Vectors/4.1.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/dotnet/System.Numerics.Vectors.dll": {} - } - }, - "System.Numerics.Vectors.WindowsRuntime/4.0.0": { - "type": "package", - "dependencies": { - "System.Numerics.Vectors": "4.1.0", - "System.Runtime": "4.0.20", - "System.Runtime.WindowsRuntime": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Numerics.Vectors.WindowsRuntime.dll": {} - }, - "runtime": { - "lib/dotnet/System.Numerics.Vectors.WindowsRuntime.dll": {} - } - }, - "System.ObjectModel/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/dotnet/System.ObjectModel.dll": {} - } - }, - "System.Private.DataContractSerialization/4.1.0": { - "type": "package", - "compile": { - "ref/netcore50/_._": {} - } - }, - "System.Private.Networking/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.Win32.Primitives": "4.0.0", - "System.Collections": "4.0.10", - "System.Collections.NonGeneric": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Overlapped": "4.0.0", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/_._": {} - }, - "runtime": { - "lib/netcore50/System.Private.Networking.dll": {} - } - }, - "System.Private.ServiceModel/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Collections.Concurrent": "4.0.10", - "System.Collections.NonGeneric": "4.0.0", - "System.Collections.Specialized": "4.0.0", - "System.ComponentModel.EventBasedAsync": "4.0.10", - "System.Diagnostics.Contracts": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.IO.Compression": "4.0.0", - "System.Linq": "4.0.0", - "System.Linq.Expressions": "4.0.10", - "System.Linq.Queryable": "4.0.0", - "System.Net.Http": "4.0.0", - "System.Net.Primitives": "4.0.10", - "System.Net.WebHeaderCollection": "4.0.0", - "System.ObjectModel": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.DispatchProxy": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.Serialization.Primitives": "4.0.10", - "System.Runtime.Serialization.Xml": "4.0.10", - "System.Runtime.WindowsRuntime": "4.0.10", - "System.Security.Claims": "4.0.0", - "System.Security.Principal": "4.0.0", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10", - "System.Threading.Timer": "4.0.0", - "System.Xml.ReaderWriter": "4.0.10", - "System.Xml.XmlDocument": "4.0.0", - "System.Xml.XmlSerializer": "4.0.10" - }, - "compile": { - "ref/netcore50/_._": {} - }, - "runtime": { - "lib/netcore50/System.Private.ServiceModel.dll": {} - } - }, - "System.Private.Uri/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/_._": {} - }, - "runtime": { - "lib/netcore50/System.Private.Uri.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Private.Uri.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection/4.0.10": { - "type": "package", - "dependencies": { - "System.IO": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Reflection.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.Context/4.0.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Reflection.Context.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.Context.dll": {} - } - }, - "System.Reflection.DispatchProxy/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Reflection.DispatchProxy.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.DispatchProxy.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.DispatchProxy.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.Extensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.10", - "System.Reflection": "4.0.10", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Reflection.Extensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.Metadata/1.0.22": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Collections.Immutable": "1.1.37", - "System.Diagnostics.Debug": "4.0.0", - "System.IO": "4.0.0", - "System.Reflection": "4.0.0", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.InteropServices": "4.0.0", - "System.Text.Encoding": "4.0.0", - "System.Text.Encoding.Extensions": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/dotnet/System.Reflection.Metadata.dll": {} - } - }, - "System.Reflection.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Threading": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Reflection.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.Primitives.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.Primitives.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Reflection.TypeExtensions/4.0.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Contracts": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Reflection.TypeExtensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Reflection.TypeExtensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Resources.ResourceManager/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Reflection": "4.0.10", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Resources.ResourceManager.dll": {} - }, - "runtime": { - "lib/netcore50/System.Resources.ResourceManager.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Resources.ResourceManager.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime/4.0.20": { - "type": "package", - "dependencies": { - "System.Private.Uri": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Runtime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Extensions/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.Runtime.Extensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Extensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Handles/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Runtime.Handles.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Handles.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Handles.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.InteropServices/4.0.20": { - "type": "package", - "dependencies": { - "System.Reflection": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Runtime.InteropServices.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.InteropServices.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.InteropServices.WindowsRuntime/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Numerics/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Numerics.dll": {} - } - }, - "System.Runtime.Serialization.Json/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.0.0", - "System.Private.DataContractSerialization": "4.1.0", - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Runtime.Serialization.Json.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Serialization.Json.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Json.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Serialization.Primitives/4.1.0": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.Serialization.Xml/4.1.0": { - "type": "package", - "dependencies": { - "System.IO": "4.0.0", - "System.Private.DataContractSerialization": "4.1.0", - "System.Runtime": "4.0.0", - "System.Runtime.Serialization.Primitives": "4.1.0", - "System.Text.Encoding": "4.0.0", - "System.Xml.ReaderWriter": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Runtime.Serialization.Xml.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.Serialization.Xml.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Xml.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.WindowsRuntime/4.0.10": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.0", - "System.IO": "4.0.10", - "System.ObjectModel": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Runtime.WindowsRuntime.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.WindowsRuntime.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Runtime.WindowsRuntime.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Runtime.WindowsRuntime.UI.Xaml/4.0.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.WindowsRuntime": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll": {} - }, - "runtime": { - "lib/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll": {} - } - }, - "System.Security.Claims/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Globalization": "4.0.0", - "System.IO": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Security.Principal": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Security.Claims.dll": {} - }, - "runtime": { - "lib/dotnet/System.Security.Claims.dll": {} - } - }, - "System.Security.Principal/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/netcore50/System.Security.Principal.dll": {} - }, - "runtime": { - "lib/netcore50/System.Security.Principal.dll": {} - } - }, - "System.ServiceModel.Duplex/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.Duplex.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Duplex.dll": {} - } - }, - "System.ServiceModel.Http/4.0.10": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/dotnet/System.ServiceModel.Http.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Http.dll": {} - } - }, - "System.ServiceModel.NetTcp/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.NetTcp.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.NetTcp.dll": {} - } - }, - "System.ServiceModel.Primitives/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.Primitives.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Primitives.dll": {} - } - }, - "System.ServiceModel.Security/4.0.0": { - "type": "package", - "dependencies": { - "System.Private.ServiceModel": "4.0.0", - "System.Runtime": "4.0.20" - }, - "compile": { - "ref/netcore50/System.ServiceModel.Security.dll": {} - }, - "runtime": { - "lib/netcore50/System.ServiceModel.Security.dll": {} - } - }, - "System.Text.Encoding/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Text.Encoding.dll": {} - }, - "runtime": { - "lib/netcore50/System.Text.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Text.Encoding.CodePages/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Reflection": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Text.Encoding.CodePages.dll": {} - }, - "runtime": { - "lib/dotnet/System.Text.Encoding.CodePages.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Text.Encoding": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Text.Encoding.Extensions.dll": {} - }, - "runtime": { - "lib/netcore50/System.Text.Encoding.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.Extensions.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Text.RegularExpressions/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Globalization": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/dotnet/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Threading.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Threading.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Threading.Overlapped/4.0.0": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Threading": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Threading.Overlapped.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Overlapped.dll": {} - } - }, - "System.Threading.Tasks/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Threading.Tasks.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Tasks.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Threading.Tasks.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Threading.Tasks.Dataflow/4.5.25": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.0", - "System.Collections.Concurrent": "4.0.0", - "System.Diagnostics.Debug": "4.0.0", - "System.Diagnostics.Tracing": "4.0.0", - "System.Dynamic.Runtime": "4.0.0", - "System.Linq": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Extensions": "4.0.0", - "System.Threading": "4.0.0", - "System.Threading.Tasks": "4.0.0" - }, - "compile": { - "lib/dotnet/System.Threading.Tasks.Dataflow.dll": {} - }, - "runtime": { - "lib/dotnet/System.Threading.Tasks.Dataflow.dll": {} - } - }, - "System.Threading.Tasks.Parallel/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections.Concurrent": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tracing": "4.0.20", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/netcore50/System.Threading.Tasks.Parallel.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Tasks.Parallel.dll": {} - } - }, - "System.Threading.Timer/4.0.0": { - "type": "package", - "compile": { - "ref/netcore50/System.Threading.Timer.dll": {} - }, - "runtime": { - "lib/netcore50/System.Threading.Timer.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Threading.Timer.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - }, - "System.Xml.ReaderWriter/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.InteropServices": "4.0.20", - "System.Text.Encoding": "4.0.10", - "System.Text.Encoding.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading.Tasks": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/dotnet/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Reflection": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/dotnet/System.Xml.XDocument.dll": {} - } - }, - "System.Xml.XmlDocument/4.0.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.10" - }, - "compile": { - "ref/dotnet/System.Xml.XmlDocument.dll": {} - }, - "runtime": { - "lib/dotnet/System.Xml.XmlDocument.dll": {} - } - }, - "System.Xml.XmlSerializer/4.0.10": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.10", - "System.Diagnostics.Debug": "4.0.10", - "System.Globalization": "4.0.10", - "System.IO": "4.0.10", - "System.Linq": "4.0.0", - "System.Reflection": "4.0.10", - "System.Reflection.Extensions": "4.0.0", - "System.Reflection.Primitives": "4.0.0", - "System.Reflection.TypeExtensions": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Text.RegularExpressions": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.10", - "System.Xml.XmlDocument": "4.0.0" - }, - "compile": { - "ref/dotnet/System.Xml.XmlSerializer.dll": {} - }, - "runtime": { - "lib/netcore50/System.Xml.XmlSerializer.dll": {} - }, - "runtimeTargets": { - "runtimes/win8-aot/lib/netcore50/System.Xml.XmlSerializer.dll": { - "assetType": "runtime", - "rid": "win8-aot" - } - } - } - } - }, - "libraries": { - "Microsoft.CSharp/4.0.0": { - "sha512": "oWqeKUxHXdK6dL2CFjgMcaBISbkk+AqEg+yvJHE4DElNzS4QaTsCflgkkqZwVlWby1Dg9zo9n+iCAMFefFdJ/A==", - "type": "package", - "path": "Microsoft.CSharp/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/Microsoft.CSharp.dll", - "lib/net45/_._", - "lib/netcore50/Microsoft.CSharp.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "microsoft.csharp.4.0.0.nupkg.sha512", - "microsoft.csharp.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/Microsoft.CSharp.dll", - "ref/dotnet/Microsoft.CSharp.xml", - "ref/dotnet/de/Microsoft.CSharp.xml", - "ref/dotnet/es/Microsoft.CSharp.xml", - "ref/dotnet/fr/Microsoft.CSharp.xml", - "ref/dotnet/it/Microsoft.CSharp.xml", - "ref/dotnet/ja/Microsoft.CSharp.xml", - "ref/dotnet/ko/Microsoft.CSharp.xml", - "ref/dotnet/ru/Microsoft.CSharp.xml", - "ref/dotnet/zh-hans/Microsoft.CSharp.xml", - "ref/dotnet/zh-hant/Microsoft.CSharp.xml", - "ref/net45/_._", - "ref/netcore50/Microsoft.CSharp.dll", - "ref/netcore50/Microsoft.CSharp.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._" - ] - }, - "Microsoft.NETCore/5.0.0": { - "sha512": "QQMp0yYQbIdfkKhdEE6Umh2Xonau7tasG36Trw/YlHoWgYQLp7T9L+ZD8EPvdj5ubRhtOuKEKwM7HMpkagB9ZA==", - "type": "package", - "path": "Microsoft.NETCore/5.0.0", - "files": [ - "_._", - "microsoft.netcore.5.0.0.nupkg.sha512", - "microsoft.netcore.nuspec" - ] - }, - "Microsoft.NETCore.Platforms/1.0.0": { - "sha512": "0N77OwGZpXqUco2C/ynv1os7HqdFYifvNIbveLDKqL5PZaz05Rl9enCwVBjF61aumHKueLWIJ3prnmdAXxww4A==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.0.0", - "files": [ - "microsoft.netcore.platforms.1.0.0.nupkg.sha512", - "microsoft.netcore.platforms.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.1.0", - "files": [ - "Microsoft.NETCore.Platforms.1.1.0.nupkg.sha512", - "Microsoft.NETCore.Platforms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Portable.Compatibility/1.0.0": { - "sha512": "5/IFqf2zN1jzktRJitxO+5kQ+0AilcIbPvSojSJwDG3cGNSMZg44LXLB5E9RkSETE0Wh4QoALdNh1koKoF7/mA==", - "type": "package", - "path": "Microsoft.NETCore.Portable.Compatibility/1.0.0", - "files": [ - "lib/dnxcore50/System.ComponentModel.DataAnnotations.dll", - "lib/dnxcore50/System.Core.dll", - "lib/dnxcore50/System.Net.dll", - "lib/dnxcore50/System.Numerics.dll", - "lib/dnxcore50/System.Runtime.Serialization.dll", - "lib/dnxcore50/System.ServiceModel.Web.dll", - "lib/dnxcore50/System.ServiceModel.dll", - "lib/dnxcore50/System.Windows.dll", - "lib/dnxcore50/System.Xml.Linq.dll", - "lib/dnxcore50/System.Xml.Serialization.dll", - "lib/dnxcore50/System.Xml.dll", - "lib/dnxcore50/System.dll", - "lib/net45/_._", - "lib/netcore50/System.ComponentModel.DataAnnotations.dll", - "lib/netcore50/System.Core.dll", - "lib/netcore50/System.Net.dll", - "lib/netcore50/System.Numerics.dll", - "lib/netcore50/System.Runtime.Serialization.dll", - "lib/netcore50/System.ServiceModel.Web.dll", - "lib/netcore50/System.ServiceModel.dll", - "lib/netcore50/System.Windows.dll", - "lib/netcore50/System.Xml.Linq.dll", - "lib/netcore50/System.Xml.Serialization.dll", - "lib/netcore50/System.Xml.dll", - "lib/netcore50/System.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "microsoft.netcore.portable.compatibility.1.0.0.nupkg.sha512", - "microsoft.netcore.portable.compatibility.nuspec", - "ref/dotnet/System.ComponentModel.DataAnnotations.dll", - "ref/dotnet/System.Core.dll", - "ref/dotnet/System.Net.dll", - "ref/dotnet/System.Numerics.dll", - "ref/dotnet/System.Runtime.Serialization.dll", - "ref/dotnet/System.ServiceModel.Web.dll", - "ref/dotnet/System.ServiceModel.dll", - "ref/dotnet/System.Windows.dll", - "ref/dotnet/System.Xml.Linq.dll", - "ref/dotnet/System.Xml.Serialization.dll", - "ref/dotnet/System.Xml.dll", - "ref/dotnet/System.dll", - "ref/dotnet/mscorlib.dll", - "ref/net45/_._", - "ref/netcore50/System.ComponentModel.DataAnnotations.dll", - "ref/netcore50/System.Core.dll", - "ref/netcore50/System.Net.dll", - "ref/netcore50/System.Numerics.dll", - "ref/netcore50/System.Runtime.Serialization.dll", - "ref/netcore50/System.ServiceModel.Web.dll", - "ref/netcore50/System.ServiceModel.dll", - "ref/netcore50/System.Windows.dll", - "ref/netcore50/System.Xml.Linq.dll", - "ref/netcore50/System.Xml.Serialization.dll", - "ref/netcore50/System.Xml.dll", - "ref/netcore50/System.dll", - "ref/netcore50/mscorlib.dll", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/aot/lib/netcore50/System.ComponentModel.DataAnnotations.dll", - "runtimes/aot/lib/netcore50/System.Core.dll", - "runtimes/aot/lib/netcore50/System.Net.dll", - "runtimes/aot/lib/netcore50/System.Numerics.dll", - "runtimes/aot/lib/netcore50/System.Runtime.Serialization.dll", - "runtimes/aot/lib/netcore50/System.ServiceModel.Web.dll", - "runtimes/aot/lib/netcore50/System.ServiceModel.dll", - "runtimes/aot/lib/netcore50/System.Windows.dll", - "runtimes/aot/lib/netcore50/System.Xml.Linq.dll", - "runtimes/aot/lib/netcore50/System.Xml.Serialization.dll", - "runtimes/aot/lib/netcore50/System.Xml.dll", - "runtimes/aot/lib/netcore50/System.dll", - "runtimes/aot/lib/netcore50/mscorlib.dll" - ] - }, - "Microsoft.NETCore.Runtime/1.0.1": { - "sha512": "WIblAPds88Mwvcu8OjmspmHLG9zyay//n1jMVxQlxikGzZBIeRDz/O7o9qBtOR+vDpfn+Y2EbzdCmPb3brMGRg==", - "type": "package", - "path": "Microsoft.NETCore.Runtime/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.runtime.1.0.1.nupkg.sha512", - "microsoft.netcore.runtime.nuspec" - ] - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.1": { - "sha512": "EQlk4pidS+VppUSjhCCMXYlw9mf/47BwyM5XIX/gQHp5/qedKG7jypSMy0SGwv80U5mr1juQC0YROqjr7j8nTA==", - "type": "package", - "path": "Microsoft.NETCore.Runtime.CoreCLR/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.runtime.coreclr.1.0.1.nupkg.sha512", - "microsoft.netcore.runtime.coreclr.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Runtime.Native/1.0.1": { - "sha512": "VeZR/qn/+FRH5rd1htnwBFIzSBW6xiA7Yu2UzaHKKlyf9Ev9xVXIOitWnkvb/tJMTKdmiCzmfi2TsAMajUHNZA==", - "type": "package", - "path": "Microsoft.NETCore.Runtime.Native/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.runtime.native.1.0.1.nupkg.sha512", - "microsoft.netcore.runtime.native.nuspec" - ] - }, - "Microsoft.NETCore.Targets/1.0.0": { - "sha512": "XfITpPjYLYRmAeZtb9diw6P7ylLQsSC1U2a/xj10iQpnHxkiLEBXop/psw15qMPuNca7lqgxWvzZGpQxphuXaw==", - "type": "package", - "path": "Microsoft.NETCore.Targets/1.0.0", - "files": [ - "microsoft.netcore.targets.1.0.0.nupkg.sha512", - "microsoft.netcore.targets.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets/1.1.0": { - "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", - "type": "package", - "path": "Microsoft.NETCore.Targets/1.1.0", - "files": [ - "Microsoft.NETCore.Targets.1.1.0.nupkg.sha512", - "Microsoft.NETCore.Targets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets.UniversalWindowsPlatform/5.0.0": { - "sha512": "jszcJ6okLlhqF4OQbhSbixLOuLUyVT3BP7Y7/i7fcDMwnHBd1Pmdz6M1Al9SMDKVLA2oSaItg4tq6C0ydv8lYQ==", - "type": "package", - "path": "Microsoft.NETCore.Targets.UniversalWindowsPlatform/5.0.0", - "files": [ - "microsoft.netcore.targets.universalwindowsplatform.5.0.0.nupkg.sha512", - "microsoft.netcore.targets.universalwindowsplatform.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.UniversalWindowsPlatform/5.1.0": { - "sha512": "6xdZAZALSJB65rRfOAfB6+aVBBc42Oz8jr8Cqy8J7A34zWVBV9l612lwbEsf6KJ1YdtocJsNcA8sLId3vJL/FA==", - "type": "package", - "path": "Microsoft.NETCore.UniversalWindowsPlatform/5.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "microsoft.netcore.universalwindowsplatform.5.1.0.nupkg.sha512", - "microsoft.netcore.universalwindowsplatform.nuspec" - ] - }, - "Microsoft.VisualBasic/10.0.0": { - "sha512": "5BEm2/HAVd97whRlCChU7rmSh/9cwGlZ/NTNe3Jl07zuPWfKQq5TUvVNUmdvmEe8QRecJLZ4/e7WF1i1O8V42g==", - "type": "package", - "path": "Microsoft.VisualBasic/10.0.0", - "files": [ - "lib/dotnet/Microsoft.VisualBasic.dll", - "lib/net45/_._", - "lib/netcore50/Microsoft.VisualBasic.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "microsoft.visualbasic.10.0.0.nupkg.sha512", - "microsoft.visualbasic.nuspec", - "ref/dotnet/Microsoft.VisualBasic.dll", - "ref/dotnet/Microsoft.VisualBasic.xml", - "ref/dotnet/de/Microsoft.VisualBasic.xml", - "ref/dotnet/es/Microsoft.VisualBasic.xml", - "ref/dotnet/fr/Microsoft.VisualBasic.xml", - "ref/dotnet/it/Microsoft.VisualBasic.xml", - "ref/dotnet/ja/Microsoft.VisualBasic.xml", - "ref/dotnet/ko/Microsoft.VisualBasic.xml", - "ref/dotnet/ru/Microsoft.VisualBasic.xml", - "ref/dotnet/zh-hans/Microsoft.VisualBasic.xml", - "ref/dotnet/zh-hant/Microsoft.VisualBasic.xml", - "ref/net45/_._", - "ref/netcore50/Microsoft.VisualBasic.dll", - "ref/netcore50/Microsoft.VisualBasic.xml", - "ref/win8/_._", - "ref/wpa81/_._" - ] - }, - "Microsoft.Win32.Primitives/4.0.0": { - "sha512": "CypEz9/lLOup8CEhiAmvr7aLs1zKPYyEU1sxQeEr6G0Ci8/F0Y6pYR1zzkROjM8j8Mq0typmbu676oYyvErQvg==", - "type": "package", - "path": "Microsoft.Win32.Primitives/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/Microsoft.Win32.Primitives.dll", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "microsoft.win32.primitives.4.0.0.nupkg.sha512", - "microsoft.win32.primitives.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/Microsoft.Win32.Primitives.dll", - "ref/dotnet/Microsoft.Win32.Primitives.xml", - "ref/dotnet/de/Microsoft.Win32.Primitives.xml", - "ref/dotnet/es/Microsoft.Win32.Primitives.xml", - "ref/dotnet/fr/Microsoft.Win32.Primitives.xml", - "ref/dotnet/it/Microsoft.Win32.Primitives.xml", - "ref/dotnet/ja/Microsoft.Win32.Primitives.xml", - "ref/dotnet/ko/Microsoft.Win32.Primitives.xml", - "ref/dotnet/ru/Microsoft.Win32.Primitives.xml", - "ref/dotnet/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/dotnet/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._" - ] - }, - "Microsoft.Win32.Primitives/4.3.0": { - "sha512": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "type": "package", - "path": "Microsoft.Win32.Primitives/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "microsoft.win32.primitives.4.3.0.nupkg.sha512", - "microsoft.win32.primitives.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "NETStandard.Library/1.6.1": { - "sha512": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "type": "package", - "path": "NETStandard.Library/1.6.1", - "files": [ - "NETStandard.Library.1.6.1.nupkg.sha512", - "NETStandard.Library.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt" - ] - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", - "type": "package", - "path": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", - "type": "package", - "path": "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", - "type": "package", - "path": "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.native.System/4.3.0": { - "sha512": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "type": "package", - "path": "runtime.native.System/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.4.3.0.nupkg.sha512", - "runtime.native.System.nuspec" - ] - }, - "runtime.native.System.IO.Compression/4.3.0": { - "sha512": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "type": "package", - "path": "runtime.native.System.IO.Compression/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.IO.Compression.4.3.0.nupkg.sha512", - "runtime.native.System.IO.Compression.nuspec" - ] - }, - "runtime.native.System.Net.Http/4.3.0": { - "sha512": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "type": "package", - "path": "runtime.native.System.Net.Http/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Net.Http.4.3.0.nupkg.sha512", - "runtime.native.System.Net.Http.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography.Apple/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.Apple.4.3.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.Apple.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.OpenSsl.nuspec" - ] - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", - "type": "package", - "path": "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", - "type": "package", - "path": "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib" - ] - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", - "type": "package", - "path": "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", - "type": "package", - "path": "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", - "type": "package", - "path": "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", - "type": "package", - "path": "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "System.AppContext/4.0.0": { - "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", - "type": "package", - "path": "System.AppContext/4.0.0", - "files": [ - "lib/DNXCore50/System.AppContext.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.AppContext.dll", - "ref/dotnet/System.AppContext.xml", - "ref/dotnet/de/System.AppContext.xml", - "ref/dotnet/es/System.AppContext.xml", - "ref/dotnet/fr/System.AppContext.xml", - "ref/dotnet/it/System.AppContext.xml", - "ref/dotnet/ja/System.AppContext.xml", - "ref/dotnet/ko/System.AppContext.xml", - "ref/dotnet/ru/System.AppContext.xml", - "ref/dotnet/zh-hans/System.AppContext.xml", - "ref/dotnet/zh-hant/System.AppContext.xml", - "ref/net46/System.AppContext.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.appcontext.4.0.0.nupkg.sha512", - "system.appcontext.nuspec" - ] - }, - "System.AppContext/4.3.0": { - "sha512": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "type": "package", - "path": "System.AppContext/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/net463/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/netstandard1.6/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.AppContext.dll", - "ref/net463/System.AppContext.dll", - "ref/netstandard/_._", - "ref/netstandard1.3/System.AppContext.dll", - "ref/netstandard1.3/System.AppContext.xml", - "ref/netstandard1.3/de/System.AppContext.xml", - "ref/netstandard1.3/es/System.AppContext.xml", - "ref/netstandard1.3/fr/System.AppContext.xml", - "ref/netstandard1.3/it/System.AppContext.xml", - "ref/netstandard1.3/ja/System.AppContext.xml", - "ref/netstandard1.3/ko/System.AppContext.xml", - "ref/netstandard1.3/ru/System.AppContext.xml", - "ref/netstandard1.3/zh-hans/System.AppContext.xml", - "ref/netstandard1.3/zh-hant/System.AppContext.xml", - "ref/netstandard1.6/System.AppContext.dll", - "ref/netstandard1.6/System.AppContext.xml", - "ref/netstandard1.6/de/System.AppContext.xml", - "ref/netstandard1.6/es/System.AppContext.xml", - "ref/netstandard1.6/fr/System.AppContext.xml", - "ref/netstandard1.6/it/System.AppContext.xml", - "ref/netstandard1.6/ja/System.AppContext.xml", - "ref/netstandard1.6/ko/System.AppContext.xml", - "ref/netstandard1.6/ru/System.AppContext.xml", - "ref/netstandard1.6/zh-hans/System.AppContext.xml", - "ref/netstandard1.6/zh-hant/System.AppContext.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.AppContext.dll", - "system.appcontext.4.3.0.nupkg.sha512", - "system.appcontext.nuspec" - ] - }, - "System.Buffers/4.3.0": { - "sha512": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "type": "package", - "path": "System.Buffers/4.3.0", - "files": [ - "System.Buffers.4.3.0.nupkg.sha512", - "System.Buffers.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/.xml", - "lib/netstandard1.1/System.Buffers.dll" - ] - }, - "System.Collections/4.0.10": { - "sha512": "ux6ilcZZjV/Gp7JEZpe+2V1eTueq6NuoGRM3eZCFuPM25hLVVgCRuea6STW8hvqreIOE59irJk5/ovpA5xQipw==", - "type": "package", - "path": "System.Collections/4.0.10", - "files": [ - "lib/DNXCore50/System.Collections.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Collections.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.dll", - "ref/dotnet/System.Collections.xml", - "ref/dotnet/de/System.Collections.xml", - "ref/dotnet/es/System.Collections.xml", - "ref/dotnet/fr/System.Collections.xml", - "ref/dotnet/it/System.Collections.xml", - "ref/dotnet/ja/System.Collections.xml", - "ref/dotnet/ko/System.Collections.xml", - "ref/dotnet/ru/System.Collections.xml", - "ref/dotnet/zh-hans/System.Collections.xml", - "ref/dotnet/zh-hant/System.Collections.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Collections.dll", - "system.collections.4.0.10.nupkg.sha512", - "system.collections.nuspec" - ] - }, - "System.Collections/4.3.0": { - "sha512": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "type": "package", - "path": "System.Collections/4.3.0", - "files": [ - "System.Collections.4.3.0.nupkg.sha512", - "System.Collections.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.dll", - "ref/netcore50/System.Collections.xml", - "ref/netcore50/de/System.Collections.xml", - "ref/netcore50/es/System.Collections.xml", - "ref/netcore50/fr/System.Collections.xml", - "ref/netcore50/it/System.Collections.xml", - "ref/netcore50/ja/System.Collections.xml", - "ref/netcore50/ko/System.Collections.xml", - "ref/netcore50/ru/System.Collections.xml", - "ref/netcore50/zh-hans/System.Collections.xml", - "ref/netcore50/zh-hant/System.Collections.xml", - "ref/netstandard1.0/System.Collections.dll", - "ref/netstandard1.0/System.Collections.xml", - "ref/netstandard1.0/de/System.Collections.xml", - "ref/netstandard1.0/es/System.Collections.xml", - "ref/netstandard1.0/fr/System.Collections.xml", - "ref/netstandard1.0/it/System.Collections.xml", - "ref/netstandard1.0/ja/System.Collections.xml", - "ref/netstandard1.0/ko/System.Collections.xml", - "ref/netstandard1.0/ru/System.Collections.xml", - "ref/netstandard1.0/zh-hans/System.Collections.xml", - "ref/netstandard1.0/zh-hant/System.Collections.xml", - "ref/netstandard1.3/System.Collections.dll", - "ref/netstandard1.3/System.Collections.xml", - "ref/netstandard1.3/de/System.Collections.xml", - "ref/netstandard1.3/es/System.Collections.xml", - "ref/netstandard1.3/fr/System.Collections.xml", - "ref/netstandard1.3/it/System.Collections.xml", - "ref/netstandard1.3/ja/System.Collections.xml", - "ref/netstandard1.3/ko/System.Collections.xml", - "ref/netstandard1.3/ru/System.Collections.xml", - "ref/netstandard1.3/zh-hans/System.Collections.xml", - "ref/netstandard1.3/zh-hant/System.Collections.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Concurrent/4.0.10": { - "sha512": "ZtMEqOPAjAIqR8fqom9AOKRaB94a+emO2O8uOP6vyJoNswSPrbiwN7iH53rrVpvjMVx0wr4/OMpI7486uGZjbw==", - "type": "package", - "path": "System.Collections.Concurrent/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Collections.Concurrent.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.Concurrent.dll", - "ref/dotnet/System.Collections.Concurrent.xml", - "ref/dotnet/de/System.Collections.Concurrent.xml", - "ref/dotnet/es/System.Collections.Concurrent.xml", - "ref/dotnet/fr/System.Collections.Concurrent.xml", - "ref/dotnet/it/System.Collections.Concurrent.xml", - "ref/dotnet/ja/System.Collections.Concurrent.xml", - "ref/dotnet/ko/System.Collections.Concurrent.xml", - "ref/dotnet/ru/System.Collections.Concurrent.xml", - "ref/dotnet/zh-hans/System.Collections.Concurrent.xml", - "ref/dotnet/zh-hant/System.Collections.Concurrent.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.collections.concurrent.4.0.10.nupkg.sha512", - "system.collections.concurrent.nuspec" - ] - }, - "System.Collections.Concurrent/4.3.0": { - "sha512": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "type": "package", - "path": "System.Collections.Concurrent/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Collections.Concurrent.dll", - "lib/netstandard1.3/System.Collections.Concurrent.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.Concurrent.dll", - "ref/netcore50/System.Collections.Concurrent.xml", - "ref/netcore50/de/System.Collections.Concurrent.xml", - "ref/netcore50/es/System.Collections.Concurrent.xml", - "ref/netcore50/fr/System.Collections.Concurrent.xml", - "ref/netcore50/it/System.Collections.Concurrent.xml", - "ref/netcore50/ja/System.Collections.Concurrent.xml", - "ref/netcore50/ko/System.Collections.Concurrent.xml", - "ref/netcore50/ru/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hans/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.1/System.Collections.Concurrent.dll", - "ref/netstandard1.1/System.Collections.Concurrent.xml", - "ref/netstandard1.1/de/System.Collections.Concurrent.xml", - "ref/netstandard1.1/es/System.Collections.Concurrent.xml", - "ref/netstandard1.1/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.1/it/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.3/System.Collections.Concurrent.dll", - "ref/netstandard1.3/System.Collections.Concurrent.xml", - "ref/netstandard1.3/de/System.Collections.Concurrent.xml", - "ref/netstandard1.3/es/System.Collections.Concurrent.xml", - "ref/netstandard1.3/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.3/it/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hant/System.Collections.Concurrent.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.collections.concurrent.4.3.0.nupkg.sha512", - "system.collections.concurrent.nuspec" - ] - }, - "System.Collections.Immutable/1.1.37": { - "sha512": "fTpqwZYBzoklTT+XjTRK8KxvmrGkYHzBiylCcKyQcxiOM8k+QvhNBxRvFHDWzy4OEP5f8/9n+xQ9mEgEXY+muA==", - "type": "package", - "path": "System.Collections.Immutable/1.1.37", - "files": [ - "lib/dotnet/System.Collections.Immutable.dll", - "lib/dotnet/System.Collections.Immutable.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml", - "system.collections.immutable.1.1.37.nupkg.sha512", - "system.collections.immutable.nuspec" - ] - }, - "System.Collections.NonGeneric/4.0.0": { - "sha512": "rVgwrFBMkmp8LI6GhAYd6Bx+2uLIXjRfNg6Ie+ASfX8ESuh9e2HNxFy2yh1MPIXZq3OAYa+0mmULVwpnEC6UDA==", - "type": "package", - "path": "System.Collections.NonGeneric/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Collections.NonGeneric.dll", - "lib/net46/System.Collections.NonGeneric.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.NonGeneric.dll", - "ref/dotnet/System.Collections.NonGeneric.xml", - "ref/dotnet/de/System.Collections.NonGeneric.xml", - "ref/dotnet/es/System.Collections.NonGeneric.xml", - "ref/dotnet/fr/System.Collections.NonGeneric.xml", - "ref/dotnet/it/System.Collections.NonGeneric.xml", - "ref/dotnet/ja/System.Collections.NonGeneric.xml", - "ref/dotnet/ko/System.Collections.NonGeneric.xml", - "ref/dotnet/ru/System.Collections.NonGeneric.xml", - "ref/dotnet/zh-hans/System.Collections.NonGeneric.xml", - "ref/dotnet/zh-hant/System.Collections.NonGeneric.xml", - "ref/net46/System.Collections.NonGeneric.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.collections.nongeneric.4.0.0.nupkg.sha512", - "system.collections.nongeneric.nuspec" - ] - }, - "System.Collections.Specialized/4.0.0": { - "sha512": "poJFwQCUOoXqvdoGxx+3p8Z63yawcYKPBSFP67Z2jICeOINvEIQZN7mVOAnC7gsVF0WU+A2wtVwfhagC7UCgAg==", - "type": "package", - "path": "System.Collections.Specialized/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Collections.Specialized.dll", - "lib/net46/System.Collections.Specialized.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Collections.Specialized.dll", - "ref/dotnet/System.Collections.Specialized.xml", - "ref/dotnet/de/System.Collections.Specialized.xml", - "ref/dotnet/es/System.Collections.Specialized.xml", - "ref/dotnet/fr/System.Collections.Specialized.xml", - "ref/dotnet/it/System.Collections.Specialized.xml", - "ref/dotnet/ja/System.Collections.Specialized.xml", - "ref/dotnet/ko/System.Collections.Specialized.xml", - "ref/dotnet/ru/System.Collections.Specialized.xml", - "ref/dotnet/zh-hans/System.Collections.Specialized.xml", - "ref/dotnet/zh-hant/System.Collections.Specialized.xml", - "ref/net46/System.Collections.Specialized.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.collections.specialized.4.0.0.nupkg.sha512", - "system.collections.specialized.nuspec" - ] - }, - "System.ComponentModel/4.0.0": { - "sha512": "BzpLdSi++ld7rJLOOt5f/G9GxujP202bBgKORsHcGV36rLB0mfSA2h8chTMoBzFhgN7TE14TmJ2J7Q1RyNCTAw==", - "type": "package", - "path": "System.ComponentModel/4.0.0", - "files": [ - "lib/dotnet/System.ComponentModel.dll", - "lib/net45/_._", - "lib/netcore50/System.ComponentModel.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.ComponentModel.dll", - "ref/dotnet/System.ComponentModel.xml", - "ref/dotnet/de/System.ComponentModel.xml", - "ref/dotnet/es/System.ComponentModel.xml", - "ref/dotnet/fr/System.ComponentModel.xml", - "ref/dotnet/it/System.ComponentModel.xml", - "ref/dotnet/ja/System.ComponentModel.xml", - "ref/dotnet/ko/System.ComponentModel.xml", - "ref/dotnet/ru/System.ComponentModel.xml", - "ref/dotnet/zh-hans/System.ComponentModel.xml", - "ref/dotnet/zh-hant/System.ComponentModel.xml", - "ref/net45/_._", - "ref/netcore50/System.ComponentModel.dll", - "ref/netcore50/System.ComponentModel.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.componentmodel.4.0.0.nupkg.sha512", - "system.componentmodel.nuspec" - ] - }, - "System.ComponentModel.Annotations/4.0.10": { - "sha512": "7+XGyEZx24nP1kpHxCB9e+c6D0fdVDvFwE1xujE9BzlXyNVcy5J5aIO0H/ECupx21QpyRvzZibGAHfL/XLL6dw==", - "type": "package", - "path": "System.ComponentModel.Annotations/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.ComponentModel.Annotations.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ComponentModel.Annotations.dll", - "ref/dotnet/System.ComponentModel.Annotations.xml", - "ref/dotnet/de/System.ComponentModel.Annotations.xml", - "ref/dotnet/es/System.ComponentModel.Annotations.xml", - "ref/dotnet/fr/System.ComponentModel.Annotations.xml", - "ref/dotnet/it/System.ComponentModel.Annotations.xml", - "ref/dotnet/ja/System.ComponentModel.Annotations.xml", - "ref/dotnet/ko/System.ComponentModel.Annotations.xml", - "ref/dotnet/ru/System.ComponentModel.Annotations.xml", - "ref/dotnet/zh-hans/System.ComponentModel.Annotations.xml", - "ref/dotnet/zh-hant/System.ComponentModel.Annotations.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.componentmodel.annotations.4.0.10.nupkg.sha512", - "system.componentmodel.annotations.nuspec" - ] - }, - "System.ComponentModel.EventBasedAsync/4.0.10": { - "sha512": "d6kXcHUgP0jSPXEQ6hXJYCO6CzfoCi7t9vR3BfjSQLrj4HzpuATpx1gkN7itmTW1O+wjuw6rai4378Nj6N70yw==", - "type": "package", - "path": "System.ComponentModel.EventBasedAsync/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.ComponentModel.EventBasedAsync.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ComponentModel.EventBasedAsync.dll", - "ref/dotnet/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/de/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/es/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/fr/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/it/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/ja/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/ko/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/ru/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/zh-hans/System.ComponentModel.EventBasedAsync.xml", - "ref/dotnet/zh-hant/System.ComponentModel.EventBasedAsync.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.componentmodel.eventbasedasync.4.0.10.nupkg.sha512", - "system.componentmodel.eventbasedasync.nuspec" - ] - }, - "System.Console/4.3.0": { - "sha512": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "type": "package", - "path": "System.Console/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Console.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Console.dll", - "ref/netstandard1.3/System.Console.dll", - "ref/netstandard1.3/System.Console.xml", - "ref/netstandard1.3/de/System.Console.xml", - "ref/netstandard1.3/es/System.Console.xml", - "ref/netstandard1.3/fr/System.Console.xml", - "ref/netstandard1.3/it/System.Console.xml", - "ref/netstandard1.3/ja/System.Console.xml", - "ref/netstandard1.3/ko/System.Console.xml", - "ref/netstandard1.3/ru/System.Console.xml", - "ref/netstandard1.3/zh-hans/System.Console.xml", - "ref/netstandard1.3/zh-hant/System.Console.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.console.4.3.0.nupkg.sha512", - "system.console.nuspec" - ] - }, - "System.Data.Common/4.0.0": { - "sha512": "SA7IdoTWiImVr0exDM68r0mKmR4f/qFGxZUrJQKu4YS7F+3afWzSOCezHxWdevQ0ONi4WRQsOiv+Zf9p8H0Feg==", - "type": "package", - "path": "System.Data.Common/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Data.Common.dll", - "lib/net46/System.Data.Common.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Data.Common.dll", - "ref/dotnet/System.Data.Common.xml", - "ref/dotnet/de/System.Data.Common.xml", - "ref/dotnet/es/System.Data.Common.xml", - "ref/dotnet/fr/System.Data.Common.xml", - "ref/dotnet/it/System.Data.Common.xml", - "ref/dotnet/ja/System.Data.Common.xml", - "ref/dotnet/ko/System.Data.Common.xml", - "ref/dotnet/ru/System.Data.Common.xml", - "ref/dotnet/zh-hans/System.Data.Common.xml", - "ref/dotnet/zh-hant/System.Data.Common.xml", - "ref/net46/System.Data.Common.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.data.common.4.0.0.nupkg.sha512", - "system.data.common.nuspec" - ] - }, - "System.Diagnostics.Contracts/4.0.0": { - "sha512": "lMc7HNmyIsu0pKTdA4wf+FMq5jvouUd+oUpV4BdtyqoV0Pkbg9u/7lTKFGqpjZRQosWHq1+B32Lch2wf4AmloA==", - "type": "package", - "path": "System.Diagnostics.Contracts/4.0.0", - "files": [ - "lib/DNXCore50/System.Diagnostics.Contracts.dll", - "lib/net45/_._", - "lib/netcore50/System.Diagnostics.Contracts.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Diagnostics.Contracts.dll", - "ref/dotnet/System.Diagnostics.Contracts.xml", - "ref/dotnet/de/System.Diagnostics.Contracts.xml", - "ref/dotnet/es/System.Diagnostics.Contracts.xml", - "ref/dotnet/fr/System.Diagnostics.Contracts.xml", - "ref/dotnet/it/System.Diagnostics.Contracts.xml", - "ref/dotnet/ja/System.Diagnostics.Contracts.xml", - "ref/dotnet/ko/System.Diagnostics.Contracts.xml", - "ref/dotnet/ru/System.Diagnostics.Contracts.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Contracts.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Contracts.xml", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Contracts.dll", - "ref/netcore50/System.Diagnostics.Contracts.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Contracts.dll", - "system.diagnostics.contracts.4.0.0.nupkg.sha512", - "system.diagnostics.contracts.nuspec" - ] - }, - "System.Diagnostics.Debug/4.0.10": { - "sha512": "pi2KthuvI2LWV2c2V+fwReDsDiKpNl040h6DcwFOb59SafsPT/V1fCy0z66OKwysurJkBMmp5j5CBe3Um+ub0g==", - "type": "package", - "path": "System.Diagnostics.Debug/4.0.10", - "files": [ - "lib/DNXCore50/System.Diagnostics.Debug.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Diagnostics.Debug.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Diagnostics.Debug.dll", - "ref/dotnet/System.Diagnostics.Debug.xml", - "ref/dotnet/de/System.Diagnostics.Debug.xml", - "ref/dotnet/es/System.Diagnostics.Debug.xml", - "ref/dotnet/fr/System.Diagnostics.Debug.xml", - "ref/dotnet/it/System.Diagnostics.Debug.xml", - "ref/dotnet/ja/System.Diagnostics.Debug.xml", - "ref/dotnet/ko/System.Diagnostics.Debug.xml", - "ref/dotnet/ru/System.Diagnostics.Debug.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Debug.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Debug.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll", - "system.diagnostics.debug.4.0.10.nupkg.sha512", - "system.diagnostics.debug.nuspec" - ] - }, - "System.Diagnostics.Debug/4.3.0": { - "sha512": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "type": "package", - "path": "System.Diagnostics.Debug/4.3.0", - "files": [ - "System.Diagnostics.Debug.4.3.0.nupkg.sha512", - "System.Diagnostics.Debug.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Debug.dll", - "ref/netcore50/System.Diagnostics.Debug.xml", - "ref/netcore50/de/System.Diagnostics.Debug.xml", - "ref/netcore50/es/System.Diagnostics.Debug.xml", - "ref/netcore50/fr/System.Diagnostics.Debug.xml", - "ref/netcore50/it/System.Diagnostics.Debug.xml", - "ref/netcore50/ja/System.Diagnostics.Debug.xml", - "ref/netcore50/ko/System.Diagnostics.Debug.xml", - "ref/netcore50/ru/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/System.Diagnostics.Debug.dll", - "ref/netstandard1.0/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/System.Diagnostics.Debug.dll", - "ref/netstandard1.3/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "sha512": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", - "type": "package", - "path": "System.Diagnostics.DiagnosticSource/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Diagnostics.DiagnosticSource.dll", - "lib/net46/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.xml", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.dll", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.xml", - "system.diagnostics.diagnosticsource.4.3.0.nupkg.sha512", - "system.diagnostics.diagnosticsource.nuspec" - ] - }, - "System.Diagnostics.StackTrace/4.0.0": { - "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", - "type": "package", - "path": "System.Diagnostics.StackTrace/4.0.0", - "files": [ - "lib/DNXCore50/System.Diagnostics.StackTrace.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.StackTrace.dll", - "lib/netcore50/System.Diagnostics.StackTrace.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Diagnostics.StackTrace.dll", - "ref/dotnet/System.Diagnostics.StackTrace.xml", - "ref/dotnet/de/System.Diagnostics.StackTrace.xml", - "ref/dotnet/es/System.Diagnostics.StackTrace.xml", - "ref/dotnet/fr/System.Diagnostics.StackTrace.xml", - "ref/dotnet/it/System.Diagnostics.StackTrace.xml", - "ref/dotnet/ja/System.Diagnostics.StackTrace.xml", - "ref/dotnet/ko/System.Diagnostics.StackTrace.xml", - "ref/dotnet/ru/System.Diagnostics.StackTrace.xml", - "ref/dotnet/zh-hans/System.Diagnostics.StackTrace.xml", - "ref/dotnet/zh-hant/System.Diagnostics.StackTrace.xml", - "ref/net46/System.Diagnostics.StackTrace.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.StackTrace.dll", - "system.diagnostics.stacktrace.4.0.0.nupkg.sha512", - "system.diagnostics.stacktrace.nuspec" - ] - }, - "System.Diagnostics.Tools/4.0.0": { - "sha512": "uw5Qi2u5Cgtv4xv3+8DeB63iaprPcaEHfpeJqlJiLjIVy6v0La4ahJ6VW9oPbJNIjcavd24LKq0ctT9ssuQXsw==", - "type": "package", - "path": "System.Diagnostics.Tools/4.0.0", - "files": [ - "lib/DNXCore50/System.Diagnostics.Tools.dll", - "lib/net45/_._", - "lib/netcore50/System.Diagnostics.Tools.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Diagnostics.Tools.dll", - "ref/dotnet/System.Diagnostics.Tools.xml", - "ref/dotnet/de/System.Diagnostics.Tools.xml", - "ref/dotnet/es/System.Diagnostics.Tools.xml", - "ref/dotnet/fr/System.Diagnostics.Tools.xml", - "ref/dotnet/it/System.Diagnostics.Tools.xml", - "ref/dotnet/ja/System.Diagnostics.Tools.xml", - "ref/dotnet/ko/System.Diagnostics.Tools.xml", - "ref/dotnet/ru/System.Diagnostics.Tools.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Tools.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Tools.xml", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tools.dll", - "system.diagnostics.tools.4.0.0.nupkg.sha512", - "system.diagnostics.tools.nuspec" - ] - }, - "System.Diagnostics.Tools/4.3.0": { - "sha512": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "type": "package", - "path": "System.Diagnostics.Tools/4.3.0", - "files": [ - "System.Diagnostics.Tools.4.3.0.nupkg.sha512", - "System.Diagnostics.Tools.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/netcore50/de/System.Diagnostics.Tools.xml", - "ref/netcore50/es/System.Diagnostics.Tools.xml", - "ref/netcore50/fr/System.Diagnostics.Tools.xml", - "ref/netcore50/it/System.Diagnostics.Tools.xml", - "ref/netcore50/ja/System.Diagnostics.Tools.xml", - "ref/netcore50/ko/System.Diagnostics.Tools.xml", - "ref/netcore50/ru/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/System.Diagnostics.Tools.dll", - "ref/netstandard1.0/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/de/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/es/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/it/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Tools.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Tracing/4.0.20": { - "sha512": "gn/wexGHc35Fv++5L1gYHMY5g25COfiZ0PGrL+3PfwzoJd4X2LbTAm/U8d385SI6BKQBI/z4dQfvneS9J27+Tw==", - "type": "package", - "path": "System.Diagnostics.Tracing/4.0.20", - "files": [ - "lib/DNXCore50/System.Diagnostics.Tracing.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Diagnostics.Tracing.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Diagnostics.Tracing.dll", - "ref/dotnet/System.Diagnostics.Tracing.xml", - "ref/dotnet/de/System.Diagnostics.Tracing.xml", - "ref/dotnet/es/System.Diagnostics.Tracing.xml", - "ref/dotnet/fr/System.Diagnostics.Tracing.xml", - "ref/dotnet/it/System.Diagnostics.Tracing.xml", - "ref/dotnet/ja/System.Diagnostics.Tracing.xml", - "ref/dotnet/ko/System.Diagnostics.Tracing.xml", - "ref/dotnet/ru/System.Diagnostics.Tracing.xml", - "ref/dotnet/zh-hans/System.Diagnostics.Tracing.xml", - "ref/dotnet/zh-hant/System.Diagnostics.Tracing.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Tracing.dll", - "system.diagnostics.tracing.4.0.20.nupkg.sha512", - "system.diagnostics.tracing.nuspec" - ] - }, - "System.Diagnostics.Tracing/4.3.0": { - "sha512": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "type": "package", - "path": "System.Diagnostics.Tracing/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Diagnostics.Tracing.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.xml", - "ref/netcore50/de/System.Diagnostics.Tracing.xml", - "ref/netcore50/es/System.Diagnostics.Tracing.xml", - "ref/netcore50/fr/System.Diagnostics.Tracing.xml", - "ref/netcore50/it/System.Diagnostics.Tracing.xml", - "ref/netcore50/ja/System.Diagnostics.Tracing.xml", - "ref/netcore50/ko/System.Diagnostics.Tracing.xml", - "ref/netcore50/ru/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/System.Diagnostics.Tracing.dll", - "ref/netstandard1.1/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/System.Diagnostics.Tracing.dll", - "ref/netstandard1.2/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/System.Diagnostics.Tracing.dll", - "ref/netstandard1.3/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/System.Diagnostics.Tracing.dll", - "ref/netstandard1.5/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hant/System.Diagnostics.Tracing.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.diagnostics.tracing.4.3.0.nupkg.sha512", - "system.diagnostics.tracing.nuspec" - ] - }, - "System.Dynamic.Runtime/4.0.10": { - "sha512": "r10VTLdlxtYp46BuxomHnwx7vIoMOr04CFoC/jJJfY22f7HQQ4P+cXY2Nxo6/rIxNNqOxwdbQQwv7Gl88Jsu1w==", - "type": "package", - "path": "System.Dynamic.Runtime/4.0.10", - "files": [ - "lib/DNXCore50/System.Dynamic.Runtime.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Dynamic.Runtime.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Dynamic.Runtime.dll", - "ref/dotnet/System.Dynamic.Runtime.xml", - "ref/dotnet/de/System.Dynamic.Runtime.xml", - "ref/dotnet/es/System.Dynamic.Runtime.xml", - "ref/dotnet/fr/System.Dynamic.Runtime.xml", - "ref/dotnet/it/System.Dynamic.Runtime.xml", - "ref/dotnet/ja/System.Dynamic.Runtime.xml", - "ref/dotnet/ko/System.Dynamic.Runtime.xml", - "ref/dotnet/ru/System.Dynamic.Runtime.xml", - "ref/dotnet/zh-hans/System.Dynamic.Runtime.xml", - "ref/dotnet/zh-hant/System.Dynamic.Runtime.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Dynamic.Runtime.dll", - "system.dynamic.runtime.4.0.10.nupkg.sha512", - "system.dynamic.runtime.nuspec" - ] - }, - "System.Globalization/4.0.10": { - "sha512": "kzRtbbCNAxdafFBDogcM36ehA3th8c1PGiz8QRkZn8O5yMBorDHSK8/TGJPYOaCS5zdsGk0u9qXHnW91nqy7fw==", - "type": "package", - "path": "System.Globalization/4.0.10", - "files": [ - "lib/DNXCore50/System.Globalization.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Globalization.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Globalization.dll", - "ref/dotnet/System.Globalization.xml", - "ref/dotnet/de/System.Globalization.xml", - "ref/dotnet/es/System.Globalization.xml", - "ref/dotnet/fr/System.Globalization.xml", - "ref/dotnet/it/System.Globalization.xml", - "ref/dotnet/ja/System.Globalization.xml", - "ref/dotnet/ko/System.Globalization.xml", - "ref/dotnet/ru/System.Globalization.xml", - "ref/dotnet/zh-hans/System.Globalization.xml", - "ref/dotnet/zh-hant/System.Globalization.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Globalization.dll", - "system.globalization.4.0.10.nupkg.sha512", - "system.globalization.nuspec" - ] - }, - "System.Globalization/4.3.0": { - "sha512": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "type": "package", - "path": "System.Globalization/4.3.0", - "files": [ - "System.Globalization.4.3.0.nupkg.sha512", - "System.Globalization.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Globalization.dll", - "ref/netcore50/System.Globalization.xml", - "ref/netcore50/de/System.Globalization.xml", - "ref/netcore50/es/System.Globalization.xml", - "ref/netcore50/fr/System.Globalization.xml", - "ref/netcore50/it/System.Globalization.xml", - "ref/netcore50/ja/System.Globalization.xml", - "ref/netcore50/ko/System.Globalization.xml", - "ref/netcore50/ru/System.Globalization.xml", - "ref/netcore50/zh-hans/System.Globalization.xml", - "ref/netcore50/zh-hant/System.Globalization.xml", - "ref/netstandard1.0/System.Globalization.dll", - "ref/netstandard1.0/System.Globalization.xml", - "ref/netstandard1.0/de/System.Globalization.xml", - "ref/netstandard1.0/es/System.Globalization.xml", - "ref/netstandard1.0/fr/System.Globalization.xml", - "ref/netstandard1.0/it/System.Globalization.xml", - "ref/netstandard1.0/ja/System.Globalization.xml", - "ref/netstandard1.0/ko/System.Globalization.xml", - "ref/netstandard1.0/ru/System.Globalization.xml", - "ref/netstandard1.0/zh-hans/System.Globalization.xml", - "ref/netstandard1.0/zh-hant/System.Globalization.xml", - "ref/netstandard1.3/System.Globalization.dll", - "ref/netstandard1.3/System.Globalization.xml", - "ref/netstandard1.3/de/System.Globalization.xml", - "ref/netstandard1.3/es/System.Globalization.xml", - "ref/netstandard1.3/fr/System.Globalization.xml", - "ref/netstandard1.3/it/System.Globalization.xml", - "ref/netstandard1.3/ja/System.Globalization.xml", - "ref/netstandard1.3/ko/System.Globalization.xml", - "ref/netstandard1.3/ru/System.Globalization.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Calendars/4.0.0": { - "sha512": "cL6WrdGKnNBx9W/iTr+jbffsEO4RLjEtOYcpVSzPNDoli6X5Q6bAfWtJYbJNOPi8Q0fXgBEvKK1ncFL/3FTqlA==", - "type": "package", - "path": "System.Globalization.Calendars/4.0.0", - "files": [ - "lib/DNXCore50/System.Globalization.Calendars.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/netcore50/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Globalization.Calendars.dll", - "ref/dotnet/System.Globalization.Calendars.xml", - "ref/dotnet/de/System.Globalization.Calendars.xml", - "ref/dotnet/es/System.Globalization.Calendars.xml", - "ref/dotnet/fr/System.Globalization.Calendars.xml", - "ref/dotnet/it/System.Globalization.Calendars.xml", - "ref/dotnet/ja/System.Globalization.Calendars.xml", - "ref/dotnet/ko/System.Globalization.Calendars.xml", - "ref/dotnet/ru/System.Globalization.Calendars.xml", - "ref/dotnet/zh-hans/System.Globalization.Calendars.xml", - "ref/dotnet/zh-hant/System.Globalization.Calendars.xml", - "ref/net46/System.Globalization.Calendars.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Globalization.Calendars.dll", - "system.globalization.calendars.4.0.0.nupkg.sha512", - "system.globalization.calendars.nuspec" - ] - }, - "System.Globalization.Calendars/4.3.0": { - "sha512": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "type": "package", - "path": "System.Globalization.Calendars/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.xml", - "ref/netstandard1.3/de/System.Globalization.Calendars.xml", - "ref/netstandard1.3/es/System.Globalization.Calendars.xml", - "ref/netstandard1.3/fr/System.Globalization.Calendars.xml", - "ref/netstandard1.3/it/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ja/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ko/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ru/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Calendars.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.globalization.calendars.4.3.0.nupkg.sha512", - "system.globalization.calendars.nuspec" - ] - }, - "System.Globalization.Extensions/4.0.0": { - "sha512": "rqbUXiwpBCvJ18ySCsjh20zleazO+6fr3s5GihC2sVwhyS0MUl6+oc5Rzk0z6CKkS4kmxbZQSeZLsK7cFSO0ng==", - "type": "package", - "path": "System.Globalization.Extensions/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Globalization.Extensions.dll", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Globalization.Extensions.dll", - "ref/dotnet/System.Globalization.Extensions.xml", - "ref/dotnet/de/System.Globalization.Extensions.xml", - "ref/dotnet/es/System.Globalization.Extensions.xml", - "ref/dotnet/fr/System.Globalization.Extensions.xml", - "ref/dotnet/it/System.Globalization.Extensions.xml", - "ref/dotnet/ja/System.Globalization.Extensions.xml", - "ref/dotnet/ko/System.Globalization.Extensions.xml", - "ref/dotnet/ru/System.Globalization.Extensions.xml", - "ref/dotnet/zh-hans/System.Globalization.Extensions.xml", - "ref/dotnet/zh-hant/System.Globalization.Extensions.xml", - "ref/net46/System.Globalization.Extensions.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.globalization.extensions.4.0.0.nupkg.sha512", - "system.globalization.extensions.nuspec" - ] - }, - "System.Globalization.Extensions/4.3.0": { - "sha512": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "type": "package", - "path": "System.Globalization.Extensions/4.3.0", - "files": [ - "System.Globalization.Extensions.4.3.0.nupkg.sha512", - "System.Globalization.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.xml", - "ref/netstandard1.3/de/System.Globalization.Extensions.xml", - "ref/netstandard1.3/es/System.Globalization.Extensions.xml", - "ref/netstandard1.3/fr/System.Globalization.Extensions.xml", - "ref/netstandard1.3/it/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ja/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ko/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ru/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Extensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll", - "runtimes/win/lib/net46/System.Globalization.Extensions.dll", - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll" - ] - }, - "System.IO/4.0.10": { - "sha512": "kghf1CeYT+W2lw8a50/GxFz5HR9t6RkL4BvjxtTp1NxtEFWywnMA9W8FH/KYXiDNThcw9u/GOViDON4iJFGXIQ==", - "type": "package", - "path": "System.IO/4.0.10", - "files": [ - "lib/DNXCore50/System.IO.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.IO.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.dll", - "ref/dotnet/System.IO.xml", - "ref/dotnet/de/System.IO.xml", - "ref/dotnet/es/System.IO.xml", - "ref/dotnet/fr/System.IO.xml", - "ref/dotnet/it/System.IO.xml", - "ref/dotnet/ja/System.IO.xml", - "ref/dotnet/ko/System.IO.xml", - "ref/dotnet/ru/System.IO.xml", - "ref/dotnet/zh-hans/System.IO.xml", - "ref/dotnet/zh-hant/System.IO.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.IO.dll", - "system.io.4.0.10.nupkg.sha512", - "system.io.nuspec" - ] - }, - "System.IO/4.3.0": { - "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "type": "package", - "path": "System.IO/4.3.0", - "files": [ - "System.IO.4.3.0.nupkg.sha512", - "System.IO.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.IO.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.IO.dll", - "ref/netcore50/System.IO.dll", - "ref/netcore50/System.IO.xml", - "ref/netcore50/de/System.IO.xml", - "ref/netcore50/es/System.IO.xml", - "ref/netcore50/fr/System.IO.xml", - "ref/netcore50/it/System.IO.xml", - "ref/netcore50/ja/System.IO.xml", - "ref/netcore50/ko/System.IO.xml", - "ref/netcore50/ru/System.IO.xml", - "ref/netcore50/zh-hans/System.IO.xml", - "ref/netcore50/zh-hant/System.IO.xml", - "ref/netstandard1.0/System.IO.dll", - "ref/netstandard1.0/System.IO.xml", - "ref/netstandard1.0/de/System.IO.xml", - "ref/netstandard1.0/es/System.IO.xml", - "ref/netstandard1.0/fr/System.IO.xml", - "ref/netstandard1.0/it/System.IO.xml", - "ref/netstandard1.0/ja/System.IO.xml", - "ref/netstandard1.0/ko/System.IO.xml", - "ref/netstandard1.0/ru/System.IO.xml", - "ref/netstandard1.0/zh-hans/System.IO.xml", - "ref/netstandard1.0/zh-hant/System.IO.xml", - "ref/netstandard1.3/System.IO.dll", - "ref/netstandard1.3/System.IO.xml", - "ref/netstandard1.3/de/System.IO.xml", - "ref/netstandard1.3/es/System.IO.xml", - "ref/netstandard1.3/fr/System.IO.xml", - "ref/netstandard1.3/it/System.IO.xml", - "ref/netstandard1.3/ja/System.IO.xml", - "ref/netstandard1.3/ko/System.IO.xml", - "ref/netstandard1.3/ru/System.IO.xml", - "ref/netstandard1.3/zh-hans/System.IO.xml", - "ref/netstandard1.3/zh-hant/System.IO.xml", - "ref/netstandard1.5/System.IO.dll", - "ref/netstandard1.5/System.IO.xml", - "ref/netstandard1.5/de/System.IO.xml", - "ref/netstandard1.5/es/System.IO.xml", - "ref/netstandard1.5/fr/System.IO.xml", - "ref/netstandard1.5/it/System.IO.xml", - "ref/netstandard1.5/ja/System.IO.xml", - "ref/netstandard1.5/ko/System.IO.xml", - "ref/netstandard1.5/ru/System.IO.xml", - "ref/netstandard1.5/zh-hans/System.IO.xml", - "ref/netstandard1.5/zh-hant/System.IO.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.Compression/4.0.0": { - "sha512": "S+ljBE3py8pujTrsOOYHtDg2cnAifn6kBu/pfh1hMWIXd8DoVh0ADTA6Puv4q+nYj+Msm6JoFLNwuRSmztbsDQ==", - "type": "package", - "path": "System.IO.Compression/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.Compression.dll", - "lib/net45/_._", - "lib/netcore50/System.IO.Compression.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.Compression.dll", - "ref/dotnet/System.IO.Compression.xml", - "ref/dotnet/de/System.IO.Compression.xml", - "ref/dotnet/es/System.IO.Compression.xml", - "ref/dotnet/fr/System.IO.Compression.xml", - "ref/dotnet/it/System.IO.Compression.xml", - "ref/dotnet/ja/System.IO.Compression.xml", - "ref/dotnet/ko/System.IO.Compression.xml", - "ref/dotnet/ru/System.IO.Compression.xml", - "ref/dotnet/zh-hans/System.IO.Compression.xml", - "ref/dotnet/zh-hant/System.IO.Compression.xml", - "ref/net45/_._", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "system.io.compression.4.0.0.nupkg.sha512", - "system.io.compression.nuspec" - ] - }, - "System.IO.Compression/4.3.0": { - "sha512": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "type": "package", - "path": "System.IO.Compression/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.IO.Compression.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/netcore50/de/System.IO.Compression.xml", - "ref/netcore50/es/System.IO.Compression.xml", - "ref/netcore50/fr/System.IO.Compression.xml", - "ref/netcore50/it/System.IO.Compression.xml", - "ref/netcore50/ja/System.IO.Compression.xml", - "ref/netcore50/ko/System.IO.Compression.xml", - "ref/netcore50/ru/System.IO.Compression.xml", - "ref/netcore50/zh-hans/System.IO.Compression.xml", - "ref/netcore50/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.1/System.IO.Compression.dll", - "ref/netstandard1.1/System.IO.Compression.xml", - "ref/netstandard1.1/de/System.IO.Compression.xml", - "ref/netstandard1.1/es/System.IO.Compression.xml", - "ref/netstandard1.1/fr/System.IO.Compression.xml", - "ref/netstandard1.1/it/System.IO.Compression.xml", - "ref/netstandard1.1/ja/System.IO.Compression.xml", - "ref/netstandard1.1/ko/System.IO.Compression.xml", - "ref/netstandard1.1/ru/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.3/System.IO.Compression.dll", - "ref/netstandard1.3/System.IO.Compression.xml", - "ref/netstandard1.3/de/System.IO.Compression.xml", - "ref/netstandard1.3/es/System.IO.Compression.xml", - "ref/netstandard1.3/fr/System.IO.Compression.xml", - "ref/netstandard1.3/it/System.IO.Compression.xml", - "ref/netstandard1.3/ja/System.IO.Compression.xml", - "ref/netstandard1.3/ko/System.IO.Compression.xml", - "ref/netstandard1.3/ru/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll", - "runtimes/win/lib/net46/System.IO.Compression.dll", - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll", - "system.io.compression.4.3.0.nupkg.sha512", - "system.io.compression.nuspec" - ] - }, - "System.IO.Compression.ZipFile/4.0.0": { - "sha512": "pwntmtsJqtt6Lez4Iyv4GVGW6DaXUTo9Rnlsx0MFagRgX+8F/sxG5S/IzDJabBj68sUWViz1QJrRZL4V9ngWDg==", - "type": "package", - "path": "System.IO.Compression.ZipFile/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.Compression.ZipFile.dll", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.Compression.ZipFile.dll", - "ref/dotnet/System.IO.Compression.ZipFile.xml", - "ref/dotnet/de/System.IO.Compression.ZipFile.xml", - "ref/dotnet/es/System.IO.Compression.ZipFile.xml", - "ref/dotnet/fr/System.IO.Compression.ZipFile.xml", - "ref/dotnet/it/System.IO.Compression.ZipFile.xml", - "ref/dotnet/ja/System.IO.Compression.ZipFile.xml", - "ref/dotnet/ko/System.IO.Compression.ZipFile.xml", - "ref/dotnet/ru/System.IO.Compression.ZipFile.xml", - "ref/dotnet/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/dotnet/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.compression.zipfile.4.0.0.nupkg.sha512", - "system.io.compression.zipfile.nuspec" - ] - }, - "System.IO.Compression.ZipFile/4.3.0": { - "sha512": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "type": "package", - "path": "System.IO.Compression.ZipFile/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/de/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/es/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/fr/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/it/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ja/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ko/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ru/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.compression.zipfile.4.3.0.nupkg.sha512", - "system.io.compression.zipfile.nuspec" - ] - }, - "System.IO.FileSystem/4.0.0": { - "sha512": "eo05SPWfG+54UA0wxgRIYOuOslq+2QrJLXZaJDDsfLXG15OLguaItW39NYZTqUb4DeGOkU4R0wpOLOW4ynMUDQ==", - "type": "package", - "path": "System.IO.FileSystem/4.0.0", - "files": [ - "lib/DNXCore50/System.IO.FileSystem.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/netcore50/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.FileSystem.dll", - "ref/dotnet/System.IO.FileSystem.xml", - "ref/dotnet/de/System.IO.FileSystem.xml", - "ref/dotnet/es/System.IO.FileSystem.xml", - "ref/dotnet/fr/System.IO.FileSystem.xml", - "ref/dotnet/it/System.IO.FileSystem.xml", - "ref/dotnet/ja/System.IO.FileSystem.xml", - "ref/dotnet/ko/System.IO.FileSystem.xml", - "ref/dotnet/ru/System.IO.FileSystem.xml", - "ref/dotnet/zh-hans/System.IO.FileSystem.xml", - "ref/dotnet/zh-hant/System.IO.FileSystem.xml", - "ref/net46/System.IO.FileSystem.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.filesystem.4.0.0.nupkg.sha512", - "system.io.filesystem.nuspec" - ] - }, - "System.IO.FileSystem/4.3.0": { - "sha512": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "type": "package", - "path": "System.IO.FileSystem/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.filesystem.4.3.0.nupkg.sha512", - "system.io.filesystem.nuspec" - ] - }, - "System.IO.FileSystem.Primitives/4.0.0": { - "sha512": "7pJUvYi/Yq3A5nagqCCiOw3+aJp3xXc/Cjr8dnJDnER3/6kX3LEencfqmXUcPl9+7OvRNyPMNhqsLAcMK6K/KA==", - "type": "package", - "path": "System.IO.FileSystem.Primitives/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.FileSystem.Primitives.dll", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.FileSystem.Primitives.dll", - "ref/dotnet/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/de/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/es/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/fr/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/it/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/ja/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/ko/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/ru/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/dotnet/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.filesystem.primitives.4.0.0.nupkg.sha512", - "system.io.filesystem.primitives.nuspec" - ] - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "sha512": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "type": "package", - "path": "System.IO.FileSystem.Primitives/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.filesystem.primitives.4.3.0.nupkg.sha512", - "system.io.filesystem.primitives.nuspec" - ] - }, - "System.IO.IsolatedStorage/4.0.0": { - "sha512": "d5KimUbZ49Ki6A/uwU+Iodng+nhJvpRs7hr/828cfeXC02LxUiggnRnAu+COtWcKvJ2YbBmAGOcO4GLK4fX1+w==", - "type": "package", - "path": "System.IO.IsolatedStorage/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/netcore50/System.IO.IsolatedStorage.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.IsolatedStorage.dll", - "ref/dotnet/System.IO.IsolatedStorage.xml", - "ref/dotnet/de/System.IO.IsolatedStorage.xml", - "ref/dotnet/es/System.IO.IsolatedStorage.xml", - "ref/dotnet/fr/System.IO.IsolatedStorage.xml", - "ref/dotnet/it/System.IO.IsolatedStorage.xml", - "ref/dotnet/ja/System.IO.IsolatedStorage.xml", - "ref/dotnet/ko/System.IO.IsolatedStorage.xml", - "ref/dotnet/ru/System.IO.IsolatedStorage.xml", - "ref/dotnet/zh-hans/System.IO.IsolatedStorage.xml", - "ref/dotnet/zh-hant/System.IO.IsolatedStorage.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.isolatedstorage.4.0.0.nupkg.sha512", - "system.io.isolatedstorage.nuspec" - ] - }, - "System.IO.UnmanagedMemoryStream/4.0.0": { - "sha512": "i2xczgQfwHmolORBNHxV9b5izP8VOBxgSA2gf+H55xBvwqtR+9r9adtzlc7at0MAwiLcsk6V1TZlv2vfRQr8Sw==", - "type": "package", - "path": "System.IO.UnmanagedMemoryStream/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.IO.UnmanagedMemoryStream.dll", - "lib/net46/System.IO.UnmanagedMemoryStream.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.IO.UnmanagedMemoryStream.dll", - "ref/dotnet/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/de/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/es/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/fr/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/it/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/ja/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/ko/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/ru/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/zh-hans/System.IO.UnmanagedMemoryStream.xml", - "ref/dotnet/zh-hant/System.IO.UnmanagedMemoryStream.xml", - "ref/net46/System.IO.UnmanagedMemoryStream.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.io.unmanagedmemorystream.4.0.0.nupkg.sha512", - "system.io.unmanagedmemorystream.nuspec" - ] - }, - "System.Linq/4.0.0": { - "sha512": "r6Hlc+ytE6m/9UBr+nNRRdoJEWjoeQiT3L3lXYFDHoXk3VYsRBCDNXrawcexw7KPLaH0zamQLiAb6avhZ50cGg==", - "type": "package", - "path": "System.Linq/4.0.0", - "files": [ - "lib/dotnet/System.Linq.dll", - "lib/net45/_._", - "lib/netcore50/System.Linq.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Linq.dll", - "ref/dotnet/System.Linq.xml", - "ref/dotnet/de/System.Linq.xml", - "ref/dotnet/es/System.Linq.xml", - "ref/dotnet/fr/System.Linq.xml", - "ref/dotnet/it/System.Linq.xml", - "ref/dotnet/ja/System.Linq.xml", - "ref/dotnet/ko/System.Linq.xml", - "ref/dotnet/ru/System.Linq.xml", - "ref/dotnet/zh-hans/System.Linq.xml", - "ref/dotnet/zh-hant/System.Linq.xml", - "ref/net45/_._", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.linq.4.0.0.nupkg.sha512", - "system.linq.nuspec" - ] - }, - "System.Linq/4.3.0": { - "sha512": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "type": "package", - "path": "System.Linq/4.3.0", - "files": [ - "System.Linq.4.3.0.nupkg.sha512", - "System.Linq.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.dll", - "lib/netcore50/System.Linq.dll", - "lib/netstandard1.6/System.Linq.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.dll", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/netcore50/de/System.Linq.xml", - "ref/netcore50/es/System.Linq.xml", - "ref/netcore50/fr/System.Linq.xml", - "ref/netcore50/it/System.Linq.xml", - "ref/netcore50/ja/System.Linq.xml", - "ref/netcore50/ko/System.Linq.xml", - "ref/netcore50/ru/System.Linq.xml", - "ref/netcore50/zh-hans/System.Linq.xml", - "ref/netcore50/zh-hant/System.Linq.xml", - "ref/netstandard1.0/System.Linq.dll", - "ref/netstandard1.0/System.Linq.xml", - "ref/netstandard1.0/de/System.Linq.xml", - "ref/netstandard1.0/es/System.Linq.xml", - "ref/netstandard1.0/fr/System.Linq.xml", - "ref/netstandard1.0/it/System.Linq.xml", - "ref/netstandard1.0/ja/System.Linq.xml", - "ref/netstandard1.0/ko/System.Linq.xml", - "ref/netstandard1.0/ru/System.Linq.xml", - "ref/netstandard1.0/zh-hans/System.Linq.xml", - "ref/netstandard1.0/zh-hant/System.Linq.xml", - "ref/netstandard1.6/System.Linq.dll", - "ref/netstandard1.6/System.Linq.xml", - "ref/netstandard1.6/de/System.Linq.xml", - "ref/netstandard1.6/es/System.Linq.xml", - "ref/netstandard1.6/fr/System.Linq.xml", - "ref/netstandard1.6/it/System.Linq.xml", - "ref/netstandard1.6/ja/System.Linq.xml", - "ref/netstandard1.6/ko/System.Linq.xml", - "ref/netstandard1.6/ru/System.Linq.xml", - "ref/netstandard1.6/zh-hans/System.Linq.xml", - "ref/netstandard1.6/zh-hant/System.Linq.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq.Expressions/4.0.10": { - "sha512": "qhFkPqRsTfXBaacjQhxwwwUoU7TEtwlBIULj7nG7i4qAkvivil31VvOvDKppCSui5yGw0/325ZeNaMYRvTotXw==", - "type": "package", - "path": "System.Linq.Expressions/4.0.10", - "files": [ - "lib/DNXCore50/System.Linq.Expressions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Linq.Expressions.dll", - "ref/dotnet/System.Linq.Expressions.xml", - "ref/dotnet/de/System.Linq.Expressions.xml", - "ref/dotnet/es/System.Linq.Expressions.xml", - "ref/dotnet/fr/System.Linq.Expressions.xml", - "ref/dotnet/it/System.Linq.Expressions.xml", - "ref/dotnet/ja/System.Linq.Expressions.xml", - "ref/dotnet/ko/System.Linq.Expressions.xml", - "ref/dotnet/ru/System.Linq.Expressions.xml", - "ref/dotnet/zh-hans/System.Linq.Expressions.xml", - "ref/dotnet/zh-hant/System.Linq.Expressions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Linq.Expressions.dll", - "system.linq.expressions.4.0.10.nupkg.sha512", - "system.linq.expressions.nuspec" - ] - }, - "System.Linq.Expressions/4.3.0": { - "sha512": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "type": "package", - "path": "System.Linq.Expressions/4.3.0", - "files": [ - "System.Linq.Expressions.4.3.0.nupkg.sha512", - "System.Linq.Expressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.Expressions.dll", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/netstandard1.6/System.Linq.Expressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.xml", - "ref/netcore50/de/System.Linq.Expressions.xml", - "ref/netcore50/es/System.Linq.Expressions.xml", - "ref/netcore50/fr/System.Linq.Expressions.xml", - "ref/netcore50/it/System.Linq.Expressions.xml", - "ref/netcore50/ja/System.Linq.Expressions.xml", - "ref/netcore50/ko/System.Linq.Expressions.xml", - "ref/netcore50/ru/System.Linq.Expressions.xml", - "ref/netcore50/zh-hans/System.Linq.Expressions.xml", - "ref/netcore50/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.0/System.Linq.Expressions.dll", - "ref/netstandard1.0/System.Linq.Expressions.xml", - "ref/netstandard1.0/de/System.Linq.Expressions.xml", - "ref/netstandard1.0/es/System.Linq.Expressions.xml", - "ref/netstandard1.0/fr/System.Linq.Expressions.xml", - "ref/netstandard1.0/it/System.Linq.Expressions.xml", - "ref/netstandard1.0/ja/System.Linq.Expressions.xml", - "ref/netstandard1.0/ko/System.Linq.Expressions.xml", - "ref/netstandard1.0/ru/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.3/System.Linq.Expressions.dll", - "ref/netstandard1.3/System.Linq.Expressions.xml", - "ref/netstandard1.3/de/System.Linq.Expressions.xml", - "ref/netstandard1.3/es/System.Linq.Expressions.xml", - "ref/netstandard1.3/fr/System.Linq.Expressions.xml", - "ref/netstandard1.3/it/System.Linq.Expressions.xml", - "ref/netstandard1.3/ja/System.Linq.Expressions.xml", - "ref/netstandard1.3/ko/System.Linq.Expressions.xml", - "ref/netstandard1.3/ru/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.6/System.Linq.Expressions.dll", - "ref/netstandard1.6/System.Linq.Expressions.xml", - "ref/netstandard1.6/de/System.Linq.Expressions.xml", - "ref/netstandard1.6/es/System.Linq.Expressions.xml", - "ref/netstandard1.6/fr/System.Linq.Expressions.xml", - "ref/netstandard1.6/it/System.Linq.Expressions.xml", - "ref/netstandard1.6/ja/System.Linq.Expressions.xml", - "ref/netstandard1.6/ko/System.Linq.Expressions.xml", - "ref/netstandard1.6/ru/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hant/System.Linq.Expressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Linq.Expressions.dll" - ] - }, - "System.Linq.Parallel/4.0.0": { - "sha512": "PtH7KKh1BbzVow4XY17pnrn7Io63ApMdwzRE2o2HnzsKQD/0o7X5xe6mxrDUqTm9ZCR3/PNhAlP13VY1HnHsbA==", - "type": "package", - "path": "System.Linq.Parallel/4.0.0", - "files": [ - "lib/dotnet/System.Linq.Parallel.dll", - "lib/net45/_._", - "lib/netcore50/System.Linq.Parallel.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Linq.Parallel.dll", - "ref/dotnet/System.Linq.Parallel.xml", - "ref/dotnet/de/System.Linq.Parallel.xml", - "ref/dotnet/es/System.Linq.Parallel.xml", - "ref/dotnet/fr/System.Linq.Parallel.xml", - "ref/dotnet/it/System.Linq.Parallel.xml", - "ref/dotnet/ja/System.Linq.Parallel.xml", - "ref/dotnet/ko/System.Linq.Parallel.xml", - "ref/dotnet/ru/System.Linq.Parallel.xml", - "ref/dotnet/zh-hans/System.Linq.Parallel.xml", - "ref/dotnet/zh-hant/System.Linq.Parallel.xml", - "ref/net45/_._", - "ref/netcore50/System.Linq.Parallel.dll", - "ref/netcore50/System.Linq.Parallel.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.linq.parallel.4.0.0.nupkg.sha512", - "system.linq.parallel.nuspec" - ] - }, - "System.Linq.Queryable/4.0.0": { - "sha512": "DIlvCNn3ucFvwMMzXcag4aFnFJ1fdxkQ5NqwJe9Nh7y8ozzhDm07YakQL/yoF3P1dLzY1T2cTpuwbAmVSdXyBA==", - "type": "package", - "path": "System.Linq.Queryable/4.0.0", - "files": [ - "lib/dotnet/System.Linq.Queryable.dll", - "lib/net45/_._", - "lib/netcore50/System.Linq.Queryable.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Linq.Queryable.dll", - "ref/dotnet/System.Linq.Queryable.xml", - "ref/dotnet/de/System.Linq.Queryable.xml", - "ref/dotnet/es/System.Linq.Queryable.xml", - "ref/dotnet/fr/System.Linq.Queryable.xml", - "ref/dotnet/it/System.Linq.Queryable.xml", - "ref/dotnet/ja/System.Linq.Queryable.xml", - "ref/dotnet/ko/System.Linq.Queryable.xml", - "ref/dotnet/ru/System.Linq.Queryable.xml", - "ref/dotnet/zh-hans/System.Linq.Queryable.xml", - "ref/dotnet/zh-hant/System.Linq.Queryable.xml", - "ref/net45/_._", - "ref/netcore50/System.Linq.Queryable.dll", - "ref/netcore50/System.Linq.Queryable.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.linq.queryable.4.0.0.nupkg.sha512", - "system.linq.queryable.nuspec" - ] - }, - "System.Net.Http/4.0.0": { - "sha512": "mZuAl7jw/mFY8jUq4ITKECxVBh9a8SJt9BC/+lJbmo7cRKspxE3PsITz+KiaCEsexN5WYPzwBOx0oJH/0HlPyQ==", - "type": "package", - "path": "System.Net.Http/4.0.0", - "files": [ - "lib/DNXCore50/System.Net.Http.dll", - "lib/net45/_._", - "lib/netcore50/System.Net.Http.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Net.Http.dll", - "ref/dotnet/System.Net.Http.xml", - "ref/dotnet/de/System.Net.Http.xml", - "ref/dotnet/es/System.Net.Http.xml", - "ref/dotnet/fr/System.Net.Http.xml", - "ref/dotnet/it/System.Net.Http.xml", - "ref/dotnet/ja/System.Net.Http.xml", - "ref/dotnet/ko/System.Net.Http.xml", - "ref/dotnet/ru/System.Net.Http.xml", - "ref/dotnet/zh-hans/System.Net.Http.xml", - "ref/dotnet/zh-hant/System.Net.Http.xml", - "ref/net45/_._", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.net.http.4.0.0.nupkg.sha512", - "system.net.http.nuspec" - ] - }, - "System.Net.Http/4.3.0": { - "sha512": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "type": "package", - "path": "System.Net.Http/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/Xamarinmac20/_._", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/net46/System.Net.Http.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/Xamarinmac20/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/net46/System.Net.Http.dll", - "ref/net46/System.Net.Http.xml", - "ref/net46/de/System.Net.Http.xml", - "ref/net46/es/System.Net.Http.xml", - "ref/net46/fr/System.Net.Http.xml", - "ref/net46/it/System.Net.Http.xml", - "ref/net46/ja/System.Net.Http.xml", - "ref/net46/ko/System.Net.Http.xml", - "ref/net46/ru/System.Net.Http.xml", - "ref/net46/zh-hans/System.Net.Http.xml", - "ref/net46/zh-hant/System.Net.Http.xml", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/netcore50/de/System.Net.Http.xml", - "ref/netcore50/es/System.Net.Http.xml", - "ref/netcore50/fr/System.Net.Http.xml", - "ref/netcore50/it/System.Net.Http.xml", - "ref/netcore50/ja/System.Net.Http.xml", - "ref/netcore50/ko/System.Net.Http.xml", - "ref/netcore50/ru/System.Net.Http.xml", - "ref/netcore50/zh-hans/System.Net.Http.xml", - "ref/netcore50/zh-hant/System.Net.Http.xml", - "ref/netstandard1.1/System.Net.Http.dll", - "ref/netstandard1.1/System.Net.Http.xml", - "ref/netstandard1.1/de/System.Net.Http.xml", - "ref/netstandard1.1/es/System.Net.Http.xml", - "ref/netstandard1.1/fr/System.Net.Http.xml", - "ref/netstandard1.1/it/System.Net.Http.xml", - "ref/netstandard1.1/ja/System.Net.Http.xml", - "ref/netstandard1.1/ko/System.Net.Http.xml", - "ref/netstandard1.1/ru/System.Net.Http.xml", - "ref/netstandard1.1/zh-hans/System.Net.Http.xml", - "ref/netstandard1.1/zh-hant/System.Net.Http.xml", - "ref/netstandard1.3/System.Net.Http.dll", - "ref/netstandard1.3/System.Net.Http.xml", - "ref/netstandard1.3/de/System.Net.Http.xml", - "ref/netstandard1.3/es/System.Net.Http.xml", - "ref/netstandard1.3/fr/System.Net.Http.xml", - "ref/netstandard1.3/it/System.Net.Http.xml", - "ref/netstandard1.3/ja/System.Net.Http.xml", - "ref/netstandard1.3/ko/System.Net.Http.xml", - "ref/netstandard1.3/ru/System.Net.Http.xml", - "ref/netstandard1.3/zh-hans/System.Net.Http.xml", - "ref/netstandard1.3/zh-hant/System.Net.Http.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll", - "runtimes/win/lib/net46/System.Net.Http.dll", - "runtimes/win/lib/netcore50/System.Net.Http.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll", - "system.net.http.4.3.0.nupkg.sha512", - "system.net.http.nuspec" - ] - }, - "System.Net.Http.Rtc/4.0.0": { - "sha512": "PlE+oJgXdbxPmZYR6GBywRkyIPovjB1Y0SYHizj2Iflgu80uJQC4szl9gue4rKI2FgXiEbj9JL7wL5K3mp9HAQ==", - "type": "package", - "path": "System.Net.Http.Rtc/4.0.0", - "files": [ - "lib/netcore50/System.Net.Http.Rtc.dll", - "lib/win8/_._", - "ref/dotnet/System.Net.Http.Rtc.dll", - "ref/dotnet/System.Net.Http.Rtc.xml", - "ref/dotnet/de/System.Net.Http.Rtc.xml", - "ref/dotnet/es/System.Net.Http.Rtc.xml", - "ref/dotnet/fr/System.Net.Http.Rtc.xml", - "ref/dotnet/it/System.Net.Http.Rtc.xml", - "ref/dotnet/ja/System.Net.Http.Rtc.xml", - "ref/dotnet/ko/System.Net.Http.Rtc.xml", - "ref/dotnet/ru/System.Net.Http.Rtc.xml", - "ref/dotnet/zh-hans/System.Net.Http.Rtc.xml", - "ref/dotnet/zh-hant/System.Net.Http.Rtc.xml", - "ref/netcore50/System.Net.Http.Rtc.dll", - "ref/netcore50/System.Net.Http.Rtc.xml", - "ref/win8/_._", - "system.net.http.rtc.4.0.0.nupkg.sha512", - "system.net.http.rtc.nuspec" - ] - }, - "System.Net.NetworkInformation/4.0.0": { - "sha512": "D68KCf5VK1G1GgFUwD901gU6cnMITksOdfdxUCt9ReCZfT1pigaDqjJ7XbiLAM4jm7TfZHB7g5mbOf1mbG3yBA==", - "type": "package", - "path": "System.Net.NetworkInformation/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Net.NetworkInformation.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.NetworkInformation.dll", - "ref/dotnet/System.Net.NetworkInformation.xml", - "ref/dotnet/de/System.Net.NetworkInformation.xml", - "ref/dotnet/es/System.Net.NetworkInformation.xml", - "ref/dotnet/fr/System.Net.NetworkInformation.xml", - "ref/dotnet/it/System.Net.NetworkInformation.xml", - "ref/dotnet/ja/System.Net.NetworkInformation.xml", - "ref/dotnet/ko/System.Net.NetworkInformation.xml", - "ref/dotnet/ru/System.Net.NetworkInformation.xml", - "ref/dotnet/zh-hans/System.Net.NetworkInformation.xml", - "ref/dotnet/zh-hant/System.Net.NetworkInformation.xml", - "ref/net45/_._", - "ref/netcore50/System.Net.NetworkInformation.dll", - "ref/netcore50/System.Net.NetworkInformation.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.networkinformation.4.0.0.nupkg.sha512", - "system.net.networkinformation.nuspec" - ] - }, - "System.Net.Primitives/4.0.10": { - "sha512": "YQqIpmMhnKjIbT7rl6dlf7xM5DxaMR+whduZ9wKb9OhMLjoueAJO3HPPJI+Naf3v034kb+xZqdc3zo44o3HWcg==", - "type": "package", - "path": "System.Net.Primitives/4.0.10", - "files": [ - "lib/DNXCore50/System.Net.Primitives.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Net.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.Primitives.dll", - "ref/dotnet/System.Net.Primitives.xml", - "ref/dotnet/de/System.Net.Primitives.xml", - "ref/dotnet/es/System.Net.Primitives.xml", - "ref/dotnet/fr/System.Net.Primitives.xml", - "ref/dotnet/it/System.Net.Primitives.xml", - "ref/dotnet/ja/System.Net.Primitives.xml", - "ref/dotnet/ko/System.Net.Primitives.xml", - "ref/dotnet/ru/System.Net.Primitives.xml", - "ref/dotnet/zh-hans/System.Net.Primitives.xml", - "ref/dotnet/zh-hant/System.Net.Primitives.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.primitives.4.0.10.nupkg.sha512", - "system.net.primitives.nuspec" - ] - }, - "System.Net.Primitives/4.3.0": { - "sha512": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "type": "package", - "path": "System.Net.Primitives/4.3.0", - "files": [ - "System.Net.Primitives.4.3.0.nupkg.sha512", - "System.Net.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Net.Primitives.dll", - "ref/netcore50/System.Net.Primitives.xml", - "ref/netcore50/de/System.Net.Primitives.xml", - "ref/netcore50/es/System.Net.Primitives.xml", - "ref/netcore50/fr/System.Net.Primitives.xml", - "ref/netcore50/it/System.Net.Primitives.xml", - "ref/netcore50/ja/System.Net.Primitives.xml", - "ref/netcore50/ko/System.Net.Primitives.xml", - "ref/netcore50/ru/System.Net.Primitives.xml", - "ref/netcore50/zh-hans/System.Net.Primitives.xml", - "ref/netcore50/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.0/System.Net.Primitives.dll", - "ref/netstandard1.0/System.Net.Primitives.xml", - "ref/netstandard1.0/de/System.Net.Primitives.xml", - "ref/netstandard1.0/es/System.Net.Primitives.xml", - "ref/netstandard1.0/fr/System.Net.Primitives.xml", - "ref/netstandard1.0/it/System.Net.Primitives.xml", - "ref/netstandard1.0/ja/System.Net.Primitives.xml", - "ref/netstandard1.0/ko/System.Net.Primitives.xml", - "ref/netstandard1.0/ru/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.1/System.Net.Primitives.dll", - "ref/netstandard1.1/System.Net.Primitives.xml", - "ref/netstandard1.1/de/System.Net.Primitives.xml", - "ref/netstandard1.1/es/System.Net.Primitives.xml", - "ref/netstandard1.1/fr/System.Net.Primitives.xml", - "ref/netstandard1.1/it/System.Net.Primitives.xml", - "ref/netstandard1.1/ja/System.Net.Primitives.xml", - "ref/netstandard1.1/ko/System.Net.Primitives.xml", - "ref/netstandard1.1/ru/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.3/System.Net.Primitives.dll", - "ref/netstandard1.3/System.Net.Primitives.xml", - "ref/netstandard1.3/de/System.Net.Primitives.xml", - "ref/netstandard1.3/es/System.Net.Primitives.xml", - "ref/netstandard1.3/fr/System.Net.Primitives.xml", - "ref/netstandard1.3/it/System.Net.Primitives.xml", - "ref/netstandard1.3/ja/System.Net.Primitives.xml", - "ref/netstandard1.3/ko/System.Net.Primitives.xml", - "ref/netstandard1.3/ru/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Net.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.Requests/4.0.10": { - "sha512": "A6XBR7TztiIQg6hx7VGfbBKmRTAavUERm2E7pmNz/gZeGvwyP0lcKHZxylJtNVKj7DPwr91bD87oLY6zZYntcg==", - "type": "package", - "path": "System.Net.Requests/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Net.Requests.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.Requests.dll", - "ref/dotnet/System.Net.Requests.xml", - "ref/dotnet/de/System.Net.Requests.xml", - "ref/dotnet/es/System.Net.Requests.xml", - "ref/dotnet/fr/System.Net.Requests.xml", - "ref/dotnet/it/System.Net.Requests.xml", - "ref/dotnet/ja/System.Net.Requests.xml", - "ref/dotnet/ko/System.Net.Requests.xml", - "ref/dotnet/ru/System.Net.Requests.xml", - "ref/dotnet/zh-hans/System.Net.Requests.xml", - "ref/dotnet/zh-hant/System.Net.Requests.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.requests.4.0.10.nupkg.sha512", - "system.net.requests.nuspec" - ] - }, - "System.Net.Sockets/4.0.0": { - "sha512": "7bBNLdO6Xw0BGyFVSxjloGXMvsc3qQmW+70bYMLwHEAVivMK8zx+E7XO8CeJnAko2mFj6R402E798EGYUksFcQ==", - "type": "package", - "path": "System.Net.Sockets/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/netcore50/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.Sockets.dll", - "ref/dotnet/System.Net.Sockets.xml", - "ref/dotnet/de/System.Net.Sockets.xml", - "ref/dotnet/es/System.Net.Sockets.xml", - "ref/dotnet/fr/System.Net.Sockets.xml", - "ref/dotnet/it/System.Net.Sockets.xml", - "ref/dotnet/ja/System.Net.Sockets.xml", - "ref/dotnet/ko/System.Net.Sockets.xml", - "ref/dotnet/ru/System.Net.Sockets.xml", - "ref/dotnet/zh-hans/System.Net.Sockets.xml", - "ref/dotnet/zh-hant/System.Net.Sockets.xml", - "ref/net46/System.Net.Sockets.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.sockets.4.0.0.nupkg.sha512", - "system.net.sockets.nuspec" - ] - }, - "System.Net.Sockets/4.3.0": { - "sha512": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "type": "package", - "path": "System.Net.Sockets/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.xml", - "ref/netstandard1.3/de/System.Net.Sockets.xml", - "ref/netstandard1.3/es/System.Net.Sockets.xml", - "ref/netstandard1.3/fr/System.Net.Sockets.xml", - "ref/netstandard1.3/it/System.Net.Sockets.xml", - "ref/netstandard1.3/ja/System.Net.Sockets.xml", - "ref/netstandard1.3/ko/System.Net.Sockets.xml", - "ref/netstandard1.3/ru/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hans/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hant/System.Net.Sockets.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.net.sockets.4.3.0.nupkg.sha512", - "system.net.sockets.nuspec" - ] - }, - "System.Net.WebHeaderCollection/4.0.0": { - "sha512": "IsIZAsHm/yK7R/XASnEc4EMffFLIMgYchG3/zJv6B4LwMnXZwrVlSPpNbPgEVb0lSXyztsn7A6sIPAACQQ2vTQ==", - "type": "package", - "path": "System.Net.WebHeaderCollection/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Net.WebHeaderCollection.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Net.WebHeaderCollection.dll", - "ref/dotnet/System.Net.WebHeaderCollection.xml", - "ref/dotnet/de/System.Net.WebHeaderCollection.xml", - "ref/dotnet/es/System.Net.WebHeaderCollection.xml", - "ref/dotnet/fr/System.Net.WebHeaderCollection.xml", - "ref/dotnet/it/System.Net.WebHeaderCollection.xml", - "ref/dotnet/ja/System.Net.WebHeaderCollection.xml", - "ref/dotnet/ko/System.Net.WebHeaderCollection.xml", - "ref/dotnet/ru/System.Net.WebHeaderCollection.xml", - "ref/dotnet/zh-hans/System.Net.WebHeaderCollection.xml", - "ref/dotnet/zh-hant/System.Net.WebHeaderCollection.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.net.webheadercollection.4.0.0.nupkg.sha512", - "system.net.webheadercollection.nuspec" - ] - }, - "System.Numerics.Vectors/4.1.0": { - "sha512": "jpubR06GWPoZA0oU5xLM7kHeV59/CKPBXZk4Jfhi0T3DafxbrdueHZ8kXlb+Fb5nd3DAyyMh2/eqEzLX0xv6Qg==", - "type": "package", - "path": "System.Numerics.Vectors/4.1.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Numerics.Vectors.dll", - "lib/net46/System.Numerics.Vectors.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Numerics.Vectors.dll", - "ref/net46/System.Numerics.Vectors.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.numerics.vectors.4.1.0.nupkg.sha512", - "system.numerics.vectors.nuspec" - ] - }, - "System.Numerics.Vectors.WindowsRuntime/4.0.0": { - "sha512": "Ly7GvoPFZq6GyfZpfS0E7uCk1cinl5BANAngXVuau3lD2QqZJMHitzlPv6n1FlIn6krfv99X2IPkIaVzUwDHXA==", - "type": "package", - "path": "System.Numerics.Vectors.WindowsRuntime/4.0.0", - "files": [ - "lib/dotnet/System.Numerics.Vectors.WindowsRuntime.dll", - "system.numerics.vectors.windowsruntime.4.0.0.nupkg.sha512", - "system.numerics.vectors.windowsruntime.nuspec" - ] - }, - "System.ObjectModel/4.0.10": { - "sha512": "Djn1wb0vP662zxbe+c3mOhvC4vkQGicsFs1Wi0/GJJpp3Eqp+oxbJ+p2Sx3O0efYueggAI5SW+BqEoczjfr1cA==", - "type": "package", - "path": "System.ObjectModel/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.ObjectModel.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ObjectModel.dll", - "ref/dotnet/System.ObjectModel.xml", - "ref/dotnet/de/System.ObjectModel.xml", - "ref/dotnet/es/System.ObjectModel.xml", - "ref/dotnet/fr/System.ObjectModel.xml", - "ref/dotnet/it/System.ObjectModel.xml", - "ref/dotnet/ja/System.ObjectModel.xml", - "ref/dotnet/ko/System.ObjectModel.xml", - "ref/dotnet/ru/System.ObjectModel.xml", - "ref/dotnet/zh-hans/System.ObjectModel.xml", - "ref/dotnet/zh-hant/System.ObjectModel.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.objectmodel.4.0.10.nupkg.sha512", - "system.objectmodel.nuspec" - ] - }, - "System.ObjectModel/4.3.0": { - "sha512": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "type": "package", - "path": "System.ObjectModel/4.3.0", - "files": [ - "System.ObjectModel.4.3.0.nupkg.sha512", - "System.ObjectModel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ObjectModel.dll", - "lib/netstandard1.3/System.ObjectModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ObjectModel.dll", - "ref/netcore50/System.ObjectModel.xml", - "ref/netcore50/de/System.ObjectModel.xml", - "ref/netcore50/es/System.ObjectModel.xml", - "ref/netcore50/fr/System.ObjectModel.xml", - "ref/netcore50/it/System.ObjectModel.xml", - "ref/netcore50/ja/System.ObjectModel.xml", - "ref/netcore50/ko/System.ObjectModel.xml", - "ref/netcore50/ru/System.ObjectModel.xml", - "ref/netcore50/zh-hans/System.ObjectModel.xml", - "ref/netcore50/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.0/System.ObjectModel.dll", - "ref/netstandard1.0/System.ObjectModel.xml", - "ref/netstandard1.0/de/System.ObjectModel.xml", - "ref/netstandard1.0/es/System.ObjectModel.xml", - "ref/netstandard1.0/fr/System.ObjectModel.xml", - "ref/netstandard1.0/it/System.ObjectModel.xml", - "ref/netstandard1.0/ja/System.ObjectModel.xml", - "ref/netstandard1.0/ko/System.ObjectModel.xml", - "ref/netstandard1.0/ru/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.3/System.ObjectModel.dll", - "ref/netstandard1.3/System.ObjectModel.xml", - "ref/netstandard1.3/de/System.ObjectModel.xml", - "ref/netstandard1.3/es/System.ObjectModel.xml", - "ref/netstandard1.3/fr/System.ObjectModel.xml", - "ref/netstandard1.3/it/System.ObjectModel.xml", - "ref/netstandard1.3/ja/System.ObjectModel.xml", - "ref/netstandard1.3/ko/System.ObjectModel.xml", - "ref/netstandard1.3/ru/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hant/System.ObjectModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Private.DataContractSerialization/4.1.0": { - "sha512": "jihi0lC7TMGx8QtMuz3tRFoXdP0BHbceAdd3gvRbNnxM3W93jSRE/cocQyGf64wlC/1etjHKPwnwdu+PDJkjnA==", - "type": "package", - "path": "System.Private.DataContractSerialization/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "runtime.json", - "system.private.datacontractserialization.4.1.0.nupkg.sha512", - "system.private.datacontractserialization.nuspec" - ] - }, - "System.Private.Networking/4.0.0": { - "sha512": "RUEqdBdJjISC65dO8l4LdN7vTdlXH+attUpKnauDUHVtLbIKdlDB9LKoLzCQsTQRP7vzUJHWYXznHJBkjAA7yA==", - "type": "package", - "path": "System.Private.Networking/4.0.0", - "files": [ - "lib/DNXCore50/System.Private.Networking.dll", - "lib/netcore50/System.Private.Networking.dll", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "system.private.networking.4.0.0.nupkg.sha512", - "system.private.networking.nuspec" - ] - }, - "System.Private.ServiceModel/4.0.0": { - "sha512": "cm2wEa1f9kuUq/2k8uIwepgZJi5HdxXSnjGQIeXmAb7RaWfZPEC/iamv9GJ67b5LPnCZHR0KvtFqh82e8AAYSw==", - "type": "package", - "path": "System.Private.ServiceModel/4.0.0", - "files": [ - "lib/DNXCore50/System.Private.ServiceModel.dll", - "lib/netcore50/System.Private.ServiceModel.dll", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "system.private.servicemodel.4.0.0.nupkg.sha512", - "system.private.servicemodel.nuspec" - ] - }, - "System.Private.Uri/4.0.0": { - "sha512": "CtuxaCKcRIvPcsqquVl3mPp79EDZPMr2UogfiFCxCs+t2z1VjbpQsKNs1GHZ8VQetqbk1mr0V1yAfMe6y8CHDA==", - "type": "package", - "path": "System.Private.Uri/4.0.0", - "files": [ - "lib/DNXCore50/System.Private.Uri.dll", - "lib/netcore50/System.Private.Uri.dll", - "ref/dnxcore50/_._", - "ref/netcore50/_._", - "runtimes/win8-aot/lib/netcore50/System.Private.Uri.dll", - "system.private.uri.4.0.0.nupkg.sha512", - "system.private.uri.nuspec" - ] - }, - "System.Reflection/4.0.10": { - "sha512": "WZ+4lEE4gqGx6mrqLhSiW4oi6QLPWwdNjzhhTONmhELOrW8Cw9phlO9tltgvRUuQUqYtBiliFwhO5S5fCJElVw==", - "type": "package", - "path": "System.Reflection/4.0.10", - "files": [ - "lib/DNXCore50/System.Reflection.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Reflection.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Reflection.dll", - "ref/dotnet/System.Reflection.xml", - "ref/dotnet/de/System.Reflection.xml", - "ref/dotnet/es/System.Reflection.xml", - "ref/dotnet/fr/System.Reflection.xml", - "ref/dotnet/it/System.Reflection.xml", - "ref/dotnet/ja/System.Reflection.xml", - "ref/dotnet/ko/System.Reflection.xml", - "ref/dotnet/ru/System.Reflection.xml", - "ref/dotnet/zh-hans/System.Reflection.xml", - "ref/dotnet/zh-hant/System.Reflection.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.dll", - "system.reflection.4.0.10.nupkg.sha512", - "system.reflection.nuspec" - ] - }, - "System.Reflection/4.3.0": { - "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "type": "package", - "path": "System.Reflection/4.3.0", - "files": [ - "System.Reflection.4.3.0.nupkg.sha512", - "System.Reflection.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Reflection.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Reflection.dll", - "ref/netcore50/System.Reflection.dll", - "ref/netcore50/System.Reflection.xml", - "ref/netcore50/de/System.Reflection.xml", - "ref/netcore50/es/System.Reflection.xml", - "ref/netcore50/fr/System.Reflection.xml", - "ref/netcore50/it/System.Reflection.xml", - "ref/netcore50/ja/System.Reflection.xml", - "ref/netcore50/ko/System.Reflection.xml", - "ref/netcore50/ru/System.Reflection.xml", - "ref/netcore50/zh-hans/System.Reflection.xml", - "ref/netcore50/zh-hant/System.Reflection.xml", - "ref/netstandard1.0/System.Reflection.dll", - "ref/netstandard1.0/System.Reflection.xml", - "ref/netstandard1.0/de/System.Reflection.xml", - "ref/netstandard1.0/es/System.Reflection.xml", - "ref/netstandard1.0/fr/System.Reflection.xml", - "ref/netstandard1.0/it/System.Reflection.xml", - "ref/netstandard1.0/ja/System.Reflection.xml", - "ref/netstandard1.0/ko/System.Reflection.xml", - "ref/netstandard1.0/ru/System.Reflection.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.xml", - "ref/netstandard1.3/System.Reflection.dll", - "ref/netstandard1.3/System.Reflection.xml", - "ref/netstandard1.3/de/System.Reflection.xml", - "ref/netstandard1.3/es/System.Reflection.xml", - "ref/netstandard1.3/fr/System.Reflection.xml", - "ref/netstandard1.3/it/System.Reflection.xml", - "ref/netstandard1.3/ja/System.Reflection.xml", - "ref/netstandard1.3/ko/System.Reflection.xml", - "ref/netstandard1.3/ru/System.Reflection.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.xml", - "ref/netstandard1.5/System.Reflection.dll", - "ref/netstandard1.5/System.Reflection.xml", - "ref/netstandard1.5/de/System.Reflection.xml", - "ref/netstandard1.5/es/System.Reflection.xml", - "ref/netstandard1.5/fr/System.Reflection.xml", - "ref/netstandard1.5/it/System.Reflection.xml", - "ref/netstandard1.5/ja/System.Reflection.xml", - "ref/netstandard1.5/ko/System.Reflection.xml", - "ref/netstandard1.5/ru/System.Reflection.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.Context/4.0.0": { - "sha512": "Gz4sUHHFd/52RjHccSHbOXdujJEWKfL3gIaA+ekxvQaQfJGbI2tPzA0Uv3WTCTDRGHgtoNq5WS9E007Dt4P/VQ==", - "type": "package", - "path": "System.Reflection.Context/4.0.0", - "files": [ - "lib/net45/_._", - "lib/netcore50/System.Reflection.Context.dll", - "lib/win8/_._", - "ref/dotnet/System.Reflection.Context.dll", - "ref/dotnet/System.Reflection.Context.xml", - "ref/dotnet/de/System.Reflection.Context.xml", - "ref/dotnet/es/System.Reflection.Context.xml", - "ref/dotnet/fr/System.Reflection.Context.xml", - "ref/dotnet/it/System.Reflection.Context.xml", - "ref/dotnet/ja/System.Reflection.Context.xml", - "ref/dotnet/ko/System.Reflection.Context.xml", - "ref/dotnet/ru/System.Reflection.Context.xml", - "ref/dotnet/zh-hans/System.Reflection.Context.xml", - "ref/dotnet/zh-hant/System.Reflection.Context.xml", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Context.dll", - "ref/netcore50/System.Reflection.Context.xml", - "ref/win8/_._", - "system.reflection.context.4.0.0.nupkg.sha512", - "system.reflection.context.nuspec" - ] - }, - "System.Reflection.DispatchProxy/4.0.0": { - "sha512": "Kd/4o6DqBfJA4058X8oGEu1KlT8Ej0A+WGeoQgZU2h+3f2vC8NRbHxeOSZvxj9/MPZ1RYmZMGL1ApO9xG/4IVA==", - "type": "package", - "path": "System.Reflection.DispatchProxy/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.DispatchProxy.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.DispatchProxy.dll", - "lib/netcore50/System.Reflection.DispatchProxy.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Reflection.DispatchProxy.dll", - "ref/dotnet/System.Reflection.DispatchProxy.xml", - "ref/dotnet/de/System.Reflection.DispatchProxy.xml", - "ref/dotnet/es/System.Reflection.DispatchProxy.xml", - "ref/dotnet/fr/System.Reflection.DispatchProxy.xml", - "ref/dotnet/it/System.Reflection.DispatchProxy.xml", - "ref/dotnet/ja/System.Reflection.DispatchProxy.xml", - "ref/dotnet/ko/System.Reflection.DispatchProxy.xml", - "ref/dotnet/ru/System.Reflection.DispatchProxy.xml", - "ref/dotnet/zh-hans/System.Reflection.DispatchProxy.xml", - "ref/dotnet/zh-hant/System.Reflection.DispatchProxy.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Reflection.DispatchProxy.dll", - "system.reflection.dispatchproxy.4.0.0.nupkg.sha512", - "system.reflection.dispatchproxy.nuspec" - ] - }, - "System.Reflection.Emit/4.3.0": { - "sha512": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "type": "package", - "path": "System.Reflection.Emit/4.3.0", - "files": [ - "System.Reflection.Emit.4.3.0.nupkg.sha512", - "System.Reflection.Emit.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.dll", - "lib/netstandard1.3/System.Reflection.Emit.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/net45/_._", - "ref/netstandard1.1/System.Reflection.Emit.dll", - "ref/netstandard1.1/System.Reflection.Emit.xml", - "ref/netstandard1.1/de/System.Reflection.Emit.xml", - "ref/netstandard1.1/es/System.Reflection.Emit.xml", - "ref/netstandard1.1/fr/System.Reflection.Emit.xml", - "ref/netstandard1.1/it/System.Reflection.Emit.xml", - "ref/netstandard1.1/ja/System.Reflection.Emit.xml", - "ref/netstandard1.1/ko/System.Reflection.Emit.xml", - "ref/netstandard1.1/ru/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", - "ref/xamarinmac20/_._" - ] - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "sha512": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "type": "package", - "path": "System.Reflection.Emit.ILGeneration/4.3.0", - "files": [ - "System.Reflection.Emit.ILGeneration.4.3.0.nupkg.sha512", - "System.Reflection.Emit.ILGeneration.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.ILGeneration.dll", - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.ILGeneration.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "sha512": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "type": "package", - "path": "System.Reflection.Emit.Lightweight/4.3.0", - "files": [ - "System.Reflection.Emit.Lightweight.4.3.0.nupkg.sha512", - "System.Reflection.Emit.Lightweight.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.Lightweight.dll", - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Extensions/4.0.0": { - "sha512": "dbYaZWCyFAu1TGYUqR2n+Q+1casSHPR2vVW0WVNkXpZbrd2BXcZ7cpvpu9C98CTHtNmyfMWCLpCclDqly23t6A==", - "type": "package", - "path": "System.Reflection.Extensions/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.Extensions.dll", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Extensions.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Reflection.Extensions.dll", - "ref/dotnet/System.Reflection.Extensions.xml", - "ref/dotnet/de/System.Reflection.Extensions.xml", - "ref/dotnet/es/System.Reflection.Extensions.xml", - "ref/dotnet/fr/System.Reflection.Extensions.xml", - "ref/dotnet/it/System.Reflection.Extensions.xml", - "ref/dotnet/ja/System.Reflection.Extensions.xml", - "ref/dotnet/ko/System.Reflection.Extensions.xml", - "ref/dotnet/ru/System.Reflection.Extensions.xml", - "ref/dotnet/zh-hans/System.Reflection.Extensions.xml", - "ref/dotnet/zh-hant/System.Reflection.Extensions.xml", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll", - "system.reflection.extensions.4.0.0.nupkg.sha512", - "system.reflection.extensions.nuspec" - ] - }, - "System.Reflection.Extensions/4.3.0": { - "sha512": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "type": "package", - "path": "System.Reflection.Extensions/4.3.0", - "files": [ - "System.Reflection.Extensions.4.3.0.nupkg.sha512", - "System.Reflection.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/netcore50/de/System.Reflection.Extensions.xml", - "ref/netcore50/es/System.Reflection.Extensions.xml", - "ref/netcore50/fr/System.Reflection.Extensions.xml", - "ref/netcore50/it/System.Reflection.Extensions.xml", - "ref/netcore50/ja/System.Reflection.Extensions.xml", - "ref/netcore50/ko/System.Reflection.Extensions.xml", - "ref/netcore50/ru/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hans/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hant/System.Reflection.Extensions.xml", - "ref/netstandard1.0/System.Reflection.Extensions.dll", - "ref/netstandard1.0/System.Reflection.Extensions.xml", - "ref/netstandard1.0/de/System.Reflection.Extensions.xml", - "ref/netstandard1.0/es/System.Reflection.Extensions.xml", - "ref/netstandard1.0/fr/System.Reflection.Extensions.xml", - "ref/netstandard1.0/it/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ja/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ko/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ru/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.Metadata/1.0.22": { - "sha512": "ltoL/teiEdy5W9fyYdtFr2xJ/4nHyksXLK9dkPWx3ubnj7BVfsSWxvWTg9EaJUXjhWvS/AeTtugZA1/IDQyaPQ==", - "type": "package", - "path": "System.Reflection.Metadata/1.0.22", - "files": [ - "lib/dotnet/System.Reflection.Metadata.dll", - "lib/dotnet/System.Reflection.Metadata.xml", - "lib/portable-net45+win8/System.Reflection.Metadata.dll", - "lib/portable-net45+win8/System.Reflection.Metadata.xml", - "system.reflection.metadata.1.0.22.nupkg.sha512", - "system.reflection.metadata.nuspec" - ] - }, - "System.Reflection.Primitives/4.0.0": { - "sha512": "n9S0XpKv2ruc17FSnaiX6nV47VfHTZ1wLjKZlAirUZCvDQCH71mVp+Ohabn0xXLh5pK2PKp45HCxkqu5Fxn/lA==", - "type": "package", - "path": "System.Reflection.Primitives/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.Primitives.dll", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Primitives.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Reflection.Primitives.dll", - "ref/dotnet/System.Reflection.Primitives.xml", - "ref/dotnet/de/System.Reflection.Primitives.xml", - "ref/dotnet/es/System.Reflection.Primitives.xml", - "ref/dotnet/fr/System.Reflection.Primitives.xml", - "ref/dotnet/it/System.Reflection.Primitives.xml", - "ref/dotnet/ja/System.Reflection.Primitives.xml", - "ref/dotnet/ko/System.Reflection.Primitives.xml", - "ref/dotnet/ru/System.Reflection.Primitives.xml", - "ref/dotnet/zh-hans/System.Reflection.Primitives.xml", - "ref/dotnet/zh-hant/System.Reflection.Primitives.xml", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.Primitives.dll", - "system.reflection.primitives.4.0.0.nupkg.sha512", - "system.reflection.primitives.nuspec" - ] - }, - "System.Reflection.Primitives/4.3.0": { - "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "type": "package", - "path": "System.Reflection.Primitives/4.3.0", - "files": [ - "System.Reflection.Primitives.4.3.0.nupkg.sha512", - "System.Reflection.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/netcore50/de/System.Reflection.Primitives.xml", - "ref/netcore50/es/System.Reflection.Primitives.xml", - "ref/netcore50/fr/System.Reflection.Primitives.xml", - "ref/netcore50/it/System.Reflection.Primitives.xml", - "ref/netcore50/ja/System.Reflection.Primitives.xml", - "ref/netcore50/ko/System.Reflection.Primitives.xml", - "ref/netcore50/ru/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", - "ref/netstandard1.0/System.Reflection.Primitives.dll", - "ref/netstandard1.0/System.Reflection.Primitives.xml", - "ref/netstandard1.0/de/System.Reflection.Primitives.xml", - "ref/netstandard1.0/es/System.Reflection.Primitives.xml", - "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", - "ref/netstandard1.0/it/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.TypeExtensions/4.0.0": { - "sha512": "YRM/msNAM86hdxPyXcuZSzmTO0RQFh7YMEPBLTY8cqXvFPYIx2x99bOyPkuU81wRYQem1c1HTkImQ2DjbOBfew==", - "type": "package", - "path": "System.Reflection.TypeExtensions/4.0.0", - "files": [ - "lib/DNXCore50/System.Reflection.TypeExtensions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Reflection.TypeExtensions.dll", - "ref/dotnet/System.Reflection.TypeExtensions.xml", - "ref/dotnet/de/System.Reflection.TypeExtensions.xml", - "ref/dotnet/es/System.Reflection.TypeExtensions.xml", - "ref/dotnet/fr/System.Reflection.TypeExtensions.xml", - "ref/dotnet/it/System.Reflection.TypeExtensions.xml", - "ref/dotnet/ja/System.Reflection.TypeExtensions.xml", - "ref/dotnet/ko/System.Reflection.TypeExtensions.xml", - "ref/dotnet/ru/System.Reflection.TypeExtensions.xml", - "ref/dotnet/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/dotnet/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Reflection.TypeExtensions.dll", - "system.reflection.typeextensions.4.0.0.nupkg.sha512", - "system.reflection.typeextensions.nuspec" - ] - }, - "System.Reflection.TypeExtensions/4.3.0": { - "sha512": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "type": "package", - "path": "System.Reflection.TypeExtensions/4.3.0", - "files": [ - "System.Reflection.TypeExtensions.4.3.0.nupkg.sha512", - "System.Reflection.TypeExtensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/net462/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/net462/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.5/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.TypeExtensions.dll" - ] - }, - "System.Resources.ResourceManager/4.0.0": { - "sha512": "qmqeZ4BJgjfU+G2JbrZt4Dk1LsMxO4t+f/9HarNY6w8pBgweO6jT+cknUH7c3qIrGvyUqraBhU45Eo6UtA0fAw==", - "type": "package", - "path": "System.Resources.ResourceManager/4.0.0", - "files": [ - "lib/DNXCore50/System.Resources.ResourceManager.dll", - "lib/net45/_._", - "lib/netcore50/System.Resources.ResourceManager.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Resources.ResourceManager.dll", - "ref/dotnet/System.Resources.ResourceManager.xml", - "ref/dotnet/de/System.Resources.ResourceManager.xml", - "ref/dotnet/es/System.Resources.ResourceManager.xml", - "ref/dotnet/fr/System.Resources.ResourceManager.xml", - "ref/dotnet/it/System.Resources.ResourceManager.xml", - "ref/dotnet/ja/System.Resources.ResourceManager.xml", - "ref/dotnet/ko/System.Resources.ResourceManager.xml", - "ref/dotnet/ru/System.Resources.ResourceManager.xml", - "ref/dotnet/zh-hans/System.Resources.ResourceManager.xml", - "ref/dotnet/zh-hant/System.Resources.ResourceManager.xml", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Resources.ResourceManager.dll", - "system.resources.resourcemanager.4.0.0.nupkg.sha512", - "system.resources.resourcemanager.nuspec" - ] - }, - "System.Resources.ResourceManager/4.3.0": { - "sha512": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "type": "package", - "path": "System.Resources.ResourceManager/4.3.0", - "files": [ - "System.Resources.ResourceManager.4.3.0.nupkg.sha512", - "System.Resources.ResourceManager.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/netcore50/de/System.Resources.ResourceManager.xml", - "ref/netcore50/es/System.Resources.ResourceManager.xml", - "ref/netcore50/fr/System.Resources.ResourceManager.xml", - "ref/netcore50/it/System.Resources.ResourceManager.xml", - "ref/netcore50/ja/System.Resources.ResourceManager.xml", - "ref/netcore50/ko/System.Resources.ResourceManager.xml", - "ref/netcore50/ru/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/System.Resources.ResourceManager.dll", - "ref/netstandard1.0/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime/4.0.20": { - "sha512": "X7N/9Bz7jVPorqdVFO86ns1sX6MlQM+WTxELtx+Z4VG45x9+LKmWH0GRqjgKprUnVuwmfB9EJ9DQng14Z7/zwg==", - "type": "package", - "path": "System.Runtime/4.0.20", - "files": [ - "lib/DNXCore50/System.Runtime.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.dll", - "ref/dotnet/System.Runtime.xml", - "ref/dotnet/de/System.Runtime.xml", - "ref/dotnet/es/System.Runtime.xml", - "ref/dotnet/fr/System.Runtime.xml", - "ref/dotnet/it/System.Runtime.xml", - "ref/dotnet/ja/System.Runtime.xml", - "ref/dotnet/ko/System.Runtime.xml", - "ref/dotnet/ru/System.Runtime.xml", - "ref/dotnet/zh-hans/System.Runtime.xml", - "ref/dotnet/zh-hant/System.Runtime.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.dll", - "system.runtime.4.0.20.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Runtime/4.3.0": { - "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "type": "package", - "path": "System.Runtime/4.3.0", - "files": [ - "System.Runtime.4.3.0.nupkg.sha512", - "System.Runtime.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Extensions/4.0.10": { - "sha512": "5dsEwf3Iml7d5OZeT20iyOjT+r+okWpN7xI2v+R4cgd3WSj4DeRPTvPFjDpacbVW4skCAZ8B9hxXJYgkCFKJ1A==", - "type": "package", - "path": "System.Runtime.Extensions/4.0.10", - "files": [ - "lib/DNXCore50/System.Runtime.Extensions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.Extensions.dll", - "ref/dotnet/System.Runtime.Extensions.xml", - "ref/dotnet/de/System.Runtime.Extensions.xml", - "ref/dotnet/es/System.Runtime.Extensions.xml", - "ref/dotnet/fr/System.Runtime.Extensions.xml", - "ref/dotnet/it/System.Runtime.Extensions.xml", - "ref/dotnet/ja/System.Runtime.Extensions.xml", - "ref/dotnet/ko/System.Runtime.Extensions.xml", - "ref/dotnet/ru/System.Runtime.Extensions.xml", - "ref/dotnet/zh-hans/System.Runtime.Extensions.xml", - "ref/dotnet/zh-hant/System.Runtime.Extensions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Extensions.dll", - "system.runtime.extensions.4.0.10.nupkg.sha512", - "system.runtime.extensions.nuspec" - ] - }, - "System.Runtime.Extensions/4.3.0": { - "sha512": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "type": "package", - "path": "System.Runtime.Extensions/4.3.0", - "files": [ - "System.Runtime.Extensions.4.3.0.nupkg.sha512", - "System.Runtime.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.xml", - "ref/netcore50/de/System.Runtime.Extensions.xml", - "ref/netcore50/es/System.Runtime.Extensions.xml", - "ref/netcore50/fr/System.Runtime.Extensions.xml", - "ref/netcore50/it/System.Runtime.Extensions.xml", - "ref/netcore50/ja/System.Runtime.Extensions.xml", - "ref/netcore50/ko/System.Runtime.Extensions.xml", - "ref/netcore50/ru/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hans/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.0/System.Runtime.Extensions.dll", - "ref/netstandard1.0/System.Runtime.Extensions.xml", - "ref/netstandard1.0/de/System.Runtime.Extensions.xml", - "ref/netstandard1.0/es/System.Runtime.Extensions.xml", - "ref/netstandard1.0/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.0/it/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.3/System.Runtime.Extensions.dll", - "ref/netstandard1.3/System.Runtime.Extensions.xml", - "ref/netstandard1.3/de/System.Runtime.Extensions.xml", - "ref/netstandard1.3/es/System.Runtime.Extensions.xml", - "ref/netstandard1.3/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.3/it/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.5/System.Runtime.Extensions.dll", - "ref/netstandard1.5/System.Runtime.Extensions.xml", - "ref/netstandard1.5/de/System.Runtime.Extensions.xml", - "ref/netstandard1.5/es/System.Runtime.Extensions.xml", - "ref/netstandard1.5/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.5/it/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Handles/4.0.0": { - "sha512": "638VhpRq63tVcQ6HDb3um3R/J2BtR1Sa96toHo6PcJGPXEPEsleCuqhBgX2gFCz0y0qkutANwW6VPPY5wQu1XQ==", - "type": "package", - "path": "System.Runtime.Handles/4.0.0", - "files": [ - "lib/DNXCore50/System.Runtime.Handles.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.Handles.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.Handles.dll", - "ref/dotnet/System.Runtime.Handles.xml", - "ref/dotnet/de/System.Runtime.Handles.xml", - "ref/dotnet/es/System.Runtime.Handles.xml", - "ref/dotnet/fr/System.Runtime.Handles.xml", - "ref/dotnet/it/System.Runtime.Handles.xml", - "ref/dotnet/ja/System.Runtime.Handles.xml", - "ref/dotnet/ko/System.Runtime.Handles.xml", - "ref/dotnet/ru/System.Runtime.Handles.xml", - "ref/dotnet/zh-hans/System.Runtime.Handles.xml", - "ref/dotnet/zh-hant/System.Runtime.Handles.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Handles.dll", - "system.runtime.handles.4.0.0.nupkg.sha512", - "system.runtime.handles.nuspec" - ] - }, - "System.Runtime.Handles/4.3.0": { - "sha512": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "type": "package", - "path": "System.Runtime.Handles/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Runtime.Handles.dll", - "ref/netstandard1.3/System.Runtime.Handles.xml", - "ref/netstandard1.3/de/System.Runtime.Handles.xml", - "ref/netstandard1.3/es/System.Runtime.Handles.xml", - "ref/netstandard1.3/fr/System.Runtime.Handles.xml", - "ref/netstandard1.3/it/System.Runtime.Handles.xml", - "ref/netstandard1.3/ja/System.Runtime.Handles.xml", - "ref/netstandard1.3/ko/System.Runtime.Handles.xml", - "ref/netstandard1.3/ru/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Handles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.handles.4.3.0.nupkg.sha512", - "system.runtime.handles.nuspec" - ] - }, - "System.Runtime.InteropServices/4.0.20": { - "sha512": "ZgDyBYfEnjWoz/viS6VOswA6XOkDSH2DzgbpczbW50RywhnCgTl+w3JEvtAiOGyIh8cyx1NJq80jsNBSUr8Pig==", - "type": "package", - "path": "System.Runtime.InteropServices/4.0.20", - "files": [ - "lib/DNXCore50/System.Runtime.InteropServices.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Runtime.InteropServices.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Runtime.InteropServices.dll", - "ref/dotnet/System.Runtime.InteropServices.xml", - "ref/dotnet/de/System.Runtime.InteropServices.xml", - "ref/dotnet/es/System.Runtime.InteropServices.xml", - "ref/dotnet/fr/System.Runtime.InteropServices.xml", - "ref/dotnet/it/System.Runtime.InteropServices.xml", - "ref/dotnet/ja/System.Runtime.InteropServices.xml", - "ref/dotnet/ko/System.Runtime.InteropServices.xml", - "ref/dotnet/ru/System.Runtime.InteropServices.xml", - "ref/dotnet/zh-hans/System.Runtime.InteropServices.xml", - "ref/dotnet/zh-hant/System.Runtime.InteropServices.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.dll", - "system.runtime.interopservices.4.0.20.nupkg.sha512", - "system.runtime.interopservices.nuspec" - ] - }, - "System.Runtime.InteropServices/4.3.0": { - "sha512": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "type": "package", - "path": "System.Runtime.InteropServices/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.InteropServices.dll", - "lib/net463/System.Runtime.InteropServices.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.InteropServices.dll", - "ref/net463/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.xml", - "ref/netcore50/de/System.Runtime.InteropServices.xml", - "ref/netcore50/es/System.Runtime.InteropServices.xml", - "ref/netcore50/fr/System.Runtime.InteropServices.xml", - "ref/netcore50/it/System.Runtime.InteropServices.xml", - "ref/netcore50/ja/System.Runtime.InteropServices.xml", - "ref/netcore50/ko/System.Runtime.InteropServices.xml", - "ref/netcore50/ru/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hans/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hant/System.Runtime.InteropServices.xml", - "ref/netcoreapp1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/System.Runtime.InteropServices.dll", - "ref/netstandard1.2/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/System.Runtime.InteropServices.dll", - "ref/netstandard1.3/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/System.Runtime.InteropServices.dll", - "ref/netstandard1.5/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.InteropServices.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.interopservices.4.3.0.nupkg.sha512", - "system.runtime.interopservices.nuspec" - ] - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "sha512": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "type": "package", - "path": "System.Runtime.InteropServices.RuntimeInformation/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/win8/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/wpa81/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "system.runtime.interopservices.runtimeinformation.4.3.0.nupkg.sha512", - "system.runtime.interopservices.runtimeinformation.nuspec" - ] - }, - "System.Runtime.InteropServices.WindowsRuntime/4.0.0": { - "sha512": "K5MGSvw/sGPKQYdOVqSpsVbHBE8HccHIDEhUNjM1lui65KGF/slNZfijGU87ggQiVXTI802ebKiOYBkwiLotow==", - "type": "package", - "path": "System.Runtime.InteropServices.WindowsRuntime/4.0.0", - "files": [ - "lib/net45/_._", - "lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.InteropServices.WindowsRuntime.dll", - "ref/dotnet/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/de/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/es/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/fr/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/it/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/ja/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/ko/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/ru/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/zh-hans/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/dotnet/zh-hant/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/net45/_._", - "ref/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll", - "ref/netcore50/System.Runtime.InteropServices.WindowsRuntime.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.WindowsRuntime.dll", - "system.runtime.interopservices.windowsruntime.4.0.0.nupkg.sha512", - "system.runtime.interopservices.windowsruntime.nuspec" - ] - }, - "System.Runtime.Numerics/4.0.0": { - "sha512": "aAYGEOE01nabQLufQ4YO8WuSyZzOqGcksi8m1BRW8ppkmssR7en8TqiXcBkB2gTkCnKG/Ai2NQY8CgdmgZw/fw==", - "type": "package", - "path": "System.Runtime.Numerics/4.0.0", - "files": [ - "lib/dotnet/System.Runtime.Numerics.dll", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.Numerics.dll", - "ref/dotnet/System.Runtime.Numerics.xml", - "ref/dotnet/de/System.Runtime.Numerics.xml", - "ref/dotnet/es/System.Runtime.Numerics.xml", - "ref/dotnet/fr/System.Runtime.Numerics.xml", - "ref/dotnet/it/System.Runtime.Numerics.xml", - "ref/dotnet/ja/System.Runtime.Numerics.xml", - "ref/dotnet/ko/System.Runtime.Numerics.xml", - "ref/dotnet/ru/System.Runtime.Numerics.xml", - "ref/dotnet/zh-hans/System.Runtime.Numerics.xml", - "ref/dotnet/zh-hant/System.Runtime.Numerics.xml", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.runtime.numerics.4.0.0.nupkg.sha512", - "system.runtime.numerics.nuspec" - ] - }, - "System.Runtime.Numerics/4.3.0": { - "sha512": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "type": "package", - "path": "System.Runtime.Numerics/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/netstandard1.3/System.Runtime.Numerics.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/netcore50/de/System.Runtime.Numerics.xml", - "ref/netcore50/es/System.Runtime.Numerics.xml", - "ref/netcore50/fr/System.Runtime.Numerics.xml", - "ref/netcore50/it/System.Runtime.Numerics.xml", - "ref/netcore50/ja/System.Runtime.Numerics.xml", - "ref/netcore50/ko/System.Runtime.Numerics.xml", - "ref/netcore50/ru/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hans/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hant/System.Runtime.Numerics.xml", - "ref/netstandard1.1/System.Runtime.Numerics.dll", - "ref/netstandard1.1/System.Runtime.Numerics.xml", - "ref/netstandard1.1/de/System.Runtime.Numerics.xml", - "ref/netstandard1.1/es/System.Runtime.Numerics.xml", - "ref/netstandard1.1/fr/System.Runtime.Numerics.xml", - "ref/netstandard1.1/it/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ja/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ko/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ru/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.Numerics.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.numerics.4.3.0.nupkg.sha512", - "system.runtime.numerics.nuspec" - ] - }, - "System.Runtime.Serialization.Json/4.0.1": { - "sha512": "MUqpQDHlwFAy3v+fVzLN26SMGCPW/J2n4vfsBfScPiut/+Kp77Pcy1nWX2FC83WskFMepvmjMcXwTYZ75FCK0Q==", - "type": "package", - "path": "System.Runtime.Serialization.Json/4.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/DNXCore50/System.Runtime.Serialization.Json.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Serialization.Json.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.1/System.Runtime.Serialization.Json.dll", - "ref/dotnet5.1/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/de/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/es/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/fr/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/it/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/ja/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/ko/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/ru/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/zh-hans/System.Runtime.Serialization.Json.xml", - "ref/dotnet5.1/zh-hant/System.Runtime.Serialization.Json.xml", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Serialization.Json.dll", - "ref/netcore50/System.Runtime.Serialization.Json.xml", - "ref/netcore50/de/System.Runtime.Serialization.Json.xml", - "ref/netcore50/es/System.Runtime.Serialization.Json.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Json.xml", - "ref/netcore50/it/System.Runtime.Serialization.Json.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Json.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Json.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Json.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Json.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Json.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Json.dll", - "system.runtime.serialization.json.4.0.1.nupkg.sha512", - "system.runtime.serialization.json.nuspec" - ] - }, - "System.Runtime.Serialization.Primitives/4.1.0": { - "sha512": "2UBnpTwpEi5dzbNJ8KhbOZ7Te1XQNov9MrtJ+dcnqogjACPNzbOiGT2uU9XgZg+sdbPvr4VMvVjFwJ85uLLCuA==", - "type": "package", - "path": "System.Runtime.Serialization.Primitives/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet5.4/System.Runtime.Serialization.Primitives.dll", - "lib/net45/_._", - "lib/net46/System.Runtime.Serialization.Primitives.dll", - "lib/netcore50/System.Runtime.Serialization.Primitives.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.1/System.Runtime.Serialization.Primitives.dll", - "ref/dotnet5.1/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/de/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/es/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/fr/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/it/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/ja/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/ko/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/ru/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.1/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/System.Runtime.Serialization.Primitives.dll", - "ref/dotnet5.4/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/de/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/es/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/fr/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/it/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/ja/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/ko/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/ru/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/dotnet5.4/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/net45/_._", - "ref/net46/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/de/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/es/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/it/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll", - "system.runtime.serialization.primitives.4.1.0.nupkg.sha512", - "system.runtime.serialization.primitives.nuspec" - ] - }, - "System.Runtime.Serialization.Xml/4.1.0": { - "sha512": "7TvzeIeNvT2GLpmSy/3J1VIkT70MroNujIiBWBe0qeM6/QFPdCcF/1Zxx9Ohc/iZUPAANb1wMruCAiYY2HTTrg==", - "type": "package", - "path": "System.Runtime.Serialization.Xml/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/DNXCore50/System.Runtime.Serialization.Xml.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Runtime.Serialization.Xml.dll", - "lib/netcore50/System.Runtime.Serialization.Xml.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.1/System.Runtime.Serialization.Xml.dll", - "ref/dotnet5.1/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/de/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/es/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/fr/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/it/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/ja/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/ko/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/ru/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/zh-hans/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.1/zh-hant/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/System.Runtime.Serialization.Xml.dll", - "ref/dotnet5.4/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/de/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/es/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/fr/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/it/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/ja/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/ko/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/ru/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/zh-hans/System.Runtime.Serialization.Xml.xml", - "ref/dotnet5.4/zh-hant/System.Runtime.Serialization.Xml.xml", - "ref/net45/_._", - "ref/net46/System.Runtime.Serialization.Xml.dll", - "ref/netcore50/System.Runtime.Serialization.Xml.dll", - "ref/netcore50/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/de/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/es/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/it/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Xml.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Xml.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.Serialization.Xml.dll", - "system.runtime.serialization.xml.4.1.0.nupkg.sha512", - "system.runtime.serialization.xml.nuspec" - ] - }, - "System.Runtime.WindowsRuntime/4.0.10": { - "sha512": "9w6ypdnEw8RrLRlxTbLAYrap4eL1xIQeNoOaumQVOQ8TTD/5g9FGrBtY3KLiGxAPieN9AwAAEIDkugU85Cwuvg==", - "type": "package", - "path": "System.Runtime.WindowsRuntime/4.0.10", - "files": [ - "lib/netcore50/System.Runtime.WindowsRuntime.dll", - "lib/win81/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.WindowsRuntime.dll", - "ref/dotnet/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/de/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/es/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/fr/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/it/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/ja/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/ko/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/ru/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/zh-hans/System.Runtime.WindowsRuntime.xml", - "ref/dotnet/zh-hant/System.Runtime.WindowsRuntime.xml", - "ref/netcore50/System.Runtime.WindowsRuntime.dll", - "ref/netcore50/System.Runtime.WindowsRuntime.xml", - "ref/win81/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Runtime.WindowsRuntime.dll", - "system.runtime.windowsruntime.4.0.10.nupkg.sha512", - "system.runtime.windowsruntime.nuspec" - ] - }, - "System.Runtime.WindowsRuntime.UI.Xaml/4.0.0": { - "sha512": "2GY3fkXBMQOyyO9ovaH46CN6MD2ck/Gvk4VNAgVDvtmfO3HXYFNd+bB05WhVcJrHKbfKZNwfwZKpYZ+OsVFsLw==", - "type": "package", - "path": "System.Runtime.WindowsRuntime.UI.Xaml/4.0.0", - "files": [ - "lib/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Runtime.WindowsRuntime.UI.Xaml.dll", - "ref/dotnet/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/de/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/es/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/fr/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/it/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/ja/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/ko/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/ru/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/zh-hans/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/dotnet/zh-hant/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.dll", - "ref/netcore50/System.Runtime.WindowsRuntime.UI.Xaml.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.runtime.windowsruntime.ui.xaml.4.0.0.nupkg.sha512", - "system.runtime.windowsruntime.ui.xaml.nuspec" - ] - }, - "System.Security.Claims/4.0.0": { - "sha512": "94NFR/7JN3YdyTH7hl2iSvYmdA8aqShriTHectcK+EbizT71YczMaG6LuqJBQP/HWo66AQyikYYM9aw+4EzGXg==", - "type": "package", - "path": "System.Security.Claims/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Security.Claims.dll", - "lib/net46/System.Security.Claims.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Security.Claims.dll", - "ref/dotnet/System.Security.Claims.xml", - "ref/dotnet/de/System.Security.Claims.xml", - "ref/dotnet/es/System.Security.Claims.xml", - "ref/dotnet/fr/System.Security.Claims.xml", - "ref/dotnet/it/System.Security.Claims.xml", - "ref/dotnet/ja/System.Security.Claims.xml", - "ref/dotnet/ko/System.Security.Claims.xml", - "ref/dotnet/ru/System.Security.Claims.xml", - "ref/dotnet/zh-hans/System.Security.Claims.xml", - "ref/dotnet/zh-hant/System.Security.Claims.xml", - "ref/net46/System.Security.Claims.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.security.claims.4.0.0.nupkg.sha512", - "system.security.claims.nuspec" - ] - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "sha512": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "type": "package", - "path": "System.Security.Cryptography.Algorithms/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Algorithms.dll", - "lib/net461/System.Security.Cryptography.Algorithms.dll", - "lib/net463/System.Security.Cryptography.Algorithms.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Algorithms.dll", - "ref/net461/System.Security.Cryptography.Algorithms.dll", - "ref/net463/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.3/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.4/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "system.security.cryptography.algorithms.4.3.0.nupkg.sha512", - "system.security.cryptography.algorithms.nuspec" - ] - }, - "System.Security.Cryptography.Cng/4.3.0": { - "sha512": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "type": "package", - "path": "System.Security.Cryptography.Cng/4.3.0", - "files": [ - "System.Security.Cryptography.Cng.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Cng.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Cryptography.Cng.dll", - "lib/net461/System.Security.Cryptography.Cng.dll", - "lib/net463/System.Security.Cryptography.Cng.dll", - "ref/net46/System.Security.Cryptography.Cng.dll", - "ref/net461/System.Security.Cryptography.Cng.dll", - "ref/net463/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.3/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.4/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.4/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll" - ] - }, - "System.Security.Cryptography.Csp/4.3.0": { - "sha512": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "type": "package", - "path": "System.Security.Cryptography.Csp/4.3.0", - "files": [ - "System.Security.Cryptography.Csp.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Csp.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Csp.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Csp.dll", - "ref/netstandard1.3/System.Security.Cryptography.Csp.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll" - ] - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "sha512": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "type": "package", - "path": "System.Security.Cryptography.Encoding/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.Encoding.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "system.security.cryptography.encoding.4.3.0.nupkg.sha512", - "system.security.cryptography.encoding.nuspec" - ] - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "type": "package", - "path": "System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "System.Security.Cryptography.OpenSsl.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "ref/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll" - ] - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "sha512": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "type": "package", - "path": "System.Security.Cryptography.Primitives/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Primitives.dll", - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Primitives.dll", - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.security.cryptography.primitives.4.3.0.nupkg.sha512", - "system.security.cryptography.primitives.nuspec" - ] - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "sha512": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "type": "package", - "path": "System.Security.Cryptography.X509Certificates/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.X509Certificates.dll", - "lib/net461/System.Security.Cryptography.X509Certificates.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.X509Certificates.dll", - "ref/net461/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512", - "system.security.cryptography.x509certificates.nuspec" - ] - }, - "System.Security.Principal/4.0.0": { - "sha512": "FOhq3jUOONi6fp5j3nPYJMrKtSJlqAURpjiO3FaDIV4DJNEYymWW5uh1pfxySEB8dtAW+I66IypzNge/w9OzZQ==", - "type": "package", - "path": "System.Security.Principal/4.0.0", - "files": [ - "lib/dotnet/System.Security.Principal.dll", - "lib/net45/_._", - "lib/netcore50/System.Security.Principal.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Security.Principal.dll", - "ref/dotnet/System.Security.Principal.xml", - "ref/dotnet/de/System.Security.Principal.xml", - "ref/dotnet/es/System.Security.Principal.xml", - "ref/dotnet/fr/System.Security.Principal.xml", - "ref/dotnet/it/System.Security.Principal.xml", - "ref/dotnet/ja/System.Security.Principal.xml", - "ref/dotnet/ko/System.Security.Principal.xml", - "ref/dotnet/ru/System.Security.Principal.xml", - "ref/dotnet/zh-hans/System.Security.Principal.xml", - "ref/dotnet/zh-hant/System.Security.Principal.xml", - "ref/net45/_._", - "ref/netcore50/System.Security.Principal.dll", - "ref/netcore50/System.Security.Principal.xml", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "system.security.principal.4.0.0.nupkg.sha512", - "system.security.principal.nuspec" - ] - }, - "System.ServiceModel.Duplex/4.0.0": { - "sha512": "JFeDn+IsiwAVJkNNnM7MLefJOnzYhovaHnjk3lzEnUWkYZJeAKrcgLdK6GE2GNjb5mEV8Pad/E0JcA8eCr3eWQ==", - "type": "package", - "path": "System.ServiceModel.Duplex/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.Duplex.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.Duplex.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.Duplex.dll", - "ref/dotnet/System.ServiceModel.Duplex.xml", - "ref/dotnet/de/System.ServiceModel.Duplex.xml", - "ref/dotnet/es/System.ServiceModel.Duplex.xml", - "ref/dotnet/fr/System.ServiceModel.Duplex.xml", - "ref/dotnet/it/System.ServiceModel.Duplex.xml", - "ref/dotnet/ja/System.ServiceModel.Duplex.xml", - "ref/dotnet/ko/System.ServiceModel.Duplex.xml", - "ref/dotnet/ru/System.ServiceModel.Duplex.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Duplex.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Duplex.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.Duplex.dll", - "ref/netcore50/System.ServiceModel.Duplex.xml", - "ref/win8/_._", - "system.servicemodel.duplex.4.0.0.nupkg.sha512", - "system.servicemodel.duplex.nuspec" - ] - }, - "System.ServiceModel.Http/4.0.10": { - "sha512": "Vyl7lmvMlXJamtnDugoXuAgAQGSqtA7omK3zDBYByhbYeBC2hRBchgyXox7e5vEO+29TeB1IpoLWQGb7tO9h6A==", - "type": "package", - "path": "System.ServiceModel.Http/4.0.10", - "files": [ - "lib/DNXCore50/System.ServiceModel.Http.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.ServiceModel.Http.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.ServiceModel.Http.dll", - "ref/dotnet/System.ServiceModel.Http.xml", - "ref/dotnet/de/System.ServiceModel.Http.xml", - "ref/dotnet/es/System.ServiceModel.Http.xml", - "ref/dotnet/fr/System.ServiceModel.Http.xml", - "ref/dotnet/it/System.ServiceModel.Http.xml", - "ref/dotnet/ja/System.ServiceModel.Http.xml", - "ref/dotnet/ko/System.ServiceModel.Http.xml", - "ref/dotnet/ru/System.ServiceModel.Http.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Http.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Http.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.servicemodel.http.4.0.10.nupkg.sha512", - "system.servicemodel.http.nuspec" - ] - }, - "System.ServiceModel.NetTcp/4.0.0": { - "sha512": "lV2Cdcso9jOS0KBtgHZHzTLe/Lx/ERdPcvF4dlepUie6/+BOMYTOgg2C7OdpIjp3fwUNXq8nhU+IilmEyjuf/A==", - "type": "package", - "path": "System.ServiceModel.NetTcp/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.NetTcp.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.NetTcp.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.NetTcp.dll", - "ref/dotnet/System.ServiceModel.NetTcp.xml", - "ref/dotnet/de/System.ServiceModel.NetTcp.xml", - "ref/dotnet/es/System.ServiceModel.NetTcp.xml", - "ref/dotnet/fr/System.ServiceModel.NetTcp.xml", - "ref/dotnet/it/System.ServiceModel.NetTcp.xml", - "ref/dotnet/ja/System.ServiceModel.NetTcp.xml", - "ref/dotnet/ko/System.ServiceModel.NetTcp.xml", - "ref/dotnet/ru/System.ServiceModel.NetTcp.xml", - "ref/dotnet/zh-hans/System.ServiceModel.NetTcp.xml", - "ref/dotnet/zh-hant/System.ServiceModel.NetTcp.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.NetTcp.dll", - "ref/netcore50/System.ServiceModel.NetTcp.xml", - "ref/win8/_._", - "system.servicemodel.nettcp.4.0.0.nupkg.sha512", - "system.servicemodel.nettcp.nuspec" - ] - }, - "System.ServiceModel.Primitives/4.0.0": { - "sha512": "uF5VYQWR07LgiZkzUr8qjwvqOaIAfwU566MneD4WuC14d8FLJNsAgCJUYhBGB7COjH7HTqnP9ZFmr6c+L83Stg==", - "type": "package", - "path": "System.ServiceModel.Primitives/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.Primitives.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.Primitives.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.Primitives.dll", - "ref/dotnet/System.ServiceModel.Primitives.xml", - "ref/dotnet/de/System.ServiceModel.Primitives.xml", - "ref/dotnet/es/System.ServiceModel.Primitives.xml", - "ref/dotnet/fr/System.ServiceModel.Primitives.xml", - "ref/dotnet/it/System.ServiceModel.Primitives.xml", - "ref/dotnet/ja/System.ServiceModel.Primitives.xml", - "ref/dotnet/ko/System.ServiceModel.Primitives.xml", - "ref/dotnet/ru/System.ServiceModel.Primitives.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Primitives.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Primitives.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.Primitives.dll", - "ref/netcore50/System.ServiceModel.Primitives.xml", - "ref/win8/_._", - "system.servicemodel.primitives.4.0.0.nupkg.sha512", - "system.servicemodel.primitives.nuspec" - ] - }, - "System.ServiceModel.Security/4.0.0": { - "sha512": "sPVzsnd8w/TJsW/4sYA9eIGP+RtlpN0AhKLGKf9ywdGGmHPi0kkuX2mx412dM3GN0e4oifuISwvZqby/sI8Feg==", - "type": "package", - "path": "System.ServiceModel.Security/4.0.0", - "files": [ - "lib/DNXCore50/System.ServiceModel.Security.dll", - "lib/net45/_._", - "lib/netcore50/System.ServiceModel.Security.dll", - "lib/win8/_._", - "ref/dotnet/System.ServiceModel.Security.dll", - "ref/dotnet/System.ServiceModel.Security.xml", - "ref/dotnet/de/System.ServiceModel.Security.xml", - "ref/dotnet/es/System.ServiceModel.Security.xml", - "ref/dotnet/fr/System.ServiceModel.Security.xml", - "ref/dotnet/it/System.ServiceModel.Security.xml", - "ref/dotnet/ja/System.ServiceModel.Security.xml", - "ref/dotnet/ko/System.ServiceModel.Security.xml", - "ref/dotnet/ru/System.ServiceModel.Security.xml", - "ref/dotnet/zh-hans/System.ServiceModel.Security.xml", - "ref/dotnet/zh-hant/System.ServiceModel.Security.xml", - "ref/net45/_._", - "ref/netcore50/System.ServiceModel.Security.dll", - "ref/netcore50/System.ServiceModel.Security.xml", - "ref/win8/_._", - "system.servicemodel.security.4.0.0.nupkg.sha512", - "system.servicemodel.security.nuspec" - ] - }, - "System.Text.Encoding/4.0.10": { - "sha512": "fNlSFgy4OuDlJrP9SFFxMlaLazq6ipv15sU5TiEgg9UCVnA/OgoVUfymFp4AOk1jOkW5SVxWbeeIUptcM+m/Vw==", - "type": "package", - "path": "System.Text.Encoding/4.0.10", - "files": [ - "lib/DNXCore50/System.Text.Encoding.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Text.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.Encoding.dll", - "ref/dotnet/System.Text.Encoding.xml", - "ref/dotnet/de/System.Text.Encoding.xml", - "ref/dotnet/es/System.Text.Encoding.xml", - "ref/dotnet/fr/System.Text.Encoding.xml", - "ref/dotnet/it/System.Text.Encoding.xml", - "ref/dotnet/ja/System.Text.Encoding.xml", - "ref/dotnet/ko/System.Text.Encoding.xml", - "ref/dotnet/ru/System.Text.Encoding.xml", - "ref/dotnet/zh-hans/System.Text.Encoding.xml", - "ref/dotnet/zh-hant/System.Text.Encoding.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.dll", - "system.text.encoding.4.0.10.nupkg.sha512", - "system.text.encoding.nuspec" - ] - }, - "System.Text.Encoding/4.3.0": { - "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "type": "package", - "path": "System.Text.Encoding/4.3.0", - "files": [ - "System.Text.Encoding.4.3.0.nupkg.sha512", - "System.Text.Encoding.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.dll", - "ref/netcore50/System.Text.Encoding.xml", - "ref/netcore50/de/System.Text.Encoding.xml", - "ref/netcore50/es/System.Text.Encoding.xml", - "ref/netcore50/fr/System.Text.Encoding.xml", - "ref/netcore50/it/System.Text.Encoding.xml", - "ref/netcore50/ja/System.Text.Encoding.xml", - "ref/netcore50/ko/System.Text.Encoding.xml", - "ref/netcore50/ru/System.Text.Encoding.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.0/System.Text.Encoding.dll", - "ref/netstandard1.0/System.Text.Encoding.xml", - "ref/netstandard1.0/de/System.Text.Encoding.xml", - "ref/netstandard1.0/es/System.Text.Encoding.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.xml", - "ref/netstandard1.0/it/System.Text.Encoding.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.3/System.Text.Encoding.dll", - "ref/netstandard1.3/System.Text.Encoding.xml", - "ref/netstandard1.3/de/System.Text.Encoding.xml", - "ref/netstandard1.3/es/System.Text.Encoding.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.xml", - "ref/netstandard1.3/it/System.Text.Encoding.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.Encoding.CodePages/4.0.0": { - "sha512": "ZHBTr1AXLjY9OuYR7pKx5xfN6QFye1kgd5QAbGrvfCOu7yxRnJs3VUaxERe1fOlnF0mi/xD/Dvb3T3x3HNuPWQ==", - "type": "package", - "path": "System.Text.Encoding.CodePages/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Text.Encoding.CodePages.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.Encoding.CodePages.dll", - "ref/dotnet/System.Text.Encoding.CodePages.xml", - "ref/dotnet/de/System.Text.Encoding.CodePages.xml", - "ref/dotnet/es/System.Text.Encoding.CodePages.xml", - "ref/dotnet/fr/System.Text.Encoding.CodePages.xml", - "ref/dotnet/it/System.Text.Encoding.CodePages.xml", - "ref/dotnet/ja/System.Text.Encoding.CodePages.xml", - "ref/dotnet/ko/System.Text.Encoding.CodePages.xml", - "ref/dotnet/ru/System.Text.Encoding.CodePages.xml", - "ref/dotnet/zh-hans/System.Text.Encoding.CodePages.xml", - "ref/dotnet/zh-hant/System.Text.Encoding.CodePages.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.text.encoding.codepages.4.0.0.nupkg.sha512", - "system.text.encoding.codepages.nuspec" - ] - }, - "System.Text.Encoding.Extensions/4.0.10": { - "sha512": "TZvlwXMxKo3bSRIcsWZLCIzIhLbvlz+mGeKYRZv/zUiSoQzGOwkYeBu6hOw2XPQgKqT0F4Rv8zqKdvmp2fWKYg==", - "type": "package", - "path": "System.Text.Encoding.Extensions/4.0.10", - "files": [ - "lib/DNXCore50/System.Text.Encoding.Extensions.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Text.Encoding.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.Encoding.Extensions.dll", - "ref/dotnet/System.Text.Encoding.Extensions.xml", - "ref/dotnet/de/System.Text.Encoding.Extensions.xml", - "ref/dotnet/es/System.Text.Encoding.Extensions.xml", - "ref/dotnet/fr/System.Text.Encoding.Extensions.xml", - "ref/dotnet/it/System.Text.Encoding.Extensions.xml", - "ref/dotnet/ja/System.Text.Encoding.Extensions.xml", - "ref/dotnet/ko/System.Text.Encoding.Extensions.xml", - "ref/dotnet/ru/System.Text.Encoding.Extensions.xml", - "ref/dotnet/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/dotnet/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.Extensions.dll", - "system.text.encoding.extensions.4.0.10.nupkg.sha512", - "system.text.encoding.extensions.nuspec" - ] - }, - "System.Text.Encoding.Extensions/4.3.0": { - "sha512": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "type": "package", - "path": "System.Text.Encoding.Extensions/4.3.0", - "files": [ - "System.Text.Encoding.Extensions.4.3.0.nupkg.sha512", - "System.Text.Encoding.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.Extensions.dll", - "ref/netcore50/System.Text.Encoding.Extensions.xml", - "ref/netcore50/de/System.Text.Encoding.Extensions.xml", - "ref/netcore50/es/System.Text.Encoding.Extensions.xml", - "ref/netcore50/fr/System.Text.Encoding.Extensions.xml", - "ref/netcore50/it/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ja/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ko/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ru/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.0/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.3/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.RegularExpressions/4.0.10": { - "sha512": "0vDuHXJePpfMCecWBNOabOKCvzfTbFMNcGgklt3l5+RqHV5SzmF7RUVpuet8V0rJX30ROlL66xdehw2Rdsn2DA==", - "type": "package", - "path": "System.Text.RegularExpressions/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Text.RegularExpressions.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Text.RegularExpressions.dll", - "ref/dotnet/System.Text.RegularExpressions.xml", - "ref/dotnet/de/System.Text.RegularExpressions.xml", - "ref/dotnet/es/System.Text.RegularExpressions.xml", - "ref/dotnet/fr/System.Text.RegularExpressions.xml", - "ref/dotnet/it/System.Text.RegularExpressions.xml", - "ref/dotnet/ja/System.Text.RegularExpressions.xml", - "ref/dotnet/ko/System.Text.RegularExpressions.xml", - "ref/dotnet/ru/System.Text.RegularExpressions.xml", - "ref/dotnet/zh-hans/System.Text.RegularExpressions.xml", - "ref/dotnet/zh-hant/System.Text.RegularExpressions.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.text.regularexpressions.4.0.10.nupkg.sha512", - "system.text.regularexpressions.nuspec" - ] - }, - "System.Text.RegularExpressions/4.3.0": { - "sha512": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "type": "package", - "path": "System.Text.RegularExpressions/4.3.0", - "files": [ - "System.Text.RegularExpressions.4.3.0.nupkg.sha512", - "System.Text.RegularExpressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Text.RegularExpressions.dll", - "lib/netcore50/System.Text.RegularExpressions.dll", - "lib/netstandard1.6/System.Text.RegularExpressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.xml", - "ref/netcore50/de/System.Text.RegularExpressions.xml", - "ref/netcore50/es/System.Text.RegularExpressions.xml", - "ref/netcore50/fr/System.Text.RegularExpressions.xml", - "ref/netcore50/it/System.Text.RegularExpressions.xml", - "ref/netcore50/ja/System.Text.RegularExpressions.xml", - "ref/netcore50/ko/System.Text.RegularExpressions.xml", - "ref/netcore50/ru/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hans/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hant/System.Text.RegularExpressions.xml", - "ref/netcoreapp1.1/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/System.Text.RegularExpressions.dll", - "ref/netstandard1.3/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/System.Text.RegularExpressions.dll", - "ref/netstandard1.6/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hant/System.Text.RegularExpressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading/4.0.10": { - "sha512": "0w6pRxIEE7wuiOJeKabkDgeIKmqf4ER1VNrs6qFwHnooEE78yHwi/bKkg5Jo8/pzGLm0xQJw0nEmPXt1QBAIUA==", - "type": "package", - "path": "System.Threading/4.0.10", - "files": [ - "lib/DNXCore50/System.Threading.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Threading.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Threading.dll", - "ref/dotnet/System.Threading.xml", - "ref/dotnet/de/System.Threading.xml", - "ref/dotnet/es/System.Threading.xml", - "ref/dotnet/fr/System.Threading.xml", - "ref/dotnet/it/System.Threading.xml", - "ref/dotnet/ja/System.Threading.xml", - "ref/dotnet/ko/System.Threading.xml", - "ref/dotnet/ru/System.Threading.xml", - "ref/dotnet/zh-hans/System.Threading.xml", - "ref/dotnet/zh-hant/System.Threading.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Threading.dll", - "system.threading.4.0.10.nupkg.sha512", - "system.threading.nuspec" - ] - }, - "System.Threading/4.3.0": { - "sha512": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "type": "package", - "path": "System.Threading/4.3.0", - "files": [ - "System.Threading.4.3.0.nupkg.sha512", - "System.Threading.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.dll", - "lib/netstandard1.3/System.Threading.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.dll", - "ref/netcore50/System.Threading.xml", - "ref/netcore50/de/System.Threading.xml", - "ref/netcore50/es/System.Threading.xml", - "ref/netcore50/fr/System.Threading.xml", - "ref/netcore50/it/System.Threading.xml", - "ref/netcore50/ja/System.Threading.xml", - "ref/netcore50/ko/System.Threading.xml", - "ref/netcore50/ru/System.Threading.xml", - "ref/netcore50/zh-hans/System.Threading.xml", - "ref/netcore50/zh-hant/System.Threading.xml", - "ref/netstandard1.0/System.Threading.dll", - "ref/netstandard1.0/System.Threading.xml", - "ref/netstandard1.0/de/System.Threading.xml", - "ref/netstandard1.0/es/System.Threading.xml", - "ref/netstandard1.0/fr/System.Threading.xml", - "ref/netstandard1.0/it/System.Threading.xml", - "ref/netstandard1.0/ja/System.Threading.xml", - "ref/netstandard1.0/ko/System.Threading.xml", - "ref/netstandard1.0/ru/System.Threading.xml", - "ref/netstandard1.0/zh-hans/System.Threading.xml", - "ref/netstandard1.0/zh-hant/System.Threading.xml", - "ref/netstandard1.3/System.Threading.dll", - "ref/netstandard1.3/System.Threading.xml", - "ref/netstandard1.3/de/System.Threading.xml", - "ref/netstandard1.3/es/System.Threading.xml", - "ref/netstandard1.3/fr/System.Threading.xml", - "ref/netstandard1.3/it/System.Threading.xml", - "ref/netstandard1.3/ja/System.Threading.xml", - "ref/netstandard1.3/ko/System.Threading.xml", - "ref/netstandard1.3/ru/System.Threading.xml", - "ref/netstandard1.3/zh-hans/System.Threading.xml", - "ref/netstandard1.3/zh-hant/System.Threading.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Threading.dll" - ] - }, - "System.Threading.Overlapped/4.0.0": { - "sha512": "X5LuQFhM5FTqaez3eXKJ9CbfSGZ7wj6j4hSVtxct3zmwQXLqG95qoWdvILcgN7xtrDOBIFtpiyDg0vmoI0jE2A==", - "type": "package", - "path": "System.Threading.Overlapped/4.0.0", - "files": [ - "lib/DNXCore50/System.Threading.Overlapped.dll", - "lib/net46/System.Threading.Overlapped.dll", - "lib/netcore50/System.Threading.Overlapped.dll", - "ref/dotnet/System.Threading.Overlapped.dll", - "ref/dotnet/System.Threading.Overlapped.xml", - "ref/dotnet/de/System.Threading.Overlapped.xml", - "ref/dotnet/es/System.Threading.Overlapped.xml", - "ref/dotnet/fr/System.Threading.Overlapped.xml", - "ref/dotnet/it/System.Threading.Overlapped.xml", - "ref/dotnet/ja/System.Threading.Overlapped.xml", - "ref/dotnet/ko/System.Threading.Overlapped.xml", - "ref/dotnet/ru/System.Threading.Overlapped.xml", - "ref/dotnet/zh-hans/System.Threading.Overlapped.xml", - "ref/dotnet/zh-hant/System.Threading.Overlapped.xml", - "ref/net46/System.Threading.Overlapped.dll", - "system.threading.overlapped.4.0.0.nupkg.sha512", - "system.threading.overlapped.nuspec" - ] - }, - "System.Threading.Tasks/4.0.10": { - "sha512": "NOwJGDfk79jR0bnzosbXLVD/PdI8KzBeESoa3CofEM5v9R5EBfcI0Jyf18stx+0IYV9okmDIDxVtxq9TbnR9bQ==", - "type": "package", - "path": "System.Threading.Tasks/4.0.10", - "files": [ - "lib/DNXCore50/System.Threading.Tasks.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Threading.Tasks.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Threading.Tasks.dll", - "ref/dotnet/System.Threading.Tasks.xml", - "ref/dotnet/de/System.Threading.Tasks.xml", - "ref/dotnet/es/System.Threading.Tasks.xml", - "ref/dotnet/fr/System.Threading.Tasks.xml", - "ref/dotnet/it/System.Threading.Tasks.xml", - "ref/dotnet/ja/System.Threading.Tasks.xml", - "ref/dotnet/ko/System.Threading.Tasks.xml", - "ref/dotnet/ru/System.Threading.Tasks.xml", - "ref/dotnet/zh-hans/System.Threading.Tasks.xml", - "ref/dotnet/zh-hant/System.Threading.Tasks.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtimes/win8-aot/lib/netcore50/System.Threading.Tasks.dll", - "system.threading.tasks.4.0.10.nupkg.sha512", - "system.threading.tasks.nuspec" - ] - }, - "System.Threading.Tasks/4.3.0": { - "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "type": "package", - "path": "System.Threading.Tasks/4.3.0", - "files": [ - "System.Threading.Tasks.4.3.0.nupkg.sha512", - "System.Threading.Tasks.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.dll", - "ref/netcore50/System.Threading.Tasks.xml", - "ref/netcore50/de/System.Threading.Tasks.xml", - "ref/netcore50/es/System.Threading.Tasks.xml", - "ref/netcore50/fr/System.Threading.Tasks.xml", - "ref/netcore50/it/System.Threading.Tasks.xml", - "ref/netcore50/ja/System.Threading.Tasks.xml", - "ref/netcore50/ko/System.Threading.Tasks.xml", - "ref/netcore50/ru/System.Threading.Tasks.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.0/System.Threading.Tasks.dll", - "ref/netstandard1.0/System.Threading.Tasks.xml", - "ref/netstandard1.0/de/System.Threading.Tasks.xml", - "ref/netstandard1.0/es/System.Threading.Tasks.xml", - "ref/netstandard1.0/fr/System.Threading.Tasks.xml", - "ref/netstandard1.0/it/System.Threading.Tasks.xml", - "ref/netstandard1.0/ja/System.Threading.Tasks.xml", - "ref/netstandard1.0/ko/System.Threading.Tasks.xml", - "ref/netstandard1.0/ru/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.3/System.Threading.Tasks.dll", - "ref/netstandard1.3/System.Threading.Tasks.xml", - "ref/netstandard1.3/de/System.Threading.Tasks.xml", - "ref/netstandard1.3/es/System.Threading.Tasks.xml", - "ref/netstandard1.3/fr/System.Threading.Tasks.xml", - "ref/netstandard1.3/it/System.Threading.Tasks.xml", - "ref/netstandard1.3/ja/System.Threading.Tasks.xml", - "ref/netstandard1.3/ko/System.Threading.Tasks.xml", - "ref/netstandard1.3/ru/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Tasks.Dataflow/4.5.25": { - "sha512": "Y5/Dj+tYlDxHBwie7bFKp3+1uSG4vqTJRF7Zs7kaUQ3ahYClffCTxvgjrJyPclC+Le55uE7bMLgjZQVOQr3Jfg==", - "type": "package", - "path": "System.Threading.Tasks.Dataflow/4.5.25", - "files": [ - "lib/dotnet/System.Threading.Tasks.Dataflow.XML", - "lib/dotnet/System.Threading.Tasks.Dataflow.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Dataflow.XML", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Dataflow.dll", - "lib/portable-net45+win8+wpa81/System.Threading.Tasks.Dataflow.XML", - "lib/portable-net45+win8+wpa81/System.Threading.Tasks.Dataflow.dll", - "system.threading.tasks.dataflow.4.5.25.nupkg.sha512", - "system.threading.tasks.dataflow.nuspec" - ] - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "sha512": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", - "type": "package", - "path": "System.Threading.Tasks.Extensions/4.3.0", - "files": [ - "System.Threading.Tasks.Extensions.4.3.0.nupkg.sha512", - "System.Threading.Tasks.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml" - ] - }, - "System.Threading.Tasks.Parallel/4.0.0": { - "sha512": "GXDhjPhF3nE4RtDia0W6JR4UMdmhOyt9ibHmsNV6GLRT4HAGqU636Teo4tqvVQOFp2R6b1ffxPXiRaoqtzGxuA==", - "type": "package", - "path": "System.Threading.Tasks.Parallel/4.0.0", - "files": [ - "lib/dotnet/System.Threading.Tasks.Parallel.dll", - "lib/net45/_._", - "lib/netcore50/System.Threading.Tasks.Parallel.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Threading.Tasks.Parallel.dll", - "ref/dotnet/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/de/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/es/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/fr/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/it/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/ja/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/ko/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/ru/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/zh-hans/System.Threading.Tasks.Parallel.xml", - "ref/dotnet/zh-hant/System.Threading.Tasks.Parallel.xml", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.Parallel.dll", - "ref/netcore50/System.Threading.Tasks.Parallel.xml", - "ref/win8/_._", - "ref/wpa81/_._", - "system.threading.tasks.parallel.4.0.0.nupkg.sha512", - "system.threading.tasks.parallel.nuspec" - ] - }, - "System.Threading.Timer/4.0.0": { - "sha512": "BIdJH5/e4FnVl7TkRUiE3pWytp7OYiRUGtwUbyLewS/PhKiLepFetdtlW+FvDYOVn60Q2NMTrhHhJ51q+sVW5g==", - "type": "package", - "path": "System.Threading.Timer/4.0.0", - "files": [ - "lib/DNXCore50/System.Threading.Timer.dll", - "lib/net451/_._", - "lib/netcore50/System.Threading.Timer.dll", - "lib/win81/_._", - "lib/wpa81/_._", - "ref/dotnet/System.Threading.Timer.dll", - "ref/dotnet/System.Threading.Timer.xml", - "ref/dotnet/de/System.Threading.Timer.xml", - "ref/dotnet/es/System.Threading.Timer.xml", - "ref/dotnet/fr/System.Threading.Timer.xml", - "ref/dotnet/it/System.Threading.Timer.xml", - "ref/dotnet/ja/System.Threading.Timer.xml", - "ref/dotnet/ko/System.Threading.Timer.xml", - "ref/dotnet/ru/System.Threading.Timer.xml", - "ref/dotnet/zh-hans/System.Threading.Timer.xml", - "ref/dotnet/zh-hant/System.Threading.Timer.xml", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/win81/_._", - "ref/wpa81/_._", - "runtimes/win8-aot/lib/netcore50/System.Threading.Timer.dll", - "system.threading.timer.4.0.0.nupkg.sha512", - "system.threading.timer.nuspec" - ] - }, - "System.Threading.Timer/4.3.0": { - "sha512": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "type": "package", - "path": "System.Threading.Timer/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net451/_._", - "lib/portable-net451+win81+wpa81/_._", - "lib/win81/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/netcore50/de/System.Threading.Timer.xml", - "ref/netcore50/es/System.Threading.Timer.xml", - "ref/netcore50/fr/System.Threading.Timer.xml", - "ref/netcore50/it/System.Threading.Timer.xml", - "ref/netcore50/ja/System.Threading.Timer.xml", - "ref/netcore50/ko/System.Threading.Timer.xml", - "ref/netcore50/ru/System.Threading.Timer.xml", - "ref/netcore50/zh-hans/System.Threading.Timer.xml", - "ref/netcore50/zh-hant/System.Threading.Timer.xml", - "ref/netstandard1.2/System.Threading.Timer.dll", - "ref/netstandard1.2/System.Threading.Timer.xml", - "ref/netstandard1.2/de/System.Threading.Timer.xml", - "ref/netstandard1.2/es/System.Threading.Timer.xml", - "ref/netstandard1.2/fr/System.Threading.Timer.xml", - "ref/netstandard1.2/it/System.Threading.Timer.xml", - "ref/netstandard1.2/ja/System.Threading.Timer.xml", - "ref/netstandard1.2/ko/System.Threading.Timer.xml", - "ref/netstandard1.2/ru/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hans/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hant/System.Threading.Timer.xml", - "ref/portable-net451+win81+wpa81/_._", - "ref/win81/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.threading.timer.4.3.0.nupkg.sha512", - "system.threading.timer.nuspec" - ] - }, - "System.Xml.ReaderWriter/4.0.10": { - "sha512": "VdmWWMH7otrYV7D+cviUo7XjX0jzDnD/lTGSZTlZqfIQ5PhXk85j+6P0TK9od3PnOd5ZIM+pOk01G/J+3nh9/w==", - "type": "package", - "path": "System.Xml.ReaderWriter/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Xml.ReaderWriter.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.ReaderWriter.dll", - "ref/dotnet/System.Xml.ReaderWriter.xml", - "ref/dotnet/de/System.Xml.ReaderWriter.xml", - "ref/dotnet/es/System.Xml.ReaderWriter.xml", - "ref/dotnet/fr/System.Xml.ReaderWriter.xml", - "ref/dotnet/it/System.Xml.ReaderWriter.xml", - "ref/dotnet/ja/System.Xml.ReaderWriter.xml", - "ref/dotnet/ko/System.Xml.ReaderWriter.xml", - "ref/dotnet/ru/System.Xml.ReaderWriter.xml", - "ref/dotnet/zh-hans/System.Xml.ReaderWriter.xml", - "ref/dotnet/zh-hant/System.Xml.ReaderWriter.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.xml.readerwriter.4.0.10.nupkg.sha512", - "system.xml.readerwriter.nuspec" - ] - }, - "System.Xml.ReaderWriter/4.3.0": { - "sha512": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "type": "package", - "path": "System.Xml.ReaderWriter/4.3.0", - "files": [ - "System.Xml.ReaderWriter.4.3.0.nupkg.sha512", - "System.Xml.ReaderWriter.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Xml.ReaderWriter.dll", - "lib/netcore50/System.Xml.ReaderWriter.dll", - "lib/netstandard1.3/System.Xml.ReaderWriter.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.xml", - "ref/netcore50/de/System.Xml.ReaderWriter.xml", - "ref/netcore50/es/System.Xml.ReaderWriter.xml", - "ref/netcore50/fr/System.Xml.ReaderWriter.xml", - "ref/netcore50/it/System.Xml.ReaderWriter.xml", - "ref/netcore50/ja/System.Xml.ReaderWriter.xml", - "ref/netcore50/ko/System.Xml.ReaderWriter.xml", - "ref/netcore50/ru/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/System.Xml.ReaderWriter.dll", - "ref/netstandard1.0/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/System.Xml.ReaderWriter.dll", - "ref/netstandard1.3/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hant/System.Xml.ReaderWriter.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XDocument/4.0.10": { - "sha512": "+ej0g0INnXDjpS2tDJsLO7/BjyBzC+TeBXLeoGnvRrm4AuBH9PhBjjZ1IuKWOhCkxPkFognUOKhZHS2glIOlng==", - "type": "package", - "path": "System.Xml.XDocument/4.0.10", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Xml.XDocument.dll", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.XDocument.dll", - "ref/dotnet/System.Xml.XDocument.xml", - "ref/dotnet/de/System.Xml.XDocument.xml", - "ref/dotnet/es/System.Xml.XDocument.xml", - "ref/dotnet/fr/System.Xml.XDocument.xml", - "ref/dotnet/it/System.Xml.XDocument.xml", - "ref/dotnet/ja/System.Xml.XDocument.xml", - "ref/dotnet/ko/System.Xml.XDocument.xml", - "ref/dotnet/ru/System.Xml.XDocument.xml", - "ref/dotnet/zh-hans/System.Xml.XDocument.xml", - "ref/dotnet/zh-hant/System.Xml.XDocument.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.xml.xdocument.4.0.10.nupkg.sha512", - "system.xml.xdocument.nuspec" - ] - }, - "System.Xml.XDocument/4.3.0": { - "sha512": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "type": "package", - "path": "System.Xml.XDocument/4.3.0", - "files": [ - "System.Xml.XDocument.4.3.0.nupkg.sha512", - "System.Xml.XDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Xml.XDocument.dll", - "lib/netstandard1.3/System.Xml.XDocument.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Xml.XDocument.dll", - "ref/netcore50/System.Xml.XDocument.xml", - "ref/netcore50/de/System.Xml.XDocument.xml", - "ref/netcore50/es/System.Xml.XDocument.xml", - "ref/netcore50/fr/System.Xml.XDocument.xml", - "ref/netcore50/it/System.Xml.XDocument.xml", - "ref/netcore50/ja/System.Xml.XDocument.xml", - "ref/netcore50/ko/System.Xml.XDocument.xml", - "ref/netcore50/ru/System.Xml.XDocument.xml", - "ref/netcore50/zh-hans/System.Xml.XDocument.xml", - "ref/netcore50/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.0/System.Xml.XDocument.dll", - "ref/netstandard1.0/System.Xml.XDocument.xml", - "ref/netstandard1.0/de/System.Xml.XDocument.xml", - "ref/netstandard1.0/es/System.Xml.XDocument.xml", - "ref/netstandard1.0/fr/System.Xml.XDocument.xml", - "ref/netstandard1.0/it/System.Xml.XDocument.xml", - "ref/netstandard1.0/ja/System.Xml.XDocument.xml", - "ref/netstandard1.0/ko/System.Xml.XDocument.xml", - "ref/netstandard1.0/ru/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.3/System.Xml.XDocument.dll", - "ref/netstandard1.3/System.Xml.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XDocument.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XmlDocument/4.0.0": { - "sha512": "H5qTx2+AXgaKE5wehU1ZYeYPFpp/rfFh69/937NvwCrDqbIkvJRmIFyKKpkoMI6gl9hGfuVizfIudVTMyowCXw==", - "type": "package", - "path": "System.Xml.XmlDocument/4.0.0", - "files": [ - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/dotnet/System.Xml.XmlDocument.dll", - "lib/net46/System.Xml.XmlDocument.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.XmlDocument.dll", - "ref/dotnet/System.Xml.XmlDocument.xml", - "ref/dotnet/de/System.Xml.XmlDocument.xml", - "ref/dotnet/es/System.Xml.XmlDocument.xml", - "ref/dotnet/fr/System.Xml.XmlDocument.xml", - "ref/dotnet/it/System.Xml.XmlDocument.xml", - "ref/dotnet/ja/System.Xml.XmlDocument.xml", - "ref/dotnet/ko/System.Xml.XmlDocument.xml", - "ref/dotnet/ru/System.Xml.XmlDocument.xml", - "ref/dotnet/zh-hans/System.Xml.XmlDocument.xml", - "ref/dotnet/zh-hant/System.Xml.XmlDocument.xml", - "ref/net46/System.Xml.XmlDocument.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "system.xml.xmldocument.4.0.0.nupkg.sha512", - "system.xml.xmldocument.nuspec" - ] - }, - "System.Xml.XmlSerializer/4.0.10": { - "sha512": "OKhE6vruk88z/hl0lmfrMvXteTASgJUagu6PT6S10i9uLbvDR3pTwB6jVgiwa2D2qtTB+eneZbS9jljhPXhTtg==", - "type": "package", - "path": "System.Xml.XmlSerializer/4.0.10", - "files": [ - "lib/DNXCore50/System.Xml.XmlSerializer.dll", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netcore50/System.Xml.XmlSerializer.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet/System.Xml.XmlSerializer.dll", - "ref/dotnet/System.Xml.XmlSerializer.xml", - "ref/dotnet/de/System.Xml.XmlSerializer.xml", - "ref/dotnet/es/System.Xml.XmlSerializer.xml", - "ref/dotnet/fr/System.Xml.XmlSerializer.xml", - "ref/dotnet/it/System.Xml.XmlSerializer.xml", - "ref/dotnet/ja/System.Xml.XmlSerializer.xml", - "ref/dotnet/ko/System.Xml.XmlSerializer.xml", - "ref/dotnet/ru/System.Xml.XmlSerializer.xml", - "ref/dotnet/zh-hans/System.Xml.XmlSerializer.xml", - "ref/dotnet/zh-hant/System.Xml.XmlSerializer.xml", - "ref/net46/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json", - "runtimes/win8-aot/lib/netcore50/System.Xml.XmlSerializer.dll", - "system.xml.xmlserializer.4.0.10.nupkg.sha512", - "system.xml.xmlserializer.nuspec" - ] - } - }, - "projectFileDependencyGroups": { - "": [], - ".NETCoreApp,Version=v1.0": [ - "NETStandard.Library >= 1.6.1" - ], - ".NETFramework,Version=v2.0": [ - "System.Security >= 2.0.0", - "System.Web >= 2.0.0" - ], - ".NETFramework,Version=v4.0": [ - "System.Security >= 4.0.0", - "System.Web >= 4.0.0" - ], - ".NETFramework,Version=v4.6": [ - "System.Security >= 4.0.0", - "System.Web >= 4.0.0" - ], - ".NETStandard,Version=v1.6": [ - "NETStandard.Library >= 1.6.1" - ], - "UAP,Version=v10.0": [ - "Microsoft.NETCore.UniversalWindowsPlatform >= 5.1.0" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/src/OpenCvSharpExtern/CMakeLists.txt b/src/OpenCvSharpExtern/CMakeLists.txt index f5d670970..4371d2f63 100644 --- a/src/OpenCvSharpExtern/CMakeLists.txt +++ b/src/OpenCvSharpExtern/CMakeLists.txt @@ -1,26 +1,50 @@ cmake_minimum_required(VERSION 3.0) include_directories(${OpenCV_INCLUDE_DIR}) -link_directories(${OpenCV_LIBRARY_DIR} ${OpenCV_LIBRARIES}) +IF(!EMSCRIPTEN) + link_directories(${OpenCV_LIBRARY_DIR} ${OpenCV_LIBRARIES}) +ENDIF() +IF(APPLE) + # Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035 + link_directories(/usr/local/lib) +ENDIF() file(GLOB OPENCVSHARP_FILES *.cpp) find_package(OpenCV REQUIRED) -include_directories(${OpenCV_INCLUDE_DIRS}) -#set(LIBS ${LIBS} ${OpenCV_LIBRARIES}) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") - -if(CMAKE_GENERATOR MATCHES "Visual Studio") -set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") +# iconv support isn't automatic on some systems +if(CMAKE_VERSION VERSION_GREATER "3.11") + find_package(Iconv QUIET) + if(Iconv_FOUND) + ocv_target_link_libraries(${the_module} Iconv::Iconv) + else() + ocv_target_compile_definitions(${the_module} PRIVATE "NO_ICONV=1") + endif() endif() -add_library(OpenCvSharpExtern SHARED ${OPENCVSHARP_FILES}) -target_link_libraries(OpenCvSharpExtern ${OpenCV_LIBRARIES}) +if(OpenCV_FOUND) + include_directories(${OpenCV_INCLUDE_DIRS}) + #set(LIBS ${LIBS} ${OpenCV_LIBRARIES}) + + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() + + if(EMSCRIPTEN) + # TODO: replace path + add_library(OpenCvSharpExtern STATIC ${OPENCVSHARP_FILES} ${WASM_LIB}) + else() + add_library(OpenCvSharpExtern SHARED ${OPENCVSHARP_FILES}) + target_link_libraries(OpenCvSharpExtern ${OpenCV_LIBRARIES}) + endif() -install(TARGETS OpenCvSharpExtern + install(TARGETS OpenCvSharpExtern RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib/static -) + ) +endif(OpenCV_FOUND) diff --git a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj index 313dc8541..9644d3992 100644 --- a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj +++ b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj @@ -22,30 +22,32 @@ {8E7279F8-F801-4672-B42F-1ED2C68B16A4} OpenCvSharpExtern Win32Proj - 8.1 + x86-windows-static + x64-windows-static + 10.0 DynamicLibrary MultiByte true - v140 + v143 DynamicLibrary MultiByte - v140 + v143 DynamicLibrary Unicode true - v140 + v143 DynamicLibrary Unicode - v110 + v143 @@ -77,14 +79,14 @@ $(SolutionDir)src\$(Configuration)\$(PlatformName)\ src\$(Platform)\$(Configuration)\ false - $(SolutionDir)\opencv\3.2\include;$(IncludePath) - $(SolutionDir)\opencv\3.2\include;$(IncludePath) - $(SolutionDir)\opencv\3.2\x64\vc14\lib;$(SolutionDir)\opencv\3.2\x64\vc14\staticlib;$(LibraryPath) - $(SolutionDir)\opencv\3.2\x64\vc14\lib;$(SolutionDir)\opencv\3.2\x64\vc14\staticlib;$(LibraryPath) - $(SolutionDir)\opencv\3.2\include;$(IncludePath) - $(SolutionDir)\opencv\3.2\include;$(IncludePath) - $(SolutionDir)\opencv\3.2\x86\vc14\lib;$(SolutionDir)\opencv\3.2\x86\vc14\staticlib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;$(LibraryPath) - $(SolutionDir)\opencv\3.2\x86\vc14\lib;$(SolutionDir)\opencv\3.2\x86\vc14\staticlib;$(LibraryPath) + $(SolutionDir)\opencv_files\opencv_win_x64\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv_win_x64\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv_win_x64\x64\vc16\staticlib;$(LibraryPath) + $(SolutionDir)\opencv_files\opencv_win_x64\x64\vc17\staticlib;$(SolutionDir)\tesseract_files\tesseract_vcpkg\x64-windows-static\lib;$(LibraryPath) + $(SolutionDir)\opencv_files\opencv_win_x86\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv_win_x86\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv_win_x86\x86\vc17\staticlib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;$(SolutionDir)\tesseract_files\tesseract_vcpkg\x86-windows-static\lib;$(LibraryPath) + $(SolutionDir)\opencv_files\opencv_win_x86\x86\vc16\staticlib;$(LibraryPath) @@ -101,7 +103,7 @@ EditAndContinue - opencv_world300d.lib;%(AdditionalDependencies) + ;%(AdditionalDependencies) true Windows MachineX86 @@ -129,7 +131,7 @@ ProgramDatabase - opencv_world310d.lib;%(AdditionalDependencies) + ;%(AdditionalDependencies) true Windows MachineX64 @@ -144,7 +146,7 @@ MaxSpeed true WIN32;NDEBUG;_WINDOWS;_USRDLL;CVAPI_EXPORTS;%(PreprocessorDefinitions) - true + false Sync Default MultiThreaded @@ -159,9 +161,10 @@ true true 4251;4275;4819;%(DisableSpecificWarnings) + true - IlmImf.lib;ippicvmt.lib;libjasper.lib;libjpeg.lib;libpng.lib;libprotobuf.lib;libtiff.lib;libwebp.lib;opencv_aruco320.lib;opencv_bgsegm320.lib;opencv_bioinspired320.lib;opencv_calib3d320.lib;opencv_ccalib320.lib;opencv_core320.lib;opencv_datasets320.lib;opencv_dnn320.lib;opencv_dpm320.lib;opencv_face320.lib;opencv_features2d320.lib;opencv_flann320.lib;opencv_fuzzy320.lib;opencv_highgui320.lib;opencv_imgcodecs320.lib;opencv_imgproc320.lib;opencv_line_descriptor320.lib;opencv_ml320.lib;opencv_objdetect320.lib;opencv_optflow320.lib;opencv_phase_unwrapping320.lib;opencv_photo320.lib;opencv_plot320.lib;opencv_reg320.lib;opencv_rgbd320.lib;opencv_saliency320.lib;opencv_shape320.lib;opencv_stereo320.lib;opencv_stitching320.lib;opencv_structured_light320.lib;opencv_superres320.lib;opencv_surface_matching320.lib;opencv_text320.lib;opencv_tracking320.lib;opencv_video320.lib;opencv_videoio320.lib;opencv_videostab320.lib;opencv_xfeatures2d320.lib;opencv_ximgproc320.lib;opencv_xobjdetect320.lib;opencv_xphoto320.lib;zlib.lib;vfw32.lib;%(AdditionalDependencies) + IlmImf.lib;ippicvmt.lib;ippiw.lib;ittnotify.lib;libjpeg-turbo.lib;libopenjp2.lib;libpng.lib;libprotobuf.lib;libtiff.lib;libwebp.lib;opencv_aruco4110.lib;opencv_bgsegm4110.lib;opencv_bioinspired4110.lib;opencv_calib3d4110.lib;opencv_ccalib4110.lib;opencv_core4110.lib;opencv_dnn4110.lib;opencv_dnn_objdetect4110.lib;opencv_dnn_superres4110.lib;opencv_dpm4110.lib;opencv_face4110.lib;opencv_features2d4110.lib;opencv_flann4110.lib;opencv_fuzzy4110.lib;opencv_hfs4110.lib;opencv_highgui4110.lib;opencv_imgcodecs4110.lib;opencv_imgproc4110.lib;opencv_img_hash4110.lib;opencv_intensity_transform4110.lib;opencv_line_descriptor4110.lib;opencv_mcc4110.lib;opencv_ml4110.lib;opencv_objdetect4110.lib;opencv_optflow4110.lib;opencv_phase_unwrapping4110.lib;opencv_photo4110.lib;opencv_plot4110.lib;opencv_quality4110.lib;opencv_rapid4110.lib;opencv_reg4110.lib;opencv_rgbd4110.lib;opencv_saliency4110.lib;opencv_shape4110.lib;opencv_stereo4110.lib;opencv_stitching4110.lib;opencv_structured_light4110.lib;opencv_superres4110.lib;opencv_surface_matching4110.lib;opencv_text4110.lib;opencv_tracking4110.lib;opencv_video4110.lib;opencv_videoio4110.lib;opencv_videostab4110.lib;opencv_wechat_qrcode4110.lib;opencv_xfeatures2d4110.lib;opencv_ximgproc4110.lib;opencv_xobjdetect4110.lib;opencv_xphoto4110.lib;zlib.lib;ws2_32.lib;tesseract53.lib;leptonica-1.83.1.lib;archive.lib;bz2.lib;charset.lib;gif.lib;iconv.lib;libcrypto.lib;libcurl.lib;libpng16.lib;libsharpyuv.lib;libssl.lib;libxml2.lib;lz4.lib;lzma.lib;tiff.lib;zstd.lib;crypt32.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) true NotSet @@ -174,8 +177,11 @@ /IGNORE:4099 %(AdditionalOptions) - copy "$(LocalDebuggerCommand)" "$(SolutionDir)src\OpenCvSharp.Sandbox\dll\x86\$(TargetFileName)" -copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x86\$(TargetFileName)" + copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x86\$(TargetFileName)" +copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\$(TargetFileName)" +copy "$(SolutionDir)opencv_files\opencv_win_x86\x86\vc17\bin\opencv_videoio_ffmpeg4110.dll" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x86\opencv_videoio_ffmpeg4110.dll" +copy "$(SolutionDir)opencv_files\opencv_win_x86\x86\vc17\bin\opencv_videoio_ffmpeg4110.dll" "$(SolutionDir)test\OpenCvSharp.Tests\opencv_videoio_ffmpeg4110.dll" + @@ -186,7 +192,7 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x86\$(T MaxSpeed true WIN32;NDEBUG;_WINDOWS;_USRDLL;CVAPI_EXPORTS;%(PreprocessorDefinitions) - true + false Sync Default MultiThreaded @@ -198,9 +204,10 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x86\$(T false true 4251;4275;4819;%(DisableSpecificWarnings) + true - IlmImf.lib;ippicvmt.lib;libjasper.lib;libjpeg.lib;libpng.lib;libprotobuf.lib;libtiff.lib;libwebp.lib;opencv_aruco320.lib;opencv_bgsegm320.lib;opencv_bioinspired320.lib;opencv_calib3d320.lib;opencv_ccalib320.lib;opencv_core320.lib;opencv_datasets320.lib;opencv_dnn320.lib;opencv_dpm320.lib;opencv_face320.lib;opencv_features2d320.lib;opencv_flann320.lib;opencv_fuzzy320.lib;opencv_highgui320.lib;opencv_imgcodecs320.lib;opencv_imgproc320.lib;opencv_line_descriptor320.lib;opencv_ml320.lib;opencv_objdetect320.lib;opencv_optflow320.lib;opencv_phase_unwrapping320.lib;opencv_photo320.lib;opencv_plot320.lib;opencv_reg320.lib;opencv_rgbd320.lib;opencv_saliency320.lib;opencv_shape320.lib;opencv_stereo320.lib;opencv_stitching320.lib;opencv_structured_light320.lib;opencv_superres320.lib;opencv_surface_matching320.lib;opencv_text320.lib;opencv_tracking320.lib;opencv_video320.lib;opencv_videoio320.lib;opencv_videostab320.lib;opencv_xfeatures2d320.lib;opencv_ximgproc320.lib;opencv_xobjdetect320.lib;opencv_xphoto320.lib;zlib.lib;vfw32.lib;%(AdditionalDependencies) + IlmImf.lib;ippicvmt.lib;ippiw.lib;ittnotify.lib;libopenjp2.lib;libjpeg-turbo.lib;libpng.lib;libprotobuf.lib;libtiff.lib;libwebp.lib;opencv_aruco4110.lib;opencv_bgsegm4110.lib;opencv_bioinspired4110.lib;opencv_calib3d4110.lib;opencv_ccalib4110.lib;opencv_core4110.lib;opencv_dnn4110.lib;opencv_dnn_objdetect4110.lib;opencv_dnn_superres4110.lib;opencv_dpm4110.lib;opencv_face4110.lib;opencv_features2d4110.lib;opencv_flann4110.lib;opencv_fuzzy4110.lib;opencv_hfs4110.lib;opencv_highgui4110.lib;opencv_imgcodecs4110.lib;opencv_imgproc4110.lib;opencv_img_hash4110.lib;opencv_intensity_transform4110.lib;opencv_line_descriptor4110.lib;opencv_mcc4110.lib;opencv_ml4110.lib;opencv_objdetect4110.lib;opencv_optflow4110.lib;opencv_phase_unwrapping4110.lib;opencv_photo4110.lib;opencv_plot4110.lib;opencv_quality4110.lib;opencv_rapid4110.lib;opencv_reg4110.lib;opencv_rgbd4110.lib;opencv_saliency4110.lib;opencv_shape4110.lib;opencv_stereo4110.lib;opencv_stitching4110.lib;opencv_structured_light4110.lib;opencv_superres4110.lib;opencv_surface_matching4110.lib;opencv_text4110.lib;opencv_tracking4110.lib;opencv_video4110.lib;opencv_videoio4110.lib;opencv_videostab4110.lib;opencv_wechat_qrcode4110.lib;opencv_xfeatures2d4110.lib;opencv_ximgproc4110.lib;opencv_xobjdetect4110.lib;opencv_xphoto4110.lib;zlib.lib;ws2_32.lib;tesseract53.lib;leptonica-1.83.1.lib;archive.lib;bz2.lib;charset.lib;gif.lib;iconv.lib;libcrypto.lib;libcurl.lib;libpng16.lib;libsharpyuv.lib;libssl.lib;libxml2.lib;lz4.lib;lzma.lib;tiff.lib;zstd.lib;crypt32.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) true NotSet @@ -213,8 +220,10 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x86\$(T /IGNORE:4099 %(AdditionalOptions) - copy "$(LocalDebuggerCommand)" "$(SolutionDir)src\OpenCvSharp.Sandbox\dll\x64\$(TargetFileName)" -copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\$(TargetFileName)" + copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\$(TargetFileName)" +copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\$(TargetFileName)" +copy "$(SolutionDir)opencv_files\opencv_win_x64\x64\vc17\bin\opencv_videoio_ffmpeg4110_64.dll" "$(SolutionDir)test\OpenCvSharp.Tests\opencv_videoio_ffmpeg4110_64.dll" +copy "$(SolutionDir)opencv_files\opencv_win_x64\x64\vc17\bin\opencv_videoio_ffmpeg4110_64.dll" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\opencv_videoio_ffmpeg4110_64.dll" @@ -223,70 +232,75 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\$(T + + + + + + + + + + - + - + + - - - + + + + + - - - - - - - - - - - - + - + + + + @@ -296,6 +310,7 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\$(T + @@ -307,7 +322,16 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\$(T + + + + + + + + + @@ -319,13 +343,18 @@ copy "$(LocalDebuggerCommand)" "$(SolutionDir)test\OpenCvSharp.Tests\dll\x64\$(T + - + + - + + + + + - - + \ No newline at end of file diff --git a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters index 84ed612c8..b9c96c843 100644 --- a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters +++ b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters @@ -1,99 +1,138 @@  - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files Source Files - + + Source Files + + + Source Files + + Source Files Source Files - + Source Files - + Source Files - + Source Files - + Source Files Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + Source Files Source Files + + Source Files + + + Source Files + + + Header Files + + + Header Files + Header Files\core Header Files\core + + Header Files\core + Header Files\core Header Files\core - + Header Files\core - + Header Files\core - + Header Files\core - + Header Files\core @@ -105,273 +144,304 @@ Header Files\core - - Header Files\ml + + Header Files\core - + Header Files - + Header Files - + Header Files - + Header Files - - Header Files\features2d - - - Header Files\features2d - - - Header Files\features2d - - - Header Files\objdetect - - - Header Files\objdetect - - - Header Files\imgproc - - - Header Files\imgproc - - - Header Files\ml + + Header Files - + Header Files - + Header Files - - Header Files\video + + Header Files - - Header Files\video + + Header Files - - Header Files\stitching + + Header Files - - Header Files\stitching + + Header Files - - Header Files\imgproc + + Header Files - - Header Files\video + + Header Files - - Header Files\calib3d + + Header Files\ml Header Files\ml - - Header Files - - - Header Files\cuda - - - Header Files\cuda - - - Header Files\optflow - - - Header Files\optflow + + Header Files\ml - - Header Files\calib3d + + Header Files\ml - - Header Files + + Header Files\ml - + Header Files\ml - + Header Files\ml - + Header Files\ml Header Files\ml - + Header Files\ml - + Header Files\ml - - Header Files\features2d + + Header Files\imgproc - - Header Files\features2d + + Header Files\imgproc - - Header Files\features2d + + Header Files\imgproc - - Header Files\features2d + + Header Files\imgproc - - Header Files\features2d + + Header Files\imgproc - - Header Files\features2d + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc - + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + Header Files\features2d - + Header Files\features2d - + Header Files\features2d - + Header Files\features2d - - Header Files + + Header Files\calib3d - - Header Files + + Header Files\calib3d - - Header Files\shape + + Header Files\calib3d - - Header Files\photo + + Header Files\objdetect - - Header Files\photo + + Header Files\objdetect - - Header Files\imgproc + + Header Files\objdetect - - Header Files\imgproc + + Header Files\dnn - - Header Files\imgproc + + Header Files\dnn - - Header Files\features2d + + Header Files\dnn + + + Header Files\cuda + + + Header Files\cuda Header Files\face - + Header Files\face - - Header Files\face + + Header Files\flann - - Header Files\calib3d + + Header Files\flann - - Header Files\calib3d + + Header Files\std_vector - - Header Files\face + + Header Files\std_vector - - Header Files\aruco + + Header Files\std_vector - - Header Files\ximgproc + + Header Files\stitching - - Header Files\ximgproc + + Header Files\stitching - - Header Files\ximgproc + + Header Files\photo - - Header Files\ximgproc + + Header Files\photo - - Header Files\ml + + Header Files\photo - - Header Files\ml + + Header Files\optflow - - Header Files\flann + + Header Files\optflow - - Header Files\flann + + Header Files\video + + + Header Files\video + + + Header Files\video + + + Header Files\tracking + + + Header Files\tracking + + + Header Files\text + + + Header Files\text + + + Header Files\shape + + + Header Files\ximgproc + + + Header Files\imgproc + + + Header Files + + + Header Files\imgproc - {b0a234b5-5c12-4b8e-a0e8-0492fd41e722} - *.cpp;*.c + {7cf64a97-436b-4e7c-b5df-8f2cda783780} - {2b66c248-878e-4591-8091-e5c812526273} - *.h;*.hpp + {a4e507f2-fd1a-4ba4-bdc7-4b686631a280} - {7d21ebfe-bc23-421e-ad79-f96eaffb3777} + {24e1d695-b7e6-434c-9f2e-83a1cb409209} - {17c51294-b680-4aa4-a74c-a51a817dd35a} + {4233ccf9-e77f-40b4-8d0b-e4ac49e67711} + + + {b9a7effa-cedf-47ed-8151-7f1ebf87d5fd} + + + {78555271-f303-485c-853f-42a14182efa8} - {d63db3ce-bfb9-4ab8-95c2-22bfe7020148} + {ecb04cb1-5fe2-49c1-82fe-612b709c0ec3} - - {cd61c3fc-60ce-4cd6-8d3b-e87d9e0e6ffe} + + {304e0a93-fb5b-4559-ae8c-cd15c9e86285} - - {f8b57698-6e4b-424d-870c-29526931576a} + + {ecc26737-c8cf-42cb-9530-609703b6c670} - - {cc445911-b121-4dc0-b44e-fb11ed931e40} + + {e9dfd607-4844-4086-a86b-06882ac2815c} - - {d2ac930b-731a-4af9-ad0d-bfe1272b646d} + + {071d16dc-3c5e-43da-a662-ff9092f10f32} - - {620702b8-6e54-451a-a8af-52270265167a} + + {f9141818-d182-4ada-96a3-17ef091dec53} - - {b7573dcb-d145-4466-99d1-64124c7c5211} + + {7a43ead9-0cbb-40b6-9333-ea6253d8be0e} - - {381d4d4f-0c83-4c35-a777-fb3214db09f9} + + {645e3789-6fa8-4888-9b72-f2d9306dd6de} - - {eed306c8-8a82-4f4f-b9d5-447f88befafa} + + {4c55114e-d9de-43a9-8847-2952c064818c} - {a91945a2-e61d-4a10-82c3-14772eaa2d21} + {ba968e69-29f9-400e-8f37-013af8fceeec} - - {55d56498-7105-4f1b-a081-518faedcc993} + + {bf3bad2d-eb30-4f36-a69f-5cdc124aa073} - - {d8e2cd6a-75d9-4cb0-84e0-b9b4b4102e07} + + {a2d7d79a-869a-4962-9b8e-5cdf8c916eda} - - {90a79351-d5d5-4aa3-9ff3-2df1751b11d6} + + {2f810550-8fb2-48fd-913e-c9e6fa285c46} - - {fe6ddcd7-d2d0-4c73-99f6-d37802a99d2c} + + {17d07de9-d86e-4fe9-962e-b22fe7da979e} + + + {b36ab73f-c7bb-491b-aedb-dc16a293c0b9} \ No newline at end of file diff --git a/src/OpenCvSharpExtern/aruco.h b/src/OpenCvSharpExtern/aruco.h index 2f5cb12e5..2660116cb 100644 --- a/src/OpenCvSharpExtern/aruco.h +++ b/src/OpenCvSharpExtern/aruco.h @@ -1,27 +1,303 @@ -#ifndef _CPP_ARUCO_H_ -#define _CPP_ARUCO_H_ +#pragma once #include "include_opencv.h" -CVAPI(aruco_DetectorParameters) aruco_DetectorParameters_create() +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +extern "C" +{ + struct aruco_DetectorParameters + { + int adaptiveThreshWinSizeMin; + int adaptiveThreshWinSizeMax; + int adaptiveThreshWinSizeStep; + double adaptiveThreshConstant; + double minMarkerPerimeterRate; + double maxMarkerPerimeterRate; + double polygonalApproxAccuracyRate; + double minCornerDistanceRate; + int minDistanceToBorder; + double minMarkerDistanceRate; + int cornerRefinementMethod; + int cornerRefinementWinSize; + int cornerRefinementMaxIterations; + double cornerRefinementMinAccuracy; + int markerBorderBits; + int perspectiveRemovePixelPerCell; + double perspectiveRemoveIgnoredMarginPerCell; + double maxErroneousBitsInBorderRate; + double minOtsuStdDev; + double errorCorrectionRate; + float aprilTagQuadDecimate; + float aprilTagQuadSigma; + int aprilTagMinClusterPixels; + int aprilTagMaxNmaxima; + float aprilTagCriticalRad; + float aprilTagMaxLineFitMse; + int aprilTagMinWhiteBlackDiff; + int aprilTagDeglitch; + bool detectInvertedMarker; + bool useAruco3Detection; + int minSideLengthCanonicalImg; + float minMarkerLengthRatioOriginalImg; + }; +} + +static cv::aruco::DetectorParameters cpp(const aruco_DetectorParameters& p) +{ + cv::aruco::DetectorParameters pp; + pp.adaptiveThreshWinSizeMin = p.adaptiveThreshWinSizeMin; + pp.adaptiveThreshWinSizeMax = p.adaptiveThreshWinSizeMax; + pp.adaptiveThreshWinSizeStep = p.adaptiveThreshWinSizeStep; + pp.adaptiveThreshConstant = p.adaptiveThreshConstant; + pp.minMarkerPerimeterRate = p.minMarkerPerimeterRate; + pp.maxMarkerPerimeterRate = p.maxMarkerPerimeterRate; + pp.polygonalApproxAccuracyRate = p.polygonalApproxAccuracyRate; + pp.minCornerDistanceRate = p.minCornerDistanceRate; + pp.minDistanceToBorder = p.minDistanceToBorder; + pp.minMarkerDistanceRate = p.minMarkerDistanceRate; + pp.cornerRefinementMethod = static_cast(p.cornerRefinementMethod); + pp.cornerRefinementWinSize = p.cornerRefinementWinSize; + pp.cornerRefinementMaxIterations = p.cornerRefinementMaxIterations; + pp.cornerRefinementMinAccuracy = p.cornerRefinementMinAccuracy; + pp.markerBorderBits = p.markerBorderBits; + pp.perspectiveRemovePixelPerCell = p.perspectiveRemovePixelPerCell; + pp.perspectiveRemoveIgnoredMarginPerCell = p.perspectiveRemoveIgnoredMarginPerCell; + pp.maxErroneousBitsInBorderRate = p.maxErroneousBitsInBorderRate; + pp.minOtsuStdDev = p.minOtsuStdDev; + pp.errorCorrectionRate = p.errorCorrectionRate; + pp.aprilTagQuadDecimate = p.aprilTagQuadDecimate; + pp.aprilTagQuadSigma = p.aprilTagQuadSigma; + pp.aprilTagMinClusterPixels = p.aprilTagMinClusterPixels; + pp.aprilTagMaxNmaxima = p.aprilTagMaxNmaxima; + pp.aprilTagCriticalRad = p.aprilTagCriticalRad; + pp.aprilTagMaxLineFitMse = p.aprilTagMaxLineFitMse; + pp.aprilTagDeglitch = p.aprilTagDeglitch; + pp.aprilTagMinWhiteBlackDiff = p.aprilTagMinWhiteBlackDiff; + pp.detectInvertedMarker = p.detectInvertedMarker; + pp.useAruco3Detection = p.useAruco3Detection; + pp.minSideLengthCanonicalImg = p.minSideLengthCanonicalImg; + pp.minMarkerLengthRatioOriginalImg = p.minMarkerLengthRatioOriginalImg; + return pp; +} + +CVAPI(ExceptionStatus) aruco_drawDetectedMarkers( + cv::_InputOutputArray* image, + cv::Point2f** corners, + int cornerSize1, + int* cornerSize2, + int* idx, int idxCount, + MyCvScalar borderColor) +{ + BEGIN_WRAP + std::vector< std::vector > cornerVec(cornerSize1); + std::vector idxVec; + + for (int i = 0; i < cornerSize1; i++) + cornerVec[i] = std::vector(corners[i], corners[i] + cornerSize2[i]); + if (idx != nullptr) + idxVec = std::vector(idx, idx + idxCount); + + cv::aruco::drawDetectedMarkers(*image, cornerVec, idxVec, cpp(borderColor)); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_detectMarkers( + cv::_InputArray* image, + cv::aruco::Dictionary* dictionary, + std::vector< std::vector >* corners, + std::vector* ids, + aruco_DetectorParameters* parameters, + std::vector< std::vector >* rejectedImgPoints) +{ + BEGIN_WRAP + const auto p = cpp(*parameters); + const auto pp = cv::makePtr(p); + const auto d = cv::makePtr(*dictionary); + cv::aruco::detectMarkers(*image, d, *corners, *ids, pp, *rejectedImgPoints); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_estimatePoseSingleMarkers( + cv::Point2f** corners, int cornersLength1, + int* cornersLengths2, float markerLength, + cv::_InputArray* cameraMatrix, + cv::_InputArray* distCoeffs, + cv::_OutputArray* rvecs, + cv::_OutputArray* tvecs, + cv::_OutputArray* objPoints) { - cv::Ptr p = cv::aruco::DetectorParameters::create(); - return c(*p); + BEGIN_WRAP + std::vector > cornersVec(cornersLength1); + for (int i = 0; i < cornersLength1; i++) + cornersVec[i] = std::vector(corners[i], corners[i] + cornersLengths2[i]); + + cv::aruco::estimatePoseSingleMarkers(cornersVec, markerLength, *cameraMatrix, *distCoeffs, *rvecs, *tvecs, entity(objPoints)); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_getPredefinedDictionary(int name, cv::aruco::Dictionary** returnValue) +{ + BEGIN_WRAP + const auto dictionary = cv::aruco::getPredefinedDictionary(name); + *returnValue = new cv::aruco::Dictionary(dictionary); + END_WRAP } -CVAPI(void) aruco_detectMarkers(cv::_InputArray *image, cv::aruco::Dictionary *dictionary, cv::_OutputArray *corners, - cv::_OutputArray *ids, aruco_DetectorParameters *parameters, - cv::_OutputArray *rejectedImgPoints) +CVAPI(ExceptionStatus) aruco_readDictionary(const char* dictionaryFile, cv::aruco::Dictionary** returnValue) { - cv::aruco::DetectorParameters parametersCpp = cpp(*parameters); - cv::aruco::detectMarkers(*image, dictionary, *corners, *ids, ¶metersCpp, *rejectedImgPoints); + BEGIN_WRAP + + auto readMode = cv::FileStorage::READ | cv::FileStorage::FORMAT_YAML; + cv::FileStorage storeage(dictionaryFile, readMode); + cv::FileNode rootNode = storeage.root(); + + cv::aruco::Dictionary dictionary; + auto result = dictionary.readDictionary(rootNode); + + storeage.release(); + + *returnValue = new cv::aruco::Dictionary(dictionary); + + END_WRAP } -CVAPI(void) aruco_estimatePoseSingleMarkers(cv::_InputArray *corners, float markerLength, - cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, - cv::_OutputArray *rvecs, cv::_OutputArray *tvecs) +CVAPI(ExceptionStatus) aruco_Dictionary_delete(cv::aruco::Dictionary* ptr) { - cv::aruco::estimatePoseSingleMarkers(*corners, markerLength, *cameraMatrix, *distCoeffs, *rvecs, *tvecs); + BEGIN_WRAP + delete ptr; + END_WRAP } -#endif \ No newline at end of file +CVAPI(ExceptionStatus) aruco_Dictionary_setMarkerSize(cv::aruco::Dictionary* obj, int value) +{ + BEGIN_WRAP + obj->markerSize = value; + END_WRAP +} +CVAPI(ExceptionStatus) aruco_Dictionary_setMaxCorrectionBits(cv::aruco::Dictionary* obj, int value) +{ + BEGIN_WRAP + obj->maxCorrectionBits = value; + END_WRAP +} +CVAPI(ExceptionStatus) aruco_Dictionary_getBytesList(cv::aruco::Dictionary* obj, cv::Mat** returnValue) +{ + BEGIN_WRAP + * returnValue = new cv::Mat(obj->bytesList); + END_WRAP +} +CVAPI(ExceptionStatus) aruco_Dictionary_getMarkerSize(cv::aruco::Dictionary* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->markerSize; + END_WRAP +} +CVAPI(ExceptionStatus) aruco_Dictionary_getMaxCorrectionBits(cv::aruco::Dictionary* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->maxCorrectionBits; + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_Dictionary_identify( + cv::aruco::Dictionary* obj, + cv::Mat *onlyBits, + int *idx, + int *rotation, + double maxCorrectionRate, + int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->identify(*onlyBits, *idx, *rotation, maxCorrectionRate) != 0; + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_Dictionary_getDistanceToId( + cv::aruco::Dictionary* obj, + cv::_InputArray *bits, + int id, + int allRotations, + int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getDistanceToId(*bits, id, allRotations != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_Dictionary_generateImageMarker( + cv::aruco::Dictionary* obj, + int id, + int sidePixels, + cv::_OutputArray *img, + int borderBits) +{ + BEGIN_WRAP + obj->generateImageMarker(id, sidePixels, *img, borderBits); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_Dictionary_getByteListFromBits( + cv::Mat *bits, + cv::Mat* returnValue) +{ + BEGIN_WRAP + const auto result = cv::aruco::Dictionary::getByteListFromBits(*bits); + result.copyTo(*returnValue); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_Dictionary_getBitsFromByteList( + cv::Mat *byteList, + int markerSize, + cv::Mat* returnValue) +{ + BEGIN_WRAP + const auto result = cv::aruco::Dictionary::getBitsFromByteList(*byteList, markerSize); + result.copyTo(*returnValue); + END_WRAP +} + + +CVAPI(ExceptionStatus) aruco_detectCharucoDiamond( + cv::_InputArray* image, + cv::Point2f** markerCorners, + int markerCornersSize1, + int* markerCornersSize2, + std::vector* markerIds, + float squareMarkerLengthRate, + std::vector< std::vector >* diamondCorners, + std::vector* diamondIds, + cv::_InputArray* cameraMatrix, cv::_InputArray* distCoeffs) +{ + BEGIN_WRAP + std::vector< std::vector > markerCornerVec(markerCornersSize1); + for (int i = 0; i < markerCornersSize1; i++) + markerCornerVec[i] = std::vector(markerCorners[i], markerCorners[i] + markerCornersSize2[i]); + + cv::aruco::detectCharucoDiamond(*image, markerCornerVec, *markerIds, squareMarkerLengthRate, + *diamondCorners, *diamondIds, entity(cameraMatrix), entity(distCoeffs)); + END_WRAP +} + +CVAPI(ExceptionStatus) aruco_drawDetectedDiamonds( + cv::_InputOutputArray* image, + cv::Point2f** corners, + int cornerSize1, + int* cornerSize2, + std::vector* ids, + MyCvScalar borderColor) +{ + BEGIN_WRAP + std::vector< std::vector > cornerVec(cornerSize1); + + for (int i = 0; i < cornerSize1; i++) + cornerVec[i] = std::vector(corners[i], corners[i] + cornerSize2[i]); + + const cv::_InputArray idArray = (ids != nullptr) ? *ids : static_cast(cv::noArray()); + + cv::aruco::drawDetectedDiamonds(*image, cornerVec, idArray, cpp(borderColor)); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/bgsegm.h b/src/OpenCvSharpExtern/bgsegm.h index 785998a4f..cc2efb7f3 100644 --- a/src/OpenCvSharpExtern/bgsegm.h +++ b/src/OpenCvSharpExtern/bgsegm.h @@ -1,176 +1,243 @@ -#ifndef _CPP_BGSEGM_H_ -#define _CPP_BGSEGM_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::bgsegm; +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +#include "include_opencv.h" #pragma region BackgroundSubtractorMOG -CVAPI(cv::Ptr*) bgsegm_createBackgroundSubtractorMOG( - int history, int nmixtures, double backgroundRatio, double noiseSigma) +CVAPI(ExceptionStatus) bgsegm_createBackgroundSubtractorMOG( + int history, int nmixtures, double backgroundRatio, double noiseSigma, cv::Ptr **returnValue) { - cv::Ptr ptr = createBackgroundSubtractorMOG(history, nmixtures, backgroundRatio, noiseSigma); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::bgsegm::createBackgroundSubtractorMOG(history, nmixtures, backgroundRatio, noiseSigma); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) bgsegm_Ptr_BackgroundSubtractorMOG_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) bgsegm_Ptr_BackgroundSubtractorMOG_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(BackgroundSubtractorMOG*) bgsegm_Ptr_BackgroundSubtractorMOG_get( - cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_Ptr_BackgroundSubtractorMOG_get( + cv::Ptr *ptr, cv::bgsegm::BackgroundSubtractorMOG **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorMOG_getHistory(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_getHistory(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getHistory(); + BEGIN_WRAP + *returnValue = (*ptr)->getHistory(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorMOG_setHistory(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_setHistory(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setHistory(value); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorMOG_getNMixtures(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_getNMixtures(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getNMixtures(); + BEGIN_WRAP + *returnValue = (*ptr)->getNMixtures(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorMOG_setNMixtures(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_setNMixtures(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setNMixtures(value); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorMOG_getBackgroundRatio(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_getBackgroundRatio(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getBackgroundRatio(); + BEGIN_WRAP + *returnValue = (*ptr)->getBackgroundRatio(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorMOG_setBackgroundRatio(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_setBackgroundRatio(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setBackgroundRatio(value); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorMOG_getNoiseSigma(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_getNoiseSigma(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getNoiseSigma(); + BEGIN_WRAP + *returnValue = (*ptr)->getNoiseSigma(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorMOG_setNoiseSigma(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorMOG_setNoiseSigma(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setNoiseSigma(value); + END_WRAP } #pragma endregion #pragma region BackgroundSubtractorGMG -CVAPI(cv::Ptr*) bgsegm_createBackgroundSubtractorGMG( - int initializationFrames, double decisionThreshold) +CVAPI(ExceptionStatus) bgsegm_createBackgroundSubtractorGMG( + int initializationFrames, double decisionThreshold, cv::Ptr **returnValue) { - cv::Ptr ptr = createBackgroundSubtractorGMG(initializationFrames, decisionThreshold); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::bgsegm::createBackgroundSubtractorGMG(initializationFrames, decisionThreshold); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) bgsegm_Ptr_BackgroundSubtractorGMG_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) bgsegm_Ptr_BackgroundSubtractorGMG_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(BackgroundSubtractorGMG*) bgsegm_Ptr_BackgroundSubtractorGMG_get( - cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_Ptr_BackgroundSubtractorGMG_get( + cv::Ptr *ptr, cv::bgsegm::BackgroundSubtractorGMG **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorGMG_getMaxFeatures(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getMaxFeatures(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getMaxFeatures(); + BEGIN_WRAP + *returnValue = (*ptr)->getMaxFeatures(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setMaxFeatures(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setMaxFeatures(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setMaxFeatures(value); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorGMG_getDefaultLearningRate(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getDefaultLearningRate(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getDefaultLearningRate(); + BEGIN_WRAP + *returnValue = (*ptr)->getDefaultLearningRate(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setDefaultLearningRate(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setDefaultLearningRate(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setDefaultLearningRate(value); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorGMG_getNumFrames(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getNumFrames(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getNumFrames(); + BEGIN_WRAP + *returnValue = (*ptr)->getNumFrames(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setNumFrames(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setNumFrames(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setNumFrames(value); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorGMG_getQuantizationLevels(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getQuantizationLevels(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getQuantizationLevels(); + BEGIN_WRAP + *returnValue = (*ptr)->getQuantizationLevels(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setQuantizationLevels(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setQuantizationLevels(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setQuantizationLevels(value); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorGMG_getBackgroundPrior(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getBackgroundPrior(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getBackgroundPrior(); + BEGIN_WRAP + *returnValue = (*ptr)->getBackgroundPrior(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setBackgroundPrior(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setBackgroundPrior(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setBackgroundPrior(value); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorGMG_getSmoothingRadius(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getSmoothingRadius(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getSmoothingRadius(); + BEGIN_WRAP + *returnValue = (*ptr)->getSmoothingRadius(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setSmoothingRadius(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setSmoothingRadius(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setSmoothingRadius(value); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorGMG_getDecisionThreshold(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getDecisionThreshold(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getDecisionThreshold(); + BEGIN_WRAP + *returnValue = (*ptr)->getDecisionThreshold(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setDecisionThreshold(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setDecisionThreshold(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setDecisionThreshold(value); + END_WRAP } -CVAPI(int) bgsegm_BackgroundSubtractorGMG_getUpdateBackgroundModel(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getUpdateBackgroundModel(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getUpdateBackgroundModel() ? 1 : 0; + BEGIN_WRAP + *returnValue = (*ptr)->getUpdateBackgroundModel() ? 1 : 0; + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setUpdateBackgroundModel(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setUpdateBackgroundModel(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setUpdateBackgroundModel(value != 0); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorGMG_getMinVal(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getMinVal(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getMinVal(); + BEGIN_WRAP + *returnValue = (*ptr)->getMinVal(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setMinVal(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setMinVal(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setMinVal(value); + END_WRAP } -CVAPI(double) bgsegm_BackgroundSubtractorGMG_getMaxVal(cv::Ptr *ptr) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_getMaxVal(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getMaxVal(); + BEGIN_WRAP + *returnValue = (*ptr)->getMaxVal(); + END_WRAP } -CVAPI(void) bgsegm_BackgroundSubtractorGMG_setMaxVal(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) bgsegm_BackgroundSubtractorGMG_setMaxVal(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setMaxVal(value); + END_WRAP } #pragma endregion - -#endif diff --git a/src/OpenCvSharpExtern/calib3d.cpp b/src/OpenCvSharpExtern/calib3d.cpp index c536cf607..96b09b032 100644 --- a/src/OpenCvSharpExtern/calib3d.cpp +++ b/src/OpenCvSharpExtern/calib3d.cpp @@ -1,4 +1,4 @@ +// ReSharper disable CppUnusedIncludeDirective #include "calib3d.h" -#include "calib3d_StereoMatcher.h" -#include "calib3d_StereoBM.h" -#include "calib3d_StereoSGBM.h" \ No newline at end of file +#include "calib3d_fisheye.h" +#include "calib3d_StereoMatcher.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/calib3d.h b/src/OpenCvSharpExtern/calib3d.h index 44f9add79..a1d7767ec 100644 --- a/src/OpenCvSharpExtern/calib3d.h +++ b/src/OpenCvSharpExtern/calib3d.h @@ -1,77 +1,130 @@ -#ifndef _CPP_CALIB3D_H_ -#define _CPP_CALIB3D_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) calib3d_Rodrigues(cv::_InputArray *src, cv::_OutputArray *dst, cv::_OutputArray *jacobian) -{ - cv::Rodrigues(*src, *dst, entity(jacobian)); -} -CVAPI(void) calib3d_Rodrigues_VecToMat(cv::Mat *vector, cv::Mat *matrix, cv::Mat *jacobian) +struct CV_EXPORTS_W_SIMPLE MyUsacParams { - cv::Mat vectorM(3, 1, CV_64FC1, vector); - cv::Mat matrixM(3, 3, CV_64FC1, matrix); - cv::Mat jacobianM(3, 9, CV_64FC1, jacobian); - cv::Rodrigues(*vector, *matrix, *jacobian); -} -CVAPI(void) calib3d_Rodrigues_MatToVec(cv::Mat *matrix, cv::Mat *vector, cv::Mat *jacobian) + double confidence; + int isParallel; + int loIterations; + cv::LocalOptimMethod loMethod; + int loSampleSize; + int maxIterations; + cv::NeighborSearchMethod neighborsSearch; + int randomGeneratorState; + cv::SamplingMethod sampler; + cv::ScoreMethod score; + double threshold; +}; + +CVAPI(ExceptionStatus) calib3d_Rodrigues(cv::_InputArray *src, cv::_OutputArray *dst, cv::_OutputArray *jacobian) { - cv::Mat matrixM(3, 3, CV_64FC1, matrix); - cv::Mat vectorM(3, 1, CV_64FC1, vector); - cv::Mat jacobianM(3, 9, CV_64FC1, jacobian); - cv::Rodrigues(*matrix, *vector, *jacobian); + BEGIN_WRAP + cv::Rodrigues(*src, *dst, entity(jacobian)); + END_WRAP } -CVAPI(cv::Mat*) calib3d_findHomography_InputArray(cv::_InputArray *srcPoints, cv::_InputArray *dstPoints, - int method, double ransacReprojThreshold, cv::_OutputArray *mask) +CVAPI(ExceptionStatus) calib3d_findHomography_InputArray( + cv::_InputArray *srcPoints, cv::_InputArray *dstPoints, + int method, double ransacReprojThreshold, cv::_OutputArray *mask, + int maxIters, double confidence, + cv::Mat** returnValue) { - cv::Mat ret = cv::findHomography(*srcPoints, *dstPoints, method, ransacReprojThreshold, entity(mask)); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::findHomography(*srcPoints, *dstPoints, method, ransacReprojThreshold, entity(mask), maxIters, confidence); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) calib3d_findHomography_vector(cv::Point2d *srcPoints, int srcPointsLength, +CVAPI(ExceptionStatus) calib3d_findHomography_vector( + cv::Point2d *srcPoints, int srcPointsLength, cv::Point2d *dstPoints, int dstPointsLength, - int method, double ransacReprojThreshold, cv::_OutputArray *mask) + int method, double ransacReprojThreshold, cv::_OutputArray *mask, + int maxIters, double confidence, + cv::Mat **returnValue) { - cv::Mat srcPointsMat(srcPointsLength, 1, CV_64FC2, srcPoints); - cv::Mat dstPointsMat(dstPointsLength, 1, CV_64FC2, dstPoints); + BEGIN_WRAP + const cv::Mat srcPointsMat(srcPointsLength, 1, CV_64FC2, srcPoints); + const cv::Mat dstPointsMat(dstPointsLength, 1, CV_64FC2, dstPoints); - cv::Mat ret = cv::findHomography(srcPointsMat, dstPointsMat, method, ransacReprojThreshold, entity(mask)); - return new cv::Mat(ret); + const auto ret = cv::findHomography(srcPointsMat, dstPointsMat, method, ransacReprojThreshold, entity(mask), maxIters, confidence); + *returnValue = new cv::Mat(ret); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_findHomography_UsacParams( + cv::_InputArray* srcPoints, cv::_InputArray* dstPoints, cv::_OutputArray* mask, MyUsacParams *params, + cv::Mat** returnValue) +{ + BEGIN_WRAP + cv::UsacParams p; + p.confidence = params->confidence; + p.isParallel = params->isParallel != 0; + p.loIterations = params->loIterations; + p.loMethod = params->loMethod; + p.loSampleSize = params->loSampleSize; + p.maxIterations = params->maxIterations; + p.neighborsSearch = params->neighborsSearch; + p.randomGeneratorState = params->randomGeneratorState; + p.sampler = params->sampler; + p.score = params->score; + p.threshold = params->threshold; + const auto ret = cv::findHomography(*srcPoints, *dstPoints, entity(mask), p); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) calib3d_RQDecomp3x3_InputArray(cv::_InputArray *src, cv::_OutputArray *mtxR, cv::_OutputArray *mtxQ, +CVAPI(ExceptionStatus) calib3d_RQDecomp3x3_InputArray( + cv::_InputArray *src, cv::_OutputArray *mtxR, cv::_OutputArray *mtxQ, cv::_OutputArray *qx, cv::_OutputArray *qy, cv::_OutputArray *qz, cv::Vec3d *outVec) { + BEGIN_WRAP *outVec = cv::RQDecomp3x3(*src, *mtxR, *mtxQ, entity(qx), entity(qy), entity(qz)); + END_WRAP } -CVAPI(void) calib3d_RQDecomp3x3_Mat(cv::Mat *src, cv::Mat *mtxR, cv::Mat *mtxQ, +CVAPI(ExceptionStatus) calib3d_RQDecomp3x3_Mat( + cv::Mat *src, cv::Mat *mtxR, cv::Mat *mtxQ, cv::Mat *qx, cv::Mat *qy, cv::Mat *qz, cv::Vec3d *outVec) { + BEGIN_WRAP *outVec = cv::RQDecomp3x3(*src, *mtxR, *mtxQ, *qx, *qy, *qz); + END_WRAP } -CVAPI(void) calib3d_decomposeProjectionMatrix_InputArray(cv::_InputArray *projMatrix, cv::_OutputArray *cameraMatrix, +CVAPI(ExceptionStatus) calib3d_decomposeProjectionMatrix_InputArray( + cv::_InputArray *projMatrix, cv::_OutputArray *cameraMatrix, cv::_OutputArray *rotMatrix, cv::_OutputArray *transVect, cv::_OutputArray *rotMatrixX, cv::_OutputArray *rotMatrixY, cv::_OutputArray *rotMatrixZ, cv::_OutputArray *eulerAngles) { + BEGIN_WRAP cv::decomposeProjectionMatrix(*projMatrix, *cameraMatrix, *rotMatrix, *transVect, entity(rotMatrixX), entity(rotMatrixY), entity(rotMatrixZ), entity(eulerAngles)); + END_WRAP } -CVAPI(void) calib3d_decomposeProjectionMatrix_Mat(cv::Mat *projMatrix, cv::Mat *cameraMatrix, +CVAPI(ExceptionStatus) calib3d_decomposeProjectionMatrix_Mat( + cv::Mat *projMatrix, cv::Mat *cameraMatrix, cv::Mat *rotMatrix, cv::Mat *transVect, cv::Mat *rotMatrixX, cv::Mat *rotMatrixY, cv::Mat *rotMatrixZ, cv::Mat *eulerAngles) { + BEGIN_WRAP cv::decomposeProjectionMatrix(*projMatrix, *cameraMatrix, *rotMatrix, *transVect, *rotMatrixX, *rotMatrixY, *rotMatrixZ, *eulerAngles); + END_WRAP } -CVAPI(void) calib3d_matMulDeriv(cv::_InputArray *a, cv::_InputArray *b, +CVAPI(ExceptionStatus) calib3d_matMulDeriv( + cv::_InputArray *a, cv::_InputArray *b, cv::_OutputArray *dABdA, cv::_OutputArray *dABdB) { + BEGIN_WRAP cv::matMulDeriv(*a, *b, *dABdA, *dABdB); + END_WRAP } -CVAPI(void) calib3d_composeRT_InputArray(cv::_InputArray *rvec1, cv::_InputArray *tvec1, +CVAPI(ExceptionStatus) calib3d_composeRT_InputArray( + cv::_InputArray *rvec1, cv::_InputArray *tvec1, cv::_InputArray *rvec2, cv::_InputArray *tvec2, cv::_OutputArray *rvec3, cv::_OutputArray *tvec3, cv::_OutputArray *dr3dr1, cv::_OutputArray *dr3dt1, @@ -79,12 +132,15 @@ CVAPI(void) calib3d_composeRT_InputArray(cv::_InputArray *rvec1, cv::_InputArray cv::_OutputArray *dt3dr1, cv::_OutputArray *dt3dt1, cv::_OutputArray *dt3dr2, cv::_OutputArray *dt3dt2) { + BEGIN_WRAP cv::composeRT(*rvec1, *tvec1, *rvec2, *tvec2, *rvec3, *tvec3, entity(dr3dr1), entity(dr3dt1), entity(dr3dr2), entity(dr3dt2), entity(dt3dr1), entity(dt3dt1), entity(dt3dr2), entity(dt3dt2)); + END_WRAP } -CVAPI(void) calib3d_composeRT_Mat(cv::Mat *rvec1, cv::Mat *tvec1, +CVAPI(ExceptionStatus) calib3d_composeRT_Mat( + cv::Mat *rvec1, cv::Mat *tvec1, cv::Mat *rvec2, cv::Mat *tvec2, cv::Mat *rvec3, cv::Mat *tvec3, cv::Mat *dr3dr1, cv::Mat *dr3dt1, @@ -92,76 +148,95 @@ CVAPI(void) calib3d_composeRT_Mat(cv::Mat *rvec1, cv::Mat *tvec1, cv::Mat *dt3dr1, cv::Mat *dt3dt1, cv::Mat *dt3dr2, cv::Mat *dt3dt2) { + BEGIN_WRAP cv::composeRT(*rvec1, *tvec1, *rvec2, *tvec2, *rvec3, *tvec3, entity(dr3dr1), entity(dr3dt1), entity(dr3dr2), entity(dr3dt2), entity(dt3dr1), entity(dt3dt1), entity(dt3dr2), entity(dt3dt2)); + END_WRAP } -CVAPI(void) calib3d_projectPoints_InputArray(cv::_InputArray *objectPoints, +CVAPI(ExceptionStatus) calib3d_projectPoints_InputArray( + cv::_InputArray *objectPoints, cv::_InputArray *rvec, cv::_InputArray *tvec, cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, cv::_OutputArray *imagePoints, cv::_OutputArray *jacobian, double aspectRatio) { + BEGIN_WRAP cv::projectPoints(*objectPoints, *rvec, *tvec, *cameraMatrix, *distCoeffs, - *imagePoints, *jacobian, aspectRatio); + *imagePoints, entity(jacobian), aspectRatio); + END_WRAP } -CVAPI(void) calib3d_projectPoints_Mat(cv::Mat *objectPoints, +CVAPI(ExceptionStatus) calib3d_projectPoints_Mat( + cv::Mat *objectPoints, cv::Mat *rvec, cv::Mat *tvec, cv::Mat *cameraMatrix, cv::Mat *distCoeffs, cv::Mat *imagePoints, cv::Mat *jacobian, double aspectRatio) { + BEGIN_WRAP cv::projectPoints(*objectPoints, *rvec, *tvec, *cameraMatrix, *distCoeffs, *imagePoints, *jacobian, aspectRatio); + END_WRAP } - -CVAPI(void) calib3d_solvePnP_InputArray(cv::_InputArray *objectPoints, cv::_InputArray *imagePoints, cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, +CVAPI(ExceptionStatus) calib3d_solvePnP_InputArray( + cv::_InputArray *objectPoints, cv::_InputArray *imagePoints, cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, cv::_OutputArray *rvec, cv::_OutputArray *tvec, int useExtrinsicGuess, int flags) { + BEGIN_WRAP cv::solvePnP(*objectPoints, *imagePoints, *cameraMatrix, entity(distCoeffs), *rvec, *tvec, useExtrinsicGuess != 0, flags); + END_WRAP } -CVAPI(void) calib3d_solvePnP_vector(cv::Point3f *objectPoints, int objectPointsLength, +CVAPI(ExceptionStatus) calib3d_solvePnP_vector(cv::Point3f *objectPoints, int objectPointsLength, cv::Point2f *imagePoints, int imagePointsLength, double *cameraMatrix, double *distCoeffs, int distCoeffsLength, double *rvec, double *tvec, int useExtrinsicGuess, int flags) { - cv::Mat objectPointsMat(objectPointsLength, 1, CV_64FC3, objectPoints); - cv::Mat imagePointsMat(imagePointsLength, 1, CV_64FC2, imagePoints); + BEGIN_WRAP + const cv::Mat objectPointsMat(objectPointsLength, 1, CV_32FC3, objectPoints); + const cv::Mat imagePointsMat(imagePointsLength, 1, CV_32FC2, imagePoints); cv::Mat distCoeffsMat; - if (distCoeffs != NULL) + if (distCoeffs != nullptr) distCoeffsMat = cv::Mat(distCoeffsLength, 1, CV_64FC1, distCoeffs); - cv::Matx rvecM, tvecM; - cv::solvePnP(objectPointsMat, imagePointsMat, *cameraMatrix, distCoeffsMat, rvecM, tvecM, useExtrinsicGuess != 0, flags); - memcpy(rvec, rvecM.val, sizeof(double) * 3); - memcpy(tvec, tvecM.val, sizeof(double) * 3); + const cv::Matx cameraMatrixMat(cameraMatrix); + cv::Matx rvecMat(rvec), tvecMat(tvec); + cv::solvePnP(objectPointsMat, imagePointsMat, cameraMatrixMat, distCoeffsMat, rvecMat, tvecMat, useExtrinsicGuess != 0, flags); + memcpy(rvec, rvecMat.val, sizeof(double) * 3); + memcpy(tvec, tvecMat.val, sizeof(double) * 3); + END_WRAP } -CVAPI(void) calib3d_solvePnPRansac_InputArray(cv::_InputArray *objectPoints, cv::_InputArray *imagePoints, +CVAPI(ExceptionStatus) calib3d_solvePnPRansac_InputArray( + cv::_InputArray *objectPoints, cv::_InputArray *imagePoints, cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, cv::_OutputArray *rvec, cv::_OutputArray *tvec, bool useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, cv::_OutputArray *inliers, int flags) { + BEGIN_WRAP cv::solvePnPRansac(*objectPoints, *imagePoints, *cameraMatrix, entity(distCoeffs), *rvec, *tvec, useExtrinsicGuess != 0, iterationsCount, reprojectionError, confidence, entity(inliers), flags); + END_WRAP } -CVAPI(void) calib3d_solvePnPRansac_vector(cv::Point3f *objectPoints, int objectPointsLength, +CVAPI(ExceptionStatus) calib3d_solvePnPRansac_vector( + cv::Point3f *objectPoints, int objectPointsLength, cv::Point2f *imagePoints, int imagePointsLength, - double *cameraMatrix, double *distCoeffs, int distCoeffsLength, + double *cameraMatrix, + double *distCoeffs, int distCoeffsLength, double *rvec, double *tvec, int useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, std::vector *inliers, int flags) { - cv::Mat objectPointsMat(objectPointsLength, 1, CV_64FC3, objectPoints); - cv::Mat imagePointsMat(imagePointsLength, 1, CV_64FC2, imagePoints); + BEGIN_WRAP + const cv::Mat objectPointsMat(objectPointsLength, 1, CV_64FC3, objectPoints); + const cv::Mat imagePointsMat(imagePointsLength, 1, CV_64FC2, imagePoints); cv::Mat distCoeffsMat; - if (distCoeffs != NULL) + if (distCoeffs != nullptr) distCoeffsMat = cv::Mat(distCoeffsLength, 1, CV_64FC1, distCoeffs); cv::Matx rvecM, tvecM; @@ -172,158 +247,252 @@ CVAPI(void) calib3d_solvePnPRansac_vector(cv::Point3f *objectPoints, int objectP memcpy(rvec, rvecM.val, sizeof(double) * 3); memcpy(tvec, tvecM.val, sizeof(double) * 3); + END_WRAP } -CVAPI(cv::Mat*) calib3d_initCameraMatrix2D_Mat(cv::Mat **objectPoints, int objectPointsLength, - cv::Mat **imagePoints, int imagePointsLength, CvSize imageSize, double aspectRatio) +CVAPI(ExceptionStatus) calib3d_initCameraMatrix2D_Mat( + cv::Mat **objectPoints, int objectPointsLength, + cv::Mat **imagePoints, int imagePointsLength, + MyCvSize imageSize, double aspectRatio, + cv::Mat **returnValue) { + BEGIN_WRAP std::vector objectPointsVec(objectPointsLength); - for (int i = 0; i < objectPointsLength; i++) + for (auto i = 0; i < objectPointsLength; i++) objectPointsVec[i] = *objectPoints[i]; std::vector imagePointsVec(imagePointsLength); - for (int i = 0; i < objectPointsLength; i++) + for (auto i = 0; i < objectPointsLength; i++) imagePointsVec[i] = *imagePoints[i]; - cv::Mat ret = cv::initCameraMatrix2D(objectPointsVec, imagePointsVec, imageSize, aspectRatio); - return new cv::Mat(ret); + const auto ret = cv::initCameraMatrix2D(objectPointsVec, imagePointsVec, cpp(imageSize), aspectRatio); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) calib3d_initCameraMatrix2D_array(cv::Point3d **objectPoints, int opSize1, int *opSize2, - cv::Point2d **imagePoints, int ipSize1, int *ipSize2, CvSize imageSize, double aspectRatio) +CVAPI(ExceptionStatus) calib3d_initCameraMatrix2D_array( + cv::Point3f **objectPoints, int opSize1, int *opSize2, + cv::Point2f **imagePoints, int ipSize1, int *ipSize2, MyCvSize imageSize, double aspectRatio, + cv::Mat **returnValue) { - std::vector > objectPointsVec(opSize1); - for (int i = 0; i < opSize1; i++) - objectPointsVec[i] = std::vector(objectPoints[i], objectPoints[i] + opSize2[i]); - std::vector > imagePointsVec(ipSize1); - for (int i = 0; i < ipSize1; i++) - imagePointsVec[i] = std::vector(imagePoints[i], imagePoints[i] + ipSize2[i]); + BEGIN_WRAP + std::vector > objectPointsVec(opSize1); + for (auto i = 0; i < opSize1; i++) + objectPointsVec[i] = std::vector(objectPoints[i], objectPoints[i] + opSize2[i]); + std::vector > imagePointsVec(ipSize1); + for (auto i = 0; i < ipSize1; i++) + imagePointsVec[i] = std::vector(imagePoints[i], imagePoints[i] + ipSize2[i]); + + const auto ret = cv::initCameraMatrix2D(objectPointsVec, imagePointsVec, cpp(imageSize), aspectRatio); + *returnValue = new cv::Mat(ret); + END_WRAP +} - cv::Mat ret = cv::initCameraMatrix2D(objectPointsVec, imagePointsVec, imageSize, aspectRatio); - return new cv::Mat(ret); +CVAPI(ExceptionStatus) calib3d_findChessboardCorners_InputArray( + cv::_InputArray *image, MyCvSize patternSize, + cv::_OutputArray *corners, int flags, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::findChessboardCorners(*image, cpp(patternSize), *corners, flags) ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_findChessboardCorners_vector( + cv::_InputArray *image, MyCvSize patternSize, + std::vector *corners, int flags, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::findChessboardCorners(*image, cpp(patternSize), *corners, flags) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_checkChessboard( + cv::_InputArray *img, MyCvSize size, int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::checkChessboard(*img, cpp(size)) ? 1 : 0; + END_WRAP } -CVAPI(int) calib3d_findChessboardCorners_InputArray(cv::_InputArray *image, CvSize patternSize, - cv::_OutputArray *corners, int flags) +CVAPI(ExceptionStatus) calib3d_findChessboardCornersSB_OutputArray( + cv::_InputArray *image, MyCvSize patternSize, cv::_OutputArray *corners, int flags, + int *returnValue) { - return cv::findChessboardCorners(*image, patternSize, *corners, flags) ? 1 : 0; + BEGIN_WRAP + *returnValue = cv::findChessboardCornersSB(*image, cpp(patternSize), *corners, flags) ? 1 : 0; + END_WRAP } -CVAPI(int) calib3d_findChessboardCorners_vector(cv::_InputArray *image, CvSize patternSize, - std::vector *corners, int flags) +CVAPI(ExceptionStatus) calib3d_findChessboardCornersSB_vector( + cv::_InputArray *image, MyCvSize patternSize, std::vector *corners, int flags, + int *returnValue) { - return cv::findChessboardCorners(*image, patternSize, *corners, flags) ? 1 : 0; + BEGIN_WRAP + *returnValue = cv::findChessboardCornersSB(*image, cpp(patternSize), *corners, flags) ? 1 : 0; + END_WRAP } -CVAPI(int) calib3d_find4QuadCornerSubpix_InputArray(cv::_InputArray *img, cv::_InputOutputArray *corners, CvSize regionSize) +CVAPI(ExceptionStatus) calib3d_find4QuadCornerSubpix_InputArray( + cv::_InputArray *img, cv::_InputOutputArray *corners, MyCvSize regionSize, + int *returnValue) { - return cv::find4QuadCornerSubpix(*img, *corners, regionSize) ? 1 : 0; + BEGIN_WRAP + *returnValue = cv::find4QuadCornerSubpix(*img, *corners, cpp(regionSize)) ? 1 : 0; + END_WRAP } -CVAPI(int) calib3d_find4QuadCornerSubpix_vector(cv::_InputArray *img, std::vector *corners, CvSize regionSize) +CVAPI(ExceptionStatus) calib3d_find4QuadCornerSubpix_vector( + cv::_InputArray *img, std::vector *corners, MyCvSize regionSize, + int *returnValue) { - return cv::find4QuadCornerSubpix(*img, *corners, regionSize) ? 1 : 0; + BEGIN_WRAP + *returnValue = cv::find4QuadCornerSubpix(*img, *corners, cpp(regionSize)) ? 1 : 0; + END_WRAP } -CVAPI(void) calib3d_drawChessboardCorners_InputArray(cv::_InputOutputArray *image, CvSize patternSize, +CVAPI(ExceptionStatus) calib3d_drawChessboardCorners_InputArray( + cv::_InputOutputArray *image, MyCvSize patternSize, cv::_InputArray *corners, int patternWasFound) { - cv::drawChessboardCorners(*image, patternSize, *corners, patternWasFound != 0); + BEGIN_WRAP + cv::drawChessboardCorners(*image, cpp(patternSize), *corners, patternWasFound != 0); + END_WRAP } -CVAPI(void) calib3d_drawChessboardCorners_array(cv::_InputOutputArray *image, CvSize patternSize, +CVAPI(ExceptionStatus) calib3d_drawChessboardCorners_array( + cv::_InputOutputArray *image, MyCvSize patternSize, cv::Point2f *corners, int cornersLength, int patternWasFound) { - std::vector cornersVec(corners, corners + cornersLength); - cv::drawChessboardCorners(*image, patternSize, cornersVec, patternWasFound != 0); + BEGIN_WRAP + const std::vector cornersVec(corners, corners + cornersLength); + cv::drawChessboardCorners(*image, cpp(patternSize), cornersVec, patternWasFound != 0); + END_WRAP } -static void BlobDetectorDeleter(cv::FeatureDetector *p) {} - -CVAPI(int) calib3d_findCirclesGrid_InputArray(cv::_InputArray *image, CvSize patternSize, - cv::_OutputArray *centers, int flags, cv::FeatureDetector* blobDetector) +CVAPI(ExceptionStatus) calib3d_drawFrameAxes( + cv::_InputOutputArray *image, cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, + cv::_InputArray *rvec, cv::_InputArray *tvec, float length, int thickness) { - if (blobDetector == NULL) - return cv::findCirclesGrid(*image, patternSize, *centers, flags) ? 1 : 0; + BEGIN_WRAP + cv::drawFrameAxes(*image, *cameraMatrix, *distCoeffs, *rvec, *tvec, length, thickness); + END_WRAP +} + + +static void BlobDetectorDeleter(cv::FeatureDetector *) {} - cv::Ptr detectorPtr(blobDetector, BlobDetectorDeleter); // don't delete - return cv::findCirclesGrid(*image, patternSize, *centers, flags, detectorPtr) ? 1 : 0; +CVAPI(ExceptionStatus) calib3d_findCirclesGrid_InputArray( + cv::_InputArray *image, MyCvSize patternSize, + cv::_OutputArray *centers, int flags, cv::FeatureDetector* blobDetector, + int *returnValue) +{ + BEGIN_WRAP + if (blobDetector == nullptr) + { + *returnValue = cv::findCirclesGrid(*image, cpp(patternSize), *centers, flags) ? 1 : 0; + } + else + { + const cv::Ptr detectorPtr(blobDetector, BlobDetectorDeleter); // don't delete + *returnValue = cv::findCirclesGrid(*image, cpp(patternSize), *centers, flags, detectorPtr) ? 1 : 0; + } + END_WRAP } -CVAPI(int) calib3d_findCirclesGrid_vector(cv::_InputArray *image, CvSize patternSize, - std::vector *centers, int flags, cv::FeatureDetector* blobDetector) +CVAPI(ExceptionStatus) calib3d_findCirclesGrid_vector( + cv::_InputArray *image, MyCvSize patternSize, + std::vector *centers, int flags, cv::FeatureDetector* blobDetector, + int *returnValue) { - if (blobDetector == NULL) - return cv::findCirclesGrid(*image, patternSize, *centers, flags) ? 1 : 0; - - cv::Ptr detectorPtr(blobDetector, BlobDetectorDeleter); // don't delete - return cv::findCirclesGrid(*image, patternSize, *centers, flags, detectorPtr) ? 1 : 0; + BEGIN_WRAP + if (blobDetector == nullptr) + { + *returnValue = cv::findCirclesGrid(*image, cpp(patternSize), *centers, flags) ? 1 : 0; + } + else + { + const cv::Ptr detectorPtr(blobDetector, BlobDetectorDeleter); // don't delete + *returnValue = cv::findCirclesGrid(*image, cpp(patternSize), *centers, flags, detectorPtr) ? 1 : 0; + } + END_WRAP } -CVAPI(double) calib3d_calibrateCamera_InputArray( +CVAPI(ExceptionStatus) calib3d_calibrateCamera_InputArray( cv::Mat **objectPoints, int objectPointsSize, cv::Mat **imagePoints, int imagePointsSize, - CvSize imageSize, + MyCvSize imageSize, cv::_InputOutputArray *cameraMatrix, cv::_InputOutputArray *distCoeffs, std::vector *rvecs, std::vector *tvecs, int flags, - CvTermCriteria criteria) + MyCvTermCriteria criteria, + double *returnValue) { + BEGIN_WRAP std::vector objectPointsVec(objectPointsSize); - for (int i = 0; i < objectPointsSize; i++) + for (auto i = 0; i < objectPointsSize; i++) objectPointsVec[i] = *objectPoints[i]; std::vector imagePointsVec(imagePointsSize); - for (int i = 0; i < imagePointsSize; i++) + for (auto i = 0; i < imagePointsSize; i++) imagePointsVec[i] = *imagePoints[i]; - return cv::calibrateCamera(objectPointsVec, imagePointsVec, imageSize, - *cameraMatrix, *distCoeffs, *rvecs, *tvecs, flags, criteria); + *returnValue = cv::calibrateCamera(objectPointsVec, imagePointsVec, cpp(imageSize), + *cameraMatrix, *distCoeffs, *rvecs, *tvecs, flags, cpp(criteria)); + END_WRAP } -CVAPI(double) calib3d_calibrateCamera_vector( +CVAPI(ExceptionStatus) calib3d_calibrateCamera_vector( cv::Point3f **objectPoints, int opSize1, int *opSize2, cv::Point2f **imagePoints, int ipSize1, int *ipSize2, - CvSize imageSize, + MyCvSize imageSize, double *cameraMatrix, double *distCoeffs, int distCoeffsSize, std::vector *rvecs, std::vector *tvecs, int flags, - CvTermCriteria criteria) + MyCvTermCriteria criteria, + double *returnValue) { + BEGIN_WRAP std::vector > objectPointsVec(opSize1); - for (int i = 0; i < opSize1; i++) + for (auto i = 0; i < opSize1; i++) objectPointsVec[i] = std::vector(objectPoints[i], objectPoints[i] + opSize2[i]); std::vector > imagePointsVec(ipSize1); - for (int i = 0; i < ipSize1; i++) + for (auto i = 0; i < ipSize1; i++) imagePointsVec[i] = std::vector(imagePoints[i], imagePoints[i] + ipSize2[i]); cv::Mat cametaMatrixM(3, 3, CV_64FC1, cameraMatrix); cv::Mat distCoeffsM(distCoeffsSize, 1, CV_64FC1, distCoeffs); - return cv::calibrateCamera(objectPointsVec, imagePointsVec, imageSize, - cametaMatrixM, distCoeffsM, *rvecs, *tvecs, flags, criteria); + *returnValue = cv::calibrateCamera(objectPointsVec, imagePointsVec, cpp(imageSize), + cametaMatrixM, distCoeffsM, *rvecs, *tvecs, flags, cpp(criteria)); + END_WRAP } -CVAPI(void) calib3d_calibrationMatrixValues_InputArray(cv::_InputArray *cameraMatrix, CvSize imageSize, +CVAPI(ExceptionStatus) calib3d_calibrationMatrixValues_InputArray(cv::_InputArray *cameraMatrix, MyCvSize imageSize, double apertureWidth, double apertureHeight, double *fovx, double *fovy, double *focalLength, cv::Point2d *principalPoint, double *aspectRatio) { + BEGIN_WRAP double fovx0, fovy0, focalLength0, aspectRatio0; cv::Point2d principalPoint0; - cv::calibrationMatrixValues(*cameraMatrix, imageSize, apertureWidth, apertureHeight, + cv::calibrationMatrixValues(*cameraMatrix, cpp(imageSize), apertureWidth, apertureHeight, fovx0, fovy0, focalLength0, principalPoint0, aspectRatio0); *fovx = fovx0; *fovy = fovy0; *principalPoint = principalPoint0; *focalLength = focalLength0; *aspectRatio = aspectRatio0; + END_WRAP } -CVAPI(void) calib3d_calibrationMatrixValues_array(double *cameraMatrix, CvSize imageSize, +CVAPI(ExceptionStatus) calib3d_calibrationMatrixValues_array(double *cameraMatrix, MyCvSize imageSize, double apertureWidth, double apertureHeight, double *fovx, double *fovy, double *focalLength, cv::Point2d *principalPoint, double *aspectRatio) { - cv::Mat cameraMatrixM(3, 3, CV_64FC1, cameraMatrix); + BEGIN_WRAP + const cv::Mat cameraMatrixM(3, 3, CV_64FC1, cameraMatrix); cv::_InputArray cameraMatrixI(cameraMatrixM); calib3d_calibrationMatrixValues_InputArray(&cameraMatrixI, imageSize, apertureWidth, apertureHeight, fovx, fovy, focalLength, principalPoint, aspectRatio); + END_WRAP } -CVAPI(double) calib3d_stereoCalibrate_InputArray(cv::_InputArray **objectPoints, int opSize, +CVAPI(ExceptionStatus) calib3d_stereoCalibrate_InputArray( + cv::_InputArray **objectPoints, int opSize, cv::_InputArray **imagePoints1, int ip1Size, cv::_InputArray **imagePoints2, int ip2Size, cv::_InputOutputArray *cameraMatrix1, @@ -334,24 +503,27 @@ CVAPI(double) calib3d_stereoCalibrate_InputArray(cv::_InputArray **objectPoints, cv::_OutputArray *R, cv::_OutputArray *T, cv::_OutputArray *E, cv::_OutputArray *F, int flags, - MyCvTermCriteria criteria) + MyCvTermCriteria criteria, + double *returnValue) { + BEGIN_WRAP std::vector objectPointsVec(opSize); std::vector imagePoints1Vec(ip1Size); std::vector imagePoints2Vec(ip2Size); - for (int i = 0; i < opSize; i++) + for (auto i = 0; i < opSize; i++) objectPointsVec[i] = *objectPoints[i]; - for (int i = 0; i < ip1Size; i++) + for (auto i = 0; i < ip1Size; i++) imagePoints1Vec[i] = *imagePoints1[i]; - for (int i = 0; i < ip2Size; i++) + for (auto i = 0; i < ip2Size; i++) imagePoints2Vec[i] = *imagePoints2[i]; - return cv::stereoCalibrate(objectPointsVec, imagePoints1Vec, imagePoints2Vec, + *returnValue = cv::stereoCalibrate(objectPointsVec, imagePoints1Vec, imagePoints2Vec, *cameraMatrix1, *distCoeffs1, *cameraMatrix2, *distCoeffs2, cpp(imageSize), entity(R), entity(T), entity(E), entity(F), flags, cpp(criteria)); + END_WRAP } -CVAPI(double) calib3d_stereoCalibrate_array( +CVAPI(ExceptionStatus) calib3d_stereoCalibrate_array( cv::Point3f **objectPoints, int opSize1, int *opSizes2, cv::Point2f **imagePoints1, int ip1Size1, int *ip1Sizes2, cv::Point2f **imagePoints2, int ip2Size1, int *ip2Sizes2, @@ -363,18 +535,20 @@ CVAPI(double) calib3d_stereoCalibrate_array( cv::_OutputArray *R, cv::_OutputArray *T, cv::_OutputArray *E, cv::_OutputArray *F, int flags, - MyCvTermCriteria criteria ) + MyCvTermCriteria criteria, + double *returnValue) { + BEGIN_WRAP std::vector > objectPointsVec(opSize1); std::vector > imagePoints1Vec(ip1Size1); std::vector > imagePoints2Vec(ip2Size1); - for (int i = 0; i < opSize1; i++) + for (auto i = 0; i < opSize1; i++) objectPointsVec[i] = std::vector( objectPoints[i], objectPoints[i] + opSizes2[i]); - for (int i = 0; i < ip1Size1; i++) + for (auto i = 0; i < ip1Size1; i++) imagePoints1Vec[i] = std::vector( imagePoints1[i], imagePoints1[i] + ip1Sizes2[i]); - for (int i = 0; i < ip2Size1; i++) + for (auto i = 0; i < ip2Size1; i++) imagePoints2Vec[i] = std::vector( imagePoints2[i], imagePoints2[i] + ip2Sizes2[i]); @@ -383,13 +557,14 @@ CVAPI(double) calib3d_stereoCalibrate_array( cv::Mat distCoeffs1M(dc1Size, 1, CV_64FC1, distCoeffs1); cv::Mat distCoeffs2M(dc2Size, 1, CV_64FC1, distCoeffs2); - return cv::stereoCalibrate(objectPointsVec, imagePoints1Vec, imagePoints2Vec, + *returnValue = cv::stereoCalibrate(objectPointsVec, imagePoints1Vec, imagePoints2Vec, cameraMatrix1M, distCoeffs1M, cameraMatrix2M, distCoeffs2M, cpp(imageSize), entity(R), entity(T), entity(E), entity(F), flags, cpp(criteria)); + END_WRAP } -CVAPI(void) calib3d_stereoRectify_InputArray( +CVAPI(ExceptionStatus) calib3d_stereoRectify_InputArray( cv::_InputArray *cameraMatrix1, cv::_InputArray *distCoeffs1, cv::_InputArray *cameraMatrix2, cv::_InputArray *distCoeffs2, MyCvSize imageSize, cv::_InputArray *R, cv::_InputArray *T, @@ -397,16 +572,18 @@ CVAPI(void) calib3d_stereoRectify_InputArray( cv::_OutputArray *P1, cv::_OutputArray *P2, cv::_OutputArray *Q, int flags, double alpha, CvSize newImageSize, - CvRect *validPixROI1, CvRect *validPixROI2) + MyCvRect *validPixROI1, MyCvRect *validPixROI2) { + BEGIN_WRAP cv::Rect _validPixROI1, _validPixROI2; cv::stereoRectify(*cameraMatrix1, *distCoeffs1, *cameraMatrix2, *distCoeffs2, cpp(imageSize), *R, *T, *R1, *R2, *P1, *P2, *Q, flags, alpha, newImageSize, &_validPixROI1, &_validPixROI2); - *validPixROI1 = _validPixROI1; - *validPixROI2 = _validPixROI2; + *validPixROI1 = c(_validPixROI1); + *validPixROI2 = c(_validPixROI2); + END_WRAP } -CVAPI(void) calib3d_stereoRectify_array(double *cameraMatrix1, +CVAPI(ExceptionStatus) calib3d_stereoRectify_array(double *cameraMatrix1, double *distCoeffs1, int dc1Size, double *cameraMatrix2, double *distCoeffs2, int dc2Size, @@ -414,8 +591,9 @@ CVAPI(void) calib3d_stereoRectify_array(double *cameraMatrix1, double *R, double *T, double *R1, double *R2, double *P1, double *P2, double *Q, int flags, double alpha, MyCvSize newImageSize, - CvRect *validPixROI1, CvRect *validPixROI2) + MyCvRect *validPixROI1, MyCvRect *validPixROI2) { + BEGIN_WRAP cv::Mat cameraMatrix1M(3, 3, CV_64FC1, cameraMatrix1); cv::Mat cameraMatrix2M(3, 3, CV_64FC1, cameraMatrix2); cv::Mat distCoeffs1M(dc1Size, 1, CV_64FC1, distCoeffs1); @@ -433,210 +611,373 @@ CVAPI(void) calib3d_stereoRectify_array(double *cameraMatrix1, cv::stereoRectify(cameraMatrix1M, distCoeffs1M, cameraMatrix2M, distCoeffs2M, cpp(imageSize), RM, TM, R1M, R2M, P1M, P2M, QM, flags, alpha, cpp(newImageSize), &_validPixROI1, &_validPixROI2); - *validPixROI1 = _validPixROI1; - *validPixROI2 = _validPixROI2; + *validPixROI1 = c(_validPixROI1); + *validPixROI2 = c(_validPixROI2); + END_WRAP } -CVAPI(int) calib3d_stereoRectifyUncalibrated_InputArray(cv::_InputArray *points1, cv::_InputArray *points2, +CVAPI(ExceptionStatus) calib3d_stereoRectifyUncalibrated_InputArray(cv::_InputArray *points1, cv::_InputArray *points2, cv::_InputArray *F, MyCvSize imgSize, cv::_OutputArray *H1, cv::_OutputArray *H2, - double threshold) + double threshold, + int *returnValue) { - return cv::stereoRectifyUncalibrated(*points1, *points2, *F, cpp(imgSize), *H1, *H2, threshold) ? 1 : 0; + BEGIN_WRAP + *returnValue = cv::stereoRectifyUncalibrated(*points1, *points2, *F, cpp(imgSize), *H1, *H2, threshold) ? 1 : 0; + END_WRAP } -CVAPI(int) calib3d_stereoRectifyUncalibrated_array(cv::Point2d *points1, int points1Size, +CVAPI(ExceptionStatus) calib3d_stereoRectifyUncalibrated_array(cv::Point2d *points1, int points1Size, cv::Point2d *points2, int points2Size, cv::_InputArray *F, MyCvSize imgSize, double *H1, double *H2, - double threshold) + double threshold, + int *returnValue) { - cv::Mat points1Mat(points1Size, 1, CV_64FC2, points1); - cv::Mat points2Mat(points2Size, 1, CV_64FC2, points2); + BEGIN_WRAP + const cv::Mat points1Mat(points1Size, 1, CV_64FC2, points1); + const cv::Mat points2Mat(points2Size, 1, CV_64FC2, points2); cv::Mat H1M(3, 3, CV_64FC1, H1); cv::Mat H2M(3, 3, CV_64FC1, H2); - return cv::stereoRectifyUncalibrated(points1Mat, points2Mat, *F, cpp(imgSize), H1M, H2M, threshold) ? 1 : 0; + *returnValue = cv::stereoRectifyUncalibrated(points1Mat, points2Mat, *F, cpp(imgSize), H1M, H2M, threshold) ? 1 : 0; + END_WRAP } -CVAPI(float) calib3d_rectify3Collinear_InputArray( +CVAPI(ExceptionStatus) calib3d_rectify3Collinear_InputArray( cv::_InputArray *cameraMatrix1, cv::_InputArray *distCoeffs1, cv::_InputArray *cameraMatrix2, cv::_InputArray *distCoeffs2, cv::_InputArray *cameraMatrix3, cv::_InputArray *distCoeffs3, cv::_InputArray **imgpt1, int imgpt1Size, cv::_InputArray **imgpt3, int imgpt3Size, - CvSize imageSize, cv::_InputArray *R12, cv::_InputArray *T12, + MyCvSize imageSize, cv::_InputArray *R12, cv::_InputArray *T12, cv::_InputArray *R13, cv::_InputArray *T13, cv::_OutputArray *R1, cv::_OutputArray *R2, cv::_OutputArray *R3, cv::_OutputArray *P1, cv::_OutputArray *P2, cv::_OutputArray *P3, cv::_OutputArray *Q, double alpha, CvSize newImgSize, - CvRect *roi1, CvRect *roi2, int flags) + MyCvRect *roi1, MyCvRect *roi2, int flags, + float *returnValue) { + BEGIN_WRAP std::vector imgpt1Vec(imgpt1Size); std::vector imgpt3Vec(imgpt3Size); - for (int i = 0; i < imgpt1Size; i++) + for (auto i = 0; i < imgpt1Size; i++) imgpt1Vec[i] = *(imgpt1[i]); - for (int i = 0; i < imgpt1Size; i++) + for (auto i = 0; i < imgpt1Size; i++) imgpt3Vec[i] = *(imgpt3[i]); cv::Rect _roi1, _roi2; - float ret = cv::rectify3Collinear(*cameraMatrix1, *distCoeffs1, + const auto ret = cv::rectify3Collinear(*cameraMatrix1, *distCoeffs1, *cameraMatrix2, *distCoeffs2, *cameraMatrix3, *distCoeffs3, - imgpt1Vec, imgpt3Vec, imageSize, *R12, *T12, *R13, *T13, + imgpt1Vec, imgpt3Vec, cpp(imageSize), *R12, *T12, *R13, *T13, *R1, *R2, *R3, *P1, *P2, *P3, *Q, alpha, newImgSize, &_roi1, &_roi2, flags); - *roi1 = _roi1; - *roi2 = _roi2; - return ret; + *roi1 = c(_roi1); + *roi2 = c(_roi2); + *returnValue = ret; + END_WRAP } -CVAPI(cv::Mat*) calib3d_getOptimalNewCameraMatrix_InputArray( +CVAPI(ExceptionStatus) calib3d_getOptimalNewCameraMatrix_InputArray( cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, MyCvSize imageSize, double alpha, MyCvSize newImgSize, - CvRect* validPixROI, int centerPrincipalPoint) + MyCvRect* validPixROI, int centerPrincipalPoint, + cv::Mat **returnValue) { + BEGIN_WRAP cv::Rect _validPixROI; - cv::Mat mat = cv::getOptimalNewCameraMatrix(*cameraMatrix, entity(distCoeffs), + const auto mat = cv::getOptimalNewCameraMatrix(*cameraMatrix, entity(distCoeffs), cpp(imageSize), alpha, cpp(newImgSize), &_validPixROI, centerPrincipalPoint != 0); - *validPixROI = _validPixROI; - return new cv::Mat(mat); + *validPixROI = c(_validPixROI); + *returnValue = new cv::Mat(mat); + END_WRAP } -CVAPI(void) calib3d_getOptimalNewCameraMatrix_array( +CVAPI(ExceptionStatus) calib3d_getOptimalNewCameraMatrix_array( double *cameraMatrix, double *distCoeffs, int distCoeffsSize, MyCvSize imageSize, double alpha, MyCvSize newImgSize, - CvRect* validPixROI, int centerPrincipalPoint, - double *outValues) + MyCvRect* validPixROI, int centerPrincipalPoint, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const cv::Mat cameraMatrixM(3, 3, CV_64FC1, cameraMatrix); + const auto distCoeffsM = (distCoeffs == nullptr) ? cv::Mat() : cv::Mat(distCoeffsSize, 1, CV_64FC1, distCoeffs); + + cv::Rect _validPixROI; + const auto mat = cv::getOptimalNewCameraMatrix(cameraMatrixM, distCoeffsM, cpp(imageSize), + alpha, cpp(newImgSize), &_validPixROI, centerPrincipalPoint != 0); + *validPixROI = c(_validPixROI); + *returnValue = new cv::Mat(mat); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_calibrateHandEye( + cv::Mat **R_gripper2baseMats, const int32_t R_gripper2baseMatsSize, + cv::Mat **t_gripper2baseMats, const int32_t t_gripper2baseMatsSize, + cv::Mat **R_target2camMats, const int32_t R_target2camMatsSize, + cv::Mat **t_target2camMats, const int32_t t_target2camMatsSize, + cv::_OutputArray *R_cam2gripper, + cv::_OutputArray *t_cam2gripper, + int32_t method) { - CvMat cameraMatrixM = cvMat(3, 3, CV_64FC1, cameraMatrix); - CvMat distCoeffsM = cvMat(distCoeffsSize, 1, CV_64FC1, distCoeffs); - CvMat *pdistCoeffsM = (distCoeffs == NULL) ? NULL : &distCoeffsM; - CvMat newCameraMatrix = cvMat(3, 3, CV_64FC1, outValues); + BEGIN_WRAP + std::vector R_gripper2base; + std::vector t_gripper2base; + std::vector R_target2cam; + std::vector t_target2cam; + toVec(R_gripper2baseMats, R_gripper2baseMatsSize, R_gripper2base); + toVec(t_gripper2baseMats, t_gripper2baseMatsSize, t_gripper2base); + toVec(R_target2camMats, R_target2camMatsSize, R_target2cam); + toVec(t_target2camMats, t_target2camMatsSize, t_target2cam); + cv::calibrateHandEye( + R_gripper2base, t_gripper2base, + R_target2cam, t_target2cam, + *R_cam2gripper, *t_cam2gripper, + static_cast(method)); + END_WRAP +} + +/* +static void calibrateRobotWorldHandEyeShah(const std::vector>& cRw, const std::vector>& ctw, + const std::vector>& gRb, const std::vector>& gtb, + Matx33d& wRb, Matx31d& wtb, Matx33d& cRg, Matx31d& ctg) +static void calibrateRobotWorldHandEyeLi(const std::vector>& cRw, const std::vector>& ctw, + const std::vector>& gRb, const std::vector>& gtb, + Matx33d& wRb, Matx31d& wtb, Matx33d& cRg, Matx31d& ctg) + */ +CVAPI(ExceptionStatus) calib3d_calibrateRobotWorldHandEye_OutputArray( + cv::Mat** R_world2camMats, int32_t R_world2camMatsSize, + cv::Mat** t_world2camMats, int32_t t_world2camMatsSize, + cv::Mat** R_base2gripperMats, int32_t R_base2gripperMatsSize, + cv::Mat** t_base2gripperMats, int32_t t_base2gripperMatsSize, + cv::_OutputArray* R_base2world, cv::_OutputArray* t_base2world, + cv::_OutputArray* R_gripper2cam, cv::_OutputArray* t_gripper2cam, + int32_t method) +{ + BEGIN_WRAP + std::vector R_gripper2base; + std::vector t_gripper2base; + std::vector R_target2cam; + std::vector t_target2cam; + toVec(R_world2camMats, R_world2camMatsSize, R_gripper2base); + toVec(t_world2camMats, t_world2camMatsSize, t_gripper2base); + toVec(R_base2gripperMats, R_base2gripperMatsSize, R_target2cam); + toVec(t_base2gripperMats, t_base2gripperMatsSize, t_target2cam); + cv::calibrateRobotWorldHandEye( + R_gripper2base, t_gripper2base, + R_target2cam, t_target2cam, + *R_base2world, *t_base2world, + *R_gripper2cam, *t_gripper2cam, + static_cast(method)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_calibrateRobotWorldHandEye_Pointer( + cv::Mat** R_world2camMats, int32_t R_world2camMatsSize, + cv::Mat** t_world2camMats, int32_t t_world2camMatsSize, + cv::Mat** R_base2gripperMats, int32_t R_base2gripperMatsSize, + cv::Mat** t_base2gripperMats, int32_t t_base2gripperMatsSize, + double* R_base2world, double* t_base2world, + double* R_gripper2cam, double* t_gripper2cam, + int32_t method) +{ + BEGIN_WRAP + std::vector R_gripper2base; + std::vector t_gripper2base; + std::vector R_target2cam; + std::vector t_target2cam; + toVec(R_world2camMats, R_world2camMatsSize, R_gripper2base); + toVec(t_world2camMats, t_world2camMatsSize, t_gripper2base); + toVec(R_base2gripperMats, R_base2gripperMatsSize, R_target2cam); + toVec(t_base2gripperMats, t_base2gripperMatsSize, t_target2cam); + cv::Matx33d R_base2worldM; + cv::Matx31d t_base2worldM; + cv::Matx33d R_gripper2camM; + cv::Matx31d t_gripper2camM; + cv::calibrateRobotWorldHandEye( + R_gripper2base, t_gripper2base, + R_target2cam, t_target2cam, + R_base2worldM, t_base2worldM, + R_gripper2camM, t_gripper2camM, + static_cast(method)); + + std::memcpy(R_base2world, R_base2worldM.val, 9 * sizeof(double)); + std::memcpy(t_base2world, t_base2worldM.val, 3 * sizeof(double)); + std::memcpy(R_gripper2cam, R_gripper2camM.val, 9 * sizeof(double)); + std::memcpy(t_gripper2cam, t_gripper2camM.val, 3 * sizeof(double)); - cvGetOptimalNewCameraMatrix(&cameraMatrixM, pdistCoeffsM, cpp(imageSize), - alpha, &newCameraMatrix, cpp(newImgSize), validPixROI, centerPrincipalPoint != 0); + END_WRAP } -CVAPI(void) calib3d_convertPointsToHomogeneous_InputArray(cv::_InputArray *src, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) calib3d_convertPointsToHomogeneous_InputArray(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::convertPointsToHomogeneous(*src, *dst); + END_WRAP } -CVAPI(void) calib3d_convertPointsToHomogeneous_array1(cv::Vec2f *src, cv::Vec3f *dst, int length) +CVAPI(ExceptionStatus) calib3d_convertPointsToHomogeneous_array1(cv::Vec2f *src, cv::Vec3f *dst, int length) { - cv::Mat srcMat(length, 1, CV_64FC2, src); + BEGIN_WRAP + const cv::Mat srcMat(length, 1, CV_64FC2, src); cv::Mat dstMat(length, 1, CV_64FC3, dst); cv::convertPointsFromHomogeneous(srcMat, dstMat); + END_WRAP } -CVAPI(void) calib3d_convertPointsToHomogeneous_array2(cv::Vec3f *src, cv::Vec4f *dst, int length) +CVAPI(ExceptionStatus) calib3d_convertPointsToHomogeneous_array2(cv::Vec3f *src, cv::Vec4f *dst, int length) { - cv::Mat srcMat(length, 1, CV_64FC3, src); + BEGIN_WRAP + const cv::Mat srcMat(length, 1, CV_64FC3, src); cv::Mat dstMat(length, 1, CV_64FC4, dst); cv::convertPointsFromHomogeneous(srcMat, dstMat); + END_WRAP } -CVAPI(void) calib3d_convertPointsFromHomogeneous_InputArray(cv::_InputArray *src, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) calib3d_convertPointsFromHomogeneous_InputArray(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::convertPointsFromHomogeneous(*src, *dst); + END_WRAP } -CVAPI(void) calib3d_convertPointsFromHomogeneous_array1(cv::Vec3f *src, cv::Vec2f *dst, int length) +CVAPI(ExceptionStatus) calib3d_convertPointsFromHomogeneous_array1(cv::Vec3f *src, cv::Vec2f *dst, int length) { - cv::Mat srcMat(length, 1, CV_64FC3, src); + BEGIN_WRAP + const cv::Mat srcMat(length, 1, CV_64FC3, src); cv::Mat dstMat(length, 1, CV_64FC2, dst); cv::convertPointsFromHomogeneous(srcMat, dstMat); + END_WRAP } -CVAPI(void) calib3d_convertPointsFromHomogeneous_array2(cv::Vec4f *src, cv::Vec3f *dst, int length) +CVAPI(ExceptionStatus) calib3d_convertPointsFromHomogeneous_array2(cv::Vec4f *src, cv::Vec3f *dst, int length) { - cv::Mat srcMat(length, 1, CV_64FC4, src); + BEGIN_WRAP + const cv::Mat srcMat(length, 1, CV_64FC4, src); cv::Mat dstMat(length, 1, CV_64FC3, dst); cv::convertPointsFromHomogeneous(srcMat, dstMat); + END_WRAP } -CVAPI(void) calib3d_convertPointsHomogeneous(cv::_InputArray *src, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) calib3d_convertPointsHomogeneous(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::convertPointsHomogeneous(*src, *dst); + END_WRAP } -CVAPI(cv::Mat*) calib3d_findFundamentalMat_InputArray( +CVAPI(ExceptionStatus) calib3d_findFundamentalMat_InputArray( cv::_InputArray *points1, cv::_InputArray *points2, int method, double param1, double param2, - cv::_OutputArray *mask) + cv::_OutputArray *mask, + cv::Mat **returnValue) { - cv::Mat mat = cv::findFundamentalMat( + BEGIN_WRAP + const auto mat = cv::findFundamentalMat( *points1, *points2, method, param1, param2, entity(mask)); - return new cv::Mat(mat); + *returnValue = new cv::Mat(mat); + END_WRAP } -CVAPI(cv::Mat*) calib3d_findFundamentalMat_array( +CVAPI(ExceptionStatus) calib3d_findFundamentalMat_arrayF64( cv::Point2d *points1, int points1Size, cv::Point2d *points2, int points2Size, int method, double param1, double param2, - cv::_OutputArray *mask) + cv::_OutputArray *mask, + cv::Mat **returnValue) { - cv::Mat points1M(points1Size, 1, CV_64FC2, points1); - cv::Mat points2M(points2Size, 1, CV_64FC2, points2); - cv::Mat mat = cv::findFundamentalMat( + BEGIN_WRAP + const cv::Mat points1M(points1Size, 1, CV_64FC2, points1); + const cv::Mat points2M(points2Size, 1, CV_64FC2, points2); + const auto mat = cv::findFundamentalMat( points1M, points2M, method, param1, param2, entity(mask)); - return new cv::Mat(mat); + *returnValue = new cv::Mat(mat); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_findFundamentalMat_arrayF32( + cv::Point2f *points1, int points1Size, + cv::Point2f *points2, int points2Size, + int method, double param1, double param2, + cv::_OutputArray *mask, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const cv::Mat points1M(points1Size, 1, CV_32FC2, points1); + const cv::Mat points2M(points2Size, 1, CV_32FC2, points2); + const auto mat = cv::findFundamentalMat( + points1M, points2M, method, param1, param2, entity(mask)); + *returnValue = new cv::Mat(mat); + END_WRAP } -CVAPI(void) calib3d_computeCorrespondEpilines_InputArray( +CVAPI(ExceptionStatus) calib3d_computeCorrespondEpilines_InputArray( cv::_InputArray *points, int whichImage, cv::_InputArray *F, cv::_OutputArray *lines) { + BEGIN_WRAP cv::computeCorrespondEpilines(*points, whichImage, *F, *lines); + END_WRAP } -CVAPI(void) calib3d_computeCorrespondEpilines_array2d( +CVAPI(ExceptionStatus) calib3d_computeCorrespondEpilines_array2d( cv::Point2d *points, int pointsSize, int whichImage, double *F, cv::Point3f *lines) { - cv::Mat_ pointsM(pointsSize, 1, points); - cv::Mat_ FM(3, 3, F); + BEGIN_WRAP + const cv::Mat_ pointsM(pointsSize, 1, points); + const cv::Mat_ FM(3, 3, F); cv::Mat_ linesM(pointsSize, 1, lines); cv::computeCorrespondEpilines(pointsM, whichImage, FM, linesM); + END_WRAP } -CVAPI(void) calib3d_computeCorrespondEpilines_array3d( +CVAPI(ExceptionStatus) calib3d_computeCorrespondEpilines_array3d( cv::Point3d *points, int pointsSize, int whichImage, double *F, cv::Point3f *lines) { - cv::Mat_ pointsM(pointsSize, 1, points); - cv::Mat_ FM(3, 3, F); + BEGIN_WRAP + const cv::Mat_ pointsM(pointsSize, 1, points); + const cv::Mat_ FM(3, 3, F); cv::Mat_ linesM(pointsSize, 1, lines); cv::computeCorrespondEpilines(pointsM, whichImage, FM, linesM); + END_WRAP } -CVAPI(void) calib3d_triangulatePoints_InputArray( +CVAPI(ExceptionStatus) calib3d_triangulatePoints_InputArray( cv::_InputArray *projMatr1, cv::_InputArray *projMatr2, cv::_InputArray *projPoints1, cv::_InputArray *projPoints2, cv::_OutputArray *points4D) { + BEGIN_WRAP cv::triangulatePoints(*projMatr1, *projMatr2, *projPoints1, *projPoints2, *points4D); + END_WRAP } -CVAPI(void) calib3d_triangulatePoints_array( +CVAPI(ExceptionStatus) calib3d_triangulatePoints_array( double *projMatr1, double *projMatr2, cv::Point2d *projPoints1, int projPoints1Size, cv::Point2d *projPoints2, int projPoints2Size, cv::Vec4d *points4D) { - cv::Mat_ projMatr1M(3, 4, projMatr1); - cv::Mat_ projMatr2M(3, 4, projMatr2); - cv::Mat_ projPoints1M(projPoints1Size, 1, projPoints1); - cv::Mat_ projPoints2M(projPoints2Size, 1, projPoints2); + BEGIN_WRAP + const cv::Mat_ projMatr1M(3, 4, projMatr1); + const cv::Mat_ projMatr2M(3, 4, projMatr2); + const cv::Mat_ projPoints1M(projPoints1Size, 1, projPoints1); + const cv::Mat_ projPoints2M(projPoints2Size, 1, projPoints2); cv::Mat_ points4DM(1, projPoints1Size, points4D); cv::triangulatePoints(projMatr1M, projMatr2M, projPoints1M, projPoints2M, points4DM); + END_WRAP } -CVAPI(void) calib3d_correctMatches_InputArray( +CVAPI(ExceptionStatus) calib3d_correctMatches_InputArray( cv::_InputArray *F, cv::_InputArray *points1, cv::_InputArray *points2, cv::_OutputArray *newPoints1, cv::_OutputArray *newPoints2) { + BEGIN_WRAP cv::correctMatches(*F, *points1, *points2, *newPoints1, *newPoints2); + END_WRAP } -CVAPI(void) calib3d_correctMatches_array(double *F, +CVAPI(ExceptionStatus) calib3d_correctMatches_array( + double *F, cv::Point2d *points1, int points1Size, cv::Point2d *points2, int points2Size, cv::Point2d *newPoints1, cv::Point2d *newPoints2) { + BEGIN_WRAP cv::Mat_ FM(3, 3, F); cv::Mat_ points1M(points1Size, 1, points1); cv::Mat_ points2M(points2Size, 1, points2); @@ -647,39 +988,248 @@ CVAPI(void) calib3d_correctMatches_array(double *F, cv::Mat_ newPoints1MM = points1M.reshape(2); cv::Mat_ newPoints2MM = points2M.reshape(2); cv::correctMatches(FM, points1MM, points2MM, newPoints1MM, newPoints2MM); + END_WRAP } -CVAPI(void) calib3d_filterSpeckles(cv::_InputOutputArray *img, double newVal, int maxSpeckleSize, double maxDiff, - cv::_InputOutputArray *buf) +CVAPI(ExceptionStatus) calib3d_filterSpeckles( + cv::_InputOutputArray *img, double newVal, int maxSpeckleSize, double maxDiff, cv::_InputOutputArray *buf) { + BEGIN_WRAP cv::filterSpeckles(*img, newVal, maxSpeckleSize, maxDiff, entity(buf)); + END_WRAP } -CVAPI(MyCvRect) calib3d_getValidDisparityROI(MyCvRect roi1, MyCvRect roi2, - int minDisparity, int numberOfDisparities, int SADWindowSize) +CVAPI(ExceptionStatus) calib3d_getValidDisparityROI( + MyCvRect roi1, MyCvRect roi2, + int minDisparity, int numberOfDisparities, int SADWindowSize, + MyCvRect *returnValue) { - return c(cv::getValidDisparityROI( + BEGIN_WRAP + *returnValue = c(cv::getValidDisparityROI( cpp(roi1), cpp(roi2), minDisparity, numberOfDisparities, SADWindowSize)); + END_WRAP } -CVAPI(void) calib3d_validateDisparity(cv::_InputOutputArray *disparity, cv::_InputArray *cost, +CVAPI(ExceptionStatus) calib3d_validateDisparity( + cv::_InputOutputArray *disparity, cv::_InputArray *cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp) { + BEGIN_WRAP cv::validateDisparity(*disparity, *cost, minDisparity, numberOfDisparities, disp12MaxDisp); + END_WRAP } -CVAPI(void) calib3d_reprojectImageTo3D(cv::_InputArray *disparity, cv::_OutputArray *_3dImage, +CVAPI(ExceptionStatus) calib3d_reprojectImageTo3D( + cv::_InputArray *disparity, cv::_OutputArray *_3dImage, cv::_InputArray *Q, int handleMissingValues, int ddepth) { + BEGIN_WRAP cv::reprojectImageTo3D(*disparity, *_3dImage, *Q, handleMissingValues != 0, ddepth); + END_WRAP } -CVAPI(int) calib3d_estimateAffine3D(cv::_InputArray *src, cv::_InputArray *dst, +CVAPI(ExceptionStatus) calib3d_estimateAffine3D(cv::_InputArray *src, cv::_InputArray *dst, cv::_OutputArray *out, cv::_OutputArray *inliers, - double ransacThreshold, double confidence) + double ransacThreshold, double confidence, + int *returnValue) { - return cv::estimateAffine3D(*src, *dst, *out, *inliers, ransacThreshold, confidence); + BEGIN_WRAP + *returnValue = cv::estimateAffine3D(*src, *dst, *out, *inliers, ransacThreshold, confidence); + END_WRAP } -#endif \ No newline at end of file + +CVAPI(ExceptionStatus) calib3d_sampsonDistance_InputArray( + cv::_InputArray *pt1, cv::_InputArray *pt2, cv::_InputArray *F, + double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::sampsonDistance(*pt1, *pt2, *F); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_sampsonDistance_Point3d( + MyCvPoint3D64f pt1, MyCvPoint3D64f pt2, MyCvPoint3D64f *F, + double *returnValue) +{ + BEGIN_WRAP + std::vector f(9); + for (size_t i = 0; i < 9; i++) + { + f[i] = cpp(F[i]); + } + *returnValue = cv::sampsonDistance(cv::Mat(cpp(pt1)), cv::Mat(cpp(pt2)), f); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_estimateAffine2D( + cv::_InputArray *from, cv::_InputArray *to, cv::_OutputArray *inliers, + int method, double ransacReprojThreshold, + uint64_t maxIters, double confidence, uint64_t refineIters, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto result = cv::estimateAffine2D( + *from, *to, entity(inliers), method, ransacReprojThreshold, static_cast(maxIters), confidence, static_cast(refineIters)); + *returnValue = new cv::Mat(result); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_estimateAffinePartial2D( + cv::_InputArray *from, cv::_InputArray *to, cv::_OutputArray *inliers, + int method, double ransacReprojThreshold, + uint64_t maxIters, double confidence, uint64_t refineIters, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto result = cv::estimateAffinePartial2D( + *from, *to, entity(inliers), method, ransacReprojThreshold, static_cast(maxIters), confidence, static_cast(refineIters)); + *returnValue = new cv::Mat(result); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_decomposeHomographyMat( + cv::_InputArray *H, + cv::_InputArray *K, + std::vector *rotations, + std::vector *translations, + std::vector *normals, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::decomposeHomographyMat(*H, *K, *rotations, *translations, *normals); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_filterHomographyDecompByVisibleRefpoints( + std::vector *rotations, + std::vector *normals, + cv::_InputArray *beforePoints, + cv::_InputArray *afterPoints, + cv::_OutputArray *possibleSolutions, + cv::_InputArray *pointsMask) +{ + BEGIN_WRAP + cv::filterHomographyDecompByVisibleRefpoints(*rotations, *normals, *beforePoints, *afterPoints, *possibleSolutions, entity(pointsMask)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_undistort( + cv::_InputArray *src, cv::_OutputArray *dst, + cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, cv::_InputArray *newCameraMatrix) +{ + BEGIN_WRAP + cv::undistort(*src, *dst, *cameraMatrix, entity(distCoeffs), entity(newCameraMatrix)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_initUndistortRectifyMap( + cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, + cv::_InputArray *R, cv::_InputArray *newCameraMatrix, + MyCvSize size, int m1type, cv::_OutputArray *map1, cv::_OutputArray *map2) +{ + BEGIN_WRAP + cv::initUndistortRectifyMap(*cameraMatrix, *distCoeffs, *R, *newCameraMatrix, cpp(size), m1type, *map1, *map2); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_initWideAngleProjMap( + cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, + MyCvSize imageSize, int destImageWidth, + int m1type, cv::_OutputArray *map1, cv::_OutputArray *map2, + int projType, double alpha, + float *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::initWideAngleProjMap(*cameraMatrix, *distCoeffs, cpp(imageSize), destImageWidth, m1type, + *map1, *map2, static_cast(projType), alpha); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_getDefaultNewCameraMatrix( + cv::_InputArray *cameraMatrix, MyCvSize imgsize, int centerPrincipalPoint, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto result = cv::getDefaultNewCameraMatrix(*cameraMatrix, cpp(imgsize), centerPrincipalPoint != 0); + *returnValue = new cv::Mat(result); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_undistortPoints( + cv::_InputArray *src, cv::_OutputArray *dst, + cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, + cv::_InputArray *R, cv::_InputArray *P) +{ + BEGIN_WRAP + cv::undistortPoints(*src, *dst, *cameraMatrix, *distCoeffs, entity(R), entity(P)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_undistortPointsIter( + cv::_InputArray *src, cv::_OutputArray *dst, + cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, + cv::_InputArray *R, cv::_InputArray *P, MyCvTermCriteria criteria) +{ + BEGIN_WRAP + cv::undistortPoints(*src, *dst, *cameraMatrix, *distCoeffs, entity(R), entity(P), cpp(criteria)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_recoverPose_InputArray1( + cv::_InputArray *E, cv::_InputArray *points1, cv::_InputArray *points2, + cv::_InputArray *cameraMatrix, + cv::_OutputArray *R, cv::_OutputArray *t, cv::_InputOutputArray *mask, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::recoverPose(*E, *points1, *points2, *cameraMatrix, *R, *t, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_recoverPose_InputArray2( + cv::_InputArray *E, cv::_InputArray *points1, cv::_InputArray *points2, + cv::_OutputArray *R, cv::_OutputArray *t, double focal, MyCvPoint2D64f pp, + cv::_InputOutputArray *mask, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::recoverPose(*E, *points1, *points2, *R, *t, focal, cpp(pp), entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_recoverPose_InputArray3( + cv::_InputArray *E, cv::_InputArray *points1, cv::_InputArray *points2, + cv::_InputArray *cameraMatrix, double distanceTresh, + cv::_OutputArray *R, cv::_OutputArray *t, cv::_InputOutputArray *mask, cv::_OutputArray *triangulatedPoints, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::recoverPose(*E, *points1, *points2, *cameraMatrix, *R, *t, distanceTresh, entity(mask), entity(triangulatedPoints)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_findEssentialMat_InputArray1( + cv::_InputArray *points1, cv::_InputArray *points2, cv::_InputArray *cameraMatrix, + int method, double prob, double threshold, + cv::_OutputArray *mask, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = cv::findEssentialMat( + *points1, *points2, *cameraMatrix, method, prob, threshold, entity(mask)); + *returnValue = new cv::Mat(mat); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_findEssentialMat_InputArray2( + cv::_InputArray *points1, cv::_InputArray *points2, double focal, MyCvPoint2D64f pp, + int method, double prob, double threshold, + cv::_OutputArray *mask, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = cv::findEssentialMat( + *points1, *points2, focal, cpp(pp), method, prob, threshold, entity(mask)); + *returnValue = new cv::Mat(mat); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/calib3d_StereoBM.h b/src/OpenCvSharpExtern/calib3d_StereoBM.h deleted file mode 100644 index 3ee295870..000000000 --- a/src/OpenCvSharpExtern/calib3d_StereoBM.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef _CPP_CALIB3D_STEREOBM_H_ -#define _CPP_CALIB3D_STEREOBM_H_ - -#include "include_opencv.h" - -CVAPI(cv::StereoBM*) calib3d_Ptr_StereoBM_get( - cv::Ptr *obj) -{ - return obj->get(); -} - -CVAPI(void) calib3d_Ptr_StereoBM_delete(cv::Ptr *obj) -{ - delete obj; -} - -CVAPI(cv::Ptr*) calib3d_StereoBM_create(int numDisparities, int blockSize) -{ - cv::Ptr obj = cv::StereoBM::create(numDisparities, blockSize); - return new cv::Ptr(obj); -} - -CVAPI(int) calib3d_StereoBM_getPreFilterType(cv::Ptr *obj) -{ - return (*obj)->getPreFilterType(); -} -CVAPI(void) calib3d_StereoBM_setPreFilterType(cv::Ptr *obj, int value) -{ - (*obj)->setPreFilterType(value); -} - -CVAPI(int) calib3d_StereoBM_getPreFilterSize(cv::Ptr *obj) -{ - return (*obj)->getPreFilterSize(); -} -CVAPI(void) calib3d_StereoBM_setPreFilterSize(cv::Ptr *obj, int value) -{ - (*obj)->setPreFilterSize(value); -} - -CVAPI(int) calib3d_StereoBM_getPreFilterCap(cv::Ptr *obj) -{ - return (*obj)->getPreFilterCap(); -} -CVAPI(void) calib3d_StereoBM_setPreFilterCap(cv::Ptr *obj, int value) -{ - (*obj)->setPreFilterCap(value); -} - -CVAPI(int) calib3d_StereoBM_getTextureThreshold(cv::Ptr *obj) -{ - return (*obj)->getTextureThreshold(); -} -CVAPI(void) calib3d_StereoBM_setTextureThreshold(cv::Ptr *obj, int value) -{ - (*obj)->setTextureThreshold(value); -} - -CVAPI(int) calib3d_StereoBM_getUniquenessRatio(cv::Ptr *obj) -{ - return (*obj)->getUniquenessRatio(); -} -CVAPI(void) calib3d_StereoBM_setUniquenessRatio(cv::Ptr *obj, int value) -{ - (*obj)->setUniquenessRatio(value); -} - -CVAPI(int) calib3d_StereoBM_getSmallerBlockSize(cv::Ptr *obj) -{ - return (*obj)->getSmallerBlockSize(); -} -CVAPI(void) calib3d_StereoBM_setSmallerBlockSize(cv::Ptr *obj, int value) -{ - (*obj)->setSmallerBlockSize(value); -} - -CVAPI(MyCvRect) calib3d_StereoBM_getROI1(cv::Ptr *obj) -{ - return c((*obj)->getROI1()); -} -CVAPI(void) calib3d_StereoBM_setROI1(cv::Ptr *obj, MyCvRect value) -{ - (*obj)->setROI1(cpp(value)); -} - -CVAPI(MyCvRect) calib3d_StereoBM_getROI2(cv::Ptr *obj) -{ - return c((*obj)->getROI2()); -} -CVAPI(void) calib3d_StereoBM_setROI2(cv::Ptr *obj, MyCvRect value) -{ - (*obj)->setROI2(cpp(value)); -} - - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/calib3d_StereoMatcher.h b/src/OpenCvSharpExtern/calib3d_StereoMatcher.h index 789578b61..b11d7e116 100644 --- a/src/OpenCvSharpExtern/calib3d_StereoMatcher.h +++ b/src/OpenCvSharpExtern/calib3d_StereoMatcher.h @@ -1,67 +1,359 @@ -#ifndef _CPP_CALIB3D_STEREOMATCHER_H_ -#define _CPP_CALIB3D_STEREOMATCHER_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" +#pragma region StereoMatcher -CVAPI(void) calib3d_StereoMatcher_compute( +CVAPI(ExceptionStatus) calib3d_StereoMatcher_compute( cv::Ptr *obj, cv::_InputArray *left, cv::_InputArray *right, cv::_OutputArray *disparity) { + BEGIN_WRAP (*obj)->compute(*left, *right, *disparity); + END_WRAP } -CVAPI(int) calib3d_StereoMatcher_getMinDisparity(cv::Ptr *obj) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_getMinDisparity( + cv::Ptr *obj, int *returnValue) { - return (*obj)->getMinDisparity(); + BEGIN_WRAP + *returnValue = (*obj)->getMinDisparity(); + END_WRAP } -CVAPI(void) calib3d_StereoMatcher_setMinDisparity(cv::Ptr *obj, int value) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_setMinDisparity( + cv::Ptr *obj, int value) { + BEGIN_WRAP (*obj)->setMinDisparity(value); + END_WRAP } -CVAPI(int) calib3d_StereoMatcher_getNumDisparities(cv::Ptr *obj) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_getNumDisparities( + cv::Ptr *obj, int *returnValue) { - return (*obj)->getNumDisparities(); + BEGIN_WRAP + *returnValue = (*obj)->getNumDisparities(); + END_WRAP } -CVAPI(void) calib3d_StereoMatcher_setNumDisparities(cv::Ptr *obj, int value) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_setNumDisparities( + cv::Ptr *obj, int value) { + BEGIN_WRAP (*obj)->setNumDisparities(value); + END_WRAP } -CVAPI(int) calib3d_StereoMatcher_getBlockSize(cv::Ptr *obj) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_getBlockSize( + cv::Ptr *obj, int *returnValue) { - return (*obj)->getBlockSize(); + BEGIN_WRAP + *returnValue = (*obj)->getBlockSize(); + END_WRAP } -CVAPI(void) calib3d_StereoMatcher_setBlockSize(cv::Ptr *obj, int value) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_setBlockSize( + cv::Ptr *obj, int value) { + BEGIN_WRAP (*obj)->setBlockSize(value); + END_WRAP } -CVAPI(int) calib3d_StereoMatcher_getSpeckleWindowSize(cv::Ptr *obj) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_getSpeckleWindowSize( + cv::Ptr *obj, int *returnValue) { - return (*obj)->getSpeckleWindowSize(); + BEGIN_WRAP + *returnValue = (*obj)->getSpeckleWindowSize(); + END_WRAP } -CVAPI(void) calib3d_StereoMatcher_setSpeckleWindowSize(cv::Ptr *obj, int value) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_setSpeckleWindowSize( + cv::Ptr *obj, int value) { + BEGIN_WRAP (*obj)->setSpeckleWindowSize(value); + END_WRAP } -CVAPI(int) calib3d_StereoMatcher_getSpeckleRange(cv::Ptr *obj) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_getSpeckleRange( + cv::Ptr *obj, int *returnValue) { - return (*obj)->getSpeckleRange(); + BEGIN_WRAP + *returnValue = (*obj)->getSpeckleRange(); + END_WRAP } -CVAPI(void) calib3d_StereoMatcher_setSpeckleRange(cv::Ptr *obj, int value) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_setSpeckleRange( + cv::Ptr *obj, int value) { + BEGIN_WRAP (*obj)->setSpeckleRange(value); + END_WRAP } -CVAPI(int) calib3d_StereoMatcher_getDisp12MaxDiff(cv::Ptr *obj) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_getDisp12MaxDiff( + cv::Ptr *obj, int *returnValue) { - return (*obj)->getDisp12MaxDiff(); + BEGIN_WRAP + *returnValue = (*obj)->getDisp12MaxDiff(); + END_WRAP } -CVAPI(void) calib3d_StereoMatcher_setDisp12MaxDiff(cv::Ptr *obj, int value) +CVAPI(ExceptionStatus) calib3d_StereoMatcher_setDisp12MaxDiff( + cv::Ptr *obj, int value) { + BEGIN_WRAP (*obj)->setDisp12MaxDiff(value); + END_WRAP +} + +#pragma endregion + +#pragma region StereoBM + +CVAPI(ExceptionStatus) calib3d_Ptr_StereoBM_get( + cv::Ptr *obj, cv::StereoBM **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_Ptr_StereoBM_delete( + cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_create( + int numDisparities, int blockSize, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto obj = cv::StereoBM::create(numDisparities, blockSize); + *returnValue = clone(obj); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getPreFilterType( + cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getPreFilterType(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setPreFilterType( + cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setPreFilterType(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getPreFilterSize( + cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getPreFilterSize(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setPreFilterSize( + cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setPreFilterSize(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getPreFilterCap( + cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getPreFilterCap(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setPreFilterCap( + cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setPreFilterCap(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getTextureThreshold( + cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getTextureThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setTextureThreshold( + cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setTextureThreshold(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getUniquenessRatio( + cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getUniquenessRatio(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setUniquenessRatio( + cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setUniquenessRatio(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getSmallerBlockSize( + cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getSmallerBlockSize(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setSmallerBlockSize( + cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setSmallerBlockSize(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getROI1( + cv::Ptr *obj, MyCvRect *returnValue) +{ + BEGIN_WRAP + *returnValue = c((*obj)->getROI1()); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setROI1( + cv::Ptr *obj, MyCvRect value) +{ + BEGIN_WRAP + (*obj)->setROI1(cpp(value)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoBM_getROI2( + cv::Ptr *obj, MyCvRect *returnValue) +{ + BEGIN_WRAP + *returnValue = c((*obj)->getROI2()); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoBM_setROI2( + cv::Ptr *obj, MyCvRect value) +{ + BEGIN_WRAP + (*obj)->setROI2(cpp(value)); + END_WRAP +} + +#pragma endregion + +#pragma region StereoSGBM + +CVAPI(ExceptionStatus) calib3d_Ptr_StereoSGBM_get( + cv::Ptr *obj, cv::StereoSGBM **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_Ptr_StereoSGBM_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoSGBM_create( + int minDisparity, int numDisparities, int blockSize, + int P1, int P2, int disp12MaxDiff, + int preFilterCap, int uniquenessRatio, + int speckleWindowSize, int speckleRange, int mode, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto obj = cv::StereoSGBM::create( + minDisparity, numDisparities, blockSize, + P1, P2, disp12MaxDiff, + preFilterCap, uniquenessRatio, + speckleWindowSize, speckleRange, mode); + *returnValue = new cv::Ptr(obj); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoSGBM_getPreFilterCap(cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getPreFilterCap(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoSGBM_setPreFilterCap(cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setPreFilterCap(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoSGBM_getUniquenessRatio(cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getUniquenessRatio(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoSGBM_setUniquenessRatio(cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setUniquenessRatio(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoSGBM_getP1(cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getP1(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoSGBM_setP1(cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setP1(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoSGBM_getP2(cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getP2(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoSGBM_setP2(cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setP2(value); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_StereoSGBM_getMode(cv::Ptr *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*obj)->getMode(); + END_WRAP +} +CVAPI(ExceptionStatus) calib3d_StereoSGBM_setMode(cv::Ptr *obj, int value) +{ + BEGIN_WRAP + (*obj)->setMode(value); + END_WRAP } -#endif \ No newline at end of file +#pragma endregion diff --git a/src/OpenCvSharpExtern/calib3d_StereoSGBM.h b/src/OpenCvSharpExtern/calib3d_StereoSGBM.h deleted file mode 100644 index 5631e641e..000000000 --- a/src/OpenCvSharpExtern/calib3d_StereoSGBM.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _CPP_CALIB3D_STEREOSGBM_H_ -#define _CPP_CALIB3D_STEREOSGBM_H_ - -#include "include_opencv.h" - -CVAPI(cv::StereoSGBM*) calib3d_Ptr_StereoSGBM_get( - cv::Ptr *obj) -{ - return obj->get(); -} - -CVAPI(void) calib3d_Ptr_StereoSGBM_delete(cv::Ptr *obj) -{ - delete obj; -} - -CVAPI(cv::Ptr*) calib3d_StereoSGBM_create( - int minDisparity, int numDisparities, int blockSize, - int P1, int P2, int disp12MaxDiff, - int preFilterCap, int uniquenessRatio, - int speckleWindowSize, int speckleRange, int mode) -{ - cv::Ptr obj = cv::StereoSGBM::create( - minDisparity, numDisparities, blockSize, - P1, P2, disp12MaxDiff, - preFilterCap, uniquenessRatio, - speckleWindowSize, speckleRange, mode); - return new cv::Ptr(obj); -} - -CVAPI(int) calib3d_StereoSGBM_getPreFilterCap(cv::Ptr *obj) -{ - return (*obj)->getPreFilterCap(); -} -CVAPI(void) calib3d_StereoSGBM_setPreFilterCap(cv::Ptr *obj, int value) -{ - (*obj)->setPreFilterCap(value); -} - -CVAPI(int) calib3d_StereoSGBM_getUniquenessRatio(cv::Ptr *obj) -{ - return (*obj)->getUniquenessRatio(); -} -CVAPI(void) calib3d_StereoSGBM_setUniquenessRatio(cv::Ptr *obj, int value) -{ - (*obj)->setUniquenessRatio(value); -} - -CVAPI(int) calib3d_StereoSGBM_getP1(cv::Ptr *obj) -{ - return (*obj)->getP1(); -} -CVAPI(void) calib3d_StereoSGBM_setP1(cv::Ptr *obj, int value) -{ - (*obj)->setP1(value); -} - -CVAPI(int) calib3d_StereoSGBM_getP2(cv::Ptr *obj) -{ - return (*obj)->getP2(); -} -CVAPI(void) calib3d_StereoSGBM_setP2(cv::Ptr *obj, int value) -{ - (*obj)->setP2(value); -} - -CVAPI(int) calib3d_StereoSGBM_getMode(cv::Ptr *obj) -{ - return (*obj)->getMode(); -} -CVAPI(void) calib3d_StereoSGBM_setMode(cv::Ptr *obj, int value) -{ - (*obj)->setMode(value); -} - - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/calib3d_fisheye.h b/src/OpenCvSharpExtern/calib3d_fisheye.h new file mode 100644 index 000000000..f17b325f6 --- /dev/null +++ b/src/OpenCvSharpExtern/calib3d_fisheye.h @@ -0,0 +1,122 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +/*CVAPI(ExceptionStatus) calib3d_fisheye_projectPoints1( + cv::_InputArray *objectPoints, cv::_OutputArray *imagePoints, const cv::Affine3d& affine, + cv::_InputArray *K, cv::_InputArray *D, double alpha, cv::_OutputArray *jacobian) +{ + BEGIN_WRAP + cv::fisheye::projectPoints(*objectPoints, *imagePoints, affine, *K, *D, alpha, entity(jacobian)); + END_WRAP +}*/ + +CVAPI(ExceptionStatus) calib3d_fisheye_projectPoints2( + cv::_InputArray *objectPoints, cv::_OutputArray *imagePoints, cv::_InputArray *rvec, cv::_InputArray *tvec, + cv::_InputArray *K, cv::_InputArray *D, double alpha, cv::_OutputArray *jacobian) +{ + BEGIN_WRAP + cv::fisheye::projectPoints(*objectPoints, *imagePoints, *rvec, *tvec, *K, *D, alpha, entity(jacobian)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_distortPoints( + cv::_InputArray *undistorted, cv::_OutputArray *distorted, cv::_InputArray *K, cv::_InputArray *D, double alpha) +{ + BEGIN_WRAP + cv::fisheye::distortPoints(*undistorted, *distorted, *K, *D, alpha); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_undistortPoints( + cv::_InputArray *distorted, cv::_OutputArray *undistorted, + cv::_InputArray *K, cv::_InputArray *D, cv::_InputArray *R, cv::_InputArray *P) +{ + BEGIN_WRAP + cv::fisheye::undistortPoints(*distorted, *undistorted, *K, *D, entity(R), entity(P)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_initUndistortRectifyMap( + cv::_InputArray *K, cv::_InputArray *D, cv::_InputArray *R, cv::_InputArray *P, + MyCvSize size, int m1type, cv::_OutputArray *map1, cv::_OutputArray *map2) +{ + BEGIN_WRAP + cv::fisheye::initUndistortRectifyMap(*K, *D, *R, *P, cpp(size), m1type, *map1, *map2); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_undistortImage( + cv::_InputArray *distorted, cv::_OutputArray *undistorted, + cv::_InputArray *K, cv::_InputArray *D, cv::_InputArray *Knew, MyCvSize newSize) +{ + BEGIN_WRAP + cv::fisheye::undistortImage(*distorted, *undistorted, *K, *D, entity(Knew), cpp(newSize)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_estimateNewCameraMatrixForUndistortRectify( + cv::_InputArray *K, cv::_InputArray *D, MyCvSize image_size, cv::_InputArray *R, + cv::_OutputArray *P, double balance, MyCvSize newSize, double fov_scale) +{ + BEGIN_WRAP + cv::fisheye::estimateNewCameraMatrixForUndistortRectify(*K, *D, cpp(image_size), *R, *P, balance, cpp(newSize), fov_scale); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_calibrate( + std::vector *objectPoints, + std::vector *imagePoints, + MyCvSize imageSize, + cv::_InputOutputArray *K, + cv::_InputOutputArray *D, + std::vector *rvecs, + std::vector *tvecs, + int flags, + MyCvTermCriteria criteria, + double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::fisheye::calibrate( + *objectPoints, *imagePoints, cpp(imageSize), + *K, *D, *rvecs, *tvecs, flags, cpp(criteria)); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_stereoRectify( + cv::_InputArray *K1, cv::_InputArray *D1, cv::_InputArray *K2, cv::_InputArray *D2, MyCvSize imageSize, cv::_InputArray *R, cv::_InputArray *tvec, + cv::_OutputArray *R1, cv::_OutputArray *R2, cv::_OutputArray *P1, cv::_OutputArray *P2, cv::_OutputArray *Q, int flags, MyCvSize newImageSize, + double balance, double fov_scale) +{ + BEGIN_WRAP + cv::fisheye::stereoRectify(*K1, *D1, *K2, *D2, cpp(imageSize), *R, *tvec, *R1, *R2, *P1, *P2, *Q, flags, cpp(newImageSize), balance, fov_scale); + END_WRAP +} + +CVAPI(ExceptionStatus) calib3d_fisheye_stereoCalibrate( + std::vector *objectPoints, + std::vector *imagePoints1, + std::vector *imagePoints2, + cv::_InputOutputArray *K1, + cv::_InputOutputArray *D1, + cv::_InputOutputArray *K2, + cv::_InputOutputArray *D2, + MyCvSize imageSize, + cv::_OutputArray *R, + cv::_OutputArray *T, + int flags, + MyCvTermCriteria criteria, + double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::fisheye::stereoCalibrate( + *objectPoints, *imagePoints1, *imagePoints2, + *K1, *D1, + *K2, *D2, + cpp(imageSize), entity(R), entity(T), flags, cpp(criteria)); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/core.cpp b/src/OpenCvSharpExtern/core.cpp index 029326363..477559082 100644 --- a/src/OpenCvSharpExtern/core.cpp +++ b/src/OpenCvSharpExtern/core.cpp @@ -1,12 +1,14 @@ +// ReSharper disable CppUnusedIncludeDirective #include "core.h" - #include "core_Algorithm.h" #include "core_FileStorage.h" +#include "core_FileNode.h" #include "core_InputArray.h" #include "core_Mat.h" +#include "core_UMat.h" #include "core_MatExpr.h" #include "core_OutputArray.h" #include "core_PCA.h" -#include "core_RNG.h" #include "core_SparseMat.h" #include "core_SVD.h" +#include "core_LDA.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/core.h b/src/OpenCvSharpExtern/core.h index 2ff1f4068..152c76810 100644 --- a/src/OpenCvSharpExtern/core.h +++ b/src/OpenCvSharpExtern/core.h @@ -1,622 +1,1109 @@ -#ifndef _CPP_CORE_H_ -#define _CPP_CORE_H_ +#pragma once #include "include_opencv.h" -#pragma region Miscellaneous +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile -CVAPI(void) core_setNumThreads(int nthreads) -{ - cv::setNumThreads(nthreads); -} -CVAPI(int) core_getNumThreads() -{ - return cv::getNumThreads(); -} -CVAPI(int) core_getThreadNum() -{ - return cv::getThreadNum(); -} - -CVAPI(void) core_getBuildInformation(char *buf, int maxLength) -{ - const cv::String &str = cv::getBuildInformation(); - copyString(str, buf, maxLength); -} -CVAPI(int) core_getBuildInformation_length() -{ - const cv::String &str = cv::getBuildInformation(); - return static_cast(str.length()); -} - -CVAPI(int64) core_getTickCount() -{ - return cv::getTickCount(); -} -CVAPI(double) core_getTickFrequency() -{ - return cv::getTickFrequency(); -} -CVAPI(int64) core_getCPUTickCount() -{ - return cv::getCPUTickCount(); -} +#pragma region core.hpp -CVAPI(int) core_checkHardwareSupport(int feature) -{ - return cv::checkHardwareSupport(feature) ? 1 : 0; -} -CVAPI(int) core_getNumberOfCPUs() +CVAPI(MyCvBox2D) core_RotatedRect_byThreeVertexPoints( + MyCvPoint2D32f p1, MyCvPoint2D32f p2, MyCvPoint2D32f p3) { - return cv::getNumberOfCPUs(); + return c( + cv::RotatedRect(cpp(p1), cpp(p2), cpp(p3))); } -CVAPI(void*) core_fastMalloc(size_t bufSize) +CVAPI(ExceptionStatus) core_borderInterpolate(int p, int len, int borderType, int* returnValue) { - return cv::fastMalloc(bufSize); -} -CVAPI(void) core_fastFree(void *ptr) -{ - return cv::fastFree(ptr); + BEGIN_WRAP + *returnValue = cv::borderInterpolate(p, len, borderType); + END_WRAP } -CVAPI(void) core_setUseOptimized(int onoff) +CVAPI(ExceptionStatus) core_copyMakeBorder( + cv::_InputArray* src, cv::_OutputArray* dst, int top, int bottom, int left, int right, int borderType, MyCvScalar value) { - cv::setUseOptimized(onoff != 0); -} -CVAPI(int) core_useOptimized() -{ - return cv::useOptimized() ? 1 : 0; + BEGIN_WRAP + cv::copyMakeBorder(*src, *dst, top, bottom, left, right, borderType, cpp(value)); + END_WRAP } -CVAPI(cv::ErrorCallback) redirectError(cv::ErrorCallback errCallback, void* userdata, void** prevUserdata) +CVAPI(ExceptionStatus) core_add( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask, int dtype) { - return cv::redirectError(errCallback, userdata, prevUserdata); + BEGIN_WRAP + cv::add(*src1, *src2, *dst, entity(mask), dtype); + END_WRAP } -CVAPI(cv::Mat*) core_cvarrToMat(CvArr *arr, int copyData, int allowND, int coiMode) +CVAPI(ExceptionStatus) core_subtract_InputArray2( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask, int dtype) { - cv::Mat ret = cv::cvarrToMat(arr, copyData != 0, allowND != 0, coiMode); - return new cv::Mat(ret); + BEGIN_WRAP + cv::subtract(*src1, *src2, *dst, entity(mask), dtype); + END_WRAP } -CVAPI(void) core_extractImageCOI(CvArr *arr, cv::_OutputArray *coiimg, int coi) +CVAPI(ExceptionStatus) core_subtract_InputArrayScalar( + cv::_InputArray *src1, MyCvScalar src2, cv::_OutputArray *dst, cv::_InputArray *mask, int dtype) { - cv::extractImageCOI(arr, *coiimg, coi); + BEGIN_WRAP + cv::subtract(*src1, cpp(src2), *dst, entity(mask), dtype); + END_WRAP } -CVAPI(void) core_insertImageCOI(cv::_InputArray *coiimg, CvArr *arr, int coi) +CVAPI(ExceptionStatus) core_subtract_ScalarInputArray( + MyCvScalar src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask, int dtype) { - cv::insertImageCOI(*coiimg, arr, coi); + BEGIN_WRAP + cv::subtract(cpp(src1), *src2, *dst, entity(mask), dtype); + END_WRAP } -#pragma endregion - -#pragma region Array Operations -CVAPI(void) core_add(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask, int dtype) -{ - cv::add(*src1, *src2, *dst, entity(mask), dtype); -} -CVAPI(void) core_subtract(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask, int dtype) -{ - cv::subtract(*src1, *src2, *dst, entity(mask), dtype); -} -CVAPI(void) core_multiply(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, double scale, int dtype) +CVAPI(ExceptionStatus) core_multiply( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, double scale, int dtype) { + BEGIN_WRAP cv::multiply(*src1, *src2, *dst, scale, dtype); + END_WRAP } -CVAPI(void) core_divide1(double scale, cv::_InputArray *src2, cv::_OutputArray *dst, int dtype) +CVAPI(ExceptionStatus) core_divide1( + double scale, cv::_InputArray *src2, cv::_OutputArray *dst, int dtype) { + BEGIN_WRAP cv::divide(scale, *src2, *dst, dtype); + END_WRAP } -CVAPI(void) core_divide2(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, double scale, int dtype) +CVAPI(ExceptionStatus) core_divide2( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, double scale, int dtype) { - cv::divide(*src1, *src2, *dst); + BEGIN_WRAP + cv::divide(*src1, *src2, *dst, scale, dtype); + END_WRAP } -CVAPI(void) core_scaleAdd(cv::_InputArray *src1, double alpha, cv::_InputArray *src2, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_scaleAdd(cv::_InputArray *src1, double alpha, cv::_InputArray *src2, cv::_OutputArray *dst) { + BEGIN_WRAP cv::scaleAdd(*src1, alpha, *src2, *dst); + END_WRAP } -CVAPI(void) core_addWeighted(cv::_InputArray *src1, double alpha, cv::_InputArray *src2, - double beta, double gamma, cv::_OutputArray *dst, int dtype) +CVAPI(ExceptionStatus) core_addWeighted(cv::_InputArray *src1, double alpha, cv::_InputArray *src2, + double beta, double gamma, cv::_OutputArray *dst, int dtype) { + BEGIN_WRAP cv::addWeighted(*src1, alpha, *src2, beta, gamma, *dst, dtype); + END_WRAP } -#pragma endregion - - -CVAPI(void) core_convertScaleAbs(cv::_InputArray *src, cv::_OutputArray *dst, double alpha, double beta) +CVAPI(ExceptionStatus) core_convertScaleAbs(cv::_InputArray* src, cv::_OutputArray* dst, double alpha, double beta) { + BEGIN_WRAP cv::convertScaleAbs(*src, *dst, alpha, beta); + END_WRAP +} + +CVAPI(ExceptionStatus) core_convertFp16(cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + cv::convertFp16(*src, *dst); + END_WRAP } -CVAPI(void) core_LUT(cv::_InputArray *src, cv::_InputArray *lut, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_LUT(cv::_InputArray* src, cv::_InputArray* lut, cv::_OutputArray* dst) { + BEGIN_WRAP cv::LUT(*src, *lut, *dst); + END_WRAP } -CVAPI(MyCvScalar) core_sum(cv::_InputArray *src) + +CVAPI(ExceptionStatus) core_sum(cv::_InputArray* src, MyCvScalar* returnValue) { - return c(cv::sum(*src)); + BEGIN_WRAP + *returnValue = c(cv::sum(*src)); + END_WRAP } -CVAPI(int) core_countNonZero(cv::_InputArray *src) + +CVAPI(ExceptionStatus) core_countNonZero(cv::_InputArray* src, int* returnValue) { - return cv::countNonZero(*src); + BEGIN_WRAP + *returnValue = cv::countNonZero(*src); + END_WRAP } -CVAPI(void) core_findNonZero(cv::_InputArray *src, cv::_OutputArray *idx) + +CVAPI(ExceptionStatus) core_findNonZero(cv::_InputArray* src, cv::_OutputArray* idx) { + BEGIN_WRAP cv::findNonZero(*src, *idx); + END_WRAP } -CVAPI(MyCvScalar) core_mean(cv::_InputArray *src, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_mean(cv::_InputArray* src, cv::_InputArray* mask, MyCvScalar* returnValue) { - return c(cv::mean(*src, entity(mask))); + BEGIN_WRAP + *returnValue = c(cv::mean(*src, entity(mask))); + END_WRAP } -CVAPI(void) core_meanStdDev_OutputArray( - cv::_InputArray *src, cv::_OutputArray *mean, cv::_OutputArray *stddev, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_meanStdDev_OutputArray( + cv::_InputArray* src, cv::_OutputArray* mean, cv::_OutputArray* stddev, cv::_InputArray* mask) { + BEGIN_WRAP cv::meanStdDev(*src, *mean, *stddev, entity(mask)); + END_WRAP } -CVAPI(void) core_meanStdDev_Scalar( - cv::_InputArray *src, MyCvScalar *mean, MyCvScalar *stddev, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_meanStdDev_Scalar( + cv::_InputArray* src, MyCvScalar* mean, MyCvScalar* stddev, cv::_InputArray* mask) { + BEGIN_WRAP cv::Scalar mean0, stddev0; cv::meanStdDev(*src, mean0, stddev0, entity(mask)); *mean = c(mean0); *stddev = c(stddev0); + END_WRAP } -CVAPI(double) core_norm1(cv::_InputArray *src1, int normType, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_norm1( + cv::_InputArray* src1, int normType, cv::_InputArray* mask, double *returnValue) +{ + BEGIN_WRAP; + *returnValue = cv::norm(*src1, normType, entity(mask)); + END_WRAP +} +CVAPI(ExceptionStatus) core_norm2( + cv::_InputArray* src1, cv::_InputArray* src2, + int normType, cv::_InputArray* mask, double* returnValue) { - return cv::norm(*src1, normType, entity(mask)); + BEGIN_WRAP; + *returnValue = cv::norm(*src1, *src2, normType, entity(mask)); + END_WRAP; } -CVAPI(double) core_norm2(cv::_InputArray *src1, cv::_InputArray *src2, - int normType, cv::_InputArray *mask) + +CVAPI(ExceptionStatus) core_PSNR(cv::_InputArray* src1, cv::_InputArray* src2, double R, double* returnValue) { - return cv::norm(*src1, *src2, normType, entity(mask)); + BEGIN_WRAP + *returnValue = cv::PSNR(*src1, *src2, R); + END_WRAP } -CVAPI(void) core_batchDistance(cv::_InputArray *src1, cv::_InputArray *src2, - cv::_OutputArray *dist, int dtype, cv::_OutputArray *nidx, - int normType, int K, cv::_InputArray *mask, - int update, int crosscheck) +CVAPI(ExceptionStatus) core_batchDistance( + cv::_InputArray* src1, cv::_InputArray* src2, + cv::_OutputArray* dist, int dtype, cv::_OutputArray* nidx, + int normType, int K, cv::_InputArray* mask, + int update, int crosscheck) { - cv::batchDistance(*src1, *src2, *dist, dtype, *nidx, normType, K, entity(mask), update, crosscheck != 0); + BEGIN_WRAP + cv::batchDistance( + *src1, *src2, *dist, dtype, *nidx, normType, K, entity(mask), update, crosscheck != 0); + END_WRAP } -CVAPI(void) core_normalize(cv::_InputArray *src, cv::_InputOutputArray *dst, double alpha, double beta, - int normType, int dtype, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_normalize( + cv::_InputArray* src, cv::_InputOutputArray* dst, double alpha, double beta, int normType, int dtype, cv::_InputArray* mask) { + BEGIN_WRAP cv::InputArray maskVal = entity(mask); cv::normalize(*src, *dst, alpha, beta, normType, dtype, maskVal); + END_WRAP +} + +CVAPI(ExceptionStatus) core_reduceArgMax(cv::_InputArray* src, cv::_OutputArray* dst, int axis, bool lastIndex) +{ + BEGIN_WRAP + cv::reduceArgMax(*src, *dst, axis, lastIndex); + END_WRAP +} + +CVAPI(ExceptionStatus) core_reduceArgMin(cv::_InputArray* src, cv::_OutputArray* dst, int axis, bool lastIndex) +{ + BEGIN_WRAP + cv::reduceArgMin(*src, *dst, axis, lastIndex); + END_WRAP } -CVAPI(void) core_minMaxLoc1(cv::_InputArray *src, double *minVal, double *maxVal) +CVAPI(ExceptionStatus) core_minMaxLoc1(cv::_InputArray* src, double* minVal, double* maxVal) { + BEGIN_WRAP cv::minMaxLoc(*src, minVal, maxVal); + END_WRAP } -CVAPI(void) core_minMaxLoc2(cv::_InputArray *src, double *minVal, double *maxVal, - CvPoint *minLoc, CvPoint *maxLoc, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_minMaxLoc2(cv::_InputArray* src, double* minVal, double* maxVal, + MyCvPoint* minLoc, MyCvPoint* maxLoc, cv::_InputArray* mask) { + BEGIN_WRAP cv::InputArray maskVal = entity(mask); cv::Point minLoc0, maxLoc0; cv::minMaxLoc(*src, minVal, maxVal, &minLoc0, &maxLoc0, maskVal); - *minLoc = minLoc0; - *maxLoc = maxLoc0; + *minLoc = c(minLoc0); + *maxLoc = c(maxLoc0); + END_WRAP } -CVAPI(void) core_minMaxIdx1(cv::_InputArray *src, double *minVal, double *maxVal) + +CVAPI(ExceptionStatus) core_minMaxIdx1(cv::_InputArray* src, double* minVal, double* maxVal) { + BEGIN_WRAP cv::minMaxIdx(*src, minVal, maxVal); + END_WRAP } -CVAPI(void) core_minMaxIdx2(cv::_InputArray *src, double *minVal, double *maxVal, - int *minIdx, int *maxIdx, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_minMaxIdx2(cv::_InputArray* src, double* minVal, double* maxVal, + int* minIdx, int* maxIdx, cv::_InputArray* mask) { + BEGIN_WRAP cv::InputArray maskVal = entity(mask); cv::minMaxIdx(*src, minVal, maxVal, minIdx, maxIdx, maskVal); + END_WRAP } -CVAPI(void) core_reduce(cv::_InputArray *src, cv::_OutputArray *dst, int dim, int rtype, int dtype) +CVAPI(ExceptionStatus) core_reduce(cv::_InputArray* src, cv::_OutputArray* dst, int dim, int rtype, int dtype) { + BEGIN_WRAP cv::reduce(*src, *dst, dim, rtype, dtype); + END_WRAP } -CVAPI(void) core_merge(cv::Mat **mv, uint32 count, cv::Mat *dst) + +CVAPI(ExceptionStatus) core_merge(cv::Mat** mv, uint32_t count, cv::Mat* dst) { - std::vector vec((size_t)count); - for (uint32 i = 0; i < count; i++) + BEGIN_WRAP + std::vector vec(static_cast(count)); + for (uint32_t i = 0; i < count; i++) vec[i] = *mv[i]; - + cv::merge(vec, *dst); + END_WRAP } -CVAPI(void) core_split(cv::Mat *src, std::vector **mv) + +CVAPI(ExceptionStatus) core_split(cv::Mat* src, std::vector* mv) { - *mv = new std::vector(); - cv::split(*src, **mv); + BEGIN_WRAP + cv::split(*src, *mv); + END_WRAP } -CVAPI(void) core_mixChannels(cv::Mat **src, uint32 nsrcs, cv::Mat **dst, uint32 ndsts, int *fromTo, uint32 npairs) + +CVAPI(ExceptionStatus) core_mixChannels(cv::Mat** src, uint32_t nsrcs, cv::Mat** dst, uint32_t ndsts, int* fromTo, uint32_t npairs) { - std::vector srcVec((size_t)nsrcs); - std::vector dstVec((size_t)ndsts); - for (uint32 i = 0; i < nsrcs; i++) + BEGIN_WRAP + std::vector srcVec(static_cast(nsrcs)); + std::vector dstVec(static_cast(ndsts)); + for (uint32_t i = 0; i < nsrcs; i++) srcVec[i] = *(src[i]); - for (uint32 i = 0; i < ndsts; i++) + for (uint32_t i = 0; i < ndsts; i++) dstVec[i] = *(dst[i]); cv::mixChannels(srcVec, dstVec, fromTo, npairs); + END_WRAP } -CVAPI(void) core_extractChannel(cv::_InputArray *src, cv::_OutputArray *dst, int coi) +CVAPI(ExceptionStatus) core_extractChannel(cv::_InputArray* src, cv::_OutputArray* dst, int coi) { + BEGIN_WRAP cv::extractChannel(*src, *dst, coi); + END_WRAP } -CVAPI(void) core_insertChannel(cv::_InputArray *src, cv::_InputOutputArray *dst, int coi) + +CVAPI(ExceptionStatus) core_insertChannel(cv::_InputArray* src, cv::_InputOutputArray* dst, int coi) { + BEGIN_WRAP cv::insertChannel(*src, *dst, coi); + END_WRAP } -CVAPI(void) core_flip(cv::_InputArray *src, cv::_OutputArray *dst, int flipCode) + +CVAPI(ExceptionStatus) core_flip(cv::_InputArray* src, cv::_OutputArray* dst, int flipCode) { + BEGIN_WRAP cv::flip(*src, *dst, flipCode); + END_WRAP } -CVAPI(void) core_repeat1(cv::_InputArray *src, int ny, int nx, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_rotate(cv::_InputArray *src, cv::_OutputArray *dst, int rotateCode) { + BEGIN_WRAP + cv::rotate(*src, *dst, rotateCode); + END_WRAP +} + +CVAPI(ExceptionStatus) core_repeat1(cv::_InputArray* src, int ny, int nx, cv::_OutputArray* dst) +{ + BEGIN_WRAP cv::repeat(*src, ny, nx, *dst); + END_WRAP } -CVAPI(cv::Mat*) core_repeat2(cv::Mat *src, int ny, int nx) +CVAPI(ExceptionStatus) core_repeat2(cv::Mat* src, int ny, int nx, cv::Mat** returnValue) { - cv::Mat ret = cv::repeat(*src, ny, nx); - return new cv::Mat(ret); + BEGIN_WRAP + const cv::Mat ret = cv::repeat(*src, ny, nx); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) core_hconcat1(cv::Mat **src, uint32 nsrc, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_hconcat1(cv::Mat** src, uint32_t nsrc, cv::_OutputArray* dst) { - std::vector srcVec((size_t)nsrc); - for (uint32 i = 0; i < nsrc; i++) + BEGIN_WRAP + std::vector srcVec(static_cast(nsrc)); + for (uint32_t i = 0; i < nsrc; i++) srcVec[i] = *(src[i]); cv::hconcat(&srcVec[0], nsrc, *dst); + END_WRAP } -CVAPI(void) core_hconcat2(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_hconcat2(cv::_InputArray* src1, cv::_InputArray* src2, cv::_OutputArray* dst) { + BEGIN_WRAP cv::hconcat(*src1, *src2, *dst); + END_WRAP } -CVAPI(void) core_vconcat1(cv::Mat **src, uint32 nsrc, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_vconcat1(cv::Mat** src, uint32_t nsrc, cv::_OutputArray* dst) { - std::vector srcVec((size_t)nsrc); - for (uint32 i = 0; i < nsrc; i++) + BEGIN_WRAP + std::vector srcVec(static_cast(nsrc)); + for (uint32_t i = 0; i < nsrc; i++) srcVec[i] = *(src[i]); cv::vconcat(&srcVec[0], nsrc, *dst); + END_WRAP } -CVAPI(void) core_vconcat2(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_vconcat2(cv::_InputArray* src1, cv::_InputArray* src2, cv::_OutputArray* dst) { + BEGIN_WRAP cv::vconcat(*src1, *src2, *dst); + END_WRAP } -CVAPI(void) core_bitwise_and(cv::_InputArray *src1, cv::_InputArray *src2, - cv::_OutputArray *dst, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_bitwise_and( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::bitwise_and(*src1, *src2, *dst, entity(mask)); + END_WRAP } -CVAPI(void) core_bitwise_or(cv::_InputArray *src1, cv::_InputArray *src2, - cv::_OutputArray *dst, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_bitwise_or( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::bitwise_or(*src1, *src2, *dst, entity(mask)); + END_WRAP } -CVAPI(void) core_bitwise_xor(cv::_InputArray *src1, cv::_InputArray *src2, - cv::_OutputArray *dst, cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_bitwise_xor( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::bitwise_xor(*src1, *src2, *dst, entity(mask)); + END_WRAP } -CVAPI(void) core_bitwise_not(cv::_InputArray *src, cv::_OutputArray *dst, - cv::_InputArray *mask) +CVAPI(ExceptionStatus) core_bitwise_not( + cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::bitwise_not(*src, *dst, entity(mask)); + END_WRAP } -CVAPI(void) core_absdiff(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_absdiff( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) { + BEGIN_WRAP cv::absdiff(*src1, *src2, *dst); + END_WRAP } -CVAPI(void) core_inRange_InputArray(cv::_InputArray *src, cv::_InputArray *lowerb, cv::_InputArray *upperb, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_copyTo(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP + cv::copyTo(*src, *dst, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_inRange_InputArray( + cv::_InputArray *src, cv::_InputArray *lowerb, cv::_InputArray *upperb, cv::_OutputArray *dst) +{ + BEGIN_WRAP cv::inRange(*src, *lowerb, *upperb, *dst); + END_WRAP } -CVAPI(void) core_inRange_Scalar(cv::_InputArray *src, CvScalar lowerb, CvScalar upperb, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_inRange_Scalar( + cv::_InputArray *src, MyCvScalar lowerb, MyCvScalar upperb, cv::_OutputArray *dst) { - cv::inRange(*src, cv::Scalar(lowerb), cv::Scalar(upperb), *dst); + BEGIN_WRAP + cv::inRange(*src, cpp(lowerb), cpp(upperb), *dst); + END_WRAP } -CVAPI(void) core_compare(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, int cmpop) +CVAPI(ExceptionStatus) core_compare( + cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, int cmpop) { + BEGIN_WRAP cv::compare(*src1, *src2, *dst, cmpop); + END_WRAP } -CVAPI(void) core_min1(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_min1(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) { + BEGIN_WRAP cv::min(*src1, *src2, *dst); + END_WRAP } -CVAPI(void) core_max1(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) -{ - cv::max(*src1, *src2, *dst); -} -CVAPI(void) core_min_MatMat(cv::Mat *src1, cv::Mat *src2, cv::Mat *dst) +CVAPI(ExceptionStatus) core_min_MatMat(cv::Mat* src1, cv::Mat* src2, cv::Mat* dst) { + BEGIN_WRAP cv::min(*src1, *src2, *dst); + END_WRAP } -CVAPI(void) core_min_MatDouble(cv::Mat *src1, double src2, cv::Mat *dst) +CVAPI(ExceptionStatus) core_min_MatDouble(cv::Mat* src1, double src2, cv::Mat* dst) { + BEGIN_WRAP cv::min(*src1, src2, *dst); + END_WRAP } -CVAPI(void) core_max_MatMat(cv::Mat *src1, const cv::Mat *src2, cv::Mat *dst) + +CVAPI(ExceptionStatus) core_max1(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) +{ + BEGIN_WRAP + cv::max(*src1, *src2, *dst); + END_WRAP +} +CVAPI(ExceptionStatus) core_max_MatMat(cv::Mat *src1, const cv::Mat *src2, cv::Mat *dst) { + BEGIN_WRAP cv::max(*src1, *src2, *dst); + END_WRAP } -CVAPI(void) core_max_MatDouble(cv::Mat *src1, double src2, cv::Mat *dst) +CVAPI(ExceptionStatus) core_max_MatDouble(cv::Mat *src1, double src2, cv::Mat *dst) { + BEGIN_WRAP cv::max(*src1, src2, *dst); + END_WRAP } -CVAPI(void) core_sqrt(cv::_InputArray *src, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_sqrt(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::sqrt(*src, *dst); + END_WRAP } -CVAPI(void) core_pow_Mat(cv::_InputArray *src, double power, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_pow_Mat(cv::_InputArray *src, double power, cv::_OutputArray *dst) { - cv::pow(*src, power, *dst); + BEGIN_WRAP + cv::pow(*src, power, *dst); + END_WRAP } -CVAPI(void) core_exp_Mat(cv::_InputArray *src, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_exp_Mat(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::exp(*src, *dst); + END_WRAP } -CVAPI(void) core_log_Mat(cv::_InputArray *src, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_log_Mat(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::log(*src, *dst); -} -CVAPI(float) core_cubeRoot(float val) -{ - return cv::cubeRoot(val); -} -CVAPI(float) core_fastAtan2(float y, float x) -{ - return cv::fastAtan2(y, x); + END_WRAP } -CVAPI(void) core_polarToCart(cv::_InputArray *magnitude, cv::_InputArray *angle, - cv::_OutputArray *x, cv::_OutputArray *y, int angleInDegrees) +CVAPI(ExceptionStatus) core_polarToCart(cv::_InputArray* magnitude, cv::_InputArray* angle, + cv::_OutputArray* x, cv::_OutputArray* y, int angleInDegrees) { + BEGIN_WRAP cv::polarToCart(*magnitude, *angle, *x, *y, angleInDegrees != 0); + END_WRAP } -CVAPI(void) core_cartToPolar(cv::_InputArray *x, cv::_InputArray *y, - cv::_OutputArray *magnitude, cv::_OutputArray *angle, int angleInDegrees) + +CVAPI(ExceptionStatus) core_cartToPolar(cv::_InputArray* x, cv::_InputArray* y, + cv::_OutputArray* magnitude, cv::_OutputArray* angle, int angleInDegrees) { + BEGIN_WRAP cv::cartToPolar(*x, *y, *magnitude, *angle, angleInDegrees != 0); + END_WRAP } -CVAPI(void) core_phase(cv::_InputArray *x, cv::_InputArray *y, cv::_OutputArray *angle, int angleInDegrees) + +CVAPI(ExceptionStatus) core_phase(cv::_InputArray* x, cv::_InputArray* y, cv::_OutputArray* angle, int angleInDegrees) { + BEGIN_WRAP cv::phase(*x, *y, *angle, angleInDegrees != 0); + END_WRAP } -CVAPI(void) core_magnitude_Mat(cv::_InputArray *x, cv::_InputArray *y, cv::_OutputArray *magnitude) + +CVAPI(ExceptionStatus) core_magnitude_Mat(cv::_InputArray* x, cv::_InputArray* y, cv::_OutputArray* magnitude) { + BEGIN_WRAP cv::magnitude(*x, *y, *magnitude); + END_WRAP } -CVAPI(int) core_checkRange(cv::_InputArray *a, int quiet, CvPoint *pos, double minVal, double maxVal) + +CVAPI(ExceptionStatus) core_checkRange(cv::_InputArray* a, int quiet, MyCvPoint* pos, double minVal, double maxVal, int* returnValue) { + BEGIN_WRAP cv::Point pos0; - int ret = cv::checkRange(*a, quiet != 0, &pos0, minVal, maxVal); - *pos = pos0; - return ret; + *returnValue = cv::checkRange(*a, quiet != 0, &pos0, minVal, maxVal); + *pos = c(pos0); + END_WRAP } -CVAPI(void) core_patchNaNs(cv::_InputOutputArray *a, double val) + +CVAPI(ExceptionStatus) core_patchNaNs(cv::_InputOutputArray *a, double val) { + BEGIN_WRAP cv::patchNaNs(*a, val); + END_WRAP } -CVAPI(void) core_gemm(cv::_InputArray *src1, cv::_InputArray *src2, double alpha, - cv::_InputArray *src3, double gamma, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_gemm(cv::_InputArray *src1, cv::_InputArray *src2, double alpha, + cv::_InputArray *src3, double gamma, cv::_OutputArray *dst, int flags) { + BEGIN_WRAP cv::gemm(*src1, *src2, alpha, *src3, gamma, *dst, flags); + END_WRAP } -CVAPI(void) core_mulTransposed(cv::_InputArray *src, cv::_OutputArray *dst, int aTa, - cv::_InputArray *delta, double scale, int dtype) + +CVAPI(ExceptionStatus) core_mulTransposed(cv::_InputArray *src, cv::_OutputArray *dst, int aTa, + cv::_InputArray *delta, double scale, int dtype) { + BEGIN_WRAP cv::mulTransposed(*src, *dst, aTa != 0, entity(delta), scale, dtype); + END_WRAP } -CVAPI(void) core_transpose(cv::_InputArray *src, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) core_transpose(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::transpose(*src, *dst); + END_WRAP } -CVAPI(void) core_transform(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *m) + +CVAPI(ExceptionStatus) core_transform(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *m) { + BEGIN_WRAP cv::transform(*src, *dst, *m); + END_WRAP } -CVAPI(void) core_perspectiveTransform(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *m) +CVAPI(ExceptionStatus) core_perspectiveTransform(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *m) { + BEGIN_WRAP cv::perspectiveTransform(*src, *dst, *m); + END_WRAP } -CVAPI(void) core_perspectiveTransform_Mat(cv::Mat *src, cv::Mat *dst, cv::Mat *m) +CVAPI(ExceptionStatus) core_perspectiveTransform_Mat(cv::Mat *src, cv::Mat *dst, cv::Mat *m) { + BEGIN_WRAP cv::perspectiveTransform(*src, *dst, *m); + END_WRAP } -CVAPI(void) core_perspectiveTransform_Point2f(cv::Point2f *src, int srcLength, cv::Point2f *dst, int dstLength, cv::_InputArray *m) +CVAPI(ExceptionStatus) core_perspectiveTransform_Point2f(cv::Point2f *src, int srcLength, cv::Point2f *dst, int dstLength, cv::_InputArray *m) { - std::vector srcVector(src, src + srcLength); + BEGIN_WRAP + const std::vector srcVector(src, src + srcLength); std::vector dstVector(dst, dst + dstLength); cv::perspectiveTransform(srcVector, dstVector, *m); + END_WRAP } -CVAPI(void) core_perspectiveTransform_Point2d(cv::Point2d *src, int srcLength, cv::Point2d *dst, int dstLength, cv::_InputArray *m) +CVAPI(ExceptionStatus) core_perspectiveTransform_Point2d(cv::Point2d *src, int srcLength, cv::Point2d *dst, int dstLength, cv::_InputArray *m) { - std::vector srcVector(src, src + srcLength); + BEGIN_WRAP + const std::vector srcVector(src, src + srcLength); std::vector dstVector(dst, dst + dstLength); cv::perspectiveTransform(srcVector, dstVector, *m); + END_WRAP } -CVAPI(void) core_perspectiveTransform_Point3f(cv::Point3f *src, int srcLength, cv::Point3f *dst, int dstLength, cv::_InputArray *m) +CVAPI(ExceptionStatus) core_perspectiveTransform_Point3f(cv::Point3f *src, int srcLength, cv::Point3f *dst, int dstLength, cv::_InputArray *m) { - std::vector srcVector(src, src + srcLength); + BEGIN_WRAP + const std::vector srcVector(src, src + srcLength); std::vector dstVector(dst, dst + dstLength); cv::perspectiveTransform(srcVector, dstVector, *m); + END_WRAP } -CVAPI(void) core_perspectiveTransform_Point3d(cv::Point3d *src, int srcLength, cv::Point3d *dst, int dstLength, cv::_InputArray *m) +CVAPI(ExceptionStatus) core_perspectiveTransform_Point3d(cv::Point3d *src, int srcLength, cv::Point3d *dst, int dstLength, cv::_InputArray *m) { - std::vector srcVector(src, src + srcLength); + BEGIN_WRAP + const std::vector srcVector(src, src + srcLength); std::vector dstVector(dst, dst + dstLength); cv::perspectiveTransform(srcVector, dstVector, *m); + END_WRAP } -CVAPI(void) core_completeSymm(cv::_InputOutputArray *mtx, int lowerToUpper) +CVAPI(ExceptionStatus) core_completeSymm(cv::_InputOutputArray *mtx, int lowerToUpper) { + BEGIN_WRAP cv::completeSymm(*mtx, lowerToUpper != 0); + END_WRAP } -CVAPI(void) core_setIdentity(cv::_InputOutputArray *mtx, MyCvScalar s) + +CVAPI(ExceptionStatus) core_setIdentity(cv::_InputOutputArray *mtx, MyCvScalar s) { + BEGIN_WRAP cv::setIdentity(*mtx, cpp(s)); + END_WRAP } -CVAPI(double) core_determinant(cv::_InputArray *mtx) + +CVAPI(ExceptionStatus) core_determinant(cv::_InputArray *mtx, double *returnValue) { - return cv::determinant(*mtx); + BEGIN_WRAP + *returnValue = cv::determinant(*mtx); + END_WRAP } -CVAPI(MyCvScalar) core_trace(cv::_InputArray *mtx) + +CVAPI(ExceptionStatus) core_trace(cv::_InputArray *mtx, MyCvScalar *returnValue) { - return c(cv::trace(*mtx)); + BEGIN_WRAP + *returnValue = c(cv::trace(*mtx)); + END_WRAP } -CVAPI(double) core_invert(cv::_InputArray *src, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_invert(cv::_InputArray *src, cv::_OutputArray *dst, int flags, double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::invert(*src, *dst, flags); + END_WRAP +} + +CVAPI(ExceptionStatus) core_solve(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, int flags, int *returnValue) { - return cv::invert(*src, *dst, flags); + BEGIN_WRAP + *returnValue = cv::solve(*src1, *src2, *dst, flags); + END_WRAP } -CVAPI(int) core_solve(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_solveLP(cv::_InputArray *Func, cv::_InputArray *Constr, cv::_OutputArray *z, int *returnValue) { - return cv::solve(*src1, *src2, *dst, flags); + BEGIN_WRAP + *returnValue = cv::solveLP(*Func, *Constr, *z); + END_WRAP } -CVAPI(void) core_sort(cv::_InputArray *src, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_sort(cv::_InputArray *src, cv::_OutputArray *dst, int flags) { + BEGIN_WRAP cv::sort(*src, *dst, flags); + END_WRAP } -CVAPI(void) core_sortIdx(cv::_InputArray *src, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_sortIdx(cv::_InputArray *src, cv::_OutputArray *dst, int flags) { + BEGIN_WRAP cv::sortIdx(*src, *dst, flags); + END_WRAP } -CVAPI(int) core_solveCubic(cv::_InputArray *coeffs, cv::_OutputArray *roots) + +CVAPI(ExceptionStatus) core_solveCubic(cv::_InputArray *coeffs, cv::_OutputArray *roots, int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::solveCubic(*coeffs, *roots); + END_WRAP +} + +CVAPI(ExceptionStatus) core_solvePoly(cv::_InputArray *coeffs, cv::_OutputArray *roots, int maxIters, double *returnValue) { - return cv::solveCubic(*coeffs, *roots); + BEGIN_WRAP + *returnValue = cv::solvePoly(*coeffs, *roots, maxIters); + END_WRAP } -CVAPI(double) core_solvePoly(cv::_InputArray *coeffs, cv::_OutputArray *roots, int maxIters) + +CVAPI(ExceptionStatus) core_eigen(cv::_InputArray *src, cv::_OutputArray *eigenvalues, cv::_OutputArray *eigenvectors, int *returnValue) { - return cv::solvePoly(*coeffs, *roots, maxIters); + BEGIN_WRAP + *returnValue = cv::eigen(*src, *eigenvalues, *eigenvectors) ? 1 : 0; + END_WRAP } -CVAPI(int) core_eigen(cv::_InputArray *src, cv::_OutputArray *eigenvalues, cv::_OutputArray *eigenvectors) +CVAPI(ExceptionStatus) core_eigenNonSymmetric( + cv::_InputArray *src, cv::_OutputArray *eigenvalues, cv::_OutputArray *eigenvectors) { - return cv::eigen(*src, *eigenvalues, *eigenvectors) ? 1 : 0; + BEGIN_WRAP + cv::eigenNonSymmetric(*src, *eigenvalues, *eigenvectors); + END_WRAP } -CVAPI(void) core_calcCovarMatrix_Mat(cv::Mat **samples, int nsamples, cv::Mat *covar, - cv::Mat *mean, int flags, int ctype) +CVAPI(ExceptionStatus) core_calcCovarMatrix_Mat(cv::Mat **samples, int nsamples, cv::Mat *covar, + cv::Mat *mean, int flags, int ctype) { + BEGIN_WRAP std::vector samplesVec(nsamples); for (int i = 0; i < nsamples; i++) samplesVec[i] = *samples[i]; cv::calcCovarMatrix(&samplesVec[0], nsamples, *covar, *mean, flags, ctype); + END_WRAP } -CVAPI(void) core_calcCovarMatrix_InputArray(cv::_InputArray *samples, cv::_OutputArray *covar, - cv::_InputOutputArray *mean, int flags, int ctype) +CVAPI(ExceptionStatus) core_calcCovarMatrix_InputArray(cv::_InputArray *samples, cv::_OutputArray *covar, + cv::_InputOutputArray *mean, int flags, int ctype) { + BEGIN_WRAP cv::calcCovarMatrix(*samples, *covar, *mean, flags, ctype); + END_WRAP } - -CVAPI(void) core_PCACompute(cv::_InputArray *data, cv::_InputOutputArray *mean, - cv::_OutputArray *eigenvectors, int maxComponents) +CVAPI(ExceptionStatus) core_PCACompute(cv::_InputArray *data, cv::_InputOutputArray *mean, + cv::_OutputArray *eigenvectors, int maxComponents) { + BEGIN_WRAP cv::PCACompute(*data, *mean, *eigenvectors, maxComponents); + END_WRAP } -CVAPI(void) core_PCAComputeVar(cv::_InputArray *data, cv::_InputOutputArray *mean, - cv::_OutputArray *eigenvectors, double retainedVariance) +CVAPI(ExceptionStatus) core_PCACompute2(cv::_InputArray *data, cv::_InputOutputArray *mean, + cv::_OutputArray *eigenvectors, cv::_OutputArray *eigenvalues, int maxComponents) { + BEGIN_WRAP + cv::PCACompute(*data, *mean, *eigenvectors, *eigenvalues, maxComponents); + END_WRAP +} + +CVAPI(ExceptionStatus) core_PCAComputeVar(cv::_InputArray *data, cv::_InputOutputArray *mean, + cv::_OutputArray *eigenvectors, double retainedVariance) +{ + BEGIN_WRAP cv::PCACompute(*data, *mean, *eigenvectors, retainedVariance); + END_WRAP +} +CVAPI(ExceptionStatus) core_PCAComputeVar2(cv::_InputArray *data, cv::_InputOutputArray *mean, + cv::_OutputArray *eigenvectors, cv::_OutputArray *eigenvalues, double retainedVariance) +{ + BEGIN_WRAP + cv::PCACompute(*data, *mean, *eigenvectors, *eigenvalues, retainedVariance); + END_WRAP } -CVAPI(void) core_PCAProject(cv::_InputArray *data, cv::_InputArray *mean, - cv::_InputArray *eigenvectors, cv::_OutputArray *result) + +CVAPI(ExceptionStatus) core_PCAProject(cv::_InputArray *data, cv::_InputArray *mean, + cv::_InputArray *eigenvectors, cv::_OutputArray *result) { + BEGIN_WRAP cv::PCAProject(*data, *mean, *eigenvectors, *result); + END_WRAP } -CVAPI(void) core_PCABackProject(cv::_InputArray *data, cv::_InputArray *mean, - cv::_InputArray *eigenvectors, cv::_OutputArray *result) +CVAPI(ExceptionStatus) core_PCABackProject(cv::_InputArray *data, cv::_InputArray *mean, + cv::_InputArray *eigenvectors, cv::_OutputArray *result) { + BEGIN_WRAP cv::PCABackProject(*data, *mean, *eigenvectors, *result); + END_WRAP } -CVAPI(void) core_SVDecomp(cv::_InputArray *src, cv::_OutputArray *w, - cv::_OutputArray *u, cv::_OutputArray *vt, int flags) +CVAPI(ExceptionStatus) core_SVDecomp(cv::_InputArray *src, cv::_OutputArray *w, + cv::_OutputArray *u, cv::_OutputArray *vt, int flags) { + BEGIN_WRAP cv::SVDecomp(*src, *w, *u, *vt, flags); + END_WRAP } -CVAPI(void) core_SVBackSubst(cv::_InputArray *w, cv::_InputArray *u, cv::_InputArray *vt, - cv::_InputArray *rhs, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_SVBackSubst(cv::_InputArray *w, cv::_InputArray *u, cv::_InputArray *vt, + cv::_InputArray *rhs, cv::_OutputArray *dst) { + BEGIN_WRAP cv::SVBackSubst(*w, *u, *vt, *rhs, *dst); + END_WRAP } -CVAPI(double) core_Mahalanobis(cv::_InputArray *v1, cv::_InputArray *v2, cv::_InputArray *icovar) +CVAPI(ExceptionStatus) core_Mahalanobis(cv::_InputArray *v1, cv::_InputArray *v2, cv::_InputArray *icovar, double *returnValue) { - return cv::Mahalanobis(*v1, *v2, *icovar); + BEGIN_WRAP + *returnValue = cv::Mahalanobis(*v1, *v2, *icovar); + END_WRAP } -CVAPI(void) core_dft(cv::_InputArray *src, cv::_OutputArray *dst, int flags, int nonzeroRows) + +CVAPI(ExceptionStatus) core_dft(cv::_InputArray *src, cv::_OutputArray *dst, int flags, int nonzeroRows) { + BEGIN_WRAP cv::dft(*src, *dst, flags, nonzeroRows); + END_WRAP } -CVAPI(void) core_idft(cv::_InputArray *src, cv::_OutputArray *dst, int flags, int nonzeroRows) + +CVAPI(ExceptionStatus) core_idft(cv::_InputArray *src, cv::_OutputArray *dst, int flags, int nonzeroRows) { + BEGIN_WRAP cv::idft(*src, *dst, flags, nonzeroRows); + END_WRAP } -CVAPI(void) core_dct(cv::_InputArray *src, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_dct(cv::_InputArray *src, cv::_OutputArray *dst, int flags) { + BEGIN_WRAP cv::dct(*src, *dst, flags); + END_WRAP } -CVAPI(void) core_idct(cv::_InputArray *src, cv::_OutputArray *dst, int flags) + +CVAPI(ExceptionStatus) core_idct(cv::_InputArray *src, cv::_OutputArray *dst, int flags) { + BEGIN_WRAP cv::idct(*src, *dst, flags); + END_WRAP } -CVAPI(void) core_mulSpectrums(cv::_InputArray *a, cv::_InputArray *b, cv::_OutputArray *c, int flags, int conjB) + +CVAPI(ExceptionStatus) core_mulSpectrums(cv::_InputArray *a, cv::_InputArray *b, cv::_OutputArray *c, int flags, int conjB) { + BEGIN_WRAP cv::mulSpectrums(*a, *b, *c, flags, conjB != 0); + END_WRAP } -CVAPI(int) core_getOptimalDFTSize(int vecsize) + +CVAPI(ExceptionStatus) core_getOptimalDFTSize(int vecsize, int *returnValue) { - return cv::getOptimalDFTSize(vecsize); + BEGIN_WRAP + *returnValue = cv::getOptimalDFTSize(vecsize); + END_WRAP } -CVAPI(double) core_kmeans(cv::_InputArray *data, int k, cv::_InputOutputArray *bestLabels, - MyCvTermCriteria criteria, int attempts, int flags, cv::_OutputArray *centers) +CVAPI(ExceptionStatus) core_theRNG_get(uint64 *returnValue) { - return cv::kmeans(*data, k, *bestLabels, cpp(criteria), attempts, flags, entity(centers)); + BEGIN_WRAP + cv::RNG &rng = cv::theRNG(); + *returnValue = rng.state; + END_WRAP } -CVAPI(uint64) core_theRNG() +CVAPI(ExceptionStatus) core_theRNG_set(uint64 value) { - cv::RNG &rng = cv::theRNG(); - return rng.state; + BEGIN_WRAP + cv::theRNG().state = value; + END_WRAP } -CVAPI(void) core_randu_InputArray(cv::_InputOutputArray *dst, cv::_InputArray *low, cv::_InputArray *high) +CVAPI(ExceptionStatus) core_randu_InputArray(cv::_InputOutputArray *dst, cv::_InputArray *low, cv::_InputArray *high) { + BEGIN_WRAP cv::randu(*dst, *low, *high); + END_WRAP } -CVAPI(void) core_randu_Scalar(cv::_InputOutputArray *dst, MyCvScalar low, MyCvScalar high) +CVAPI(ExceptionStatus) core_randu_Scalar(cv::_InputOutputArray *dst, MyCvScalar low, MyCvScalar high) { + BEGIN_WRAP cv::randu(*dst, cpp(low), cpp(high)); + END_WRAP } -CVAPI(void) core_randn_InputArray(cv::_InputOutputArray *dst, cv::_InputArray *mean, cv::_InputArray *stddev) +CVAPI(ExceptionStatus) core_randn_InputArray(cv::_InputOutputArray *dst, cv::_InputArray *mean, cv::_InputArray *stddev) { + BEGIN_WRAP cv::randn(*dst, *mean, *stddev); + END_WRAP } -CVAPI(void) core_randn_Scalar(cv::_InputOutputArray *dst, MyCvScalar mean, MyCvScalar stddev) +CVAPI(ExceptionStatus) core_randn_Scalar(cv::_InputOutputArray *dst, MyCvScalar mean, MyCvScalar stddev) { + BEGIN_WRAP cv::randn(*dst, cpp(mean), cpp(stddev)); + END_WRAP } -CVAPI(void) core_randShuffle(cv::_InputOutputArray *dst, double iterFactor, uint64 *rng) +CVAPI(ExceptionStatus) core_randShuffle(cv::_InputOutputArray *dst, double iterFactor, uint64 *rng) { + BEGIN_WRAP cv::RNG rng0; cv::randShuffle(*dst, iterFactor, &rng0); *rng = rng0.state; + END_WRAP +} + +CVAPI(ExceptionStatus) core_kmeans( + cv::_InputArray *data, int k, cv::_InputOutputArray *bestLabels, + MyCvTermCriteria criteria, int attempts, int flags, cv::_OutputArray *centers, + double* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::kmeans(*data, k, *bestLabels, cpp(criteria), attempts, flags, entity(centers)); + END_WRAP +} + +#pragma endregion + +#pragma region base.hpp + +CVAPI(ExceptionStatus) core_cubeRoot(float val, float* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::cubeRoot(val); + END_WRAP +} +CVAPI(ExceptionStatus) core_fastAtan2(float y, float x, float* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::fastAtan2(y, x); + END_WRAP +} + +#pragma endregion + +#pragma region utility.hpp + +CVAPI(int) core_setBreakOnError(int flag) +{ + return cv::setBreakOnError(flag != 0) ? 1 : 0; +} + +CVAPI(cv::ErrorCallback) redirectError(cv::ErrorCallback errCallback, void* userdata, void** prevUserdata) +{ + return cv::redirectError(errCallback, userdata, prevUserdata); +} + +CVAPI(ExceptionStatus) core_setNumThreads(int nthreads) +{ + BEGIN_WRAP + cv::setNumThreads(nthreads); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getNumThreads(int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getNumThreads(); + END_WRAP +} +CVAPI(ExceptionStatus) core_getThreadNum(int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getThreadNum(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getBuildInformation(std::string *buf) +{ + BEGIN_WRAP + const auto& str = cv::getBuildInformation(); + buf->assign(str); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getVersionString(char *buf, int bufLength) +{ + BEGIN_WRAP + const auto& str = cv::getVersionString(); + copyString(str, buf, bufLength); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getVersionMajor(int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getVersionMajor(); + END_WRAP } -#endif \ No newline at end of file +CVAPI(ExceptionStatus) core_getVersionMinor(int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getVersionMinor(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getVersionRevision(int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getVersionRevision(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getTickCount(int64* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getTickCount(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getTickFrequency(double* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getTickFrequency(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getCPUTickCount(int64* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getCPUTickCount(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_checkHardwareSupport(int feature, int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::checkHardwareSupport(feature) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_getHardwareFeatureName(int feature, std::string *buf) +{ + BEGIN_WRAP + const auto& str = cv::getHardwareFeatureName(feature); + buf->assign(str); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getCPUFeaturesLine(std::string *buf) +{ + BEGIN_WRAP + const auto& str = cv::getCPUFeaturesLine(); + buf->assign(str); + END_WRAP +} + +CVAPI(ExceptionStatus) core_getNumberOfCPUs(int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getNumberOfCPUs(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_setUseOptimized(int onoff) +{ + BEGIN_WRAP + cv::setUseOptimized(onoff != 0); + END_WRAP +} +CVAPI(ExceptionStatus) core_useOptimized(int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::useOptimized() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_format(cv::_InputArray *mtx, int fmt, std::string *buf) +{ + BEGIN_WRAP + const auto formatted = cv::format(*mtx, static_cast(fmt)); + + std::stringstream s; + s << formatted; + buf->assign(s.str()); + END_WRAP +} + +#pragma endregion + +#pragma region logger.hpp + +CVAPI(ExceptionStatus) core_logger_setLogLevel(cv::utils::logging::LogLevel logLevel, cv::utils::logging::LogLevel* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::utils::logging::setLogLevel(logLevel); + END_WRAP +} + +CVAPI(ExceptionStatus) core_logger_getLogLevel(cv::utils::logging::LogLevel *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::utils::logging::getLogLevel(); + END_WRAP +} + +#pragma endregion + +#pragma region RNG + +CVAPI(ExceptionStatus) core_RNG_fill(uint64 *state, cv::_InputOutputArray *mat, int distType, cv::_InputArray *a, cv::_InputArray *b, int saturateRange) +{ + BEGIN_WRAP + cv::RNG rng(*state); + rng.fill(*mat, distType, *a, *b, saturateRange != 0); + *state = rng.state; + END_WRAP +} + +CVAPI(ExceptionStatus) core_RNG_gaussian(uint64 *state, double sigma, double *returnValue) +{ + BEGIN_WRAP + cv::RNG rng(*state); + *returnValue = rng.gaussian(sigma); + *state = rng.state; + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/core_Algorithm.h b/src/OpenCvSharpExtern/core_Algorithm.h index 1db208894..9c19b918a 100644 --- a/src/OpenCvSharpExtern/core_Algorithm.h +++ b/src/OpenCvSharpExtern/core_Algorithm.h @@ -1,32 +1,42 @@ -#ifndef _CPP_CORE_ALGORITHM_H_ -#define _CPP_CORE_ALGORITHM_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) core_Algorithm_write(cv::Algorithm *obj, cv::FileStorage *fs) +CVAPI(ExceptionStatus) core_Algorithm_write(cv::Algorithm *obj, cv::FileStorage *fs) { + BEGIN_WRAP obj->write(*fs); + END_WRAP } -CVAPI(void) core_Algorithm_read(cv::Algorithm *obj, cv::FileNode *fn) +CVAPI(ExceptionStatus) core_Algorithm_read(cv::Algorithm *obj, cv::FileNode *fn) { + BEGIN_WRAP obj->read(*fn); + END_WRAP } -CVAPI(int) core_Algorithm_empty(cv::Algorithm *obj) +CVAPI(ExceptionStatus) core_Algorithm_empty(cv::Algorithm *obj, int *returnValue) { - return obj->empty() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP } -CVAPI(void) core_Algorithm_save(cv::Algorithm *obj, const char *filename) +CVAPI(ExceptionStatus) core_Algorithm_save(cv::Algorithm *obj, const char *filename) { + BEGIN_WRAP obj->save(filename); + END_WRAP } -CVAPI(void) core_Algorithm_getDefaultName(cv::Algorithm *obj, char *buf, int bufLength) +CVAPI(ExceptionStatus) core_Algorithm_getDefaultName(cv::Algorithm *obj, std::string *buf) { - cv::String str = obj->getDefaultName(); - copyString(str, buf, bufLength); + BEGIN_WRAP + buf->assign(obj->getDefaultName()); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/core_FileNode.h b/src/OpenCvSharpExtern/core_FileNode.h new file mode 100644 index 000000000..23781de2c --- /dev/null +++ b/src/OpenCvSharpExtern/core_FileNode.h @@ -0,0 +1,451 @@ +#pragma once + +#include "include_opencv.h" + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +CVAPI(ExceptionStatus) core_FileNode_new1(cv::FileNode **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::FileNode(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_delete(cv::FileNode *node) +{ + BEGIN_WRAP + delete node; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_operatorThis_byString(cv::FileNode *obj, const char *nodeName, cv::FileNode **returnValue) +{ + BEGIN_WRAP + const auto ret = (*obj)[nodeName]; + *returnValue = new cv::FileNode(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_operatorThis_byInt(cv::FileNode *obj, int i, cv::FileNode **returnValue) +{ + BEGIN_WRAP + const auto ret = (*obj)[i]; + *returnValue = new cv::FileNode(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_type(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->type(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_empty(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_isNone(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isNone() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_isSeq(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isSeq() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_isMap(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isMap() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_isInt(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isInt() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_isReal(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isReal() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_isString(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isString() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_isNamed(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->isNamed() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_name(cv::FileNode *obj, std::string *buf) +{ + BEGIN_WRAP + buf->assign(obj->name()); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_size(cv::FileNode *obj, size_t *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->size(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_toInt(cv::FileNode *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(*obj); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_toFloat(cv::FileNode *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(*obj); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_toDouble(cv::FileNode *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(*obj); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_toString(cv::FileNode *obj, std::string *buf) +{ + BEGIN_WRAP + buf->assign(*obj); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_toMat(cv::FileNode *obj, cv::Mat *m) +{ + BEGIN_WRAP + (*obj) >> (*m); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_begin(cv::FileNode *obj, cv::FileNodeIterator **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::FileNodeIterator(obj->begin()); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_end(cv::FileNode *obj, cv::FileNodeIterator **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::FileNodeIterator(obj->end()); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_readRaw(cv::FileNode *obj, const char *fmt, uchar* vec, size_t len) +{ + BEGIN_WRAP + obj->readRaw(fmt, vec, len); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_int(cv::FileNode *node, int *value, int default_value) +{ + BEGIN_WRAP + int temp; + cv::read(*node, temp, default_value); + *value = temp; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_float(cv::FileNode *node, float *value, float default_value) +{ + BEGIN_WRAP + float temp; + cv::read(*node, temp, default_value); + *value = temp; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_double(cv::FileNode *node, double *value, double default_value) +{ + BEGIN_WRAP + double temp; + cv::read(*node, temp, default_value); + *value = temp; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_String(cv::FileNode *node, std::string *value, const char *default_value) +{ + BEGIN_WRAP + cv::String str; + cv::read(*node, str, (default_value == nullptr) ? cv::String() : cv::String(default_value)); + value->assign(str); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Mat(cv::FileNode *node, cv::Mat *mat, cv::Mat *default_mat) +{ + BEGIN_WRAP + cv::read(*node, *mat, entity(default_mat)); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_SparseMat(cv::FileNode *node, cv::SparseMat *mat, cv::SparseMat *default_mat) +{ + BEGIN_WRAP + cv::read(*node, *mat, entity(default_mat)); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_vectorOfKeyPoint(cv::FileNode *node, std::vector *keypoints) +{ + BEGIN_WRAP + cv::read(*node, *keypoints); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_vectorOfDMatch(cv::FileNode *node, std::vector *matches) +{ + BEGIN_WRAP + cv::read(*node, *matches); + END_WRAP +} + + +CVAPI(ExceptionStatus) core_FileNode_read_Range(cv::FileNode *node, MyCvSlice *returnValue) +{ + BEGIN_WRAP + cv::Range ret; + (*node) >> ret; + *returnValue = c(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_KeyPoint(cv::FileNode *node, MyKeyPoint *returnValue) +{ + BEGIN_WRAP + cv::KeyPoint ret; + (*node) >> ret; + *returnValue = c(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_DMatch(cv::FileNode *node, MyDMatch *returnValue) +{ + BEGIN_WRAP + cv::DMatch ret; + (*node) >> ret; + *returnValue = c(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_Point2i(cv::FileNode *node, MyCvPoint *returnValue) +{ + BEGIN_WRAP + cv::Point2i ret; + (*node) >> ret; + *returnValue = MyCvPoint{ ret.x, ret.y }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Point2f(cv::FileNode *node, MyCvPoint2D32f *returnValue) +{ + BEGIN_WRAP + cv::Point2f ret; + (*node) >> ret; + *returnValue = MyCvPoint2D32f{ ret.x, ret.y }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Point2d(cv::FileNode *node, MyCvPoint2D64f *returnValue) +{ + BEGIN_WRAP + cv::Point2d ret; + (*node) >> ret; + *returnValue = MyCvPoint2D64f{ ret.x, ret.y }; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_Point3i(cv::FileNode *node, MyCvPoint3D32i *returnValue) +{ + BEGIN_WRAP + cv::Point3i ret; + (*node) >> ret; + *returnValue = MyCvPoint3D32i{ ret.x, ret.y, ret.z }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Point3f(cv::FileNode *node, MyCvPoint3D32f *returnValue) +{ + BEGIN_WRAP + cv::Point3f ret; + (*node) >> ret; + *returnValue = MyCvPoint3D32f{ ret.x, ret.y, ret.z }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Point3d(cv::FileNode *node, MyCvPoint3D64f *returnValue) +{ + BEGIN_WRAP + cv::Point3d ret; + (*node) >> ret; + *returnValue = MyCvPoint3D64f{ ret.x, ret.y, ret.z }; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_Size2i(cv::FileNode *node, MyCvSize *returnValue) +{ + BEGIN_WRAP + cv::Size2i ret; + (*node) >> ret; + *returnValue = MyCvSize{ ret.width, ret.height }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Size2f(cv::FileNode *node, MyCvSize2D32f *returnValue) +{ + BEGIN_WRAP + cv::Size2f ret; + (*node) >> ret; + *returnValue = MyCvSize2D32f{ ret.width, ret.height }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Size2d(cv::FileNode *node, MyCvSize2D64f *returnValue) +{ + BEGIN_WRAP + cv::Size2d ret; + (*node) >> ret; + *returnValue = MyCvSize2D64f{ ret.width, ret.height }; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_Rect2i(cv::FileNode *node, MyCvRect *returnValue) +{ + BEGIN_WRAP + cv::Rect2i ret; + (*node) >> ret; + *returnValue = MyCvRect{ ret.x, ret.y, ret.width, ret.height }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Rect2f(cv::FileNode *node, MyCvRect2D32f *returnValue) +{ + BEGIN_WRAP + cv::Rect2f ret; + (*node) >> ret; + *returnValue = MyCvRect2D32f{ ret.x, ret.y, ret.width, ret.height }; + END_WRAP +} +CVAPI(ExceptionStatus) core_FileNode_read_Rect2d(cv::FileNode *node, MyCvRect2D64f *returnValue) +{ + BEGIN_WRAP + cv::Rect2d ret; + (*node) >> ret; + *returnValue = MyCvRect2D64f{ ret.x, ret.y, ret.width, ret.height }; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_Scalar(cv::FileNode *node, MyCvScalar *returnValue) +{ + BEGIN_WRAP + cv::Scalar s; + (*node) >> s; + *returnValue = MyCvScalar{}; + returnValue->val[0] = s.val[0]; + returnValue->val[1] = s.val[1]; + returnValue->val[2] = s.val[2]; + returnValue->val[3] = s.val[3]; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNode_read_Vec2i(cv::FileNode *node, CvVec2i *returnValue) { BEGIN_WRAP cv::Vec2i v; (*node) >> v; CvVec2i ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec3i(cv::FileNode *node, CvVec3i *returnValue) { BEGIN_WRAP cv::Vec3i v; (*node) >> v; CvVec3i ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec4i(cv::FileNode *node, CvVec4i *returnValue) { BEGIN_WRAP cv::Vec4i v; (*node) >> v; CvVec4i ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec6i(cv::FileNode *node, CvVec6i *returnValue) { BEGIN_WRAP cv::Vec6i v; (*node) >> v; CvVec6i ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec2d(cv::FileNode *node, CvVec2d *returnValue) { BEGIN_WRAP cv::Vec2d v; (*node) >> v; CvVec2d ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec3d(cv::FileNode *node, CvVec3d *returnValue) { BEGIN_WRAP cv::Vec3d v; (*node) >> v; CvVec3d ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec4d(cv::FileNode *node, CvVec4d *returnValue) { BEGIN_WRAP cv::Vec4d v; (*node) >> v; CvVec4d ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec6d(cv::FileNode *node, CvVec6d *returnValue) { BEGIN_WRAP cv::Vec6d v; (*node) >> v; CvVec6d ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec2f(cv::FileNode *node, CvVec2f *returnValue) { BEGIN_WRAP cv::Vec2f v; (*node) >> v; CvVec2f ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec3f(cv::FileNode *node, CvVec3f *returnValue) { BEGIN_WRAP cv::Vec3f v; (*node) >> v; CvVec3f ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec4f(cv::FileNode *node, CvVec4f *returnValue) { BEGIN_WRAP cv::Vec4f v; (*node) >> v; CvVec4f ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec6f(cv::FileNode *node, CvVec6f *returnValue) { BEGIN_WRAP cv::Vec6f v; (*node) >> v; CvVec6f ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec2b(cv::FileNode *node, CvVec2b *returnValue) { BEGIN_WRAP cv::Vec2b v; (*node) >> v; CvVec2b ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec3b(cv::FileNode *node, CvVec3b *returnValue) { BEGIN_WRAP cv::Vec3b v; (*node) >> v; CvVec3b ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec4b(cv::FileNode *node, CvVec4b *returnValue) { BEGIN_WRAP cv::Vec4b v; (*node) >> v; CvVec4b ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec6b(cv::FileNode *node, CvVec6b *returnValue) { BEGIN_WRAP cv::Vec6b v; (*node) >> v; CvVec6b ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec2s(cv::FileNode *node, CvVec2s *returnValue) { BEGIN_WRAP cv::Vec2s v; (*node) >> v; CvVec2s ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec3s(cv::FileNode *node, CvVec3s *returnValue) { BEGIN_WRAP cv::Vec3s v; (*node) >> v; CvVec3s ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec4s(cv::FileNode *node, CvVec4s *returnValue) { BEGIN_WRAP cv::Vec4s v; (*node) >> v; CvVec4s ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec6s(cv::FileNode *node, CvVec6s *returnValue) { BEGIN_WRAP cv::Vec6s v; (*node) >> v; CvVec6s ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec2w(cv::FileNode *node, CvVec2w *returnValue) { BEGIN_WRAP cv::Vec2w v; (*node) >> v; CvVec2w ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec3w(cv::FileNode *node, CvVec3w *returnValue) { BEGIN_WRAP cv::Vec3w v; (*node) >> v; CvVec3w ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec4w(cv::FileNode *node, CvVec4w *returnValue) { BEGIN_WRAP cv::Vec4w v; (*node) >> v; CvVec4w ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } +CVAPI(ExceptionStatus) core_FileNode_read_Vec6w(cv::FileNode *node, CvVec6w *returnValue) { BEGIN_WRAP cv::Vec6w v; (*node) >> v; CvVec6w ret; std::copy(std::begin(v.val), std::end(v.val), std::begin(ret.val)); *returnValue = ret; END_WRAP } + + +#pragma region FileNodeIterator + +CVAPI(ExceptionStatus) core_FileNodeIterator_new1(cv::FileNodeIterator **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::FileNodeIterator; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_delete(cv::FileNodeIterator *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_operatorAsterisk(cv::FileNodeIterator *obj, cv::FileNode **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::FileNode(*(*obj)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_operatorIncrement(cv::FileNodeIterator *obj, int *returnValue) +{ + BEGIN_WRAP + const size_t prev_remaining = obj->remaining(); + ++(*obj); + *returnValue = (prev_remaining == obj->remaining()) ? 0 : 1; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_operatorPlusEqual(cv::FileNodeIterator *obj, int ofs, int *returnValue) +{ + BEGIN_WRAP + const size_t prev_remaining = obj->remaining(); + (*obj) += ofs; + *returnValue = (prev_remaining == obj->remaining()) ? 0 : 1; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_readRaw( + cv::FileNodeIterator *obj, const char *fmt, uchar* vec, size_t maxCount) +{ + BEGIN_WRAP + obj->readRaw(fmt, vec, maxCount); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_operatorEqual(cv::FileNodeIterator *it1, cv::FileNodeIterator *it2, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ((*it1) == (*it2)) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_operatorMinus(cv::FileNodeIterator *it1, cv::FileNodeIterator *it2, ptrdiff_t *returnValue) +{ + BEGIN_WRAP + *returnValue = (*it1) - (*it2); + END_WRAP +} + +CVAPI(ExceptionStatus) core_FileNodeIterator_operatorLessThan(cv::FileNodeIterator *it1, cv::FileNodeIterator *it2, int *returnValue) +{ + BEGIN_WRAP + *returnValue = (*it1) < (*it2); + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/core_FileStorage.h b/src/OpenCvSharpExtern/core_FileStorage.h index e7adfc198..bb2fb6f20 100644 --- a/src/OpenCvSharpExtern/core_FileStorage.h +++ b/src/OpenCvSharpExtern/core_FileStorage.h @@ -1,306 +1,503 @@ -#ifndef _CPP_CORE_FILESTORAGE_H_ -#define _CPP_CORE_FILESTORAGE_H_ +#pragma once #include "include_opencv.h" +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + #pragma region FileStorage -CVAPI(cv::FileStorage*) core_FileStorage_new1() +CVAPI(ExceptionStatus) core_FileStorage_new1(cv::FileStorage **returnValue) { - return new cv::FileStorage(); + BEGIN_WRAP + *returnValue = new cv::FileStorage; + END_WRAP } -CVAPI(cv::FileStorage*) core_FileStorage_new2(const char *source, int flags, const char *encoding) +CVAPI(ExceptionStatus) core_FileStorage_new2(const char *source, int flags, const char *encoding, cv::FileStorage **returnValue) { + BEGIN_WRAP std::string encodingStr; - if (encoding != NULL) + if (encoding != nullptr) encodingStr = std::string(encoding); - return new cv::FileStorage(source, flags, encodingStr); -} -CVAPI(cv::FileStorage*) core_FileStorage_newFromLegacy(CvFileStorage *fs) -{ - return new cv::FileStorage(fs); + *returnValue = new cv::FileStorage(source, flags, encodingStr); + END_WRAP } -CVAPI(void) core_FileStorage_delete(cv::FileStorage *obj) +CVAPI(ExceptionStatus) core_FileStorage_delete(cv::FileStorage *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(int) core_FileStorage_open(cv::FileStorage *obj, - const char *filename, int flags, const char *encoding) +CVAPI(ExceptionStatus) core_FileStorage_open(cv::FileStorage *obj, + const char *filename, int flags, const char *encoding, int *returnValue) { + BEGIN_WRAP std::string encodingStr; - if (encoding != NULL) + if (encoding != nullptr) encodingStr = std::string(encoding); - return obj->open(filename, flags, encodingStr) ? 1 : 0; + *returnValue = obj->open(filename, flags, encodingStr) ? 1 : 0; + END_WRAP } -CVAPI(int) core_FileStorage_isOpened(cv::FileStorage *obj) + +CVAPI(ExceptionStatus) core_FileStorage_isOpened(cv::FileStorage *obj, int *returnValue) { - return obj->isOpened() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isOpened() ? 1 : 0; + END_WRAP } -CVAPI(void) core_FileStorage_release(cv::FileStorage *obj) + +/* +CVAPI(ExceptionStatus) core_FileStorage_release(cv::FileStorage *obj) { - return obj->release(); -} -CVAPI(void) core_FileStorage_releaseAndGetString(cv::FileStorage *obj, - char *buf, int bufLength) + BEGIN_WRAP + obj->release(); + END_WRAP +}*/ + +CVAPI(ExceptionStatus) core_FileStorage_releaseAndGetString( + cv::FileStorage* obj, std::string * outString) { - std::string result = obj->releaseAndGetString(); - copyString(result, buf, bufLength); + BEGIN_WRAP + outString->assign(obj->releaseAndGetString()); + END_WRAP } -CVAPI(cv::FileNode*) core_FileStorage_getFirstTopLevelNode(cv::FileStorage *obj) +CVAPI(ExceptionStatus) core_FileStorage_getFirstTopLevelNode(cv::FileStorage *obj, cv::FileNode **returnValue) { - cv::FileNode node = obj->getFirstTopLevelNode(); - return new cv::FileNode(node); + BEGIN_WRAP + const auto node = obj->getFirstTopLevelNode(); + *returnValue = new cv::FileNode(node); + END_WRAP } -CVAPI(cv::FileNode*) core_FileStorage_root(cv::FileStorage *obj, int streamIdx) +CVAPI(ExceptionStatus) core_FileStorage_root(cv::FileStorage *obj, int streamIdx, cv::FileNode **returnValue) { - cv::FileNode node = obj->root(streamIdx); - return new cv::FileNode(node); + BEGIN_WRAP + const auto node = obj->root(streamIdx); + *returnValue = new cv::FileNode(node); + END_WRAP } -CVAPI(cv::FileNode*) core_FileStorage_indexer(cv::FileStorage *obj, const char *nodeName) +CVAPI(ExceptionStatus) core_FileStorage_indexer(cv::FileStorage *obj, const char *nodeName, cv::FileNode **returnValue) { - cv::FileNode node = (*obj)[nodeName]; - return new cv::FileNode(node); + BEGIN_WRAP + const auto node = (*obj)[nodeName]; + *returnValue = new cv::FileNode(node); + END_WRAP } -CVAPI(CvFileStorage*) core_FileStorage_toLegacy(cv::FileStorage *obj) +CVAPI(ExceptionStatus) core_FileStorage_writeRaw(cv::FileStorage *obj, const char *fmt, const uchar *vec, size_t len) { - return obj->fs.get(); + BEGIN_WRAP + obj->writeRaw(fmt, vec, len); + END_WRAP } -CVAPI(void) core_FileStorage_writeRaw(cv::FileStorage *obj, const char *fmt, const uchar *vec, size_t len) + +CVAPI(ExceptionStatus) core_FileStorage_writeComment(cv::FileStorage *obj, const char *comment, int append) { - obj->writeRaw(fmt, vec, len); + BEGIN_WRAP + obj->writeComment(comment, append != 0); + END_WRAP } -CVAPI(void) core_FileStorage_writeObj(cv::FileStorage *obj, const char *name, const void *value) + +CVAPI(ExceptionStatus) core_FileStorage_getDefaultObjectName(const char *filename, std::string *buf) { - obj->writeObj(name, value); + BEGIN_WRAP + buf->assign(cv::FileStorage::getDefaultObjectName(filename)); + END_WRAP } -CVAPI(void) core_FileStorage_getDefaultObjectName(const char *filename, char *buf, int bufLength) +CVAPI(ExceptionStatus) core_FileStorage_elname(cv::FileStorage *obj, std::string *returnValue) { - std::string ret = cv::FileStorage::getDefaultObjectName(filename); - copyString(ret, buf, bufLength); + BEGIN_WRAP + returnValue->assign(obj->elname); + END_WRAP } -CVAPI(const char*) core_FileStorage_elname(cv::FileStorage *obj) +CVAPI(ExceptionStatus) core_FileStorage_startWriteStruct( + cv::FileStorage *obj, const char* name, int flags, const char *typeName) { - return obj->elname.c_str(); + BEGIN_WRAP + obj->startWriteStruct(name, flags, typeName); + END_WRAP } -CVAPI(const char*) core_FileStorage_structs(cv::FileStorage *obj, size_t* resultLength) +CVAPI(ExceptionStatus) core_FileStorage_endWriteStruct( cv::FileStorage *obj) { - std::vector &structs = obj->structs; - *resultLength = structs.size(); - return &(structs[0]); + BEGIN_WRAP + obj->endWriteStruct(); + END_WRAP } -CVAPI(int) core_FileStorage_state(cv::FileStorage *obj) + +CVAPI(ExceptionStatus) core_FileStorage_state(cv::FileStorage *obj, int *returnValue) { - return obj->state; + BEGIN_WRAP + *returnValue = obj->state; + END_WRAP } -CVAPI(void) core_FileStorage_write_int(cv::FileStorage *fs, const char *name, int value) +CVAPI(ExceptionStatus) core_FileStorage_write_int(cv::FileStorage *fs, const char *name, int value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), value); + END_WRAP } -CVAPI(void) core_FileStorage_write_float(cv::FileStorage *fs, const char *name, float value) +CVAPI(ExceptionStatus) core_FileStorage_write_float(cv::FileStorage *fs, const char *name, float value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), value); + END_WRAP } -CVAPI(void) core_FileStorage_write_double(cv::FileStorage *fs, const char *name, double value) +CVAPI(ExceptionStatus) core_FileStorage_write_double(cv::FileStorage *fs, const char *name, double value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), value); + END_WRAP } -CVAPI(void) core_FileStorage_write_String(cv::FileStorage *fs, const char *name, const char *value) +CVAPI(ExceptionStatus) core_FileStorage_write_String(cv::FileStorage *fs, const char *name, const char *value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), value); + END_WRAP } -CVAPI(void) core_FileStorage_write_Mat(cv::FileStorage *fs, const char *name, const cv::Mat *value) +CVAPI(ExceptionStatus) core_FileStorage_write_Mat(cv::FileStorage *fs, const char *name, const cv::Mat *value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), *value); + END_WRAP } -CVAPI(void) core_FileStorage_write_SparseMat(cv::FileStorage *fs, const char *name, const cv::SparseMat *value) +CVAPI(ExceptionStatus) core_FileStorage_write_SparseMat(cv::FileStorage *fs, const char *name, const cv::SparseMat *value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), *value); + END_WRAP } -CVAPI(void) core_FileStorage_write_vectorOfKeyPoint(cv::FileStorage *fs, const char *name, const std::vector *value) +CVAPI(ExceptionStatus) core_FileStorage_write_vectorOfKeyPoint(cv::FileStorage *fs, const char *name, const std::vector *value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), *value); + END_WRAP } -CVAPI(void) core_FileStorage_write_vectorOfDMatch(cv::FileStorage *fs, const char *name, const std::vector *value) +CVAPI(ExceptionStatus) core_FileStorage_write_vectorOfDMatch(cv::FileStorage *fs, const char *name, const std::vector *value) { + BEGIN_WRAP cv::write(*fs, cv::String(name), *value); + END_WRAP } -CVAPI(void) core_FileStorage_writeScalar_int(cv::FileStorage *fs, int value) +CVAPI(ExceptionStatus) core_FileStorage_writeScalar_int(cv::FileStorage *fs, int value) { + BEGIN_WRAP cv::writeScalar(*fs, value); + END_WRAP } -CVAPI(void) core_FileStorage_writeScalar_float(cv::FileStorage *fs, float value) +CVAPI(ExceptionStatus) core_FileStorage_writeScalar_float(cv::FileStorage *fs, float value) { + BEGIN_WRAP cv::writeScalar(*fs, value); + END_WRAP } -CVAPI(void) core_FileStorage_writeScalar_double(cv::FileStorage *fs, double value) +CVAPI(ExceptionStatus) core_FileStorage_writeScalar_double(cv::FileStorage *fs, double value) { + BEGIN_WRAP cv::writeScalar(*fs, value); + END_WRAP } -CVAPI(void) core_FileStorage_writeScalar_String(cv::FileStorage *fs, const char *value) +CVAPI(ExceptionStatus) core_FileStorage_writeScalar_String(cv::FileStorage *fs, const char *value) { + BEGIN_WRAP cv::writeScalar(*fs, cv::String(value)); + END_WRAP } -#pragma endregion - -#pragma region FileNode - -CVAPI(cv::FileNode*) core_FileNode_new1() +CVAPI(ExceptionStatus) core_FileStorage_shift_String(cv::FileStorage *fs, const char *val) { - return new cv::FileNode(); + BEGIN_WRAP + (*fs) << val; + END_WRAP } -CVAPI(cv::FileNode*) core_FileNode_new2(CvFileStorage* fs, CvFileNode* node) +CVAPI(ExceptionStatus) core_FileStorage_shift_int(cv::FileStorage *fs, int val) { - return new cv::FileNode(fs, node); + BEGIN_WRAP + (*fs) << val; + END_WRAP } -CVAPI(cv::FileNode*) core_FileNode_new3(cv::FileNode *node) +CVAPI(ExceptionStatus) core_FileStorage_shift_float(cv::FileStorage *fs, float val) { - return new cv::FileNode(*node); + BEGIN_WRAP + (*fs) << val; + END_WRAP } - -CVAPI(void) core_FileNode_delete(cv::FileNode *node) +CVAPI(ExceptionStatus) core_FileStorage_shift_double(cv::FileStorage *fs, double val) { - delete node; + BEGIN_WRAP + (*fs) << val; + END_WRAP } - -CVAPI(cv::FileNode*) core_FileNode_operatorThis_byString(cv::FileNode *obj, const char *nodeName) +CVAPI(ExceptionStatus) core_FileStorage_shift_Mat(cv::FileStorage *fs, cv::Mat *val) { - cv::FileNode ret = (*obj)[nodeName]; - return new cv::FileNode(ret); + BEGIN_WRAP + (*fs) << *val; + END_WRAP } -CVAPI(cv::FileNode*) core_FileNode_operatorThis_byInt(cv::FileNode *obj, int i) +CVAPI(ExceptionStatus) core_FileStorage_shift_SparseMat(cv::FileStorage *fs, cv::SparseMat *val) { - cv::FileNode ret = (*obj)[i]; - return new cv::FileNode(ret); + BEGIN_WRAP + (*fs) << *val; + END_WRAP } -CVAPI(int) core_FileNode_type(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Range(cv::FileStorage *fs, MyCvSlice val) { - return obj->type(); + BEGIN_WRAP + (*fs) << cpp(val); + END_WRAP } - -CVAPI(int) core_FileNode_empty(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_KeyPoint(cv::FileStorage *fs, cv::KeyPoint val) { - return obj->empty() ? 1 : 0; + BEGIN_WRAP + (*fs) << val; + END_WRAP } -CVAPI(int) core_FileNode_isNone(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_DMatch(cv::FileStorage *fs, cv::DMatch val) { - return obj->isNone() ? 1 : 0; + BEGIN_WRAP + (*fs) << val; + END_WRAP } -CVAPI(int) core_FileNode_isSeq(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_vectorOfKeyPoint(cv::FileStorage *fs, std::vector *val) { - return obj->isSeq() ? 1 : 0; + BEGIN_WRAP + (*fs) << *val; + END_WRAP } -CVAPI(int) core_FileNode_isMap(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_vectorOfDMatch(cv::FileStorage *fs, std::vector *val) { - return obj->isMap() ? 1 : 0; + BEGIN_WRAP + (*fs) << *val; + END_WRAP } -CVAPI(int) core_FileNode_isInt(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Point2i(cv::FileStorage *fs, MyCvPoint val) { - return obj->isInt() ? 1 : 0; + BEGIN_WRAP + (*fs) << cv::Point2i(val.x, val.y); + END_WRAP } -CVAPI(int) core_FileNode_isReal(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Point2f(cv::FileStorage *fs, MyCvPoint2D32f val) { - return obj->isReal() ? 1 : 0; + BEGIN_WRAP + (*fs) << cv::Point2f(val.x, val.y); + END_WRAP } -CVAPI(int) core_FileNode_isString(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Point2d(cv::FileStorage *fs, MyCvPoint2D64f val) { - return obj->isString() ? 1 : 0; + BEGIN_WRAP + (*fs) << cv::Point2d(val.x, val.y); + END_WRAP } -CVAPI(int) core_FileNode_isNamed(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Point3i(cv::FileStorage *fs, MyCvPoint3D32i val) { - return obj->isNamed() ? 1 : 0; + BEGIN_WRAP + (*fs) << cv::Point3i(val.x, val.y, val.z); + END_WRAP } - -CVAPI(void) core_FileNode_name(cv::FileNode *obj, char *buf, int bufLength) +CVAPI(ExceptionStatus) core_FileStorage_shift_Point3f(cv::FileStorage *fs, MyCvPoint3D32f val) { - std::string str = obj->name(); - copyString(str, buf, bufLength); + BEGIN_WRAP + (*fs) << cv::Point3f(val.x, val.y, val.z); + END_WRAP } -CVAPI(size_t) core_FileNode_size(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Point3d(cv::FileStorage *fs, MyCvPoint3D64f val) { - return obj->size(); + BEGIN_WRAP + (*fs) << cv::Point3d(val.x, val.y, val.z); + END_WRAP } - -CVAPI(int) core_FileNode_toInt(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Size2i(cv::FileStorage *fs, MyCvSize val) { - return (int)(*obj); + BEGIN_WRAP + (*fs) << cv::Size2i(val.width, val.height); + END_WRAP } -CVAPI(float) core_FileNode_toFloat(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Size2f(cv::FileStorage *fs, MyCvSize2D32f val) { - return (float)(*obj); + BEGIN_WRAP + (*fs) << cv::Size2f(val.width, val.height); + END_WRAP } -CVAPI(double) core_FileNode_toDouble(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Size2d(cv::FileStorage *fs, MyCvSize2D64f val) { - return (double)(*obj); + BEGIN_WRAP + (*fs) << cv::Size2d(val.width, val.height); + END_WRAP } -CVAPI(void) core_FileNode_toString(cv::FileNode *obj, char *buf, int bufLength) +CVAPI(ExceptionStatus) core_FileStorage_shift_Rect2i(cv::FileStorage *fs, MyCvRect val) { - std::string str = (std::string)(*obj); - copyString(str, buf, bufLength); + BEGIN_WRAP + (*fs) << cv::Rect2i(val.x, val.y, val.width, val.height); + END_WRAP } -CVAPI(void) core_FileNode_toMat(cv::FileNode *obj, cv::Mat *m) +CVAPI(ExceptionStatus) core_FileStorage_shift_Rect2f(cv::FileStorage *fs, MyCvRect2D32f val) { - (*obj) >> (*m); + BEGIN_WRAP + (*fs) << cv::Rect2f(val.x, val.y, val.width, val.height); + END_WRAP } - -CVAPI(void) core_FileNode_readRaw(cv::FileNode *obj, const char *fmt, uchar* vec, size_t len) +CVAPI(ExceptionStatus) core_FileStorage_shift_Rect2d(cv::FileStorage *fs, MyCvRect2D64f val) { - obj->readRaw(fmt, vec, len); + BEGIN_WRAP + (*fs) << cv::Rect2d(val.x, val.y, val.width, val.height); + END_WRAP } -CVAPI(void*) core_FileNode_readObj(cv::FileNode *obj) +CVAPI(ExceptionStatus) core_FileStorage_shift_Scalar(cv::FileStorage *fs, MyCvScalar val) { - return obj->readObj(); + BEGIN_WRAP + (*fs) << cpp(val); + END_WRAP } -CVAPI(void) core_FileNode_read_int(cv::FileNode *node, int *value, int default_value) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec2i(cv::FileStorage *fs, CvVec2i v) +{ + BEGIN_WRAP + (*fs) << cv::Vec2i(v.val[0], v.val[1]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec3i(cv::FileStorage *fs, CvVec3i v) +{ + BEGIN_WRAP + (*fs) << cv::Vec3i(v.val[0], v.val[1], v.val[2]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec4i(cv::FileStorage *fs, CvVec4i v) +{ + BEGIN_WRAP + (*fs) << cv::Vec4i(v.val[0], v.val[1], v.val[2], v.val[3]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec6i(cv::FileStorage *fs, CvVec6i v) { - int temp; - cv::read(*node, temp, default_value); - *value = temp; + BEGIN_WRAP + (*fs) << cv::Vec6i(v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]); + END_WRAP } -CVAPI(void) core_FileNode_read_float(cv::FileNode *node, float *value, float default_value) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec2d(cv::FileStorage *fs, CvVec2d v) { - float temp; - cv::read(*node, temp, default_value); - *value = temp; + BEGIN_WRAP + (*fs) << cv::Vec2d(v.val[0], v.val[1]); + END_WRAP } -CVAPI(void) core_FileNode_read_double(cv::FileNode *node, double *value, double default_value) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec3d(cv::FileStorage *fs, CvVec3d v) { - double temp; - cv::read(*node, temp, default_value); - *value = temp; + BEGIN_WRAP + (*fs) << cv::Vec3d(v.val[0], v.val[1], v.val[2]); + END_WRAP } -CVAPI(void) core_FileNode_read_String(cv::FileNode *node, char *value, int valueCapacity, const char *default_value) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec4d(cv::FileStorage *fs, CvVec4d v) { - cv::String str; - cv::read(*node, str, (default_value == NULL) ? cv::String() : cv::String(default_value)); - copyString(str, value, valueCapacity); + BEGIN_WRAP + (*fs) << cv::Vec4d(v.val[0], v.val[1], v.val[2], v.val[3]); + END_WRAP } -CVAPI(void) core_FileNode_read_Mat(cv::FileNode *node, cv::Mat *mat, cv::Mat *default_mat) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec6d(cv::FileStorage *fs, CvVec6d v) { - cv::read(*node, *mat, entity(default_mat)); + BEGIN_WRAP + (*fs) << cv::Vec6d(v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]); + END_WRAP } -CVAPI(void) core_FileNode_read_SparseMat(cv::FileNode *node, cv::SparseMat *mat, cv::SparseMat *default_mat) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec2f(cv::FileStorage *fs, CvVec2f v) { - cv::read(*node, *mat, entity(default_mat)); + BEGIN_WRAP + (*fs) << cv::Vec2f(v.val[0], v.val[1]); + END_WRAP } -CVAPI(void) core_FileNode_read_vectorOfKeyPoint(cv::FileNode *node, std::vector *keypoints) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec3f(cv::FileStorage *fs, CvVec3f v) { - cv::read(*node, *keypoints); + BEGIN_WRAP + (*fs) << cv::Vec3f(v.val[0], v.val[1], v.val[2]); + END_WRAP } -CVAPI(void) core_FileNode_read_vectorOfDMatch(cv::FileNode *node, std::vector *matches) +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec4f(cv::FileStorage *fs, CvVec4f v) { - cv::read(*node, *matches); + BEGIN_WRAP + (*fs) << cv::Vec4f(v.val[0], v.val[1], v.val[2], v.val[3]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec6f(cv::FileStorage *fs, CvVec6f v) +{ + BEGIN_WRAP + (*fs) << cv::Vec6f(v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec2b(cv::FileStorage *fs, CvVec2b v) +{ + BEGIN_WRAP + (*fs) << cv::Vec2b(v.val[0], v.val[1]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec3b(cv::FileStorage *fs, CvVec3b v) +{ + BEGIN_WRAP + (*fs) << cv::Vec3b(v.val[0], v.val[1], v.val[2]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec4b(cv::FileStorage *fs, CvVec4b v) +{ + BEGIN_WRAP + (*fs) << cv::Vec4b(v.val[0], v.val[1], v.val[2], v.val[3]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec6b(cv::FileStorage *fs, CvVec6b v) +{ + BEGIN_WRAP + (*fs) << cv::Vec6b(v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec2s(cv::FileStorage *fs, CvVec2s v) +{ + BEGIN_WRAP + (*fs) << cv::Vec2s(v.val[0], v.val[1]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec3s(cv::FileStorage *fs, CvVec3s v) +{ + BEGIN_WRAP + (*fs) << cv::Vec3s(v.val[0], v.val[1], v.val[2]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec4s(cv::FileStorage *fs, CvVec4s v) +{ + BEGIN_WRAP + (*fs) << cv::Vec4s(v.val[0], v.val[1], v.val[2], v.val[3]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec6s(cv::FileStorage *fs, CvVec6s v) +{ + BEGIN_WRAP + (*fs) << cv::Vec6s(v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec2w(cv::FileStorage *fs, CvVec2w v) +{ + BEGIN_WRAP + (*fs) << cv::Vec2w(v.val[0], v.val[1]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec3w(cv::FileStorage *fs, CvVec3w v) +{ + BEGIN_WRAP + (*fs) << cv::Vec3w(v.val[0], v.val[1], v.val[2]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec4w(cv::FileStorage *fs, CvVec4w v) +{ + BEGIN_WRAP + (*fs) << cv::Vec4w(v.val[0], v.val[1], v.val[2], v.val[3]); + END_WRAP +} +CVAPI(ExceptionStatus) core_FileStorage_shift_Vec6w(cv::FileStorage *fs, CvVec6w v) +{ + BEGIN_WRAP + (*fs) << cv::Vec6w(v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]); + END_WRAP } #pragma endregion - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/core_InputArray.h b/src/OpenCvSharpExtern/core_InputArray.h index 3b3841510..64a82dd41 100644 --- a/src/OpenCvSharpExtern/core_InputArray.h +++ b/src/OpenCvSharpExtern/core_InputArray.h @@ -1,52 +1,316 @@ -#ifndef _CPP_CORE_INPUTARRAY_H_ -#define _CPP_CORE_INPUTARRAY_H_ +#pragma once #include "include_opencv.h" -CVAPI(cv::_InputArray*) core_InputArray_new_byMat(cv::Mat *mat) +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +CVAPI(ExceptionStatus) core_InputArray_new_byMat(cv::Mat *mat, cv::_InputArray **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::_InputArray(*mat); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_new_byUMat(cv::UMat* mat, cv::_InputArray** returnValue) { - cv::_InputArray ia(*mat); - return new cv::_InputArray(ia); + BEGIN_WRAP + * returnValue = new cv::_InputArray(*mat); + END_WRAP } -CVAPI(cv::_InputArray*) core_InputArray_new_byMatExpr(cv::MatExpr *expr) +CVAPI(ExceptionStatus) core_InputArray_new_byMatExpr(cv::MatExpr *expr, cv::_InputArray **returnValue) { - cv::_InputArray ia(*expr); - return new cv::_InputArray(ia); + BEGIN_WRAP + *returnValue = new cv::_InputArray(*expr); + END_WRAP } -CVAPI(cv::_InputArray*) core_InputArray_new_byScalar(cv::Scalar val) +CVAPI(ExceptionStatus) core_InputArray_new_byScalar(MyCvScalar s, cv::Scalar **handle, cv::_InputArray **returnValue) { - cv::_InputArray ia(val); - return new cv::_InputArray(ia); + BEGIN_WRAP + *handle = new cv::Scalar(s.val[0], s.val[1], s.val[2], s.val[3]); + *returnValue = new cv::_InputArray(**handle); + END_WRAP } -CVAPI(cv::_InputArray*) core_InputArray_new_byDouble(double val) +CVAPI(ExceptionStatus) core_InputArray_new_byDouble(double *handle, cv::_InputArray **returnValue) { - cv::_InputArray ia(val); - return new cv::_InputArray(ia); + BEGIN_WRAP + *returnValue = new cv::_InputArray(*handle); + END_WRAP } -CVAPI(cv::_InputArray*) core_InputArray_new_byGpuMat(cv::cuda::GpuMat *gm) +CVAPI(ExceptionStatus) core_InputArray_new_byVectorOfMat(std::vector *vector, cv::_InputArray **returnValue) { - cv::_InputArray ia(*gm); - return new cv::_InputArray(ia); + BEGIN_WRAP + *returnValue = new cv::_InputArray(*vector); + END_WRAP } -CVAPI(cv::_InputArray*) core_InputArray_new_byVectorOfMat(std::vector *vector) +#pragma region new_byVec + +CVAPI(ExceptionStatus) core_InputArray_new_byVecb(uchar *vec, int n, cv::_InputArray **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::_InputArray(vec, n); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_new_byVecs(short *vec, int n, cv::_InputArray **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::_InputArray(vec, n); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_new_byVecw(ushort *vec, int n, cv::_InputArray **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::_InputArray(vec, n); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_new_byVeci(int *vec, int n, cv::_InputArray **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::_InputArray(vec, n); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_new_byVecf(float *vec, int n, cv::_InputArray **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::_InputArray(vec, n); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_new_byVecd(double *vec, int n, cv::_InputArray **returnValue) { - cv::_InputArray ia(*vector); - return new cv::_InputArray(ia); + BEGIN_WRAP + *returnValue = new cv::_InputArray(vec, n); + END_WRAP } -CVAPI(void) core_InputArray_delete(cv::_InputArray *ia) +#pragma endregion + +CVAPI(ExceptionStatus) core_InputArray_delete(cv::_InputArray *ia) +{ + BEGIN_WRAP + delete ia; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_delete_withScalar(cv::_InputArray *ia, cv::Scalar *handle) { + BEGIN_WRAP delete ia; + delete handle; + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_getMat(cv::_InputArray *ia, int idx, cv::Mat **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::Mat(ia->getMat(idx)); + END_WRAP } +/*CVAPI(ExceptionStatus) core_InputArray_getMat_(cv::_InputArray *ia, int idx, cv::Mat **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::Mat(ia->getMat_(idx)); + END_WRAP +}*/ -CVAPI(int) core_InputArray_kind(cv::_InputArray *ia) +CVAPI(ExceptionStatus) core_InputArray_getUMat(cv::_InputArray* ia, int idx, cv::UMat** returnValue) { - return ia->kind(); + BEGIN_WRAP + * returnValue = new cv::UMat(ia->getUMat(idx)); + END_WRAP + } -#endif \ No newline at end of file +CVAPI(ExceptionStatus) core_InputArray_getMatVector(cv::_InputArray *ia, std::vector *mv) +{ + BEGIN_WRAP + ia->getMatVector(*mv); + END_WRAP +} +/*CVAPI(void) core_InputArray_getUMatVector(cv::_InputArray *ia, std::vector *umv) +{ + ia->getUMatVector(*umv); +}*/ + +CVAPI(ExceptionStatus) core_InputArray_getFlags(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->getFlags(); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_getObj(cv::_InputArray *ia, void **returnValue) +{ + BEGIN_WRAP + *returnValue = ia->getObj(); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_getSz(cv::_InputArray *ia, MyCvSize *returnValue) +{ + BEGIN_WRAP + *returnValue = c(ia->getSz()); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_kind(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->kind(); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_dims(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->dims(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_cols(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->cols(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_rows(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->rows(i); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_size(cv::_InputArray *ia, int i, MyCvSize *returnValue) +{ + BEGIN_WRAP + *returnValue = c(ia->size(i)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_sizend(cv::_InputArray *ia, int* sz, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->sizend(sz, i); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_sameSize(cv::_InputArray *self, cv::_InputArray * target, int *returnValue) +{ + BEGIN_WRAP + *returnValue = self->sameSize(*target) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_total(cv::_InputArray *ia, int i, size_t *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->total(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_type(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->type(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_depth(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->depth(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_channels(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->channels(i); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_isContinuous(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isContinuous(i) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_isSubmatrix(cv::_InputArray *ia, int i, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isSubmatrix(i) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_empty(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->empty() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_copyTo1(cv::_InputArray *ia, cv::_OutputArray *arr) +{ + BEGIN_WRAP + ia->copyTo(*arr); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_copyTo2(cv::_InputArray *ia, cv::_OutputArray *arr, cv::_InputArray *mask) +{ + BEGIN_WRAP + ia->copyTo(*arr, *mask); + END_WRAP +} + +CVAPI(ExceptionStatus) core_InputArray_offset(cv::_InputArray *ia, int i, size_t *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->offset(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_step(cv::_InputArray *ia, int i, size_t *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->step(i); + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isMat(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isMat() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isUMat(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isUMat() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isMatVector(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isMatVector() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isUMatVector(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isUMatVector() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isMatx(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isMatx() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isVector(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isVector() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) core_InputArray_isGpuMatVector(cv::_InputArray *ia, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ia->isGpuMatVector() ? 1 : 0; + END_WRAP +} diff --git a/src/OpenCvSharpExtern/core_LDA.h b/src/OpenCvSharpExtern/core_LDA.h new file mode 100644 index 000000000..19e889631 --- /dev/null +++ b/src/OpenCvSharpExtern/core_LDA.h @@ -0,0 +1,110 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +CVAPI(ExceptionStatus) core_LDA_new1(int num_components, cv::LDA **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::LDA(num_components); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_new2(cv::_InputArray *src, cv::_InputArray *labels, int num_components, cv::LDA **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::LDA(*src, *labels, num_components); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_delete(cv::LDA *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_save_String(cv::LDA *obj, const char *filename) +{ + BEGIN_WRAP + obj->save(filename); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_load_String(cv::LDA *obj, const char *filename) +{ + BEGIN_WRAP + obj->load(filename); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_save_FileStorage(cv::LDA *obj, cv::FileStorage *fs) +{ + BEGIN_WRAP + obj->save(*fs); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_load_FileStorage(cv::LDA *obj, cv::FileStorage *node) +{ + BEGIN_WRAP + obj->load(*node); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_compute(cv::LDA *obj, cv::_InputArray *src, cv::_InputArray *labels) +{ + BEGIN_WRAP + obj->compute(*src, *labels); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_project(cv::LDA *obj, cv::_InputArray *src, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = obj->project(*src); + *returnValue = new cv::Mat(mat); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_reconstruct(cv::LDA *obj, cv::_InputArray *src, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = obj->reconstruct(*src); + *returnValue = new cv::Mat(mat); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_eigenvectors(cv::LDA *obj, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = obj->eigenvectors(); + *returnValue = new cv::Mat(mat); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_eigenvalues(cv::LDA *obj, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = obj->eigenvalues(); + *returnValue = new cv::Mat(mat); + END_WRAP +} + +CVAPI(ExceptionStatus) core_LDA_subspaceProject(cv::_InputArray *W, cv::_InputArray *mean, cv::_InputArray *src, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = cv::LDA::subspaceProject(*W, *mean, *src); + *returnValue = new cv::Mat(mat); + END_WRAP +} +CVAPI(ExceptionStatus) core_LDA_subspaceReconstruct(cv::_InputArray *W, cv::_InputArray *mean, cv::_InputArray *src, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = cv::LDA::subspaceReconstruct(*W, *mean, *src); + *returnValue = new cv::Mat(mat); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/core_Mat.h b/src/OpenCvSharpExtern/core_Mat.h index 5444086c8..794c15f36 100644 --- a/src/OpenCvSharpExtern/core_Mat.h +++ b/src/OpenCvSharpExtern/core_Mat.h @@ -1,8 +1,10 @@ -#ifndef _CPP_CORE_MAT_H_ -#define _CPP_CORE_MAT_H_ +#pragma once #include "include_opencv.h" +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #pragma region Init & Release CVAPI(uint64) core_Mat_sizeof() @@ -10,1203 +12,947 @@ CVAPI(uint64) core_Mat_sizeof() return sizeof(cv::Mat); } -CVAPI(cv::Mat*) core_Mat_new1() +CVAPI(ExceptionStatus) core_Mat_new1(cv::Mat **returnValue) { - return new cv::Mat(); + BEGIN_WRAP + *returnValue = new cv::Mat; + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new2(int rows, int cols, int type) +CVAPI(ExceptionStatus) core_Mat_new2(int rows, int cols, int type, cv::Mat **returnValue) { - return new cv::Mat(rows, cols, type); + BEGIN_WRAP + *returnValue = new cv::Mat(rows, cols, type); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new3(int rows, int cols, int type, MyCvScalar scalar) +CVAPI(ExceptionStatus) core_Mat_new3(int rows, int cols, int type, MyCvScalar scalar, cv::Mat **returnValue) { - return new cv::Mat(rows, cols, type, cpp(scalar)); + BEGIN_WRAP + *returnValue = new cv::Mat(rows, cols, type, cpp(scalar)); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new4(cv::Mat *mat, cv::Range rowRange, cv::Range colRange) +CVAPI(ExceptionStatus) core_Mat_new4(cv::Mat *mat, MyCvSlice rowRange, MyCvSlice colRange, cv::Mat **returnValue) { - return new cv::Mat(*mat, rowRange, colRange); + BEGIN_WRAP + *returnValue = new cv::Mat(*mat, cpp(rowRange), cpp(colRange)); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new5(cv::Mat *mat, cv::Range rowRange) +CVAPI(ExceptionStatus) core_Mat_new5(cv::Mat *mat, cv::Range rowRange, cv::Mat **returnValue) { - return new cv::Mat(*mat, rowRange); + BEGIN_WRAP + *returnValue = new cv::Mat(*mat, rowRange); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new6(cv::Mat *mat, cv::Range *ranges) +CVAPI(ExceptionStatus) core_Mat_new6(cv::Mat *mat, cv::Range *ranges, cv::Mat **returnValue) { - return new cv::Mat(*mat, ranges); + BEGIN_WRAP + *returnValue = new cv::Mat(*mat, ranges); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new7(cv::Mat *mat, MyCvRect roi) +CVAPI(ExceptionStatus) core_Mat_new7(cv::Mat *mat, MyCvRect roi, cv::Mat **returnValue) { - return new cv::Mat(*mat, cpp(roi)); + BEGIN_WRAP + *returnValue = new cv::Mat(*mat, cpp(roi)); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new8(int rows, int cols, int type, void* data, size_t step) +CVAPI(ExceptionStatus) core_Mat_new8(int rows, int cols, int type, void* data, size_t step, cv::Mat **returnValue) { - return new cv::Mat(rows, cols, type, data, step); + BEGIN_WRAP + *returnValue = new cv::Mat(rows, cols, type, data, step); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_new9(int ndims, const int* sizes, int type, void* data, const size_t* steps) +CVAPI(ExceptionStatus) core_Mat_new9(int ndims, const int* sizes, int type, void* data, const size_t* steps, cv::Mat **returnValue) { - return new cv::Mat(ndims, sizes, type, data, steps); + BEGIN_WRAP + *returnValue = new cv::Mat(ndims, sizes, type, data, steps); + END_WRAP } - -CVAPI(cv::Mat*) core_Mat_new10(int ndims, int* sizes, int type) -{ - return new cv::Mat(ndims, sizes, type); -} -CVAPI(cv::Mat*) core_Mat_new11(int ndims, int* sizes, int type, MyCvScalar s) +CVAPI(ExceptionStatus) core_Mat_new10(int ndims, int* sizes, int type, cv::Mat **returnValue) { - return new cv::Mat(ndims, sizes, type, cpp(s)); + BEGIN_WRAP + *returnValue = new cv::Mat(ndims, sizes, type); + END_WRAP } - -CVAPI(cv::Mat*) core_Mat_new_FromIplImage(IplImage *img, int copyData) +CVAPI(ExceptionStatus) core_Mat_new11(int ndims, int* sizes, int type, MyCvScalar s, cv::Mat **returnValue) { - cv::Size size(img->height, img->width); - cv::Mat m(size, CV_MAKETYPE(img->depth, img->nChannels), img->imageData, img->widthStep); - if (copyData) - return new cv::Mat(m.clone()); - else - return new cv::Mat(m); + BEGIN_WRAP + *returnValue = new cv::Mat(ndims, sizes, type, cpp(s)); + END_WRAP } - -CVAPI(cv::Mat*) core_Mat_new_FromCvMat(CvMat *mat, int copyData) +CVAPI(ExceptionStatus) core_Mat_new12(cv::Mat *mat, cv::Mat **returnValue) { - cv::Size size(mat->rows, mat->cols); - cv::Mat m(size, mat->type, (mat->data).ptr); - if (copyData) - return new cv::Mat(m.clone()); - else - return new cv::Mat(m); + BEGIN_WRAP + *returnValue = new cv::Mat(*mat); + END_WRAP } - -CVAPI(void) core_Mat_release(cv::Mat *self) +/*CVAPI(ExceptionStatus) core_Mat_release(cv::Mat *self) { + BEGIN_WRAP self->release(); -} -CVAPI(void) core_Mat_delete(cv::Mat *self) + END_WRAP +}*/ +CVAPI(ExceptionStatus) core_Mat_delete(cv::Mat *self) { + BEGIN_WRAP delete self; + END_WRAP } #pragma endregion #pragma region Functions -CVAPI(cv::Mat*) core_Mat_adjustROI(cv::Mat *self, int dtop, int dbottom, int dleft, int dright) -{ - cv::Mat ret = self->adjustROI(dtop, dbottom, dleft, dright); - return new cv::Mat(ret); -} - -CVAPI(void) core_Mat_assignTo1(cv::Mat *self, cv::Mat *m) -{ - self->assignTo(*m); -} -CVAPI(void) core_Mat_assignTo2(cv::Mat *self, cv::Mat *m, int type) -{ - self->assignTo(*m, type); -} - -CVAPI(int) core_Mat_channels(cv::Mat *self) -{ - return self->channels(); -} -CVAPI(int) core_Mat_checkVector1(cv::Mat *self, int elemChannels) +CVAPI(ExceptionStatus) core_Mat_getUMat(cv::Mat* self, cv::AccessFlag accessFlags, cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) { - return self->checkVector(elemChannels); -} -CVAPI(int) core_Mat_checkVector2(cv::Mat *self, int elemChannels, int depth) -{ - return self->checkVector(elemChannels, depth); -} -CVAPI(int) core_Mat_checkVector3(cv::Mat *self, int elemChannels, int depth, int requireContinuous) -{ - return self->checkVector(elemChannels, depth, requireContinuous != 0); + BEGIN_WRAP + * returnValue = new cv::UMat(self->getUMat(accessFlags, usageFlags)); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_clone(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_row(cv::Mat *self, int y, cv::Mat **returnValue) { - cv::Mat ret = self->clone(); - return new cv::Mat(ret); + BEGIN_WRAP + *returnValue = new cv::Mat(self->row(y)); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_col_toMat(cv::Mat *self, int x) -{ - cv::Mat ret = self->col(x); - return new cv::Mat(ret); -} -CVAPI(cv::MatExpr*) core_Mat_col_toMatExpr(cv::Mat *self, int x) +CVAPI(ExceptionStatus) core_Mat_col(cv::Mat *self, int x, cv::Mat **returnValue) { - cv::Mat ret = self->col(x); - return new cv::MatExpr(ret); + BEGIN_WRAP + *returnValue = new cv::Mat(self->col(x)); + END_WRAP } -CVAPI(int) core_Mat_cols(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_rowRange(cv::Mat *self, int startRow, int endRow, cv::Mat **returnValue) { - return self->cols; + BEGIN_WRAP + *returnValue = new cv::Mat(self->rowRange(startRow, endRow)); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_colRange_toMat(cv::Mat *self, int startCol, int endCol) +CVAPI(ExceptionStatus) core_Mat_colRange(cv::Mat *self, int startCol, int endCol, cv::Mat **returnValue) { - cv::Mat ret = self->colRange(startCol, endCol); - return new cv::Mat(ret); + BEGIN_WRAP + *returnValue = new cv::Mat(self->colRange(startCol, endCol)); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_colRange_toMatExpr(cv::Mat *self, int startCol, int endCol) -{ - cv::Mat ret = self->colRange(startCol, endCol); - return new cv::MatExpr(ret); -} - -CVAPI(int) core_Mat_dims(cv::Mat *self) + +CVAPI(ExceptionStatus) core_Mat_diag(cv::Mat *self, int d, cv::Mat **returnValue) { - return self->dims; + BEGIN_WRAP + const auto ret = self->diag(d); + *returnValue = new cv::Mat(ret); + END_WRAP } - -CVAPI(void) core_Mat_convertTo(cv::Mat *self, cv::Mat *m, int rtype, double alpha, double beta) +CVAPI(ExceptionStatus) core_Mat_diag_static(cv::Mat *self, cv::Mat **returnValue) { - self->convertTo(*m, rtype, alpha, beta); + BEGIN_WRAP + const auto ret = cv::Mat::diag(*self); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) core_Mat_copyTo(cv::Mat *self, cv::Mat *m, cv::Mat *mask) +CVAPI(ExceptionStatus) core_Mat_clone(cv::Mat *self, cv::Mat **returnValue) { - const cv::Mat &maskMat = (mask == NULL) ? cv::Mat() : *mask; - self->copyTo(*m, maskMat); + BEGIN_WRAP + const auto ret = self->clone(); + *returnValue = new cv::Mat(ret); + END_WRAP } - -CVAPI(void) core_Mat_create1(cv::Mat *self, int rows, int cols, int type) -{ - self->create(rows, cols, type); -} -CVAPI(void) core_Mat_create2(cv::Mat *self, int ndims, const int *sizes, int type) +CVAPI(ExceptionStatus) core_Mat_copyTo1(cv::Mat *self, cv::_OutputArray *m) { - self->create(ndims, sizes, type); + BEGIN_WRAP + self->copyTo(*m); + END_WRAP } - -CVAPI(cv::Mat*) core_Mat_cross(cv::Mat *self, cv::Mat *m) +CVAPI(ExceptionStatus) core_Mat_copyTo2(cv::Mat *self, cv::_OutputArray *m, cv::_InputArray *mask) { - cv::Mat ret = self->cross(*m); - return new cv::Mat(ret); + BEGIN_WRAP + self->copyTo(*m, entity(mask)); + END_WRAP } -CVAPI(uchar*) core_Mat_data(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_copyTo_toMat1(cv::Mat *self, cv::Mat *m) { - return self->data; + BEGIN_WRAP + self->copyTo(*m); + END_WRAP } -CVAPI(const uchar*) core_Mat_datastart(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_copyTo_toMat2(cv::Mat *self, cv::Mat *m, cv::_InputArray *mask) { - return self->datastart; + BEGIN_WRAP + self->copyTo(*m, entity(mask)); + END_WRAP } -CVAPI(const uchar*) core_Mat_dataend(cv::Mat *self) -{ - return self->dataend; -} -CVAPI(const uchar*) core_Mat_datalimit(cv::Mat *self) -{ - return self->datalimit; -} - -CVAPI(int) core_Mat_depth(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_convertTo(cv::Mat *self, cv::_OutputArray *m, int rtype, double alpha, double beta) { - return self->depth(); + BEGIN_WRAP + self->convertTo(*m, rtype, alpha, beta); + END_WRAP } - -CVAPI(cv::Mat*) core_Mat_diag1(cv::Mat *self) -{ - cv::Mat ret = self->diag(); - return new cv::Mat(ret); -} -CVAPI(cv::Mat*) core_Mat_diag2(cv::Mat *self, int d) -{ - cv::Mat ret = self->diag(d); - return new cv::Mat(ret); -} -CVAPI(cv::Mat*) core_Mat_diag3(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_assignTo(cv::Mat *self, cv::Mat *m, int type) { - cv::Mat ret = cv::Mat::diag(*self); - return new cv::Mat(ret); + BEGIN_WRAP + self->assignTo(*m, type); + END_WRAP } -CVAPI(double) core_Mat_dot(cv::Mat *self, cv::Mat *m) +CVAPI(ExceptionStatus) core_Mat_setTo_Scalar(cv::Mat *self, MyCvScalar value, cv::Mat *mask) { - return self->dot(*m); + BEGIN_WRAP + if (mask == nullptr) + self->setTo(cpp(value)); + else + self->setTo(cpp(value), entity(mask)); + END_WRAP } - -CVAPI(uint64) core_Mat_elemSize(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_setTo_InputArray(cv::Mat *self, cv::_InputArray *value, cv::Mat *mask) { - return self->elemSize(); + BEGIN_WRAP + self->setTo(*value, entity(mask)); + END_WRAP } -CVAPI(uint64) core_Mat_elemSize1(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_reshape1(cv::Mat *self, int cn, int rows, cv::Mat **returnValue) { - return self->elemSize1(); + BEGIN_WRAP + const auto ret = self->reshape(cn, rows); + *returnValue = new cv::Mat(ret); + END_WRAP } - -CVAPI(int) core_Mat_empty(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_reshape2(cv::Mat *self, int cn, int newndims, const int* newsz, cv::Mat **returnValue) { - return self->empty() ? 1 : 0; -} - -CVAPI(cv::MatExpr*) core_Mat_eye(int rows, int cols, int type) -{ - cv::MatExpr eye = cv::Mat::eye(rows, cols, type); - cv::MatExpr *ret = new cv::MatExpr(eye); - return ret; + BEGIN_WRAP + const auto ret = self->reshape(cn, newndims, newsz); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_inv1(cv::Mat *self) -{ - cv::Mat ret = self->inv(); - return new cv::Mat(ret); -} -CVAPI(cv::Mat*) core_Mat_inv2(cv::Mat *self, int method) +CVAPI(ExceptionStatus) core_Mat_t(cv::Mat *self, cv::MatExpr **returnValue) { - cv::Mat ret = self->inv(method); - return new cv::Mat(ret); + BEGIN_WRAP + const auto expr = self->t(); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(int) core_Mat_isContinuous(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_inv(cv::Mat *self, int method, cv::MatExpr **returnValue) { - return self->isContinuous() ? 1 : 0; + BEGIN_WRAP + const auto ret = self->inv(method); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(int) core_Mat_isSubmatrix(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_mul(cv::Mat *self, cv::_InputArray *m, double scale, cv::MatExpr **returnValue) { - return self->isSubmatrix() ? 1 : 0; + BEGIN_WRAP + const auto ret = self->mul(*m, scale); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(void) core_Mat_locateROI(cv::Mat *self, MyCvSize *wholeSize, MyCvPoint *ofs) +CVAPI(ExceptionStatus) core_Mat_cross(cv::Mat *self, cv::_InputArray *m, cv::Mat **returnValue) { - cv::Size wholeSize2; - cv::Point ofs2; - self->locateROI(wholeSize2, ofs2); - *wholeSize = c(cv::Size(wholeSize2.width, wholeSize2.height)); - *ofs = c(cv::Point(ofs2.x, ofs2.y)); + BEGIN_WRAP + const auto ret = self->cross(*m); + *returnValue = new cv::Mat(ret); + END_WRAP } - -CVAPI(cv::MatExpr*) core_Mat_mul1(cv::Mat *self, cv::Mat *m) -{ - cv::MatExpr ret = self->mul(*m); - return new cv::MatExpr(ret); -} -CVAPI(cv::MatExpr*) core_Mat_mul2(cv::Mat *self, cv::Mat *m, double scale) +CVAPI(ExceptionStatus) core_Mat_dot(cv::Mat *self, cv::_InputArray *m, double *returnValue) { - cv::MatExpr ret = self->mul(*m, scale); - return new cv::MatExpr(ret); + BEGIN_WRAP + *returnValue = self->dot(*m); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_ones1(int rows, int cols, int type) +CVAPI(ExceptionStatus) core_Mat_zeros1(int rows, int cols, int type, cv::MatExpr **returnValue) { - cv::MatExpr ret = cv::Mat::ones(rows, cols, type); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto expr = cv::Mat::zeros(rows, cols, type); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_ones2(int ndims, const int *sz, int type) +CVAPI(ExceptionStatus) core_Mat_zeros2(int ndims, const int *sz, int type, cv::MatExpr **returnValue) { - //cv::MatExpr ret = cv::Mat::ones(ndims, sz, type); - //return new cv::MatExpr(ret); - return NULL; + BEGIN_WRAP + const auto expr = cv::Mat::zeros(ndims, sz, type); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_reshape1(cv::Mat *self, int cn) -{ - cv::Mat ret = self->reshape(cn); - return new cv::Mat(ret); -} -CVAPI(cv::Mat*) core_Mat_reshape2(cv::Mat *self, int cn, int rows) +CVAPI(ExceptionStatus) core_Mat_ones1(int rows, int cols, int type, cv::MatExpr **returnValue) { - cv::Mat ret = self->reshape(cn, rows); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::Mat::ones(rows, cols, type); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_reshape3(cv::Mat *self, int cn, int newndims, const int* newsz) +CVAPI(ExceptionStatus) core_Mat_ones2(int ndims, const int *sz, int type, cv::MatExpr **returnValue) { - cv::Mat ret = self->reshape(cn, newndims, newsz); - return new cv::Mat(ret); + BEGIN_WRAP + auto ret = cv::Mat::ones(ndims, sz, type); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_row_toMat(cv::Mat *self, int y) +CVAPI(ExceptionStatus) core_Mat_eye(int rows, int cols, int type, cv::MatExpr **returnValue) { - cv::Mat ret = self->row(y); - return new cv::Mat(ret); -} -CVAPI(cv::MatExpr*) core_Mat_row_toMatExpr(cv::Mat *self, int y) -{ - cv::Mat ret = self->row(y); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto eye = cv::Mat::eye(rows, cols, type); + *returnValue = new cv::MatExpr(eye); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_rowRange_toMat(cv::Mat *self, int startRow, int endRow) +CVAPI(ExceptionStatus) core_Mat_create1(cv::Mat *self, int rows, int cols, int type) { - cv::Mat ret = self->rowRange(startRow, endRow); - return new cv::Mat(ret); + BEGIN_WRAP + self->create(rows, cols, type); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_rowRange_toMatExpr(cv::Mat *self, int startRow, int endRow) +CVAPI(ExceptionStatus) core_Mat_create2(cv::Mat *self, int ndims, const int *sizes, int type) { - cv::Mat ret = self->rowRange(startRow, endRow); - return new cv::MatExpr(ret); + BEGIN_WRAP + self->create(ndims, sizes, type); + END_WRAP } -CVAPI(int) core_Mat_rows(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_reserve(cv::Mat *self, size_t sz) { - return self->rows; + BEGIN_WRAP + self->reserve(sz); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_setTo_Scalar(cv::Mat *self, MyCvScalar value, cv::Mat *mask) -{ - // crash - // core_Mat_setTo_Scalar(cv::Mat *self, MyCvScalar value, cv::InputArray *mask) - - cv::Mat ret; - if (mask == NULL) - ret = self->setTo(cpp(value)); - else - ret = self->setTo(cpp(value), entity(mask)); - return new cv::Mat(ret); -} -CVAPI(cv::Mat*) core_Mat_setTo_InputArray(cv::Mat *self, cv::_InputArray *value, cv::Mat *mask) +CVAPI(ExceptionStatus) core_Mat_reserveBuffer(cv::Mat *self, size_t sz) { - cv::Mat ret = self->setTo(*value, entity(mask)); - return new cv::Mat(ret); + BEGIN_WRAP + self->reserveBuffer(sz); + END_WRAP } -CVAPI(MyCvSize) core_Mat_size(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_resize1(cv::Mat *obj, size_t sz) { - return c(self->size()); + BEGIN_WRAP + obj->resize(sz); + END_WRAP } -CVAPI(int) core_Mat_sizeAt(cv::Mat *self, int i) +CVAPI(ExceptionStatus) core_Mat_resize2(cv::Mat *obj, size_t sz, MyCvScalar s) { - int size = self->size[i]; - return size; + BEGIN_WRAP + obj->resize(sz, cpp(s)); + END_WRAP } -CVAPI(uint64) core_Mat_step11(cv::Mat *self) -{ - return self->step1(); -} -CVAPI(uint64) core_Mat_step12(cv::Mat *self, int i) +CVAPI(ExceptionStatus) core_Mat_pop_back(cv::Mat *obj, size_t nelems) { - return self->step1(i); + BEGIN_WRAP + obj->pop_back(nelems); + END_WRAP } -CVAPI(uint64) core_Mat_step(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_locateROI(cv::Mat *self, MyCvSize *wholeSize, MyCvPoint *ofs) { - return self->step; + BEGIN_WRAP + cv::Size wholeSize2; + cv::Point ofs2; + self->locateROI(wholeSize2, ofs2); + *wholeSize = c(cv::Size(wholeSize2.width, wholeSize2.height)); + *ofs = c(cv::Point(ofs2.x, ofs2.y)); + END_WRAP } -CVAPI(uint64) core_Mat_stepAt(cv::Mat *self, int i) + +CVAPI(ExceptionStatus) core_Mat_adjustROI(cv::Mat *self, int dtop, int dbottom, int dleft, int dright, cv::Mat** returnValue) { - return self->step[i]; + BEGIN_WRAP + const auto ret = self->adjustROI(dtop, dbottom, dleft, dright); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_subMat1(cv::Mat *self, int rowStart, int rowEnd, int colStart, int colEnd) +CVAPI(ExceptionStatus) core_Mat_subMat1(cv::Mat *self, int rowStart, int rowEnd, int colStart, int colEnd, cv::Mat** returnValue) { - cv::Range rowRange(rowStart, rowEnd); - cv::Range colRange(colStart, colEnd); - cv::Mat ret = (*self)(rowRange, colRange); - return new cv::Mat(ret); + BEGIN_WRAP + const cv::Range rowRange(rowStart, rowEnd); + const cv::Range colRange(colStart, colEnd); + const auto ret = (*self)(rowRange, colRange); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) core_Mat_subMat2(cv::Mat *self, int nRanges, MyCvSlice *ranges) +CVAPI(ExceptionStatus) core_Mat_subMat2(cv::Mat *self, int nRanges, MyCvSlice *ranges, cv::Mat** returnValue) { - std::vector rangesVec; - for (int i = 0; i < nRanges; i++) + BEGIN_WRAP + std::vector rangesVec(nRanges); + for (auto i = 0; i < nRanges; i++) { - rangesVec.push_back(cpp(ranges[i])); + rangesVec[i] = (cpp(ranges[i])); } - cv::Mat ret = (*self)(&rangesVec[0]); - return new cv::Mat(ret); -} - -CVAPI(cv::Mat*) core_Mat_t(cv::Mat *self) -{ - cv::Mat expr = self->t(); - return new cv::Mat(expr); + const auto ret = (*self)(&rangesVec[0]); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(uint64) core_Mat_total(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_isContinuous(cv::Mat *self, int *returnValue) { - return self->total(); + BEGIN_WRAP + *returnValue = self->isContinuous() ? 1 : 0; + END_WRAP } -CVAPI(int) core_Mat_type(cv::Mat *self) +CVAPI(ExceptionStatus) core_Mat_isSubmatrix(cv::Mat *self, int *returnValue) { - return self->type(); + BEGIN_WRAP + *returnValue = self->isSubmatrix() ? 1 : 0; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_zeros1(int rows, int cols, int type) +CVAPI(ExceptionStatus) core_Mat_elemSize(cv::Mat *self, size_t *returnValue) { - cv::MatExpr expr = cv::Mat::zeros(rows, cols, type); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->elemSize(); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_zeros2(int ndims, const int *sz, int type) // Not defined in .lib +CVAPI(ExceptionStatus) core_Mat_elemSize1(cv::Mat *self, size_t *returnValue) { - //cv::MatExpr expr = cv::Mat::zeros(ndims, sz, type); - //return new cv::MatExpr(expr); - return NULL; + BEGIN_WRAP + *returnValue = self->elemSize1(); + END_WRAP } -CVAPI(char*) core_Mat_dump(cv::Mat *self, const char *format) +CVAPI(ExceptionStatus) core_Mat_type(cv::Mat *self, int *returnValue) { - std::stringstream s; - if (format == NULL) - s << *self; - else - s << cv::format(*self, 0); - std::string str = s.str(); - - const char *src = str.c_str(); - char *dst = new char[str.length() + 1]; - std::memcpy(dst, src, str.length() + 1); - return dst; -} -CVAPI(void) core_Mat_dump_delete(char *buf) -{ - delete[] buf; + BEGIN_WRAP + *returnValue = self->type(); + END_WRAP } -CVAPI(uchar*) core_Mat_ptr1d(cv::Mat *self, int i0) +CVAPI(ExceptionStatus) core_Mat_depth(cv::Mat *self, int *returnValue) { - return self->ptr(i0); -} -CVAPI(uchar*) core_Mat_ptr2d(cv::Mat *self, int i0, int i1) -{ - return self->ptr(i0, i1); -} -CVAPI(uchar*) core_Mat_ptr3d(cv::Mat *self, int i0, int i1, int i2) -{ - return self->ptr(i0, i1, i2); -} -CVAPI(uchar*) core_Mat_ptrnd(cv::Mat *self, int *idx) -{ - return self->ptr(idx); + BEGIN_WRAP + *returnValue = self->depth(); + END_WRAP } -CVAPI(void) core_Mat_reserve(cv::Mat *obj, size_t sz) -{ - obj->reserve(sz); -} -CVAPI(void) core_Mat_resize1(cv::Mat *obj, size_t sz) -{ - obj->resize(sz); -} -CVAPI(void) core_Mat_resize2(cv::Mat *obj, size_t sz, MyCvScalar s) -{ - obj->resize(sz, cpp(s)); -} -CVAPI(void) core_Mat_pop_back(cv::Mat *obj, size_t nelems) +CVAPI(ExceptionStatus) core_Mat_channels(cv::Mat *self, int *returnValue) { - obj->pop_back(nelems); + BEGIN_WRAP + *returnValue = self->channels(); + END_WRAP } - -#pragma endregion - -#pragma region Operators -CVAPI(void) core_Mat_assignment_FromMat(cv::Mat *self, cv::Mat *newMat) -{ - *self = *newMat; -} -CVAPI(void) core_Mat_assignment_FromMatExpr(cv::Mat *self, cv::MatExpr *newMatExpr) +CVAPI(ExceptionStatus) core_Mat_step1(cv::Mat *self, int i, size_t *returnValue) { - *self = *newMatExpr; -} -CVAPI(void) core_Mat_assignment_FromScalar(cv::Mat *self, MyCvScalar scalar) -{ - *self = cpp(scalar); + BEGIN_WRAP + *returnValue = self->step1(i); + END_WRAP } -CVAPI(void) core_Mat_IplImage(cv::Mat *self, IplImage *outImage) -{ - *outImage = IplImage(); - IplImage inImage = (IplImage)(*self); - memcpy(outImage, &inImage, sizeof(IplImage)); -} -CVAPI(void) core_Mat_IplImage_alignment(cv::Mat *self, IplImage **outImage) +CVAPI(ExceptionStatus) core_Mat_empty(cv::Mat *self, int *returnValue) { - // キャストの結果を参考に使う. - // メモリ管理の問題から、直接は使わない. - IplImage dummy = (IplImage)(*self); - // alignmentをそろえる - IplImage *img = cvCreateImage(cvSize(dummy.width, dummy.height), dummy.depth, dummy.nChannels); - int height = img->height; - size_t sstep = self->step; - size_t dstep = img->widthStep; - for (int i = 0; i < height; ++i) - { - char *dp = img->imageData + (dstep * i); - char *sp = (char*)(self->data) + (sstep * i); - memcpy(dp, sp, sstep); - } - *outImage = img; + BEGIN_WRAP + *returnValue = self->empty() ? 1 : 0; + END_WRAP } -CVAPI(void) core_Mat_CvMat(cv::Mat *self, CvMat *outMat) +CVAPI(ExceptionStatus) core_Mat_total1(cv::Mat *self, size_t *returnValue) { - *outMat = CvMat(); - CvMat inMat = (CvMat)(*self); - memcpy(outMat, &inMat, sizeof(CvMat)); + BEGIN_WRAP + *returnValue = self->total(); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorUnaryMinus(cv::Mat *mat) +CVAPI(ExceptionStatus) core_Mat_total2(cv::Mat *self, int startDim, int endDim, size_t *returnValue) { - cv::MatExpr expr = -(*mat); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->total(startDim, endDim); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorAdd_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) + (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorAdd_MatScalar(cv::Mat *a, MyCvScalar s) -{ - cv::MatExpr expr = (*a) + cpp(s); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorAdd_ScalarMat(MyCvScalar s, cv::Mat *a) +CVAPI(ExceptionStatus) core_Mat_checkVector(cv::Mat *self, int elemChannels, int depth, int requireContinuous, int *returnValue) { - cv::MatExpr expr = cpp(s) + (*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->checkVector(elemChannels, depth, requireContinuous != 0); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorMinus_Mat(cv::Mat *a) +CVAPI(ExceptionStatus) core_Mat_ptr1d(cv::Mat *self, int i0, uchar **returnValue) { - cv::MatExpr expr = -(*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->ptr(i0); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorSubtract_MatMat(cv::Mat *a, cv::Mat *b) +CVAPI(ExceptionStatus) core_Mat_ptr2d(cv::Mat *self, int i0, int i1, uchar **returnValue) { - cv::MatExpr expr = (*a) - (*b); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->ptr(i0, i1); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorSubtract_MatScalar(cv::Mat *a, MyCvScalar s) +CVAPI(ExceptionStatus) core_Mat_ptr3d(cv::Mat *self, int i0, int i1, int i2, uchar **returnValue) { - cv::MatExpr expr = (*a) - cpp(s); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->ptr(i0, i1, i2); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorSubtract_ScalarMat(MyCvScalar s, cv::Mat *a) +CVAPI(ExceptionStatus) core_Mat_ptrnd(cv::Mat *self, int *idx, uchar **returnValue) { - cv::MatExpr expr = cpp(s) - (*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->ptr(idx); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorMultiply_MatMat(cv::Mat *a, cv::Mat *b) +CVAPI(ExceptionStatus) core_Mat_flags(cv::Mat *self, int *returnValue) { - cv::MatExpr expr = (*a) * (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorMultiply_MatDouble(cv::Mat *a, double s) -{ - cv::MatExpr expr = (*a) * s; - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorMultiply_DoubleMat(double s, cv::Mat *a) -{ - cv::MatExpr expr = s * (*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->flags; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorDivide_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) / (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorDivide_MatDouble(cv::Mat *a, double s) +CVAPI(ExceptionStatus) core_Mat_dims(cv::Mat *self, int *returnValue) { - cv::MatExpr expr = (*a) / s; - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorDivide_DoubleMat(double s, cv::Mat *a) -{ - cv::MatExpr expr = s / (*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->dims; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorAnd_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) & (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorAnd_MatDouble(cv::Mat *a, double s) -{ - cv::MatExpr expr = (*a) & s; - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorAnd_DoubleMat(double s, cv::Mat *a) -{ - cv::MatExpr expr = s & (*a); - return new cv::MatExpr(expr); -} - -CVAPI(cv::MatExpr*) core_Mat_operatorOr_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) | (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorOr_MatDouble(cv::Mat *a, double s) +CVAPI(ExceptionStatus) core_Mat_rows(cv::Mat *self, int *returnValue) { - cv::MatExpr expr = (*a) | s; - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->rows; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorOr_DoubleMat(double s, cv::Mat *a) +CVAPI(ExceptionStatus) core_Mat_cols(cv::Mat *self, int *returnValue) { - cv::MatExpr expr = s | (*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->cols; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorXor_MatMat(cv::Mat *a, cv::Mat *b) +CVAPI(ExceptionStatus) core_Mat_data(cv::Mat *self, uchar **returnValue) { - cv::MatExpr expr = (*a) ^ (*b); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->data; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorXor_MatDouble(cv::Mat *a, double s) +CVAPI(ExceptionStatus) core_Mat_datastart(cv::Mat *self, const uchar **returnValue) { - cv::MatExpr expr = (*a) ^ s; - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->datastart; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorXor_DoubleMat(double s, cv::Mat *a) +CVAPI(ExceptionStatus) core_Mat_dataend(cv::Mat *self, const uchar **returnValue) { - cv::MatExpr expr = s ^ (*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->dataend; + END_WRAP } - -CVAPI(cv::MatExpr*) core_Mat_operatorNot(cv::Mat *a) +CVAPI(ExceptionStatus) core_Mat_datalimit(cv::Mat *self, const uchar **returnValue) { - cv::MatExpr expr = ~(*a); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->datalimit; + END_WRAP } - -// Comparison Operators - -// < -CVAPI(cv::MatExpr*) core_Mat_operatorLT_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) < (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorLT_DoubleMat(double a, cv::Mat *b) -{ - cv::MatExpr expr = a < (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorLT_MatDouble(cv::Mat *a, double b) -{ - cv::MatExpr expr = (*a) < b; - return new cv::MatExpr(expr); -} -// <= -CVAPI(cv::MatExpr*) core_Mat_operatorLE_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) <= (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorLE_DoubleMat(double a, cv::Mat *b) -{ - cv::MatExpr expr = a <= (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorLE_MatDouble(cv::Mat *a, double b) -{ - cv::MatExpr expr = (*a) <= b; - return new cv::MatExpr(expr); -} -// > -CVAPI(cv::MatExpr*) core_Mat_operatorGT_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) > (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorGT_DoubleMat(double a, cv::Mat *b) -{ - cv::MatExpr expr = a > (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorGT_MatDouble(cv::Mat *a, double b) +CVAPI(ExceptionStatus) core_Mat_size(cv::Mat *self, MyCvSize *returnValue) { - cv::MatExpr expr = (*a) > b; - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = c(self->size()); + END_WRAP } -// >= -CVAPI(cv::MatExpr*) core_Mat_operatorGE_MatMat(cv::Mat *a, cv::Mat *b) -{ - cv::MatExpr expr = (*a) >= (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorGE_DoubleMat(double a, cv::Mat *b) -{ - cv::MatExpr expr = a >= (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorGE_MatDouble(cv::Mat *a, double b) -{ - cv::MatExpr expr = (*a) >= b; - return new cv::MatExpr(expr); -} -// == -CVAPI(cv::MatExpr*) core_Mat_operatorEQ_MatMat(cv::Mat *a, cv::Mat *b) +CVAPI(ExceptionStatus) core_Mat_sizeAt(cv::Mat *self, int i, int *returnValue) { - cv::MatExpr expr = (*a) == (*b); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->size[i]; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorEQ_DoubleMat(double a, cv::Mat *b) + +CVAPI(ExceptionStatus) core_Mat_step(cv::Mat *self, size_t *returnValue) { - cv::MatExpr expr = a == (*b); - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->step; + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorEQ_MatDouble(cv::Mat *a, double b) +CVAPI(ExceptionStatus) core_Mat_stepAt(cv::Mat *self, int i, size_t *returnValue) { - cv::MatExpr expr = (*a) == b; - return new cv::MatExpr(expr); + BEGIN_WRAP + *returnValue = self->step[i]; + END_WRAP } -// != -CVAPI(cv::MatExpr*) core_Mat_operatorNE_MatMat(cv::Mat *a, cv::Mat *b) + +CVAPI(ExceptionStatus) core_abs_Mat(cv::Mat *m, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*a) != (*b); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto ret = cv::abs(*m); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_Mat_operatorNE_DoubleMat(double a, cv::Mat *b) + +/*CVAPI(ExceptionStatus) core_Mat_assignment_FromMat(cv::Mat *self, cv::Mat *newMat) { - cv::MatExpr expr = a != (*b); - return new cv::MatExpr(expr); -} -CVAPI(cv::MatExpr*) core_Mat_operatorNE_MatDouble(cv::Mat *a, double b) + BEGIN_WRAP + *self = *newMat; + END_WRAP +}*/ +/*CVAPI(ExceptionStatus) core_Mat_assignment_FromScalar(cv::Mat *self, MyCvScalar scalar) { - cv::MatExpr expr = (*a) != b; - return new cv::MatExpr(expr); -} + BEGIN_WRAP + *self = cpp(scalar); + END_WRAP +}*/ #pragma endregion -CVAPI(cv::MatExpr*) core_abs_Mat(cv::Mat *m) -{ - cv::MatExpr ret = cv::abs(*m); - return new cv::MatExpr(ret); -} - -#pragma region nSet/nGet +#pragma region getMatData/setMatData -template -static int internal_Mat_set(cv::Mat *m, int row, int col, char *buff, int count) +static bool internal_Mat_set(cv::Mat *m, uchar *buff) { - if (!m) return 0; - if (!buff) return 0; + if (!m) return false; + if (!buff) return false; + if (m->dims != 2) return false; - count *= sizeof(T); - int rest = ((m->rows - row) * m->cols - col) * (int)m->elemSize(); - if (count>rest) - count = rest; - int res = count; + const size_t bytesToCopy = static_cast(m->rows) * m->cols * m->elemSize(); if (m->isContinuous()) { - memcpy(m->ptr(row, col), buff, count); + memcpy(m->ptr(0, 0), buff, bytesToCopy); } else { // row by row - int num = (m->cols - col) * (int)m->elemSize(); // 1st partial row - if (countptr(row++, col); - while (count>0) + const size_t bytesInRow = m->cols * m->elemSize(); + for (int row = 0; row < m->rows; row++) { - memcpy(data, buff, num); - count -= num; - buff += num; - num = m->cols * (int)m->elemSize(); - if (countptr(row++, 0); + uchar *matData = m->ptr(row, 0); + memcpy(matData, buff, bytesInRow); + buff += bytesInRow; } } - return res; + + return true; } -template -static int internal_Mat_get(cv::Mat *m, int row, int col, char *buff, int count) +static bool internal_Mat_get(cv::Mat *m, uchar *buff) { - if (!m) return 0; - if (!buff) return 0; + if (!m) return false; + if (!buff) return false; + if (m->dims != 2) return false; - int bytesToCopy = count * sizeof(T); - int bytesRestInMat = ((m->rows - row) * m->cols - col) * (int)m->elemSize(); - if (bytesToCopy > bytesRestInMat) - bytesToCopy = bytesRestInMat; - int res = bytesToCopy; + const size_t bytesToCopy = static_cast(m->rows) * m->cols * m->elemSize(); if (m->isContinuous()) { - memcpy(buff, m->ptr(row, col), bytesToCopy); + memcpy(buff, m->ptr(0, 0), bytesToCopy); } else { // row by row - int bytesInRow = (m->cols - col) * (int)m->elemSize(); // 1st partial row - while (bytesToCopy > 0) + const size_t bytesInRow = m->cols * m->elemSize(); + for (int row = 0; row < m->rows; row++) { - int len = std::min(bytesToCopy, bytesInRow); - memcpy(buff, m->ptr(row, col), len); - bytesToCopy -= len; - buff += len; - row++; - col = 0; - bytesInRow = m->cols * (int)m->elemSize(); + const uchar *matData = m->ptr(row, 0); + memcpy(buff, matData, bytesInRow); + buff += bytesInRow; } } - return res; + + return true; } // unlike other nPut()-s this one (with double[]) should convert input values to correct type template static void internal_set_item(cv::Mat *mat, int r, int c, double *src, int &count) { - T *dst = (T*)mat->ptr(r, c); - for (int ch = 0; ch < mat->channels() && count > 0; count--, ch++, src++, dst++) + T *dst = reinterpret_cast(mat->ptr(r, c)); + for (auto ch = 0; ch < mat->channels() && count > 0; count--, ch++, src++, dst++) *dst = cv::saturate_cast(*src); } - -CVAPI(int) core_Mat_nSetB(cv::Mat *obj, int row, int col, uchar *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetS(cv::Mat *obj, int row, int col, short *vals, int valsLength) +CVAPI(ExceptionStatus) core_Mat_setMatData(cv::Mat *obj, uchar *vals, int *returnValue) { - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetI(cv::Mat *obj, int row, int col, int *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetF(cv::Mat *obj, int row, int col, float *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetD(cv::Mat *obj, int row, int col, double *vals, int valsLength) -{ - int rest = ((obj->rows - row) * obj->cols - col) * obj->channels(); - int count = valsLength; - if (count > rest) - count = rest; - int res = count; - double* src = vals; - int r, c; - for (c = col; ccols && count > 0; c++) - { - switch (obj->depth()) - { - case CV_8U: internal_set_item(obj, row, c, src, count); break; - case CV_8S: internal_set_item(obj, row, c, src, count); break; - case CV_16U: internal_set_item(obj, row, c, src, count); break; - case CV_16S: internal_set_item(obj, row, c, src, count); break; - case CV_32S: internal_set_item(obj, row, c, src, count); break; - case CV_32F: internal_set_item(obj, row, c, src, count); break; - case CV_64F: internal_set_item(obj, row, c, src, count); break; - } - } - for (r = row + 1; r < obj->rows && count > 0; r++) - { - for (c = 0; c < obj->cols && count > 0; c++) - { - switch (obj->depth()) - { - case CV_8U: internal_set_item(obj, r, c, src, count); break; - case CV_8S: internal_set_item(obj, r, c, src, count); break; - case CV_16U: internal_set_item(obj, r, c, src, count); break; - case CV_16S: internal_set_item(obj, r, c, src, count); break; - case CV_32S: internal_set_item(obj, r, c, src, count); break; - case CV_32F: internal_set_item(obj, r, c, src, count); break; - case CV_64F: internal_set_item(obj, r, c, src, count); break; - } - } - } - return res; -} -CVAPI(int) core_Mat_nSetVec3b(cv::Mat *obj, int row, int col, cv::Vec3b *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetVec3d(cv::Mat *obj, int row, int col, cv::Vec3d *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetVec4f(cv::Mat *obj, int row, int col, cv::Vec4f *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetVec6f(cv::Mat *obj, int row, int col, cv::Vec6f *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetVec4i(cv::Mat *obj, int row, int col, cv::Vec4i *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetPoint(cv::Mat *obj, int row, int col, cv::Point *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetPoint2f(cv::Mat *obj, int row, int col, cv::Point2f *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetPoint2d(cv::Mat *obj, int row, int col, cv::Point2d *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetPoint3i(cv::Mat *obj, int row, int col, cv::Point3i *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetPoint3f(cv::Mat *obj, int row, int col, cv::Point3f *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetPoint3d(cv::Mat *obj, int row, int col, cv::Point3d *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nSetRect(cv::Mat *obj, int row, int col, cv::Rect *vals, int valsLength) -{ - return internal_Mat_set(obj, row, col, (char*)vals, valsLength); + BEGIN_WRAP + *returnValue = internal_Mat_set(obj, vals) ? 1 : 0; + END_WRAP } -CVAPI(int) core_Mat_nGetB(cv::Mat *obj, int row, int col, uchar *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetS(cv::Mat *obj, int row, int col, short *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetI(cv::Mat *obj, int row, int col, int *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetF(cv::Mat *obj, int row, int col, float *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetD(cv::Mat *obj, int row, int col, double *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetVec3b(cv::Mat *obj, int row, int col, cv::Vec3b *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetVec3d(cv::Mat *obj, int row, int col, cv::Vec3d *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetVec4f(cv::Mat *obj, int row, int col, cv::Vec4f *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetVec6f(cv::Mat *obj, int row, int col, cv::Vec6f *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetVec4i(cv::Mat *obj, int row, int col, cv::Vec4i *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetPoint(cv::Mat *obj, int row, int col, cv::Point *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetPoint2f(cv::Mat *obj, int row, int col, cv::Point2f *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetPoint2d(cv::Mat *obj, int row, int col, cv::Point2d *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetPoint3i(cv::Mat *obj, int row, int col, cv::Point3i *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetPoint3f(cv::Mat *obj, int row, int col, cv::Point3f *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetPoint3d(cv::Mat *obj, int row, int col, cv::Point3d *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); -} -CVAPI(int) core_Mat_nGetRect(cv::Mat *obj, int row, int col, cv::Rect *vals, int valsLength) -{ - return internal_Mat_get(obj, row, col, (char*)vals, valsLength); +CVAPI(ExceptionStatus) core_Mat_getMatData(cv::Mat *obj, uchar *vals, int *returnValue) +{ + BEGIN_WRAP + *returnValue = internal_Mat_get(obj, vals) ? 1 : 0; + END_WRAP } #pragma endregion #pragma region push_back -CVAPI(void) core_Mat_push_back_Mat(cv::Mat *self, cv::Mat *m) +CVAPI(ExceptionStatus) core_Mat_push_back_Mat(cv::Mat *self, cv::Mat *m) { + BEGIN_WRAP self->push_back(*m); + END_WRAP } -CVAPI(void) core_Mat_push_back_char(cv::Mat *self, char v) +CVAPI(ExceptionStatus) core_Mat_push_back_char(cv::Mat *self, char v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_uchar(cv::Mat *self, uchar v) +CVAPI(ExceptionStatus) core_Mat_push_back_uchar(cv::Mat *self, uchar v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_short(cv::Mat *self, short v) +CVAPI(ExceptionStatus) core_Mat_push_back_short(cv::Mat *self, short v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_ushort(cv::Mat *self, ushort v) +CVAPI(ExceptionStatus) core_Mat_push_back_ushort(cv::Mat *self, ushort v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_int(cv::Mat *self, int v) +CVAPI(ExceptionStatus) core_Mat_push_back_int(cv::Mat *self, int v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_float(cv::Mat *self, float v) +CVAPI(ExceptionStatus) core_Mat_push_back_float(cv::Mat *self, float v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_double(cv::Mat *self, double v) +CVAPI(ExceptionStatus) core_Mat_push_back_double(cv::Mat *self, double v) { + BEGIN_WRAP self->push_back(v); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec2b(cv::Mat *self, CvVec2b v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec2b(cv::Mat *self, CvVec2b v) { + BEGIN_WRAP self->push_back(cv::Vec2b(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec3b(cv::Mat *self, CvVec3b v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec3b(cv::Mat *self, CvVec3b v) { + BEGIN_WRAP self->push_back(cv::Vec3b(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec4b(cv::Mat *self, CvVec4b v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec4b(cv::Mat *self, CvVec4b v) { + BEGIN_WRAP self->push_back(cv::Vec4b(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec6b(cv::Mat *self, CvVec6b v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec6b(cv::Mat *self, CvVec6b v) { + BEGIN_WRAP self->push_back(cv::Vec6b(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec2s(cv::Mat *self, CvVec2s v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec2s(cv::Mat *self, CvVec2s v) { + BEGIN_WRAP self->push_back(cv::Vec2s(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec3s(cv::Mat *self, CvVec3s v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec3s(cv::Mat *self, CvVec3s v) { + BEGIN_WRAP self->push_back(cv::Vec3s(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec4s(cv::Mat *self, CvVec4s v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec4s(cv::Mat *self, CvVec4s v) { + BEGIN_WRAP self->push_back(cv::Vec4s(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec6s(cv::Mat *self, CvVec6s v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec6s(cv::Mat *self, CvVec6s v) { + BEGIN_WRAP self->push_back(cv::Vec6s(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec2w(cv::Mat *self, CvVec2w v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec2w(cv::Mat *self, CvVec2w v) { + BEGIN_WRAP self->push_back(cv::Vec2w(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec3w(cv::Mat *self, CvVec3w v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec3w(cv::Mat *self, CvVec3w v) { + BEGIN_WRAP self->push_back(cv::Vec3w(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec4w(cv::Mat *self, CvVec4w v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec4w(cv::Mat *self, CvVec4w v) { + BEGIN_WRAP self->push_back(cv::Vec4w(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec6w(cv::Mat *self, CvVec6w v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec6w(cv::Mat *self, CvVec6w v) { + BEGIN_WRAP self->push_back(cv::Vec6w(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec2i(cv::Mat *self, CvVec2i v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec2i(cv::Mat *self, CvVec2i v) { + BEGIN_WRAP self->push_back(cv::Vec2i(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec3i(cv::Mat *self, CvVec3i v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec3i(cv::Mat *self, CvVec3i v) { + BEGIN_WRAP self->push_back(cv::Vec3i(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec4i(cv::Mat *self, CvVec4i v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec4i(cv::Mat *self, CvVec4i v) { + BEGIN_WRAP self->push_back(cv::Vec4i(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec6i(cv::Mat *self, CvVec6i v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec6i(cv::Mat *self, CvVec6i v) { + BEGIN_WRAP self->push_back(cv::Vec6i(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec2f(cv::Mat *self, CvVec2f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec2f(cv::Mat *self, CvVec2f v) { + BEGIN_WRAP self->push_back(cv::Vec2f(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec3f(cv::Mat *self, CvVec3f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec3f(cv::Mat *self, CvVec3f v) { + BEGIN_WRAP self->push_back(cv::Vec3f(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec4f(cv::Mat *self, CvVec4f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec4f(cv::Mat *self, CvVec4f v) { + BEGIN_WRAP self->push_back(cv::Vec4f(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec6f(cv::Mat *self, CvVec6f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec6f(cv::Mat *self, CvVec6f v) { + BEGIN_WRAP self->push_back(cv::Vec6f(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec2d(cv::Mat *self, CvVec2d v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec2d(cv::Mat *self, CvVec2d v) { + BEGIN_WRAP self->push_back(cv::Vec2d(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec3d(cv::Mat *self, CvVec3d v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec3d(cv::Mat *self, CvVec3d v) { + BEGIN_WRAP self->push_back(cv::Vec3d(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec4d(cv::Mat *self, CvVec4d v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec4d(cv::Mat *self, CvVec4d v) { + BEGIN_WRAP self->push_back(cv::Vec4d(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Vec6d(cv::Mat *self, CvVec6d v) +CVAPI(ExceptionStatus) core_Mat_push_back_Vec6d(cv::Mat *self, CvVec6d v) { + BEGIN_WRAP self->push_back(cv::Vec6d(v.val)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Point(cv::Mat *self, CvPoint v) +CVAPI(ExceptionStatus) core_Mat_push_back_Point(cv::Mat *self, MyCvPoint v) { - self->push_back((cv::Point)v); + BEGIN_WRAP + self->push_back(cv::Point(v.x, v.y)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Point2f(cv::Mat *self, CvPoint2D32f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Point2f(cv::Mat *self, MyCvPoint2D32f v) { - self->push_back((cv::Point2f)v); + BEGIN_WRAP + self->push_back(cv::Point2f(v.x, v.y)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Point2d(cv::Mat *self, CvPoint2D64f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Point2d(cv::Mat *self, MyCvPoint2D64f v) { + BEGIN_WRAP self->push_back(cv::Point2d(v.x, v.y)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Point3i(cv::Mat *self, CvPoint3D v) +CVAPI(ExceptionStatus) core_Mat_push_back_Point3i(cv::Mat *self, MyCvPoint3D32i v) { + BEGIN_WRAP self->push_back(cv::Point3i(v.x, v.y, v.z)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Point3f(cv::Mat *self, CvPoint3D32f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Point3f(cv::Mat *self, MyCvPoint3D32f v) { - self->push_back((cv::Point3f)v); + BEGIN_WRAP + self->push_back(cv::Point3f(v.x, v.y, v.z)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Point3d(cv::Mat *self, CvPoint3D64f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Point3d(cv::Mat *self, MyCvPoint3D64f v) { + BEGIN_WRAP self->push_back(cv::Point3d(v.x, v.y, v.z)); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_push_back_Size(cv::Mat *self, MyCvSize v) +{ + BEGIN_WRAP + self->push_back(cv::Size(v.width, v.height)); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_push_back_Size2f(cv::Mat *self, MyCvSize2D32f v) +{ + BEGIN_WRAP + self->push_back(cv::Size2f(v.width, v.height)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Size(cv::Mat *self, CvSize v) +CVAPI(ExceptionStatus) core_Mat_push_back_Size2d(cv::Mat *self, MyCvSize2D64f v) { - self->push_back((cv::Size)v); + BEGIN_WRAP + self->push_back(cv::Size2d(v.width, v.height)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Size2f(cv::Mat *self, CvSize2D32f v) +CVAPI(ExceptionStatus) core_Mat_push_back_Rect(cv::Mat *self, MyCvRect v) { - self->push_back((cv::Size2f)v); + BEGIN_WRAP + self->push_back(cv::Rect(v.x, v.y, v.width, v.height)); + END_WRAP } -CVAPI(void) core_Mat_push_back_Rect(cv::Mat *self, CvRect v) +CVAPI(ExceptionStatus) core_Mat_push_back_Rect2f(cv::Mat *self, MyCvRect2D32f v) { - self->push_back((cv::Rect)v); + BEGIN_WRAP + self->push_back(cv::Rect2f(v.x, v.y, v.width, v.height)); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_push_back_Rect2d(cv::Mat *self, MyCvRect2D64f v) +{ + BEGIN_WRAP + self->push_back(cv::Rect2d(v.x, v.y, v.width, v.height)); + END_WRAP } #pragma endregion @@ -1252,136 +998,500 @@ struct Functor } }; -CVAPI(void) core_Mat_forEach_uchar(cv::Mat *m, Mat_foreach_uchar proc) +CVAPI(ExceptionStatus) core_Mat_forEach_uchar(cv::Mat *m, Mat_foreach_uchar proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec2b(cv::Mat *m, Mat_foreach_Vec2b proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec2b(cv::Mat *m, Mat_foreach_Vec2b proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec3b(cv::Mat *m, Mat_foreach_Vec3b proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec3b(cv::Mat *m, Mat_foreach_Vec3b proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec4b(cv::Mat *m, Mat_foreach_Vec4b proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec4b(cv::Mat *m, Mat_foreach_Vec4b proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec6b(cv::Mat *m, Mat_foreach_Vec6b proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec6b(cv::Mat *m, Mat_foreach_Vec6b proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_short(cv::Mat *m, Mat_foreach_short proc) +CVAPI(ExceptionStatus) core_Mat_forEach_short(cv::Mat *m, Mat_foreach_short proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec2s(cv::Mat *m, Mat_foreach_Vec2s proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec2s(cv::Mat *m, Mat_foreach_Vec2s proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec3s(cv::Mat *m, Mat_foreach_Vec3s proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec3s(cv::Mat *m, Mat_foreach_Vec3s proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec4s(cv::Mat *m, Mat_foreach_Vec4s proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec4s(cv::Mat *m, Mat_foreach_Vec4s proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec6s(cv::Mat *m, Mat_foreach_Vec6s proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec6s(cv::Mat *m, Mat_foreach_Vec6s proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_int(cv::Mat *m, Mat_foreach_int proc) +CVAPI(ExceptionStatus) core_Mat_forEach_int(cv::Mat *m, Mat_foreach_int proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec2i(cv::Mat *m, Mat_foreach_Vec2i proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec2i(cv::Mat *m, Mat_foreach_Vec2i proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec3i(cv::Mat *m, Mat_foreach_Vec3i proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec3i(cv::Mat *m, Mat_foreach_Vec3i proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec4i(cv::Mat *m, Mat_foreach_Vec4i proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec4i(cv::Mat *m, Mat_foreach_Vec4i proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec6i(cv::Mat *m, Mat_foreach_Vec6i proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec6i(cv::Mat *m, Mat_foreach_Vec6i proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_float(cv::Mat *m, Mat_foreach_float proc) +CVAPI(ExceptionStatus) core_Mat_forEach_float(cv::Mat *m, Mat_foreach_float proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec2f(cv::Mat *m, Mat_foreach_Vec2f proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec2f(cv::Mat *m, Mat_foreach_Vec2f proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec3f(cv::Mat *m, Mat_foreach_Vec3f proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec3f(cv::Mat *m, Mat_foreach_Vec3f proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec4f(cv::Mat *m, Mat_foreach_Vec4f proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec4f(cv::Mat *m, Mat_foreach_Vec4f proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec6f(cv::Mat *m, Mat_foreach_Vec6f proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec6f(cv::Mat *m, Mat_foreach_Vec6f proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } - -CVAPI(void) core_Mat_forEach_double(cv::Mat *m, Mat_foreach_double proc) +CVAPI(ExceptionStatus) core_Mat_forEach_double(cv::Mat *m, Mat_foreach_double proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec2d(cv::Mat *m, Mat_foreach_Vec2d proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec2d(cv::Mat *m, Mat_foreach_Vec2d proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec3d(cv::Mat *m, Mat_foreach_Vec3d proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec3d(cv::Mat *m, Mat_foreach_Vec3d proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec4d(cv::Mat *m, Mat_foreach_Vec4d proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec4d(cv::Mat *m, Mat_foreach_Vec4d proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } -CVAPI(void) core_Mat_forEach_Vec6d(cv::Mat *m, Mat_foreach_Vec6d proc) +CVAPI(ExceptionStatus) core_Mat_forEach_Vec6d(cv::Mat *m, Mat_foreach_Vec6d proc) { - Functor functor(proc); + BEGIN_WRAP + const Functor functor(proc); m->forEach(functor); + END_WRAP } #pragma endregion -#endif \ No newline at end of file +#pragma region Operators + +CVAPI(ExceptionStatus) core_Mat_operatorUnaryMinus(cv::Mat *mat, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = -(*mat); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorAdd_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) + (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorAdd_MatScalar(cv::Mat *a, MyCvScalar s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) + cpp(s); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorAdd_ScalarMat(MyCvScalar s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = cpp(s) + (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorMinus_Mat(cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = -(*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorSubtract_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) - (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorSubtract_MatScalar(cv::Mat *a, MyCvScalar s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) - cpp(s); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorSubtract_ScalarMat(MyCvScalar s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = cpp(s) - (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorMultiply_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) * (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorMultiply_MatDouble(cv::Mat *a, double s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) * s; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorMultiply_DoubleMat(double s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = s * (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorDivide_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) / (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorDivide_MatDouble(cv::Mat *a, double s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) / s; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorDivide_DoubleMat(double s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = s / (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorAnd_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) & (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorAnd_MatDouble(cv::Mat *a, double s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) & s; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorAnd_DoubleMat(double s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = s & (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorOr_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) | (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorOr_MatDouble(cv::Mat *a, double s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) | s; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorOr_DoubleMat(double s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = s | (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorXor_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) ^ (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorXor_MatDouble(cv::Mat *a, double s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) ^ s; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorXor_DoubleMat(double s, cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = s ^ (*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_Mat_operatorNot(cv::Mat *a, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = ~(*a); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + + +// Comparison Operators + +// < +CVAPI(ExceptionStatus) core_Mat_operatorLT_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) < (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorLT_DoubleMat(double a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = a < (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorLT_MatDouble(cv::Mat *a, double b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) < b; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +// <= +CVAPI(ExceptionStatus) core_Mat_operatorLE_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) <= (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorLE_DoubleMat(double a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = a <= (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorLE_MatDouble(cv::Mat *a, double b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) <= b; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +// > +CVAPI(ExceptionStatus) core_Mat_operatorGT_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) > (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorGT_DoubleMat(double a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = a > (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorGT_MatDouble(cv::Mat *a, double b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) > b; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +// >= +CVAPI(ExceptionStatus) core_Mat_operatorGE_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) >= (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorGE_DoubleMat(double a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = a >= (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorGE_MatDouble(cv::Mat *a, double b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) >= b; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +// == +CVAPI(ExceptionStatus) core_Mat_operatorEQ_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) == (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorEQ_DoubleMat(double a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = a == (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorEQ_MatDouble(cv::Mat *a, double b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) == b; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +// != +CVAPI(ExceptionStatus) core_Mat_operatorNE_MatMat(cv::Mat *a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) != (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorNE_DoubleMat(double a, cv::Mat *b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = a != (*b); + *returnValue = new cv::MatExpr(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_Mat_operatorNE_MatDouble(cv::Mat *a, double b, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto expr = (*a) != b; + *returnValue = new cv::MatExpr(expr); + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/core_MatExpr.h b/src/OpenCvSharpExtern/core_MatExpr.h index 05e239c56..db1142488 100644 --- a/src/OpenCvSharpExtern/core_MatExpr.h +++ b/src/OpenCvSharpExtern/core_MatExpr.h @@ -1,220 +1,301 @@ -#ifndef _CPP_CORE_MATEXPR_H_ -#define _CPP_CORE_MATEXPR_H_ +#pragma once #include "include_opencv.h" -CVAPI(cv::MatExpr*) core_MatExpr_new1() +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +CVAPI(ExceptionStatus) core_MatExpr_new1(cv::MatExpr **returnValue) { - return new cv::MatExpr(); + BEGIN_WRAP + *returnValue = new cv::MatExpr; + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_new2(cv::Mat *mat) +CVAPI(ExceptionStatus) core_MatExpr_new2(cv::Mat *mat, cv::MatExpr **returnValue) { - return new cv::MatExpr(*mat); + BEGIN_WRAP + *returnValue = new cv::MatExpr(*mat); + END_WRAP } -CVAPI(void) core_MatExpr_delete(cv::MatExpr *self) + +CVAPI(ExceptionStatus) core_MatExpr_delete(cv::MatExpr *self) { + BEGIN_WRAP delete self; + END_WRAP } -CVAPI(cv::Mat*) core_MatExpr_toMat(cv::MatExpr *self) +CVAPI(ExceptionStatus) core_MatExpr_toMat(cv::MatExpr *self, cv::Mat *returnValue) { - cv::Mat ret = (*self); - return new cv::Mat(ret); + BEGIN_WRAP + *returnValue = (*self); + END_WRAP } #pragma region Functions -CVAPI(cv::MatExpr*) core_MatExpr_row(cv::MatExpr *self, int y) -{ - cv::MatExpr ret = self->row(y); - return new cv::MatExpr(ret); -} -CVAPI(cv::MatExpr*) core_MatExpr_col(cv::MatExpr *self, int x) -{ - cv::MatExpr ret = self->col(x); - return new cv::MatExpr(ret); -} -CVAPI(cv::MatExpr*) core_MatExpr_diag1(cv::MatExpr *self) + +CVAPI(ExceptionStatus) core_MatExpr_row(cv::MatExpr *self, int y, cv::MatExpr **returnValue) { - cv::MatExpr ret = self->diag(); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->row(y); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_diag2(cv::MatExpr *self, int d) +CVAPI(ExceptionStatus) core_MatExpr_col(cv::MatExpr *self, int x, cv::MatExpr **returnValue) { - cv::MatExpr ret = self->diag(d); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->col(x); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_submat(cv::MatExpr *self, int rowStart, int rowEnd, int colStart, int colEnd) + +CVAPI(ExceptionStatus) core_MatExpr_diag(cv::MatExpr *self, int d, cv::MatExpr **returnValue) { - cv::Range rowRange(rowStart, rowEnd); - cv::Range colRange(colStart, colEnd); - cv::MatExpr ret = (*self)(rowRange, colRange); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->diag(d); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::Mat*) core_MatExpr_cross(cv::MatExpr *self, cv::Mat *m) + +CVAPI(ExceptionStatus) core_MatExpr_submat(cv::MatExpr *self, int rowStart, int rowEnd, int colStart, int colEnd, cv::MatExpr **returnValue) { - cv::Mat ret = self->cross(*m); - return new cv::Mat(ret); + BEGIN_WRAP + const cv::Range rowRange(rowStart, rowEnd); + const cv::Range colRange(colStart, colEnd); + const auto ret = (*self)(rowRange, colRange); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(double) core_MatExpr_dot(cv::MatExpr *self, cv::Mat *m) + +CVAPI(ExceptionStatus) core_MatExpr_t(cv::MatExpr *self, cv::MatExpr **returnValue) { - return self->dot(*m); + BEGIN_WRAP + const auto ret = self->t(); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_t(cv::MatExpr *self) + +CVAPI(ExceptionStatus) core_MatExpr_inv(cv::MatExpr *self, int method, cv::MatExpr **returnValue) { - cv::MatExpr ret = self->t(); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->inv(method); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_inv1(cv::MatExpr *self) + +CVAPI(ExceptionStatus) core_MatExpr_mul_toMatExpr(cv::MatExpr *self, cv::MatExpr *e, double scale, cv::MatExpr **returnValue) { - cv::MatExpr ret = self->inv(); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->mul(*e, scale); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_inv2(cv::MatExpr *self, int method) +CVAPI(ExceptionStatus) core_MatExpr_mul_toMat(cv::MatExpr *self, cv::Mat *m, double scale, cv::MatExpr **returnValue) { - cv::MatExpr ret = self->inv(method); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->mul(*m, scale); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_mul_toMatExpr(cv::MatExpr *self, cv::MatExpr *e, double scale) + +CVAPI(ExceptionStatus) core_MatExpr_cross(cv::MatExpr *self, cv::Mat *m, cv::Mat **returnValue) { - cv::MatExpr ret = self->mul(*e, scale); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = self->cross(*m); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_MatExpr_mul_toMat(cv::MatExpr *self, cv::Mat *m, double scale) + +CVAPI(ExceptionStatus) core_MatExpr_dot(cv::MatExpr *self, cv::Mat *m, double *returnValue) { - cv::MatExpr ret = self->mul(*m, scale); - return new cv::MatExpr(ret); + BEGIN_WRAP + *returnValue = self->dot(*m); + END_WRAP } -CVAPI(MyCvSize) core_MatExpr_size(cv::MatExpr *self) + +CVAPI(ExceptionStatus) core_MatExpr_size(cv::MatExpr *self, MyCvSize *returnValue) { - return c(self->size()); + BEGIN_WRAP + *returnValue = c(self->size()); + END_WRAP } -CVAPI(int) core_MatExpr_type(cv::MatExpr *self) + +CVAPI(ExceptionStatus) core_MatExpr_type(cv::MatExpr *self, int *returnValue) { - return self->type(); + BEGIN_WRAP + *returnValue = self->type(); + END_WRAP } + #pragma endregion #pragma region Operators -CVAPI(cv::MatExpr*) core_operatorUnaryMinus_MatExpr(cv::MatExpr *e) + +CVAPI(ExceptionStatus) core_operatorUnaryMinus_MatExpr(cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr expr = -(*e); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = -(*e); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorUnaryNot_MatExpr(cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorUnaryNot_MatExpr(cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr expr = ~(*e); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = ~(*e); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorAdd_MatExprMat(cv::MatExpr *e, cv:: Mat *m) +CVAPI(ExceptionStatus) core_operatorAdd_MatExprMat(cv::MatExpr *e, cv:: Mat *m, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*e) + (*m); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*e) + (*m); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorAdd_MatMatExpr(cv::Mat *m, cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorAdd_MatMatExpr(cv::Mat *m, cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*m) + (*e); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*m) + (*e); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorAdd_MatExprScalar(cv::MatExpr *e, CvScalar s) +CVAPI(ExceptionStatus) core_operatorAdd_MatExprScalar(cv::MatExpr *e, MyCvScalar s, cv::MatExpr **returnValue) { - cv::MatExpr expr = s + (*e); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*e) + cpp(s); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorAdd_ScalarMatExpr(CvScalar s, cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorAdd_ScalarMatExpr(MyCvScalar s, cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*e) + s; - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = cpp(s) + (*e); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorAdd_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2) +CVAPI(ExceptionStatus) core_operatorAdd_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*e1) + (*e2); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*e1) + (*e2); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorSubtract_MatExprMat(cv::MatExpr *e, cv::Mat *m) +CVAPI(ExceptionStatus) core_operatorSubtract_MatExprMat(cv::MatExpr *e, cv::Mat *m, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*e) - (*m); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*e) - (*m); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorSubtract_MatMatExpr(cv::Mat *m, cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorSubtract_MatMatExpr(cv::Mat *m, cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*m) - (*e); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*m) - (*e); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorSubtract_MatExprScalar(cv::MatExpr *e, CvScalar s) +CVAPI(ExceptionStatus) core_operatorSubtract_MatExprScalar(cv::MatExpr *e, MyCvScalar s, cv::MatExpr **returnValue) { - cv::MatExpr expr = s - (*e); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*e) - cpp(s); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorSubtract_ScalarMatExpr(CvScalar s, cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorSubtract_ScalarMatExpr(MyCvScalar s, cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*e) - s; - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = cpp(s) - (*e); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorSubtract_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2) +CVAPI(ExceptionStatus) core_operatorSubtract_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2, cv::MatExpr **returnValue) { - cv::MatExpr expr = (*e1) - (*e2); - return new cv::MatExpr(expr); + BEGIN_WRAP + const auto expr = (*e1) - (*e2); + *returnValue = new cv::MatExpr(expr); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorMultiply_MatExprMat(cv::MatExpr *e, cv::Mat *m) +CVAPI(ExceptionStatus) core_operatorMultiply_MatExprMat(cv::MatExpr *e, cv::Mat *m, cv::MatExpr **returnValue) { - cv::MatExpr ret = (*e) * (*m); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = (*e) * (*m); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorMultiply_MatMatExpr(cv::Mat *m, cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorMultiply_MatMatExpr(cv::Mat *m, cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr ret = (*m) * (*e); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = (*m) * (*e); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorMultiply_MatExprDouble(cv::MatExpr *e, double s) +CVAPI(ExceptionStatus) core_operatorMultiply_MatExprDouble(cv::MatExpr *e, double s, cv::MatExpr **returnValue) { - cv::MatExpr ret = (*e) * s; - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = (*e) * s; + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorMultiply_DoubleMatExpr(double s, cv::MatExpr *e) +CVAPI(ExceptionStatus) core_operatorMultiply_DoubleMatExpr(double s, cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr ret = s * (*e); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = s * (*e); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorMultiply_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2) +CVAPI(ExceptionStatus) core_operatorMultiply_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2, cv::MatExpr **returnValue) { - cv::MatExpr ret = (*e1) * (*e2); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = (*e1) * (*e2); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorDivide_MatExprMat(cv::MatExpr *e, cv::Mat *m) -{ - cv::MatExpr ret = (*e) / (*m); - return new cv::MatExpr(ret); +CVAPI(ExceptionStatus) core_operatorDivide_MatExprMat(cv::MatExpr *e, cv::Mat *m, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto ret = (*e) / (*m); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorDivide_MatMatExpr(cv::Mat *m, cv::MatExpr *e) -{ - cv::MatExpr ret = (*m) / (*e); - return new cv::MatExpr(ret); +CVAPI(ExceptionStatus) core_operatorDivide_MatMatExpr(cv::Mat *m, cv::MatExpr *e, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto ret = (*m) / (*e); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorDivide_MatExprDouble(cv::MatExpr *e, double s) -{ - cv::MatExpr ret = (*e) / s; - return new cv::MatExpr(ret); +CVAPI(ExceptionStatus) core_operatorDivide_MatExprDouble(cv::MatExpr *e, double s, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto ret = (*e) / s; + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorDivide_DoubleMatExpr(double s, cv::MatExpr *e) -{ - cv::MatExpr ret = s / (*e); - return new cv::MatExpr(ret); +CVAPI(ExceptionStatus) core_operatorDivide_DoubleMatExpr(double s, cv::MatExpr *e, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto ret = s / (*e); + *returnValue = new cv::MatExpr(ret); + END_WRAP } -CVAPI(cv::MatExpr*) core_operatorDivide_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2) -{ - cv::MatExpr ret = (*e1) / (*e2); - return new cv::MatExpr(ret); +CVAPI(ExceptionStatus) core_operatorDivide_MatExprMatExpr(cv::MatExpr *e1, cv::MatExpr *e2, cv::MatExpr **returnValue) +{ + BEGIN_WRAP + const auto ret = (*e1) / (*e2); + *returnValue = new cv::MatExpr(ret); + END_WRAP } #pragma endregion -CVAPI(cv::MatExpr*) core_abs_MatExpr(cv::MatExpr *e) +CVAPI(ExceptionStatus) core_abs_MatExpr(cv::MatExpr *e, cv::MatExpr **returnValue) { - cv::MatExpr ret = cv::abs(*e); - return new cv::MatExpr(ret); + BEGIN_WRAP + const auto ret = cv::abs(*e); + *returnValue = new cv::MatExpr(ret); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/core_OutputArray.h b/src/OpenCvSharpExtern/core_OutputArray.h index d4af1320c..1df91239e 100644 --- a/src/OpenCvSharpExtern/core_OutputArray.h +++ b/src/OpenCvSharpExtern/core_OutputArray.h @@ -1,53 +1,77 @@ -#ifndef _CPP_CORE_OUTPUTARRAY_H_ -#define _CPP_CORE_OUTPUTARRAY_H_ +#pragma once #include "include_opencv.h" -CVAPI(cv::_OutputArray*) core_OutputArray_new_byMat(cv::Mat *mat) +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +CVAPI(ExceptionStatus) core_OutputArray_new_byMat(cv::Mat *mat, cv::_OutputArray **returnValue) { - cv::_OutputArray ia(*mat); - return new cv::_OutputArray(ia); + BEGIN_WRAP + const cv::_OutputArray ia(*mat); + *returnValue = new cv::_OutputArray(ia); + END_WRAP } -CVAPI(cv::_OutputArray*) core_OutputArray_new_byGpuMat(cv::cuda::GpuMat *gm) +/*CVAPI(cv::_OutputArray*) core_OutputArray_new_byGpuMat(cv::cuda::GpuMat *gm) { cv::_OutputArray ia(*gm); return new cv::_OutputArray(ia); +}*/ + +CVAPI(ExceptionStatus) core_OutputArray_new_byUMat(cv::UMat* mat, cv::_OutputArray** returnValue) +{ + BEGIN_WRAP + const cv::_OutputArray ia(*mat); + *returnValue = new cv::_OutputArray(ia); + END_WRAP } -CVAPI(cv::_OutputArray*) core_OutputArray_new_byScalar(MyCvScalar scalar) +CVAPI(ExceptionStatus) core_OutputArray_new_byScalar(MyCvScalar scalar, cv::_OutputArray **returnValue) { + BEGIN_WRAP cv::Scalar scalarVal(cpp(scalar)); - cv::_OutputArray ia(scalarVal); - return new cv::_OutputArray(ia); + const cv::_OutputArray ia(scalarVal); + *returnValue = new cv::_OutputArray(ia); + END_WRAP } -CVAPI(cv::_OutputArray*) core_OutputArray_new_byVectorOfMat(std::vector *vector) +CVAPI(ExceptionStatus) core_OutputArray_new_byVectorOfMat(std::vector *vector, cv::_OutputArray **returnValue) { - cv::_OutputArray ia(*vector); - return new cv::_OutputArray(ia); + BEGIN_WRAP + const cv::_OutputArray ia(*vector); + *returnValue = new cv::_OutputArray(ia); + END_WRAP } -CVAPI(void) core_OutputArray_delete(cv::_OutputArray *oa) +CVAPI(ExceptionStatus) core_OutputArray_delete(cv::_OutputArray *oa) { + BEGIN_WRAP delete oa; + END_WRAP } -CVAPI(cv::Mat*) core_OutputArray_getMat(cv::_OutputArray *oa) +CVAPI(ExceptionStatus) core_OutputArray_getMat(cv::_OutputArray *oa, cv::Mat **returnValue) { - cv::Mat &mat = oa->getMatRef(); - return new cv::Mat(mat); + BEGIN_WRAP + auto& mat = oa->getMatRef(); + *returnValue = new cv::Mat(mat); + END_WRAP } -CVAPI(MyCvScalar) core_OutputArray_getScalar(cv::_OutputArray *oa) +CVAPI(ExceptionStatus) core_OutputArray_getScalar(cv::_OutputArray *oa, MyCvScalar *returnValue) { + BEGIN_WRAP cv::Mat &mat = oa->getMatRef(); - cv::Scalar scalar = mat.at(0); - return c(scalar); + const auto scalar = mat.at(0); + *returnValue = c(scalar); + END_WRAP } -CVAPI(void) core_OutputArray_getVectorOfMat(cv::_OutputArray *oa, std::vector *vector) +CVAPI(ExceptionStatus) core_OutputArray_getVectorOfMat(cv::_OutputArray *oa, std::vector *vector) { + BEGIN_WRAP std::vector temp; oa->getMatVector(temp); @@ -56,6 +80,5 @@ CVAPI(void) core_OutputArray_getVectorOfMat(cv::_OutputArray *oa, std::vectorproject(*vec); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = obj->project(*vec); + *returnValue = new cv::Mat(ret); + END_WRAP } + //! projects vector from the original space to the principal components subspace -CVAPI(void) core_PCA_project2(cv::PCA *obj, cv::_InputArray *vec, cv::_OutputArray *result) +CVAPI(ExceptionStatus) core_PCA_project2(cv::PCA *obj, cv::_InputArray *vec, cv::_OutputArray *result) { + BEGIN_WRAP obj->project(*vec, *result); + END_WRAP } + //! reconstructs the original vector from the projection -CVAPI(cv::Mat*) core_PCA_backProject1(cv::PCA *obj, cv::_InputArray *vec) +CVAPI(ExceptionStatus) core_PCA_backProject1(cv::PCA *obj, cv::_InputArray *vec, cv::Mat **returnValue) { - cv::Mat ret = obj->backProject(*vec); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = obj->backProject(*vec); + *returnValue = new cv::Mat(ret); + END_WRAP } + //! reconstructs the original vector from the projection -CVAPI(void) core_PCA_backProject2(cv::PCA *obj, cv::_InputArray *vec, cv::_OutputArray *result) +CVAPI(ExceptionStatus) core_PCA_backProject2(cv::PCA *obj, cv::_InputArray *vec, cv::_OutputArray *result) { + BEGIN_WRAP obj->backProject(*vec, *result); + END_WRAP } //!< eigenvectors of the covariation matrix -CVAPI(cv::Mat*) core_PCA_eigenvectors(cv::PCA *obj) +CVAPI(ExceptionStatus) core_PCA_eigenvectors(cv::PCA *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->eigenvectors); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->eigenvectors); + END_WRAP } + //!< eigenvalues of the covariation matrix -CVAPI(cv::Mat*) core_PCA_eigenvalues(cv::PCA *obj) +CVAPI(ExceptionStatus) core_PCA_eigenvalues(cv::PCA *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->eigenvalues); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->eigenvalues); + END_WRAP } + //!< mean value subtracted before the projection and added after the back projection -CVAPI(cv::Mat*) core_PCA_mean(cv::PCA *obj) +CVAPI(ExceptionStatus) core_PCA_mean(cv::PCA *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->mean); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->mean); + END_WRAP } -#endif \ No newline at end of file +CVAPI(ExceptionStatus) core_PCA_write(cv::PCA *obj, cv::FileStorage *fs) +{ + BEGIN_WRAP + obj->write(*fs); + END_WRAP +} + +CVAPI(ExceptionStatus) core_PCA_read(cv::PCA *obj, cv::FileNode *fn) +{ + BEGIN_WRAP + obj->read(*fn); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/core_RNG.h b/src/OpenCvSharpExtern/core_RNG.h deleted file mode 100644 index 695d0c8da..000000000 --- a/src/OpenCvSharpExtern/core_RNG.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _CPP_CORE_RNG_H_ -#define _CPP_CORE_RNG_H_ - -#include "include_opencv.h" - -CVAPI(void) core_RNG_fill(uint64 *state, cv::_InputOutputArray *mat, int distType, cv::_InputArray *a, cv::_InputArray *b, int saturateRange) -{ - cv::RNG rng(*state); - rng.fill(*mat, distType, *a, *b, saturateRange != 0); - *state = rng.state; -} -//! returns Gaussian random variate with mean zero. -CVAPI(double) core_RNG_gaussian(uint64 *state, double sigma) -{ - cv::RNG rng(*state); - double result = rng.gaussian(sigma); - *state = rng.state; - return result; -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/core_SVD.h b/src/OpenCvSharpExtern/core_SVD.h index 05b9315e9..96ed6802f 100644 --- a/src/OpenCvSharpExtern/core_SVD.h +++ b/src/OpenCvSharpExtern/core_SVD.h @@ -1,65 +1,89 @@ -#ifndef _CPP_CORE_SVD_H_ -#define _CPP_CORE_SVD_H_ +#pragma once + +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(cv::SVD*) core_SVD_new1() +CVAPI(ExceptionStatus) core_SVD_new1(cv::SVD **returnValue) { - return new cv::SVD; + BEGIN_WRAP + *returnValue = new cv::SVD; + END_WRAP } -CVAPI(cv::SVD*) core_SVD_new2(cv::_InputArray *src, int flags) +CVAPI(ExceptionStatus) core_SVD_new2(cv::_InputArray *src, int flags, cv::SVD **returnValue) { - return new cv::SVD(*src, flags); + BEGIN_WRAP + *returnValue = new cv::SVD(*src, flags); + END_WRAP } -CVAPI(void) core_SVD_delete(cv::SVD *obj) +CVAPI(ExceptionStatus) core_SVD_delete(cv::SVD *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) core_SVD_operatorThis(cv::SVD *obj, cv::_InputArray *src, int flags) +CVAPI(ExceptionStatus) core_SVD_operatorThis(cv::SVD *obj, cv::_InputArray *src, int flags) { + BEGIN_WRAP (*obj)(*src, flags); + END_WRAP } //! performs back substitution, so that dst is the solution or pseudo-solution of m*dst = rhs, where m is the decomposed matrix -CVAPI(void) core_SVD_backSubst(cv::SVD *obj, cv::_InputArray *rhs, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_SVD_backSubst(cv::SVD *obj, cv::_InputArray *rhs, cv::_OutputArray *dst) { + BEGIN_WRAP obj->backSubst(*rhs, *dst); + END_WRAP } //! decomposes matrix and stores the results to user-provided matrices -CVAPI(void) core_SVD_static_compute1(cv::_InputArray *src, cv::_OutputArray *w, - cv::_OutputArray *u, cv::_OutputArray *vt, int flags) +CVAPI(ExceptionStatus) core_SVD_static_compute1(cv::_InputArray *src, cv::_OutputArray *w, + cv::_OutputArray *u, cv::_OutputArray *vt, int flags) { + BEGIN_WRAP cv::SVD::compute(*src, *w, *u, *vt, flags); + END_WRAP } //! computes singular values of a matrix -CVAPI(void) core_SVD_static_compute2(cv::_InputArray *src, cv::_OutputArray *w, int flags) +CVAPI(ExceptionStatus) core_SVD_static_compute2(cv::_InputArray *src, cv::_OutputArray *w, int flags) { + BEGIN_WRAP cv::SVD::compute(*src, *w, flags); + END_WRAP } //! performs back substitution -CVAPI(void) core_SVD_static_backSubst(cv::_InputArray *w, cv::_InputArray *u, - cv::_InputArray *vt, cv::_InputArray *rhs, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_SVD_static_backSubst(cv::_InputArray *w, cv::_InputArray *u, + cv::_InputArray *vt, cv::_InputArray *rhs, cv::_OutputArray *dst) { + BEGIN_WRAP cv::SVD::backSubst(*w, *u, *vt, *rhs, *dst); + END_WRAP } //! finds dst = arg min_{|dst|=1} |m*dst| -CVAPI(void) core_SVD_static_solveZ(cv::_InputArray *src, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) core_SVD_static_solveZ(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::SVD::solveZ(*src, *dst); + END_WRAP } -CVAPI(cv::Mat*) core_SVD_u(cv::SVD *obj) +CVAPI(ExceptionStatus) core_SVD_u(cv::SVD *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->u); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->u); + END_WRAP } -CVAPI(cv::Mat*) core_SVD_w(cv::SVD *obj) +CVAPI(ExceptionStatus) core_SVD_w(cv::SVD *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->w); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->w); + END_WRAP } -CVAPI(cv::Mat*) core_SVD_vt(cv::SVD *obj) +CVAPI(ExceptionStatus) core_SVD_vt(cv::SVD *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->vt); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->vt); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/core_SparseMat.h b/src/OpenCvSharpExtern/core_SparseMat.h index e2611e142..f77f51029 100644 --- a/src/OpenCvSharpExtern/core_SparseMat.h +++ b/src/OpenCvSharpExtern/core_SparseMat.h @@ -1,167 +1,260 @@ -#ifndef _CPP_CORE_SPARSEMAT_H_ -#define _CPP_CORE_SPARSEMAT_H_ +#pragma once -#include "include_opencv.h" +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile -CVAPI(uint64) core_SparseMat_sizeof() -{ - return sizeof(cv::SparseMat); -} +#include "include_opencv.h" -CVAPI(cv::SparseMat*) core_SparseMat_new1() +CVAPI(ExceptionStatus) core_SparseMat_new1(cv::SparseMat **returnValue) { - return new cv::SparseMat(); + BEGIN_WRAP + *returnValue = new cv::SparseMat; + END_WRAP } -CVAPI(cv::SparseMat*) core_SparseMat_new2(int dims, const int *sizes, int type) +CVAPI(ExceptionStatus) core_SparseMat_new2(int dims, const int *sizes, int type, cv::SparseMat **returnValue) { - return new cv::SparseMat(dims, sizes, type); + BEGIN_WRAP + *returnValue = new cv::SparseMat(dims, sizes, type); + END_WRAP } -CVAPI(cv::SparseMat*) core_SparseMat_new3(cv::Mat *m) +CVAPI(ExceptionStatus) core_SparseMat_new3(cv::Mat *m, cv::SparseMat **returnValue) { - return new cv::SparseMat(*m); + BEGIN_WRAP + *returnValue = new cv::SparseMat(*m); + END_WRAP } -CVAPI(void) core_SparseMat_delete(cv::SparseMat *obj) +CVAPI(ExceptionStatus) core_SparseMat_delete(cv::SparseMat *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) core_SparseMat_operatorAssign_SparseMat(cv::SparseMat *obj, cv::SparseMat *m) +CVAPI(ExceptionStatus) core_SparseMat_operatorAssign_SparseMat(cv::SparseMat *obj, cv::SparseMat *m) { + BEGIN_WRAP *obj = *m; + END_WRAP } -CVAPI(void) core_SparseMat_operatorAssign_Mat(cv::SparseMat *obj, cv::Mat *m) +CVAPI(ExceptionStatus) core_SparseMat_operatorAssign_Mat(cv::SparseMat *obj, cv::Mat *m) { + BEGIN_WRAP *obj = *m; + END_WRAP } -CVAPI(cv::SparseMat*) core_SparseMat_clone(cv::SparseMat *obj) +CVAPI(ExceptionStatus) core_SparseMat_clone(cv::SparseMat *obj, cv::SparseMat **returnValue) { - cv::SparseMat sm = obj->clone(); - return new cv::SparseMat(sm); + BEGIN_WRAP + const auto sm = obj->clone(); + *returnValue = new cv::SparseMat(sm); + END_WRAP } -CVAPI(void) core_SparseMat_copyTo_SparseMat(cv::SparseMat *obj, cv::SparseMat *m) + +CVAPI(ExceptionStatus) core_SparseMat_copyTo_SparseMat(cv::SparseMat *obj, cv::SparseMat *m) { + BEGIN_WRAP obj->copyTo(*m); + END_WRAP } -CVAPI(void) core_SparseMat_copyTo_Mat(cv::SparseMat *obj, cv::Mat *m) +CVAPI(ExceptionStatus) core_SparseMat_copyTo_Mat(cv::SparseMat *obj, cv::Mat *m) { + BEGIN_WRAP obj->copyTo(*m); + END_WRAP } -CVAPI(void) core_SparseMat_convertTo_SparseMat(cv::SparseMat *obj, cv::SparseMat *m, int rtype, double alpha) + +CVAPI(ExceptionStatus) core_SparseMat_convertTo_SparseMat(cv::SparseMat *obj, cv::SparseMat *m, int rtype, double alpha) { + BEGIN_WRAP obj->convertTo(*m, rtype, alpha); + END_WRAP } -CVAPI(void) core_SparseMat_convertTo_Mat(cv::SparseMat *obj, cv::Mat *m, int rtype, double alpha = 1, double beta = 0) +CVAPI(ExceptionStatus) core_SparseMat_convertTo_Mat(cv::SparseMat *obj, cv::Mat *m, int rtype, double alpha = 1, double beta = 0) { + BEGIN_WRAP obj->convertTo(*m, rtype, alpha, beta); + END_WRAP } -CVAPI(void) core_SparseMat_assignTo(cv::SparseMat *obj, cv::SparseMat *m, int type = -1) + +CVAPI(ExceptionStatus) core_SparseMat_assignTo(cv::SparseMat *obj, cv::SparseMat *m, int type = -1) { + BEGIN_WRAP obj->assignTo(*m, type); + END_WRAP } -CVAPI(void) core_SparseMat_create(cv::SparseMat *obj, int dims, const int* sizes, int type) +CVAPI(ExceptionStatus) core_SparseMat_create(cv::SparseMat *obj, int dims, const int* sizes, int type) { + BEGIN_WRAP obj->create(dims, sizes, type); + END_WRAP } -CVAPI(void) core_SparseMat_clear(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_clear(cv::SparseMat *obj) { + BEGIN_WRAP obj->clear(); + END_WRAP } -CVAPI(void) core_SparseMat_addref(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_addref(cv::SparseMat *obj) { + BEGIN_WRAP obj->addref(); + END_WRAP } -CVAPI(void) core_SparseMat_release(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_release(cv::SparseMat *obj) { + BEGIN_WRAP obj->release(); + END_WRAP } -CVAPI(int) core_SparseMat_elemSize(cv::SparseMat *obj) +CVAPI(ExceptionStatus) core_SparseMat_elemSize(cv::SparseMat *obj, int *returnValue) { - return static_cast(obj->elemSize()); + BEGIN_WRAP + *returnValue = static_cast(obj->elemSize()); + END_WRAP } -CVAPI(int) core_SparseMat_elemSize1(cv::SparseMat *obj) +CVAPI(ExceptionStatus) core_SparseMat_elemSize1(cv::SparseMat *obj, int *returnValue) { - return static_cast(obj->elemSize1()); + BEGIN_WRAP + *returnValue = static_cast(obj->elemSize1()); + END_WRAP } -CVAPI(int) core_SparseMat_type(cv::SparseMat *obj) +CVAPI(ExceptionStatus) core_SparseMat_type(cv::SparseMat *obj, int *returnValue) { - return obj->type(); + BEGIN_WRAP + *returnValue = obj->type(); + END_WRAP } -CVAPI(int) core_SparseMat_depth(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_depth(cv::SparseMat *obj, int *returnValue) { - return obj->depth(); + BEGIN_WRAP + *returnValue = obj->depth(); + END_WRAP } -CVAPI(int) core_SparseMat_channels(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_channels(cv::SparseMat *obj, int *returnValue) { - return obj->channels(); + BEGIN_WRAP + *returnValue = obj->channels(); + END_WRAP } -CVAPI(const int*) core_SparseMat_size1(cv::SparseMat *obj) +CVAPI(ExceptionStatus) core_SparseMat_size1(cv::SparseMat *obj, const int **returnValue) { - return obj->size(); + BEGIN_WRAP + *returnValue = obj->size(); + END_WRAP } -CVAPI(int) core_SparseMat_size2(cv::SparseMat *obj, int i) +CVAPI(ExceptionStatus) core_SparseMat_size2(cv::SparseMat *obj, int i, int *returnValue) { - return obj->size(i); + BEGIN_WRAP + *returnValue = obj->size(i); + END_WRAP } -CVAPI(int) core_SparseMat_dims(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_dims(cv::SparseMat *obj, int *returnValue) { - return obj->dims(); + BEGIN_WRAP + *returnValue = obj->dims(); + END_WRAP } -CVAPI(size_t) core_SparseMat_nzcount(cv::SparseMat *obj) + +CVAPI(ExceptionStatus) core_SparseMat_nzcount(cv::SparseMat *obj, size_t *returnValue) { - return obj->nzcount(); + BEGIN_WRAP + *returnValue = obj->nzcount(); + END_WRAP } -CVAPI(size_t) core_SparseMat_hash_1d(cv::SparseMat *obj, int i0) +CVAPI(ExceptionStatus) core_SparseMat_hash_1d(cv::SparseMat *obj, int i0, size_t *returnValue) { - return obj->hash(i0); + BEGIN_WRAP + *returnValue = obj->hash(i0); + END_WRAP } -CVAPI(size_t) core_SparseMat_hash_2d(cv::SparseMat *obj, int i0, int i1) +CVAPI(ExceptionStatus) core_SparseMat_hash_2d(cv::SparseMat *obj, int i0, int i1, size_t *returnValue) { - return obj->hash(i0, i1); + BEGIN_WRAP + *returnValue = obj->hash(i0, i1); + END_WRAP } -CVAPI(size_t) core_SparseMat_hash_3d(cv::SparseMat *obj, int i0, int i1, int i2) +CVAPI(ExceptionStatus) core_SparseMat_hash_3d(cv::SparseMat *obj, int i0, int i1, int i2, size_t *returnValue) { - return obj->hash(i0, i1, i2); + BEGIN_WRAP + *returnValue = obj->hash(i0, i1, i2); + END_WRAP } -CVAPI(size_t) core_SparseMat_hash_nd(cv::SparseMat *obj, const int* idx) +CVAPI(ExceptionStatus) core_SparseMat_hash_nd(cv::SparseMat *obj, const int* idx, size_t *returnValue) { - return obj->hash(idx); + BEGIN_WRAP + *returnValue = obj->hash(idx); + END_WRAP } -CVAPI(uchar*) core_SparseMat_ptr_1d(cv::SparseMat *obj, int i0, int createMissing, uint64* hashval) -{ - if (hashval == NULL) - return obj->ptr(i0, createMissing != 0); - size_t hashval0 = static_cast(*hashval); - return obj->ptr(i0, createMissing != 0, &hashval0); -} -CVAPI(uchar*) core_SparseMat_ptr_2d(cv::SparseMat *obj, int i0, int i1, int createMissing, uint64* hashval) -{ - if (hashval == NULL) - return obj->ptr(i0, i1, createMissing != 0); - size_t hashval0 = static_cast(*hashval); - return obj->ptr(i0, i1, createMissing != 0, &hashval0); +CVAPI(ExceptionStatus) core_SparseMat_ptr_1d(cv::SparseMat *obj, int i0, int createMissing, uint64* hashVal, uchar **returnValue) +{ + BEGIN_WRAP + if (hashVal == nullptr) + { + *returnValue = obj->ptr(i0, createMissing != 0); + }else + { + auto hashVal0 = static_cast(*hashVal); + *returnValue = obj->ptr(i0, createMissing != 0, &hashVal0); + } + END_WRAP } -CVAPI(uchar*) core_SparseMat_ptr_3d(cv::SparseMat *obj, int i0, int i1, int i2, int createMissing, uint64* hashval) -{ - if (hashval == NULL) - return obj->ptr(i0, i1, i2, createMissing != 0); - size_t hashval0 = static_cast(*hashval); - return obj->ptr(i0, i1, i2, createMissing != 0, &hashval0); + +CVAPI(ExceptionStatus) core_SparseMat_ptr_2d(cv::SparseMat *obj, int i0, int i1, int createMissing, uint64* hashVal, uchar **returnValue) +{ + BEGIN_WRAP + if (hashVal == nullptr) + { + *returnValue = obj->ptr(i0, i1, createMissing != 0); + } + else + { + auto hashVal0 = static_cast(*hashVal); + *returnValue = obj->ptr(i0, i1, createMissing != 0, &hashVal0); + } + END_WRAP } -CVAPI(uchar*) core_SparseMat_ptr_nd(cv::SparseMat *obj, const int* idx, int createMissing, uint64* hashval) -{ - if (hashval == NULL) - return obj->ptr(idx, createMissing != 0); - size_t hashval0 = static_cast(*hashval); - return obj->ptr(idx, createMissing != 0, &hashval0); + +CVAPI(ExceptionStatus) core_SparseMat_ptr_3d(cv::SparseMat *obj, int i0, int i1, int i2, int createMissing, uint64* hashVal, uchar **returnValue) +{ + BEGIN_WRAP + if (hashVal == nullptr) + { + *returnValue = obj->ptr(i0, i1, i2, createMissing != 0); + } + else + { + auto hashVal0 = static_cast(*hashVal); + *returnValue = obj->ptr(i0, i1, i2, createMissing != 0, &hashVal0); + } + END_WRAP } -#endif \ No newline at end of file +CVAPI(ExceptionStatus) core_SparseMat_ptr_nd(cv::SparseMat *obj, const int* idx, int createMissing, uint64* hashVal, uchar **returnValue) +{ + BEGIN_WRAP + if (hashVal == nullptr) + { + *returnValue = obj->ptr(idx, createMissing != 0); + } + else + { + auto hashVal0 = static_cast(*hashVal); + *returnValue = obj->ptr(idx, createMissing != 0, &hashVal0); + } + END_WRAP +} diff --git a/src/OpenCvSharpExtern/core_UMat.h b/src/OpenCvSharpExtern/core_UMat.h new file mode 100644 index 000000000..3501afd58 --- /dev/null +++ b/src/OpenCvSharpExtern/core_UMat.h @@ -0,0 +1,491 @@ +#pragma once + +#include "include_opencv.h" + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#pragma region Init & Release + +CVAPI(ExceptionStatus) core_UMat_new1(const cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(usageFlags); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_new2(const int rows, const int cols, const int type, const cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(rows, cols, type, usageFlags); + END_WRAP +} +/* +CVAPI(ExceptionStatus) core_UMat_new3(cv::Size size, int type, cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(size, type, usageFlags); + END_WRAP +} +*/ +CVAPI(ExceptionStatus) core_UMat_new3( + const int rows, const int cols, const int type, const MyCvScalar s, const cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(rows, cols, type, cpp(s), usageFlags); + END_WRAP +} +/* +CVAPI(ExceptionStatus) core_UMat_new5(cv::Size size, int type, MyCvScalar s, cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(size, type, cpp(s), usageFlags); + END_WRAP +} +*/ +CVAPI(ExceptionStatus) core_UMat_new4( + const int ndims, const int* sizes, const int type, const cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(ndims, sizes, type, usageFlags); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_new5( + const int ndims, const int* sizes, const int type, const MyCvScalar s, cv::UMatUsageFlags usageFlags, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(ndims, sizes, type, cpp(s), usageFlags); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_new6(cv::UMat* umat, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(*umat); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_new7(cv::UMat* umat, const MyCvSlice rowRange, const MyCvSlice colRange, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(*umat, cpp(rowRange), cpp(colRange)); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_new8(cv::UMat* umat, const MyCvRect roi, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(*umat, cpp(roi)); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_new9(cv::UMat* umat, cv::Range* ranges, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(*umat, ranges); + END_WRAP +} +/* +CVAPI(ExceptionStatus) core_UMat_new12(cv::UMat* umat, std::vector& ranges, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(*umat, ranges); + END_WRAP +} +*/ + +CVAPI(ExceptionStatus) core_UMat_delete(cv::UMat* self) +{ + BEGIN_WRAP + delete self; + END_WRAP +} + +#pragma endregion + +#pragma region Functions + +CVAPI(ExceptionStatus) core_UMat_getMat(cv::UMat* self, cv::AccessFlag accessFlag, cv::Mat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::Mat(self->getMat(accessFlag)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_row(cv::UMat* self, int y, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(self->row(y)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_col(cv::UMat* self, int x, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(self->col(x)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_rowRange(cv::UMat* self, int startRow, int endRow, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(self->rowRange(startRow, endRow)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_colRange(cv::UMat* self, int startCol, int endCol, cv::UMat** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::UMat(self->colRange(startCol, endCol)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_diag(cv::UMat* self, int d, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->diag(d); + *returnValue = new cv::UMat(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_diag_static(cv::UMat* self, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = cv::UMat::diag(*self); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_clone(cv::UMat* self, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->clone(); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_copyTo1(cv::UMat* self, cv::_OutputArray* m) +{ + BEGIN_WRAP + self->copyTo(*m); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_copyTo2(cv::UMat* self, cv::_OutputArray* m, cv::_InputArray* mask) +{ + BEGIN_WRAP + self->copyTo(*m, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_copyTo_toUMat1(cv::UMat* self, cv::UMat* m) +{ + BEGIN_WRAP + self->copyTo(*m); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_copyTo_toUMat2(cv::UMat* self, cv::UMat* m, cv::_InputArray* mask) +{ + BEGIN_WRAP + self->copyTo(*m, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_convertTo(cv::UMat* self, cv::_OutputArray* m, int rtype, double alpha, double beta) +{ + BEGIN_WRAP + self->convertTo(*m, rtype, alpha, beta); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_assignTo(cv::UMat* self, cv::UMat* m, int type) +{ + BEGIN_WRAP + self->assignTo(*m, type); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_setTo_Scalar(cv::UMat* self, MyCvScalar value, cv::UMat* mask) +{ + BEGIN_WRAP + if (mask == nullptr) + self->setTo(cpp(value)); + else + self->setTo(cpp(value), entity(mask)); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_setTo_InputArray(cv::UMat* self, cv::_InputArray* value, cv::UMat* mask) +{ + BEGIN_WRAP + self->setTo(*value, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_reshape1(cv::UMat* self, int cn, int rows, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->reshape(cn, rows); + *returnValue = new cv::UMat(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_reshape2(cv::UMat* self, int cn, int newndims, const int* newsz, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->reshape(cn, newndims, newsz); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_t(cv::UMat* self, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto expr = self->t(); + *returnValue = new cv::UMat(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_inv(cv::UMat* self, int method, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->inv(method); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_mul(cv::UMat* self, cv::_InputArray* m, double scale, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->mul(*m, scale); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_dot(cv::UMat* self, cv::_InputArray* m, double* returnValue) +{ + BEGIN_WRAP + *returnValue = self->dot(*m); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_zeros1(int rows, int cols, int type, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto expr = cv::UMat::zeros(rows, cols, type); + *returnValue = new cv::UMat(expr); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_zeros2(int ndims, const int* sz, int type, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto expr = cv::UMat::zeros(ndims, sz, type); + *returnValue = new cv::UMat(expr); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_ones1(int rows, int cols, int type, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = cv::UMat::ones(rows, cols, type); + *returnValue = new cv::UMat(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_ones2(int ndims, const int* sz, int type, cv::UMat** returnValue) +{ + BEGIN_WRAP + cv::UMat ret = cv::UMat::ones(ndims, sz, type); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_eye(int rows, int cols, int type, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto eye = cv::UMat::eye(rows, cols, type); + *returnValue = new cv::UMat(eye); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_create1(cv::UMat* self, int rows, int cols, int type, cv::UMatUsageFlags usageFlags) +{ + BEGIN_WRAP + self->create(rows, cols, type, usageFlags); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_create2(cv::UMat* self, int ndims, const int* sizes, int type, cv::UMatUsageFlags usageFlags) +{ + BEGIN_WRAP + self->create(ndims, sizes, type, usageFlags); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_locateROI(cv::UMat* self, MyCvSize* wholeSize, MyCvPoint* ofs) +{ + BEGIN_WRAP + cv::Size wholeSize2; + cv::Point ofs2; + self->locateROI(wholeSize2, ofs2); + *wholeSize = c(cv::Size(wholeSize2.width, wholeSize2.height)); + *ofs = c(cv::Point(ofs2.x, ofs2.y)); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_adjustROI(cv::UMat* self, int dtop, int dbottom, int dleft, int dright, cv::UMat** returnValue) +{ + BEGIN_WRAP + const auto ret = self->adjustROI(dtop, dbottom, dleft, dright); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_subMat1(cv::UMat* self, int rowStart, int rowEnd, int colStart, int colEnd, cv::UMat** returnValue) +{ + BEGIN_WRAP + const cv::Range rowRange(rowStart, rowEnd); + const cv::Range colRange(colStart, colEnd); + const auto ret = (*self)(rowRange, colRange); + *returnValue = new cv::UMat(ret); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_subMat2(cv::UMat* self, int nRanges, MyCvSlice* ranges, cv::UMat** returnValue) +{ + BEGIN_WRAP + std::vector rangesVec(nRanges); + for (auto i = 0; i < nRanges; i++) + { + rangesVec[i] = (cpp(ranges[i])); + } + const auto ret = (*self)(&rangesVec[0]); + *returnValue = new cv::UMat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_isContinuous(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->isContinuous() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_isSubmatrix(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->isSubmatrix() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_elemSize(cv::UMat* self, size_t* returnValue) +{ + BEGIN_WRAP + *returnValue = self->elemSize(); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_elemSize1(cv::UMat* self, size_t* returnValue) +{ + BEGIN_WRAP + *returnValue = self->elemSize1(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_type(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->type(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_depth(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->depth(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_channels(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->channels(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_step1(cv::UMat* self, int i, size_t* returnValue) +{ + BEGIN_WRAP + *returnValue = self->step1(i); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_empty(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->empty() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_total(cv::UMat* self, size_t* returnValue) +{ + BEGIN_WRAP + *returnValue = self->total(); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_checkVector(cv::UMat* self, int elemChannels, int depth, int requireContinuous, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->checkVector(elemChannels, depth, requireContinuous != 0); + END_WRAP +} + +//does this replace Ptr? +CVAPI(ExceptionStatus) core_UMat_handle(cv::UMat* self, cv::AccessFlag accessFlag, void** returnValue) +{ + BEGIN_WRAP + *returnValue = self->handle(accessFlag); + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_flags(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->flags; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_dims(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->dims; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_rows(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->rows; + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_cols(cv::UMat* self, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->cols; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_size(cv::UMat* self, MyCvSize* returnValue) +{ + BEGIN_WRAP + *returnValue = c(self->size()); + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_sizeAt(cv::UMat* self, int i, int* returnValue) +{ + BEGIN_WRAP + *returnValue = self->size[i]; + END_WRAP +} + +CVAPI(ExceptionStatus) core_UMat_step(cv::UMat* self, size_t* returnValue) +{ + BEGIN_WRAP + *returnValue = self->step; + END_WRAP +} +CVAPI(ExceptionStatus) core_UMat_stepAt(cv::UMat* self, int i, size_t* returnValue) +{ + BEGIN_WRAP + *returnValue = self->step[i]; + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/cuda.cpp b/src/OpenCvSharpExtern/cuda.cpp index 40bf08af4..a6de78ca2 100644 --- a/src/OpenCvSharpExtern/cuda.cpp +++ b/src/OpenCvSharpExtern/cuda.cpp @@ -1,2 +1,6 @@ +// ReSharper disable CppUnusedIncludeDirective + +#ifdef ENABLED_CUDA #include "cuda.h" -#include "cuda_GpuMat.h" \ No newline at end of file +#include "cuda_GpuMat.h" +#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/cuda.h b/src/OpenCvSharpExtern/cuda.h index 9b9188ead..10811a0d1 100644 --- a/src/OpenCvSharpExtern/cuda.h +++ b/src/OpenCvSharpExtern/cuda.h @@ -1,8 +1,8 @@ -#ifndef _CPP_cuda_H_ -#define _CPP_cuda_H_ +#pragma once + +#ifdef ENABLED_CUDA #include "include_opencv.h" -using namespace cv::cuda; #pragma region Device @@ -193,4 +193,4 @@ CVAPI(int) cuda_Stream_bool(Stream *obj) #pragma endregion -#endif \ No newline at end of file +#endif diff --git a/src/OpenCvSharpExtern/cuda_GpuMat.h b/src/OpenCvSharpExtern/cuda_GpuMat.h index 317e642cc..d15377f94 100644 --- a/src/OpenCvSharpExtern/cuda_GpuMat.h +++ b/src/OpenCvSharpExtern/cuda_GpuMat.h @@ -1,9 +1,8 @@ -#ifndef _CPP_GPU_GPUMAT_H_ -#define _CPP_GPU_GPUMAT_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::cuda; +#ifdef ENABLED_CUDA +#include "include_opencv.h" #pragma region Init and Disposal @@ -281,4 +280,4 @@ CVAPI(void) cuda_ensureSizeIsEnough(int rows, int cols, int type, GpuMat *m) ensureSizeIsEnough(rows, cols, type, *m); } -#endif \ No newline at end of file +#endif diff --git a/src/OpenCvSharpExtern/dnn.cpp b/src/OpenCvSharpExtern/dnn.cpp new file mode 100644 index 000000000..df30bf252 --- /dev/null +++ b/src/OpenCvSharpExtern/dnn.cpp @@ -0,0 +1,3 @@ +// ReSharper disable CppUnusedIncludeDirective +#include "dnn.h" +#include "dnn_Net.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/dnn.h b/src/OpenCvSharpExtern/dnn.h new file mode 100644 index 000000000..1b02e596f --- /dev/null +++ b/src/OpenCvSharpExtern/dnn.h @@ -0,0 +1,201 @@ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +CVAPI(ExceptionStatus) dnn_readNetFromDarknet(const char *cfgFile, const char *darknetModel, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto darknetModelStr = (darknetModel == nullptr) ? cv::String() : cv::String(darknetModel); + const auto net = cv::dnn::readNetFromDarknet(cfgFile, darknetModelStr); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromDarknet_InputArray(const char* bufferCfg, size_t lenCfg, const char* bufferModel, size_t lenModel, cv::dnn::Net** returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromDarknet(bufferCfg, lenCfg, bufferModel, lenModel); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromCaffe(const char *prototxt, const char *caffeModel, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto caffeModelStr = (caffeModel == nullptr) ? cv::String() : cv::String(caffeModel); + const auto net = cv::dnn::readNetFromCaffe(prototxt, caffeModelStr); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromCaffe_InputArray( + const char* bufferProto, size_t lenProto, const char* bufferModel, size_t lenModel, cv::dnn::Net** returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromCaffe( + bufferProto, lenProto, + bufferModel, lenModel); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromTensorflow(const char *model, const char *config, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto configStr = (config == nullptr) ? cv::String() : cv::String(config); + const auto net = cv::dnn::readNetFromTensorflow(model, configStr); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromTensorflow_InputArray(const char *model,size_t lenModel, const char *config, size_t lenConfig, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromTensorflow(model, lenModel, config, lenConfig); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromTorch(const char *model, const int isBinary, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromTorch(model, isBinary != 0); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNet(const char *model, const char *config, const char *framework, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto configStr = (config == nullptr) ? "" : cv::String(config); + const auto frameworkStr = (framework == nullptr) ? "" : cv::String(framework); + const auto net = cv::dnn::readNet(model, configStr, frameworkStr); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readTorchBlob(const char *filename, const int isBinary, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto blob = cv::dnn::readTorchBlob(filename, isBinary != 0); + *returnValue = new cv::Mat(blob); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromModelOptimizer(const char *xml, const char *bin, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromModelOptimizer(xml, bin); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromONNX(const char *onnxFile, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromONNX(onnxFile); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_readNetFromONNX_InputArray(const char* buffer, size_t sizeBuffer, cv::dnn::Net** returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::readNetFromONNX(buffer, sizeBuffer); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + + +CVAPI(ExceptionStatus) dnn_readTensorFromONNX(const char *path, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto mat = cv::dnn::readTensorFromONNX(path); + *returnValue = new cv::Mat(mat); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_blobFromImage( + cv::Mat *image, const double scalefactor, const MyCvSize size, const MyCvScalar mean, const int swapRB, const int crop, + cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto blob = cv::dnn::blobFromImage(*image, scalefactor, cpp(size), cpp(mean), swapRB != 0, crop != 0); + *returnValue = new cv::Mat(blob); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_blobFromImages( + const cv::Mat **images, const int imagesLength, const double scalefactor, const MyCvSize size, const MyCvScalar mean, const int swapRB, const int crop, + cv::Mat **returnValue) +{ + BEGIN_WRAP + std::vector imagesVec; + toVec(images, imagesLength, imagesVec); + + const auto blob = cv::dnn::blobFromImages(imagesVec, scalefactor, cpp(size), cpp(mean), swapRB != 0, crop != 0); + *returnValue = new cv::Mat(blob); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_shrinkCaffeModel( + const char *src, const char *dst, + const char **layersTypes, int layersTypesSize) +{ + BEGIN_WRAP + std::vector layersTypesVec(layersTypesSize); + for (int i = 0; i < layersTypesSize; i++) { + layersTypesVec[i].assign(layersTypes[i]); + } + cv::dnn::shrinkCaffeModel(src, dst, layersTypesVec); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_writeTextGraph(const char *model, const char *output) +{ + BEGIN_WRAP + cv::dnn::writeTextGraph(model, output); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_NMSBoxes_Rect(std::vector *bboxes, std::vector *scores, + const float score_threshold, const float nms_threshold, + std::vector *indices, const float eta, const int top_k) +{ + BEGIN_WRAP + cv::dnn::NMSBoxes(*bboxes, *scores, score_threshold, nms_threshold, *indices, eta, top_k); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_NMSBoxes_Rect2d(std::vector *bboxes, std::vector *scores, + const float score_threshold, const float nms_threshold, + std::vector *indices, const float eta, const int top_k) +{ + BEGIN_WRAP + cv::dnn::NMSBoxes(*bboxes, *scores, score_threshold, nms_threshold, *indices, eta, top_k); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_NMSBoxes_RotatedRect(std::vector *bboxes, std::vector *scores, + const float score_threshold, const float nms_threshold, + std::vector *indices, const float eta, const int top_k) +{ + BEGIN_WRAP + cv::dnn::NMSBoxes(*bboxes, *scores, score_threshold, nms_threshold, *indices, eta, top_k); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_resetMyriadDevice() +{ + BEGIN_WRAP + cv::dnn::resetMyriadDevice(); + END_WRAP +} + +#endif // !#ifndef _WINRT_DLL diff --git a/src/OpenCvSharpExtern/dnn_Net.h b/src/OpenCvSharpExtern/dnn_Net.h new file mode 100644 index 000000000..c24b8620c --- /dev/null +++ b/src/OpenCvSharpExtern/dnn_Net.h @@ -0,0 +1,212 @@ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +CVAPI(ExceptionStatus) dnn_Net_new(cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::dnn::Net; + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_delete(cv::dnn::Net* net) +{ + BEGIN_WRAP + delete net; + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_readFromModelOptimizer(const char *xml, const char *bin, cv::dnn::Net **returnValue) +{ + BEGIN_WRAP + const auto net = cv::dnn::Net::readFromModelOptimizer(xml, bin); + *returnValue = new cv::dnn::Net(net); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_empty(cv::dnn::Net* net, int *returnValue) +{ + BEGIN_WRAP + *returnValue = net->empty() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_dump(cv::dnn::Net* net, std::string *outString) +{ + BEGIN_WRAP + outString->assign(net->dump()); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_dumpToFile(cv::dnn::Net* net, const char *path) +{ + BEGIN_WRAP + net->dumpToFile(path); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_getLayerId(cv::dnn::Net* net, const char *layer, int *returnValue) +{ + BEGIN_WRAP + *returnValue = net->getLayerId(layer); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_getLayerNames(cv::dnn::Net* net, std::vector *outVec) +{ + BEGIN_WRAP + const auto result = net->getLayerNames(); + outVec->assign(result.begin(), result.end()); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_connect1(cv::dnn::Net* net, const char *outPin, const char *inpPin) +{ + BEGIN_WRAP + net->connect(outPin, inpPin); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_connect2(cv::dnn::Net* net, int outLayerId, int outNum, int inpLayerId, int inpNum) +{ + BEGIN_WRAP + net->connect(outLayerId, outNum, inpLayerId, inpNum); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_setInputsNames(cv::dnn::Net* net, const char **inputBlobNames, int inputBlobNamesLength) +{ + BEGIN_WRAP + std::vector inputBlobNamesVec(inputBlobNamesLength); + for (auto i = 0; i < inputBlobNamesLength; i++) + { + inputBlobNamesVec[i] = inputBlobNames[i]; + } + net->setInputsNames(inputBlobNamesVec); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_forward1(cv::dnn::Net* net, const char *outputName, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto outputNameStr = (outputName == nullptr) ? cv::String() : cv::String(outputName); + const auto ret = net->forward(outputNameStr); + *returnValue = new cv::Mat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_forward2( + cv::dnn::Net* net, cv::Mat **outputBlobs, int outputBlobsLength, const char *outputName) +{ + BEGIN_WRAP + const auto outputNameStr = (outputName == nullptr) ? cv::String() : cv::String(outputName); + std::vector outputBlobsVec; + toVec(outputBlobs, outputBlobsLength, outputBlobsVec); + + net->forward(outputBlobsVec, outputNameStr); + + for (auto i = 0; i < outputBlobsLength; i++) + { + *outputBlobs[i] = outputBlobsVec[i]; + } + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_forward3( + cv::dnn::Net* net, cv::Mat **outputBlobs, int outputBlobsLength, const char **outBlobNames, int outBlobNamesLength) +{ + BEGIN_WRAP + std::vector outputBlobsVec; + toVec(outputBlobs, outputBlobsLength, outputBlobsVec); + + std::vector outBlobNamesVec(outBlobNamesLength); + for (auto i = 0; i < outBlobNamesLength; i++) + { + outBlobNamesVec[i] = outBlobNames[i]; + } + + net->forward(outputBlobsVec, outBlobNamesVec); + + for (auto i = 0; i < outputBlobsLength; i++) + { + *outputBlobs[i] = outputBlobsVec[i]; + } + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_setHalideScheduler(cv::dnn::Net* net, const char *scheduler) +{ + BEGIN_WRAP + net->setHalideScheduler(scheduler); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_setPreferableBackend(cv::dnn::Net* net, int backendId) +{ + BEGIN_WRAP + net->setPreferableBackend(backendId); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_setPreferableTarget(cv::dnn::Net* net, int targetId) +{ + BEGIN_WRAP + net->setPreferableTarget(targetId); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_setInput(cv::dnn::Net* net, const cv::Mat *blob, const char *name) +{ + BEGIN_WRAP + const auto nameStr = (name == nullptr) ? "" : cv::String(name); + net->setInput(*blob, nameStr); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_getUnconnectedOutLayers(cv::dnn::Net* net, std::vector *result) +{ + BEGIN_WRAP + const auto v = net->getUnconnectedOutLayers(); + result->clear(); + result->resize(v.size()); + for (size_t i = 0; i < v.size(); i++) + { + result->at(i) = v[i]; + } + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_getUnconnectedOutLayersNames(cv::dnn::Net* net, std::vector *result) +{ + BEGIN_WRAP + const auto v = net->getUnconnectedOutLayersNames(); + result->clear(); + result->resize(v.size()); + for (size_t i = 0; i < v.size(); i++) + { + result->at(i) = v[i]; + } + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_enableFusion(cv::dnn::Net* net, int fusion) +{ + BEGIN_WRAP + net->enableFusion(fusion != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_Net_getPerfProfile(cv::dnn::Net* net, std::vector *timings, int64 *returnValue) +{ + BEGIN_WRAP + *returnValue = net->getPerfProfile(*timings); + END_WRAP +} + +#endif // !#ifndef _WINRT_DLL diff --git a/src/OpenCvSharpExtern/dnn_superres.cpp b/src/OpenCvSharpExtern/dnn_superres.cpp new file mode 100644 index 000000000..03f2bcc5c --- /dev/null +++ b/src/OpenCvSharpExtern/dnn_superres.cpp @@ -0,0 +1,2 @@ +// ReSharper disable CppUnusedIncludeDirective +#include "dnn_superres.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/dnn_superres.h b/src/OpenCvSharpExtern/dnn_superres.h new file mode 100644 index 000000000..e33934601 --- /dev/null +++ b/src/OpenCvSharpExtern/dnn_superres.h @@ -0,0 +1,117 @@ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_new1( + cv::dnn_superres::DnnSuperResImpl** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::dnn_superres::DnnSuperResImpl; + END_WRAP +} +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_new2( + const char* algo, int scale, cv::dnn_superres::DnnSuperResImpl** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::dnn_superres::DnnSuperResImpl(algo, scale); + END_WRAP +} + + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_delete(cv::dnn_superres::DnnSuperResImpl* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_readModel1( + cv::dnn_superres::DnnSuperResImpl* obj, const char *path) +{ + BEGIN_WRAP + obj->readModel(path); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_readModel2( + cv::dnn_superres::DnnSuperResImpl* obj, const char* weights, const char *definition) +{ + BEGIN_WRAP + obj->readModel(weights, definition); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_setModel( + cv::dnn_superres::DnnSuperResImpl* obj, const char* algo, int scale) +{ + BEGIN_WRAP + obj->setModel(algo, scale); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_setPreferableBackend( + cv::dnn_superres::DnnSuperResImpl* obj, int backendId) +{ + BEGIN_WRAP + obj->setPreferableBackend(backendId); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_setPreferableTarget( + cv::dnn_superres::DnnSuperResImpl* obj, int targetId) +{ + BEGIN_WRAP + obj->setPreferableTarget(targetId); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_upsample( + cv::dnn_superres::DnnSuperResImpl* obj, cv::_InputArray *img, cv::_OutputArray *result) +{ + BEGIN_WRAP + obj->upsample(*img, *result); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_upsampleMultioutput( + cv::dnn_superres::DnnSuperResImpl* obj, cv::_InputArray *img, std::vector *imgs_new, + const int* scale_factors, int scale_factors_size, + const char **node_names, int node_names_size) +{ + BEGIN_WRAP + + const std::vector scale_factors_vec(scale_factors, scale_factors + scale_factors_size); + std::vector node_names_vec(node_names_size); + for (int i = 0; i < node_names_size; i++) + { + node_names_vec[i].assign(cv::String(node_names[i])); + } + + obj->upsampleMultioutput(*img, *imgs_new, scale_factors_vec, node_names_vec); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_getScale( + cv::dnn_superres::DnnSuperResImpl* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getScale(); + END_WRAP +} + +CVAPI(ExceptionStatus) dnn_superres_DnnSuperResImpl_getAlgorithm( + cv::dnn_superres::DnnSuperResImpl* obj, std::string* returnValue) +{ + BEGIN_WRAP + returnValue->assign(obj->getAlgorithm()); + END_WRAP +} + +#endif diff --git a/src/OpenCvSharpExtern/face.cpp b/src/OpenCvSharpExtern/face.cpp index 10394613c..ddf3f7b86 100644 --- a/src/OpenCvSharpExtern/face.cpp +++ b/src/OpenCvSharpExtern/face.cpp @@ -1,4 +1,3 @@ -#include "face.h" +// ReSharper disable CppUnusedIncludeDirective #include "face_FaceRecognizer.h" -#include "face_BasicFaceRecognizer.h" -#include "face_LBPHFaceRecognizer.h" \ No newline at end of file +#include "face_Facemark.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/face.h b/src/OpenCvSharpExtern/face.h deleted file mode 100644 index 3e3cbfecb..000000000 --- a/src/OpenCvSharpExtern/face.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _CPP_FACE_H_ -#define _CPP_FACE_H_ - -// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile - -#include "include_opencv.h" -using namespace cv::face; - -CVAPI(cv::Ptr*) face_createEigenFaceRecognizer(int numComponents, double threshold) -{ - return clone(createEigenFaceRecognizer(numComponents, threshold)); -} - -CVAPI(cv::Ptr*) face_createFisherFaceRecognizer(int numComponents, double threshold) -{ - return clone(createFisherFaceRecognizer(numComponents, threshold)); -} - -CVAPI(cv::Ptr*) face_createLBPHFaceRecognizer( - int radius, int neighbors, int gridX, int gridY, double threshold) -{ - return clone(createLBPHFaceRecognizer(radius, neighbors, gridX, gridY, threshold)); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/face_BasicFaceRecognizer.h b/src/OpenCvSharpExtern/face_BasicFaceRecognizer.h deleted file mode 100644 index 35f32de03..000000000 --- a/src/OpenCvSharpExtern/face_BasicFaceRecognizer.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _CPP_FACE_BASICFACERECOGNIZER_H_ -#define _CPP_FACE_BASICFACERECOGNIZER_H_ - -// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile - -#include "include_opencv.h" -using namespace cv::face; - -CVAPI(int) face_BasicFaceRecognizer_getNumComponents(BasicFaceRecognizer *obj) -{ - return obj->getNumComponents(); -} -CVAPI(void) face_BasicFaceRecognizer_setNumComponents(BasicFaceRecognizer *obj, int val) -{ - obj->getNumComponents(); -} - -CVAPI(double) face_BasicFaceRecognizer_getThreshold(BasicFaceRecognizer *obj) -{ - return obj->getThreshold(); -} -CVAPI(void) face_BasicFaceRecognizer_setThreshold(BasicFaceRecognizer *obj, double val) -{ - obj->setThreshold(val); -} -CVAPI(void) face_BasicFaceRecognizer_getProjections(BasicFaceRecognizer *obj, std::vector *dst) -{ - std::vector result = obj->getProjections(); - dst->clear(); - dst->reserve(result.size()); - for (size_t i = 0; i < result.size(); i++) - { - dst->push_back(result[i]); - } -} -CVAPI(void) face_BasicFaceRecognizer_getLabels(BasicFaceRecognizer *obj, cv::Mat *dst) -{ - cv::Mat result = obj->getLabels(); - result.copyTo(*dst); -} -CVAPI(void) face_BasicFaceRecognizer_getEigenValues(BasicFaceRecognizer *obj, cv::Mat *dst) -{ - cv::Mat result = obj->getEigenValues(); - result.copyTo(*dst); -} -CVAPI(void) face_BasicFaceRecognizer_getEigenVectors(BasicFaceRecognizer *obj, cv::Mat *dst) -{ - cv::Mat result = obj->getEigenVectors(); - result.copyTo(*dst); -} -CVAPI(void) face_BasicFaceRecognizer_getMean(BasicFaceRecognizer *obj, cv::Mat *dst) -{ - cv::Mat result = obj->getMean(); - result.copyTo(*dst); -} - - -CVAPI(BasicFaceRecognizer*) face_Ptr_BasicFaceRecognizer_get(cv::Ptr *obj) -{ - return obj->get(); -} -CVAPI(void) face_Ptr_BasicFaceRecognizer_delete(cv::Ptr *obj) -{ - delete obj; -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/face_FaceRecognizer.h b/src/OpenCvSharpExtern/face_FaceRecognizer.h index 59cc0d1b3..3e1b5b774 100644 --- a/src/OpenCvSharpExtern/face_FaceRecognizer.h +++ b/src/OpenCvSharpExtern/face_FaceRecognizer.h @@ -1,90 +1,354 @@ -#ifndef _CPP_FACE_FACERECOGNIZER_H_ -#define _CPP_FACE_FACERECOGNIZER_H_ +#pragma once // ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::face; +#ifndef _WINRT_DLL -CVAPI(void) face_FaceRecognizer_train( - FaceRecognizer *obj, cv::Mat **src, int srcLength, int *labels, int labelsLength) +#pragma region FaceRecognizer + +CVAPI(ExceptionStatus) face_FaceRecognizer_train( + cv::face::FaceRecognizer *obj, cv::Mat **src, int srcLength, int *labels, int labelsLength) { + BEGIN_WRAP std::vector srcVec(srcLength); - for (int i = 0; i < srcLength; i++) + for (auto i = 0; i < srcLength; i++) srcVec[i] = *src[i]; - std::vector labelsVec(labels, labels + labelsLength); + const std::vector labelsVec(labels, labels + labelsLength); obj->train(srcVec, labelsVec); + END_WRAP } -CVAPI(void) face_FaceRecognizer_update( - FaceRecognizer *obj, cv::Mat **src, int srcLength, int *labels, int labelsLength) + +CVAPI(ExceptionStatus) face_FaceRecognizer_update( + cv::face::FaceRecognizer *obj, cv::Mat **src, int srcLength, int *labels, int labelsLength) { + BEGIN_WRAP std::vector srcVec(srcLength); - for (int i = 0; i < srcLength; i++) + for (auto i = 0; i < srcLength; i++) srcVec[i] = *src[i]; - std::vector labelsVec(labels, labels + labelsLength); + const std::vector labelsVec(labels, labels + labelsLength); obj->update(srcVec, labelsVec); + END_WRAP } -CVAPI(int) face_FaceRecognizer_predict1(FaceRecognizer *obj, cv::_InputArray *src) + +CVAPI(ExceptionStatus) face_FaceRecognizer_predict1(cv::face::FaceRecognizer *obj, cv::_InputArray *src, int *returnValue) { - return obj->predict(*src); + BEGIN_WRAP + *returnValue = obj->predict(*src); + END_WRAP } -CVAPI(void) face_FaceRecognizer_predict2( - FaceRecognizer *obj, cv::_InputArray *src, int *label, double *confidence) +CVAPI(ExceptionStatus) face_FaceRecognizer_predict2( + cv::face::FaceRecognizer *obj, cv::_InputArray *src, int *label, double *confidence) { + BEGIN_WRAP obj->predict(*src, *label, *confidence); + END_WRAP } -CVAPI(void) face_FaceRecognizer_save1(FaceRecognizer *obj, const char *filename) + +CVAPI(ExceptionStatus) face_FaceRecognizer_write1(cv::face::FaceRecognizer *obj, const char *filename) { - obj->save(filename); + BEGIN_WRAP + obj->write(filename); + END_WRAP } -CVAPI(void) face_FaceRecognizer_load1(FaceRecognizer *obj, const char *filename) +CVAPI(ExceptionStatus) face_FaceRecognizer_read1(cv::face::FaceRecognizer *obj, const char *filename) { - obj->load(filename); + BEGIN_WRAP + obj->read(filename); + END_WRAP } -CVAPI(void) face_FaceRecognizer_save2(FaceRecognizer *obj, cv::FileStorage *fs) + +CVAPI(ExceptionStatus) face_FaceRecognizer_write2(cv::face::FaceRecognizer *obj, cv::FileStorage *fs) { - obj->save(*fs); + BEGIN_WRAP + obj->write(*fs); + END_WRAP } -CVAPI(void) face_FaceRecognizer_load2(FaceRecognizer *obj, cv::FileStorage *fs) +CVAPI(ExceptionStatus) face_FaceRecognizer_read2(cv::face::FaceRecognizer *obj, cv::FileNode *fn) { - obj->load(*fs); + BEGIN_WRAP + obj->read(*fn); + END_WRAP } -CVAPI(void) face_FaceRecognizer_setLabelInfo(FaceRecognizer *obj, int label, const char *strInfo) +CVAPI(ExceptionStatus) face_FaceRecognizer_setLabelInfo(cv::face::FaceRecognizer *obj, int label, const char *strInfo) { + BEGIN_WRAP obj->setLabelInfo(label, strInfo); + END_WRAP } -CVAPI(void) face_FaceRecognizer_getLabelInfo(FaceRecognizer *obj, int label, std::vector *dst) +CVAPI(ExceptionStatus) face_FaceRecognizer_getLabelInfo(cv::face::FaceRecognizer *obj, int label, std::string *dst) { - cv::String result = obj->getLabelInfo(label); - dst->resize(result.size() + 1); - std::memcpy(&((*dst)[0]), result.c_str(), result.size() + 1); + BEGIN_WRAP + const auto result = obj->getLabelInfo(label); + dst->assign(result); + END_WRAP } -CVAPI(void) face_FaceRecognizer_getLabelsByString(FaceRecognizer *obj, const char* str, std::vector *dst) +CVAPI(ExceptionStatus) face_FaceRecognizer_getLabelsByString(cv::face::FaceRecognizer *obj, const char* str, std::vector *dst) { - std::vector result = obj->getLabelsByString(str); + BEGIN_WRAP + const auto result = obj->getLabelsByString(str); std::copy(result.begin(), result.end(), std::back_inserter(*dst)); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FaceRecognizer_getThreshold(cv::face::FaceRecognizer *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) face_FaceRecognizer_setThreshold(cv::face::FaceRecognizer *obj, double val) +{ + BEGIN_WRAP + obj->setThreshold(val); + END_WRAP +} + +#pragma endregion + +#pragma region BasicFaceRecognizer + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getNumComponents(cv::face::BasicFaceRecognizer *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNumComponents(); + END_WRAP +} +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_setNumComponents(cv::face::BasicFaceRecognizer *obj, int val) +{ + BEGIN_WRAP + obj->setNumComponents(val); + END_WRAP +} + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getThreshold(cv::face::BasicFaceRecognizer *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_setThreshold(cv::face::BasicFaceRecognizer *obj, double val) +{ + BEGIN_WRAP + obj->setThreshold(val); + END_WRAP +} + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getProjections(cv::face::BasicFaceRecognizer *obj, std::vector *dst) +{ + BEGIN_WRAP + auto result = obj->getProjections(); + dst->clear(); + dst->reserve(result.size()); + for (size_t i = 0; i < result.size(); i++) + { + dst->push_back(result[i]); + } + END_WRAP +} + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getLabels(cv::face::BasicFaceRecognizer *obj, cv::Mat *dst) +{ + BEGIN_WRAP + const auto result = obj->getLabels(); + result.copyTo(*dst); + END_WRAP +} + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getEigenValues(cv::face::BasicFaceRecognizer *obj, cv::Mat *dst) +{ + BEGIN_WRAP + const auto result = obj->getEigenValues(); + result.copyTo(*dst); + END_WRAP +} + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getEigenVectors(cv::face::BasicFaceRecognizer *obj, cv::Mat *dst) +{ + BEGIN_WRAP + const auto result = obj->getEigenVectors(); + result.copyTo(*dst); + END_WRAP +} + +CVAPI(ExceptionStatus) face_BasicFaceRecognizer_getMean(cv::face::BasicFaceRecognizer *obj, cv::Mat *dst) +{ + BEGIN_WRAP + const auto result = obj->getMean(); + result.copyTo(*dst); + END_WRAP +} + +#pragma endregion + +#pragma region EigenFaceRecognizer + +CVAPI(ExceptionStatus) face_EigenFaceRecognizer_create( + const int numComponents, const double threshold, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto r = cv::face::EigenFaceRecognizer::create(numComponents, threshold); + *returnValue = clone(r); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_EigenFaceRecognizer_get(cv::Ptr *obj, cv::face::EigenFaceRecognizer **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(double) face_FaceRecognizer_getThreshold(FaceRecognizer *obj) +CVAPI(ExceptionStatus) face_Ptr_EigenFaceRecognizer_delete(cv::Ptr *obj) { - return obj->getThreshold(); + BEGIN_WRAP + delete obj; + END_WRAP +} + +#pragma endregion + +#pragma region FisherFaceRecognizer + +CVAPI(ExceptionStatus) face_FisherFaceRecognizer_create( + const int numComponents, const double threshold, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto r = cv::face::FisherFaceRecognizer::create(numComponents, threshold); + *returnValue = clone(r); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_FisherFaceRecognizer_get(cv::Ptr *obj, cv::face::FisherFaceRecognizer **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_FisherFaceRecognizer_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +#pragma endregion + +#pragma region LBPHFaceRecognizer + +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_create( + const int radius, const int neighbors, const int gridX, const int gridY, const double threshold, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto r = cv::face::LBPHFaceRecognizer::create(radius, neighbors, gridX, gridY, threshold); + *returnValue = clone(r); + END_WRAP } -CVAPI(void) face_FaceRecognizer_setThreshold(FaceRecognizer *obj, double val) + +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getGridX(cv::face::LBPHFaceRecognizer *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getGridX(); + END_WRAP +} +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_setGridX(cv::face::LBPHFaceRecognizer *obj, int val) +{ + BEGIN_WRAP + obj->setGridX(val); + END_WRAP +} + +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getGridY(cv::face::LBPHFaceRecognizer *obj, int *returnValue) { + BEGIN_WRAP + *returnValue = obj->getGridY(); + END_WRAP +} +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_setGridY(cv::face::LBPHFaceRecognizer *obj, int val) +{ + BEGIN_WRAP + obj->setGridY(val); + END_WRAP +} + +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getRadius(cv::face::LBPHFaceRecognizer *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getRadius(); + END_WRAP +} +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_setRadius(cv::face::LBPHFaceRecognizer *obj, int val) +{ + BEGIN_WRAP + obj->setRadius(val); + END_WRAP +} + +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getNeighbors(cv::face::LBPHFaceRecognizer *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNeighbors(); + END_WRAP +} +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_setNeighbors(cv::face::LBPHFaceRecognizer *obj, int val) +{ + BEGIN_WRAP + obj->setNeighbors(val); + END_WRAP +} + +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getThreshold(cv::face::LBPHFaceRecognizer *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_setThreshold(cv::face::LBPHFaceRecognizer *obj, double val) +{ + BEGIN_WRAP obj->setThreshold(val); + END_WRAP } +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getHistograms(cv::face::LBPHFaceRecognizer *obj, std::vector *dst) +{ + BEGIN_WRAP + auto result = obj->getHistograms(); + dst->clear(); + dst->reserve(result.size()); + for (size_t i = 0; i < result.size(); i++) + { + dst->at(i) = result[i]; + } + END_WRAP +} +CVAPI(ExceptionStatus) face_LBPHFaceRecognizer_getLabels(cv::face::LBPHFaceRecognizer *obj, cv::Mat *dst) +{ + BEGIN_WRAP + const auto result = obj->getLabels(); + result.copyTo(*dst); + END_WRAP +} -CVAPI(FaceRecognizer*) face_Ptr_FaceRecognizer_get(cv::Ptr *obj) + +CVAPI(ExceptionStatus) face_Ptr_LBPHFaceRecognizer_get(cv::Ptr *obj, cv::face::LBPHFaceRecognizer **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(void) face_Ptr_FaceRecognizer_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) face_Ptr_LBPHFaceRecognizer_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -#endif +#pragma endregion + +#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/face_Facemark.h b/src/OpenCvSharpExtern/face_Facemark.h new file mode 100644 index 000000000..4cb830b2b --- /dev/null +++ b/src/OpenCvSharpExtern/face_Facemark.h @@ -0,0 +1,510 @@ +#pragma once + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +#ifndef _WINRT_DLL + +#pragma region Facemark + +CVAPI(ExceptionStatus) face_Facemark_loadModel(cv::face::Facemark *obj, const char *model) +{ + BEGIN_WRAP + obj->loadModel(model); + END_WRAP +} + +CVAPI(ExceptionStatus) +face_Facemark_fit( + cv::face::Facemark *obj, + cv::_InputArray *image, + cv::_InputArray *faces, + std::vector> *landmarks, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->fit(*image, *faces, *landmarks) ? 1 : 0; + END_WRAP +} + +#pragma endregion + +#pragma region FacemarkLBF + +CVAPI(ExceptionStatus) face_FacemarkLBF_create(cv::face::FacemarkLBF::Params *params, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto obj = (params == nullptr) ? + cv::face::FacemarkLBF::create() : + cv::face::FacemarkLBF::create(*params); + *returnValue = clone(obj); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_FacemarkLBF_get(cv::Ptr *obj, cv::face::FacemarkLBF **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_FacemarkLBF_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +#pragma region Params + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_new(cv::face::FacemarkLBF::Params **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::face::FacemarkLBF::Params; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_delete(cv::face::FacemarkLBF::Params *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_shape_offset_get(cv::face::FacemarkLBF::Params *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->shape_offset; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_shape_offset_set(cv::face::FacemarkLBF::Params *obj, double val) +{ + BEGIN_WRAP + obj->shape_offset = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_cascade_face_get(cv::face::FacemarkLBF::Params *obj, std::string *s) +{ + BEGIN_WRAP + s->assign(obj->cascade_face); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_cascade_face_set(cv::face::FacemarkLBF::Params *obj, const char *s) +{ + BEGIN_WRAP + obj->cascade_face = s; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_verbose_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->verbose ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_verbose_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->verbose = (val != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_n_landmarks_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->n_landmarks; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_n_landmarks_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->n_landmarks = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_initShape_n_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->initShape_n; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_initShape_n_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->initShape_n = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_stages_n_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->stages_n; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_stages_n_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->stages_n = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_tree_n_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->tree_n; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_tree_n_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->tree_n = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_tree_depth_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->tree_depth; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_tree_depth_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->tree_depth = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_bagging_overlap_get(cv::face::FacemarkLBF::Params *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->bagging_overlap; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_bagging_overlap_set(cv::face::FacemarkLBF::Params *obj, double val) +{ + BEGIN_WRAP + obj->bagging_overlap = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_model_filename_get(cv::face::FacemarkLBF::Params *obj, std::string *s) +{ + BEGIN_WRAP + s->assign(obj->model_filename); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_model_filename_set(cv::face::FacemarkLBF::Params *obj, const char *s) +{ + BEGIN_WRAP + obj->model_filename = s; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_save_model_get(cv::face::FacemarkLBF::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->save_model ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_save_model_set(cv::face::FacemarkLBF::Params *obj, int val) +{ + BEGIN_WRAP + obj->save_model = (val != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_seed_get(cv::face::FacemarkLBF::Params *obj, unsigned int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->seed; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_seed_set(cv::face::FacemarkLBF::Params *obj, unsigned int val) +{ + BEGIN_WRAP + obj->seed = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_feats_m_get(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + std::copy(obj->feats_m.begin(), obj->feats_m.end(), std::back_inserter(*v)); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_feats_m_set(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + obj->feats_m.clear(); + std::copy(v->begin(), v->end(), std::back_inserter(obj->feats_m)); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_radius_m_get(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + std::copy(obj->radius_m.begin(), obj->radius_m.end(), std::back_inserter(*v)); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_radius_m_set(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + obj->radius_m.clear(); + std::copy(v->begin(), v->end(), std::back_inserter(obj->radius_m)); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_pupils0_get(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + std::copy(obj->pupils[0].begin(), obj->pupils[0].end(), std::back_inserter(*v)); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_pupils0_set(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + obj->pupils[0].clear(); + std::copy(v->begin(), v->end(), std::back_inserter(obj->pupils[0])); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_pupils1_get(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + std::copy(obj->pupils[1].begin(), obj->pupils[1].end(), std::back_inserter(*v)); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_pupils1_set(cv::face::FacemarkLBF::Params *obj, std::vector *v) +{ + BEGIN_WRAP + obj->pupils[1].clear(); + std::copy(v->begin(), v->end(), std::back_inserter(obj->pupils[1])); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_detectROI_get(cv::face::FacemarkLBF::Params *obj, MyCvRect *returnValue) +{ + BEGIN_WRAP + *returnValue = c(obj->detectROI); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_detectROI_set(cv::face::FacemarkLBF::Params *obj, MyCvRect val) +{ + BEGIN_WRAP + obj->detectROI = cpp(val); + END_WRAP +} + + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_read(cv::face::FacemarkLBF::Params *obj, cv::FileNode *fn) +{ + BEGIN_WRAP + obj->read(*fn); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkLBF_Params_write(cv::face::FacemarkLBF::Params *obj, cv::FileStorage *fs) +{ + BEGIN_WRAP + obj->write(*fs); + END_WRAP +} + +#pragma endregion +#pragma endregion + +#pragma region FacemarkAAM + +CVAPI(ExceptionStatus) face_FacemarkAAM_create(cv::face::FacemarkAAM::Params *params, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto obj = (params == nullptr) ? + cv::face::FacemarkAAM::create() : + cv::face::FacemarkAAM::create(*params); + *returnValue = clone(obj); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_FacemarkAAM_get(cv::Ptr *obj, cv::face::FacemarkAAM **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) face_Ptr_FacemarkAAM_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +#pragma region Params + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_new(cv::face::FacemarkAAM::Params **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::face::FacemarkAAM::Params; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_delete(cv::face::FacemarkAAM::Params *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_model_filename_get(cv::face::FacemarkAAM::Params *obj, std::string *s) +{ + BEGIN_WRAP + s->assign(obj->model_filename); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_model_filename_set(cv::face::FacemarkAAM::Params *obj, const char *s) +{ + BEGIN_WRAP + obj->model_filename = s; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_m_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->m; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_m_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->m = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_n_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->n; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_n_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->n = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_n_iter_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->n_iter; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_n_iter_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->n_iter = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_verbose_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->verbose ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_verbose_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->verbose = (val != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_save_model_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->save_model ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_save_model_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->save_model = (val != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_max_m_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->max_m; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_max_m_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->max_m = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_max_n_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->max_n; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_max_n_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->max_n = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_texture_max_m_get(cv::face::FacemarkAAM::Params *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->texture_max_m; + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_texture_max_m_set(cv::face::FacemarkAAM::Params *obj, int val) +{ + BEGIN_WRAP + obj->texture_max_m = val; + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_scales_get(cv::face::FacemarkAAM::Params *obj, std::vector *v) +{ + BEGIN_WRAP + std::copy(obj->scales.begin(), obj->scales.end(), std::back_inserter(*v)); + END_WRAP +} +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_scales_set(cv::face::FacemarkAAM::Params *obj, std::vector *v) +{ + BEGIN_WRAP + obj->scales.clear(); + std::copy(v->begin(), v->end(), std::back_inserter(obj->scales)); + END_WRAP +} + + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_read(cv::face::FacemarkAAM::Params *obj, cv::FileNode *fn) +{ + BEGIN_WRAP + obj->read(*fn); + END_WRAP +} + +CVAPI(ExceptionStatus) face_FacemarkAAM_Params_write(cv::face::FacemarkAAM::Params *obj, cv::FileStorage *fs) +{ + BEGIN_WRAP + obj->write(*fs); + END_WRAP +} + +#pragma endregion +#pragma endregion + +#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/face_LBPHFaceRecognizer.h b/src/OpenCvSharpExtern/face_LBPHFaceRecognizer.h deleted file mode 100644 index 499ba9d78..000000000 --- a/src/OpenCvSharpExtern/face_LBPHFaceRecognizer.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _CPP_FACE_LBPHFACERECOGNIZER_H_ -#define _CPP_FACE_LBPHFACERECOGNIZER_H_ - -// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile - -#include "include_opencv.h" -using namespace cv::face; - - -CVAPI(int) face_LBPHFaceRecognizer_getGridX(LBPHFaceRecognizer *obj) -{ - return obj->getGridX(); -} -CVAPI(void) face_LBPHFaceRecognizer_setGridX(LBPHFaceRecognizer *obj, int val) -{ - obj->setGridX(val); -} -CVAPI(int) face_LBPHFaceRecognizer_getGridY(LBPHFaceRecognizer *obj) -{ - return obj->getGridY(); -} -CVAPI(void) face_LBPHFaceRecognizer_setGridY(LBPHFaceRecognizer *obj, int val) -{ - obj->setGridY(val); -} -CVAPI(int) face_LBPHFaceRecognizer_getRadius(LBPHFaceRecognizer *obj) -{ - return obj->getRadius(); -} -CVAPI(void) face_LBPHFaceRecognizer_setRadius(LBPHFaceRecognizer *obj, int val) -{ - obj->setRadius(val); -} -CVAPI(int) face_LBPHFaceRecognizer_getNeighbors(LBPHFaceRecognizer *obj) -{ - return obj->getNeighbors(); -} -CVAPI(void) face_LBPHFaceRecognizer_setNeighbors(LBPHFaceRecognizer *obj, int val) -{ - obj->setNeighbors(val); -} -CVAPI(double) face_LBPHFaceRecognizer_getThreshold(LBPHFaceRecognizer *obj) -{ - return obj->getThreshold(); -} -CVAPI(void) face_LBPHFaceRecognizer_setThreshold(LBPHFaceRecognizer *obj, double val) -{ - obj->setThreshold(val); -} -CVAPI(void) face_LBPHFaceRecognizer_getHistograms(LBPHFaceRecognizer *obj, std::vector *dst) -{ - std::vector result = obj->getHistograms(); - dst->clear(); - dst->reserve(result.size()); - for (size_t i = 0; i < result.size(); i++) - { - dst->at(i) = result[i]; - } -} -CVAPI(void) face_LBPHFaceRecognizer_getLabels(LBPHFaceRecognizer *obj, cv::Mat *dst) -{ - cv::Mat result = obj->getLabels(); - result.copyTo(*dst); -} - - -CVAPI(LBPHFaceRecognizer*) face_Ptr_LBPHFaceRecognizer_get(cv::Ptr *obj) -{ - return obj->get(); -} -CVAPI(void) face_Ptr_LBPHFaceRecognizer_delete(cv::Ptr *obj) -{ - delete obj; -} - - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d.cpp b/src/OpenCvSharpExtern/features2d.cpp index e792ba17e..9bc93c9fa 100644 --- a/src/OpenCvSharpExtern/features2d.cpp +++ b/src/OpenCvSharpExtern/features2d.cpp @@ -1,14 +1,5 @@ +// ReSharper disable CppUnusedIncludeDirective #include "features2d.h" -#include "features2d_AgastFeatureDetector.h" -#include "features2d_AKAZE.h" #include "features2d_BOW.h" -#include "features2d_BRISK.h" #include "features2d_DescriptorMatcher.h" -#include "features2d_FastFeatureDetector.h" -#include "features2d_FeatureDetector.h" -#include "features2d_GFTTDetector.h" -#include "features2d_KAZE.h" -#include "features2d_KeyPointsFilter.h" -#include "features2d_MSER.h" -#include "features2d_ORB.h" -#include "features2d_SimpleBlobDetector.h" +#include "features2d_Feature2D.h" diff --git a/src/OpenCvSharpExtern/features2d.h b/src/OpenCvSharpExtern/features2d.h index 7ff8e9d26..64843ec38 100644 --- a/src/OpenCvSharpExtern/features2d.h +++ b/src/OpenCvSharpExtern/features2d.h @@ -1,41 +1,49 @@ -#ifndef _CPP_FEATURES2D_H_ -#define _CPP_FEATURES2D_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) features2d_drawKeypoints(cv::Mat* image, cv::KeyPoint *keypoints, int keypointsLength, - cv::Mat *outImage, CvScalar color, int flags) +CVAPI(ExceptionStatus) features2d_drawKeypoints(cv::_InputArray *image, cv::KeyPoint *keypoints, int keypointsLength, + cv::_InputOutputArray *outImage, MyCvScalar color, int flags) { - std::vector keypointsVec(keypoints, keypoints + keypointsLength); - cv::drawKeypoints(*image, keypointsVec, *outImage, color, flags); + BEGIN_WRAP + const std::vector keypointsVec(keypoints, keypoints + keypointsLength); + cv::drawKeypoints(*image, keypointsVec, *outImage, cpp(color), static_cast(flags)); + END_WRAP } -CVAPI(void) features2d_drawMatches1(cv::Mat *img1, cv::KeyPoint *keypoints1, int keypoints1Length, +CVAPI(ExceptionStatus) features2d_drawMatches(cv::Mat *img1, cv::KeyPoint *keypoints1, int keypoints1Length, cv::Mat *img2, cv::KeyPoint *keypoints2, int keypoints2Length, cv::DMatch *matches1to2, int matches1to2Length, cv::Mat *outImg, - CvScalar matchColor, CvScalar singlePointColor, + MyCvScalar matchColor, MyCvScalar singlePointColor, char *matchesMask, int matchesMaskLength, int flags) { - std::vector keypoints1Vec(keypoints1, keypoints1 + keypoints1Length); - std::vector keypoints2Vec(keypoints2, keypoints2 + keypoints2Length); - std::vector matches1to2Vec(matches1to2, matches1to2 + matches1to2Length); + BEGIN_WRAP + const std::vector keypoints1Vec(keypoints1, keypoints1 + keypoints1Length); + const std::vector keypoints2Vec(keypoints2, keypoints2 + keypoints2Length); + const std::vector matches1to2Vec(matches1to2, matches1to2 + matches1to2Length); std::vector matchesMaskVec; - if (matchesMask != NULL) + if (matchesMask != nullptr) matchesMaskVec = std::vector(matchesMask, matchesMask + matchesMaskLength); cv::drawMatches(*img1, keypoints1Vec, *img2, keypoints2Vec, matches1to2Vec, *outImg, - matchColor, singlePointColor, matchesMaskVec, flags); + cpp(matchColor), cpp(singlePointColor), matchesMaskVec, static_cast(flags)); + END_WRAP } -CVAPI(void) features2d_drawMatches2(cv::Mat *img1, cv::KeyPoint *keypoints1, int keypoints1Length, +CVAPI(ExceptionStatus) features2d_drawMatchesKnn(cv::Mat *img1, cv::KeyPoint *keypoints1, int keypoints1Length, cv::Mat *img2, cv::KeyPoint *keypoints2, int keypoints2Length, cv::DMatch **matches1to2, int matches1to2Size1, int *matches1to2Size2, - cv::Mat *outImg, CvScalar matchColor, CvScalar singlePointColor, + cv::Mat *outImg, MyCvScalar matchColor, MyCvScalar singlePointColor, char **matchesMask, int matchesMaskSize1, int *matchesMaskSize2, int flags) { - std::vector keypoints1Vec(keypoints1, keypoints1 + keypoints1Length); - std::vector keypoints2Vec(keypoints2, keypoints2 + keypoints2Length); + BEGIN_WRAP + const std::vector keypoints1Vec(keypoints1, keypoints1 + keypoints1Length); + const std::vector keypoints2Vec(keypoints2, keypoints2 + keypoints2Length); std::vector > matches1to2Vec(matches1to2Size1); for (int i = 0; i < matches1to2Size1; i++) { @@ -44,7 +52,7 @@ CVAPI(void) features2d_drawMatches2(cv::Mat *img1, cv::KeyPoint *keypoints1, int } std::vector > matchesMaskVec; - if (matchesMask != NULL) + if (matchesMask != nullptr) { matchesMaskVec = std::vector >(matchesMaskSize1); for (int i = 0; i < matchesMaskSize1; i++) @@ -55,55 +63,116 @@ CVAPI(void) features2d_drawMatches2(cv::Mat *img1, cv::KeyPoint *keypoints1, int } cv::drawMatches(*img1, keypoints1Vec, *img2, keypoints2Vec, matches1to2Vec, - *outImg, matchColor, singlePointColor, matchesMaskVec, flags); + *outImg, cpp(matchColor), cpp(singlePointColor), matchesMaskVec, static_cast(flags)); + END_WRAP } -CVAPI(void) features2d_evaluateFeatureDetector( +CVAPI(ExceptionStatus) features2d_evaluateFeatureDetector( cv::Mat *img1, cv::Mat *img2, cv::Mat *H1to2, std::vector *keypoints1, std::vector *keypoints2, float *repeatability, int *correspCount/*, const Ptr& fdetector = Ptr()*/) { - cv::evaluateFeatureDetector(*img1, *img2, *H1to2, keypoints1, keypoints2, + BEGIN_WRAP + cv::evaluateFeatureDetector( + *img1, *img2, *H1to2, keypoints1, keypoints2, *repeatability, *correspCount); + END_WRAP } -CVAPI(void) features2d_computeRecallPrecisionCurve( +CVAPI(ExceptionStatus) features2d_computeRecallPrecisionCurve( cv::DMatch **matches1to2, int matches1to2Size1, int *matches1to2Size2, uchar **correctMatches1to2Mask, int correctMatches1to2MaskSize1, int *correctMatches1to2MaskSize2, std::vector *recallPrecisionCurve) { + BEGIN_WRAP std::vector > matches1to2Vec; std::vector > correctMatches1to2MaskVec; + matches1to2Vec.reserve(matches1to2Size1); for (int i = 0; i < matches1to2Size1; i++) { - matches1to2Vec.push_back( - std::vector(matches1to2[i], matches1to2[i] + matches1to2Size2[i])); + matches1to2Vec.emplace_back(matches1to2[i], matches1to2[i] + matches1to2Size2[i]); } + correctMatches1to2MaskVec.reserve(correctMatches1to2MaskSize1); for (int i = 0; i < correctMatches1to2MaskSize1; i++) { - correctMatches1to2MaskVec.push_back( - std::vector(correctMatches1to2Mask[i], correctMatches1to2Mask[i] + correctMatches1to2MaskSize2[i])); + correctMatches1to2MaskVec.emplace_back(correctMatches1to2Mask[i], correctMatches1to2Mask[i] + correctMatches1to2MaskSize2[i]); } cv::computeRecallPrecisionCurve( matches1to2Vec, correctMatches1to2MaskVec, *recallPrecisionCurve); + END_WRAP } -CVAPI(float) features2d_getRecall( - cv::Point2f *recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision) +CVAPI(ExceptionStatus) features2d_getRecall( + cv::Point2f *recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision, float *returnValue) { - std::vector recallPrecisionCurveVec( + BEGIN_WRAP + const std::vector recallPrecisionCurveVec( recallPrecisionCurve, recallPrecisionCurve + recallPrecisionCurveSize); - return cv::getRecall(recallPrecisionCurveVec, l_precision); + *returnValue = cv::getRecall(recallPrecisionCurveVec, l_precision); + END_WRAP } -CVAPI(int) features2d_getNearestPoint( - cv::Point2f *recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision) +CVAPI(ExceptionStatus) features2d_getNearestPoint( + cv::Point2f *recallPrecisionCurve, int recallPrecisionCurveSize, float l_precision, int *returnValue) { - std::vector recallPrecisionCurveVec( + BEGIN_WRAP + const std::vector recallPrecisionCurveVec( recallPrecisionCurve, recallPrecisionCurve + recallPrecisionCurveSize); - return cv::getNearestPoint(recallPrecisionCurveVec, l_precision); + *returnValue = cv::getNearestPoint(recallPrecisionCurveVec, l_precision); + END_WRAP +} + + +#pragma region KeyPointsFilter + +CVAPI(ExceptionStatus) features2d_KeyPointsFilter_runByImageBorder( + std::vector *keypoints, MyCvSize imageSize, int borderSize) +{ + BEGIN_WRAP + cv::KeyPointsFilter::runByImageBorder(*keypoints, cpp(imageSize), borderSize); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KeyPointsFilter_runByKeypointSize( + std::vector *keypoints, float minSize, float maxSize) +{ + BEGIN_WRAP + cv::KeyPointsFilter::runByKeypointSize(*keypoints, minSize, maxSize); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KeyPointsFilter_runByPixelsMask( + std::vector *keypoints, cv::Mat *mask) +{ + BEGIN_WRAP + cv::KeyPointsFilter::runByPixelsMask(*keypoints, *mask); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KeyPointsFilter_removeDuplicated( + std::vector *keypoints) +{ + BEGIN_WRAP + cv::KeyPointsFilter::removeDuplicated(*keypoints); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KeyPointsFilter_removeDuplicatedSorted( + std::vector *keypoints) +{ + BEGIN_WRAP + cv::KeyPointsFilter::removeDuplicatedSorted(*keypoints); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KeyPointsFilter_retainBest( + std::vector *keypoints, int nPoints) +{ + BEGIN_WRAP + cv::KeyPointsFilter::retainBest(*keypoints, nPoints); + END_WRAP } -#endif \ No newline at end of file +#pragma endregion diff --git a/src/OpenCvSharpExtern/features2d_AKAZE.h b/src/OpenCvSharpExtern/features2d_AKAZE.h deleted file mode 100644 index 9ad0dd0a2..000000000 --- a/src/OpenCvSharpExtern/features2d_AKAZE.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef _CPP_FEATURES2D_AKAZE_H_ -#define _CPP_FEATURES2D_AKAZE_H_ - -#include "include_opencv.h" - - -CVAPI(cv::Ptr*) features2d_AKAZE_create( - int descriptor_type, int descriptor_size, int descriptor_channels, - float threshold, int nOctaves, int nOctaveLayers, int diffusivity) -{ - cv::Ptr ptr = cv::AKAZE::create( - descriptor_type, descriptor_size, descriptor_channels, - threshold, nOctaves, nOctaveLayers, diffusivity); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_AKAZE_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::AKAZE*) features2d_Ptr_AKAZE_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - - -CVAPI(void) features2d_AKAZE_setDescriptorType(cv::AKAZE *obj, int val) -{ - obj->setDescriptorType(val); -} -CVAPI(int) features2d_AKAZE_getDescriptorType(cv::AKAZE *obj) -{ - return obj->getDescriptorType(); -} - -CVAPI(void) features2d_AKAZE_setDescriptorSize(cv::AKAZE *obj, int val) -{ - obj->setDescriptorSize(val); -} -CVAPI(int) features2d_AKAZE_getDescriptorSize(cv::AKAZE *obj) -{ - return obj->getDescriptorSize(); -} - -CVAPI(void) features2d_AKAZE_setDescriptorChannels(cv::AKAZE *obj, int val) -{ - obj->setDescriptorChannels(val); -} -CVAPI(int) features2d_AKAZE_getDescriptorChannels(cv::AKAZE *obj) -{ - return obj->getDescriptorChannels(); -} - -CVAPI(void) features2d_AKAZE_setThreshold(cv::AKAZE *obj, double val) -{ - obj->setThreshold(val); -} -CVAPI(double) features2d_AKAZE_getThreshold(cv::AKAZE *obj) -{ - return obj->getThreshold(); -} - -CVAPI(void) features2d_AKAZE_setNOctaves(cv::AKAZE *obj, int val) -{ - obj->setNOctaves(val); -} -CVAPI(int) features2d_AKAZE_getNOctaves(cv::AKAZE *obj) -{ - return obj->getNOctaves(); -} - -CVAPI(void) features2d_AKAZE_setNOctaveLayers(cv::AKAZE *obj, int val) -{ - obj->setNOctaveLayers(val); -} -CVAPI(int) features2d_AKAZE_getNOctaveLayers(cv::AKAZE *obj) -{ - return obj->getNOctaveLayers(); -} - -CVAPI(void) features2d_AKAZE_setDiffusivity(cv::AKAZE *obj, int val) -{ - obj->setDiffusivity(val); -} -CVAPI(int) features2d_AKAZE_getDiffusivity(cv::AKAZE *obj) -{ - return obj->getDiffusivity(); -} - -#endif diff --git a/src/OpenCvSharpExtern/features2d_AgastFeatureDetector.h b/src/OpenCvSharpExtern/features2d_AgastFeatureDetector.h deleted file mode 100644 index 7470b5d05..000000000 --- a/src/OpenCvSharpExtern/features2d_AgastFeatureDetector.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _CPP_FEATURES2D_AGASTFEATUREDETECTOR_H_ -#define _CPP_FEATURES2D_AGASTFEATUREDETECTOR_H_ - -#include "include_opencv.h" - - -CVAPI(void) features2d_AGAST(cv::_InputArray *image, std::vector *keypoints, - int threshold, int nonmaxSuppression, int type) -{ - cv::AGAST(entity(image), *keypoints, threshold, nonmaxSuppression != 0, type); -} - - -CVAPI(cv::Ptr*) features2d_AgastFeatureDetector_create( - int threshold, int nonmaxSuppression, int type) -{ - cv::Ptr ptr = cv::AgastFeatureDetector::create( - threshold, nonmaxSuppression != 0, type); - return new cv::Ptr(ptr); -} - -CVAPI(void) features2d_Ptr_AgastFeatureDetector_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::AgastFeatureDetector*) features2d_Ptr_AgastFeatureDetector_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - - -CVAPI(void) features2d_AgastFeatureDetector_setThreshold(cv::AgastFeatureDetector *obj, int val) -{ - obj->setThreshold(val); -} -CVAPI(int) features2d_AgastFeatureDetector_getThreshold(cv::AgastFeatureDetector *obj) -{ - return obj->getThreshold(); -} - -CVAPI(void) features2d_AgastFeatureDetector_setNonmaxSuppression(cv::AgastFeatureDetector *obj, int val) -{ - obj->setNonmaxSuppression(val != 0); -} -CVAPI(int) features2d_AgastFeatureDetector_getNonmaxSuppression(cv::AgastFeatureDetector *obj) -{ - return obj->getNonmaxSuppression() ? 1 : 0; -} - -CVAPI(void) features2d_AgastFeatureDetector_setType(cv::AgastFeatureDetector *obj, int val) -{ - obj->setType(val); -} -CVAPI(int) features2d_AgastFeatureDetector_getType(cv::AgastFeatureDetector *obj) -{ - return obj->getType(); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_BOW.h b/src/OpenCvSharpExtern/features2d_BOW.h index fe4c1cfe6..2bbf7a7c1 100644 --- a/src/OpenCvSharpExtern/features2d_BOW.h +++ b/src/OpenCvSharpExtern/features2d_BOW.h @@ -1,132 +1,173 @@ -#ifndef _CPP_FEATURES2D_BOW_H_ -#define _CPP_FEATURES2D_BOW_H_ +#pragma once + +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" // BOWTrainer -CVAPI(void) features2d_BOWTrainer_add(cv::BOWTrainer *obj, cv::Mat *descriptors) +CVAPI(ExceptionStatus) features2d_BOWTrainer_add(cv::BOWTrainer *obj, cv::Mat *descriptors) { + BEGIN_WRAP obj->add(*descriptors); + END_WRAP } -CVAPI(void) features2d_BOWTrainer_getDescriptors(cv::BOWTrainer *obj, std::vector *descriptors) +CVAPI(ExceptionStatus) features2d_BOWTrainer_getDescriptors(cv::BOWTrainer *obj, std::vector *descriptors) { + BEGIN_WRAP const std::vector d = obj->getDescriptors(); std::copy(d.begin(), d.end(), std::back_inserter(*descriptors)); + END_WRAP } -CVAPI(int) features2d_BOWTrainer_descriptorsCount(cv::BOWTrainer *obj) +CVAPI(ExceptionStatus) features2d_BOWTrainer_descriptorsCount(cv::BOWTrainer *obj, int *returnValue) { - return obj->descriptorsCount(); + BEGIN_WRAP + *returnValue = obj->descriptorsCount(); + END_WRAP } -CVAPI(void) features2d_BOWTrainer_clear(cv::BOWTrainer *obj) +CVAPI(ExceptionStatus) features2d_BOWTrainer_clear(cv::BOWTrainer *obj) { + BEGIN_WRAP obj->clear(); + END_WRAP } // BOWKMeansTrainer -CVAPI(cv::BOWKMeansTrainer*) features2d_BOWKMeansTrainer_new( - int clusterCount, MyCvTermCriteria termcrit, int attempts, int flags) +CVAPI(ExceptionStatus) features2d_BOWKMeansTrainer_new( + int clusterCount, MyCvTermCriteria termcrit, int attempts, int flags, cv::BOWKMeansTrainer **returnValue) { - return new cv::BOWKMeansTrainer(clusterCount, cpp(termcrit), attempts, flags); + BEGIN_WRAP + *returnValue = new cv::BOWKMeansTrainer(clusterCount, cpp(termcrit), attempts, flags); + END_WRAP } -CVAPI(void) features2d_BOWKMeansTrainer_delete(cv::BOWKMeansTrainer *obj) +CVAPI(ExceptionStatus) features2d_BOWKMeansTrainer_delete(cv::BOWKMeansTrainer *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::Mat*) features2d_BOWKMeansTrainer_cluster1(cv::BOWKMeansTrainer *obj) +CVAPI(ExceptionStatus) features2d_BOWKMeansTrainer_cluster1(cv::BOWKMeansTrainer *obj, cv::Mat **returnValue) { - cv::Mat m = obj->cluster(); - return new cv::Mat(m); + BEGIN_WRAP + const cv::Mat m = obj->cluster(); + *returnValue = new cv::Mat(m); + END_WRAP } -CVAPI(cv::Mat*) features2d_BOWKMeansTrainer_cluster2(cv::BOWKMeansTrainer *obj, cv::Mat *descriptors) +CVAPI(ExceptionStatus) features2d_BOWKMeansTrainer_cluster2(cv::BOWKMeansTrainer *obj, cv::Mat *descriptors, cv::Mat **returnValue) { - cv::Mat m = obj->cluster(*descriptors); - return new cv::Mat(m); + BEGIN_WRAP + const cv::Mat m = obj->cluster(*descriptors); + *returnValue = new cv::Mat(m); + END_WRAP } // BOWImgDescriptorExtractor -static void DescriptorExtractorDeleter(cv::DescriptorExtractor *p) { } -static void DescriptorMatcherDeleter(cv::DescriptorMatcher *p) { } +static void DescriptorExtractorDeleter(cv::DescriptorExtractor *) { } +static void DescriptorMatcherDeleter(cv::DescriptorMatcher *) { } -CVAPI(cv::BOWImgDescriptorExtractor*) features2d_BOWImgDescriptorExtractor_new1_Ptr( - cv::Ptr *dextractor, cv::Ptr *dmatcher) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_new1_Ptr( + cv::Ptr *dextractor, cv::Ptr *dmatcher, cv::BOWImgDescriptorExtractor **returnValue) { - return new cv::BOWImgDescriptorExtractor(*dextractor, *dmatcher); + BEGIN_WRAP + *returnValue = new cv::BOWImgDescriptorExtractor(*dextractor, *dmatcher); + END_WRAP } -CVAPI(cv::BOWImgDescriptorExtractor*) features2d_BOWImgDescriptorExtractor_new2_Ptr( - cv::Ptr *dmatcher) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_new2_Ptr( + cv::Ptr *dmatcher, cv::BOWImgDescriptorExtractor **returnValue) { - return new cv::BOWImgDescriptorExtractor(*dmatcher); + BEGIN_WRAP + *returnValue = new cv::BOWImgDescriptorExtractor(*dmatcher); + END_WRAP } -CVAPI(cv::BOWImgDescriptorExtractor*) features2d_BOWImgDescriptorExtractor_new1_RawPtr( - cv::DescriptorExtractor *dextractor, cv::DescriptorMatcher *dmatcher) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_new1_RawPtr( + cv::DescriptorExtractor *dextractor, cv::DescriptorMatcher *dmatcher, cv::BOWImgDescriptorExtractor **returnValue) { + BEGIN_WRAP // do not delete dextractor and dmatcher - cv::Ptr dextractorPtr(dextractor, DescriptorExtractorDeleter); - cv::Ptr dmatcherPtr(dmatcher, DescriptorMatcherDeleter); - return new cv::BOWImgDescriptorExtractor(dextractorPtr, dmatcherPtr); + const cv::Ptr dextractorPtr(dextractor, DescriptorExtractorDeleter); + const cv::Ptr dmatcherPtr(dmatcher, DescriptorMatcherDeleter); + *returnValue = new cv::BOWImgDescriptorExtractor(dextractorPtr, dmatcherPtr); + END_WRAP } -CVAPI(cv::BOWImgDescriptorExtractor*) features2d_BOWImgDescriptorExtractor_new2_RawPtr( - cv::DescriptorMatcher *dmatcher) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_new2_RawPtr( + cv::DescriptorMatcher *dmatcher, cv::BOWImgDescriptorExtractor **returnValue) { + BEGIN_WRAP // do not delete dmatcher - cv::Ptr dmatcherPtr(dmatcher, DescriptorMatcherDeleter); - return new cv::BOWImgDescriptorExtractor(dmatcherPtr); + const cv::Ptr dmatcherPtr(dmatcher, DescriptorMatcherDeleter); + *returnValue = new cv::BOWImgDescriptorExtractor(dmatcherPtr); + END_WRAP } -CVAPI(void) features2d_BOWImgDescriptorExtractor_delete(cv::BOWImgDescriptorExtractor *obj) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_delete(cv::BOWImgDescriptorExtractor *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) features2d_BOWImgDescriptorExtractor_setVocabulary(cv::BOWImgDescriptorExtractor *obj, cv::Mat *vocabulary) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_setVocabulary(cv::BOWImgDescriptorExtractor *obj, cv::Mat *vocabulary) { + BEGIN_WRAP obj->setVocabulary(*vocabulary); + END_WRAP } -CVAPI(cv::Mat*) features2d_BOWImgDescriptorExtractor_getVocabulary(cv::BOWImgDescriptorExtractor *obj) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_getVocabulary(cv::BOWImgDescriptorExtractor *obj, cv::Mat **returnValue) { + BEGIN_WRAP cv::Mat m = obj->getVocabulary(); - return new cv::Mat(m); + *returnValue = new cv::Mat(m); + END_WRAP } -CVAPI(void) features2d_BOWImgDescriptorExtractor_compute11( +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_compute11( cv::BOWImgDescriptorExtractor *obj, cv::_InputArray *image, std::vector *keypoints, cv::_OutputArray *imgDescriptor, - std::vector >* pointIdxsOfClusters, cv::Mat* descriptors) + std::vector >* pointIdxsOfClusters, cv::Mat* descriptors) { + BEGIN_WRAP obj->compute(*image, *keypoints, *imgDescriptor, pointIdxsOfClusters, descriptors); + END_WRAP } -CVAPI(void) features2d_BOWImgDescriptorExtractor_compute12( +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_compute12( cv::BOWImgDescriptorExtractor *obj, cv::_InputArray *keypointDescriptors, cv::_OutputArray *imgDescriptor, std::vector >* pointIdxsOfClusters) { + BEGIN_WRAP obj->compute(*keypointDescriptors, *imgDescriptor, pointIdxsOfClusters); + END_WRAP } -CVAPI(void) features2d_BOWImgDescriptorExtractor_compute2( +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_compute2( cv::BOWImgDescriptorExtractor *obj, cv::Mat *image, std::vector *keypoints, cv::Mat *imgDescriptor) { + BEGIN_WRAP obj->compute2(*image, *keypoints, *imgDescriptor); + END_WRAP } -CVAPI(int) features2d_BOWImgDescriptorExtractor_descriptorSize(cv::BOWImgDescriptorExtractor *obj) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_descriptorSize(cv::BOWImgDescriptorExtractor *obj, int *returnValue) { - return obj->descriptorSize(); + BEGIN_WRAP + *returnValue = obj->descriptorSize(); + END_WRAP } -CVAPI(int) features2d_BOWImgDescriptorExtractor_descriptorType(cv::BOWImgDescriptorExtractor *obj) +CVAPI(ExceptionStatus) features2d_BOWImgDescriptorExtractor_descriptorType(cv::BOWImgDescriptorExtractor *obj, int *returnValue) { - return obj->descriptorType(); + BEGIN_WRAP + *returnValue = obj->descriptorType(); + END_WRAP } -#endif diff --git a/src/OpenCvSharpExtern/features2d_BRISK.h b/src/OpenCvSharpExtern/features2d_BRISK.h deleted file mode 100644 index 44b0e40de..000000000 --- a/src/OpenCvSharpExtern/features2d_BRISK.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _CPP_FEATURES2D_BRISK_H_ -#define _CPP_FEATURES2D_BRISK_H_ - -#include "include_opencv.h" - - -CVAPI(cv::Ptr*) features2d_BRISK_create1(int thresh, int octaves, float patternScale) -{ - cv::Ptr ptr = cv::BRISK::create(thresh, octaves, patternScale); - return new cv::Ptr(ptr); -} -CVAPI(cv::Ptr*) features2d_BRISK_create2( - float *radiusList, int radiusListLength, int *numberList, int numberListLength, - float dMax, float dMin, - int *indexChange, int indexChangeLength) -{ - std::vector radiusListVec(radiusList, radiusList + radiusListLength); - std::vector numberListVec(numberList, numberList + numberListLength); - std::vector indexChangeVec; - if (indexChange == NULL) - indexChangeVec = std::vector(indexChange, indexChange + indexChangeLength); - else - indexChangeVec = std::vector(); - - cv::Ptr ptr = cv::BRISK::create(radiusListVec, numberListVec, dMax, dMin, indexChangeVec); - return new cv::Ptr(ptr); -} - -CVAPI(void) features2d_Ptr_BRISK_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::BRISK*) features2d_Ptr_BRISK_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - -#endif diff --git a/src/OpenCvSharpExtern/features2d_DescriptorMatcher.h b/src/OpenCvSharpExtern/features2d_DescriptorMatcher.h index 501ef1079..64f240e22 100644 --- a/src/OpenCvSharpExtern/features2d_DescriptorMatcher.h +++ b/src/OpenCvSharpExtern/features2d_DescriptorMatcher.h @@ -1,63 +1,89 @@ -#ifndef _CPP_FEATURES2D_DESCRIPTROMATCHER_H_ -#define _CPP_FEATURES2D_DESCRIPTROMATCHER_H_ +#pragma once + +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" #pragma region DescriptorMatcher -CVAPI(void) features2d_DescriptorMatcher_add(cv::DescriptorMatcher *obj, cv::Mat **descriptors, int descriptorLength) +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_add(cv::DescriptorMatcher *obj, cv::Mat **descriptors, int descriptorLength) { + BEGIN_WRAP std::vector descriptorsVec(descriptorLength); for (int i = 0; i < descriptorLength; i++) descriptorsVec[i] = *descriptors[i]; obj->add(descriptorsVec); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_getTrainDescriptors(cv::DescriptorMatcher *obj, std::vector *dst) + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_getTrainDescriptors(cv::DescriptorMatcher *obj, std::vector *dst) { + BEGIN_WRAP *dst = obj->getTrainDescriptors(); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_clear(cv::DescriptorMatcher *obj) + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_clear(cv::DescriptorMatcher *obj) { + BEGIN_WRAP obj->clear(); + END_WRAP } -CVAPI(int) features2d_DescriptorMatcher_empty(cv::DescriptorMatcher *obj) + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_empty(cv::DescriptorMatcher *obj, int *returnValue) { - return obj->empty() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP } -CVAPI(int) features2d_DescriptorMatcher_isMaskSupported(cv::DescriptorMatcher *obj) +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_isMaskSupported(cv::DescriptorMatcher *obj, int *returnValue) { - return obj->isMaskSupported() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isMaskSupported() ? 1 : 0; + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_train(cv::DescriptorMatcher *obj) +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_train(cv::DescriptorMatcher *obj) { + BEGIN_WRAP obj->train(); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_match1( +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_match1( cv::DescriptorMatcher *obj, cv::Mat *queryDescriptors, cv::Mat *trainDescriptors, std::vector *matches, cv::Mat *mask) { + BEGIN_WRAP obj->match(*queryDescriptors, *trainDescriptors, *matches, entity(mask)); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_knnMatch1( + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_knnMatch1( cv::DescriptorMatcher *obj, cv::Mat *queryDescriptors, cv::Mat *trainDescriptors, std::vector > *matches, int k, cv::Mat *mask, int compactResult) { + BEGIN_WRAP obj->knnMatch(*queryDescriptors, *trainDescriptors, *matches, k, entity(mask), compactResult != 0); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_radiusMatch1( + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_radiusMatch1( cv::DescriptorMatcher *obj, cv::Mat *queryDescriptors, cv::Mat *trainDescriptors, std::vector > *matches, float maxDistance, cv::Mat *mask, int compactResult) { + BEGIN_WRAP obj->radiusMatch(*queryDescriptors, *trainDescriptors, *matches, maxDistance, entity(mask), compactResult != 0); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_match2( +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_match2( cv::DescriptorMatcher *obj, cv::Mat *queryDescriptors, std::vector *matches, cv::Mat **masks, int masksSize) { + BEGIN_WRAP std::vector masksVal; if (masksSize != 0) { @@ -68,11 +94,14 @@ CVAPI(void) features2d_DescriptorMatcher_match2( } } obj->match(*queryDescriptors, *matches, masksVal); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_knnMatch2( + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_knnMatch2( cv::DescriptorMatcher *obj, cv::Mat *queryDescriptors, std::vector > *matches, int k, cv::Mat **masks, int masksSize, int compactResult) { + BEGIN_WRAP std::vector masksVal; if (masksSize != 0) { @@ -83,11 +112,14 @@ CVAPI(void) features2d_DescriptorMatcher_knnMatch2( } } obj->knnMatch(*queryDescriptors, *matches, k, masksVal, compactResult != 0); + END_WRAP } -CVAPI(void) features2d_DescriptorMatcher_radiusMatch2( + +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_radiusMatch2( cv::DescriptorMatcher *obj, cv::Mat *queryDescriptors, std::vector > *matches, float maxDistance, cv::Mat **masks, int masksSize, int compactResult) { + BEGIN_WRAP std::vector masksVal; if (masksSize != 0) { @@ -98,107 +130,149 @@ CVAPI(void) features2d_DescriptorMatcher_radiusMatch2( } } obj->radiusMatch(*queryDescriptors, *matches, maxDistance, masksVal, compactResult != 0); + END_WRAP } -CVAPI(cv::Ptr*) features2d_DescriptorMatcher_create(const char *descriptorMatcherType) +CVAPI(ExceptionStatus) features2d_DescriptorMatcher_create( + const char *descriptorMatcherType, cv::Ptr **returnValue) { - cv::Ptr ret = cv::DescriptorMatcher::create(descriptorMatcherType); - return new cv::Ptr(ret); + BEGIN_WRAP + const cv::Ptr ret = cv::DescriptorMatcher::create(descriptorMatcherType); + *returnValue = new cv::Ptr(ret); + END_WRAP } -CVAPI(cv::DescriptorMatcher*) features2d_Ptr_DescriptorMatcher_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) features2d_Ptr_DescriptorMatcher_get( + cv::Ptr *ptr, cv::DescriptorMatcher **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) features2d_Ptr_DescriptorMatcher_delete(cv::Ptr *ptr) +CVAPI(ExceptionStatus) features2d_Ptr_DescriptorMatcher_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } #pragma endregion #pragma region BFMatcher -CVAPI(cv::BFMatcher*) features2d_BFMatcher_new(int normType, int crossCheck) + +CVAPI(ExceptionStatus) features2d_BFMatcher_new(int normType, int crossCheck, cv::BFMatcher **returnValue) { - return new cv::BFMatcher(normType, crossCheck != 0); + BEGIN_WRAP + *returnValue = new cv::BFMatcher(normType, crossCheck != 0); + END_WRAP } -CVAPI(void) features2d_BFMatcher_delete(cv::BFMatcher *obj) + +CVAPI(ExceptionStatus) features2d_BFMatcher_delete(cv::BFMatcher *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(int) features2d_BFMatcher_isMaskSupported(cv::BFMatcher *obj) +CVAPI(ExceptionStatus) features2d_BFMatcher_isMaskSupported(cv::BFMatcher *obj, int *returnValue) { - return obj->isMaskSupported() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isMaskSupported() ? 1 : 0; + END_WRAP } -CVAPI(cv::BFMatcher*) features2d_Ptr_BFMatcher_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) features2d_Ptr_BFMatcher_get(cv::Ptr *ptr, cv::BFMatcher **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) features2d_Ptr_BFMatcher_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) features2d_Ptr_BFMatcher_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } #pragma endregion #pragma region FlannBasedMatcher -CVAPI(cv::FlannBasedMatcher*) features2d_FlannBasedMatcher_new( - cv::Ptr *indexParams, cv::Ptr *searchParams) +CVAPI(ExceptionStatus) features2d_FlannBasedMatcher_new( + cv::Ptr *indexParams, cv::Ptr *searchParams, cv::FlannBasedMatcher **returnValue) { + BEGIN_WRAP cv::Ptr indexParamsPtr; cv::Ptr searchParamsPtr; - if (indexParams == NULL) + if (indexParams == nullptr) indexParamsPtr = cv::makePtr(); else indexParamsPtr = *indexParams; - if (searchParams == NULL) + if (searchParams == nullptr) searchParamsPtr = cv::makePtr(); else searchParamsPtr = *searchParams; - return new cv::FlannBasedMatcher(indexParamsPtr, searchParamsPtr); + *returnValue = new cv::FlannBasedMatcher(indexParamsPtr, searchParamsPtr); + END_WRAP } -CVAPI(void) features2d_FlannBasedMatcher_delete(cv::FlannBasedMatcher *obj) + +CVAPI(ExceptionStatus) features2d_FlannBasedMatcher_delete(cv::FlannBasedMatcher *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) features2d_FlannBasedMatcher_add( +CVAPI(ExceptionStatus) features2d_FlannBasedMatcher_add( cv::FlannBasedMatcher *obj, cv::Mat **descriptors, int descriptorsSize) { + BEGIN_WRAP std::vector descriptorsVal(descriptorsSize); for (int i = 0; i < descriptorsSize; i++) { descriptorsVal[i] = *(descriptors[i]); } - return obj->add(descriptorsVal); + obj->add(descriptorsVal); + END_WRAP } -CVAPI(void) features2d_FlannBasedMatcher_clear(cv::FlannBasedMatcher *obj) + +CVAPI(ExceptionStatus) features2d_FlannBasedMatcher_clear(cv::FlannBasedMatcher *obj) { - return obj->clear(); + BEGIN_WRAP + obj->clear(); + END_WRAP } -CVAPI(void) features2d_FlannBasedMatcher_train(cv::FlannBasedMatcher *obj) + +CVAPI(ExceptionStatus) features2d_FlannBasedMatcher_train(cv::FlannBasedMatcher *obj) { - return obj->train(); + BEGIN_WRAP + obj->train(); + END_WRAP } -CVAPI(int) features2d_FlannBasedMatcher_isMaskSupported(cv::FlannBasedMatcher *obj) + +CVAPI(ExceptionStatus) features2d_FlannBasedMatcher_isMaskSupported(cv::FlannBasedMatcher *obj, int *returnValue) { - return obj->isMaskSupported() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isMaskSupported() ? 1 : 0; + END_WRAP } -CVAPI(cv::FlannBasedMatcher*) features2d_Ptr_FlannBasedMatcher_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) features2d_Ptr_FlannBasedMatcher_get( + cv::Ptr *ptr, cv::FlannBasedMatcher **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) features2d_Ptr_FlannBasedMatcher_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) features2d_Ptr_FlannBasedMatcher_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } #pragma endregion - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_FastFeatureDetector.h b/src/OpenCvSharpExtern/features2d_FastFeatureDetector.h deleted file mode 100644 index 53220f41f..000000000 --- a/src/OpenCvSharpExtern/features2d_FastFeatureDetector.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _CPP_FEATURES2D_FAST_H_ -#define _CPP_FEATURES2D_FAST_H_ - -#include "include_opencv.h" - -CVAPI(void) features2d_FAST1(cv::_InputArray *image, std::vector *keypoints, int threshold, int nonmaxSupression) -{ - cv::FAST(*image, *keypoints, threshold, nonmaxSupression != 0); -} - -CVAPI(void) features2d_FAST2(cv::_InputArray *image, std::vector *keypoints, int threshold, int nonmaxSupression, int type) -{ - cv::FAST(*image, *keypoints, threshold, nonmaxSupression != 0, type); -} - - -CVAPI(cv::Ptr*) features2d_FastFeatureDetector_create( - int threshold, int nonmaxSuppression) -{ - cv::Ptr ptr = cv::FastFeatureDetector::create(threshold, nonmaxSuppression != 0); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_FastFeatureDetector_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::FastFeatureDetector*) features2d_Ptr_FastFeatureDetector_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - -CVAPI(void) features2d_FastFeatureDetector_setThreshold(cv::FastFeatureDetector *obj, int threshold) -{ - obj->setThreshold(threshold); -} -CVAPI(int) features2d_FastFeatureDetector_getThreshold(cv::FastFeatureDetector *obj) -{ - return obj->getThreshold(); -} - -CVAPI(void) features2d_FastFeatureDetector_setNonmaxSuppression(cv::FastFeatureDetector *obj, int f) -{ - obj->setNonmaxSuppression(f != 0); -} -CVAPI(int) features2d_FastFeatureDetector_getNonmaxSuppression(cv::FastFeatureDetector *obj) -{ - return obj->getNonmaxSuppression() ? 1 : 0; -} - -CVAPI(void) features2d_FastFeatureDetector_setType(cv::FastFeatureDetector *obj, int type) -{ - obj->setType(type); -} -CVAPI(int) features2d_FastFeatureDetector_getType(cv::FastFeatureDetector *obj) -{ - return obj->getType(); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_Feature2D.h b/src/OpenCvSharpExtern/features2d_Feature2D.h new file mode 100644 index 000000000..f775eac82 --- /dev/null +++ b/src/OpenCvSharpExtern/features2d_Feature2D.h @@ -0,0 +1,1045 @@ +#pragma once + + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +#pragma region Feature2D + +CVAPI(ExceptionStatus) features2d_Feature2D_detect_Mat1( + cv::Feature2D *detector, + cv::Mat *image, + std::vector *keypoints, + cv::Mat *mask) +{ + BEGIN_WRAP + detector->detect(*image, *keypoints, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_detect_Mat2( + cv::Feature2D *detector, + cv::Mat **images, int imageLength, + std::vector > *keypoints, + cv::Mat **mask) +{ + BEGIN_WRAP + std::vector imageVec(imageLength); + std::vector maskVec; + + for (auto i = 0; i < imageLength; i++) + imageVec.push_back(*images[i]); + + if (mask != nullptr) + { + maskVec.reserve(imageLength); + for (auto i = 0; i < imageLength; i++) + maskVec.push_back(*mask[i]); + } + + detector->detect(imageVec, *keypoints, maskVec); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_detect_InputArray( + cv::Feature2D *obj, cv::_InputArray *image, std::vector *keypoints, cv::Mat *mask) +{ + BEGIN_WRAP + obj->detect(*image, *keypoints, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_compute1( + cv::Feature2D *obj, + cv::_InputArray *image, std::vector *keypoints, cv::_OutputArray *descriptors) +{ + BEGIN_WRAP + obj->compute(*image, *keypoints, *descriptors); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_compute2( + cv::Feature2D *detector, cv::Mat **images, int imageLength, + std::vector > *keypoints, cv::Mat **descriptors, int descriptorsLength) +{ + BEGIN_WRAP + std::vector imageVec(imageLength); + std::vector descriptorsVec(descriptorsLength); + + for (auto i = 0; i < imageLength; i++) + imageVec.push_back(*images[i]); + for (auto i = 0; i < descriptorsLength; i++) + descriptorsVec.push_back(*descriptors[i]); + + detector->compute(imageVec, *keypoints, descriptorsVec); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_detectAndCompute( + cv::Feature2D *detector, cv::_InputArray *image, cv::_InputArray *mask, + std::vector *keypoints, cv::_OutputArray *descriptors, int useProvidedKeypoints) +{ + BEGIN_WRAP + detector->detectAndCompute(entity(image), entity(mask), *keypoints, *descriptors, useProvidedKeypoints != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_descriptorSize(cv::Feature2D *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->descriptorSize(); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Feature2D_descriptorType(cv::Feature2D *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->descriptorType(); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Feature2D_defaultNorm(cv::Feature2D *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->defaultNorm(); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Feature2D_empty(cv::Feature2D *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_write(cv::Feature2D *obj, const char *fileName) +{ + BEGIN_WRAP + const cv::String fileNameString(fileName); + obj->write(fileNameString); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_read(cv::Feature2D *obj, const char *fileName) +{ + BEGIN_WRAP + obj->read(fileName); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Feature2D_getDefaultName(cv::Feature2D *obj, std::string *returnValue) +{ + BEGIN_WRAP + returnValue->assign(obj->getDefaultName()); + END_WRAP +} + +#pragma endregion + +#pragma region SIFT + +CVAPI(ExceptionStatus) features2d_SIFT_create( + int nfeatures, int nOctaveLayers, + double contrastThreshold, double edgeThreshold, double sigma, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::SIFT::create( + nfeatures, nOctaveLayers, contrastThreshold, edgeThreshold, sigma); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_SIFT_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_SIFT_get(cv::Ptr *ptr, cv::SIFT **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region BRISK + +CVAPI(ExceptionStatus) features2d_BRISK_create1( + int thresh, int octaves, float patternScale, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::BRISK::create(thresh, octaves, patternScale); + *returnValue = clone(ptr); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_BRISK_create2( + float *radiusList, int radiusListLength, + int *numberList, int numberListLength, + float dMax, float dMin, + int *indexChange, int indexChangeLength, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const std::vector radiusListVec(radiusList, radiusList + radiusListLength); + const std::vector numberListVec(numberList, numberList + numberListLength); + std::vector indexChangeVec; + if (indexChange != nullptr) + indexChangeVec = std::vector(indexChange, indexChange + indexChangeLength); + + const auto ptr = cv::BRISK::create(radiusListVec, numberListVec, dMax, dMin, indexChangeVec); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_BRISK_create3( + int thresh, int octaves, + float *radiusList, int radiusListLength, + int *numberList, int numberListLength, + float dMax, float dMin, + int *indexChange, int indexChangeLength, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const std::vector radiusListVec(radiusList, radiusList + radiusListLength); + const std::vector numberListVec(numberList, numberList + numberListLength); + std::vector indexChangeVec; + if (indexChange != nullptr) + indexChangeVec = std::vector(indexChange, indexChange + indexChangeLength); + + const auto ptr = cv::BRISK::create(thresh, octaves, radiusListVec, numberListVec, dMax, dMin, indexChangeVec); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_BRISK_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_BRISK_get(cv::Ptr *ptr, cv::BRISK **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region ORB + +CVAPI(ExceptionStatus) features2d_ORB_create( + int nFeatures, float scaleFactor, int nlevels, int edgeThreshold, + int firstLevel, int wtaK, int scoreType, int patchSize, int fastThreshold, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ORB::create( + nFeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, wtaK, static_cast(scoreType), patchSize, fastThreshold); + *returnValue = clone(ptr); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Ptr_ORB_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_ORB_get(cv::Ptr *ptr, cv::ORB **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + + +CVAPI(ExceptionStatus) features2d_ORB_setMaxFeatures(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setMaxFeatures(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getMaxFeatures(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMaxFeatures(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setScaleFactor(cv::ORB *obj, double val) +{ + BEGIN_WRAP + obj->setScaleFactor(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getScaleFactor(cv::ORB *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getScaleFactor(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setNLevels(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setNLevels(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getNLevels(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNLevels(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setEdgeThreshold(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setEdgeThreshold(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getEdgeThreshold(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getEdgeThreshold(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setFirstLevel(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setFirstLevel(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getFirstLevel(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getFirstLevel(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setWTA_K(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setWTA_K(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getWTA_K(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getWTA_K(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setScoreType(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setScoreType(static_cast(val)); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getScoreType(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(obj->getScoreType()); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setPatchSize(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setPatchSize(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getPatchSize(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getPatchSize(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_ORB_setFastThreshold(cv::ORB *obj, int val) +{ + BEGIN_WRAP + obj->setFastThreshold(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_ORB_getFastThreshold(cv::ORB *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getFastThreshold(); + END_WRAP +} + +#pragma endregion + +#pragma region MSER + +CVAPI(ExceptionStatus) features2d_MSER_create(int delta, int minArea, int maxArea, + double maxVariation, double minDiversity, int maxEvolution, + double areaThreshold, double minMargin, int edgeBlurSize, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::MSER::create(delta, minArea, maxArea, maxVariation, minDiversity, maxEvolution, + areaThreshold, minMargin, edgeBlurSize); + *returnValue = clone(ptr); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Ptr_MSER_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_MSER_detectRegions( + cv::MSER *obj, + cv::_InputArray *image, + std::vector > *msers, + std::vector *bboxes) +{ + BEGIN_WRAP + obj->detectRegions(*image, *msers, *bboxes); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_MSER_get(cv::Ptr *ptr, cv::MSER **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_MSER_setDelta(cv::MSER *obj, int delta) +{ + BEGIN_WRAP + obj->setDelta(delta); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_MSER_getDelta(cv::MSER *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getDelta(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_MSER_setMinArea(cv::MSER *obj, int minArea) +{ + BEGIN_WRAP + obj->setMinArea(minArea); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_MSER_getMinArea(cv::MSER *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMinArea(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_MSER_setMaxArea(cv::MSER *obj, int maxArea) +{ + BEGIN_WRAP + obj->setMaxArea(maxArea); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_MSER_getMaxArea(cv::MSER *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMaxArea(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_MSER_setPass2Only(cv::MSER *obj, int f) +{ + BEGIN_WRAP + obj->setPass2Only(f != 0); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_MSER_getPass2Only(cv::MSER *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getPass2Only() ? 1 : 0; + END_WRAP +} + +#pragma endregion + +#pragma region FastFeatureDetector + +CVAPI(ExceptionStatus) features2d_FAST1(cv::_InputArray *image, std::vector *keypoints, int threshold, int nonmaxSupression) +{ + BEGIN_WRAP + cv::FAST(*image, *keypoints, threshold, nonmaxSupression != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_FAST2(cv::_InputArray *image, std::vector *keypoints, int threshold, int nonmaxSupression, int type) +{ + BEGIN_WRAP + cv::FAST(*image, *keypoints, threshold, nonmaxSupression != 0, static_cast(type)); + END_WRAP +} + + +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_create( + int threshold, int nonmaxSuppression, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::FastFeatureDetector::create(threshold, nonmaxSuppression != 0); + *returnValue = clone(ptr); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Ptr_FastFeatureDetector_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_FastFeatureDetector_get(cv::Ptr *ptr, cv::FastFeatureDetector **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_setThreshold(cv::FastFeatureDetector *obj, int threshold) +{ + BEGIN_WRAP + obj->setThreshold(threshold); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_getThreshold(cv::FastFeatureDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_setNonmaxSuppression(cv::FastFeatureDetector *obj, int f) +{ + BEGIN_WRAP + obj->setNonmaxSuppression(f != 0); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_getNonmaxSuppression(cv::FastFeatureDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNonmaxSuppression() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_setType(cv::FastFeatureDetector *obj, int type) +{ + BEGIN_WRAP + obj->setType(static_cast(type)); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_FastFeatureDetector_getType(cv::FastFeatureDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(obj->getType()); + END_WRAP +} + +#pragma endregion + +#pragma region + +CVAPI(ExceptionStatus) features2d_AGAST( + cv::_InputArray *image, std::vector *keypoints, + int threshold, int nonmaxSuppression, int type) +{ + BEGIN_WRAP + cv::AGAST( + entity(image), + *keypoints, + threshold, + nonmaxSuppression != 0, + static_cast(type)); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_create( + int threshold, int nonmaxSuppression, int type, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::AgastFeatureDetector::create( + threshold, nonmaxSuppression != 0, static_cast(type)); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_AgastFeatureDetector_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_AgastFeatureDetector_get(cv::Ptr *ptr, cv::AgastFeatureDetector **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_setThreshold(cv::AgastFeatureDetector *obj, int val) +{ + BEGIN_WRAP + obj->setThreshold(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_getThreshold(cv::AgastFeatureDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_setNonmaxSuppression(cv::AgastFeatureDetector *obj, int val) +{ + BEGIN_WRAP + obj->setNonmaxSuppression(val != 0); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_getNonmaxSuppression(cv::AgastFeatureDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNonmaxSuppression() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_setType(cv::AgastFeatureDetector *obj, int val) +{ + BEGIN_WRAP + obj->setType(static_cast(val)); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AgastFeatureDetector_getType(cv::AgastFeatureDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(obj->getType()); + END_WRAP +} + +#pragma endregion + +#pragma region GFTTDetector + +CVAPI(ExceptionStatus) features2d_GFTTDetector_create( + int maxCorners, double qualityLevel, double minDistance, + int blockSize, int useHarrisDetector, double k, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::GFTTDetector::create( + maxCorners, qualityLevel, minDistance, + blockSize, useHarrisDetector != 0, k); + *returnValue = clone(ptr); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Ptr_GFTTDetector_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_GFTTDetector_get(cv::Ptr *ptr, cv::GFTTDetector **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_GFTTDetector_setMaxFeatures(cv::GFTTDetector *obj, int maxFeatures) +{ + BEGIN_WRAP + obj->setMaxFeatures(maxFeatures); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_GFTTDetector_getMaxFeatures(cv::GFTTDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMaxFeatures(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_GFTTDetector_setQualityLevel(cv::GFTTDetector *obj, double qlevel) +{ + BEGIN_WRAP + obj->setQualityLevel(qlevel); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_GFTTDetector_getQualityLevel(cv::GFTTDetector *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getQualityLevel(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_GFTTDetector_setMinDistance(cv::GFTTDetector *obj, double minDistance) +{ + BEGIN_WRAP + obj->setMinDistance(minDistance); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_GFTTDetector_getMinDistance(cv::GFTTDetector *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMinDistance(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_GFTTDetector_setBlockSize(cv::GFTTDetector *obj, int blockSize) +{ + BEGIN_WRAP + obj->setBlockSize(blockSize); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_GFTTDetector_getBlockSize(cv::GFTTDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getBlockSize(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_GFTTDetector_setHarrisDetector(cv::GFTTDetector *obj, int val) +{ + BEGIN_WRAP + obj->setHarrisDetector(val != 0); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_GFTTDetector_getHarrisDetector(cv::GFTTDetector *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getHarrisDetector() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_GFTTDetector_setK(cv::GFTTDetector *obj, double k) +{ + BEGIN_WRAP + obj->setK(k); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_GFTTDetector_getK(cv::GFTTDetector *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getK(); + END_WRAP +} + +#pragma endregion + +#pragma region SimbpleBlobDetector + +struct SimpleBlobDetector_Params +{ + float thresholdStep; + float minThreshold; + float maxThreshold; + uint32_t minRepeatability; // size_t + float minDistBetweenBlobs; + + int filterByColor; + uchar blobColor; + + int filterByArea; + float minArea, maxArea; + + int filterByCircularity; + float minCircularity, maxCircularity; + + int filterByInertia; + float minInertiaRatio, maxInertiaRatio; + + int filterByConvexity; + float minConvexity, maxConvexity; +}; + +CVAPI(ExceptionStatus) features2d_SimpleBlobDetector_create( + SimpleBlobDetector_Params *p, cv::Ptr **returnValue) +{ + BEGIN_WRAP + cv::SimpleBlobDetector::Params p2; + if (p != nullptr) + { + p2.thresholdStep = p->thresholdStep; + p2.minThreshold = p->minThreshold; + p2.maxThreshold = p->maxThreshold; + p2.minRepeatability = static_cast(p->minRepeatability); + p2.minDistBetweenBlobs = p->minDistBetweenBlobs; + p2.filterByColor = p->filterByColor != 0; + p2.blobColor = p->blobColor; + p2.filterByArea = p->filterByArea != 0; + p2.minArea = p->minArea; + p2.maxArea = p->maxArea; + p2.filterByCircularity = p->filterByCircularity != 0; + p2.minCircularity = p->minCircularity; + p2.maxCircularity = p->maxCircularity; + p2.filterByInertia = p->filterByInertia != 0; + p2.minInertiaRatio = p->minInertiaRatio; + p2.maxInertiaRatio = p->maxInertiaRatio; + p2.filterByConvexity = p->filterByConvexity != 0; + p2.minConvexity = p->minConvexity; + p2.maxConvexity = p->maxConvexity; + } + const auto ptr = cv::SimpleBlobDetector::create(p2); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_SimpleBlobDetector_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_SimpleBlobDetector_get( + cv::Ptr *ptr, cv::SimpleBlobDetector **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region KAZE + +CVAPI(ExceptionStatus) features2d_KAZE_create( + int extended, int upright, float threshold, + int nOctaves, int nOctaveLayers, int diffusivity, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::KAZE::create( + extended != 0, upright != 0, threshold, + nOctaves, nOctaveLayers, static_cast(diffusivity)); + *returnValue = clone(ptr); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_Ptr_KAZE_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_KAZE_get(cv::Ptr *ptr, cv::KAZE **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KAZE_setDiffusivity(cv::KAZE *obj, int val) +{ + BEGIN_WRAP + obj->setDiffusivity(static_cast(val)); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_KAZE_getDiffusivity(cv::KAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(obj->getDiffusivity()); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KAZE_setExtended(cv::KAZE *obj, int val) +{ + BEGIN_WRAP + obj->setExtended(val != 0); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_KAZE_getExtended(cv::KAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getExtended() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KAZE_setNOctaveLayers(cv::KAZE *obj, int val) +{ + BEGIN_WRAP + obj->setNOctaveLayers(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_KAZE_getNOctaveLayers(cv::KAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNOctaveLayers(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KAZE_setNOctaves(cv::KAZE *obj, int val) +{ + BEGIN_WRAP + obj->setNOctaves(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_KAZE_getNOctaves(cv::KAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNOctaves(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KAZE_setThreshold(cv::KAZE *obj, double val) +{ + BEGIN_WRAP + obj->setThreshold(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_KAZE_getThreshold(cv::KAZE *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_KAZE_setUpright(cv::KAZE *obj, int val) +{ + BEGIN_WRAP + obj->setUpright(val != 0); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_KAZE_getUpright(cv::KAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getUpright() ? 1 : 0; + END_WRAP +} + +#pragma endregion + +#pragma region AKAZE + +CVAPI(ExceptionStatus) features2d_AKAZE_create( + int descriptor_type, int descriptor_size, int descriptor_channels, + float threshold, int nOctaves, int nOctaveLayers, int diffusivity, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::AKAZE::create( + static_cast(descriptor_type), descriptor_size, descriptor_channels, + threshold, nOctaves, nOctaveLayers, static_cast(diffusivity)); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_AKAZE_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_Ptr_AKAZE_get(cv::Ptr *ptr, cv::AKAZE **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setDescriptorType(cv::AKAZE *obj, int val) +{ + BEGIN_WRAP + obj->setDescriptorType(static_cast(val)); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getDescriptorType(cv::AKAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(obj->getDescriptorType()); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setDescriptorSize(cv::AKAZE *obj, int val) +{ + BEGIN_WRAP + obj->setDescriptorSize(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getDescriptorSize(cv::AKAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getDescriptorSize(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setDescriptorChannels(cv::AKAZE *obj, int val) +{ + BEGIN_WRAP + obj->setDescriptorChannels(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getDescriptorChannels(cv::AKAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getDescriptorChannels(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setThreshold(cv::AKAZE *obj, double val) +{ + BEGIN_WRAP + obj->setThreshold(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getThreshold(cv::AKAZE *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setNOctaves(cv::AKAZE *obj, int val) +{ + BEGIN_WRAP + obj->setNOctaves(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getNOctaves(cv::AKAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNOctaves(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setNOctaveLayers(cv::AKAZE *obj, int val) +{ + BEGIN_WRAP + obj->setNOctaveLayers(val); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getNOctaveLayers(cv::AKAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNOctaveLayers(); + END_WRAP +} + +CVAPI(ExceptionStatus) features2d_AKAZE_setDiffusivity(cv::AKAZE *obj, int val) +{ + BEGIN_WRAP + obj->setDiffusivity(static_cast(val)); + END_WRAP +} +CVAPI(ExceptionStatus) features2d_AKAZE_getDiffusivity(cv::AKAZE *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = static_cast(obj->getDiffusivity()); + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/features2d_FeatureDetector.h b/src/OpenCvSharpExtern/features2d_FeatureDetector.h deleted file mode 100644 index 008055388..000000000 --- a/src/OpenCvSharpExtern/features2d_FeatureDetector.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef _CPP_FEATURES2DFEATUREDETECTOR_H_ -#define _CPP_FEATURES2DFEATUREDETECTOR_H_ - -#include "include_opencv.h" - -#pragma region Feature2D - -CVAPI(cv::Feature2D*) features2d_Ptr_Feature2D_get(cv::Ptr* ptr) -{ - return ptr->get(); -} -CVAPI(void) features2d_Ptr_Feature2D_delete(cv::Ptr* ptr) -{ - delete ptr; -} - -CVAPI(void) features2d_Feature2D_detect_Mat1( - cv::Feature2D *detector, cv::Mat *image, std::vector *keypoints, - cv::Mat *mask) -{ - detector->detect(*image, *keypoints, entity(mask)); -} - -CVAPI(void) features2d_Feature2D_detect_Mat2( - cv::Feature2D *detector, cv::Mat **images, int imageLength, - std::vector > *keypoints, cv::Mat **mask) -{ - std::vector imageVec(imageLength); - std::vector maskVec; - - for (int i = 0; i < imageLength; i++) - imageVec.push_back(*images[i]); - - if (mask != NULL) - { - maskVec.reserve(imageLength); - for (int i = 0; i < imageLength; i++) - maskVec.push_back(*mask[i]); - } - - detector->detect(imageVec, *keypoints, maskVec); -} - -CVAPI(void) features2d_Feature2D_detect_InputArray( - cv::Feature2D *obj, cv::_InputArray *image, std::vector *keypoints, cv::Mat *mask) -{ - obj->detect(*image, *keypoints, entity(mask)); -} - -CVAPI(void) features2d_Feature2D_compute1(cv::Feature2D *obj, - cv::_InputArray *image, std::vector *keypoints, cv::_OutputArray *descriptors) -{ - obj->compute(*image, *keypoints, *descriptors); -} - -CVAPI(void) features2d_Feature2D_compute2( - cv::Feature2D *detector, cv::Mat **images, int imageLength, - std::vector > *keypoints, cv::Mat **descriptors, int descriptorsLength) -{ - std::vector imageVec(imageLength); - std::vector descriptorsVec(descriptorsLength); - - for (int i = 0; i < imageLength; i++) - imageVec.push_back(*images[i]); - for (int i = 0; i < descriptorsLength; i++) - descriptorsVec.push_back(*descriptors[i]); - - detector->compute(imageVec, *keypoints, descriptorsVec); -} - -CVAPI(void) features2d_Feature2D_detectAndCompute( - cv::Feature2D *detector, cv::_InputArray *image, cv::_InputArray *mask, - std::vector *keypoints, cv::_OutputArray *descriptors, int useProvidedKeypoints) -{ - detector->detectAndCompute(entity(image), entity(mask), *keypoints, *descriptors, useProvidedKeypoints != 0); -} - -CVAPI(int) features2d_Feature2D_descriptorSize(cv::Ptr *obj) -{ - return obj->get()->descriptorSize(); -} -CVAPI(int) features2d_Feature2D_descriptorType(cv::Ptr *obj) -{ - return obj->get()->descriptorType(); -} -CVAPI(int) features2d_Feature2D_defaultNorm(cv::Ptr *obj) -{ - return obj->get()->defaultNorm(); -} -CVAPI(int) features2d_Feature2D_empty(cv::Ptr *obj) -{ - return obj->get()->empty() ? 1 : 0; -} - -#pragma endregion - -/* -#pragma region DenseFeatureDetector - -CVAPI(cv::DenseFeatureDetector*) features2d_DenseFeatureDetector_new( - float initFeatureScale, int featureScaleLevels, float featureScaleMul, - int initXyStep, int initImgBound, int varyXyStepWithScale, int varyImgBoundWithScale) -{ - return new cv::DenseFeatureDetector(initFeatureScale, featureScaleLevels, - featureScaleMul, initXyStep, initImgBound, varyXyStepWithScale != 0, varyImgBoundWithScale != 0); -} -CVAPI(void) features2d_DenseFeatureDetector_delete(cv::DenseFeatureDetector *obj) -{ - delete obj; -} - -CVAPI(cv::DenseFeatureDetector*) features2d_Ptr_DenseFeatureDetector_get(cv::Ptr *ptr) -{ - return ptr->get(); -} -CVAPI(void) features2d_Ptr_DenseFeatureDetector_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -#pragma endregion -*/ -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_GFTTDetector.h b/src/OpenCvSharpExtern/features2d_GFTTDetector.h deleted file mode 100644 index 6b984f8b1..000000000 --- a/src/OpenCvSharpExtern/features2d_GFTTDetector.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _CPP_FEATURES2D_GFTT_H_ -#define _CPP_FEATURES2D_GFTT_H_ - -#include "include_opencv.h" - - -CVAPI(cv::Ptr*) features2d_GFTTDetector_create( - int maxCorners, double qualityLevel, double minDistance, - int blockSize, int useHarrisDetector, double k) -{ - cv::Ptr ptr = cv::GFTTDetector::create( - maxCorners, qualityLevel, minDistance, - blockSize, useHarrisDetector != 0, k); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_GFTTDetector_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::GFTTDetector*) features2d_Ptr_GFTTDetector_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - -CVAPI(void) features2d_GFTTDetector_setMaxFeatures(cv::GFTTDetector *obj, int maxFeatures) -{ - obj->setMaxFeatures(maxFeatures); -} -CVAPI(int) features2d_GFTTDetector_getMaxFeatures(cv::GFTTDetector *obj) -{ - return obj->getMaxFeatures(); -} - -CVAPI(void) features2d_GFTTDetector_setQualityLevel(cv::GFTTDetector *obj, double qlevel) -{ - obj->setQualityLevel(qlevel); -} -CVAPI(double) features2d_GFTTDetector_getQualityLevel(cv::GFTTDetector *obj) -{ - return obj->getQualityLevel(); -} - -CVAPI(void) features2d_GFTTDetector_setMinDistance(cv::GFTTDetector *obj, double minDistance) -{ - obj->setMinDistance(minDistance); -} -CVAPI(double) features2d_GFTTDetector_getMinDistance(cv::GFTTDetector *obj) -{ - return obj->getMinDistance(); -} - -CVAPI(void) features2d_GFTTDetector_setBlockSize(cv::GFTTDetector *obj, int blockSize) -{ - obj->setBlockSize(blockSize); -} -CVAPI(int) features2d_GFTTDetector_getBlockSize(cv::GFTTDetector *obj) -{ - return obj->getBlockSize(); -} - -CVAPI(void) features2d_GFTTDetector_setHarrisDetector(cv::GFTTDetector *obj, int val) -{ - obj->setHarrisDetector(val != 0); -} -CVAPI(int) features2d_GFTTDetector_getHarrisDetector(cv::GFTTDetector *obj) -{ - return obj->getHarrisDetector() ? 1 : 0; -} - -CVAPI(void) features2d_GFTTDetector_setK(cv::GFTTDetector *obj, double k) -{ - obj->setK(k); -} -CVAPI(double) features2d_GFTTDetector_getK(cv::GFTTDetector *obj) -{ - return obj->getK(); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_KAZE.h b/src/OpenCvSharpExtern/features2d_KAZE.h deleted file mode 100644 index 1b376bb9b..000000000 --- a/src/OpenCvSharpExtern/features2d_KAZE.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef _CPP_FEATURES2D_KAZE_H_ -#define _CPP_FEATURES2D_KAZE_H_ - -#include "include_opencv.h" - - -CVAPI(cv::Ptr*) features2d_KAZE_create( - bool extended, bool upright, float threshold, - int nOctaves, int nOctaveLayers, int diffusivity) -{ - cv::Ptr ptr = cv::KAZE::create( - extended, upright, threshold, - nOctaves, nOctaveLayers, diffusivity); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_KAZE_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::KAZE*) features2d_Ptr_KAZE_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - - -CVAPI(void) features2d_KAZE_setDiffusivity(cv::KAZE *obj, int val) -{ - obj->setDiffusivity(val); -} -CVAPI(int) features2d_KAZE_getDiffusivity(cv::KAZE *obj) -{ - return obj->getDiffusivity(); -} - -CVAPI(void) features2d_KAZE_setExtended(cv::KAZE *obj, bool val) -{ - obj->setExtended(val); -} -CVAPI(bool) features2d_KAZE_getExtended(cv::KAZE *obj) -{ - return obj->getExtended(); -} - -CVAPI(void) features2d_KAZE_setNOctaveLayers(cv::KAZE *obj, int val) -{ - obj->setNOctaveLayers(val); -} -CVAPI(int) features2d_KAZE_getNOctaveLayers(cv::KAZE *obj) -{ - return obj->getNOctaveLayers(); -} - -CVAPI(void) features2d_KAZE_setNOctaves(cv::KAZE *obj, int val) -{ - obj->setNOctaves(val); -} -CVAPI(int) features2d_KAZE_getNOctaves(cv::KAZE *obj) -{ - return obj->getNOctaves(); -} - -CVAPI(void) features2d_KAZE_setThreshold(cv::KAZE *obj, double val) -{ - obj->setThreshold(val); -} -CVAPI(double) features2d_KAZE_getThreshold(cv::KAZE *obj) -{ - return obj->getThreshold(); -} - -CVAPI(void) features2d_KAZE_setUpright(cv::KAZE *obj, bool val) -{ - obj->setUpright(val); -} -CVAPI(bool) features2d_KAZE_getUpright(cv::KAZE *obj) -{ - return obj->getUpright(); -} - -#endif diff --git a/src/OpenCvSharpExtern/features2d_KeyPointsFilter.h b/src/OpenCvSharpExtern/features2d_KeyPointsFilter.h deleted file mode 100644 index 86523a0b3..000000000 --- a/src/OpenCvSharpExtern/features2d_KeyPointsFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _CPP_FEATURES2D_KEY_POINTS_FILTER_H_ -#define _CPP_FEATURES2D_KEY_POINTS_FILTER_H_ - -#include "include_opencv.h" - - -CVAPI(void) features2d_KeyPointsFilter_runByImageBorder( - std::vector *keypoints, MyCvSize imageSize, int borderSize) -{ - cv::KeyPointsFilter::runByImageBorder(*keypoints, cpp(imageSize), borderSize); -} - -CVAPI(void) features2d_KeyPointsFilter_runByKeypointSize( - std::vector *keypoints, float minSize, float maxSize) -{ - cv::KeyPointsFilter::runByKeypointSize(*keypoints, minSize, maxSize); -} -CVAPI(void) features2d_KeyPointsFilter_runByPixelsMask( - std::vector *keypoints, cv::Mat *mask) -{ - cv::KeyPointsFilter::runByPixelsMask(*keypoints, *mask); -} - -CVAPI(void) features2d_KeyPointsFilter_removeDuplicated( - std::vector *keypoints) -{ - cv::KeyPointsFilter::removeDuplicated(*keypoints); -} - -CVAPI(void) features2d_KeyPointsFilter_retainBest( - std::vector *keypoints, int npoints) -{ - cv::KeyPointsFilter::retainBest(*keypoints, npoints); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_MSER.h b/src/OpenCvSharpExtern/features2d_MSER.h deleted file mode 100644 index 006742168..000000000 --- a/src/OpenCvSharpExtern/features2d_MSER.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _CPP_FEATURES2D_MSER_H_ -#define _CPP_FEATURES2D_MSER_H_ - -#include "include_opencv.h" - - -CVAPI(cv::Ptr*) features2d_MSER_create(int delta, int minArea, int maxArea, - double maxVariation, double minDiversity, int maxEvolution, - double areaThreshold, double minMargin, int edgeBlurSize) -{ - cv::Ptr ptr = cv::MSER::create(delta, minArea, maxArea, maxVariation, minDiversity, maxEvolution, - areaThreshold, minMargin, edgeBlurSize); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_MSER_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(void) features2d_MSER_detectRegions( - cv::MSER *obj, cv::_InputArray *image, - std::vector > *msers, - std::vector *bboxes) -{ - obj->detectRegions(*image, *msers, *bboxes); -} - -CVAPI(cv::MSER*) features2d_Ptr_MSER_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - -CVAPI(void) features2d_MSER_setDelta(cv::MSER *obj, int delta) -{ - obj->setDelta(delta); -} -CVAPI(int) features2d_MSER_getDelta(cv::MSER *obj) -{ - return obj->getDelta(); -} - -CVAPI(void) features2d_MSER_setMinArea(cv::MSER *obj, int minArea) -{ - obj->setMinArea(minArea); -} -CVAPI(int) features2d_MSER_getMinArea(cv::MSER *obj) -{ - return obj->getMinArea(); -} - -CVAPI(void) features2d_MSER_setMaxArea(cv::MSER *obj, int maxArea) -{ - obj->setMaxArea(maxArea); -} -CVAPI(int) features2d_MSER_getMaxArea(cv::MSER *obj) -{ - return obj->getMaxArea(); -} - -CVAPI(void) features2d_MSER_setPass2Only(cv::MSER *obj, int f) -{ - obj->setPass2Only(f != 0); -} -CVAPI(int) features2d_MSER_getPass2Only(cv::MSER *obj) -{ - return obj->getPass2Only() ? 1 : 0; -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_ORB.h b/src/OpenCvSharpExtern/features2d_ORB.h deleted file mode 100644 index ba70b2312..000000000 --- a/src/OpenCvSharpExtern/features2d_ORB.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef _CPP_FEATURES2D_ORB_H_ -#define _CPP_FEATURES2D_ORB_H_ - -#include "include_opencv.h" - - -CVAPI(cv::Ptr*) features2d_ORB_create( - int nFeatures, float scaleFactor, int nlevels, int edgeThreshold, - int firstLevel, int wtaK, int scoreType, int patchSize) -{ - cv::Ptr ptr = cv::ORB::create( - nFeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, wtaK, scoreType, patchSize); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_ORB_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::ORB*) features2d_Ptr_ORB_get(cv::Ptr *ptr) -{ - return ptr->get(); -} - - -CVAPI(void) features2d_ORB_setMaxFeatures(cv::ORB *obj, int val) -{ - obj->setMaxFeatures(val); -} -CVAPI(int) features2d_ORB_getMaxFeatures(cv::ORB *obj) -{ - return obj->getMaxFeatures(); -} - -CVAPI(void) features2d_ORB_setScaleFactor(cv::ORB *obj, double val) -{ - obj->setScaleFactor(val); -} -CVAPI(double) features2d_ORB_getScaleFactor(cv::ORB *obj) -{ - return obj->getScaleFactor(); -} - -CVAPI(void) features2d_ORB_setNLevels(cv::ORB *obj, int val) -{ - obj->setNLevels(val); -} -CVAPI(int) features2d_ORB_getNLevels(cv::ORB *obj) -{ - return obj->getNLevels(); -} - -CVAPI(void) features2d_ORB_setEdgeThreshold(cv::ORB *obj, int val) -{ - obj->setEdgeThreshold(val); -} -CVAPI(int) features2d_ORB_getEdgeThreshold(cv::ORB *obj) -{ - return obj->getEdgeThreshold(); -} - -CVAPI(void) features2d_ORB_setFirstLevel(cv::ORB *obj, int val) -{ - obj->setFirstLevel(val); -} -CVAPI(int) features2d_ORB_getFirstLevel(cv::ORB *obj) -{ - return obj->getFirstLevel(); -} - -CVAPI(void) features2d_ORB_setWTA_K(cv::ORB *obj, int val) -{ - obj->setWTA_K(val); -} -CVAPI(int) features2d_ORB_getWTA_K(cv::ORB *obj) -{ - return obj->getWTA_K(); -} - -CVAPI(void) features2d_ORB_setScoreType(cv::ORB *obj, int val) -{ - obj->setScoreType(val); -} -CVAPI(int) features2d_ORB_getScoreType(cv::ORB *obj) -{ - return obj->getScoreType(); -} - -CVAPI(void) features2d_ORB_setPatchSize(cv::ORB *obj, int val) -{ - obj->setPatchSize(val); -} -CVAPI(int) features2d_ORB_getPatchSize(cv::ORB *obj) -{ - return obj->getPatchSize(); -} - -CVAPI(void) features2d_ORB_setFastThreshold(cv::ORB *obj, int val) -{ - obj->setFastThreshold(val); -} -CVAPI(int) features2d_ORB_getFastThreshold(cv::ORB *obj) -{ - return obj->getFastThreshold(); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/features2d_SimpleBlobDetector.h b/src/OpenCvSharpExtern/features2d_SimpleBlobDetector.h deleted file mode 100644 index ab67221dc..000000000 --- a/src/OpenCvSharpExtern/features2d_SimpleBlobDetector.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _CPP_FEATURES2D_SIMPLEBLOBDETECTOR_H_ -#define _CPP_FEATURES2D_SIMPLEBLOBDETECTOR_H_ - -#include "include_opencv.h" - - -struct SimpleBlobDetector_Params -{ - float thresholdStep; - float minThreshold; - float maxThreshold; - uint32 minRepeatability; // size_t - float minDistBetweenBlobs; - - int filterByColor; - uchar blobColor; - - int filterByArea; - float minArea, maxArea; - - int filterByCircularity; - float minCircularity, maxCircularity; - - int filterByInertia; - float minInertiaRatio, maxInertiaRatio; - - int filterByConvexity; - float minConvexity, maxConvexity; -}; - -CVAPI(cv::Ptr*) features2d_SimpleBlobDetector_create( - SimpleBlobDetector_Params *p) -{ - cv::SimpleBlobDetector::Params p2; - if (p != NULL) - { - p2.thresholdStep = p->thresholdStep; - p2.minThreshold = p->minThreshold; - p2.maxThreshold = p->maxThreshold; - p2.minRepeatability = (size_t)p->minRepeatability; - p2.minDistBetweenBlobs = p->minDistBetweenBlobs; - p2.filterByColor = p->filterByColor != 0; - p2.blobColor = p->blobColor; - p2.filterByArea = p->filterByArea != 0; - p2.minArea = p->minArea; - p2.maxArea = p->maxArea; - p2.filterByCircularity = p->filterByCircularity != 0; - p2.minCircularity = p->minCircularity; - p2.maxCircularity = p->maxCircularity; - p2.filterByInertia = p->filterByInertia != 0; - p2.minInertiaRatio = p->minInertiaRatio; - p2.maxInertiaRatio = p->maxInertiaRatio; - p2.filterByConvexity = p->filterByConvexity != 0; - p2.minConvexity = p->minConvexity; - p2.maxConvexity = p->maxConvexity; - } - cv::Ptr ptr = cv::SimpleBlobDetector::create(p2); - return new cv::Ptr(ptr); -} -CVAPI(void) features2d_Ptr_SimpleBlobDetector_delete(cv::Ptr *ptr) -{ - delete ptr; -} - -CVAPI(cv::SimpleBlobDetector*) features2d_Ptr_SimpleBlobDetector_get(cv::Ptr *ptr) -{ - return ptr->get(); -} -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/flann.cpp b/src/OpenCvSharpExtern/flann.cpp index 8a09761a5..6375ca094 100644 --- a/src/OpenCvSharpExtern/flann.cpp +++ b/src/OpenCvSharpExtern/flann.cpp @@ -1,2 +1,3 @@ +// ReSharper disable CppUnusedIncludeDirective #include "flann.h" #include "flann_IndexParams.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/flann.h b/src/OpenCvSharpExtern/flann.h index 3897fc3a3..8d1334b28 100644 --- a/src/OpenCvSharpExtern/flann.h +++ b/src/OpenCvSharpExtern/flann.h @@ -1,84 +1,87 @@ -#ifndef _CPP_FLANN_H_ -#define _CPP_FLANN_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" // cv::flann::Index -CVAPI(cv::flann::Index*) flann_Index_new( - cv::_InputArray *features, cv::flann::IndexParams* params, cvflann::flann_distance_t distType) +CVAPI(ExceptionStatus) flann_Index_new( + cv::_InputArray *features, cv::flann::IndexParams* params, cvflann::flann_distance_t distType, cv::flann::Index **returnValue) { - return new cv::flann::Index(*features, *params, distType); + BEGIN_WRAP + *returnValue = new cv::flann::Index(*features, *params, distType); + END_WRAP } -CVAPI(void) flann_Index_delete(cv::flann::Index* obj) + +CVAPI(ExceptionStatus) flann_Index_delete(cv::flann::Index* obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) flann_Index_knnSearch1(cv::flann::Index* obj, float* queries, int queries_length, int* indices, float* dists, int knn, cv::flann::SearchParams* params) + +CVAPI(ExceptionStatus) flann_Index_knnSearch1(cv::flann::Index* obj, float* queries, int queries_length, int* indices, float* dists, int knn, cv::flann::SearchParams* params) { - std::vector queries_vec(queries_length); + BEGIN_WRAP + const std::vector queries_vec(queries, queries + queries_length); std::vector indices_vec(knn); std::vector dists_vec(knn); - memcpy(&queries_vec[0], queries, sizeof(float) * queries_length); obj->knnSearch(queries_vec, indices_vec, dists_vec, knn, *params); memcpy(indices, &indices_vec[0], sizeof(int) * knn); memcpy(dists, &dists_vec[0], sizeof(float) * knn); + END_WRAP } -CVAPI(void) flann_Index_knnSearch2(cv::flann::Index* obj, cv::Mat* queries, cv::Mat* indices, cv::Mat* dists, int knn, cv::flann::SearchParams* params) +CVAPI(ExceptionStatus) flann_Index_knnSearch2(cv::flann::Index* obj, cv::Mat* queries, cv::Mat* indices, cv::Mat* dists, int knn, cv::flann::SearchParams* params) { + BEGIN_WRAP obj->knnSearch(*queries, *indices, *dists, knn, *params); + END_WRAP } -CVAPI(void) flann_Index_knnSearch3(cv::flann::Index* obj, cv::Mat* queries, int* indices, float* dists, int knn, cv::flann::SearchParams* params) +CVAPI(ExceptionStatus) flann_Index_knnSearch3(cv::flann::Index* obj, cv::Mat* queries, int* indices, float* dists, int knn, cv::flann::SearchParams* params) { + BEGIN_WRAP cv::Mat indices_mat(1, knn, CV_32SC1); cv::Mat dists_mat(1, knn, CV_32FC1); obj->knnSearch(*queries, indices_mat, dists_mat, knn, *params); memcpy(indices, indices_mat.ptr(0), sizeof(int) * knn); memcpy(dists, dists_mat.ptr(0), sizeof(float) * knn); + END_WRAP } -CVAPI(void) flann_Index_radiusSearch1(cv::flann::Index* obj, float* queries, int queries_length, int* indices, int indices_length, float* dists, int dists_length, float radius, int maxResults, cv::flann::SearchParams* params) + +CVAPI(ExceptionStatus) flann_Index_radiusSearch1(cv::flann::Index* obj, float* queries, int queries_length, int* indices, int indices_length, float* dists, int dists_length, double radius, int maxResults, cv::flann::SearchParams* params) { - std::vector queries_vec(queries_length); + BEGIN_WRAP + const std::vector queries_vec(queries, queries + queries_length); std::vector indices_vec(indices_length); std::vector dists_vec(dists_length); - memcpy(&queries_vec[0], queries, sizeof(float) * queries_length); obj->radiusSearch(queries_vec, indices_vec, dists_vec, radius, maxResults, *params); memcpy(indices, &indices_vec[0], sizeof(int) * indices_length); memcpy(dists, &dists_vec[0], sizeof(float) * dists_length); + END_WRAP } -CVAPI(void) flann_Index_radiusSearch2(cv::flann::Index* obj, cv::Mat* queries, cv::Mat* indices, cv::Mat* dists, float radius, int maxResults, cv::flann::SearchParams* params) +CVAPI(ExceptionStatus) flann_Index_radiusSearch2(cv::flann::Index* obj, cv::Mat* queries, cv::Mat* indices, cv::Mat* dists, double radius, int maxResults, cv::flann::SearchParams* params) { + BEGIN_WRAP obj->radiusSearch(*queries, *indices, *dists, radius, maxResults, *params); + END_WRAP } -CVAPI(void) flann_Index_radiusSearch3(cv::flann::Index* obj, cv::Mat* queries, int* indices, int indices_length, float* dists, int dists_length, float radius, int maxResults, cv::flann::SearchParams* params) +CVAPI(ExceptionStatus) flann_Index_radiusSearch3(cv::flann::Index* obj, cv::Mat* queries, int* indices, int indices_length, float* dists, int dists_length, double radius, int maxResults, cv::flann::SearchParams* params) { + BEGIN_WRAP cv::Mat indices_mat(1, indices_length, CV_32SC1); cv::Mat dists_mat(1, dists_length, CV_32FC1); obj->radiusSearch(*queries, indices_mat, dists_mat, radius, maxResults, *params); memcpy(indices, indices_mat.ptr(0), sizeof(int) * indices_length); memcpy(dists, dists_mat.ptr(0), sizeof(float) * dists_length); + END_WRAP } -CVAPI(void) flann_Index_save(cv::flann::Index* obj, const char* filename) -{ - std::string _filename(filename); - obj->save(_filename); -} -/* -CVAPI(int) flann_Index_veclen(cv::flann::Index* obj) -{ - return obj->veclen(); -} -CVAPI(int) flann_Index_size(cv::flann::Index* obj) -{ - return obj->size(); -} -//*/ -/* -CVAPI(int) flann_hierarchicalClustering(Mat* features, Mat* centers, KMeansIndexParams* params) +CVAPI(ExceptionStatus) flann_Index_save(cv::flann::Index* obj, const char* filename) { - return cv::flann::hierarchicalClustering(*features, *centers, *params); + BEGIN_WRAP + obj->save(filename); + END_WRAP } -//*/ - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/flann_IndexParams.h b/src/OpenCvSharpExtern/flann_IndexParams.h index f8a14dd4c..c44117a30 100644 --- a/src/OpenCvSharpExtern/flann_IndexParams.h +++ b/src/OpenCvSharpExtern/flann_IndexParams.h @@ -1,237 +1,293 @@ -#ifndef _CPP_FLANN_INDEXPARAMS_H_ -#define _CPP_FLANN_INDEXPARAMS_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" // cv::flann::IndexParams -CVAPI(cv::flann::IndexParams*) flann_IndexParams_new() -{ - return new cv::flann::IndexParams; -} -CVAPI(void) flann_IndexParams_delete(cv::flann::IndexParams *obj) -{ - delete obj; -} -CVAPI(cv::Ptr*) flann_Ptr_IndexParams_new() +CVAPI(ExceptionStatus) flann_Ptr_IndexParams_new(cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::IndexParams); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::IndexParams); + END_WRAP } -CVAPI(cv::flann::IndexParams*) flann_Ptr_IndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_IndexParams_get( + cv::Ptr *ptr, cv::flann::IndexParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_IndexParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_IndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) flann_IndexParams_getString(cv::flann::IndexParams *obj, const char *key, const char *defaultVal, char *result) +CVAPI(ExceptionStatus) flann_IndexParams_getString( + cv::flann::IndexParams *obj, const char *key, const char *defaultVal, std::string *returnValue) { - std::string defaultVal_; - if (defaultVal == NULL) - defaultVal_ = std::string(key); - else - defaultVal_ = std::string(); - std::string result_ = obj->getString(key, defaultVal_); - std::strcpy(result, result_.c_str()); + BEGIN_WRAP + returnValue->assign(obj->getString(key, defaultVal)); + END_WRAP } -CVAPI(int) flann_IndexParams_getInt(cv::flann::IndexParams* obj, const char* key, int defaultVal) +CVAPI(ExceptionStatus) flann_IndexParams_getInt(cv::flann::IndexParams* obj, const char* key, int defaultVal, int *returnValue) { - return obj->getInt(key, defaultVal); + BEGIN_WRAP + *returnValue = obj->getInt(key, defaultVal); + END_WRAP } -CVAPI(double) flann_IndexParams_getDouble(cv::flann::IndexParams* obj, const char* key, double defaultVal) +CVAPI(ExceptionStatus) flann_IndexParams_getDouble(cv::flann::IndexParams* obj, const char* key, double defaultVal, double *returnValue) { - return obj->getDouble(key, defaultVal); + BEGIN_WRAP + *returnValue = obj->getDouble(key, defaultVal); + END_WRAP } -CVAPI(void) flann_IndexParams_setString(cv::flann::IndexParams* obj, const char* key, const char* value) +CVAPI(ExceptionStatus) flann_IndexParams_setString(cv::flann::IndexParams* obj, const char* key, const char* value) { + BEGIN_WRAP obj->setString(key, value); + END_WRAP } -CVAPI(void) flann_IndexParams_setInt(cv::flann::IndexParams* obj, const char* key, int value) +CVAPI(ExceptionStatus) flann_IndexParams_setInt(cv::flann::IndexParams* obj, const char* key, int value) { + BEGIN_WRAP obj->setInt(key, value); + END_WRAP } -CVAPI(void) flann_IndexParams_setDouble(cv::flann::IndexParams* obj, const char* key, double value) +CVAPI(ExceptionStatus) flann_IndexParams_setDouble(cv::flann::IndexParams* obj, const char* key, double value) { + BEGIN_WRAP obj->setDouble(key, value); + END_WRAP } -CVAPI(void) flann_IndexParams_setFloat(cv::flann::IndexParams* obj, const char* key, float value) +CVAPI(ExceptionStatus) flann_IndexParams_setFloat(cv::flann::IndexParams* obj, const char* key, float value) { + BEGIN_WRAP obj->setFloat(key, value); + END_WRAP } -CVAPI(void) flann_IndexParams_setBool(cv::flann::IndexParams* obj, const char* key, int value) +CVAPI(ExceptionStatus) flann_IndexParams_setBool(cv::flann::IndexParams* obj, const char* key, int value) { + BEGIN_WRAP obj->setBool(key, (value != 0)); + END_WRAP } -CVAPI(void) flann_IndexParams_setAlgorithm(cv::flann::IndexParams* obj, int value) +CVAPI(ExceptionStatus) flann_IndexParams_setAlgorithm(cv::flann::IndexParams* obj, int value) { + BEGIN_WRAP obj->setAlgorithm(value); + END_WRAP } // cv::flann::LinearIndexParams -CVAPI(cv::flann::LinearIndexParams*) flann_LinearIndexParams_new() -{ - return new cv::flann::LinearIndexParams(); -} -CVAPI(void) flann_LinearIndexParams_delete(cv::flann::LinearIndexParams* obj) -{ - delete obj; -} -CVAPI(cv::Ptr*) flann_Ptr_LinearIndexParams_new() + +CVAPI(ExceptionStatus) flann_Ptr_LinearIndexParams_new(cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::LinearIndexParams); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::LinearIndexParams); + END_WRAP } -CVAPI(cv::flann::LinearIndexParams*) flann_Ptr_LinearIndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_LinearIndexParams_get( + cv::Ptr *ptr, cv::flann::LinearIndexParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_LinearIndexParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_LinearIndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } + // cv::flann::KDTreeIndexParams -CVAPI(cv::flann::KDTreeIndexParams*) flann_KDTreeIndexParams_new(int trees) -{ - return new cv::flann::KDTreeIndexParams(trees); -} -CVAPI(void) flann_KDTreeIndexParams_delete(cv::flann::KDTreeIndexParams* obj) -{ - delete obj; -} -CVAPI(cv::Ptr*) flann_Ptr_KDTreeIndexParams_new(int trees) + +CVAPI(ExceptionStatus) flann_Ptr_KDTreeIndexParams_new(int trees, cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::KDTreeIndexParams(trees)); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::KDTreeIndexParams(trees)); + END_WRAP } -CVAPI(cv::flann::KDTreeIndexParams*) flann_Ptr_KDTreeIndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_KDTreeIndexParams_get( + cv::Ptr *ptr, cv::flann::KDTreeIndexParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_KDTreeIndexParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_KDTreeIndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } + // cv::flann::KMeansIndexParams -CVAPI(cv::flann::KMeansIndexParams*) flann_KMeansIndexParams_new(int branching, int iterations, cvflann::flann_centers_init_t centers_init, float cb_index) -{ - return new cv::flann::KMeansIndexParams(branching, iterations, centers_init, cb_index); -} -CVAPI(void) flann_KMeansIndexParams_delete(cv::flann::KMeansIndexParams* obj) + +CVAPI(ExceptionStatus) flann_Ptr_KMeansIndexParams_new( + int branching, int iterations, cvflann::flann_centers_init_t centers_init, float cb_index, cv::Ptr **returnValue) { - delete obj; + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::KMeansIndexParams(branching, iterations, centers_init, cb_index)); + END_WRAP } -CVAPI(cv::Ptr*) flann_Ptr_KMeansIndexParams_new(int branching, int iterations, cvflann::flann_centers_init_t centers_init, float cb_index) + +CVAPI(ExceptionStatus) flann_Ptr_KMeansIndexParams_get( + cv::Ptr *ptr, cv::flann::KMeansIndexParams **returnValue) { - return new cv::Ptr(new cv::flann::KMeansIndexParams(branching, iterations, centers_init, cb_index)); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(cv::flann::KMeansIndexParams*) flann_Ptr_KMeansIndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_KMeansIndexParams_delete(cv::Ptr *obj) { - return ptr->get(); + BEGIN_WRAP + delete obj; + END_WRAP } -CVAPI(void) flann_Ptr_KMeansIndexParams_delete(cv::Ptr *obj) + + +// cv::flann::LshIndexParams + +CVAPI(ExceptionStatus) flann_Ptr_LshIndexParams_new( + int table_number, int key_size, int multi_probe_level, cv::Ptr **returnValue) { - delete obj; + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::LshIndexParams(table_number, key_size, multi_probe_level)); + END_WRAP } -// cv::flann::CompositeIndexParams -CVAPI(cv::flann::CompositeIndexParams*) flann_CompositeIndexParams_new(int trees, int branching, int iterations, cvflann::flann_centers_init_t centers_init, float cb_index) +CVAPI(ExceptionStatus) flann_Ptr_LshIndexParams_get( + cv::Ptr *ptr, cv::flann::LshIndexParams **returnValue) { - return new cv::flann::CompositeIndexParams(trees, branching, iterations, centers_init, cb_index); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_CompositeIndexParams_delete(cv::flann::CompositeIndexParams* obj) + +CVAPI(ExceptionStatus) flann_Ptr_LshIndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::Ptr*) flann_Ptr_CompositeIndexParams_new(int trees, int branching, int iterations, cvflann::flann_centers_init_t centers_init, float cb_index) + + +// cv::flann::CompositeIndexParams + +CVAPI(ExceptionStatus) flann_Ptr_CompositeIndexParams_new( + int trees, int branching, int iterations, cvflann::flann_centers_init_t centers_init, float cb_index, cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::CompositeIndexParams(trees, branching, iterations, centers_init, cb_index)); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::CompositeIndexParams(trees, branching, iterations, centers_init, cb_index)); + END_WRAP } -CVAPI(cv::flann::CompositeIndexParams*) flann_Ptr_CompositeIndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_CompositeIndexParams_get( + cv::Ptr *ptr, cv::flann::CompositeIndexParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_CompositeIndexParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_CompositeIndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } + // cv::flann::AutotunedIndexParams -CVAPI(cv::flann::AutotunedIndexParams*) flann_AutotunedIndexParams_new(float target_precision, float build_weight, float memory_weight, float sample_fraction) -{ - return new cv::flann::AutotunedIndexParams(target_precision, build_weight, memory_weight, sample_fraction); -} -CVAPI(void) flann_AutotunedIndexParams_delete(cv::flann::AutotunedIndexParams* obj) -{ - delete obj; -} -CVAPI(cv::Ptr*) flann_Ptr_AutotunedIndexParams_new(float target_precision, float build_weight, float memory_weight, float sample_fraction) + +CVAPI(ExceptionStatus) flann_Ptr_AutotunedIndexParams_new( + float target_precision, float build_weight, float memory_weight, float sample_fraction, cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::AutotunedIndexParams(target_precision, build_weight, memory_weight, sample_fraction)); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::AutotunedIndexParams(target_precision, build_weight, memory_weight, sample_fraction)); + END_WRAP } -CVAPI(cv::flann::AutotunedIndexParams*) flann_Ptr_AutotunedIndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_AutotunedIndexParams_get( + cv::Ptr *ptr, cv::flann::AutotunedIndexParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_AutotunedIndexParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_AutotunedIndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } + // cv::flann::SavedIndexParams -CVAPI(cv::flann::SavedIndexParams*) flann_SavedIndexParams_new(const char* filename) -{ - return new cv::flann::SavedIndexParams(filename); -} -CVAPI(void) flann_SavedIndexParams_delete(cv::flann::SavedIndexParams* obj) -{ - delete obj; -} -CVAPI(cv::Ptr*) flann_Ptr_SavedIndexParams_new(const char* filename) + +CVAPI(ExceptionStatus) flann_Ptr_SavedIndexParams_new(const char* filename, cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::SavedIndexParams(filename)); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::SavedIndexParams(filename)); + END_WRAP } -CVAPI(cv::flann::SavedIndexParams*) flann_Ptr_SavedIndexParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_SavedIndexParams_get( + cv::Ptr *ptr, cv::flann::SavedIndexParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_SavedIndexParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_SavedIndexParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } + // cv::flann::SearchParams -CVAPI(cv::flann::SearchParams*) flann_SearchParams_new(int checks, float eps, int sorted) -{ - return new cv::flann::SearchParams(checks, eps, (sorted != 0)); -} -CVAPI(void) flann_SearchParams_delete(cv::flann::SearchParams* obj) -{ - delete obj; -} -CVAPI(cv::Ptr*) flann_Ptr_SearchParams_new(int checks, float eps, int sorted) + +CVAPI(ExceptionStatus) flann_Ptr_SearchParams_new(int checks, float eps, int sorted, cv::Ptr **returnValue) { - return new cv::Ptr(new cv::flann::SearchParams(checks, eps, (sorted != 0))); + BEGIN_WRAP + *returnValue = new cv::Ptr(new cv::flann::SearchParams(checks, eps, (sorted != 0))); + END_WRAP } -CVAPI(cv::flann::SearchParams*) flann_Ptr_SearchParams_get( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) flann_Ptr_SearchParams_get( + cv::Ptr *ptr, cv::flann::SearchParams **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) flann_Ptr_SearchParams_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) flann_Ptr_SearchParams_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/highgui.h b/src/OpenCvSharpExtern/highgui.h index 65a7a5eac..5121597bd 100644 --- a/src/OpenCvSharpExtern/highgui.h +++ b/src/OpenCvSharpExtern/highgui.h @@ -1,80 +1,203 @@ -#ifndef _CPP_HIGHGUI_H_ -#define _CPP_HIGHGUI_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) highgui_namedWindow(const char *winname, int flags) +CVAPI(ExceptionStatus) highgui_namedWindow(const char *winname, int flags) { + BEGIN_WRAP cv::namedWindow(winname, flags); + END_WRAP } -CVAPI(void) highgui_destroyWindow(const char *winName) + +CVAPI(ExceptionStatus) highgui_destroyWindow(const char *winName) { + BEGIN_WRAP cv::destroyWindow(winName); + END_WRAP } -CVAPI(void) highgui_destroyAllWindows() + +CVAPI(ExceptionStatus) highgui_destroyAllWindows() { + BEGIN_WRAP cv::destroyAllWindows(); + END_WRAP } -CVAPI(void) highgui_imshow(const char *winname, cv::Mat *mat) + +CVAPI(ExceptionStatus) highgui_startWindowThread(int *returnValue) { - cv::imshow(winname, *mat); + BEGIN_WRAP + *returnValue = cv::startWindowThread(); + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_waitKeyEx(int delay, int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::waitKeyEx(delay); + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_waitKey(int delay, int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::waitKey(delay); + END_WRAP } + -CVAPI(int) highgui_startWindowThread() +CVAPI(ExceptionStatus) highgui_imshow(const char *winname, cv::Mat *mat) { - return cv::startWindowThread(); + BEGIN_WRAP + cv::imshow(winname, *mat); + END_WRAP } -CVAPI(int) highgui_waitKey(int delay) + +CVAPI(ExceptionStatus) highgui_imshow_umat(const char* winname, cv::UMat* mat) { - return cv::waitKey(delay); + BEGIN_WRAP + cv::imshow(winname, *mat); + END_WRAP } -CVAPI(void) highgui_resizeWindow(const char *winName, int width, int height) +CVAPI(ExceptionStatus) highgui_resizeWindow(const char *winName, int width, int height) { + BEGIN_WRAP cv::resizeWindow(winName, width, height); + END_WRAP } -CVAPI(void) highgui_moveWindow(const char *winName, int x, int y) + +CVAPI(ExceptionStatus) highgui_moveWindow(const char *winName, int x, int y) { + BEGIN_WRAP cv::moveWindow(winName, x, y); + END_WRAP } -CVAPI(void) highgui_setWindowProperty(const char *winName, int propId, double propValue) +CVAPI(ExceptionStatus) highgui_setWindowProperty(const char *winName, int propId, double propValue) { + BEGIN_WRAP cv::setWindowProperty(winName, propId, propValue); + END_WRAP } -CVAPI(void) highgui_setWindowTitle(const char *winname, const char *title) +CVAPI(ExceptionStatus) highgui_setWindowTitle(const char *winname, const char *title) { + BEGIN_WRAP + // TODO Resolve: +#ifndef _WINRT_DLL cv::setWindowTitle(winname, title); +#endif + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_getWindowProperty(const char *winName, int propId, double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getWindowProperty(winName, propId); + END_WRAP } -CVAPI(double) highgui_getWindowProperty(const char *winName, int propId) +CVAPI(ExceptionStatus) highgui_getWindowImageRect(const char *winName, MyCvRect *returnValue) { - return cv::getWindowProperty(winName, propId); + BEGIN_WRAP + *returnValue = c(cv::getWindowImageRect(winName)); + END_WRAP } -CVAPI(void) highgui_setMouseCallback(const char *winName, cv::MouseCallback onMouse, void* userData) +CVAPI(ExceptionStatus) highgui_setMouseCallback(const char *winName, cv::MouseCallback onMouse, void* userData) { + BEGIN_WRAP cv::setMouseCallback(winName, onMouse, userData); + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_getMouseWheelDelta(int flags, int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getMouseWheelDelta(flags); + END_WRAP } -CVAPI(int) highgui_createTrackbar(const char *trackbarName, const char *winName, - int* value, int count, cv::TrackbarCallback onChange, void* userData) + +CVAPI(ExceptionStatus) highgui_selectROI1(const char *windowName, cv::_InputArray *img, int showCrosshair, int fromCenter, MyCvRect *returnValue) +{ + BEGIN_WRAP + *returnValue = c(cv::selectROI(windowName, *img, showCrosshair != 0, fromCenter != 0)); + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_selectROI2(cv::_InputArray *img, int showCrosshair, int fromCenter, MyCvRect *returnValue) +{ + BEGIN_WRAP + *returnValue = c(cv::selectROI(*img, showCrosshair != 0, fromCenter != 0)); + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_selectROIs(const char * windowName, cv::_InputArray *img, + std::vector *boundingBoxes, int showCrosshair, int fromCenter) +{ + BEGIN_WRAP + cv::selectROIs(windowName, *img, *boundingBoxes, showCrosshair != 0, fromCenter != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) highgui_createTrackbar(const char *trackbarName, const char *winName, + int* value, int count, cv::TrackbarCallback onChange, void* userData, int *returnValue) { - return cv::createTrackbar(trackbarName, winName, value, count, onChange, userData); + BEGIN_WRAP + *returnValue = cv::createTrackbar(trackbarName, winName, value, count, onChange, userData); + END_WRAP } -CVAPI(int) highgui_getTrackbarPos(const char *trackbarName, const char *winName) +CVAPI(ExceptionStatus) highgui_getTrackbarPos(const char *trackbarName, const char *winName, int *returnValue) { - return cv::getTrackbarPos(trackbarName, winName); + BEGIN_WRAP + *returnValue = cv::getTrackbarPos(trackbarName, winName); + END_WRAP } -CVAPI(void) highgui_setTrackbarPos(const char *trackbarName, const char *winName, int pos) +CVAPI(ExceptionStatus) highgui_setTrackbarPos(const char *trackbarName, const char *winName, int pos) { + BEGIN_WRAP cv::setTrackbarPos(trackbarName, winName, pos); + END_WRAP } -CVAPI(int) highgui_createButton(const char *bar_name, cv::ButtonCallback on_change, - void* userdata, int type, int initial_button_state) +CVAPI(ExceptionStatus) highgui_setTrackbarMax(const char *trackbarName, const char *winName, int maxVal) { - return cv::createButton(bar_name, on_change, userdata, type, initial_button_state != 0); + BEGIN_WRAP + cv::setTrackbarMax(trackbarName, winName, maxVal); + END_WRAP } +CVAPI(ExceptionStatus) highgui_setTrackbarMin(const char *trackbarName, const char *winName, int minVal) +{ + BEGIN_WRAP + cv::setTrackbarMin(trackbarName, winName, minVal); + END_WRAP +} + +/*CVAPI(ExceptionStatus) highgui_createButton(const char *bar_name, cv::ButtonCallback on_change, + void* user_data, int type, int initial_button_state, int *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::createButton(bar_name, on_change, user_data, type, initial_button_state != 0); + END_WRAP +}*/ + +CVAPI(ExceptionStatus) highgui_cvGetWindowHandle(const char* name, void **returnValue) +{ + BEGIN_WRAP + *returnValue = cvGetWindowHandle(name); + END_WRAP +} + -#endif \ No newline at end of file +#ifdef _WINRT_DLL +CVAPI(ExceptionStatus) highgui_initContainer(::Windows::UI::Xaml::Controls::Panel^ panel) +{ + BEGIN_WRAP + cv::winrt_initContainer(panel); + END_WRAP +} +#endif diff --git a/src/OpenCvSharpExtern/img_hash.cpp b/src/OpenCvSharpExtern/img_hash.cpp new file mode 100644 index 000000000..696a9bf75 --- /dev/null +++ b/src/OpenCvSharpExtern/img_hash.cpp @@ -0,0 +1,2 @@ +// ReSharper disable CppUnusedIncludeDirective +#include "img_hash.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/img_hash.h b/src/OpenCvSharpExtern/img_hash.h new file mode 100644 index 000000000..4aa86a16e --- /dev/null +++ b/src/OpenCvSharpExtern/img_hash.h @@ -0,0 +1,237 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +CVAPI(ExceptionStatus) img_hash_ImgHashBase_compute(cv::img_hash::ImgHashBase *obj, cv::_InputArray *inputArr, cv::_OutputArray *outputArr) +{ + BEGIN_WRAP + obj->compute(*inputArr, *outputArr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_ImgHashBase_compare(cv::img_hash::ImgHashBase *obj, cv::_InputArray *hashOne, cv::_InputArray *hashTwo, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->compare(*hashOne, *hashTwo); + END_WRAP +} + + +// AverageHash + +CVAPI(ExceptionStatus) img_hash_AverageHash_create(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::img_hash::AverageHash::create(); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_AverageHash_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_AverageHash_get(cv::Ptr *ptr, cv::img_hash::AverageHash **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + + +// BlockMeanHash + +CVAPI(ExceptionStatus) img_hash_BlockMeanHash_create(const int mode, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::img_hash::BlockMeanHash::create(mode); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_BlockMeanHash_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_BlockMeanHash_get(cv::Ptr *ptr, cv::img_hash::BlockMeanHash **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_BlockMeanHash_setMode(cv::img_hash::BlockMeanHash *obj, const int mode) +{ + BEGIN_WRAP + obj->setMode(mode); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_BlockMeanHash_getMean(cv::img_hash::BlockMeanHash *obj, std::vector *outVec) +{ + BEGIN_WRAP + const auto mean = obj->getMean(); + outVec->clear(); + outVec->assign(mean.begin(), mean.end()); + END_WRAP +} + + +// ColorMomentHash + +CVAPI(ExceptionStatus) img_hash_ColorMomentHash_create(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::img_hash::ColorMomentHash::create(); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_ColorMomentHash_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_ColorMomentHash_get(cv::Ptr *ptr, cv::img_hash::ColorMomentHash **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + + +// MarrHildrethHash + +CVAPI(ExceptionStatus) img_hash_MarrHildrethHash_create(const float alpha, const float scale, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::img_hash::MarrHildrethHash::create(alpha, scale); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_MarrHildrethHash_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_MarrHildrethHash_get(cv::Ptr *ptr, cv::img_hash::MarrHildrethHash **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_MarrHildrethHash_setKernelParam(cv::img_hash::MarrHildrethHash *obj, const float alpha, const float scale) +{ + BEGIN_WRAP + obj->setKernelParam(alpha, scale); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_MarrHildrethHash_getAlpha(cv::img_hash::MarrHildrethHash *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getAlpha(); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_MarrHildrethHash_getScale(cv::img_hash::MarrHildrethHash *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getScale(); + END_WRAP +} + + +// PHash + +CVAPI(ExceptionStatus) img_hash_PHash_create(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::img_hash::PHash::create(); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_PHash_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_PHash_get(cv::Ptr *ptr, cv::img_hash::PHash **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + + +// RadialVarianceHash + +CVAPI(ExceptionStatus) img_hash_RadialVarianceHash_create(const double sigma, const int numOfAngleLine, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::img_hash::RadialVarianceHash::create(sigma, numOfAngleLine); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_RadialVarianceHash_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_Ptr_RadialVarianceHash_get(cv::Ptr *ptr, cv::img_hash::RadialVarianceHash **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_RadialVarianceHash_setNumOfAngleLine(cv::img_hash::RadialVarianceHash *obj, const int value) +{ + BEGIN_WRAP + obj->setNumOfAngleLine(value); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_RadialVarianceHash_setSigma(cv::img_hash::RadialVarianceHash *obj, const double value) +{ + BEGIN_WRAP + obj->setSigma(value); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_RadialVarianceHash_getNumOfAngleLine(cv::img_hash::RadialVarianceHash *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNumOfAngleLine(); + END_WRAP +} + +CVAPI(ExceptionStatus) img_hash_RadialVarianceHash_getSigma(cv::img_hash::RadialVarianceHash *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSigma(); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/imgcodecs.h b/src/OpenCvSharpExtern/imgcodecs.h index d500e07fa..38b8d06e5 100644 --- a/src/OpenCvSharpExtern/imgcodecs.h +++ b/src/OpenCvSharpExtern/imgcodecs.h @@ -1,73 +1,92 @@ -#ifndef _CPP_IMGCODECS_H_ -#define _CPP_IMGCODECS_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(cv::Mat*) imgcodecs_imread(const char *filename, int flags) +CVAPI(ExceptionStatus) imgcodecs_imread(const char *filename, int flags, cv::Mat **returnValue) +{ + BEGIN_WRAP + const auto ret = cv::imread(filename, flags); + *returnValue = new cv::Mat(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) imgcodecs_imreadmulti(const char *filename, std::vector *mats, int flags, int *returnValue) { - cv::Mat ret = cv::imread(filename, flags); - return new cv::Mat(ret); + BEGIN_WRAP + *returnValue = cv::imreadmulti(filename, *mats, flags) ? 1 : 0; + END_WRAP } -CVAPI(int) imgcodecs_imreadmulti(const char *filename, std::vector *mats, int flags) +CVAPI(ExceptionStatus) imgcodecs_imwrite(const char *filename, cv::Mat *img, int *params, int paramsLength, int *returnValue) { - return cv::imreadmulti(filename, *mats, flags) ? 1 : 0; + BEGIN_WRAP + std::vector paramsVec; + paramsVec.assign(params, params + paramsLength); + *returnValue = cv::imwrite(filename, *img, paramsVec) ? 1 : 0; + END_WRAP } -CVAPI(int) imgcodecs_imwrite(const char *filename, cv::Mat *img, int *params, int paramsLength) +CVAPI(ExceptionStatus) imgcodecs_imwrite_multi(const char *filename, std::vector *img, int *params, int paramsLength, int *returnValue) { + BEGIN_WRAP std::vector paramsVec; paramsVec.assign(params, params + paramsLength); - return cv::imwrite(filename, *img, paramsVec) ? 1 : 0; + *returnValue = cv::imwrite(filename, *img, paramsVec) ? 1 : 0; + END_WRAP } -CVAPI(cv::Mat*) imgcodecs_imdecode_Mat(cv::Mat *buf, int flags) +CVAPI(ExceptionStatus) imgcodecs_imdecode_Mat(cv::Mat *buf, int flags, cv::Mat **returnValue) { - cv::Mat ret = cv::imdecode(*buf, flags); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::imdecode(*buf, flags); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) imgcodecs_imdecode_vector(uchar *buf, size_t bufLength, int flags) +CVAPI(ExceptionStatus) imgcodecs_imdecode_vector(uchar *buf, int bufLength, int flags, cv::Mat **returnValue) { - std::vector bufVec(buf, buf + bufLength); - cv::Mat ret = cv::imdecode(bufVec, flags); - return new cv::Mat(ret); + BEGIN_WRAP + //const std::vector bufVec(buf, buf + bufLength); + const cv::Mat bufMat(1, bufLength, CV_8UC1, buf, cv::Mat::AUTO_STEP); + const auto ret = cv::imdecode(bufMat, flags); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) imgcodecs_imdecode_InputArray(cv::_InputArray *buf, int flags) +CVAPI(ExceptionStatus) imgcodecs_imdecode_InputArray(cv::_InputArray *buf, int flags, cv::Mat **returnValue) { - cv::Mat ret = cv::imdecode(*buf, flags); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::imdecode(*buf, flags); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(int) imgcodecs_imencode_vector(const char *ext, cv::_InputArray *img, - std::vector *buf, int *params, int paramsLength) +CVAPI(ExceptionStatus) imgcodecs_imencode_vector( + const char *ext, cv::_InputArray *img, + std::vector *buf, int *params, int paramsLength, int *returnValue) { + BEGIN_WRAP std::vector paramsVec; - if (params != NULL) + if (params != nullptr) paramsVec = std::vector(params, params + paramsLength); - return cv::imencode(ext, *img, *buf, paramsVec) ? 1 : 0; + *returnValue = cv::imencode(ext, *img, *buf, paramsVec) ? 1 : 0; + END_WRAP } -CVAPI(void) imgcodecs_cvConvertImage_CvArr(CvArr *src, CvArr *dst, int flags) +CVAPI(ExceptionStatus) imgcodecs_haveImageReader(const char *filename, int *returnValue) { - cvConvertImage(src, dst, flags); -} -CVAPI(void) imgcodecs_cvConvertImage_Mat(cv::Mat *src, cv::Mat *dst, int flags) -{ - IplImage srcImg = (IplImage)*src; - IplImage dstImg = (IplImage)*dst; - cvConvertImage(&srcImg, &dstImg, flags); -} - -CVAPI(int) imgcodecs_cvHaveImageReader(const char *filename) -{ - return cvHaveImageReader(filename); + BEGIN_WRAP + *returnValue = cv::haveImageReader(filename) ? 1 : 0; + END_WRAP } -CVAPI(int) imgcodecs_cvHaveImageWriter(const char *filename) +CVAPI(ExceptionStatus) imgcodecs_haveImageWriter(const char *filename, int *returnValue) { - return cvHaveImageWriter(filename); + BEGIN_WRAP + *returnValue = cv::haveImageWriter(filename) ? 1 : 0; + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/imgproc.cpp b/src/OpenCvSharpExtern/imgproc.cpp index ed9017ddd..83c2fdac6 100644 --- a/src/OpenCvSharpExtern/imgproc.cpp +++ b/src/OpenCvSharpExtern/imgproc.cpp @@ -1,6 +1,8 @@ +// ReSharper disable CppUnusedIncludeDirective #include "imgproc.h" #include "imgproc_Subdiv2D.h" #include "imgproc_CLAHE.h" #include "imgproc_LineIterator.h" +#include "imgproc_GeneralizedHough.h" +#include "imgproc_Segmentation.h" #include "imgproc_LineSegmentDetector.h" -#include "imgproc_GeneralizedHough.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/imgproc.h b/src/OpenCvSharpExtern/imgproc.h index 3617c8cab..266fc6b1b 100644 --- a/src/OpenCvSharpExtern/imgproc.h +++ b/src/OpenCvSharpExtern/imgproc.h @@ -1,949 +1,1415 @@ -#ifndef _CPP_IMGPROC_H_ -#define _CPP_IMGPROC_H_ +#pragma once + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppParameterMayBeConst #include "include_opencv.h" -// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile -CVAPI(cv::Mat*) imgproc_getGaussianKernel(int ksize, double sigma, int ktype) +CVAPI(ExceptionStatus) imgproc_getGaussianKernel(int ksize, double sigma, int ktype, cv::Mat **returnValue) { - cv::Mat ret = cv::getGaussianKernel(ksize, sigma, ktype); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getGaussianKernel(ksize, sigma, ktype); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) imgproc_getDerivKernels(cv::_OutputArray *kx, cv::_OutputArray *ky, +CVAPI(ExceptionStatus) imgproc_getDerivKernels(cv::_OutputArray *kx, cv::_OutputArray *ky, int dx, int dy, int ksize, int normalize, int ktype) { + BEGIN_WRAP cv::getDerivKernels(*kx, *ky, dx, dy, ksize, normalize != 0, ktype); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getGaborKernel(MyCvSize ksize, double sigma, double theta, - double lambd, double gamma, double psi, int ktype) +CVAPI(ExceptionStatus) imgproc_getGaborKernel(MyCvSize ksize, double sigma, double theta, + double lambd, double gamma, double psi, int ktype, cv::Mat **returnValue) { - cv::Mat ret = cv::getGaborKernel(cpp(ksize), sigma, theta, lambd, gamma, psi, ktype); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getGaborKernel(cpp(ksize), sigma, theta, lambd, gamma, psi, ktype); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getStructuringElement(int shape, MyCvSize ksize, MyCvPoint anchor) +CVAPI(ExceptionStatus) imgproc_getStructuringElement(int shape, MyCvSize ksize, MyCvPoint anchor, cv::Mat **returnValue) { - cv::Mat ret = cv::getStructuringElement(shape, cpp(ksize), cpp(anchor)); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getStructuringElement(shape, cpp(ksize), cpp(anchor)); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) imgproc_copyMakeBorder(cv::_InputArray *src, cv::_OutputArray *dst, - int top, int bottom, int left, int right, int borderType, MyCvScalar value) -{ - cv::copyMakeBorder(*src, *dst, top, bottom, left, right, borderType, cpp(value)); -} - -CVAPI(void) imgproc_medianBlur(cv::_InputArray *src, cv::_OutputArray *dst, int ksize) +CVAPI(ExceptionStatus) imgproc_medianBlur(cv::_InputArray *src, cv::_OutputArray *dst, int ksize) { + BEGIN_WRAP cv::medianBlur(*src, *dst, ksize); + END_WRAP } -CVAPI(void) imgproc_GaussianBlur(cv::_InputArray *src, cv::_OutputArray *dst, - CvSize ksize, double sigmaX, double sigmaY, int borderType) +CVAPI(ExceptionStatus) imgproc_GaussianBlur(cv::_InputArray *src, cv::_OutputArray *dst, + MyCvSize ksize, double sigmaX, double sigmaY, int borderType) { - cv::GaussianBlur(*src, *dst, ksize, sigmaX, sigmaY, borderType); + BEGIN_WRAP + cv::GaussianBlur(*src, *dst, cpp(ksize), sigmaX, sigmaY, borderType); + END_WRAP } -CVAPI(void) imgproc_bilateralFilter(cv::_InputArray *src, cv::_OutputArray *dst, - int d, double sigmaColor, double sigmaSpace, int borderType) +CVAPI(ExceptionStatus) imgproc_bilateralFilter(cv::_InputArray *src, cv::_OutputArray *dst, + int d, double sigmaColor, double sigmaSpace, int borderType) { + BEGIN_WRAP cv::bilateralFilter(*src, *dst, d, sigmaColor, sigmaSpace, borderType); + END_WRAP } -/* -CVAPI(void) imgproc_adaptiveBilateralFilter(cv::_InputArray *src, cv::_OutputArray *dst, - CvSize ksize, double sigmaSpace, double maxSigmaColor, CvPoint anchor, int borderType) +CVAPI(ExceptionStatus) imgproc_boxFilter(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + MyCvSize ksize, MyCvPoint anchor, int normalize, int borderType) { - cv::adaptiveBilateralFilter(*src, *dst, ksize, sigmaSpace, maxSigmaColor, anchor, borderType); -}*/ + BEGIN_WRAP + cv::boxFilter(*src, *dst, ddepth, cpp(ksize), cpp(anchor), normalize != 0, borderType); + END_WRAP +} -CVAPI(void) imgproc_boxFilter(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, - CvSize ksize, CvPoint anchor, int normalize, int borderType) +CVAPI(ExceptionStatus) imgproc_sqrBoxFilter( + cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + MyCvSize ksize, MyCvPoint anchor, int normalize, int borderType) { - cv::boxFilter(*src, *dst, ddepth, ksize, anchor, normalize != 0, borderType); + BEGIN_WRAP + cv::sqrBoxFilter(*src, *dst, ddepth, cpp(ksize), cpp(anchor), normalize != 0, borderType); + END_WRAP } -CVAPI(void) imgproc_blur(cv::_InputArray *src, cv::_OutputArray *dst, CvSize ksize, CvPoint anchor, int borderType) +CVAPI(ExceptionStatus) imgproc_blur(cv::_InputArray *src, cv::_OutputArray *dst, CvSize ksize, CvPoint anchor, int borderType) { + BEGIN_WRAP cv::blur(*src, *dst, ksize, anchor, borderType); + END_WRAP } -CVAPI(void) imgproc_filter2D(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, - cv::_InputArray *kernel, CvPoint anchor, double delta, int borderType) +CVAPI(ExceptionStatus) imgproc_filter2D(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + cv::_InputArray *kernel, MyCvPoint anchor, double delta, int borderType) { - cv::filter2D(*src, *dst, ddepth, *kernel, anchor, delta, borderType); + BEGIN_WRAP + cv::filter2D(*src, *dst, ddepth, *kernel, cpp(anchor), delta, borderType); + END_WRAP } -CVAPI(void) imgproc_sepFilter2D(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, - cv::_InputArray *kernelX, cv::_InputArray *kernelY, - CvPoint anchor, double delta, int borderType) +CVAPI(ExceptionStatus) imgproc_sepFilter2D(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + cv::_InputArray *kernelX, cv::_InputArray *kernelY, + MyCvPoint anchor, double delta, int borderType) { - cv::sepFilter2D(*src, *dst, ddepth, *kernelX, *kernelY, anchor, delta, borderType); + BEGIN_WRAP + cv::sepFilter2D(*src, *dst, ddepth, *kernelX, *kernelY, cpp(anchor), delta, borderType); + END_WRAP } -CVAPI(void) imgproc_Sobel(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, - int dx, int dy, int ksize, double scale, double delta, int borderType) +CVAPI(ExceptionStatus) imgproc_Sobel(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + int dx, int dy, int ksize, double scale, double delta, int borderType) { + BEGIN_WRAP cv::Sobel(*src, *dst, ddepth, dx, dy, ksize, scale, delta, borderType); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_spatialGradient( + cv::_InputArray *src, cv::_OutputArray *dx, cv::_OutputArray *dy, int ksize, int borderType) +{ + BEGIN_WRAP + cv::spatialGradient(*src, *dx, *dy, ksize, borderType); + END_WRAP } -CVAPI(void) imgproc_Scharr(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, - int dx, int dy, double scale, double delta, int borderType) +CVAPI(ExceptionStatus) imgproc_Scharr(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + int dx, int dy, double scale, double delta, int borderType) { + BEGIN_WRAP cv::Scharr(*src, *dst, ddepth, dx, dy, scale, delta, borderType); + END_WRAP } -CVAPI(void) imgproc_Laplacian(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, - int ksize, double scale, double delta, int borderType) +CVAPI(ExceptionStatus) imgproc_Laplacian(cv::_InputArray *src, cv::_OutputArray *dst, int ddepth, + int ksize, double scale, double delta, int borderType) { + BEGIN_WRAP cv::Laplacian(*src, *dst, ddepth, ksize, scale, delta, borderType); + END_WRAP } -CVAPI(void) imgproc_Canny(cv::_InputArray *src, cv::_OutputArray *edges, - double threshold1, double threshold2, int apertureSize, int L2gradient) +CVAPI(ExceptionStatus) imgproc_Canny1(cv::_InputArray *src, cv::_OutputArray *edges, + double threshold1, double threshold2, int apertureSize, int L2gradient) { + BEGIN_WRAP cv::Canny(*src, *edges, threshold1, threshold2, apertureSize, L2gradient != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_Canny2( + cv::_InputArray *dx, cv::_InputArray *dy, cv::_OutputArray *edges, + double threshold1, double threshold2, int L2gradient = false) +{ + BEGIN_WRAP + cv::Canny(*dx, *dy, *edges, threshold1, threshold2, L2gradient != 0); + END_WRAP } -CVAPI(void) imgproc_cornerMinEigenVal(cv::_InputArray *src, cv::_OutputArray *dst, - int blockSize, int ksize, int borderType) +CVAPI(ExceptionStatus) imgproc_cornerMinEigenVal(cv::_InputArray *src, cv::_OutputArray *dst, + int blockSize, int ksize, int borderType) { + BEGIN_WRAP cv::cornerMinEigenVal(*src, *dst, blockSize, ksize, borderType); + END_WRAP } -CVAPI(void) imgproc_cornerHarris(cv::_InputArray *src, cv::_OutputArray *dst, - int blockSize, int ksize, double k, int borderType) +CVAPI(ExceptionStatus) imgproc_cornerHarris(cv::_InputArray *src, cv::_OutputArray *dst, + int blockSize, int ksize, double k, int borderType) { + BEGIN_WRAP cv::cornerHarris(*src, *dst, blockSize, ksize, k, borderType); + END_WRAP } -CVAPI(void) imgproc_cornerEigenValsAndVecs(cv::_InputArray *src, cv::_OutputArray *dst, - int blockSize, int ksize, int borderType) +CVAPI(ExceptionStatus) imgproc_cornerEigenValsAndVecs(cv::_InputArray *src, cv::_OutputArray *dst, + int blockSize, int ksize, int borderType) { + BEGIN_WRAP cv::cornerEigenValsAndVecs(*src, *dst, blockSize, ksize, borderType); + END_WRAP } -CVAPI(void) imgproc_preCornerDetect(cv::_InputArray *src, cv::_OutputArray *dst, int ksize, int borderType) +CVAPI(ExceptionStatus) imgproc_preCornerDetect(cv::_InputArray *src, cv::_OutputArray *dst, int ksize, int borderType) { + BEGIN_WRAP cv::preCornerDetect(*src, *dst, ksize, borderType); + END_WRAP } -CVAPI(void) imgproc_cornerSubPix(cv::_InputArray *image, std::vector *corners, - CvSize winSize, CvSize zeroZone, CvTermCriteria criteria) +CVAPI(ExceptionStatus) imgproc_cornerSubPix(cv::_InputArray *image, std::vector *corners, + CvSize winSize, CvSize zeroZone, MyCvTermCriteria criteria) { - cv::cornerSubPix(*image, *corners, winSize, zeroZone, criteria); + BEGIN_WRAP + cv::cornerSubPix(*image, *corners, winSize, zeroZone, cpp(criteria)); + END_WRAP } -CVAPI(void) imgproc_goodFeaturesToTrack(cv::_InputArray *src, std::vector *corners, - int maxCorners, double qualityLevel, double minDistance, - cv::_InputArray *mask, int blockSize, int useHarrisDetector, double k) +CVAPI(ExceptionStatus) imgproc_goodFeaturesToTrack(cv::_InputArray *src, std::vector *corners, + int maxCorners, double qualityLevel, double minDistance, + cv::_InputArray *mask, int blockSize, int useHarrisDetector, double k) { - cv::goodFeaturesToTrack(*src, *corners, maxCorners, qualityLevel, minDistance, entity(mask), blockSize, useHarrisDetector != 0, k); + BEGIN_WRAP + cv::goodFeaturesToTrack(*src, *corners, maxCorners, qualityLevel, minDistance, + entity(mask), blockSize, useHarrisDetector != 0, k); + END_WRAP } -CVAPI(void) imgproc_HoughLines(cv::_InputArray *src, std::vector *lines, - double rho, double theta, int threshold, - double srn, double stn) +CVAPI(ExceptionStatus) imgproc_HoughLines(cv::_InputArray *src, std::vector *lines, + double rho, double theta, int threshold, + double srn, double stn) { + BEGIN_WRAP cv::HoughLines(*src, *lines, rho, theta, threshold, srn, stn); + END_WRAP } -CVAPI(void) imgproc_HoughLinesP(cv::_InputArray *src, std::vector *lines, - double rho, double theta, int threshold, - double minLineLength, double maxLineGap) +CVAPI(ExceptionStatus) imgproc_HoughLinesP(cv::_InputArray *src, std::vector *lines, + double rho, double theta, int threshold, + double minLineLength, double maxLineGap) { + BEGIN_WRAP cv::HoughLinesP(*src, *lines, rho, theta, threshold, minLineLength, maxLineGap); + END_WRAP } -CVAPI(void) imgproc_HoughCircles(cv::_InputArray *src, std::vector *circles, - int method, double dp, double minDist, - double param1, double param2, int minRadius, int maxRadius) +CVAPI(ExceptionStatus) imgproc_HoughLinesPointSet( + cv::_InputArray *_point, cv::_OutputArray *_lines, int lines_max, int threshold, + double min_rho, double max_rho, double rho_step, + double min_theta, double max_theta, double theta_step) { + BEGIN_WRAP + cv::HoughLinesPointSet(*_point, *_lines, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_HoughCircles(cv::_InputArray *src, std::vector *circles, + int method, double dp, double minDist, + double param1, double param2, int minRadius, int maxRadius) +{ + BEGIN_WRAP cv::HoughCircles(*src, *circles, method, dp, minDist, param1, param2, minRadius, maxRadius); + END_WRAP } -CVAPI(void) imgproc_erode(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *kernel, - CvPoint anchor, int iterations, int borderType, CvScalar borderValue) +CVAPI(ExceptionStatus) imgproc_erode(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *kernel, + MyCvPoint anchor, int iterations, int borderType, MyCvScalar borderValue) { - cv::erode(*src, *dst, entity(kernel), anchor, iterations, borderType, borderValue); + BEGIN_WRAP + cv::erode(*src, *dst, entity(kernel), cpp(anchor), iterations, borderType, cpp(borderValue)); + END_WRAP } -CVAPI(void) imgproc_dilate(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *kernel, - CvPoint anchor, int iterations, int borderType, CvScalar borderValue) + +CVAPI(ExceptionStatus) imgproc_dilate(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *kernel, + CvPoint anchor, int iterations, int borderType, CvScalar borderValue) { + BEGIN_WRAP cv::dilate(*src, *dst, entity(kernel), anchor, iterations, borderType, borderValue); + END_WRAP } -CVAPI(void) imgproc_morphologyEx(cv::_InputArray *src, cv::_OutputArray *dst, int op, cv::_InputArray *kernel, - CvPoint anchor, int iterations, int borderType, CvScalar borderValue) + +CVAPI(ExceptionStatus) imgproc_morphologyEx(cv::_InputArray *src, cv::_OutputArray *dst, int op, cv::_InputArray *kernel, + MyCvPoint anchor, int iterations, int borderType, MyCvScalar borderValue) { - cv::morphologyEx(*src, *dst, op, entity(kernel), anchor, iterations, borderType, borderValue); + BEGIN_WRAP + cv::morphologyEx(*src, *dst, op, entity(kernel), cpp(anchor), iterations, borderType, cpp(borderValue)); + END_WRAP } -CVAPI(void) imgproc_resize(cv::_InputArray* src, cv::_OutputArray* dst, CvSize dsize, double fx, double fy, int interpolation) +CVAPI(ExceptionStatus) imgproc_resize(cv::_InputArray* src, cv::_OutputArray* dst, MyCvSize dsize, double fx, double fy, int interpolation) { - cv::resize(*src, *dst, dsize, fx, fy, interpolation); + BEGIN_WRAP + cv::resize(*src, *dst, cpp(dsize), fx, fy, interpolation); + END_WRAP } -CVAPI(void) imgproc_warpAffine(cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray* M, CvSize dsize, - int flags, int borderMode, CvScalar borderValue) +CVAPI(ExceptionStatus) imgproc_warpAffine(cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray* M, MyCvSize dsize, + int flags, int borderMode, MyCvScalar borderValue) { - cv::warpAffine(*src, *dst, *M, dsize, flags, borderMode, borderValue); + BEGIN_WRAP + cv::warpAffine(*src, *dst, *M, cpp(dsize), flags, borderMode, cpp(borderValue)); + END_WRAP } -CVAPI(void) imgproc_warpPerspective_MisInputArray(cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray* m, CvSize dsize, - int flags, int borderMode, CvScalar borderValue) +CVAPI(ExceptionStatus) imgproc_warpPerspective_MisInputArray(cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray* m, MyCvSize dsize, + int flags, int borderMode, MyCvScalar borderValue) { - cv::warpPerspective(*src, *dst, *m, dsize, flags, borderMode, borderValue); + BEGIN_WRAP + cv::warpPerspective(*src, *dst, *m, cpp(dsize), flags, borderMode, cpp(borderValue)); + END_WRAP } -CVAPI(void) imgproc_warpPerspective_MisArray(cv::_InputArray* src, cv::_OutputArray* dst, float* m, int mRow, int mCol, CvSize dsize, - int flags, int borderMode, CvScalar borderValue) +CVAPI(ExceptionStatus) imgproc_warpPerspective_MisArray(cv::_InputArray* src, cv::_OutputArray* dst, float* m, int mRow, int mCol, MyCvSize dsize, + int flags, int borderMode, MyCvScalar borderValue) { - cv::Mat mmat(mRow, mCol, CV_32FC1, m); - cv::warpPerspective(*src, *dst, mmat, dsize, flags, borderMode, borderValue); + BEGIN_WRAP + const cv::Mat mmat(mRow, mCol, CV_32FC1, m); + cv::warpPerspective(*src, *dst, mmat, cpp(dsize), flags, borderMode, cpp(borderValue)); + END_WRAP } -CVAPI(void) imgproc_remap(cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray* map1, cv::_InputArray* map2, - int interpolation, int borderMode, CvScalar borderValue) +CVAPI(ExceptionStatus) imgproc_remap(cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray* map1, cv::_InputArray* map2, + int interpolation, int borderMode, MyCvScalar borderValue) { - cv::remap(*src, *dst, *map1, *map2, interpolation, borderMode, borderValue); + BEGIN_WRAP + cv::remap(*src, *dst, *map1, *map2, interpolation, borderMode, cpp(borderValue)); + END_WRAP } -CVAPI(void) imgproc_convertMaps(cv::_InputArray* map1, cv::_InputArray* map2, cv::_OutputArray* dstmap1, cv::_OutputArray* dstmap2, - int dstmap1type, int nninterpolation) +CVAPI(ExceptionStatus) imgproc_convertMaps(cv::_InputArray* map1, cv::_InputArray* map2, cv::_OutputArray* dstmap1, cv::_OutputArray* dstmap2, + int dstmap1type, int nnInterpolation) { - cv::convertMaps(*map1, *map2, *dstmap1, *dstmap2, dstmap1type, nninterpolation != 0); + BEGIN_WRAP + cv::convertMaps(*map1, *map2, *dstmap1, *dstmap2, dstmap1type, nnInterpolation != 0); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getRotationMatrix2D(MyCvPoint2D32f center, double angle, double scale) +CVAPI(ExceptionStatus) imgproc_getRotationMatrix2D(MyCvPoint2D32f center, double angle, double scale, cv::Mat** returnValue) { - cv::Mat ret = cv::getRotationMatrix2D(cpp(center), angle, scale); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getRotationMatrix2D(cpp(center), angle, scale); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) imgproc_invertAffineTransform(cv::_InputArray* M, cv::_OutputArray *iM) +CVAPI(ExceptionStatus) imgproc_invertAffineTransform(cv::_InputArray* M, cv::_OutputArray *iM) { + BEGIN_WRAP cv::invertAffineTransform(*M, *iM); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getPerspectiveTransform1(cv::Point2f *src, cv::Point2f *dst) +CVAPI(ExceptionStatus) imgproc_getPerspectiveTransform1(cv::Point2f *src, cv::Point2f *dst, cv::Mat** returnValue) { - cv::Mat ret = cv::getPerspectiveTransform(src, dst); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getPerspectiveTransform(src, dst); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getPerspectiveTransform2(cv::_InputArray *src, cv::_InputArray *dst) +CVAPI(ExceptionStatus) imgproc_getPerspectiveTransform2(cv::_InputArray *src, cv::_InputArray *dst, cv::Mat** returnValue) { - cv::Mat ret = cv::getPerspectiveTransform(*src, *dst); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getPerspectiveTransform(*src, *dst); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getAffineTransform1(cv::Point2f *src, cv::Point2f *dst) +CVAPI(ExceptionStatus) imgproc_getAffineTransform1(cv::Point2f *src, cv::Point2f *dst, cv::Mat** returnValue) { - cv::Mat ret = cv::getAffineTransform(src, dst); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getAffineTransform(src, dst); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(cv::Mat*) imgproc_getAffineTransform2(cv::_InputArray *src, cv::_InputArray *dst) +CVAPI(ExceptionStatus) imgproc_getAffineTransform2(cv::_InputArray *src, cv::_InputArray *dst, cv::Mat** returnValue) { - cv::Mat ret = cv::getAffineTransform(*src, *dst); - return new cv::Mat(ret); + BEGIN_WRAP + const auto ret = cv::getAffineTransform(*src, *dst); + *returnValue = new cv::Mat(ret); + END_WRAP } -CVAPI(void) imgproc_getRectSubPix(cv::_InputArray *image, CvSize patchSize, MyCvPoint2D32f center, cv::_OutputArray *patch, int patchType) +CVAPI(ExceptionStatus) imgproc_getRectSubPix(cv::_InputArray *image, MyCvSize patchSize, MyCvPoint2D32f center, cv::_OutputArray *patch, int patchType) { - cv::getRectSubPix(*image, patchSize, cpp(center), *patch, patchType); + BEGIN_WRAP + cv::getRectSubPix(*image, cpp(patchSize), cpp(center), *patch, patchType); + END_WRAP } -CVAPI(void) imgproc_logPolar(cv::_InputArray *src, cv::_OutputArray *dst, - MyCvPoint2D32f center, double M, int flags) +CVAPI(ExceptionStatus) imgproc_logPolar(cv::_InputArray *src, cv::_OutputArray *dst, + MyCvPoint2D32f center, double M, int flags) { + BEGIN_WRAP cv::logPolar(*src, *dst, cpp(center), M, flags); + END_WRAP } -CVAPI(void) imgproc_linearPolar(cv::_InputArray *src, cv::_OutputArray *dst, - MyCvPoint2D32f center, double maxRadius, int flags) +CVAPI(ExceptionStatus) imgproc_linearPolar(cv::_InputArray *src, cv::_OutputArray *dst, + MyCvPoint2D32f center, double maxRadius, int flags) { + BEGIN_WRAP cv::linearPolar(*src, *dst, cpp(center), maxRadius, flags); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_warpPolar( + cv::_InputArray *src, cv::_OutputArray *dst, MyCvSize dsize, + MyCvPoint2D32f center, double maxRadius, int flags) +{ + BEGIN_WRAP + cv::warpPolar(*src, *dst, cpp(dsize), cpp(center), maxRadius, flags); + END_WRAP } -CVAPI(void) imgproc_integral1(cv::_InputArray *src, cv::_OutputArray *sum, int sdepth) +CVAPI(ExceptionStatus) imgproc_integral1(cv::_InputArray *src, cv::_OutputArray *sum, int sdepth) { + BEGIN_WRAP cv::integral(*src, *sum, sdepth); + END_WRAP } -CVAPI(void) imgproc_integral2(cv::_InputArray *src, cv::_OutputArray *sum, cv::_OutputArray *sqsum, int sdepth) + +CVAPI(ExceptionStatus) imgproc_integral2(cv::_InputArray *src, cv::_OutputArray *sum, cv::_OutputArray *sqsum, int sdepth) { + BEGIN_WRAP cv::integral(*src, *sum, *sqsum, sdepth); + END_WRAP } -CVAPI(void) imgproc_integral3(cv::_InputArray *src, cv::_OutputArray *sum, cv::_OutputArray *sqsum, cv::_OutputArray *tilted, int sdepth) + +CVAPI(ExceptionStatus) imgproc_integral3(cv::_InputArray *src, cv::_OutputArray *sum, cv::_OutputArray *sqsum, cv::_OutputArray *tilted, int sdepth, int sqdepth) { - cv::integral(*src, *sum, *sqsum, *tilted, sdepth); + BEGIN_WRAP + cv::integral(*src, *sum, *sqsum, *tilted, sdepth, sqdepth); + END_WRAP } -CVAPI(void) imgproc_accumulate(cv::_InputArray *src, cv::_InputOutputArray *dst, cv::_InputArray *mask) +CVAPI(ExceptionStatus) imgproc_accumulate(cv::_InputArray *src, cv::_InputOutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::accumulate(*src, *dst, entity(mask)); + END_WRAP } -CVAPI(void) imgproc_accumulateSquare(cv::_InputArray* src, cv::_InputOutputArray *dst, cv::_InputArray *mask) + +CVAPI(ExceptionStatus) imgproc_accumulateSquare(cv::_InputArray* src, cv::_InputOutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::accumulateSquare(*src, *dst, entity(mask)); + END_WRAP } -CVAPI(void) imgproc_accumulateProduct(cv::_InputArray *src1, cv::_InputArray *src2, cv::_InputOutputArray *dst, cv::_InputArray *mask) + +CVAPI(ExceptionStatus) imgproc_accumulateProduct(cv::_InputArray *src1, cv::_InputArray *src2, cv::_InputOutputArray *dst, cv::_InputArray *mask) { + BEGIN_WRAP cv::accumulateProduct(*src1, *src2, *dst, entity(mask)); + END_WRAP } -CVAPI(void) imgproc_accumulateWeighted(cv::_InputArray *src, cv::_InputOutputArray *dst, double alpha, cv::_InputArray *mask) + +CVAPI(ExceptionStatus) imgproc_accumulateWeighted(cv::_InputArray *src, cv::_InputOutputArray *dst, double alpha, cv::_InputArray *mask) { + BEGIN_WRAP cv::accumulateWeighted(*src, *dst, alpha, entity(mask)); + END_WRAP } -CVAPI(double) imgproc_PSNR(cv::_InputArray *src1, cv::_InputArray *src2) +CVAPI(ExceptionStatus) imgproc_phaseCorrelate(cv::_InputArray *src1, cv::_InputArray *src2, + cv::_InputArray *window, double* response, MyCvPoint2D64f* returnValue) { - return cv::PSNR(*src1, *src2); + BEGIN_WRAP + const auto p = cv::phaseCorrelate(*src1, *src2, *window, response); + *returnValue = { p.x, p.y }; + END_WRAP } -CVAPI(CvPoint2D64f) imgproc_phaseCorrelate(cv::_InputArray *src1, cv::_InputArray *src2, - cv::_InputArray *window) -{ - cv::Point2d p = cv::phaseCorrelate(*src1, *src2, entity(window)); - return cvPoint2D64f(p.x, p.y); -} -CVAPI(CvPoint2D64f) imgproc_phaseCorrelateRes(cv::_InputArray *src1, cv::_InputArray *src2, - cv::_InputArray *window, double* response) +CVAPI(ExceptionStatus) imgproc_createHanningWindow(cv::_OutputArray *dst, MyCvSize winSize, int type) { - cv::Point2d p = cv::phaseCorrelate(*src1, *src2, *window, response); - return cvPoint2D64f(p.x, p.y); -} -CVAPI(void) imgproc_createHanningWindow(cv::_OutputArray *dst, CvSize winSize, int type) -{ - cv::createHanningWindow(*dst, winSize, type); + BEGIN_WRAP + cv::createHanningWindow(*dst, cpp(winSize), type); + END_WRAP } -CVAPI(double) imgproc_threshold(cv::_InputArray *src, cv::_OutputArray *dst, - double thresh, double maxval, int type) +CVAPI(ExceptionStatus) imgproc_threshold(cv::_InputArray *src, cv::_OutputArray *dst, + double thresh, double maxVal, int type, double *returnValue) { - return cv::threshold(*src, *dst, thresh, maxval, type); + BEGIN_WRAP + *returnValue = cv::threshold(*src, *dst, thresh, maxVal, type); + END_WRAP } -CVAPI(void) imgproc_adaptiveThreshold(cv::_InputArray *src, cv::_OutputArray *dst, - double maxValue, int adaptiveMethod, - int thresholdType, int blockSize, double C) + +CVAPI(ExceptionStatus) imgproc_adaptiveThreshold(cv::_InputArray *src, cv::_OutputArray *dst, + double maxValue, int adaptiveMethod, + int thresholdType, int blockSize, double C) { + BEGIN_WRAP cv::adaptiveThreshold(*src, *dst, maxValue, adaptiveMethod, thresholdType, blockSize, C); + END_WRAP } -CVAPI(void) imgproc_pyrDown(cv::_InputArray *src, cv::_OutputArray *dst, CvSize dstsize, int borderType) +CVAPI(ExceptionStatus) imgproc_pyrDown(cv::_InputArray *src, cv::_OutputArray *dst, MyCvSize dstSize, int borderType) { - cv::pyrDown(*src, *dst, dstsize, borderType); + BEGIN_WRAP + cv::pyrDown(*src, *dst, cpp(dstSize), borderType); + END_WRAP } -CVAPI(void) imgproc_pyrUp(cv::_InputArray *src, cv::_OutputArray *dst, CvSize dstsize, int borderType) +CVAPI(ExceptionStatus) imgproc_pyrUp(cv::_InputArray *src, cv::_OutputArray *dst, MyCvSize dstSize, int borderType) { - cv::pyrUp(*src, *dst, dstsize, borderType); + BEGIN_WRAP + cv::pyrUp(*src, *dst, cpp(dstSize), borderType); + END_WRAP } -CVAPI(void) imgproc_undistort(cv::_InputArray *src, cv::_OutputArray *dst, - cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, cv::_InputArray *newCameraMatrix) -{ - cv::undistort(*src, *dst, *cameraMatrix, entity(distCoeffs), entity(newCameraMatrix)); -} -CVAPI(void) imgproc_initUndistortRectifyMap(cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, - cv::_InputArray *r, cv::_InputArray *newCameraMatrix, CvSize size, int m1type, - cv::_OutputArray *map1, cv::_OutputArray *map2) -{ - cv::initUndistortRectifyMap(*cameraMatrix, *distCoeffs, *r, *newCameraMatrix, size, m1type, *map1, *map2); -} -CVAPI(float) imgproc_initWideAngleProjMap(cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, - CvSize imageSize, int destImageWidth, int m1type, cv::_OutputArray *map1, cv::_OutputArray *map2, int projType, double alpha) -{ - return cv::initWideAngleProjMap(*cameraMatrix, *distCoeffs, imageSize, destImageWidth, m1type, *map1, *map2, projType, alpha); -} -CVAPI(cv::Mat*) imgproc_getDefaultNewCameraMatrix(cv::_InputArray *cameraMatrix, CvSize imgSize, int centerPrincipalPoint) -{ - cv::Mat ret = cv::getDefaultNewCameraMatrix(*cameraMatrix, imgSize, centerPrincipalPoint != 0); - return new cv::Mat(ret); -} -CVAPI(void) imgproc_undistortPoints(cv::_InputArray *src, cv::_OutputArray *dst, - cv::_InputArray *cameraMatrix, cv::_InputArray *distCoeffs, - cv::_InputArray *R, cv::_InputArray *P) +CVAPI(ExceptionStatus) imgproc_buildPyramid(cv::_InputArray *src, std::vector *dst,int maxlevel, int borderType) { - cv::undistortPoints(*src, *dst, *cameraMatrix, entity(distCoeffs), entity(R), entity(P)); + BEGIN_WRAP + cv::buildPyramid(*src, *dst, maxlevel, borderType); + END_WRAP } -CVAPI(void) imgproc_calcHist1(cv::Mat **images, int nimages, - const int* channels, cv::_InputArray *mask, - cv::_OutputArray *hist, int dims, const int* histSize, - const float** ranges, int uniform, int accumulate) + +CVAPI(ExceptionStatus) imgproc_calcHist(cv::Mat **images, int nimages, + const int* channels, cv::_InputArray *mask, + cv::_OutputArray *hist, int dims, const int* histSize, + const float** ranges, int uniform, int accumulate) { + BEGIN_WRAP std::vector imagesVec(nimages); - for (int i = 0; i < nimages; i++) + for (auto i = 0; i < nimages; i++) imagesVec[i] = *(images[i]); cv::calcHist(&imagesVec[0], nimages, channels, entity(mask), *hist, dims, histSize, ranges, uniform != 0, accumulate != 0); + END_WRAP } -CVAPI(void) imgproc_calcBackProject(cv::Mat **images, int nimages, - const int* channels, cv::_InputArray *hist, cv::_OutputArray *backProject, - const float** ranges, int uniform) +CVAPI(ExceptionStatus) imgproc_calcBackProject(cv::Mat **images, int nimages, + const int* channels, cv::_InputArray *hist, cv::_OutputArray *backProject, + const float** ranges, int uniform) { + BEGIN_WRAP std::vector imagesVec(nimages); - for (int i = 0; i < nimages; i++) + for (auto i = 0; i < nimages; i++) imagesVec[i] = *(images[i]); cv::calcBackProject(&imagesVec[0], nimages, channels, *hist, *backProject, ranges, uniform != 0); + END_WRAP } -CVAPI(double) imgproc_compareHist1(cv::_InputArray *h1, cv::_InputArray *h2, int method) +CVAPI(ExceptionStatus) imgproc_compareHist(cv::_InputArray *h1, cv::_InputArray *h2, int method, double *returnValue) { - return cv::compareHist(*h1, *h2, method); + BEGIN_WRAP + *returnValue = cv::compareHist(*h1, *h2, method); + END_WRAP } -CVAPI(void) imgproc_equalizeHist(cv::_InputArray *src, cv::_OutputArray *dst) + +CVAPI(ExceptionStatus) imgproc_equalizeHist(cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP cv::equalizeHist(*src, *dst); + END_WRAP } -CVAPI(float) imgproc_EMD(cv::_InputArray *signature1, cv::_InputArray *signature2, - int distType, cv::_InputArray *cost, float* lowerBound, cv::_OutputArray *flow) +CVAPI(ExceptionStatus) imgproc_EMD(cv::_InputArray *signature1, cv::_InputArray *signature2, + int distType, cv::_InputArray *cost, float* lowerBound, cv::_OutputArray *flow, float* returnValue) { - return cv::EMD(*signature1, *signature2, distType, entity(cost), lowerBound, entity(flow)); + BEGIN_WRAP + *returnValue = cv::EMD(*signature1, *signature2, distType, entity(cost), lowerBound, entity(flow)); + END_WRAP } -CVAPI(void) imgproc_watershed(cv::_InputArray *image, cv::_InputOutputArray *markers) + +CVAPI(ExceptionStatus) imgproc_watershed(cv::_InputArray *image, cv::_InputOutputArray *markers) { + BEGIN_WRAP cv::watershed(*image, *markers); + END_WRAP } -CVAPI(void) imgproc_pyrMeanShiftFiltering(cv::_InputArray *src, cv::_InputOutputArray *dst, - double sp, double sr, int maxLevel, CvTermCriteria termcrit) +CVAPI(ExceptionStatus) imgproc_pyrMeanShiftFiltering(cv::_InputArray *src, cv::_InputOutputArray *dst, + double sp, double sr, int maxLevel, MyCvTermCriteria termCrit) { - cv::pyrMeanShiftFiltering(*src, *dst, sp, sr, maxLevel, termcrit); + BEGIN_WRAP + cv::pyrMeanShiftFiltering(*src, *dst, sp, sr, maxLevel, cpp(termCrit)); + END_WRAP } -CVAPI(void) imgproc_grabCut(cv::_InputArray *img, cv::_InputOutputArray *mask, CvRect rect, - cv::_InputOutputArray *bgdModel, cv::_InputOutputArray *fgdModel, - int iterCount, int mode ) +CVAPI(ExceptionStatus) imgproc_grabCut(cv::_InputArray *img, cv::_InputOutputArray *mask, CvRect rect, + cv::_InputOutputArray *bgdModel, cv::_InputOutputArray *fgdModel, + int iterCount, int mode) { + BEGIN_WRAP cv::grabCut(*img, *mask, rect, *bgdModel, *fgdModel, iterCount, mode); + END_WRAP } -CVAPI(void) imgproc_distanceTransformWithLabels(cv::_InputArray *src, cv::_OutputArray *dst, - cv::_OutputArray *labels, int distanceType, int maskSize, - int labelType) +CVAPI(ExceptionStatus) imgproc_distanceTransformWithLabels(cv::_InputArray *src, cv::_OutputArray *dst, + cv::_OutputArray *labels, int distanceType, int maskSize, + int labelType) { + BEGIN_WRAP cv::distanceTransform(*src, *dst, *labels, distanceType, maskSize, labelType); + END_WRAP } -CVAPI(void) imgproc_distanceTransform(cv::_InputArray *src, cv::_OutputArray *dst, - int distanceType, int maskSize ) +CVAPI(ExceptionStatus) imgproc_distanceTransform(cv::_InputArray *src, cv::_OutputArray *dst, + int distanceType, int maskSize, int dstType) { - cv::distanceTransform(*src, *dst, distanceType, maskSize); + BEGIN_WRAP + cv::distanceTransform(*src, *dst, distanceType, maskSize, dstType); + END_WRAP } -CVAPI(int) imgproc_floodFill1(cv::_InputOutputArray *image, - MyCvPoint seedPoint, MyCvScalar newVal, MyCvRect *rect, - MyCvScalar loDiff, MyCvScalar upDiff, int flags) +CVAPI(ExceptionStatus) imgproc_floodFill1(cv::_InputOutputArray *image, + MyCvPoint seedPoint, MyCvScalar newVal, MyCvRect *rect, + MyCvScalar loDiff, MyCvScalar upDiff, int flags, int *returnValue) { + BEGIN_WRAP cv::Rect rect0; - int ret = cv::floodFill(*image, cpp(seedPoint), cpp(newVal), &rect0, cpp(loDiff), cpp(upDiff), flags); + *returnValue = cv::floodFill(*image, cpp(seedPoint), cpp(newVal), &rect0, cpp(loDiff), cpp(upDiff), flags); *rect = c(rect0); - return ret; + END_WRAP } -CVAPI(int) imgproc_floodFill2(cv::_InputOutputArray *image, cv::_InputOutputArray *mask, - MyCvPoint seedPoint, MyCvScalar newVal, MyCvRect *rect, - MyCvScalar loDiff, MyCvScalar upDiff, int flags) +CVAPI(ExceptionStatus) imgproc_floodFill2(cv::_InputOutputArray *image, cv::_InputOutputArray *mask, + MyCvPoint seedPoint, MyCvScalar newVal, MyCvRect *rect, + MyCvScalar loDiff, MyCvScalar upDiff, int flags, int* returnValue) { + BEGIN_WRAP cv::Rect rect0; - int ret = cv::floodFill(*image, *mask, cpp(seedPoint), cpp(newVal), &rect0, cpp(loDiff), cpp(upDiff), flags); + *returnValue = cv::floodFill(*image, *mask, cpp(seedPoint), cpp(newVal), &rect0, cpp(loDiff), cpp(upDiff), flags); *rect = c(rect0); - return ret; + END_WRAP } -CVAPI(void) imgproc_cvtColor(cv::_InputArray *src, cv::_OutputArray *dst, int code, int dstCn) +CVAPI(ExceptionStatus) imgproc_blendLinear( + cv::_InputArray* src1, cv::_InputArray* src2, cv::_InputArray* weights1, cv::_InputArray* weights2, cv::_OutputArray* dst) { - cv::cvtColor(*src, *dst, code, dstCn); + BEGIN_WRAP + cv::blendLinear(*src1, *src2, *weights1, *weights2, *dst); + END_WRAP } -CVAPI(MyCvMoments) imgproc_moments(cv::_InputArray *arr, int binaryImage ) +CVAPI(ExceptionStatus) imgproc_cvtColor(cv::_InputArray *src, cv::_OutputArray *dst, int code, int dstCn) { - cv::Moments m = cv::moments(*arr, binaryImage != 0); - return c(m); + BEGIN_WRAP + cv::cvtColor(*src, *dst, code, dstCn); + END_WRAP } +CVAPI(ExceptionStatus) imgproc_cvtColorTwoPlane(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst, int code) +{ + BEGIN_WRAP + cv::cvtColorTwoPlane(*src1, *src2, *dst, code); + END_WRAP +} -CVAPI(void) imgproc_matchTemplate(cv::_InputArray *image, cv::_InputArray *templ, - cv::_OutputArray *result, int method, cv::_InputArray *mask) +CVAPI(ExceptionStatus) imgproc_demosaicing(cv::_InputArray *src, cv::_OutputArray *dst, int code, int dstCn) +{ + BEGIN_WRAP + cv::demosaicing(*src, *dst, code, dstCn); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_moments(cv::_InputArray *arr, int binaryImage, MyCvMoments *returnValue) +{ + BEGIN_WRAP + const auto m = cv::moments(*arr, binaryImage != 0); + *returnValue = c(m); + END_WRAP +} +/* +CVAPI(ExceptionStatus) imgproc_HuMoments(MyCvMoments *moments, double hu[7]) +{ + BEGIN_WRAP + cv::HuMoments(cpp(*moments), hu); + END_WRAP +} +*/ +CVAPI(ExceptionStatus) imgproc_matchTemplate(cv::_InputArray *image, cv::_InputArray *templ, + cv::_OutputArray *result, int method, cv::_InputArray *mask) { + BEGIN_WRAP cv::matchTemplate(*image, *templ, *result, method, entity(mask)); + END_WRAP } -CVAPI(int) imgproc_connectedComponents(cv::_InputArray *image, cv::_OutputArray *labels, - int connectivity, int ltype) +CVAPI(ExceptionStatus) imgproc_connectedComponentsWithAlgorithm( + cv::_InputArray *image, cv::_OutputArray *labels, int connectivity, int ltype, int ccltype, int* returnValue) { - return cv::connectedComponents(entity(image), entity(labels), connectivity, ltype); + BEGIN_WRAP + *returnValue = cv::connectedComponents(entity(image), entity(labels), connectivity, ltype, ccltype); + END_WRAP } -CVAPI(int) imgproc_connectedComponentsWithStats(cv::_InputArray *image, cv::_OutputArray *labels, - cv::_OutputArray *stats, cv::_OutputArray *centroids, int connectivity, int ltype) +CVAPI(ExceptionStatus) imgproc_connectedComponents(cv::_InputArray *image, cv::_OutputArray *labels, + int connectivity, int ltype, int *returnValue) { - return cv::connectedComponentsWithStats(entity(image), entity(labels), entity(stats), entity(centroids), connectivity, ltype); + BEGIN_WRAP + *returnValue = cv::connectedComponents(entity(image), entity(labels), connectivity, ltype); + END_WRAP } -CVAPI(void) imgproc_findContours1_vector(cv::_InputOutputArray *image, std::vector > **contours, - std::vector **hierarchy, int mode, int method, MyCvPoint offset) +CVAPI(ExceptionStatus) imgproc_connectedComponentsWithStatsWithAlgorithm( + cv::_InputArray *image, cv::_OutputArray *labels, + cv::_OutputArray *stats, cv::_OutputArray *centroids, + int connectivity, int ltype, int ccltype, int* returnValue) { - *contours = new std::vector >; - *hierarchy = new std::vector; - cv::findContours(*image, **contours, **hierarchy, mode, method, cpp(offset)); + BEGIN_WRAP + *returnValue = cv::connectedComponentsWithStats( + entity(image), entity(labels), entity(stats), entity(centroids), connectivity, ltype, ccltype); + END_WRAP } -CVAPI(void) imgproc_findContours1_OutputArray(cv::_InputOutputArray *image, std::vector **contours, - cv::_OutputArray *hierarchy, int mode, int method, CvPoint offset) + +CVAPI(ExceptionStatus) imgproc_connectedComponentsWithStats(cv::_InputArray *image, cv::_OutputArray *labels, + cv::_OutputArray *stats, cv::_OutputArray *centroids, int connectivity, int ltype, int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::connectedComponentsWithStats( + entity(image), entity(labels), entity(stats), entity(centroids), connectivity, ltype); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_findContours1_vector(cv::_InputArray *image, std::vector > *contours, + std::vector *hierarchy, int mode, int method, MyCvPoint offset) { - *contours = new std::vector; - cv::findContours(*image, **contours, *hierarchy, mode, method, offset); + BEGIN_WRAP + cv::findContours(*image, *contours, *hierarchy, mode, method, cpp(offset)); + END_WRAP } -CVAPI(void) imgproc_findContours2_vector(cv::_InputOutputArray *image, std::vector > **contours, - int mode, int method, CvPoint offset) +CVAPI(ExceptionStatus) imgproc_findContours1_OutputArray(cv::_InputArray *image, std::vector *contours, + cv::_OutputArray *hierarchy, int mode, int method, MyCvPoint offset) { - *contours = new std::vector >; - cv::findContours(*image, **contours, mode, method, offset); + BEGIN_WRAP + cv::findContours(*image, *contours, *hierarchy, mode, method, cpp(offset)); + END_WRAP } -CVAPI(void) imgproc_findContours2_OutputArray(cv::_InputOutputArray *image, std::vector **contours, - int mode, int method, CvPoint offset) +CVAPI(ExceptionStatus) imgproc_findContours2_vector(cv::_InputArray *image, std::vector > *contours, + int mode, int method, MyCvPoint offset) { - *contours = new std::vector; - cv::findContours(*image, **contours, mode, method, offset); + BEGIN_WRAP + cv::findContours(*image, *contours, mode, method, cpp(offset)); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_findContours2_OutputArray(cv::_InputArray *image, std::vector *contours, + int mode, int method, MyCvPoint offset) +{ + BEGIN_WRAP + cv::findContours(*image, *contours, mode, method, cpp(offset)); + END_WRAP } -CVAPI(void) imgproc_approxPolyDP_InputArray(cv::_InputArray *curve, cv::_OutputArray *approxCurve, double epsilon, int closed) +CVAPI(ExceptionStatus) imgproc_approxPolyDP_InputArray(cv::_InputArray *curve, cv::_OutputArray *approxCurve, double epsilon, int closed) { + BEGIN_WRAP cv::approxPolyDP(*curve, *approxCurve, epsilon, closed != 0); + END_WRAP } -CVAPI(void) imgproc_approxPolyDP_Point(cv::Point *curve, int curveLength, std::vector **approxCurve, double epsilon, int closed) +CVAPI(ExceptionStatus) imgproc_approxPolyDP_Point(cv::Point *curve, int curveLength, std::vector *approxCurve, double epsilon, int closed) { - cv::Mat_ curveMat(curveLength, 1, curve); - *approxCurve = new std::vector; - cv::approxPolyDP(curveMat, **approxCurve, epsilon, closed != 0); + BEGIN_WRAP + const cv::Mat_ curveMat(curveLength, 1, curve); + cv::approxPolyDP(curveMat, *approxCurve, epsilon, closed != 0); + END_WRAP } -CVAPI(void) imgproc_approxPolyDP_Point2f(cv::Point2f *curve, int curveLength, std::vector **approxCurve, double epsilon, int closed) +CVAPI(ExceptionStatus) imgproc_approxPolyDP_Point2f(cv::Point2f *curve, int curveLength, std::vector *approxCurve, double epsilon, int closed) { - cv::Mat_ curveMat(curveLength, 1, curve); - *approxCurve = new std::vector; - cv::approxPolyDP(curveMat, **approxCurve, epsilon, closed != 0); + BEGIN_WRAP + const cv::Mat_ curveMat(curveLength, 1, curve); + cv::approxPolyDP(curveMat, *approxCurve, epsilon, closed != 0); + END_WRAP } -CVAPI(double) imgproc_arcLength_InputArray(cv::_InputArray *curve, int closed) +CVAPI(ExceptionStatus) imgproc_arcLength_InputArray(cv::_InputArray *curve, int closed, double *returnValue) { - return cv::arcLength(*curve, closed != 0); + BEGIN_WRAP + *returnValue = cv::arcLength(*curve, closed != 0); + END_WRAP } -CVAPI(double) imgproc_arcLength_Point(cv::Point *curve, int curveLength, int closed) +CVAPI(ExceptionStatus) imgproc_arcLength_Point(cv::Point *curve, int curveLength, int closed, double* returnValue) { - cv::Mat_ curveMat(curveLength, 1, curve); - return cv::arcLength(curveMat, closed != 0); + BEGIN_WRAP + const cv::Mat_ curveMat(curveLength, 1, curve); + *returnValue = cv::arcLength(curveMat, closed != 0); + END_WRAP } -CVAPI(double) imgproc_arcLength_Point2f(cv::Point2f *curve, int curveLength, int closed) +CVAPI(ExceptionStatus) imgproc_arcLength_Point2f(cv::Point2f *curve, int curveLength, int closed, double* returnValue) { - cv::Mat_ curveMat(curveLength, 1, curve); - return cv::arcLength(curveMat, closed != 0); + BEGIN_WRAP + const cv::Mat_ curveMat(curveLength, 1, curve); + *returnValue = cv::arcLength(curveMat, closed != 0); + END_WRAP } -CVAPI(MyCvRect) imgproc_boundingRect_InputArray(cv::_InputArray *curve) +CVAPI(ExceptionStatus) imgproc_boundingRect_InputArray(cv::_InputArray *curve, MyCvRect* returnValue) { - return c(cv::boundingRect(*curve)); + BEGIN_WRAP + *returnValue = c(cv::boundingRect(*curve)); + END_WRAP } -CVAPI(MyCvRect) imgproc_boundingRect_Point(cv::Point *curve, int curveLength) +CVAPI(ExceptionStatus) imgproc_boundingRect_Point(cv::Point *curve, int curveLength, MyCvRect* returnValue) { - cv::Mat_ curveMat(curveLength, 1, curve); - return c(cv::boundingRect(curveMat)); + BEGIN_WRAP + const cv::Mat_ curveMat(curveLength, 1, curve); + *returnValue = c(cv::boundingRect(curveMat)); + END_WRAP } -CVAPI(MyCvRect) imgproc_boundingRect_Point2f(cv::Point2f *curve, int curveLength) +CVAPI(ExceptionStatus) imgproc_boundingRect_Point2f(cv::Point2f *curve, int curveLength, MyCvRect* returnValue) { - cv::Mat_ curveMat(curveLength, 1, curve); - return c(cv::boundingRect(curveMat)); + BEGIN_WRAP + const cv::Mat_ curveMat(curveLength, 1, curve); + *returnValue = c(cv::boundingRect(curveMat)); + END_WRAP } -CVAPI(double) imgproc_contourArea_InputArray(cv::_InputArray *contour, int oriented) +CVAPI(ExceptionStatus) imgproc_contourArea_InputArray(cv::_InputArray *contour, int oriented, double* returnValue) { - return cv::contourArea(*contour, oriented != 0); + BEGIN_WRAP + *returnValue = cv::contourArea(*contour, oriented != 0); + END_WRAP } -CVAPI(double) imgproc_contourArea_Point(cv::Point *contour, int contourLength, int oriented) +CVAPI(ExceptionStatus) imgproc_contourArea_Point(cv::Point *contour, int contourLength, int oriented, double* returnValue) { - cv::Mat_ contourMat(contourLength, 1, contour); - return cv::contourArea(contourMat, oriented != 0); + BEGIN_WRAP + const cv::Mat_ contourMat(contourLength, 1, contour); + *returnValue = cv::contourArea(contourMat, oriented != 0); + END_WRAP } -CVAPI(double) imgproc_contourArea_Point2f(cv::Point2f *contour, int contourLength, int oriented) +CVAPI(ExceptionStatus) imgproc_contourArea_Point2f(cv::Point2f *contour, int contourLength, int oriented, double* returnValue) { - cv::Mat_ contourMat(contourLength, 1, contour); - return cv::contourArea(contourMat, oriented != 0); + BEGIN_WRAP + const cv::Mat_ contourMat(contourLength, 1, contour); + *returnValue = cv::contourArea(contourMat, oriented != 0); + END_WRAP } -CVAPI(MyCvBox2D) imgproc_minAreaRect_InputArray(cv::_InputArray *points) +CVAPI(ExceptionStatus) imgproc_minAreaRect_InputArray(cv::_InputArray *points, MyCvBox2D* returnValue) +{ + BEGIN_WRAP + *returnValue = c(cv::minAreaRect(*points)); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_minAreaRect_Point(cv::Point *points, int pointsLength, MyCvBox2D* returnValue) +{ + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + *returnValue = c(cv::minAreaRect(pointsMat)); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_minAreaRect_Point2f(cv::Point2f *points, int pointsLength, MyCvBox2D* returnValue) { - return c(cv::minAreaRect(*points)); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + *returnValue = c(cv::minAreaRect(pointsMat)); + END_WRAP } -CVAPI(MyCvBox2D) imgproc_minAreaRect_Point(cv::Point *points, int pointsLength) + +CVAPI(ExceptionStatus) imgproc_boxPoints_OutputArray(MyCvBox2D box, cv::_OutputArray* points) { - cv::Mat_ pointsMat(pointsLength, 1, points); - return c(cv::minAreaRect(pointsMat)); + BEGIN_WRAP + cv::boxPoints(cpp(box), *points); + END_WRAP } -CVAPI(MyCvBox2D) imgproc_minAreaRect_Point2f(cv::Point2f *points, int pointsLength) +CVAPI(ExceptionStatus) imgproc_boxPoints_Point2f(MyCvBox2D box, cv::Point2f points[4]) { - cv::Mat_ pointsMat(pointsLength, 1, points); - return c(cv::minAreaRect(pointsMat)); + BEGIN_WRAP + cpp(box).points(points); + END_WRAP } -CVAPI(void) imgproc_minEnclosingCircle_InputArray(cv::_InputArray *points, cv::Point2f *center, float *radius) +CVAPI(ExceptionStatus) imgproc_minEnclosingCircle_InputArray(cv::_InputArray *points, MyCvPoint2D32f *center, float *radius) { + BEGIN_WRAP cv::Point2f center0; float radius0; cv::minEnclosingCircle(*points, center0, radius0); - *center = center0; + *center = c(center0); *radius = radius0; + END_WRAP } -CVAPI(void) imgproc_minEnclosingCircle_Point(cv::Point *points, int pointsLength, cv::Point2f *center, float *radius) +CVAPI(ExceptionStatus) imgproc_minEnclosingCircle_Point(cv::Point *points, int pointsLength, MyCvPoint2D32f*center, float *radius) { - cv::Mat_ pointsMat(pointsLength, 1, points); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); cv::Point2f center0; float radius0; cv::minEnclosingCircle(pointsMat, center0, radius0); - *center = center0; + *center = c(center0); *radius = radius0; + END_WRAP } -CVAPI(void) imgproc_minEnclosingCircle_Point2f(cv::Point2f *points, int pointsLength, cv::Point2f *center, float *radius) +CVAPI(ExceptionStatus) imgproc_minEnclosingCircle_Point2f(cv::Point2f *points, int pointsLength, MyCvPoint2D32f*center, float *radius) { - cv::Mat_ pointsMat(pointsLength, 1, points); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); cv::Point2f center0; float radius0; cv::minEnclosingCircle(pointsMat, center0, radius0); - *center = center0; + *center = c(center0); *radius = radius0; + END_WRAP } -CVAPI(double) imgproc_matchShapes_InputArray(cv::_InputArray *contour1, cv::_InputArray *contour2, int method, double parameter) +CVAPI(ExceptionStatus) imgproc_minEnclosingTriangle_InputOutputArray(cv::_InputArray *points, cv::_OutputArray *triangle, double *returnValue) { - return cv::matchShapes(*contour1, *contour2, method, parameter); + BEGIN_WRAP + *returnValue = cv::minEnclosingTriangle(*points, *triangle); + END_WRAP } -CVAPI(double) imgproc_matchShapes_Point(cv::Point *contour1, int contour1Length, cv::Point *contour2, int contour2Length, - int method, double parameter) +CVAPI(ExceptionStatus) imgproc_minEnclosingTriangle_Point(cv::Point* points, int pointsLength, std::vector* triangle, double* returnValue) { - cv::Mat_ contour1Mat(contour1Length, 1, contour1); - cv::Mat_ contour2Mat(contour2Length, 1, contour2); - return cv::matchShapes(contour1Mat, contour2Mat, method, parameter); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + *returnValue = cv::minEnclosingTriangle(pointsMat, *triangle); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_minEnclosingTriangle_Point2f(cv::Point2f* points, int pointsLength, std::vector* triangle, double* returnValue) +{ + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + *returnValue = cv::minEnclosingTriangle(pointsMat, *triangle); + END_WRAP } -CVAPI(void) imgproc_convexHull_InputArray(cv::_InputArray *points, cv::_OutputArray *hull, int clockwise, int returnPoints) +CVAPI(ExceptionStatus) imgproc_matchShapes_InputArray( + cv::_InputArray *contour1, cv::_InputArray *contour2, int method, double parameter, double* returnValue) { + BEGIN_WRAP + *returnValue = cv::matchShapes(*contour1, *contour2, method, parameter); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_matchShapes_Point( + cv::Point *contour1, int contour1Length, cv::Point *contour2, int contour2Length, int method, double parameter, double* returnValue) +{ + BEGIN_WRAP + const cv::Mat_ contour1Mat(contour1Length, 1, contour1); + const cv::Mat_ contour2Mat(contour2Length, 1, contour2); + *returnValue = cv::matchShapes(contour1Mat, contour2Mat, method, parameter); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_convexHull_InputArray(cv::_InputArray *points, cv::_OutputArray *hull, int clockwise, int returnPoints) +{ + BEGIN_WRAP cv::convexHull(*points, *hull, clockwise != 0, returnPoints != 0); + END_WRAP } -CVAPI(void) imgproc_convexHull_Point_ReturnsPoints(cv::Point *points, int pointsLength, std::vector **hull, int clockwise) +CVAPI(ExceptionStatus) imgproc_convexHull_Point_ReturnsPoints(cv::Point *points, int pointsLength, std::vector *hull, int clockwise) { - cv::Mat_ pointsMat(pointsLength, 1, points); - *hull = new std::vector; - cv::convexHull(pointsMat, **hull, clockwise != 0, true); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + cv::convexHull(pointsMat, *hull, clockwise != 0, true); + END_WRAP } -CVAPI(void) imgproc_convexHull_Point2f_ReturnsPoints(cv::Point2f *points, int pointsLength, std::vector **hull, int clockwise) +CVAPI(ExceptionStatus) imgproc_convexHull_Point2f_ReturnsPoints(cv::Point2f *points, int pointsLength, std::vector *hull, int clockwise) { - cv::Mat_ pointsMat(pointsLength, 1, points); - *hull = new std::vector; - cv::convexHull(pointsMat, **hull, clockwise != 0, true); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + cv::convexHull(pointsMat, *hull, clockwise != 0, true); + END_WRAP } -CVAPI(void) imgproc_convexHull_Point_ReturnsIndices(cv::Point *points, int pointsLength, std::vector **hull, int clockwise) +CVAPI(ExceptionStatus) imgproc_convexHull_Point_ReturnsIndices(cv::Point *points, int pointsLength, std::vector *hull, int clockwise) { - cv::Mat_ pointsMat(pointsLength, 1, points); - *hull = new std::vector; - cv::convexHull(pointsMat, **hull, clockwise != 0, false); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + cv::convexHull(pointsMat, *hull, clockwise != 0, false); + END_WRAP } -CVAPI(void) imgproc_convexHull_Point2f_ReturnsIndices(cv::Point2f *points, int pointsLength, std::vector **hull, int clockwise) +CVAPI(ExceptionStatus) imgproc_convexHull_Point2f_ReturnsIndices(cv::Point2f *points, int pointsLength, std::vector *hull, int clockwise) { - cv::Mat_ pointsMat(pointsLength, 1, points); - *hull = new std::vector; - cv::convexHull(pointsMat, **hull, clockwise != 0, false); + BEGIN_WRAP + const cv::Mat_ pointsMat(pointsLength, 1, points); + cv::convexHull(pointsMat, *hull, clockwise != 0, false); + END_WRAP } -CVAPI(void) imgproc_convexityDefects_InputArray(cv::_InputArray *contour, cv::_InputArray *convexHull, - cv::_OutputArray *convexityDefects) +CVAPI(ExceptionStatus) imgproc_convexityDefects_InputArray(cv::_InputArray *contour, cv::_InputArray *convexHull, + cv::_OutputArray *convexityDefects) { + BEGIN_WRAP cv::convexityDefects(*contour, *convexHull, *convexityDefects); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_convexityDefects_Point(cv::Point *contour, int contourLength, int *convexHull, int convexHullLength, + std::vector *convexityDefects) +{ + BEGIN_WRAP + const cv::Mat_ contourMat(contourLength, 1, contour); + const cv::Mat_ convexHullMat(convexHullLength, 1, convexHull); + cv::convexityDefects(contourMat, convexHullMat, *convexityDefects); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_convexityDefects_Point2f(cv::Point2f *contour, int contourLength, int *convexHull, int convexHullLength, + std::vector *convexityDefects) +{ + BEGIN_WRAP + const cv::Mat_ contourMat(contourLength, 1, contour); + const cv::Mat_ convexHullMat(convexHullLength, 1, convexHull); + cv::convexityDefects(contourMat, convexHullMat, *convexityDefects); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_isContourConvex_InputArray(cv::_InputArray *contour, int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::isContourConvex(*contour) ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_isContourConvex_Point(cv::Point *contour, int contourLength, int* returnValue) +{ + BEGIN_WRAP + const cv::Mat_ contourMat(contourLength, 1, contour); + *returnValue = cv::isContourConvex(contourMat) ? 1 : 0; + END_WRAP } -CVAPI(void) imgproc_convexityDefects_Point(cv::Point *contour, int contourLength, int *convexHull, int convexHullLength, - std::vector **convexityDefects) +CVAPI(ExceptionStatus) imgproc_isContourConvex_Point2f(cv::Point2f *contour, int contourLength, int* returnValue) { - cv::Mat_ contourMat(contourLength, 1, contour); - cv::Mat_ convexHullMat(convexHullLength, 1, convexHull); - *convexityDefects = new std::vector; - cv::convexityDefects(contourMat, convexHullMat, **convexityDefects); + BEGIN_WRAP + const cv::Mat_ contourMat(contourLength, 1, contour); + *returnValue = cv::isContourConvex(contourMat) ? 1 : 0; + END_WRAP } -CVAPI(void) imgproc_convexityDefects_Point2f(cv::Point2f *contour, int contourLength, int *convexHull, int convexHullLength, - std::vector **convexityDefects) + +CVAPI(ExceptionStatus) imgproc_intersectConvexConvex_InputArray(cv::_InputArray *p1, cv::_InputArray *p2, + cv::_OutputArray *p12, int handleNested, float* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::intersectConvexConvex(*p1, *p2, *p12, handleNested != 0); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_intersectConvexConvex_Point(cv::Point *p1, int p1Length, cv::Point *p2, int p2Length, + std::vector *p12, int handleNested, float* returnValue) { - cv::Mat_ contourMat(contourLength, 1, contour); - cv::Mat_ convexHullMat(convexHullLength, 1, convexHull); - *convexityDefects = new std::vector; - cv::convexityDefects(contourMat, convexHullMat, **convexityDefects); + BEGIN_WRAP + const cv::Mat_ p1Vec(p1Length, 1, p1); + const cv::Mat_ p2Vec(p2Length, 1, p2); + *returnValue = cv::intersectConvexConvex(p1Vec, p2Vec, *p12, handleNested != 0); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_intersectConvexConvex_Point2f(cv::Point2f *p1, int p1Length, cv::Point2f *p2, int p2Length, + std::vector *p12, int handleNested, float *returnValue) +{ + BEGIN_WRAP + const cv::Mat_ p1Vec(p1Length, 1, p1); + const cv::Mat_ p2Vec(p2Length, 1, p2); + *returnValue = cv::intersectConvexConvex(p1Vec, p2Vec, *p12, handleNested != 0); + END_WRAP } -CVAPI(int) imgproc_isContourConvex_InputArray(cv::_InputArray *contour) +CVAPI(ExceptionStatus) imgproc_fitEllipse_InputArray(cv::_InputArray *points, MyCvBox2D* returnValue) { - return cv::isContourConvex(*contour) ? 1 : 0; + BEGIN_WRAP + *returnValue = c(cv::fitEllipse(*points)); + END_WRAP } -CVAPI(int) imgproc_isContourConvex_Point(cv::Point *contour, int contourLength) +CVAPI(ExceptionStatus) imgproc_fitEllipse_Point(cv::Point *points, int pointsLength, MyCvBox2D* returnValue) { - cv::Mat_ contourMat(contourLength, 1, contour); - return cv::isContourConvex(contourMat) ? 1 : 0; + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); + *returnValue = c(cv::fitEllipse(pointsVec)); + END_WRAP } -CVAPI(int) imgproc_isContourConvex_Point2f(cv::Point2f *contour, int contourLength) +CVAPI(ExceptionStatus) imgproc_fitEllipse_Point2f(cv::Point2f *points, int pointsLength, MyCvBox2D* returnValue) { - cv::Mat_ contourMat(contourLength, 1, contour); - return cv::isContourConvex(contourMat) ? 1 : 0; + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); + *returnValue = c(cv::fitEllipse(pointsVec)); + END_WRAP } -CVAPI(float) imgproc_intersectConvexConvex_InputArray(cv::_InputArray *p1, cv::_InputArray *p2, - cv::_OutputArray *p12, int handleNested) +CVAPI(ExceptionStatus) imgproc_fitEllipseAMS_InputArray(cv::_InputArray *points, MyCvBox2D* returnValue) { - return cv::intersectConvexConvex(*p1, *p2, *p12, handleNested != 0); + BEGIN_WRAP + *returnValue = c(cv::fitEllipseAMS(*points)); + END_WRAP } -CVAPI(float) imgproc_intersectConvexConvex_Point(cv::Point *p1, int p1Length, cv::Point *p2, int p2Length, - std::vector **p12, int handleNested) +CVAPI(ExceptionStatus) imgproc_fitEllipseAMS_Point(cv::Point* points, int pointsLength, MyCvBox2D* returnValue) { - cv::Mat_ p1Vec(p1Length, 1, p1); - cv::Mat_ p2Vec(p2Length, 1, p2); - *p12 = new std::vector; - return cv::intersectConvexConvex(p1Vec, p2Vec, **p12, handleNested != 0); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); + *returnValue = c(cv::fitEllipseAMS(pointsVec)); + END_WRAP } -CVAPI(float) imgproc_intersectConvexConvex_Point2f(cv::Point2f *p1, int p1Length, cv::Point2f *p2, int p2Length, - std::vector **p12, int handleNested) +CVAPI(ExceptionStatus) imgproc_fitEllipseAMS_Point2f(cv::Point2f* points, int pointsLength, MyCvBox2D* returnValue) { - cv::Mat_ p1Vec(p1Length, 1, p1); - cv::Mat_ p2Vec(p2Length, 1, p2); - *p12 = new std::vector; - return cv::intersectConvexConvex(p1Vec, p2Vec, **p12, handleNested != 0); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); + *returnValue = c(cv::fitEllipseAMS(pointsVec)); + END_WRAP } -CVAPI(MyCvBox2D) imgproc_fitEllipse_InputArray(cv::_InputArray *points) +CVAPI(ExceptionStatus) imgproc_fitEllipseDirect_InputArray(cv::_InputArray* points, MyCvBox2D* returnValue) { - return c(cv::fitEllipse(*points)); + BEGIN_WRAP + *returnValue = c(cv::fitEllipseDirect(*points)); + END_WRAP } -CVAPI(MyCvBox2D) imgproc_fitEllipse_Point(cv::Point *points, int pointsLength) +CVAPI(ExceptionStatus) imgproc_fitEllipseDirect_Point(cv::Point* points, int pointsLength, MyCvBox2D* returnValue) { - cv::Mat_ pointsVec(pointsLength, 1, points); - return c(cv::fitEllipse(pointsVec)); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); + *returnValue = c(cv::fitEllipseDirect(pointsVec)); + END_WRAP } -CVAPI(MyCvBox2D) imgproc_fitEllipse_Point2f(cv::Point2f *points, int pointsLength) +CVAPI(ExceptionStatus) imgproc_fitEllipseDirect_Point2f(cv::Point2f* points, int pointsLength, MyCvBox2D* returnValue) { - cv::Mat_ pointsVec(pointsLength, 1, points); - return c(cv::fitEllipse(pointsVec)); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); + *returnValue = c(cv::fitEllipseDirect(pointsVec)); + END_WRAP } -CVAPI(void) imgproc_fitLine_InputArray(cv::_InputArray *points, cv::_OutputArray *line, +CVAPI(ExceptionStatus) imgproc_fitLine_InputArray(cv::_InputArray *points, cv::_OutputArray *line, int distType, double param, double reps, double aeps) { + BEGIN_WRAP cv::fitLine(*points, *line, distType, param, reps, aeps); + END_WRAP } -CVAPI(void) imgproc_fitLine_Point(cv::Point *points, int pointsLength, float *line, int distType, - double param, double reps, double aeps) +CVAPI(ExceptionStatus) imgproc_fitLine_Point(cv::Point *points, int pointsLength, float *line, int distType, + double param, double reps, double aeps) { - cv::Mat_ pointsVec(pointsLength, 1, points); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); cv::Mat_ lineVec(4, 1, line); cv::fitLine(pointsVec, lineVec, distType, param, reps, aeps); + END_WRAP } -CVAPI(void) imgproc_fitLine_Point2f(cv::Point2f *points, int pointsLength, float *line, int distType, - double param, double reps, double aeps) +CVAPI(ExceptionStatus) imgproc_fitLine_Point2f(cv::Point2f *points, int pointsLength, float *line, int distType, + double param, double reps, double aeps) { - cv::Mat_ pointsVec(pointsLength, 1, points); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); cv::Mat_ lineVec(4, 1, line); cv::fitLine(pointsVec, lineVec, distType, param, reps, aeps); + END_WRAP } -CVAPI(void) imgproc_fitLine_Point3i(cv::Point3i *points, int pointsLength, float *line, int distType, - double param, double reps, double aeps) +CVAPI(ExceptionStatus) imgproc_fitLine_Point3i(cv::Point3i *points, int pointsLength, float *line, int distType, + double param, double reps, double aeps) { - cv::Mat_ pointsVec(pointsLength, 1, points); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); cv::Mat_ lineVec(6, 1, line); cv::fitLine(pointsVec, lineVec, distType, param, reps, aeps); + END_WRAP } -CVAPI(void) imgproc_fitLine_Point3f(cv::Point3f *points, int pointsLength, float *line, int distType, - double param, double reps, double aeps) +CVAPI(ExceptionStatus) imgproc_fitLine_Point3f(cv::Point3f *points, int pointsLength, float *line, int distType, + double param, double reps, double aeps) { - cv::Mat_ pointsVec(pointsLength, 1, points); + BEGIN_WRAP + const cv::Mat_ pointsVec(pointsLength, 1, points); cv::Mat_ lineVec(6, 1, line); cv::fitLine(pointsVec, lineVec, distType, param, reps, aeps); + END_WRAP } -CVAPI(double) imgproc_pointPolygonTest_InputArray(cv::_InputArray *contour, MyCvPoint2D32f pt, int measureDist) +CVAPI(ExceptionStatus) imgproc_pointPolygonTest_InputArray( + cv::_InputArray* contour, MyCvPoint2D32f pt, int measureDist, double *returnValue) { - return cv::pointPolygonTest(*contour, cpp(pt), measureDist != 0); + BEGIN_WRAP + *returnValue = cv::pointPolygonTest(*contour, cpp(pt), measureDist != 0); + END_WRAP } -CVAPI(double) imgproc_pointPolygonTest_Point(cv::Point *contour, int contourLength, MyCvPoint2D32f pt, int measureDist) +CVAPI(ExceptionStatus) imgproc_pointPolygonTest_Point( + cv::Point *contour, int contourLength, MyCvPoint2D32f pt, int measureDist, double* returnValue) { - cv::Mat_ contourVec(contourLength, 1, contour); - return cv::pointPolygonTest(contourVec, cpp(pt), measureDist != 0); + BEGIN_WRAP + const cv::Mat_ contourVec(contourLength, 1, contour); + *returnValue = cv::pointPolygonTest(contourVec, cpp(pt), measureDist != 0); + END_WRAP } -CVAPI(double) imgproc_pointPolygonTest_Point2f(cv::Point2f *contour, int contourLength, MyCvPoint2D32f pt, int measureDist) +CVAPI(ExceptionStatus) imgproc_pointPolygonTest_Point2f( + cv::Point2f *contour, int contourLength, MyCvPoint2D32f pt, int measureDist, double* returnValue) { - cv::Mat_ contourVec(contourLength, 1, contour); - return cv::pointPolygonTest(contourVec, cpp(pt), measureDist != 0); + BEGIN_WRAP + const cv::Mat_ contourVec(contourLength, 1, contour); + *returnValue = cv::pointPolygonTest(contourVec, cpp(pt), measureDist != 0); + END_WRAP } -CVAPI(int) imgproc_rotatedRectangleIntersection_OutputArray( - MyCvBox2D rect1, MyCvBox2D rect2, cv::_OutputArray *intersectingRegion) +CVAPI(ExceptionStatus) imgproc_rotatedRectangleIntersection_OutputArray( + MyCvBox2D rect1, MyCvBox2D rect2, cv::_OutputArray *intersectingRegion, int* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::rotatedRectangleIntersection(cpp(rect1), cpp(rect2), *intersectingRegion); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_rotatedRectangleIntersection_vector( + MyCvBox2D rect1, MyCvBox2D rect2, std::vector *intersectingRegion, int* returnValue) { - return cv::rotatedRectangleIntersection(cpp(rect1), cpp(rect2), *intersectingRegion); + BEGIN_WRAP + *returnValue = cv::rotatedRectangleIntersection(cpp(rect1), cpp(rect2), *intersectingRegion); + END_WRAP } -CVAPI(int) imgproc_rotatedRectangleIntersection_vector( - MyCvBox2D rect1, MyCvBox2D rect2, std::vector *intersectingRegion) + +CVAPI(ExceptionStatus) imgproc_applyColorMap1(cv::_InputArray *src, cv::_OutputArray *dst, int colorMap) { - return cv::rotatedRectangleIntersection(cpp(rect1), cpp(rect2), *intersectingRegion); + BEGIN_WRAP + cv::applyColorMap(*src, *dst, colorMap); + END_WRAP } -CVAPI(void) imgproc_applyColorMap(cv::_InputArray *src, cv::_OutputArray *dst, int colormap) +CVAPI(ExceptionStatus) imgproc_applyColorMap2(cv::_InputArray *src, cv::_OutputArray *dst, cv::_InputArray *userColor) { - cv::applyColorMap(*src, *dst, colormap); + BEGIN_WRAP + cv::applyColorMap(*src, *dst, *userColor); + END_WRAP } #pragma region Drawing -CVAPI(void) imgproc_line( +CVAPI(ExceptionStatus) imgproc_line( cv::_InputOutputArray *img, MyCvPoint pt1, MyCvPoint pt2, MyCvScalar color, int thickness, int lineType, int shift) { + BEGIN_WRAP cv::line(*img, cpp(pt1), cpp(pt2), cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_arrowedLine( +CVAPI(ExceptionStatus) imgproc_arrowedLine( cv::_InputOutputArray *img, MyCvPoint pt1, MyCvPoint pt2, MyCvScalar color, int thickness, int line_type, int shift, double tipLength) { + BEGIN_WRAP cv::arrowedLine(*img, cpp(pt1), cpp(pt2), cpp(color), thickness, line_type, shift, tipLength); + END_WRAP } -CVAPI(void) imgproc_rectangle_InputOutputArray( + +CVAPI(ExceptionStatus) imgproc_rectangle_InputOutputArray_Point( cv::_InputOutputArray *img, MyCvPoint pt1, MyCvPoint pt2, MyCvScalar color, int thickness, int lineType, int shift) { - cv::rectangle(*img, cpp(pt1), cpp(pt2), cpp(color), thickness, shift); + BEGIN_WRAP + cv::rectangle(*img, cpp(pt1), cpp(pt2), cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_rectangle_Mat( +CVAPI(ExceptionStatus) imgproc_rectangle_InputOutputArray_Rect( + cv::_InputOutputArray* img, MyCvRect rect, + MyCvScalar color, int thickness, int lineType, int shift) +{ + BEGIN_WRAP + cv::rectangle(*img, cpp(rect), cpp(color), thickness, lineType, shift); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_rectangle_Mat_Point( + cv::Mat* img, MyCvPoint pt1, MyCvPoint pt2, + MyCvScalar color, int thickness, int lineType, int shift) +{ + BEGIN_WRAP + cv::rectangle(*img, cpp(pt1), cpp(pt2), cpp(color), thickness, lineType, shift); + END_WRAP +} +CVAPI(ExceptionStatus) imgproc_rectangle_Mat_Rect( cv::Mat *img, MyCvRect rect, MyCvScalar color, int thickness, int lineType, int shift) { - cv::rectangle(*img, cpp(rect), cpp(color), thickness, shift); + BEGIN_WRAP + cv::rectangle(*img, cpp(rect), cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_circle( + +CVAPI(ExceptionStatus) imgproc_circle( cv::_InputOutputArray *img, MyCvPoint center, int radius, MyCvScalar color, int thickness, int lineType, int shift) { + BEGIN_WRAP cv::circle(*img, cpp(center), radius, cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_ellipse1( +CVAPI(ExceptionStatus) imgproc_ellipse1( cv::_InputOutputArray *img, MyCvPoint center, MyCvSize axes, double angle, double startAngle, double endAngle, MyCvScalar color, int thickness, int lineType, int shift) { + BEGIN_WRAP cv::ellipse(*img, cpp(center), cpp(axes), angle, startAngle, endAngle, cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_ellipse2( +CVAPI(ExceptionStatus) imgproc_ellipse2( cv::_InputOutputArray *img, MyCvBox2D box, MyCvScalar color, int thickness, int lineType) { + BEGIN_WRAP cv::ellipse(*img, cpp(box), cpp(color), thickness, lineType); + END_WRAP } -CVAPI(void) imgproc_fillConvexPoly_Mat( - cv::Mat *img, cv::Point *pts, int npts, MyCvScalar color, int lineType, int shift) +CVAPI(ExceptionStatus) imgproc_drawMarker( + cv::_InputOutputArray *img, MyCvPoint position, MyCvScalar color, + int markerType, int markerSize, int thickness, int lineType) { + BEGIN_WRAP + cv::drawMarker(*img, cpp(position), cpp(color), markerType, markerSize, thickness, lineType); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_fillConvexPoly_Mat( + cv::Mat *img, cv::Point *pts, int npts, MyCvScalar color, int lineType, int shift) +{ + BEGIN_WRAP cv::fillConvexPoly(*img, pts, npts, cpp(color), lineType, shift); + END_WRAP } -CVAPI(void) imgproc_fillConvexPoly_InputOutputArray( +CVAPI(ExceptionStatus) imgproc_fillConvexPoly_InputOutputArray( cv::_InputOutputArray *img, cv::_InputArray *points, MyCvScalar color, int lineType, int shift) { + BEGIN_WRAP cv::fillConvexPoly(*img, *points, cpp(color), lineType, shift); + END_WRAP } -CVAPI(void) imgproc_fillPoly_Mat(cv::Mat *img, const cv::Point **pts, const int *npts, - int ncontours, MyCvScalar color, int lineType, int shift, MyCvPoint offset) +CVAPI(ExceptionStatus) imgproc_fillPoly_Mat(cv::Mat *img, const cv::Point **pts, const int *npts, + int ncontours, MyCvScalar color, int lineType, int shift, MyCvPoint offset) { + BEGIN_WRAP cv::fillPoly(*img, pts, npts, ncontours, cpp(color), lineType, shift, cpp(offset)); + END_WRAP } -CVAPI(void) imgproc_fillPoly_InputOutputArray(cv::_InputOutputArray *img, cv::_InputArray *pts, - MyCvScalar color, int lineType, int shift, MyCvPoint offset) +CVAPI(ExceptionStatus) imgproc_fillPoly_InputOutputArray(cv::_InputOutputArray *img, cv::_InputArray *pts, + MyCvScalar color, int lineType, int shift, MyCvPoint offset) { + BEGIN_WRAP cv::fillPoly(*img, *pts, cpp(color), lineType, shift, cpp(offset)); + END_WRAP } -CVAPI(void) imgproc_polylines_Mat( +CVAPI(ExceptionStatus) imgproc_polylines_Mat( cv::Mat *img, const cv::Point **pts, const int *npts, int ncontours, int isClosed, MyCvScalar color, int thickness, int lineType, int shift) { + BEGIN_WRAP cv::polylines( *img, pts, npts, ncontours, isClosed != 0, cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_polylines_InputOutputArray( +CVAPI(ExceptionStatus) imgproc_polylines_InputOutputArray( cv::_InputOutputArray *img, cv::_InputArray *pts, int isClosed, MyCvScalar color, int thickness, int lineType, int shift) { + BEGIN_WRAP cv::polylines(*img, *pts, isClosed != 0, cpp(color), thickness, lineType, shift); + END_WRAP } -CVAPI(void) imgproc_drawContours_vector(cv::_InputOutputArray *image, - cv::Point **contours, int contoursSize1, int *contoursSize2, - int contourIdx, MyCvScalar color, int thickness, int lineType, - cv::Vec4i *hierarchy, int hiearchyLength, int maxLevel, MyCvPoint offset) +CVAPI(ExceptionStatus) imgproc_drawContours_vector(cv::_InputOutputArray *image, + cv::Point **contours, int contoursSize1, int *contoursSize2, + int contourIdx, MyCvScalar color, int thickness, int lineType, + cv::Vec4i *hierarchy, int hiearchyLength, int maxLevel, MyCvPoint offset) { + BEGIN_WRAP std::vector > contoursVec; - for (int i = 0; i < contoursSize1; i++) + for (auto i = 0; i < contoursSize1; i++) { std::vector c1(contours[i], contours[i] + contoursSize2[i]); contoursVec.push_back(c1); } - std::vector hiearchyVec; - if (hierarchy != NULL) + std::vector hierarchyVec; + if (hierarchy != nullptr) { - hiearchyVec = std::vector(hierarchy, hierarchy + hiearchyLength); + hierarchyVec = std::vector(hierarchy, hierarchy + hiearchyLength); } - cv::drawContours(*image, contoursVec, contourIdx, cpp(color), thickness, lineType, hiearchyVec, maxLevel, cpp(offset)); + cv::drawContours( + *image, contoursVec, contourIdx, cpp(color), thickness, lineType, hierarchyVec, maxLevel, cpp(offset)); + END_WRAP } -CVAPI(void) imgproc_drawContours_InputArray(cv::_InputOutputArray *image, - cv::Mat **contours, int contoursLength, - int contourIdx, MyCvScalar color, int thickness, int lineType, - cv::_InputArray *hierarchy, int maxLevel, MyCvPoint offset) +CVAPI(ExceptionStatus) imgproc_drawContours_InputArray(cv::_InputOutputArray *image, + cv::Mat **contours, int contoursLength, + int contourIdx, MyCvScalar color, int thickness, int lineType, + cv::_InputArray *hierarchy, int maxLevel, MyCvPoint offset) { + BEGIN_WRAP std::vector > contoursVec(contoursLength); - for (int i = 0; i < contoursLength; i++) + for (auto i = 0; i < contoursLength; i++) contoursVec[i] = *contours[i]; - cv::drawContours(*image, contoursVec, contourIdx, cpp(color), thickness, lineType, entity(hierarchy), maxLevel, cpp(offset)); + cv::drawContours( + *image, contoursVec, contourIdx, cpp(color), thickness, lineType, entity(hierarchy), maxLevel, cpp(offset)); + END_WRAP } -CVAPI(int) imgproc_clipLine1(MyCvSize imgSize, MyCvPoint *pt1, MyCvPoint *pt2) +CVAPI(ExceptionStatus) imgproc_clipLine1(MyCvSize imgSize, MyCvPoint *pt1, MyCvPoint *pt2, int* returnValue) { - cv::Point pt1c = cpp(*pt1), pt2c = cpp(*pt2); - bool result = cv::clipLine(cpp(imgSize), pt1c, pt2c); + BEGIN_WRAP + auto pt1c = cpp(*pt1), pt2c = cpp(*pt2); + const auto result = cv::clipLine(cpp(imgSize), pt1c, pt2c); *pt1 = c(pt1c); *pt2 = c(pt2c); - return result ? 1 : 0; + *returnValue = result ? 1 : 0; + END_WRAP } -CVAPI(int) imgproc_clipLine2(MyCvRect imgRect, MyCvPoint *pt1, MyCvPoint *pt2) +CVAPI(ExceptionStatus) imgproc_clipLine2(MyCvRect imgRect, MyCvPoint *pt1, MyCvPoint *pt2, int* returnValue) { - cv::Point pt1c = cpp(*pt1), pt2c = cpp(*pt2); - bool result = cv::clipLine(cpp(imgRect), pt1c, pt2c); + BEGIN_WRAP + auto pt1c = cpp(*pt1), pt2c = cpp(*pt2); + const auto result = cv::clipLine(cpp(imgRect), pt1c, pt2c); *pt1 = c(pt1c); *pt2 = c(pt2c); - return result ? 1 : 0; + *returnValue = result ? 1 : 0; + END_WRAP } -CVAPI(void) imgproc_ellipse2Poly(MyCvPoint center, MyCvSize axes, int angle, int arcStart, int arcEnd, - int delta, std::vector *pts) +CVAPI(ExceptionStatus) imgproc_ellipse2Poly_int( + MyCvPoint center, MyCvSize axes, int angle, int arcStart, int arcEnd, + int delta, std::vector* pts) { + BEGIN_WRAP cv::ellipse2Poly(cpp(center), cpp(axes), angle, arcStart, arcEnd, delta, *pts); + END_WRAP } -CVAPI(void) core_putText(cv::_InputOutputArray *img, const char *text, MyCvPoint org, - int fontFace, double fontScale, MyCvScalar color, - int thickness, int lineType, int bottomLeftOrigin) +CVAPI(ExceptionStatus) imgproc_ellipse2Poly_double( + MyCvPoint2D64f center, MyCvSize2D64f axes, int angle, int arcStart, int arcEnd, + int delta, std::vector* pts) { + BEGIN_WRAP + cv::ellipse2Poly(cpp(center), cpp(axes), angle, arcStart, arcEnd, delta, *pts); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_putText(cv::_InputOutputArray *img, const char *text, MyCvPoint org, + int fontFace, double fontScale, MyCvScalar color, + int thickness, int lineType, int bottomLeftOrigin) +{ + BEGIN_WRAP cv::putText(*img, text, cpp(org), fontFace, fontScale, cpp(color), thickness, lineType, bottomLeftOrigin != 0); + END_WRAP } -CVAPI(MyCvSize) core_getTextSize(const char *text, int fontFace, - double fontScale, int thickness, int *baseLine) +CVAPI(ExceptionStatus) imgproc_getTextSize(const char *text, int fontFace, + double fontScale, int thickness, int *baseLine, MyCvSize *returnValue) { - return c(cv::getTextSize(text, fontFace, fontScale, thickness, baseLine)); + BEGIN_WRAP + *returnValue = c(cv::getTextSize(text, fontFace, fontScale, thickness, baseLine)); + END_WRAP } -#pragma endregion +CVAPI(ExceptionStatus) imgproc_getFontScaleFromHeight( + int fontFace, int pixelHeight, int thickness, double* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::getFontScaleFromHeight(fontFace, pixelHeight, thickness); + END_WRAP +} -#endif \ No newline at end of file +#pragma endregion diff --git a/src/OpenCvSharpExtern/imgproc_CLAHE.h b/src/OpenCvSharpExtern/imgproc_CLAHE.h index 25610703b..4e99604a5 100644 --- a/src/OpenCvSharpExtern/imgproc_CLAHE.h +++ b/src/OpenCvSharpExtern/imgproc_CLAHE.h @@ -1,54 +1,73 @@ -#ifndef _CPP_IMGPROC_CLAHE_H_ -#define _CPP_IMGPROC_CLAHE_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(cv::Ptr*) imgproc_createCLAHE(double clipLimit, MyCvSize tileGridSize) +CVAPI(ExceptionStatus) imgproc_createCLAHE(double clipLimit, MyCvSize tileGridSize, cv::Ptr **returnValue) { - cv::Ptr ret = cv::createCLAHE(clipLimit, cpp(tileGridSize)); - return clone(ret); + BEGIN_WRAP + const auto ret = cv::createCLAHE(clipLimit, cpp(tileGridSize)); + *returnValue = clone(ret); + END_WRAP } -CVAPI(void) imgproc_Ptr_CLAHE_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) imgproc_Ptr_CLAHE_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::CLAHE*) imgproc_Ptr_CLAHE_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) imgproc_Ptr_CLAHE_get(cv::Ptr *obj, cv::CLAHE **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(void) imgproc_CLAHE_apply(cv::CLAHE *obj, cv::_InputArray *src, cv::_OutputArray *dst) +CVAPI(ExceptionStatus) imgproc_CLAHE_apply(cv::CLAHE *obj, cv::_InputArray *src, cv::_OutputArray *dst) { + BEGIN_WRAP obj->apply(*src, *dst); + END_WRAP } -CVAPI(void) imgproc_CLAHE_setClipLimit(cv::CLAHE *obj, double clipLimit) +CVAPI(ExceptionStatus) imgproc_CLAHE_setClipLimit(cv::CLAHE *obj, double clipLimit) { + BEGIN_WRAP obj->setClipLimit(clipLimit); + END_WRAP } -CVAPI(double) imgproc_CLAHE_getClipLimit(cv::CLAHE *obj) +CVAPI(ExceptionStatus) imgproc_CLAHE_getClipLimit(cv::CLAHE *obj, double *returnValue) { - return obj->getClipLimit(); + BEGIN_WRAP + *returnValue = obj->getClipLimit(); + END_WRAP } -CVAPI(void) imgproc_CLAHE_setTilesGridSize(cv::CLAHE *obj, MyCvSize tileGridSize) +CVAPI(ExceptionStatus) imgproc_CLAHE_setTilesGridSize(cv::CLAHE *obj, MyCvSize tileGridSize) { + BEGIN_WRAP obj->setTilesGridSize(cpp(tileGridSize)); + END_WRAP } -CVAPI(MyCvSize) imgproc_CLAHE_getTilesGridSize(cv::CLAHE *obj) +CVAPI(ExceptionStatus) imgproc_CLAHE_getTilesGridSize(cv::CLAHE *obj, MyCvSize *returnValue) { - return c(obj->getTilesGridSize()); + BEGIN_WRAP + *returnValue = c(obj->getTilesGridSize()); + END_WRAP } -CVAPI(void) imgproc_CLAHE_collectGarbage(cv::CLAHE *obj) +CVAPI(ExceptionStatus) imgproc_CLAHE_collectGarbage(cv::CLAHE *obj) { + BEGIN_WRAP obj->collectGarbage(); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/imgproc_GeneralizedHough.h b/src/OpenCvSharpExtern/imgproc_GeneralizedHough.h index ceaee5168..9d72533ec 100644 --- a/src/OpenCvSharpExtern/imgproc_GeneralizedHough.h +++ b/src/OpenCvSharpExtern/imgproc_GeneralizedHough.h @@ -1,238 +1,334 @@ -#ifndef _CPP_IMGPROC_GENERALIZEDHOUGH_H_ -#define _CPP_IMGPROC_GENERALIZEDHOUGH_H_ +#pragma once + +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" // GeneralizedHough -CVAPI(void) imgproc_GeneralizedHough_setTemplate1( +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setTemplate1( cv::GeneralizedHough *obj, cv::_InputArray *templ, MyCvPoint templCenter) { + BEGIN_WRAP obj->setTemplate(*templ, cpp(templCenter)); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_setTemplate2( +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setTemplate2( cv::GeneralizedHough *obj, cv::_InputArray *edges, cv::_InputArray *dx, cv::_InputArray *dy, MyCvPoint templCenter) { + BEGIN_WRAP obj->setTemplate(*edges, *dx, *dy, cpp(templCenter)); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_detect1( +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_detect1( cv::GeneralizedHough *obj, cv::_InputArray *image, cv::_OutputArray *positions, cv::_OutputArray *votes) { + BEGIN_WRAP obj->detect(*image, *positions, entity(votes)); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_detect2( +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_detect2( cv::GeneralizedHough *obj, cv::_InputArray *edges, cv::_InputArray *dx, cv::_InputArray *dy, cv::_OutputArray *positions, cv::_OutputArray *votes) { + BEGIN_WRAP obj->detect(*edges, *dx, *dy, *positions, entity(votes)); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_setCannyLowThresh(cv::GeneralizedHough *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setCannyLowThresh(cv::GeneralizedHough *obj, int val) { + BEGIN_WRAP obj->setCannyLowThresh(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHough_getCannyLowThresh(cv::GeneralizedHough *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_getCannyLowThresh(cv::GeneralizedHough *obj, int *returnValue) { - return obj->getCannyLowThresh(); + BEGIN_WRAP + *returnValue = obj->getCannyLowThresh(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_setCannyHighThresh(cv::GeneralizedHough *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setCannyHighThresh(cv::GeneralizedHough *obj, int val) { + BEGIN_WRAP obj->setCannyHighThresh(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHough_getCannyHighThresh(cv::GeneralizedHough *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_getCannyHighThresh(cv::GeneralizedHough *obj, int *returnValue) { - return obj->getCannyHighThresh(); + BEGIN_WRAP + *returnValue = obj->getCannyHighThresh(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_setMinDist(cv::GeneralizedHough *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setMinDist(cv::GeneralizedHough *obj, double val) { + BEGIN_WRAP obj->setMinDist(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHough_getMinDist(cv::GeneralizedHough *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_getMinDist(cv::GeneralizedHough *obj, double *returnValue) { - return obj->getMinDist(); + BEGIN_WRAP + *returnValue = obj->getMinDist(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_setDp(cv::GeneralizedHough *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setDp(cv::GeneralizedHough *obj, double val) { + BEGIN_WRAP obj->setDp(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHough_getDp(cv::GeneralizedHough *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_getDp(cv::GeneralizedHough *obj, double *returnValue) { - return obj->getDp(); + BEGIN_WRAP + *returnValue = obj->getDp(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHough_setMaxBufferSize(cv::GeneralizedHough *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_setMaxBufferSize(cv::GeneralizedHough *obj, int val) { + BEGIN_WRAP obj->setMaxBufferSize(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHough_getMaxBufferSize(cv::GeneralizedHough *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHough_getMaxBufferSize(cv::GeneralizedHough *obj, int *returnValue) { - return obj->getMaxBufferSize(); + BEGIN_WRAP + *returnValue = obj->getMaxBufferSize(); + END_WRAP } // GeneralizedHoughBallard -CVAPI(cv::Ptr*) imgproc_createGeneralizedHoughBallard() +CVAPI(ExceptionStatus) imgproc_createGeneralizedHoughBallard(cv::Ptr **returnValue) { - cv::Ptr ptr = cv::createGeneralizedHoughBallard(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::createGeneralizedHoughBallard(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::GeneralizedHoughBallard*) imgproc_Ptr_GeneralizedHoughBallard_get( - cv::Ptr *obj) +CVAPI(ExceptionStatus) imgproc_Ptr_GeneralizedHoughBallard_get( + cv::Ptr *obj, cv::GeneralizedHoughBallard **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(void) imgproc_Ptr_GeneralizedHoughBallard_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) imgproc_Ptr_GeneralizedHoughBallard_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughBallard_setLevels(cv::GeneralizedHoughBallard *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughBallard_setLevels(cv::GeneralizedHoughBallard *obj, int val) { + BEGIN_WRAP obj->setLevels(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHoughBallard_getLevels(cv::GeneralizedHoughBallard *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughBallard_getLevels(cv::GeneralizedHoughBallard *obj, int *returnValue) { - return obj->getLevels(); + BEGIN_WRAP + *returnValue = obj->getLevels(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughBallard_setVotesThreshold(cv::GeneralizedHoughBallard *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughBallard_setVotesThreshold(cv::GeneralizedHoughBallard *obj, int val) { + BEGIN_WRAP obj->setVotesThreshold(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHoughBallard_getVotesThreshold(cv::GeneralizedHoughBallard *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughBallard_getVotesThreshold(cv::GeneralizedHoughBallard *obj, int *returnValue) { - return obj->getVotesThreshold(); + BEGIN_WRAP + *returnValue = obj->getVotesThreshold(); + END_WRAP } // GeneralizedHoughGuil -CVAPI(cv::Ptr*) imgproc_createGeneralizedHoughGuil() +CVAPI(ExceptionStatus) imgproc_createGeneralizedHoughGuil(cv::Ptr **returnValue) { - cv::Ptr ptr = cv::createGeneralizedHoughGuil(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::createGeneralizedHoughGuil(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::GeneralizedHoughGuil*) imgproc_Ptr_GeneralizedHoughGuil_get( - cv::Ptr *obj) +CVAPI(ExceptionStatus) imgproc_Ptr_GeneralizedHoughGuil_get( + cv::Ptr *obj, cv::GeneralizedHoughGuil **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(void) imgproc_Ptr_GeneralizedHoughGuil_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) imgproc_Ptr_GeneralizedHoughGuil_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setXi(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setXi(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setXi(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getXi(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getXi(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getXi(); + BEGIN_WRAP + *returnValue = obj->getXi(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setLevels(cv::GeneralizedHoughGuil *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setLevels(cv::GeneralizedHoughGuil *obj, int val) { + BEGIN_WRAP obj->setLevels(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHoughGuil_getLevels(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getLevels(cv::GeneralizedHoughGuil *obj, int *returnValue) { - return obj->getLevels(); + BEGIN_WRAP + *returnValue = obj->getLevels(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setAngleEpsilon(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setAngleEpsilon(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setAngleEpsilon(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getAngleEpsilon(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getAngleEpsilon(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getAngleEpsilon(); + BEGIN_WRAP + *returnValue = obj->getAngleEpsilon(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setMinAngle(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setMinAngle(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setMinAngle(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getMinAngle(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getMinAngle(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getMinAngle(); + BEGIN_WRAP + *returnValue = obj->getMinAngle(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setMaxAngle(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setMaxAngle(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setMaxAngle(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getMaxAngle(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getMaxAngle(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getMaxAngle(); + BEGIN_WRAP + *returnValue = obj->getMaxAngle(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setAngleStep(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setAngleStep(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setAngleStep(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getAngleStep(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getAngleStep(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getAngleStep(); + BEGIN_WRAP + *returnValue = obj->getAngleStep(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setAngleThresh(cv::GeneralizedHoughGuil *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setAngleThresh(cv::GeneralizedHoughGuil *obj, int val) { + BEGIN_WRAP obj->setAngleThresh(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHoughGuil_getAngleThresh(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getAngleThresh(cv::GeneralizedHoughGuil *obj, int *returnValue) { - return obj->getAngleThresh(); + BEGIN_WRAP + *returnValue = obj->getAngleThresh(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setMinScale(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setMinScale(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setMinScale(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getMinScale(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getMinScale(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getMinScale(); + BEGIN_WRAP + *returnValue = obj->getMinScale(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setMaxScale(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setMaxScale(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setMaxScale(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getMaxScale(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getMaxScale(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getMaxScale(); + BEGIN_WRAP + *returnValue = obj->getMaxScale(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setScaleStep(cv::GeneralizedHoughGuil *obj, double val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setScaleStep(cv::GeneralizedHoughGuil *obj, double val) { + BEGIN_WRAP obj->setScaleStep(val); + END_WRAP } -CVAPI(double) imgproc_GeneralizedHoughGuil_getScaleStep(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getScaleStep(cv::GeneralizedHoughGuil *obj, double *returnValue) { - return obj->getScaleStep(); + BEGIN_WRAP + *returnValue = obj->getScaleStep(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setScaleThresh(cv::GeneralizedHoughGuil *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setScaleThresh(cv::GeneralizedHoughGuil *obj, int val) { + BEGIN_WRAP obj->setScaleThresh(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHoughGuil_getScaleThresh(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getScaleThresh(cv::GeneralizedHoughGuil *obj, int *returnValue) { - return obj->getScaleThresh(); + BEGIN_WRAP + *returnValue = obj->getScaleThresh(); + END_WRAP } -CVAPI(void) imgproc_GeneralizedHoughGuil_setPosThresh(cv::GeneralizedHoughGuil *obj, int val) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_setPosThresh(cv::GeneralizedHoughGuil *obj, int val) { + BEGIN_WRAP obj->setPosThresh(val); + END_WRAP } -CVAPI(int) imgproc_GeneralizedHoughGuil_getPosThresh(cv::GeneralizedHoughGuil *obj) +CVAPI(ExceptionStatus) imgproc_GeneralizedHoughGuil_getPosThresh(cv::GeneralizedHoughGuil *obj, int *returnValue) { - return obj->getPosThresh(); + BEGIN_WRAP + *returnValue = obj->getPosThresh(); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/imgproc_LineIterator.h b/src/OpenCvSharpExtern/imgproc_LineIterator.h index 313eb1432..edf917742 100644 --- a/src/OpenCvSharpExtern/imgproc_LineIterator.h +++ b/src/OpenCvSharpExtern/imgproc_LineIterator.h @@ -1,119 +1,102 @@ -#ifndef _CPP_IMGPROC_LINEITERATOR_H_ -#define _CPP_IMGPROC_LINEITERATOR_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(cv::LineIterator*) imgproc_LineIterator_new( - cv::Mat *img, MyCvPoint pt1, MyCvPoint pt2, int connectivity, int leftToRight) +CVAPI(ExceptionStatus) imgproc_LineIterator_new( + cv::Mat *img, MyCvPoint pt1, MyCvPoint pt2, int connectivity, int leftToRight, cv::LineIterator** returnValue) { - return new cv::LineIterator(*img, cpp(pt1), cpp(pt2), connectivity, leftToRight != 0); + BEGIN_WRAP + *returnValue = new cv::LineIterator(*img, cpp(pt1), cpp(pt2), connectivity, leftToRight != 0); + END_WRAP } -CVAPI(void) imgproc_LineIterator_delete(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_delete(cv::LineIterator *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(uchar*) imgproc_LineIterator_operatorEntity(cv::LineIterator *obj) -{ - return **obj; -} - -CVAPI(void) imgproc_LineIterator_operatorPP(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_getValuePosAndShiftToNext(cv::LineIterator* obj, uchar** returnValue, MyCvPoint *returnPos) { + BEGIN_WRAP + *returnValue = **obj; + *returnPos = c(obj->pos()); (*obj)++; + END_WRAP } -CVAPI(MyCvPoint) imgproc_LineIterator_pos(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_ptr_get(cv::LineIterator *obj, uchar **returnValue) { - return c(obj->pos()); + BEGIN_WRAP + *returnValue = obj->ptr; + END_WRAP } -CVAPI(uchar*) imgproc_LineIterator_ptr_get(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_ptr0_get(cv::LineIterator *obj, const uchar** returnValue) { - return obj->ptr; -} -CVAPI(void) imgproc_LineIterator_ptr_set(cv::LineIterator *obj, uchar *val) -{ - obj->ptr = val; + BEGIN_WRAP + *returnValue = obj->ptr0; + END_WRAP } -CVAPI(const uchar*) imgproc_LineIterator_ptr0_get(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_step_get(cv::LineIterator *obj, int* returnValue) { - return obj->ptr0; + BEGIN_WRAP + *returnValue = obj->step; + END_WRAP } -CVAPI(int) imgproc_LineIterator_step_get(cv::LineIterator *obj) -{ - return obj->step; -} -CVAPI(void) imgproc_LineIterator_step_set(cv::LineIterator *obj, int val) +CVAPI(ExceptionStatus) imgproc_LineIterator_elemSize_get(cv::LineIterator *obj, int* returnValue) { - obj->step = val; + BEGIN_WRAP + *returnValue = obj->elemSize; + END_WRAP } -CVAPI(int) imgproc_LineIterator_elemSize_get(cv::LineIterator *obj) -{ - return obj->elemSize; -} -CVAPI(void) imgproc_LineIterator_elemSize_set(cv::LineIterator *obj, int val) +CVAPI(ExceptionStatus) imgproc_LineIterator_err_get(cv::LineIterator *obj, int* returnValue) { - obj->elemSize = val; + BEGIN_WRAP + *returnValue = obj->err; + END_WRAP } -CVAPI(int) imgproc_LineIterator_err_get(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_count_get(cv::LineIterator *obj, int* returnValue) { - return obj->err; -} -CVAPI(void) imgproc_LineIterator_err_set(cv::LineIterator *obj, int val) -{ - obj->err = val; + BEGIN_WRAP + *returnValue = obj->count; + END_WRAP } -CVAPI(int) imgproc_LineIterator_count_get(cv::LineIterator *obj) -{ - return obj->count; -} -CVAPI(void) imgproc_LineIterator_count_set(cv::LineIterator *obj, int val) +CVAPI(ExceptionStatus) imgproc_LineIterator_minusDelta_get(cv::LineIterator *obj, int* returnValue) { - obj->count = val; + BEGIN_WRAP + *returnValue = obj->minusDelta; + END_WRAP } -CVAPI(int) imgproc_LineIterator_minusDelta_get(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_plusDelta_get(cv::LineIterator *obj, int* returnValue) { - return obj->minusDelta; -} -CVAPI(void) imgproc_LineIterator_minusDelta_set(cv::LineIterator *obj, int val) -{ - obj->minusDelta = val; + BEGIN_WRAP + *returnValue = obj->plusDelta; + END_WRAP } -CVAPI(int) imgproc_LineIterator_plusDelta_get(cv::LineIterator *obj) -{ - return obj->plusDelta; -} -CVAPI(void) imgproc_LineIterator_plusDelta_set(cv::LineIterator *obj, int val) +CVAPI(ExceptionStatus) imgproc_LineIterator_minusStep_get(cv::LineIterator *obj, int* returnValue) { - obj->plusDelta = val; + BEGIN_WRAP + *returnValue = obj->minusStep; + END_WRAP } -CVAPI(int) imgproc_LineIterator_minusStep_get(cv::LineIterator *obj) +CVAPI(ExceptionStatus) imgproc_LineIterator_plusStep_get(cv::LineIterator *obj, int *returnValue) { - return obj->minusStep; -} -CVAPI(void) imgproc_LineIterator_minusStep_set(cv::LineIterator *obj, int val) -{ - obj->minusStep = val; -} - -CVAPI(int) imgproc_LineIterator_plusStep_get(cv::LineIterator *obj) -{ - return obj->plusStep; -} -CVAPI(void) imgproc_LineIterator_plusStep_set(cv::LineIterator *obj, int val) -{ - obj->plusStep = val; -} - -#endif \ No newline at end of file + BEGIN_WRAP + *returnValue = obj->plusStep; + END_WRAP +} \ No newline at end of file diff --git a/src/OpenCvSharpExtern/imgproc_LineSegmentDetector.h b/src/OpenCvSharpExtern/imgproc_LineSegmentDetector.h index 65da1dca3..18cc3f014 100644 --- a/src/OpenCvSharpExtern/imgproc_LineSegmentDetector.h +++ b/src/OpenCvSharpExtern/imgproc_LineSegmentDetector.h @@ -1,5 +1,8 @@ -#ifndef _CPP_IMGPROC_LINESEGMENTDETECTOR_H_ -#define _CPP_IMGPROC_LINESEGMENTDETECTOR_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" @@ -44,5 +47,3 @@ CVAPI(cv::LineSegmentDetector*) imgproc_Ptr_LineSegmentDetector_get(cv::Ptrget(); } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/imgproc_Segmentation.h b/src/OpenCvSharpExtern/imgproc_Segmentation.h new file mode 100644 index 000000000..d2d128589 --- /dev/null +++ b/src/OpenCvSharpExtern/imgproc_Segmentation.h @@ -0,0 +1,101 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_new( + cv::segmentation::IntelligentScissorsMB** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::segmentation::IntelligentScissorsMB(); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_delete( + cv::segmentation::IntelligentScissorsMB *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_setWeights( + cv::segmentation::IntelligentScissorsMB *obj, + float weight_non_edge, float weight_gradient_direction, float weight_gradient_magnitude) +{ + BEGIN_WRAP + obj->setWeights(weight_non_edge, weight_gradient_direction, weight_gradient_magnitude); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_setGradientMagnitudeMaxLimit( + cv::segmentation::IntelligentScissorsMB *obj, + float gradient_magnitude_threshold_max) +{ + BEGIN_WRAP + obj->setGradientMagnitudeMaxLimit(gradient_magnitude_threshold_max); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_setEdgeFeatureZeroCrossingParameters( + cv::segmentation::IntelligentScissorsMB *obj, + float gradient_magnitude_min_value) +{ + BEGIN_WRAP + obj->setEdgeFeatureZeroCrossingParameters(gradient_magnitude_min_value); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_setEdgeFeatureCannyParameters( + cv::segmentation::IntelligentScissorsMB *obj, + double threshold1, double threshold2, + int apertureSize, int L2gradient) +{ + BEGIN_WRAP + obj->setEdgeFeatureCannyParameters(threshold1, threshold2, apertureSize, L2gradient != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_applyImage( + cv::segmentation::IntelligentScissorsMB *obj, + cv::_InputArray *image) +{ + BEGIN_WRAP + obj->applyImage(*image); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_applyImageFeatures( + cv::segmentation::IntelligentScissorsMB *obj, + cv::_InputArray *non_edge, + cv::_InputArray *gradient_direction, + cv::_InputArray *gradient_magnitude, + cv::_InputArray *image) +{ + BEGIN_WRAP + obj->applyImageFeatures(*non_edge, *gradient_direction, *gradient_magnitude, entity(image)); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_buildMap( + cv::segmentation::IntelligentScissorsMB *obj, + MyCvPoint sourcePt) +{ + BEGIN_WRAP + obj->buildMap(cpp(sourcePt)); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_segmentation_IntelligentScissorsMB_getContour( + cv::segmentation::IntelligentScissorsMB *obj, + MyCvPoint targetPt, cv::_OutputArray *contour, int backward) +{ + BEGIN_WRAP + obj->getContour(cpp(targetPt), *contour, backward != 0); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/imgproc_Subdiv2D.h b/src/OpenCvSharpExtern/imgproc_Subdiv2D.h index bfcb6d78d..38d1d9a85 100644 --- a/src/OpenCvSharpExtern/imgproc_Subdiv2D.h +++ b/src/OpenCvSharpExtern/imgproc_Subdiv2D.h @@ -1,104 +1,155 @@ -#ifndef _CPP_IMGPROC_SUBDIV2D_H_ -#define _CPP_IMGPROC_SUBDIV2D_H_ +#pragma once + +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(cv::Subdiv2D*) imgproc_Subdiv2D_new1() +CVAPI(ExceptionStatus) imgproc_Subdiv2D_new1(cv::Subdiv2D **returnValue) { - return new cv::Subdiv2D(); + BEGIN_WRAP + *returnValue = new cv::Subdiv2D; + END_WRAP } -CVAPI(cv::Subdiv2D*) imgproc_Subdiv2D_new2(CvRect rect) +CVAPI(ExceptionStatus) imgproc_Subdiv2D_new2(MyCvRect rect, cv::Subdiv2D **returnValue) { - return new cv::Subdiv2D(rect); + BEGIN_WRAP + *returnValue = new cv::Subdiv2D(cpp(rect)); + END_WRAP } -CVAPI(void) imgproc_Subdiv2D_delete(cv::Subdiv2D *obj) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_delete(cv::Subdiv2D *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) imgproc_Subdiv2D_initDelaunay(cv::Subdiv2D *obj, CvRect rect) +CVAPI(ExceptionStatus) imgproc_Subdiv2D_initDelaunay(cv::Subdiv2D *obj, CvRect rect) { + BEGIN_WRAP obj->initDelaunay(rect); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_insert1(cv::Subdiv2D *obj, CvPoint2D32f pt) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_insert1(cv::Subdiv2D *obj, MyCvPoint2D32f pt, int *returnValue) { - return obj->insert(pt); + BEGIN_WRAP + *returnValue = obj->insert(cpp(pt)); + END_WRAP } -CVAPI(void) imgproc_Subdiv2D_insert2(cv::Subdiv2D *obj, CvPoint2D32f *ptArray, int length) +CVAPI(ExceptionStatus) imgproc_Subdiv2D_insert2(cv::Subdiv2D *obj, MyCvPoint2D32f *ptArray, int length) { - std::vector ptvec(length); + BEGIN_WRAP + std::vector ptVec(length); for (int i = 0; i < length; i++) { - ptvec[i] = ptArray[i]; + ptVec[i] = cpp(ptArray[i]); } - obj->insert(ptvec); + obj->insert(ptVec); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_locate(cv::Subdiv2D *obj, CvPoint2D32f pt, int *edge, int *vertex) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_locate( + cv::Subdiv2D *obj, MyCvPoint2D32f pt, int *edge, int *vertex, int *returnValue) { - return obj->locate(pt, *edge, *vertex); + BEGIN_WRAP + *returnValue = obj->locate(cpp(pt), *edge, *vertex); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_findNearest(cv::Subdiv2D *obj, CvPoint2D32f pt, CvPoint2D32f* nearestPt) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_findNearest( + cv::Subdiv2D *obj, MyCvPoint2D32f pt, MyCvPoint2D32f* nearestPt, int *returnValue) { + BEGIN_WRAP cv::Point2f nearestPt0; - int ret = obj->findNearest(pt, &nearestPt0); - *nearestPt = nearestPt0; - return ret; + *returnValue = obj->findNearest(cpp(pt), &nearestPt0); + *nearestPt = c(nearestPt0); + END_WRAP } -CVAPI(void) imgproc_Subdiv2D_getEdgeList(cv::Subdiv2D *obj, std::vector **edgeList) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_getEdgeList(cv::Subdiv2D *obj, std::vector *edgeList) { - *edgeList = new std::vector(); - obj->getEdgeList(**edgeList); + BEGIN_WRAP + obj->getEdgeList(*edgeList); + END_WRAP } -CVAPI(void) imgproc_Subdiv2D_getTriangleList(cv::Subdiv2D *obj, std::vector **triangleList) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_getLeadingEdgeList(cv::Subdiv2D *obj, std::vector *leadingEdgeList) { - *triangleList = new std::vector(); - obj->getTriangleList(**triangleList); + BEGIN_WRAP + obj->getLeadingEdgeList(*leadingEdgeList); + END_WRAP } -CVAPI(void) imgproc_Subdiv2D_getVoronoiFacetList(cv::Subdiv2D *obj, int *idx, int idxCount, - std::vector > **facetList, std::vector **facetCenters) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_getTriangleList(cv::Subdiv2D *obj, std::vector *triangleList) { + BEGIN_WRAP + obj->getTriangleList(*triangleList); + END_WRAP +} + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_getVoronoiFacetList( + cv::Subdiv2D *obj, int *idx, int idxCount, + std::vector > *facetList, std::vector *facetCenters) +{ + BEGIN_WRAP std::vector idxVec; - if (idx != NULL) + if (idx != nullptr) idxVec = std::vector(idx, idx + idxCount); - *facetList = new std::vector >(); - *facetCenters = new std::vector(); - obj->getVoronoiFacetList(idxVec, **facetList, **facetCenters); + obj->getVoronoiFacetList(idxVec, *facetList, *facetCenters); + END_WRAP } -CVAPI(MyCvPoint2D32f) imgproc_Subdiv2D_getVertex(cv::Subdiv2D *obj, int vertex, int* firstEdge) +CVAPI(ExceptionStatus) imgproc_Subdiv2D_getVertex(cv::Subdiv2D *obj, int vertex, int* firstEdge, MyCvPoint2D32f *returnValue) { - return c(obj->getVertex(vertex, firstEdge)); + BEGIN_WRAP + *returnValue = c(obj->getVertex(vertex, firstEdge)); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_getEdge(cv::Subdiv2D *obj, int edge, int nextEdgeType) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_getEdge(cv::Subdiv2D *obj, int edge, int nextEdgeType, int *returnValue) { - return obj->getEdge(edge, nextEdgeType); + BEGIN_WRAP + *returnValue = obj->getEdge(edge, nextEdgeType); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_nextEdge(cv::Subdiv2D *obj, int edge) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_nextEdge(cv::Subdiv2D *obj, int edge, int *returnValue) { - return obj->nextEdge(edge); + BEGIN_WRAP + *returnValue = obj->nextEdge(edge); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_rotateEdge(cv::Subdiv2D *obj, int edge, int rotate) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_rotateEdge(cv::Subdiv2D *obj, int edge, int rotate, int *returnValue) { - return obj->rotateEdge(edge, rotate); + BEGIN_WRAP + *returnValue = obj->rotateEdge(edge, rotate); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_symEdge(cv::Subdiv2D *obj, int edge) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_symEdge(cv::Subdiv2D *obj, int edge, int *returnValue) { - return obj->symEdge(edge); + BEGIN_WRAP + *returnValue = obj->symEdge(edge); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_edgeOrg(cv::Subdiv2D *obj, int edge, CvPoint2D32f *orgpt) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_edgeOrg(cv::Subdiv2D *obj, int edge, MyCvPoint2D32f *orgPt, int *returnValue) { - cv::Point2f orgpt0; - int ret = obj->edgeOrg(edge, &orgpt0); - *orgpt = orgpt0; - return ret; + BEGIN_WRAP + cv::Point2f orgPt0; + *returnValue = obj->edgeOrg(edge, &orgPt0); + *orgPt = c(orgPt0); + END_WRAP } -CVAPI(int) imgproc_Subdiv2D_edgeDst(cv::Subdiv2D *obj, int edge, CvPoint2D32f *dstpt) + +CVAPI(ExceptionStatus) imgproc_Subdiv2D_edgeDst(cv::Subdiv2D *obj, int edge, MyCvPoint2D32f *dstPt, int *returnValue) { - cv::Point2f dstpt0; - int ret = obj->edgeDst(edge, &dstpt0); - *dstpt = dstpt0; - return ret; + BEGIN_WRAP + cv::Point2f dstPt0; + *returnValue = obj->edgeDst(edge, &dstPt0); + *dstPt = c(dstPt0); + END_WRAP } - - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/include_opencv.h b/src/OpenCvSharpExtern/include_opencv.h index 3f09cf312..d65eb67e5 100644 --- a/src/OpenCvSharpExtern/include_opencv.h +++ b/src/OpenCvSharpExtern/include_opencv.h @@ -1,32 +1,73 @@ -#ifndef _INCLUDE_OPENCV_H_ -#define _INCLUDE_OPENCV_H_ +#pragma once -#define ENABLED_CONTRIB -#undef ENABLED_CONTRIB +//#define ENABLED_CONTRIB +//#undef ENABLED_CONTRIB + +#ifndef CV_EXPORTS +# if (defined _WIN32 || defined WINCE || defined __CYGWIN__) +# define CV_EXPORTS __declspec(dllexport) +# elif defined __GNUC__ && __GNUC__ >= 4 && defined(__APPLE__) +# define CV_EXPORTS __attribute__ ((visibility ("default"))) +# endif +#endif + +#ifndef CV_EXPORTS +# define CV_EXPORTS +#endif #ifdef _MSC_VER +// ReSharper disable once IdentifierTypo +#define NOMINMAX +// ReSharper disable once CppInconsistentNaming +#define _CRT_SECURE_NO_WARNINGS #pragma warning(push) +#pragma warning(disable: 4244) #pragma warning(disable: 4251) +#pragma warning(disable: 4819) #pragma warning(disable: 4996) +#pragma warning(disable: 6294) +#include +#pragma warning(disable: ALL_CODE_ANALYSIS_WARNINGS) #endif + +#define OPENCV_TRAITS_ENABLE_DEPRECATED + #include -#include -#include + +// MP! Added: To correctly support imShow under WinRT. +#ifdef _WINRT_DLL +#include +#endif +#include #include #include #include -#include -#include #include #include +#ifndef _WINRT_DLL +#include +#include +#endif // opencv_contrib #include +#include #include -#include +#include +#include #include +#include +#include #include #include +#include +#ifndef _WINRT_DLL +#include +#include +#include +#include +#include +#endif #include #include @@ -47,5 +88,3 @@ // Additional functions #include "my_functions.h" - -#endif diff --git a/src/OpenCvSharpExtern/line_descriptor.cpp b/src/OpenCvSharpExtern/line_descriptor.cpp new file mode 100644 index 000000000..fd1016a7f --- /dev/null +++ b/src/OpenCvSharpExtern/line_descriptor.cpp @@ -0,0 +1 @@ +#include "line_descriptor.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/line_descriptor.h b/src/OpenCvSharpExtern/line_descriptor.h new file mode 100644 index 000000000..679de3217 --- /dev/null +++ b/src/OpenCvSharpExtern/line_descriptor.h @@ -0,0 +1,78 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +CVAPI(ExceptionStatus) line_descriptor_LSDDetector_new1( + cv::line_descriptor::LSDDetector** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::line_descriptor::LSDDetector; + END_WRAP +} + +CVAPI(ExceptionStatus) line_descriptor_LSDDetector_new2( + const double scale, + const double sigma_scale, + const double quant, + const double ang_th, + const double log_eps, + const double density_th, + const int n_bins, + cv::line_descriptor::LSDDetector** returnValue) +{ + BEGIN_WRAP + cv::line_descriptor::LSDParam param; + param.scale = scale; + param.sigma_scale = sigma_scale; + param.quant = quant; + param.ang_th = ang_th; + param.log_eps = log_eps; + param.density_th = density_th; + param.n_bins = n_bins; + *returnValue = new cv::line_descriptor::LSDDetector(param); + END_WRAP +} + +CVAPI(ExceptionStatus) line_descriptor_LSDDetector_delete(cv::line_descriptor::LSDDetector* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) line_descriptor_LSDDetector_detect1( + cv::line_descriptor::LSDDetector* obj, + cv::Mat* image, std::vector *keypoints, int scale, int numOctaves, cv::Mat* mask) +{ + BEGIN_WRAP + obj->detect(*image, *keypoints, scale, numOctaves, entity(mask)); + END_WRAP +} + +CVAPI(ExceptionStatus) line_descriptor_LSDDetector_detect2( + cv::line_descriptor::LSDDetector* obj, + cv::Mat **images, int32_t imagesSize, + std::vector > *keylines, int scale, int numOctaves, + cv::Mat** masks, int32_t masksSize) +{ + BEGIN_WRAP + std::vector imagesVec(imagesSize); + std::vector masksVec(masksSize); + for (int i = 0; i < imagesSize; i++) + { + imagesVec[i] = *images[i]; + } + for (int i = 0; i < masksSize; i++) + { + masksVec[i] = *masks[i]; + } + + obj->detect(imagesVec, *keylines, scale, numOctaves, masksVec); + + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ml.cpp b/src/OpenCvSharpExtern/ml.cpp index 23a3f26a8..80bad8a7b 100644 --- a/src/OpenCvSharpExtern/ml.cpp +++ b/src/OpenCvSharpExtern/ml.cpp @@ -1,5 +1,5 @@ +// ReSharper disable CppUnusedIncludeDirective #include "ml.h" - #include "ml_StatModel.h" #include "ml_ANN_MLP.h" #include "ml_Boost.h" diff --git a/src/OpenCvSharpExtern/ml.h b/src/OpenCvSharpExtern/ml.h index de490af9e..f85861717 100644 --- a/src/OpenCvSharpExtern/ml.h +++ b/src/OpenCvSharpExtern/ml.h @@ -1,5 +1,4 @@ -#ifndef _CPP_ML_H_ -#define _CPP_ML_H_ +#pragma once #include "include_opencv.h" @@ -25,5 +24,3 @@ static inline cv::ml::ParamGrid cpp(ParamGridStruct obj) { return cv::ml::ParamGrid(obj.minVal, obj.maxVal, obj.logStep); } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/ml_ANN_MLP.h b/src/OpenCvSharpExtern/ml_ANN_MLP.h index 164cf3d74..56c920c67 100644 --- a/src/OpenCvSharpExtern/ml_ANN_MLP.h +++ b/src/OpenCvSharpExtern/ml_ANN_MLP.h @@ -1,141 +1,195 @@ -#ifndef _CPP_ML_ANN_MLP_H_ -#define _CPP_ML_ANN_MLP_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::ml; +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +#include "include_opencv.h" -CVAPI(void) ml_ANN_MLP_setTrainMethod(ANN_MLP *obj, int method, double param1, double param2) +CVAPI(ExceptionStatus) ml_ANN_MLP_setTrainMethod(cv::ml::ANN_MLP *obj, int method, double param1, double param2) { + BEGIN_WRAP obj->setTrainMethod(method, param1, param2); + END_WRAP } -CVAPI(int) ml_ANN_MLP_getTrainMethod(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getTrainMethod(cv::ml::ANN_MLP *obj, int *returnValue) { - return obj->getTrainMethod(); + BEGIN_WRAP + *returnValue = obj->getTrainMethod(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setActivationFunction(ANN_MLP *obj, int type, double param1, double param2) +CVAPI(ExceptionStatus) ml_ANN_MLP_setActivationFunction(cv::ml::ANN_MLP *obj, int type, double param1, double param2) { + BEGIN_WRAP obj->setActivationFunction(type, param1, param2); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setLayerSizes(ANN_MLP *obj, cv::_InputArray *_layer_sizes) +CVAPI(ExceptionStatus) ml_ANN_MLP_setLayerSizes(cv::ml::ANN_MLP *obj, cv::_InputArray *_layer_sizes) { + BEGIN_WRAP obj->setLayerSizes(entity(_layer_sizes)); + END_WRAP } -CVAPI(cv::Mat*) ml_ANN_MLP_getLayerSizes(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getLayerSizes(cv::ml::ANN_MLP *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->getLayerSizes()); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->getLayerSizes()); + END_WRAP } -CVAPI(MyCvTermCriteria) ml_ANN_MLP_getTermCriteria(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getTermCriteria(cv::ml::ANN_MLP *obj, MyCvTermCriteria *returnValue) { - return c(obj->getTermCriteria()); + BEGIN_WRAP + *returnValue = c(obj->getTermCriteria()); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setTermCriteria(ANN_MLP *obj, MyCvTermCriteria val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setTermCriteria(cv::ml::ANN_MLP *obj, MyCvTermCriteria val) { + BEGIN_WRAP obj->setTermCriteria(cpp(val)); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getBackpropWeightScale(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getBackpropWeightScale(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getBackpropWeightScale(); + BEGIN_WRAP + *returnValue = obj->getBackpropWeightScale(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setBackpropWeightScale(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setBackpropWeightScale(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setBackpropWeightScale(val); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getBackpropMomentumScale(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getBackpropMomentumScale(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getBackpropMomentumScale(); + BEGIN_WRAP + *returnValue = obj->getBackpropMomentumScale(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setBackpropMomentumScale(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setBackpropMomentumScale(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setBackpropMomentumScale(val); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getRpropDW0(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getRpropDW0(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getRpropDW0(); + BEGIN_WRAP + *returnValue = obj->getRpropDW0(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setRpropDW0(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setRpropDW0(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setRpropDW0(val); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getRpropDWPlus(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getRpropDWPlus(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getRpropDWPlus(); + BEGIN_WRAP + *returnValue = obj->getRpropDWPlus(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setRpropDWPlus(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setRpropDWPlus(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setRpropDWPlus(val); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getRpropDWMinus(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getRpropDWMinus(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getRpropDWMinus(); + BEGIN_WRAP + *returnValue = obj->getRpropDWMinus(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setRpropDWMinus(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setRpropDWMinus(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setRpropDWMinus(val); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getRpropDWMin(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getRpropDWMin(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getRpropDWMin(); + BEGIN_WRAP + *returnValue = obj->getRpropDWMin(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setRpropDWMin(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setRpropDWMin(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setRpropDWMin(val); + END_WRAP } -CVAPI(double) ml_ANN_MLP_getRpropDWMax(ANN_MLP *obj) +CVAPI(ExceptionStatus) ml_ANN_MLP_getRpropDWMax(cv::ml::ANN_MLP *obj, double *returnValue) { - return obj->getRpropDWMax(); + BEGIN_WRAP + *returnValue = obj->getRpropDWMax(); + END_WRAP } -CVAPI(void) ml_ANN_MLP_setRpropDWMax(ANN_MLP *obj, double val) +CVAPI(ExceptionStatus) ml_ANN_MLP_setRpropDWMax(cv::ml::ANN_MLP *obj, double val) { + BEGIN_WRAP obj->setRpropDWMax(val); + END_WRAP } -CVAPI(cv::Mat*) ml_ANN_MLP_getWeights(ANN_MLP *obj, int layerIdx) +CVAPI(ExceptionStatus) ml_ANN_MLP_getWeights(cv::ml::ANN_MLP *obj, int layerIdx, cv::Mat **returnValue) { - return new cv::Mat(obj->getWeights(layerIdx)); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->getWeights(layerIdx)); + END_WRAP } -CVAPI(cv::Ptr*) ml_ANN_MLP_create() +CVAPI(ExceptionStatus) ml_ANN_MLP_create(cv::Ptr **returnValue) { - cv::Ptr ptr = ANN_MLP::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::ANN_MLP::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_ANN_MLP_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_ANN_MLP_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(ANN_MLP*) ml_Ptr_ANN_MLP_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_ANN_MLP_get(cv::Ptr *obj, cv::ml::ANN_MLP **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_ANN_MLP_load(const char *filePath) +CVAPI(ExceptionStatus) ml_ANN_MLP_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = ANN_MLP::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::ANN_MLP::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_ANN_MLP_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_ANN_MLP_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::ANN_MLP::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::ANN_MLP::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -#endif diff --git a/src/OpenCvSharpExtern/ml_Boost.h b/src/OpenCvSharpExtern/ml_Boost.h index 2a1d1f193..9c9938d87 100644 --- a/src/OpenCvSharpExtern/ml_Boost.h +++ b/src/OpenCvSharpExtern/ml_Boost.h @@ -1,65 +1,85 @@ -#ifndef _CPP_ML_BOOST_H_ -#define _CPP_ML_BOOST_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::ml; +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +#include "include_opencv.h" -CVAPI(int) ml_Boost_getBoostType(Boost *obj) +CVAPI(ExceptionStatus) ml_Boost_getBoostType(cv::ml::Boost *obj, int *returnValue) { - return obj->getBoostType(); + BEGIN_WRAP + *returnValue = obj->getBoostType(); + END_WRAP } -CVAPI(void) ml_Boost_setBoostType(Boost *obj, int val) +CVAPI(ExceptionStatus) ml_Boost_setBoostType(cv::ml::Boost *obj, int val) { + BEGIN_WRAP obj->setBoostType(val); + END_WRAP } -CVAPI(int) ml_Boost_getWeakCount(Boost *obj) +CVAPI(ExceptionStatus) ml_Boost_getWeakCount(cv::ml::Boost *obj, int *returnValue) { - return obj->getWeakCount(); + BEGIN_WRAP + *returnValue = obj->getWeakCount(); + END_WRAP } -CVAPI(void) ml_Boost_setWeakCount(Boost *obj, int val) +CVAPI(ExceptionStatus) ml_Boost_setWeakCount(cv::ml::Boost *obj, int val) { + BEGIN_WRAP obj->setWeakCount(val); + END_WRAP } -CVAPI(double) ml_Boost_getWeightTrimRate(Boost *obj) +CVAPI(ExceptionStatus) ml_Boost_getWeightTrimRate(cv::ml::Boost *obj, double *returnValue) { - return obj->getWeightTrimRate(); + BEGIN_WRAP + *returnValue = obj->getWeightTrimRate(); + END_WRAP } -CVAPI(void) ml_Boost_setWeightTrimRate(Boost *obj, double val) +CVAPI(ExceptionStatus) ml_Boost_setWeightTrimRate(cv::ml::Boost *obj, double val) { + BEGIN_WRAP obj->setWeightTrimRate(val); + END_WRAP } -CVAPI(cv::Ptr*) ml_Boost_create() +CVAPI(ExceptionStatus) ml_Boost_create(cv::Ptr **returnValue) { - cv::Ptr ptr = Boost::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::Boost::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_Boost_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_Boost_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(Boost*) ml_Ptr_Boost_get(cv::Ptr* obj) +CVAPI(ExceptionStatus) ml_Ptr_Boost_get(cv::Ptr* obj, cv::ml::Boost **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_Boost_load(const char *filePath) +CVAPI(ExceptionStatus) ml_Boost_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_Boost_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_Boost_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::Boost::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::Boost::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/ml_DTrees.h b/src/OpenCvSharpExtern/ml_DTrees.h index 7db15c07c..207ccc765 100644 --- a/src/OpenCvSharpExtern/ml_DTrees.h +++ b/src/OpenCvSharpExtern/ml_DTrees.h @@ -1,12 +1,13 @@ -#ifndef _CPP_ML_DTREE_H_ -#define _CPP_ML_DTREE_H_ +#pragma once + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +// ReSharper disable CppInconsistentNaming #include "include_opencv.h" -using namespace cv::ml; extern "C" { - typedef struct DTrees_Node + struct DTrees_Node { double value; int classIdx; @@ -15,9 +16,9 @@ extern "C" int right; int defaultDir; int split; - } DTrees_Node; + }; - typedef struct DTrees_Split + struct DTrees_Split { int varIdx; int inversed; // bool @@ -25,10 +26,10 @@ extern "C" int next; float c; int subsetOfs; - } DTrees_Split; + }; } -static inline DTrees_Node c(DTrees::Node obj) +static DTrees_Node c(const cv::ml::DTrees::Node obj) { DTrees_Node ret; ret.value = obj.value; @@ -40,20 +41,8 @@ static inline DTrees_Node c(DTrees::Node obj) ret.split = obj.split; return ret; } -static inline DTrees::Node cpp(DTrees_Node obj) -{ - DTrees::Node ret; - ret.value = obj.value; - ret.classIdx = obj.classIdx; - ret.parent = obj.parent; - ret.left = obj.left; - ret.right = obj.right; - ret.defaultDir = obj.defaultDir; - ret.split = obj.split; - return ret; -} -static inline DTrees_Split c(DTrees::Split obj) +DTrees_Split c(const cv::ml::DTrees::Split obj) { DTrees_Split ret; ret.varIdx = obj.varIdx; @@ -64,174 +53,213 @@ static inline DTrees_Split c(DTrees::Split obj) ret.subsetOfs = obj.subsetOfs; return ret; } -static inline DTrees::Split cpp(DTrees_Split obj) -{ - DTrees::Split ret; - ret.varIdx = obj.varIdx; - ret.inversed = obj.inversed != 0; - ret.quality = obj.quality; - ret.next = obj.next; - ret.c = obj.c; - ret.subsetOfs = obj.subsetOfs; - return ret; -} - -CVAPI(int) ml_DTrees_getMaxCategories(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getMaxCategories(cv::ml::DTrees *obj, int *returnValue) { - return obj->getMaxCategories(); + BEGIN_WRAP + *returnValue = obj->getMaxCategories(); + END_WRAP } -CVAPI(void) ml_DTrees_setMaxCategories(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setMaxCategories(cv::ml::DTrees *obj, int val) { - return obj->setMaxCategories(val); + BEGIN_WRAP + obj->setMaxCategories(val); + END_WRAP } -CVAPI(int) ml_DTrees_getMaxDepth(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getMaxDepth(cv::ml::DTrees *obj, int *returnValue) { - return obj->getMaxDepth(); + BEGIN_WRAP + *returnValue = obj->getMaxDepth(); + END_WRAP } -CVAPI(void) ml_DTrees_setMaxDepth(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setMaxDepth(cv::ml::DTrees *obj, int val) { - return obj->setMaxDepth(val); + BEGIN_WRAP + obj->setMaxDepth(val); + END_WRAP } -CVAPI(int) ml_DTrees_getMinSampleCount(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getMinSampleCount(cv::ml::DTrees *obj, int *returnValue) { - return obj->getMinSampleCount(); + BEGIN_WRAP + *returnValue = obj->getMinSampleCount(); + END_WRAP } -CVAPI(void) ml_DTrees_setMinSampleCount(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setMinSampleCount(cv::ml::DTrees *obj, int val) { - return obj->setMinSampleCount(val); + BEGIN_WRAP + obj->setMinSampleCount(val); + END_WRAP } -CVAPI(int) ml_DTrees_getCVFolds(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getCVFolds(cv::ml::DTrees *obj, int *returnValue) { - return obj->getCVFolds(); + BEGIN_WRAP + *returnValue = obj->getCVFolds(); + END_WRAP } -CVAPI(void) ml_DTrees_setCVFolds(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setCVFolds(cv::ml::DTrees *obj, int val) { - return obj->setCVFolds(val); + BEGIN_WRAP + obj->setCVFolds(val); + END_WRAP } -CVAPI(int) ml_DTrees_getUseSurrogates(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getUseSurrogates(cv::ml::DTrees *obj, int *returnValue) { - return obj->getUseSurrogates() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getUseSurrogates() ? 1 : 0; + END_WRAP } -CVAPI(void) ml_DTrees_setUseSurrogates(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setUseSurrogates(cv::ml::DTrees *obj, int val) { - return obj->setUseSurrogates(val != 0); + BEGIN_WRAP + obj->setUseSurrogates(val != 0); + END_WRAP } -CVAPI(int) ml_DTrees_getUse1SERule(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getUse1SERule(cv::ml::DTrees *obj, int *returnValue) { - return obj->getUse1SERule() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getUse1SERule() ? 1 : 0; + END_WRAP } -CVAPI(void) ml_DTrees_setUse1SERule(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setUse1SERule(cv::ml::DTrees *obj, int val) { - return obj->setUse1SERule(val != 0); + BEGIN_WRAP + obj->setUse1SERule(val != 0); + END_WRAP } -CVAPI(int) ml_DTrees_getTruncatePrunedTree(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getTruncatePrunedTree(cv::ml::DTrees *obj, int *returnValue) { - return obj->getTruncatePrunedTree() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getTruncatePrunedTree() ? 1 : 0; + END_WRAP } -CVAPI(void) ml_DTrees_setTruncatePrunedTree(DTrees *obj, int val) +CVAPI(ExceptionStatus) ml_DTrees_setTruncatePrunedTree(cv::ml::DTrees *obj, int val) { - return obj->setTruncatePrunedTree(val != 0); + BEGIN_WRAP + obj->setTruncatePrunedTree(val != 0); + END_WRAP } -CVAPI(float) ml_DTrees_getRegressionAccuracy(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getRegressionAccuracy(cv::ml::DTrees *obj, float *returnValue) { - return obj->getRegressionAccuracy(); + BEGIN_WRAP + *returnValue = obj->getRegressionAccuracy(); + END_WRAP } -CVAPI(void) ml_DTrees_setRegressionAccuracy(DTrees *obj, float val) +CVAPI(ExceptionStatus) ml_DTrees_setRegressionAccuracy(cv::ml::DTrees *obj, float val) { - return obj->setRegressionAccuracy(val); + BEGIN_WRAP + obj->setRegressionAccuracy(val); + END_WRAP } -CVAPI(cv::Mat*) ml_DTrees_getPriors(DTrees *obj) +CVAPI(ExceptionStatus) ml_DTrees_getPriors(cv::ml::DTrees *obj, cv::Mat **returnValue) { - cv::Mat m = obj->getPriors(); - return new cv::Mat(m); + BEGIN_WRAP + const auto m = obj->getPriors(); + *returnValue = new cv::Mat(m); + END_WRAP } -CVAPI(void) ml_DTrees_setPriors(DTrees *obj, cv::Mat *val) +CVAPI(ExceptionStatus) ml_DTrees_setPriors(cv::ml::DTrees *obj, cv::Mat *val) { + BEGIN_WRAP obj->setPriors(*val); + END_WRAP } - -CVAPI(void) ml_DTrees_getRoots(DTrees *obj, std::vector *result) +CVAPI(ExceptionStatus) ml_DTrees_getRoots(cv::ml::DTrees *obj, std::vector *result) { - const std::vector &org = obj->getRoots(); + BEGIN_WRAP + const auto& org = obj->getRoots(); result->clear(); - for (size_t i = 0; i < org.size(); i++) + for (auto i : org) { - result->push_back(org[i]); + result->push_back(i); } + END_WRAP } -CVAPI(void) ml_DTrees_getNodes(DTrees *obj, std::vector *result) +CVAPI(ExceptionStatus) ml_DTrees_getNodes(cv::ml::DTrees *obj, std::vector *result) { - const std::vector &org = obj->getNodes(); + BEGIN_WRAP + const auto& org = obj->getNodes(); result->clear(); - for (size_t i = 0; i < org.size(); i++) + for (const auto& i : org) { - result->push_back(c(org[i])); + result->push_back(c(i)); } + END_WRAP } -CVAPI(void) ml_DTrees_getSplits(DTrees *obj, std::vector *result) +CVAPI(ExceptionStatus) ml_DTrees_getSplits(cv::ml::DTrees *obj, std::vector *result) { - const std::vector &org = obj->getSplits(); + BEGIN_WRAP + const auto& org = obj->getSplits(); result->clear(); - for (size_t i = 0; i < org.size(); i++) + for (const auto& i : org) { - result->push_back(c(org[i])); + result->push_back(c(i)); } + END_WRAP } -CVAPI(void) ml_DTrees_getSubsets(DTrees *obj, std::vector *result) +CVAPI(ExceptionStatus) ml_DTrees_getSubsets(cv::ml::DTrees *obj, std::vector *result) { - const std::vector &org = obj->getSubsets(); + BEGIN_WRAP + const auto& org = obj->getSubsets(); result->clear(); - for (size_t i = 0; i < org.size(); i++) + for (auto i : org) { - result->push_back(org[i]); + result->push_back(i); } + END_WRAP } - -CVAPI(cv::Ptr*) ml_DTrees_create() +CVAPI(ExceptionStatus) ml_DTrees_create(cv::Ptr **returnValue) { - cv::Ptr ptr = DTrees::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::DTrees::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_DTrees_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_DTrees_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(DTrees*) ml_Ptr_DTrees_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_DTrees_get(cv::Ptr *obj, cv::ml::DTrees **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_DTrees_load(const char *filePath) +CVAPI(ExceptionStatus) ml_DTrees_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_DTrees_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_DTrees_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::DTrees::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::DTrees::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -#endif diff --git a/src/OpenCvSharpExtern/ml_EM.h b/src/OpenCvSharpExtern/ml_EM.h index 4a0473ccf..96adf893f 100644 --- a/src/OpenCvSharpExtern/ml_EM.h +++ b/src/OpenCvSharpExtern/ml_EM.h @@ -1,51 +1,70 @@ -#ifndef _CPP_ML_EM_H_ -#define _CPP_ML_EM_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::ml; -CVAPI(int) ml_EM_getClustersNumber(EM *obj) +CVAPI(ExceptionStatus) ml_EM_getClustersNumber(cv::ml::EM *obj, int *returnValue) { - return obj->getClustersNumber(); + BEGIN_WRAP + *returnValue = obj->getClustersNumber(); + END_WRAP } -CVAPI(void) ml_EM_setClustersNumber(EM *obj, int val) +CVAPI(ExceptionStatus) ml_EM_setClustersNumber(cv::ml::EM *obj, int val) { + BEGIN_WRAP obj->setClustersNumber(val); + END_WRAP } -CVAPI(int) ml_EM_getCovarianceMatrixType(EM *obj) +CVAPI(ExceptionStatus) ml_EM_getCovarianceMatrixType(cv::ml::EM *obj, int *returnValue) { - return obj->getCovarianceMatrixType(); + BEGIN_WRAP + *returnValue = obj->getCovarianceMatrixType(); + END_WRAP } -CVAPI(void) ml_EM_setCovarianceMatrixType(EM *obj, int val) +CVAPI(ExceptionStatus) ml_EM_setCovarianceMatrixType(cv::ml::EM *obj, int val) { + BEGIN_WRAP obj->setCovarianceMatrixType(val); + END_WRAP } -CVAPI(MyCvTermCriteria) ml_EM_getTermCriteria(EM *obj) +CVAPI(ExceptionStatus) ml_EM_getTermCriteria(cv::ml::EM *obj, MyCvTermCriteria *returnValue) { - return c(obj->getTermCriteria()); + BEGIN_WRAP + *returnValue = c(obj->getTermCriteria()); + END_WRAP } -CVAPI(void) ml_EM_setTermCriteria(EM *obj, MyCvTermCriteria val) +CVAPI(ExceptionStatus) ml_EM_setTermCriteria(cv::ml::EM *obj, MyCvTermCriteria val) { + BEGIN_WRAP obj->setTermCriteria(cpp(val)); + END_WRAP } -CVAPI(cv::Mat*) ml_EM_getWeights(EM *obj) +CVAPI(ExceptionStatus) ml_EM_getWeights(cv::ml::EM *obj, cv::Mat **returnValue) { - cv::Mat m = obj->getWeights(); - return new cv::Mat(m); + BEGIN_WRAP + const auto m = obj->getWeights(); + *returnValue = new cv::Mat(m); + END_WRAP } -CVAPI(cv::Mat*) ml_EM_getMeans(EM *obj) +CVAPI(ExceptionStatus) ml_EM_getMeans(cv::ml::EM *obj, cv::Mat **returnValue) { - cv::Mat m = obj->getMeans(); - return new cv::Mat(m); + BEGIN_WRAP + const auto m = obj->getMeans(); + *returnValue = new cv::Mat(m); + END_WRAP } -CVAPI(void) ml_EM_getCovs(EM *obj, std::vector *covs) +CVAPI(ExceptionStatus) ml_EM_getCovs(cv::ml::EM *obj, std::vector *covs) { + BEGIN_WRAP std::vector raw; obj->getCovs(raw); covs->resize(raw.size()); @@ -53,87 +72,108 @@ CVAPI(void) ml_EM_getCovs(EM *obj, std::vector *covs) { covs->at(i) = new cv::Mat(raw[i]); } + END_WRAP } -CVAPI(CvVec2d) ml_EM_predict2( - EM *obj, cv::_InputArray *sample, cv::_OutputArray *probs) +CVAPI(ExceptionStatus) ml_EM_predict2( + cv::ml::EM *obj, cv::_InputArray *sample, cv::_OutputArray *probs, CvVec2d *returnValue) { - cv::Vec2d vec = obj->predict2(*sample, *probs); + BEGIN_WRAP + auto vec = obj->predict2(*sample, *probs); CvVec2d ret; ret.val[0] = vec[0]; ret.val[1] = vec[1]; - return ret; + *returnValue = ret; + END_WRAP } -CVAPI(int) ml_EM_trainEM( - EM *obj, +CVAPI(ExceptionStatus) ml_EM_trainEM( + cv::ml::EM *obj, cv::_InputArray *samples, cv::_OutputArray *logLikelihoods, cv::_OutputArray *labels, - cv::_OutputArray *probs) + cv::_OutputArray *probs, + int *returnValue) { - bool ret = obj->trainEM(*samples, entity(logLikelihoods), entity(labels), entity(probs)); - return ret ? 1 : 0; + BEGIN_WRAP + const auto ret = obj->trainEM(*samples, entity(logLikelihoods), entity(labels), entity(probs)); + *returnValue = ret ? 1 : 0; + END_WRAP } -CVAPI(int) ml_EM_trainE( - EM *obj, +CVAPI(ExceptionStatus) ml_EM_trainE( + cv::ml::EM *obj, cv::_InputArray *samples, cv::_InputArray *means0, cv::_InputArray *covs0, cv::_InputArray *weights0, cv::_OutputArray *logLikelihoods, cv::_OutputArray *labels, - cv::_OutputArray *probs) + cv::_OutputArray *probs, + int *returnValue) { - bool ret = obj->trainE( + BEGIN_WRAP + const auto ret = obj->trainE( *samples, *means0, entity(covs0), entity(weights0), entity(logLikelihoods), entity(labels), entity(probs)); - return ret ? 1 : 0; + *returnValue = ret ? 1 : 0; + END_WRAP } -CVAPI(int) ml_EM_trainM( - EM *obj, +CVAPI(ExceptionStatus) ml_EM_trainM( + cv::ml::EM *obj, cv::_InputArray *samples, cv::_InputArray *probs0, cv::_OutputArray *logLikelihoods, cv::_OutputArray *labels, - cv::_OutputArray *probs) + cv::_OutputArray *probs, + int *returnValue) { - bool ret = obj->trainM( + BEGIN_WRAP + const auto ret = obj->trainM( *samples, *probs0, entity(logLikelihoods), entity(labels), entity(probs)); - return ret ? 1 : 0; + *returnValue = ret ? 1 : 0; + END_WRAP } -CVAPI(cv::Ptr*) ml_EM_create() +CVAPI(ExceptionStatus) ml_EM_create(cv::Ptr **returnValue) { - cv::Ptr obj = EM::create(); - return new cv::Ptr(obj); + BEGIN_WRAP + const auto obj = cv::ml::EM::create(); + *returnValue = new cv::Ptr(obj); + END_WRAP } -CVAPI(void) ml_Ptr_EM_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_EM_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(EM*) ml_Ptr_EM_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_EM_get(cv::Ptr *obj, cv::ml::EM **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_EM_load(const char *filePath) +CVAPI(ExceptionStatus) ml_EM_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_EM_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_EM_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::EM::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::EM::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -#endif diff --git a/src/OpenCvSharpExtern/ml_KNearest.h b/src/OpenCvSharpExtern/ml_KNearest.h index 282912efb..a5f6ddc69 100644 --- a/src/OpenCvSharpExtern/ml_KNearest.h +++ b/src/OpenCvSharpExtern/ml_KNearest.h @@ -1,82 +1,110 @@ -#ifndef _CPP_ML_KNEAREST_H_ -#define _CPP_ML_KNEAREST_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::ml; -CVAPI(int) ml_KNearest_getDefaultK(KNearest *obj) +CVAPI(ExceptionStatus) ml_KNearest_getDefaultK(cv::ml::KNearest *obj, int *returnValue) { - return obj->getDefaultK(); + BEGIN_WRAP + *returnValue = obj->getDefaultK(); + END_WRAP } -CVAPI(void) ml_KNearest_setDefaultK(KNearest *obj, int val) +CVAPI(ExceptionStatus) ml_KNearest_setDefaultK(cv::ml::KNearest *obj, int val) { + BEGIN_WRAP obj->setDefaultK(val); + END_WRAP } -CVAPI(int) ml_KNearest_getIsClassifier(KNearest *obj) +CVAPI(ExceptionStatus) ml_KNearest_getIsClassifier(cv::ml::KNearest *obj, int *returnValue) { - return obj->getIsClassifier() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getIsClassifier() ? 1 : 0; + END_WRAP } -CVAPI(void) ml_KNearest_setIsClassifier(KNearest *obj, int val) +CVAPI(ExceptionStatus) ml_KNearest_setIsClassifier(cv::ml::KNearest *obj, int val) { + BEGIN_WRAP obj->setIsClassifier(val != 0); + END_WRAP } -CVAPI(int) ml_KNearest_getEmax(KNearest *obj) +CVAPI(ExceptionStatus) ml_KNearest_getEmax(cv::ml::KNearest *obj, int *returnValue) { - return obj->getEmax(); + BEGIN_WRAP + *returnValue = obj->getEmax(); + END_WRAP } -CVAPI(void) ml_KNearest_setEmax(KNearest *obj, int val) +CVAPI(ExceptionStatus) ml_KNearest_setEmax(cv::ml::KNearest *obj, int val) { + BEGIN_WRAP obj->setEmax(val); + END_WRAP } -CVAPI(int) ml_KNearest_getAlgorithmType(KNearest *obj) +CVAPI(ExceptionStatus) ml_KNearest_getAlgorithmType(cv::ml::KNearest *obj, int *returnValue) { - return obj->getAlgorithmType(); + BEGIN_WRAP + *returnValue = obj->getAlgorithmType(); + END_WRAP } -CVAPI(void) ml_KNearest_setAlgorithmType(KNearest *obj, int val) +CVAPI(ExceptionStatus) ml_KNearest_setAlgorithmType(cv::ml::KNearest *obj, int val) { + BEGIN_WRAP obj->setAlgorithmType(val); + END_WRAP } -CVAPI(float) ml_KNearest_findNearest(KNearest *obj, cv::_InputArray *samples, int k, - cv::_OutputArray *results, cv::_OutputArray *neighborResponses, cv::_OutputArray *dist) +CVAPI(ExceptionStatus) ml_KNearest_findNearest(cv::ml::KNearest *obj, cv::_InputArray *samples, int k, + cv::_OutputArray *results, cv::_OutputArray *neighborResponses, cv::_OutputArray *dist, float *returnValue) { - return obj->findNearest( + BEGIN_WRAP + *returnValue = obj->findNearest( entity(samples), k, entity(results), entity(neighborResponses), entity(dist)); + END_WRAP } -CVAPI(cv::Ptr*) ml_KNearest_create() +CVAPI(ExceptionStatus) ml_KNearest_create(cv::Ptr **returnValue) { - cv::Ptr ptr = KNearest::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::KNearest::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_KNearest_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_KNearest_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(KNearest*) ml_Ptr_KNearest_get(cv::Ptr* obj) +CVAPI(ExceptionStatus) ml_Ptr_KNearest_get(cv::Ptr* obj, cv::ml::KNearest **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_KNearest_load(const char *filePath) +CVAPI(ExceptionStatus) ml_KNearest_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_KNearest_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_KNearest_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::KNearest::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::KNearest::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/ml_LogisticRegression.h b/src/OpenCvSharpExtern/ml_LogisticRegression.h index 685585edd..c8c7027ad 100644 --- a/src/OpenCvSharpExtern/ml_LogisticRegression.h +++ b/src/OpenCvSharpExtern/ml_LogisticRegression.h @@ -1,104 +1,143 @@ -#ifndef _CPP_ML_LOGISTICREGRESSION_H_ -#define _CPP_ML_LOGISTICREGRESSION_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::ml; +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +#include "include_opencv.h" -CVAPI(double) ml_LogisticRegression_getLearningRate(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_getLearningRate(cv::ml::LogisticRegression *obj, double *returnValue) { - return obj->getLearningRate(); + BEGIN_WRAP + *returnValue = obj->getLearningRate(); + END_WRAP } -CVAPI(void) ml_LogisticRegression_setLearningRate(LogisticRegression *obj, double val) +CVAPI(ExceptionStatus) ml_LogisticRegression_setLearningRate(cv::ml::LogisticRegression *obj, double val) { + BEGIN_WRAP obj->setLearningRate(val); + END_WRAP } -CVAPI(int) ml_LogisticRegression_getIterations(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_getIterations(cv::ml::LogisticRegression *obj, int *returnValue) { - return obj->getIterations(); + BEGIN_WRAP + *returnValue = obj->getIterations(); + END_WRAP } -CVAPI(void) ml_LogisticRegression_setIterations(LogisticRegression *obj, int val) +CVAPI(ExceptionStatus) ml_LogisticRegression_setIterations(cv::ml::LogisticRegression *obj, int val) { + BEGIN_WRAP obj->setIterations(val); + END_WRAP } -CVAPI(int) ml_LogisticRegression_getRegularization(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_getRegularization(cv::ml::LogisticRegression *obj, int *returnValue) { - return obj->getRegularization(); + BEGIN_WRAP + *returnValue = obj->getRegularization(); + END_WRAP } -CVAPI(void) ml_LogisticRegression_setRegularization(LogisticRegression *obj, int val) +CVAPI(ExceptionStatus) ml_LogisticRegression_setRegularization(cv::ml::LogisticRegression *obj, int val) { + BEGIN_WRAP obj->setRegularization(val); + END_WRAP } -CVAPI(int) ml_LogisticRegression_getTrainMethod(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_getTrainMethod(cv::ml::LogisticRegression *obj, int *returnValue) { - return obj->getTrainMethod(); + BEGIN_WRAP + *returnValue = obj->getTrainMethod(); + END_WRAP } -CVAPI(void) ml_LogisticRegression_setTrainMethod(LogisticRegression *obj, int val) +CVAPI(ExceptionStatus) ml_LogisticRegression_setTrainMethod(cv::ml::LogisticRegression *obj, int val) { + BEGIN_WRAP obj->setTrainMethod(val); + END_WRAP } -CVAPI(int) ml_LogisticRegression_getMiniBatchSize(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_getMiniBatchSize(cv::ml::LogisticRegression *obj, int *returnValue) { - return obj->getMiniBatchSize(); + BEGIN_WRAP + *returnValue = obj->getMiniBatchSize(); + END_WRAP } -CVAPI(void) ml_LogisticRegression_setMiniBatchSize(LogisticRegression *obj, int val) +CVAPI(ExceptionStatus) ml_LogisticRegression_setMiniBatchSize(cv::ml::LogisticRegression *obj, int val) { + BEGIN_WRAP obj->setMiniBatchSize(val); + END_WRAP } -CVAPI(MyCvTermCriteria) ml_LogisticRegression_getTermCriteria(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_getTermCriteria(cv::ml::LogisticRegression *obj, MyCvTermCriteria *returnValue) { - return c(obj->getTermCriteria()); + BEGIN_WRAP + *returnValue = c(obj->getTermCriteria()); + END_WRAP } -CVAPI(void) ml_LogisticRegression_setTermCriteria(LogisticRegression *obj, MyCvTermCriteria val) +CVAPI(ExceptionStatus) ml_LogisticRegression_setTermCriteria(cv::ml::LogisticRegression *obj, MyCvTermCriteria val) { + BEGIN_WRAP obj->setTermCriteria(cpp(val)); + END_WRAP } -CVAPI(float) ml_LogisticRegression_predict( - LogisticRegression *obj, cv::_InputArray *samples, cv::_OutputArray *results, int flags) +CVAPI(ExceptionStatus) ml_LogisticRegression_predict( + cv::ml::LogisticRegression *obj, cv::_InputArray *samples, cv::_OutputArray *results, int flags, float *returnValue) { - return obj->predict(entity(samples), entity(results), flags); + BEGIN_WRAP + *returnValue = obj->predict(entity(samples), entity(results), flags); + END_WRAP } -CVAPI(cv::Mat*) ml_LogisticRegression_get_learnt_thetas(LogisticRegression *obj) +CVAPI(ExceptionStatus) ml_LogisticRegression_get_learnt_thetas(cv::ml::LogisticRegression *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->get_learnt_thetas()); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->get_learnt_thetas()); + END_WRAP } -CVAPI(cv::Ptr*) ml_LogisticRegression_create() +CVAPI(ExceptionStatus) ml_LogisticRegression_create(cv::Ptr **returnValue) { - cv::Ptr ptr = LogisticRegression::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::LogisticRegression::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_LogisticRegression_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_LogisticRegression_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(LogisticRegression*) ml_Ptr_LogisticRegression_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_LogisticRegression_get( + cv::Ptr *obj, cv::ml::LogisticRegression **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_LogisticRegression_load(const char *filePath) +CVAPI(ExceptionStatus) ml_LogisticRegression_load( + const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_LogisticRegression_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_LogisticRegression_loadFromString( + const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::LogisticRegression::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::LogisticRegression::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/ml_NormalBayesClassifier.h b/src/OpenCvSharpExtern/ml_NormalBayesClassifier.h index 81fadd1c6..483b9da96 100644 --- a/src/OpenCvSharpExtern/ml_NormalBayesClassifier.h +++ b/src/OpenCvSharpExtern/ml_NormalBayesClassifier.h @@ -1,45 +1,56 @@ -#ifndef _CPP_ML_NORMALBAYESCLASSIFIER_H_ -#define _CPP_ML_NORMALBAYESCLASSIFIER_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::ml; +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +// ReSharper disable CppInconsistentNaming +#include "include_opencv.h" -CVAPI(float) ml_NormalBayesClassifier_predictProb( - NormalBayesClassifier *obj, cv::_InputArray *inputs, - cv::_OutputArray *samples, cv::_OutputArray *outputProbs, int flags) +CVAPI(ExceptionStatus) ml_NormalBayesClassifier_predictProb( + cv::ml::NormalBayesClassifier *obj, cv::_InputArray *inputs, + cv::_OutputArray *samples, cv::_OutputArray *outputProbs, int flags, float *returnValue) { - return obj->predictProb(entity(inputs), entity(samples), entity(outputProbs), flags); + BEGIN_WRAP + *returnValue = obj->predictProb(entity(inputs), entity(samples), entity(outputProbs), flags); + END_WRAP } -CVAPI(cv::Ptr*) ml_NormalBayesClassifier_create() +CVAPI(ExceptionStatus) ml_NormalBayesClassifier_create(cv::Ptr **returnValue) { - cv::Ptr ptr = NormalBayesClassifier::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::NormalBayesClassifier::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_NormalBayesClassifier_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_NormalBayesClassifier_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(NormalBayesClassifier*) ml_Ptr_NormalBayesClassifier_get( - cv::Ptr* obj) +CVAPI(ExceptionStatus) ml_Ptr_NormalBayesClassifier_get( + cv::Ptr* obj, cv::ml::NormalBayesClassifier **returnValue) + { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_NormalBayesClassifier_load(const char *filePath) +CVAPI(ExceptionStatus) ml_NormalBayesClassifier_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_NormalBayesClassifier_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_NormalBayesClassifier_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::NormalBayesClassifier::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::NormalBayesClassifier::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/ml_RTrees.h b/src/OpenCvSharpExtern/ml_RTrees.h index 5291f16d3..95c63c507 100644 --- a/src/OpenCvSharpExtern/ml_RTrees.h +++ b/src/OpenCvSharpExtern/ml_RTrees.h @@ -1,69 +1,94 @@ -#ifndef _CPP_ML_RTREES_H_ -#define _CPP_ML_RTREES_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::ml; -CVAPI(int) ml_RTrees_getCalculateVarImportance(RTrees *obj) +CVAPI(ExceptionStatus) ml_RTrees_getCalculateVarImportance(cv::ml::RTrees *obj, int *returnValue) { - return obj->getCalculateVarImportance() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getCalculateVarImportance() ? 1 : 0; + END_WRAP } -CVAPI(void) ml_RTrees_setCalculateVarImportance(RTrees *obj, int val) +CVAPI(ExceptionStatus) ml_RTrees_setCalculateVarImportance(cv::ml::RTrees *obj, int val) { + BEGIN_WRAP obj->setCalculateVarImportance(val != 0); + END_WRAP } -CVAPI(int) ml_RTrees_getActiveVarCount(RTrees *obj) +CVAPI(ExceptionStatus) ml_RTrees_getActiveVarCount(cv::ml::RTrees *obj, int *returnValue) { - return obj->getActiveVarCount(); + BEGIN_WRAP + *returnValue = obj->getActiveVarCount(); + END_WRAP } -CVAPI(void) ml_RTrees_setActiveVarCount(RTrees *obj, int val) +CVAPI(ExceptionStatus) ml_RTrees_setActiveVarCount(cv::ml::RTrees *obj, int val) { + BEGIN_WRAP obj->setActiveVarCount(val); + END_WRAP } -CVAPI(MyCvTermCriteria) ml_RTrees_getTermCriteria(RTrees *obj) +CVAPI(ExceptionStatus) ml_RTrees_getTermCriteria(cv::ml::RTrees *obj, MyCvTermCriteria *returnValue) { - return c(obj->getTermCriteria()); + BEGIN_WRAP + *returnValue = c(obj->getTermCriteria()); + END_WRAP } -CVAPI(void) ml_RTrees_setTermCriteria(RTrees *obj, MyCvTermCriteria val) +CVAPI(ExceptionStatus) ml_RTrees_setTermCriteria(cv::ml::RTrees *obj, MyCvTermCriteria val) { + BEGIN_WRAP obj->setTermCriteria(cpp(val)); + END_WRAP } -CVAPI(cv::Mat*) ml_RTrees_getVarImportance(RTrees *obj) +CVAPI(ExceptionStatus) ml_RTrees_getVarImportance(cv::ml::RTrees *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->getVarImportance()); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->getVarImportance()); + END_WRAP } -CVAPI(cv::Ptr*) ml_RTrees_create() +CVAPI(ExceptionStatus) ml_RTrees_create(cv::Ptr **returnValue) { - cv::Ptr ptr = RTrees::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::RTrees::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_RTrees_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_RTrees_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(RTrees*) ml_Ptr_RTrees_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_RTrees_get(cv::Ptr *obj, cv::ml::RTrees **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_RTrees_load(const char *filePath) +CVAPI(ExceptionStatus) ml_RTrees_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::Algorithm::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Algorithm::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_RTrees_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_RTrees_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::RTrees::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::RTrees::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -#endif diff --git a/src/OpenCvSharpExtern/ml_SVM.h b/src/OpenCvSharpExtern/ml_SVM.h index 851ffaeaa..9c3f3634e 100644 --- a/src/OpenCvSharpExtern/ml_SVM.h +++ b/src/OpenCvSharpExtern/ml_SVM.h @@ -1,149 +1,202 @@ -#ifndef _CPP_ML_SVM_H_ -#define _CPP_ML_SVM_H_ +#pragma once + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +// ReSharper disable once CppInconsistentNaming #include "include_opencv.h" #include "ml.h" -using namespace cv::ml; - - -CVAPI(int) ml_SVM_getType(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getType(cv::ml::SVM *obj, int *returnValue) { - return obj->getType(); + BEGIN_WRAP + *returnValue = obj->getType(); + END_WRAP } -CVAPI(void) ml_SVM_setType(SVM *obj, int val) +CVAPI(ExceptionStatus) ml_SVM_setType(cv::ml::SVM *obj, int val) { + BEGIN_WRAP obj->setType(val); + END_WRAP } -CVAPI(double) ml_SVM_getGamma(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getGamma(cv::ml::SVM *obj, double *returnValue) { - return obj->getGamma(); + BEGIN_WRAP + *returnValue = obj->getGamma(); + END_WRAP } -CVAPI(void) ml_SVM_setGamma(SVM *obj, double val) +CVAPI(ExceptionStatus) ml_SVM_setGamma(cv::ml::SVM *obj, double val) { + BEGIN_WRAP obj->setGamma(val); + END_WRAP } -CVAPI(double) ml_SVM_getCoef0(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getCoef0(cv::ml::SVM *obj, double *returnValue) { - return obj->getCoef0(); + BEGIN_WRAP + *returnValue = obj->getCoef0(); + END_WRAP } -CVAPI(void) ml_SVM_setCoef0(SVM *obj, double val) +CVAPI(ExceptionStatus) ml_SVM_setCoef0(cv::ml::SVM *obj, double val) { + BEGIN_WRAP obj->setCoef0(val); + END_WRAP } -CVAPI(double) ml_SVM_getDegree(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getDegree(cv::ml::SVM *obj, double *returnValue) { - return obj->getDegree(); + BEGIN_WRAP + *returnValue = obj->getDegree(); + END_WRAP } -CVAPI(void) ml_SVM_setDegree(SVM *obj, double val) +CVAPI(ExceptionStatus) ml_SVM_setDegree(cv::ml::SVM *obj, double val) { + BEGIN_WRAP obj->setDegree(val); + END_WRAP } -CVAPI(double) ml_SVM_getC(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getC(cv::ml::SVM *obj, double *returnValue) { - return obj->getC(); + BEGIN_WRAP + *returnValue = obj->getC(); + END_WRAP } -CVAPI(void) ml_SVM_setC(SVM *obj, double val) +CVAPI(ExceptionStatus) ml_SVM_setC(cv::ml::SVM *obj, double val) { + BEGIN_WRAP obj->setC(val); + END_WRAP } -CVAPI(double) ml_SVM_getP(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getP(cv::ml::SVM *obj, double *returnValue) { - return obj->getP(); + BEGIN_WRAP + *returnValue = obj->getP(); + END_WRAP } -CVAPI(void) ml_SVM_setP(SVM *obj, double val) +CVAPI(ExceptionStatus) ml_SVM_setP(cv::ml::SVM *obj, double val) { + BEGIN_WRAP obj->setP(val); + END_WRAP } -CVAPI(double) ml_SVM_getNu(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getNu(cv::ml::SVM *obj, double *returnValue) { - return obj->getNu(); + BEGIN_WRAP + *returnValue = obj->getNu(); + END_WRAP } -CVAPI(void) ml_SVM_setNu(SVM *obj, double val) +CVAPI(ExceptionStatus) ml_SVM_setNu(cv::ml::SVM *obj, double val) { + BEGIN_WRAP obj->setNu(val); + END_WRAP } -CVAPI(cv::Mat*) ml_SVM_getClassWeights(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getClassWeights(cv::ml::SVM *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->getClassWeights()); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->getClassWeights()); + END_WRAP } -CVAPI(void) ml_SVM_setClassWeights(SVM *obj, cv::Mat *val) +CVAPI(ExceptionStatus) ml_SVM_setClassWeights(cv::ml::SVM *obj, cv::Mat *val) { + BEGIN_WRAP obj->setClassWeights(*val); + END_WRAP } -CVAPI(MyCvTermCriteria) ml_SVM_getTermCriteria(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getTermCriteria(cv::ml::SVM *obj, MyCvTermCriteria *returnValue) { - return c(obj->getTermCriteria()); + BEGIN_WRAP + *returnValue = c(obj->getTermCriteria()); + END_WRAP } -CVAPI(void) ml_SVM_setTermCriteria(SVM *obj, MyCvTermCriteria val) +CVAPI(ExceptionStatus) ml_SVM_setTermCriteria(cv::ml::SVM *obj, MyCvTermCriteria val) { + BEGIN_WRAP obj->setTermCriteria(cpp(val)); + END_WRAP } -CVAPI(int) ml_SVM_getKernelType(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getKernelType(cv::ml::SVM *obj, int *returnValue) { - return obj->getKernelType(); + BEGIN_WRAP + *returnValue = obj->getKernelType(); + END_WRAP } -CVAPI(void) ml_SVM_setKernel(SVM *obj, int kernelType) +CVAPI(ExceptionStatus) ml_SVM_setKernel(cv::ml::SVM *obj, int kernelType) { + BEGIN_WRAP obj->setKernel(kernelType); + END_WRAP } -CVAPI(cv::Mat*) ml_SVM_getSupportVectors(SVM *obj) +CVAPI(ExceptionStatus) ml_SVM_getSupportVectors(cv::ml::SVM *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->getSupportVectors()); + BEGIN_WRAP + *returnValue = new cv::Mat(obj->getSupportVectors()); + END_WRAP } -CVAPI(double) ml_SVM_getDecisionFunction( - cv::ml::SVM *obj, int i, cv::_OutputArray *alpha, cv::_OutputArray *svidx) +CVAPI(ExceptionStatus) ml_SVM_getDecisionFunction( + cv::ml::SVM *obj, int i, cv::_OutputArray *alpha, cv::_OutputArray *svidx, double *returnValue) { - return obj->getDecisionFunction(i, entity(alpha), entity(svidx)); + BEGIN_WRAP + *returnValue = obj->getDecisionFunction(i, entity(alpha), entity(svidx)); + END_WRAP } // static -CVAPI(ParamGridStruct) ml_SVM_getDefaultGrid(int param_id) +CVAPI(ExceptionStatus) ml_SVM_getDefaultGrid(int param_id, ParamGridStruct *returnValue) { - return c(cv::ml::SVM::getDefaultGrid(param_id)); + BEGIN_WRAP + *returnValue = c(cv::ml::SVM::getDefaultGrid(param_id)); + END_WRAP } -CVAPI(cv::Ptr*) ml_SVM_create() +CVAPI(ExceptionStatus) ml_SVM_create(cv::Ptr **returnValue) { - cv::Ptr ptr = SVM::create(); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::SVM::create(); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(void) ml_Ptr_SVM_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ml_Ptr_SVM_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::ml::SVM*) ml_Ptr_SVM_get(cv::Ptr* obj) +CVAPI(ExceptionStatus) ml_Ptr_SVM_get(cv::Ptr* obj, cv::ml::SVM **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::Ptr*) ml_SVM_load(const char *filePath) +CVAPI(ExceptionStatus) ml_SVM_load(const char *filePath, cv::Ptr **returnValue) { - cv::Ptr ptr = SVM::load(filePath); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::ml::SVM::load(filePath); + *returnValue = new cv::Ptr(ptr); + END_WRAP } -CVAPI(cv::Ptr*) ml_SVM_loadFromString(const char *strModel) +CVAPI(ExceptionStatus) ml_SVM_loadFromString(const char *strModel, cv::Ptr **returnValue) { - cv::String objname = cv::ml::SVM::create()->getDefaultName(); - cv::Ptr ptr = cv::Algorithm::loadFromString(strModel, objname); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto objName = cv::ml::SVM::create()->getDefaultName(); + const auto ptr = cv::Algorithm::loadFromString(strModel, objName); + *returnValue = new cv::Ptr(ptr); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/ml_StatModel.h b/src/OpenCvSharpExtern/ml_StatModel.h index c5f6b123b..78504d050 100644 --- a/src/OpenCvSharpExtern/ml_StatModel.h +++ b/src/OpenCvSharpExtern/ml_StatModel.h @@ -1,64 +1,73 @@ -#ifndef _CPP_ML_STATMODEL_H_ -#define _CPP_ML_STATMODEL_H_ +#pragma once -#include "include_opencv.h" -using namespace cv::ml; +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +#include "include_opencv.h" -CVAPI(void) ml_StatModel_clear(StatModel *obj) +CVAPI(ExceptionStatus) ml_StatModel_clear(cv::ml::StatModel *obj) { + BEGIN_WRAP obj->clear(); + END_WRAP } -CVAPI(int) ml_StatModel_getVarCount(StatModel *obj) -{ - return obj->getVarCount(); -} - -CVAPI(int) ml_StatModel_empty(StatModel *obj) +CVAPI(ExceptionStatus) ml_StatModel_getVarCount(cv::ml::StatModel *obj, int *returnValue) { - return obj->empty() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getVarCount(); + END_WRAP } -CVAPI(int) ml_StatModel_isTrained(StatModel *obj) +CVAPI(ExceptionStatus) ml_StatModel_empty(cv::ml::StatModel *obj, int *returnValue) { - return obj->isTrained() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP } -CVAPI(int) ml_StatModel_isClassifier(StatModel *obj) +CVAPI(ExceptionStatus) ml_StatModel_isTrained(cv::ml::StatModel *obj, int *returnValue) { - return obj->isClassifier() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isTrained() ? 1 : 0; + END_WRAP } - -CVAPI(int) ml_StatModel_train1( - StatModel *obj, cv::Ptr *trainData, int flags) +CVAPI(ExceptionStatus) ml_StatModel_isClassifier(cv::ml::StatModel *obj, int *returnValue) { - return obj->train(*trainData, flags) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isClassifier() ? 1 : 0; + END_WRAP } -CVAPI(int) ml_StatModel_train2( - StatModel *obj, cv::_InputArray *samples, int layout, cv::_InputArray *responses) +/*CVAPI(ExceptionStatus) ml_StatModel_train1( + cv::ml::StatModel *obj, cv::Ptr *trainData, int flags, int *returnValue) { - return obj->train(*samples, layout, *responses) ? 1 : 0; -} + BEGIN_WRAP + *returnValue = obj->train(*trainData, flags) ? 1 : 0; + END_WRAP +}*/ -CVAPI(float) ml_StatModel_calcError( - StatModel *obj, cv::Ptr *data, int test, cv::_OutputArray *resp) +CVAPI(ExceptionStatus) ml_StatModel_train2( + cv::ml::StatModel *obj, cv::_InputArray *samples, int layout, cv::_InputArray *responses, int *returnValue) { - return obj->calcError(*data, test != 0, *resp); + BEGIN_WRAP + *returnValue = obj->train(*samples, layout, *responses) ? 1 : 0; + END_WRAP } -CVAPI(float) ml_StatModel_predict( - StatModel *obj, cv::_InputArray *samples, cv::_OutputArray *results, int flags) +/*CVAPI(ExceptionStatus) ml_StatModel_calcError( + cv::ml::StatModel *obj, cv::Ptr *data, int test, cv::_OutputArray *resp, float *returnValue) { - return obj->predict(entity(samples), entity(results), flags); -} + BEGIN_WRAP + *returnValue = obj->calcError(*data, test != 0, *resp); + END_WRAP +}*/ - -CVAPI(void) ml_StatModel_save(StatModel *obj, const char *filename) +CVAPI(ExceptionStatus) ml_StatModel_predict( + cv::ml::StatModel *obj, cv::_InputArray *samples, cv::_OutputArray *results, int flags, float *returnValue) { - return obj->save(cv::String(filename)); + BEGIN_WRAP + *returnValue = obj->predict(entity(samples), entity(results), flags); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/my_functions.h b/src/OpenCvSharpExtern/my_functions.h index ccd894fa3..80f135877 100644 --- a/src/OpenCvSharpExtern/my_functions.h +++ b/src/OpenCvSharpExtern/my_functions.h @@ -1,16 +1,37 @@ // Additional functions -#ifndef _MY_FUNCTIONS_H_ -#define _MY_FUNCTIONS_H_ +#pragma once + +#ifdef _WIN32 +#pragma warning(disable: 4996) +#endif #include -#include "my_types.h" + #ifdef _WIN32 +#ifdef _DEBUG #include + +// MP! Added: To provide WinRT version of MessageBox handling. +#ifdef _WINRT_DLL +void StringConvert(const std::string from, std::wstring& to); +void StringConvert(const std::wstring from, std::string& to); +#endif + static int p(const char *msg, const char caption[] = "MessageBox") { - return MessageBoxA(NULL, msg, caption, MB_OK); +#ifdef _WINRT_DLL + std::wstring wmsg; + std::wstring wcaption; + StringConvert(msg, wmsg); + StringConvert(caption, wcaption); + + Windows::UI::Popups::MessageDialog(ref new Platform::String(wmsg.c_str()), ref new Platform::String(wcaption.c_str())).ShowAsync(); + return MB_OK; +#else + return MessageBoxA(nullptr, msg, caption, MB_OK); +#endif } template @@ -20,10 +41,8 @@ static int p(T obj, const std::string &caption = "MessageBox") ss << obj; return p(ss.str().c_str(), caption.c_str()); } -#undef min -#undef max #endif - +#endif #if defined WIN32 || defined _WIN32 @@ -39,34 +58,41 @@ static int p(T obj, const std::string &caption = "MessageBox") #endif +// catch all exception +enum class ExceptionStatus : int { NotOccurred = 0, Occurred = 1 }; + +#if defined WIN32 || defined _WIN32 +#define BEGIN_WRAP +#define END_WRAP return ExceptionStatus::NotOccurred; +#else +#define BEGIN_WRAP try{ +#define END_WRAP return ExceptionStatus::NotOccurred;}catch(std::exception){return ExceptionStatus::Occurred;} +#endif + static cv::_InputArray entity(cv::_InputArray *obj) { - return (obj != NULL) ? *obj : static_cast(cv::noArray()); + return (obj != nullptr) ? *obj : static_cast(cv::noArray()); } static cv::_OutputArray entity(cv::_OutputArray *obj) { - return (obj != NULL) ? *obj : static_cast(cv::noArray()); + return (obj != nullptr) ? *obj : static_cast(cv::noArray()); } static cv::_InputOutputArray entity(cv::_InputOutputArray *obj) { - return (obj != NULL) ? *obj : cv::noArray(); + return (obj != nullptr) ? *obj : cv::noArray(); } static cv::Mat entity(cv::Mat *obj) { - return (obj != NULL) ? *obj : cv::Mat(); -} -static cv::SparseMat entity(cv::SparseMat *obj) -{ - return (obj != NULL) ? *obj : cv::SparseMat(); + return (obj != nullptr) ? *obj : cv::Mat(); } -static cv::cuda::GpuMat entity(cv::cuda::GpuMat *obj) +static cv::UMat entity(cv::UMat* obj) { - return (obj != NULL) ? *obj : cv::cuda::GpuMat(); + return (obj != nullptr) ? *obj : cv::UMat(); } -static cv::cuda::Stream entity(cv::cuda::Stream *obj) +static cv::SparseMat entity(cv::SparseMat *obj) { - return (obj != NULL) ? *obj : cv::cuda::Stream::Null(); + return (obj != nullptr) ? *obj : cv::SparseMat(); } template @@ -77,30 +103,25 @@ static cv::Ptr *clone(const cv::Ptr &ptr) static void copyString(const char *src, char *dst, int dstLength) { + const auto length = static_cast(std::max(0, dstLength - 1)); if (strlen(src) == 0) - std::strncpy(dst, "", dstLength - 1); + std::strncpy(dst, "", length); else - std::strncpy(dst, src, dstLength - 1); + std::strncpy(dst, src, length); } static void copyString(const std::string &src, char *dst, int dstLength) { + const auto length = static_cast(std::max(0, dstLength - 1)); if (src.empty()) - std::strncpy(dst, "", dstLength - 1); - else - std::strncpy(dst, src.c_str(), dstLength - 1); -} -static void copyString(const cv::String &src, char *dst, int dstLength) -{ - if (src.empty()) - std::strncpy(dst, "", dstLength - 1); + std::strncpy(dst, "", length); else - std::strncpy(dst, src.c_str(), dstLength - 1); + std::strncpy(dst, src.c_str(), length); } template static void dump(T *obj, const std::string &outFile) { - int size = sizeof(T); + const int size = sizeof(T); std::vector bytes(size); std::memcpy(&bytes[0], reinterpret_cast(obj), size); @@ -113,7 +134,17 @@ static void dump(T *obj, const std::string &outFile) } static void toVec( - cv::Mat **inPtr, int size, std::vector &outVec) + const cv::Mat **inPtr, const int size, std::vector &outVec) +{ + outVec.resize(size); + for (int i = 0; i < size; i++) + { + outVec[i] = *inPtr[i]; + } +} + +static void toVec( + cv::Mat **inPtr, const int size, std::vector &outVec) { outVec.resize(size); for (int i = 0; i < size; i++) @@ -124,21 +155,28 @@ static void toVec( template static void toVec( - TIn **inPtr, int size1, const int *size2, std::vector > &outVec) + const TIn **inPtr, const int size1, const int *size2, std::vector > &outVec) { outVec.resize(size1); for (int i = 0; i < size1; i++) { int size = size2[i]; - TIn *p = inPtr[i]; + const TIn *p = inPtr[i]; std::vector v(p, p + size); - /*std::vector v(size); - for (int j = 0; j < size; j++) - { - v[j] = inPtr[i][j]; - }*/ outVec[i] = v; } } -#endif \ No newline at end of file +template +static void copyFromVectorToArray(std::vector >* src, T** dst) +{ + for (size_t i = 0; i < src->size(); ++i) + { + const auto& srcI = src->at(i); + const auto dstI = dst[i]; + for (size_t j = 0; j < srcI.size(); ++j) + { + dstI[j] = srcI[j]; + } + } +} \ No newline at end of file diff --git a/src/OpenCvSharpExtern/my_types.h b/src/OpenCvSharpExtern/my_types.h index e7a6f079b..2604d622b 100644 --- a/src/OpenCvSharpExtern/my_types.h +++ b/src/OpenCvSharpExtern/my_types.h @@ -1,12 +1,8 @@ // Additional types -#ifndef _MY_TYPES_H_ -#define _MY_TYPES_H_ +#pragma once -typedef unsigned char uchar; -typedef unsigned short uint16; -typedef unsigned short ushort; -typedef unsigned int uint32; +#include "my_functions.h" namespace cv { @@ -15,33 +11,60 @@ namespace cv typedef cv::Vec Vec6w; } -extern "C" +extern "C" { - #pragma region OpenCV1.0-compatible Types +#pragma region OpenCV1.0-compatible Types struct MyCvPoint { int x; int y; }; - struct MyCvPoint2D32f { float x; float y; }; + struct MyCvPoint2D64f + { + double x; + double y; + }; + + struct MyCvPoint3D32i + { + int x; + int y; + int z; + }; + struct MyCvPoint3D32f + { + float x; + float y; + float z; + }; + struct MyCvPoint3D64f + { + double x; + double y; + double z; + }; struct MyCvSize { int width; int height; }; - struct MyCvSize2D32f { float width; float height; }; + struct MyCvSize2D64f + { + double width; + double height; + }; struct MyCvRect { @@ -50,6 +73,20 @@ extern "C" int width; int height; }; + struct MyCvRect2D32f + { + float x; + float y; + float width; + float height; + }; + struct MyCvRect2D64f + { + double x; + double y; + double width; + double height; + }; struct MyCvScalar { @@ -77,12 +114,30 @@ extern "C" struct MyCvBox2D { - MyCvPoint2D32f center; + MyCvPoint2D32f center; MyCvSize2D32f size; float angle; }; - #pragma endregion + struct MyKeyPoint + { + MyCvPoint2D32f pt; + float size; + float angle; + float response; + int octave; + int class_id; + }; + + struct MyDMatch + { + int queryIdx; + int trainIdx; + int imgIdx; + float distance; + }; + +#pragma endregion struct CvPoint3D { @@ -91,30 +146,6 @@ extern "C" int z; }; - struct aruco_DetectorParameters - { - int adaptiveThreshWinSizeMin; - int adaptiveThreshWinSizeMax; - int adaptiveThreshWinSizeStep; - double adaptiveThreshConstant; - double minMarkerPerimeterRate; - double maxMarkerPerimeterRate; - double polygonalApproxAccuracyRate; - double minCornerDistanceRate; - int minDistanceToBorder; - double minMarkerDistanceRate; - int doCornerRefinement; // bool - int cornerRefinementWinSize; - int cornerRefinementMaxIterations; - double cornerRefinementMinAccuracy; - int markerBorderBits; - int perspectiveRemovePixelPerCell; - double perspectiveRemoveIgnoredMarginPerCell; - double maxErroneousBitsInBorderRate; - double minOtsuStdDev; - double errorCorrectionRate; - }; - typedef struct CvVec2b { uchar val[2]; } CvVec2b; typedef struct CvVec3b { uchar val[3]; } CvVec3b; typedef struct CvVec4b { uchar val[4]; } CvVec4b; @@ -139,100 +170,169 @@ extern "C" typedef struct CvVec3d { double val[3]; } CvVec3d; typedef struct CvVec4d { double val[4]; } CvVec4d; typedef struct CvVec6d { double val[6]; } CvVec6d; -} -static MyCvPoint c(cv::Point p) + /** @brief Structure containing image keypoints and descriptors. */ + struct CV_EXPORTS_W_SIMPLE detail_ImageFeatures + { + int img_idx; + MyCvSize img_size; + std::vector* keypoints; + cv::Mat* descriptors; + }; + + /* + struct line_descriptor_KeyLine + { + float angle; + int class_id; + int octave; + MyCvPoint2D32f pt; + float response; + float size; + float startPointX; + float startPointY; + float endPointX; + float endPointY; + float sPointInOctaveX; + float sPointInOctaveY; + float ePointInOctaveX; + float ePointInOctaveY; + float lineLength; + int numOfPixels; + };*/ +} + +static MyCvPoint c(const cv::Point p) { - MyCvPoint ret = { p.x, p.y }; + const MyCvPoint ret = { p.x, p.y }; return ret; } -static cv::Point cpp(MyCvPoint p) +static cv::Point cpp(const MyCvPoint p) { return cv::Point(p.x, p.y); } -static MyCvPoint2D32f c(cv::Point2f p) +static MyCvPoint2D32f c(const cv::Point2f &p) { - MyCvPoint2D32f ret = { p.x, p.y }; - return ret; + return { p.x, p.y }; } -static cv::Point2f cpp(MyCvPoint2D32f p) +static cv::Point2f cpp(const MyCvPoint2D32f &p) { return cv::Point2f(p.x, p.y); } -static MyCvSize c(cv::Size s) +static MyCvPoint2D64f c(const cv::Point2d &p) { - MyCvSize ret = { s.width, s.height }; - return ret; + return { p.x, p.y }; +} +static cv::Point2d cpp(const MyCvPoint2D64f &p) +{ + return cv::Point2d(p.x, p.y); +} + +static MyCvPoint3D32i c(const cv::Point3i &p) +{ + return { p.x, p.y, p.z }; +} +static cv::Point3i cpp(const MyCvPoint3D32i &p) +{ + return cv::Point3i(p.x, p.y, p.z); +} + +static MyCvPoint3D64f c(const cv::Point3d &p) +{ + return { p.x, p.y, p.z }; +} +static cv::Point3d cpp(const MyCvPoint3D64f &p) +{ + return cv::Point3d(p.x, p.y, p.z); +} + +static MyCvSize c(const cv::Size &s) +{ + return { s.width, s.height }; } -static cv::Size cpp(MyCvSize s) +static cv::Size cpp(const MyCvSize &s) { return cv::Size(s.width, s.height); } -static MyCvSize2D32f c(cv::Size2f s) +static MyCvSize2D32f c(const cv::Size2f &s) { - MyCvSize2D32f ret = { s.width, s.height }; - return ret; + return { s.width, s.height }; } -static cv::Size2f cpp(MyCvSize2D32f s) +static cv::Size2f cpp(const MyCvSize2D32f &s) { return cv::Size2f(s.width, s.height); } -static MyCvRect c(cv::Rect r) +static MyCvSize2D64f c(const cv::Size2d &s) { - MyCvRect ret = { r.x, r.y, r.width, r.height }; - return ret; + return { s.width, s.height }; } -static cv::Rect cpp(MyCvRect r) +static cv::Size2d cpp(const MyCvSize2D64f &s) +{ + return cv::Size2d(s.width, s.height); +} + +static MyCvRect c(const cv::Rect &r) +{ + return { r.x, r.y, r.width, r.height }; +} +static cv::Rect cpp(const MyCvRect &r) { return cv::Rect(r.x, r.y, r.width, r.height); } -static MyCvScalar c(cv::Scalar s) +static MyCvRect2D64f c(const cv::Rect2d &r) +{ + return { r.x, r.y, r.width, r.height }; +} +static cv::Rect2d cpp(const MyCvRect2D64f &r) { - MyCvScalar ret; + return cv::Rect2d(r.x, r.y, r.width, r.height); +} + +static MyCvScalar c(const cv::Scalar &s) +{ + MyCvScalar ret{}; ret.val[0] = s[0]; ret.val[1] = s[1]; ret.val[2] = s[2]; ret.val[3] = s[3]; return ret; } -static cv::Scalar cpp(MyCvScalar s) +static cv::Scalar cpp(const MyCvScalar &s) { - return cv::Scalar(s.val[0], s.val[1], s.val[2], s.val[3]); + return {s.val[0], s.val[1], s.val[2], s.val[3]}; } -static CvVec4i c(cv::Vec4i v) +static CvVec4i c(const cv::Vec4i &v) { - CvVec4i vv; + CvVec4i vv{}; vv.val[0] = v.val[0]; vv.val[1] = v.val[1]; vv.val[2] = v.val[2]; vv.val[3] = v.val[3]; return vv; } -static cv::Vec4i cpp(CvVec4i v) +static cv::Vec4i cpp(const CvVec4i &v) { return cv::Vec4i(v.val[0], v.val[1], v.val[2], v.val[3]); } -static MyCvSlice c(cv::Range s) +static MyCvSlice c(const cv::Range &s) { - MyCvSlice ret; - ret.start_index = s.start; - ret.end_index = s.end; + const MyCvSlice ret{ s.start, s.end }; return ret; } -static cv::Range cpp(MyCvSlice s) +static cv::Range cpp(const MyCvSlice &s) { - return cv::Range(s.start_index, s.end_index); + return {s.start_index, s.end_index}; } -static MyCvMoments c(cv::Moments m) +static MyCvMoments c(const cv::Moments &m) { MyCvMoments ret; ret.m00 = m.m00; ret.m10 = m.m10; ret.m01 = m.m01; @@ -240,91 +340,48 @@ static MyCvMoments c(cv::Moments m) ret.m30 = m.m30; ret.m21 = m.m21; ret.m12 = m.m12; ret.m03 = m.m03; ret.mu20 = m.mu20; ret.mu11 = m.mu11; ret.mu02 = m.mu02; ret.mu30 = m.mu30; ret.mu21 = m.mu21; ret.mu12 = m.mu12; ret.mu03 = m.mu03; - double am00 = std::abs(m.m00); + const double am00 = std::abs(m.m00); ret.inv_sqrt_m00 = am00 > DBL_EPSILON ? 1. / std::sqrt(am00) : 0; return ret; } -static cv::Moments cpp(MyCvMoments m) +static cv::Moments cpp(const MyCvMoments &m) { return cv::Moments(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03); } -static MyCvTermCriteria c(cv::TermCriteria tc) +static MyCvTermCriteria c(const cv::TermCriteria &tc) { - MyCvTermCriteria ret; - ret.type = tc.type; - ret.max_iter = tc.maxCount; - ret.epsilon = tc.epsilon; - return ret; + return { tc.type, tc.maxCount, tc.epsilon }; } -static cv::TermCriteria cpp(MyCvTermCriteria tc) +static cv::TermCriteria cpp(const MyCvTermCriteria &tc) { return cv::TermCriteria(tc.type, tc.max_iter, tc.epsilon); } -static MyCvBox2D c(cv::RotatedRect r) +static MyCvBox2D c(const cv::RotatedRect &r) { - MyCvBox2D ret; - ret.center = c(r.center); - ret.size = c(r.size); - ret.angle = r.angle; - return ret; + return { c(r.center), c(r.size), r.angle }; +} +static cv::RotatedRect cpp(const MyCvBox2D &b) +{ + return { cpp(b.center), cpp(b.size), b.angle }; +} + +static cv::KeyPoint cpp(const MyKeyPoint &k) +{ + return cv::KeyPoint(cpp(k.pt), k.size, k.angle, k.response, k.octave, k.class_id); +} +static MyKeyPoint c(const cv::KeyPoint &k) +{ + return { c(k.pt), k.size, k.angle, k.response, k.octave, k.class_id }; +} + +static cv::DMatch cpp(const MyDMatch &d) +{ + return cv::DMatch(d.queryIdx, d.trainIdx, d.imgIdx, d.distance); +} +static MyDMatch c(const cv::DMatch &d) +{ + return {d.queryIdx, d.trainIdx, d.imgIdx, d.distance }; } -static cv::RotatedRect cpp(MyCvBox2D b) -{ - return cv::RotatedRect(cpp(b.center), cpp(b.size), b.angle); -} - -static cv::aruco::DetectorParameters cpp(aruco_DetectorParameters p) -{ - cv::aruco::DetectorParameters pp; - pp.adaptiveThreshWinSizeMin = p.adaptiveThreshWinSizeMin; - pp.adaptiveThreshWinSizeMax = p.adaptiveThreshWinSizeMax; - pp.adaptiveThreshWinSizeStep = p.adaptiveThreshWinSizeStep; - pp.adaptiveThreshConstant = p.adaptiveThreshConstant; - pp.minMarkerPerimeterRate = p.minMarkerPerimeterRate; - pp.maxMarkerPerimeterRate = p.maxMarkerPerimeterRate; - pp.polygonalApproxAccuracyRate = p.polygonalApproxAccuracyRate; - pp.minCornerDistanceRate = p.minCornerDistanceRate; - pp.minDistanceToBorder = p.minDistanceToBorder; - pp.minMarkerDistanceRate = p.minMarkerDistanceRate; - pp.doCornerRefinement = p.doCornerRefinement != 0; - pp.cornerRefinementWinSize = p.cornerRefinementWinSize; - pp.cornerRefinementMaxIterations = p.cornerRefinementMaxIterations; - pp.cornerRefinementMinAccuracy = p.cornerRefinementMinAccuracy; - pp.markerBorderBits = p.markerBorderBits; - pp.perspectiveRemovePixelPerCell = p.perspectiveRemovePixelPerCell; - pp.perspectiveRemoveIgnoredMarginPerCell = p.perspectiveRemoveIgnoredMarginPerCell;; - pp.maxErroneousBitsInBorderRate = p.maxErroneousBitsInBorderRate; - pp.minOtsuStdDev = p.minOtsuStdDev; - pp.errorCorrectionRate = p.errorCorrectionRate; - return pp; -} -static aruco_DetectorParameters c(const cv::aruco::DetectorParameters &p) -{ - aruco_DetectorParameters pp; - pp.adaptiveThreshWinSizeMin = p.adaptiveThreshWinSizeMin; - pp.adaptiveThreshWinSizeMax = p.adaptiveThreshWinSizeMax; - pp.adaptiveThreshWinSizeStep = p.adaptiveThreshWinSizeStep; - pp.adaptiveThreshConstant = p.adaptiveThreshConstant; - pp.minMarkerPerimeterRate = p.minMarkerPerimeterRate; - pp.maxMarkerPerimeterRate = p.maxMarkerPerimeterRate; - pp.polygonalApproxAccuracyRate = p.polygonalApproxAccuracyRate; - pp.minCornerDistanceRate = p.minCornerDistanceRate; - pp.minDistanceToBorder = p.minDistanceToBorder; - pp.minMarkerDistanceRate = p.minMarkerDistanceRate; - pp.doCornerRefinement = p.doCornerRefinement ? 1 : 0; - pp.cornerRefinementWinSize = p.cornerRefinementWinSize; - pp.cornerRefinementMaxIterations = p.cornerRefinementMaxIterations; - pp.cornerRefinementMinAccuracy = p.cornerRefinementMinAccuracy; - pp.markerBorderBits = p.markerBorderBits; - pp.perspectiveRemovePixelPerCell = p.perspectiveRemovePixelPerCell; - pp.perspectiveRemoveIgnoredMarginPerCell = p.perspectiveRemoveIgnoredMarginPerCell;; - pp.maxErroneousBitsInBorderRate = p.maxErroneousBitsInBorderRate; - pp.minOtsuStdDev = p.minOtsuStdDev; - pp.errorCorrectionRate = p.errorCorrectionRate; - return pp; -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/objdetect.cpp b/src/OpenCvSharpExtern/objdetect.cpp index 7dced1af8..35a1fbbcf 100644 --- a/src/OpenCvSharpExtern/objdetect.cpp +++ b/src/OpenCvSharpExtern/objdetect.cpp @@ -1,2 +1,4 @@ +// ReSharper disable CppUnusedIncludeDirective #include "objdetect.h" -#include "objdetect_HOGDescriptor.h" \ No newline at end of file +#include "objdetect_HOGDescriptor.h" +#include "objdetect_QRCodeDetector.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/objdetect.h b/src/OpenCvSharpExtern/objdetect.h index d65e5441b..34fde3b48 100644 --- a/src/OpenCvSharpExtern/objdetect.h +++ b/src/OpenCvSharpExtern/objdetect.h @@ -1,112 +1,68 @@ -#ifndef _CPP_OBJDETECT_H_ -#define _CPP_OBJDETECT_H_ +#pragma once -#include "include_opencv.h" - -#pragma region LatentSvmDetector -/* -CVAPI(cv::LatentSvmDetector*) objdetect_LatentSvmDetector_new() -{ - return new cv::LatentSvmDetector(); -} +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile -CVAPI(void) objdetect_LatentSvmDetector_delete(cv::LatentSvmDetector *obj) -{ - delete obj; -} - - -CVAPI(void) objdetect_LatentSvmDetector_clear(cv::LatentSvmDetector *obj) -{ - obj->clear(); -} -CVAPI(int) objdetect_LatentSvmDetector_empty(cv::LatentSvmDetector *obj) -{ - return obj->empty() ? 1 : 0; -} -CVAPI(int) objdetect_LatentSvmDetector_load(cv::LatentSvmDetector *obj, - const char **fileNames, int fileNamesLength, - const char **classNames, int classNamesLength) -{ - std::vector fileNamesVec(fileNamesLength); - std::vector classNamesVec(classNamesLength); - for (int i = 0; i < fileNamesLength; i++) - fileNamesVec[i] = std::string(fileNames[i]); - for (int i = 0; i < classNamesLength; i++) - classNamesVec[i] = std::string(classNames[i]); - - return obj->load(fileNamesVec, classNamesVec) ? 1 : 0; -} - -CVAPI(void) objdetect_LatentSvmDetector_detect( - cv::LatentSvmDetector *obj, cv::Mat *image, std::vector *objectDetections, - float overlapThreshold, int numThreads) -{ - std::vector odVecs; - obj->detect(*image, odVecs, overlapThreshold, numThreads); - - objectDetections->resize(odVecs.size()); - for (size_t i = 0; i < odVecs.size(); i++) - { - objectDetections->at(i)[0] = odVecs[i].rect.x; - objectDetections->at(i)[1] = odVecs[i].rect.y; - objectDetections->at(i)[2] = odVecs[i].rect.width; - objectDetections->at(i)[3] = odVecs[i].rect.height; - objectDetections->at(i)[4] = odVecs[i].score; - objectDetections->at(i)[5] = odVecs[i].classID; - } -} +#include "include_opencv.h" -CVAPI(void) objdetect_LatentSvmDetector_getClassNames(cv::LatentSvmDetector *obj, std::vector *outValues) -{ - const std::vector &ret = obj->getClassNames(); - std::copy(ret.begin(), ret.end(), std::back_inserter(*outValues)); -} -CVAPI(size_t) objdetect_LatentSvmDetector_getClassCount(cv::LatentSvmDetector *obj) -{ - return obj->getClassCount(); -} -*/ -#pragma endregion +#ifndef _WINRT_DLL #pragma region CascadeClassifier -CVAPI(cv::CascadeClassifier*) objdetect_CascadeClassifier_new() +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_new(cv::CascadeClassifier **returnValue) { - return new cv::CascadeClassifier(); + BEGIN_WRAP + *returnValue = new cv::CascadeClassifier; + END_WRAP } -CVAPI(cv::CascadeClassifier*) objdetect_CascadeClassifier_newFromFile(const char *fileName) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_newFromFile(const char *fileName, cv::CascadeClassifier **returnValue) { - return new cv::CascadeClassifier(fileName); + BEGIN_WRAP + *returnValue = new cv::CascadeClassifier(fileName); + END_WRAP } -CVAPI(void) objdetect_CascadeClassifier_delete(cv::CascadeClassifier *obj) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_delete(cv::CascadeClassifier *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(int) objdetect_CascadeClassifier_empty(cv::CascadeClassifier *obj) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_empty(cv::CascadeClassifier *obj, int *returnValue) { - return obj->empty() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP } -CVAPI(int) objdetect_CascadeClassifier_load( - cv::CascadeClassifier *obj, const char *fileName) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_load( + cv::CascadeClassifier *obj, const char *fileName, int *returnValue) { - return obj->load(fileName) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->load(fileName) ? 1 : 0; + END_WRAP } -//CVAPI(int) objdetect_CascadeClassifier_read(const FileNode& node); +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_read( + cv::CascadeClassifier* obj, cv::FileNode* fn, int* returnValue) +{ + BEGIN_WRAP + * returnValue = obj->read(*fn) ? 1 : 0; + END_WRAP +} -CVAPI(void) objdetect_CascadeClassifier_detectMultiScale1( +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_detectMultiScale1( cv::CascadeClassifier *obj, cv::Mat *image, std::vector *objects, - double scaleFactor, int minNeighbors, int flags, CvSize minSize, CvSize maxSize) + double scaleFactor, int minNeighbors, int flags, MyCvSize minSize, MyCvSize maxSize) { - std::vector vec; + BEGIN_WRAP obj->detectMultiScale(*image, *objects, - scaleFactor, minNeighbors, flags, minSize, maxSize); + scaleFactor, minNeighbors, flags, cpp(minSize), cpp(maxSize)); + END_WRAP } -CVAPI(void) objdetect_CascadeClassifier_detectMultiScale2( +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_detectMultiScale2( cv::CascadeClassifier *obj, cv::Mat *image, std::vector *objects, @@ -115,45 +71,68 @@ CVAPI(void) objdetect_CascadeClassifier_detectMultiScale2( double scaleFactor, int minNeighbors, int flags, MyCvSize minSize, MyCvSize maxSize, int outputRejectLevels) { + BEGIN_WRAP obj->detectMultiScale(*image, *objects, *rejectLevels, *levelWeights, scaleFactor, minNeighbors, flags, cpp(minSize), cpp(maxSize), outputRejectLevels != 0); + END_WRAP } -CVAPI(int) objdetect_CascadeClassifier_isOldFormatCascade(cv::CascadeClassifier *obj) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_isOldFormatCascade(cv::CascadeClassifier *obj, int *returnValue) { - return obj->isOldFormatCascade() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isOldFormatCascade() ? 1 : 0; + END_WRAP } -CVAPI(MyCvSize) objdetect_CascadeClassifier_getOriginalWindowSize(cv::CascadeClassifier *obj) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_getOriginalWindowSize(cv::CascadeClassifier *obj, MyCvSize *returnValue) { - return c(obj->getOriginalWindowSize()); + BEGIN_WRAP + *returnValue = c(obj->getOriginalWindowSize()); + END_WRAP } -CVAPI(int) objdetect_CascadeClassifier_getFeatureType(cv::CascadeClassifier *obj) +CVAPI(ExceptionStatus) objdetect_CascadeClassifier_getFeatureType(cv::CascadeClassifier *obj, int *returnValue) { - return obj->getFeatureType(); + BEGIN_WRAP + *returnValue = obj->getFeatureType(); + END_WRAP } #pragma endregion -CVAPI(void) objdetect_groupRectangles1(std::vector *rectList, int groupThreshold, double eps) +CVAPI(ExceptionStatus) objdetect_groupRectangles1( + std::vector *rectList, int groupThreshold, double eps) { + BEGIN_WRAP cv::groupRectangles(*rectList, groupThreshold, eps); + END_WRAP } -CVAPI(void) objdetect_groupRectangles2(std::vector *rectList, std::vector *weights, int groupThreshold, double eps) +CVAPI(ExceptionStatus) objdetect_groupRectangles2( + std::vector *rectList, std::vector *weights, int groupThreshold, double eps) { + BEGIN_WRAP cv::groupRectangles(*rectList, *weights, groupThreshold, eps); + END_WRAP } -CVAPI(void) objdetect_groupRectangles3(std::vector *rectList, int groupThreshold, double eps, std::vector *weights, std::vector *levelWeights) +CVAPI(ExceptionStatus) objdetect_groupRectangles3( + std::vector *rectList, int groupThreshold, double eps, std::vector *weights, std::vector *levelWeights) { + BEGIN_WRAP cv::groupRectangles(*rectList, groupThreshold, eps, weights, levelWeights); + END_WRAP } -CVAPI(void) objdetect_groupRectangles4(std::vector *rectList, std::vector *rejectLevels, std::vector *levelWeights, int groupThreshold, double eps) +CVAPI(ExceptionStatus) objdetect_groupRectangles4( + std::vector *rectList, std::vector *rejectLevels, std::vector *levelWeights, int groupThreshold, double eps) { + BEGIN_WRAP cv::groupRectangles(*rectList, *rejectLevels, *levelWeights, groupThreshold, eps); + END_WRAP } -CVAPI(void) objdetect_groupRectangles_meanshift(std::vector *rectList, std::vector *foundWeights, std::vector *foundScales, double detectThreshold, MyCvSize winDetSize) +CVAPI(ExceptionStatus) objdetect_groupRectangles_meanshift( + std::vector *rectList, std::vector *foundWeights, std::vector *foundScales, double detectThreshold, MyCvSize winDetSize) { + BEGIN_WRAP cv::groupRectangles_meanshift(*rectList, *foundWeights, *foundScales, detectThreshold, cpp(winDetSize)); + END_WRAP } -#endif \ No newline at end of file +#endif diff --git a/src/OpenCvSharpExtern/objdetect_HOGDescriptor.h b/src/OpenCvSharpExtern/objdetect_HOGDescriptor.h index f6bae5c34..d463a7a47 100644 --- a/src/OpenCvSharpExtern/objdetect_HOGDescriptor.h +++ b/src/OpenCvSharpExtern/objdetect_HOGDescriptor.h @@ -1,138 +1,180 @@ -#ifndef _CPP_OBJDETECT_HOGDESCRIPTOR_H_ -#define _CPP_OBJDETECT_HOGDESCRIPTOR_H_ +#pragma once + +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -#pragma region Methods -CVAPI(int) objdetect_HOGDescriptor_sizeof() -{ - return sizeof(cv::HOGDescriptor); -} -CVAPI(cv::HOGDescriptor*) objdetect_HOGDescriptor_new1() +#ifndef _WINRT_DLL + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_new1(cv::HOGDescriptor **returnValue) { - return new cv::HOGDescriptor(); + BEGIN_WRAP + *returnValue = new cv::HOGDescriptor; + END_WRAP } -CVAPI(cv::HOGDescriptor*) objdetect_HOGDescriptor_new2(CvSize winSize, CvSize blockSize, CvSize blockStride, CvSize cellSize, - int nbins, int derivAperture, double winSigma, int histogramNormType, double L2HysThreshold, int gammaCorrection, int nlevels) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_new2( + MyCvSize winSize, MyCvSize blockSize, MyCvSize blockStride, MyCvSize cellSize, + int nbins, int derivAperture, double winSigma, int histogramNormType, double L2HysThreshold, int gammaCorrection, int nlevels, + cv::HOGDescriptor **returnValue) { - return new cv::HOGDescriptor(winSize, blockSize, blockStride, cellSize, nbins, derivAperture, - winSigma, histogramNormType, L2HysThreshold, gammaCorrection != 0, nlevels); + BEGIN_WRAP + *returnValue = new cv::HOGDescriptor(cpp(winSize), cpp(blockSize), cpp(blockStride), cpp(cellSize), nbins, derivAperture, + winSigma, static_cast(histogramNormType), L2HysThreshold, gammaCorrection != 0, nlevels); + END_WRAP } -CVAPI(cv::HOGDescriptor*) objdetect_HOGDescriptor_new3(const char *filename) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_new3(const char *filename, cv::HOGDescriptor **returnValue) { - std::string filename_str(filename); - return new cv::HOGDescriptor(filename_str); + BEGIN_WRAP + *returnValue = new cv::HOGDescriptor(filename); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_delete(cv::HOGDescriptor *obj) + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_delete(cv::HOGDescriptor *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(size_t) objdetect_HOGDescriptor_getDescriptorSize(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_getDescriptorSize(cv::HOGDescriptor *obj, size_t *returnValue) { - return obj->getDescriptorSize(); + BEGIN_WRAP + *returnValue = obj->getDescriptorSize(); + END_WRAP } -CVAPI(int) objdetect_HOGDescriptor_checkDetectorSize(cv::HOGDescriptor *obj) + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_checkDetectorSize(cv::HOGDescriptor *obj, int *returnValue) { - return obj->checkDetectorSize() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->checkDetectorSize() ? 1 : 0; + END_WRAP } -CVAPI(double) objdetect_HOGDescriptor_getWinSigma(cv::HOGDescriptor *obj) + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_getWinSigma(cv::HOGDescriptor *obj, double *returnValue) { - return obj->getWinSigma(); + BEGIN_WRAP + *returnValue = obj->getWinSigma(); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_setSVMDetector(cv::HOGDescriptor *obj, std::vector *svmdetector) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_setSVMDetector(cv::HOGDescriptor *obj, std::vector *svmDetector) { - obj->setSVMDetector(*svmdetector); + BEGIN_WRAP + obj->setSVMDetector(*svmDetector); + END_WRAP } -CVAPI(bool) objdetect_HOGDescriptor_load(cv::HOGDescriptor *obj, const char *filename, const char *objname) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_load(cv::HOGDescriptor *obj, const char *filename, const char *objName, int *returnValue) { - std::string filenameStr(filename); - std::string objnameStr; - if (objname != NULL) - objnameStr = cv::String(objname); - return obj->load(filenameStr, objnameStr); + BEGIN_WRAP + std::string objNameStr; + if (objName != nullptr) + objNameStr = std::string(objName); + *returnValue = obj->load(filename, objNameStr); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_save(cv::HOGDescriptor *obj, const char *filename, const char *objname) + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_save(cv::HOGDescriptor *obj, const char *filename, const char *objName) { - std::string filenameStr(filename); - std::string objnameStr; - if (objname != NULL) - objnameStr = cv::String(objname); - obj->save(filenameStr, objnameStr); + BEGIN_WRAP + std::string objNameStr; + if (objName != nullptr) + objNameStr = cv::String(objName); + obj->save(filename, objNameStr); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_copyTo(cv::HOGDescriptor *obj, cv::HOGDescriptor *c) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_copyTo(cv::HOGDescriptor *obj, cv::HOGDescriptor *c) { + BEGIN_WRAP obj->copyTo(*c); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_compute(cv::HOGDescriptor *obj, cv::Mat *img, std::vector *descriptors, - CvSize winStride, CvSize padding, cv::Point* locations, int locationsLength) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_compute( + cv::HOGDescriptor *obj, cv::Mat *img, std::vector *descriptors, + MyCvSize winStride, MyCvSize padding, cv::Point* locations, int locationsLength) { + BEGIN_WRAP std::vector locationsVec; - if (locations != NULL) - locationsVec = std::vector(locations, locations + locationsLength); - - obj->compute(*img, *descriptors, winStride, padding, locationsVec); + if (locations != nullptr) + locationsVec = std::vector(locations, locations + locationsLength); + obj->compute(*img, *descriptors, cpp(winStride), cpp(padding), locationsVec); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_detect1(cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, - double hitThreshold, CvSize winStride, CvSize padding, cv::Point* searchLocations, int searchLocationsLength) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_detect1( + cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, + double hitThreshold, MyCvSize winStride, MyCvSize padding, cv::Point* searchLocations, int searchLocationsLength) { + BEGIN_WRAP std::vector slVec; - if (searchLocations != NULL) - slVec = std::vector(searchLocations, searchLocations + searchLocationsLength); - - obj->detect(*img, *foundLocations, hitThreshold, winStride, padding, slVec); + if (searchLocations != nullptr) + slVec = std::vector(searchLocations, searchLocations + searchLocationsLength); + obj->detect(*img, *foundLocations, hitThreshold, cpp(winStride), cpp(padding), slVec); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_detect2(cv::HOGDescriptor *obj, cv::Mat *img, +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_detect2( + cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, std::vector *weights, - double hitThreshold, CvSize winStride, CvSize padding, cv::Point* searchLocations, int searchLocationsLength) + double hitThreshold, MyCvSize winStride, MyCvSize padding, cv::Point* searchLocations, int searchLocationsLength) { + BEGIN_WRAP std::vector slVec; - if (searchLocations != NULL) - slVec = std::vector(searchLocations, searchLocations + searchLocationsLength); - - obj->detect(*img, *foundLocations, *weights, hitThreshold, winStride, padding, slVec); + if (searchLocations != nullptr) + slVec = std::vector(searchLocations, searchLocations + searchLocationsLength); + obj->detect(*img, *foundLocations, *weights, hitThreshold, cpp(winStride), cpp(padding), slVec); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_detectMultiScale1(cv::HOGDescriptor *obj, cv::Mat *img, +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_detectMultiScale1( + cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, - double hitThreshold, CvSize winStride, CvSize padding, double scale, int groupThreshold) + double hitThreshold, MyCvSize winStride, MyCvSize padding, double scale, int groupThreshold) { + BEGIN_WRAP obj->detectMultiScale(*img, *foundLocations, - hitThreshold, winStride, padding, scale, groupThreshold); + hitThreshold, cpp(winStride), cpp(padding), scale, groupThreshold); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_detectMultiScale2(cv::HOGDescriptor *obj, cv::Mat *img, +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_detectMultiScale2( + cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, std::vector *foundWeights, - double hitThreshold, CvSize winStride, CvSize padding, double scale, int groupThreshold) + double hitThreshold, MyCvSize winStride, MyCvSize padding, double scale, int groupThreshold) { + BEGIN_WRAP obj->detectMultiScale(*img, *foundLocations, *foundWeights, - hitThreshold, winStride, padding, scale, groupThreshold); + hitThreshold, cpp(winStride), cpp(padding), scale, groupThreshold); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_computeGradient(cv::HOGDescriptor *obj, cv::Mat* img, - cv::Mat* grad, cv::Mat* angleOfs, CvSize paddingTL, CvSize paddingBR) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_computeGradient( + cv::HOGDescriptor *obj, cv::Mat* img, + cv::Mat* grad, cv::Mat* angleOfs, MyCvSize paddingTL, MyCvSize paddingBR) { - obj->computeGradient(*img, *grad, *angleOfs, paddingTL, paddingBR); + BEGIN_WRAP + obj->computeGradient(*img, *grad, *angleOfs, cpp(paddingTL), cpp(paddingBR)); + END_WRAP } -// evaluate specified ROI and return confidence value for each location -CVAPI(void) objdetect_HOGDescriptor_detectROI(cv::HOGDescriptor *obj, cv::Mat *img, cv::Point *locations, int locationsLength, +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_detectROI( + cv::HOGDescriptor *obj, cv::Mat *img, cv::Point *locations, int locationsLength, std::vector *foundLocations, std::vector *confidences, - double hitThreshold, CvSize winStride, CvSize padding) + double hitThreshold, MyCvSize winStride, MyCvSize padding) { - std::vector locationsVec(locations, locations + locationsLength); - obj->detectROI(*img, locationsVec, *foundLocations, *confidences, hitThreshold, winStride, padding); + BEGIN_WRAP + const std::vector locationsVec(locations, locations + locationsLength); + obj->detectROI(*img, locationsVec, *foundLocations, *confidences, hitThreshold, cpp(winStride), cpp(padding)); + END_WRAP } -// evaluate specified ROI and return confidence value for each location in multiple scales -CVAPI(void) objdetect_HOGDescriptor_detectMultiScaleROI(cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_detectMultiScaleROI( + cv::HOGDescriptor *obj, cv::Mat *img, std::vector *foundLocations, std::vector *roiScales, std::vector > *roiLocations, std::vector > *roiConfidences, double hitThreshold, int groupThreshold) { + BEGIN_WRAP std::vector locations; obj->detectMultiScaleROI(*img, *foundLocations, locations, hitThreshold, groupThreshold); @@ -145,111 +187,164 @@ CVAPI(void) objdetect_HOGDescriptor_detectMultiScaleROI(cv::HOGDescriptor *obj, (*roiLocations)[i] = locations[i].locations; (*roiConfidences)[i] = locations[i].confidences; } + END_WRAP } -// read/parse Dalal's alt model file -CVAPI(void) objdetect_HOGDescriptor_readALTModel(cv::HOGDescriptor *obj, const char *modelfile) -{ - obj->readALTModel(modelfile); -} -CVAPI(void) objdetect_HOGDescriptor_groupRectangles(cv::HOGDescriptor *obj, - std::vector *rectList, std::vector *weights, int groupThreshold, double eps) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_groupRectangles(cv::HOGDescriptor *obj, + std::vector *rectList, std::vector *weights, int groupThreshold, double eps) { + BEGIN_WRAP obj->groupRectangles(*rectList, *weights, groupThreshold, eps); + END_WRAP } -#pragma endregion -#pragma region Fields -CVAPI(MyCvSize) objdetect_HOGDescriptor_winSize_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_winSize_get(cv::HOGDescriptor *obj, MyCvSize *returnValue) +{ + BEGIN_WRAP + *returnValue = c(obj->winSize); + END_WRAP +} +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_blockSize_get(cv::HOGDescriptor *obj, MyCvSize *returnValue) { - return c(obj->winSize); + BEGIN_WRAP + *returnValue = c(obj->blockSize); + END_WRAP } -CVAPI(MyCvSize) objdetect_HOGDescriptor_blockSize_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_blockStride_get(cv::HOGDescriptor *obj, MyCvSize *returnValue) { - return c(obj->blockSize); + BEGIN_WRAP + *returnValue = c(obj->blockStride); + END_WRAP } -CVAPI(MyCvSize) objdetect_HOGDescriptor_blockStride_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_cellSize_get(cv::HOGDescriptor *obj, MyCvSize *returnValue) { - return c(obj->blockStride); + BEGIN_WRAP + *returnValue = c(obj->cellSize); + END_WRAP } -CVAPI(MyCvSize) objdetect_HOGDescriptor_cellSize_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_nbins_get(cv::HOGDescriptor *obj, int *returnValue) { - return c(obj->winSize); + BEGIN_WRAP + *returnValue = obj->nbins; + END_WRAP } -CVAPI(int) objdetect_HOGDescriptor_nbins_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_derivAperture_get(cv::HOGDescriptor *obj, int *returnValue) { - return obj->nbins; + BEGIN_WRAP + *returnValue = obj->derivAperture; + END_WRAP } -CVAPI(int) objdetect_HOGDescriptor_derivAperture_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_winSigma_get(cv::HOGDescriptor *obj, double *returnValue) { - return obj->derivAperture; + BEGIN_WRAP + *returnValue = obj->winSigma; + END_WRAP } -CVAPI(double) objdetect_HOGDescriptor_winSigma_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_histogramNormType_get(cv::HOGDescriptor *obj, int *returnValue) { - return obj->winSigma; + BEGIN_WRAP + *returnValue = obj->histogramNormType; + END_WRAP } -CVAPI(int) objdetect_HOGDescriptor_histogramNormType_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_L2HysThreshold_get(cv::HOGDescriptor *obj, double *returnValue) { - return obj->histogramNormType; + BEGIN_WRAP + *returnValue = obj->L2HysThreshold; + END_WRAP } -CVAPI(double) objdetect_HOGDescriptor_L2HysThreshold_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_gammaCorrection_get(cv::HOGDescriptor *obj, int *returnValue) { - return obj->L2HysThreshold; + BEGIN_WRAP + *returnValue = obj->gammaCorrection ? 1 : 0; + END_WRAP } -CVAPI(int) objdetect_HOGDescriptor_gammaCorrection_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_nlevels_get(cv::HOGDescriptor *obj, int *returnValue) { - return obj->gammaCorrection ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->nlevels; + END_WRAP } -CVAPI(int) objdetect_HOGDescriptor_nlevels_get(cv::HOGDescriptor *obj) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_signedGradient_get(cv::HOGDescriptor *obj, int *returnValue) { - return obj->nlevels; + BEGIN_WRAP + *returnValue = obj->signedGradient; + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_winSize_set(cv::HOGDescriptor *obj, CvSize value) + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_winSize_set(cv::HOGDescriptor *obj, MyCvSize value) { - obj->winSize = value; + BEGIN_WRAP + obj->winSize = cpp(value); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_blockSize_set(cv::HOGDescriptor *obj, CvSize value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_blockSize_set(cv::HOGDescriptor *obj, MyCvSize value) { - obj->blockSize = value; + BEGIN_WRAP + obj->blockSize = cpp(value); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_blockStride_set(cv::HOGDescriptor *obj, CvSize value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_blockStride_set(cv::HOGDescriptor *obj, MyCvSize value) { - obj->blockStride = value; + BEGIN_WRAP + obj->blockStride = cpp(value); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_cellSize_set(cv::HOGDescriptor *obj, CvSize value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_cellSize_set(cv::HOGDescriptor *obj, MyCvSize value) { - obj->cellSize = value; + BEGIN_WRAP + obj->cellSize = cpp(value); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_nbins_set(cv::HOGDescriptor *obj, int value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_nbins_set(cv::HOGDescriptor *obj, int value) { + BEGIN_WRAP obj->nbins = value; + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_derivAperture_set(cv::HOGDescriptor *obj, int value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_derivAperture_set(cv::HOGDescriptor *obj, int value) { + BEGIN_WRAP obj->derivAperture = value; + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_winSigma_set(cv::HOGDescriptor *obj, double value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_winSigma_set(cv::HOGDescriptor *obj, double value) { + BEGIN_WRAP obj->winSigma = value; + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_histogramNormType_set(cv::HOGDescriptor *obj, int value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_histogramNormType_set(cv::HOGDescriptor *obj, int value) { - obj->histogramNormType = value; + BEGIN_WRAP + obj->histogramNormType = static_cast(value); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_L2HysThreshold_set(cv::HOGDescriptor *obj, double value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_L2HysThreshold_set(cv::HOGDescriptor *obj, double value) { + BEGIN_WRAP obj->L2HysThreshold = value; + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_gammaCorrection_set(cv::HOGDescriptor *obj, int value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_gammaCorrection_set(cv::HOGDescriptor *obj, int value) { + BEGIN_WRAP obj->gammaCorrection = (value != 0); + END_WRAP } -CVAPI(void) objdetect_HOGDescriptor_nlevels_set(cv::HOGDescriptor *obj, int value) +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_nlevels_set(cv::HOGDescriptor *obj, int value) { + BEGIN_WRAP obj->nlevels = value; + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_HOGDescriptor_signedGradient_set(cv::HOGDescriptor *obj, int value) +{ + BEGIN_WRAP + obj->signedGradient = (value != 0); + END_WRAP } -#pragma endregion -#endif \ No newline at end of file +#endif diff --git a/src/OpenCvSharpExtern/objdetect_QRCodeDetector.h b/src/OpenCvSharpExtern/objdetect_QRCodeDetector.h new file mode 100644 index 000000000..394e8d3ad --- /dev/null +++ b/src/OpenCvSharpExtern/objdetect_QRCodeDetector.h @@ -0,0 +1,88 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +#ifndef _WINRT_DLL + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_new(cv::QRCodeDetector **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::QRCodeDetector(); + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_delete(cv::QRCodeDetector *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_setEpsX(cv::QRCodeDetector *obj, double epsX) +{ + BEGIN_WRAP + obj->setEpsX(epsX); + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_setEpsY(cv::QRCodeDetector *obj, double epsY) +{ + BEGIN_WRAP + obj->setEpsY(epsY); + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_detect( + cv::QRCodeDetector *obj, cv::_InputArray *img, std::vector *points, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->detect(*img, *points) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_decode( + cv::QRCodeDetector *obj, cv::_InputArray *img, std::vector *points, cv::_OutputArray *straight_qrcode, std::string *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->decode(*img, *points, entity(straight_qrcode)); + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_detectAndDecode( + cv::QRCodeDetector *obj, cv::_InputArray *img, std::vector *points, + cv::_OutputArray *straight_qrcode, std::string *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->detectAndDecode(*img, *points, entity(straight_qrcode)); + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_detectMulti( + cv::QRCodeDetector* obj, cv::_InputArray* img, std::vector* points, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->detectMulti(*img, *points) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_decodeMulti( + cv::QRCodeDetector* obj, cv::_InputArray* img, std::vector* points, std::vector* decoded_info, std::vector* straight_qrcode, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->decodeMulti(*img, *points, *decoded_info, *straight_qrcode) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) objdetect_QRCodeDetector_decodeMulti_NoStraightQrCode( + cv::QRCodeDetector* obj, cv::_InputArray* img, std::vector* points, std::vector* decoded_info, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->decodeMulti(*img, *points, *decoded_info) ? 1 : 0; + END_WRAP +} + +#endif diff --git a/src/OpenCvSharpExtern/optflow.cpp b/src/OpenCvSharpExtern/optflow.cpp index 0a0977790..68a741e86 100644 --- a/src/OpenCvSharpExtern/optflow.cpp +++ b/src/OpenCvSharpExtern/optflow.cpp @@ -1,2 +1,3 @@ +// ReSharper disable CppUnusedIncludeDirective #include "optflow.h" #include "optflow_motempl.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/optflow.h b/src/OpenCvSharpExtern/optflow.h index dc41f2c3e..1ea715c17 100644 --- a/src/OpenCvSharpExtern/optflow.h +++ b/src/OpenCvSharpExtern/optflow.h @@ -1,24 +1,28 @@ -#ifndef _CPP_OPTFLOW_H_ -#define _CPP_OPTFLOW_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::optflow; -CVAPI(void) optflow_calcOpticalFlowSF1( - cv::Mat *from, - cv::Mat *to, - cv::Mat *flow, +CVAPI(ExceptionStatus) optflow_calcOpticalFlowSF1( + cv::_InputArray *from, + cv::_InputArray *to, + cv::_OutputArray *flow, int layers, int averagingBlockSize, int maxFlow) { - calcOpticalFlowSF(*from, *to, *flow, layers, averagingBlockSize, maxFlow); + BEGIN_WRAP + cv::optflow::calcOpticalFlowSF(*from, *to, *flow, layers, averagingBlockSize, maxFlow); + END_WRAP } -CVAPI(void) optflow_calcOpticalFlowSF2( - cv::Mat *from, - cv::Mat *to, - cv::Mat *flow, +CVAPI(ExceptionStatus) optflow_calcOpticalFlowSF2( + cv::_InputArray *from, + cv::_InputArray *to, + cv::_OutputArray *flow, int layers, int averagingBlockSize, int maxFlow, @@ -33,9 +37,20 @@ CVAPI(void) optflow_calcOpticalFlowSF2( double upscaleSigmaColor, double speedUpThr) { - calcOpticalFlowSF(*from, *to, *flow, layers, averagingBlockSize, maxFlow, + BEGIN_WRAP + cv::optflow::calcOpticalFlowSF(*from, *to, *flow, layers, averagingBlockSize, maxFlow, sigmaDist, sigmaColor, postprocessWindow, sigmaDistFix, sigmaColorFix, occThr, upscaleAveragingRadius, upscaleSigmaDist, upscaleSigmaColor, speedUpThr); + END_WRAP } -#endif +CVAPI(ExceptionStatus) optflow_calcOpticalFlowSparseToDense( + cv::_InputArray *from, cv::_InputArray *to, cv::_OutputArray *flow, + int grid_step, int k, float sigma, int use_post_proc, float fgs_lambda, float fgs_sigma ) +{ + BEGIN_WRAP + cv::optflow::calcOpticalFlowSparseToDense( + *from, *to, *flow, + grid_step, k, sigma, use_post_proc != 0, fgs_lambda, fgs_sigma); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/optflow_motempl.h b/src/OpenCvSharpExtern/optflow_motempl.h index d54a42dbe..f5ee1f68a 100644 --- a/src/OpenCvSharpExtern/optflow_motempl.h +++ b/src/OpenCvSharpExtern/optflow_motempl.h @@ -1,36 +1,44 @@ -#ifndef _CPP_OPTFLOW_MOTEMPL_H_ -#define _CPP_OPTFLOW_MOTEMPL_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::motempl; -CVAPI(void) optflow_motempl_updateMotionHistory( +CVAPI(ExceptionStatus) optflow_motempl_updateMotionHistory( cv::_InputArray *silhouette, cv::_InputOutputArray *mhi, double timestamp, double duration) { - updateMotionHistory(*silhouette, *mhi, timestamp, duration); + BEGIN_WRAP + cv::motempl::updateMotionHistory(*silhouette, *mhi, timestamp, duration); + END_WRAP } -CVAPI(void) optflow_motempl_calcMotionGradient( +CVAPI(ExceptionStatus) optflow_motempl_calcMotionGradient( cv::_InputArray *mhi, cv::_OutputArray *mask, cv::_OutputArray *orientation, double delta1, double delta2, int apertureSize) { - calcMotionGradient(*mhi, *mask, *orientation, delta1, delta2, apertureSize); + BEGIN_WRAP + cv::motempl::calcMotionGradient(*mhi, *mask, *orientation, delta1, delta2, apertureSize); + END_WRAP } -CVAPI(double) optflow_motempl_calcGlobalOrientation( +CVAPI(ExceptionStatus) optflow_motempl_calcGlobalOrientation( cv::_InputArray *orientation, cv::_InputArray *mask, - cv::_InputArray *mhi, double timestamp, double duration) + cv::_InputArray *mhi, double timestamp, double duration, double *returnValue) { - return calcGlobalOrientation(*orientation, *mask, *mhi, timestamp, duration); + BEGIN_WRAP + *returnValue = cv::motempl::calcGlobalOrientation(*orientation, *mask, *mhi, timestamp, duration); + END_WRAP } -CVAPI(void) optflow_motempl_segmentMotion( +CVAPI(ExceptionStatus) optflow_motempl_segmentMotion( cv::_InputArray *mhi, cv::_OutputArray *segmask, std::vector *boundingRects, double timestamp, double segThresh) { - segmentMotion(*mhi, *segmask, *boundingRects, timestamp, segThresh); + BEGIN_WRAP + cv::motempl::segmentMotion(*mhi, *segmask, *boundingRects, timestamp, segThresh); + END_WRAP } - -#endif diff --git a/src/OpenCvSharpExtern/photo.cpp b/src/OpenCvSharpExtern/photo.cpp index 83eb3c870..e5038b0ae 100644 --- a/src/OpenCvSharpExtern/photo.cpp +++ b/src/OpenCvSharpExtern/photo.cpp @@ -1,2 +1,4 @@ +// ReSharper disable CppUnusedIncludeDirective #include "photo.h" -#include "photo_HDR.h" \ No newline at end of file +#include "photo_HDR.h" +#include "photo_Tonemap.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/photo.h b/src/OpenCvSharpExtern/photo.h index b8db1b60e..c9b48780d 100644 --- a/src/OpenCvSharpExtern/photo.h +++ b/src/OpenCvSharpExtern/photo.h @@ -1,117 +1,156 @@ -#ifndef _CPP_PHOTO_H_ -#define _CPP_PHOTO_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) photo_inpaint(cv::_InputArray *src, cv::_InputArray *inpaintMask, +CVAPI(ExceptionStatus) photo_inpaint(cv::_InputArray *src, cv::_InputArray *inpaintMask, cv::_OutputArray *dst, double inpaintRadius, int flags) { - cv::inpaint(*src, *inpaintMask, *dst, inpaintRadius, flags); + BEGIN_WRAP + cv::inpaint(*src, *inpaintMask, *dst, inpaintRadius, flags); + END_WRAP } -CVAPI(void) photo_fastNlMeansDenoising(cv::_InputArray *src, cv::_OutputArray *dst, float h, +CVAPI(ExceptionStatus) photo_fastNlMeansDenoising(cv::_InputArray *src, cv::_OutputArray *dst, float h, int templateWindowSize, int searchWindowSize) { + BEGIN_WRAP cv::fastNlMeansDenoising(*src, *dst, h, templateWindowSize, searchWindowSize); + END_WRAP } -CVAPI(void) photo_fastNlMeansDenoisingColored(cv::_InputArray *src, cv::_OutputArray *dst, +CVAPI(ExceptionStatus) photo_fastNlMeansDenoisingColored(cv::_InputArray *src, cv::_OutputArray *dst, float h, float hColor, int templateWindowSize, int searchWindowSize) { + BEGIN_WRAP cv::fastNlMeansDenoisingColored(*src, *dst, h, hColor, templateWindowSize, searchWindowSize); + END_WRAP } -CVAPI(void) photo_fastNlMeansDenoisingMulti(cv::_InputArray ** srcImgs, int srcImgsLength, - cv::_OutputArray *dst, int imgToDenoiseIndex, int temporalWindowSize, +CVAPI(ExceptionStatus) photo_fastNlMeansDenoisingMulti(cv::Mat **srcImgs, int srcImgsLength, + cv::_OutputArray* dst, int imgToDenoiseIndex, int temporalWindowSize, float h, int templateWindowSize, int searchWindowSize) { - std::vector srcImgsVec(srcImgsLength); - for (int i = 0; i < srcImgsLength; i++) + BEGIN_WRAP + + std::vector srcImgsVec(srcImgsLength); + for (int i = 0; i < srcImgsLength; i++) srcImgsVec[i] = *srcImgs[i]; - cv::fastNlMeansDenoisingMulti(srcImgsVec, *dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize); + + cv::fastNlMeansDenoisingMulti( + srcImgsVec, *dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize); + + END_WRAP } -CVAPI(void) photo_fastNlMeansDenoisingColoredMulti(cv::_InputArray **srcImgs, int srcImgsLength, +CVAPI(ExceptionStatus) photo_fastNlMeansDenoisingColoredMulti(cv::Mat**srcImgs, int srcImgsLength, cv::_OutputArray *dst, int imgToDenoiseIndex, int temporalWindowSize, float h, float hColor, int templateWindowSize, int searchWindowSize) { - std::vector srcImgsVec(srcImgsLength); + BEGIN_WRAP + + std::vector srcImgsVec(srcImgsLength); for (int i = 0; i < srcImgsLength; i++) srcImgsVec[i] = *srcImgs[i]; - cv::fastNlMeansDenoisingColoredMulti(srcImgsVec, *dst, imgToDenoiseIndex, temporalWindowSize, h, hColor, templateWindowSize, searchWindowSize); + + cv::fastNlMeansDenoisingColoredMulti( + srcImgsVec, *dst, imgToDenoiseIndex, temporalWindowSize, h, hColor, templateWindowSize, searchWindowSize); + + END_WRAP } -CVAPI(void) photo_denoise_TVL1( +CVAPI(ExceptionStatus) photo_denoise_TVL1( cv::Mat **observations, int observationsSize, cv::Mat *result, double lambda, int niters) { + BEGIN_WRAP std::vector observationsVec(observationsSize); for (int i = 0; i < observationsSize; i++) { observationsVec[i] = *observations[i]; } cv::denoise_TVL1(observationsVec, *result, lambda, niters); + END_WRAP } -CVAPI(void) photo_decolor( +CVAPI(ExceptionStatus) photo_decolor( cv::_InputArray *src, cv::_OutputArray *grayscale, cv::_OutputArray *color_boost) { + BEGIN_WRAP cv::decolor(*src, *grayscale, *color_boost); + END_WRAP } -CVAPI(void) photo_seamlessClone( +CVAPI(ExceptionStatus) photo_seamlessClone( cv::_InputArray *src, cv::_InputArray *dst, cv::_InputArray *mask, MyCvPoint p, cv::_OutputArray *blend, int flags) { + BEGIN_WRAP cv::seamlessClone(*src, *dst, entity(mask), cpp(p), *blend, flags); + END_WRAP } -CVAPI(void) photo_colorChange( +CVAPI(ExceptionStatus) photo_colorChange( cv::_InputArray *src, cv::_InputArray *mask, cv::_OutputArray *dst, float red_mul, float green_mul, float blue_mul) { + BEGIN_WRAP cv::colorChange(*src, entity(mask), *dst, red_mul, green_mul, blue_mul); + END_WRAP } -CVAPI(void) photo_illuminationChange( +CVAPI(ExceptionStatus) photo_illuminationChange( cv::_InputArray *src, cv::_InputArray *mask, cv::_OutputArray *dst, float alpha, float beta = 0.4f) { + BEGIN_WRAP cv::illuminationChange(*src, entity(mask), *dst, alpha, beta); + END_WRAP } -CVAPI(void) photo_textureFlattening( +CVAPI(ExceptionStatus) photo_textureFlattening( cv::_InputArray *src, cv::_InputArray *mask, cv::_OutputArray *dst, float low_threshold, float high_threshold, int kernel_size) { + BEGIN_WRAP cv::textureFlattening(*src, entity(mask), *dst, low_threshold, high_threshold, kernel_size); + END_WRAP } -CVAPI(void) photo_edgePreservingFilter( +CVAPI(ExceptionStatus) photo_edgePreservingFilter( cv::_InputArray *src, cv::_OutputArray *dst, int flags, float sigma_s, float sigma_r) { + BEGIN_WRAP cv::edgePreservingFilter(*src, *dst, flags, sigma_s, sigma_r); + END_WRAP } -CVAPI(void) photo_detailEnhance( +CVAPI(ExceptionStatus) photo_detailEnhance( cv::_InputArray *src, cv::_OutputArray *dst, float sigma_s, float sigma_r) { + BEGIN_WRAP cv::detailEnhance(*src, *dst, sigma_s, sigma_r); + END_WRAP } -CVAPI(void) photo_pencilSketch( +CVAPI(ExceptionStatus) photo_pencilSketch( cv::_InputArray *src, cv::_OutputArray *dst1, cv::_OutputArray *dst2, float sigma_s, float sigma_r, float shade_factor) { + BEGIN_WRAP cv::pencilSketch(*src, *dst1, *dst2, sigma_s, sigma_r, shade_factor); + END_WRAP } -CVAPI(void) photo_stylization( +CVAPI(ExceptionStatus) photo_stylization( cv::_InputArray *src, cv::_OutputArray *dst, float sigma_s, float sigma_r) { + BEGIN_WRAP cv::stylization(*src, *dst, sigma_s, sigma_r); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/photo_HDR.h b/src/OpenCvSharpExtern/photo_HDR.h index 6ca218d0a..30e2f8458 100644 --- a/src/OpenCvSharpExtern/photo_HDR.h +++ b/src/OpenCvSharpExtern/photo_HDR.h @@ -1,42 +1,134 @@ -#ifndef _CPP_PHOTO_HDR_H_ -#define _CPP_PHOTO_HDR_H_ +#pragma once #include "include_opencv.h" -CVAPI(cv::Ptr*) photo_createCalibrateDebevec( - int samples, float lambda, int random) +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +CVAPI(ExceptionStatus) photo_createCalibrateDebevec( + int samples, float lambda, int random, cv::Ptr **returnValue) { - return clone(cv::createCalibrateDebevec(samples, lambda, random != 0)); + BEGIN_WRAP + *returnValue = clone(cv::createCalibrateDebevec(samples, lambda, random != 0)); + END_WRAP } -CVAPI(cv::Ptr*) photo_createCalibrateRobertson( - int max_iter, float threshold) +CVAPI(ExceptionStatus) photo_Ptr_CalibrateDebevec_delete(cv::Ptr *obj) { - return clone(cv::createCalibrateRobertson(max_iter, threshold)); + BEGIN_WRAP + delete obj; + END_WRAP } -CVAPI(void) photo_Ptr_CalibrateDebevec_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) photo_Ptr_CalibrateDebevec_get(cv::Ptr *obj, cv::CalibrateDebevec **returnValue) { - delete obj; + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_CalibrateDebevec_getLambda(cv::CalibrateDebevec *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getLambda(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_CalibrateDebevec_setLambda(cv::CalibrateDebevec *obj, float value) +{ + BEGIN_WRAP + obj->setLambda(value); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_CalibrateDebevec_getSamples(cv::CalibrateDebevec *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getLambda(); + END_WRAP } -CVAPI(void) photo_Ptr_CalibrateRobertson_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) photo_CalibrateDebevec_setSamples(cv::CalibrateDebevec *obj, float value) { + BEGIN_WRAP + obj->setLambda(value); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_CalibrateDebevec_getRandom(cv::CalibrateDebevec *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getRandom() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) photo_CalibrateDebevec_setRandom(cv::CalibrateDebevec *obj, int value) +{ + BEGIN_WRAP + obj->setRandom(value != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_createCalibrateRobertson( + int max_iter, float threshold, cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::createCalibrateRobertson(max_iter, threshold)); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_CalibrateRobertson_delete(cv::Ptr *obj) +{ + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::CalibrateDebevec*) photo_Ptr_CalibrateDebevec_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) photo_Ptr_CalibrateRobertson_get(cv::Ptr *obj, cv::CalibrateRobertson **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(cv::CalibrateRobertson*) photo_Ptr_CalibrateRobertson_get(cv::Ptr *obj) + +CVAPI(ExceptionStatus) photo_CalibrateRobertson_getMaxIter(cv::CalibrateRobertson *obj, int *returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->getMaxIter(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_CalibrateRobertson_setMaxIter(cv::CalibrateRobertson *obj, int value) +{ + BEGIN_WRAP + obj->setMaxIter(value); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_CalibrateRobertson_getThreshold(cv::CalibrateRobertson *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_CalibrateRobertson_setThreshold(cv::CalibrateRobertson *obj, float value) +{ + BEGIN_WRAP + obj->setThreshold(value); + END_WRAP } -CVAPI(void) photo_CalibrateCRF_process( +CVAPI(ExceptionStatus) photo_CalibrateRobertson_getRadiance(cv::CalibrateRobertson *obj, cv::Mat *returnValue) +{ + BEGIN_WRAP + obj->getRadiance().copyTo(*returnValue); + END_WRAP +} + + +CVAPI(ExceptionStatus) photo_CalibrateCRF_process( cv::CalibrateCRF *obj, cv::Mat ** srcImgs, int srcImgsLength, cv::_OutputArray *dst, float* times) { + BEGIN_WRAP + // Build Mat Vector of images std::vector srcImgsVec(srcImgsLength); @@ -49,6 +141,68 @@ CVAPI(void) photo_CalibrateCRF_process( } obj->process(srcImgsVec, *dst, times_vec); + END_WRAP +} + +// TODO Exception Handling + +CVAPI(cv::Ptr*) photo_createMergeDebevec() +{ + return clone(cv::createMergeDebevec()); +} +CVAPI(void) photo_Ptr_MergeDebevec_delete(cv::Ptr* obj) +{ + delete obj; +} +CVAPI(cv::MergeDebevec*) photo_Ptr_MergeDebevec_get(cv::Ptr* obj) +{ + return obj->get(); } -#endif \ No newline at end of file +CVAPI(cv::Ptr*) photo_createMergeMertens() +{ + return clone(cv::createMergeMertens()); +} +CVAPI(void) photo_Ptr_MergeMertens_delete(cv::Ptr* obj) +{ + delete obj; +} +CVAPI(cv::MergeMertens*) photo_Ptr_MergeMertens_get(cv::Ptr* obj) +{ + return obj->get(); +} + +CVAPI(void) photo_MergeExposures_process( + cv::MergeExposures* obj, + cv::Mat** srcImgs, int srcImgsLength, cv::_OutputArray* dst, float* times, cv::_InputArray* response) +{ + // Build Mat Vector of images + std::vector srcImgsVec(srcImgsLength); + + // Build float Vector of times + std::vector times_vec(srcImgsLength); + + for (int i = 0; i < srcImgsLength; i++) { + srcImgsVec[i] = *srcImgs[i]; + times_vec[i] = times[i]; + } + + obj->process(srcImgsVec, *dst, times_vec, *response); +} + +CVAPI(void) photo_MergeMertens_process( + cv::MergeMertens* obj, + cv::Mat** srcImgs, int srcImgsLength, cv::_OutputArray* dst) +{ + // Build Mat Vector of images + std::vector srcImgsVec(srcImgsLength); + + // Build float Vector of times + std::vector times_vec(srcImgsLength); + + for (int i = 0; i < srcImgsLength; i++) { + srcImgsVec[i] = *srcImgs[i]; + } + + obj->process(srcImgsVec, *dst); +} diff --git a/src/OpenCvSharpExtern/photo_Tonemap.h b/src/OpenCvSharpExtern/photo_Tonemap.h new file mode 100644 index 000000000..7d9914ee8 --- /dev/null +++ b/src/OpenCvSharpExtern/photo_Tonemap.h @@ -0,0 +1,222 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +#pragma region Tonemap + +CVAPI(ExceptionStatus) photo_Tonemap_process(cv::Tonemap *obj, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + obj->process(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Tonemap_getGamma(cv::Tonemap *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getGamma(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_Tonemap_setGamma(cv::Tonemap *obj, float gamma) +{ + BEGIN_WRAP + obj->setGamma(gamma); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_createTonemap(float gamma, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::createTonemap(gamma); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_Tonemap_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_Tonemap_get(cv::Ptr *ptr, cv::Tonemap **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region TonemapDrago + +CVAPI(ExceptionStatus) photo_TonemapDrago_getSaturation(cv::TonemapDrago *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSaturation(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapDrago_setSaturation(cv::TonemapDrago *obj, float saturation) +{ + BEGIN_WRAP + obj->setSaturation(saturation); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_TonemapDrago_getBias(cv::TonemapDrago *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getBias(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapDrago_setBias(cv::TonemapDrago *obj, float bias) +{ + BEGIN_WRAP + obj->setBias(bias); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_createTonemapDrago(float gamma, float saturation, float bias, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::createTonemapDrago(gamma, saturation, bias); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_TonemapDrago_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_TonemapDrago_get(cv::Ptr *ptr, cv::TonemapDrago **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region TonemapReinhard + +CVAPI(ExceptionStatus) photo_TonemapReinhard_getIntensity(cv::TonemapReinhard *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getIntensity(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapReinhard_setIntensity(cv::TonemapReinhard *obj, float intensity) +{ + BEGIN_WRAP + obj->setIntensity(intensity); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_TonemapReinhard_getLightAdaptation(cv::TonemapReinhard *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getLightAdaptation(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapReinhard_setLightAdaptation(cv::TonemapReinhard *obj, float light_adapt) +{ + BEGIN_WRAP + obj->setLightAdaptation(light_adapt); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_TonemapReinhard_getColorAdaptation(cv::TonemapReinhard *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getColorAdaptation(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapReinhard_setColorAdaptation(cv::TonemapReinhard *obj, float color_adapt) +{ + BEGIN_WRAP + obj->setColorAdaptation(color_adapt); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_createTonemapReinhard(float gamma, float intensity, float light_adapt, float color_adapt, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::createTonemapReinhard(gamma, intensity, light_adapt, color_adapt); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_TonemapReinhard_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_TonemapReinhard_get(cv::Ptr *ptr, cv::TonemapReinhard **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region TonemapMantiuk + +CVAPI(ExceptionStatus) photo_TonemapMantiuk_getScale(cv::TonemapMantiuk *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getScale(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapMantiuk_setScale(cv::TonemapMantiuk *obj, float scale) +{ + BEGIN_WRAP + obj->setScale(scale); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_TonemapMantiuk_getSaturation(cv::TonemapMantiuk *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSaturation(); + END_WRAP +} +CVAPI(ExceptionStatus) photo_TonemapMantiuk_setSaturation(cv::TonemapMantiuk *obj, float saturation) +{ + BEGIN_WRAP + obj->setSaturation(saturation); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_createTonemapMantiuk(float gamma, float scale, float saturation, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::createTonemapMantiuk(gamma, scale, saturation); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_TonemapMantiuk_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) photo_Ptr_TonemapMantiuk_get(cv::Ptr *ptr, cv::TonemapMantiuk **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/quality.cpp b/src/OpenCvSharpExtern/quality.cpp new file mode 100644 index 000000000..434036b69 --- /dev/null +++ b/src/OpenCvSharpExtern/quality.cpp @@ -0,0 +1 @@ +#include "quality.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/quality.h b/src/OpenCvSharpExtern/quality.h new file mode 100644 index 000000000..800cd85ee --- /dev/null +++ b/src/OpenCvSharpExtern/quality.h @@ -0,0 +1,273 @@ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +#pragma region QualityBase + +CVAPI(ExceptionStatus) quality_QualityBase_compute(cv::quality::QualityBase *obj, cv::_InputArray *img, MyCvScalar *returnValue) +{ + BEGIN_WRAP + const auto ret = obj->compute(*img); + *returnValue = c(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityBase_getQualityMap(cv::quality::QualityBase *obj, cv::_OutputArray *dst) +{ + BEGIN_WRAP + obj->getQualityMap(*dst); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityBase_clear(cv::quality::QualityBase *obj) +{ + BEGIN_WRAP + obj->clear(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityBase_empty(cv::quality::QualityBase *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->empty() ? 1 : 0; + END_WRAP +} + +#pragma endregion + +#pragma region QualityPSNR + +CVAPI(ExceptionStatus) quality_createQualityPSNR( + cv::_InputArray *ref, double maxPixelValue, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::quality::QualityPSNR::create(*ref, maxPixelValue); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityPSNR_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityPSNR_get( + cv::Ptr* ptr, cv::quality::QualityPSNR **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityPSNR_staticCompute( + cv::_InputArray *ref, cv::_InputArray *cmp, cv::_OutputArray *qualityMap, double maxPixelValue, MyCvScalar *returnValue) +{ + BEGIN_WRAP + cv::Scalar ret; + if (qualityMap == nullptr) + ret = cv::quality::QualityPSNR::compute(*ref, *cmp, cv::noArray(), maxPixelValue); + else + ret = cv::quality::QualityPSNR::compute(*ref, *cmp, *qualityMap, maxPixelValue); + *returnValue = c(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityPSNR_getMaxPixelValue(cv::quality::QualityPSNR *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMaxPixelValue(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityPSNR_setMaxPixelValue(cv::quality::QualityPSNR *obj, double val) +{ + BEGIN_WRAP + obj->setMaxPixelValue(val); + END_WRAP +} + +#pragma endregion + +#pragma region QualitySSIM + +CVAPI(ExceptionStatus) quality_createQualitySSIM(cv::_InputArray* ref, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::quality::QualitySSIM::create(*ref); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualitySSIM_delete(cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualitySSIM_get( + cv::Ptr* ptr, cv::quality::QualitySSIM **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualitySSIM_staticCompute( + cv::_InputArray* ref, cv::_InputArray* cmp, cv::_OutputArray* qualityMap, MyCvScalar *returnValue) +{ + BEGIN_WRAP + cv::Scalar ret; + if (qualityMap == nullptr) + ret = cv::quality::QualitySSIM::compute(*ref, *cmp, cv::noArray()); + else + ret = cv::quality::QualitySSIM::compute(*ref, *cmp, *qualityMap); + *returnValue = c(ret); + END_WRAP +} + +#pragma endregion + +#pragma region QualityGMSD + +CVAPI(ExceptionStatus) quality_createQualityGMSD(cv::_InputArray* ref, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::quality::QualityGMSD::create(*ref); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityGMSD_delete(cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityGMSD_get( + cv::Ptr* ptr, cv::quality::QualityGMSD **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityGMSD_staticCompute( + cv::_InputArray* ref, cv::_InputArray* cmp, cv::_OutputArray* qualityMap, MyCvScalar *returnValue) +{ + BEGIN_WRAP + cv::Scalar ret; + if (qualityMap == nullptr) + ret = cv::quality::QualityGMSD::compute(*ref, *cmp, cv::noArray()); + else + ret = cv::quality::QualityGMSD::compute(*ref, *cmp, *qualityMap); + *returnValue = c(ret); + END_WRAP +} + +#pragma endregion + +#pragma region QualityMSE + +CVAPI(ExceptionStatus) quality_createQualityMSE(cv::_InputArray* ref, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::quality::QualityMSE::create(*ref); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityMSE_delete(cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityMSE_get( + cv::Ptr* ptr, cv::quality::QualityMSE **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityMSE_staticCompute( + cv::_InputArray* ref, cv::_InputArray* cmp, cv::_OutputArray* qualityMap, MyCvScalar *returnValue) +{ + BEGIN_WRAP + cv::Scalar ret; + if (qualityMap == nullptr) + ret = cv::quality::QualityMSE::compute(*ref, *cmp, cv::noArray()); + else + ret = cv::quality::QualityMSE::compute(*ref, *cmp, *qualityMap); + *returnValue = c(ret); + END_WRAP +} + +#pragma endregion + +#pragma region QualityBRISQUE + +CVAPI(ExceptionStatus) quality_createQualityBRISQUE1( + const char *modelFilePath, const char *rangeFilePath, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::quality::QualityBRISQUE::create(modelFilePath, rangeFilePath); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_createQualityBRISQUE2( + cv::ml::SVM *model, cv::Mat *range, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::quality::QualityBRISQUE::create(model, *range); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityBRISQUE_delete(cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) quality_Ptr_QualityBRISQUE_get( + cv::Ptr* ptr, cv::quality::QualityBRISQUE **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityBRISQUE_staticCompute( + cv::_InputArray* ref, const char* modelFilePath, const char* rangeFilePath, MyCvScalar *returnValue) +{ + BEGIN_WRAP + const auto ret = cv::quality::QualityBRISQUE::compute(*ref, modelFilePath, rangeFilePath); + *returnValue = c(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) quality_QualityBRISQUE_computeFeatures( + cv::_InputArray* img, cv::_OutputArray *features) +{ + BEGIN_WRAP + cv::quality::QualityBRISQUE::computeFeatures(*img, *features); + END_WRAP +} + +#pragma endregion + +#endif // !#ifndef _WINRT_DLL diff --git a/src/OpenCvSharpExtern/shape.cpp b/src/OpenCvSharpExtern/shape.cpp index 60183316a..d5831722a 100644 --- a/src/OpenCvSharpExtern/shape.cpp +++ b/src/OpenCvSharpExtern/shape.cpp @@ -1 +1,2 @@ +// ReSharper disable CppUnusedIncludeDirective #include "shape_ShapeDistanceExtractor.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/shape_ShapeDistanceExtractor.h b/src/OpenCvSharpExtern/shape_ShapeDistanceExtractor.h index 8f0479c4a..1eb0f737c 100644 --- a/src/OpenCvSharpExtern/shape_ShapeDistanceExtractor.h +++ b/src/OpenCvSharpExtern/shape_ShapeDistanceExtractor.h @@ -1,231 +1,297 @@ -#ifndef _CPP_SHAPE_SHAPEDISTANCEEXTRACTOR_H_ -#define _CPP_SHAPE_SHAPEDISTANCEEXTRACTOR_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(float) shape_ShapeDistanceExtractor_computeDistance( - cv::ShapeDistanceExtractor *obj, cv::_InputArray *contour1, cv::_InputArray *contour2) +CVAPI(ExceptionStatus) shape_ShapeDistanceExtractor_computeDistance( + cv::ShapeDistanceExtractor *obj, cv::_InputArray *contour1, cv::_InputArray *contour2, float *returnValue) { - return obj->computeDistance(*contour1, *contour2); + BEGIN_WRAP + *returnValue = obj->computeDistance(*contour1, *contour2); + END_WRAP } #pragma region ShapeContextDistanceExtractor -CVAPI(void) shape_Ptr_ShapeContextDistanceExtractor_delete( +CVAPI(ExceptionStatus) shape_Ptr_ShapeContextDistanceExtractor_delete( cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::ShapeContextDistanceExtractor*) shape_Ptr_ShapeContextDistanceExtractor_get( - cv::Ptr *obj) +CVAPI(ExceptionStatus) shape_Ptr_ShapeContextDistanceExtractor_get( + cv::Ptr *obj, cv::ShapeContextDistanceExtractor **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setAngularBins( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setAngularBins( cv::ShapeContextDistanceExtractor *obj, int val) { + BEGIN_WRAP obj->setAngularBins(val); + END_WRAP } -CVAPI(int) shape_ShapeContextDistanceExtractor_getAngularBins( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getAngularBins( + cv::ShapeContextDistanceExtractor *obj, int *returnValue) { - return obj->getAngularBins(); + BEGIN_WRAP + *returnValue = obj->getAngularBins(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setRadialBins( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setRadialBins( cv::ShapeContextDistanceExtractor *obj, int val) { + BEGIN_WRAP obj->setRadialBins(val); + END_WRAP } -CVAPI(int) shape_ShapeContextDistanceExtractor_getRadialBins( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getRadialBins( + cv::ShapeContextDistanceExtractor *obj, int *returnValue) { - return obj->getRadialBins(); + BEGIN_WRAP + *returnValue = obj->getRadialBins(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setInnerRadius( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setInnerRadius( cv::ShapeContextDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setInnerRadius(val); + END_WRAP } -CVAPI(float) shape_ShapeContextDistanceExtractor_getInnerRadius( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getInnerRadius( + cv::ShapeContextDistanceExtractor *obj, float *returnValue) { - return obj->getInnerRadius(); + BEGIN_WRAP + *returnValue = obj->getInnerRadius(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setOuterRadius( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setOuterRadius( cv::ShapeContextDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setOuterRadius(val); + END_WRAP } -CVAPI(float) shape_ShapeContextDistanceExtractor_getOuterRadius( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getOuterRadius( + cv::ShapeContextDistanceExtractor *obj, float *returnValue) { - return obj->getOuterRadius(); + BEGIN_WRAP + *returnValue = obj->getOuterRadius(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setRotationInvariant( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setRotationInvariant( cv::ShapeContextDistanceExtractor *obj, int val) { + BEGIN_WRAP obj->setRotationInvariant(val != 0); + END_WRAP } -CVAPI(int) shape_ShapeContextDistanceExtractor_getRotationInvariant( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getRotationInvariant( + cv::ShapeContextDistanceExtractor *obj, int *returnValue) { - return obj->getRotationInvariant() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getRotationInvariant() ? 1 : 0; + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setShapeContextWeight( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setShapeContextWeight( cv::ShapeContextDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setShapeContextWeight(val); + END_WRAP } -CVAPI(float) shape_ShapeContextDistanceExtractor_getShapeContextWeight( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getShapeContextWeight( + cv::ShapeContextDistanceExtractor *obj, float *returnValue) { - return obj->getShapeContextWeight(); + BEGIN_WRAP + *returnValue = obj->getShapeContextWeight(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setImageAppearanceWeight( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setImageAppearanceWeight( cv::ShapeContextDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setImageAppearanceWeight(val); + END_WRAP } -CVAPI(float) shape_ShapeContextDistanceExtractor_getImageAppearanceWeight( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getImageAppearanceWeight( + cv::ShapeContextDistanceExtractor *obj, float *returnValue) { - return obj->getImageAppearanceWeight(); + BEGIN_WRAP + *returnValue = obj->getImageAppearanceWeight(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setBendingEnergyWeight( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setBendingEnergyWeight( cv::ShapeContextDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setBendingEnergyWeight(val); + END_WRAP } -CVAPI(float) shape_ShapeContextDistanceExtractor_getBendingEnergyWeight( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getBendingEnergyWeight( + cv::ShapeContextDistanceExtractor *obj, float *returnValue) { - return obj->getBendingEnergyWeight(); + BEGIN_WRAP + *returnValue = obj->getBendingEnergyWeight(); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setImages( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setImages( cv::ShapeContextDistanceExtractor *obj, cv::_InputArray *image1, cv::_InputArray *image2) { + BEGIN_WRAP obj->setImages(*image1, *image2); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_getImages( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getImages( cv::ShapeContextDistanceExtractor *obj, cv::_OutputArray *image1, cv::_OutputArray *image2) { + BEGIN_WRAP obj->getImages(*image1, *image2); + END_WRAP } -CVAPI(void) shape_ShapeContextDistanceExtractor_setIterations( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setIterations( cv::ShapeContextDistanceExtractor *obj, int val) { + BEGIN_WRAP obj->setIterations(val); + END_WRAP } -CVAPI(int) shape_ShapeContextDistanceExtractor_getIterations( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getIterations( + cv::ShapeContextDistanceExtractor *obj, int *returnValue) { - return obj->getIterations(); + BEGIN_WRAP + *returnValue = obj->getIterations(); + END_WRAP } -/* -CVAPI(void) shape_ShapeContextDistanceExtractor_setCostExtractor( +/*CVAPI(void) shape_ShapeContextDistanceExtractor_setCostExtractor( cv::ShapeContextDistanceExtractor *obj, Ptr comparer) { -} -CVAPI(Ptr) shape_ShapeContextDistanceExtractor_getCostExtractor( +}*/ +/*CVAPI(Ptr) shape_ShapeContextDistanceExtractor_getCostExtractor( cv::ShapeContextDistanceExtractor *obj) { }*/ -CVAPI(void) shape_ShapeContextDistanceExtractor_setStdDev( +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_setStdDev( cv::ShapeContextDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setStdDev(val); + END_WRAP } -CVAPI(float) shape_ShapeContextDistanceExtractor_getStdDev( - cv::ShapeContextDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_ShapeContextDistanceExtractor_getStdDev( + cv::ShapeContextDistanceExtractor *obj, float *returnValue) { - return obj->getStdDev(); + BEGIN_WRAP + *returnValue = obj->getStdDev(); + END_WRAP } -/* -CVAPI(void) shape_ShapeContextDistanceExtractor_setTransformAlgorithm( +/*CVAPI(void) shape_ShapeContextDistanceExtractor_setTransformAlgorithm( cv::ShapeContextDistanceExtractor *obj, Ptr transformer) { -} -CVAPI(Ptr) shape_ShapeContextDistanceExtractor_getTransformAlgorithm( +}*/ +/*CVAPI(Ptr) shape_ShapeContextDistanceExtractor_getTransformAlgorithm( cv::ShapeContextDistanceExtractor *obj) { } */ -CVAPI(cv::Ptr*) shape_createShapeContextDistanceExtractor( +CVAPI(ExceptionStatus) shape_createShapeContextDistanceExtractor( int nAngularBins, int nRadialBins, float innerRadius, float outerRadius, int iterations/*, const Ptr &comparer = createChiHistogramCostExtractor(), - const Ptr &transformer = createThinPlateSplineShapeTransformer()*/) + const Ptr &transformer = createThinPlateSplineShapeTransformer()*/, + cv::Ptr **returnValue) { - cv::Ptr p = cv::createShapeContextDistanceExtractor( + BEGIN_WRAP + const auto p = cv::createShapeContextDistanceExtractor( nAngularBins, nRadialBins, innerRadius, outerRadius, iterations); - return new cv::Ptr(p); + *returnValue = clone(p); + END_WRAP } #pragma endregion #pragma region HausdorffDistanceExtractor -CVAPI(void) shape_Ptr_HausdorffDistanceExtractor_delete( +CVAPI(ExceptionStatus) shape_Ptr_HausdorffDistanceExtractor_delete( cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::HausdorffDistanceExtractor*) shape_Ptr_HausdorffDistanceExtractor_get( - cv::Ptr *obj) +CVAPI(ExceptionStatus) shape_Ptr_HausdorffDistanceExtractor_get( + cv::Ptr *obj, cv::HausdorffDistanceExtractor **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } -CVAPI(void) shape_HausdorffDistanceExtractor_setDistanceFlag( +CVAPI(ExceptionStatus) shape_HausdorffDistanceExtractor_setDistanceFlag( cv::HausdorffDistanceExtractor *obj, int val) { + BEGIN_WRAP obj->setDistanceFlag(val); + END_WRAP } -CVAPI(int) shape_HausdorffDistanceExtractor_getDistanceFlag( - cv::HausdorffDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_HausdorffDistanceExtractor_getDistanceFlag( + cv::HausdorffDistanceExtractor *obj, int *returnValue) { - return obj->getDistanceFlag(); + BEGIN_WRAP + *returnValue = obj->getDistanceFlag(); + END_WRAP } -CVAPI(void) shape_HausdorffDistanceExtractor_setRankProportion( +CVAPI(ExceptionStatus) shape_HausdorffDistanceExtractor_setRankProportion( cv::HausdorffDistanceExtractor *obj, float val) { + BEGIN_WRAP obj->setRankProportion(val); + END_WRAP } -CVAPI(float) shape_HausdorffDistanceExtractor_getRankProportion( - cv::HausdorffDistanceExtractor *obj) +CVAPI(ExceptionStatus) shape_HausdorffDistanceExtractor_getRankProportion( + cv::HausdorffDistanceExtractor *obj, float *returnValue) { - return obj->getRankProportion(); + BEGIN_WRAP + *returnValue = obj->getRankProportion(); + END_WRAP } -CVAPI(cv::Ptr*) shape_createHausdorffDistanceExtractor( - int distanceFlag, float rankProp) +CVAPI(ExceptionStatus) shape_createHausdorffDistanceExtractor( + int distanceFlag, float rankProp, cv::Ptr **returnValue) { - cv::Ptr p = cv::createHausdorffDistanceExtractor( + BEGIN_WRAP + const auto p = cv::createHausdorffDistanceExtractor( distanceFlag, rankProp); - return new cv::Ptr(p); + *returnValue = clone(p); + END_WRAP } #pragma endregion - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/std_string.cpp b/src/OpenCvSharpExtern/std_string.cpp new file mode 100644 index 000000000..9d3d45b25 --- /dev/null +++ b/src/OpenCvSharpExtern/std_string.cpp @@ -0,0 +1 @@ +#include "std_string.h" diff --git a/src/OpenCvSharpExtern/std_string.h b/src/OpenCvSharpExtern/std_string.h new file mode 100644 index 000000000..6d24a39eb --- /dev/null +++ b/src/OpenCvSharpExtern/std_string.h @@ -0,0 +1,32 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +CVAPI(std::string*) string_new1() +{ + return new std::string; +} +CVAPI(std::string*) string_new2(const char *str) +{ + return new std::string(str); +} + +CVAPI(void) string_delete(std::string *s) +{ + delete s; +} + +CVAPI(const char*) string_c_str(std::string *s) +{ + return s->c_str(); +} + +CVAPI(size_t) string_size(std::string *s) +{ + return s->size(); +} + diff --git a/src/OpenCvSharpExtern/std_vector.cpp b/src/OpenCvSharpExtern/std_vector.cpp index 0abe33f41..28363fbf1 100644 --- a/src/OpenCvSharpExtern/std_vector.cpp +++ b/src/OpenCvSharpExtern/std_vector.cpp @@ -1 +1,3 @@ -#include "std_vector.h" \ No newline at end of file +#include "std_vector.h" +#include "std_vector_nesting.h" +#include "std_vector_primitive.h" diff --git a/src/OpenCvSharpExtern/std_vector.h b/src/OpenCvSharpExtern/std_vector.h index 4de048ca7..b0699d03e 100644 --- a/src/OpenCvSharpExtern/std_vector.h +++ b/src/OpenCvSharpExtern/std_vector.h @@ -1,451 +1,376 @@ -#ifndef _CPP_WVECTOR_H_ -#define _CPP_WVECTOR_H_ +#pragma once // ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace std; -#pragma region uchar -CVAPI(vector*) vector_uchar_new1() -{ - return new vector; -} -CVAPI(vector*) vector_uchar_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_uchar_new3(uchar* data, size_t dataLength) +#pragma region std::string +CVAPI(std::vector*) vector_string_new1() { - return new vector(data, data + dataLength); + return new std::vector; } -CVAPI(size_t) vector_uchar_getSize(vector* vector) +CVAPI(std::vector*) vector_string_new2(size_t size) { - return vector->size(); + return new std::vector(size); } -CVAPI(uchar*) vector_uchar_getPointer(vector* vector) +CVAPI(size_t) vector_string_getSize(std::vector* vec) { - return &(vector->at(0)); + return vec->size(); } -CVAPI(void) vector_vector_uchar_copy(vector *vector, uchar *dst) +CVAPI(void) vector_string_getElements(std::vector* vector, const char** cStringPointers, int32_t* stringLengths) { - size_t length = sizeof(uchar)* vector->size(); - memcpy(dst, &(vector->at(0)), length); + for (size_t i = 0; i < vector->size(); i++) + { + const auto& elem = vector->at(i); + cStringPointers[i] = elem.c_str(); + stringLengths[i] = static_cast(elem.size()); + } } -CVAPI(void) vector_uchar_delete(vector* vector) +CVAPI(void) vector_string_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region char -CVAPI(vector*) vector_char_new1() -{ - return new vector; -} -CVAPI(vector*) vector_char_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_char_new3(char* data, size_t dataLength) -{ - return new vector(data, data + dataLength); -} -CVAPI(size_t) vector_char_getSize(vector* vector) -{ - return vector->size(); -} -CVAPI(char*) vector_char_getPointer(vector* vector) -{ - return &(vector->at(0)); -} -CVAPI(void) vector_vector_char_copy(vector *vector, char *dst) -{ - size_t length = sizeof(char)* vector->size(); - memcpy(dst, &(vector->at(0)), length); -} -CVAPI(void) vector_char_delete(vector* vector) -{ - delete vector; -} -#pragma endregion +#pragma region cv::Vec2f -#pragma region int -CVAPI(vector*) vector_int32_new1() -{ - return new vector; -} -CVAPI(vector*) vector_int32_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_int32_new3(int* data, size_t dataLength) -{ - return new vector(data, data + dataLength); -} -CVAPI(size_t) vector_int32_getSize(vector* vector) -{ - return vector->size(); -} -CVAPI(int*) vector_int32_getPointer(vector* vector) +CVAPI(std::vector*) vector_Vec2f_new1() { - return &(vector->at(0)); + return new std::vector; } -CVAPI(void) vector_int32_delete(vector* vector) -{ - delete vector; -} -#pragma endregion -#pragma region float -CVAPI(vector*) vector_float_new1() -{ - return new vector; -} -CVAPI(vector*) vector_float_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_float_new3(float* data, size_t dataLength) -{ - return new vector(data, data + dataLength); -} -CVAPI(size_t) vector_float_getSize(vector* vector) +CVAPI(size_t) vector_Vec2f_getSize(std::vector* vector) { return vector->size(); } -CVAPI(float*) vector_float_getPointer(vector* vector) + +CVAPI(cv::Vec2f*) vector_Vec2f_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_float_delete(vector* vector) + +CVAPI(void) vector_Vec2f_delete(std::vector* vector) { delete vector; } + #pragma endregion -#pragma region double -CVAPI(vector*) vector_double_new1() -{ - return new vector; -} -CVAPI(vector*) vector_double_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_double_new3(float* data, size_t dataLength) +#pragma region cv::Vec3f +CVAPI(std::vector*) vector_Vec3f_new1() { - return new vector(data, data + dataLength); + return new std::vector; } -CVAPI(size_t) vector_double_getSize(vector* vector) + +CVAPI(size_t) vector_Vec3f_getSize(std::vector* vector) { return vector->size(); } -CVAPI(double*) vector_double_getPointer(vector* vector) + +CVAPI(cv::Vec3f*) vector_Vec3f_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_double_delete(vector* vector) + +CVAPI(void) vector_Vec3f_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region cv::Vec2f -CVAPI(vector*) vector_Vec2f_new1() -{ - return new vector; -} -CVAPI(vector*) vector_Vec2f_new2(size_t size) +#pragma region cv::Vec4f + +CVAPI(std::vector*) vector_Vec4f_new1() { - return new vector(size); + return new std::vector; } -CVAPI(vector*) vector_Vec2f_new3(cv::Vec2f* data, size_t dataLength) + +CVAPI(std::vector*) vector_Vec4f_new3(cv::Vec4f* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Vec2f_getSize(vector* vector) + +CVAPI(size_t) vector_Vec4f_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Vec2f*) vector_Vec2f_getPointer(vector* vector) + +CVAPI(cv::Vec4f*) vector_Vec4f_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Vec2f_delete(vector* vector) + +CVAPI(void) vector_Vec4f_delete(std::vector* vector) { delete vector; } + #pragma endregion -#pragma region cv::Vec3f -CVAPI(vector*) vector_Vec3f_new1() -{ - return new vector; -} -CVAPI(vector*) vector_Vec3f_new2(size_t size) +#pragma region cv::Vec4i + +CVAPI(std::vector*) vector_Vec4i_new1() { - return new vector(size); + return new std::vector; } -CVAPI(vector*) vector_Vec3f_new3(cv::Vec3f* data, size_t dataLength) + +CVAPI(std::vector*) vector_Vec4i_new3(cv::Vec4i* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Vec3f_getSize(vector* vector) + +CVAPI(size_t) vector_Vec4i_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Vec3f*) vector_Vec3f_getPointer(vector* vector) + +CVAPI(cv::Vec4i*) vector_Vec4i_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Vec3f_delete(vector* vector) + +CVAPI(void) vector_Vec4i_delete(std::vector* vector) { delete vector; } + #pragma endregion -#pragma region cv::Vec4f -CVAPI(vector*) vector_Vec4f_new1() -{ - return new vector; -} -CVAPI(vector*) vector_Vec4f_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_Vec4f_new3(cv::Vec4f* data, size_t dataLength) +#pragma region cv::Vec6f +CVAPI(std::vector*) vector_Vec6f_new1() { - return new vector(data, data + dataLength); + return new std::vector; } -CVAPI(size_t) vector_Vec4f_getSize(vector* vector) + +CVAPI(size_t) vector_Vec6f_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Vec4f*) vector_Vec4f_getPointer(vector* vector) + +CVAPI(cv::Vec6f*) vector_Vec6f_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Vec4f_delete(vector* vector) + +CVAPI(void) vector_Vec6f_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region cv::Vec4i -CVAPI(vector*) vector_Vec4i_new1() +#pragma region cv::Point2i +CVAPI(std::vector*) vector_Point2i_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_Vec4i_new2(size_t size) +CVAPI(std::vector*) vector_Point2i_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_Vec4i_new3(cv::Vec4i* data, size_t dataLength) +CVAPI(std::vector*) vector_Point2i_new3(cv::Point* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Vec4i_getSize(vector* vector) +CVAPI(size_t) vector_Point2i_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Vec4i*) vector_Vec4i_getPointer(vector* vector) +CVAPI(cv::Point*) vector_Point2i_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Vec4i_delete(vector* vector) +CVAPI(void) vector_Point2i_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region cv::Vec6f -CVAPI(vector*) vector_Vec6f_new1() +#pragma region cv::Point2f +CVAPI(std::vector*) vector_Point2f_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_Vec6f_new2(size_t size) +CVAPI(std::vector*) vector_Point2f_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_Vec6f_new3(cv::Vec6f* data, size_t dataLength) +CVAPI(std::vector*) vector_Point2f_new3(cv::Point2f* data, size_t dataLength) { - return new vector(data, data + dataLength);; + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Vec6f_getSize(vector* vector) +CVAPI(size_t) vector_Point2f_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Vec6f*) vector_Vec6f_getPointer(vector* vector) +CVAPI(cv::Point2f*) vector_Point2f_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Vec6f_delete(vector* vector) +CVAPI(void) vector_Point2f_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region cv::Vec6d -CVAPI(vector*) vector_Vec6d_new1() -{ - return new vector; -} -CVAPI(vector*) vector_Vec6d_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_Vec6d_new3(cv::Vec6d* data, size_t dataLength) +#pragma region cv::Point2d + +CVAPI(std::vector*) vector_Point2d_new1() { - return new vector(data, data + dataLength); + return new std::vector; } -CVAPI(size_t) vector_Vec6d_getSize(vector* vector) + +CVAPI(size_t) vector_Point2d_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Vec6d*) vector_Vec6d_getPointer(vector* vector) + +CVAPI(cv::Point2d*) vector_Point2d_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Vec6d_delete(vector* vector) + +CVAPI(void) vector_Point2d_delete(std::vector* vector) { delete vector; } + #pragma endregion -#pragma region cv::Point2i -CVAPI(vector*) vector_Point2i_new1() +#pragma region cv::Point3f +CVAPI(std::vector*) vector_Point3f_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_Point2i_new2(size_t size) +CVAPI(std::vector*) vector_Point3f_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_Point2i_new3(cv::Point* data, size_t dataLength) +CVAPI(std::vector*) vector_Point3f_new3(cv::Point3f* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Point2i_getSize(vector* vector) +CVAPI(size_t) vector_Point3f_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Point*) vector_Point2i_getPointer(vector* vector) +CVAPI(cv::Point3f*) vector_Point3f_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_Point2i_delete(vector* vector) +CVAPI(void) vector_Point3f_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region cv::Point2f -CVAPI(vector*) vector_Point2f_new1() +#pragma region cv::Rect +CVAPI(std::vector*) vector_Rect_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_Point2f_new2(size_t size) +CVAPI(std::vector*) vector_Rect_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_Point2f_new3(cv::Point2f* data, size_t dataLength) +CVAPI(std::vector*) vector_Rect_new3(cv::Rect* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Point2f_getSize(vector* vector) +CVAPI(size_t) vector_Rect_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Point2f*) vector_Point2f_getPointer(vector* vector) +CVAPI(cv::Rect*) vector_Rect_getPointer(std::vector *vector) { return &(vector->at(0)); } -CVAPI(void) vector_Point2f_delete(vector* vector) -{ +CVAPI(void) vector_Rect_delete(std::vector *vector) +{ + //vector->~vector(); delete vector; } + #pragma endregion -#pragma region cv::Point3f -CVAPI(vector*) vector_Point3f_new1() +#pragma region cv::Rect2d +CVAPI(std::vector*) vector_Rect2d_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_Point3f_new2(size_t size) +CVAPI(std::vector*) vector_Rect2d_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_Point3f_new3(cv::Point3f* data, size_t dataLength) +CVAPI(std::vector*) vector_Rect2d_new3(cv::Rect2d* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Point3f_getSize(vector* vector) +CVAPI(size_t) vector_Rect2d_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Point3f*) vector_Point3f_getPointer(vector* vector) +CVAPI(cv::Rect2d*) vector_Rect2d_getPointer(std::vector *vector) { return &(vector->at(0)); } -CVAPI(void) vector_Point3f_delete(vector* vector) +CVAPI(void) vector_Rect2d_delete(std::vector *vector) { delete vector; } + #pragma endregion -#pragma region cv::Rect -CVAPI(vector*) vector_Rect_new1() +#pragma region cv::RotatedRect +CVAPI(std::vector*) vector_RotatedRect_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_Rect_new2(size_t size) +CVAPI(std::vector*) vector_RotatedRect_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_Rect_new3(cv::Rect* data, size_t dataLength) +CVAPI(std::vector*) vector_RotatedRect_new3(cv::RotatedRect* data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_Rect_getSize(vector* vector) +CVAPI(size_t) vector_RotatedRect_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::Rect*) vector_Rect_getPointer(vector *vector) +CVAPI(cv::RotatedRect*) vector_RotatedRect_getPointer(std::vector *vector) { return &(vector->at(0)); } -CVAPI(void) vector_Rect_delete(vector *vector) -{ - //vector->~vector(); +CVAPI(void) vector_RotatedRect_delete(std::vector *vector) +{ delete vector; } #pragma endregion #pragma region cv::KeyPoint -CVAPI(vector*) vector_KeyPoint_new1() +CVAPI(std::vector*) vector_KeyPoint_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_KeyPoint_new2(size_t size) +CVAPI(std::vector*) vector_KeyPoint_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_KeyPoint_new3(cv::KeyPoint *data, size_t dataLength) +CVAPI(std::vector*) vector_KeyPoint_new3(cv::KeyPoint *data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_KeyPoint_getSize(vector* vector) +CVAPI(size_t) vector_KeyPoint_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::KeyPoint*) vector_KeyPoint_getPointer(vector* vector) +CVAPI(cv::KeyPoint*) vector_KeyPoint_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_KeyPoint_delete(vector* vector) +CVAPI(void) vector_KeyPoint_delete(std::vector* vector) { //vector->~vector(); delete vector; @@ -453,449 +378,208 @@ CVAPI(void) vector_KeyPoint_delete(vector* vector) #pragma endregion #pragma region cv::DMatch -CVAPI(vector*) vector_DMatch_new1() +CVAPI(std::vector*) vector_DMatch_new1() { - return new vector; + return new std::vector; } -CVAPI(vector*) vector_DMatch_new2(size_t size) +CVAPI(std::vector*) vector_DMatch_new2(size_t size) { - return new vector(size); + return new std::vector(size); } -CVAPI(vector*) vector_DMatch_new3(cv::DMatch *data, size_t dataLength) +CVAPI(std::vector*) vector_DMatch_new3(cv::DMatch *data, size_t dataLength) { - return new vector(data, data + dataLength); + return new std::vector(data, data + dataLength); } -CVAPI(size_t) vector_DMatch_getSize(vector* vector) +CVAPI(size_t) vector_DMatch_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::DMatch*) vector_DMatch_getPointer(vector* vector) +CVAPI(cv::DMatch*) vector_DMatch_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_DMatch_delete(vector* vector) +CVAPI(void) vector_DMatch_delete(std::vector* vector) { delete vector; } #pragma endregion -#pragma region vector -CVAPI(vector >*) vector_vector_int_new1() -{ - return new vector >; -} -CVAPI(vector >*) vector_vector_int_new2(size_t size) -{ - return new vector >(size); -} -CVAPI(size_t) vector_vector_int_getSize1(vector >* vec) -{ - return vec->size(); -} -CVAPI(void) vector_vector_int_getSize2(vector >* vec, size_t *sizes) +#pragma region cv::Mat +CVAPI(std::vector*) vector_Mat_new1() { - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } + return new std::vector; } -CVAPI(vector*) vector_vector_int_getPointer(vector >* vec) +CVAPI(std::vector*) vector_Mat_new2(uint32_t size) { - return &(vec->at(0)); + return new std::vector(size); } -CVAPI(void) vector_vector_int_copy(vector > *vec, int **dst) +CVAPI(std::vector*) vector_Mat_new3(cv::Mat **data, uint32_t dataLength) { - for (size_t i = 0; i < vec->size(); i++) + auto *vec = new std::vector(dataLength); + for (size_t i = 0; i < dataLength; i++) { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(int) * elem.size(); - memcpy(dst[i], src, length); + (*vec)[i] = *(data[i]); } + return vec; } -CVAPI(void) vector_vector_int_delete(vector >* vec) -{ - delete vec; -} -#pragma endregion -#pragma region vector -CVAPI(vector >*) vector_vector_float_new1() -{ - return new vector >; -} -CVAPI(vector >*) vector_vector_float_new2(size_t size) -{ - return new vector >(size); -} -CVAPI(size_t) vector_vector_float_getSize1(vector >* vec) +CVAPI(size_t) vector_Mat_getSize(std::vector* vector) { - return vec->size(); -} -CVAPI(void) vector_vector_float_getSize2(vector >* vec, size_t *sizes) -{ - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } -} -CVAPI(vector*) vector_vector_float_getPointer(vector >* vec) -{ - return &(vec->at(0)); -} -CVAPI(void) vector_vector_float_copy(vector > *vec, float **dst) -{ - for (size_t i = 0; i < vec->size(); i++) - { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(float) * elem.size(); - memcpy(dst[i], src, length); - } -} -CVAPI(void) vector_vector_float_delete(vector >* vec) -{ - delete vec; + return vector->size(); } -#pragma endregion -#pragma region vector -CVAPI(vector >*) vector_vector_double_new1() -{ - return new vector >; -} -CVAPI(vector >*) vector_vector_double_new2(size_t size) -{ - return new vector >(size); -} -CVAPI(size_t) vector_vector_double_getSize1(vector >* vec) -{ - return vec->size(); -} -CVAPI(void) vector_vector_double_getSize2(vector >* vec, size_t *sizes) -{ - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } -} -CVAPI(vector*) vector_vector_double_getPointer(vector >* vec) -{ - return &(vec->at(0)); -} -CVAPI(void) vector_vector_double_copy(vector > *vec, double **dst) -{ - for (size_t i = 0; i < vec->size(); i++) - { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(double) * elem.size(); - memcpy(dst[i], src, length); - } -} -CVAPI(void) vector_vector_double_delete(vector >* vec) +CVAPI(cv::Mat*) vector_Mat_getPointer(std::vector* vector) { - delete vec; + return &(vector->at(0)); } -#pragma endregion -#pragma region vector -CVAPI(vector >*) vector_vector_KeyPoint_new1() -{ - return new vector >; -} -CVAPI(vector >*) vector_vector_KeyPoint_new2(size_t size) +CVAPI(void) vector_Mat_assignToArray(std::vector* vector, cv::Mat** arr) { - return new vector >(size); -} -CVAPI(vector >*) vector_vector_KeyPoint_new3( - cv::KeyPoint **values, int size1, int *size2) -{ - vector > *vec = new std::vector >(size1); - for (int i = 0; i < size1; i++) + for (size_t i = 0; i < vector->size(); i++) { - vec->at(i) = std::vector(values[i], values[i] + size2[i]); + (vector->at(i)).assignTo(*(arr[i])); } - return vec; } -CVAPI(size_t) vector_vector_KeyPoint_getSize1(vector >* vec) +CVAPI(void) vector_Mat_delete(std::vector* vector) { - return vec->size(); -} -CVAPI(void) vector_vector_KeyPoint_getSize2(vector >* vec, size_t *sizes) -{ - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } -} -CVAPI(vector*) vector_vector_KeyPoint_getPointer(vector >* vec) -{ - return &(vec->at(0)); -} -CVAPI(void) vector_vector_KeyPoint_copy(vector > *vec, cv::KeyPoint **dst) -{ - for (size_t i = 0; i < vec->size(); i++) - { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(cv::KeyPoint) * elem.size(); - memcpy(dst[i], src, length); - } -} -CVAPI(void) vector_vector_KeyPoint_delete(vector >* vec) -{ - delete vec; + //vector->~vector(); + delete vector; } #pragma endregion -#pragma region vector -CVAPI(vector >*) vector_vector_DMatch_new1() -{ - return new vector >; -} -CVAPI(vector >*) vector_vector_DMatch_new2(size_t size) -{ - return new vector >(size); -} -CVAPI(size_t) vector_vector_DMatch_getSize1(vector >* vec) -{ - return vec->size(); -} -CVAPI(void) vector_vector_DMatch_getSize2(vector >* vec, size_t *sizes) -{ - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } -} -CVAPI(vector*) vector_vector_DMatch_getPointer(vector >* vec) -{ - return &(vec->at(0)); -} -CVAPI(void) vector_vector_DMatch_copy(vector > *vec, cv::DMatch **dst) -{ - for (size_t i = 0; i < vec->size(); i++) - { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(cv::DMatch) * elem.size(); - memcpy(dst[i], src, length); - } -} -CVAPI(void) vector_vector_DMatch_delete(vector >* vec) -{ - delete vec; -} -#pragma endregion +#pragma region cv::ml::DTrees::Node -#pragma region vector -CVAPI(vector >*) vector_vector_Point_new1() +CVAPI(std::vector*) vector_DTrees_Node_new1() { - return new vector >; + return new std::vector; } -CVAPI(vector >*) vector_vector_Point_new2(size_t size) -{ - return new vector >(size); -} -CVAPI(size_t) vector_vector_Point_getSize1(vector >* vec) -{ - return vec->size(); -} -CVAPI(void) vector_vector_Point_getSize2(vector >* vec, size_t *sizes) -{ - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } -} -CVAPI(vector*) vector_vector_Point_getPointer(vector >* vec) -{ - return &(vec->at(0)); -} -CVAPI(void) vector_vector_Point_copy(vector > *vec, cv::Point **dst) -{ - for (size_t i = 0; i < vec->size(); i++) - { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(cv::Point) * elem.size(); - memcpy(dst[i], src, length); - } -} -CVAPI(void) vector_vector_Point_delete(vector >* vec) -{ - delete vec; -} -#pragma endregion -#pragma region vector -CVAPI(vector >*) vector_vector_Point2f_new1() -{ - return new vector >; -} -CVAPI(vector >*) vector_vector_Point2f_new2(size_t size) -{ - return new vector >(size); -} -CVAPI(size_t) vector_vector_Point2f_getSize1(vector >* vec) +CVAPI(size_t) vector_DTrees_Node_getSize(std::vector *vector) { - return vec->size(); -} -CVAPI(void) vector_vector_Point2f_getSize2(vector >* vec, size_t *sizes) -{ - for (size_t i = 0; i < vec->size(); i++) - { - sizes[i] = vec->at(i).size(); - } -} -CVAPI(vector*) vector_vector_Point2f_getPointer(vector >* vec) -{ - return &(vec->at(0)); + return vector->size(); } -CVAPI(void) vector_vector_Point2f_copy(vector > *vec, cv::Point2f **dst) + +CVAPI(cv::ml::DTrees::Node*) vector_DTrees_Node_getPointer(std::vector *vector) { - for (size_t i = 0; i < vec->size(); i++) - { - vector &elem = vec->at(i); - void *src = &elem[0]; - size_t length = sizeof(cv::Point2f) * elem.size(); - memcpy(dst[i], src, length); - } + return &(vector->at(0)); } -CVAPI(void) vector_vector_Point2f_delete(vector >* vec) + +CVAPI(void) vector_DTrees_Node_delete(std::vector *vector) { - delete vec; + delete vector; } + #pragma endregion -#pragma region std::string -CVAPI(vector*) vector_string_new1() -{ - return new vector; -} -CVAPI(vector*) vector_string_new2(size_t size) +#pragma region cv::ml::DTrees::Split + +CVAPI(std::vector*) vector_DTrees_Split_new1() { - return new vector(size); + return new std::vector; } -CVAPI(size_t) vector_string_getSize(vector *vec) + +CVAPI(size_t) vector_DTrees_Split_getSize(std::vector *vector) { - return vec->size(); + return vector->size(); } -CVAPI(string*) vector_string_getPointer(vector *vector) + +CVAPI(cv::ml::DTrees::Split*) vector_DTrees_Split_getPointer(std::vector *vector) { return &(vector->at(0)); } -CVAPI(const char*) vector_string_elemAt(vector *vector, int i) + +CVAPI(void) vector_DTrees_Split_delete(std::vector *vector) { - return vector->at(i).c_str(); -} -CVAPI(void) vector_string_delete(vector *vector) -{ delete vector; } + #pragma endregion -#pragma region cv::Mat -CVAPI(vector*) vector_Mat_new1() -{ - return new vector; -} -CVAPI(vector*) vector_Mat_new2(size_t size) +#pragma region cv::detail::ImageFeatures + +CVAPI(std::vector*) vector_ImageFeatures_new1() { - return new vector(size); + return new std::vector; } -CVAPI(vector*) vector_Mat_new3(cv::Mat *data, size_t dataLength) -{ - vector* vec = new vector(dataLength); - for (size_t i = 0; ipush_back(data[i]); - } - return vec; -} -CVAPI(size_t) vector_Mat_getSize(vector* vector) + +CVAPI(size_t) vector_ImageFeatures_getSize( + std::vector* vector) { return vector->size(); } -CVAPI(cv::Mat*) vector_Mat_getPointer(vector* vector) -{ - return &(vector->at(0)); -} -CVAPI(void) vector_Mat_assignToArray(vector* vector, cv::Mat** arr) + +CVAPI(void) vector_ImageFeatures_getKeypointsSize( + std::vector* vector, size_t *dst) { - for (size_t i = 0; i < vector->size(); i++) + for (size_t i = 0; i < vector->size(); i++) { - (vector->at(i)).assignTo(*(arr[i])); + dst[i] = vector->at(i).keypoints.size(); } } -CVAPI(void) vector_Mat_addref(vector* vector) + +CVAPI(void) vector_ImageFeatures_getElements( + std::vector* vector, detail_ImageFeatures* dstArray) { - for (std::vector::iterator m = vector->begin(); m != vector->end(); m++) + for (size_t i = 0; i < vector->size(); i++) { - m->addref(); + const auto &src = vector->at(i); + auto &dst = dstArray[i]; + dst.img_idx = src.img_idx; + dst.img_size = c(src.img_size); + //std::memcpy(dst.keypoints, &src.keypoints[0], sizeof(cv::KeyPoint)*src.keypoints.size()); + std::copy(src.keypoints.begin(), src.keypoints.end(), std::back_inserter(*dst.keypoints)); + src.descriptors.copyTo(*dst.descriptors); } } -CVAPI(void) vector_Mat_delete(vector* vector) + +CVAPI(void) vector_ImageFeatures_delete(std::vector* vector) { - //vector->~vector(); delete vector; } + #pragma endregion -#pragma region cv::ml::DTrees::Node -CVAPI(vector*) vector_DTrees_Node_new1() -{ - return new vector; -} -CVAPI(vector*) vector_DTrees_Node_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_DTrees_Node_new3(cv::ml::DTrees::Node *data, size_t dataLength) +#pragma region cv::line_descriptor::KeyLine +#if 0 +CVAPI(std::vector*) vector_KeyLine_new1() { - return new vector(data, data + dataLength); + return new std::vector; } -CVAPI(size_t) vector_DTrees_Node_getSize(vector *vector) + +CVAPI(size_t) vector_KeyLine_getSize(std::vector* vector) { return vector->size(); } -CVAPI(cv::ml::DTrees::Node*) vector_DTrees_Node_getPointer(vector *vector) -{ - return &(vector->at(0)); -} -CVAPI(void) vector_DTrees_Node_delete(vector *vector) -{ - delete vector; -} -#pragma endregion -#pragma region cv::ml::DTrees::Split -CVAPI(vector*) vector_DTrees_Split_new1() -{ - return new vector; -} -CVAPI(vector*) vector_DTrees_Split_new2(size_t size) -{ - return new vector(size); -} -CVAPI(vector*) vector_DTrees_Split_new3(cv::ml::DTrees::Split *data, size_t dataLength) -{ - return new vector(data, data + dataLength); -} -CVAPI(size_t) vector_DTrees_Split_getSize(vector *vector) +/* +CVAPI(void) vector_KeyLine_getElements( + std::vector* vector, line_descriptor_KeyLine* dst) { - return vector->size(); -} -CVAPI(cv::ml::DTrees::Split*) vector_DTrees_Split_getPointer(vector *vector) + for (size_t i = 0; i < vector->size(); i++) + { + const auto &k = vector->at(i); + const line_descriptor_KeyLine kl{ + k.angle, k.class_id, k.octave, + {k.pt.x, k.pt.y}, + k.response, k.size, + k.startPointX, k.startPointY, + k.endPointX, k.endPointY, + k.sPointInOctaveX, k.sPointInOctaveY, + k.ePointInOctaveX, k.ePointInOctaveY, + k.lineLength, k.numOfPixels }; + dst[i] = kl; + } +}*/ + +CVAPI(cv::line_descriptor::KeyLine*) vector_KeyLine_getPointer(std::vector* vector) { return &(vector->at(0)); } -CVAPI(void) vector_DTrees_Split_delete(vector *vector) + +CVAPI(void) vector_KeyLine_delete(std::vector* vector) { delete vector; } -#pragma endregion - -#endif \ No newline at end of file +#endif +#pragma endregion \ No newline at end of file diff --git a/src/OpenCvSharpExtern/std_vector_nesting.h b/src/OpenCvSharpExtern/std_vector_nesting.h new file mode 100644 index 000000000..86ff85249 --- /dev/null +++ b/src/OpenCvSharpExtern/std_vector_nesting.h @@ -0,0 +1,290 @@ +#pragma once + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +#pragma region vector + +CVAPI(std::vector >*) vector_vector_uchar_new1() +{ + return new std::vector >; +} + +CVAPI(size_t) vector_vector_uchar_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_uchar_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_uchar_copy(std::vector >* vec, uchar** dst) +{ + for (size_t i = 0; i < vec->size(); i++) + { + auto& elem = vec->at(i); + void* src = &elem[0]; + const auto length = sizeof(int) * elem.size(); + memcpy(dst[i], src, length); + } +} + +CVAPI(void) vector_vector_uchar_delete(std::vector >* vec) +{ + delete vec; +} + +#pragma endregion + +#pragma region vector + +CVAPI(std::vector >*) vector_vector_int_new1() +{ + return new std::vector >; +} + +CVAPI(size_t) vector_vector_int_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_int_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_int_copy(std::vector >* vec, int** dst) +{ + for (size_t i = 0; i < vec->size(); i++) + { + auto& elem = vec->at(i); + void* src = &elem[0]; + const auto length = sizeof(int) * elem.size(); + memcpy(dst[i], src, length); + } +} + +CVAPI(void) vector_vector_int_delete(std::vector >* vec) +{ + delete vec; +} + +#pragma endregion + +#pragma region vector + +CVAPI(std::vector >*) vector_vector_double_new1() +{ + return new std::vector >; +} + +CVAPI(size_t) vector_vector_double_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_double_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_double_copy(std::vector >* vec, double** dst) +{ + for (size_t i = 0; i < vec->size(); i++) + { + std::vector& elem = vec->at(i); + void* src = &elem[0]; + const size_t length = sizeof(double) * elem.size(); + memcpy(dst[i], src, length); + } +} + +CVAPI(void) vector_vector_double_delete(std::vector >* vec) +{ + delete vec; +} + +#pragma endregion + +#pragma region vector + +CVAPI(std::vector >*) vector_vector_KeyPoint_new1() +{ + return new std::vector >; +} + +CVAPI(std::vector >*) vector_vector_KeyPoint_new3( + cv::KeyPoint** values, int size1, int* size2) +{ + std::vector >* vec = new std::vector >(size1); + for (int i = 0; i < size1; i++) + { + vec->at(i) = std::vector(values[i], values[i] + size2[i]); + } + return vec; +} + +CVAPI(size_t) vector_vector_KeyPoint_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_KeyPoint_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_KeyPoint_copy(std::vector >* vec, cv::KeyPoint** dst) +{ + copyFromVectorToArray(vec, dst); +} + +CVAPI(void) vector_vector_KeyPoint_delete(std::vector >* vec) +{ + delete vec; +} + +#pragma endregion + +#pragma region vector + +CVAPI(std::vector >*) vector_vector_DMatch_new1() +{ + return new std::vector >; +} + +CVAPI(size_t) vector_vector_DMatch_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_DMatch_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_DMatch_copy(std::vector >* vec, cv::DMatch** dst) +{ + copyFromVectorToArray(vec, dst); +} + +CVAPI(void) vector_vector_DMatch_delete(std::vector >* vec) +{ + delete vec; +} + +#pragma endregion + +#pragma region vector +CVAPI(std::vector >*) vector_vector_Point_new1() +{ + return new std::vector >; +} +CVAPI(std::vector >*) vector_vector_Point_new2(size_t size) +{ + return new std::vector >(size); +} +CVAPI(size_t) vector_vector_Point_getSize1(std::vector >* vec) +{ + return vec->size(); +} +CVAPI(void) vector_vector_Point_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} +CVAPI(void) vector_vector_Point_copy(std::vector >* vec, cv::Point** dst) +{ + copyFromVectorToArray(vec, dst); +} +CVAPI(void) vector_vector_Point_delete(std::vector >* vec) +{ + delete vec; +} +#pragma endregion + +#pragma region vector + +CVAPI(std::vector >*) vector_vector_Point2f_new1() +{ + return new std::vector >; +} + +CVAPI(size_t) vector_vector_Point2f_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_Point2f_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_Point2f_copy(std::vector >* vec, cv::Point2f** dst) +{ + copyFromVectorToArray(vec, dst); +} + +CVAPI(void) vector_vector_Point2f_delete(std::vector >* vec) +{ + delete vec; +} + +#pragma endregion + +#pragma region vector + +#if 0 +CVAPI(std::vector >*) vector_vector_KeyLine_new1() +{ + return new std::vector >; +} + +CVAPI(size_t) vector_vector_KeyLine_getSize1(std::vector >* vec) +{ + return vec->size(); +} + +CVAPI(void) vector_vector_KeyLine_getSize2(std::vector >* vec, size_t* sizes) +{ + for (size_t i = 0; i < vec->size(); i++) + { + sizes[i] = vec->at(i).size(); + } +} + +CVAPI(void) vector_vector_KeyLine_copy(std::vector >* vec, cv::line_descriptor::KeyLine** dst) +{ + copyFromVectorToArray(vec, dst); +} + +CVAPI(void) vector_vector_KeyLine_delete(std::vector >* vec) +{ + delete vec; +} +#endif +#pragma endregion \ No newline at end of file diff --git a/src/OpenCvSharpExtern/std_vector_primitive.h b/src/OpenCvSharpExtern/std_vector_primitive.h new file mode 100644 index 000000000..830d113e8 --- /dev/null +++ b/src/OpenCvSharpExtern/std_vector_primitive.h @@ -0,0 +1,119 @@ +#pragma once + +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +#pragma region uchar +CVAPI(std::vector*) vector_uchar_new1() +{ + return new std::vector; +} +CVAPI(std::vector*) vector_uchar_new2(size_t size) +{ + return new std::vector(size); +} +CVAPI(std::vector*) vector_uchar_new3(uchar* data, size_t dataLength) +{ + return new std::vector(data, data + dataLength); +} +CVAPI(size_t) vector_uchar_getSize(std::vector* vector) +{ + return vector->size(); +} +CVAPI(uchar*) vector_uchar_getPointer(std::vector* vector) +{ + return &(vector->at(0)); +} +CVAPI(void) vector_uchar_copy(std::vector* vector, uchar* dst) +{ + const size_t length = sizeof(uchar) * vector->size(); + memcpy(dst, &(vector->at(0)), length); +} +CVAPI(void) vector_uchar_delete(std::vector* vector) +{ + delete vector; +} +#pragma endregion + +#pragma region int +CVAPI(std::vector*) vector_int32_new1() +{ + return new std::vector; +} +CVAPI(std::vector*) vector_int32_new2(size_t size) +{ + return new std::vector(size); +} +CVAPI(std::vector*) vector_int32_new3(int* data, size_t dataLength) +{ + return new std::vector(data, data + dataLength); +} +CVAPI(size_t) vector_int32_getSize(std::vector* vector) +{ + return vector->size(); +} +CVAPI(int*) vector_int32_getPointer(std::vector* vector) +{ + return &(vector->at(0)); +} +CVAPI(void) vector_int32_delete(std::vector* vector) +{ + delete vector; +} +#pragma endregion + +#pragma region float +CVAPI(std::vector*) vector_float_new1() +{ + return new std::vector; +} +CVAPI(std::vector*) vector_float_new2(size_t size) +{ + return new std::vector(size); +} +CVAPI(std::vector*) vector_float_new3(float* data, size_t dataLength) +{ + return new std::vector(data, data + dataLength); +} +CVAPI(size_t) vector_float_getSize(std::vector* vector) +{ + return vector->size(); +} +CVAPI(float*) vector_float_getPointer(std::vector* vector) +{ + return &(vector->at(0)); +} +CVAPI(void) vector_float_delete(std::vector* vector) +{ + delete vector; +} +#pragma endregion + +#pragma region double +CVAPI(std::vector*) vector_double_new1() +{ + return new std::vector; +} +CVAPI(std::vector*) vector_double_new2(size_t size) +{ + return new std::vector(size); +} +CVAPI(std::vector*) vector_double_new3(double* data, size_t dataLength) +{ + return new std::vector(data, data + dataLength); +} +CVAPI(size_t) vector_double_getSize(std::vector* vector) +{ + return vector->size(); +} +CVAPI(double*) vector_double_getPointer(std::vector* vector) +{ + return &(vector->at(0)); +} +CVAPI(void) vector_double_delete(std::vector* vector) +{ + delete vector; +} +#pragma endregion diff --git a/src/OpenCvSharpExtern/stitching.cpp b/src/OpenCvSharpExtern/stitching.cpp index e232613bc..ee904debf 100644 --- a/src/OpenCvSharpExtern/stitching.cpp +++ b/src/OpenCvSharpExtern/stitching.cpp @@ -1,2 +1,3 @@ +// ReSharper disable CppUnusedIncludeDirective #include "stitching.h" #include "stitching_detail_Matchers.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/stitching.h b/src/OpenCvSharpExtern/stitching.h index 7ef0c0030..df5ddcb94 100644 --- a/src/OpenCvSharpExtern/stitching.h +++ b/src/OpenCvSharpExtern/stitching.h @@ -1,200 +1,250 @@ -#ifndef _CPP_STITCHING_H_ -#define _CPP_STITCHING_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(cv::Ptr*) stitching_createStitcher(int try_use_gpu) +CVAPI(ExceptionStatus) stitching_Stitcher_create(int mode, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::createStitcher(try_use_gpu != 0); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::Stitcher::create(static_cast(mode)); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) stitching_Ptr_Stitcher_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) stitching_Ptr_Stitcher_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::Stitcher*) stitching_Ptr_Stitcher_get(cv::Ptr *obj) +CVAPI(ExceptionStatus) stitching_Ptr_Stitcher_get(cv::Ptr *obj, cv::Stitcher **returnValue) { - return obj->get(); + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP } #pragma region getter/setter -CVAPI(double) stitching_Stitcher_registrationResol(cv::Stitcher *obj) + +CVAPI(ExceptionStatus) stitching_Stitcher_registrationResol(cv::Stitcher *obj, double *returnValue) { - return obj->registrationResol(); + BEGIN_WRAP + *returnValue = obj->registrationResol(); + END_WRAP } -CVAPI(void) stitching_Stitcher_setRegistrationResol(cv::Stitcher *obj, double resol_mpx) +CVAPI(ExceptionStatus) stitching_Stitcher_setRegistrationResol(cv::Stitcher *obj, const double resol_mpx) { + BEGIN_WRAP obj->setRegistrationResol(resol_mpx); + END_WRAP } -CVAPI(double) stitching_Stitcher_seamEstimationResol(cv::Stitcher *obj) +CVAPI(ExceptionStatus) stitching_Stitcher_seamEstimationResol(cv::Stitcher *obj, double *returnValue) { - return obj->seamEstimationResol(); + BEGIN_WRAP + *returnValue = obj->seamEstimationResol(); + END_WRAP } -CVAPI(void) stitching_Stitcher_setSeamEstimationResol(cv::Stitcher *obj, double resol_mpx) +CVAPI(ExceptionStatus) stitching_Stitcher_setSeamEstimationResol(cv::Stitcher *obj, const double resol_mpx) { + BEGIN_WRAP obj->setSeamEstimationResol(resol_mpx); + END_WRAP } -CVAPI(double) stitching_Stitcher_compositingResol(cv::Stitcher *obj) +CVAPI(ExceptionStatus) stitching_Stitcher_compositingResol(cv::Stitcher *obj, double *returnValue) { - return obj->compositingResol(); + BEGIN_WRAP + *returnValue = obj->compositingResol(); + END_WRAP } -CVAPI(void) stitching_Stitcher_setCompositingResol(cv::Stitcher *obj, double resol_mpx) +CVAPI(ExceptionStatus) stitching_Stitcher_setCompositingResol(cv::Stitcher *obj, const double resol_mpx) { + BEGIN_WRAP obj->setCompositingResol(resol_mpx); + END_WRAP } -CVAPI(double) stitching_Stitcher_panoConfidenceThresh(cv::Stitcher *obj) +CVAPI(ExceptionStatus) stitching_Stitcher_panoConfidenceThresh(cv::Stitcher *obj, double *returnValue) { - return obj->panoConfidenceThresh(); + BEGIN_WRAP + *returnValue = obj->panoConfidenceThresh(); + END_WRAP } -CVAPI(void) stitching_Stitcher_setPanoConfidenceThresh(cv::Stitcher *obj, double conf_thresh) +CVAPI(ExceptionStatus) stitching_Stitcher_setPanoConfidenceThresh(cv::Stitcher *obj, const double conf_thresh) { + BEGIN_WRAP obj->setPanoConfidenceThresh(conf_thresh); + END_WRAP } -CVAPI(int) stitching_Stitcher_waveCorrection(cv::Stitcher *obj) +CVAPI(ExceptionStatus) stitching_Stitcher_waveCorrection(cv::Stitcher *obj, int *returnValue) { - return obj->waveCorrection() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->waveCorrection() ? 1 : 0; + END_WRAP } -CVAPI(void) stitching_Stitcher_setWaveCorrection(cv::Stitcher *obj, int flag) +CVAPI(ExceptionStatus) stitching_Stitcher_setWaveCorrection(cv::Stitcher *obj, const int flag) { + BEGIN_WRAP obj->setWaveCorrection(flag != 0); + END_WRAP } -CVAPI(int) stitching_Stitcher_waveCorrectKind(cv::Stitcher *obj) +CVAPI(ExceptionStatus) stitching_Stitcher_waveCorrectKind(cv::Stitcher *obj, int *returnValue) { - return static_cast(obj->waveCorrectKind()); + BEGIN_WRAP + *returnValue = static_cast(obj->waveCorrectKind()); + END_WRAP } -CVAPI(void) stitching_Stitcher_setWaveCorrectKind(cv::Stitcher *obj, int kind) +CVAPI(ExceptionStatus) stitching_Stitcher_setWaveCorrectKind(cv::Stitcher *obj, int kind) { + BEGIN_WRAP obj->setWaveCorrectKind(static_cast(kind)); + END_WRAP } #pragma endregion -CVAPI(int) stitching_Stitcher_estimateTransform_InputArray1( - cv::Stitcher *obj, cv::_InputArray *images) +CVAPI(ExceptionStatus) stitching_Stitcher_estimateTransform_InputArray1( + cv::Stitcher *obj, cv::_InputArray *images, int *returnValue) { - cv::Stitcher::Status status = obj->estimateTransform(*images); - return static_cast(status); + BEGIN_WRAP + *returnValue = static_cast(obj->estimateTransform(*images)); + END_WRAP } -CVAPI(int) stitching_Stitcher_estimateTransform_InputArray2( +CVAPI(ExceptionStatus) stitching_Stitcher_estimateTransform_InputArray2( cv::Stitcher *obj, cv::_InputArray *images, - CvRect **rois, int roisSize1, int *roisSize2) + const CvRect **rois, const int roisSize1, const int *roisSize2, int *returnValue) { + BEGIN_WRAP std::vector > roisVec; toVec(rois, roisSize1, roisSize2, roisVec); - cv::Stitcher::Status status = obj->estimateTransform(*images, roisVec); - return static_cast(status); + *returnValue = static_cast(obj->estimateTransform(*images, roisVec)); + END_WRAP } -CVAPI(int) stitching_Stitcher_estimateTransform_MatArray1( - cv::Stitcher *obj, cv::Mat **images, int imagesSize) + +CVAPI(ExceptionStatus) stitching_Stitcher_estimateTransform_MatArray1( + cv::Stitcher *obj, const cv::Mat **images, const int imagesSize, int *returnValue) { + BEGIN_WRAP std::vector imagesVec; toVec(images, imagesSize, imagesVec); - cv::Stitcher::Status status = obj->estimateTransform(imagesVec); - return static_cast(status); + *returnValue = static_cast(obj->estimateTransform(imagesVec)); + END_WRAP } -CVAPI(int) stitching_Stitcher_estimateTransform_MatArray2( - cv::Stitcher *obj, cv::Mat **images, int imagesSize, - CvRect **rois, int roisSize1, int *roisSize2) +CVAPI(ExceptionStatus) stitching_Stitcher_estimateTransform_MatArray2( + cv::Stitcher *obj, const cv::Mat **images, const int imagesSize, + const CvRect **rois, const int roisSize1, const int *roisSize2, int *returnValue) { + BEGIN_WRAP std::vector imagesVec; toVec(images, imagesSize, imagesVec); std::vector > roisVec; toVec(rois, roisSize1, roisSize2, roisVec); - cv::Stitcher::Status status = obj->estimateTransform(imagesVec, roisVec); - return static_cast(status); + *returnValue = static_cast(obj->estimateTransform(imagesVec, roisVec)); + END_WRAP } -CVAPI(int) stitching_Stitcher_composePanorama1( - cv::Stitcher *obj, cv::_OutputArray *pano) +CVAPI(ExceptionStatus) stitching_Stitcher_composePanorama1( + cv::Stitcher *obj, cv::_OutputArray *pano, int *returnValue) { - cv::Stitcher::Status status = obj->composePanorama(*pano); - return static_cast(status); + BEGIN_WRAP + *returnValue = static_cast(obj->composePanorama(*pano)); + END_WRAP } -CVAPI(int) stitching_Stitcher_composePanorama2_InputArray( - cv::Stitcher *obj, cv::_InputArray *images, cv::_OutputArray *pano) +CVAPI(ExceptionStatus) stitching_Stitcher_composePanorama2_InputArray( + cv::Stitcher *obj, cv::_InputArray *images, cv::_OutputArray *pano, int *returnValue) { - cv::Stitcher::Status status = obj->composePanorama(*images, *pano); - return static_cast(status); + BEGIN_WRAP + *returnValue = static_cast(obj->composePanorama(*images, *pano)); + END_WRAP } -CVAPI(int) stitching_Stitcher_composePanorama2_MatArray( - cv::Stitcher *obj, cv::Mat **images, int imagesSize, cv::_OutputArray *pano) +CVAPI(ExceptionStatus) stitching_Stitcher_composePanorama2_MatArray( + cv::Stitcher *obj, const cv::Mat **images, const int imagesSize, + cv::_OutputArray *pano, int *returnValue) { + BEGIN_WRAP std::vector imagesVec; toVec(images, imagesSize, imagesVec); - cv::Stitcher::Status status = obj->composePanorama(imagesVec, *pano); - return static_cast(status); + *returnValue = static_cast(obj->composePanorama(imagesVec, *pano)); + END_WRAP } -CVAPI(int) stitching_Stitcher_stitch1_InputArray( - cv::Stitcher *obj, cv::_InputArray *images, cv::_OutputArray *pano) +CVAPI(ExceptionStatus) stitching_Stitcher_stitch1_InputArray( + cv::Stitcher *obj, cv::_InputArray *images, + cv::_OutputArray *pano, int *returnValue) { - cv::Stitcher::Status status = obj->stitch(*images, *pano); - return static_cast(status); + BEGIN_WRAP + *returnValue = static_cast(obj->stitch(*images, *pano)); + END_WRAP } -CVAPI(int) stitching_Stitcher_stitch1_MatArray( - cv::Stitcher *obj, cv::Mat **images, int imagesSize, cv::_OutputArray *pano) +CVAPI(ExceptionStatus) stitching_Stitcher_stitch1_MatArray( + cv::Stitcher *obj, const cv::Mat **images, const int imagesSize, + cv::_OutputArray *pano, int *returnValue) { + BEGIN_WRAP std::vector imagesVec; toVec(images, imagesSize, imagesVec); - cv::Stitcher::Status status = obj->stitch(imagesVec, *pano); - return static_cast(status); + *returnValue = static_cast(obj->stitch(imagesVec, *pano)); + END_WRAP } -CVAPI(int) stitching_Stitcher_stitch2_InputArray( +CVAPI(ExceptionStatus) stitching_Stitcher_stitch2_InputArray( cv::Stitcher *obj, cv::_InputArray *images, - CvRect **rois, int roisSize1, int *roisSize2, - cv::_OutputArray *pano) + const CvRect **rois, const int roisSize1, int *roisSize2, + cv::_OutputArray *pano, int *returnValue) { + BEGIN_WRAP std::vector > roisVec; toVec(rois, roisSize1, roisSize2, roisVec); - cv::Stitcher::Status status = obj->stitch(*images, roisVec, *pano); - return static_cast(status); + *returnValue = static_cast(obj->stitch(*images, roisVec, *pano)); + END_WRAP } -CVAPI(int) stitching_Stitcher_stitch2_MatArray( - cv::Stitcher *obj, cv::Mat **images, int imagesSize, - CvRect **rois, int roisSize1, int *roisSize2, - cv::_OutputArray *pano) +CVAPI(ExceptionStatus) stitching_Stitcher_stitch2_MatArray( + cv::Stitcher *obj, const cv::Mat **images, const int imagesSize, + const CvRect **rois, const int roisSize1, int *roisSize2, + cv::_OutputArray *pano, int *returnValue) { + BEGIN_WRAP std::vector imagesVec; toVec(images, imagesSize, imagesVec); std::vector > roisVec; toVec(rois, roisSize1, roisSize2, roisVec); - cv::Stitcher::Status status = obj->stitch(imagesVec, roisVec, *pano); - return static_cast(status); + *returnValue = static_cast(obj->stitch(imagesVec, roisVec, *pano)); + END_WRAP } -CVAPI(void) stitching_Stitcher_component(cv::Stitcher *obj, int **pointer, int *length) +CVAPI(ExceptionStatus) stitching_Stitcher_component(cv::Stitcher *obj, std::vector* returnValue) { - const std::vector &val = obj->component(); - *pointer = const_cast(&val[0]); - *length = static_cast(val.size()); + BEGIN_WRAP + const auto component = obj->component(); + std::copy(component.begin(), component.end(), std::back_inserter(*returnValue)); + END_WRAP } // std::vector cameras() const { return cameras_; } -CVAPI(double) stitching_Stitcher_workScale(cv::Stitcher *obj) +CVAPI(ExceptionStatus) stitching_Stitcher_workScale(cv::Stitcher *obj, double *returnValue) { - return obj->workScale(); + BEGIN_WRAP + *returnValue = obj->workScale(); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/stitching_detail_Matchers.h b/src/OpenCvSharpExtern/stitching_detail_Matchers.h index 9c5299e53..5e7dac98c 100644 --- a/src/OpenCvSharpExtern/stitching_detail_Matchers.h +++ b/src/OpenCvSharpExtern/stitching_detail_Matchers.h @@ -1,118 +1,229 @@ -#ifndef _CPP_STITCHING_DETAIL_MATCHERS_H_ -#define _CPP_STITCHING_DETAIL_MATCHERS_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -using namespace cv::detail; - -void extractImageFeatures( - const ImageFeatures &f, - int *img_idx, - cv::Size *img_size, - std::vector *keypoints, - cv::Mat *descriptors) -{ - *img_idx = f.img_idx; - *img_size = f.img_size; - std::copy(f.keypoints.begin(), f.keypoints.end(), std::back_inserter(*keypoints)); - f.descriptors.copyTo(*descriptors); -} -// ImageFeatures -CVAPI(int) stitching_ImageFeatures_img_idx(ImageFeatures *obj) -{ - return obj->img_idx; -} -CVAPI(MyCvSize) stitching_ImageFeatures_img_size(ImageFeatures *obj) -{ - return c(obj->img_size); -} -CVAPI(int64) stitching_ImageFeatures_keypoints_size(ImageFeatures *obj) -{ - return static_cast(obj->keypoints.size()); -} -CVAPI(void) stitching_ImageFeatures_keypoints_copy(ImageFeatures *obj, cv::KeyPoint* outArray) -{ - for (size_t i = 0; i < obj->keypoints.size(); i++) +CVAPI(ExceptionStatus) stitching_computeImageFeatures1( + cv::Feature2D *featuresFinder, + cv::Mat **images, + int imagesLength, + std::vector *featuresVec, + cv::Mat **masks) +{ + BEGIN_WRAP + + // Do not free Feature2D + const cv::Ptr featuresFinderPtr(featuresFinder, [](cv::Feature2D*){}); + + std::vector imagesVec(imagesLength); + for (int i = 0; i < imagesLength; i++) { - outArray[i] = obj->keypoints[i]; + imagesVec[i] = *images[i]; } + + auto masksArrays = cv::noArray(); + std::vector masksVec(imagesLength); + if (masks != nullptr) + { + for (int i = 0; i < imagesLength; i++) + { + masksVec[i] = *masks[i]; + } + masksArrays = masksVec; + } + + std::vector rawFeatures; + cv::detail::computeImageFeatures(featuresFinderPtr, imagesVec, *featuresVec, masksArrays); + + END_WRAP } -CVAPI(void) stitching_ImageFeatures_descriptors(ImageFeatures *obj, cv::Mat *outMat) + +CVAPI(ExceptionStatus) stitching_computeImageFeatures2( + cv::Feature2D *featuresFinder, + cv::_InputArray *image, + detail_ImageFeatures *features, + cv::_InputArray *mask) { - (obj->descriptors).copyTo(*outMat); -} + BEGIN_WRAP + // Do not free Feature2D + const cv::Ptr featuresFinderPtr(featuresFinder, [](cv::Feature2D*){}); + + cv::detail::ImageFeatures rawFeature; + cv::detail::computeImageFeatures(featuresFinderPtr, *image, rawFeature, entity(mask)); -// SurfFeaturesFinder + features->img_idx = rawFeature.img_idx; + features->img_size = c(rawFeature.img_size); + std::copy(rawFeature.keypoints.begin(), rawFeature.keypoints.end(), std::back_inserter(*features->keypoints)); + rawFeature.descriptors.copyTo(*features->descriptors); -CVAPI(SurfFeaturesFinder*) stitching_SurfFeaturesFinder_new( - double hess_thresh, int num_octaves, int num_layers, int num_octaves_descr, int num_layers_descr) -{ - return new SurfFeaturesFinder(hess_thresh, num_octaves, num_layers, num_octaves_descr, num_layers_descr); + END_WRAP } -CVAPI(void) stitching_SurfFeaturesFinder_delete(SurfFeaturesFinder* obj) -{ - delete obj; + + +// FeaturesMatcher + +CVAPI(ExceptionStatus) stitching_FeaturesMatcher_apply( + cv::detail::FeaturesMatcher* obj, + detail_ImageFeatures *features1, + detail_ImageFeatures *features2, + int *out_src_img_idx, + int *out_dst_img_idx, + std::vector *out_matches, + std::vector *out_inliers_mask, + int *out_num_inliers, + cv::Mat *out_H, + double *out_confidence) +{ + BEGIN_WRAP + cv::detail::ImageFeatures features1Cpp{ + features1->img_idx, + cpp(features1->img_size), + *features1->keypoints, + cv::UMat() + }; + cv::detail::ImageFeatures features2Cpp{ + features2->img_idx, + cpp(features2->img_size), + *features2->keypoints, + cv::UMat() + }; + features1->descriptors->copyTo(features1Cpp.descriptors); + features2->descriptors->copyTo(features2Cpp.descriptors); + + cv::detail::MatchesInfo result; + (*obj)(features1Cpp, features2Cpp, result); + + *out_src_img_idx = result.src_img_idx; + *out_dst_img_idx = result.dst_img_idx; + std::copy(result.matches.begin(), result.matches.end(), std::back_inserter(*out_matches)); + std::copy(result.inliers_mask.begin(), result.inliers_mask.end(), std::back_inserter(*out_inliers_mask)); + *out_num_inliers = result.num_inliers; + result.H.copyTo(*out_H); + *out_confidence = result.confidence; + END_WRAP } -CVAPI(void) stitching_SurfFeaturesFinder_run1( - SurfFeaturesFinder* obj, cv::Mat *image, - int *img_idx, cv::Size *img_size, std::vector *keypoints, cv::Mat *descriptors) -{ - ImageFeatures features; - (*obj)(*image, features); - extractImageFeatures(features, img_idx, img_size, keypoints, descriptors); +CVAPI(ExceptionStatus) stitching_FeaturesMatcher_apply2( + cv::detail::FeaturesMatcher* obj, + detail_ImageFeatures* features, int featuresSize, + cv::Mat *mask, + std::vector *out_src_img_idx, + std::vector *out_dst_img_idx, + std::vector< std::vector > *out_matches, + std::vector< std::vector > *out_inliers_mask, + std::vector *out_num_inliers, + std::vector *out_H, + std::vector *out_confidence) +{ + BEGIN_WRAP + std::vector featuresVec(featuresSize); + for (int i = 0; i < featuresSize; i++) + { + cv::detail::ImageFeatures featuresCpp { + features[i].img_idx, + cpp(features[i].img_size), + *features[i].keypoints, + cv::UMat() }; + features[i].descriptors->copyTo(featuresCpp.descriptors); + featuresVec.push_back(featuresCpp); + } + + cv::UMat maskU; + if (mask != nullptr) + { + mask->copyTo(maskU); + } + + std::vector pairwise_matches; + (*obj)(featuresVec, pairwise_matches, maskU); + + out_src_img_idx->reserve(pairwise_matches.size()); + out_dst_img_idx->reserve(pairwise_matches.size()); + out_matches->reserve(pairwise_matches.size()); + out_inliers_mask->reserve(pairwise_matches.size()); + out_num_inliers->reserve(pairwise_matches.size()); + out_H->reserve(pairwise_matches.size()); + out_confidence->reserve(pairwise_matches.size()); + for (const auto &m : pairwise_matches) + { + out_src_img_idx->push_back(m.src_img_idx); + out_dst_img_idx->push_back(m.dst_img_idx); + out_num_inliers->push_back(m.num_inliers); + out_matches->push_back(m.matches); + out_inliers_mask->push_back(m.inliers_mask); + out_H->push_back(m.H); + out_confidence->push_back(m.confidence); + } + + END_WRAP } -CVAPI(void) stitching_SurfFeaturesFinder_run2( - SurfFeaturesFinder* obj, cv::Mat *image, cv::Rect *rois, int roisSize, - int *img_idx, cv::Size *img_size, std::vector *keypoints, cv::Mat *descriptors) + +CVAPI(ExceptionStatus) stitching_FeaturesMatcher_isThreadSafe( + cv::detail::FeaturesMatcher* obj, int *returnValue) { - std::vector roisVec(rois, rois + roisSize); - ImageFeatures features; - (*obj)(*image, features, roisVec); - extractImageFeatures(features, img_idx, img_size, keypoints, descriptors); + BEGIN_WRAP + *returnValue = obj->isThreadSafe() ? 1 : 0; + END_WRAP } -CVAPI(void) stitching_SurfFeaturesFinder_collectGarbage(SurfFeaturesFinder* obj) + +CVAPI(ExceptionStatus) stitching_FeaturesMatcher_collectGarbage( + cv::detail::FeaturesMatcher* obj) { + BEGIN_WRAP obj->collectGarbage(); + END_WRAP } -// OrbFeaturesFinder +// BestOf2NearestMatcher -CVAPI(OrbFeaturesFinder*) stitching_OrbFeaturesFinder_new( - CvSize grid_size, int nfeatures, float scaleFactor, int nlevels) +CVAPI(ExceptionStatus) stitching_BestOf2NearestMatcher_new( + int try_use_gpu, float match_conf, int num_matches_thresh1,int num_matches_thresh2, + cv::detail::BestOf2NearestMatcher **returnValue) { - return new OrbFeaturesFinder(grid_size, nfeatures, scaleFactor, nlevels); + BEGIN_WRAP + *returnValue = new cv::detail::BestOf2NearestMatcher( + try_use_gpu != 0, match_conf, num_matches_thresh1, num_matches_thresh2); + END_WRAP } -CVAPI(void) stitching_OrbFeaturesFinder_delete(OrbFeaturesFinder* obj) + +CVAPI(ExceptionStatus) stitching_BestOf2NearestMatcher_delete(cv::detail::BestOf2NearestMatcher* obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) stitching_OrbFeaturesFinder_run1( - OrbFeaturesFinder* obj, cv::Mat *image, - int *img_idx, cv::Size *img_size, std::vector *keypoints, cv::Mat *descriptors) -{ - ImageFeatures features; - (*obj)(*image, features); - extractImageFeatures(features, img_idx, img_size, keypoints, descriptors); -} -CVAPI(void) stitching_OrbFeaturesFinder_run2( - OrbFeaturesFinder* obj, cv::Mat *image, cv::Rect *rois, int roisSize, - int *img_idx, cv::Size *img_size, std::vector *keypoints, cv::Mat *descriptors) -{ - std::vector roisVec(rois, rois + roisSize); - ImageFeatures features; - (*obj)(*image, features, roisVec); - extractImageFeatures(features, img_idx, img_size, keypoints, descriptors); -} -CVAPI(void) stitching_OrbFeaturesFinder_collectGarbage(OrbFeaturesFinder* obj) +CVAPI(ExceptionStatus) stitching_BestOf2NearestMatcher_collectGarbage( + cv::detail::BestOf2NearestMatcher* obj) { + BEGIN_WRAP obj->collectGarbage(); + END_WRAP } +// AffineBestOf2NearestMatcher -#endif \ No newline at end of file +CVAPI(ExceptionStatus) stitching_AffineBestOf2NearestMatcher_new( + int full_affine, int try_use_gpu, float match_conf, int num_matches_thresh1, + cv::detail::AffineBestOf2NearestMatcher** returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::detail::AffineBestOf2NearestMatcher( + full_affine != 0, try_use_gpu != 0, match_conf, num_matches_thresh1); + END_WRAP +} + +CVAPI(ExceptionStatus) stitching_AffineBestOf2NearestMatcher_delete( + cv::detail::AffineBestOf2NearestMatcher* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} diff --git a/src/OpenCvSharpExtern/superres.h b/src/OpenCvSharpExtern/superres.h index e071c9e93..9197314d8 100644 --- a/src/OpenCvSharpExtern/superres.h +++ b/src/OpenCvSharpExtern/superres.h @@ -1,157 +1,352 @@ -#ifndef _CPP_SUPERRES_H_ -#define _CPP_SUPERRES_H_ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) superres_FrameSource_nextFrame( +#pragma region FrameSource + +CVAPI(ExceptionStatus) superres_FrameSource_nextFrame( cv::Ptr *obj, cv::_OutputArray *frame) { + BEGIN_WRAP (*obj)->nextFrame(*frame); + END_WRAP } -CVAPI(void) superres_FrameSource_reset( + +CVAPI(ExceptionStatus) superres_FrameSource_reset( cv::Ptr *obj) { + BEGIN_WRAP (*obj)->reset(); + END_WRAP } -CVAPI(cv::Ptr*) superres_createFrameSource_Empty() +CVAPI(ExceptionStatus) superres_createFrameSource_Empty(cv::Ptr **returnValue) { - return clone( cv::superres::createFrameSource_Empty() ); + BEGIN_WRAP + *returnValue = clone( cv::superres::createFrameSource_Empty() ); + END_WRAP } -CVAPI(cv::Ptr*) superres_createFrameSource_Video(const char *fileName) +CVAPI(ExceptionStatus) superres_createFrameSource_Video(const char *fileName, cv::Ptr **returnValue) { - return clone( cv::superres::createFrameSource_Video(fileName) ); + BEGIN_WRAP + *returnValue = clone( cv::superres::createFrameSource_Video(fileName) ); + END_WRAP } -CVAPI(cv::Ptr*) superres_createFrameSource_Video_CUDA(const char *fileName) +CVAPI(ExceptionStatus) superres_createFrameSource_Video_CUDA(const char *fileName, cv::Ptr **returnValue) { - return clone( cv::superres::createFrameSource_Video_CUDA(fileName) ); + BEGIN_WRAP + *returnValue = clone( cv::superres::createFrameSource_Video_CUDA(fileName) ); + END_WRAP } -CVAPI(cv::Ptr*) superres_createFrameSource_Camera(int deviceId) +CVAPI(ExceptionStatus) superres_createFrameSource_Camera(int deviceId, cv::Ptr **returnValue) { - return clone( cv::superres::createFrameSource_Camera(deviceId) ); + BEGIN_WRAP + *returnValue = clone( cv::superres::createFrameSource_Camera(deviceId) ); + END_WRAP } -CVAPI(cv::superres::FrameSource*) superres_Ptr_FrameSource_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) superres_Ptr_FrameSource_get(cv::Ptr *ptr, cv::superres::FrameSource **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) superres_Ptr_FrameSource_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) superres_Ptr_FrameSource_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } +#pragma endregion + +#pragma region SuperResolution -CVAPI(void) superres_SuperResolution_setInput( +CVAPI(ExceptionStatus) superres_SuperResolution_setInput( cv::superres::SuperResolution *obj, cv::Ptr *frameSource) { + BEGIN_WRAP obj->setInput(*frameSource); + END_WRAP } -CVAPI(void) superres_SuperResolution_nextFrame( + +CVAPI(ExceptionStatus) superres_SuperResolution_nextFrame( cv::superres::SuperResolution *obj, cv::_OutputArray *frame) { + BEGIN_WRAP obj->nextFrame(*frame); + END_WRAP } -CVAPI(void) superres_SuperResolution_reset(cv::superres::SuperResolution *obj) + +CVAPI(ExceptionStatus) superres_SuperResolution_reset(cv::superres::SuperResolution *obj) { + BEGIN_WRAP obj->reset(); + END_WRAP } -CVAPI(void) superres_SuperResolution_collectGarbage(cv::superres::SuperResolution *obj) + +CVAPI(ExceptionStatus) superres_SuperResolution_collectGarbage(cv::superres::SuperResolution *obj) { + BEGIN_WRAP obj->collectGarbage(); + END_WRAP } -CVAPI(cv::Ptr*) superres_createSuperResolution_BTVL1() +CVAPI(ExceptionStatus) superres_createSuperResolution_BTVL1(cv::Ptr **returnValue) { - return clone( cv::superres::createSuperResolution_BTVL1() ); + BEGIN_WRAP + *returnValue = clone( cv::superres::createSuperResolution_BTVL1() ); + END_WRAP } -CVAPI(cv::Ptr*) superres_createSuperResolution_BTVL1_CUDA() +CVAPI(ExceptionStatus) superres_createSuperResolution_BTVL1_CUDA(cv::Ptr **returnValue) { - return clone( cv::superres::createSuperResolution_BTVL1_CUDA() ); + BEGIN_WRAP + *returnValue = clone( cv::superres::createSuperResolution_BTVL1_CUDA() ); + END_WRAP } -/* -CVAPI(cv::Ptr*) superres_createSuperResolution_BTVL1_OCL() -{ - return clone( cv::superres::createSuperResolution_BTVL1_OCL() ); -}*/ -CVAPI(cv::superres::SuperResolution*) superres_Ptr_SuperResolution_get( - cv::Ptr *ptr) +CVAPI(ExceptionStatus) superres_Ptr_SuperResolution_get( + cv::Ptr *ptr, cv::superres::SuperResolution **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) superres_Ptr_SuperResolution_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) superres_Ptr_SuperResolution_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getScale(cv::superres::SuperResolution *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getScale(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setScale(cv::superres::SuperResolution *obj, int val) { BEGIN_WRAP obj->setScale(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getIterations(cv::superres::SuperResolution *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setIterations(cv::superres::SuperResolution *obj, int val) { BEGIN_WRAP obj->setIterations(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getTau(cv::superres::SuperResolution *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getTau(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setTau(cv::superres::SuperResolution *obj, double val) { BEGIN_WRAP obj->setTau(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getLambda(cv::superres::SuperResolution *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getLambda(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setLambda(cv::superres::SuperResolution *obj, double val) { BEGIN_WRAP obj->setLambda(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getAlpha(cv::superres::SuperResolution *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getAlpha(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setAlpha(cv::superres::SuperResolution *obj, double val) { BEGIN_WRAP obj->setAlpha(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getKernelSize(cv::superres::SuperResolution *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getKernelSize(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setKernelSize(cv::superres::SuperResolution *obj, int val) { BEGIN_WRAP obj->setKernelSize(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getBlurKernelSize(cv::superres::SuperResolution *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getBlurKernelSize(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setBlurKernelSize(cv::superres::SuperResolution *obj, int val) { BEGIN_WRAP obj->setBlurKernelSize(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getBlurSigma(cv::superres::SuperResolution *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getBlurSigma(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setBlurSigma(cv::superres::SuperResolution *obj, double val) { BEGIN_WRAP obj->setBlurSigma(val); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_getTemporalAreaRadius(cv::superres::SuperResolution *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getTemporalAreaRadius(); END_WRAP } +CVAPI(ExceptionStatus) superres_SuperResolution_setTemporalAreaRadius(cv::superres::SuperResolution *obj, int val) { BEGIN_WRAP obj->setTemporalAreaRadius(val); END_WRAP } -CVAPI(void) superres_DenseOpticalFlowExt_calc(cv::superres::DenseOpticalFlowExt *obj, +CVAPI(ExceptionStatus) superres_SuperResolution_getOpticalFlow(cv::superres::SuperResolution *obj, cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::Ptr(obj->getOpticalFlow()); + END_WRAP +} +CVAPI(ExceptionStatus) superres_SuperResolution_setOpticalFlow(cv::superres::SuperResolution *obj, cv::Ptr *val) +{ + BEGIN_WRAP + obj->setOpticalFlow(*val); + END_WRAP +} + +#pragma endregion + +CVAPI(ExceptionStatus) superres_DenseOpticalFlowExt_calc(cv::superres::DenseOpticalFlowExt *obj, cv::_InputArray *frame0, cv::_InputArray *frame1, cv::_OutputArray *flow1, cv::_OutputArray *flow2) { + BEGIN_WRAP obj->calc(*frame0, *frame1, *flow1, entity(flow2)); + END_WRAP } -CVAPI(void) superres_DenseOpticalFlowExt_collectGarbage(cv::superres::DenseOpticalFlowExt *obj) + +CVAPI(ExceptionStatus) superres_DenseOpticalFlowExt_collectGarbage(cv::superres::DenseOpticalFlowExt *obj) { + BEGIN_WRAP obj->collectGarbage(); + END_WRAP +} + +#pragma region FarnebackOpticalFlow + +CVAPI(ExceptionStatus) superres_createOptFlow_Farneback(cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::superres::createOptFlow_Farneback()); + END_WRAP +} +CVAPI(ExceptionStatus) superres_createOptFlow_Farneback_CUDA(cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::superres::createOptFlow_Farneback_CUDA()); + END_WRAP } -CVAPI(cv::superres::DenseOpticalFlowExt*) superres_Ptr_DenseOpticalFlowExt_get( - cv::Ptr *ptr) +CVAPI(ExceptionStatus) superres_Ptr_FarnebackOpticalFlow_get( + cv::Ptr *ptr, cv::superres::FarnebackOpticalFlow **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) superres_Ptr_DenseOpticalFlowExt_delete( - cv::Ptr *ptr) + +CVAPI(ExceptionStatus) superres_Ptr_FarnebackOpticalFlow_delete( + cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } -CVAPI(cv::Ptr*) superres_createOptFlow_Farneback() +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getPyrScale(cv::superres::FarnebackOpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getPyrScale(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setPyrScale(cv::superres::FarnebackOpticalFlow *obj, double val) { BEGIN_WRAP obj->setPyrScale(val); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getLevelsNumber(cv::superres::FarnebackOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getLevelsNumber(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setLevelsNumber(cv::superres::FarnebackOpticalFlow *obj, int val) { BEGIN_WRAP obj->setLevelsNumber(val); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getWindowSize(cv::superres::FarnebackOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getWindowSize(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setWindowSize(cv::superres::FarnebackOpticalFlow *obj, int val) { BEGIN_WRAP obj->setWindowSize(val); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getIterations(cv::superres::FarnebackOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setIterations(cv::superres::FarnebackOpticalFlow *obj, int val) { BEGIN_WRAP obj->setIterations(val); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getPolyN(cv::superres::FarnebackOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getPolyN(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setPolyN(cv::superres::FarnebackOpticalFlow *obj, int val) { BEGIN_WRAP obj->setPolyN(val); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getPolySigma(cv::superres::FarnebackOpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getPolySigma(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setPolySigma(cv::superres::FarnebackOpticalFlow *obj, double val) { BEGIN_WRAP obj->setPolySigma(val); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_getFlags(cv::superres::FarnebackOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getFlags(); END_WRAP } +CVAPI(ExceptionStatus) superres_FarnebackOpticalFlow_setFlags(cv::superres::FarnebackOpticalFlow *obj, int val) { BEGIN_WRAP obj->setFlags(val); END_WRAP } + +#pragma endregion + +#pragma region DualTVL1OpticalFlow + +CVAPI(ExceptionStatus) superres_createOptFlow_DualTVL1(cv::Ptr **returnValue) { - return clone(cv::superres::createOptFlow_Farneback()); + BEGIN_WRAP + *returnValue = clone(cv::superres::createOptFlow_DualTVL1()); + END_WRAP } -CVAPI(cv::Ptr*) superres_createOptFlow_Farneback_CUDA() +CVAPI(ExceptionStatus) superres_createOptFlow_DualTVL1_CUDA(cv::Ptr **returnValue) { - return clone(cv::superres::createOptFlow_Farneback_CUDA()); + BEGIN_WRAP + *returnValue = clone(cv::superres::createOptFlow_DualTVL1_CUDA()); + END_WRAP } -/* -CVAPI(cv::Ptr*) superres_createOptFlow_Farneback_OCL() + +CVAPI(ExceptionStatus) superres_Ptr_DualTVL1OpticalFlow_get( + cv::Ptr *ptr, cv::superres::DualTVL1OpticalFlow **returnValue) { - return clone(cv::superres::createOptFlow_Farneback_OCL()); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -*/ -/* -CVAPI(cv::Ptr*) superres_createOptFlow_Simple() + +CVAPI(ExceptionStatus) superres_Ptr_DualTVL1OpticalFlow_delete( + cv::Ptr *ptr) { - return clone(cv::superres::createOptFlow_Simple()); -}*/ -CVAPI(cv::Ptr*) superres_createOptFlow_DualTVL1() + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getTau(cv::superres::DualTVL1OpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getTau(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setTau(cv::superres::DualTVL1OpticalFlow *obj, double val) { BEGIN_WRAP obj->setTau(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getLambda(cv::superres::DualTVL1OpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getLambda(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setLambda(cv::superres::DualTVL1OpticalFlow *obj, double val) { BEGIN_WRAP obj->setLambda(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getTheta(cv::superres::DualTVL1OpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getTheta(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setTheta(cv::superres::DualTVL1OpticalFlow *obj, double val) { BEGIN_WRAP obj->setTheta(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getScalesNumber(cv::superres::DualTVL1OpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getScalesNumber(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setScalesNumber(cv::superres::DualTVL1OpticalFlow *obj, int val) { BEGIN_WRAP obj->setScalesNumber(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getWarpingsNumber(cv::superres::DualTVL1OpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getWarpingsNumber(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setWarpingsNumber(cv::superres::DualTVL1OpticalFlow *obj, int val) { BEGIN_WRAP obj->setWarpingsNumber(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getEpsilon(cv::superres::DualTVL1OpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getEpsilon(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setEpsilon(cv::superres::DualTVL1OpticalFlow *obj, double val) { BEGIN_WRAP obj->setEpsilon(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getIterations(cv::superres::DualTVL1OpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setIterations(cv::superres::DualTVL1OpticalFlow *obj, int val) { BEGIN_WRAP obj->setIterations(val); END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_getUseInitialFlow(cv::superres::DualTVL1OpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getUseInitialFlow() ? 1 : 0; END_WRAP } +CVAPI(ExceptionStatus) superres_DualTVL1OpticalFlow_setUseInitialFlow(cv::superres::DualTVL1OpticalFlow *obj, int val) { BEGIN_WRAP obj->setUseInitialFlow(val != 0); END_WRAP } + +#pragma endregion + +#pragma region BroxOpticalFlow + +CVAPI(ExceptionStatus) superres_createOptFlow_Brox_CUDA(cv::Ptr **returnValue) { - return clone(cv::superres::createOptFlow_DualTVL1()); + BEGIN_WRAP + *returnValue = clone(cv::superres::createOptFlow_Brox_CUDA()); + END_WRAP } -CVAPI(cv::Ptr*) superres_createOptFlow_DualTVL1_CUDA() + +CVAPI(ExceptionStatus) superres_Ptr_BroxOpticalFlow_get( + cv::Ptr *ptr, cv::superres::BroxOpticalFlow **returnValue) { - return clone(cv::superres::createOptFlow_DualTVL1_CUDA()); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -/* -CVAPI(cv::Ptr*) superres_createOptFlow_DualTVL1_OCL() + +CVAPI(ExceptionStatus) superres_Ptr_BroxOpticalFlow_delete( + cv::Ptr *ptr) { - return clone(cv::superres::createOptFlow_DualTVL1_OCL()); + BEGIN_WRAP + delete ptr; + END_WRAP } -*/ -CVAPI(cv::Ptr*) superres_createOptFlow_Brox_CUDA() + +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_getAlpha(cv::superres::BroxOpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getAlpha(); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_setAlpha(cv::superres::BroxOpticalFlow *obj, double val) { BEGIN_WRAP obj->setAlpha(val); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_getGamma(cv::superres::BroxOpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getGamma(); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_setGamma(cv::superres::BroxOpticalFlow *obj, double val) { BEGIN_WRAP obj->setGamma(val); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_getScaleFactor(cv::superres::BroxOpticalFlow *obj, double *returnValue) { BEGIN_WRAP *returnValue = obj->getScaleFactor(); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_setScaleFactor(cv::superres::BroxOpticalFlow *obj, double val) { BEGIN_WRAP obj->setScaleFactor(val); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_getInnerIterations(cv::superres::BroxOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getInnerIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_setInnerIterations(cv::superres::BroxOpticalFlow *obj, int val) { BEGIN_WRAP obj->setInnerIterations(val); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_getOuterIterations(cv::superres::BroxOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getOuterIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_setOuterIterations(cv::superres::BroxOpticalFlow *obj, int val) { BEGIN_WRAP obj->setOuterIterations(val); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_getSolverIterations(cv::superres::BroxOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getSolverIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_BroxOpticalFlow_setSolverIterations(cv::superres::BroxOpticalFlow *obj, int val) { BEGIN_WRAP obj->setSolverIterations(val); END_WRAP } + +#pragma endregion + +#pragma region PyrLKOpticalFlow + +CVAPI(ExceptionStatus) superres_createOptFlow_PyrLK_CUDA(cv::Ptr **returnValue) { - return clone(cv::superres::createOptFlow_Brox_CUDA()); + BEGIN_WRAP + *returnValue = clone(cv::superres::createOptFlow_PyrLK_CUDA()); + END_WRAP } -CVAPI(cv::Ptr*) superres_createOptFlow_PyrLK_CUDA() + +CVAPI(ExceptionStatus) superres_Ptr_PyrLKOpticalFlow_get( + cv::Ptr *ptr, cv::superres::PyrLKOpticalFlow **returnValue) { - return clone(cv::superres::createOptFlow_PyrLK_CUDA()); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -/* -CVAPI(cv::Ptr*) superres_createOptFlow_PyrLK_OCL() + +CVAPI(ExceptionStatus) superres_Ptr_PyrLKOpticalFlow_delete( + cv::Ptr *ptr) { - return clone(cv::superres::createOptFlow_PyrLK_OCL()); + BEGIN_WRAP + delete ptr; + END_WRAP } -*/ -#endif \ No newline at end of file +CVAPI(ExceptionStatus) superres_PyrLKOpticalFlow_getWindowSize(cv::superres::PyrLKOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getWindowSize(); END_WRAP } +CVAPI(ExceptionStatus) superres_PyrLKOpticalFlow_setWindowSize(cv::superres::PyrLKOpticalFlow *obj, int val) { BEGIN_WRAP obj->setWindowSize(val); END_WRAP } +CVAPI(ExceptionStatus) superres_PyrLKOpticalFlow_getMaxLevel(cv::superres::PyrLKOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getMaxLevel(); END_WRAP } +CVAPI(ExceptionStatus) superres_PyrLKOpticalFlow_setMaxLevel(cv::superres::PyrLKOpticalFlow *obj, int val) { BEGIN_WRAP obj->setMaxLevel(val); END_WRAP } +CVAPI(ExceptionStatus) superres_PyrLKOpticalFlow_getIterations(cv::superres::PyrLKOpticalFlow *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getIterations(); END_WRAP } +CVAPI(ExceptionStatus) superres_PyrLKOpticalFlow_setIterations(cv::superres::PyrLKOpticalFlow *obj, int val) { BEGIN_WRAP obj->setIterations(val); END_WRAP } + +#pragma endregion + + +#endif // !#ifndef _WINRT_DLL diff --git a/src/OpenCvSharpExtern/text.cpp b/src/OpenCvSharpExtern/text.cpp new file mode 100644 index 000000000..f4ed060fe --- /dev/null +++ b/src/OpenCvSharpExtern/text.cpp @@ -0,0 +1,2 @@ +#include "text.h" +#include "text_TextDetector.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/text.h b/src/OpenCvSharpExtern/text.h new file mode 100644 index 000000000..48720306e --- /dev/null +++ b/src/OpenCvSharpExtern/text.h @@ -0,0 +1,120 @@ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +// OCRTesseract + +CVAPI(ExceptionStatus) text_OCRTesseract_run1( + cv::text::OCRTesseract *obj, + cv::Mat *image, + std::string *output_text, + std::vector* component_rects, + std::vector* component_texts, + std::vector* component_confidences, + int component_level) +{ + BEGIN_WRAP + obj->run(*image, *output_text, component_rects, component_texts, component_confidences, component_level); + END_WRAP +} + +CVAPI(ExceptionStatus) text_OCRTesseract_run2( + cv::text::OCRTesseract *obj, + cv::Mat *image, + cv::Mat *mask, + std::string *output_text, + std::vector* component_rects, + std::vector* component_texts, + std::vector* component_confidences, + int component_level) +{ + BEGIN_WRAP + obj->run(*image, *mask, *output_text, component_rects, component_texts, component_confidences, component_level); + END_WRAP +} + +/*CVAPI(ExceptionStatus) text_OCRTesseract_run3( + cv::text::OCRTesseract *obj, + cv::_InputArray *image, + int min_confidence, + int component_level, + std::string *dst) +{ + BEGIN_WRAP + const auto result = obj->run(*image, min_confidence, component_level); + dst->assign(result); + END_WRAP +}*/ + +/*CVAPI(ExceptionStatus) text_OCRTesseract_run4( + cv::text::OCRTesseract *obj, + cv::_InputArray *image, + cv::_InputArray *mask, + int min_confidence, + int component_level, + std::string *dst) +{ + BEGIN_WRAP + const auto result = obj->run(*image, *mask, min_confidence, component_level); + dst->assign(result); + END_WRAP +}*/ + +CVAPI(ExceptionStatus) text_OCRTesseract_setWhiteList( + cv::text::OCRTesseract *obj, + const char *char_whitelist) +{ + BEGIN_WRAP + obj->setWhiteList(char_whitelist); + END_WRAP +} + +CVAPI(ExceptionStatus) text_OCRTesseract_create( + const char* datapath, + const char* language, + const char* char_whitelist, + int oem, + int psmode, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto result = cv::text::OCRTesseract::create(datapath, language, char_whitelist, oem, psmode); + *returnValue = clone(result); + END_WRAP +} + +CVAPI(ExceptionStatus) text_Ptr_OCRTesseract_delete( + cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) text_OCRTesseract_get( + cv::Ptr *obj, cv::text::OCRTesseract **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +#pragma region swt_text_detection.hpp + +CVAPI(ExceptionStatus) text_detectTextSWT( + cv::_InputArray *input, std::vector *result, int dark_on_light, cv::_OutputArray *draw, cv::_OutputArray *chainBBs) +{ + BEGIN_WRAP + cv::text::detectTextSWT(*input, *result, dark_on_light != 0, entity(draw), entity(chainBBs)); + END_WRAP +} + +#pragma endregion + +#endif // !#ifndef _WINRT_DLL diff --git a/src/OpenCvSharpExtern/text_TextDetector.h b/src/OpenCvSharpExtern/text_TextDetector.h new file mode 100644 index 000000000..c9b7f82de --- /dev/null +++ b/src/OpenCvSharpExtern/text_TextDetector.h @@ -0,0 +1,66 @@ +#pragma once + +#ifndef _WINRT_DLL + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +CVAPI(ExceptionStatus) text_TextDetector_detect(cv::text::TextDetector *obj, cv::_InputArray *inputImage, std::vector *Bbox, std::vector *confidence) +{ + BEGIN_WRAP + obj->detect(*inputImage, *Bbox, *confidence); + END_WRAP +} + +CVAPI(ExceptionStatus) text_TextDetectorCNN_detect(cv::text::TextDetectorCNN *obj, cv::_InputArray *inputImage, std::vector *Bbox, std::vector *confidence) +{ + BEGIN_WRAP + obj->detect(*inputImage, *Bbox, *confidence); + END_WRAP +} + +CVAPI(ExceptionStatus) text_TextDetectorCNN_create1( + const char *modelArchFilename, const char *modelWeightsFilename, MyCvSize *detectionSizes, int detectionSizesLength, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + std::vector detectionSizesVec; + if (detectionSizes != nullptr) + { + detectionSizesVec.resize(detectionSizesLength); + for (int i = 0; i < detectionSizesLength; i++) + detectionSizesVec[i] = cpp(detectionSizes[i]); + } + + const auto ptr = cv::text::TextDetectorCNN::create(modelArchFilename, modelWeightsFilename, detectionSizesVec); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) text_TextDetectorCNN_create2( + const char *modelArchFilename, const char *modelWeightsFilename, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::text::TextDetectorCNN::create(modelArchFilename, modelWeightsFilename); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) text_Ptr_TextDetectorCNN_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) text_Ptr_TextDetectorCNN_get(cv::Ptr* obj, cv::text::TextDetectorCNN **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +#endif // !#ifndef _WINRT_DLL diff --git a/src/OpenCvSharpExtern/tracking.cpp b/src/OpenCvSharpExtern/tracking.cpp new file mode 100644 index 000000000..a009e28f3 --- /dev/null +++ b/src/OpenCvSharpExtern/tracking.cpp @@ -0,0 +1,2 @@ +// ReSharper disable CppUnusedIncludeDirective +#include "tracking.h" diff --git a/src/OpenCvSharpExtern/tracking.h b/src/OpenCvSharpExtern/tracking.h new file mode 100644 index 000000000..6a3e440be --- /dev/null +++ b/src/OpenCvSharpExtern/tracking.h @@ -0,0 +1,150 @@ +#pragma once + +// ReSharper disable CommentTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile +// ReSharper disable IdentifierTypo + +#include "include_opencv.h" + +#pragma region TrackerCSRT + +CV_EXTERN_C struct tracker_TrackerCSRT_Params +{ + int use_hog; + int use_color_names; + int use_gray; + int use_rgb; + int use_channel_weights; + int use_segmentation; + + char* window_function; //!< Window function: "hann", "cheb", "kaiser" + float kaiser_alpha; + float cheb_attenuation; + + float template_size; + float gsl_sigma; + float hog_orientations; + float hog_clip; + float padding; + float filter_lr; + float weights_lr; + int num_hog_channels_used; + int admm_iterations; + int histogram_bins; + float histogram_lr; + int background_ratio; + int number_of_scales; + float scale_sigma_factor; + float scale_model_max_area; + float scale_lr; + float scale_step; + + float psr_threshold; //!< we lost the target, if the psr is lower than this. +}; + +cv::TrackerCSRT::Params tracking_TrackerCSRT_Param_ToCpp(const tracker_TrackerCSRT_Params *params) +{ + cv::TrackerCSRT::Params p; + p.use_hog = params->use_hog != 0; + p.use_color_names = params->use_color_names != 0; + p.use_gray = params->use_gray != 0; + p.use_rgb = params->use_rgb != 0; + p.use_channel_weights = params->use_channel_weights != 0; + p.use_segmentation = params->use_segmentation != 0; + p.window_function = std::string(params->window_function); + p.kaiser_alpha = params->kaiser_alpha; + p.cheb_attenuation = params->cheb_attenuation; + p.template_size = params->template_size; + p.gsl_sigma = params->gsl_sigma; + p.hog_orientations = params->hog_orientations; + p.hog_clip = params->hog_clip; + p.padding = params->padding; + p.filter_lr = params->filter_lr; + p.weights_lr = params->weights_lr; + p.num_hog_channels_used = params->num_hog_channels_used; + p.admm_iterations = params->admm_iterations; + p.histogram_bins = params->histogram_bins; + p.histogram_lr = params->histogram_lr; + p.background_ratio = params->background_ratio; + p.number_of_scales = params->number_of_scales; + p.scale_sigma_factor = params->scale_sigma_factor; + p.scale_model_max_area = params->scale_model_max_area; + p.scale_lr = params->scale_lr; + p.scale_step = params->scale_step; + p.psr_threshold = params->psr_threshold; + return p; +} + +CVAPI(ExceptionStatus) tracking_TrackerCSRT_create1(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::TrackerCSRT::create(); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_TrackerCSRT_create2(tracker_TrackerCSRT_Params* parameters, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = tracking_TrackerCSRT_Param_ToCpp(parameters); + const auto obj = cv::TrackerCSRT::create(p); + *returnValue = clone(obj); + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_Ptr_TrackerCSRT_delete(cv::Ptr* ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_Ptr_TrackerCSRT_get(cv::Ptr* ptr, cv::TrackerCSRT **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_TrackerCSRT_setInitialMask(cv::TrackerCSRT *tracker, cv::_InputArray *mask) +{ + BEGIN_WRAP + tracker->setInitialMask(*mask); + END_WRAP +} + +#pragma endregion + +#pragma region TrackerKCF + +CVAPI(ExceptionStatus) tracking_TrackerKCF_create1(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::TrackerKCF::create(); + *returnValue = clone(p); + END_WRAP +} +CVAPI(ExceptionStatus) tracking_TrackerKCF_create2(cv::TrackerKCF::Params *parameters, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::TrackerKCF::create(*parameters); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_Ptr_TrackerKCF_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_Ptr_TrackerKCF_get(cv::Ptr *ptr, cv::TrackerKCF **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion diff --git a/src/OpenCvSharpExtern/tracking_UnscentedKalmanFilter.h b/src/OpenCvSharpExtern/tracking_UnscentedKalmanFilter.h new file mode 100644 index 000000000..39049668c --- /dev/null +++ b/src/OpenCvSharpExtern/tracking_UnscentedKalmanFilter.h @@ -0,0 +1,38 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +// TODO +#if false +#include "include_opencv.h" +#include + +CVAPI(ExceptionStatus) tracking_createUnscentedKalmanFilter( + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::tracking::createUnscentedKalmanFilter(); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_Ptr_UnscentedKalmanFilter_delete( + cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) tracking_Ptr_UnscentedKalmanFilter_get( + cv::Ptr *ptr, + cv::tracking::UnscentedKalmanFilter **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#endif diff --git a/src/OpenCvSharpExtern/video.cpp b/src/OpenCvSharpExtern/video.cpp index fbadbb674..9a9421a77 100644 --- a/src/OpenCvSharpExtern/video.cpp +++ b/src/OpenCvSharpExtern/video.cpp @@ -1,3 +1,4 @@ +// ReSharper disable CppUnusedIncludeDirective #include "video.h" #include "video_tracking.h" #include "video_background_segm.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/video.h b/src/OpenCvSharpExtern/video.h index 25a6b04ea..87e7b1887 100644 --- a/src/OpenCvSharpExtern/video.h +++ b/src/OpenCvSharpExtern/video.h @@ -1,7 +1,4 @@ -#ifndef _CPP_VIDEO_H_ -#define _CPP_VIDEO_H_ +#pragma once #include "include_opencv.h" - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/video_background_segm.h b/src/OpenCvSharpExtern/video_background_segm.h index 67b95b68e..985882c9a 100644 --- a/src/OpenCvSharpExtern/video_background_segm.h +++ b/src/OpenCvSharpExtern/video_background_segm.h @@ -1,239 +1,343 @@ -#ifndef _CPP_VIDEO_BACKGROUND_SEGM_H_ -#define _CPP_VIDEO_BACKGROUND_SEGM_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" #pragma region BackgroundSubtractor -CVAPI(void) video_BackgroundSubtractor_getBackgroundImage(cv::BackgroundSubtractor *obj, cv::_OutputArray *backgroundImage) + +CVAPI(ExceptionStatus) video_BackgroundSubtractor_getBackgroundImage(cv::BackgroundSubtractor *obj, cv::_OutputArray *backgroundImage) { + BEGIN_WRAP obj->getBackgroundImage(*backgroundImage); + END_WRAP } -CVAPI(void) video_BackgroundSubtractor_apply(cv::BackgroundSubtractor *obj, cv::_InputArray *image, cv::_OutputArray *fgmask, double learningRate) + +CVAPI(ExceptionStatus) video_BackgroundSubtractor_apply(cv::BackgroundSubtractor *obj, cv::_InputArray *image, cv::_OutputArray *fgmask, double learningRate) { + BEGIN_WRAP obj->apply(*image, *fgmask, learningRate); + END_WRAP } -CVAPI(void) video_Ptr_BackgroundSubtractor_delete(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_Ptr_BackgroundSubtractor_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } -CVAPI(cv::BackgroundSubtractor*) video_Ptr_BackgroundSubtractor_get(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) video_Ptr_BackgroundSubtractor_get(cv::Ptr *ptr, cv::BackgroundSubtractor **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } #pragma endregion #pragma region BackgroundSubtractorMOG2 -CVAPI(cv::Ptr*) video_createBackgroundSubtractorMOG2(int history, double varThreshold, int detectShadows) + +CVAPI(ExceptionStatus) video_createBackgroundSubtractorMOG2(int history, double varThreshold, int detectShadows, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::createBackgroundSubtractorMOG2(history, varThreshold, detectShadows != 0); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::createBackgroundSubtractorMOG2(history, varThreshold, detectShadows != 0); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) video_Ptr_BackgroundSubtractorMOG2_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) video_Ptr_BackgroundSubtractorMOG2_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::BackgroundSubtractorMOG2*) video_Ptr_BackgroundSubtractorMOG2_get( - cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_Ptr_BackgroundSubtractorMOG2_get( + cv::Ptr *ptr, cv::BackgroundSubtractorMOG2 **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorMOG2_getHistory(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getHistory(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getHistory(); + BEGIN_WRAP + *returnValue = (*ptr)->getHistory(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setHistory(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setHistory(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setHistory(value); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorMOG2_getNMixtures(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getNMixtures(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getNMixtures(); + BEGIN_WRAP + *returnValue = (*ptr)->getNMixtures(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setNMixtures(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setNMixtures(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setNMixtures(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getBackgroundRatio(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getBackgroundRatio(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getBackgroundRatio(); + BEGIN_WRAP + *returnValue = (*ptr)->getBackgroundRatio(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setBackgroundRatio(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setBackgroundRatio(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setBackgroundRatio(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getVarThreshold(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getVarThreshold(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getVarThreshold(); + BEGIN_WRAP + *returnValue = (*ptr)->getVarThreshold(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setVarThreshold(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setVarThreshold(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setVarThreshold(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getVarThresholdGen(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getVarThresholdGen(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getVarThresholdGen(); + BEGIN_WRAP + *returnValue = (*ptr)->getVarThresholdGen(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setVarThresholdGen(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setVarThresholdGen(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setVarThresholdGen(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getVarInit(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getVarInit(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getVarInit(); + BEGIN_WRAP + *returnValue = (*ptr)->getVarInit(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setVarInit(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setVarInit(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setVarInit(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getVarMin(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getVarMin(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getVarMin(); + BEGIN_WRAP + *returnValue = (*ptr)->getVarMin(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setVarMin(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setVarMin(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setVarMin(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getVarMax(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getVarMax(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getVarMax(); + BEGIN_WRAP + *returnValue = (*ptr)->getVarMax(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setVarMax(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setVarMax(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setVarMax(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getComplexityReductionThreshold(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getComplexityReductionThreshold(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getComplexityReductionThreshold(); + BEGIN_WRAP + *returnValue = (*ptr)->getComplexityReductionThreshold(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setComplexityReductionThreshold(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setComplexityReductionThreshold(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setComplexityReductionThreshold(value); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorMOG2_getDetectShadows(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getDetectShadows(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getDetectShadows() ? 1 : 0; + BEGIN_WRAP + *returnValue = (*ptr)->getDetectShadows() ? 1 : 0; + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setDetectShadows(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setDetectShadows(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setDetectShadows(value != 0); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorMOG2_getShadowValue(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getShadowValue(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getShadowValue(); + BEGIN_WRAP + *returnValue = (*ptr)->getShadowValue(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setShadowValue(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setShadowValue(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setShadowValue(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorMOG2_getShadowThreshold(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_getShadowThreshold(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getShadowThreshold(); + BEGIN_WRAP + *returnValue = (*ptr)->getShadowThreshold(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorMOG2_setShadowThreshold(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorMOG2_setShadowThreshold(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setShadowThreshold(value); + END_WRAP } #pragma endregion #pragma region BackgroundSubtractorKNN -CVAPI(cv::Ptr*) video_createBackgroundSubtractorKNN( - int history, double dist2Threshold, int detectShadows) + +CVAPI(ExceptionStatus) video_createBackgroundSubtractorKNN( + int history, double dist2Threshold, int detectShadows, cv::Ptr **returnValue) { - cv::Ptr ptr = cv::createBackgroundSubtractorKNN( + BEGIN_WRAP + const auto ptr = cv::createBackgroundSubtractorKNN( history, dist2Threshold, detectShadows != 0); - return new cv::Ptr(ptr); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) video_Ptr_BackgroundSubtractorKNN_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) video_Ptr_BackgroundSubtractorKNN_delete(cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::BackgroundSubtractorKNN*) video_Ptr_BackgroundSubtractorKNN_get( - cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_Ptr_BackgroundSubtractorKNN_get( + cv::Ptr *ptr, cv::BackgroundSubtractorKNN **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorKNN_getHistory(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getHistory(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getHistory(); + BEGIN_WRAP + *returnValue = (*ptr)->getHistory(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setHistory(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setHistory(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setHistory(value); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorKNN_getNSamples(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getNSamples(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getNSamples(); + BEGIN_WRAP + *returnValue = (*ptr)->getNSamples(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setNSamples(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setNSamples(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setNSamples(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorKNN_getDist2Threshold(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getDist2Threshold(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getDist2Threshold(); + BEGIN_WRAP + *returnValue = (*ptr)->getDist2Threshold(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setDist2Threshold(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setDist2Threshold(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setDist2Threshold(value); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorKNN_getkNNSamples(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getkNNSamples(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getkNNSamples(); + BEGIN_WRAP + *returnValue = (*ptr)->getkNNSamples(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setkNNSamples(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setkNNSamples(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setkNNSamples(value); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorKNN_getDetectShadows(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getDetectShadows(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getDetectShadows() ? 1 : 0; + BEGIN_WRAP + *returnValue = (*ptr)->getDetectShadows() ? 1 : 0; + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setDetectShadows(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setDetectShadows(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setDetectShadows(value != 0); + END_WRAP } -CVAPI(int) video_BackgroundSubtractorKNN_getShadowValue(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getShadowValue(cv::Ptr *ptr, int *returnValue) { - return (*ptr)->getShadowValue(); + BEGIN_WRAP + *returnValue = (*ptr)->getShadowValue(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setShadowValue(cv::Ptr *ptr, int value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setShadowValue(cv::Ptr *ptr, int value) { + BEGIN_WRAP (*ptr)->setShadowValue(value); + END_WRAP } -CVAPI(double) video_BackgroundSubtractorKNN_getShadowThreshold(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_getShadowThreshold(cv::Ptr *ptr, double *returnValue) { - return (*ptr)->getShadowThreshold(); + BEGIN_WRAP + *returnValue = (*ptr)->getShadowThreshold(); + END_WRAP } -CVAPI(void) video_BackgroundSubtractorKNN_setShadowThreshold(cv::Ptr *ptr, double value) +CVAPI(ExceptionStatus) video_BackgroundSubtractorKNN_setShadowThreshold(cv::Ptr *ptr, double value) { + BEGIN_WRAP (*ptr)->setShadowThreshold(value); + END_WRAP } #pragma endregion - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/video_tracking.h b/src/OpenCvSharpExtern/video_tracking.h index 71871a556..7bdac87b7 100644 --- a/src/OpenCvSharpExtern/video_tracking.h +++ b/src/OpenCvSharpExtern/video_tracking.h @@ -1,185 +1,371 @@ -#ifndef _CPP_VIDEO_TRACKING_H_ -#define _CPP_VIDEO_TRACKING_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(MyCvBox2D) video_CamShift( - cv::_InputArray *probImage, CvRect *window, CvTermCriteria criteria) +CVAPI(ExceptionStatus) video_CamShift( + cv::_InputArray *probImage, MyCvRect *window, MyCvTermCriteria criteria, MyCvBox2D *returnValue) +{ + BEGIN_WRAP + cv::Rect window0 = cpp(*window); + const auto ret = cv::CamShift(*probImage, window0, cpp(criteria)); + *window = c(window0); + *returnValue = c(ret); + END_WRAP +} + +CVAPI(ExceptionStatus) video_meanShift( + cv::_InputArray *probImage, MyCvRect *window, MyCvTermCriteria criteria, int *returnValue) { - cv::Rect window0 = *window; - cv::RotatedRect ret = cv::CamShift(*probImage, window0, criteria); - *window = window0; - return c(ret); + BEGIN_WRAP + cv::Rect window0 = cpp(*window); + const auto ret = cv::meanShift(*probImage, window0, cpp(criteria)); + *window = c(window0); + *returnValue = ret; + END_WRAP } -CVAPI(int) video_meanShift( - cv::_InputArray *probImage, CvRect *window, CvTermCriteria criteria) +CVAPI(ExceptionStatus) video_buildOpticalFlowPyramid1( + cv::_InputArray* img, cv::_OutputArray* pyramid, + MyCvSize winSize, int maxLevel, int withDerivatives, + int pyrBorder, int derivBorder, int tryReuseInputImage, + int* returnValue) +{ + BEGIN_WRAP + * returnValue = cv::buildOpticalFlowPyramid( + *img, *pyramid, cpp(winSize), maxLevel, withDerivatives != 0, + pyrBorder, derivBorder, tryReuseInputImage != 0); + END_WRAP +} +CVAPI(ExceptionStatus) video_buildOpticalFlowPyramid2( + cv::_InputArray* img, std::vector* pyramidVec, + MyCvSize winSize, int maxLevel, int withDerivatives, + int pyrBorder, int derivBorder, int tryReuseInputImage, + int* returnValue) { - cv::Rect window0 = *window; - int ret = cv::meanShift(*probImage, window0, criteria); - *window = window0; - return ret; + BEGIN_WRAP + * returnValue = cv::buildOpticalFlowPyramid( + *img, *pyramidVec, cpp(winSize), maxLevel, withDerivatives != 0, + pyrBorder, derivBorder, tryReuseInputImage != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) video_calcOpticalFlowPyrLK_InputArray( + cv::_InputArray* prevImg, cv::_InputArray* nextImg, + cv::_InputArray* prevPts, cv::_InputOutputArray* nextPts, + cv::_OutputArray* status, cv::_OutputArray* err, + MyCvSize winSize, int maxLevel, MyCvTermCriteria criteria, + int flags, double minEigThreshold) +{ + BEGIN_WRAP + cv::calcOpticalFlowPyrLK(*prevImg, *nextImg, *prevPts, *nextPts, *status, *err, + cpp(winSize), maxLevel, cpp(criteria), flags, minEigThreshold); + END_WRAP +} + +CVAPI(ExceptionStatus) video_calcOpticalFlowPyrLK_vector( + cv::_InputArray* prevImg, cv::_InputArray* nextImg, + cv::Point2f* prevPts, int prevPtsSize, + std::vector* nextPts, + std::vector* status, + std::vector* err, + MyCvSize winSize, int maxLevel, MyCvTermCriteria criteria, + int flags, double minEigThreshold) +{ + BEGIN_WRAP + const std::vector prevPtsVec(prevPts, prevPts + prevPtsSize); + cv::calcOpticalFlowPyrLK(*prevImg, *nextImg, prevPtsVec, *nextPts, + *status, *err, cpp(winSize), maxLevel, cpp(criteria), flags, minEigThreshold); + END_WRAP +} + +CVAPI(ExceptionStatus) video_calcOpticalFlowFarneback( + cv::_InputArray* prev, cv::_InputArray* next, + cv::_InputOutputArray* flow, double pyrScale, int levels, int winSize, + int iterations, int polyN, double polySigma, int flags) +{ + BEGIN_WRAP + cv::calcOpticalFlowFarneback(*prev, *next, *flow, pyrScale, levels, winSize, + iterations, polyN, polySigma, flags); + END_WRAP +} + +/* deprecated +CVAPI(ExceptionStatus) video_estimateRigidTransform(cv::_InputArray *src, cv::_InputArray *dst, int fullAffine, cv::Mat *returnValue) +{ + *returnValue = cv::estimateRigidTransform(*src, *dst, fullAffine != 0); +} +*/ + +CVAPI(ExceptionStatus) video_computeECC(cv::_InputArray *templateImage, cv::_InputArray *inputImage, cv::_InputArray *inputMask, double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::computeECC(*templateImage, *inputImage, entity(inputMask)); + END_WRAP +} + +CVAPI(ExceptionStatus) video_findTransformECC1( + cv::_InputArray *templateImage, cv::_InputArray *inputImage, + cv::_InputOutputArray *warpMatrix, int motionType, + MyCvTermCriteria criteria, + cv::_InputArray *inputMask, int gaussFiltSize, double *returnValue) +{ + BEGIN_WRAP + *returnValue = cv::findTransformECC( + *templateImage, *inputImage, *warpMatrix, motionType, + cpp(criteria),entity(inputMask), gaussFiltSize); + END_WRAP +} + +CVAPI(ExceptionStatus) video_findTransformECC2( + cv::_InputArray *templateImage, cv::_InputArray *inputImage, + cv::_InputOutputArray *warpMatrix, int motionType, + MyCvTermCriteria criteria, cv::_InputArray *inputMask, double* returnValue) +{ + BEGIN_WRAP + *returnValue = cv::findTransformECC( + *templateImage, *inputImage, *warpMatrix, motionType, + cpp(criteria), entity(inputMask)); + END_WRAP } #pragma region KalmanFilter -CVAPI(cv::KalmanFilter*) video_KalmanFilter_new1() +CVAPI(ExceptionStatus) video_KalmanFilter_new1(cv::KalmanFilter **returnValue) { - return new cv::KalmanFilter(); + BEGIN_WRAP + *returnValue = new cv::KalmanFilter; + END_WRAP } -CVAPI(cv::KalmanFilter*) video_KalmanFilter_new2(int dynamParams, int measureParams, int controlParams, int type) +CVAPI(ExceptionStatus) video_KalmanFilter_new2(int dynamParams, int measureParams, int controlParams, int type, cv::KalmanFilter **returnValue) { - return new cv::KalmanFilter(dynamParams, measureParams, controlParams, type); + BEGIN_WRAP + *returnValue = new cv::KalmanFilter(dynamParams, measureParams, controlParams, type); + END_WRAP } -CVAPI(void) video_KalmanFilter_init(cv::KalmanFilter *obj, int dynamParams, int measureParams, int controlParams, int type) + +CVAPI(ExceptionStatus) video_KalmanFilter_init(cv::KalmanFilter *obj, int dynamParams, int measureParams, int controlParams, int type) { + BEGIN_WRAP obj->init(dynamParams, measureParams, controlParams, type); + END_WRAP } -CVAPI(void) video_KalmanFilter_delete(cv::KalmanFilter *obj) + +CVAPI(ExceptionStatus) video_KalmanFilter_delete(cv::KalmanFilter *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_predict(cv::KalmanFilter *obj, cv::Mat *control) +CVAPI(ExceptionStatus) video_KalmanFilter_predict(cv::KalmanFilter *obj, cv::Mat *control, cv::Mat **returnValue) { - cv::Mat result = obj->predict(entity(control)); - return new cv::Mat(result); + BEGIN_WRAP + const auto result = obj->predict(entity(control)); + *returnValue = new cv::Mat(result); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_correct(cv::KalmanFilter *obj, cv::Mat *measurement) +CVAPI(ExceptionStatus) video_KalmanFilter_correct(cv::KalmanFilter *obj, cv::Mat *measurement, cv::Mat **returnValue) { - cv::Mat result = obj->correct(*measurement); - return new cv::Mat(result); + BEGIN_WRAP + const auto result = obj->correct(*measurement); + *returnValue = new cv::Mat(result); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_statePre(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_statePre(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->statePre); + BEGIN_WRAP + *returnValue = &(obj->statePre); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_statePost(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_statePost(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->statePost); + BEGIN_WRAP + *returnValue = &(obj->statePost); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_transitionMatrix(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_transitionMatrix(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->transitionMatrix); + BEGIN_WRAP + *returnValue = &(obj->transitionMatrix); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_controlMatrix(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_controlMatrix(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->controlMatrix); + BEGIN_WRAP + *returnValue = &(obj->controlMatrix); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_measurementMatrix(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_measurementMatrix(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->measurementMatrix); + BEGIN_WRAP + *returnValue = &(obj->measurementMatrix); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_processNoiseCov(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_processNoiseCov(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->processNoiseCov); + BEGIN_WRAP + *returnValue = &(obj->processNoiseCov); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_measurementNoiseCov(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_measurementNoiseCov(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->measurementNoiseCov); + BEGIN_WRAP + *returnValue = &(obj->measurementNoiseCov); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_errorCovPre(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_errorCovPre(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->errorCovPre); + BEGIN_WRAP + *returnValue = &(obj->errorCovPre); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_gain(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_gain(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->gain); + BEGIN_WRAP + *returnValue = &(obj->gain); + END_WRAP } -CVAPI(cv::Mat*) video_KalmanFilter_errorCovPost(cv::KalmanFilter *obj) +CVAPI(ExceptionStatus) video_KalmanFilter_errorCovPost(cv::KalmanFilter *obj, cv::Mat **returnValue) { - return new cv::Mat(obj->errorCovPost); + BEGIN_WRAP + *returnValue = &(obj->errorCovPost); + END_WRAP } + #pragma endregion -CVAPI(int) video_buildOpticalFlowPyramid1( - cv::_InputArray *img, cv::_OutputArray *pyramid, - MyCvSize winSize, int maxLevel, int withDerivatives, - int pyrBorder, int derivBorder, int tryReuseInputImage) +#pragma region Tracker + +CVAPI(ExceptionStatus) video_Tracker_init(cv::Tracker* tracker, const cv::Mat* image, const MyCvRect boundingBox) { - return cv::buildOpticalFlowPyramid( - *img, *pyramid, cpp(winSize), maxLevel, withDerivatives != 0, - pyrBorder, derivBorder, tryReuseInputImage != 0); + BEGIN_WRAP + tracker->init(*image, cpp(boundingBox)); + END_WRAP } -CVAPI(int) video_buildOpticalFlowPyramid2( - cv::_InputArray *img, std::vector *pyramidVec, - MyCvSize winSize, int maxLevel, int withDerivatives, - int pyrBorder, int derivBorder, int tryReuseInputImage) + +CVAPI(ExceptionStatus) video_Tracker_update(cv::Tracker* tracker, const cv::Mat* image, MyCvRect* boundingBox, int* returnValue) { - return cv::buildOpticalFlowPyramid( - *img, *pyramidVec, cpp(winSize), maxLevel, withDerivatives != 0, - pyrBorder, derivBorder, tryReuseInputImage != 0); + BEGIN_WRAP + cv::Rect bb = cpp(*boundingBox); + const bool ret = tracker->update(*image, bb); + if (ret) + { + boundingBox->x = bb.x; + boundingBox->y = bb.y; + boundingBox->width = bb.width; + boundingBox->height = bb.height; + } + + *returnValue = ret ? 1 : 0; + END_WRAP } -CVAPI(void) video_calcOpticalFlowPyrLK_InputArray( - cv::_InputArray *prevImg, cv::_InputArray *nextImg, - cv::_InputArray *prevPts, cv::_InputOutputArray *nextPts, - cv::_OutputArray *status, cv::_OutputArray *err, - MyCvSize winSize, int maxLevel, MyCvTermCriteria criteria, - int flags, double minEigThreshold) +#pragma endregion + +#pragma region TrackerMIL + +CVAPI(ExceptionStatus) video_TrackerMIL_create1(cv::Ptr** returnValue) { - cv::calcOpticalFlowPyrLK(*prevImg, *nextImg, *prevPts, *nextPts, *status, *err, - cpp(winSize), maxLevel, cpp(criteria), flags, minEigThreshold); + BEGIN_WRAP + const auto p = cv::TrackerMIL::create(); + *returnValue = clone(p); + END_WRAP } -CVAPI(void) video_calcOpticalFlowPyrLK_vector( - cv::_InputArray *prevImg, cv::_InputArray *nextImg, - cv::Point2f *prevPts, int prevPtsSize, - std::vector *nextPts, - std::vector *status, - std::vector *err, - CvSize winSize, int maxLevel, CvTermCriteria criteria, - int flags, double minEigThreshold) +CVAPI(ExceptionStatus) video_TrackerMIL_create2(cv::TrackerMIL::Params* parameters, cv::Ptr** returnValue) { - std::vector prevPtsVec(prevPts, prevPts + prevPtsSize); - cv::calcOpticalFlowPyrLK(*prevImg, *nextImg, prevPtsVec, *nextPts, - *status, *err, winSize, maxLevel, criteria, flags, minEigThreshold); + BEGIN_WRAP + const auto p = cv::TrackerMIL::create(*parameters); + *returnValue = clone(p); + END_WRAP } -CVAPI(void) video_calcOpticalFlowFarneback( - cv::_InputArray *prev, cv::_InputArray *next, - cv::_InputOutputArray *flow, double pyrScale, int levels, int winSize, - int iterations, int polyN, double polySigma, int flags) +CVAPI(ExceptionStatus) video_Ptr_TrackerMIL_delete(cv::Ptr* ptr) { - cv::calcOpticalFlowFarneback(*prev, *next, *flow, pyrScale, levels, winSize, - iterations, polyN, polySigma, flags); + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) video_Ptr_TrackerMIL_get(cv::Ptr* ptr, cv::TrackerMIL** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + +#pragma region TrackerGOTURN + +CVAPI(ExceptionStatus) video_TrackerGOTURN_create1(cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto p = cv::TrackerGOTURN::create(); + *returnValue = clone(p); + END_WRAP +} +CVAPI(ExceptionStatus) video_TrackerGOTURN_create2(cv::TrackerGOTURN::Params* parameters, cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto p = cv::TrackerGOTURN::create(*parameters); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) video_Ptr_TrackerGOTURN_delete(cv::Ptr* ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP } -CVAPI(cv::Mat*) video_estimateRigidTransform( - cv::_InputArray *src, cv::_InputArray *dst, int fullAffine) +CVAPI(ExceptionStatus) video_Ptr_TrackerGOTURN_get(cv::Ptr* ptr, cv::TrackerGOTURN** returnValue) { - cv::Mat ret = cv::estimateRigidTransform(*src, *dst, fullAffine != 0); - return new cv::Mat(ret); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } +#pragma endregion + +// TODO #pragma region DenseOpticalFlow -CVAPI(void) video_DenseOpticalFlow_calc( +/*CVAPI(ExceptionStatus) video_DenseOpticalFlow_calc( cv::DenseOpticalFlow *obj, cv::_InputArray *i0, cv::_InputArray *i1, cv::_InputOutputArray *flow) { + BEGIN_WRAP obj->calc(*i0, *i1, *flow); + END_WRAP } -CVAPI(void) video_DenseOpticalFlow_collectGarbage(cv::DenseOpticalFlow *obj) + +CVAPI(ExceptionStatus) video_DenseOpticalFlow_collectGarbage(cv::DenseOpticalFlow *obj) { + BEGIN_WRAP obj->collectGarbage(); + END_WRAP } -CVAPI(cv::Ptr*) video_createOptFlow_DualTVL1() +CVAPI(ExceptionStatus) video_Ptr_DenseOpticalFlow_get(cv::Ptr *ptr, cv::DenseOpticalFlow **returnValue) { - return clone(cv::createOptFlow_DualTVL1()); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(cv::DenseOpticalFlow*) video_Ptr_DenseOpticalFlow_get(cv::Ptr *ptr) -{ - return ptr->get(); -} -CVAPI(void) video_Ptr_DenseOpticalFlow_delete(cv::Ptr *ptr) +CVAPI(ExceptionStatus) video_Ptr_DenseOpticalFlow_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } +*/ #pragma endregion - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/videoio.h b/src/OpenCvSharpExtern/videoio.h index eb60aafbc..05de8c2f8 100644 --- a/src/OpenCvSharpExtern/videoio.h +++ b/src/OpenCvSharpExtern/videoio.h @@ -1,144 +1,320 @@ -#ifndef _CPP_VIDEOIO_H_ -#define _CPP_VIDEOIO_H_ +#pragma once #include "include_opencv.h" +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + #pragma region VideoCapture -CVAPI(cv::VideoCapture*) videoio_VideoCapture_new1() +CVAPI(ExceptionStatus) videoio_VideoCapture_new1(cv::VideoCapture **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::VideoCapture; + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoCapture_new2(const char *filename, int apiPreference, cv::VideoCapture **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::VideoCapture(filename, apiPreference); + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoCapture_new3(int device, int apiPreference, cv::VideoCapture **returnValue) { - return new cv::VideoCapture; + BEGIN_WRAP + *returnValue = new cv::VideoCapture(device, apiPreference); + END_WRAP } -CVAPI(cv::VideoCapture*) videoio_VideoCapture_new2(const char *filename) + +CVAPI(ExceptionStatus) videoio_VideoCapture_new4(const char* filename, int apiPreference, int* params, int paramsLength, cv::VideoCapture** returnValue) { - return new cv::VideoCapture(filename); + BEGIN_WRAP + std::string filenameStr(filename); + std::vector paramsVec; + paramsVec.assign(params, params + paramsLength); + * returnValue = new cv::VideoCapture(filenameStr, apiPreference, paramsVec); + END_WRAP } -CVAPI(cv::VideoCapture*) videoio_VideoCapture_new3(int device) +CVAPI(ExceptionStatus) videoio_VideoCapture_new5(int device, int apiPreference, int* params, int paramsLength, cv::VideoCapture** returnValue) { - return new cv::VideoCapture(device); + BEGIN_WRAP + std::vector paramsVec; + paramsVec.assign(params, params + paramsLength); + * returnValue = new cv::VideoCapture(device, apiPreference, paramsVec); + END_WRAP } -CVAPI(void) videoio_VideoCapture_delete(cv::VideoCapture *obj) + +CVAPI(ExceptionStatus) videoio_VideoCapture_delete(cv::VideoCapture *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(int) videoio_VideoCapture_open1(cv::VideoCapture *obj, const char *filename) +CVAPI(ExceptionStatus) videoio_VideoCapture_open1(cv::VideoCapture *obj, const char *filename, int apiPreference, int *returnValue) { - return obj->open(filename) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->open(filename, apiPreference) ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoCapture_open2(cv::VideoCapture *obj, int device) +CVAPI(ExceptionStatus) videoio_VideoCapture_open2(cv::VideoCapture *obj, int device, int apiPreference, int *returnValue) { - return obj->open(device) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->open(device, apiPreference) ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoCapture_isOpened(cv::VideoCapture *obj) +CVAPI(ExceptionStatus) videoio_VideoCapture_isOpened(cv::VideoCapture *obj, int *returnValue) { - return obj->isOpened() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isOpened() ? 1 : 0; + END_WRAP } -CVAPI(void) videoio_VideoCapture_release(cv::VideoCapture *obj) +CVAPI(ExceptionStatus) videoio_VideoCapture_release(cv::VideoCapture *obj) { + BEGIN_WRAP obj->release(); + END_WRAP +} + +CVAPI(ExceptionStatus) videoio_VideoCapture_grab(cv::VideoCapture *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->grab() ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoCapture_grab(cv::VideoCapture *obj) +CVAPI(ExceptionStatus) videoio_VideoCapture_retrieve_OutputArray(cv::VideoCapture *obj, cv::_OutputArray *image, int flag, int *returnValue) { - return obj->grab() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->retrieve(*image, flag) ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoCapture_retrieve(cv::VideoCapture *obj, cv::_OutputArray *image, int flag) +CVAPI(ExceptionStatus) videoio_VideoCapture_retrieve_Mat(cv::VideoCapture *obj, cv::Mat *image, int flag, int *returnValue) { - return obj->retrieve(*image, flag) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->retrieve(*image, flag) ? 1 : 0; + END_WRAP } -CVAPI(void) videoio_VideoCapture_operatorRightShift_Mat(cv::VideoCapture *obj, cv::Mat *image) +CVAPI(ExceptionStatus) videoio_VideoCapture_operatorRightShift_Mat(cv::VideoCapture *obj, cv::Mat *image) { + BEGIN_WRAP (*obj) >> (*image); + END_WRAP } -CVAPI(void) videoio_VideoCapture_operatorRightShift_UMat(cv::VideoCapture *obj, cv::UMat *image) +/*CVAPI(ExceptionStatus) videoio_VideoCapture_operatorRightShift_UMat(cv::VideoCapture *obj, cv::UMat *image) { + BEGIN_WRAP (*obj) >> (*image); + END_WRAP +}*/ + +CVAPI(ExceptionStatus) videoio_VideoCapture_read_OutputArray(cv::VideoCapture *obj, cv::_OutputArray *image, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->read(*image) ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoCapture_read_Mat(cv::VideoCapture *obj, cv::Mat *image, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->read(*image) ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoCapture_read(cv::VideoCapture *obj, cv::_OutputArray *image) +CVAPI(ExceptionStatus) videoio_VideoCapture_set(cv::VideoCapture *obj, int propId, double value, int *returnValue) { - return obj->read(*image) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->set(propId, value) ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoCapture_set(cv::VideoCapture *obj, int propId, double value) +CVAPI(ExceptionStatus) videoio_VideoCapture_get(cv::VideoCapture *obj, int propId, double *returnValue) { - return obj->set(propId, value) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->get(propId); + END_WRAP } -CVAPI(double) videoio_VideoCapture_get(cv::VideoCapture *obj, int propId) +CVAPI(ExceptionStatus) videoio_VideoCapture_getBackendName(cv::VideoCapture *obj, std::string *returnValue) { - return obj->get(propId); + BEGIN_WRAP + returnValue->assign(obj->getBackendName()); + END_WRAP +} + +CVAPI(ExceptionStatus) videoio_VideoCapture_setExceptionMode(cv::VideoCapture *obj, int enable) +{ + BEGIN_WRAP + obj->setExceptionMode(enable != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) videoio_VideoCapture_getExceptionMode(cv::VideoCapture *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getExceptionMode() ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) videoio_VideoCapture_waitAny( + cv::VideoCapture** streams, const size_t streamsSize, + std::vector *readyIndex, const int64 timeoutNs, int *returnValue) +{ + BEGIN_WRAP + std::vector streamsVec(streamsSize); + for (size_t i = 0; i < streamsSize; i++) + streamsVec[i] = *streams[i]; + + *returnValue = cv::VideoCapture::waitAny(streamsVec, *readyIndex, timeoutNs) ? 1 : 0; + END_WRAP } #pragma endregion #pragma region VideoWriter -CVAPI(cv::VideoWriter*) videoio_VideoWriter_new1() +CVAPI(ExceptionStatus) videoio_VideoWriter_new1(cv::VideoWriter **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::VideoWriter; + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoWriter_new2( + const char *filename, + int fourcc, double fps, + MyCvSize frameSize, int isColor, + cv::VideoWriter **returnValue) +{ + BEGIN_WRAP + *returnValue = new cv::VideoWriter(filename, fourcc, fps, cpp(frameSize), isColor != 0); + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoWriter_new3( + const char *filename, int apiPreference, + int fourcc, double fps, + MyCvSize frameSize, int isColor, + cv::VideoWriter **returnValue) { - return new cv::VideoWriter; + BEGIN_WRAP + *returnValue = new cv::VideoWriter(filename, apiPreference, fourcc, fps, cpp(frameSize), isColor != 0); + END_WRAP } -CVAPI(cv::VideoWriter*) videoio_VideoWriter_new2(const char *filename, int fourcc, double fps, - MyCvSize frameSize, int isColor) +CVAPI(ExceptionStatus) videoio_VideoWriter_new4( + const char* filename, + int fourcc, double fps, + MyCvSize frameSize, int* params, int paramsLength, + cv::VideoWriter** returnValue) { - return new cv::VideoWriter(filename, fourcc, fps, cpp(frameSize), isColor != 0); + BEGIN_WRAP + std::vector paramsVec; + paramsVec.assign(params, params + paramsLength); + * returnValue = new cv::VideoWriter(filename, fourcc, fps, cpp(frameSize), paramsVec); + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoWriter_new5( + const char* filename, int apiPreference, + int fourcc, double fps, + MyCvSize frameSize, int* params, int paramsLength, + cv::VideoWriter** returnValue) +{ + BEGIN_WRAP + std::vector paramsVec; + paramsVec.assign(params, params + paramsLength); + * returnValue = new cv::VideoWriter(filename, apiPreference, fourcc, fps, cpp(frameSize), paramsVec); + END_WRAP } -CVAPI(void) videoio_VideoWriter_delete(cv::VideoWriter *obj) +CVAPI(ExceptionStatus) videoio_VideoWriter_delete(cv::VideoWriter *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(int) videoio_VideoWriter_open(cv::VideoWriter *obj, const char *filename, int fourcc, double fps, - MyCvSize frameSize, int isColor) +CVAPI(ExceptionStatus) videoio_VideoWriter_open1( + cv::VideoWriter *obj, const char *filename, + int fourcc, double fps, + MyCvSize frameSize, int isColor, + int *returnValue) { - return obj->open(filename, fourcc, fps, cpp(frameSize), isColor != 0) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->open(filename, fourcc, fps, cpp(frameSize), isColor != 0) ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) videoio_VideoWriter_open2( + cv::VideoWriter *obj, const char *filename, int apiPreference, + int fourcc, double fps, + MyCvSize frameSize, int isColor, + int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->open(filename, apiPreference, fourcc, fps, cpp(frameSize), isColor != 0) ? 1 : 0; + END_WRAP } -CVAPI(int) videoio_VideoWriter_isOpened(cv::VideoWriter *obj) +CVAPI(ExceptionStatus) videoio_VideoWriter_isOpened(cv::VideoWriter *obj, int *returnValue) { - return obj->isOpened() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->isOpened() ? 1 : 0; + END_WRAP } -CVAPI(void) videoio_VideoWriter_release(cv::VideoWriter *obj) +CVAPI(ExceptionStatus) videoio_VideoWriter_release(cv::VideoWriter *obj) { + BEGIN_WRAP obj->release(); + END_WRAP } -CVAPI(void) videoio_VideoWriter_OperatorLeftShift(cv::VideoWriter *obj, cv::Mat *image) +/*CVAPI(ExceptionStatus) videoio_VideoWriter_OperatorLeftShift(cv::VideoWriter *obj, cv::Mat *image) { + BEGIN_WRAP (*obj) << (*image); -} + END_WRAP +}*/ -CVAPI(void) videoio_VideoWriter_write(cv::VideoWriter *obj, cv::Mat *image) +CVAPI(ExceptionStatus) videoio_VideoWriter_write(cv::VideoWriter *obj, cv::_InputArray *image) { + BEGIN_WRAP obj->write(*image); + END_WRAP } -CVAPI(int) videoio_VideoWriter_set(cv::VideoWriter *obj, int propId, double value) +CVAPI(ExceptionStatus) videoio_VideoWriter_set(cv::VideoWriter *obj, int propId, double value, int *returnValue) { - return obj->set(propId, value) ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->set(propId, value) ? 1 : 0; + END_WRAP } -CVAPI(double) videoio_VideoWriter_get(cv::VideoWriter *obj, int propId) +CVAPI(ExceptionStatus) videoio_VideoWriter_get(cv::VideoWriter *obj, int propId, double *returnValue) { - return obj->get(propId); + BEGIN_WRAP + *returnValue = obj->get(propId); + END_WRAP } -CVAPI(int) videoio_VideoWriter_fourcc(char c1, char c2, char c3, char c4) +CVAPI(ExceptionStatus) videoio_VideoWriter_fourcc(char c1, char c2, char c3, char c4, int *returnValue) { - return cv::VideoWriter::fourcc(c1, c2, c3, c4); + BEGIN_WRAP + *returnValue = cv::VideoWriter::fourcc(c1, c2, c3, c4); + END_WRAP } -#pragma endregion +CVAPI(ExceptionStatus) videoio_VideoWriter_getBackendName(cv::VideoWriter *obj, std::string *returnValue) +{ + BEGIN_WRAP + returnValue->assign(obj->getBackendName()); + END_WRAP +} -#endif \ No newline at end of file +#pragma endregion diff --git a/src/OpenCvSharpExtern/wechat_qrcode.cpp b/src/OpenCvSharpExtern/wechat_qrcode.cpp new file mode 100644 index 000000000..e87e1164e --- /dev/null +++ b/src/OpenCvSharpExtern/wechat_qrcode.cpp @@ -0,0 +1 @@ +#include "wechat_qrcode.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/wechat_qrcode.h b/src/OpenCvSharpExtern/wechat_qrcode.h new file mode 100644 index 000000000..f6474e4d2 --- /dev/null +++ b/src/OpenCvSharpExtern/wechat_qrcode.h @@ -0,0 +1,34 @@ +#pragma once +#include "include_opencv.h" +CVAPI(ExceptionStatus) wechat_qrcode_create1(const char *detector_prototxt_path, + const char *detector_caffe_model_path , + const char *super_resolution_prototxt_path , + const char *super_resolution_caffe_model_path, cv::Ptr **returnValue) +{ + BEGIN_WRAP + cv::Ptr detector; + detector = cv::makePtr(detector_prototxt_path, detector_caffe_model_path, + super_resolution_prototxt_path, super_resolution_caffe_model_path); + *returnValue = clone(detector); + END_WRAP +} +CVAPI(ExceptionStatus) wechat_qrcode_Ptr_delete(cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) wechat_qrcode_Ptr_WeChatQRCode_get(cv::Ptr* obj, cv::wechat_qrcode::WeChatQRCode **returnValue) +{ + BEGIN_WRAP + * returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) wechat_qrcode_WeChatQRCode_detectAndDecode(cv::wechat_qrcode::WeChatQRCode* obj, cv::_InputArray* inputImage, std::vector* points, std::vector* texts) +{ + BEGIN_WRAP + * texts = obj->detectAndDecode(*inputImage, *points); + END_WRAP +} \ No newline at end of file diff --git a/src/OpenCvSharpExtern/xfeatures2d.h b/src/OpenCvSharpExtern/xfeatures2d.h index ef5dbb8ab..c59439339 100644 --- a/src/OpenCvSharpExtern/xfeatures2d.h +++ b/src/OpenCvSharpExtern/xfeatures2d.h @@ -1,178 +1,278 @@ -#ifndef _CPP_XFEATURES2D_H_ -#define _CPP_XFEATURES2D_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + #include "include_opencv.h" -using namespace cv::xfeatures2d; #pragma region BriefDescriptorExtractor -CVAPI(cv::Ptr*) xfeatures2d_BriefDescriptorExtractor_create(int bytes) +CVAPI(ExceptionStatus) xfeatures2d_BriefDescriptorExtractor_create( + int bytes, cv::Ptr **returnValue) { - cv::Ptr ptr = BriefDescriptorExtractor::create(bytes); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::xfeatures2d::BriefDescriptorExtractor::create(bytes); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) xfeatures2d_Ptr_BriefDescriptorExtractor_delete(cv::Ptr *obj) + +CVAPI(ExceptionStatus) xfeatures2d_Ptr_BriefDescriptorExtractor_delete( + cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(void) xfeatures2d_BriefDescriptorExtractor_read( - cv::Ptr *obj, cv::FileNode *fn) +CVAPI(ExceptionStatus) xfeatures2d_BriefDescriptorExtractor_read( + cv::Ptr *obj, cv::FileNode *fn) { + BEGIN_WRAP obj->get()->read(*fn); + END_WRAP } -CVAPI(void) xfeatures2d_BriefDescriptorExtractor_write( - cv::Ptr *obj, cv::FileStorage *fs) + +CVAPI(ExceptionStatus) xfeatures2d_BriefDescriptorExtractor_write( + cv::Ptr *obj, cv::FileStorage *fs) { + BEGIN_WRAP obj->get()->write(*fs); + END_WRAP } -CVAPI(int) xfeatures2d_BriefDescriptorExtractor_descriptorSize(cv::Ptr *obj) +CVAPI(ExceptionStatus) xfeatures2d_BriefDescriptorExtractor_descriptorSize( + cv::Ptr *obj, int *returnValue) { - return obj->get()->descriptorSize(); + BEGIN_WRAP + *returnValue = obj->get()->descriptorSize(); + END_WRAP } -CVAPI(int) xfeatures2d_BriefDescriptorExtractor_descriptorType(cv::Ptr *obj) + +CVAPI(ExceptionStatus) xfeatures2d_BriefDescriptorExtractor_descriptorType( + cv::Ptr *obj, int *returnValue) { - return obj->get()->descriptorType(); + BEGIN_WRAP + *returnValue = obj->get()->descriptorType(); + END_WRAP } -CVAPI(BriefDescriptorExtractor*) xfeatures2d_Ptr_BriefDescriptorExtractor_get( - cv::Ptr* ptr) +CVAPI(ExceptionStatus) xfeatures2d_Ptr_BriefDescriptorExtractor_get( + cv::Ptr* ptr, cv::xfeatures2d::BriefDescriptorExtractor **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } #pragma endregion #pragma region FREAK -CVAPI(cv::Ptr*) xfeatures2d_FREAK_create(int orientationNormalized, - int scaleNormalized, float patternScale, int nOctaves, - int *selectedPairs, int selectedPairsLength) +CVAPI(ExceptionStatus) xfeatures2d_FREAK_create( + int orientationNormalized, int scaleNormalized, float patternScale, int nOctaves, + int *selectedPairs, int selectedPairsLength, + cv::Ptr **returnValue) { + BEGIN_WRAP std::vector selectedPairsVec; - if (selectedPairs != NULL) + if (selectedPairs != nullptr) selectedPairsVec = std::vector(selectedPairs, selectedPairs + selectedPairsLength); - cv::Ptr ptr = FREAK::create(orientationNormalized != 0, scaleNormalized != 0, - patternScale, nOctaves, selectedPairsVec); - return new cv::Ptr(ptr); + const auto ptr = cv::xfeatures2d::FREAK::create( + orientationNormalized != 0, scaleNormalized != 0, patternScale, nOctaves, selectedPairsVec); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) xfeatures2d_Ptr_FREAK_delete(cv::Ptr *ptr) +CVAPI(ExceptionStatus) xfeatures2d_Ptr_FREAK_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } -CVAPI(FREAK*) xfeatures2d_Ptr_FREAK_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) xfeatures2d_Ptr_FREAK_get(cv::Ptr *ptr, cv::xfeatures2d::FREAK **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } #pragma endregion #pragma region StarDetector -CVAPI(cv::Ptr*) xfeatures2d_StarDetector_create(int maxSize, int responseThreshold, - int lineThresholdProjected, int lineThresholdBinarized, int suppressNonmaxSize) +CVAPI(ExceptionStatus) xfeatures2d_StarDetector_create( + int maxSize, int responseThreshold, + int lineThresholdProjected, int lineThresholdBinarized, int suppressNonmaxSize, + cv::Ptr **returnValue) { - cv::Ptr ptr = StarDetector::create( + BEGIN_WRAP + const auto ptr = cv::xfeatures2d::StarDetector::create( maxSize, responseThreshold, lineThresholdProjected, lineThresholdBinarized, suppressNonmaxSize); - return new cv::Ptr(ptr); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) xfeatures2d_Ptr_StarDetector_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) xfeatures2d_Ptr_StarDetector_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } -CVAPI(StarDetector*) xfeatures2d_Ptr_StarDetector_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) xfeatures2d_Ptr_StarDetector_get(cv::Ptr *ptr, cv::xfeatures2d::StarDetector **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } #pragma endregion -#pragma region SIFT +#pragma region LUCID -CVAPI(cv::Ptr*) xfeatures2d_SIFT_create( - int nfeatures, int nOctaveLayers, - double contrastThreshold, double edgeThreshold, double sigma) +CVAPI(ExceptionStatus) xfeatures2d_LUCID_create(const int lucid_kernel, const int blur_kernel, cv::Ptr **returnValue) { - cv::Ptr ptr = SIFT::create( - nfeatures, nOctaveLayers, contrastThreshold, edgeThreshold, sigma); - return new cv::Ptr(ptr); + BEGIN_WRAP + const auto ptr = cv::xfeatures2d::LUCID::create(lucid_kernel, blur_kernel); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) xfeatures2d_Ptr_SIFT_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) xfeatures2d_Ptr_LUCID_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } -CVAPI(SIFT*) xfeatures2d_Ptr_SIFT_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) xfeatures2d_Ptr_LUCID_get(cv::Ptr *ptr, cv::xfeatures2d::LUCID **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } #pragma endregion +#pragma region LATCH + +CVAPI(ExceptionStatus) xfeatures2d_LATCH_create( + int bytes, int rotationInvariance, int half_ssd_size, double sigma, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::xfeatures2d::LATCH::create(bytes, rotationInvariance != 0, half_ssd_size, sigma); + *returnValue = clone(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) xfeatures2d_Ptr_LATCH_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) xfeatures2d_Ptr_LATCH_get(cv::Ptr *ptr, cv::xfeatures2d::LATCH **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion + + #pragma region SURF -CVAPI(cv::Ptr*) xfeatures2d_SURF_create(double hessianThreshold, int nOctaves, - int nOctaveLayers, int extended, int upright) +CVAPI(ExceptionStatus) xfeatures2d_SURF_create( + double hessianThreshold, int nOctaves, + int nOctaveLayers, int extended, int upright, + cv::Ptr **returnValue) { - cv::Ptr ptr = SURF::create( + BEGIN_WRAP + const auto ptr = cv::xfeatures2d::SURF::create( hessianThreshold, nOctaves, nOctaveLayers, extended != 0, upright != 0); - return new cv::Ptr(ptr); + *returnValue = clone(ptr); + END_WRAP } -CVAPI(void) xfeatures2d_Ptr_SURF_delete(cv::Ptr *ptr) + +CVAPI(ExceptionStatus) xfeatures2d_Ptr_SURF_delete(cv::Ptr *ptr) { + BEGIN_WRAP delete ptr; + END_WRAP } -CVAPI(SURF*) xfeatures2d_Ptr_SURF_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) xfeatures2d_Ptr_SURF_get(cv::Ptr *ptr, cv::xfeatures2d::SURF **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(double) xfeatures2d_SURF_getHessianThreshold(SURF *obj) +CVAPI(ExceptionStatus) xfeatures2d_SURF_getHessianThreshold(cv::xfeatures2d::SURF *obj, double *returnValue) { - return obj->getHessianThreshold(); + BEGIN_WRAP + *returnValue = obj->getHessianThreshold(); + END_WRAP } -CVAPI(int) xfeatures2d_SURF_getNOctaves(SURF *obj) +CVAPI(ExceptionStatus) xfeatures2d_SURF_getNOctaves(cv::xfeatures2d::SURF *obj, int *returnValue) { - return obj->getNOctaves(); + BEGIN_WRAP + *returnValue = obj->getNOctaves(); + END_WRAP } -CVAPI(int) xfeatures2d_SURF_getNOctaveLayers(SURF *obj) +CVAPI(ExceptionStatus) xfeatures2d_SURF_getNOctaveLayers(cv::xfeatures2d::SURF *obj, int *returnValue) { - return obj->getNOctaveLayers(); + BEGIN_WRAP + *returnValue = obj->getNOctaveLayers(); + END_WRAP } -CVAPI(int) xfeatures2d_SURF_getExtended(SURF *obj) +CVAPI(ExceptionStatus) xfeatures2d_SURF_getExtended(cv::xfeatures2d::SURF *obj, int *returnValue) { - return obj->getExtended() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getExtended() ? 1 : 0; + END_WRAP } -CVAPI(int) xfeatures2d_SURF_getUpright(SURF *obj) +CVAPI(ExceptionStatus) xfeatures2d_SURF_getUpright(cv::xfeatures2d::SURF *obj, int *returnValue) { - return obj->getUpright() ? 1 : 0; + BEGIN_WRAP + *returnValue = obj->getUpright() ? 1 : 0; + END_WRAP } -CVAPI(void) xfeatures2d_SURF_setHessianThreshold(SURF *obj, double value) +CVAPI(ExceptionStatus) xfeatures2d_SURF_setHessianThreshold(cv::xfeatures2d::SURF *obj, double value) { + BEGIN_WRAP obj->setHessianThreshold(value); + END_WRAP } -CVAPI(void) xfeatures2d_SURF_setNOctaves(SURF *obj, int value) +CVAPI(ExceptionStatus) xfeatures2d_SURF_setNOctaves(cv::xfeatures2d::SURF *obj, int value) { + BEGIN_WRAP obj->setNOctaves(value); + END_WRAP } -CVAPI(void) xfeatures2d_SURF_setNOctaveLayers(SURF *obj, int value) +CVAPI(ExceptionStatus) xfeatures2d_SURF_setNOctaveLayers(cv::xfeatures2d::SURF *obj, int value) { + BEGIN_WRAP obj->setNOctaveLayers(value); + END_WRAP } -CVAPI(void) xfeatures2d_SURF_setExtended(SURF *obj, int value) +CVAPI(ExceptionStatus) xfeatures2d_SURF_setExtended(cv::xfeatures2d::SURF *obj, int value) { + BEGIN_WRAP obj->setExtended(value != 0); + END_WRAP } -CVAPI(void) xfeatures2d_SURF_setUpright(SURF *obj, int value) +CVAPI(ExceptionStatus) xfeatures2d_SURF_setUpright(cv::xfeatures2d::SURF *obj, int value) { + BEGIN_WRAP obj->setUpright(value != 0); + END_WRAP } #pragma endregion - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/ximgproc.cpp b/src/OpenCvSharpExtern/ximgproc.cpp index 99131a4b8..a50104c9d 100644 --- a/src/OpenCvSharpExtern/ximgproc.cpp +++ b/src/OpenCvSharpExtern/ximgproc.cpp @@ -1,4 +1,9 @@ +// ReSharper disable CppUnusedIncludeDirective #include "ximgproc.h" -#include "ximgproc_FastHoughTransform.h" +#include "ximgproc_EdgeBoxes.h" +#include "ximgproc_EdgeFilter.h" #include "ximgproc_FastLineDetector.h" -#include "ximgproc_Paillou.h" \ No newline at end of file +#include "ximgproc_RidgeDetectionFilter.h" +#include "ximgproc_Segmentation.h" +#include "ximgproc_StructuredEdgeDetection.h" +#include "ximgproc_SuperPixel.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/ximgproc.h b/src/OpenCvSharpExtern/ximgproc.h index d9dad11c2..46c0af3f1 100644 --- a/src/OpenCvSharpExtern/ximgproc.h +++ b/src/OpenCvSharpExtern/ximgproc.h @@ -1,32 +1,257 @@ -#ifndef _CPP_XIMGPROC_H_ -#define _CPP_XIMGPROC_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) ximgproc_niBlackThreshold(cv::_InputArray *src, cv::_OutputArray *dst, +CVAPI(ExceptionStatus) ximgproc_niBlackThreshold(cv::_InputArray *src, cv::_OutputArray *dst, double maxValue, int type, - int blockSize, double delta) + int blockSize, double k, int binarizationMethod, double r) { - cv::ximgproc::niBlackThreshold(*src, *dst, maxValue, type, blockSize, delta); + BEGIN_WRAP + cv::ximgproc::niBlackThreshold(*src, *dst, maxValue, type, blockSize, k, binarizationMethod, r); + END_WRAP } -CVAPI(void) ximgproc_thinning(cv::_InputArray *src, cv::_OutputArray *dst, int thinningType) +CVAPI(ExceptionStatus) ximgproc_thinning(cv::_InputArray *src, cv::_OutputArray *dst, int thinningType) { + BEGIN_WRAP cv::ximgproc::thinning(*src, *dst, thinningType); + END_WRAP } -CVAPI(void) ximgproc_weightedMedianFilter( - cv::_InputArray *joint, cv::_InputArray *src, cv::_OutputArray *dst, - int r, double sigma, int weightType, cv::Mat *mask) +CVAPI(ExceptionStatus) ximgproc_anisotropicDiffusion(cv::_InputArray *src, cv::_OutputArray *dst, float alpha, float K, int niters) { - cv::ximgproc::weightedMedianFilter(*joint, *src, *dst, r, sigma, - static_cast(weightType), entity(mask)); + BEGIN_WRAP + cv::ximgproc::anisotropicDiffusion(*src, *dst, alpha, K, niters); + END_WRAP +} + +// brightedges.hpp + +CVAPI(ExceptionStatus) ximgproc_BrightEdges(cv::Mat *original, cv::Mat *edgeview, int contrast, int shortrange, int longrange) +{ + BEGIN_WRAP + cv::ximgproc::BrightEdges(*original, *edgeview, contrast, shortrange, longrange); + END_WRAP +} + +// color_match.hpp + +CVAPI(ExceptionStatus) ximgproc_createQuaternionImage(cv::_InputArray *img, cv::_OutputArray *qimg) +{ + BEGIN_WRAP + cv::ximgproc::createQuaternionImage(*img, *qimg); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_qconj(cv::_InputArray *qimg, cv::_OutputArray *qcimg) +{ + BEGIN_WRAP + cv::ximgproc::qconj(*qimg, *qcimg); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_qunitary(cv::_InputArray *qimg, cv::_OutputArray *qnimg) +{ + BEGIN_WRAP + cv::ximgproc::qunitary(*qimg, *qnimg); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_qmultiply(cv::_InputArray *src1, cv::_InputArray *src2, cv::_OutputArray *dst) +{ + BEGIN_WRAP + cv::ximgproc::qmultiply(*src1, *src2, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_qdft(cv::_InputArray *img, cv::_OutputArray *qimg, int flags, int sideLeft) +{ + BEGIN_WRAP + cv::ximgproc::qdft(*img, *qimg, flags, sideLeft != 0); + END_WRAP } -CVAPI(void) ximgproc_covarianceEstimation( +CVAPI(ExceptionStatus) ximgproc_colorMatchTemplate(cv::_InputArray *img, cv::_InputArray *templ, cv::_OutputArray *result) +{ + BEGIN_WRAP + cv::ximgproc::colorMatchTemplate(*img, *templ, *result); + END_WRAP +} + +// deriche_filter.hpp + +CVAPI(ExceptionStatus) ximgproc_GradientDericheY(cv::_InputArray *op, cv::_OutputArray *dst, double alpha, double omega) +{ + BEGIN_WRAP + cv::ximgproc::GradientDericheY(*op, *dst, alpha, omega); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_GradientDericheX(cv::_InputArray *op, cv::_OutputArray *dst, double alpha, double omega) +{ + BEGIN_WRAP + cv::ximgproc::GradientDericheX(*op, *dst, alpha, omega); + END_WRAP +} + +// edgepreserving_filter.hpp + +CVAPI(ExceptionStatus) ximgproc_edgePreservingFilter(cv::_InputArray *src, cv::_OutputArray *dst, int d, double threshold) +{ + BEGIN_WRAP + cv::ximgproc::edgePreservingFilter(*src, *dst, d, threshold); + END_WRAP +} + +// estimated_covariance.hpp + +CVAPI(ExceptionStatus) ximgproc_covarianceEstimation( cv::_InputArray *src, cv::_OutputArray *dst, int windowRows, int windowCols) { + BEGIN_WRAP cv::ximgproc::covarianceEstimation(*src, *dst, windowRows, windowCols); + END_WRAP +} + +// fast_hough_transform.hpp + +CVAPI(ExceptionStatus) ximgproc_FastHoughTransform( + cv::_InputArray* src, cv::_OutputArray* dst, + int dstMatDepth, int angleRange, int op, int makeSkew) +{ + BEGIN_WRAP + cv::ximgproc::FastHoughTransform(*src, *dst, dstMatDepth, angleRange, op, makeSkew); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_HoughPoint2Line(MyCvPoint houghPoint, cv::_InputArray* srcImgInfo, + int angleRange, int makeSkew, int rules, CvVec4i* returnValue) +{ + BEGIN_WRAP + *returnValue = c(cv::ximgproc::HoughPoint2Line(cpp(houghPoint), *srcImgInfo, angleRange, makeSkew, rules)); + END_WRAP } -#endif \ No newline at end of file +// paillou_filter.hpp + +CVAPI(ExceptionStatus) ximgproc_GradientPaillouY(cv::_InputArray* op, cv::_OutputArray* dst, double alpha, double omega) +{ + BEGIN_WRAP + cv::ximgproc::GradientPaillouY(*op, *dst, alpha, omega); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_GradientPaillouX(cv::_InputArray* op, cv::_OutputArray* dst, double alpha, double omega) +{ + BEGIN_WRAP + cv::ximgproc::GradientPaillouX(*op, *dst, alpha, omega); + END_WRAP +} + +// peilin.hpp + +CVAPI(ExceptionStatus) ximgproc_PeiLinNormalization_Mat23d(cv::_InputArray *I, double *returnValue) +{ + BEGIN_WRAP + auto ret = cv::ximgproc::PeiLinNormalization(*I); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < 3; ++c) + { + returnValue[r * 3 + c] = ret(r, c); + } + } + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_PeiLinNormalization_OutputArray(cv::_InputArray *I, cv::_OutputArray *T) +{ + BEGIN_WRAP + cv::ximgproc::PeiLinNormalization(*I, *T); + END_WRAP +} + +// run_length_morphology.hpp + +CVAPI(ExceptionStatus) ximgproc_rl_threshold(cv::_InputArray *src, cv::_OutputArray *rlDest, double thresh, int type) +{ + BEGIN_WRAP + cv::ximgproc::rl::threshold(*src, *rlDest, thresh, type); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_dilate( + cv::_InputArray *rlSrc, cv::_OutputArray *rlDest, cv::_InputArray *rlKernel, MyCvPoint anchor) +{ + BEGIN_WRAP + cv::ximgproc::rl::dilate(*rlSrc, *rlDest, *rlKernel, cpp(anchor)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_erode( + cv::_InputArray *rlSrc, cv::_OutputArray *rlDest, cv::_InputArray *rlKernel, + int bBoundaryOn, MyCvPoint anchor) +{ + BEGIN_WRAP + cv::ximgproc::rl::erode(*rlSrc, *rlDest, *rlKernel, bBoundaryOn != 0, cpp(anchor)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_getStructuringElement(int shape, MyCvSize ksize, cv::Mat *outValue) +{ + BEGIN_WRAP + auto result = cv::ximgproc::rl::getStructuringElement(shape, cpp(ksize)); + result.copyTo(*outValue); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_paint(cv::_InputOutputArray *image, cv::_InputArray *rlSrc, MyCvScalar value) +{ + BEGIN_WRAP + cv::ximgproc::rl::paint(*image, *rlSrc, cpp(value)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_isRLMorphologyPossible(cv::_InputArray *rlStructuringElement, int *outValue) +{ + BEGIN_WRAP + *outValue = cv::ximgproc::rl::isRLMorphologyPossible(*rlStructuringElement) ? 1 : 0; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_createRLEImage(MyCvPoint3D32i *runs, size_t runsLength, cv::_OutputArray *res, MyCvSize size) +{ + BEGIN_WRAP + std::vector runsVec(runsLength); + for (size_t i = 0; i < runsLength; i++) + { + runsVec[i] = cpp(runs[i]); + } + cv::ximgproc::rl::createRLEImage(runsVec, *res, cpp(size)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rl_morphologyEx( + cv::_InputArray *rlSrc, cv::_OutputArray *rlDest, int op, cv::_InputArray *rlKernel, + int bBoundaryOnForErosion, MyCvPoint anchor) +{ + BEGIN_WRAP + cv::ximgproc::rl::morphologyEx(*rlSrc, *rlDest, op, *rlKernel, bBoundaryOnForErosion != 0, cpp(anchor)); + END_WRAP +} + +// weighted_median_filter.hpp + +CVAPI(ExceptionStatus) ximgproc_weightedMedianFilter( + cv::_InputArray* joint, cv::_InputArray* src, cv::_OutputArray* dst, + int r, double sigma, int weightType, cv::Mat* mask) +{ + BEGIN_WRAP + cv::ximgproc::weightedMedianFilter(*joint, *src, *dst, r, sigma, + static_cast(weightType), entity(mask)); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ximgproc_EdgeBoxes.h b/src/OpenCvSharpExtern/ximgproc_EdgeBoxes.h new file mode 100644 index 000000000..02993ae4f --- /dev/null +++ b/src/OpenCvSharpExtern/ximgproc_EdgeBoxes.h @@ -0,0 +1,68 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + + +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getBoundingBoxes( + cv::ximgproc::EdgeBoxes *obj, cv::_InputArray *edge_map, + cv::_InputArray *orientation_map, std::vector *boxes) +{ + BEGIN_WRAP + obj->getBoundingBoxes(*edge_map, *orientation_map, *boxes); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getAlpha(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getAlpha(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setAlpha(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setAlpha(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getBeta(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getBeta(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setBeta(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setBeta(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getEta(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getEta(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setEta(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setEta(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getMinScore(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getMinScore(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setMinScore(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setMinScore(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getMaxBoxes(cv::ximgproc::EdgeBoxes *obj, int *returnValue) { BEGIN_WRAP *returnValue = obj->getMaxBoxes(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setMaxBoxes(cv::ximgproc::EdgeBoxes *obj, int value) { BEGIN_WRAP obj->setMaxBoxes(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getEdgeMinMag(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getEdgeMinMag(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setEdgeMinMag(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setEdgeMinMag(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getEdgeMergeThr(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getEdgeMergeThr(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setEdgeMergeThr(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setEdgeMergeThr(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getClusterMinMag(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getClusterMinMag(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setClusterMinMag(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setClusterMinMag(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getMaxAspectRatio(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getMaxAspectRatio(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setMaxAspectRatio(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setMaxAspectRatio(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getMinBoxArea(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getMinBoxArea(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setMinBoxArea(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setMinBoxArea(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getGamma(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getGamma(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setGamma(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setGamma(value); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_getKappa(cv::ximgproc::EdgeBoxes *obj, float *returnValue) { BEGIN_WRAP *returnValue = obj->getKappa(); END_WRAP } +CVAPI(ExceptionStatus) ximgproc_EdgeBoxes_setKappa(cv::ximgproc::EdgeBoxes *obj, float value) { BEGIN_WRAP obj->setKappa(value); END_WRAP } + + +CVAPI(ExceptionStatus) ximgproc_createEdgeBoxes( + float alpha, float beta, float eta, float minScore, int maxBoxes, float edgeMinMag, float edgeMergeThr, + float clusterMinMag, float maxAspectRatio, float minBoxArea, float gamma, float kappa, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::createEdgeBoxes(alpha, beta, eta, minScore, maxBoxes, edgeMinMag, edgeMergeThr, + clusterMinMag, maxAspectRatio, minBoxArea, gamma, kappa)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_EdgeBoxes_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_EdgeBoxes_get(cv::Ptr *ptr, cv::ximgproc::EdgeBoxes **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ximgproc_EdgeFilter.h b/src/OpenCvSharpExtern/ximgproc_EdgeFilter.h new file mode 100644 index 000000000..106eb5637 --- /dev/null +++ b/src/OpenCvSharpExtern/ximgproc_EdgeFilter.h @@ -0,0 +1,353 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +// DTFilter + +CVAPI(ExceptionStatus) ximgproc_Ptr_DTFilter_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_DTFilter_get( + cv::Ptr* ptr, cv::ximgproc::DTFilter** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_DTFilter_filter( + cv::ximgproc::DTFilter* obj, + cv::_InputArray *src, cv::_OutputArray *dst, int dDepth) +{ + BEGIN_WRAP + obj->filter(*src, *dst, dDepth); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createDTFilter( + cv::_InputArray *guide, double sigmaSpatial, double sigmaColor, int mode, int numIters, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createDTFilter(*guide, sigmaSpatial, sigmaColor, mode, numIters); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_dtFilter( + cv::_InputArray *guide, cv::_InputArray *src, cv::_OutputArray *dst, double sigmaSpatial, double sigmaColor, int mode, int numIters) +{ + BEGIN_WRAP + cv::ximgproc::dtFilter(*guide, *src, *dst, sigmaSpatial, sigmaColor, mode, numIters); + END_WRAP +} + +////////////////////////////////////////////////////////////////////////// +// GuidedFilter + +CVAPI(ExceptionStatus) ximgproc_Ptr_GuidedFilter_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_GuidedFilter_get( + cv::Ptr* ptr, cv::ximgproc::GuidedFilter** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_GuidedFilter_filter( + cv::ximgproc::GuidedFilter* obj, + cv::_InputArray* src, cv::_OutputArray* dst, int dDepth) +{ + BEGIN_WRAP + obj->filter(*src, *dst, dDepth); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createGuidedFilter( + cv::_InputArray* guide, int radius, double eps, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createGuidedFilter(*guide, radius, eps); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_guidedFilter( + cv::_InputArray *guide, cv::_InputArray *src, cv::_OutputArray *dst, int radius, double eps, int dDepth) +{ + BEGIN_WRAP + cv::ximgproc::guidedFilter(*guide, *src, *dst, radius, eps, dDepth); + END_WRAP +} + +////////////////////////////////////////////////////////////////////////// +// AdaptiveManifoldFilter + +CVAPI(ExceptionStatus) ximgproc_Ptr_AdaptiveManifoldFilter_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_AdaptiveManifoldFilter_get( + cv::Ptr* ptr, cv::ximgproc::AdaptiveManifoldFilter** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_filter( + cv::ximgproc::AdaptiveManifoldFilter* obj, + cv::_InputArray* src, cv::_OutputArray* dst, cv::_InputArray *joint) +{ + BEGIN_WRAP + obj->filter(*src, *dst, entity(joint)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_collectGarbage( + cv::ximgproc::AdaptiveManifoldFilter* obj) +{ + BEGIN_WRAP + obj->collectGarbage(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_getSigmaS(cv::ximgproc::AdaptiveManifoldFilter* obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSigmaS(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_setSigmaS(cv::ximgproc::AdaptiveManifoldFilter* obj, double val) +{ + BEGIN_WRAP + obj->setSigmaS(val); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_getSigmaR(cv::ximgproc::AdaptiveManifoldFilter* obj, double* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSigmaR(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_setSigmaR(cv::ximgproc::AdaptiveManifoldFilter* obj, double val) +{ + BEGIN_WRAP + obj->setSigmaR(val); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_getTreeHeight(cv::ximgproc::AdaptiveManifoldFilter* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getTreeHeight(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_setTreeHeight(cv::ximgproc::AdaptiveManifoldFilter* obj, int val) +{ + BEGIN_WRAP + obj->setTreeHeight(val); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_getPCAIterations(cv::ximgproc::AdaptiveManifoldFilter* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getPCAIterations(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_setPCAIterations(cv::ximgproc::AdaptiveManifoldFilter* obj, int val) +{ + BEGIN_WRAP + obj->setPCAIterations(val); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_getAdjustOutliers(cv::ximgproc::AdaptiveManifoldFilter* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getAdjustOutliers(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_setAdjustOutliers(cv::ximgproc::AdaptiveManifoldFilter* obj, int val) +{ + BEGIN_WRAP + obj->setAdjustOutliers(val); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_getUseRNG(cv::ximgproc::AdaptiveManifoldFilter* obj, int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getUseRNG() ? 1 : 0; + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_AdaptiveManifoldFilter_setUseRNG(cv::ximgproc::AdaptiveManifoldFilter* obj, int val) +{ + BEGIN_WRAP + obj->setUseRNG(val != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createAMFilter( + double sigma_s, double sigma_r, int adjust_outliers, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createAMFilter(sigma_s, sigma_r, adjust_outliers != 0); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_amFilter( + cv::_InputArray *joint, cv::_InputArray *src, cv::_OutputArray *dst, double sigma_s, double sigma_r, int adjust_outliers) +{ + BEGIN_WRAP + cv::ximgproc::amFilter(*joint, *src, *dst, sigma_s, sigma_r, adjust_outliers != 0); + END_WRAP +} + + +////////////////////////////////////////////////////////////////////////// + +CVAPI(ExceptionStatus) ximgproc_jointBilateralFilter(cv::_InputArray *joint, cv::_InputArray *src, cv::_OutputArray *dst, int d, double sigmaColor, double sigmaSpace, int borderType) +{ + BEGIN_WRAP + cv::ximgproc::jointBilateralFilter(*joint, *src, *dst, d, sigmaColor, sigmaSpace, borderType); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_bilateralTextureFilter(cv::_InputArray *src, cv::_OutputArray *dst, int fr, int numIter, double sigmaAlpha, double sigmaAvg) +{ + BEGIN_WRAP + cv::ximgproc::bilateralTextureFilter(*src, *dst, fr, numIter, sigmaAlpha, sigmaAvg); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_rollingGuidanceFilter(cv::_InputArray *src, cv::_OutputArray *dst, int d, double sigmaColor, double sigmaSpace, int numOfIter, int borderType) +{ + BEGIN_WRAP + cv::ximgproc::rollingGuidanceFilter(*src, *dst, d, sigmaColor, sigmaSpace, numOfIter, borderType); + END_WRAP +} + + +////////////////////////////////////////////////////////////////////////// +// FastBilateralSolverFilter + +CVAPI(ExceptionStatus) ximgproc_Ptr_FastBilateralSolverFilter_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_FastBilateralSolverFilter_get( + cv::Ptr* ptr, cv::ximgproc::FastBilateralSolverFilter** returnValue) +{ + BEGIN_WRAP + * returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_FastBilateralSolverFilter_filter( + cv::ximgproc::FastBilateralSolverFilter* obj, + cv::_InputArray* src, cv::_InputArray *confidence, cv::_OutputArray* dst) +{ + BEGIN_WRAP + obj->filter(*src, *confidence , *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createFastBilateralSolverFilter( + cv::_InputArray *guide, double sigma_spatial, double sigma_luma, double sigma_chroma, double lambda, int num_iter, double max_tol, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createFastBilateralSolverFilter(*guide, sigma_spatial, sigma_luma, sigma_chroma, lambda, num_iter, max_tol); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_fastBilateralSolverFilter( + cv::_InputArray *guide, cv::_InputArray *src, cv::_InputArray *confidence, cv::_OutputArray *dst, + double sigma_spatial, double sigma_luma, double sigma_chroma, double lambda, int num_iter, double max_tol) +{ + BEGIN_WRAP + cv::ximgproc::fastBilateralSolverFilter(*guide, *src, *confidence, *dst, + sigma_spatial, sigma_luma, sigma_chroma, lambda, num_iter, max_tol); + END_WRAP +} + + +////////////////////////////////////////////////////////////////////////// +// FastGlobalSmootherFilter + +CVAPI(ExceptionStatus) ximgproc_Ptr_FastGlobalSmootherFilter_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_FastGlobalSmootherFilter_get( + cv::Ptr* ptr, cv::ximgproc::FastGlobalSmootherFilter** returnValue) +{ + BEGIN_WRAP + * returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_FastGlobalSmootherFilter_filter( + cv::ximgproc::FastGlobalSmootherFilter* obj, + cv::_InputArray* src, cv::_OutputArray* dst) +{ + BEGIN_WRAP + obj->filter(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createFastGlobalSmootherFilter( + cv::_InputArray *guide, double lambda, double sigma_color, double lambda_attenuation, int num_iter, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createFastGlobalSmootherFilter(*guide, lambda, sigma_color, lambda_attenuation, num_iter); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_fastGlobalSmootherFilter( + cv::_InputArray *guide, cv::_InputArray *src, cv::_OutputArray *dst, double lambda, double sigma_color, double lambda_attenuation, int num_iter) +{ + BEGIN_WRAP + cv::ximgproc::fastGlobalSmootherFilter(*guide, *src, *dst, + lambda, sigma_color, lambda_attenuation, num_iter); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_l0Smooth(cv::_InputArray *src, cv::_OutputArray *dst, double lambda, double kappa) +{ + BEGIN_WRAP + cv::ximgproc::l0Smooth(*src, *dst, lambda, kappa); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ximgproc_FastHoughTransform.h b/src/OpenCvSharpExtern/ximgproc_FastHoughTransform.h deleted file mode 100644 index ffdbbabf4..000000000 --- a/src/OpenCvSharpExtern/ximgproc_FastHoughTransform.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _CPP_XIMGPROC_FASTHOUGHTRANSFORM_H_ -#define _CPP_XIMGPROC_FASTHOUGHTRANSFORM_H_ - -#include "include_opencv.h" - -CVAPI(void) ximgproc_FastHoughTransform(cv::_InputArray *src, cv::_OutputArray *dst, - int dstMatDepth, int angleRange, int op, int makeSkew) -{ - cv::ximgproc::FastHoughTransform(*src, *dst, dstMatDepth, angleRange, op, makeSkew); -} - -CVAPI(CvVec4i) ximgproc_HoughPoint2Line(CvPoint houghPoint, cv::_InputArray *srcImgInfo, - int angleRange, int makeSkew, int rules) -{ - return c(cv::ximgproc::HoughPoint2Line(houghPoint, *srcImgInfo, angleRange, makeSkew, rules)); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/ximgproc_FastLineDetector.h b/src/OpenCvSharpExtern/ximgproc_FastLineDetector.h index f9cd3a647..7ea1a4779 100644 --- a/src/OpenCvSharpExtern/ximgproc_FastLineDetector.h +++ b/src/OpenCvSharpExtern/ximgproc_FastLineDetector.h @@ -1,49 +1,67 @@ -#ifndef _CPP_XIMGPROC_FASTLINEDETECTOR_H_ -#define _CPP_XIMGPROC_FASTLINEDETECTOR_H_ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile #include "include_opencv.h" -CVAPI(void) ximgproc_FastLineDetector_delete(cv::Ptr *obj) +CVAPI(ExceptionStatus) ximgproc_Ptr_FastLineDetector_delete( + cv::Ptr *obj) { + BEGIN_WRAP delete obj; + END_WRAP } -CVAPI(cv::ximgproc::FastLineDetector*) ximgproc_Ptr_FastLineDetector_get(cv::Ptr *ptr) +CVAPI(ExceptionStatus) ximgproc_Ptr_FastLineDetector_get( + cv::Ptr *ptr, cv::ximgproc::FastLineDetector **returnValue) { - return ptr->get(); + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP } -CVAPI(void) ximgproc_FastLineDetector_detect_OutputArray(cv::ximgproc::FastLineDetector *obj, - cv::_InputArray *image, cv::_OutputArray *lines) +CVAPI(ExceptionStatus) ximgproc_FastLineDetector_detect_OutputArray( + cv::ximgproc::FastLineDetector *obj, cv::_InputArray *image, cv::_OutputArray *lines) { + BEGIN_WRAP obj->detect(*image, *lines); + END_WRAP } -CVAPI(void) ximgproc_FastLineDetector_detect_vector(cv::ximgproc::FastLineDetector *obj, - cv::_InputArray *image, std::vector *lines) +CVAPI(ExceptionStatus) ximgproc_FastLineDetector_detect_vector( + cv::ximgproc::FastLineDetector *obj, cv::_InputArray *image, std::vector *lines) { + BEGIN_WRAP obj->detect(*image, *lines); + END_WRAP } -CVAPI(void) ximgproc_FastLineDetector_drawSegments_InputArray(cv::ximgproc::FastLineDetector *obj, - cv::_InputOutputArray *image, cv::_InputArray *lines, int draw_arrow) +CVAPI(ExceptionStatus) ximgproc_FastLineDetector_drawSegments_InputArray( + cv::ximgproc::FastLineDetector *obj, cv::_InputOutputArray *image, cv::_InputArray *lines, int draw_arrow) { + BEGIN_WRAP obj->drawSegments(*image, *lines, draw_arrow != 0); + END_WRAP } -CVAPI(void) ximgproc_FastLineDetector_drawSegments_vector(cv::ximgproc::FastLineDetector *obj, - cv::_InputOutputArray *image, std::vector *lines, int draw_arrow) +CVAPI(ExceptionStatus) ximgproc_FastLineDetector_drawSegments_vector( + cv::ximgproc::FastLineDetector *obj, cv::_InputOutputArray *image, std::vector *lines, int draw_arrow) { + BEGIN_WRAP obj->drawSegments(*image, *lines, draw_arrow != 0); + END_WRAP } -CVAPI(cv::Ptr*) ximgproc_createFastLineDetector( - int length_threshold, float distance_threshold, double canny_th1, double canny_th2, int canny_aperture_size, int do_merge) +CVAPI(ExceptionStatus) ximgproc_createFastLineDetector( + int length_threshold, float distance_threshold, double canny_th1, double canny_th2, int canny_aperture_size, int do_merge, + cv::Ptr **returnValue) { - cv::Ptr ptr = cv::ximgproc::createFastLineDetector( + BEGIN_WRAP + const auto ptr = cv::ximgproc::createFastLineDetector( length_threshold, distance_threshold, canny_th1, canny_th2, canny_aperture_size, do_merge != 0); - return new cv::Ptr(ptr); + *returnValue = new cv::Ptr(ptr); + END_WRAP } - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/ximgproc_Paillou.h b/src/OpenCvSharpExtern/ximgproc_Paillou.h deleted file mode 100644 index 1caea594a..000000000 --- a/src/OpenCvSharpExtern/ximgproc_Paillou.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _CPP_XIMGPROC_PAILLOU_H_ -#define _CPP_XIMGPROC_PAILLOU_H_ - -#include "include_opencv.h" - -CVAPI(void) ximgproc_GradientPaillouY(cv::_InputArray *op, cv::_OutputArray *dst, double alpha, double omega) -{ - cv::ximgproc::GradientPaillouY(*op, *dst, alpha, omega); -} - -CVAPI(void) ximgproc_GradientPaillouX(cv::_InputArray *op, cv::_OutputArray *dst, double alpha, double omega) -{ - cv::ximgproc::GradientPaillouX(*op, *dst, alpha, omega); -} - -#endif \ No newline at end of file diff --git a/src/OpenCvSharpExtern/ximgproc_RidgeDetectionFilter.h b/src/OpenCvSharpExtern/ximgproc_RidgeDetectionFilter.h new file mode 100644 index 000000000..c2d5cf871 --- /dev/null +++ b/src/OpenCvSharpExtern/ximgproc_RidgeDetectionFilter.h @@ -0,0 +1,37 @@ +#pragma once + +#include "include_opencv.h" + +CVAPI(ExceptionStatus) ximgproc_RidgeDetectionFilter_create( + int ddepth, int dx, int dy, int ksize, int out_dtype, double scale, double delta, int borderType, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + auto obj = cv::ximgproc::RidgeDetectionFilter::create( + ddepth, dx, dy, ksize, out_dtype, scale, delta, borderType); + *returnValue = clone(obj); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_RidgeDetectionFilter_getRidgeFilteredImage( + cv::ximgproc::RidgeDetectionFilter *obj, + cv::_InputArray *_img, cv::_OutputArray *out) +{ + BEGIN_WRAP + obj->getRidgeFilteredImage(*_img, *out); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_RidgeDetectionFilter_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_RidgeDetectionFilter_get(cv::Ptr *ptr, cv::ximgproc::RidgeDetectionFilter **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ximgproc_Segmentation.h b/src/OpenCvSharpExtern/ximgproc_Segmentation.h new file mode 100644 index 000000000..a7a3b60d9 --- /dev/null +++ b/src/OpenCvSharpExtern/ximgproc_Segmentation.h @@ -0,0 +1,386 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +// GraphSegmentation + +CVAPI(ExceptionStatus) ximgproc_segmentation_createGraphSegmentation( + double sigma, float k, int min_size, cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createGraphSegmentation(sigma, k, min_size)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_GraphSegmentation_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_GraphSegmentation_get( + cv::Ptr *ptr, + cv::ximgproc::segmentation::GraphSegmentation **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_processImage(cv::ximgproc::segmentation::GraphSegmentation *obj, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + obj->processImage(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_setSigma(cv::ximgproc::segmentation::GraphSegmentation *obj, double value) +{ + BEGIN_WRAP + obj->setSigma(value); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_getSigma(cv::ximgproc::segmentation::GraphSegmentation *obj, double *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSigma(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_setK(cv::ximgproc::segmentation::GraphSegmentation *obj, float value) +{ + BEGIN_WRAP + obj->setK(value); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_getK(cv::ximgproc::segmentation::GraphSegmentation *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getK(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_setMinSize(cv::ximgproc::segmentation::GraphSegmentation *obj, int value) +{ + BEGIN_WRAP + obj->setMinSize(value); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_GraphSegmentation_getMinSize(cv::ximgproc::segmentation::GraphSegmentation *obj, int *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getMinSize(); + END_WRAP +} + + +// SelectiveSearchSegmentationStrategy + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentationStrategy_setImage( + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy *obj, cv::_InputArray *img, cv::_InputArray *regions, cv::_InputArray *sizes, int image_id) +{ + BEGIN_WRAP + obj->setImage(*img, *regions, *sizes, image_id); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentationStrategy_get( + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy *obj, int r1, int r2, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(r1, r2); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentationStrategy_merge( + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy *obj, int r1, int r2) +{ + BEGIN_WRAP + obj->merge(r1, r2); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyColor( + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategyColor()); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategySize( + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategySize()); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyTexture( + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategyTexture()); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyFill( + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategyFill()); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyColor_delete( + cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategySize_delete( + cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyTexture_delete( + cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyFill_delete( + cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyColor_get( + cv::Ptr *ptr, + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategyColor **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategySize_get( + cv::Ptr *ptr, + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategySize **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyTexture_get( + cv::Ptr *ptr, + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategyTexture **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyFill_get( + cv::Ptr *ptr, + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategyFill **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + + +// SelectiveSearchSegmentationStrategyMultiple + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentationStrategyMultiple_addStrategy( + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategyMultiple *obj, cv::Ptr *g, float weight) +{ + BEGIN_WRAP + obj->addStrategy(*g, weight); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentationStrategyMultiple_clearStrategies(cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategyMultiple *obj) +{ + BEGIN_WRAP + obj->clearStrategies(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple0( + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategyMultiple()); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple1( + cv::Ptr *s1, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(createSelectiveSearchSegmentationStrategyMultiple(*s1)); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple2( + cv::Ptr *s1, + cv::Ptr *s2, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(createSelectiveSearchSegmentationStrategyMultiple(*s1, *s2)); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple3( + cv::Ptr *s1, + cv::Ptr *s2, + cv::Ptr *s3, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategyMultiple(*s1, *s2, *s3)); + END_WRAP +} +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentationStrategyMultiple4( + cv::Ptr *s1, + cv::Ptr *s2, + cv::Ptr *s3, + cv::Ptr *s4, + cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentationStrategyMultiple(*s1, *s2, *s3, *s4)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyMultiple_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentationStrategyMultiple_get( + cv::Ptr *ptr, + cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategyMultiple **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +// SelectiveSearchSegmentation + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_setBaseImage( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, cv::_InputArray *img) +{ + BEGIN_WRAP + obj->setBaseImage(*img); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_switchToSingleStrategy( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, int k, float sigma) +{ + BEGIN_WRAP + obj->switchToSingleStrategy(k, sigma); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_switchToSelectiveSearchFast( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, int base_k, int inc_k, float sigma) +{ + BEGIN_WRAP + obj->switchToSelectiveSearchFast(base_k, inc_k, sigma); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_switchToSelectiveSearchQuality( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, int base_k, int inc_k, float sigma) +{ + BEGIN_WRAP + obj->switchToSelectiveSearchQuality(base_k, inc_k, sigma); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_addImage(cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, cv::_InputArray *img) +{ + BEGIN_WRAP + obj->addImage(*img); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_clearImages(cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj) +{ + BEGIN_WRAP + obj->clearImages(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_addGraphSegmentation( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, cv::Ptr *g) +{ + BEGIN_WRAP + obj->addGraphSegmentation(*g); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_clearGraphSegmentations(cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj) +{ + BEGIN_WRAP + obj->clearGraphSegmentations(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_addStrategy( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, cv::Ptr *s) +{ + BEGIN_WRAP + obj->addStrategy(*s); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_clearStrategies( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj) +{ + BEGIN_WRAP + obj->clearStrategies(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_SelectiveSearchSegmentation_process( + cv::ximgproc::segmentation::SelectiveSearchSegmentation *obj, std::vector *rects) +{ + BEGIN_WRAP + obj->process(*rects); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_createSelectiveSearchSegmentation(cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::segmentation::createSelectiveSearchSegmentation()); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentation_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_segmentation_Ptr_SelectiveSearchSegmentation_get( + cv::Ptr *ptr, cv::ximgproc::segmentation::SelectiveSearchSegmentation **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ximgproc_StructuredEdgeDetection.h b/src/OpenCvSharpExtern/ximgproc_StructuredEdgeDetection.h new file mode 100644 index 000000000..39e006f87 --- /dev/null +++ b/src/OpenCvSharpExtern/ximgproc_StructuredEdgeDetection.h @@ -0,0 +1,90 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +// RFFeatureGetter + +CVAPI(ExceptionStatus) ximgproc_createRFFeatureGetter(cv::Ptr **returnValue) +{ + BEGIN_WRAP + *returnValue = clone(cv::ximgproc::createRFFeatureGetter()); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_RFFeatureGetter_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_RFFeatureGetter_get(cv::Ptr *ptr, cv::ximgproc::RFFeatureGetter **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_RFFeatureGetter_getFeatures( + cv::ximgproc::RFFeatureGetter *obj, cv::Mat *src, cv::Mat *features, + const int gnrmRad, const int gsmthRad, const int shrink, const int outNum, const int gradNum) +{ + BEGIN_WRAP + obj->getFeatures(*src, *features, gnrmRad, gsmthRad, shrink, outNum, gradNum); + END_WRAP +} + + +// StructuredEdgeDetection + +CVAPI(ExceptionStatus) ximgproc_createStructuredEdgeDetection( + const char *model, cv::Ptr *howToGetFeatures, cv::Ptr **returnValue) +{ + BEGIN_WRAP + if (howToGetFeatures == nullptr) + *returnValue = clone(cv::ximgproc::createStructuredEdgeDetection(model)); + else + *returnValue = clone(cv::ximgproc::createStructuredEdgeDetection(model, *howToGetFeatures)); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_StructuredEdgeDetection_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_StructuredEdgeDetection_get(cv::Ptr *ptr, cv::ximgproc::StructuredEdgeDetection **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_StructuredEdgeDetection_detectEdges(cv::ximgproc::StructuredEdgeDetection *obj, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + obj->detectEdges(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_StructuredEdgeDetection_computeOrientation(cv::ximgproc::StructuredEdgeDetection *obj, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + obj->computeOrientation(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_StructuredEdgeDetection_edgesNms(cv::ximgproc::StructuredEdgeDetection *obj, + cv::_InputArray *edge_image, cv::_InputArray *orientation_image, cv::_OutputArray *dst, + int r, int s, float m, int isParallel) +{ + BEGIN_WRAP + obj->edgesNms(*edge_image, *orientation_image, *dst, r, s, m, isParallel != 0); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/ximgproc_SuperPixel.h b/src/OpenCvSharpExtern/ximgproc_SuperPixel.h new file mode 100644 index 000000000..83430c4e9 --- /dev/null +++ b/src/OpenCvSharpExtern/ximgproc_SuperPixel.h @@ -0,0 +1,216 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +// SuperpixelLSC + +CVAPI(ExceptionStatus) ximgproc_Ptr_SuperpixelLSC_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_SuperpixelLSC_get( + cv::Ptr* ptr, cv::ximgproc::SuperpixelLSC** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelLSC_getNumberOfSuperpixels( + cv::ximgproc::SuperpixelLSC* obj, + int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNumberOfSuperpixels(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelLSC_iterate( + cv::ximgproc::SuperpixelLSC* obj, int num_iterations) +{ + BEGIN_WRAP + obj->iterate(num_iterations); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelLSC_getLabels( + cv::ximgproc::SuperpixelLSC* obj, cv::_OutputArray *labels_out) +{ + BEGIN_WRAP + obj->getLabels(*labels_out); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelLSC_getLabelContourMask( + cv::ximgproc::SuperpixelLSC* obj, + cv::_OutputArray *image, int thick_line) +{ + BEGIN_WRAP + obj->getLabelContourMask(*image, thick_line != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelLSC_enforceLabelConnectivity( + cv::ximgproc::SuperpixelLSC* obj, + int min_element_size) +{ + BEGIN_WRAP + obj->enforceLabelConnectivity(min_element_size); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createSuperpixelLSC( + cv::_InputArray *image, int region_size, float ratio, cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createSuperpixelLSC(*image, region_size, ratio); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + + +// SuperpixelSEEDS + +CVAPI(ExceptionStatus) ximgproc_Ptr_SuperpixelSEEDS_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_SuperpixelSEEDS_get( + cv::Ptr* ptr, cv::ximgproc::SuperpixelSEEDS** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSEEDS_getNumberOfSuperpixels( + cv::ximgproc::SuperpixelSEEDS* obj, + int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNumberOfSuperpixels(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSEEDS_iterate( + cv::ximgproc::SuperpixelSEEDS* obj, cv::_InputArray *img, int num_iterations) +{ + BEGIN_WRAP + obj->iterate(*img, num_iterations); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSEEDS_getLabels( + cv::ximgproc::SuperpixelSEEDS* obj, cv::_OutputArray* labels_out) +{ + BEGIN_WRAP + obj->getLabels(*labels_out); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSEEDS_getLabelContourMask( + cv::ximgproc::SuperpixelSEEDS* obj, + cv::_OutputArray* image, int thick_line) +{ + BEGIN_WRAP + obj->getLabelContourMask(*image, thick_line != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createSuperpixelSEEDS( + int image_width, int image_height, int image_channels, + int num_superpixels, int num_levels, int prior, + int histogram_bins, int double_step, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createSuperpixelSEEDS( + image_width, image_height, image_channels, num_superpixels, num_levels, prior, histogram_bins, double_step); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + + +// SuperpixelSLIC + +CVAPI(ExceptionStatus) ximgproc_Ptr_SuperpixelSLIC_delete( + cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_Ptr_SuperpixelSLIC_get( + cv::Ptr* ptr, cv::ximgproc::SuperpixelSLIC** returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSLIC_getNumberOfSuperpixels( + cv::ximgproc::SuperpixelSLIC* obj, + int* returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getNumberOfSuperpixels(); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSLIC_iterate( + cv::ximgproc::SuperpixelSLIC* obj, int num_iterations) +{ + BEGIN_WRAP + obj->iterate(num_iterations); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSLIC_getLabels( + cv::ximgproc::SuperpixelSLIC* obj, cv::_OutputArray* labels_out) +{ + BEGIN_WRAP + obj->getLabels(*labels_out); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSLIC_getLabelContourMask( + cv::ximgproc::SuperpixelSLIC* obj, + cv::_OutputArray* image, int thick_line) +{ + BEGIN_WRAP + obj->getLabelContourMask(*image, thick_line != 0); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_SuperpixelSLIC_enforceLabelConnectivity( + cv::ximgproc::SuperpixelSLIC* obj, + int min_element_size) +{ + BEGIN_WRAP + obj->enforceLabelConnectivity(min_element_size); + END_WRAP +} + +CVAPI(ExceptionStatus) ximgproc_createSuperpixelSLIC( + cv::_InputArray *image, int algorithm, int region_size, float ruler, + cv::Ptr** returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::ximgproc::createSuperpixelSLIC( + *image, algorithm, region_size, ruler); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} diff --git a/src/OpenCvSharpExtern/xphoto.cpp b/src/OpenCvSharpExtern/xphoto.cpp new file mode 100644 index 000000000..c4ba24fda --- /dev/null +++ b/src/OpenCvSharpExtern/xphoto.cpp @@ -0,0 +1 @@ +#include "xphoto.h" \ No newline at end of file diff --git a/src/OpenCvSharpExtern/xphoto.h b/src/OpenCvSharpExtern/xphoto.h new file mode 100644 index 000000000..050520695 --- /dev/null +++ b/src/OpenCvSharpExtern/xphoto.h @@ -0,0 +1,392 @@ +#pragma once + +// ReSharper disable IdentifierTypo +// ReSharper disable CppInconsistentNaming +// ReSharper disable CppNonInlineFunctionDefinitionInHeaderFile + +#include "include_opencv.h" + +#pragma region inpainting.hpp + +CVAPI(ExceptionStatus) xphoto_inpaint(cv::Mat *src, cv::Mat *mask, cv::Mat *dst, int algorithm) +{ + BEGIN_WRAP + cv::xphoto::inpaint(*src, *mask, *dst, static_cast(algorithm)); + END_WRAP +} + +#pragma endregion + +#pragma region white_balance.hpp + +CVAPI(ExceptionStatus) xphoto_applyChannelGains(cv::_InputArray *src, cv::_OutputArray *dst, float gainB, float gainG, float gainR) +{ + BEGIN_WRAP + cv::xphoto::applyChannelGains(*src, *dst, gainB, gainG, gainR); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_createGrayworldWB(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::xphoto::createGrayworldWB(); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_Ptr_GrayworldWB_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_Ptr_GrayworldWB_get(cv::Ptr* ptr, cv::xphoto::GrayworldWB **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_GrayworldWB_balanceWhite(cv::xphoto::GrayworldWB* ptr, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + ptr->balanceWhite(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_GrayworldWB_SaturationThreshold_get(cv::xphoto::GrayworldWB* ptr, float* returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getSaturationThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_GrayworldWB_SaturationThreshold_set(cv::xphoto::GrayworldWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setSaturationThreshold(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_createLearningBasedWB(const char* path_to_model, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const std::string str_path_to_model(path_to_model); + const auto ptr = cv::xphoto::createLearningBasedWB(str_path_to_model); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_Ptr_LearningBasedWB_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_Ptr_LearningBasedWB_get(cv::Ptr* ptr, cv::xphoto::LearningBasedWB **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_balanceWhite(cv::xphoto::LearningBasedWB* ptr, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + ptr->balanceWhite(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_extractSimpleFeatures(cv::xphoto::LearningBasedWB* ptr, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + ptr->extractSimpleFeatures(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_RangeMaxVal_get(cv::xphoto::LearningBasedWB* ptr, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getRangeMaxVal(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_RangeMaxVal_set(cv::xphoto::LearningBasedWB* ptr, int val) +{ + BEGIN_WRAP + ptr->setRangeMaxVal(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_SaturationThreshold_get(cv::xphoto::LearningBasedWB* ptr, float *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getSaturationThreshold(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_SaturationThreshold_set(cv::xphoto::LearningBasedWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setSaturationThreshold(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_HistBinNum_get(cv::xphoto::LearningBasedWB* ptr, int *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getHistBinNum(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_LearningBasedWB_HistBinNum_set(cv::xphoto::LearningBasedWB* ptr, int val) +{ + BEGIN_WRAP + ptr->setHistBinNum(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_createSimpleWB(cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto ptr = cv::xphoto::createSimpleWB(); + *returnValue = new cv::Ptr(ptr); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_Ptr_SimpleWB_delete(cv::Ptr *obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_Ptr_SimpleWB_get(cv::Ptr* ptr, cv::xphoto::SimpleWB **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_SimpleWB_balanceWhite(cv::xphoto::SimpleWB* ptr, cv::_InputArray *src, cv::_OutputArray *dst) +{ + BEGIN_WRAP + ptr->balanceWhite(*src, *dst); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_SimpleWB_InputMax_get(cv::xphoto::SimpleWB* ptr, float *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getInputMax(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_SimpleWB_InputMax_set(cv::xphoto::SimpleWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setInputMax(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_SimpleWB_InputMin_get(cv::xphoto::SimpleWB* ptr, float *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getInputMin(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_SimpleWB_InputMin_set(cv::xphoto::SimpleWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setInputMin(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_SimpleWB_OutputMax_get(cv::xphoto::SimpleWB* ptr, float *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getOutputMax(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_SimpleWB_OutputMax_set(cv::xphoto::SimpleWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setOutputMax(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_SimpleWB_OutputMin_get(cv::xphoto::SimpleWB* ptr, float *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getOutputMin(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_SimpleWB_OutputMin_set(cv::xphoto::SimpleWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setOutputMin(val); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_SimpleWB_P_get(cv::xphoto::SimpleWB* ptr, float *returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->getP(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_SimpleWB_P_set(cv::xphoto::SimpleWB* ptr, float val) +{ + BEGIN_WRAP + ptr->setP(val); + END_WRAP +} + +#pragma endregion + +#pragma region bm3d_image_denoising.hpp + +CVAPI(ExceptionStatus) xphoto_bm3dDenoising1( + cv::_InputArray *src, + cv::_InputOutputArray *dstStep1, + cv::_OutputArray *dstStep2, + float h, + int templateWindowSize, + int searchWindowSize, + int blockMatchingStep1, + int blockMatchingStep2, + int groupSize, + int slidingStep, + float beta, + int normType, + int step, + int transformType) +{ + BEGIN_WRAP + cv::xphoto::bm3dDenoising( + *src, *dstStep1, *dstStep2, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, + groupSize, slidingStep, beta, normType, step, transformType); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_bm3dDenoising2( + cv::_InputArray *src, + cv::_OutputArray *dst, + float h, + int templateWindowSize, + int searchWindowSize, + int blockMatchingStep1, + int blockMatchingStep2, + int groupSize, + int slidingStep, + float beta, + int normType, + int step, + int transformType) +{ + BEGIN_WRAP + cv::xphoto::bm3dDenoising( + *src, *dst, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, + groupSize, slidingStep, beta, normType, step, transformType); + END_WRAP +} + +#pragma endregion + +#pragma region dct_image_denoising.hpp + +CVAPI(ExceptionStatus) xphoto_dctDenoising(cv::Mat *src, cv::Mat *dst, const double sigma, const int psize) +{ + BEGIN_WRAP + cv::xphoto::dctDenoising(*src, *dst, sigma, psize); + END_WRAP +} + +#pragma endregion + +#pragma region oilpainting.hpp + +CVAPI(ExceptionStatus) xphoto_oilPainting( + cv::_InputArray *src, cv::_OutputArray *dst, int size, int dynRatio, int code) +{ + BEGIN_WRAP + if (code >= 0) + cv::xphoto::oilPainting(*src, *dst, size, dynRatio, code); + else + cv::xphoto::oilPainting(*src, *dst, size, dynRatio); + END_WRAP +} + +#pragma endregion + +#pragma region tonemap.hpp + +CVAPI(ExceptionStatus) xphoto_TonemapDurand_getSaturation(cv::xphoto::TonemapDurand *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSaturation(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_TonemapDurand_setSaturation(cv::xphoto::TonemapDurand *obj, float saturation) +{ + BEGIN_WRAP + obj->setSaturation(saturation); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_TonemapDurand_getContrast(cv::xphoto::TonemapDurand *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getContrast(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_TonemapDurand_setContrast(cv::xphoto::TonemapDurand *obj, float contrast) +{ + BEGIN_WRAP + obj->setContrast(contrast); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_TonemapDurand_getSigmaSpace(cv::xphoto::TonemapDurand *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSigmaSpace(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_TonemapDurand_setSigmaSpace(cv::xphoto::TonemapDurand *obj, float sigma_space) +{ + BEGIN_WRAP + obj->setSigmaSpace(sigma_space); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_TonemapDurand_getSigmaColor(cv::xphoto::TonemapDurand *obj, float *returnValue) +{ + BEGIN_WRAP + *returnValue = obj->getSigmaColor(); + END_WRAP +} +CVAPI(ExceptionStatus) xphoto_TonemapDurand_setSigmaColor(cv::xphoto::TonemapDurand *obj, float sigma_color) +{ + BEGIN_WRAP + obj->setSigmaColor(sigma_color); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_createTonemapDurand( + float gamma, float contrast, float saturation, float sigma_space, float sigma_color, cv::Ptr **returnValue) +{ + BEGIN_WRAP + const auto p = cv::xphoto::createTonemapDurand(gamma, contrast, saturation, sigma_space, sigma_color); + *returnValue = clone(p); + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_Ptr_TonemapDurand_delete(cv::Ptr *ptr) +{ + BEGIN_WRAP + delete ptr; + END_WRAP +} + +CVAPI(ExceptionStatus) xphoto_Ptr_TonemapDurand_get(cv::Ptr *ptr, cv::xphoto::TonemapDurand **returnValue) +{ + BEGIN_WRAP + *returnValue = ptr->get(); + END_WRAP +} + +#pragma endregion diff --git a/src/cmake/Modules/FindOpenCV.cmake b/src/cmake/Modules/FindOpenCV.cmake deleted file mode 100644 index 060d66f5c..000000000 --- a/src/cmake/Modules/FindOpenCV.cmake +++ /dev/null @@ -1,104 +0,0 @@ -include(UsePkgConfig OPTIONAL) - -if (WIN32) -find_path(OpenCV_cv_INCLUDE_DIR opencv/cv.h - "c:/Program Files/OpenCV/cv/include" - "c:/Platform/OpenCV/cv/include" -) - -find_path(OpenCV_cxcore_INCLUDE_DIR opencv/cxcore.h - "c:/Program Files/OpenCV/cxcore/include" - "c:/Platform/OpenCV/cxcore/include" -) - -find_path(OpenCV_highgui_INCLUDE_DIR opencv/highgui.h - "c:/Program Files/OpenCV/otherlibs/highgui" - "c:/Platform/OpenCV/otherlibs/highgui" -) - -find_path(OpenCV_ml_INCLUDE_DIR opencv/ml.h - "c:/Program Files/OpenCV/ml/include" - "c:/Platform/OpenCV/ml/include" -) - -set(OpenCV_INCLUDE_DIR $(OpenCV_cv_INCLUDE_DIR) $(OpenCV_cxcore_INCLUDE_DIR) $(OpenCV_highgui_INCLUDE_DIR) $(OpenCV_ml_INCLUDE_DIR)) - -set(OpenCV_LIBRARY_DIR "c:/Program Files/OpenCV/lib" "c:/Platform/OpenCV/lib") - -find_library(OpenCV_cv_LIBRARY - NAMES cv - PATH "c:/Program Files/OpenCV/lib" - "c:/Platform/OpenCV/lib" -) - -find_library(OpenCV_cxcore_LIBRARY - NAMES cxcore - PATH "c:/Program Files/OpenCV/lib" - "c:/Platform/OpenCV/lib" -) - -find_library(OpenCV_highgui_LIBRARY - NAMES highgui - PATH "c:/Program Files/OpenCV/lib" - "c:/Platform/OpenCV/lib" -) - -find_library(OpenCV_ml_LIBRARY - NAMES ml - PATH "c:/Program Files/OpenCV/lib" - "c:/Platform/OpenCV/lib" -) - -else (WIN32) -find_path(OpenCV_INCLUDE_DIR opencv/cv.h - /usr/include - /usr/local/include -) - -set(OpenCV_LIBRARY_DIR /usr/lib /usr/local/lib) - -find_library(OpenCV_cv_LIBRARY - NAMES cv cv0.9.7 cv0.9.8 cv1.0.0 cv1.1.0 cv2.0.0 - PATH /usr/lib - /usr/local/lib -) - -find_library(OpenCV_cxcore_LIBRARY - NAMES cxcore cxcore0.9.7 cxcore0.9.8 cxcore1.0.0 cxcore1.1.0 cxcore2.0.0 - PATH /usr/lib - /usr/local/lib -) - -find_library(OpenCV_highgui_LIBRARY - NAMES highgui highgui0.9.7 highgui0.9.8 highgui1.0.0 highgui1.1.0 highgui2.0.0 - PATH /usr/lib - /usr/local/lib -) - -find_library(OpenCV_ml_LIBRARY - NAMES ml ml0.9.7 ml0.9.8 ml1.0.0 ml1.1.0 ml2.0.0 - PATH /usr/lib - /usr/local/lib -) -endif (WIN32) - -if (OpenCV_cv_LIBRARY AND OpenCV_cxcore_LIBRARY AND OpenCV_highgui_LIBRARY AND OpenCV_ml_LIBRARY) - set(OpenCV_LIBRARIES ${OpenCV_cv_LIBRARY} ${OpenCV_cxcore_LIBRARY} ${OpenCV_highgui_LIBRARY} ${OpenCV_ml_LIBRARY}) - set(OpenCV_FOUND TRUE) -endif (OpenCV_cv_LIBRARY AND OpenCV_cxcore_LIBRARY AND OpenCV_highgui_LIBRARY AND OpenCV_ml_LIBRARY) - -if (OpenCV_FOUND) - if (NOT OpenCV_FIND_QUIETLY) - message(STATUS "OpenCV library found: ${OpenCV_LIBRARIES}") - endif (NOT OpenCV_FIND_QUIETLY) -else (OpenCV_FOUND) - if (OpenCV_FIND_REQUIRED) - message(FATAL_ERROR "!!!No OpenCV library found!!!") - endif (OpenCV_FIND_REQUIRED) -endif (OpenCV_FOUND) - -if (OpenCV_INCLUDE_DIR) - message(STATUS "OpenCV include directories found: ${OpenCV_INCLUDE_DIR}") -else (OpenCV_INCLUDE_DIR) - message(FATAL_ERROR "!!!No OpenCV include directories found!!!") -endif (OpenCV_INCLUDE_DIR) \ No newline at end of file diff --git a/src/uwpOpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters b/src/uwpOpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters new file mode 100644 index 000000000..451560c6e --- /dev/null +++ b/src/uwpOpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters @@ -0,0 +1,468 @@ + + + + + 49d7baab-0f46-4431-b9fc-4351a4fb4ef5 + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms + + + {661abba9-bcda-41ca-8fce-5ef6bf646070} + + + {80811005-7492-4c04-91c0-1efa1c5ed8f5} + + + {58a08998-493f-49d0-817d-8ecf1c746dd6} + + + {2310424d-6997-41fb-914e-804a1f089260} + + + {c7288703-2491-4e11-b014-6897feaa0b27} + + + {39982e0d-ce44-40cd-b434-bbae463adfb4} + + + {bc92ecb9-0adb-45e0-b36d-fde93568cdd8} + + + {86830676-8816-42f3-ad6c-6f8602147b31} + + + {fc81d858-023a-4e24-aac3-629a3595630f} + + + {e858eb51-aa75-4979-92a0-0b8363d079e3} + + + {9e0b682a-2292-4f20-9ace-0f6ba1c53d05} + + + {823b7645-6edc-4709-adbc-69663b3e9c75} + + + {290a2eeb-1604-4a6b-935a-64d6e26751c8} + + + {56f274b8-84fa-409b-ba2c-fae7792c75ad} + + + {1c863020-648b-443e-839c-1dc63e38477d} + + + {348665c8-0b97-45c2-9cc0-8b8ebb804666} + + + {167db875-e306-4d7b-8761-c060067d1f3f} + + + {138a3e3b-0c1c-494c-87ea-c7808054c28f} + + + {cde1b297-65e0-4672-8681-dcf4086e6965} + + + {363d80cf-42b3-487f-9819-2a4fa85ebd9d} + + + {54a819c4-c58e-422d-9f5c-3f30dd2e00ab} + + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + Header Files\aruco + + + Header Files + + + Header Files\calib3d + + + Header Files\calib3d + + + Header Files\calib3d + + + Header Files\calib3d + + + Header Files\calib3d + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\face + + + Header Files\face + + + Header Files\face + + + Header Files\face + + + Header Files\face + + + Header Files\face + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\flann + + + Header Files\flann + + + Header Files + + + Header Files + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files + + + Header Files + + + Header Files\optflow + + + Header Files\optflow + + + Header Files + + + Header Files\photo + + + Header Files\photo + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\objdetect + + + Header Files\objdetect + + + Header Files\objdetect + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\shape + + + Header Files\stitching + + + Header Files\stitching + + + Header Files\tracking + + + Header Files\tracking + + + Header Files\core + + + Header Files\video + + + Header Files\video + + + Header Files\video + + + Header Files + + + Header Files\cuda + + + Header Files\cuda + + + Header Files\text + + + Header Files\text + + + Header Files\dnn + + + Header Files\dnn + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/uwpOpenCvSharpExtern/pch.cpp b/src/uwpOpenCvSharpExtern/pch.cpp new file mode 100644 index 000000000..bcb5590be --- /dev/null +++ b/src/uwpOpenCvSharpExtern/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/src/uwpOpenCvSharpExtern/pch.h b/src/uwpOpenCvSharpExtern/pch.h new file mode 100644 index 000000000..1d89ee5c1 --- /dev/null +++ b/src/uwpOpenCvSharpExtern/pch.h @@ -0,0 +1,8 @@ +#pragma once + +// MP! Force: Use of correct export declaration. Disable stl related export warnings (not sure how serious this is, ignoring for now). +#define CV_EXPORTS __declspec(dllexport) +#pragma warning(disable:4275) + +#include +#include diff --git a/src/uwpOpenCvSharpExtern/uwpOpenCvSharpExtern.vcxproj b/src/uwpOpenCvSharpExtern/uwpOpenCvSharpExtern.vcxproj new file mode 100644 index 000000000..3a1286c38 --- /dev/null +++ b/src/uwpOpenCvSharpExtern/uwpOpenCvSharpExtern.vcxproj @@ -0,0 +1,371 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {bd5471e5-7b55-5192-8da4-042b66af71ae} + WindowsRuntimeComponent + OpenCvSharpExtern + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.18362.0 + 10.0 + uwpOpenCvSharpExtern + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + true + v143 + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + $(SolutionDir)src\$(Configuration)\$(MSBuildProjectName)\$(Platform)\ + $(Platform)\$(Configuration)\ + OpenCvSharpExtern + $(SolutionDir)\opencv_files\opencv480_uwp_x86\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv480_uwp_x86\x86\vc16\lib;$(LibraryPath) + + + false + $(SolutionDir)src\$(Configuration)\$(MSBuildProjectName)\$(Platform)\ + $(Platform)\$(Configuration)\ + OpenCvSharpExtern + $(SolutionDir)\opencv_files\opencv480_uwp_x86\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv480_uwp_x86\x86\vc17\lib;$(LibraryPath) + + + false + OpenCvSharpExtern + $(SolutionDir)\opencv_files\opencv480_uwp_ARM\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv480_uwp_ARM\x86\vc16\lib;$(LibraryPath) + + + false + OpenCvSharpExtern + $(SolutionDir)\opencv_files\opencv480_uwp_ARM\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv480_uwp_ARM\x86\vc17\lib;$(LibraryPath) + $(SolutionDir)src\$(Configuration)\$(MSBuildProjectName)\$(Platform)\ + + + false + OpenCvSharpExtern + $(SolutionDir)\opencv_files\opencv480_uwp_x64\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv480_uwp_x64\x64\vc16\lib;$(LibraryPath) + $(SolutionDir)src\$(Configuration)\$(MSBuildProjectName)\$(Platform)\ + + + false + OpenCvSharpExtern + $(SolutionDir)\opencv_files\opencv480_uwp_x64\include;$(IncludePath) + $(SolutionDir)\opencv_files\opencv480_uwp_x64\x64\vc17\lib;$(LibraryPath) + $(SolutionDir)src\$(Configuration)\$(MSBuildProjectName)\$(Platform)\ + + + + NotUsing + _WINRT_DLL;%(PreprocessorDefinitions) + pch.h + $(IntDir)pch.pch + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + /bigobj %(AdditionalOptions) + 28204 + true + + + Console + false + D:\Samples\vcpkg\packages\opencv4_x86-uwp\debug\lib; + ;WindowsApp.lib;%(AdditionalDependencies) + + + + + NotUsing + _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) + pch.h + $(IntDir)pch.pch + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + /bigobj %(AdditionalOptions) + 28204 + pch.h + + + Console + false + D:\Samples\vcpkg\packages\opencv4_x86-uwp\lib; + opencv_world480.lib;opencv_img_hash480.lib;WindowsApp.lib;%(AdditionalDependencies) + + + + + Use + _WINRT_DLL;%(PreprocessorDefinitions) + pch.h + $(IntDir)pch.pch + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + /bigobj %(AdditionalOptions) + 28204 + + + Console + false + ;%(AdditionalDependencies) + + + + + NotUsing + _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) + pch.h + $(IntDir)pch.pch + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + /bigobj %(AdditionalOptions) + 28204;26439 + pch.h + + + Console + false + opencv_world480.lib;opencv_img_hash480.lib;%(AdditionalDependencies) + + + + + NotUsing + _WINRT_DLL;%(PreprocessorDefinitions) + pch.h + $(IntDir)pch.pch + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + /bigobj %(AdditionalOptions) + 28204 + + + Console + false + ;WindowsApp.lib;%(AdditionalDependencies) + + + + + NotUsing + _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) + pch.h + $(IntDir)pch.pch + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + /bigobj %(AdditionalOptions) + 28204;26439 + pch.h + + + Console + false + opencv_world480.lib;opencv_img_hash480.lib;WindowsApp.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + + + + + + \ No newline at end of file diff --git a/src/uwpOpenCvSharpExtern/uwpOpenCvSharpExtern.vcxproj.filters b/src/uwpOpenCvSharpExtern/uwpOpenCvSharpExtern.vcxproj.filters new file mode 100644 index 000000000..7469ec9bd --- /dev/null +++ b/src/uwpOpenCvSharpExtern/uwpOpenCvSharpExtern.vcxproj.filters @@ -0,0 +1,407 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\calib3d + + + Header Files\calib3d + + + Header Files\calib3d + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\core + + + Header Files\face + + + Header Files\face + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\features2d + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\imgproc + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ml + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\ximgproc + + + Header Files\flann + + + Header Files\flann + + + Header Files\dnn + + + Header Files\dnn + + + Header Files\objdetect + + + Header Files\objdetect + + + Header Files\objdetect + + + Header Files\optflow + + + Header Files\optflow + + + Header Files\stitching + + + Header Files\stitching + + + Header Files\video + + + Header Files\video + + + Header Files\video + + + Header Files\tracking + + + Header Files\tracking + + + Header Files\text + + + Header Files\text + + + Header Files\photo + + + Header Files\photo + + + + Header Files\features2d + + + Header Files\photo + + + + + {87e4132c-3eb0-4e07-8a0b-ecf507fca827} + + + {14b620e8-a026-4867-9822-865db813f9c9} + + + {51644011-fff5-4aff-b456-5e82ee865f92} + + + {878a66cf-ad75-4154-9809-2edeb380401b} + + + {3b70964b-05de-4635-82bd-565621e132ef} + + + {3b53a072-cc4b-42ec-bc7e-83619ac57d2a} + + + {a8fe3424-ee1b-4b03-91c8-c0ce57eaa4ea} + + + {bdd22bdd-9938-4451-8b19-36766ce7b4d3} + + + {c7405fcb-4690-4e4e-a085-8ab8b4954425} + + + {4cd752e3-041d-4e5e-9c26-911348c8192e} + + + {d98ae7a1-1e7d-4356-b424-9b6e5f19692d} + + + {7fef1239-bca7-4882-8d33-59d4b263444f} + + + {876f39de-d5c6-4bbd-9466-c3372518f787} + + + {7c731225-280f-45ee-a1fb-d63ab0a4429b} + + + {c3434374-265f-40f2-9a23-a832cce11467} + + + {f564287d-da9a-48cc-9ba9-ebc0d6006635} + + + {6316a388-f1c0-43b6-ad3d-57105a1cd17a} + + + {60054d5c-401c-4648-ac02-dcf95f453cec} + + + \ No newline at end of file diff --git a/test/OpenCvSharp.DebuggerVisualizers.Tester/App.config b/test/OpenCvSharp.DebuggerVisualizers.Tester/App.config new file mode 100644 index 000000000..4bfa00561 --- /dev/null +++ b/test/OpenCvSharp.DebuggerVisualizers.Tester/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/OpenCvSharp.DebuggerVisualizers.Tester/OpenCvSharp.DebuggerVisualizers.Tester.csproj b/test/OpenCvSharp.DebuggerVisualizers.Tester/OpenCvSharp.DebuggerVisualizers.Tester.csproj new file mode 100644 index 000000000..a7655560a --- /dev/null +++ b/test/OpenCvSharp.DebuggerVisualizers.Tester/OpenCvSharp.DebuggerVisualizers.Tester.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {FFD602AA-0A08-40DD-8ACD-7F5A3BA51DEC} + WinExe + OpenCvSharp.DebuggerVisualizers.Tester + OpenCvSharp.DebuggerVisualizers.Tester + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + {4232cb4a-dfe3-46ca-9503-c5f1798baed3} + OpenCvSharp.DebuggerVisualizers + + + + + PreserveNewest + + + + \ No newline at end of file diff --git a/test/OpenCvSharp.DebuggerVisualizers.Tester/Program.cs b/test/OpenCvSharp.DebuggerVisualizers.Tester/Program.cs new file mode 100644 index 000000000..af27f1029 --- /dev/null +++ b/test/OpenCvSharp.DebuggerVisualizers.Tester/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Windows.Forms; + +namespace OpenCvSharp.DebuggerVisualizers.Tester +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + var img = @"_data\image\calibration\00.jpg"; + var mainForm = new ImageViewer(img); + Application.Run(mainForm); + } + } +} diff --git a/test/OpenCvSharp.DebuggerVisualizers.Tester/Properties/AssemblyInfo.cs b/test/OpenCvSharp.DebuggerVisualizers.Tester/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..9f1d777cc --- /dev/null +++ b/test/OpenCvSharp.DebuggerVisualizers.Tester/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("OpenCvSharp.DebuggerVisualizers.Tester")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenCvSharp.DebuggerVisualizers.Tester")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("ffd602aa-0a08-40dd-8acd-7f5a3ba51dec")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/OpenCvSharp.DebuggerVisualizers.Tester/_data/image/calibration/00.jpg b/test/OpenCvSharp.DebuggerVisualizers.Tester/_data/image/calibration/00.jpg new file mode 100644 index 000000000..995d0a8d1 Binary files /dev/null and b/test/OpenCvSharp.DebuggerVisualizers.Tester/_data/image/calibration/00.jpg differ diff --git a/test/OpenCvSharp.Tests.Windows/BitmapConverterTest.cs b/test/OpenCvSharp.Tests.Windows/BitmapConverterTest.cs new file mode 100644 index 000000000..b35b199fb --- /dev/null +++ b/test/OpenCvSharp.Tests.Windows/BitmapConverterTest.cs @@ -0,0 +1,274 @@ +using System.Drawing; +using System.Drawing.Imaging; +using System.Runtime.InteropServices; +using OpenCvSharp.Extensions; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Extensions; + +public class BitmapConverterTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public BitmapConverterTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToMat8bppIndexed() + { + using var bitmap = new Bitmap("_data/image/8bpp_indexed.png"); + Assert.Equal(PixelFormat.Format8bppIndexed, bitmap.PixelFormat); + + using var mat = BitmapConverter.ToMat(bitmap); + Assert.NotNull(mat); + Assert.False(mat.IsDisposed); + Assert.False(mat.Empty()); + Assert.Equal(bitmap.Width, mat.Width); + Assert.Equal(bitmap.Height, mat.Height); + Assert.Equal(MatType.CV_8UC1, mat.Type()); + + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var bitmapPixel = bitmap.GetPixel(x, y); + var matPixel = mat.Get(y, x); + Assert.Equal(bitmapPixel.R, matPixel); + } + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToMat8bppIndexed8UC3() + { + using var bitmap = new Bitmap("_data/image/8bpp_indexed.png"); + Assert.Equal(PixelFormat.Format8bppIndexed, bitmap.PixelFormat); + + using var mat = new Mat(bitmap.Height, bitmap.Width, MatType.CV_8UC3); + BitmapConverter.ToMat(bitmap, mat); + Assert.NotNull(mat); + Assert.False(mat.IsDisposed); + Assert.False(mat.Empty()); + Assert.Equal(bitmap.Width, mat.Width); + Assert.Equal(bitmap.Height, mat.Height); + Assert.Equal(MatType.CV_8UC3, mat.Type()); + + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var bitmapPixel = bitmap.GetPixel(x, y); + var matPixel = mat.Get(y, x); + Assert.Equal(bitmapPixel.R, matPixel.Item2); + Assert.Equal(bitmapPixel.G, matPixel.Item1); + Assert.Equal(bitmapPixel.B, matPixel.Item0); + } + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToMat24bppRgb() + { + using var bitmap = new Bitmap("_data/image/lenna.png"); + Assert.Equal(PixelFormat.Format24bppRgb, bitmap.PixelFormat); + + using var mat = BitmapConverter.ToMat(bitmap); + Assert.NotNull(mat); + Assert.False(mat.IsDisposed); + Assert.False(mat.Empty()); + Assert.Equal(bitmap.Width, mat.Width); + Assert.Equal(bitmap.Height, mat.Height); + Assert.Equal(MatType.CV_8UC3, mat.Type()); + + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var bitmapPixel = bitmap.GetPixel(x, y); + var matPixel = mat.Get(y, x); + Assert.Equal(bitmapPixel.R, matPixel.Item2); + Assert.Equal(bitmapPixel.G, matPixel.Item1); + Assert.Equal(bitmapPixel.B, matPixel.Item0); + } + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToMat32bppArgb() + { + using var bitmapOrg = new Bitmap("_data/image/issue/821.jpg"); + Assert.Equal(PixelFormat.Format24bppRgb, bitmapOrg.PixelFormat); + + // 24bpp -> 32bppArgb + using var bitmap = new Bitmap(bitmapOrg.Width, bitmapOrg.Height, PixelFormat.Format32bppArgb); + using (var graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawImage(bitmapOrg, new System.Drawing.Point(0, 0)); + } + Assert.Equal(PixelFormat.Format32bppArgb, bitmap.PixelFormat); + + using var mat = BitmapConverter.ToMat(bitmap); + Assert.NotNull(mat); + Assert.False(mat.IsDisposed); + Assert.False(mat.Empty()); + Assert.Equal(bitmap.Width, mat.Width); + Assert.Equal(bitmap.Height, mat.Height); + Assert.Equal(MatType.CV_8UC4, mat.Type()); + + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var bitmapPixel = bitmap.GetPixel(x, y); + var matPixel = mat.Get(y, x); + Assert.Equal(bitmapPixel.A, matPixel.Item3); + Assert.Equal(bitmapPixel.R, matPixel.Item2); + Assert.Equal(bitmapPixel.G, matPixel.Item1); + Assert.Equal(bitmapPixel.B, matPixel.Item0); + } + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToMat32bppRgb() + { + using var bitmapOrg = new Bitmap("_data/image/issue/821.jpg"); + Assert.Equal(PixelFormat.Format24bppRgb, bitmapOrg.PixelFormat); + + // 24bpp -> 32bppRgb + using var bitmap = new Bitmap(bitmapOrg.Width, bitmapOrg.Height, PixelFormat.Format32bppRgb); + using (var graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawImage(bitmapOrg, new System.Drawing.Point(0, 0)); + } + Assert.Equal(PixelFormat.Format32bppRgb, bitmap.PixelFormat); + + using var mat = BitmapConverter.ToMat(bitmap); + Assert.NotNull(mat); + Assert.False(mat.IsDisposed); + Assert.False(mat.Empty()); + Assert.Equal(bitmap.Width, mat.Width); + Assert.Equal(bitmap.Height, mat.Height); + Assert.Equal(MatType.CV_8UC3, mat.Type()); + + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var bitmapPixel = bitmap.GetPixel(x, y); + var matPixel = mat.Get(y, x); + Assert.Equal(bitmapPixel.R, matPixel.Item2); + Assert.Equal(bitmapPixel.G, matPixel.Item1); + Assert.Equal(bitmapPixel.B, matPixel.Item0); + } + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToBitmap8bppIndexed() + { + using var mat = new Mat("_data/image/8bpp_indexed.png", ImreadModes.Grayscale); + Assert.Equal(MatType.CV_8UC1, mat.Type()); + + using var bitmap = BitmapConverter.ToBitmap(mat); + Assert.NotNull(bitmap); + Assert.Equal(mat.Width, bitmap.Width); + Assert.Equal(mat.Height, bitmap.Height); + Assert.Equal(PixelFormat.Format8bppIndexed, bitmap.PixelFormat); + + var matIndexer = mat.GetUnsafeGenericIndexer(); + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var matPixel = matIndexer[y, x]; + var bitmapPixel = bitmap.GetPixel(x, y); + Assert.Equal(matPixel, bitmapPixel.R); + } + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ToBitmap24bppRgb() + { + using var mat = new Mat("_data/image/lenna.png", ImreadModes.Color); + Assert.False(mat.Empty()); + Assert.Equal(MatType.CV_8UC3, mat.Type()); + + using var bitmap = BitmapConverter.ToBitmap(mat); + Assert.NotNull(bitmap); + Assert.Equal(mat.Width, bitmap.Width); + Assert.Equal(mat.Height, bitmap.Height); + Assert.Equal(PixelFormat.Format24bppRgb, bitmap.PixelFormat); + + int width = bitmap.Width, height = bitmap.Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var matPixel = mat.Get(y, x); + var bitmapPixel = bitmap.GetPixel(x, y); + Assert.Equal(matPixel.Item2, bitmapPixel.R); + Assert.Equal(matPixel.Item1, bitmapPixel.G); + Assert.Equal(matPixel.Item0, bitmapPixel.B); + } + } + } + + [Fact] + public void BitmapSource8Bit() + { + var blueColor8 = new Scalar(200, 0, 0); + var greenColor8 = new Scalar(0, 200, 0); + var redColor8 = new Scalar(0, 0, 200); + + using (var mat = new Mat(1, 1, MatType.CV_8UC3, blueColor8)) + { + var bitmap = mat.ToBitmap(); + AssertPixelValue8bpp(blueColor8, bitmap); + } + using (var mat = new Mat(1, 1, MatType.CV_8UC3, greenColor8)) + { + var bitmap = mat.ToBitmap(); + AssertPixelValue8bpp(greenColor8, bitmap); + } + using (var mat = new Mat(1, 1, MatType.CV_8UC3, redColor8)) + { + var bitmap = mat.ToBitmap(); + AssertPixelValue8bpp(redColor8, bitmap); + } + } + + private void AssertPixelValue8bpp(Scalar expectedValue, Bitmap bitmap) + { + if (bitmap.Width != 1 || bitmap.Height != 1) + throw new ArgumentException("1x1 image only"); + + var pixels = new byte[3]; + var bitmapData = bitmap.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + Marshal.Copy(bitmapData.Scan0, pixels, 0, 3); + bitmap.UnlockBits(bitmapData); + + testOutputHelper.WriteLine("Expected: ({0},{1},{2})", expectedValue.Val0, expectedValue.Val1, expectedValue.Val2); + testOutputHelper.WriteLine("Actual: ({0},{1},{2})", pixels[0], pixels[1], pixels[2]); + Assert.Equal(expectedValue.Val0, Convert.ToDouble(pixels[0]), 9); + Assert.Equal(expectedValue.Val1, Convert.ToDouble(pixels[1]), 9); + Assert.Equal(expectedValue.Val2, Convert.ToDouble(pixels[2]), 9); + } +} diff --git a/test/OpenCvSharp.Tests.Windows/BitmapSourceConverterTest.cs b/test/OpenCvSharp.Tests.Windows/BitmapSourceConverterTest.cs new file mode 100644 index 000000000..fd02da0f8 --- /dev/null +++ b/test/OpenCvSharp.Tests.Windows/BitmapSourceConverterTest.cs @@ -0,0 +1,148 @@ +using System.Globalization; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media.Imaging; +using Xunit; + +#pragma warning disable xUnit1004 // Test methods should not be skipped + +namespace OpenCvSharp.Tests.Windows; + +public class BitmapSourceConverterTest : OpenCvSharp.Tests.TestBase +{ + [Fact] + public void BitmapSource8Bit() + { + var blueColor8 = new Scalar(200, 0, 0); + var greenColor8 = new Scalar(0, 200, 0); + var redColor8 = new Scalar(0, 0, 200); + + using (var mat = new Mat(1, 1, MatType.CV_8UC3, blueColor8)) + { + var bs = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); // PixelFormats.Bgr24 + AssertPixelValue(blueColor8, bs); + } + using (var mat = new Mat(1, 1, MatType.CV_8UC3, greenColor8)) + { + var bs = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); + AssertPixelValue(greenColor8, bs); + } + using (var mat = new Mat(1, 1, MatType.CV_8UC3, redColor8)) + { + var bs = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); + AssertPixelValue(redColor8, bs); + } + } + + [Fact] + public void BitmapSource16Bit() + { + var blueColor16 = new Scalar(32767, 0, 0); + var greenColor16 = new Scalar(0, 32767, 0); + var redColor16 = new Scalar(0, 0, 32767); + + using (var mat = new Mat(1, 1, MatType.CV_16UC3, blueColor16)) + { + var bs = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); // PixelFormats.Rgb48 + AssertPixelValue(redColor16, bs); // B is swapped for R + } + using (var mat = new Mat(1, 1, MatType.CV_16UC3, greenColor16)) + { + var bs = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); + AssertPixelValue(greenColor16, bs); + } + using (var mat = new Mat(1, 1, MatType.CV_16UC3, redColor16)) + { + var bs = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); + AssertPixelValue(blueColor16, bs); // R is swapped for B + } + } + + /// + /// https://github.com/shimat/opencvsharp/issues/304 + /// + [StaFact(Skip = "sample")] + public void BitmapSourceSample() + { + const int size = 250; + + BitmapSource bs8, bs16; + + var blueColor8 = new Scalar(128, 0, 0); + var greenColor8 = new Scalar(0, 128, 0); + var redColor8 = new Scalar(0, 0, 128); + var whiteColor8 = new Scalar(255, 255, 255); + using (var mat = new Mat(size, size, MatType.CV_8UC3, new Scalar(128, 128, 128))) + { + mat.Rectangle(new Rect(15, 10, 100, 100), blueColor8, -1); + mat.PutText("B", new Point(50, 70), HersheyFonts.HersheyComplex, 1, whiteColor8); + + mat.Rectangle(new Rect(130, 10, 100, 100), greenColor8, -1); + mat.PutText("G", new Point(165, 70), HersheyFonts.HersheyComplex, 1, whiteColor8); + + mat.Rectangle(new Rect(75, 130, 100, 100), redColor8, -1); + mat.PutText("R", new Point(110, 190), HersheyFonts.HersheyComplex, 1, whiteColor8); + + bs8 = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); + } + + var blueColor16 = new Scalar(32767, 0, 0); + var greenColor16 = new Scalar(0, 32767, 0); + var redColor16 = new Scalar(0, 0, 32767); + var whiteColor16 = new Scalar(65535, 65535, 65535); + using (var mat = new Mat(size, size, MatType.CV_16UC3, new Scalar(32767, 32767, 32767))) + { + mat.Rectangle(new Rect(15, 10, 100, 100), blueColor16, -1); + mat.PutText("B", new Point(50, 70), HersheyFonts.HersheyComplex, 1, whiteColor16); + + mat.Rectangle(new Rect(130, 10, 100, 100), greenColor16, -1); + mat.PutText("G", new Point(165, 70), HersheyFonts.HersheyComplex, 1, whiteColor16); + + mat.Rectangle(new Rect(75, 130, 100, 100), redColor16, -1); + mat.PutText("R", new Point(110, 190), HersheyFonts.HersheyComplex, 1, whiteColor16); + + bs16 = OpenCvSharp.WpfExtensions.BitmapSourceConverter.ToBitmapSource(mat); + } + + var image8 = new Image { Source = bs8 }; + var image16 = new Image { Source = bs16 }; + var grid = new Grid(); + grid.ColumnDefinitions.Add(new ColumnDefinition()); + grid.ColumnDefinitions.Add(new ColumnDefinition()); + grid.RowDefinitions.Add(new RowDefinition()); + Grid.SetRow(image8, 0); + Grid.SetColumn(image8, 0); + grid.Children.Add(image8); + Grid.SetRow(image16, 0); + Grid.SetColumn(image16, 1); + grid.Children.Add(image16); + var window = new System.Windows.Window + { + Title = "Left:8bit Right:16bit", + Width = size * 2, + Height = size, + Content = grid + }; + + var app = new Application(); + app.Run(window); + } + + private static void AssertPixelValue(Scalar expectedValue, BitmapSource bs) + where T : unmanaged + { + if (bs.PixelWidth != 1 || bs.PixelHeight != 1) + throw new ArgumentException("1x1 image only"); + + var pixels = new T[3]; + int stride = 4 * Marshal.SizeOf(); + bs.CopyPixels(Int32Rect.Empty, pixels, stride, 0); + + Console.WriteLine("Expected: ({0},{1},{2})", expectedValue.Val0, expectedValue.Val1, expectedValue.Val2); + Console.WriteLine("Actual: ({0},{1},{2})", pixels[0], pixels[1], pixels[2]); + Assert.Equal(expectedValue.Val0, Convert.ToDouble(pixels[0], CultureInfo.InvariantCulture), 9); + Assert.Equal(expectedValue.Val1, Convert.ToDouble(pixels[1], CultureInfo.InvariantCulture), 9); + Assert.Equal(expectedValue.Val2, Convert.ToDouble(pixels[2], CultureInfo.InvariantCulture), 9); + } +} diff --git a/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj b/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj new file mode 100644 index 000000000..d5f0cf966 --- /dev/null +++ b/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj @@ -0,0 +1,55 @@ + + + + net8.0-windows;net48 + true + true + 12 + enable + enable + + + + AllEnabledByDefault + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + PreserveNewest + + + + + CA1303;CA1814; + + + diff --git a/test/OpenCvSharp.Tests.Windows/WriteableBitmapConverterTest.cs b/test/OpenCvSharp.Tests.Windows/WriteableBitmapConverterTest.cs new file mode 100644 index 000000000..98e7dda9b --- /dev/null +++ b/test/OpenCvSharp.Tests.Windows/WriteableBitmapConverterTest.cs @@ -0,0 +1,120 @@ +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using OpenCvSharp.WpfExtensions; +using Xunit; + +namespace OpenCvSharp.Tests.Windows; + +public class WriteableBitmapConverterTest +{ + [Fact] + public void ToWriteableBitmap() + { + var expected = new byte[] {1, 2, 3, 4, 5, 6}; + using (var mat = Mat.FromPixelData(3, 2, MatType.CV_8UC1, expected)) + { + var wb = mat.ToWriteableBitmap(); + + byte[] actual = new byte[6]; + wb.CopyPixels(Int32Rect.Empty, actual, mat.Cols, 0); + for (int i = 0; i < expected.Length; i++) + { + Assert.True(expected[i] == actual[i], $"values[{i}] = {expected[i]}, pixels[{i}] = {actual[i]}"); + } + } + + GC.KeepAlive(expected); + } + + [Fact] + public void ToWriteableBitmapSubmat() + { + var expected = new byte[] {1, 2, 3, 4, 5, 6}; + using (var mat = Mat.FromPixelData(3, 2, MatType.CV_8UC1, expected)) + using (var submat = mat[0, 2, 0, 2]) + { + var wb = submat.ToWriteableBitmap(); + + byte[] actual = new byte[4]; + wb.CopyPixels(Int32Rect.Empty, actual, submat.Cols, 0); + for (int i = 0; i < actual.Length; i++) + { + Assert.True(expected[i] == actual[i], $"values[{i}] = {expected[i]}, pixels[{i}] = {actual[i]}"); + } + } + + GC.KeepAlive(expected); + } + + [Fact] + public void ToMatGray8() + { + const int width = 3; + const int height = 4; + + var buffer = new byte[height, width] + { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + {10, 11, 12}, + }; + + var wb = new WriteableBitmap(width, height, 92, 92, PixelFormats.Gray8, null); + wb.WritePixels(new Int32Rect(0, 0, width, height), buffer, width, 0); + + using var mat = wb.ToMat(); + Assert.Equal(MatType.CV_8UC1, mat.Type()); + Assert.Equal(width, mat.Cols); + Assert.Equal(height, mat.Rows); + + var indexer = mat.GetUnsafeGenericIndexer(); + + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + Assert.True(buffer[y, x] == indexer[y, x], + $"wb[{y},{x}] = {buffer[y, x]}, mat[{y},{x}] = {indexer[y, x]}"); + } + } + } + + [Fact] + public void ToMatBgr24() + { + const int width = 3; + const int height = 4; + + var buffer = new byte[height, width * 3] + { + {1,2,3, 4,5,6, 7,8,9}, + {10,11,12, 13,14,15, 16,17,18}, + {19,20,21, 22,23,24, 25,26,27}, + {28,29,30, 31,32,33, 34,35,36}, + }; + + var wb = new WriteableBitmap(width, height, 92, 92, PixelFormats.Bgr24, null); + wb.WritePixels(new Int32Rect(0, 0, width, height), buffer, width*3, 0); + + using var mat = wb.ToMat(); + Assert.Equal(MatType.CV_8UC3, mat.Type()); + Assert.Equal(width, mat.Cols); + Assert.Equal(height, mat.Rows); + + var indexer = mat.GetUnsafeGenericIndexer(); + + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + var expected = new Vec3b(buffer[y, x*3+0], buffer[y, x*3+1], buffer[y, x*3+2]); + var actual = indexer[y, x]; + + Assert.True(actual == expected, + $"wb[{y},{x}] = {expected}, mat[{y},{x}] = {actual}"); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/ArchitectureSpecificFactAttribute.cs b/test/OpenCvSharp.Tests/ArchitectureSpecificFactAttribute.cs new file mode 100644 index 000000000..d88002424 --- /dev/null +++ b/test/OpenCvSharp.Tests/ArchitectureSpecificFactAttribute.cs @@ -0,0 +1,20 @@ +using System.Runtime.InteropServices; +using Xunit; + +namespace OpenCvSharp.Tests; + +// ReSharper disable once UnusedMember.Global +public sealed class ArchitectureSpecificFactAttribute : FactAttribute +{ + public Architecture[] Architectures { get; } + + public ArchitectureSpecificFactAttribute(params Architecture[] architectures) + { + Architectures = architectures; + + if (architectures.Contains(RuntimeInformation.ProcessArchitecture)) + { + Skip = $"Only running in specific architectures ({string.Join(",", architectures)})."; + } + } +} diff --git a/test/OpenCvSharp.Tests/DoubleEqualityComparer.cs b/test/OpenCvSharp.Tests/DoubleEqualityComparer.cs new file mode 100644 index 000000000..7d76229d2 --- /dev/null +++ b/test/OpenCvSharp.Tests/DoubleEqualityComparer.cs @@ -0,0 +1,23 @@ +namespace OpenCvSharp.Tests; + +public class DoubleEqualityComparer : IEqualityComparer +{ + private readonly double epsilon; + + public DoubleEqualityComparer(double epsilon) + { + if (epsilon < 0) + throw new ArgumentException("epsilon can't be negative", nameof(epsilon)); + this.epsilon = epsilon; + } + + public bool Equals(double x, double y) + { + return Math.Abs(x - y) < epsilon; + } + + public int GetHashCode(double obj) + { + return obj.GetHashCode(); + } +} diff --git a/test/OpenCvSharp.Tests/ExplicitFactAttribute.cs b/test/OpenCvSharp.Tests/ExplicitFactAttribute.cs new file mode 100644 index 000000000..c08050254 --- /dev/null +++ b/test/OpenCvSharp.Tests/ExplicitFactAttribute.cs @@ -0,0 +1,27 @@ +using System.Diagnostics; +using Xunit; + +namespace OpenCvSharp.Tests; + +// ReSharper disable once UnusedMember.Global +public sealed class ExplicitFactAttribute : FactAttribute +{ + public ExplicitFactAttribute() + { + if (!Debugger.IsAttached) + { + Skip = "Only running in interactive mode."; + } + } +} + +public sealed class ExplicitStaFactAttribute : StaFactAttribute +{ + public ExplicitStaFactAttribute() + { + if (!Debugger.IsAttached) + { + Skip = "Only running in interactive mode."; + } + } +} diff --git a/test/OpenCvSharp.Tests/ExplicitTheoryAttribute.cs b/test/OpenCvSharp.Tests/ExplicitTheoryAttribute.cs new file mode 100644 index 000000000..3df1f4288 --- /dev/null +++ b/test/OpenCvSharp.Tests/ExplicitTheoryAttribute.cs @@ -0,0 +1,27 @@ +using System.Diagnostics; +using Xunit; + +namespace OpenCvSharp.Tests; + +// ReSharper disable once UnusedMember.Global +public sealed class ExplicitTheoryAttribute : TheoryAttribute +{ + public ExplicitTheoryAttribute() + { + if (!Debugger.IsAttached) + { + Skip = "Only running in interactive mode."; + } + } +} + +public sealed class ExplicitStaTheoryAttribute : StaTheoryAttribute +{ + public ExplicitStaTheoryAttribute() + { + if (!Debugger.IsAttached) + { + Skip = "Only running in interactive mode."; + } + } +} diff --git a/test/OpenCvSharp.Tests/FileDownloader.cs b/test/OpenCvSharp.Tests/FileDownloader.cs new file mode 100644 index 000000000..a5130904b --- /dev/null +++ b/test/OpenCvSharp.Tests/FileDownloader.cs @@ -0,0 +1,40 @@ +#if NET48 +using System.Net; +#else +using System.Net.Http; +#endif + +namespace OpenCvSharp.Tests +{ + public static class FileDownloader + { + private const int TimeoutMilliseconds = 5 * 60 * 1000; + +#if !NET48 + private static readonly HttpClient httpClient = new() + { + Timeout = TimeSpan.FromMilliseconds(TimeoutMilliseconds) + }; +#endif + + public static byte[] DownloadData(Uri address) + { +#if NET48 + var webRequest = WebRequest.CreateHttp(address); + webRequest.Method = "GET"; + webRequest.Timeout = TimeoutMilliseconds; + using var response = webRequest.GetResponse(); + using var responseStream = response.GetResponseStream(); + using var memoryStream = new MemoryStream(); + responseStream.CopyTo(memoryStream); + return memoryStream.ToArray(); +#else + using var httpRequest = new HttpRequestMessage(HttpMethod.Get, address); + using var httpResponse = httpClient.Send(httpRequest); + using var memoryStream = new MemoryStream(); + httpResponse.Content.ReadAsStream().CopyTo(memoryStream); + return memoryStream.ToArray(); +#endif + } + } +} \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj b/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj new file mode 100644 index 000000000..269f16bc7 --- /dev/null +++ b/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj @@ -0,0 +1,65 @@ + + + + net8.0;net48 + true + OpenCvSharp.Tests + Library + OpenCvSharp.Tests + true + false + false + false + 12 + enable + enable + + + + AllEnabledByDefault + + + + + + PreserveNewest + PreserveNewest + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + PreserveNewest + + + + + + + + + CA1303;CA1814; + + diff --git a/test/OpenCvSharp.Tests/OpenCvSharp.Tests.xproj b/test/OpenCvSharp.Tests/OpenCvSharp.Tests.xproj deleted file mode 100644 index 39d8b96fa..000000000 --- a/test/OpenCvSharp.Tests/OpenCvSharp.Tests.xproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - ffbbcf99-97f0-4f81-aaf6-8d851a8e1d2e - OpenCvSharp.Tests - .\obj - .\bin\ - v4.5 - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/PlatformSpecificFactAttribute.cs b/test/OpenCvSharp.Tests/PlatformSpecificFactAttribute.cs new file mode 100644 index 000000000..5f8d2ac05 --- /dev/null +++ b/test/OpenCvSharp.Tests/PlatformSpecificFactAttribute.cs @@ -0,0 +1,78 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using Xunit; + +namespace OpenCvSharp.Tests; + +public sealed class PlatformSpecificFactAttribute : FactAttribute +{ + public string[] TargetPlatformNames { get; } + + public PlatformSpecificFactAttribute(params string[] targetPlatformNames) + { + if (targetPlatformNames is null) + throw new ArgumentNullException(nameof(targetPlatformNames)); + if (targetPlatformNames.Length == 0) + throw new ArgumentException($"Empty array", nameof(targetPlatformNames)); + TargetPlatformNames = targetPlatformNames; + + var targetPlatforms = targetPlatformNames.Select(OSPlatformExtensions.FromString).ToArray(); + if (targetPlatforms.All(pf => !RuntimeInformation.IsOSPlatform(pf))) + { + Skip = $"Only running in {string.Join(" or ", targetPlatforms)}."; + } + } +} + +// ReSharper disable once UnusedMember.Global +public sealed class PlatformSpecificStaFactAttribute : StaFactAttribute +{ + public string[] TargetPlatformNames { get; } + + public PlatformSpecificStaFactAttribute(params string[] targetPlatformNames) + { + if (targetPlatformNames is null) + throw new ArgumentNullException(nameof(targetPlatformNames)); + if (targetPlatformNames.Length == 0) + throw new ArgumentException($"Empty array", nameof(targetPlatformNames)); + TargetPlatformNames = targetPlatformNames; + + var targetPlatforms = targetPlatformNames.Select(OSPlatformExtensions.FromString).ToArray(); + if (targetPlatforms.All(pf => !RuntimeInformation.IsOSPlatform(pf))) + { + Skip = $"Only running in {string.Join(" or ", targetPlatforms)}."; + } + } +} + +// ReSharper disable once UnusedMember.Global +public sealed class PlatformSpecificTheoryAttribute : TheoryAttribute +{ + public string[] TargetPlatformNames { get; } + + public PlatformSpecificTheoryAttribute(params string[] targetPlatformNames) + { + if (targetPlatformNames is null) + throw new ArgumentNullException(nameof(targetPlatformNames)); + if (targetPlatformNames.Length == 0) + throw new ArgumentException($"Empty array", nameof(targetPlatformNames)); + TargetPlatformNames = targetPlatformNames; + + var targetPlatforms = targetPlatformNames.Select(OSPlatformExtensions.FromString).ToArray(); + if (targetPlatforms.All(pf => !RuntimeInformation.IsOSPlatform(pf))) + { + Skip = $"Only running in {string.Join(" or ", targetPlatforms)}."; + } + } +} + +internal static class OSPlatformExtensions +{ + public static OSPlatform FromString(string platformName) + { + var properties = typeof(OSPlatform).GetProperties(BindingFlags.Public | BindingFlags.Static); + var property = properties.FirstOrDefault(p => p.Name.Equals(platformName, StringComparison.OrdinalIgnoreCase)); + var value = (OSPlatform)(property?.GetValue(null) ?? throw new InvalidOperationException()); + return value; + } +} diff --git a/test/OpenCvSharp.Tests/Properties/AssemblyInfo.cs b/test/OpenCvSharp.Tests/Properties/AssemblyInfo.cs index 0ab25490b..d3322dcc1 100644 --- a/test/OpenCvSharp.Tests/Properties/AssemblyInfo.cs +++ b/test/OpenCvSharp.Tests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/test/OpenCvSharp.Tests/TestBase.cs b/test/OpenCvSharp.Tests/TestBase.cs index bce977933..3c9a8e7fd 100644 --- a/test/OpenCvSharp.Tests/TestBase.cs +++ b/test/OpenCvSharp.Tests/TestBase.cs @@ -1,22 +1,81 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using NUnit.Framework; - -namespace OpenCvSharp.Tests +using System.Diagnostics; +using System.Net; +using Xunit; + +[assembly: CollectionBehavior(/*MaxParallelThreads = 2, */DisableTestParallelization = true)] + +#pragma warning disable CA1810 // Initialize reference type static fields inline +#pragma warning disable CA5359 + +namespace OpenCvSharp.Tests; + +public abstract class TestBase { - public abstract class TestBase + static TestBase() + { +#pragma warning disable CA5364 +#pragma warning disable CA5386 + ServicePointManager.ServerCertificateValidationCallback = (_, _, _, _) => true; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; +#pragma warning restore CA5364 +#pragma warning restore CA5386 + } + + protected static Mat LoadImage(string fileName, ImreadModes modes = ImreadModes.Color) + => new(Path.Combine("_data", "image", fileName), modes); + + protected static void ImageEquals(Mat img1, Mat img2) { - protected TestBase() + if (img1 is null && img2 is null) + return; + Assert.NotNull(img1); + Assert.NotNull(img2); +#pragma warning disable CS8602 +#pragma warning disable CA1062 + Assert.Equal(img1.Type(), img2.Type()); +#pragma warning restore CS8602 +#pragma warning restore CA1062 + + using var comparison = new Mat(); + Cv2.Compare(img1, img2, comparison, CmpType.NE); + + if (img1.Channels() == 1) { - Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + Assert.Equal(0, Cv2.CountNonZero(comparison)); } + else + { + var channels = Cv2.Split(comparison); + try + { + foreach (var channel in channels) + { + Assert.Equal(0, Cv2.CountNonZero(channel)); + } + } + finally + { + foreach (var channel in channels) + { + channel.Dispose(); + } + } + } + } - protected Mat Image(string fileName, ImreadModes modes = ImreadModes.Color) + protected static void ShowImagesWhenDebugMode(params Mat[] mats) + { + if (Debugger.IsAttached) + { + Window.ShowImages(mats); + } + } + + protected static void ShowImagesWhenDebugMode(IEnumerable mats, IEnumerable names) + { + if (Debugger.IsAttached) { - return new Mat(Path.Combine("_data", "image", fileName), modes); + Window.ShowImages(mats, names); } } } diff --git a/test/OpenCvSharp.Tests/_data/aruco/Dict6X6_1000.yaml b/test/OpenCvSharp.Tests/_data/aruco/Dict6X6_1000.yaml new file mode 100644 index 000000000..fcaf89492 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/aruco/Dict6X6_1000.yaml @@ -0,0 +1,1005 @@ +%YAML:1.0 +--- +nmarkers: 1000 +markersize: 6 +maxCorrectionBits: 4 +marker_0: "000111100011110111011000001010100110" +marker_1: "000011101111101110100011100010010001" +marker_2: "000101011001000001111110101011001101" +marker_3: "110010010001101100110000011010011110" +marker_4: "110101100000011111010110111000010101" +marker_5: "110110001110100011100000111001101000" +marker_6: "010000100110100010110100000111110101" +marker_7: "100010001010010100001111001010011010" +marker_8: "001100000111110101010010010011111101" +marker_9: "001111000010111100110100101100111100" +marker_10: "010001011101111111000111010011100011" +marker_11: "010010001101100001011011001001010111" +marker_12: "011100010000010101011000111111000110" +marker_13: "100001101101110011111010110100000111" +marker_14: "100011010111001010101001001111110110" +marker_15: "101000101011100010011101110011011110" +marker_16: "000010011111110100011110100111000100" +marker_17: "000101010100110110111101000110001111" +marker_18: "001100000000101000110001000011100010" +marker_19: "010010000000011111101111101011111101" +marker_20: "010101101101111100010001110110110110" +marker_21: "011001101000100000110010011101001100" +marker_22: "011101101110100011001011011110000001" +marker_23: "100110100101001111011001110011110011" +marker_24: "101010011100101110000100000000100100" +marker_25: "110001100111010101001001010010010000" +marker_26: "110000011101001010001000100101000001" +marker_27: "111001110100100000001000010100101011" +marker_28: "111010100010111111001010100001001000" +marker_29: "111010010110001110110111011110110001" +marker_30: "111110100011011001100101001010101111" +marker_31: "000001100101101111111111011110111101" +marker_32: "000001010100000111010111001011010110" +marker_33: "000011001111011100100100011010100010" +marker_34: "000100110011100010100011100111101011" +marker_35: "000101011010100010010011111001110100" +marker_36: "001110100100000101111110111010011110" +marker_37: "010011110001000111100010011011000000" +marker_38: "010100110000110110110110110100100000" +marker_39: "010110001001101111111010111000110100" +marker_40: "011001000000100111101000101000001011" +marker_41: "011000000101001101111010100010010001" +marker_42: "011000010101100100000110100110111010" +marker_43: "011010111111111101111000110101111011" +marker_44: "011100001010110110010110101001001111" +marker_45: "011101011000010001101111011100011010" +marker_46: "011110101001010100011001001011111100" +marker_47: "100001100000100101110110000010101010" +marker_48: "100010100010110101000100110000111111" +marker_49: "100100111110101101111000101100010100" +marker_50: "100110001000110110101000010011010100" +marker_51: "100111101101111000101011001111001000" +marker_52: "101001010010100111100000011110111000" +marker_53: "101101011001001110111000010101011111" +marker_54: "101101111111100011100100001001101111" +marker_55: "101111000010000001010010001001011110" +marker_56: "110000000100010010000111011101100101" +marker_57: "110001001100001100100100001001011001" +marker_58: "110001011010100100011011110110001101" +marker_59: "110011100111001111100110101100101100" +marker_60: "110011010000110010100110001001110010" +marker_61: "110010010100001101011101010001001101" +marker_62: "110011111011111010000000111100110100" +marker_63: "111001010111110100010101100001110111" +marker_64: "111011111100011010000101100011101001" +marker_65: "111101110111111011110011011101110010" +marker_66: "001011001110010000111111001001010100" +marker_67: "001010111101110011111111010010110011" +marker_68: "001101111100011111011101101111011010" +marker_69: "101000011010001001010100111000001111" +marker_70: "101010011000001011000001101110110101" +marker_71: "110110000001101101001001101100001000" +marker_72: "000000110101100000101001111110000110" +marker_73: "000001111100010000001001010111111100" +marker_74: "000011111110001001100110000101111011" +marker_75: "000101000100100000110110010001000001" +marker_76: "000100001010110101011111111110110111" +marker_77: "000100101000001010010101010100111111" +marker_78: "000101101110000100110001100001001100" +marker_79: "000110000111101001001001011010110000" +marker_80: "000110101110100010000110000100010010" +marker_81: "000110010001001110101110000010100001" +marker_82: "000110110110011110110101101000010111" +marker_83: "001001011101110010010101111100001011" +marker_84: "001010001000100101100001111101110110" +marker_85: "001100110101010000010100011010101010" +marker_86: "001100011100000101101100000111110111" +marker_87: "001100111100101100011000110001100110" +marker_88: "001111101100111111100100100100001111" +marker_89: "010001100100010100011000101000111111" +marker_90: "010001001011101001110000101101100111" +marker_91: "010000011001110001100010001111101000" +marker_92: "010010001101000110010001010010100001" +marker_93: "010101001111010010011001111101101101" +marker_94: "010101110101101010011100100000010011" +marker_95: "010101011000001101010101101100101100" +marker_96: "010101111011011101110110000100001111" +marker_97: "010111000011010000110110111111100100" +marker_98: "010111000100100011111100011101111110" +marker_99: "010111100110111011101111010000000010" +marker_100: "010111110010001100111011011011111111" +marker_101: "010110110111010000101010011000110010" +marker_102: "011001010000111110100011001110101110" +marker_103: "011001011101001100010111010111001100" +marker_104: "011010101001110000100100010110101110" +marker_105: "011010011100010111110011000001000010" +marker_106: "011010011101001001001000010011101010" +marker_107: "011101000111100111100010110111100110" +marker_108: "011100101100111100100011111010101011" +marker_109: "011101111011000111011100010000010100" +marker_110: "011111100000110000000111001000010111" +marker_111: "011110100110100101110000011001000111" +marker_112: "011110001011001011011000011100000111" +marker_113: "011110011100010110000101011110010100" +marker_114: "100001100110111101011001111111000110" +marker_115: "100000101111011001110010011111110101" +marker_116: "100001010100111000101111010000010100" +marker_117: "100110100001000110000101100100110100" +marker_118: "100111000111000101100000110010010111" +marker_119: "100111011101000110010100111111011000" +marker_120: "101000100001111000010010111000111000" +marker_121: "101011100111000000011100100000101100" +marker_122: "101011010000000100100001100111000001" +marker_123: "101100000011010100011111100111101110" +marker_124: "101101100100101011011000000011010100" +marker_125: "101101010011011100110001010010110100" +marker_126: "101111101010101011000111111000111011" +marker_127: "101110110110100000111101101111001111" +marker_128: "110001100111001011110111001011000001" +marker_129: "110000011110011101001101101110101011" +marker_130: "110010110101010111101110010110011101" +marker_131: "110010111010000001010011011100100100" +marker_132: "110100000000100100001111110011110001" +marker_133: "110100000110110000111010110101010100" +marker_134: "110100111111000100100000010101110100" +marker_135: "111001101110001100111011000110100111" +marker_136: "111000110101001100111110101001001010" +marker_137: "111010000000011010001110101100010100" +marker_138: "111011000000011111000000010110010111" +marker_139: "111010101111001110000000001111011010" +marker_140: "111101100011101100100111110110001000" +marker_141: "111100110000011110011000001101111001" +marker_142: "111111100100101110111010100110111001" +marker_143: "101010111010010101111101100001101011" +marker_144: "110000001101000101100010010110101011" +marker_145: "000100111100111001111011101011100111" +marker_146: "010011101000000111111101011000010111" +marker_147: "010101101110000001110110001100100000" +marker_148: "011010100111000010001010010101000000" +marker_149: "011100101010100010011000101000011000" +marker_150: "100000010101110101000010111110000000" +marker_151: "110011110100110011000011110101011111" +marker_152: "110101101011101101100101100001100100" +marker_153: "111011001101001100010011101000110001" +marker_154: "111101010010000111110101001000000111" +marker_155: "111110010001111110100101110111110111" +marker_156: "000000000010010011110100011110100111" +marker_157: "000000000000100001001101100010000010" +marker_158: "000001000011110011000010111100101001" +marker_159: "000001000111101101010000001000010001" +marker_160: "000001100111101011100100110000011101" +marker_161: "000000001010101010010110100010100011" +marker_162: "000001001101000100111000111010010100" +marker_163: "000001010001000010101000000011011010" +marker_164: "000000010100000010110000000000000111" +marker_165: "000000011001110110011100111011100001" +marker_166: "000010000001000001010111111000111011" +marker_167: "000010000110101110010111101101100110" +marker_168: "000011101110100010111000011000001010" +marker_169: "000010110110110001110110101110011011" +marker_170: "000011111101110010111001100011001011" +marker_171: "000011111100101011001111001110100000" +marker_172: "000101000010010010011111110110011000" +marker_173: "000101000000011100100000000111111101" +marker_174: "000101010000100100010000110101010111" +marker_175: "000100110101110011010111001100000111" +marker_176: "000100010100011110011010101110110110" +marker_177: "000111001011100110101001001000111000" +marker_178: "000111001101110100000111011101100110" +marker_179: "000111110010111001111100001001001011" +marker_180: "000110010110011001000010010001110111" +marker_181: "000110010101011111010100110010000100" +marker_182: "000111111010100011110100111100000100" +marker_183: "000110111000001001000110111011011000" +marker_184: "000110111010111011100001000011111110" +marker_185: "001000101010010010110110001111001010" +marker_186: "001000101011111110010000000100101111" +marker_187: "001000110010110000010101101101000000" +marker_188: "001001010101101010101001011001101100" +marker_189: "001001111010010110101111101010010111" +marker_190: "001001011111010000001110010000100101" +marker_191: "001010000110011001010101110011011110" +marker_192: "001011000100001001111110000011100000" +marker_193: "001010101011100101111100101111010000" +marker_194: "001010010100011011100001110100100011" +marker_195: "001011011010011000101000010000010000" +marker_196: "001010111111101100100000100110100110" +marker_197: "001101101000110011010110011010111100" +marker_198: "001101001000011101110111011111000111" +marker_199: "001101001101110111101011100001000000" +marker_200: "001101111001000111110111011011110001" +marker_201: "001110100010001010001110000101110101" +marker_202: "001111100001001110111101010000001000" +marker_203: "001111001001100001000011110010100010" +marker_204: "001110010101100010011101000101111001" +marker_205: "001110010111010011011010111011101011" +marker_206: "001111110110110110111100011100110001" +marker_207: "001111010110101111000000010100001100" +marker_208: "001110011010101100100111010010010111" +marker_209: "010001100000001001001110001001011110" +marker_210: "010001101000001010111010000010111100" +marker_211: "010000101110100111001101010110101110" +marker_212: "010001001100100110110111101100111111" +marker_213: "010000001100011111010100000111101001" +marker_214: "010001101101001010110100110011001110" +marker_215: "010000110001100101010011010101101011" +marker_216: "010000010010001011100110110111011001" +marker_217: "010001110101001110100101100110101011" +marker_218: "010011100001111011110001111000001000" +marker_219: "010011100100101011000000100101100000" +marker_220: "010011100101111110101010000001101111" +marker_221: "010010101000110100110010100101000011" +marker_222: "010010010001010110010100101100111001" +marker_223: "010011010100110111011011011000100001" +marker_224: "010010111010011101100001111010000001" +marker_225: "010010011101010010000011110110001110" +marker_226: "010101100010100100001110111101101100" +marker_227: "010100110111111011010101111111111100" +marker_228: "010101011111010110100111101011111010" +marker_229: "010101011101010111101010011001001111" +marker_230: "010110000001101110101011000111011010" +marker_231: "010111101011111010010010011011011101" +marker_232: "010111110001000011111001100110110101" +marker_233: "010111010001111011011111101001011100" +marker_234: "010111110111000110001101111100000010" +marker_235: "010111011110000100011110010001101000" +marker_236: "011000000011001110111011001001000111" +marker_237: "011001000101100000011010111111100001" +marker_238: "011000111100100011011101101001110110" +marker_239: "011000011101101000111101100011111101" +marker_240: "011011100011101000100010101011111010" +marker_241: "011011100110000100000101101101110001" +marker_242: "011010101000100110101001111010001100" +marker_243: "011010101001011100100010010011110101" +marker_244: "011010110001001011000011100000000001" +marker_245: "011010110110100001001011001000101010" +marker_246: "011011111001010011000001010101111001" +marker_247: "011011011010011011111110101000001101" +marker_248: "011011111110101011001010010001010111" +marker_249: "011100000011110100111000101001100000" +marker_250: "011101100110110000110101111001111000" +marker_251: "011100000100101000001101111111110110" +marker_252: "011101010111100010101001110010000000" +marker_253: "011100010100101001110000000100111000" +marker_254: "011101010111111110001100101110111001" +marker_255: "011111000010001101101000001100110001" +marker_256: "011111001011010110100111110100110001" +marker_257: "011111001111100000101100111011011110" +marker_258: "011111110010010011100010001101001111" +marker_259: "011111110100011100101001100011011000" +marker_260: "100001101101100000000011110100011001" +marker_261: "100000111000101100011011101000010011" +marker_262: "100001111010001001111001110001011001" +marker_263: "100010100100001101100100100011001110" +marker_264: "100010001001001100111011010011001000" +marker_265: "100011110010000111011111010011100011" +marker_266: "100011011000010000110101011100101001" +marker_267: "100011011000100011010111000111111101" +marker_268: "100010011001111101111000111111001101" +marker_269: "100100100110101100010110011110011100" +marker_270: "100101001000111000100010111100010010" +marker_271: "100100001110010111100110001100010111" +marker_272: "100101101101100010000101001010100001" +marker_273: "100101010011100100111011101001000110" +marker_274: "100101010011110011111011010011011101" +marker_275: "100100010011111010101010000100100110" +marker_276: "100101110110111101011010101011111001" +marker_277: "100100011011001000101001111111011010" +marker_278: "100100011101001111111010011101100001" +marker_279: "100110100111000010000110110010001000" +marker_280: "100110001000111011001101000000110001" +marker_281: "100110001100011100010000100101111010" +marker_282: "100111011100101111101011010001100110" +marker_283: "101001000010100011110101101101101110" +marker_284: "101000110011011111110001011110010011" +marker_285: "101000110100010001000000111101011010" +marker_286: "101000010111111110101101100001011000" +marker_287: "101001111101001010010110001000111101" +marker_288: "101010000100010101110000001010111011" +marker_289: "101011100100100001111111101000001001" +marker_290: "101011000100111110110110110101101000" +marker_291: "101010001010100011010011100001010011" +marker_292: "101010011000101100001010110010111000" +marker_293: "101011011111111010001100110111100010" +marker_294: "101101001110111100101110001011101110" +marker_295: "101101111001100110001001110001110000" +marker_296: "101111100000110010100010000011101100" +marker_297: "101111000111000000100010011110101001" +marker_298: "101111101011110000101111100100011010" +marker_299: "101110001110100100001010100110000011" +marker_300: "101111010000101000110000111011001000" +marker_301: "110000100000001011100000111100110001" +marker_302: "110000100110101100110010111000110111" +marker_303: "110001101100101001000010011010101000" +marker_304: "110001110001111011101110011010001110" +marker_305: "110001110111110100101110100100010011" +marker_306: "110011100011110000100000011101000010" +marker_307: "110011000100101010111001110001010111" +marker_308: "110011101111011101100011110111001101" +marker_309: "110011010100001100100010110010100010" +marker_310: "110011111011011111001100000111010000" +marker_311: "110010011100111011001000001101011010" +marker_312: "110011111111001101001011011100010011" +marker_313: "110101100010111001111011011100001101" +marker_314: "110101000001011101001011001110110100" +marker_315: "110101111000110111111010100101111110" +marker_316: "110100011101100011110101010101010001" +marker_317: "110101011100111111100001110100111001" +marker_318: "110110100001011010101000110011001001" +marker_319: "110110000100110001000100100001011001" +marker_320: "110111001101100101110010100011101101" +marker_321: "110111110110011100010001011111101000" +marker_322: "110110111001100101111101111001100111" +marker_323: "110111011010101110001110001100011110" +marker_324: "111000000001100100001000010011001101" +marker_325: "111001100011011011011010010100100001" +marker_326: "111000101010110011000111100110110000" +marker_327: "111001001000110100100001011000100000" +marker_328: "111000101111111011010000110001010001" +marker_329: "111000010011101001111101000000101010" +marker_330: "111001111101000001011011100011100101" +marker_331: "111011000011000010011100011010110101" +marker_332: "111011001010101001001001110100100000" +marker_333: "111011101011001101111010110001000110" +marker_334: "111010001110000001100111001011100010" +marker_335: "111010101110010111010101001001001100" +marker_336: "111011010110101100011100001011000010" +marker_337: "111010111100100010101111000111010110" +marker_338: "111100100000010101100010110101000101" +marker_339: "111101100001100110111100111110110010" +marker_340: "111101101010001101011100011011011011" +marker_341: "111101001111000110111101000011110000" +marker_342: "111100010110101010011011010000110101" +marker_343: "111100011011001010010001001010011110" +marker_344: "111110100101010001011011111100110101" +marker_345: "111111100110111010000110011111000110" +marker_346: "111110010000110110111001010000110010" +marker_347: "111110010110100101100110001010111101" +marker_348: "111110110100000111001011010010000100" +marker_349: "111111010101011110111111100110000101" +marker_350: "111110111001100010010000011111100110" +marker_351: "111111111110101000100001110001100011" +marker_352: "101000111010010101101111010001010000" +marker_353: "101000011001100001101000001100000010" +marker_354: "000011110011011110000011001010110000" +marker_355: "001001101110110001001000001001110010" +marker_356: "010000011001100010111000101010001111" +marker_357: "010011101011010101000011100010100100" +marker_358: "011000111100010111100011011110111010" +marker_359: "011011100101100111011101111001101100" +marker_360: "100000001101010001011001111100001000" +marker_361: "100110000000100010001000100111111101" +marker_362: "101000110000011001100111101001101111" +marker_363: "000000100001100110100110000101000111" +marker_364: "000000100001010111001010010011100010" +marker_365: "000000000110100011001100001110011001" +marker_366: "000000001010000100010011111111101000" +marker_367: "000000101011100101010110011101010101" +marker_368: "000000101100011010111011010100110010" +marker_369: "000000101111001100011111000111011001" +marker_370: "000001110010101011000001011111100011" +marker_371: "000001110011011110001101100101110010" +marker_372: "000000010110111100011111111001110101" +marker_373: "000000010111011100110000000101010101" +marker_374: "000001111001010101110010010000011010" +marker_375: "000001111100100010100011100001101110" +marker_376: "000001011111111011111011111101111001" +marker_377: "000011000001010111110011000100000001" +marker_378: "000010100100010001100010111000101110" +marker_379: "000010000101111000110111111011101001" +marker_380: "000010000101001011011110000100101101" +marker_381: "000011000110011010001000000000111001" +marker_382: "000010001000110010111010010001111111" +marker_383: "000011001010110000100111000111100101" +marker_384: "000010001011001100111000000010111111" +marker_385: "000011001010001010100101110110010100" +marker_386: "000010001110001101010010110000000001" +marker_387: "000011101111111101000100111101011110" +marker_388: "000011101111111101011101111010101011" +marker_389: "000010110011010001101101110010011110" +marker_390: "000011010000100111111110101110110011" +marker_391: "000011110001000010101010100100100110" +marker_392: "000011010001111101100101101001111110" +marker_393: "000011111011000101011111101000000000" +marker_394: "000011011010001000000101001000110011" +marker_395: "000011011010111100100011110110111011" +marker_396: "000010111111000010100101111011100100" +marker_397: "000011011100100010011001111110111110" +marker_398: "000011111111110100110000001001110111" +marker_399: "000010111100011101011101010101100010" +marker_400: "000100100010111110100011000000011101" +marker_401: "000100100111010101001000011100100101" +marker_402: "000100000100111110101110011000100111" +marker_403: "000100001000110010001010111010001011" +marker_404: "000100001111001111110100001011101110" +marker_405: "000100110011011111101110011100000010" +marker_406: "000101110000101100100011111010110000" +marker_407: "000101010000001001101111000110111011" +marker_408: "000100011010000110101011110010110010" +marker_409: "000100111010011001001010110010001101" +marker_410: "000101111000111000110101110011010011" +marker_411: "000101011000101111100101100111011100" +marker_412: "000101111010011011111001011111010100" +marker_413: "000101011101110010100100101101000100" +marker_414: "000100011101111100000101010000111100" +marker_415: "000101011101001000000001100100110101" +marker_416: "000110000001111110101101111110101010" +marker_417: "000111000100000000001110101010111101" +marker_418: "000111100100110001011101001111010010" +marker_419: "000110000110111111110110011111111001" +marker_420: "000110000101011100110100101110001111" +marker_421: "000111100101011010001001111000110100" +marker_422: "000110101001010111010001100001000101" +marker_423: "000110001010011111111111000000101010" +marker_424: "000110001001111010110001110010011110" +marker_425: "000111001011001000001010011000001010" +marker_426: "000111001001001000110101100010000001" +marker_427: "000111001001001110110111110101101101" +marker_428: "000110101100101010111100010110000001" +marker_429: "000111001110001010101100101101011000" +marker_430: "000110110111100111101101000001100100" +marker_431: "000111110110101000111001000100110010" +marker_432: "000111011001100000111000011101010000" +marker_433: "001000000000110111000001000000111111" +marker_434: "001001100011010111010100111010000000" +marker_435: "001001100111010100101100001011111000" +marker_436: "001000000101001110000101100011110110" +marker_437: "001000101000100000011111011110100011" +marker_438: "001001110010110011111010111001010101" +marker_439: "001000010110101101001100010000111011" +marker_440: "001001011011110001100111000010111010" +marker_441: "001000011010001111101001101100001110" +marker_442: "001000011001011011110010100100011111" +marker_443: "001001111010001000101011100011001010" +marker_444: "001001111001111101001000001100101000" +marker_445: "001000111110001010111100110010010111" +marker_446: "001000011100001001010111111101000001" +marker_447: "001001111100111110111010111110001011" +marker_448: "001010100010111110111101111001001011" +marker_449: "001010100101010000111010100011001100" +marker_450: "001010101101000110111011100101111111" +marker_451: "001010001111111100111010011000110001" +marker_452: "001010110101010011000101101110011000" +marker_453: "001011010110000110101111000110101010" +marker_454: "001010111011110011011011001111100110" +marker_455: "001011011001111110011010000011010010" +marker_456: "001011111011101101110010011010100011" +marker_457: "001010111101100111001100111111110111" +marker_458: "001010011100011011011111100011101100" +marker_459: "001101000000110000111111110000110101" +marker_460: "001100000000001100011011001010001110" +marker_461: "001100000111000100011101111011000011" +marker_462: "001101000100110011011110101000101010" +marker_463: "001100100111101010001010100010111100" +marker_464: "001101100101011101100011110101110010" +marker_465: "001101001000110100110010101010100110" +marker_466: "001101101000000111111010101100010001" +marker_467: "001101101001100101101111000101011101" +marker_468: "001100101100110001101100001100011110" +marker_469: "001101101110000000000111010011010100" +marker_470: "001100110100000010001101100111000101" +marker_471: "001100110111110110101110101101101010" +marker_472: "001100010101111011111111001111010001" +marker_473: "001101011010010011111001001010001011" +marker_474: "001100111000011010100001110001100100" +marker_475: "001101011110100000011010100111101100" +marker_476: "001101111101100001011000101110100011" +marker_477: "001110000001010100110011010110011100" +marker_478: "001110000001101101100010011010101100" +marker_479: "001110100011011001010000110110111010" +marker_480: "001110001000100011010001111100101001" +marker_481: "001110101100110010001101110010000010" +marker_482: "001111001111110011111001000001111011" +marker_483: "001111001111011010001001001110011100" +marker_484: "001110110000111110101110110001111001" +marker_485: "001111010000101101011111111101010110" +marker_486: "001110010100100110000011101010100110" +marker_487: "001111010101110010101111111001010110" +marker_488: "001110110110111111010001111111100010" +marker_489: "001111010111001011100101110011100111" +marker_490: "001110111010010100011000001100000100" +marker_491: "001110111101011111010111011101001110" +marker_492: "010000100001010100000111100001100001" +marker_493: "010001000010101000110011110011000101" +marker_494: "010000000110100100111110001000001100" +marker_495: "010001000100110001010100111100011100" +marker_496: "010000000100111011001111000001010101" +marker_497: "010000001101111101001010110001000110" +marker_498: "010001101101101001100111000110101110" +marker_499: "010000110010000011101111101100101101" +marker_500: "010000010110001101111001111100100111" +marker_501: "010001110111111110101001001011001010" +marker_502: "010000111010100000100100011100111010" +marker_503: "010001011010111000000010101001100001" +marker_504: "010010000001110101111101011010110110" +marker_505: "010010000100010000101001000011100100" +marker_506: "010011000101110110110000111100100110" +marker_507: "010010000100111110100110010011000000" +marker_508: "010010001000000111110010001011011011" +marker_509: "010010001000110001101001100110101011" +marker_510: "010011001110011000100111110001010010" +marker_511: "010011110011110110100011110011010111" +marker_512: "010010010100100111111101101110001000" +marker_513: "010011010101100101101111000110010111" +marker_514: "010011110100111111010101001001111011" +marker_515: "010010111001010001100100111001001011" +marker_516: "010011011010000001101010101010011110" +marker_517: "010010111001001011010001111110110010" +marker_518: "010011111110110110000000101111101011" +marker_519: "010010011111101001101110101011110011" +marker_520: "010101000010000010101100101001110111" +marker_521: "010101000001100110100100100011101000" +marker_522: "010101100111010011011010000111111000" +marker_523: "010100100100011001000101110101001011" +marker_524: "010100001001100101110000110000000011" +marker_525: "010100101010001011000100011010100101" +marker_526: "010100001110100010101010010000100100" +marker_527: "010100101111001010101101010110011000" +marker_528: "010100101101101011101011111101101010" +marker_529: "010101010010111011111000111000100010" +marker_530: "010100010100000101100000101101100010" +marker_531: "010101010110100000000110000101011000" +marker_532: "010100110100101001111110010010111101" +marker_533: "010100110110101111010011111000001011" +marker_534: "010101110111001010000010110100100111" +marker_535: "010101111000000111010101010110000010" +marker_536: "010101111010010011000011010010101000" +marker_537: "010100011001011110101111100101001000" +marker_538: "010101111000111100010111011100111011" +marker_539: "010101011100001011100000110011110000" +marker_540: "010101111111011010100100111001010001" +marker_541: "010111000000010101011110000000100101" +marker_542: "010111100011100011001100010011010000" +marker_543: "010111100110010101100110000111110101" +marker_544: "010110101010010111101011011110110101" +marker_545: "010111101010110101010001111000001101" +marker_546: "010110001011001110000101111111000001" +marker_547: "010110101100010111111000011011100000" +marker_548: "010110001111000101101011011000000000" +marker_549: "010110110011000010110001001000001000" +marker_550: "010111110011010011101111111001111011" +marker_551: "010110010100000001110011011001101001" +marker_552: "010111010110100100010011101011010001" +marker_553: "010110010101001010111001111000111011" +marker_554: "010111010100011011110100101011000010" +marker_555: "010111111000000010011101001011101000" +marker_556: "010111111110000011111011010100001110" +marker_557: "010111111110101111010011110101110000" +marker_558: "011001000110100110000110011100110101" +marker_559: "011000001011110011101000110011011000" +marker_560: "011001001001111011100011000001010110" +marker_561: "011000101101010010100101001001011101" +marker_562: "011000101111011010001111100011100011" +marker_563: "011001010110000001001000001001000111" +marker_564: "011000111011010000001100100100011000" +marker_565: "011000111001111111101001100110011101" +marker_566: "011001011110110111100101100111000111" +marker_567: "011001111110101111100111011100000100" +marker_568: "011010100000000111001000100111010100" +marker_569: "011010000011110111110010000010110000" +marker_570: "011010000001100001100110011111011101" +marker_571: "011011000101010001100001010100001111" +marker_572: "011010000100101100011000111101011101" +marker_573: "011010000100111100010101100000010000" +marker_574: "011011100110111011110100010110010000" +marker_575: "011011101001100010000000001001100101" +marker_576: "011011101001000001100011001100110011" +marker_577: "011011101111000111100100000010100111" +marker_578: "011011001100001100100100111111000000" +marker_579: "011010010000000001010001010110111111" +marker_580: "011010110100000000001110111110101100" +marker_581: "011010110111110010110101010001000111" +marker_582: "011010011010110011110101110010100010" +marker_583: "011010011010011101100110111101111100" +marker_584: "011011011110101100110010100011001011" +marker_585: "011101000001011111111100011011101100" +marker_586: "011100000110000110101010101110010100" +marker_587: "011101000100001100010001010100100001" +marker_588: "011100001011100110111011100010101001" +marker_589: "011101101001010000111110111001010100" +marker_590: "011101101011110001100000000100101001" +marker_591: "011100001001101100000111101001010100" +marker_592: "011101001000101110111111000000010011" +marker_593: "011100101111100001011101010011111011" +marker_594: "011101101101001111011010101001111111" +marker_595: "011101010010010011010000111110011001" +marker_596: "011101010011110010111100001100000110" +marker_597: "011101110000001111001001110101011111" +marker_598: "011100010100010100111011001010100101" +marker_599: "011100110110110000011001110111110001" +marker_600: "011100010100100011101110001011001010" +marker_601: "011100110110111100100010011111000000" +marker_602: "011100111001000101100011101011101110" +marker_603: "011101011000001110011110100011101001" +marker_604: "011101111011111101100100011110110110" +marker_605: "011100111110010110111101000100101010" +marker_606: "011100111100111101101000100000000011" +marker_607: "011100011111011101001010000010100000" +marker_608: "011110000010110111001111001001110110" +marker_609: "011111000000001000111010100111010111" +marker_610: "011110100101110011001110001110100100" +marker_611: "011110100111001000010000000001110111" +marker_612: "011111101011001000100100110100001011" +marker_613: "011110001111110111000101110101010010" +marker_614: "011111101110100001110101100111101001" +marker_615: "011110110001110000101011010001001110" +marker_616: "011111110000010010100000111110100010" +marker_617: "011110110010011101001110111010110011" +marker_618: "011111010010011001111111011110100001" +marker_619: "011111110011001010101001010111101010" +marker_620: "011110011011010010101010101010100111" +marker_621: "011111011011000011010111001001010011" +marker_622: "011111111001001101001111000011000010" +marker_623: "011111011111110000010000010000100010" +marker_624: "011111011101010111011000110100111111" +marker_625: "100000000011100000100000011001111011" +marker_626: "100001000001000110111001110101100011" +marker_627: "100000000000001111111100011001001010" +marker_628: "100000100011101100001111101110111010" +marker_629: "100001100010101010100111011101011010" +marker_630: "100001000001101101011001010010110111" +marker_631: "100000100100010000110001110010001010" +marker_632: "100000100101100111011000011101010011" +marker_633: "100001000100100000011111110111001110" +marker_634: "100000101011010111100101011010110100" +marker_635: "100000001011011100001010101101110000" +marker_636: "100001101011001001010000000110011010" +marker_637: "100000001100110000101111011110111000" +marker_638: "100001101111110110110110011001001000" +marker_639: "100000010111100100111100001111101001" +marker_640: "100001010110000010000100100001011011" +marker_641: "100000110110001000010110100100100101" +marker_642: "100000111000000011100101110111011111" +marker_643: "100001111010000001001100110010110010" +marker_644: "100001111011100010001010101101001101" +marker_645: "100011100000001000000110001110000100" +marker_646: "100011000011011001111101101011000111" +marker_647: "100011000100000111101001001011000010" +marker_648: "100011001001100000111011101011111100" +marker_649: "100010001111010001101011010011111011" +marker_650: "100011110010110011000101110011000100" +marker_651: "100011010011011101111110011100110011" +marker_652: "100010110100010101001111001111110111" +marker_653: "100011010101011000100101100101100000" +marker_654: "100010111011111100011000001110010010" +marker_655: "100011011010011001000011000010010100" +marker_656: "100011011101000011001010101001101000" +marker_657: "100010111111011010011000010011110100" +marker_658: "100100000001001010011001101001010100" +marker_659: "100101100010111000000100100001110101" +marker_660: "100100100101110010100011110101000000" +marker_661: "100100101000010110001111011101111010" +marker_662: "100101001010100100111101010001011010" +marker_663: "100100010010000011110011001100110010" +marker_664: "100100010010011101101101010011110011" +marker_665: "100101110011001111111101111010011010" +marker_666: "100101110100100011110011100000010011" +marker_667: "100101111001111110100000000001101001" +marker_668: "100100111101000000111111110101111100" +marker_669: "100101011111110011010000011011100000" +marker_670: "100100111100001110110010000010110001" +marker_671: "100100011100001101000010000000011110" +marker_672: "100111100000101011010100110100001001" +marker_673: "100111100011111000011000010001101000" +marker_674: "100110100110000101111010110111001001" +marker_675: "100110001100100010000111011001011101" +marker_676: "100110001100000111011111001100001001" +marker_677: "100111101111100100101000111110101100" +marker_678: "100111101111000010101011000101100001" +marker_679: "100110001111101101110101000010011101" +marker_680: "100111110010000000000001001101010100" +marker_681: "100110010001001001111000000001111100" +marker_682: "100110111000001111110101011111101011" +marker_683: "100110011111100111001000101011010101" +marker_684: "100111011110010000101110111011000010" +marker_685: "100110111101101110010000110100100011" +marker_686: "100111111111111010000100100110011111" +marker_687: "101000100100001010001100110101111001" +marker_688: "101001001100110100011001001101010111" +marker_689: "101001101101010110100010000110010000" +marker_690: "101000001101111111000000101100000110" +marker_691: "101000110011000110110100100100000100" +marker_692: "101001110010000010000110001110101111" +marker_693: "101001110011100000101101001010001101" +marker_694: "101000110011111111001100110111001110" +marker_695: "101001010011111010110011100001001011" +marker_696: "101000010111000000011010101111010111" +marker_697: "101001110110011101100101001101111001" +marker_698: "101001010111101101100110101011100100" +marker_699: "101000011101010100011101100100110010" +marker_700: "101000111111100011101001100110111110" +marker_701: "101001011101001110000011110110100011" +marker_702: "101001011101011011101011101111000110" +marker_703: "101010100010011011100011100101111001" +marker_704: "101011100001111011001001001111111100" +marker_705: "101011000111011110111000111011010010" +marker_706: "101010101010100111101110010011011111" +marker_707: "101010101000000001111001101010100110" +marker_708: "101011101100001001100000110010100001" +marker_709: "101010010011101010011000011000101011" +marker_710: "101010110001001001010001110010001100" +marker_711: "101011010110011011011011110110001101" +marker_712: "101011010101001011011101010010100001" +marker_713: "101010011011011001110001000100001000" +marker_714: "101011011011101011100010001101010000" +marker_715: "101011011001011101000001110111111100" +marker_716: "101010111111001110110110001011000111" +marker_717: "101101100010001001101100011100011100" +marker_718: "101101000001111000100101011110100111" +marker_719: "101101100011011111000011100010100011" +marker_720: "101100000100110011010100001101110000" +marker_721: "101100100111111110001011000001010011" +marker_722: "101100001010110111011000001000100101" +marker_723: "101101001001101110000010001010111011" +marker_724: "101100001101001101001110110000100011" +marker_725: "101100010011110101111110110000111110" +marker_726: "101100010000011010100100011000111110" +marker_727: "101100110010101101110100001111111110" +marker_728: "101101110001111111010110010001101111" +marker_729: "101100010110111011110001111101000101" +marker_730: "101100010111111001010011100010101110" +marker_731: "101101110110001011011111001101110111" +marker_732: "101100011010100111111000100101001001" +marker_733: "101100111011011111011001110100100100" +marker_734: "101100111110111010111011010011000110" +marker_735: "101110000010110010100101010100100100" +marker_736: "101110000001010000001101111010111111" +marker_737: "101111000001100111011100110001110111" +marker_738: "101111000101010000100110101110010110" +marker_739: "101111100110011100110111110001000101" +marker_740: "101110001111101011101000110100110101" +marker_741: "101111101100001000011010001101111000" +marker_742: "101110110001100011001111101001001011" +marker_743: "101111010000000101111110111101101101" +marker_744: "101111010010001000101111110100100111" +marker_745: "101111010000001001010101100001010101" +marker_746: "101110010111001001001110011000000101" +marker_747: "101111010111011101011100000101101111" +marker_748: "101110011000100010101100001011100001" +marker_749: "101111111010000000100110011001110101" +marker_750: "101110011000001010010110101010000110" +marker_751: "101111011000011100010111000110001010" +marker_752: "101111111011111011101111001011010111" +marker_753: "101111011111101010011111000000000111" +marker_754: "110000100111000000110101101110111000" +marker_755: "110001000110110000000101101011001101" +marker_756: "110001000111100101010100110111000011" +marker_757: "110000100110101001010001000011011000" +marker_758: "110001101010010010011111011010000100" +marker_759: "110000001001111000101100111010110100" +marker_760: "110001101001001000100001010010011101" +marker_761: "110001001011101010000011110011111000" +marker_762: "110001101110011110000101010000111011" +marker_763: "110001101101011110101111010001100100" +marker_764: "110001010011011001010101010011011011" +marker_765: "110000111001001111111111000011010111" +marker_766: "110000011111010101110000101001011010" +marker_767: "110011000011100101110001110001010000" +marker_768: "110010000000001010001001010010010010" +marker_769: "110010000111110001100100010010100101" +marker_770: "110010100110011111100001000011010111" +marker_771: "110010001001100111100111010000100010" +marker_772: "110010001010101010110010000100000101" +marker_773: "110011001010011011010101100111110011" +marker_774: "110010101110010110000110111110111110" +marker_775: "110010101101100101111100001100011111" +marker_776: "110011101110010011001010000011100110" +marker_777: "110010110010110110100100001100101100" +marker_778: "110010110101011111010110100000100010" +marker_779: "110010011001000000100001101100010000" +marker_780: "110010011000001001011111101100001010" +marker_781: "110010111001111011010100001001000111" +marker_782: "110011011000011010101011100111011101" +marker_783: "110010011100100110110000011101110101" +marker_784: "110010011111101000011111011000110010" +marker_785: "110010111111011101000000000001101001" +marker_786: "110011011101101000001101000111001111" +marker_787: "110100000000101110000010010100111111" +marker_788: "110101000011101111001111110101101111" +marker_789: "110101100110001010101011110100011011" +marker_790: "110101000110011011001000001110101111" +marker_791: "110100010010000000011100011110001010" +marker_792: "110100110011100101000001110000111001" +marker_793: "110100010000011110100000111111010100" +marker_794: "110100011001010100111010000011100010" +marker_795: "110101111011110101000010000111011101" +marker_796: "110101111100000010100110010100001101" +marker_797: "110101111110010110001101111101011100" +marker_798: "110101111100010101010011111101100111" +marker_799: "110101011111111001110000101110001000" +marker_800: "110110000000110010111001101111100110" +marker_801: "110111100011010010111010001001010110" +marker_802: "110111000000111011000110100010111110" +marker_803: "110111100000001111110111101001001011" +marker_804: "110110100101110100001011100010100010" +marker_805: "110110000111000111111001011111111111" +marker_806: "110111001011110110000010111001110010" +marker_807: "110111001011000001011010111001010101" +marker_808: "110110101001001111011110010100000000" +marker_809: "110110101011011111110001101111111000" +marker_810: "110111101001111100000010001100101110" +marker_811: "110110101100010000001101010101010000" +marker_812: "110111001100010110101011100000001110" +marker_813: "110110101100001010110010001110101010" +marker_814: "110110101101101001011000111111010000" +marker_815: "110110010010010110001110101010000001" +marker_816: "110111010000010101110110001110111110" +marker_817: "110111010010111010011001000010001100" +marker_818: "110110010101010101101000110001110101" +marker_819: "110110110101000001101101010011000011" +marker_820: "110111110110100010101010001110001000" +marker_821: "110110110100001010000111101001110101" +marker_822: "110110111000000100101000101100111101" +marker_823: "110110011010001111000010111110101101" +marker_824: "110111011011001100111000110100111000" +marker_825: "110110011100101001111011100110110001" +marker_826: "110110111111011010011110101100000111" +marker_827: "111000100000100001101100101011111000" +marker_828: "111000000001101110101011100101100100" +marker_829: "111000000100100001110011111100110000" +marker_830: "111001000111010110101001010110111110" +marker_831: "111001101000000011101100011101001001" +marker_832: "111000101010111101110110010010000111" +marker_833: "111000001010001011001000000100011101" +marker_834: "111000101100101101110001010100001100" +marker_835: "111000001101001001001001110001011111" +marker_836: "111000010000110011000010100000101001" +marker_837: "111000010111111101000100001101000011" +marker_838: "111001111010110101000101101100011110" +marker_839: "111000011011011001011010100111111001" +marker_840: "111001111111110000100000010000011100" +marker_841: "111011100011001101000001001110000001" +marker_842: "111011100111110000110110001100110100" +marker_843: "111011000111000001111011111110001010" +marker_844: "111010000111101100111011111001101110" +marker_845: "111010001001010111101000001110010001" +marker_846: "111011101010110000001001011111010101" +marker_847: "111011001010000111001001001101110100" +marker_848: "111010001001011110111101110001010101" +marker_849: "111010001100110000010010000111010000" +marker_850: "111011101100000100011101011010011000" +marker_851: "111011010000011111111111110110111010" +marker_852: "111011010110100111110011001101101011" +marker_853: "111011010111011000010100101101011100" +marker_854: "111011111000010000100001110100010111" +marker_855: "111010111111010111011010011110000010" +marker_856: "111010011111100111100101110101101101" +marker_857: "111010111101001100001111100100011001" +marker_858: "111010011101101111110001001000001001" +marker_859: "111101000010100110001011011011011000" +marker_860: "111101100000101000110100001000100101" +marker_861: "111101000101100001010101100110110001" +marker_862: "111100100111011000110111011000010011" +marker_863: "111101000100101100001010111000000110" +marker_864: "111101100110111010000001010010111100" +marker_865: "111101100100001100011101010011000110" +marker_866: "111101000101011100100010111011100001" +marker_867: "111101001001100101010011111001011011" +marker_868: "111100001111110000101111000110110101" +marker_869: "111101110000100100011110000010011100" +marker_870: "111101110010011001010111110000100000" +marker_871: "111100011000010100011011110001101101" +marker_872: "111100111000100001100010111010000001" +marker_873: "111101111010100110110111111010100110" +marker_874: "111101111000101010001010010111000010" +marker_875: "111100111110110111000010000101010010" +marker_876: "111101011111010110010100111100100100" +marker_877: "111110000000111100111110000011110100" +marker_878: "111111001011111001100011011111011110" +marker_879: "111110001110110100100001010010011011" +marker_880: "111110101101100011000010100000001110" +marker_881: "111111101110010100000101100111000110" +marker_882: "111111101100010011111101000110111000" +marker_883: "111110101101001011100001000111110100" +marker_884: "111111001100001111100110011100110010" +marker_885: "111110010011111110100010011011101011" +marker_886: "111110110101011011000010010111100011" +marker_887: "111111110100111010001100101000101111" +marker_888: "111111110100111101110000111000100100" +marker_889: "111110011011000100101010001101001001" +marker_890: "111111111000011110010010011110000001" +marker_891: "111110011100001110111100000010011010" +marker_892: "111111111100101000011001110100011100" +marker_893: "111111111110111100010111101001011010" +marker_894: "111111011111111011011010100011000001" +marker_895: "000001100100001011101001000010010111" +marker_896: "000000110010010000100100010001101101" +marker_897: "000001110101111001011100100001111100" +marker_898: "000001111000100001000010111110100110" +marker_899: "000010100000011110110010000110111011" +marker_900: "000100001001010011011100111100011110" +marker_901: "000101101010001001011010101100001111" +marker_902: "000100001111110111001011011011011110" +marker_903: "000100010011010010101100101000101100" +marker_904: "000100011010011000111110000100000001" +marker_905: "000111100101100000101100111000100010" +marker_906: "000110000110001100111010100010110000" +marker_907: "000110100110001100000001001011111101" +marker_908: "000110101111000101000111110011101111" +marker_909: "000110010110110010110001100010110001" +marker_910: "000111011001010111001111010111001100" +marker_911: "000110011001111000111000100100100010" +marker_912: "000111111111110001010110001000111010" +marker_913: "001001000001101100101001101100110011" +marker_914: "001001101110011110001000100001010000" +marker_915: "001000010000011100110110101111000001" +marker_916: "001010000100110101000110010101101010" +marker_917: "001011101110110011100011010001011000" +marker_918: "001011010100111111100001010011010100" +marker_919: "001011011000101000101000001111000111" +marker_920: "001101001111100000111110001101110001" +marker_921: "001110000110001101011101011111011000" +marker_922: "001111111010001000011100110001001100" +marker_923: "010000101101110110010111101011101110" +marker_924: "010001001101111100010010110101101011" +marker_925: "010000010011101011001101111011001000" +marker_926: "010000011100000011011011010010010100" +marker_927: "010011001011010000000000110010001101" +marker_928: "010010010010001101001000100101010010" +marker_929: "010100100011011110111001010111000110" +marker_930: "010100100101000100111000110111011010" +marker_931: "010111100111000110010010010000010011" +marker_932: "010111001011001001110001111010111101" +marker_933: "010110111110111000110111001101100110" +marker_934: "011000000000010110000100000101010010" +marker_935: "011001000000100010000000001100111000" +marker_936: "011011100010100010000111100011000011" +marker_937: "011011000101010101010100101101010111" +marker_938: "011010001011101011111110010001100001" +marker_939: "011010001011001101010101110010100111" +marker_940: "011101011001110010011011011001101001" +marker_941: "011111000000101111001000000010100000" +marker_942: "011111100101100101101000110001001001" +marker_943: "011110000110111100111101001101000101" +marker_944: "011110001100000110111111111111111010" +marker_945: "011110101101101010111001010001011010" +marker_946: "100000000011110001111011100111000000" +marker_947: "100001110001010001011000111110010111" +marker_948: "100000110001101100000101101001011101" +marker_949: "100010000011101110110100011001110100" +marker_950: "100011001010100110001000100111000000" +marker_951: "100011101011000100000011000110101011" +marker_952: "100011110010011110111111001101100100" +marker_953: "100011110001011010110011110010100000" +marker_954: "100101000001100011011110010010100000" +marker_955: "100100110100010100100100110001010000" +marker_956: "100111001111110110011100110110000101" +marker_957: "100110110010001000110111011110001101" +marker_958: "100110011111101010100011110100010110" +marker_959: "101000101001111100011100010101000011" +marker_960: "101011000100111101011011000110101011" +marker_961: "101011001011111101101101001101100110" +marker_962: "101010011011100101001100010000001000" +marker_963: "101101100010100011101001000000101100" +marker_964: "101101000110110111011010110111100000" +marker_965: "101100100110111011110110000010100001" +marker_966: "101100110010010110011001011010011110" +marker_967: "101100110101000000101000000100010101" +marker_968: "101111100001110000011011001110110110" +marker_969: "101111000111111101010101011000111110" +marker_970: "101111001010111111100110100011010101" +marker_971: "101111010010010110010010100011000100" +marker_972: "110001000001101111010110101101110001" +marker_973: "110001100110001110111110111111001110" +marker_974: "110001100101011010000010000100111101" +marker_975: "110001101000101101001001001001001010" +marker_976: "110000010011110111001110101111100010" +marker_977: "110001010001100101101101011011010001" +marker_978: "110001110100110100111101111011111011" +marker_979: "110000010101101000101011110111001001" +marker_980: "110010100010001101110010001000011100" +marker_981: "110011111100011111110100110101011001" +marker_982: "110100000011000100100111111000100110" +marker_983: "110101000111011101010100000011100000" +marker_984: "110100011000011000110001010110100010" +marker_985: "110110110100110001100100011110101011" +marker_986: "110110111000010010000111100100001000" +marker_987: "110111111101111000000110011100000000" +marker_988: "111000100010100110111010011000000000" +marker_989: "111000010100000011100000100011010110" +marker_990: "111000011001101010010000101001010010" +marker_991: "111001111111001011000000111110101001" +marker_992: "111011101010110110111110100000111000" +marker_993: "111100000001110011110010011111000001" +marker_994: "111101110110010110101000001001100100" +marker_995: "111101111110110011000011101001001101" +marker_996: "111110000010110101010100011100010100" +marker_997: "111111101000010110001111110011011011" +marker_998: "111110001110001101011011000010110110" +marker_999: "111111101101011000111110000111111111" diff --git a/test/OpenCvSharp.Tests/_data/image/8bpp_indexed.png b/test/OpenCvSharp.Tests/_data/image/8bpp_indexed.png new file mode 100644 index 000000000..8175260f7 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/8bpp_indexed.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/Dnn/MNIST_5.png b/test/OpenCvSharp.Tests/_data/image/Dnn/MNIST_5.png new file mode 100644 index 000000000..7d0a438f2 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/Dnn/MNIST_5.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/Dnn/MNIST_9.png b/test/OpenCvSharp.Tests/_data/image/Dnn/MNIST_9.png new file mode 100644 index 000000000..3565e656a Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/Dnn/MNIST_9.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/Readme.md b/test/OpenCvSharp.Tests/_data/image/ETHZ/Readme.md new file mode 100644 index 000000000..2f756c274 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/image/ETHZ/Readme.md @@ -0,0 +1,3 @@ +# seq03-img-left +This folder image files are downloaded and extracted from https://data.vision.ee.ethz.ch/cvl/aess/cvpr2008/seq03-img-left.tar.gz. +This folder includes only first 21 images. diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000000_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000000_0.png new file mode 100644 index 000000000..ac3622377 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000000_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000001_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000001_0.png new file mode 100644 index 000000000..545a754cc Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000001_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000002_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000002_0.png new file mode 100644 index 000000000..7680d7a1c Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000002_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000003_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000003_0.png new file mode 100644 index 000000000..09d62af91 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000003_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000004_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000004_0.png new file mode 100644 index 000000000..ae96a3d43 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000004_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000005_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000005_0.png new file mode 100644 index 000000000..8aa336875 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000005_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000006_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000006_0.png new file mode 100644 index 000000000..3a415324e Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000006_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000007_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000007_0.png new file mode 100644 index 000000000..076c41aff Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000007_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000008_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000008_0.png new file mode 100644 index 000000000..9c21ea093 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000008_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000009_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000009_0.png new file mode 100644 index 000000000..62f3a3e9e Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000009_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000010_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000010_0.png new file mode 100644 index 000000000..0efa8d3ef Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000010_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000011_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000011_0.png new file mode 100644 index 000000000..2ab1311b8 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000011_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000012_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000012_0.png new file mode 100644 index 000000000..6b8a5ae30 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000012_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000013_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000013_0.png new file mode 100644 index 000000000..fa74ef50d Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000013_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000014_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000014_0.png new file mode 100644 index 000000000..d807bc96d Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000014_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000015_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000015_0.png new file mode 100644 index 000000000..11e953999 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000015_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000016_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000016_0.png new file mode 100644 index 000000000..8142d1928 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000016_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000017_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000017_0.png new file mode 100644 index 000000000..ba97a1d70 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000017_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000018_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000018_0.png new file mode 100644 index 000000000..51e9b4089 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000018_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000019_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000019_0.png new file mode 100644 index 000000000..c4ea82dd4 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000019_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000020_0.png b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000020_0.png new file mode 100644 index 000000000..38c374ef7 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/ETHZ/seq03-img-left/image_00000020_0.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/abbey_road.jpg b/test/OpenCvSharp.Tests/_data/image/abbey_road.jpg new file mode 100644 index 000000000..76068d229 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/abbey_road.jpg differ diff --git a/test/OpenCvSharp.Tests/_data/image/alphabet.png b/test/OpenCvSharp.Tests/_data/image/alphabet.png new file mode 100644 index 000000000..b28da9b40 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/alphabet.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/building_mask.bmp b/test/OpenCvSharp.Tests/_data/image/building_mask.bmp new file mode 100644 index 000000000..3e471f596 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/building_mask.bmp differ diff --git a/test/OpenCvSharp.Tests/_data/image/calibration/00.jpg b/test/OpenCvSharp.Tests/_data/image/calibration/00.jpg new file mode 100644 index 000000000..995d0a8d1 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/calibration/00.jpg differ diff --git a/test/OpenCvSharp.Tests/_data/image/empty.gif b/test/OpenCvSharp.Tests/_data/image/empty.gif new file mode 100644 index 000000000..002bf57fe Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/empty.gif differ diff --git a/test/OpenCvSharp.Tests/_data/image/houghp.png b/test/OpenCvSharp.Tests/_data/image/houghp.png new file mode 100644 index 000000000..da271f333 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/houghp.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/imageText.png b/test/OpenCvSharp.Tests/_data/image/imageText.png new file mode 100644 index 000000000..adfad5df2 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/imageText.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/imageTextR.png b/test/OpenCvSharp.Tests/_data/image/imageTextR.png new file mode 100644 index 000000000..7f90abdf0 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/imageTextR.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/issue/821.jpg b/test/OpenCvSharp.Tests/_data/image/issue/821.jpg new file mode 100644 index 000000000..ded09344d Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/issue/821.jpg differ diff --git a/test/OpenCvSharp.Tests/_data/image/mandrill.png b/test/OpenCvSharp.Tests/_data/image/mandrill.png new file mode 100644 index 000000000..1a43c2b4d Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/mandrill.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/markers_6x6_250.png b/test/OpenCvSharp.Tests/_data/image/markers_6x6_250.png new file mode 100644 index 000000000..a0c4c964b Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/markers_6x6_250.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/multipage_p1.tif b/test/OpenCvSharp.Tests/_data/image/multipage_p1.tif new file mode 100644 index 000000000..d4b8d1f7f Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/multipage_p1.tif differ diff --git a/test/OpenCvSharp.Tests/_data/image/multipage_p2.tif b/test/OpenCvSharp.Tests/_data/image/multipage_p2.tif new file mode 100644 index 000000000..651fbedee Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/multipage_p2.tif differ diff --git a/test/OpenCvSharp.Tests/_data/image/peilin_plane.png b/test/OpenCvSharp.Tests/_data/image/peilin_plane.png new file mode 100644 index 000000000..1ef2a28d3 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/peilin_plane.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/qr.png b/test/OpenCvSharp.Tests/_data/image/qr.png new file mode 100644 index 000000000..fdb060f33 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/qr.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/qr_multi.png b/test/OpenCvSharp.Tests/_data/image/qr_multi.png new file mode 100644 index 000000000..3a07253b9 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/qr_multi.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/qr_multibyte_letters.png b/test/OpenCvSharp.Tests/_data/image/qr_multibyte_letters.png new file mode 100644 index 000000000..01d1f5919 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/qr_multibyte_letters.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/qr_singlebyte_letters.png b/test/OpenCvSharp.Tests/_data/image/qr_singlebyte_letters.png new file mode 100644 index 000000000..80afeea77 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/qr_singlebyte_letters.png differ diff --git a/test/OpenCvSharp.Tests/_data/image/space_shuttle.jpg b/test/OpenCvSharp.Tests/_data/image/space_shuttle.jpg new file mode 100644 index 000000000..412a91969 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/image/space_shuttle.jpg differ diff --git a/test/OpenCvSharp.Tests/_data/model/FSRCNN_x4.pb b/test/OpenCvSharp.Tests/_data/model/FSRCNN_x4.pb new file mode 100644 index 000000000..64b4911c7 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/model/FSRCNN_x4.pb differ diff --git a/test/OpenCvSharp.Tests/_data/model/MNISTTest_tensorflow.pb b/test/OpenCvSharp.Tests/_data/model/MNISTTest_tensorflow.pb new file mode 100644 index 000000000..fb5b9eceb Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/model/MNISTTest_tensorflow.pb differ diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/ambigs.train b/test/OpenCvSharp.Tests/_data/tessdata/configs/ambigs.train new file mode 100644 index 000000000..23035a190 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/ambigs.train @@ -0,0 +1,7 @@ +tessedit_ambigs_training 1 +load_freq_dawg 0 +load_punc_dawg 0 +load_system_dawg 0 +load_number_dawg 0 +ambigs_debug_level 3 +load_fixed_length_dawgs 0 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/api_config b/test/OpenCvSharp.Tests/_data/tessdata/configs/api_config new file mode 100644 index 000000000..5cd6ec031 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/api_config @@ -0,0 +1 @@ +tessedit_zero_rejection T diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/bigram b/test/OpenCvSharp.Tests/_data/tessdata/configs/bigram new file mode 100644 index 000000000..5d6c2d061 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/bigram @@ -0,0 +1,5 @@ +load_bigram_dawg True +tessedit_enable_bigram_correction True +tessedit_bigram_debug 3 +save_raw_choices True +save_alt_choices True diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/box.train b/test/OpenCvSharp.Tests/_data/tessdata/configs/box.train new file mode 100644 index 000000000..03cf56326 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/box.train @@ -0,0 +1,14 @@ +disable_character_fragments T +file_type .bl +textord_fast_pitch_test T +tessedit_single_match 0 +tessedit_zero_rejection T +tessedit_minimal_rejection F +tessedit_write_rep_codes F +il1_adaption_test 1 +edges_children_fix F +edges_childarea 0.65 +edges_boxarea 0.9 +tessedit_resegment_from_boxes T +tessedit_train_from_boxes T +textord_no_rejects T diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/box.train.stderr b/test/OpenCvSharp.Tests/_data/tessdata/configs/box.train.stderr new file mode 100644 index 000000000..6fc51fdd5 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/box.train.stderr @@ -0,0 +1,15 @@ +file_type .bl +#tessedit_use_nn F +textord_fast_pitch_test T +tessedit_single_match 0 +tessedit_zero_rejection T +tessedit_minimal_rejection F +tessedit_write_rep_codes F +il1_adaption_test 1 +edges_children_fix F +edges_childarea 0.65 +edges_boxarea 0.9 +tessedit_resegment_from_boxes T +tessedit_train_from_boxes T +#textord_repeat_extraction F +textord_no_rejects T diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/digits b/test/OpenCvSharp.Tests/_data/tessdata/configs/digits new file mode 100644 index 000000000..6a329f892 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/digits @@ -0,0 +1 @@ +tessedit_char_whitelist 0123456789-. diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/hocr b/test/OpenCvSharp.Tests/_data/tessdata/configs/hocr new file mode 100644 index 000000000..72f83e89c --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/hocr @@ -0,0 +1 @@ +tessedit_create_hocr 1 \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/inter b/test/OpenCvSharp.Tests/_data/tessdata/configs/inter new file mode 100644 index 000000000..252f1a171 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/inter @@ -0,0 +1,2 @@ +interactive_display_mode T +tessedit_display_outwords T diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/kannada b/test/OpenCvSharp.Tests/_data/tessdata/configs/kannada new file mode 100644 index 000000000..c6ac10578 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/kannada @@ -0,0 +1,4 @@ +textord_skewsmooth_offset 8 +textord_skewsmooth_offset2 8 +textord_merge_desc 0.5 +textord_no_rejects 1 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/linebox b/test/OpenCvSharp.Tests/_data/tessdata/configs/linebox new file mode 100644 index 000000000..bd9c114df --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/linebox @@ -0,0 +1,2 @@ +tessedit_resegment_from_line_boxes 1 +tessedit_make_boxes_from_boxes 1 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/logfile b/test/OpenCvSharp.Tests/_data/tessdata/configs/logfile new file mode 100644 index 000000000..a160f9be2 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/logfile @@ -0,0 +1 @@ +debug_file tesseract.log diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/makebox b/test/OpenCvSharp.Tests/_data/tessdata/configs/makebox new file mode 100644 index 000000000..3d90ac26f --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/makebox @@ -0,0 +1 @@ +tessedit_create_boxfile 1 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/quiet b/test/OpenCvSharp.Tests/_data/tessdata/configs/quiet new file mode 100644 index 000000000..35b59a9d4 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/quiet @@ -0,0 +1 @@ +debug_file /dev/null diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/rebox b/test/OpenCvSharp.Tests/_data/tessdata/configs/rebox new file mode 100644 index 000000000..f8342b4c2 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/rebox @@ -0,0 +1,2 @@ +tessedit_resegment_from_boxes 1 +tessedit_make_boxes_from_boxes 1 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/strokewidth b/test/OpenCvSharp.Tests/_data/tessdata/configs/strokewidth new file mode 100644 index 000000000..e95b59263 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/strokewidth @@ -0,0 +1,12 @@ +textord_show_blobs 0 +textord_debug_tabfind 3 +textord_tabfind_show_partitions 1 +textord_tabfind_show_initial_partitions 1 +textord_tabfind_show_columns 1 +textord_tabfind_show_blocks 1 +textord_tabfind_show_initialtabs 1 +textord_tabfind_show_finaltabs 1 +textord_tabfind_show_strokewidths 1 +textord_tabfind_show_vlines 0 +textord_tabfind_show_images 1 +tessedit_dump_pageseg_images 0 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/configs/unlv b/test/OpenCvSharp.Tests/_data/tessdata/configs/unlv new file mode 100644 index 000000000..87c111bdf --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/configs/unlv @@ -0,0 +1,2 @@ +tessedit_write_unlv 1 +tessedit_pageseg_mode 6 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/eng.traineddata b/test/OpenCvSharp.Tests/_data/tessdata/eng.traineddata new file mode 100644 index 000000000..f4744c201 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/tessdata/eng.traineddata differ diff --git a/test/OpenCvSharp.Tests/_data/tessdata/pdf.ttf b/test/OpenCvSharp.Tests/_data/tessdata/pdf.ttf new file mode 100644 index 000000000..c33bafe3b --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/pdf.ttf @@ -0,0 +1 @@ +tessconfigs/pdf.ttf \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/batch b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/batch new file mode 100644 index 000000000..619b64675 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/batch @@ -0,0 +1,2 @@ +# No content needed as all defaults are correct. + diff --git a/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/batch.nochop b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/batch.nochop new file mode 100644 index 000000000..ebaab9438 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/batch.nochop @@ -0,0 +1,2 @@ +chop_enable 0 +wordrec_enable_assoc 0 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/matdemo b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/matdemo new file mode 100644 index 000000000..c34567be7 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/matdemo @@ -0,0 +1,7 @@ +################################################# +# Adaptive Matcher Using PreAdapted Templates +################################################# + +classify_enable_adaptive_debugger 1 +matcher_debug_flags 6 +matcher_debug_level 1 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/msdemo b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/msdemo new file mode 100644 index 000000000..a1af21fe6 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/msdemo @@ -0,0 +1,13 @@ +################################################# +# Adaptive Matcher Using PreAdapted Templates +################################################# + +classify_enable_adaptive_debugger 1 +matcher_debug_flags 6 +matcher_debug_level 1 + +wordrec_display_splits 0 +wordrec_display_all_words 1 +wordrec_display_all_blobs 1 +wordrec_display_segmentations 2 +classify_debug_level 1 diff --git a/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/nobatch b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/nobatch new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/nobatch @@ -0,0 +1 @@ + diff --git a/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/segdemo b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/segdemo new file mode 100644 index 000000000..d7d90ae69 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/tessdata/tessconfigs/segdemo @@ -0,0 +1,10 @@ +################################################# +# Adaptive Matcher Using PreAdapted Templates +################################################# + +wordrec_display_splits 0 +wordrec_display_all_words 1 +wordrec_display_all_blobs 1 +wordrec_display_segmentations 2 +classify_debug_level 1 +stopper_debug_level 1 diff --git a/test/OpenCvSharp.Tests/_data/text/brisque_model_live.yml b/test/OpenCvSharp.Tests/_data/text/brisque_model_live.yml new file mode 100644 index 000000000..8cdc85471 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/text/brisque_model_live.yml @@ -0,0 +1,9424 @@ +%YAML:1.0 +--- +opencv_ml_svm: + format: 3 + svmType: EPS_SVR + kernel: + type: RBF + gamma: 5.0000000000000003e-02 + C: 1024. + p: 1.0000000000000001e-01 + term_criteria: { epsilon:1.0000000000000000e-03 } + var_count: 36 + sv_total: 774 + support_vectors: + - [ -5.97555935e-01, -1.39442384e-01, -2.49112904e-01, + 4.35729742e-01, -7.69471049e-01, -1.13702476e-01, + -2.72858143e-01, 3.86102557e-01, -7.46624291e-01, + -2.00464189e-01, -1.87499940e-01, -6.77904487e-02, + -5.93950391e-01, -5.81470609e-01, -1.87500000e-01, + -6.22787476e-02, -5.90193391e-01, -5.92239380e-01, + 3.78418922e-01, 2.13951468e-01, 4.01574850e-01, 1.64288640e-01, + -3.32301497e-01, 3.92629981e-01, 4.03468132e-01, + 5.94722033e-02, -2.93012440e-01, 2.26754189e-01, + 4.96886611e-01, -3.65840018e-01, -3.31132412e-02, + -2.85737455e-01, 5.24875641e-01, -4.32341158e-01, + -4.67160940e-02, -3.17992151e-01 ] + - [ -7.51449883e-01, -4.71489668e-01, -5.17388225e-01, + 4.52400565e-01, -9.24875677e-01, -4.56025302e-01, + -5.43556452e-01, 8.03558826e-02, -8.67808700e-01, + -6.54508471e-01, -4.54687417e-01, 1.92940950e-01, + -8.50726187e-01, -7.93629766e-01, -4.56250012e-01, + 1.78094268e-01, -8.46399486e-01, -8.03789556e-01, + -5.01954556e-02, -1.31991088e-01, 1.68728828e-02, + 4.53818798e-01, -6.85710669e-01, 5.63471317e-02, + 6.58959150e-02, -2.04213083e-01, -4.87260878e-01, + -4.07591999e-01, 1.33250237e-01, -6.99379444e-02, + -4.70214307e-01, -5.55439115e-01, 1.56716347e-01, + -2.68402874e-01, -4.39923286e-01, -6.08644128e-01 ] + - [ -7.56006658e-01, -5.77993512e-01, -5.47196627e-01, + 3.88451338e-01, -9.53619361e-01, -5.97933412e-01, + -5.79553604e-01, 1.11859322e-01, -9.09386635e-01, + -7.18025684e-01, -4.51562464e-01, 2.51630068e-01, + -9.05938506e-01, -8.50941420e-01, -4.53124940e-01, + 3.06160808e-01, -9.09709811e-01, -8.48268449e-01, + -1.50299072e-03, -2.71080732e-01, -3.37451696e-03, + 4.12147164e-01, -7.47886777e-01, -1.52841151e-01, + -6.82081580e-02, 1.69326305e-01, -6.84828579e-01, + -3.69906008e-01, 1.45703554e-01, -2.39847898e-01, + -5.75910628e-01, -7.30112314e-01, 1.36815906e-01, + -1.35852635e-01, -6.09467983e-01, -7.08082259e-01 ] + - [ -8.30778778e-01, -7.30379462e-01, -6.89141214e-01, + 3.08734655e-01, -9.87211287e-01, -7.53609061e-01, + -6.80345535e-01, 3.19819927e-01, -9.85353291e-01, + -8.01384211e-01, -5.48437476e-01, 4.95920300e-01, + -9.76384759e-01, -9.02393043e-01, -5.54687440e-01, + 5.18024087e-01, -9.76644039e-01, -9.02455568e-01, + -3.92846465e-01, -4.89412487e-01, -3.00337493e-01, + 3.26959014e-01, -8.38108301e-01, -4.47629869e-01, + -3.50289047e-01, 4.34923887e-01, -8.67099106e-01, + -4.84009445e-01, -1.98007464e-01, -4.89409566e-02, + -7.43211389e-01, -8.19475114e-01, -2.03980088e-01, + -6.73755407e-02, -7.45016456e-01, -8.18471551e-01 ] + - [ -7.69055486e-01, -6.18591428e-01, -5.67068815e-01, + 3.67950559e-01, -9.63698566e-01, -6.45147204e-01, + -5.66594601e-01, 1.96846962e-01, -9.44249332e-01, + -7.53406584e-01, -4.40624952e-01, 3.65130544e-01, + -9.36553895e-01, -8.65356505e-01, -4.43749964e-01, + 4.14383888e-01, -9.39273894e-01, -8.62746060e-01, + -1.23234391e-02, -3.02398264e-01, 7.87401199e-03, + 5.18019676e-01, -8.03870857e-01, -1.71984017e-01, + -6.35837913e-02, 1.88674450e-01, -7.15294480e-01, + -4.09737945e-01, 1.40722275e-01, -1.72965348e-01, + -6.22165442e-01, -7.44866610e-01, 1.21890545e-01, + -7.61067271e-02, -6.49645686e-01, -7.23056436e-01 ] + - [ -8.11309040e-01, -5.79038978e-01, -6.53655052e-01, + 2.66601801e-01, -9.21262622e-01, -5.57496607e-01, + -6.84665203e-01, 7.94374943e-03, -8.66051912e-01, + -6.84777021e-01, -6.04687452e-01, -2.71651149e-02, + -8.41300607e-01, -8.57320845e-01, -6.17187500e-01, + 4.62102890e-03, -8.38529468e-01, -8.55950475e-01, + -3.08686554e-01, -3.36190939e-01, -2.10348666e-01, + 2.58878827e-01, -7.18912780e-01, -2.54680097e-01, + -2.50867128e-01, 7.55485296e-02, -6.54054523e-01, + -4.10593688e-01, -6.10211492e-02, -4.06402111e-01, + -5.34636855e-01, -7.71946073e-01, -8.45771432e-02, + -4.07498062e-01, -5.38136482e-01, -7.62808263e-01 ] + - [ -7.35915542e-01, -2.53773689e-01, -4.93257642e-01, + 3.85161281e-01, -8.00197840e-01, -1.76539660e-01, + -5.16198695e-01, -9.33832526e-02, -6.54668391e-01, + -4.08097148e-01, -4.39062417e-01, -8.20776224e-02, + -6.59215450e-01, -6.70591354e-01, -4.42187488e-01, + -1.38509095e-01, -6.36986017e-01, -6.88472390e-01, + 3.87736559e-02, 1.35442853e-01, 1.11361146e-01, 1.46885633e-01, + -3.59397233e-01, 3.20133686e-01, 1.46820664e-01, + -3.24057341e-01, -1.66410029e-01, -6.21851683e-02, + 2.32876658e-01, -2.17308640e-01, -1.65701330e-01, + -3.35480988e-01, 2.38805890e-01, -2.92272389e-01, + -1.56302094e-01, -3.54638338e-01 ] + - [ -8.09030652e-01, -5.39053679e-01, -6.52235627e-01, + 1.16976976e-01, -8.91915023e-01, -6.04330182e-01, + -6.65946722e-01, 2.68867135e-01, -9.00376499e-01, + -5.75086951e-01, -6.01562500e-01, 1.66838288e-01, + -8.61237407e-01, -8.16005170e-01, -6.10937476e-01, + 2.13618517e-01, -8.63878012e-01, -8.13410342e-01, + -2.83438623e-01, -1.76465034e-01, -1.72103405e-01, + 5.87092638e-02, -5.73883832e-01, -2.12707877e-01, + -1.63005888e-01, 2.20118999e-01, -5.95708787e-01, + -1.34734631e-01, -9.58903432e-02, -1.78796947e-01, + -4.49561238e-01, -6.01356864e-01, -1.06965184e-01, + -1.71632826e-01, -4.62060034e-01, -5.96197605e-01 ] + - [ -8.18144143e-01, -6.84016705e-01, -7.17530131e-01, + 4.44494486e-02, -9.30332303e-01, -7.36634851e-01, + -7.17782557e-01, 1.44906521e-01, -9.44211185e-01, + -7.60924101e-01, -6.90624952e-01, 3.37285995e-02, + -8.94341350e-01, -8.99865270e-01, -6.92187488e-01, + 2.58617997e-01, -9.23155963e-01, -8.78362536e-01, + -4.17493284e-01, -4.53735232e-01, -4.21822250e-01, + 1.94593430e-01, -7.56791651e-01, -4.00211453e-01, + -3.36416245e-01, 1.08048320e-01, -7.48083353e-01, + -5.48516154e-01, -2.65255272e-01, -1.92801178e-01, + -6.65878654e-01, -8.07839990e-01, -2.96019852e-01, + -1.27869248e-01, -6.81973219e-01, -7.87529349e-01 ] + - [ -7.51449883e-01, -4.46877956e-01, -5.55713236e-01, + 2.72939205e-02, -8.13275516e-01, -5.25509000e-01, + -5.69474459e-01, 3.63322616e-01, -8.62414539e-01, + -4.29143012e-01, -4.39062417e-01, -2.35755742e-01, + -7.50849009e-01, -8.24527740e-01, -4.40625012e-01, + -4.60924506e-02, -7.81088114e-01, -8.05214524e-01, + 3.39643955e-02, -1.43103063e-01, 1.01237297e-02, + -1.18883252e-02, -4.80522573e-01, -1.28819466e-01, + -3.81503701e-02, 2.92940617e-01, -5.29328585e-01, + 8.81496668e-02, 2.97633886e-01, -8.98843527e-01, + -2.59629488e-01, -7.41354942e-01, 2.51243830e-01, + -6.81590796e-01, -3.20888698e-01, -6.83992565e-01 ] + - [ -8.00745666e-01, -5.47454476e-01, -6.45138383e-01, + 1.70310855e-01, -9.12038326e-01, -6.13396049e-01, + -6.54427648e-01, 1.36836648e-01, -8.72543931e-01, + -6.11520648e-01, -5.95312476e-01, 1.96510911e-01, + -8.68301332e-01, -8.14886272e-01, -6.06249928e-01, + 3.71325016e-02, -8.29524279e-01, -8.34729552e-01, + -1.96272969e-01, -2.12897182e-01, -9.78627205e-02, + -7.32473731e-02, -5.61367869e-01, -3.46313894e-01, + -1.39884353e-01, 1.39487505e-01, -5.73199630e-01, + -1.89729929e-01, -2.11706161e-02, -2.91248500e-01, + -4.57477510e-01, -6.58225596e-01, -6.21890426e-02, + -1.79520369e-01, -4.84609246e-01, -6.18657649e-01 ] + - [ -6.46437407e-01, -2.82576203e-01, -3.30021322e-01, + 2.56448865e-01, -8.16340327e-01, -3.73782814e-01, + -3.57811332e-01, 2.19053030e-01, -7.85990119e-01, + -4.09804881e-01, -3.65624964e-01, 5.70372343e-02, + -6.62667632e-01, -6.09823823e-01, -3.54687512e-01, + 5.20280600e-02, -6.70666039e-01, -6.37556612e-01, + 2.37751722e-01, 4.48246002e-02, 2.37345338e-01, + -6.36093020e-02, -3.63519251e-01, 1.75126791e-02, + 2.55491376e-01, -1.90009117e-01, -3.13201249e-01, + -1.16502404e-01, 2.75217891e-01, 1.31736636e-01, + -2.96668410e-01, -2.52418518e-01, 3.20895553e-01, + -2.91866422e-01, -2.11802185e-01, -4.02434707e-01 ] + - [ -7.95360386e-01, -4.64225650e-01, -6.01135552e-01, + 4.52491164e-01, -9.15479541e-01, -3.92477751e-01, + -6.32829309e-01, -1.38400376e-01, -7.75539279e-01, + -6.32809579e-01, -5.57812512e-01, 1.59499645e-02, + -7.93174088e-01, -7.87053823e-01, -5.60937464e-01, + -4.02470231e-02, -7.72863626e-01, -7.98910141e-01, + -1.00090206e-01, -7.18296766e-02, -5.96175790e-02, + 3.66864085e-01, -5.89139700e-01, 1.74452543e-01, + -1.96532011e-02, -3.13422143e-01, -3.14955890e-01, + -2.81157851e-01, 5.60398102e-02, -2.21251488e-01, + -3.56385887e-01, -5.28312683e-01, 5.72139025e-02, + -2.75477231e-01, -3.53472292e-01, -5.38779080e-01 ] + - [ -8.03852558e-01, -5.60077310e-01, -6.38041139e-01, + -3.68342996e-02, -8.67691159e-01, -6.71859026e-01, + -6.54427648e-01, 3.56220126e-01, -9.23446655e-01, + -5.74068308e-01, -6.20312452e-01, -4.55922484e-02, + -8.16976368e-01, -8.37730527e-01, -6.25000000e-01, + 1.57512903e-01, -8.48734915e-01, -8.14604461e-01, + -3.83829296e-01, -3.33596766e-01, -2.77840316e-01, + -6.55543804e-03, -6.30420685e-01, -3.96442235e-01, + -2.67051995e-01, 2.73972750e-01, -7.24807024e-01, + -3.30820799e-01, -2.12951481e-01, -2.63663769e-01, + -5.20848870e-01, -7.12720275e-01, -2.26368129e-01, + -2.32076347e-01, -5.36275387e-01, -6.98915958e-01 ] + - [ -7.30323076e-01, -1.57782316e-01, -3.62668574e-01, + 8.37614179e-01, -8.49678040e-01, 1.21071339e-01, + -3.39092791e-01, -4.64269161e-01, -5.44795394e-01, + -5.25070786e-01, -3.43749940e-01, -4.34187412e-01, + -4.64896739e-01, -6.20769501e-01, -3.48437488e-01, + -3.01995039e-01, -4.87570941e-01, -6.03720784e-01, + -1.89660430e-01, 7.08419085e-02, 8.66141319e-02, + 6.23188853e-01, -5.86469829e-01, 5.60379148e-01, + 1.49132967e-01, -8.69919598e-01, -2.82315612e-02, + -4.64265347e-01, 1.78082108e-01, -7.08329558e-01, + -2.20751762e-03, -4.80149388e-01, 1.74129367e-01, + -6.16432667e-01, -6.39300346e-02, -4.58555758e-01 ] + - [ -7.61184752e-01, -5.29594123e-01, -5.62810481e-01, + 1.90864682e-01, -9.11934733e-01, -6.15689814e-01, + -5.73794007e-01, 3.34281564e-01, -9.23075736e-01, + -6.09738231e-01, -4.90624905e-01, 1.82352066e-01, + -8.68353963e-01, -8.20554614e-01, -4.95312452e-01, + 2.06494570e-01, -8.68257761e-01, -8.22399616e-01, + -8.14548135e-02, -2.35193729e-01, -5.51180840e-02, + 1.14514947e-01, -6.62093818e-01, -3.15040588e-01, + -5.20231128e-02, 1.37854576e-01, -6.56857133e-01, + -3.49381387e-01, 8.71729851e-03, -6.60536885e-02, + -5.43562233e-01, -6.30089402e-01, -9.95022058e-03, + -1.37825906e-01, -5.29538035e-01, -6.38942480e-01 ] + - [ -7.95774639e-01, -4.77428913e-01, -6.29524469e-01, + 5.78501225e-02, -8.45474482e-01, -5.54202437e-01, + -6.40028775e-01, 2.02629805e-01, -8.51960897e-01, + -5.18712342e-01, -5.85937500e-01, 3.73691320e-02, + -7.98189342e-01, -7.85572529e-01, -5.95312476e-01, + 1.03295088e-01, -8.03743601e-01, -7.79769301e-01, + -2.18515217e-01, -1.17768764e-01, -9.56130028e-02, + 2.51657963e-02, -5.35338402e-01, -1.83111489e-01, + -9.82660055e-02, 1.52639866e-01, -5.31835437e-01, + -9.59798694e-02, -4.35865521e-02, -1.52526617e-01, + -4.02695179e-01, -5.40705919e-01, -4.97512817e-02, + -1.37714863e-01, -4.14659739e-01, -5.30860186e-01 ] + - [ -6.66942835e-01, -2.54925728e-01, -3.25762928e-01, + 9.31068778e-01, -9.08010006e-01, -7.00271130e-03, + -3.14614832e-01, -5.26570737e-01, -6.09568357e-01, + -6.42442346e-01, -2.54687488e-01, -7.13165879e-01, + -5.30165076e-01, -7.79379129e-01, -2.57812440e-01, + -4.19271290e-01, -5.81882715e-01, -7.36962140e-01, + 1.79440856e-01, -6.75199628e-02, 2.53093362e-01, + 8.68084550e-01, -7.63803422e-01, 3.87098789e-01, + 2.83236861e-01, -6.32056952e-01, -3.16629589e-01, + -5.47244787e-01, 4.29638743e-01, -8.97222519e-01, + -2.20483184e-01, -7.05732763e-01, 4.25372958e-01, + -8.32538247e-01, -2.51320302e-01, -6.82827353e-01 ] + - [ -8.30157399e-01, -7.02668309e-01, -7.04755187e-01, + 1.30939364e-01, -9.65747237e-01, -7.77984142e-01, + -7.35061169e-01, 3.65431070e-01, -9.77528453e-01, + -7.24858046e-01, -6.21874928e-01, 3.67594957e-01, + -9.57308650e-01, -8.94636273e-01, -6.32812500e-01, + 3.94242167e-01, -9.57403004e-01, -8.93857896e-01, + -4.15689826e-01, -3.96433175e-01, -3.49831164e-01, + 4.13793325e-02, -7.03789473e-01, -4.75560963e-01, + -3.91907513e-01, 3.90916586e-01, -7.77586699e-01, + -3.00066054e-01, -2.75217950e-01, -2.11683631e-01, + -6.19384170e-01, -7.77332127e-01, -2.83582091e-01, + -1.62129939e-01, -6.42609298e-01, -7.65671611e-01 ] + - [ -8.39270949e-01, -8.42031360e-01, -7.31724620e-01, + 1.31289244e-01, -9.95796680e-01, -8.90482008e-01, + -7.49460042e-01, 1.90351605e-01, -9.94647205e-01, + -8.94988775e-01, -6.73437476e-01, 4.80333567e-01, + -9.91700113e-01, -9.39254344e-01, -6.81249976e-01, + 5.00651836e-01, -9.91777480e-01, -9.39390898e-01, + -3.24316263e-01, -5.95337152e-01, -2.75590479e-01, + 4.29415464e-01, -9.36997890e-01, -6.29172564e-01, + -2.87861288e-01, 4.47833896e-01, -9.30179894e-01, + -6.58259630e-01, -1.70610249e-01, 3.59008670e-01, + -8.92894506e-01, -8.40708315e-01, -1.74129426e-01, + 3.26935172e-01, -8.91071498e-01, -8.43931675e-01 ] + - [ -8.02609801e-01, -5.89201093e-01, -6.45138383e-01, + -8.45165849e-02, -8.67098451e-01, -7.03755140e-01, + -6.42908573e-01, 6.18834615e-01, -9.73069489e-01, + -5.59258342e-01, -5.46875000e-01, 4.61914539e-02, + -8.72139037e-01, -8.68110538e-01, -5.48437476e-01, + 1.67176843e-01, -8.85582745e-01, -8.57626796e-01, + -1.71025038e-01, -2.80676246e-01, -1.20359898e-01, + -5.72049022e-02, -5.67356586e-01, -3.39260876e-01, + -1.74566567e-01, 4.87450838e-01, -7.15797365e-01, + -6.05849624e-02, 9.83810425e-02, -6.82403326e-01, + -4.28300798e-01, -7.86850393e-01, 7.96018839e-02, + -4.53529179e-01, -5.01061022e-01, -7.41474509e-01 ] + - [ -8.12551796e-01, -6.67026877e-01, -6.16749525e-01, + 1.57106519e-01, -9.62257922e-01, -7.67985165e-01, + -6.70266390e-01, 5.84338307e-01, -9.90526736e-01, + -6.73291087e-01, -5.29687524e-01, 5.30365467e-01, + -9.63233590e-01, -8.64573479e-01, -5.35937548e-01, + 5.32484412e-01, -9.62083519e-01, -8.67233336e-01, + -2.31740355e-01, -2.81199992e-01, -1.96850419e-01, + 2.54415274e-02, -6.17173254e-01, -3.33430707e-01, + -2.06936479e-01, 7.06565142e-01, -8.11554849e-01, + -2.95510292e-02, -2.61518955e-02, -1.11737788e-01, + -5.91859818e-01, -6.98298395e-01, -2.23881602e-02, + -2.26745903e-01, -5.75341702e-01, -7.19477355e-01 ] + - [ -8.37613940e-01, -8.13829064e-01, -7.44499683e-01, + 2.35361934e-01, -9.97099996e-01, -8.44651639e-01, + -7.22102165e-01, 2.06410646e-01, -9.93061602e-01, + -8.84314716e-01, -6.40625000e-01, 5.46434999e-01, + -9.91789103e-01, -9.26592231e-01, -6.48437500e-01, + 5.52073002e-01, -9.91277039e-01, -9.27839994e-01, + -3.70003045e-01, -5.37773490e-01, -2.93588281e-01, + 5.44216990e-01, -9.28189039e-01, -4.81441319e-01, + -3.22543323e-01, 2.74999380e-01, -8.74237180e-01, + -6.53266728e-01, -2.12951481e-01, 2.68959761e-01, + -8.49220455e-01, -8.16495061e-01, -2.18905568e-01, + 2.21071005e-01, -8.47553611e-01, -8.25150728e-01 ] + - [ -7.59527743e-01, -4.51951683e-01, -5.67068815e-01, + 1.38841867e-02, -8.10477555e-01, -5.29560208e-01, + -5.80993533e-01, 3.75988007e-01, -8.68177652e-01, + -4.29959536e-01, -4.51562464e-01, -2.30455399e-01, + -7.54351199e-01, -8.26839924e-01, -4.54687536e-01, + -4.36534286e-02, -7.84011602e-01, -8.07973087e-01, + 5.10966778e-03, -1.46428764e-01, 1.12485886e-03, + -3.63026857e-02, -4.65881109e-01, -1.34057641e-01, + -5.20231128e-02, 2.78150320e-01, -5.22869468e-01, + 8.24661255e-02, 2.82689810e-01, -9.13267553e-01, + -2.56476283e-01, -7.45868921e-01, 2.36318350e-01, + -6.89965606e-01, -3.19059551e-01, -6.87031269e-01 ] + - [ -5.50331414e-01, -8.71763229e-02, -1.65365517e-01, + 4.84445810e-01, -7.61842370e-01, -6.36519790e-02, + -1.82145476e-01, 4.54751253e-01, -7.41577268e-01, + -1.42901957e-01, -1.26562476e-01, -5.58068752e-02, + -5.50679088e-01, -5.24050951e-01, -1.32812440e-01, + -4.64901328e-02, -5.47124386e-01, -5.34006715e-01, + 4.33724046e-01, 2.52801895e-01, 4.39820051e-01, 1.39711618e-01, + -2.87002325e-01, 4.44679141e-01, 4.58959460e-01, + 1.10820532e-02, -2.44230211e-01, 2.51331568e-01, + 5.49190402e-01, -3.84759784e-01, 1.74971819e-02, + -2.47391701e-01, 5.72139144e-01, -4.42805171e-01, + 2.62653828e-03, -2.76491165e-01 ] + - [ -8.38028193e-01, -4.97904956e-01, -6.73527300e-01, + 7.91657448e-01, -9.69720721e-01, -2.26570666e-01, + -6.87544942e-01, -7.00056016e-01, -6.41064107e-01, + -8.20390940e-01, -6.54687464e-01, -4.08040226e-01, + -6.95034027e-01, -8.50242019e-01, -6.64062500e-01, + -4.23824549e-01, -6.78329945e-01, -8.59142005e-01, + -4.14487541e-01, -2.58698225e-01, -2.01349795e-01, + 8.65715384e-01, -8.60821903e-01, 1.75550938e-01, + -1.95375800e-01, -8.30271363e-01, -2.85812259e-01, + -7.42358804e-01, -1.28268957e-01, -6.41483665e-01, + -3.60506952e-01, -7.45309949e-01, -1.39303565e-01, + -7.10289955e-01, -3.52757931e-01, -7.50963330e-01 ] + - [ -8.47348809e-01, -8.26157451e-01, -8.09794188e-01, + -1.41208768e-02, -9.72527027e-01, -8.63920987e-01, + -8.08495283e-01, 1.42262578e-01, -9.87214744e-01, + -8.73461485e-01, -7.92187452e-01, 2.21908092e-01, + -9.65411663e-01, -9.40453291e-01, -7.73437500e-01, + 3.87941241e-01, -9.79423761e-01, -9.31219935e-01, + -5.58761716e-01, -6.24706984e-01, -5.74803114e-01, + 2.39370704e-01, -8.72274816e-01, -5.95648408e-01, + -5.35260201e-01, 1.75603747e-01, -8.67686450e-01, + -7.13586807e-01, -4.81942773e-01, 1.06456995e-01, + -8.42213869e-01, -8.67918015e-01, -4.97512460e-01, + 1.12361550e-01, -8.45891476e-01, -8.62318516e-01 ] + - [ -7.81068742e-01, -4.89364743e-01, -5.98296642e-01, + 2.18062997e-01, -8.69647622e-01, -4.78635788e-01, + -6.24190032e-01, 3.06208134e-02, -8.51515830e-01, + -6.47874951e-01, -5.59374988e-01, -4.11769152e-02, + -8.07081282e-01, -8.23128283e-01, -5.68749964e-01, + -2.31788158e-02, -8.03170383e-01, -8.25547040e-01, + -1.67418122e-01, -2.04198062e-01, -1.27109110e-01, + 3.49638462e-01, -6.53984427e-01, 6.50036335e-03, + -1.00578129e-01, -2.72852361e-01, -4.43405688e-01, + -4.27471220e-01, 3.86052132e-02, -4.74669397e-01, + -4.11327958e-01, -6.97848439e-01, 3.23382616e-02, + -5.35511434e-01, -4.07929361e-01, -7.05104589e-01 ] + - [ -8.50869894e-01, -6.94439888e-01, -7.61533022e-01, + 1.27359033e-01, -9.54508483e-01, -7.31330216e-01, + -7.91216671e-01, -7.86000490e-03, -9.00745034e-01, + -7.49813318e-01, -7.34375000e-01, 1.82347655e-01, + -9.14512396e-01, -8.80690753e-01, -7.53125012e-01, + 6.98212385e-02, -8.85723174e-01, -8.91250432e-01, + -3.82025898e-01, -3.92019331e-01, -3.29583824e-01, + -1.85972452e-03, -6.84483707e-01, -4.87914205e-01, + -3.45664799e-01, 1.34111166e-01, -6.79288387e-01, + -3.93903255e-01, -2.52802014e-01, -9.32066441e-02, + -6.45543039e-01, -7.49936104e-01, -2.81094551e-01, + -6.32167459e-02, -6.51187301e-01, -7.32557714e-01 ] + - [ -6.82062984e-01, -3.10415149e-01, -4.12349164e-01, + 1.90994143e-01, -8.11558008e-01, -4.05981123e-01, + -4.02447820e-01, 7.31471658e-01, -8.98369014e-01, + -2.68799365e-01, -2.71874964e-01, 1.90147400e-01, + -7.77607501e-01, -6.98327899e-01, -2.81250000e-01, + 1.36716008e-01, -7.64576554e-01, -7.15095282e-01, + 1.78238511e-01, 1.05952859e-01, 2.35095620e-01, + -2.55802274e-02, -3.62273097e-01, 6.96249008e-02, + 1.93063617e-01, 3.83384585e-01, -4.63136137e-01, + 3.36614370e-01, 3.77335072e-01, -3.10259879e-01, + -1.77690387e-01, -3.93917739e-01, 3.75621796e-01, + -4.97602761e-01, -1.40522540e-01, -4.45371270e-01 ] + - [ -8.56462300e-01, -7.67428994e-01, -7.98438609e-01, + 1.29626513e-01, -9.76885915e-01, -7.91788161e-01, + -8.17134619e-01, 1.02330446e-01, -9.62548912e-01, + -8.15470159e-01, -7.62499988e-01, 2.94997573e-01, + -9.59333777e-01, -9.12737548e-01, -7.65625000e-01, + 2.99057484e-01, -9.57864165e-01, -9.16654825e-01, + -5.98437071e-01, -5.35561383e-01, -5.52305937e-01, + 8.57285261e-02, -7.84124613e-01, -5.77505231e-01, + -5.67630112e-01, 2.47550011e-02, -7.28140235e-01, + -6.02546334e-01, -5.36737204e-01, 3.91838551e-02, + -7.37511635e-01, -7.93678284e-01, -5.37313461e-01, + -6.96677566e-02, -7.21428037e-01, -8.13394070e-01 ] + - [ -8.53355408e-01, -7.07715392e-01, -7.78566360e-01, + 3.83450389e-01, -9.82001781e-01, -6.26468301e-01, + -7.69618392e-01, -6.20634556e-02, -9.32990968e-01, + -8.45893502e-01, -7.18750000e-01, 2.01229453e-01, + -9.35546577e-01, -9.03992295e-01, -7.09374964e-01, + 2.92094946e-01, -9.44469869e-01, -8.99298370e-01, + -5.40727437e-01, -4.26200926e-01, -4.21822250e-01, + 7.14576244e-01, -8.91243339e-01, -7.60530233e-02, + -4.70520318e-01, -3.68540287e-01, -5.30057609e-01, + -6.85844660e-01, -3.79825711e-01, -4.95329976e-01, + -5.25332093e-01, -8.26919734e-01, -3.80596995e-01, + -4.14312959e-01, -5.67164421e-01, -8.10901284e-01 ] + - [ -8.06752324e-01, -5.83943903e-01, -6.01135552e-01, + 5.01669765e-01, -9.74970996e-01, -5.82415819e-01, + -6.24190032e-01, 4.61520433e-01, -9.64230895e-01, + -6.41999424e-01, -4.64062512e-01, 5.88889956e-01, + -9.52933550e-01, -8.28137696e-01, -4.74999964e-01, + 5.90736747e-01, -9.50857520e-01, -8.28583241e-01, + -3.01472843e-01, -1.77663207e-01, -1.49606228e-01, + 4.10464287e-01, -6.50204897e-01, 1.06985569e-01, + -1.69942200e-01, 2.59569645e-01, -6.27325296e-01, + -1.49732411e-01, -2.86426544e-02, -3.30675840e-01, + -4.23711360e-01, -6.48212612e-01, -1.99004412e-02, + -3.29448223e-01, -4.39680457e-01, -6.45693123e-01 ] + - [ -8.38235259e-01, -7.41162419e-01, -7.07594037e-01, + 2.73174763e-01, -9.85123754e-01, -7.60330617e-01, + -6.97624207e-01, 2.92843103e-01, -9.84933019e-01, + -8.10171723e-01, -5.82812428e-01, 4.62462664e-01, + -9.74997997e-01, -9.06124532e-01, -5.89062452e-01, + 4.84657884e-01, -9.75163519e-01, -9.06185150e-01, + -4.13285315e-01, -5.04120886e-01, -3.31833541e-01, + 3.26954603e-01, -8.42102230e-01, -4.53987360e-01, + -3.80346835e-01, 3.87203336e-01, -8.59899998e-01, + -5.09983301e-01, -2.30386019e-01, -4.94223237e-02, + -7.48643994e-01, -8.25679660e-01, -2.33830869e-01, + -6.00892901e-02, -7.53228247e-01, -8.24435830e-01 ] + - [ -8.17937016e-01, -7.31281281e-01, -6.46557808e-01, + 2.11981177e-01, -9.82953548e-01, -8.03188562e-01, + -6.84665203e-01, 3.32902074e-01, -9.81568038e-01, + -7.76611090e-01, -5.64062417e-01, 4.53067899e-01, + -9.71217334e-01, -9.01223421e-01, -5.71874976e-01, + 4.57810640e-01, -9.70196545e-01, -9.03403401e-01, + -2.60595143e-01, -4.33442116e-01, -2.55343020e-01, + 2.63566017e-01, -8.05195212e-01, -4.42224085e-01, + -2.36994207e-01, 4.47118402e-01, -8.28728259e-01, + -3.85044038e-01, -7.09837675e-02, -6.87390566e-03, + -7.27900505e-01, -7.86221385e-01, -6.71641231e-02, + -9.21632051e-02, -7.17622638e-01, -7.97811627e-01 ] + - [ -8.30157399e-01, -7.14080036e-01, -7.07594037e-01, + 1.44822717e-01, -9.70533431e-01, -7.84148574e-01, + -7.36501098e-01, 3.45394373e-01, -9.78642941e-01, + -7.42155552e-01, -6.26562476e-01, 3.75642061e-01, + -9.60549474e-01, -8.98124397e-01, -6.37499988e-01, + 4.01965022e-01, -9.60519850e-01, -8.97143841e-01, + -4.13886487e-01, -4.09133375e-01, -3.52081001e-01, + 9.72194672e-02, -7.35225558e-01, -4.72845852e-01, + -3.89595449e-01, 3.90742540e-01, -7.87353992e-01, + -3.24333191e-01, -2.75217950e-01, -2.09831476e-01, + -6.32414281e-01, -7.87380219e-01, -2.83582091e-01, + -1.45026684e-01, -6.59637928e-01, -7.73845553e-01 ] + - [ -8.25393558e-01, -7.39487410e-01, -6.63591146e-01, + 1.99782133e-01, -9.82844591e-01, -8.06211293e-01, + -7.01943815e-01, 3.17206383e-01, -9.82091129e-01, + -7.83585429e-01, -5.87499976e-01, 4.36479568e-01, + -9.71365213e-01, -9.04761672e-01, -5.95312476e-01, + 4.40208435e-01, -9.70199823e-01, -9.07051563e-01, + -3.16501379e-01, -4.53915894e-01, -3.07086527e-01, + 2.47220874e-01, -8.07100296e-01, -4.60408270e-01, + -2.97109842e-01, 4.06874061e-01, -8.26559126e-01, + -4.15262043e-01, -1.38231635e-01, -2.76924968e-02, + -7.33357251e-01, -8.00875843e-01, -1.34328306e-01, + -1.28878117e-01, -7.19430566e-01, -8.14168811e-01 ] + - [ -8.60604823e-01, -6.59838676e-01, -7.55855203e-01, + 2.64789820e-01, -9.56939697e-01, -6.32429123e-01, + -7.71058321e-01, -3.59324515e-01, -8.17276239e-01, + -8.34016860e-01, -7.95312464e-01, 3.40347171e-01, + -9.02082205e-01, -8.00769567e-01, -7.92187452e-01, + -3.42500806e-01, -7.65927017e-01, -9.16210294e-01, + -5.39525151e-01, -4.90558803e-01, -4.73565817e-01, + 1.92737818e-01, -7.95609117e-01, -4.82716620e-01, + -4.86705244e-01, -4.51630056e-01, -5.28611064e-01, + -7.55151808e-01, -4.96886671e-01, 2.06338167e-02, + -6.76059067e-01, -7.40630388e-01, -4.62686598e-01, + -3.24826539e-01, -6.13042593e-01, -8.18888724e-01 ] + - [ -8.31400156e-01, -4.71329629e-01, -6.86302304e-01, + 6.20602369e-02, -8.02305758e-01, -4.48113024e-01, + -7.03383684e-01, 1.56377554e-02, -7.71951973e-01, + -5.01827300e-01, -6.25000000e-01, -2.56448150e-01, + -7.08560705e-01, -8.05094242e-01, -6.29687548e-01, + -3.53544533e-01, -6.76736355e-01, -8.28975439e-01, + -3.66396189e-01, -2.14978099e-01, -1.99100077e-01, + -5.18782139e-02, -4.97840047e-01, -2.17811942e-01, + -2.53179193e-01, -1.17129147e-01, -4.35436785e-01, + -2.63941586e-01, -1.48194313e-01, -5.04165649e-01, + -3.10442150e-01, -6.49637341e-01, -1.44278586e-01, + -6.74620986e-01, -2.84287333e-01, -6.89385891e-01 ] + - [ -8.27257633e-01, -6.54702544e-01, -7.33144104e-01, + 5.43876886e-02, -9.13156509e-01, -6.85207248e-01, + -7.40820706e-01, 1.26747608e-01, -9.31789041e-01, + -7.37111568e-01, -6.74999952e-01, 9.56175327e-02, + -8.97667289e-01, -8.85605574e-01, -6.84375048e-01, + 1.02903605e-01, -8.93567681e-01, -8.88343155e-01, + -3.47760797e-01, -3.93028140e-01, -3.43082130e-01, + 2.20197082e-01, -7.27506638e-01, -3.11068833e-01, + -3.57225478e-01, -6.04601502e-02, -6.40701056e-01, + -5.32063007e-01, -2.57783234e-01, -2.70883203e-01, + -5.95973551e-01, -7.80692995e-01, -2.63681531e-01, + -3.31855834e-01, -5.90991020e-01, -7.87676752e-01 ] + - [ -9.21499610e-01, -8.48466396e-01, -8.79347026e-01, + -6.39517307e-02, -9.74406838e-01, -8.85031521e-01, + -8.97768140e-01, -3.54399681e-02, -9.74628806e-01, + -9.07163441e-01, -8.71874988e-01, 1.50179625e-01, + -9.63315904e-01, -9.53637481e-01, -8.79687488e-01, + 1.90207124e-01, -9.64962602e-01, -9.53421056e-01, + -7.45716870e-01, -7.22556949e-01, -7.00787365e-01, + 1.29015684e-01, -8.91875327e-01, -7.43804812e-01, + -7.22543359e-01, 1.41738534e-01, -8.97834718e-01, + -7.97137380e-01, -6.88667536e-01, 6.24693632e-02, + -8.59631777e-01, -9.05981362e-01, -6.86567128e-01, + 2.18396187e-02, -8.60187769e-01, -9.10960078e-01 ] + - [ -8.48177314e-01, -7.46231616e-01, -7.88502455e-01, + 8.99022818e-02, -9.57642555e-01, -7.59786308e-01, + -7.89776802e-01, 3.60105038e-02, -9.48652804e-01, + -8.23735595e-01, -7.49999940e-01, 1.48336530e-01, + -9.35084224e-01, -9.17696476e-01, -7.48437464e-01, + 2.03239322e-01, -9.39994216e-01, -9.17432487e-01, + -5.91223359e-01, -5.59346795e-01, -5.41057348e-01, + 4.02996063e-01, -8.86797607e-01, -4.48542178e-01, + -5.49132943e-01, 5.85799217e-02, -7.70365834e-01, + -6.39404535e-01, -4.74470794e-01, -1.23071492e-01, + -7.36234963e-01, -8.52883935e-01, -5.04975140e-01, + -1.58458352e-01, -7.27913976e-01, -8.49984765e-01 ] + - [ -8.48591566e-01, -8.29208970e-01, -7.60113597e-01, + 1.10414147e-01, -9.90624130e-01, -8.68532956e-01, + -7.59539247e-01, 1.52610898e-01, -9.89012361e-01, + -8.84097517e-01, -7.09374964e-01, 4.19993162e-01, + -9.84043896e-01, -9.30851519e-01, -7.21874952e-01, + 4.02348161e-01, -9.81509745e-01, -9.34493482e-01, + -5.93627930e-01, -6.67872906e-01, -4.87064064e-01, + 4.21162009e-01, -9.54442143e-01, -6.64813697e-01, + -5.07514477e-01, 3.42009068e-01, -9.27642167e-01, + -7.14850664e-01, -4.96886671e-01, 3.76343369e-01, + -8.97625566e-01, -8.35390151e-01, -5.02487540e-01, + 2.32081413e-01, -8.78873408e-01, -8.57772887e-01 ] + - [ -8.77174854e-01, -4.90318716e-01, -6.77785635e-01, + -2.19856799e-01, -7.78777421e-01, -6.52205944e-01, + -6.99064076e-01, -1.97000265e-01, -7.75878251e-01, + -6.73830390e-01, -6.85937524e-01, -2.86027610e-01, + -6.80552781e-01, -7.97625482e-01, -6.92187488e-01, + -2.94394672e-01, -6.69710577e-01, -8.09061825e-01, + -6.83198094e-01, -4.35148478e-01, -4.96062994e-01, + -1.09681964e-01, -6.54584646e-01, -5.67304492e-01, + -5.12138724e-01, -1.56644225e-01, -6.36894166e-01, + -6.36323214e-01, -5.09340048e-01, -1.62096381e-01, + -5.75825274e-01, -7.38364756e-01, -5.12437820e-01, + -2.20924199e-01, -5.76585948e-01, -7.52363443e-01 ] + - [ -5.92584908e-01, -2.67247617e-01, -2.87437856e-01, + -4.99704480e-02, -7.29815602e-01, -4.54239547e-01, + -2.41180718e-01, -1.49021864e-01, -7.19829917e-01, + -5.56706607e-01, -1.81249976e-01, -1.26305521e-01, + -6.77921295e-01, -7.00513184e-01, -1.93749905e-01, + -1.06476188e-01, -6.75809145e-01, -7.06257463e-01, + 1.11511707e-01, -2.20811069e-01, 1.68728828e-02, + 2.57429123e-01, -6.98554039e-01, -2.26973414e-01, + 8.43930244e-02, -5.14982343e-02, -6.14031613e-01, + -4.57673371e-01, 2.32876658e-01, -1.47462487e-01, + -5.60634851e-01, -6.75423861e-01, 2.06467628e-01, + -2.02839851e-01, -5.53250790e-01, -6.81040764e-01 ] + - [ -7.63048887e-01, -5.66806078e-01, -5.11710465e-01, + 5.59199929e-01, -9.80842590e-01, -6.01642370e-01, + -5.21958232e-01, 5.98009586e-01, -9.79186177e-01, + -6.46244168e-01, -2.79687464e-01, 7.21042752e-01, + -9.65830505e-01, -8.28070700e-01, -2.85937428e-01, + 7.40495086e-01, -9.66417670e-01, -8.27769578e-01, + 4.59872484e-02, -1.48371100e-01, 9.33632851e-02, + 4.21051621e-01, -6.82114244e-01, 1.14456415e-02, + 7.97687769e-02, 6.23332977e-01, -7.50386715e-01, + -1.60496235e-02, 2.75217891e-01, -6.53592348e-02, + -5.32133579e-01, -6.10404253e-01, 2.83582091e-01, + -8.17350745e-02, -5.40872693e-01, -6.15487397e-01 ] + - [ -8.42377782e-01, -8.06739271e-01, -7.37402439e-01, + 9.57559347e-02, -9.85600650e-01, -8.59553754e-01, + -7.48020172e-01, 1.21912599e-01, -9.81824636e-01, + -8.73914301e-01, -7.18750000e-01, 3.53926301e-01, + -9.72984731e-01, -9.23230946e-01, -7.31249928e-01, + 2.94345498e-01, -9.65750158e-01, -9.31502759e-01, + -5.75593650e-01, -6.48000836e-01, -4.93813276e-01, + 3.04851294e-01, -9.20655191e-01, -6.65831268e-01, + -4.93641675e-01, 2.64397860e-01, -9.00356054e-01, + -7.11938381e-01, -5.04358709e-01, 2.98527718e-01, + -8.61111581e-01, -8.18096876e-01, -5.09950280e-01, + 1.23656154e-01, -8.33780944e-01, -8.46158624e-01 ] + - [ -7.27423370e-01, -4.15362418e-01, -5.21646559e-01, + -5.02707958e-02, -7.77795851e-01, -5.25186539e-01, + -5.03239751e-01, -1.41480744e-01, -7.64162242e-01, + -6.18953884e-01, -4.42187488e-01, -8.29456449e-02, + -7.54250169e-01, -7.76029348e-01, -4.48437512e-01, + -7.12493062e-02, -7.51672268e-01, -7.83040166e-01, + -1.31950736e-01, -3.00081670e-01, -1.56355441e-01, + 2.94859648e-01, -7.42483974e-01, -2.68768132e-01, + -1.12138808e-01, -1.60648227e-02, -6.52117729e-01, + -4.94309187e-01, -1.24531984e-03, -1.64466977e-01, + -5.95590293e-01, -7.23017633e-01, -2.23881602e-02, + -2.26262093e-01, -5.87244809e-01, -7.29704738e-01 ] + - [ -7.35086977e-01, -3.77465129e-01, -4.57771420e-01, + 8.90282512e-01, -9.42527950e-01, -1.34775221e-01, + -4.68682528e-01, -6.38206124e-01, -6.36777103e-01, + -7.49009848e-01, -3.98437500e-01, -6.51054144e-01, + -6.19573474e-01, -8.40553761e-01, -3.98437500e-01, + -4.24234092e-01, -6.59851611e-01, -8.16728115e-01, + 1.19927883e-01, -1.33341193e-01, 1.94600701e-01, + 9.84912395e-01, -8.21957469e-01, 3.72139812e-01, + 2.20809102e-01, -6.33440852e-01, -3.56781602e-01, + -5.99281073e-01, 3.99750948e-01, -9.40719068e-01, + -2.77176440e-01, -7.60589838e-01, 3.85572195e-01, + -8.50653410e-01, -3.12653005e-01, -7.34291494e-01 ] + - [ -8.11723292e-01, -7.17233300e-01, -6.38041139e-01, + 3.10281754e-01, -9.84820247e-01, -7.55118132e-01, + -6.27069771e-01, 2.93657541e-01, -9.82322454e-01, + -8.12107027e-01, -5.15625000e-01, 5.17964602e-01, + -9.74816322e-01, -8.94686997e-01, -5.28125048e-01, + 5.30549526e-01, -9.74100590e-01, -8.94564748e-01, + -1.93868399e-01, -4.17065084e-01, -1.58605158e-01, + 4.59451914e-01, -8.46110582e-01, -3.37731898e-01, + -2.20809281e-01, 2.81076670e-01, -7.98828661e-01, + -4.85598564e-01, -1.86799765e-02, -1.92830563e-02, + -7.26753116e-01, -7.88369656e-01, -1.99004412e-02, + 1.38289928e-02, -7.41589785e-01, -7.82275558e-01 ] + - [ -8.70753944e-01, -6.95665240e-01, -7.99858093e-01, + 2.40635037e-01, -9.64367867e-01, -6.58335447e-01, + -8.14254820e-01, -3.54143739e-01, -8.26918483e-01, + -8.47432673e-01, -8.14062476e-01, 2.25518584e-01, + -9.06594932e-01, -8.53244543e-01, -8.15625012e-01, + -2.19555318e-01, -8.18837166e-01, -9.22162414e-01, + -5.84610820e-01, -5.31726122e-01, -5.34308195e-01, + 2.22234368e-01, -8.27841997e-01, -5.14601111e-01, + -5.46820879e-01, -4.04919207e-01, -5.61545968e-01, + -7.67011940e-01, -5.54171860e-01, 5.59163094e-03, + -7.01787353e-01, -7.75692344e-01, -5.39801002e-01, + -2.83231616e-01, -6.46476328e-01, -8.35853517e-01 ] + - [ -7.41300702e-01, -2.86431730e-01, -4.49254811e-01, + 7.83197522e-01, -8.98319483e-01, -6.85726404e-02, + -4.25485909e-01, -5.29726624e-01, -6.11605763e-01, + -6.55523419e-01, -4.20312524e-01, -3.50574374e-01, + -5.84789693e-01, -7.06261396e-01, -4.35937464e-01, + -3.76292109e-01, -5.67659974e-01, -7.21268475e-01, + -1.69221580e-01, -9.35393572e-02, 5.62441349e-03, + 6.52287126e-01, -7.16876149e-01, 2.62727618e-01, + 5.89594841e-02, -8.14294934e-01, -2.26309538e-01, + -6.28730536e-01, 1.18306279e-01, -5.66051781e-01, + -2.51890063e-01, -6.08557940e-01, 9.45273638e-02, + -6.50047421e-01, -2.41549730e-01, -6.22933447e-01 ] + - [ -8.33678544e-01, -6.28962636e-01, -6.96238458e-01, + 4.83032465e-01, -9.80418980e-01, -5.81389785e-01, + -7.03383684e-01, 4.09054756e-02, -9.14379120e-01, + -7.57337034e-01, -6.20312452e-01, 3.31769347e-01, + -9.27707672e-01, -8.55379283e-01, -6.34374976e-01, + 3.11689734e-01, -9.20843661e-01, -8.59246552e-01, + -2.85241961e-01, -2.52581954e-01, -2.19347596e-01, + 5.45004368e-01, -7.74007261e-01, -8.03989172e-03, + -1.93063557e-01, -2.18890786e-01, -4.84135687e-01, + -4.41262662e-01, -1.38231635e-01, -2.08261132e-01, + -5.06638646e-01, -6.69988513e-01, -1.36815846e-01, + -3.11056733e-01, -4.88238633e-01, -6.86519742e-01 ] + - [ -8.75517845e-01, -6.83252215e-01, -7.65791297e-01, + 3.28232050e-01, -9.73797858e-01, -6.40972018e-01, + -7.62418985e-01, 2.15556622e-02, -9.35637474e-01, + -8.06622088e-01, -7.17187464e-01, 1.90812826e-01, + -9.22946811e-01, -8.89674604e-01, -7.23437428e-01, + 2.94139981e-01, -9.33384657e-01, -8.81361961e-01, + -5.93026817e-01, -4.62202013e-01, -4.69066381e-01, + 4.95014310e-01, -8.57668400e-01, -2.57949769e-01, + -4.65896010e-01, -1.64388537e-01, -6.59456968e-01, + -6.67522907e-01, -4.49564159e-01, -2.31914997e-01, + -6.05320215e-01, -7.88167536e-01, -4.67661679e-01, + -7.91698098e-02, -6.53228641e-01, -7.51458883e-01 ] + - [ -7.98053026e-01, -4.22122836e-01, -5.84102273e-01, + 6.21260405e-02, -8.20483565e-01, -5.06672204e-01, + -6.01151943e-01, -8.35031271e-03, -7.83975661e-01, + -5.54070950e-01, -5.84374905e-01, -6.70915842e-03, + -7.27907836e-01, -7.21795797e-01, -5.89062452e-01, + -1.13783598e-01, -6.96680427e-01, -7.49719381e-01, + -3.34535658e-01, -2.05446780e-01, -1.58605158e-01, + -1.64874017e-01, -5.20067811e-01, -3.86242270e-01, + -1.44508719e-01, -2.44060874e-01, -4.53462481e-01, + -4.17697668e-01, -1.45703673e-01, -8.95907879e-02, + -4.45290804e-01, -5.53250968e-01, -1.51741326e-01, + -2.41949677e-01, -4.17863548e-01, -5.93488216e-01 ] + - [ -6.89519465e-01, -3.37676167e-01, -4.18026924e-01, + 1.21474624e-01, -8.19623590e-01, -4.79943514e-01, + -4.32685316e-01, 2.92589903e-01, -8.38370681e-01, + -4.56281006e-01, -4.24999952e-01, -2.80032754e-02, + -6.97367787e-01, -6.90119147e-01, -4.28124964e-01, + -4.13483977e-02, -6.88361228e-01, -7.01383770e-01, + 5.13975620e-02, -1.16996348e-01, 7.31158257e-02, + -2.78988481e-02, -5.48555732e-01, -2.66712189e-01, + 1.05202198e-01, -5.17904758e-03, -5.54242015e-01, + -3.12613904e-01, 1.20796919e-01, -5.35377860e-02, + -4.41023409e-01, -5.18186331e-01, 1.16915464e-01, + -1.08151913e-01, -4.37309623e-01, -5.30729830e-01 ] + - [ -7.23902225e-01, -4.01484311e-01, -4.86160457e-01, + 2.04652429e-01, -8.50817621e-01, -4.70466375e-01, + -5.06119490e-01, 2.27936268e-01, -8.44221890e-01, + -5.06785572e-01, -4.37499940e-01, 1.44566417e-01, + -7.87563443e-01, -7.29002595e-01, -4.28124964e-01, + 1.04516268e-01, -7.84076095e-01, -7.53003240e-01, + 1.12112999e-01, -4.71862555e-02, 1.18110180e-01, + 5.17601967e-02, -4.77589667e-01, -4.05586958e-02, + 1.09826565e-01, -4.89041805e-02, -4.37549651e-01, + -1.63864791e-01, 1.50684953e-01, 1.39500260e-01, + -4.02125359e-01, -3.66903305e-01, 2.06467628e-01, + -3.09552670e-01, -3.11969638e-01, -5.10111570e-01 ] + - [ -8.18972647e-01, -7.89595008e-01, -6.86302304e-01, + 1.20785713e-01, -9.84932780e-01, -8.52846265e-01, + -7.06263483e-01, 2.26737380e-01, -9.87106979e-01, + -8.50978374e-01, -6.12499952e-01, 3.99923086e-01, + -9.78859365e-01, -9.28160131e-01, -6.15625024e-01, + 4.30781841e-01, -9.79442298e-01, -9.27635014e-01, + -3.63390446e-01, -5.53730607e-01, -3.40832412e-01, + 3.80505681e-01, -8.98771167e-01, -5.49094677e-01, + -3.17919075e-01, 3.89836669e-01, -8.95503223e-01, + -6.06883049e-01, -1.93026185e-01, 8.42038393e-02, + -8.24049473e-01, -8.51367354e-01, -1.84079647e-01, + 1.05646133e-01, -8.35724473e-01, -8.49328995e-01 ] + - [ -8.03438306e-01, -4.77997303e-01, -6.38041139e-01, + 2.78559923e-02, -8.43089581e-01, -5.72671056e-01, + -6.52987719e-01, 2.10353494e-01, -8.49341571e-01, + -5.03584027e-01, -6.07812524e-01, -3.98756266e-02, + -7.83628643e-01, -7.98921704e-01, -6.12499952e-01, + 1.97480917e-02, -7.89239109e-01, -7.96204209e-01, + -3.20709407e-01, -1.76403642e-01, -1.45106852e-01, + -1.11058712e-01, -5.19740582e-01, -3.23376358e-01, + -2.11560726e-01, 1.96838975e-01, -5.67442894e-01, + -1.06384099e-01, -1.00871742e-01, -2.53478289e-01, + -4.18506801e-01, -6.11301839e-01, -1.16915464e-01, + -2.11557627e-01, -4.42769945e-01, -5.98677993e-01 ] + - [ -7.91425049e-01, -5.70731938e-01, -6.13910556e-01, + 3.39275837e-01, -9.40984190e-01, -5.72076559e-01, + -6.27069771e-01, 1.31708980e-01, -9.13427174e-01, + -7.09331274e-01, -5.40624976e-01, 2.48349309e-01, + -8.98561478e-01, -8.40090394e-01, -5.40624976e-01, + 2.51575112e-01, -8.97549391e-01, -8.46781135e-01, + -2.05290139e-01, -2.33020186e-01, -1.45106852e-01, + 4.27160501e-01, -7.28045106e-01, -6.40677214e-02, + -1.14450872e-01, -1.47250295e-01, -5.48537850e-01, + -4.56944168e-01, -2.61518955e-02, -1.03356779e-01, + -5.40650666e-01, -6.46274507e-01, -2.73631811e-02, + -2.55891919e-01, -5.15252233e-01, -6.79154277e-01 ] + - [ -7.03189731e-01, -2.77496815e-01, -4.23704743e-01, + 8.68114233e-02, -7.63024509e-01, -3.92845929e-01, + -4.19726372e-01, 1.66043520e-01, -7.50403047e-01, + -3.73317778e-01, -3.87499928e-01, -1.44799232e-01, + -6.31599844e-01, -6.65084541e-01, -4.17187452e-01, + -6.41708374e-02, -6.25751138e-01, -6.41422749e-01, + -6.46228194e-02, -2.40876675e-02, 1.40607476e-01, + -3.01237762e-01, -3.45172346e-01, -2.48662889e-01, + 9.36415195e-02, -3.10893059e-02, -3.89117420e-01, + -6.24510050e-02, 1.98007464e-01, -3.37644756e-01, + -2.55327702e-01, -4.89904284e-01, 9.70149040e-02, + -1.03448272e-01, -2.93446302e-01, -3.85680258e-01 ] + - [ -8.68475556e-01, -7.81859338e-01, -8.28247011e-01, + 1.86274886e-01, -9.85207021e-01, -7.75141001e-01, + -8.25773954e-01, -8.61095190e-02, -9.42817330e-01, + -8.72874677e-01, -7.82812476e-01, 2.77499437e-01, + -9.60656881e-01, -9.19008732e-01, -8.03124964e-01, + 1.31823063e-01, -9.40093160e-01, -9.36626256e-01, + -6.21280432e-01, -6.23502254e-01, -6.17547750e-01, + 2.75410414e-01, -8.93797874e-01, -6.03728056e-01, + -6.23121381e-01, -2.17053592e-01, -6.96577430e-01, + -7.83553541e-01, -6.23910308e-01, 8.09670687e-02, + -7.96091855e-01, -8.36823583e-01, -6.16915405e-01, + -1.78983569e-01, -7.48051524e-01, -8.81397665e-01 ] + - [ -8.71168196e-01, -8.19125891e-01, -8.29666436e-01, + 1.50674582e-02, -9.78685617e-01, -8.61645579e-01, + -8.51691842e-01, 7.34828711e-02, -9.73096967e-01, + -8.54339004e-01, -8.51562440e-01, 2.42349386e-01, + -9.59866345e-01, -9.25184250e-01, -8.56249988e-01, + 2.19311476e-01, -9.55175161e-01, -9.32736874e-01, + -6.64562702e-01, -6.76525176e-01, -6.55793071e-01, + 4.00737524e-02, -8.57399166e-01, -7.61014342e-01, + -6.76300645e-01, 1.40818357e-01, -8.53448033e-01, + -7.13221490e-01, -6.73723578e-01, 9.62607861e-02, + -8.20114136e-01, -8.56209755e-01, -6.71641827e-01, + -9.20439363e-02, -7.81099975e-01, -8.81774366e-01 ] + - [ -8.23115170e-01, -6.58062875e-01, -6.53655052e-01, + 4.01752830e-01, -9.80420172e-01, -6.65868640e-01, + -6.73146129e-01, 3.82122755e-01, -9.74658906e-01, + -7.21371889e-01, -5.40624976e-01, 5.53079724e-01, + -9.65465009e-01, -8.62150908e-01, -5.50000012e-01, + 5.76302290e-01, -9.65584636e-01, -8.60755205e-01, + -3.94649863e-01, -2.87706017e-01, -3.11586082e-01, + 3.47228050e-01, -6.84280992e-01, -4.19018269e-02, + -3.41040432e-01, 2.20862031e-01, -6.59168720e-01, + -2.53136635e-01, -1.73100889e-01, -3.52094293e-01, + -5.02867103e-01, -7.33494699e-01, -1.66666687e-01, + -3.01475823e-01, -5.35944700e-01, -7.24440515e-01 ] + - [ -8.52319777e-01, -6.93283021e-01, -7.74308026e-01, + 3.43015075e-01, -9.70048368e-01, -6.06090069e-01, + -7.65298724e-01, -6.08959198e-02, -9.26802814e-01, + -8.33979845e-01, -7.23437428e-01, 1.43979669e-01, + -9.20492113e-01, -9.00161982e-01, -7.14062452e-01, + 2.45924592e-01, -9.31908846e-01, -8.94377768e-01, + -5.42530894e-01, -4.13407087e-01, -4.26321745e-01, + 7.04362273e-01, -8.80186558e-01, -4.59014773e-02, + -4.70520318e-01, -4.06838834e-01, -5.00782132e-01, + -6.86197281e-01, -3.84806991e-01, -5.22009313e-01, + -5.01930475e-01, -8.22184563e-01, -3.80596995e-01, + -4.44835842e-01, -5.45199275e-01, -8.06753755e-01 ] + - [ -7.21002460e-01, -2.38627315e-01, -4.02413070e-01, + 5.01550436e-01, -8.17363620e-01, -1.30752027e-01, + -4.02447820e-01, -2.40170181e-01, -6.34531319e-01, + -4.91422355e-01, -3.35937440e-01, -3.45198691e-01, + -5.80202162e-01, -6.93216503e-01, -3.46875012e-01, + -2.86794424e-01, -5.82147956e-01, -6.90396130e-01, + -1.42170191e-01, -5.40874600e-02, 1.46232843e-02, + 3.00391078e-01, -5.58404684e-01, 1.38768554e-01, + 5.20231724e-02, -4.13434863e-01, -2.82521307e-01, + -3.33667815e-01, 1.48194313e-01, -4.79903162e-01, + -2.58139014e-01, -5.69239378e-01, 1.39303446e-01, + -5.72803736e-01, -2.41088331e-01, -5.83027840e-01 ] + - [ -8.56048048e-01, -6.63370967e-01, -7.85663605e-01, + -3.31335664e-02, -8.81092906e-01, -6.73340380e-01, + -7.81137466e-01, 2.63430476e-01, -9.40073848e-01, + -6.50793552e-01, -7.31249928e-01, 4.41110134e-03, + -8.69120955e-01, -8.82212400e-01, -7.43749976e-01, + -6.56425953e-02, -8.47738683e-01, -8.94025445e-01, + -5.04057765e-01, -4.04742956e-01, -4.35320556e-01, + 1.05192184e-01, -6.55188560e-01, -3.05557728e-01, + -4.49711025e-01, -6.77669048e-03, -5.91414332e-01, + -4.02629972e-01, -3.05105925e-01, -5.84488809e-01, + -4.53228951e-01, -8.04542303e-01, -3.10945332e-01, + -7.19552100e-01, -4.31020737e-01, -8.24138820e-01 ] + - [ -8.30571651e-01, -7.10975528e-01, -7.28885710e-01, + 7.48192072e-02, -9.51222479e-01, -7.66871989e-01, + -7.43700504e-01, 5.08874655e-02, -9.38871026e-01, + -7.99351513e-01, -7.20312476e-01, 2.11486936e-01, + -9.26483870e-01, -8.88299882e-01, -7.25000024e-01, + 1.69687510e-01, -9.16618109e-01, -8.96692395e-01, + -3.72407675e-01, -4.63412642e-01, -3.31833541e-01, + 1.92578316e-01, -8.04545999e-01, -5.12127399e-01, + -3.31791878e-01, 7.18367100e-02, -7.48693407e-01, + -5.83509088e-01, -3.00124526e-01, 1.05420589e-01, + -7.34954119e-01, -7.54389465e-01, -2.91044831e-01, + 5.42243719e-02, -7.31632948e-01, -7.62916327e-01 ] + - [ -7.35501230e-01, -3.80299628e-01, -4.60610390e-01, + 8.85011792e-01, -9.42548752e-01, -1.38794184e-01, + -4.71562207e-01, -6.33155107e-01, -6.40530348e-01, + -7.50547886e-01, -3.99999976e-01, -6.46110058e-01, + -6.23234510e-01, -8.41922104e-01, -4.01562452e-01, + -4.22673941e-01, -6.62441611e-01, -8.18616629e-01, + 1.24736905e-01, -1.33688450e-01, 1.99100137e-01, + 9.89315867e-01, -8.23195696e-01, 3.72831821e-01, + 2.25433469e-01, -6.33633375e-01, -3.56980324e-01, + -5.99128485e-01, 4.02241588e-01, -9.47523236e-01, + -2.75276303e-01, -7.61654437e-01, 3.93034935e-01, + -8.55561256e-01, -3.11444581e-01, -7.34799862e-01 ] + - [ -8.66197169e-01, -8.54754210e-01, -8.38183105e-01, + 1.69487000e-02, -9.88310397e-01, -8.91537428e-01, + -8.57451379e-01, 1.01133585e-01, -9.87115562e-01, + -8.83520365e-01, -8.32812428e-01, 2.94369102e-01, + -9.78561759e-01, -9.43598509e-01, -8.40624988e-01, + 3.02565336e-01, -9.77610946e-01, -9.46182072e-01, + -6.65163815e-01, -7.18069315e-01, -6.82789683e-01, + 8.91516209e-02, -8.94269764e-01, -7.86297917e-01, + -7.01734185e-01, 1.73730969e-01, -8.86751652e-01, + -7.48166800e-01, -6.96139514e-01, 1.22281075e-01, + -8.55822682e-01, -8.82044792e-01, -6.99005008e-01, + -3.08504105e-02, -8.25773656e-01, -8.99258614e-01 ] + - [ -7.34879851e-01, -4.23412144e-01, -5.21646559e-01, + 4.47326899e-02, -8.24273050e-01, -5.37674546e-01, + -5.42116642e-01, 3.66207480e-01, -8.65636826e-01, + -4.41939354e-01, -4.46874917e-01, -2.32842565e-02, + -7.79388905e-01, -7.82587647e-01, -4.48437512e-01, + 1.10286474e-02, -7.81596124e-01, -7.85685241e-01, + 9.04718637e-02, -6.55006170e-02, 7.98650980e-02, + 3.51250172e-03, -4.46651161e-01, -4.67674732e-02, + 8.90172720e-02, 2.24644780e-01, -5.33334255e-01, + -1.35698318e-02, 2.17932701e-01, -3.08683515e-01, + -3.42218518e-01, -5.51599860e-01, 2.48756170e-01, + -4.07620668e-01, -3.40140164e-01, -5.80465317e-01 ] + - [ -8.54598165e-01, -7.56816626e-01, -7.87083030e-01, + 1.58142328e-01, -9.78015661e-01, -7.80390084e-01, + -8.04175615e-01, 1.12142324e-01, -9.61414397e-01, + -8.09283316e-01, -7.49999940e-01, 3.07555676e-01, + -9.58217502e-01, -9.07831788e-01, -7.54687488e-01, + 2.98759222e-01, -9.55420494e-01, -9.13179100e-01, + -5.81605077e-01, -5.18914700e-01, -5.29808760e-01, + 9.92918015e-02, -7.80182660e-01, -5.55068731e-01, + -5.39884448e-01, 1.39279366e-02, -7.16536045e-01, + -5.92589080e-01, -5.14321327e-01, 2.59006023e-02, + -7.21117556e-01, -7.82609463e-01, -5.12437820e-01, + -1.00021482e-01, -7.02311873e-01, -8.07100415e-01 ] + - [ -8.68889809e-01, -7.71978140e-01, -8.04116368e-01, + -1.03681684e-02, -9.60701704e-01, -8.31391692e-01, + -8.21454287e-01, 8.49157572e-02, -9.58991349e-01, + -8.15390825e-01, -8.34375024e-01, 2.12101460e-01, + -9.36122298e-01, -8.99581671e-01, -8.37499976e-01, + 1.53873682e-01, -9.26336408e-01, -9.14286196e-01, + -6.54944420e-01, -6.32092476e-01, -6.10798597e-01, + 4.77337837e-03, -8.28131914e-01, -7.40631342e-01, + -6.39306366e-01, 1.35991096e-01, -8.30132008e-01, + -6.73857689e-01, -6.41345024e-01, 1.02160811e-01, + -7.90874958e-01, -8.23579550e-01, -6.26865625e-01, + -1.39079392e-01, -7.42937922e-01, -8.64515662e-01 ] + - [ -7.41715014e-01, -4.61642921e-01, -5.11710465e-01, + 5.25114536e-02, -8.55776310e-01, -5.97066343e-01, + -5.29157639e-01, -2.84673572e-02, -8.25512171e-01, + -6.46311522e-01, -5.39062500e-01, 1.43602967e-01, + -7.93382645e-01, -7.37002492e-01, -5.40624976e-01, + 5.47895432e-02, -7.71323144e-01, -7.59558618e-01, + -1.56597555e-01, -2.83363342e-01, -1.15860522e-01, + 1.08213067e-01, -6.96494341e-01, -3.88545156e-01, + -1.00578129e-01, -2.15260386e-02, -6.41729355e-01, + -4.81898487e-01, -8.34370852e-02, 1.33247614e-01, + -6.19720697e-01, -6.14081979e-01, -8.20896029e-02, + 8.45992565e-02, -6.15516841e-01, -6.23926520e-01 ] + - [ -6.88483834e-01, -2.81238616e-01, -4.03832495e-01, + 3.84535909e-01, -8.28417659e-01, -2.74260581e-01, + -3.89488816e-01, -1.40860379e-01, -7.16988981e-01, + -5.45772135e-01, -3.78125012e-01, -2.20462263e-01, + -6.37087464e-01, -7.02138245e-01, -3.93749952e-01, + 7.52897263e-02, -6.86162114e-01, -6.46268547e-01, + -9.91892815e-03, -1.12368345e-01, 3.93700600e-02, + 4.48541880e-01, -6.79815292e-01, 6.08596802e-02, + 1.00577950e-01, -3.32827568e-01, -4.57435608e-01, + -4.82639015e-01, 1.35740995e-01, -2.52036214e-01, + -3.96997511e-01, -5.77053905e-01, 1.04477525e-01, + -1.22998357e-01, -4.36408103e-01, -5.37776649e-01 ] + - [ -8.11309040e-01, -5.56226015e-01, -6.60752296e-01, + 7.23222494e-02, -8.90390813e-01, -6.34255290e-01, + -6.57307386e-01, 3.83553863e-01, -9.32573259e-01, + -5.79611659e-01, -5.95312476e-01, 2.13146925e-01, + -8.79599273e-01, -8.24437857e-01, -6.01562500e-01, + 2.60500669e-01, -8.82978499e-01, -8.22516441e-01, + -2.76224852e-01, -1.91021264e-01, -1.72103405e-01, + 6.47056103e-02, -5.87031484e-01, -2.29797959e-01, + -1.58381522e-01, 2.65397787e-01, -6.28460884e-01, + -1.45543993e-01, -9.33997035e-02, -1.46733403e-01, + -4.74789917e-01, -6.08455658e-01, -1.04477644e-01, + -1.51604235e-01, -4.83258009e-01, -6.06111944e-01 ] + - [ -6.93661988e-01, -5.86395442e-01, -4.44996417e-01, + -7.57418871e-02, -9.05275762e-01, -7.81001389e-01, + -4.45644319e-01, -9.41693783e-04, -9.08073664e-01, + -7.84598887e-01, -4.24999952e-01, 1.15259051e-01, + -8.80428016e-01, -8.56855869e-01, -4.26562488e-01, + 7.99673796e-02, -8.74860883e-01, -8.69565368e-01, + -8.71658325e-03, -4.76416051e-01, -8.66141319e-02, + 2.11377859e-01, -8.49862218e-01, -6.05122149e-01, + -6.12717271e-02, 1.82831645e-01, -8.32879484e-01, + -6.47293448e-01, -1.36985779e-02, 2.95246720e-01, + -8.01389992e-01, -7.49570966e-01, -1.74129605e-02, + 1.26876116e-01, -7.78724015e-01, -7.80303597e-01 ] + - [ -8.55840921e-01, -6.67105556e-01, -7.85663605e-01, + -3.78609896e-02, -8.81214738e-01, -6.77515984e-01, + -7.82577395e-01, 2.61719823e-01, -9.40972567e-01, + -6.54246449e-01, -7.32812524e-01, -5.49674034e-04, + -8.69364679e-01, -8.84090126e-01, -7.46874988e-01, + -6.71240687e-02, -8.48493576e-01, -8.95410180e-01, + -5.02254367e-01, -4.08276796e-01, -4.35320556e-01, + 1.21975541e-01, -6.63493633e-01, -2.99570203e-01, + -4.49711025e-01, 3.48436832e-03, -5.99174440e-01, + -4.03611243e-01, -3.00124526e-01, -6.15773439e-01, + -4.48487341e-01, -8.12688947e-01, -3.05970132e-01, + -7.34461069e-01, -4.32623148e-01, -8.29644561e-01 ] + - [ -8.29328895e-01, -7.38075435e-01, -6.03974462e-01, + 1.28216267e-01, -9.82260287e-01, -8.50754619e-01, + -7.32181430e-01, 5.24122119e-01, -9.97080445e-01, + -7.42644310e-01, -5.46875000e-01, 5.87431431e-01, + -9.83379126e-01, -8.96802008e-01, -5.53124964e-01, + 5.90665102e-01, -9.82738733e-01, -8.98758829e-01, + -2.67207742e-01, -3.87852132e-01, -2.17097878e-01, + -7.12411404e-02, -6.71926856e-01, -5.33830285e-01, + -2.06936479e-01, 9.74239111e-01, -9.32268381e-01, + -1.36469185e-01, -8.09464455e-02, 1.05788708e-02, + -6.96785092e-01, -7.49440908e-01, -8.95522237e-02, + -6.80893064e-02, -6.87578440e-01, -7.61850417e-01 ] + - [ -8.07373643e-01, -5.97183466e-01, -6.69268966e-01, + -2.12531686e-02, -8.86579692e-01, -6.94513083e-01, + -6.76025927e-01, 3.55889440e-01, -9.39820528e-01, + -6.16785884e-01, -6.18749976e-01, 6.48179054e-02, + -8.69761825e-01, -8.60906482e-01, -6.18749976e-01, + 1.97558641e-01, -8.86895895e-01, -8.49477470e-01, + -3.55575681e-01, -3.54800403e-01, -2.80089974e-01, + 4.43165302e-02, -6.66457772e-01, -4.02806580e-01, + -2.46242762e-01, 3.04149270e-01, -7.54548907e-01, + -3.62985075e-01, -1.88044786e-01, -2.39790976e-01, + -5.72116256e-01, -7.43708670e-01, -1.99005008e-01, + -2.05280364e-01, -5.84537625e-01, -7.27754951e-01 ] + - [ -8.17937016e-01, -6.84297919e-01, -7.17530131e-01, + 4.39212322e-02, -9.30250943e-01, -7.36805856e-01, + -7.17782557e-01, 1.45934105e-01, -9.44487810e-01, + -7.61010587e-01, -6.90624952e-01, 3.40795517e-02, + -8.94562781e-01, -9.00013328e-01, -6.92187488e-01, + 2.60642052e-01, -9.23472345e-01, -8.78175318e-01, + -4.18094456e-01, -4.54382420e-01, -4.21822250e-01, + 1.94235325e-01, -7.56946743e-01, -4.00985777e-01, + -3.36416245e-01, 1.09325767e-01, -7.49140382e-01, + -5.49229860e-01, -2.67745912e-01, -1.92371309e-01, + -6.66266799e-01, -8.08143973e-01, -2.98507512e-01, + -1.26756191e-01, -6.83045208e-01, -7.88174212e-01 ] + - [ -7.54971027e-01, -2.03649044e-01, -4.60610390e-01, + 1.77279949e-01, -7.01831102e-01, -1.77906156e-01, + -4.84521210e-01, 2.86059976e-01, -7.27928758e-01, + -2.12482333e-01, -4.49999988e-01, -1.71045601e-01, + -5.42180955e-01, -5.83832085e-01, -4.49999988e-01, + -2.68469334e-01, -5.07559419e-01, -6.16350532e-01, + -2.10700393e-01, 8.53002071e-02, 2.58718729e-02, + -4.90997434e-02, -2.51140893e-01, 2.26276398e-01, + 1.96532011e-02, -1.32375002e-01, -2.78390408e-01, + -9.81855392e-03, 7.34744072e-02, -3.88358653e-01, + -7.73746371e-02, -3.68542910e-01, 6.71641827e-02, + -4.99451637e-01, -4.60711122e-02, -3.87982249e-01 ] + - [ -9.35169816e-01, -6.27752423e-01, -8.41022015e-01, + -1.96838498e-01, -8.28027725e-01, -7.07365394e-01, + -8.67530584e-01, -9.83642340e-02, -8.55550230e-01, + -7.23338664e-01, -8.40624928e-01, -1.89163029e-01, + -7.84274220e-01, -8.75158787e-01, -8.49999964e-01, + -1.80141389e-01, -7.75985241e-01, -8.80312860e-01, + -8.24466527e-01, -5.12368917e-01, -6.35545552e-01, + -1.79390848e-01, -6.15910888e-01, -6.10820889e-01, + -6.73988461e-01, -1.17816091e-01, -6.58389688e-01, + -6.56059146e-01, -6.73723578e-01, -2.28584766e-01, + -5.67772627e-01, -7.86009908e-01, -6.81592107e-01, + -3.06937337e-01, -5.57302237e-01, -7.99948096e-01 ] + - [ -7.59113491e-01, -3.52827072e-01, -5.00354886e-01, + 3.51664424e-01, -8.49000812e-01, -3.32088411e-01, + -4.94600415e-01, -1.75973952e-01, -7.35795259e-01, + -5.98082423e-01, -4.90624905e-01, -2.38363385e-01, + -6.56525195e-01, -7.36344934e-01, -5.10937452e-01, + 6.55645132e-02, -7.08696723e-01, -6.80279613e-01, + -2.49173462e-01, -1.75903976e-01, -1.15860522e-01, + 4.16879773e-01, -6.95658445e-01, -1.17313862e-03, + -6.58959150e-02, -3.25969934e-01, -4.74304438e-01, + -5.15570939e-01, -5.35492301e-02, -2.56732106e-01, + -4.20585155e-01, -6.11551166e-01, -8.45771432e-02, + -1.15945816e-01, -4.61525023e-01, -5.66591263e-01 ] + - [ -8.27257633e-01, -7.54390538e-01, -6.76366210e-01, + 2.38420129e-01, -9.88396525e-01, -8.06416273e-01, + -6.97624207e-01, 3.38663340e-01, -9.90957916e-01, + -8.15213025e-01, -5.76562405e-01, 6.03063226e-01, + -9.85731244e-01, -8.97658229e-01, -5.79687476e-01, + 5.81084013e-01, -9.83920932e-01, -9.02965844e-01, + -2.74421394e-01, -4.35075521e-01, -2.32845843e-01, + 3.81189942e-01, -8.42589736e-01, -4.06989813e-01, + -2.39306450e-01, 3.76266837e-01, -8.34563673e-01, + -4.72762227e-01, -1.08343780e-01, 3.52851272e-01, + -8.05836082e-01, -7.30924010e-01, -9.45274234e-02, + 1.17181897e-01, -7.70069718e-01, -7.75298834e-01 ] + - [ -8.38442445e-01, -7.54223824e-01, -7.53016353e-01, + 8.29123259e-02, -9.67368960e-01, -8.02565515e-01, + -7.73938060e-01, 6.73617125e-02, -9.56115961e-01, + -8.26356232e-01, -7.31249928e-01, 2.60109782e-01, + -9.50571537e-01, -9.09356296e-01, -7.40625024e-01, + 2.41556287e-01, -9.44862962e-01, -9.13658261e-01, + -4.04268146e-01, -5.08515120e-01, -3.76827896e-01, + 2.22146749e-01, -8.35581779e-01, -5.47209620e-01, + -3.75722647e-01, 1.37400985e-01, -7.96615422e-01, + -6.11382484e-01, -3.39975178e-01, 1.47119880e-01, + -7.81957924e-01, -7.87554324e-01, -3.23383152e-01, + 4.47167158e-02, -7.67665744e-01, -8.03602040e-01 ] + - [ -8.59154940e-01, -6.55951023e-01, -7.79985785e-01, + 4.84078646e-01, -9.77067888e-01, -5.01702547e-01, + -8.05615544e-01, -4.00415123e-01, -8.18324208e-01, + -8.60825241e-01, -7.67187476e-01, -1.00445628e-01, + -8.53334546e-01, -9.00395036e-01, -7.81250000e-01, + -8.98415446e-02, -8.46162200e-01, -9.02790189e-01, + -5.33513784e-01, -3.93723130e-01, -3.85826766e-01, + 7.99245119e-01, -9.02916253e-01, -1.39294863e-02, + -3.98844004e-01, -6.49153471e-01, -4.21193242e-01, + -7.78396606e-01, -3.39975178e-01, -5.22619188e-01, + -4.91479874e-01, -8.10190141e-01, -3.50746274e-01, + -6.10322893e-01, -4.77391064e-01, -8.18933189e-01 ] + - [ -8.63090277e-01, -8.91674101e-01, -8.32505345e-01, + 9.24586058e-02, -9.97723103e-01, -9.01267052e-01, + -7.45140314e-01, 3.87024879e-02, -9.95651662e-01, + -9.52926993e-01, -7.31249928e-01, 3.83995414e-01, + -9.94391859e-01, -9.63588595e-01, -7.37499952e-01, + 4.04810190e-01, -9.94362772e-01, -9.63913620e-01, + -5.26901126e-01, -7.24891365e-01, -4.57817793e-01, + 5.89796662e-01, -9.90465760e-01, -6.95539951e-01, + -4.35838163e-01, 1.03472471e-01, -9.26866829e-01, + -8.77206564e-01, -3.42465758e-01, 1.70367718e-01, + -9.19075012e-01, -9.25572336e-01, -3.50746274e-01, + 1.50918007e-01, -9.20068800e-01, -9.26115334e-01 ] + - [ -8.45898926e-01, -8.65587115e-01, -8.31085861e-01, + 6.87358379e-02, -9.93877828e-01, -8.90264392e-01, + -7.76817858e-01, 7.27375746e-02, -9.91544127e-01, + -9.23862755e-01, -7.12499976e-01, 3.80095601e-01, + -9.90771353e-01, -9.55456376e-01, -7.20312476e-01, + 3.80679011e-01, -9.89831030e-01, -9.57591534e-01, + -5.76795936e-01, -7.15632021e-01, -6.08548939e-01, + 3.83862257e-01, -9.62910056e-01, -7.07098126e-01, + -6.30057812e-01, 2.27600336e-02, -8.57855737e-01, + -8.17385077e-01, -5.79078555e-01, 1.58742428e-01, + -8.91084909e-01, -9.02347505e-01, -5.97014904e-01, + 2.07115412e-02, -8.70870769e-01, -9.16943431e-01 ] + - [ -8.07580769e-01, -6.92466378e-01, -6.45138383e-01, + 1.85107350e-01, -9.68359292e-01, -7.65267611e-01, + -6.67386591e-01, 3.62672806e-01, -9.76899147e-01, + -7.43993402e-01, -5.59374988e-01, 3.84565592e-01, + -9.56041574e-01, -8.90029550e-01, -5.59374988e-01, + 4.51908231e-01, -9.60418224e-01, -8.86156023e-01, + -3.40547085e-01, -4.35752153e-01, -2.93588281e-01, + 2.60136724e-01, -8.03539932e-01, -4.38950241e-01, + -2.71676362e-01, 3.76491189e-01, -8.24868441e-01, + -4.45844054e-01, -1.70610249e-01, -1.20023251e-01, + -6.89640820e-01, -7.96295047e-01, -1.89054728e-01, + -7.05472231e-02, -7.03304410e-01, -7.80720472e-01 ] + - [ -6.84962749e-01, -3.42234254e-01, -4.15188074e-01, + 1.31199002e-01, -8.11065197e-01, -4.54454720e-01, + -4.35565174e-01, 4.65944648e-01, -8.59367013e-01, + -3.69812310e-01, -3.73437464e-01, -3.31705809e-02, + -7.31674075e-01, -7.30084777e-01, -3.76562476e-01, + 1.18722916e-02, -7.35698938e-01, -7.31335402e-01, + 2.27532268e-01, 2.09450722e-02, 2.03599572e-01, 1.54644251e-02, + -3.98188055e-01, 5.89671135e-02, 2.23121405e-01, + 2.38456130e-01, -4.90215957e-01, 8.54985714e-02, + 3.32503080e-01, -3.29651892e-01, -2.54697025e-01, + -4.77581501e-01, 3.65671635e-01, -4.25230503e-01, + -2.55366802e-01, -5.09159744e-01 ] + - [ -6.78334713e-01, -2.86944270e-01, -3.74024153e-01, + 5.20415902e-01, -8.62362862e-01, -2.46171236e-01, + -3.88048947e-01, -4.36919928e-02, -7.43605733e-01, + -5.21828055e-01, -3.20312500e-01, -7.13944435e-04, + -7.01571941e-01, -6.80955768e-01, -3.24999988e-01, + -2.56810784e-02, -6.93234384e-01, -6.96856380e-01, + 6.52238131e-02, -6.35564327e-04, 1.40607476e-01, + 3.61774921e-01, -5.81136465e-01, 1.64258480e-01, + 2.18497038e-01, -3.23828518e-01, -3.64868462e-01, + -3.37343812e-01, 2.55292654e-01, -7.70286322e-02, + -3.46354485e-01, -4.31020379e-01, 2.78607130e-01, + -3.07576358e-01, -3.06368053e-01, -5.00431180e-01 ] + - [ -8.30985904e-01, -9.44986343e-01, -8.99219275e-01, + -6.07139468e-02, -9.97569561e-01, -9.54975426e-01, + -8.73290122e-01, -1.30460858e-02, -9.97088850e-01, + -9.64733422e-01, -8.28125000e-01, 3.08642983e-01, + -9.96563613e-01, -9.78892088e-01, -8.34375024e-01, + 3.41492414e-01, -9.96961415e-01, -9.78819549e-01, + -7.18665481e-01, -8.74966860e-01, -8.38020265e-01, + 2.11275816e-01, -9.81658041e-01, -8.83416891e-01, + -8.54335248e-01, 1.52193189e-01, -9.57754731e-01, + -9.05621827e-01, -8.80448341e-01, 2.13571548e-01, + -9.48831856e-01, -9.50919092e-01, -8.83084595e-01, + 1.72393918e-01, -9.46010053e-01, -9.53239739e-01 ] + - [ -6.76470578e-01, -3.19556117e-01, -3.86799216e-01, + 2.56285071e-01, -8.32039118e-01, -4.01064932e-01, + -4.12526965e-01, 2.06828833e-01, -8.00237119e-01, + -4.42098677e-01, -3.85937452e-01, 5.23476601e-02, + -7.02287912e-01, -6.60573840e-01, -3.74999940e-01, + 4.45728302e-02, -7.08271265e-01, -6.85892940e-01, + 2.09498048e-01, 1.60851479e-02, 2.10348725e-01, + -2.67827511e-03, -4.15850163e-01, 3.21424007e-03, + 2.18497038e-01, -1.27751589e-01, -3.63508165e-01, + -1.27289593e-01, 2.37857938e-01, 1.51417136e-01, + -3.35481584e-01, -2.83869267e-01, 2.86069512e-01, + -2.93249309e-01, -2.43249595e-01, -4.34287488e-01 ] + - [ -8.35956931e-01, -7.39372969e-01, -7.70049691e-01, + 3.09358835e-02, -9.47967172e-01, -7.78950155e-01, + -7.63858855e-01, 1.36997938e-01, -9.63043749e-01, + -8.07436943e-01, -7.40625024e-01, 1.20166659e-01, + -9.27211106e-01, -9.15304422e-01, -7.37499952e-01, + 3.13785076e-01, -9.49022293e-01, -8.99160981e-01, + -4.85422373e-01, -5.10398030e-01, -5.00562429e-01, + 2.14428186e-01, -7.98141062e-01, -4.59925175e-01, + -4.26589608e-01, 7.27100372e-02, -7.68093765e-01, + -6.18717909e-01, -3.69862974e-01, -1.13488793e-01, + -7.21695781e-01, -8.31115901e-01, -3.98009956e-01, + -5.50290346e-02, -7.36459911e-01, -8.13664079e-01 ] + - [ -6.52651191e-01, -2.15761364e-01, -3.74024153e-01, + 1.30602479e-01, -7.37701893e-01, -3.09946537e-01, + -3.85169148e-01, 5.40162563e-01, -8.02021444e-01, + -1.70293510e-01, -2.64062464e-01, -6.12336397e-02, + -6.54574633e-01, -6.50368094e-01, -2.70312488e-01, + -1.17170811e-01, -6.38616383e-01, -6.72930360e-01, + 2.51577973e-01, 1.64294124e-01, 3.02587152e-01, + -9.91052985e-02, -2.95624495e-01, 9.03559923e-02, + 2.55491376e-01, 2.98721194e-01, -3.89505208e-01, + 3.67888331e-01, 4.29638743e-01, -3.03920031e-01, + -1.18155062e-01, -3.31888258e-01, 4.32835698e-01, + -5.09816647e-01, -7.48904943e-02, -3.91309917e-01 ] + - [ -7.82725751e-01, -5.57876706e-01, -5.88360548e-01, + 2.21244454e-01, -9.22617674e-01, -6.16007328e-01, + -6.02591753e-01, 3.13461542e-01, -9.30410981e-01, + -6.38315439e-01, -5.06250024e-01, 3.68415713e-01, + -9.07092452e-01, -8.14287961e-01, -5.09374976e-01, + 2.92291641e-01, -8.96015286e-01, -8.31734180e-01, + -7.24377036e-02, -1.92839205e-01, -7.31158853e-02, + 1.78207994e-01, -6.16807818e-01, -1.46612823e-01, + -6.82081580e-02, 1.04466558e-01, -5.93959093e-01, + -2.68601835e-01, 3.73589993e-03, 1.63225532e-01, + -5.63970685e-01, -5.35846651e-01, 6.21891022e-02, + -2.23043799e-01, -4.91010308e-01, -6.38652444e-01 ] + - [ -8.53355408e-01, -9.06804383e-01, -8.18310857e-01, + 5.62666655e-02, -9.98921931e-01, -9.29972887e-01, + -8.25773954e-01, 1.04509592e-01, -9.98623729e-01, + -9.40644503e-01, -7.68750012e-01, 4.62307453e-01, + -9.98264849e-01, -9.61453617e-01, -7.73437500e-01, + 4.80274796e-01, -9.98216093e-01, -9.61802006e-01, + -5.55154800e-01, -7.22270727e-01, -5.11811018e-01, + 3.91887546e-01, -9.64072526e-01, -7.23439693e-01, + -4.82080996e-01, 4.20817375e-01, -9.70534980e-01, + -7.89552212e-01, -4.29638922e-01, 4.39246058e-01, + -9.49844778e-01, -8.92282069e-01, -4.45273697e-01, + 4.15096402e-01, -9.48832452e-01, -8.93578231e-01 ] + - [ -8.12551796e-01, -4.00764823e-01, -5.85521698e-01, + 7.32194543e-01, -9.21403944e-01, -1.31685317e-01, + -6.08351350e-01, -4.96439040e-01, -6.63378656e-01, + -7.14773655e-01, -5.67187488e-01, -4.19487655e-01, + -6.48058772e-01, -8.04696798e-01, -5.73437452e-01, + -2.43001997e-01, -6.80448771e-01, -7.84852505e-01, + -3.42350483e-01, -1.19268239e-01, -1.09111309e-01, + 7.87847400e-01, -7.45757699e-01, 4.23329115e-01, + -1.00578129e-01, -8.14441621e-01, -1.66137159e-01, + -6.03015721e-01, -3.36239338e-02, -7.87649035e-01, + -1.68022752e-01, -6.65911436e-01, -2.98507214e-02, + -7.54827917e-01, -2.05682278e-01, -6.56051874e-01 ] + - [ -8.73239458e-01, -7.89673924e-01, -8.15472007e-01, + 2.26045966e-01, -9.89030123e-01, -7.71658242e-01, + -7.75377929e-01, 2.83480883e-02, -9.73052740e-01, + -8.87600243e-01, -7.34375000e-01, 3.40726137e-01, + -9.72952962e-01, -9.25824642e-01, -7.45312452e-01, + 3.82893085e-01, -9.74063516e-01, -9.23149526e-01, + -6.13465607e-01, -5.74123561e-01, -5.25309324e-01, + 6.48878455e-01, -9.50446188e-01, -3.76434922e-01, + -5.60693622e-01, -3.41913104e-02, -7.72765756e-01, + -7.27218032e-01, -5.16811967e-01, -7.88900852e-02, + -7.48963356e-01, -8.50170016e-01, -5.24875641e-01, + 1.60201788e-02, -7.77983248e-01, -8.31035137e-01 ] + - [ -8.34299922e-01, -8.56768727e-01, -7.45919108e-01, + -7.24172592e-03, -9.87991333e-01, -9.14806724e-01, + -8.04175615e-01, 2.06624985e-01, -9.96416748e-01, + -8.88348758e-01, -7.03124940e-01, 3.94523740e-01, + -9.89310682e-01, -9.49368536e-01, -7.06250012e-01, + 4.22184944e-01, -9.89644349e-01, -9.49309528e-01, + -5.62969685e-01, -6.86352372e-01, -5.36557913e-01, + 2.74194837e-01, -9.29872096e-01, -7.14838088e-01, + -5.44508696e-01, 5.21168232e-01, -9.64792311e-01, + -6.76362753e-01, -4.64508116e-01, 2.21949339e-01, + -9.04137671e-01, -8.96197140e-01, -4.65174139e-01, + 2.53716469e-01, -9.13423121e-01, -8.92044008e-01 ] + - [ -8.36164057e-01, -6.19504869e-01, -7.18949556e-01, + 5.77812195e-02, -8.94320488e-01, -6.42233491e-01, + -7.16342688e-01, -5.50228357e-03, -8.82835031e-01, + -7.22335100e-01, -7.04687476e-01, 4.64308262e-03, + -8.39701772e-01, -8.48827004e-01, -7.09374964e-01, + -7.47060776e-03, -8.32510352e-01, -8.57616663e-01, + -5.73189139e-01, -4.78351355e-01, -5.07311583e-01, + 2.74213791e-01, -7.99066722e-01, -3.85954738e-01, + -4.98265982e-01, -1.68905258e-02, -6.93972468e-01, + -5.83980203e-01, -4.54545498e-01, -1.87663972e-01, + -6.36542857e-01, -7.95231044e-01, -4.65174139e-01, + -2.68767476e-01, -6.22852206e-01, -8.04947495e-01 ] + - [ -7.05882311e-01, -3.90389085e-01, -4.12349164e-01, + 5.21359921e-01, -9.16332185e-01, -4.00386512e-01, + -4.34125304e-01, 5.95165610e-01, -9.21306968e-01, + -4.46851254e-01, -2.37499952e-01, 4.45624113e-01, + -8.76395702e-01, -7.46549129e-01, -2.40624964e-01, + 4.63142037e-01, -8.76773179e-01, -7.49015749e-01, + 2.50375748e-01, 3.64146233e-02, 2.95838118e-01, 3.08227420e-01, + -5.24263144e-01, 2.04800844e-01, 2.43930459e-01, + 5.06321311e-01, -5.98905325e-01, 1.95061207e-01, + 3.99750948e-01, -2.39047647e-01, -2.94540584e-01, + -4.63367105e-01, 4.07960176e-01, -2.98971534e-01, + -2.94995010e-01, -4.79940653e-01 ] + - [ -7.70298243e-01, -4.55148637e-01, -5.48616052e-01, + 7.60891557e-01, -9.50593829e-01, -2.53990173e-01, + -5.80993533e-01, -6.33885026e-01, -6.67788625e-01, + -7.92304277e-01, -5.07812500e-01, -5.22274852e-01, + -6.88767910e-01, -8.64457726e-01, -5.07812500e-01, + -3.52904558e-01, -7.17594385e-01, -8.50452900e-01, + 4.89929914e-02, -1.80145860e-01, 1.36107922e-01, 1., + -8.55680823e-01, 2.78789639e-01, 1.23699307e-01, + -6.27484500e-01, -3.78966212e-01, -6.29807234e-01, + 3.15068483e-01, -8.30706358e-01, -3.52365613e-01, + -7.74869204e-01, 3.08457732e-01, -7.37796903e-01, + -3.87530208e-01, -7.49359131e-01 ] + - [ -8.47348809e-01, -8.52534473e-01, -7.91341364e-01, + -2.10610628e-02, -9.85255837e-01, -9.06983376e-01, + -8.37293029e-01, 1.71784997e-01, -9.92631555e-01, + -8.76120746e-01, -7.53124952e-01, 3.32006216e-01, + -9.84007716e-01, -9.48666811e-01, -7.64062524e-01, + 3.50165367e-01, -9.83406663e-01, -9.48733628e-01, + -5.28103471e-01, -6.44283414e-01, -5.36557913e-01, + 1.15599632e-01, -8.72439861e-01, -7.22387910e-01, + -5.67630112e-01, 4.50348854e-01, -9.28263724e-01, + -6.07990503e-01, -4.64508116e-01, 1.65458679e-01, + -8.68346334e-01, -8.74751210e-01, -4.87562180e-01, + 1.53734684e-01, -8.68465066e-01, -8.72094512e-01 ] + - [ -8.03024054e-01, -5.12236893e-01, -6.08232737e-01, + -9.21230316e-02, -8.27953100e-01, -6.40939236e-01, + -6.32829309e-01, 3.14905047e-01, -8.95947576e-01, + -5.36851466e-01, -6.25000000e-01, -1.52689397e-01, + -7.44410932e-01, -8.01008403e-01, -6.35937512e-01, + 1.41968369e-01, -7.97198057e-01, -7.56359339e-01, + -4.31319535e-01, -3.14111292e-01, -2.86839068e-01, + -6.67948127e-02, -5.86966395e-01, -3.92136753e-01, + -2.76300609e-01, 2.19347477e-01, -6.89822197e-01, + -3.19966197e-01, -2.35367477e-01, -2.58953750e-01, + -4.82329726e-01, -6.79695129e-01, -2.31343329e-01, + -2.67065346e-01, -4.94708955e-01, -6.79094195e-01 ] + - [ -8.46313179e-01, -6.11543059e-01, -7.48757958e-01, + 4.04047966e-03, -8.65844131e-01, -6.18283272e-01, + -7.55219579e-01, 2.11495519e-01, -9.05133367e-01, + -6.06010914e-01, -6.93749964e-01, -4.80347276e-02, + -8.35706115e-01, -8.61833215e-01, -7.04687476e-01, + -1.29315853e-01, -8.10414553e-01, -8.76325965e-01, + -4.61376667e-01, -3.44512582e-01, -3.63329589e-01, + 3.15290689e-02, -5.91321766e-01, -2.82089710e-01, + -3.98844004e-01, -1.11011863e-02, -5.51382363e-01, + -3.37624311e-01, -2.57783234e-01, -5.41617990e-01, + -4.16281044e-01, -7.56932855e-01, -2.56218910e-01, + -7.15910375e-01, -3.84332120e-01, -7.87177801e-01 ] + - [ -7.37365365e-01, -3.07119310e-01, -4.87579882e-01, + 5.05073071e-02, -7.62514770e-01, -4.15397942e-01, + -4.94600415e-01, 2.00177073e-01, -7.68680215e-01, + -3.71369362e-01, -4.78124976e-01, -6.20713234e-02, + -6.58875704e-01, -6.63025022e-01, -4.79687452e-01, + -2.51158476e-02, -6.58059359e-01, -6.62279725e-01, + -1.13315403e-01, 5.81705570e-03, 2.58718729e-02, + -8.77427459e-02, -4.13543940e-01, -1.08038664e-01, + 3.58381271e-02, 1.69357061e-02, -3.98402870e-01, + -2.15741396e-02, 8.09464455e-02, -1.32946670e-01, + -2.83193350e-01, -4.07318294e-01, 6.46766424e-02, + -1.02880478e-01, -3.03079844e-01, -3.96385789e-01 ] + - [ -8.45484674e-01, -7.48677850e-01, -7.58694112e-01, + 1.70154572e-02, -9.56423283e-01, -8.11746895e-01, + -7.68178523e-01, 3.27485919e-01, -9.85610664e-01, + -7.74470448e-01, -7.10937500e-01, 3.54505301e-01, + -9.60808635e-01, -9.00798619e-01, -7.18750000e-01, + 3.88076782e-01, -9.61691260e-01, -8.99600148e-01, + -4.23504710e-01, -4.29966390e-01, -3.83576989e-01, + 1.71058774e-01, -7.63704300e-01, -4.45591390e-01, + -3.64161789e-01, 4.26216722e-01, -8.28824401e-01, + -3.90707791e-01, -2.77708590e-01, 6.64962530e-02, + -7.28553653e-01, -7.63607323e-01, -2.93532312e-01, + 5.89330196e-02, -7.32503295e-01, -7.61965215e-01 ] + - [ -8.44863296e-01, -8.93173456e-01, -8.18310857e-01, + 1.28722191e-03, -9.93791640e-01, -9.23950255e-01, + -8.53131771e-01, 1.14861608e-01, -9.96885240e-01, + -9.21433389e-01, -7.53124952e-01, 3.78622293e-01, + -9.93784785e-01, -9.62047279e-01, -7.54687488e-01, + 4.08025265e-01, -9.94130552e-01, -9.62022960e-01, + -5.99038243e-01, -7.39313424e-01, -6.26546621e-01, + 2.55997419e-01, -9.40284431e-01, -7.49170244e-01, + -5.93063593e-01, 2.97754884e-01, -9.48891699e-01, + -7.98963249e-01, -5.29265285e-01, 2.96023846e-01, + -9.33942616e-01, -9.09964800e-01, -5.54726362e-01, + 2.74680257e-01, -9.31632280e-01, -9.07856941e-01 ] + - [ -8.50869894e-01, -9.28742230e-01, -8.29666436e-01, + -2.09209919e-02, -9.98062551e-01, -9.51582253e-01, + -8.57451379e-01, 6.76307678e-02, -9.99055624e-01, + -9.52202201e-01, -7.92187452e-01, 3.97836804e-01, + -9.98148680e-01, -9.71232474e-01, -7.99999952e-01, + 4.16414976e-01, -9.98069644e-01, -9.71516371e-01, + -5.77998281e-01, -7.70406485e-01, -5.74803114e-01, + 3.33827138e-01, -9.72895384e-01, -7.95446396e-01, + -5.19075215e-01, 4.21167374e-01, -9.81006742e-01, + -8.25573802e-01, -4.89414692e-01, 4.49644923e-01, + -9.65004802e-01, -9.12595510e-01, -4.97512460e-01, + 4.17328358e-01, -9.63521540e-01, -9.15087938e-01 ] + - [ -8.31193030e-01, -6.63668811e-01, -6.83463454e-01, + -1.97485089e-02, -9.21774864e-01, -7.65070617e-01, + -7.06263483e-01, 5.35022259e-01, -9.82506096e-01, + -6.42710567e-01, -6.12499952e-01, 1.93123817e-01, + -9.20064688e-01, -8.85975718e-01, -6.09375000e-01, + 2.87245989e-01, -9.29186940e-01, -8.79970968e-01, + -3.06883097e-01, -3.57130766e-01, -2.50843644e-01, + -4.93139029e-02, -6.12455130e-01, -4.13005054e-01, + -2.92485595e-01, 4.67137456e-01, -7.53841460e-01, + -1.62458241e-01, -6.60025477e-02, -5.49121022e-01, + -5.12071669e-01, -8.08190167e-01, -7.46268630e-02, + -4.05996561e-01, -5.60351789e-01, -7.78731644e-01 ] + - [ -8.38028193e-01, -9.37899947e-01, -8.92122090e-01, + -5.00240922e-02, -9.97351527e-01, -9.50736344e-01, + -8.79049659e-01, 6.18267059e-03, -9.97052491e-01, + -9.58295107e-01, -8.24999988e-01, 3.17779303e-01, + -9.96141136e-01, -9.76422966e-01, -8.28125000e-01, + 3.48222017e-01, -9.96539652e-01, -9.76738930e-01, + -7.06642628e-01, -8.56690049e-01, -8.06524158e-01, + 1.90534830e-01, -9.73213315e-01, -8.76532614e-01, + -8.21965337e-01, 1.56822443e-01, -9.51495886e-01, + -8.90472174e-01, -8.45579088e-01, 2.06099749e-01, + -9.40237105e-01, -9.43483353e-01, -8.55721414e-01, + 1.50764108e-01, -9.33994710e-01, -9.46633399e-01 ] + - [ -8.48798692e-01, -9.20819402e-01, -8.14052522e-01, + 6.12688065e-03, -9.98225808e-01, -9.44777131e-01, + -8.27213824e-01, 7.38279819e-02, -9.98203397e-01, + -9.47947919e-01, -7.92187452e-01, 4.44093943e-01, + -9.98357058e-01, -9.63966846e-01, -7.92187452e-01, + 4.59004402e-01, -9.98285949e-01, -9.65148389e-01, + -6.59152389e-01, -7.83264220e-01, -5.90551138e-01, + 4.53172565e-01, -9.90652025e-01, -7.82068133e-01, + -5.90751469e-01, 5.11887550e-01, -9.90395367e-01, + -7.98413038e-01, -5.26774645e-01, 6.33799076e-01, + -9.82361555e-01, -8.93150985e-01, -5.39801002e-01, + 5.70868850e-01, -9.78595734e-01, -8.99831176e-01 ] + - [ -8.12344670e-01, -6.23276949e-01, -6.76366210e-01, + 5.79364300e-02, -9.14289415e-01, -6.96827769e-01, + -6.96184278e-01, -6.59972429e-03, -8.90530288e-01, + -7.39631653e-01, -6.87500000e-01, 1.59928799e-01, + -8.76694202e-01, -8.38419914e-01, -6.87500000e-01, + 7.69084692e-02, -8.57590795e-01, -8.55153143e-01, + -3.21911693e-01, -3.80622506e-01, -2.57592857e-01, + 1.27493262e-01, -7.39088655e-01, -4.48966444e-01, + -2.55491316e-01, 2.23946571e-03, -6.79459691e-01, + -5.27963400e-01, -2.37858057e-01, 5.23062944e-02, + -6.56772017e-01, -6.95704341e-01, -2.21393049e-01, + 1.54209137e-03, -6.55857325e-01, -7.06896245e-01 ] + - [ -7.41300702e-01, -4.71545339e-01, -5.10290980e-01, + 2.46037364e-01, -9.04361486e-01, -5.64761400e-01, + -5.03239751e-01, 8.10348868e-01, -9.70768332e-01, + -4.57181215e-01, -3.31249952e-01, 4.78288293e-01, + -9.07114506e-01, -7.83498943e-01, -3.34374964e-01, + 4.75711107e-01, -9.05469835e-01, -7.89068282e-01, + 3.27622890e-02, -2.95920968e-02, 7.98650980e-02, + 1.02387071e-01, -5.01838803e-01, -2.04041600e-02, + 4.27745581e-02, 5.03275871e-01, -5.89325070e-01, + 2.35809088e-01, 2.55292654e-01, -2.85241842e-01, + -3.32565129e-01, -5.29138088e-01, 2.61193871e-01, + -4.69572365e-01, -3.01974237e-01, -5.76180458e-01 ] + - [ -8.68268430e-01, -5.62404394e-01, -7.10432947e-01, + 3.28123450e-01, -9.29140329e-01, -5.02927303e-01, + -7.36501098e-01, -1.67231381e-01, -8.23516607e-01, + -7.25993037e-01, -6.93749964e-01, -1.66895390e-01, + -7.82308042e-01, -8.48718464e-01, -7.09374964e-01, + 4.65967655e-02, -8.17524016e-01, -8.21429193e-01, + -5.58160543e-01, -3.59016299e-01, -4.01574790e-01, + 3.52458954e-01, -7.51965284e-01, -1.83091760e-01, + -3.82658958e-01, -2.67749786e-01, -5.57201564e-01, + -6.12923503e-01, -3.69862974e-01, -3.28550160e-01, + -4.86818850e-01, -7.28732467e-01, -3.98009956e-01, + -1.15901887e-01, -5.53398728e-01, -6.72037244e-01 ] + - [ -7.00289965e-01, -3.81128192e-01, -4.84740913e-01, + 2.04484701e-01, -8.13257277e-01, -3.85065615e-01, + -4.97480154e-01, -1.04255676e-02, -7.74511158e-01, + -5.46214104e-01, -4.29687500e-01, -2.59466946e-01, + -6.90486372e-01, -7.73780704e-01, -4.40625012e-01, + -1.06951654e-01, -7.13097215e-01, -7.55420864e-01, + 5.01952171e-02, -1.36260211e-01, 1.46232843e-02, + 2.00866818e-01, -5.54887295e-01, 7.05957413e-03, + 5.66473007e-02, -1.55834496e-01, -4.59334970e-01, + -3.17845762e-01, 1.73100829e-01, -4.71280992e-01, + -3.50829005e-01, -6.39168739e-01, 1.39303446e-01, + -3.62311304e-01, -3.79781306e-01, -5.99642277e-01 ] + - [ -7.92046368e-01, -3.91964078e-01, -5.92618883e-01, + 2.07523584e-01, -8.13519537e-01, -3.56623828e-01, + -6.22750163e-01, 2.60911942e-01, -8.22711587e-01, + -4.08233762e-01, -5.10937452e-01, -2.81001329e-02, + -7.53891706e-01, -7.57495999e-01, -5.17187476e-01, + 1.15897655e-02, -7.54281044e-01, -7.56648421e-01, + -2.38954127e-01, -1.54812932e-02, -4.16197777e-02, + 9.29570198e-02, -3.93814445e-01, 1.75159693e-01, + -6.35837913e-02, 2.65439749e-02, -4.15317655e-01, + -4.21744585e-02, 3.73589993e-03, -3.99908006e-01, + -1.91482604e-01, -4.82153594e-01, 1.74129009e-02, + -4.64654922e-01, -1.88039899e-01, -4.94818270e-01 ] + - [ -8.24772120e-01, -7.53844082e-01, -6.91980124e-01, + 1.98375344e-01, -9.85160768e-01, -8.10752571e-01, + -7.03383684e-01, 3.11214685e-01, -9.88555193e-01, + -8.15871119e-01, -5.98437428e-01, 4.86023426e-01, + -9.78353024e-01, -9.07019615e-01, -6.00000024e-01, + 5.11620045e-01, -9.79154110e-01, -9.07771945e-01, + -2.94259191e-01, -4.72614467e-01, -3.07086527e-01, + 2.90599942e-01, -8.38662326e-01, -4.88080323e-01, + -3.10982645e-01, 2.89226770e-01, -8.25576842e-01, + -5.31427741e-01, -1.70610249e-01, 5.67275286e-02, + -7.59654403e-01, -7.96126068e-01, -1.89054728e-01, + 1.72721148e-02, -7.55791724e-01, -7.98595488e-01 ] + - [ -8.53562534e-01, -8.78741741e-01, -8.16891432e-01, + 1.92321539e-02, -9.92283583e-01, -9.09892142e-01, + -8.20014358e-01, 1.13199592e-01, -9.94853795e-01, + -9.16770697e-01, -7.73437500e-01, 3.64831090e-01, + -9.90125895e-01, -9.54494357e-01, -7.81250000e-01, + 3.74600172e-01, -9.89395499e-01, -9.55622733e-01, + -5.37721753e-01, -6.92048073e-01, -5.09561300e-01, + 3.30488086e-01, -9.47243750e-01, -7.19516933e-01, + -5.16763031e-01, 2.73071766e-01, -9.25087333e-01, + -7.62366056e-01, -4.69489455e-01, 2.85278678e-01, + -9.12011743e-01, -8.86160314e-01, -4.65174139e-01, + 2.09020257e-01, -9.03437614e-01, -8.93410742e-01 ] + - [ -7.22659469e-01, -4.58988845e-01, -5.03193736e-01, + 2.67149329e-01, -8.75656903e-01, -4.75122452e-01, + -5.32037377e-01, 4.09139395e-02, -8.31103802e-01, + -6.10501885e-01, -4.42187488e-01, -1.01539135e-01, + -7.77934670e-01, -8.07946801e-01, -4.45312440e-01, + 1.93192959e-02, -7.94122577e-01, -7.96764851e-01, + 5.50044775e-02, -1.81839466e-01, 2.36220360e-02, + 2.90088654e-01, -6.32256866e-01, -3.97186875e-02, + 2.42774487e-02, -3.96960378e-02, -5.45473933e-01, + -3.36327612e-01, 1.50684953e-01, -3.75365138e-01, + -4.34387088e-01, -6.66298032e-01, 1.21890545e-01, + -2.70637751e-01, -4.62917387e-01, -6.31897807e-01 ] + - [ -6.33388519e-01, -2.17221618e-01, -3.15826833e-01, + 4.35067058e-01, -8.06607246e-01, -1.91886842e-01, + -3.53491664e-01, 4.02397990e-01, -7.94385850e-01, + -2.80499458e-01, -2.14062452e-01, 2.85466909e-02, + -6.90076411e-01, -6.53321862e-01, -2.20312476e-01, + 3.64339352e-02, -6.86058521e-01, -6.60192788e-01, + 3.46558452e-01, 1.68093443e-01, 3.76827836e-01, 2.32709527e-01, + -3.96098435e-01, 3.64819050e-01, 3.36416125e-01, + 1.37848735e-01, -3.56855631e-01, 2.11552262e-01, + 4.74470735e-01, -3.36114705e-01, -1.05139494e-01, + -3.36357415e-01, 4.92537379e-01, -4.11062777e-01, + -1.10201061e-01, -3.65584791e-01 ] + - [ -8.46934557e-01, -9.33791697e-01, -7.70049691e-01, + -6.56546354e-02, -9.97292459e-01, -9.66226816e-01, + -8.22894156e-01, 2.97689438e-02, -9.97721255e-01, + -9.59163904e-01, -7.56249964e-01, 3.71992469e-01, + -9.97892976e-01, -9.75661814e-01, -7.64062524e-01, + 3.95416617e-01, -9.97913539e-01, -9.75665808e-01, + -6.24286175e-01, -8.17356706e-01, -5.68053961e-01, + 3.46383929e-01, -9.90105927e-01, -8.61357689e-01, + -6.30057812e-01, 4.57384586e-01, -9.90809321e-01, + -8.32578182e-01, -5.09340048e-01, 5.13140917e-01, + -9.83386397e-01, -9.30432677e-01, -5.17412901e-01, + 5.02105236e-01, -9.83575702e-01, -9.30570602e-01 ] + - [ -9.31234479e-01, -6.80231571e-01, -8.43860865e-01, + -1.26530945e-01, -8.87141705e-01, -7.50874519e-01, + -8.70410323e-01, -1.09228492e-02, -9.11791503e-01, + -7.61410475e-01, -8.32812428e-01, -4.12372351e-02, + -8.66269290e-01, -8.99389744e-01, -8.39062452e-01, + -3.01750302e-02, -8.62251282e-01, -9.03726101e-01, + -8.05831075e-01, -5.42468190e-01, -6.40044987e-01, + -1.09142423e-01, -6.76267743e-01, -6.19194806e-01, + -6.71676278e-01, -5.45288920e-02, -7.11261749e-01, + -6.66720808e-01, -6.71232939e-01, -1.68992460e-01, + -6.27807379e-01, -8.03987086e-01, -6.76616907e-01, + -2.60654390e-01, -6.12411141e-01, -8.19054723e-01 ] + - [ -8.04059625e-01, -3.49547446e-01, -5.94038308e-01, + -2.44784355e-02, -7.20941424e-01, -3.91433001e-01, + -6.05471492e-01, -2.89000869e-02, -7.00878382e-01, + -4.25543964e-01, -5.73437452e-01, -2.43807137e-01, + -6.03743732e-01, -6.93051338e-01, -5.74999928e-01, + -4.02210534e-01, -5.52139044e-01, -7.34508872e-01, + -2.28133559e-01, -1.28785431e-01, -7.53655434e-02, + -1.43148839e-01, -4.08694327e-01, -1.76419556e-01, + -1.30635917e-01, -1.86302662e-01, -3.56987536e-01, + -2.11867154e-01, -4.35865521e-02, -4.43406940e-01, + -2.53392696e-01, -5.62691808e-01, -1.99004412e-02, + -6.22045338e-01, -2.40632117e-01, -6.19903803e-01 ] + - [ -8.60397696e-01, -8.57411742e-01, -8.29666436e-01, + 1.90150023e-01, -9.98830378e-01, -8.59979272e-01, + -7.42260635e-01, 1.32943869e-01, -9.95975733e-01, + -9.24871504e-01, -7.15624988e-01, 5.24979830e-01, + -9.96123672e-01, -9.42523181e-01, -7.20312476e-01, + 5.32653689e-01, -9.95721519e-01, -9.43475783e-01, + -5.04057765e-01, -6.13440275e-01, -4.33070838e-01, + 7.14243889e-01, -9.78519738e-01, -4.92493629e-01, + -4.49711025e-01, 5.95678091e-02, -8.48381519e-01, + -7.68779576e-01, -3.84806991e-01, 2.31830120e-01, + -8.69572997e-01, -8.53326976e-01, -3.80596995e-01, + 2.24253058e-01, -8.73914301e-01, -8.54672790e-01 ] + - [ -7.90596485e-01, -4.96810198e-01, -6.06813312e-01, + 2.80491352e-01, -8.85387778e-01, -4.60778594e-01, + -6.44348383e-01, -6.39632344e-02, -8.00176620e-01, + -6.20095372e-01, -5.51562488e-01, -1.67622626e-01, + -7.68414497e-01, -8.25458169e-01, -5.70312440e-01, + -1.62385285e-01, -7.54885316e-01, -8.25329185e-01, + -2.75022566e-01, -2.74815500e-01, -1.78852618e-01, + 2.15769410e-01, -6.54801607e-01, -1.72097981e-01, + -1.90751433e-01, -2.42048502e-03, -5.84941626e-01, + -3.72036278e-01, -3.86051536e-02, -4.88290787e-01, + -4.41526890e-01, -7.32409000e-01, -4.47760820e-02, + -4.81512129e-01, -4.50643361e-01, -7.21501529e-01 ] + - [ -8.62261832e-01, -9.36925054e-01, -8.35344195e-01, + -1.60476565e-02, -9.99198675e-01, -9.56652462e-01, + -8.41612637e-01, 2.49183178e-02, -9.98000860e-01, + -9.60460067e-01, -8.15625012e-01, 3.65052938e-01, + -9.97568667e-01, -9.73513186e-01, -8.20312500e-01, + 3.87562871e-01, -9.97590065e-01, -9.73814487e-01, + -5.34716010e-01, -7.77206540e-01, -4.37570274e-01, + 4.59870577e-01, -9.93054450e-01, -8.20672393e-01, + -4.33526099e-01, 4.90381837e-01, -9.90205288e-01, + -8.35242152e-01, -3.27521861e-01, 6.14205956e-01, + -9.84039605e-01, -9.12897527e-01, -3.33333433e-01, + 5.90095401e-01, -9.83216465e-01, -9.14794087e-01 ] + - [ -7.80861616e-01, -5.63979864e-01, -5.64229965e-01, + 2.07205296e-01, -9.35164928e-01, -6.66083097e-01, + -6.18430495e-01, 3.84242654e-01, -9.29845333e-01, + -5.82566738e-01, -4.74999964e-01, 2.89977074e-01, + -9.07043755e-01, -8.40539813e-01, -4.84375000e-01, + 2.68672824e-01, -9.00822639e-01, -8.46629858e-01, + -9.52810645e-02, -2.27634251e-01, -9.11136270e-02, + 1.16519213e-01, -6.16834223e-01, -2.23427653e-01, + -8.67052078e-02, 3.39736462e-01, -6.68218136e-01, + -1.44372761e-01, 6.35117292e-02, -2.09023893e-01, + -5.20524740e-01, -6.71899021e-01, 8.45770836e-02, + -3.22988987e-01, -5.09900749e-01, -6.97031140e-01 ] + - [ -8.40513706e-01, -9.28808570e-01, -8.41022015e-01, + -7.77587295e-02, -9.95080590e-01, -9.56620574e-01, + -8.87688994e-01, 4.41063643e-02, -9.97125924e-01, + -9.44773018e-01, -8.06249976e-01, 3.01244855e-01, + -9.94428337e-01, -9.75238383e-01, -8.15625012e-01, + 3.24591041e-01, -9.94373381e-01, -9.75381136e-01, + -6.42320514e-01, -8.14087749e-01, -6.91788554e-01, + 1.78220749e-01, -9.60694969e-01, -8.61548305e-01, + -7.43352652e-01, 3.45715165e-01, -9.72047448e-01, + -8.13875556e-01, -6.86176836e-01, 2.27519512e-01, + -9.42032993e-01, -9.38241661e-01, -6.99005008e-01, + 2.03636527e-01, -9.41318572e-01, -9.38290238e-01 ] + - [ -8.58740687e-01, -8.74399185e-01, -8.08374703e-01, + 2.15753317e-02, -9.91793692e-01, -9.08177853e-01, + -7.98416078e-01, 5.07806540e-02, -9.89689887e-01, + -9.23317552e-01, -7.60937452e-01, 2.79404640e-01, + -9.85012054e-01, -9.60930407e-01, -7.68750012e-01, + 3.08315277e-01, -9.85127032e-01, -9.60596442e-01, + -4.84821200e-01, -6.90557480e-01, -4.69066381e-01, + 3.56111050e-01, -9.48721945e-01, -7.07399249e-01, + -4.58959579e-01, 2.40071416e-01, -9.16909277e-01, + -7.70883918e-01, -3.54919076e-01, 1.38255000e-01, + -8.89740229e-01, -9.03735399e-01, -3.50746274e-01, + 1.31340981e-01, -8.93966675e-01, -9.03912485e-01 ] + - [ -7.94117630e-01, -6.86025262e-01, -6.21007800e-01, + 2.33493209e-01, -9.73714232e-01, -7.59484529e-01, + -6.29949570e-01, 3.45839262e-01, -9.77685332e-01, + -7.65468478e-01, -5.26562452e-01, 4.42269683e-01, + -9.60222483e-01, -8.83459091e-01, -5.24999976e-01, + 4.72952127e-01, -9.61649001e-01, -8.84079576e-01, + -1.30147398e-01, -3.84602785e-01, -1.47356570e-01, + 3.17153692e-01, -8.13767672e-01, -4.13266420e-01, + -1.30635917e-01, 3.28190088e-01, -8.05154562e-01, + -4.59044456e-01, -2.86426544e-02, 7.57889748e-02, + -7.14502871e-01, -7.39985943e-01, -4.22885418e-02, + 2.92054415e-02, -7.07580447e-01, -7.42912292e-01 ] + - [ -7.43993402e-01, -5.19587636e-01, -5.57132721e-01, + -4.91515994e-02, -8.46460938e-01, -6.47724688e-01, + -5.56515455e-01, 2.50120044e-01, -8.97326827e-01, + -6.04645371e-01, -5.15625000e-01, -1.76173985e-01, + -7.86339402e-01, -8.43889236e-01, -5.26562452e-01, + 1.45422220e-01, -8.35307777e-01, -8.01622748e-01, + -2.22723246e-01, -3.12030077e-01, -2.37345338e-01, + 9.17793512e-02, -6.44076109e-01, -3.04458916e-01, + -1.67630076e-01, 1.29123211e-01, -6.72288060e-01, + -3.86964917e-01, -4.85678315e-02, -2.68593252e-01, + -5.57006240e-01, -7.34630346e-01, -7.96020627e-02, + -1.75823271e-01, -5.77856600e-01, -7.03346848e-01 ] + - [ -8.45691800e-01, -6.71509027e-01, -7.57274628e-01, + 8.97141695e-02, -9.22445655e-01, -6.73779368e-01, + -7.60979116e-01, -2.69969702e-02, -9.00772989e-01, + -7.65697539e-01, -7.35937476e-01, 1.93339586e-02, + -8.72965932e-01, -8.81893873e-01, -7.43749976e-01, + 2.64475346e-02, -8.68627429e-01, -8.86092126e-01, + -5.96633613e-01, -5.13408661e-01, -5.36557913e-01, + 3.27003479e-01, -8.34367812e-01, -4.00036514e-01, + -5.30635893e-01, 9.26911831e-03, -7.21702754e-01, + -6.05075836e-01, -4.86924112e-01, -1.81994140e-01, + -6.65370524e-01, -8.18993986e-01, -5.00000000e-01, + -2.60317326e-01, -6.51729286e-01, -8.27195466e-01 ] + - [ -8.16072941e-01, -5.96181870e-01, -6.76366210e-01, + 8.33086967e-02, -9.15270507e-01, -6.80722296e-01, + -6.90424740e-01, 3.26978207e-01, -9.33477163e-01, + -6.14439309e-01, -6.15625024e-01, 1.71168089e-01, + -8.91389370e-01, -8.54161143e-01, -6.21875048e-01, + 2.08537817e-01, -8.93212259e-01, -8.54165316e-01, + -3.54373336e-01, -2.76095271e-01, -2.37345338e-01, + -2.24302411e-02, -6.11558199e-01, -3.80269110e-01, + -2.85549164e-01, 3.15605044e-01, -6.74356341e-01, + -1.70699954e-01, -1.75591469e-01, -2.69180298e-01, + -5.03111184e-01, -6.97498560e-01, -1.96517467e-01, + -2.22683966e-01, -5.23314476e-01, -6.81401134e-01 ] + - [ -7.98260152e-01, -9.55748916e-01, -8.01277518e-01, + -9.72855091e-02, -9.97832894e-01, -9.75059927e-01, + -7.92656600e-01, -2.71161199e-02, -9.98350680e-01, + -9.77762699e-01, -7.57812500e-01, 3.07662606e-01, + -9.97968793e-01, -9.84564841e-01, -7.60937512e-01, + 3.32581401e-01, -9.98063982e-01, -9.84945118e-01, + -6.51938677e-01, -8.75674129e-01, -7.00787365e-01, + 3.40336680e-01, -9.97489333e-01, -8.93247962e-01, + -6.62427783e-01, 3.46487641e-01, -9.94139254e-01, + -9.13838923e-01, -6.01494431e-01, 5.06152272e-01, + -9.93505955e-01, -9.53666151e-01, -6.06965184e-01, + 4.55450654e-01, -9.91569519e-01, -9.56449986e-01 ] + - [ -7.71748126e-01, -2.70126164e-01, -5.15968800e-01, + 1.58617020e-01, -7.25395918e-01, -2.33740926e-01, + -5.40676773e-01, 2.66263604e-01, -7.56409645e-01, + -2.78748214e-01, -4.76562440e-01, -1.76157117e-01, + -6.10877275e-01, -6.61804080e-01, -4.82812464e-01, + -2.30423689e-01, -5.85077882e-01, -6.79045439e-01, + -2.20919788e-01, 4.82993126e-02, -3.37451696e-03, + 1.24409199e-02, -3.08805406e-01, 2.14013577e-01, + -3.46827507e-03, -8.32137465e-02, -3.21257353e-01, + -1.88837647e-02, 5.85304499e-02, -4.21912551e-01, + -1.09511256e-01, -4.18495178e-01, 5.47263622e-02, + -4.96969044e-01, -9.31746960e-02, -4.28239465e-01 ] + - [ -8.15865755e-01, -9.21960235e-01, -7.78566360e-01, + -3.25928926e-02, -9.97327924e-01, -9.56256866e-01, + -7.63858855e-01, 2.29822397e-02, -9.96624172e-01, + -9.60041702e-01, -7.03124940e-01, 3.61973405e-01, + -9.96721447e-01, -9.74759400e-01, -7.07812488e-01, + 3.81648302e-01, -9.96726215e-01, -9.75406110e-01, + -5.41328549e-01, -8.08297336e-01, -5.38807631e-01, + 3.35871100e-01, -9.87732947e-01, -8.59974921e-01, + -5.58381557e-01, 3.21136951e-01, -9.75099802e-01, + -8.62988472e-01, -4.84433413e-01, 3.90264273e-01, + -9.70647037e-01, -9.37245488e-01, -4.82587039e-01, + 3.45574856e-01, -9.69382226e-01, -9.41896975e-01 ] + - [ -8.45898926e-01, -7.65256643e-01, -7.31724620e-01, + 2.33338952e-01, -9.87332880e-01, -7.89391816e-01, + -7.27861762e-01, 2.69786477e-01, -9.86535311e-01, + -8.22798073e-01, -6.20312452e-01, 4.54159856e-01, + -9.78258848e-01, -9.13700998e-01, -6.28124952e-01, + 4.78127599e-01, -9.78506923e-01, -9.13485587e-01, + -4.75202978e-01, -5.37212551e-01, -4.06074226e-01, + 3.09609532e-01, -8.53693604e-01, -4.93483663e-01, + -4.49711025e-01, 3.71251822e-01, -8.68450999e-01, + -5.39243579e-01, -3.22540462e-01, -3.01576853e-02, + -7.67244220e-01, -8.39082956e-01, -3.28358173e-01, + -2.17210054e-02, -7.76176333e-01, -8.35545063e-01 ] + - [ -8.28293324e-01, -5.17422318e-01, -6.70688450e-01, + 7.82085657e-02, -8.65342140e-01, -5.71471453e-01, + -6.88984871e-01, -7.20125437e-03, -8.23905110e-01, + -6.16775393e-01, -6.62499964e-01, 1.93214417e-02, + -7.94244111e-01, -7.90354550e-01, -6.67187452e-01, + -7.11948276e-02, -7.69592524e-01, -8.13132524e-01, + -4.46949244e-01, -2.80779064e-01, -2.66591609e-01, + -8.89896154e-02, -5.87684214e-01, -4.17401195e-01, + -2.62427807e-01, -1.77711427e-01, -5.12525320e-01, + -4.48119283e-01, -2.62764633e-01, -9.25585032e-02, + -4.94842529e-01, -6.09457791e-01, -2.61193991e-01, + -2.47700751e-01, -4.67030108e-01, -6.48245096e-01 ] + - [ -8.36992502e-01, -6.66320682e-01, -7.28885710e-01, + 1.28391147e-01, -9.47691023e-01, -7.19942689e-01, + -7.58099318e-01, 1.84960365e-02, -8.93766463e-01, + -7.22749352e-01, -7.01562464e-01, 1.76294088e-01, + -9.03787315e-01, -8.68509531e-01, -7.15624988e-01, + 3.45275402e-02, -8.68899703e-01, -8.82672668e-01, + -2.89450049e-01, -3.49190474e-01, -2.41844714e-01, + -1.60485506e-02, -6.63463116e-01, -4.63591993e-01, + -2.64739871e-01, 1.71201110e-01, -6.69624984e-01, + -3.35081279e-01, -1.53175533e-01, -1.22363865e-01, + -6.14842594e-01, -7.29518890e-01, -1.84079647e-01, + -7.62571692e-02, -6.24942422e-01, -7.09164977e-01 ] + - [ -8.56462300e-01, -8.92666221e-01, -8.56635928e-01, + -7.07054138e-03, -9.93618488e-01, -9.20904815e-01, + -8.77609789e-01, 5.04455566e-02, -9.91054773e-01, + -9.18031573e-01, -8.46874952e-01, 2.79321671e-01, + -9.85793889e-01, -9.60018396e-01, -8.48437488e-01, + 3.40624213e-01, -9.88589525e-01, -9.58261788e-01, + -6.62158132e-01, -7.70874858e-01, -7.07536578e-01, + 1.43160105e-01, -9.34921384e-01, -8.25031281e-01, + -7.24855542e-01, 2.03904867e-01, -9.24376428e-01, + -8.01115870e-01, -7.28518128e-01, 1.84540510e-01, + -9.02421474e-01, -9.08460140e-01, -7.36318409e-01, + 7.51602650e-02, -8.84171784e-01, -9.18113947e-01 ] + - [ -7.70091116e-01, -4.00709629e-01, -5.44357777e-01, + 2.24258661e-01, -8.29978108e-01, -3.91951203e-01, + -5.85313141e-01, -1.33539915e-01, -7.26767778e-01, + -5.53117812e-01, -5.06250024e-01, -2.76410341e-01, + -6.77222490e-01, -7.72536993e-01, -5.31250000e-01, + -2.37779975e-01, -6.62654400e-01, -7.62245119e-01, + -2.02885509e-01, -2.02092946e-01, -1.06861591e-01, + 1.06435776e-01, -5.60278773e-01, -1.25735998e-01, + -1.00578129e-01, -9.21405554e-02, -5.03267169e-01, + -3.29789102e-01, 3.86052132e-02, -4.74485695e-01, + -3.78593385e-01, -6.72159910e-01, 2.48756409e-02, + -4.52716172e-01, -3.90042543e-01, -6.56423926e-01 ] + - [ -5.78086138e-01, -1.53570712e-01, -2.87437856e-01, + 2.68830180e-01, -7.00443923e-01, -1.14754200e-01, + -2.98776031e-01, 6.49272203e-02, -5.98847866e-01, + -1.90795124e-01, -1.32812440e-01, -6.29608750e-01, + -4.69632864e-01, -6.89413071e-01, -1.29687488e-01, + -3.41511309e-01, -5.27542353e-01, -6.46916211e-01, + 3.95251036e-01, 6.88892603e-02, 3.16085458e-01, 3.43871117e-02, + -3.55135679e-01, 1.64796710e-01, 2.48554826e-01, + 1.10242724e-01, -2.92442024e-01, 2.94337034e-01, + 6.43835664e-01, -9.87812459e-01, -4.99279499e-02, + -6.12904429e-01, 6.16915345e-01, -8.14865887e-01, + -1.08894169e-01, -5.59449434e-01 ] + - [ -8.18765521e-01, -7.43769825e-01, -6.79205060e-01, + 3.20585132e-01, -9.87728000e-01, -7.51825571e-01, + -6.47228241e-01, -6.49660826e-03, -9.60239649e-01, + -8.81932437e-01, -5.81249952e-01, 2.53021717e-01, + -9.56462324e-01, -9.22987640e-01, -5.82812428e-01, + 3.03727388e-01, -9.59037483e-01, -9.21517432e-01, + -1.95070684e-01, -4.79854405e-01, -1.45106852e-01, + 6.30838394e-01, -9.06527638e-01, -3.35980535e-01, + -1.56069398e-01, -3.66100073e-02, -7.83740044e-01, + -7.23948121e-01, 3.36239338e-02, -2.17860579e-01, + -7.33716309e-01, -8.58089507e-01, 4.72637415e-02, + -1.61304533e-01, -7.57123470e-01, -8.51419389e-01 ] + - [ -8.52319777e-01, -8.89210165e-01, -7.79985785e-01, + 7.08935261e-02, -9.97409999e-01, -9.19038177e-01, + -7.94096470e-01, 1.55017853e-01, -9.99024868e-01, + -9.30367768e-01, -7.48437464e-01, 5.02455950e-01, + -9.97833788e-01, -9.52742696e-01, -7.54687488e-01, + 5.19859552e-01, -9.97819841e-01, -9.53083217e-01, + -5.78599334e-01, -6.84399962e-01, -4.55568016e-01, + 6.08488441e-01, -9.86090958e-01, -6.47081017e-01, + -4.52023149e-01, 5.58462858e-01, -9.82255101e-01, + -7.43405163e-01, -3.22540462e-01, 6.29430175e-01, + -9.70194995e-01, -8.76492321e-01, -3.20895433e-01, + 6.23288393e-01, -9.70574617e-01, -8.77344549e-01 ] + - [ -8.92709196e-01, -8.49623203e-01, -8.87863755e-01, + 2.08283663e-02, -9.86364126e-01, -8.69806945e-01, + -9.30885494e-01, 2.46941924e-01, -9.95117247e-01, + -8.08331549e-01, -8.15625012e-01, 3.50247502e-01, + -9.86395240e-01, -9.47009921e-01, -8.23437452e-01, + 3.38806748e-01, -9.84148383e-01, -9.50505018e-01, + -7.66756892e-01, -7.06259012e-01, -7.72778392e-01, + -1.38644576e-02, -7.90552378e-01, -7.08083510e-01, + -8.05780351e-01, 2.71026492e-01, -8.57245326e-01, + -5.64437807e-01, -7.53424704e-01, -3.36489141e-01, + -6.88019633e-01, -9.22507226e-01, -7.68656731e-01, + -4.39942002e-01, -6.59551680e-01, -9.29073513e-01 ] + - [ -9.24813569e-01, -7.68908501e-01, -8.58055353e-01, + -8.39002132e-02, -9.40320730e-01, -8.21852326e-01, + -8.81929398e-01, -1.89431906e-02, -9.49090421e-01, + -8.42860341e-01, -8.45312476e-01, 7.78241158e-02, + -9.27942157e-01, -9.29282367e-01, -8.54687512e-01, + 9.78796482e-02, -9.25905585e-01, -9.30593431e-01, + -7.78178573e-01, -6.19104385e-01, -6.78290188e-01, + 1.81121826e-02, -7.75052428e-01, -6.38656378e-01, + -7.01734185e-01, 4.11051512e-02, -7.96128452e-01, + -7.07238793e-01, -6.63760900e-01, -1.16767645e-01, + -7.37029314e-01, -8.66489530e-01, -6.69154167e-01, + -1.73424482e-01, -7.33786106e-01, -8.73800516e-01 ] + - [ -6.89726591e-01, -3.16734552e-01, -4.54932570e-01, + 1.93830967e-01, -7.79111385e-01, -3.25442731e-01, + -4.57163393e-01, -8.03112984e-04, -7.40072966e-01, + -4.81337428e-01, -3.99999976e-01, -3.48571897e-01, + -6.26135588e-01, -7.43191838e-01, -4.17187452e-01, + -1.71846092e-01, -6.50758147e-01, -7.15546131e-01, + 4.05770540e-02, -9.64129567e-02, 3.71204615e-02, + 1.05249882e-01, -4.83354747e-01, 1.95853710e-02, + 9.82658863e-02, -1.99726641e-01, -4.09899294e-01, + -2.85703540e-01, 2.00498104e-01, -4.89755154e-01, + -2.99845099e-01, -6.04532838e-01, 1.64179087e-01, + -3.93158615e-01, -3.22686672e-01, -5.63329995e-01 ] + - [ -8.54391038e-01, -8.69882405e-01, -7.88502455e-01, + 8.90333652e-02, -9.96113956e-01, -9.01565671e-01, + -7.88336873e-01, 1.42427683e-01, -9.95427191e-01, + -9.12701547e-01, -7.34375000e-01, 4.73244190e-01, + -9.94061351e-01, -9.44852114e-01, -7.37499952e-01, + 4.76521492e-01, -9.93426502e-01, -9.46750641e-01, + -6.10459924e-01, -7.07856297e-01, -5.09561300e-01, + 4.66652513e-01, -9.74169791e-01, -6.99441314e-01, + -5.23699522e-01, 4.04885888e-01, -9.54893351e-01, + -7.42447495e-01, -4.89414692e-01, 4.76865292e-01, + -9.38173711e-01, -8.59262288e-01, -5.07462621e-01, + 3.67086768e-01, -9.25814331e-01, -8.72662485e-01 ] + - [ -7.70712495e-01, -4.31667745e-01, -5.82682729e-01, + 7.87228346e-02, -8.35316539e-01, -5.23715138e-01, + -5.75233996e-01, 1.86854005e-01, -8.27310443e-01, + -4.90524173e-01, -5.26562452e-01, 1.86436176e-02, + -7.74879396e-01, -7.63949096e-01, -5.34375012e-01, + -7.59565234e-02, -7.41115332e-01, -7.77468681e-01, + -1.03697121e-01, -1.20169878e-01, 2.13723183e-02, + -1.78414822e-01, -4.62116480e-01, -2.96837449e-01, + -1.04046464e-02, 5.90029955e-02, -4.89749730e-01, + -1.32140160e-01, 9.58904028e-02, -2.82187402e-01, + -3.71956885e-01, -5.71679235e-01, 1.99004412e-02, + -1.24853790e-01, -4.00568247e-01, -5.07139385e-01 ] + - [ -8.48384440e-01, -4.41682160e-01, -6.33782804e-01, + 2.63170362e-01, -8.61983120e-01, -4.06329215e-01, + -6.42908573e-01, -2.26005495e-01, -7.49975920e-01, + -6.54628098e-01, -6.32812500e-01, -3.10339570e-01, + -6.57954454e-01, -7.79967070e-01, -6.56250000e-01, + 1.21736526e-03, -7.17397749e-01, -7.25666523e-01, + -5.22091985e-01, -2.80018389e-01, -3.31833541e-01, + 3.01121473e-01, -6.90602779e-01, -1.20328188e-01, + -2.99421966e-01, -3.29372764e-01, -4.90448058e-01, + -5.71064234e-01, -2.87671208e-01, -3.14293742e-01, + -4.31133449e-01, -6.68202043e-01, -3.23383152e-01, + -1.42162919e-01, -4.83541429e-01, -6.15039945e-01 ] + - [ -7.38193870e-01, -3.08817089e-01, -4.69127059e-01, + 6.54300451e-02, -7.77557671e-01, -4.34281886e-01, + -4.80201542e-01, 2.57321954e-01, -7.82453716e-01, + -3.54202926e-01, -4.62499917e-01, -8.16395283e-02, + -6.62033796e-01, -6.74585402e-01, -4.71875012e-01, + -3.28372121e-02, -6.65307701e-01, -6.73648834e-01, + -2.02885509e-01, -5.57835102e-02, -3.37451696e-03, + -1.53664589e-01, -4.42316294e-01, -2.38374889e-01, + -7.97688365e-02, 1.36009574e-01, -4.73405480e-01, + -7.15214014e-03, 3.36239338e-02, -2.36761451e-01, + -3.22183371e-01, -5.06324887e-01, 1.24377012e-02, + -1.92063987e-01, -3.46575856e-01, -4.91276503e-01 ] + - [ -8.64954472e-01, -8.17641914e-01, -8.36763620e-01, + 1.89853787e-01, -9.89809692e-01, -7.92137027e-01, + -7.49460042e-01, 1.15235567e-01, -9.89784181e-01, + -9.04102921e-01, -7.01562464e-01, 3.85798812e-01, + -9.84358072e-01, -9.39749777e-01, -7.12499976e-01, + 4.28103089e-01, -9.85246480e-01, -9.37164545e-01, + -6.36309028e-01, -6.16630137e-01, -5.65804243e-01, + 6.23374581e-01, -9.53787446e-01, -4.06687915e-01, + -6.11560702e-01, -9.44737792e-02, -7.72943079e-01, + -7.81418264e-01, -5.66625237e-01, -2.05227494e-01, + -7.35272050e-01, -8.87325764e-01, -5.54726362e-01, + -9.57075953e-02, -7.79389441e-01, -8.73501778e-01 ] + - [ -7.59527743e-01, -2.43483126e-01, -4.35060322e-01, + 8.98654103e-01, -8.92945886e-01, 7.34398365e-02, + -4.39884722e-01, -5.39333224e-01, -5.67555070e-01, + -6.11413002e-01, -4.04687405e-01, -5.03832161e-01, + -5.26492953e-01, -7.13440776e-01, -4.14062500e-01, + -3.49980116e-01, -5.49447417e-01, -6.91228747e-01, + -2.40156353e-01, 1.03235245e-02, 3.03711891e-02, + 7.17393875e-01, -6.52877331e-01, 5.46200037e-01, + 7.51445293e-02, -8.65856946e-01, -7.04357028e-02, + -5.17133594e-01, 1.10834241e-01, -7.44896531e-01, + -5.22407293e-02, -5.45019984e-01, 1.16915464e-01, + -6.88734770e-01, -1.02741003e-01, -5.32527626e-01 ] + - [ -8.72410953e-01, -8.10539126e-01, -8.12633097e-01, + 1.26741290e-01, -9.89589930e-01, -8.41600299e-01, + -8.27213824e-01, 1.26363873e-01, -9.79315519e-01, + -8.49710941e-01, -7.54687488e-01, 3.71067762e-01, + -9.78388786e-01, -9.27985430e-01, -7.73437500e-01, + 3.49015832e-01, -9.73730862e-01, -9.30102050e-01, + -4.75202978e-01, -5.61130404e-01, -4.30821180e-01, + 1.18189812e-01, -8.34928632e-01, -6.46694779e-01, + -4.54335332e-01, 1.87656164e-01, -8.11473489e-01, + -5.91989517e-01, -3.64881754e-01, 1.20992184e-01, + -8.09413433e-01, -8.26962352e-01, -4.00497556e-01, + 4.55596447e-02, -7.88454711e-01, -8.25880051e-01 ] + - [ -5.85128427e-01, -1.24177694e-01, -2.46273935e-01, + 2.18137145e-01, -7.22809017e-01, -2.16295898e-01, + -2.65658736e-01, 6.01322174e-01, -7.76383638e-01, + -7.78011084e-02, -1.64062440e-01, -6.05104566e-02, + -5.84766805e-01, -5.66915274e-01, -1.70312464e-01, + -1.77154362e-01, -5.54541111e-01, -6.04734778e-01, + 3.70002985e-01, 2.26692438e-01, 4.03824568e-01, + -1.41560197e-01, -2.38507450e-01, 1.34953499e-01, + 3.41040492e-01, 2.20734000e-01, -3.08011532e-01, + 4.17549014e-01, 5.06849289e-01, -3.02895546e-01, + -4.20989990e-02, -2.55354166e-01, 5.27363062e-01, + -5.32064199e-01, -2.98798084e-04, -3.32530618e-01 ] + - [ -6.38980985e-01, -2.27190852e-02, -3.14407408e-01, + 3.64206314e-01, -6.63400412e-01, 7.05816746e-02, + -3.18934441e-01, -1.46977305e-02, -5.40423274e-01, + -1.60759509e-01, -2.42187440e-01, -2.67403722e-01, + -4.41787004e-01, -5.10290980e-01, -2.46874988e-01, + -2.85147309e-01, -4.26168203e-01, -5.25509894e-01, + 2.56988287e-01, 2.88810015e-01, 3.25084329e-01, 4.86731529e-02, + -2.29323566e-01, 4.18988228e-01, 3.75722528e-01, + -3.95783663e-01, -5.73629141e-02, 3.30650806e-02, + 4.37110782e-01, -2.31171846e-01, 2.34448910e-03, + -1.69936240e-01, 4.45273519e-01, -2.50979304e-01, + -1.07982159e-02, -1.79285526e-01 ] + - [ -8.25186431e-01, -7.20786095e-01, -6.59332871e-01, + 3.48168254e-01, -9.90861416e-01, -7.58546829e-01, + -6.64506793e-01, 3.77844930e-01, -9.89169061e-01, + -7.92418838e-01, -5.28125048e-01, 6.38264179e-01, + -9.84348416e-01, -8.87422562e-01, -5.34375012e-01, + 6.50047541e-01, -9.84284163e-01, -8.88324261e-01, + -2.72016883e-01, -3.66951525e-01, -2.14848220e-01, + 3.79037738e-01, -7.89247394e-01, -2.72752047e-01, + -2.39306450e-01, 4.60720062e-01, -8.11811030e-01, + -3.26062143e-01, -6.10211492e-02, 8.15356970e-02, + -7.10600734e-01, -7.34178364e-01, -5.47263026e-02, + 7.31116533e-02, -7.19901204e-01, -7.38644242e-01 ] + - [ -8.53769660e-01, -8.45637500e-01, -8.56635928e-01, + 1.84932232e-01, -9.96043682e-01, -8.26260269e-01, + -7.53779650e-01, 6.95161819e-02, -9.90816832e-01, + -9.24623549e-01, -7.06249952e-01, 4.13525105e-01, + -9.90177631e-01, -9.47539449e-01, -7.14062452e-01, + 4.32972789e-01, -9.90056694e-01, -9.47755337e-01, + -6.53742135e-01, -6.58639908e-01, -6.40044987e-01, + 6.00054026e-01, -9.66711521e-01, -4.64893520e-01, + -6.69364214e-01, -2.21645117e-01, -7.42518783e-01, + -8.47024977e-01, -6.28891647e-01, -1.46733105e-01, + -7.72588432e-01, -9.00386333e-01, -6.36815906e-01, + -1.94156408e-01, -7.68687487e-01, -9.02907133e-01 ] + - [ -9.20256853e-01, -9.01969612e-01, -8.89283180e-01, + -5.79032302e-02, -9.91131067e-01, -9.29351091e-01, + -9.13606882e-01, -3.96459699e-02, -9.88064885e-01, + -9.41108525e-01, -8.82812500e-01, 2.22724319e-01, + -9.84926403e-01, -9.68921900e-01, -8.90625000e-01, + 2.50968814e-01, -9.85061228e-01, -9.69042301e-01, + -7.65554547e-01, -7.97201991e-01, -7.41282344e-01, + 1.72528148e-01, -9.44489956e-01, -8.20754826e-01, + -7.64161825e-01, 2.12305188e-01, -9.49858606e-01, + -8.50429177e-01, -7.38480687e-01, 1.32051110e-01, + -9.12780643e-01, -9.35139537e-01, -7.43781090e-01, + 1.35301590e-01, -9.19813752e-01, -9.34553564e-01 ] + - [ -8.55633795e-01, -7.80994534e-01, -7.91341364e-01, + 1.24776840e-01, -9.79733050e-01, -8.07837963e-01, + -8.04175615e-01, 1.10539079e-01, -9.70930517e-01, + -8.37091208e-01, -7.32812524e-01, 3.15621734e-01, + -9.67591226e-01, -9.22485232e-01, -7.39062488e-01, + 3.28082204e-01, -9.66447234e-01, -9.23877776e-01, + -5.28103471e-01, -5.67163348e-01, -5.41057348e-01, + 2.09130049e-01, -8.35124314e-01, -5.45816958e-01, + -5.56069434e-01, 7.18064308e-02, -7.79905617e-01, + -6.43497109e-01, -4.96886671e-01, -2.82965302e-02, + -7.59750485e-01, -8.39506686e-01, -4.92537320e-01, + -1.24539733e-01, -7.46831536e-01, -8.52709889e-01 ] + - [ -6.78541839e-01, -2.60386825e-01, -4.29382563e-01, + 2.08061218e-01, -7.32898116e-01, -2.17978776e-01, + -4.57163393e-01, 5.79526424e-02, -6.59044623e-01, + -2.90445864e-01, -2.89062440e-01, -6.30980313e-01, + -5.43512344e-01, -7.64797926e-01, -2.99999952e-01, + -3.75394106e-01, -5.90778708e-01, -7.31162786e-01, + 2.43763089e-01, -1.37681961e-02, 1.83352113e-01, + 3.97688150e-02, -3.96673143e-01, 9.42480564e-02, + 1.28323674e-01, 1.59963965e-01, -3.73487055e-01, + 2.11190939e-01, 4.99377251e-01, -1., -1.11021578e-01, + -6.69436455e-01, 4.75124478e-01, -8.07054877e-01, + -1.76193535e-01, -6.15063190e-01 ] + - [ -8.64125967e-01, -9.20482874e-01, -8.19730282e-01, + 2.95348167e-02, -9.99529481e-01, -9.45573151e-01, + -8.30093563e-01, 9.63002443e-02, -9.99353290e-01, + -9.48568046e-01, -7.95312464e-01, 4.66583133e-01, + -9.99342799e-01, -9.64986861e-01, -7.98437476e-01, + 4.84781742e-01, -9.99391615e-01, -9.65872407e-01, + -5.21490812e-01, -7.32302904e-01, -4.24071968e-01, + 5.39847612e-01, -9.92536664e-01, -7.60653079e-01, + -4.21965420e-01, 5.31414866e-01, -9.84032452e-01, + -7.77069569e-01, -3.12577784e-01, 6.78635359e-01, + -9.79106426e-01, -8.83197308e-01, -2.93532312e-01, + 6.69947624e-01, -9.80686426e-01, -8.89197767e-01 ] + - [ -8.53355408e-01, -8.55516136e-01, -8.42441440e-01, + 9.73310471e-02, -9.93444860e-01, -8.69412661e-01, + -8.11375082e-01, 1.31090641e-01, -9.93062735e-01, + -9.02320027e-01, -7.59374976e-01, 4.13509846e-01, + -9.89783466e-01, -9.43891823e-01, -7.65625000e-01, + 4.25803423e-01, -9.89400208e-01, -9.45174098e-01, + -6.30297542e-01, -6.74943089e-01, -6.17547750e-01, + 2.72807121e-01, -9.21875596e-01, -6.82767510e-01, + -6.34682059e-01, 6.00514412e-02, -8.41548800e-01, + -7.62295008e-01, -5.99003792e-01, 2.01230764e-01, + -8.75529587e-01, -8.71921659e-01, -6.01990104e-01, + 1.64517999e-01, -8.75408411e-01, -8.77363682e-01 ] + - [ -8.46934557e-01, -9.03610826e-01, -8.15472007e-01, + -2.60635018e-02, -9.93629813e-01, -9.34827745e-01, + -8.27213824e-01, 1.16137981e-01, -9.98534799e-01, + -9.35720205e-01, -7.79687524e-01, 3.70170951e-01, + -9.94064450e-01, -9.63321865e-01, -7.82812476e-01, + 3.93090010e-01, -9.94136274e-01, -9.63747680e-01, + -5.34716010e-01, -7.26023793e-01, -4.80314970e-01, + 3.88344765e-01, -9.71291065e-01, -7.59605825e-01, + -5.07514477e-01, 3.77658129e-01, -9.60947394e-01, + -7.84715354e-01, -4.19676244e-01, 4.19460177e-01, + -9.51509178e-01, -9.00913000e-01, -4.27860737e-01, + 3.74362946e-01, -9.47607458e-01, -9.03528810e-01 ] + - [ -8.62468958e-01, -5.61139464e-01, -6.79205060e-01, + -5.97197413e-02, -8.44675660e-01, -6.40257716e-01, + -6.84665203e-01, -7.93429613e-02, -8.22708488e-01, + -6.66911602e-01, -6.01562500e-01, -7.64920115e-02, + -8.11457992e-01, -8.41390252e-01, -6.07812524e-01, + -5.60657978e-02, -8.09147716e-01, -8.44828606e-01, + -4.41538930e-01, -2.49407649e-01, -1.99100077e-01, + -7.95710087e-02, -5.45514464e-01, -3.32486629e-01, + -1.90751433e-01, -1.44939899e-01, -4.79512990e-01, + -3.56995225e-01, -1.33250356e-01, -2.22925663e-01, + -4.95299876e-01, -6.66518152e-01, -1.44278586e-01, + -3.72611582e-01, -4.60643530e-01, -6.91143990e-01 ] + - [ -7.71126747e-01, -3.46504450e-01, -4.88999307e-01, + 1.69709325e-01, -7.81329215e-01, -3.46033633e-01, + -5.04679561e-01, -7.57076144e-02, -7.22708106e-01, + -5.05719960e-01, -4.01562452e-01, -3.15626919e-01, + -6.53050244e-01, -7.56461322e-01, -4.10937428e-01, + -2.75215149e-01, -6.49052978e-01, -7.54735589e-01, + -9.94891524e-02, -1.44118309e-01, 3.26209068e-02, + 1.83184981e-01, -5.77365875e-01, -6.34414554e-02, + 3.81501913e-02, -1.02612376e-01, -4.89815950e-01, + -3.11043441e-01, 1.63138151e-01, -4.82809007e-01, + -3.59270036e-01, -6.51788950e-01, 1.44278646e-01, + -4.63668108e-01, -3.65630984e-01, -6.33429885e-01 ] + - [ -8.88980925e-01, -4.99357283e-01, -6.77785635e-01, + -2.37071574e-01, -7.04979122e-01, -5.52824378e-01, + -6.73146129e-01, -3.37826431e-01, -6.89892352e-01, + -6.50892615e-01, -5.67187488e-01, -5.39735913e-01, + -6.51651621e-01, -8.48251581e-01, -5.71874976e-01, + -4.85455990e-01, -6.51604533e-01, -8.47181618e-01, + -5.28103471e-01, -2.32767999e-01, -1.87851489e-01, + -1.09474659e-02, -4.94690835e-01, -1.58798814e-01, + -2.04624236e-01, 1.95729733e-02, -5.34219563e-01, + -2.61878192e-01, -6.22671843e-03, -6.31948948e-01, + -3.74183059e-01, -7.39180624e-01, -1.24378800e-02, + -6.37643099e-01, -3.80559623e-01, -7.29465127e-01 ] + - [ -7.39436626e-01, -3.14963639e-01, -4.42157567e-01, + 6.65599227e-01, -8.76873553e-01, -1.22208536e-01, + -4.19726372e-01, -4.23770845e-01, -6.56222761e-01, + -6.44615531e-01, -3.81249964e-01, -2.77072668e-01, + -6.42256141e-01, -7.30023921e-01, -3.84374976e-01, + -2.95015991e-01, -6.31365299e-01, -7.43755937e-01, + -1.31349623e-01, -7.52064586e-02, 6.86165094e-02, + 6.83417559e-01, -7.24232256e-01, 2.74191260e-01, + 1.00577950e-01, -7.99237251e-01, -2.26145625e-01, + -6.10106111e-01, 1.43212914e-01, -5.36813021e-01, + -2.61419117e-01, -6.00101650e-01, 1.36815906e-01, + -6.72621012e-01, -2.37259448e-01, -6.26293898e-01 ] + - [ -7.68019915e-01, -4.06197488e-01, -5.10290980e-01, + 1.50226951e-01, -7.99047470e-01, -3.97681594e-01, + -5.04679561e-01, -5.37995696e-02, -7.68058896e-01, + -5.65530181e-01, -3.81249964e-01, -7.26343393e-02, + -7.44161487e-01, -7.59189248e-01, -3.89062464e-01, + -6.14387393e-02, -7.39920199e-01, -7.64629722e-01, + -1.28343940e-01, -2.14763880e-02, 6.63666725e-02, + 3.01762223e-01, -5.33311188e-01, 1.91721797e-01, + 1.28323674e-01, -2.17310071e-01, -3.78026545e-01, + -2.54275143e-01, 2.12951303e-01, -1.99134171e-01, + -3.47841978e-01, -5.00624299e-01, 2.01492548e-01, + -3.69928837e-01, -3.09525609e-01, -5.38344026e-01 ] + - [ -8.71789575e-01, -5.64932048e-01, -6.74946785e-01, + -1.75860882e-01, -8.05533171e-01, -6.61346257e-01, + -6.90424740e-01, -1.22366786e-01, -8.05759788e-01, + -6.68466091e-01, -5.92187405e-01, -2.10794270e-01, + -7.78317571e-01, -8.51703644e-01, -5.98437428e-01, + -1.80145621e-01, -7.77307689e-01, -8.54369342e-01, + -4.58370984e-01, -2.77721107e-01, -2.05849290e-01, + 1.27084255e-02, -5.98752499e-01, -3.15427542e-01, + -1.86127245e-01, -4.65291739e-02, -5.65753400e-01, + -3.86895180e-01, -1.00871742e-01, -2.23137915e-01, + -5.40104926e-01, -7.03878284e-01, -9.45274234e-02, + -2.41563976e-01, -5.50093293e-01, -7.07094848e-01 ] + - [ -6.51615560e-01, -3.88642430e-01, -3.78282428e-01, + 7.76516199e-02, -8.38142395e-01, -5.56080878e-01, + -3.96688223e-01, 2.29609013e-02, -8.13074172e-01, + -5.97855270e-01, -3.92187476e-01, 1.58502698e-01, + -7.72335410e-01, -7.03722715e-01, -3.96875024e-01, + 6.88102245e-02, -7.50894785e-01, -7.26748705e-01, + -9.31781530e-03, -2.42855489e-01, -2.13723183e-02, + 1.44999266e-01, -6.98109627e-01, -3.53090703e-01, + 1.15609169e-03, 1.95573568e-02, -6.46716118e-01, + -4.48231637e-01, 4.10958529e-02, 1.62020087e-01, + -6.13840103e-01, -5.91738224e-01, 3.48258018e-02, + 1.16331220e-01, -6.08245969e-01, -5.99275947e-01 ] + - [ -7.53521085e-01, -4.28449571e-01, -5.10290980e-01, + -7.33981133e-02, -8.03818703e-01, -5.90732396e-01, + -5.39236784e-01, 3.33897948e-01, -8.70029688e-01, + -4.79379475e-01, -5.29687524e-01, -1.30313694e-01, + -7.12850809e-01, -7.53620744e-01, -5.35937548e-01, + 1.44920945e-01, -7.59585559e-01, -7.07080841e-01, + -2.22122133e-01, -2.53493667e-01, -1.60854816e-01, + -7.54094720e-02, -5.66589057e-01, -3.60689640e-01, + -1.42196596e-01, 2.28262663e-01, -6.75178409e-01, + -2.85626113e-01, -8.84184837e-02, -2.19178140e-01, + -4.75996137e-01, -6.44797564e-01, -8.20896029e-02, + -1.73226416e-01, -5.03554642e-01, -6.34262502e-01 ] + - [ -7.85418391e-01, -2.93752491e-01, -4.66288209e-01, + 2.34006166e-01, -7.65764356e-01, -2.55724072e-01, + -4.68682528e-01, -4.93732095e-02, -7.13942945e-01, + -4.72753286e-01, -3.56249988e-01, -1.68988109e-01, + -6.72446787e-01, -7.17383444e-01, -3.59374940e-01, + -1.56749308e-01, -6.68370306e-01, -7.24523604e-01, + -3.28524232e-01, -7.92402029e-02, -3.48705649e-02, + 2.12175965e-01, -5.21846175e-01, 9.38563347e-02, + 3.46815586e-03, -3.81123841e-01, -3.00624490e-01, + -3.30619574e-01, 1.10834241e-01, -5.96265674e-01, + -2.48124897e-01, -6.20584130e-01, 9.70149040e-02, + -6.59903169e-01, -2.39000857e-01, -6.25258148e-01 ] + - [ -6.64871573e-01, -1.97753012e-01, -3.58410180e-01, + 3.62316847e-01, -7.38635302e-01, -9.05824900e-02, + -3.57811332e-01, 6.92632198e-02, -6.67353392e-01, + -3.04002285e-01, -2.15624928e-01, -8.93573165e-02, + -6.17148399e-01, -6.18424892e-01, -2.17187524e-01, + -6.27605915e-02, -6.16975546e-01, -6.23605132e-01, + 1.81845427e-01, 2.62650013e-01, 3.11586022e-01, 1.41735792e-01, + -2.65151262e-01, 4.92850780e-01, 3.52601171e-01, + -2.88403749e-01, -9.13853645e-02, 1.12362862e-01, + 4.27148223e-01, -3.52313876e-01, 1.21775866e-02, + -2.38862991e-01, 4.10447836e-01, -3.54830503e-01, + 6.02638721e-03, -2.29349494e-01 ] + - [ -8.82974327e-01, -4.67611372e-01, -6.80624604e-01, + -2.66265512e-01, -7.51233041e-01, -6.46368980e-01, + -7.00503945e-01, -2.11049318e-01, -7.61817992e-01, + -6.62855744e-01, -6.87500000e-01, -3.24022532e-01, + -6.56053066e-01, -7.91003823e-01, -6.92187488e-01, + -3.23817015e-01, -6.47699594e-01, -8.01887691e-01, + -6.66366100e-01, -4.10117567e-01, -4.46569204e-01, + -1.97208405e-01, -6.06913090e-01, -5.83166897e-01, + -4.63583827e-01, -2.28412032e-01, -6.01471543e-01, + -6.47468805e-01, -4.62017417e-01, -2.02701449e-01, + -5.53377032e-01, -7.33900607e-01, -4.67661679e-01, + -2.56678522e-01, -5.57446361e-01, -7.48015523e-01 ] + - [ -9.19221222e-01, -6.76081777e-01, -7.64371872e-01, + -1.91363275e-01, -8.64669681e-01, -7.65854359e-01, + -7.78257728e-01, -2.18672752e-01, -8.41255903e-01, + -7.85554767e-01, -7.14062452e-01, -1.47121787e-01, + -8.36557388e-01, -8.94747853e-01, -7.17187524e-01, + -1.39785826e-01, -8.32745075e-01, -9.00645792e-01, + -6.66366100e-01, -4.42282200e-01, -3.52081001e-01, + 8.19935799e-02, -7.49157548e-01, -5.16298890e-01, + -3.36416245e-01, 1.77749395e-02, -7.11415887e-01, + -5.69838226e-01, -3.02615166e-01, -4.45941091e-02, + -6.77266181e-01, -7.61084437e-01, -2.88557291e-01, + -1.76117361e-01, -6.58914208e-01, -7.85527110e-01 ] + - [ -8.11723292e-01, -3.96229446e-01, -5.40099382e-01, + 4.49305773e-02, -7.59954453e-01, -4.08119977e-01, + -5.47876179e-01, -1.12170815e-01, -7.31561422e-01, + -5.45815170e-01, -4.31249976e-01, -3.48663628e-01, + -6.69619560e-01, -7.86008000e-01, -4.37499940e-01, + -2.91276991e-01, -6.71469033e-01, -7.83633947e-01, + -2.62398601e-01, -1.59414113e-01, -2.36220360e-02, + 1.63949132e-01, -5.62950969e-01, -5.73945642e-02, + -1.27168894e-02, -7.07072616e-02, -4.99549687e-01, + -2.95613050e-01, 1.35740995e-01, -5.48048437e-01, + -3.56459558e-01, -6.80059254e-01, 1.16915464e-01, + -5.27239442e-01, -3.68059278e-01, -6.64843082e-01 ] + - [ -8.64125967e-01, -4.65781391e-01, -6.53655052e-01, + -1.74708307e-01, -7.34083891e-01, -5.45058608e-01, + -6.63066983e-01, -1.35711610e-01, -7.18042135e-01, + -5.39209247e-01, -5.59374988e-01, -2.81464159e-01, + -6.91576600e-01, -7.92403519e-01, -5.60937464e-01, + -2.89140105e-01, -6.81334794e-01, -8.01993668e-01, + -4.28313851e-01, -1.26758218e-01, -9.33633447e-02, + -2.14238584e-01, -3.75099778e-01, -2.13448644e-01, + -1.23699486e-01, -7.05785155e-02, -3.65469992e-01, + -8.37599039e-02, 3.86052132e-02, -5.48311591e-01, + -2.90824652e-01, -6.37287199e-01, 1.24377012e-02, + -4.90124702e-01, -3.18313003e-01, -6.16276324e-01 ] + - [ -8.08409274e-01, -5.24535656e-01, -6.09652162e-01, + 2.55602479e-01, -9.04925227e-01, -5.34522176e-01, + -6.16990626e-01, -3.39221001e-01, -7.68955171e-01, + -7.50415623e-01, -6.15625024e-01, 2.56991744e-01, + -8.37349534e-01, -7.48218775e-01, -6.12499952e-01, + -3.44646871e-01, -7.22242713e-01, -8.61223638e-01, + -3.48361909e-01, -3.40279281e-01, -2.28346467e-01, + 1.90634608e-01, -7.35351205e-01, -3.71367931e-01, + -2.32369959e-01, -5.00398159e-01, -4.74028587e-01, + -6.84996724e-01, -2.40348697e-01, 3.79711390e-02, + -6.07023239e-01, -6.51895106e-01, -2.06467748e-01, + -3.19520891e-01, -5.42870522e-01, -7.40337014e-01 ] + - [ -9.41590726e-01, -5.86650729e-01, -8.12633097e-01, + -2.32326508e-01, -7.88440347e-01, -6.76218867e-01, + -8.35853100e-01, -1.97366595e-01, -8.06417882e-01, + -7.21649766e-01, -7.87499964e-01, -2.65248895e-01, + -7.55175948e-01, -8.69366229e-01, -7.95312464e-01, + -2.48731375e-01, -7.49994040e-01, -8.74805808e-01, + -8.21460843e-01, -4.61650968e-01, -5.47806501e-01, + -3.00057590e-01, -5.15363932e-01, -5.90215087e-01, + -5.93063593e-01, -1.93961978e-01, -6.10846579e-01, + -6.51595950e-01, -6.03985071e-01, -3.21251452e-01, + -5.12400746e-01, -7.76937187e-01, -6.11940265e-01, + -3.91026139e-01, -5.09359717e-01, -7.90979803e-01 ] + - [ -7.51864135e-01, -1.37345612e-01, -3.91057491e-01, + 2.65234947e-01, -6.94804966e-01, -8.67291689e-02, + -4.21166301e-01, 2.88664103e-01, -6.96590662e-01, + -1.57410324e-01, -3.29687476e-01, -1.77519917e-01, + -5.33409774e-01, -5.70140600e-01, -3.35937440e-01, + -1.82517409e-01, -5.20303726e-01, -5.78931749e-01, + -1.21731341e-01, 1.56984687e-01, 1.69853687e-01, + -2.47371793e-02, -2.29055643e-01, 3.06944728e-01, + 1.79190636e-01, -1.16908967e-01, -2.61716962e-01, + 4.74740267e-02, 2.15442181e-01, -4.64082956e-01, + -6.94406033e-03, -3.40039015e-01, 2.01492548e-01, + -5.46957552e-01, 1.66639090e-02, -3.49382699e-01 ] + - [ -8.31400156e-01, -4.42673028e-01, -5.99716127e-01, + -1.08051419e-01, -7.31345117e-01, -4.85756338e-01, + -6.11231089e-01, -9.70042944e-02, -7.29947209e-01, + -5.29552102e-01, -4.87499952e-01, -1.77644372e-01, + -7.10801661e-01, -7.67316937e-01, -4.87499952e-01, + -2.07458198e-01, -6.99285805e-01, -7.82447517e-01, + -3.08686554e-01, -4.64244485e-02, -4.61191535e-02, + -5.73743582e-02, -3.49937975e-01, 3.82097960e-02, + -2.19653249e-02, -1.53028071e-01, -3.15462053e-01, + -9.75292921e-02, 8.34370852e-02, -1.59225285e-01, + -3.33297729e-01, -4.71177638e-01, 1.31840825e-01, + -5.38008690e-01, -2.54433453e-01, -5.77805758e-01 ] + - [ -6.29246056e-01, -2.08745360e-01, -3.25762928e-01, + 8.30592871e-01, -8.79743040e-01, -6.91831112e-03, + -2.72858143e-01, -5.19066095e-01, -5.92180133e-01, + -6.14406466e-01, -2.59374917e-01, -3.05441439e-01, + -5.72697997e-01, -6.64663315e-01, -2.76562512e-01, + -3.41259897e-01, -5.54953933e-01, -6.82118058e-01, + 4.83919382e-02, -5.09508848e-02, 1.27109051e-01, + 7.51115918e-01, -7.32439876e-01, 3.38825703e-01, + 1.76878572e-01, -7.77519405e-01, -2.43244946e-01, + -5.98563671e-01, 2.55292654e-01, -5.12487948e-01, + -2.57888854e-01, -5.77470303e-01, 2.36318350e-01, + -6.13968194e-01, -2.43589163e-01, -5.96966386e-01 ] + - [ -8.92502069e-01, -6.97855353e-01, -7.54435778e-01, + -1.45020604e-01, -9.02401507e-01, -7.99861431e-01, + -7.69618392e-01, -9.47937965e-02, -8.92628908e-01, + -7.91652739e-01, -7.24999905e-01, -1.90978646e-02, + -8.79532218e-01, -9.00083303e-01, -7.26562500e-01, + -1.13099813e-02, -8.77483547e-01, -9.05900300e-01, + -5.47941089e-01, -4.86239433e-01, -3.31833541e-01, + -4.08391953e-02, -7.45956063e-01, -6.32259727e-01, + -3.66474092e-01, 3.90450954e-02, -7.29451954e-01, + -5.81477880e-01, -3.37484360e-01, -2.08089948e-02, + -7.17745841e-01, -7.90677309e-01, -3.20895433e-01, + -2.24700809e-01, -6.84826672e-01, -8.26655090e-01 ] + - [ -6.99254394e-01, -2.94114411e-01, -3.38537931e-01, + 4.80018973e-01, -8.04071069e-01, -1.35917783e-01, + -2.98776031e-01, -4.40208852e-01, -6.43797874e-01, + -6.32026076e-01, -1.90624952e-01, -4.95124817e-01, + -6.10425234e-01, -7.67692685e-01, -2.07812428e-01, + -3.46355855e-01, -6.27711177e-01, -7.49064028e-01, + 9.52808857e-02, -4.60521579e-02, 2.50843644e-01, + 7.32392907e-01, -6.85385466e-01, 4.25330520e-01, + 3.22543263e-01, -5.75604796e-01, -3.14236164e-01, + -4.93594229e-01, 4.86923933e-01, -8.86503220e-01, + -2.12922156e-01, -6.92639947e-01, 4.62686658e-01, + -7.54441619e-01, -2.61813521e-01, -6.56899989e-01 ] + - [ -8.46106052e-01, -4.97438073e-01, -6.29524469e-01, + -7.54857063e-02, -7.74174392e-01, -5.29650986e-01, + -6.25629902e-01, -1.70616984e-01, -7.64060676e-01, + -6.37414575e-01, -5.17187476e-01, -2.01603770e-01, + -7.44328022e-01, -8.11278582e-01, -5.26562452e-01, + -1.73811078e-01, -7.42258906e-01, -8.14332902e-01, + -3.65193903e-01, -1.28676295e-01, -1.20359898e-01, + 1.34979010e-01, -4.89830196e-01, 5.16446829e-02, + -5.89596033e-02, -2.30461240e-01, -3.88831854e-01, + -3.01258564e-01, 7.09837675e-02, -3.54417086e-01, + -3.78895819e-01, -6.14686370e-01, 6.96516037e-02, + -4.91040528e-01, -3.61817181e-01, -6.47435665e-01 ] + - [ -7.34465599e-01, -3.23295653e-01, -4.47835386e-01, + -8.43439102e-02, -6.87881589e-01, -4.01006043e-01, + -4.68682528e-01, 2.09901929e-01, -7.37364173e-01, + -3.03773701e-01, -3.04687500e-01, -1.62875712e-01, + -6.61318183e-01, -7.00934172e-01, -3.12500000e-01, + -1.54081523e-01, -6.55904353e-01, -7.08314896e-01, + -8.71658325e-03, 1.46679044e-01, 1.83352113e-01, + -9.31813121e-02, -2.35331714e-01, 1.96789861e-01, + 1.65317893e-01, 1.72493577e-01, -2.81218290e-01, + 4.03708816e-01, 3.72353673e-01, -4.53819394e-01, + -9.52126980e-02, -4.00604367e-01, 3.58208895e-01, + -6.10429525e-01, -5.71768880e-02, -4.35050309e-01 ] + - [ -8.84424210e-01, -4.87255096e-01, -6.69268966e-01, + -1.05810165e-03, -7.91144073e-01, -4.89370584e-01, + -6.70266390e-01, -2.18656301e-01, -7.33208418e-01, + -6.25629723e-01, -5.78124940e-01, -2.55073249e-01, + -7.27443099e-01, -8.17993402e-01, -5.82812428e-01, + -2.13734984e-01, -7.28683233e-01, -8.19666505e-01, + -5.35317123e-01, -1.80369914e-01, -2.32845843e-01, + 1.09229922e-01, -5.01106143e-01, -4.74238396e-03, + -1.69942200e-01, -3.57896566e-01, -3.26728046e-01, + -3.66454601e-01, -6.10211492e-02, -6.18334174e-01, + -3.14217269e-01, -6.95944667e-01, -8.70646834e-02, + -6.64634407e-01, -3.06488216e-01, -6.94609702e-01 ] + - [ -7.24523604e-01, -4.61696267e-01, -4.84740913e-01, + -5.58161139e-02, -8.15226853e-01, -6.00108385e-01, + -4.83081341e-01, 2.00553656e-01, -8.60226274e-01, + -5.64878225e-01, -4.15624976e-01, -1.30642712e-01, + -7.73213565e-01, -8.11679661e-01, -4.29687500e-01, + 1.03526592e-01, -8.04572344e-01, -7.78280377e-01, + -1.00691378e-01, -2.46754408e-01, -1.09111309e-01, + 8.14088583e-02, -6.19110107e-01, -2.70149291e-01, + -1.27168894e-02, 1.06261253e-01, -6.45799637e-01, + -3.61467838e-01, 8.34370852e-02, -2.56789386e-01, + -5.29259562e-01, -6.99317276e-01, 4.22885418e-02, + -1.34734452e-01, -5.56988657e-01, -6.61471903e-01 ] + - [ -7.54142523e-01, -2.67982125e-01, -4.35060322e-01, + 1.94041133e-01, -7.29166150e-01, -2.22822845e-01, + -4.35565174e-01, -3.08833122e-02, -6.91745043e-01, + -4.22650218e-01, -3.03124905e-01, -2.66448796e-01, + -6.30657613e-01, -7.09818840e-01, -3.14062476e-01, + -1.88454747e-01, -6.34413838e-01, -7.00065017e-01, + -1.43973649e-01, -5.65539002e-02, 5.96176386e-02, + 1.95512414e-01, -4.97664571e-01, 1.15423203e-01, + 9.82658863e-02, -1.45359218e-01, -4.05753672e-01, + -2.20898867e-01, 2.05479503e-01, -5.47739983e-01, + -2.56608903e-01, -5.96808136e-01, 1.84079528e-01, + -4.91943598e-01, -2.79434860e-01, -5.72682261e-01 ] + - [ -9.21085358e-01, -5.17596662e-01, -7.64371872e-01, + -2.32910514e-01, -7.67058969e-01, -6.44081116e-01, + -7.89776802e-01, -1.12794042e-01, -8.03982735e-01, + -6.54158354e-01, -7.62499988e-01, -2.97536373e-01, + -6.93888903e-01, -8.25358927e-01, -7.68750012e-01, + -3.04983974e-01, -6.80048466e-01, -8.34349871e-01, + -7.72768259e-01, -4.33330476e-01, -5.23059607e-01, + -2.77040958e-01, -5.44859886e-01, -5.97122908e-01, + -5.56069434e-01, -2.14477301e-01, -5.95168591e-01, + -6.43442988e-01, -5.66625237e-01, -2.64615297e-01, + -5.21427035e-01, -7.50762403e-01, -5.74626863e-01, + -3.17980707e-01, -5.24836779e-01, -7.63446987e-01 ] + - [ -8.05302382e-01, -3.10628712e-01, -5.27324319e-01, + 1.06050968e-01, -7.10982382e-01, -2.55480468e-01, + -5.20518363e-01, -1.49573982e-01, -6.61916554e-01, + -4.64814544e-01, -3.89062464e-01, -3.56447518e-01, + -6.19828761e-01, -7.39436269e-01, -3.95312428e-01, + -2.67344952e-01, -6.29756093e-01, -7.32067525e-01, + -2.14908361e-01, -7.90225267e-02, 5.62441349e-03, + 1.37655735e-01, -4.69134510e-01, 9.28543806e-02, + 4.73988056e-02, -1.02480888e-01, -4.23573911e-01, + -2.04682946e-01, 1.85554147e-01, -6.07382774e-01, + -2.69401014e-01, -6.36036634e-01, 1.56716347e-01, + -5.11544824e-01, -3.01239908e-01, -6.01653934e-01 ] + - [ -7.02361226e-01, -2.12735653e-01, -3.58410180e-01, + 5.32951355e-02, -6.57661319e-01, -2.29263723e-01, + -3.66450608e-01, 1.48467541e-01, -6.64819777e-01, + -2.30634511e-01, -1.75000012e-01, -4.43233371e-01, + -5.58546543e-01, -7.00883746e-01, -1.89062476e-01, + -3.10068369e-01, -5.69125414e-01, -6.77830815e-01, + 5.44033051e-02, 5.30446768e-02, 2.26096749e-01, + -1.17169619e-02, -3.37456584e-01, 1.32556915e-01, + 1.81502938e-01, 1.40233755e-01, -3.27880025e-01, + 2.69734263e-01, 5.09339929e-01, -9.94020462e-01, + -5.95568419e-02, -6.31699204e-01, 4.67661738e-01, + -7.13938534e-01, -1.44412398e-01, -5.49718022e-01 ] + - [ -8.25807810e-01, -4.40330923e-01, -5.96877217e-01, + -1.97899401e-01, -6.91983342e-01, -4.99576211e-01, + -6.04031682e-01, 2.28238106e-03, -7.63637245e-01, + -5.09435534e-01, -4.84374940e-01, -3.26369166e-01, + -6.82988763e-01, -7.94428349e-01, -4.82812464e-01, + -3.64822149e-01, -6.68491602e-01, -8.10781181e-01, + -2.60595143e-01, -1.06119096e-01, -2.13723183e-02, + -4.88851070e-02, -4.10384893e-01, -5.42692542e-02, + -3.58382463e-02, -1.13275230e-01, -3.76057744e-01, + -1.46675289e-01, 1.03362441e-01, -5.90833724e-01, + -2.49062538e-01, -6.19383097e-01, 1.11940265e-01, + -8.03072631e-01, -2.15397298e-01, -6.69531465e-01 ] + - [ -5.57580829e-01, -1.42076552e-01, -1.90915585e-01, + 4.75219727e-01, -7.67285228e-01, -8.11985731e-02, + -2.13822842e-01, 4.54801083e-01, -7.60486901e-01, + -1.80956006e-01, -5.78125119e-02, 1.09441757e-01, + -6.50890350e-01, -5.68664432e-01, -7.18750358e-02, + 1.15054011e-01, -6.45524979e-01, -5.74580312e-01, + 4.32521820e-01, 2.63383269e-01, 4.91563559e-01, 2.99276948e-01, + -3.61415267e-01, 5.31929493e-01, 4.91329432e-01, + 9.54037905e-02, -2.92325377e-01, 2.75613785e-01, + 5.46699762e-01, -3.93835247e-01, 2.00160742e-02, + -2.50756681e-01, 5.62189102e-01, -4.52815711e-01, + 1.39164925e-02, -2.72503614e-01 ] + - [ -8.51077080e-01, -4.60448921e-01, -5.94038308e-01, + -2.22269773e-01, -7.20345318e-01, -5.64285994e-01, + -6.28509760e-01, -1.03588879e-01, -7.20944345e-01, + -5.19374609e-01, -4.84374940e-01, -3.51867914e-01, + -6.83949947e-01, -8.04203749e-01, -4.87499952e-01, + -3.16972375e-01, -6.83953822e-01, -8.07947993e-01, + -3.61587107e-01, -1.31081581e-01, -1.11361146e-01, + 6.41454458e-02, -4.85100389e-01, -3.89252901e-02, + -7.51445293e-02, 1.79182291e-02, -4.17468011e-01, + -5.72247505e-02, 1.18306279e-01, -5.39388776e-01, + -3.30744565e-01, -6.57733679e-01, 1.31840825e-01, + -6.79457486e-01, -3.15515161e-01, -6.87738061e-01 ] + - [ -8.23115170e-01, -4.06926930e-01, -5.55713236e-01, + 6.02004528e-02, -7.68256366e-01, -4.08017218e-01, + -5.57955325e-01, -1.55392528e-01, -7.28294492e-01, + -5.71927965e-01, -4.43749964e-01, -2.84519196e-01, + -6.94227934e-01, -7.87228346e-01, -4.46874917e-01, + -2.50460565e-01, -6.93690538e-01, -7.90197849e-01, + -3.63390446e-01, -1.14452124e-01, -6.86163306e-02, + 1.48506165e-01, -5.01805067e-01, 4.55794334e-02, + -2.19653249e-02, -3.43492806e-01, -3.29311013e-01, + -3.33318532e-01, 8.59277248e-02, -5.97719967e-01, + -2.78827786e-01, -6.46850228e-01, 7.71143436e-02, + -6.62273169e-01, -2.76554286e-01, -6.56219363e-01 ] + - [ -7.34879851e-01, -4.16513622e-01, -4.81902063e-01, + 9.97428894e-02, -8.20461988e-01, -4.90839183e-01, + -4.94600415e-01, 1.67486310e-01, -8.23635697e-01, + -5.09784520e-01, -3.78125012e-01, 1.42897367e-02, + -7.71959841e-01, -7.58897662e-01, -3.82812500e-01, + 3.83150578e-02, -7.70873427e-01, -7.61831641e-01, + -2.49475241e-02, -9.48639512e-02, 8.88639688e-02, + 8.05324316e-02, -5.67364812e-01, -1.73541427e-01, + 9.36415195e-02, 7.43787289e-02, -5.50233066e-01, + -2.21136451e-01, 1.48194313e-01, -7.77622461e-02, + -4.34472322e-01, -5.23442268e-01, 1.34328365e-01, + -1.56597912e-01, -4.21829164e-01, -5.39301991e-01 ] + - [ -8.76139224e-01, -5.27304173e-01, -6.67849541e-01, + -2.15637684e-01, -7.64841735e-01, -6.27346456e-01, + -6.90424740e-01, -5.92636466e-02, -7.86078930e-01, + -5.89385033e-01, -5.79687476e-01, -2.61785388e-01, + -7.44312227e-01, -8.35969985e-01, -5.84374905e-01, + -2.17207968e-01, -7.44868398e-01, -8.35915565e-01, + -5.16681671e-01, -1.52202010e-01, -1.74353242e-01, + -2.04997301e-01, -3.87817502e-01, -2.30375528e-01, + -2.39306450e-01, 6.03954792e-02, -4.44589317e-01, + -5.53531051e-02, -6.10211492e-02, -5.16634464e-01, + -3.30162585e-01, -6.61952138e-01, -8.70646834e-02, + -5.25421739e-01, -3.34754765e-01, -6.54234648e-01 ] + - [ -7.84175634e-01, -3.78074706e-01, -5.17388225e-01, + 5.76901436e-02, -7.91920781e-01, -4.62949216e-01, + -5.29157639e-01, 2.05282331e-01, -8.03283632e-01, + -4.32969570e-01, -4.23437476e-01, -6.52156472e-02, + -7.33288884e-01, -7.45720506e-01, -4.32812452e-01, + -2.15637684e-02, -7.33493209e-01, -7.43700504e-01, + -2.12503850e-01, -3.42136025e-02, 7.08662271e-02, + -1.59857571e-01, -4.10720110e-01, -1.89938068e-01, + -1.04046464e-02, 1.21909380e-01, -4.61715341e-01, + -3.67456675e-03, 1.00871801e-01, -3.23279500e-01, + -2.90551782e-01, -5.19873857e-01, 8.70646238e-02, + -3.18528712e-01, -3.04462254e-01, -5.14637768e-01 ] + - [ -4.87779677e-01, -3.26828361e-02, -8.58765244e-02, + 5.16448140e-01, -7.42336690e-01, 1.36041641e-03, + -9.86319780e-02, 5.32407165e-01, -7.31996477e-01, + -6.44185543e-02, -3.43749523e-02, -1.24615431e-02, + -5.29140294e-01, -4.75739539e-01, -4.06249166e-02, + -1.65965557e-02, -5.22710383e-01, -4.88735020e-01, + 4.68590260e-01, 2.75228024e-01, 4.55568075e-01, 1.58172607e-01, + -2.84108222e-01, 4.77760077e-01, 4.84393001e-01, + 4.64439392e-04, -2.33176887e-01, 2.57420301e-01, + 5.79078436e-01, -3.87719572e-01, 4.12517786e-02, + -2.25507617e-01, 5.84576964e-01, -4.29972410e-01, + 2.91374922e-02, -2.43940115e-01 ] + - [ -5.92999160e-01, -2.32043087e-01, -2.73243427e-01, + 2.01088428e-01, -7.57462800e-01, -3.00637245e-01, + -2.87257016e-01, 4.07748938e-01, -7.81156242e-01, + -2.56809413e-01, -1.60937488e-01, -8.17799568e-03, + -6.74583912e-01, -6.49243832e-01, -1.59375012e-01, + 1.20171309e-02, -6.75179601e-01, -6.56652689e-01, + 3.73609900e-01, 1.45009279e-01, 3.67828965e-01, 4.87458706e-03, + -3.18951011e-01, 1.91266298e-01, 3.82658839e-01, + 2.34650254e-01, -4.09194231e-01, 2.36968279e-01, + 5.01867890e-01, -3.64858866e-01, -1.37192309e-01, + -3.81133258e-01, 5.09950161e-01, -4.77679074e-01, + -1.17718577e-01, -4.07420516e-01 ] + - [ -7.57456541e-01, -3.17088783e-01, -4.69127059e-01, + 8.91383886e-02, -7.66441941e-01, -3.91596258e-01, + -4.78761673e-01, 1.28814459e-01, -7.40196943e-01, + -3.77087951e-01, -3.68749917e-01, -1.09943628e-01, + -6.82726741e-01, -7.05486655e-01, -3.76562476e-01, + -1.26456082e-01, -6.64838433e-01, -7.09339499e-01, + -1.14517689e-01, -4.54169512e-03, 1.40607476e-01, + -1.90846026e-01, -3.83487225e-01, -1.78810120e-01, + 1.23699307e-01, -7.62391090e-03, -3.93420041e-01, + -4.02984023e-02, 1.98007464e-01, -3.77413213e-01, + -2.43810177e-01, -5.00874877e-01, 1.34328365e-01, + -1.76431894e-01, -2.89585531e-01, -4.21749651e-01 ] + - [ -6.38980985e-01, -1.87547028e-01, -3.61249149e-01, + 5.39745092e-02, -6.86629057e-01, -2.82327831e-01, + -3.63570869e-01, 2.57815123e-02, -6.58126354e-01, + -3.23437214e-01, -3.15624952e-01, -1.60220981e-01, + -5.67096531e-01, -5.98149598e-01, -3.18750024e-01, + -3.17748427e-01, -5.23290753e-01, -6.44126773e-01, + 1.29546165e-01, -1.33036375e-02, 1.36107922e-01, + 2.79991627e-02, -4.61777747e-01, -4.17965651e-02, + 1.00577950e-01, -7.09021091e-02, -3.78379583e-01, + -9.17841196e-02, 2.30386019e-01, -2.63041437e-01, + -2.65001655e-01, -4.56403017e-01, 2.66169310e-01, + -4.79392588e-01, -2.44669497e-01, -5.32163024e-01 ] + - [ -5.65451622e-01, -1.09332860e-01, -2.19304502e-01, + 9.27684307e-02, -6.85261071e-01, -2.58017421e-01, + -2.29661644e-01, 3.06692600e-01, -7.10166574e-01, + -1.97630346e-01, -1.93749905e-01, -4.55992222e-02, + -5.54652512e-01, -5.25452077e-01, -2.01562524e-01, + 2.00690031e-02, -5.58997035e-01, -5.16677260e-01, + 1.88457966e-01, 1.22092962e-01, 2.53093362e-01, + -8.78696442e-02, -3.66943538e-01, -1.89953446e-02, + 2.46242762e-01, 6.09235764e-02, -3.82191718e-01, + 6.64991140e-02, 3.30012321e-01, -6.26401901e-02, + -2.30704427e-01, -3.01996350e-01, 3.23382974e-01, + -5.49849272e-02, -2.48087943e-01, -3.03228080e-01 ] + - [ -5.45360446e-01, -1.33104801e-01, -1.71043336e-01, + 4.96081471e-01, -7.71846890e-01, -7.58672357e-02, + -1.95104361e-01, 4.83240962e-01, -7.64482737e-01, + -1.68411970e-01, -4.68749404e-02, 1.11771703e-01, + -6.44757450e-01, -5.59817314e-01, -5.93749881e-02, + 1.16749167e-01, -6.40899777e-01, -5.67961931e-01, + 4.46949124e-01, 2.62758374e-01, 4.82564688e-01, 2.93026090e-01, + -3.59576702e-01, 5.26757956e-01, 4.95953679e-01, + 8.27276707e-02, -2.84899533e-01, 2.72622466e-01, + 5.56662440e-01, -3.60135913e-01, 9.12797451e-03, + -2.39666879e-01, 5.74626923e-01, -4.53687847e-01, + 1.22662783e-02, -2.73872912e-01 ] + - [ -6.17647052e-01, -1.92938089e-01, -2.94535160e-01, + 1.77100539e-01, -7.15949357e-01, -2.33859122e-01, + -3.04535568e-01, 4.64869261e-01, -7.57128596e-01, + -1.48740709e-01, -1.43749893e-01, 3.25819254e-02, + -6.49944484e-01, -6.02162957e-01, -1.48437440e-01, + 1.63658857e-02, -6.42510653e-01, -6.16255105e-01, + 3.02073956e-01, 2.39507437e-01, 3.97075295e-01, + -4.24830317e-02, -2.58690059e-01, 2.34661579e-01, + 3.59537482e-01, 2.82338142e-01, -3.20606112e-01, + 4.79787707e-01, 4.99377251e-01, -2.80832291e-01, + -4.33008671e-02, -2.43219137e-01, 5.07462502e-01, + -4.78964388e-01, -1.55693293e-03, -3.04638445e-01 ] + - [ -6.51201308e-01, -1.92587316e-01, -3.42796326e-01, + 1.85209513e-01, -7.18745470e-01, -2.25314617e-01, + -3.39092791e-01, 3.82078886e-02, -6.91131353e-01, + -3.72650445e-01, -2.87499964e-01, -3.61466885e-01, + -5.46224475e-01, -6.63424969e-01, -2.99999952e-01, + -1.90559208e-01, -5.69520831e-01, -6.32731318e-01, + 4.83919382e-02, -4.53695655e-02, 9.33632851e-02, + 7.86969662e-02, -4.38418269e-01, 6.89408779e-02, + 1.79190636e-01, -2.37194180e-01, -3.65480125e-01, + -2.52805889e-01, 2.92652488e-01, -5.05726099e-01, + -2.52686441e-01, -5.67489028e-01, 2.36318350e-01, + -4.00802016e-01, -2.75845408e-01, -5.22036254e-01 ] + - [ -7.34465599e-01, -3.23295653e-01, -4.47835386e-01, + -8.43439102e-02, -6.87881589e-01, -4.01006043e-01, + -4.68682528e-01, 2.09901929e-01, -7.37364173e-01, + -3.03773701e-01, -3.04687500e-01, -1.62875712e-01, + -6.61318183e-01, -7.00934172e-01, -3.12500000e-01, + -1.54081523e-01, -6.55904353e-01, -7.08314896e-01, + -8.71658325e-03, 1.46679044e-01, 1.83352113e-01, + -9.31813121e-02, -2.35331714e-01, 1.96789861e-01, + 1.65317893e-01, 1.72493577e-01, -2.81218290e-01, + 4.03708816e-01, 3.72353673e-01, -4.53819394e-01, + -9.52126980e-02, -4.00604367e-01, 3.58208895e-01, + -6.10429525e-01, -5.71768880e-02, -4.35050309e-01 ] + - [ -8.87945294e-01, -5.73968589e-01, -7.24627376e-01, + 3.88029814e-02, -8.67071688e-01, -5.96473277e-01, + -7.03383684e-01, -3.07656109e-01, -7.81548023e-01, + -7.53920197e-01, -6.76562428e-01, -5.75492382e-02, + -8.08856308e-01, -8.35943282e-01, -6.70312524e-01, + -2.68830001e-01, -7.62191951e-01, -8.75670552e-01, + -5.47941089e-01, -3.67676556e-01, -3.04836869e-01, + 1.24978185e-01, -7.07133353e-01, -3.86788189e-01, + -2.78612673e-01, -5.15132070e-01, -4.41311836e-01, + -6.70407593e-01, -3.00124526e-01, -4.71320748e-02, + -6.08509898e-01, -6.97196066e-01, -2.58706450e-01, + -5.19421160e-01, -5.10663271e-01, -7.98099697e-01 ] + - [ -6.23032331e-01, -2.60428488e-01, -3.24343503e-01, + 4.21076894e-01, -8.32724810e-01, -2.69793987e-01, + -3.10295165e-01, -8.40907097e-02, -7.29060352e-01, + -5.27725697e-01, -2.95312405e-01, -1.94439173e-01, + -6.37070656e-01, -6.87413633e-01, -3.10937524e-01, + 9.99063253e-02, -6.84671760e-01, -6.32006884e-01, + 1.66215777e-01, -6.71890974e-02, 1.51856065e-01, + 4.32691455e-01, -6.58694983e-01, 7.82065392e-02, + 2.30057716e-01, -3.43634963e-01, -4.41386104e-01, + -4.59860623e-01, 2.80199170e-01, -2.67321825e-01, + -3.71543109e-01, -5.54497957e-01, 2.46268749e-01, + -1.24848902e-01, -4.12275493e-01, -5.10116160e-01 ] + - [ -8.33264291e-01, -4.41672742e-01, -6.01135552e-01, + -7.10602403e-02, -7.63135731e-01, -5.08990765e-01, + -6.12670898e-01, 3.51520777e-02, -7.70982027e-01, + -4.95523274e-01, -5.00000000e-01, -1.83955729e-01, + -7.19069719e-01, -7.78806567e-01, -5.06250024e-01, + -1.28114045e-01, -7.23212242e-01, -7.77417660e-01, + -3.70003045e-01, -2.07080841e-02, -5.51180840e-02, + -8.58305097e-02, -3.69127572e-01, -3.44309211e-02, + -2.89017558e-02, -1.10855699e-02, -3.61546934e-01, + 4.08053398e-03, 5.60398102e-02, -4.09911931e-01, + -2.23806202e-01, -5.11138201e-01, 3.98010015e-02, + -4.10053968e-01, -2.38486290e-01, -5.07316828e-01 ] + - [ -8.69096935e-01, -5.61224937e-01, -6.89141214e-01, + -5.60658574e-02, -8.36880445e-01, -6.21417761e-01, + -6.83225334e-01, -1.05512142e-01, -8.29524279e-01, + -6.96110427e-01, -6.34374976e-01, -1.32478595e-01, + -7.95529485e-01, -8.45539212e-01, -6.39062524e-01, + -1.17601335e-01, -7.92355895e-01, -8.50645244e-01, + -4.82416630e-01, -3.94218683e-01, -3.29583824e-01, + 1.77971721e-01, -7.38577724e-01, -3.87566209e-01, + -3.01734209e-01, -1.35106027e-01, -6.18387103e-01, + -5.64827085e-01, -2.65255272e-01, -2.72020936e-01, + -5.93037486e-01, -7.79340744e-01, -2.78607011e-01, + -3.64675403e-01, -5.76578021e-01, -7.90109634e-01 ] + - [ -9.13835943e-01, -3.71382833e-01, -7.09013462e-01, + 1.72832489e-01, -7.92791486e-01, -3.04072499e-01, + -7.12023020e-01, -1.49656117e-01, -7.29411840e-01, + -5.67157447e-01, -6.62499964e-01, -1.82044208e-01, + -6.79392457e-01, -7.50782847e-01, -6.74999952e-01, + -8.34775567e-02, -6.90596700e-01, -7.36919165e-01, + -7.10249543e-01, -1.29401982e-01, -3.61079931e-01, + 2.30004191e-01, -5.55280805e-01, 7.68841505e-02, + -3.08670521e-01, -4.09826338e-01, -3.30567956e-01, + -4.52672362e-01, -3.07596564e-01, -5.13700902e-01, + -2.41814017e-01, -6.22161508e-01, -3.33333433e-01, + -3.49333942e-01, -3.06431949e-01, -5.69505095e-01 ] + - [ -6.71499610e-01, -4.16808486e-01, -4.13768649e-01, + 8.23137760e-02, -8.48342299e-01, -5.70375741e-01, + -4.34125304e-01, 3.02820206e-02, -8.24525356e-01, + -6.11990988e-01, -4.29687500e-01, 1.51823401e-01, + -7.84658372e-01, -7.22359955e-01, -4.29687500e-01, + 7.80513287e-02, -7.67396867e-01, -7.43294954e-01, + -8.71658325e-03, -2.44264901e-01, -2.13723183e-02, + 1.44825816e-01, -6.98340654e-01, -3.53746772e-01, + -3.46827507e-03, 2.10146904e-02, -6.47213817e-01, + -4.47812557e-01, 3.86052132e-02, 1.59372687e-01, + -6.10920668e-01, -5.89827836e-01, 3.73134613e-02, + 1.14854217e-01, -6.08056545e-01, -5.99740624e-01 ] + - [ -7.34672785e-01, -1.87422395e-01, -3.71185243e-01, + 6.55542135e-01, -8.06654990e-01, 5.28963804e-02, + -3.39092791e-01, -3.65057766e-01, -5.92244565e-01, + -5.18596411e-01, -2.82812476e-01, -3.91701579e-01, + -5.35782635e-01, -6.65572703e-01, -2.95312405e-01, + -2.54018068e-01, -5.54485798e-01, -6.45330369e-01, + -1.28343940e-01, 9.03952122e-02, 1.47356510e-01, + 6.32382274e-01, -5.87560534e-01, 5.60160875e-01, + 2.04624295e-01, -8.77277732e-01, -2.03716755e-02, + -4.52800512e-01, 2.20423341e-01, -7.38913715e-01, + 6.60657883e-03, -4.85501230e-01, 2.18905449e-01, + -6.55218840e-01, -4.92496490e-02, -4.63277757e-01 ] + - [ -8.00538540e-01, -6.70812488e-01, -6.49396777e-01, + 1.38951540e-02, -9.36745822e-01, -7.81655371e-01, + -6.67386591e-01, 1.27431273e-01, -9.37803686e-01, + -7.63248324e-01, -6.60937488e-01, 2.20051527e-01, + -9.09792364e-01, -8.63115788e-01, -6.59375012e-01, + 1.51008725e-01, -9.00753736e-01, -8.82127047e-01, + -3.96453321e-01, -5.01436293e-01, -3.47581506e-01, + 3.07489634e-02, -8.06572080e-01, -6.72734320e-01, + -3.82658958e-01, 1.78518534e-01, -8.09765935e-01, + -5.99232852e-01, -3.74844372e-01, 2.21298337e-01, + -7.74452806e-01, -7.48227894e-01, -3.70646775e-01, + -4.66746092e-02, -7.26883411e-01, -8.00542891e-01 ] + - [ -7.67605662e-01, -4.58289444e-01, -5.33002138e-01, + 2.77676582e-02, -8.14041138e-01, -5.29510498e-01, + -5.46436191e-01, 7.97095299e-02, -8.15822721e-01, + -5.52825451e-01, -4.20312524e-01, -4.56827879e-02, + -7.76251793e-01, -7.86266148e-01, -4.28124964e-01, + -1.12957358e-02, -7.75964856e-01, -7.86931515e-01, + -1.07303917e-01, -1.13419354e-01, 3.93700600e-02, + 7.01526403e-02, -5.54740191e-01, -1.62174165e-01, + 5.20231724e-02, 5.38418293e-02, -5.38495898e-01, + -2.23471642e-01, 1.30759597e-01, -1.55705571e-01, + -4.35301542e-01, -5.64884901e-01, 1.19403005e-01, + -2.09143996e-01, -4.30079341e-01, -5.73482096e-01 ] + - [ -6.90555096e-01, -1.23407841e-01, -3.58410180e-01, + 1.65521264e-01, -6.64629340e-01, -1.32891834e-01, + -3.83729279e-01, 2.99795032e-01, -6.99259758e-01, + -1.59192145e-01, -3.56249988e-01, -1.52465284e-01, + -4.98529434e-01, -5.20728409e-01, -3.53124917e-01, + -2.57745147e-01, -4.62392449e-01, -5.56800961e-01, + 9.91880894e-03, 1.49847627e-01, 1.60854936e-01, + -4.93537784e-02, -2.19700992e-01, 2.86705375e-01, + 1.53757215e-01, -1.09518468e-01, -2.67928839e-01, + 4.50961590e-02, 2.12951303e-01, -3.04438412e-01, + -8.20212364e-02, -3.10487151e-01, 2.06467628e-01, + -4.01024818e-01, -5.53000569e-02, -3.26810896e-01 ] + - [ -8.57290804e-01, -4.80587721e-01, -6.35202289e-01, + -1.34023368e-01, -7.69405425e-01, -5.70167005e-01, + -6.54427648e-01, 3.27706337e-04, -7.85254598e-01, + -5.44658303e-01, -5.42187452e-01, -1.95912540e-01, + -7.42278099e-01, -8.08854401e-01, -5.51562488e-01, + -1.47912621e-01, -7.43003845e-01, -8.07376266e-01, + -4.52359498e-01, -1.13490403e-01, -1.13610804e-01, + -1.78157568e-01, -3.89507234e-01, -1.92974746e-01, + -1.72254324e-01, 8.20262432e-02, -4.46427345e-01, + -2.85065174e-02, -1.61893964e-02, -4.84372795e-01, + -3.08489978e-01, -6.25632405e-01, -3.23382616e-02, + -4.83776331e-01, -3.14951956e-01, -6.14272714e-01 ] + - [ -7.69676924e-01, -3.75161409e-01, -5.06032705e-01, + 5.91660738e-02, -7.59975672e-01, -4.00282264e-01, + -5.14758825e-01, 3.87767553e-02, -7.48570681e-01, + -4.61743832e-01, -3.79687488e-01, -2.74721980e-02, + -7.23344564e-01, -7.18482852e-01, -3.79687488e-01, + -6.44957423e-02, -7.14815378e-01, -7.38206387e-01, + -9.28765535e-02, 3.08206081e-02, 1.11361146e-01, + -1.01435184e-03, -3.64469886e-01, 9.61756706e-02, + 1.56069279e-01, -1.12783492e-01, -3.30239594e-01, + -5.99213839e-02, 1.88044786e-01, -4.49514389e-03, + -2.95955896e-01, -3.38743269e-01, 2.28855610e-01, + -4.34533715e-01, -2.02015400e-01, -4.75047290e-01 ] + - [ -8.51077080e-01, -4.60448921e-01, -5.94038308e-01, + -2.22269773e-01, -7.20345318e-01, -5.64285994e-01, + -6.28509760e-01, -1.03588879e-01, -7.20944345e-01, + -5.19374609e-01, -4.84374940e-01, -3.51867914e-01, + -6.83949947e-01, -8.04203749e-01, -4.87499952e-01, + -3.16972375e-01, -6.83953822e-01, -8.07947993e-01, + -3.61587107e-01, -1.31081581e-01, -1.11361146e-01, + 6.41454458e-02, -4.85100389e-01, -3.89252901e-02, + -7.51445293e-02, 1.79182291e-02, -4.17468011e-01, + -5.72247505e-02, 1.18306279e-01, -5.39388776e-01, + -3.30744565e-01, -6.57733679e-01, 1.31840825e-01, + -6.79457486e-01, -3.15515161e-01, -6.87738061e-01 ] + - [ -8.93123448e-01, -3.38382781e-01, -6.66430116e-01, + -1.16978765e-01, -6.36944354e-01, -3.28230619e-01, + -6.81785464e-01, -1.36820734e-01, -6.36761069e-01, + -4.11501467e-01, -5.89062452e-01, -3.71328056e-01, + -5.84985256e-01, -7.32831478e-01, -5.93750000e-01, + -3.24834585e-01, -5.84660470e-01, -7.32503474e-01, + -6.06251955e-01, 2.80668736e-02, -2.28346467e-01, + -1.01997018e-01, -1.68383837e-01, 2.69264579e-01, + -2.36994207e-01, -1.53340042e-01, -1.91388667e-01, + 7.31080770e-02, -1.25778317e-01, -6.25540912e-01, + -5.94062209e-02, -5.15755177e-01, -1.29353285e-01, + -6.29367590e-01, -7.37007856e-02, -5.06863594e-01 ] + - [ -9.02651191e-01, -4.55554247e-01, -7.09013462e-01, + -1.38161540e-01, -7.46445060e-01, -5.29589891e-01, + -7.32181430e-01, -1.19850993e-01, -7.31075525e-01, + -5.44507146e-01, -6.48437440e-01, -3.00967932e-01, + -6.93407476e-01, -8.10317159e-01, -6.57812476e-01, + -2.29956388e-01, -6.97771549e-01, -8.04356575e-01, + -6.22482777e-01, -2.10514188e-01, -2.75590479e-01, + -1.42080724e-01, -4.62386727e-01, -2.79337287e-01, + -2.90173352e-01, 1.92201138e-02, -5.09876490e-01, + -2.24247694e-01, -1.83063507e-01, -4.59738731e-01, + -3.84932280e-01, -6.89827561e-01, -2.01492548e-01, + -4.05038357e-01, -4.12147641e-01, -6.71144664e-01 ] + - [ -7.07332253e-01, -3.08277428e-01, -4.13768649e-01, + 1.30748987e-01, -7.58331835e-01, -3.46061707e-01, + -4.34125304e-01, 1.45170569e-01, -7.48953462e-01, + -3.85757864e-01, -2.82812476e-01, 3.53579521e-02, + -7.09938407e-01, -6.75406933e-01, -2.79687464e-01, + -1.51798129e-02, -7.01435030e-01, -7.00670004e-01, + 1.10309601e-01, 7.89346695e-02, 2.48593926e-01, 2.25805044e-02, + -3.82438004e-01, 9.78686810e-02, 2.62427688e-01, + -7.36979246e-02, -3.39064598e-01, -2.25634575e-02, + 2.67745852e-01, 5.76262474e-02, -2.58969307e-01, + -2.58413792e-01, 3.15920472e-01, -3.40770781e-01, + -1.78631902e-01, -3.98664594e-01 ] + - [ -8.06959391e-01, -4.91880655e-01, -5.68488240e-01, + -1.02086842e-01, -8.09014976e-01, -6.17513120e-01, + -5.69474459e-01, 8.48515034e-02, -8.43685150e-01, + -6.00969911e-01, -4.93749976e-01, -1.60883665e-01, + -7.75556505e-01, -8.27272058e-01, -5.07812500e-01, + 2.87145376e-02, -8.01500440e-01, -8.03335249e-01, + -2.68410027e-01, -2.72359014e-01, -1.63104653e-01, + 3.81000042e-02, -6.08605385e-01, -3.02318454e-01, + -7.74567723e-02, 3.96589041e-02, -6.19458795e-01, + -3.83354723e-01, -8.71735811e-03, -3.05005968e-01, + -5.24168015e-01, -7.19978392e-01, -2.48757005e-02, + -2.08678544e-01, -5.50374031e-01, -6.89971507e-01 ] + - [ -7.02361226e-01, -2.12735653e-01, -3.58410180e-01, + 5.32951355e-02, -6.57661319e-01, -2.29263723e-01, + -3.66450608e-01, 1.48467541e-01, -6.64819777e-01, + -2.30634511e-01, -1.75000012e-01, -4.43233371e-01, + -5.58546543e-01, -7.00883746e-01, -1.89062476e-01, + -3.10068369e-01, -5.69125414e-01, -6.77830815e-01, + 5.44033051e-02, 5.30446768e-02, 2.26096749e-01, + -1.17169619e-02, -3.37456584e-01, 1.32556915e-01, + 1.81502938e-01, 1.40233755e-01, -3.27880025e-01, + 2.69734263e-01, 5.09339929e-01, -9.94020462e-01, + -5.95568419e-02, -6.31699204e-01, 4.67661738e-01, + -7.13938534e-01, -1.44412398e-01, -5.49718022e-01 ] + - [ -7.43579149e-01, -3.06813180e-01, -4.73385394e-01, + 2.05215335e-01, -7.41132975e-01, -2.29185581e-01, + -4.58603263e-01, -7.92374611e-02, -6.75223947e-01, + -4.32189882e-01, -3.24999928e-01, -1.64583504e-01, + -6.51132464e-01, -6.91567898e-01, -3.29687476e-01, + -1.48351610e-01, -6.47318721e-01, -6.97726846e-01, + -4.29817438e-02, 1.64112091e-01, 1.51856065e-01, + 1.35128021e-01, -2.95814097e-01, 4.25932050e-01, + 1.86127067e-01, -2.70555317e-01, -1.26384258e-01, + 6.67165518e-02, 3.07596564e-01, -4.46379244e-01, + -6.35891557e-02, -3.72672439e-01, 3.00994992e-01, + -4.78548884e-01, -6.75066113e-02, -3.75960588e-01 ] + - [ -8.39270949e-01, -4.19211626e-01, -6.12491131e-01, + -1.83613598e-01, -6.85906410e-01, -4.76937950e-01, + -6.19870365e-01, 1.57176256e-02, -7.54282534e-01, + -4.80251312e-01, -5.04687428e-01, -3.07901740e-01, + -6.76070809e-01, -7.83007503e-01, -5.03124952e-01, + -3.48437250e-01, -6.60591125e-01, -7.99924433e-01, + -2.96663702e-01, -1.08455837e-01, -3.48705649e-02, + -4.74033356e-02, -4.07391489e-01, -4.76434827e-02, + -5.20231128e-02, -1.21436656e-01, -3.65060329e-01, + -1.40133500e-01, 1.05852962e-01, -6.46267772e-01, + -2.37824798e-01, -6.36502624e-01, 1.09452724e-01, + -8.57564688e-01, -2.00431108e-01, -6.82337761e-01 ] + - [ -8.18765521e-01, -5.36113977e-01, -6.16749525e-01, + 4.40235138e-02, -8.64760101e-01, -6.08098745e-01, + -6.24190032e-01, 2.26124525e-02, -8.42327714e-01, + -6.35997295e-01, -5.43749988e-01, 2.01734304e-02, + -8.23167801e-01, -8.19773793e-01, -5.53124964e-01, + 3.10118198e-02, -8.19415092e-01, -8.23966205e-01, + -3.27321947e-01, -2.09533155e-01, -1.33858263e-01, + -6.52725697e-02, -5.52781999e-01, -3.24446559e-01, + -1.19075119e-01, -1.60430491e-01, -4.73325372e-01, + -3.57567906e-01, -1.23287737e-01, -1.22241914e-01, + -4.73934710e-01, -5.96836448e-01, -1.19403005e-01, + -2.89518714e-01, -4.43957329e-01, -6.37513638e-01 ] + - [ -7.02361226e-01, -2.12735653e-01, -3.58410180e-01, + 5.32951355e-02, -6.57661319e-01, -2.29263723e-01, + -3.66450608e-01, 1.48467541e-01, -6.64819777e-01, + -2.30634511e-01, -1.75000012e-01, -4.43233371e-01, + -5.58546543e-01, -7.00883746e-01, -1.89062476e-01, + -3.10068369e-01, -5.69125414e-01, -6.77830815e-01, + 5.44033051e-02, 5.30446768e-02, 2.26096749e-01, + -1.17169619e-02, -3.37456584e-01, 1.32556915e-01, + 1.81502938e-01, 1.40233755e-01, -3.27880025e-01, + 2.69734263e-01, 5.09339929e-01, -9.94020462e-01, + -5.95568419e-02, -6.31699204e-01, 4.67661738e-01, + -7.13938534e-01, -1.44412398e-01, -5.49718022e-01 ] + - [ -8.64125967e-01, -4.65781391e-01, -6.53655052e-01, + -1.74708307e-01, -7.34083891e-01, -5.45058608e-01, + -6.63066983e-01, -1.35711610e-01, -7.18042135e-01, + -5.39209247e-01, -5.59374988e-01, -2.81464159e-01, + -6.91576600e-01, -7.92403519e-01, -5.60937464e-01, + -2.89140105e-01, -6.81334794e-01, -8.01993668e-01, + -4.28313851e-01, -1.26758218e-01, -9.33633447e-02, + -2.14238584e-01, -3.75099778e-01, -2.13448644e-01, + -1.23699486e-01, -7.05785155e-02, -3.65469992e-01, + -8.37599039e-02, 3.86052132e-02, -5.48311591e-01, + -2.90824652e-01, -6.37287199e-01, 1.24377012e-02, + -4.90124702e-01, -3.18313003e-01, -6.16276324e-01 ] + - [ -7.67191350e-01, -3.18167865e-01, -4.43576992e-01, + 3.33259821e-01, -7.69953251e-01, -1.71702981e-01, + -3.89488816e-01, -4.68857050e-01, -6.32659435e-01, + -6.40885234e-01, -2.96875000e-01, -5.22220433e-01, + -6.02768302e-01, -7.77229369e-01, -3.04687500e-01, + -4.03162062e-01, -6.17090225e-01, -7.65718520e-01, + -3.81725430e-02, -7.61610866e-02, 1.51856065e-01, + 5.48888922e-01, -6.10838592e-01, 3.66177678e-01, + 2.57803440e-01, -5.56694150e-01, -3.23680818e-01, + -4.95335817e-01, 4.29638743e-01, -8.81833613e-01, + -2.34891355e-01, -7.09339857e-01, 4.12935138e-01, + -7.59258032e-01, -2.80739069e-01, -6.75593674e-01 ] + - [ -8.14623058e-01, -3.60664487e-01, -5.30163169e-01, + 1.68921709e-01, -7.39796042e-01, -2.50021935e-01, + -4.73002076e-01, -4.64233160e-01, -6.34565294e-01, + -6.46778047e-01, -3.82812440e-01, -5.21516085e-01, + -6.09371185e-01, -7.89435148e-01, -3.90625000e-01, + -4.31221724e-01, -6.17698073e-01, -7.82793760e-01, + -1.62608981e-01, -9.70017314e-02, 5.51180840e-02, + 4.54355597e-01, -5.63805819e-01, 3.52381110e-01, + 2.09248424e-01, -5.74411035e-01, -3.03285182e-01, + -4.92121220e-01, 4.02241588e-01, -9.49997842e-01, + -2.29886174e-01, -7.33957112e-01, 3.68159056e-01, + -9.02947068e-01, -2.49038339e-01, -7.12153196e-01 ] + - [ -8.41342151e-01, -6.98350191e-01, -6.97657943e-01, + -5.63349724e-02, -9.28732336e-01, -8.00696433e-01, + -7.09143281e-01, -2.66309977e-02, -9.23146367e-01, + -8.12717259e-01, -6.89062476e-01, 1.42327189e-01, + -9.08138454e-01, -8.84793997e-01, -6.93749964e-01, + 1.03460550e-01, -9.00446892e-01, -8.96360636e-01, + -3.64592791e-01, -5.31470895e-01, -2.59842515e-01, + 2.12664008e-01, -8.65064263e-01, -6.30894780e-01, + -2.39306450e-01, 1.79091334e-01, -8.41254473e-01, + -6.64235950e-01, -2.75217950e-01, 2.72775531e-01, + -8.10824394e-01, -7.68850386e-01, -2.71144271e-01, + 9.49268341e-02, -7.85380244e-01, -8.01992714e-01 ] + - [ -6.59693480e-01, -5.81634521e-01, -4.00993645e-01, + -1.17891431e-02, -9.16596413e-01, -7.71487951e-01, + -4.06767368e-01, 8.10344219e-02, -9.20760870e-01, + -7.71788716e-01, -3.78125012e-01, 1.58149600e-01, + -8.85532677e-01, -8.50926459e-01, -3.82812500e-01, + 1.22901678e-01, -8.79558980e-01, -8.62584233e-01, + 5.44033051e-02, -4.53680158e-01, -3.26209068e-02, + 1.97403073e-01, -8.38881910e-01, -5.94890237e-01, + -1.15603209e-03, 1.62312031e-01, -8.20146918e-01, + -6.38726890e-01, 5.10584116e-02, 2.86695600e-01, + -7.89646745e-01, -7.38978386e-01, 4.47760820e-02, + 1.20357394e-01, -7.66628146e-01, -7.69098163e-01 ] + - [ -5.89892328e-01, -2.25821018e-01, -2.78921247e-01, + 4.35439706e-01, -8.22597265e-01, -2.40072191e-01, + -2.49819934e-01, -7.84728527e-02, -7.17143059e-01, + -5.05705476e-01, -2.32812464e-01, -2.05066025e-01, + -6.20201111e-01, -6.71201348e-01, -2.51562417e-01, + 9.76355076e-02, -6.67885900e-01, -6.11744344e-01, + 2.06492305e-01, -5.85207343e-02, 1.72103524e-01, + 4.20170903e-01, -6.47152185e-01, 8.71489048e-02, + 2.57803440e-01, -3.48100781e-01, -4.36012626e-01, + -4.54455316e-01, 3.12577844e-01, -2.62328327e-01, + -3.67970943e-01, -5.47338545e-01, 2.88557172e-01, + -1.20545030e-01, -4.08247650e-01, -5.02659082e-01 ] + - [ -7.46064603e-01, -3.19167852e-01, -4.44996417e-01, + 6.53205633e-01, -8.75317872e-01, -1.28857076e-01, + -4.19726372e-01, -4.30905223e-01, -6.56724095e-01, + -6.49597883e-01, -3.81249964e-01, -2.86327004e-01, + -6.43690944e-01, -7.35008478e-01, -3.84374976e-01, + -3.10460925e-01, -6.31832123e-01, -7.50160396e-01, + -1.13916516e-01, -7.45942593e-02, 7.53655434e-02, + 6.78659201e-01, -7.19687819e-01, 2.78945327e-01, + 1.12138629e-01, -7.79978037e-01, -2.37217844e-01, + -6.04092836e-01, 1.45703554e-01, -5.16053438e-01, + -2.67103553e-01, -5.94470978e-01, 1.39303446e-01, + -6.48638844e-01, -2.47899771e-01, -6.23389006e-01 ] + - [ -9.24606442e-01, -4.98422980e-01, -7.51596868e-01, + -1.23525500e-01, -7.76967883e-01, -5.64032078e-01, + -7.53779650e-01, -1.58744395e-01, -7.73549557e-01, + -6.42394066e-01, -6.89062476e-01, -2.32266307e-01, + -7.40710557e-01, -8.32508683e-01, -6.93749964e-01, + -2.01487422e-01, -7.37960696e-01, -8.34109843e-01, + -7.06041455e-01, -3.45022321e-01, -4.03824508e-01, + 9.36393738e-02, -6.50593638e-01, -3.12478960e-01, + -3.84971201e-01, -1.72677338e-01, -5.37889719e-01, + -4.94930446e-01, -3.37484360e-01, -3.85867774e-01, + -5.05104184e-01, -7.64580607e-01, -3.28358173e-01, + -5.00846565e-01, -4.84932840e-01, -7.80165255e-01 ] + - [ -8.32850039e-01, -4.17923033e-01, -6.02554977e-01, + -4.56559658e-02, -7.10561335e-01, -3.91743064e-01, + -5.82433403e-01, -2.72934616e-01, -6.61531925e-01, + -5.59454978e-01, -4.71875012e-01, -3.36484551e-01, + -6.49584889e-01, -7.66229391e-01, -4.76562500e-01, + -3.16441596e-01, -6.44114494e-01, -7.70959377e-01, + -2.99669445e-01, 6.85787201e-03, -3.03711891e-02, + 4.23901081e-02, -3.16896498e-01, 2.43918777e-01, + -5.78039885e-03, -3.41792047e-01, -1.46441460e-01, + -7.44156837e-02, 1.73100829e-01, -6.25474274e-01, + -1.44094408e-01, -5.48436880e-01, 1.69154167e-01, + -6.93536043e-01, -1.35790884e-01, -5.55695713e-01 ] + - [ -6.41052246e-01, -2.91754007e-01, -3.38537931e-01, + 1.43289447e-01, -8.00186932e-01, -4.31140006e-01, + -3.59251201e-01, 3.65831852e-01, -8.28056693e-01, + -3.87470365e-01, -3.14062476e-01, -5.80519438e-03, + -6.91049337e-01, -6.70561254e-01, -3.24999988e-01, + -6.77597523e-03, -6.83099627e-01, -6.77370310e-01, + 1.24736905e-01, -9.66395736e-02, 1.15860462e-01, + 1.49059296e-02, -5.62114716e-01, -2.40993202e-01, + 1.58381343e-01, 5.39051294e-02, -5.73820472e-01, + -2.84238994e-01, 1.75591469e-01, -3.98290157e-02, + -4.30980861e-01, -4.98987019e-01, 1.69154167e-01, + -8.03288817e-02, -4.33302283e-01, -5.10895848e-01 ] + - [ -7.31151581e-01, -1.87159061e-01, -3.69765818e-01, + 6.56993985e-01, -8.06340098e-01, 5.48661947e-02, + -3.34773242e-01, -3.63527417e-01, -5.93012810e-01, + -5.18376827e-01, -2.78124988e-01, -3.90027165e-01, + -5.36272168e-01, -6.65019929e-01, -2.92187452e-01, + -2.53258705e-01, -5.54172575e-01, -6.44487262e-01, + -1.16922200e-01, 9.38963890e-02, 1.49606228e-01, + 6.35372400e-01, -5.85860610e-01, 5.69156170e-01, + 2.06936359e-01, -8.65513206e-01, -2.46337652e-02, + -4.46134150e-01, 2.22913980e-01, -7.23169148e-01, + 2.61926651e-03, -4.79893386e-01, 2.23880649e-01, + -6.49054289e-01, -4.95164990e-02, -4.59796429e-01 ] + - [ -8.98508728e-01, -7.02568412e-01, -7.57274628e-01, + -1.69097483e-01, -8.96033525e-01, -8.03746343e-01, + -7.73938060e-01, -1.41401589e-01, -8.80123913e-01, + -7.98256874e-01, -7.23437428e-01, -6.89495802e-02, + -8.70085835e-01, -9.04647410e-01, -7.26562500e-01, + -5.60808182e-02, -8.68475080e-01, -9.09839272e-01, + -5.70183396e-01, -4.72985089e-01, -3.45331788e-01, + -3.69051099e-02, -7.35987365e-01, -6.12564087e-01, + -3.78034770e-01, 2.62906551e-02, -7.10406661e-01, + -5.61773658e-01, -3.37484360e-01, -3.82503271e-02, + -7.07793236e-01, -7.88411856e-01, -3.23383152e-01, + -2.37613916e-01, -6.75673723e-01, -8.24012756e-01 ] + - [ -9.02651191e-01, -4.55554247e-01, -7.09013462e-01, + -1.38161540e-01, -7.46445060e-01, -5.29589891e-01, + -7.32181430e-01, -1.19850993e-01, -7.31075525e-01, + -5.44507146e-01, -6.48437440e-01, -3.00967932e-01, + -6.93407476e-01, -8.10317159e-01, -6.57812476e-01, + -2.29956388e-01, -6.97771549e-01, -8.04356575e-01, + -6.22482777e-01, -2.10514188e-01, -2.75590479e-01, + -1.42080724e-01, -4.62386727e-01, -2.79337287e-01, + -2.90173352e-01, 1.92201138e-02, -5.09876490e-01, + -2.24247694e-01, -1.83063507e-01, -4.59738731e-01, + -3.84932280e-01, -6.89827561e-01, -2.01492548e-01, + -4.05038357e-01, -4.12147641e-01, -6.71144664e-01 ] + - [ -8.80903065e-01, -5.72669983e-01, -7.13271856e-01, + 4.45367098e-02, -8.68416309e-01, -5.97117424e-01, + -6.93304539e-01, -3.12510610e-01, -7.80257225e-01, + -7.54462779e-01, -6.65624976e-01, -3.85207534e-02, + -8.11236978e-01, -8.31165314e-01, -6.59375012e-01, + -2.73900628e-01, -7.60297596e-01, -8.74602079e-01, + -5.24496555e-01, -3.68401945e-01, -2.98087776e-01, + 1.33431911e-01, -7.11877465e-01, -3.86554062e-01, + -2.71676362e-01, -5.13099372e-01, -4.48889911e-01, + -6.75426841e-01, -2.90161848e-01, -3.43890786e-02, + -6.13131404e-01, -6.95099056e-01, -2.51243711e-01, + -5.19329309e-01, -5.13745964e-01, -7.99502015e-01 ] + - [ -6.48301601e-01, -8.53065252e-02, -2.56210089e-01, + 8.64483953e-01, -8.28634262e-01, 1.75201774e-01, + -2.09503174e-01, -4.52971458e-01, -5.21860361e-01, + -4.80180919e-01, -2.14062452e-01, -4.19856548e-01, + -4.38603044e-01, -5.78058243e-01, -2.20312476e-01, + -2.85804570e-01, -4.60621238e-01, -5.59604645e-01, + 4.50849533e-03, 1.18795037e-01, 2.05849290e-01, 6.67672753e-01, + -5.84712982e-01, 6.14165902e-01, 2.69364119e-01, + -8.50387752e-01, -3.49370837e-02, -4.32676315e-01, + 3.10087204e-01, -6.62839770e-01, -4.70411777e-03, + -4.44931865e-01, 3.10945153e-01, -5.74120343e-01, + -5.99921346e-02, -4.21424627e-01 ] + - [ -7.94946134e-01, -4.98777807e-01, -5.79843879e-01, + 8.96818638e-02, -8.62253785e-01, -5.72923660e-01, + -5.83873272e-01, 6.07411861e-02, -8.39728236e-01, + -6.08558536e-01, -5.20312428e-01, 3.17751169e-02, + -8.07287037e-01, -7.96764970e-01, -5.23437500e-01, + 3.71235609e-02, -8.03865433e-01, -8.03399444e-01, + -2.56988347e-01, -1.84628367e-01, -9.11136270e-02, + -7.30475187e-02, -5.51075459e-01, -3.28455508e-01, + -7.28324056e-02, -1.47654712e-01, -4.85688508e-01, + -3.59070718e-01, -9.33997035e-02, -7.39801526e-02, + -4.59482849e-01, -5.56019902e-01, -9.20398831e-02, + -2.39115655e-01, -4.26801682e-01, -5.96195877e-01 ] + - [ -8.80695939e-01, -5.16776264e-01, -6.76366210e-01, + -1.62263989e-01, -7.83983529e-01, -6.15227580e-01, + -6.88984871e-01, -5.69051504e-02, -8.10257792e-01, + -6.29312038e-01, -6.01562500e-01, -2.05786288e-01, + -7.64760196e-01, -8.37991714e-01, -6.10937476e-01, + -8.43255520e-02, -7.80370355e-01, -8.25434208e-01, + -5.07664561e-01, -2.81948328e-01, -2.48593926e-01, + 5.48362732e-03, -5.74416578e-01, -2.81728804e-01, + -1.83815122e-01, -5.71857691e-02, -5.61365724e-01, + -3.90867949e-01, -8.59278440e-02, -3.99353862e-01, + -5.01040816e-01, -7.45106041e-01, -1.11940265e-01, + -2.96878695e-01, -5.22156119e-01, -7.07433462e-01 ] + - [ -6.37531042e-01, -2.62456596e-01, -3.04471254e-01, + 4.14152622e-01, -8.14726770e-01, -2.34517992e-01, + -3.11735034e-01, 1.09551787e-01, -7.60073304e-01, + -4.45388556e-01, -1.93749905e-01, 5.46348095e-02, + -7.06798196e-01, -6.62592411e-01, -1.95312500e-01, + 4.13689613e-02, -7.02182472e-01, -6.76814973e-01, + 1.38563156e-01, 5.22384644e-02, 2.44094610e-01, 3.78309250e-01, + -5.63310385e-01, 2.19624162e-01, 2.78612733e-01, + -2.61785090e-01, -3.54123056e-01, -2.54451394e-01, + 3.27521682e-01, -4.56286073e-02, -3.13601375e-01, + -3.77472401e-01, 3.40796113e-01, -3.02132428e-01, + -2.58328915e-01, -4.50452447e-01 ] + - [ -9.04101074e-01, -5.28799832e-01, -7.20369101e-01, + -9.72108841e-02, -8.07131946e-01, -5.97254753e-01, + -7.19222426e-01, -1.52048528e-01, -7.95987964e-01, + -6.73019528e-01, -6.54687464e-01, -2.25639880e-01, + -7.59300768e-01, -8.43888104e-01, -6.59375012e-01, + -1.87920213e-01, -7.59939790e-01, -8.45864296e-01, + -6.10459924e-01, -3.70005488e-01, -3.47581506e-01, + 1.31647706e-01, -6.95553541e-01, -3.54311764e-01, + -3.22543323e-01, -1.48732007e-01, -5.86120844e-01, + -5.32826900e-01, -2.67745912e-01, -3.47667277e-01, + -5.52026391e-01, -7.77727008e-01, -2.71144271e-01, + -4.83085811e-01, -5.22148252e-01, -7.93887675e-01 ] + - [ -5.50124288e-01, -8.89745951e-02, -1.92335010e-01, + 9.13248062e-02, -6.76077783e-01, -2.44145393e-01, + -2.08063364e-01, 2.90108204e-01, -6.95985615e-01, + -1.85497046e-01, -1.64062440e-01, -4.80245948e-02, + -5.41002870e-01, -5.09850621e-01, -1.71874940e-01, + 1.51203871e-02, -5.44134378e-01, -5.00865221e-01, + 1.90862656e-01, 1.24874234e-01, 2.59842515e-01, + -9.96962786e-02, -3.60826612e-01, -2.33005285e-02, + 2.48554826e-01, 5.35002947e-02, -3.76217306e-01, + 6.79699183e-02, 3.27521682e-01, -5.86705208e-02, + -2.29936719e-01, -2.98849225e-01, 3.33333373e-01, + -5.28011322e-02, -2.48141825e-01, -3.01718712e-01 ] + - [ -5.34175694e-01, -1.51058912e-01, -1.80979431e-01, + 2.50810266e-01, -7.43682325e-01, -2.38687575e-01, + -2.03743696e-01, 5.32287002e-01, -7.82614172e-01, + -1.67351127e-01, -1.25000000e-01, -4.48187590e-02, + -6.12201452e-01, -5.90940595e-01, -1.25000000e-01, + 1.17679834e-02, -6.19696736e-01, -5.91019452e-01, + 4.12684083e-01, 1.71483040e-01, 4.03824568e-01, + -5.80645800e-02, -2.88449287e-01, 1.60991788e-01, + 4.05780315e-01, 1.90075040e-01, -3.79416108e-01, + 2.36280799e-01, 5.24283886e-01, -3.39950025e-01, + -1.12412989e-01, -3.42975795e-01, 5.37313461e-01, + -3.77742410e-01, -1.18295252e-01, -3.52536678e-01 ] + - [ -6.59693480e-01, -1.96949959e-01, -3.28601897e-01, + 1.81595802e-01, -7.01250792e-01, -1.95124984e-01, + -3.26133847e-01, 9.61554050e-03, -6.70530379e-01, + -3.60086799e-01, -2.26562500e-01, -4.10913944e-01, + -5.49020648e-01, -6.82377219e-01, -2.40624964e-01, + -2.49745011e-01, -5.69609106e-01, -6.55732036e-01, + 4.71895933e-02, -3.94887328e-02, 1.13610864e-01, + 1.40589833e-01, -4.66137588e-01, 1.00304008e-01, + 1.88439250e-01, -2.20116138e-01, -3.74894381e-01, + -2.48070896e-01, 2.87671208e-01, -5.13694286e-01, + -2.42820919e-01, -5.63561022e-01, 2.41293430e-01, + -4.33766007e-01, -2.62924850e-01, -5.26854634e-01 ] + - [ -6.57207966e-01, -2.51699865e-01, -3.47054720e-01, + 1.42443538e-01, -7.70545125e-01, -3.69537473e-01, + -3.60691130e-01, 3.42338681e-01, -7.83758581e-01, + -3.05776656e-01, -3.09374928e-01, -3.96552086e-02, + -6.57609999e-01, -6.45849466e-01, -3.14062476e-01, + -1.37602091e-02, -6.58196330e-01, -6.51529193e-01, + 1.35256052e-02, 1.62160397e-02, 1.60854936e-01, + -1.01001620e-01, -4.43249404e-01, -1.68343663e-01, + 7.05201626e-02, 1.83051944e-01, -4.72703457e-01, + 5.29483557e-02, 2.07970142e-01, -1.87218189e-01, + -3.06967199e-01, -4.55394864e-01, 1.84079528e-01, + -1.63217485e-01, -3.18279326e-01, -4.40267801e-01 ] + - [ -7.89975166e-01, -2.49234796e-01, -4.53513145e-01, + 4.69233274e-01, -7.84489691e-01, -6.08197451e-02, + -4.25485909e-01, -3.02684486e-01, -6.37921572e-01, + -5.41391850e-01, -3.42187464e-01, -3.34265590e-01, + -5.96642971e-01, -7.05241919e-01, -3.57812464e-01, + -1.97314143e-01, -6.13220930e-01, -6.84292853e-01, + -2.56387174e-01, 4.41833735e-02, 7.76153803e-02, + 5.20672679e-01, -5.47518492e-01, 4.94345546e-01, + 1.65317893e-01, -8.38675499e-01, -4.27730083e-02, + -4.47873712e-01, 1.93026185e-01, -8.36749017e-01, + -6.48331642e-03, -5.49094677e-01, 2.03980088e-01, + -7.98814535e-01, -5.28696775e-02, -5.40697336e-01 ] + - [ -9.91300762e-01, -6.33030415e-01, -9.19091523e-01, + -4.91011620e-01, -6.73977733e-01, -7.77428091e-01, + -9.53923702e-01, -4.08176303e-01, -6.65910959e-01, + -7.38325238e-01, -9.25000012e-01, -4.94947553e-01, + -6.47163093e-01, -9.08944070e-01, -9.32812452e-01, + -4.40666437e-01, -6.48110628e-01, -9.08481359e-01, + -9.60925758e-01, -4.79016125e-01, -7.41282344e-01, + -1.78608179e-01, -5.24282575e-01, -5.12382269e-01, + -7.71098316e-01, -6.75804615e-02, -5.63479066e-01, + -4.83150840e-01, -7.08592772e-01, -4.77617025e-01, + -5.11101902e-01, -8.64958525e-01, -7.23880589e-01, + -4.98562872e-01, -5.07665932e-01, -8.57700586e-01 ] + - [ -9.98964369e-01, -7.25596368e-01, -9.53158259e-01, + -5.89996219e-01, -6.62434340e-01, -8.65734994e-01, + -9.78401721e-01, -5.32806396e-01, -6.70866668e-01, + -8.56963396e-01, -9.71875012e-01, -5.74841976e-01, + -6.39564812e-01, -9.49942172e-01, -9.76562500e-01, + -5.07862329e-01, -6.53109550e-01, -9.50777590e-01, + -9.96393144e-01, -6.33899093e-01, -8.17772746e-01, + -1.76430821e-01, -6.50708079e-01, -7.06748605e-01, + -8.38150263e-01, -1.84719205e-01, -5.92698097e-01, + -6.93982482e-01, -8.08219194e-01, -4.26999569e-01, + -5.99173069e-01, -9.16422009e-01, -8.10945272e-01, + -4.45301175e-01, -6.29743040e-01, -9.24050868e-01 ] + - [ -8.75517845e-01, -4.46870446e-01, -6.47977293e-01, + -2.49845207e-01, -6.61327720e-01, -4.97788310e-01, + -6.54427648e-01, -2.63989449e-01, -6.49227202e-01, + -5.38610876e-01, -5.32812476e-01, -4.84187841e-01, + -6.20782912e-01, -8.01007748e-01, -5.37500024e-01, + -4.34479594e-01, -6.21282458e-01, -8.01411033e-01, + -4.44544733e-01, -1.14347279e-01, -1.45106852e-01, + -1.91932321e-01, -2.62746513e-01, -1.35192275e-02, + -1.79190755e-01, 1.56195760e-01, -4.75164354e-01, + 1.72756910e-02, 7.59650469e-02, -6.47523999e-01, + -2.81182110e-01, -6.71835482e-01, 7.96018839e-02, + -6.88443184e-01, -2.91943789e-01, -6.78548336e-01 ] + - [ -6.90762222e-01, -3.27445328e-01, -3.92476916e-01, + 6.33004904e-02, -7.54896283e-01, -4.00655568e-01, + -4.09647226e-01, 1.96559906e-01, -7.64099896e-01, + -3.76987338e-01, -2.48437464e-01, -1.06223285e-01, + -6.99615598e-01, -7.18613148e-01, -2.53125012e-01, + -9.26998258e-02, -6.96857452e-01, -7.25481272e-01, + 1.98677540e-01, 7.15543032e-02, 2.32845902e-01, 6.35384321e-02, + -3.71051252e-01, 1.75018311e-01, 2.78612733e-01, + 1.72326088e-01, -4.05553818e-01, 1.64787531e-01, + 4.24657583e-01, -4.30697739e-01, -2.00598359e-01, + -4.77632523e-01, 4.30348396e-01, -5.70001423e-01, + -1.79810345e-01, -5.12057543e-01 ] + - [ -8.59569192e-01, -5.60316205e-01, -6.47977293e-01, + -2.18550503e-01, -7.78560519e-01, -6.51171207e-01, + -6.65946722e-01, -1.76071465e-01, -7.79288292e-01, + -6.64371908e-01, -5.54687440e-01, -2.87334263e-01, + -7.50074863e-01, -8.47507238e-01, -5.60937464e-01, + -2.41892040e-01, -7.51337588e-01, -8.48180056e-01, + -3.90441895e-01, -2.25324750e-01, -1.54105783e-01, + -1.40949488e-02, -5.26785135e-01, -2.18536615e-01, + -1.49132967e-01, -5.66726923e-03, -5.18582463e-01, + -2.61931062e-01, 5.35492897e-02, -3.97451460e-01, + -4.63142812e-01, -7.05047786e-01, 5.72139025e-02, + -4.48326647e-01, -4.66249228e-01, -7.13471055e-01 ] + - [ -7.33637094e-01, -4.85278487e-01, -5.10290980e-01, + 8.91047716e-02, -8.66686702e-01, -5.93269289e-01, + -5.21958232e-01, 7.23544359e-02, -8.53801608e-01, + -6.33931816e-01, -4.90624905e-01, 1.30715251e-01, + -8.19021940e-01, -7.74661541e-01, -4.92187500e-01, + 8.50270987e-02, -8.05976152e-01, -7.87663817e-01, + -9.16742682e-02, -2.62821913e-01, -4.83689904e-02, + 1.56062841e-01, -7.07317710e-01, -3.58909249e-01, + -3.58382463e-02, 1.67746544e-02, -6.49241924e-01, + -4.56108987e-01, -1.36985779e-02, 1.32269025e-01, + -6.12742066e-01, -6.05907738e-01, -2.73631811e-02, + 7.97117949e-02, -6.04185700e-01, -6.13187432e-01 ] + - [ -9.76594865e-01, -5.27888477e-01, -8.62313688e-01, + -6.44068718e-01, -4.73069906e-01, -6.82657599e-01, + -9.04967546e-01, -3.47245336e-01, -6.08694077e-01, + -5.93486547e-01, -8.57812464e-01, -6.98004425e-01, + -5.02630949e-01, -8.71576607e-01, -8.62500012e-01, + -6.73900187e-01, -4.93608117e-01, -8.77989292e-01, + -9.01412666e-01, -3.81849408e-01, -5.95050573e-01, + -4.03647840e-01, -2.58011639e-01, -4.12941337e-01, + -6.43930674e-01, -1.97649002e-01, -3.53574812e-01, + -3.21367562e-01, -5.59153199e-01, -9.21761990e-01, + -1.97610617e-01, -8.37605298e-01, -5.59701443e-01, -1., + -2.00732708e-01, -8.47293019e-01 ] + - [ -7.11060524e-01, -3.28776240e-01, -4.53513145e-01, + 2.35479474e-01, -8.02811384e-01, -3.39775980e-01, + -4.87401009e-01, -6.92057610e-02, -7.15844989e-01, + -4.90163267e-01, -4.03124928e-01, -2.71739185e-01, + -6.47514582e-01, -7.34539032e-01, -4.18750048e-01, + -2.19761074e-01, -6.41825438e-01, -7.26296425e-01, + -9.31781530e-03, -1.38157248e-01, 1.46232843e-02, + 1.64788961e-01, -5.63230634e-01, -5.81184626e-02, + 3.35259438e-02, -7.26158023e-02, -4.95175481e-01, + -2.88184345e-01, 1.80572867e-01, -3.87726009e-01, + -3.80084336e-01, -6.24639094e-01, 1.66666627e-01, + -3.60420048e-01, -3.91886652e-01, -6.07764006e-01 ] + - [ -8.23736548e-01, -1.94827139e-01, -5.20227134e-01, + 1.86424732e-01, -6.83058262e-01, -1.15873575e-01, + -5.33477247e-01, 1.56814098e-01, -6.84214830e-01, + -2.36963391e-01, -4.26562428e-01, -1.40269339e-01, + -5.91402411e-01, -6.21245623e-01, -4.32812452e-01, + -1.01672053e-01, -5.91795444e-01, -6.22490764e-01, + -3.76615644e-01, 1.69408441e-01, 3.26209068e-02, + 6.91425800e-03, -2.04758048e-01, 3.95822883e-01, + 4.27745581e-02, -1.17655337e-01, -2.12213635e-01, + 1.17718458e-01, 1.00871801e-01, -5.19698560e-01, + 3.66162062e-02, -3.46718609e-01, 8.95521641e-02, + -5.81629872e-01, 4.65881824e-02, -3.54920030e-01 ] + - [ -6.08947754e-01, -2.15492070e-01, -2.54790604e-01, + 8.94870281e-01, -8.82930458e-01, 2.20073462e-02, + -2.36861050e-01, -4.88814890e-01, -6.03384614e-01, + -6.07624292e-01, -1.56249940e-01, -6.36641741e-01, + -5.38842916e-01, -7.52708137e-01, -1.68749988e-01, + -3.67867827e-01, -5.79762220e-01, -7.10020065e-01, + 2.47971058e-01, -4.77833152e-02, 3.04836869e-01, + 9.22742367e-01, -7.75678337e-01, 4.17612672e-01, + 3.20231199e-01, -6.01036787e-01, -3.21507037e-01, + -5.23532748e-01, 4.84433413e-01, -8.62252951e-01, + -2.21044242e-01, -6.88677371e-01, 4.67661738e-01, + -7.67882407e-01, -2.58485854e-01, -6.59620464e-01 ] + - [ -5.31483054e-01, 8.28555822e-02, -1.36976659e-01, + 4.90448713e-01, -6.43590271e-01, 2.16053486e-01, + -1.40388727e-01, 1.75679088e-01, -5.42908192e-01, + -2.02804804e-03, -6.71874881e-02, -1.87948406e-01, + -3.77184093e-01, -3.89915764e-01, -6.87499642e-02, + -1.58556879e-01, -3.72819960e-01, -3.92018020e-01, + 3.39344740e-01, 3.45543742e-01, 4.01574850e-01, 1.53306723e-02, + -1.80367827e-01, 4.59916711e-01, 4.58959460e-01, + -4.17480171e-01, -1.87930465e-02, 7.01745749e-02, + 5.09339929e-01, -2.46122479e-01, 8.14194679e-02, + -9.84390974e-02, 5.19900560e-01, -2.64936924e-01, + 6.80359602e-02, -1.07359767e-01 ] + - [ -9.85501230e-01, -6.87417865e-01, -8.93541515e-01, + -6.10235691e-01, -6.41799092e-01, -8.27839375e-01, + -9.16486681e-01, -5.70139885e-01, -6.43765211e-01, + -8.23895812e-01, -8.98437440e-01, -6.51164234e-01, + -6.18380845e-01, -9.33515310e-01, -9.04687464e-01, + -5.98693609e-01, -6.20882571e-01, -9.35313761e-01, + -9.25458372e-01, -5.31046093e-01, -6.76040530e-01, + -1.91313982e-01, -5.81317663e-01, -5.87181211e-01, + -6.92485571e-01, -1.63501263e-01, -5.61188638e-01, + -5.78109741e-01, -6.31382346e-01, -4.77556586e-01, + -5.56002378e-01, -8.75321865e-01, -6.31840825e-01, + -5.46716809e-01, -5.60007930e-01, -8.86484146e-01 ] + - [ -7.81275868e-01, -3.70373130e-01, -5.23065984e-01, + 3.23374748e-01, -8.45849991e-01, -3.43977630e-01, + -5.20518363e-01, -1.29280686e-01, -7.50054598e-01, + -5.88179946e-01, -5.01562476e-01, -2.19495475e-01, + -6.67812884e-01, -7.40891576e-01, -5.17187476e-01, + 3.85072231e-02, -7.11171627e-01, -6.95631921e-01, + -2.10700393e-01, -1.58238232e-01, -6.18672967e-02, + 3.47707033e-01, -6.66398644e-01, -3.27683091e-02, + 1.04045868e-02, -3.96977365e-01, -4.33073461e-01, + -5.17324507e-01, 6.22653961e-03, -3.20376277e-01, + -3.94308507e-01, -6.15782022e-01, -2.73631811e-02, + -1.82393849e-01, -4.34068918e-01, -5.71089387e-01 ] + - [ -7.08575010e-01, -2.74878621e-01, -4.13768649e-01, + 7.81284928e-01, -8.89348269e-01, -5.53086996e-02, + -3.86609018e-01, -5.23808002e-01, -6.09552622e-01, + -6.46203279e-01, -3.64062488e-01, -3.59801054e-01, + -5.92330217e-01, -7.12790966e-01, -3.73437464e-01, + -3.91801596e-01, -5.75719953e-01, -7.29342878e-01, + -4.65885997e-02, -6.93001151e-02, 8.43644142e-02, + 7.16627002e-01, -7.31953561e-01, 2.97709227e-01, + 1.23699307e-01, -7.73954690e-01, -2.46604741e-01, + -6.06896520e-01, 1.83063507e-01, -5.08039057e-01, + -2.68380821e-01, -5.88875055e-01, 1.69154167e-01, + -6.12016916e-01, -2.53806055e-01, -6.09012127e-01 ] + - [ -6.43537700e-01, -4.33120370e-01, -4.27963138e-01, + 1.33912683e-01, -8.49187851e-01, -5.32195926e-01, + -3.99567962e-01, 4.59525585e-02, -8.35726678e-01, + -6.24788404e-01, -3.31249952e-01, -4.98085022e-02, + -7.83342957e-01, -7.93319523e-01, -3.39062512e-01, + -5.12305498e-02, -7.78419316e-01, -8.01094532e-01, + 8.98705721e-02, -2.36886203e-01, -1.01237297e-02, + 2.75812030e-01, -7.14278460e-01, -2.38465607e-01, + 5.66473007e-02, -3.22579145e-02, -6.27838016e-01, + -4.63425517e-01, 1.90535426e-01, -1.57348514e-01, + -5.65656185e-01, -6.85633063e-01, 1.76616907e-01, + -2.27948308e-01, -5.58166265e-01, -6.96685910e-01 ] + - [ -9.84051347e-01, -6.75492287e-01, -8.99219275e-01, + -6.35431170e-01, -5.98736286e-01, -8.12780499e-01, + -9.23686087e-01, -5.15826643e-01, -6.65848136e-01, + -8.09679925e-01, -8.96874964e-01, -6.40942752e-01, + -6.24854326e-01, -9.33154225e-01, -9.04687464e-01, + -5.70026338e-01, -6.23872399e-01, -9.28180218e-01, + -9.24857259e-01, -5.31100988e-01, -6.89538777e-01, + -2.24441886e-01, -5.25056243e-01, -5.56353986e-01, + -6.85549140e-01, -2.50559092e-01, -5.09115219e-01, + -6.07068539e-01, -6.26401067e-01, -5.50128222e-01, + -5.31290948e-01, -8.86138022e-01, -6.34328365e-01, + -6.26019299e-01, -4.92612839e-01, -8.77215385e-01 ] + - [ -5.71458161e-01, -1.89545453e-01, -2.19304502e-01, + 5.05662918e-01, -8.13175976e-01, -1.62459016e-01, + -2.18142509e-01, 1.23550653e-01, -7.36644030e-01, + -3.97413254e-01, -1.42187417e-01, 5.92184067e-02, + -6.59544349e-01, -6.02222323e-01, -1.45312488e-01, + 3.18917036e-02, -6.52137697e-01, -6.20737672e-01, + 2.32942581e-01, 6.53063059e-02, 2.68841386e-01, 3.81684422e-01, + -5.62477231e-01, 2.24271417e-01, 3.41040492e-01, + -3.16715360e-01, -3.37188184e-01, -2.81551600e-01, + 3.77335072e-01, -4.49087620e-02, -3.01252782e-01, + -3.62915277e-01, 4.02985096e-01, -2.88116157e-01, + -2.53708661e-01, -4.36079562e-01 ] + - [ -9.86122608e-01, -6.88116908e-01, -8.97799850e-01, + -6.46147966e-01, -6.16491675e-01, -8.34587693e-01, + -9.28005755e-01, -5.64906657e-01, -6.31741881e-01, + -8.15917909e-01, -9.03124988e-01, -6.83229923e-01, + -6.06381238e-01, -9.38655078e-01, -9.09375012e-01, + -6.40079856e-01, -6.00877345e-01, -9.39700484e-01, + -9.26660657e-01, -5.50047636e-01, -6.62542164e-01, + -3.28267515e-01, -4.79230940e-01, -6.14464521e-01, + -7.10982680e-01, -1.50320888e-01, -5.61443031e-01, + -5.68387091e-01, -6.23910308e-01, -6.35587692e-01, + -4.97284055e-01, -8.96708310e-01, -6.31840825e-01, + -6.81523681e-01, -4.92958665e-01, -8.95266294e-01 ] + - [ -9.36619759e-01, -5.30791998e-01, -7.85663605e-01, + -3.61266971e-01, -6.11269653e-01, -5.40890932e-01, + -7.39380836e-01, -7.31801033e-01, -5.49629688e-01, + -7.71564722e-01, -6.95312500e-01, -8.43001008e-01, + -5.33027411e-01, -8.86778772e-01, -6.99999988e-01, + -7.67415166e-01, -5.39130032e-01, -8.85276079e-01, + -6.84400380e-01, -3.91708612e-01, -3.76827896e-01, + -2.31946707e-02, -5.22734880e-01, -2.33129323e-01, + -3.13294888e-01, -4.50288355e-01, -4.66386855e-01, + -6.51198506e-01, -1.95516825e-01, -8.70284975e-01, + -4.09085512e-01, -8.64094198e-01, -2.13930309e-01, + -8.67490768e-01, -4.18706059e-01, -8.54325056e-01 ] + - [ -9.47390199e-01, -7.04180598e-01, -8.16891432e-01, + -3.44127595e-01, -8.28439057e-01, -8.17463160e-01, + -8.38732839e-01, -3.23173463e-01, -8.07912886e-01, + -8.09735775e-01, -7.89062500e-01, -3.21737230e-01, + -7.95948625e-01, -9.19027507e-01, -7.95312464e-01, + -2.72531748e-01, -7.98522115e-01, -9.19604599e-01, + -7.68560290e-01, -4.83674169e-01, -4.75815475e-01, + -1.49390697e-01, -6.44736052e-01, -5.92239618e-01, + -5.07514477e-01, -9.28364396e-02, -6.13794506e-01, + -5.39060831e-01, -4.14694905e-01, -3.28301191e-01, + -6.16341233e-01, -8.31296504e-01, -4.12935317e-01, + -4.54143584e-01, -5.96810818e-01, -8.48750234e-01 ] + - [ -6.79784596e-01, -2.33760357e-01, -3.74024153e-01, + 1.40361071e-01, -7.47619271e-01, -3.21168661e-01, + -3.75090003e-01, 3.08056712e-01, -7.62227178e-01, + -2.85538018e-01, -3.17187428e-01, -5.39918542e-02, + -6.39098763e-01, -6.30984247e-01, -3.28125000e-01, + 1.53831244e-02, -6.43237591e-01, -6.21383309e-01, + 5.74090481e-02, 8.44621658e-02, 1.92350984e-01, + -4.24703956e-02, -4.01778460e-01, -2.34628320e-02, + 2.11560607e-01, 7.65516758e-02, -3.98592532e-01, + 5.60376644e-02, 2.35367298e-01, -1.29621804e-01, + -2.30805755e-01, -3.46267521e-01, 2.36318350e-01, + -9.29810405e-02, -2.58966506e-01, -3.39453995e-01 ] + - [ -6.18061304e-01, -2.08452702e-01, -2.87437856e-01, + 1.31213903e-01, -7.53530800e-01, -3.51285696e-01, + -3.11735034e-01, 3.16381812e-01, -7.59930134e-01, + -2.82981396e-01, -2.67187417e-01, -6.75684214e-02, + -6.23147249e-01, -6.17189884e-01, -2.70312488e-01, + -3.47760320e-02, -6.25540495e-01, -6.22305512e-01, + 9.04718637e-02, 3.30508947e-02, 1.99100137e-01, + -1.12352014e-01, -4.32594836e-01, -1.62348926e-01, + 1.12138629e-01, 1.78787827e-01, -4.62477684e-01, + 6.64347410e-02, 2.62764692e-01, -1.81777418e-01, + -2.94512033e-01, -4.37937140e-01, 2.43781090e-01, + -1.51567638e-01, -3.10244083e-01, -4.23683345e-01 ] + - [ -8.15451503e-01, -3.89556587e-01, -5.67068815e-01, + -1.81180239e-03, -7.64352560e-01, -4.54671919e-01, + -5.73794007e-01, 1.52343512e-02, -7.38091707e-01, + -4.56387460e-01, -4.64062512e-01, -1.56403661e-01, + -7.02638865e-01, -7.49482870e-01, -4.67187464e-01, + -1.62414610e-01, -6.91542625e-01, -7.56247222e-01, + -2.80432880e-01, -3.37332487e-02, 3.26209068e-02, + -1.56068325e-01, -3.86230528e-01, -1.48270130e-01, + 1.50288343e-02, -2.24920511e-02, -3.69516373e-01, + -2.20268965e-02, 1.28268957e-01, -4.18005943e-01, + -2.63178170e-01, -5.43606460e-01, 7.96018839e-02, + -3.24280739e-01, -2.85018444e-01, -5.00577331e-01 ] + - [ -9.83637094e-01, -7.05649972e-01, -8.96380424e-01, + -5.63504040e-01, -6.82013988e-01, -8.31289947e-01, + -9.16486681e-01, -5.37508845e-01, -6.78532124e-01, + -8.32802892e-01, -9.03124988e-01, -5.78660965e-01, + -6.55495524e-01, -9.32453215e-01, -9.07812476e-01, + -5.29247165e-01, -6.58705592e-01, -9.34432447e-01, + -9.17042375e-01, -5.26345968e-01, -6.73790753e-01, + -1.79395854e-01, -5.80709934e-01, -5.71206689e-01, + -6.87861323e-01, -1.83288932e-01, -5.40565133e-01, + -5.72063625e-01, -6.28891647e-01, -4.63331163e-01, + -5.46228051e-01, -8.63940239e-01, -6.19403005e-01, + -5.49529433e-01, -5.49745321e-01, -8.79618883e-01 ] + - [ -8.73446584e-01, -4.07728672e-01, -6.43718958e-01, + 1.86123848e-01, -7.87212551e-01, -3.02454114e-01, + -5.91072679e-01, -4.67392385e-01, -6.59494877e-01, + -6.90286398e-01, -5.39062500e-01, -3.79484773e-01, + -6.59513950e-01, -7.97165930e-01, -5.45312464e-01, + -3.57109010e-01, -6.54509664e-01, -8.01909029e-01, + -4.81214404e-01, -1.44770622e-01, -1.58605158e-01, + 4.06361699e-01, -6.02945089e-01, 2.16845274e-01, + -5.20231128e-02, -7.04034090e-01, -2.39840746e-01, + -5.73120594e-01, 1.86798573e-02, -7.36697555e-01, + -2.62397647e-01, -7.02562928e-01, 7.46262074e-03, + -8.53131771e-01, -2.41268754e-01, -7.18088925e-01 ] + - [ -4.64374483e-01, -6.05396032e-02, -1.39815509e-01, + 2.73788571e-01, -6.56528056e-01, -3.93373370e-02, + -1.64866686e-01, 1.84229851e-01, -5.91980457e-01, + -8.23371410e-02, 2.81250477e-02, -5.81787348e-01, + -4.28810418e-01, -6.23344958e-01, 3.28125954e-02, + -3.49628568e-01, -4.72475290e-01, -5.87918997e-01, + 5.59362769e-01, 1.24578714e-01, 4.19572473e-01, 1.63993835e-02, + -3.26265693e-01, 1.94326520e-01, 3.41040492e-01, + 1.20903611e-01, -2.74288833e-01, 3.42662334e-01, + 7.35990047e-01, -9.36630189e-01, -1.68231726e-02, + -5.60631752e-01, 7.21393108e-01, -7.48802304e-01, + -8.79661441e-02, -5.06944418e-01 ] + - [ -9.98964369e-01, -7.25596368e-01, -9.53158259e-01, + -5.89996219e-01, -6.62434340e-01, -8.65734994e-01, + -9.78401721e-01, -5.32806396e-01, -6.70866668e-01, + -8.56963396e-01, -9.71875012e-01, -5.74841976e-01, + -6.39564812e-01, -9.49942172e-01, -9.76562500e-01, + -5.07862329e-01, -6.53109550e-01, -9.50777590e-01, + -9.96393144e-01, -6.33899093e-01, -8.17772746e-01, + -1.76430821e-01, -6.50708079e-01, -7.06748605e-01, + -8.38150263e-01, -1.84719205e-01, -5.92698097e-01, + -6.93982482e-01, -8.08219194e-01, -4.26999569e-01, + -5.99173069e-01, -9.16422009e-01, -8.10945272e-01, + -4.45301175e-01, -6.29743040e-01, -9.24050868e-01 ] + - [ -9.86122608e-01, -6.88116908e-01, -8.97799850e-01, + -6.46147966e-01, -6.16491675e-01, -8.34587693e-01, + -9.28005755e-01, -5.64906657e-01, -6.31741881e-01, + -8.15917909e-01, -9.03124988e-01, -6.83229923e-01, + -6.06381238e-01, -9.38655078e-01, -9.09375012e-01, + -6.40079856e-01, -6.00877345e-01, -9.39700484e-01, + -9.26660657e-01, -5.50047636e-01, -6.62542164e-01, + -3.28267515e-01, -4.79230940e-01, -6.14464521e-01, + -7.10982680e-01, -1.50320888e-01, -5.61443031e-01, + -5.68387091e-01, -6.23910308e-01, -6.35587692e-01, + -4.97284055e-01, -8.96708310e-01, -6.31840825e-01, + -6.81523681e-01, -4.92958665e-01, -8.95266294e-01 ] + - [ -9.74523604e-01, -5.31839728e-01, -8.58055353e-01, + -6.27411127e-01, -4.91741121e-01, -6.82927251e-01, + -9.02087808e-01, -3.19190502e-01, -6.29657388e-01, + -5.91385245e-01, -8.53124976e-01, -6.69366777e-01, + -5.20065546e-01, -8.69171858e-01, -8.57812464e-01, + -6.44873261e-01, -5.11701703e-01, -8.75424504e-01, + -8.93597841e-01, -3.72432232e-01, -5.88301480e-01, + -3.80190074e-01, -2.74113417e-01, -3.98107588e-01, + -6.36994243e-01, -1.84757531e-01, -3.56670201e-01, + -3.05361986e-01, -5.46699882e-01, -9.06813145e-01, + -2.03182697e-01, -8.31202209e-01, -5.47263622e-01, + -9.93266284e-01, -1.99573934e-01, -8.41070056e-01 ] + - [ -8.77174854e-01, -3.97728086e-01, -6.12491131e-01, + -4.29597557e-01, -5.68977475e-01, -5.23754895e-01, + -6.61627054e-01, -8.48048925e-02, -6.51186943e-01, + -3.87805462e-01, -5.15625000e-01, -6.29323483e-01, + -5.50028741e-01, -7.94285953e-01, -5.29687524e-01, + -4.96937811e-01, -5.68362236e-01, -7.80562520e-01, + -4.92636025e-01, -1.11537516e-01, -1.13610804e-01, + -2.74772704e-01, -2.60992050e-01, -1.19399488e-01, + -1.81502879e-01, 9.47574377e-02, -3.57497334e-01, + 1.50460243e-01, 1.15815639e-01, -9.76780534e-01, + -1.51152492e-01, -7.19320118e-01, 6.96516037e-02, + -7.94844747e-01, -2.06319809e-01, -6.63684726e-01 ] + - [ -5.62551796e-01, -1.20627940e-01, -2.20723927e-01, + 1.85472965e-01, -6.55558884e-01, -1.13931894e-01, + -2.39740789e-01, 1.85346603e-01, -6.24304414e-01, + -1.34854615e-01, -4.68749404e-02, -5.38219333e-01, + -4.80433285e-01, -6.57762647e-01, -5.46874404e-02, + -3.76858592e-01, -5.00357151e-01, -6.31411433e-01, + 3.76014352e-01, 1.03372574e-01, 3.63329649e-01, 3.98993492e-02, + -3.50160480e-01, 1.81885242e-01, 2.83236861e-01, + 1.34692311e-01, -2.95066595e-01, 3.23056459e-01, + 6.48816824e-01, -9.54978585e-01, -2.83200741e-02, + -5.82837224e-01, 6.26865745e-01, -7.26733208e-01, + -1.10588729e-01, -5.19604921e-01 ] + - [ -9.95028973e-01, -7.05238342e-01, -9.47480500e-01, + -5.70201576e-01, -6.23529553e-01, -8.13929379e-01, + -9.45284367e-01, -7.07015097e-01, -5.93288183e-01, + -8.88702214e-01, -9.49999988e-01, -6.90301895e-01, + -5.84191203e-01, -9.49743807e-01, -9.56250012e-01, + -6.36798978e-01, -5.82962871e-01, -9.49850142e-01, + -9.66937184e-01, -5.95239639e-01, -7.70528674e-01, + -1.48269594e-01, -5.85274041e-01, -5.66196680e-01, + -7.59537637e-01, -3.22286129e-01, -5.50773621e-01, + -7.55620480e-01, -7.33499408e-01, -5.89572668e-01, + -5.32714725e-01, -9.21069682e-01, -7.36318409e-01, + -6.34456456e-01, -5.34771800e-01, -9.21566069e-01 ] + - [ -9.61474717e-01, -6.14930153e-01, -8.63733113e-01, + -2.44465649e-01, -7.86531806e-01, -6.84349060e-01, + -8.81929398e-01, -2.76934803e-01, -7.85051703e-01, + -7.54349589e-01, -8.39062452e-01, -2.93079317e-01, + -7.53803074e-01, -8.86563301e-01, -8.46874952e-01, + -2.43196011e-01, -7.57411003e-01, -8.87516499e-01, + -8.79170418e-01, -4.38313603e-01, -6.28796458e-01, + -2.23838151e-01, -4.94334757e-01, -4.94756162e-01, + -6.55491352e-01, -1.80031836e-01, -5.73144674e-01, + -6.02490783e-01, -6.23910308e-01, -3.90479207e-01, + -4.95226979e-01, -8.00287902e-01, -6.31840825e-01, + -4.59812462e-01, -4.93068933e-01, -8.13270986e-01 ] + - [ -9.79908884e-01, -5.99250078e-01, -8.89283180e-01, + -4.74300683e-01, -6.33822978e-01, -7.05976605e-01, + -9.10727143e-01, -4.24606264e-01, -6.54972196e-01, + -7.21876562e-01, -8.75000000e-01, -5.17786443e-01, + -6.31720901e-01, -8.89791131e-01, -8.79687488e-01, + -4.80147898e-01, -6.28928304e-01, -8.92266154e-01, + -9.06822979e-01, -4.35802996e-01, -6.53543234e-01, + -1.89240158e-01, -4.72175181e-01, -4.24566269e-01, + -6.76300645e-01, -1.56128109e-01, -4.96250570e-01, + -4.75717723e-01, -6.03985071e-01, -5.05847096e-01, + -4.77053583e-01, -8.34138334e-01, -6.01990104e-01, + -5.85179508e-01, -4.72038925e-01, -8.44650567e-01 ] + - [ -8.98508728e-01, -5.44732213e-01, -7.06174612e-01, + -2.94532537e-01, -7.27183938e-01, -6.34611011e-01, + -7.29301691e-01, -2.09308684e-01, -7.33173549e-01, + -6.19974613e-01, -6.31250024e-01, -3.58604252e-01, + -7.02937722e-01, -8.37200522e-01, -6.39062524e-01, + -3.21608543e-01, -7.00232625e-01, -8.38336468e-01, + -5.99038243e-01, -1.74712956e-01, -2.80089974e-01, + -1.29978538e-01, -3.90983105e-01, -1.48933470e-01, + -2.85549164e-01, -9.44080949e-02, -3.50769579e-01, + -1.05131865e-01, -1.05853021e-01, -5.69546580e-01, + -3.15551460e-01, -6.79692984e-01, -1.26865745e-01, + -5.90741634e-01, -3.18838537e-01, -6.75497532e-01 ] + - [ -7.08989263e-01, -3.48871291e-01, -4.42157567e-01, + 1.32394314e-01, -8.12192261e-01, -4.52187657e-01, + -4.52843726e-01, 1.23270750e-01, -7.94810712e-01, + -4.89718616e-01, -4.14062500e-01, 1.13213062e-03, + -7.16966629e-01, -7.00401187e-01, -4.23437476e-01, + -5.78780174e-02, -6.99261367e-01, -7.20178127e-01, + -8.68651271e-02, -1.21682286e-01, 2.36220360e-02, + -1.06426537e-01, -5.24936438e-01, -3.16991210e-01, + 3.58381271e-02, -1.65798306e-01, -4.72228348e-01, + -3.49199235e-01, 4.35866117e-02, -3.19211483e-02, + -4.28874493e-01, -4.96914208e-01, 4.22885418e-02, + -1.80458963e-01, -4.01065290e-01, -5.35483539e-01 ] + - [ -9.64788735e-01, -6.60398483e-01, -8.45280349e-01, + -4.74960804e-01, -7.15559542e-01, -7.81264186e-01, + -8.61771047e-01, -4.51320648e-01, -7.17602372e-01, + -7.93809414e-01, -8.18749964e-01, -5.32712460e-01, + -6.85931444e-01, -9.12369192e-01, -8.24999988e-01, + -4.84547198e-01, -6.87557101e-01, -9.14231837e-01, + -8.67147565e-01, -4.50753212e-01, -5.86051702e-01, + -1.36249483e-01, -5.72202384e-01, -4.85692322e-01, + -5.93063593e-01, -1.45584404e-01, -5.51590085e-01, + -5.20408452e-01, -5.19302607e-01, -4.21728432e-01, + -5.21991909e-01, -8.14367771e-01, -5.14925361e-01, + -5.43023288e-01, -5.11059761e-01, -8.37715507e-01 ] + - [ -4.81980145e-01, -6.81853294e-03, -9.01347995e-02, + 2.48419762e-01, -6.69441283e-01, -9.62846279e-02, + -1.18790448e-01, 6.79442406e-01, -7.30775118e-01, + 7.90889263e-02, -2.49999762e-02, -4.02132273e-02, + -4.98711467e-01, -4.52954531e-01, -2.96874642e-02, + -1.44149244e-01, -4.75273550e-01, -4.97405887e-01, + 4.51157212e-01, 2.68793225e-01, 4.73565817e-01, + -1.76813066e-01, -2.03621328e-01, 1.49432302e-01, + 4.08092380e-01, 2.11812019e-01, -2.83041477e-01, + 4.52067852e-01, 5.59153080e-01, -2.82853961e-01, + 3.87203693e-03, -1.96178257e-01, 5.94527364e-01, + -5.23171902e-01, 4.31807041e-02, -2.85106897e-01 ] + - [ -6.28003299e-01, -2.28910148e-01, -2.56210089e-01, + 7.57763267e-01, -8.51357818e-01, -1.33862495e-02, + -2.42620528e-01, -4.86441374e-01, -6.06133223e-01, + -6.09891415e-01, -1.40624940e-01, -5.88094831e-01, + -5.60111701e-01, -7.52862155e-01, -1.54687464e-01, + -3.73610377e-01, -5.90751708e-01, -7.21818686e-01, + 2.08295703e-01, -4.32795882e-02, 3.13835740e-01, + 8.89242291e-01, -7.60267675e-01, 4.17332053e-01, + 3.15606833e-01, -5.92788815e-01, -3.21148515e-01, + -5.16772985e-01, 4.52054739e-01, -8.63351226e-01, + -2.13555992e-01, -6.86086893e-01, 4.62686658e-01, + -7.43722677e-01, -2.65897155e-01, -6.55550718e-01 ] + - [ -8.98301601e-01, -3.66212964e-01, -6.84882879e-01, + 7.71312714e-02, -7.09865689e-01, -2.45172977e-01, + -6.48668051e-01, -3.94546509e-01, -6.28114164e-01, + -6.09332085e-01, -5.89062452e-01, -4.13925767e-01, + -6.02135062e-01, -7.65710831e-01, -5.98437428e-01, + -3.10780406e-01, -6.16994858e-01, -7.56506145e-01, + -6.02645040e-01, -1.04215801e-01, -2.64341891e-01, + 2.54232645e-01, -4.51347828e-01, 3.27449083e-01, + -1.65318012e-01, -7.29577303e-01, -9.18507576e-02, + -4.68530178e-01, -9.83811617e-02, -9.28042650e-01, + -8.13841224e-02, -6.81236446e-01, -1.09452724e-01, + -8.74733567e-01, -1.22221172e-01, -6.62433028e-01 ] + - [ -9.49254334e-01, -5.99367678e-01, -8.08374703e-01, + -4.26197469e-01, -6.89824164e-01, -7.04465270e-01, + -8.14254820e-01, -4.77590322e-01, -6.75705791e-01, + -7.53923893e-01, -7.53124952e-01, -6.33473516e-01, + -6.47328556e-01, -9.04154181e-01, -7.59374976e-01, + -5.70691645e-01, -6.49691105e-01, -9.03013229e-01, + -8.05229962e-01, -4.20117259e-01, -5.16310453e-01, + -1.47382677e-01, -5.27243495e-01, -4.19237077e-01, + -5.19075215e-01, -1.83735132e-01, -5.17979980e-01, + -5.00896037e-01, -4.04732287e-01, -6.08275890e-01, + -4.83908951e-01, -8.44976366e-01, -4.10447717e-01, + -6.03041887e-01, -4.98709977e-01, -8.37122679e-01 ] + - [ -9.86122608e-01, -6.24418020e-01, -9.07736003e-01, + -4.56593513e-01, -6.89448118e-01, -7.58988857e-01, + -9.42404628e-01, -3.61655116e-01, -6.94723964e-01, + -7.24788487e-01, -9.09374952e-01, -4.53851044e-01, + -6.66171312e-01, -9.00204122e-01, -9.17187512e-01, + -4.01724637e-01, -6.65921569e-01, -8.99288476e-01, + -9.41689253e-01, -4.33530033e-01, -7.23284602e-01, + -1.30918145e-01, -5.09548783e-01, -4.16001022e-01, + -7.36416221e-01, -1.05744362e-01, -5.05367517e-01, + -4.40142274e-01, -6.61270261e-01, -5.36860466e-01, + -4.63420331e-01, -8.50562572e-01, -6.79104447e-01, + -5.57194471e-01, -4.54173028e-01, -8.39524150e-01 ] + - [ -8.67854178e-01, -6.81727827e-01, -7.10432947e-01, + -1.11426890e-01, -9.07538533e-01, -7.91318655e-01, + -7.22102165e-01, -9.07808542e-02, -9.00008440e-01, + -8.04420471e-01, -6.84374928e-01, 6.53324127e-02, + -8.90878320e-01, -8.86675715e-01, -6.85937524e-01, + 1.51752234e-02, -8.79443347e-01, -8.98639083e-01, + -3.91644180e-01, -5.08302450e-01, -2.10348666e-01, + 1.85604215e-01, -8.47823262e-01, -6.18850827e-01, + -2.00000048e-01, 1.54215217e-01, -8.23614836e-01, + -6.50065958e-01, -2.22914040e-01, 2.13108659e-01, + -7.88493276e-01, -7.67007053e-01, -2.11442828e-01, + 3.40954065e-02, -7.60680556e-01, -7.97873735e-01 ] + - [ -8.75517845e-01, -4.46870446e-01, -6.47977293e-01, + -2.49845207e-01, -6.61327720e-01, -4.97788310e-01, + -6.54427648e-01, -2.63989449e-01, -6.49227202e-01, + -5.38610876e-01, -5.32812476e-01, -4.84187841e-01, + -6.20782912e-01, -8.01007748e-01, -5.37500024e-01, + -4.34479594e-01, -6.21282458e-01, -8.01411033e-01, + -4.44544733e-01, -1.14347279e-01, -1.45106852e-01, + -1.91932321e-01, -2.62746513e-01, -1.35192275e-02, + -1.79190755e-01, 1.56195760e-01, -4.75164354e-01, + 1.72756910e-02, 7.59650469e-02, -6.47523999e-01, + -2.81182110e-01, -6.71835482e-01, 7.96018839e-02, + -6.88443184e-01, -2.91943789e-01, -6.78548336e-01 ] + - [ -9.60439086e-01, -5.00424385e-01, -8.50958109e-01, + -1.04142249e-01, -7.42943645e-01, -4.67369258e-01, + -8.47372174e-01, -2.91490734e-01, -7.16345906e-01, + -6.69978142e-01, -8.18749964e-01, -2.66185701e-01, + -6.88992262e-01, -8.18709731e-01, -8.24999988e-01, + -2.15517581e-01, -6.90842748e-01, -8.17067683e-01, + -8.71355593e-01, -1.97603524e-01, -6.06299162e-01, + 1.46474361e-01, -4.95455444e-01, 8.69580507e-02, + -5.72254419e-01, -3.23117495e-01, -3.22476566e-01, + -4.18972135e-01, -5.44209242e-01, -5.20210981e-01, + -2.77763426e-01, -6.96340561e-01, -5.54726362e-01, + -4.62961495e-01, -3.15905452e-01, -6.74524665e-01 ] + - [ -9.04722452e-01, -5.37475348e-01, -6.99077368e-01, + -4.00793076e-01, -6.59583092e-01, -6.27978504e-01, + -7.12023020e-01, -3.95506322e-01, -6.52390957e-01, + -6.48712337e-01, -6.12499952e-01, -5.26802778e-01, + -6.35662675e-01, -8.37936819e-01, -6.15625024e-01, + -5.29702425e-01, -6.24631047e-01, -8.47776294e-01, + -5.96633613e-01, -2.40808010e-01, -2.66591609e-01, + -2.44001150e-01, -3.38006735e-01, -2.17058182e-01, + -2.55491316e-01, -2.37586617e-01, -3.53416145e-01, + -2.82887340e-01, -1.23287737e-01, -3.77411783e-01, + -4.08660591e-01, -6.64843500e-01, -1.06965184e-01, + -6.56597316e-01, -3.48692238e-01, -7.23254979e-01 ] + - [ -9.21706736e-01, -5.88227510e-01, -7.27466285e-01, + -4.42935765e-01, -6.90947890e-01, -7.04090953e-01, + -7.43700504e-01, -3.96947205e-01, -7.01946616e-01, + -7.15157151e-01, -6.57812476e-01, -5.72524428e-01, + -6.64402902e-01, -8.79983604e-01, -6.64062500e-01, + -5.17233849e-01, -6.65836573e-01, -8.80113184e-01, + -6.30898714e-01, -3.56366336e-01, -3.16085458e-01, + -1.44262433e-01, -5.17295003e-01, -3.73116612e-01, + -3.15607011e-01, -9.47023630e-02, -5.34695268e-01, + -3.99068534e-01, -1.28268957e-01, -5.61442912e-01, + -4.88783598e-01, -8.01731706e-01, -1.31840825e-01, + -6.01687431e-01, -4.91031229e-01, -8.02811205e-01 ] + - [ -5.67108572e-01, -3.31602693e-02, -2.07948864e-01, + 5.18668652e-01, -7.06914723e-01, 1.14154816e-01, + -2.13822842e-01, 2.02911615e-01, -6.21612310e-01, + -1.16515756e-01, -9.06249285e-02, -7.04243779e-02, + -5.16711116e-01, -4.90520298e-01, -9.53124762e-02, + -5.42201996e-02, -5.11194348e-01, -4.95380223e-01, + 3.09287548e-01, 3.27001929e-01, 3.92575979e-01, 1.26530290e-01, + -2.44415462e-01, 5.08439183e-01, 4.38150287e-01, + -3.74514401e-01, -5.01648188e-02, 7.50126839e-02, + 4.76961374e-01, -2.55991101e-01, 6.89456463e-02, + -1.18941426e-01, 4.77611899e-01, -2.41732597e-01, + 4.88481522e-02, -1.13082111e-01 ] + - [ -8.97887349e-01, -4.58641112e-01, -6.91980124e-01, + -3.12862933e-01, -6.23104572e-01, -5.01069665e-01, + -6.84665203e-01, -4.10836399e-01, -6.11326039e-01, + -6.05005503e-01, -5.79687476e-01, -6.31083250e-01, + -5.84524512e-01, -8.30153883e-01, -5.89062452e-01, + -5.55800200e-01, -5.88218093e-01, -8.26067269e-01, + -5.08265734e-01, -2.66522050e-01, -2.14848220e-01, + -1.32456064e-01, -4.30347502e-01, -2.09643960e-01, + -2.23121405e-01, -1.10457540e-01, -4.77030575e-01, + -3.18189621e-01, -3.11332941e-02, -6.64149284e-01, + -3.76827240e-01, -7.55976796e-01, -5.97015619e-02, + -6.04526699e-01, -4.00990427e-01, -7.35028863e-01 ] + - [ -8.97887349e-01, -4.58641112e-01, -6.91980124e-01, + -3.12862933e-01, -6.23104572e-01, -5.01069665e-01, + -6.84665203e-01, -4.10836399e-01, -6.11326039e-01, + -6.05005503e-01, -5.79687476e-01, -6.31083250e-01, + -5.84524512e-01, -8.30153883e-01, -5.89062452e-01, + -5.55800200e-01, -5.88218093e-01, -8.26067269e-01, + -5.08265734e-01, -2.66522050e-01, -2.14848220e-01, + -1.32456064e-01, -4.30347502e-01, -2.09643960e-01, + -2.23121405e-01, -1.10457540e-01, -4.77030575e-01, + -3.18189621e-01, -3.11332941e-02, -6.64149284e-01, + -3.76827240e-01, -7.55976796e-01, -5.97015619e-02, + -6.04526699e-01, -4.00990427e-01, -7.35028863e-01 ] + - [ -8.92502069e-01, -5.41647673e-01, -6.87721789e-01, + -3.54080856e-01, -6.86543107e-01, -6.24790847e-01, + -7.07703352e-01, -3.30455303e-01, -6.82241321e-01, + -6.38785720e-01, -6.07812524e-01, -4.33356404e-01, + -6.65611506e-01, -8.29069316e-01, -6.09375000e-01, + -4.40040350e-01, -6.56204402e-01, -8.40225875e-01, + -5.46738863e-01, -2.04877317e-01, -2.30596185e-01, + -1.97558880e-01, -3.53378415e-01, -1.74269676e-01, + -2.27745771e-01, -2.21289337e-01, -3.34920883e-01, + -2.32651412e-01, -8.84184837e-02, -3.34599614e-01, + -3.92551124e-01, -6.28073812e-01, -5.97015619e-02, + -6.32951796e-01, -3.30900669e-01, -6.96007371e-01 ] + - [ -8.50455642e-01, -3.87221754e-01, -5.72746634e-01, + -3.30412626e-01, -6.32924795e-01, -5.23523271e-01, + -6.16990626e-01, -3.18642855e-02, -6.73299551e-01, + -3.80071044e-01, -4.67187464e-01, -4.24205005e-01, + -6.08792424e-01, -7.61692941e-01, -4.71875012e-01, + -4.01843309e-01, -6.02693081e-01, -7.66284525e-01, + -3.71806502e-01, -3.13030481e-02, -3.93701196e-02, + -2.79575944e-01, -2.16816902e-01, -4.93075848e-02, + -8.20809603e-02, 2.59665251e-02, -2.70427167e-01, + 2.10198641e-01, 1.65628791e-01, -6.75558448e-01, + -1.62217021e-01, -5.87967038e-01, 1.59203887e-01, + -7.62891293e-01, -1.55410767e-01, -6.04225755e-01 ] + - [ -7.98467278e-01, -3.65894616e-01, -5.13129890e-01, + 4.29971814e-01, -8.38500917e-01, -2.22984910e-01, + -4.68682528e-01, -4.20638323e-01, -6.80044115e-01, + -6.75758243e-01, -4.17187452e-01, -2.90976524e-01, + -6.72938406e-01, -7.67467499e-01, -4.21875000e-01, + -3.00865531e-01, -6.62499547e-01, -7.77746081e-01, + -2.02284455e-01, -8.60197544e-02, 4.16197777e-02, + 5.64059973e-01, -6.65407181e-01, 2.64848471e-01, + 1.14450812e-01, -7.89984345e-01, -2.20630586e-01, + -5.95245183e-01, 1.60647631e-01, -6.35218263e-01, + -2.53002822e-01, -6.38192058e-01, 1.41791105e-01, + -7.64730692e-01, -2.26394951e-01, -6.58286810e-01 ] + - [ -9.39312339e-01, -5.20259321e-01, -7.68630207e-01, + -3.90566766e-01, -6.40470147e-01, -6.04387641e-01, + -7.88336873e-01, -3.72862160e-01, -6.54765129e-01, + -6.46653593e-01, -7.12499976e-01, -5.93416929e-01, + -6.10633016e-01, -8.59528720e-01, -7.18750000e-01, + -5.42364240e-01, -6.09990597e-01, -8.59825134e-01, + -7.39705443e-01, -3.36818635e-01, -4.26321745e-01, + -1.30875409e-01, -4.70629454e-01, -2.95879602e-01, + -4.58959579e-01, -1.50697827e-02, -5.40595174e-01, + -3.29418480e-01, -3.05105925e-01, -6.19677663e-01, + -4.15754855e-01, -7.93883860e-01, -3.05970132e-01, + -6.61233127e-01, -4.13002133e-01, -7.91017234e-01 ] + - [ -9.90886509e-01, -7.17558742e-01, -9.16252613e-01, + -6.48846030e-01, -6.50685012e-01, -8.73920321e-01, + -9.38084960e-01, -6.08135343e-01, -6.48073435e-01, + -8.63933921e-01, -9.31249976e-01, -6.69176757e-01, + -6.20827556e-01, -9.51457322e-01, -9.35937464e-01, + -6.17625833e-01, -6.20052099e-01, -9.51482654e-01, + -9.52509761e-01, -5.79261065e-01, -7.14285731e-01, + -2.59651363e-01, -5.85529268e-01, -6.83490217e-01, + -7.20231235e-01, -2.84890056e-01, -5.15056491e-01, + -6.63889289e-01, -6.98630095e-01, -5.63744128e-01, + -5.22693634e-01, -9.00489271e-01, -6.99005008e-01, + -6.54460907e-01, -5.08285046e-01, -9.07619655e-01 ] + - [ -9.79908884e-01, -5.99250078e-01, -8.89283180e-01, + -4.74300683e-01, -6.33822978e-01, -7.05976605e-01, + -9.10727143e-01, -4.24606264e-01, -6.54972196e-01, + -7.21876562e-01, -8.75000000e-01, -5.17786443e-01, + -6.31720901e-01, -8.89791131e-01, -8.79687488e-01, + -4.80147898e-01, -6.28928304e-01, -8.92266154e-01, + -9.06822979e-01, -4.35802996e-01, -6.53543234e-01, + -1.89240158e-01, -4.72175181e-01, -4.24566269e-01, + -6.76300645e-01, -1.56128109e-01, -4.96250570e-01, + -4.75717723e-01, -6.03985071e-01, -5.05847096e-01, + -4.77053583e-01, -8.34138334e-01, -6.01990104e-01, + -5.85179508e-01, -4.72038925e-01, -8.44650567e-01 ] + - [ -7.01532722e-01, -1.23702645e-01, -3.52732420e-01, + 1.45943880e-01, -6.53122544e-01, -1.30742252e-01, + -3.83729279e-01, 3.57877970e-01, -7.10324645e-01, + -1.28151357e-01, -3.42187464e-01, -1.91175699e-01, + -4.94523108e-01, -5.35092473e-01, -3.43749940e-01, + -2.70127833e-01, -4.62197661e-01, -5.62093258e-01, + -6.31201267e-03, 1.55217290e-01, 1.81102276e-01, + -6.56194091e-02, -2.08516836e-01, 2.83116817e-01, + 1.69942141e-01, -1.21459544e-01, -2.62387395e-01, + 4.01343107e-02, 2.27895379e-01, -3.61781716e-01, + -5.65155149e-02, -3.21223140e-01, 2.08955288e-01, + -4.23678756e-01, -3.49678993e-02, -3.21658075e-01 ] + - [ -9.45526123e-01, -6.11671686e-01, -7.87083030e-01, + -4.86612797e-01, -6.61515951e-01, -7.14565277e-01, + -7.92656600e-01, -5.23092866e-01, -6.54849410e-01, + -7.56623685e-01, -7.34375000e-01, -6.51502252e-01, + -6.25920832e-01, -8.92568648e-01, -7.42187500e-01, + -5.76765418e-01, -6.35638237e-01, -8.92710507e-01, + -7.48722553e-01, -3.79956901e-01, -4.42069769e-01, + -1.71756029e-01, -4.55280125e-01, -3.28364491e-01, + -4.21965420e-01, -2.23203599e-01, -4.82713819e-01, + -4.76653159e-01, -2.85180628e-01, -6.41386271e-01, + -4.35222983e-01, -8.12061071e-01, -3.05970132e-01, + -6.20528400e-01, -4.70221639e-01, -8.12783360e-01 ] + - [ -6.89933717e-01, -2.70676672e-01, -3.79701853e-01, + 2.24314213e-01, -7.46094167e-01, -2.39562392e-01, + -3.95248353e-01, 1.60543799e-01, -7.28198886e-01, + -3.37486565e-01, -2.25000024e-01, -4.47816849e-02, + -6.78062379e-01, -6.69554472e-01, -2.34374940e-01, + -2.54392028e-02, -6.74298406e-01, -6.72884107e-01, + 1.99879646e-01, 1.76923156e-01, 3.25084329e-01, 2.12441683e-01, + -3.40336442e-01, 4.50948238e-01, 3.45664620e-01, + 2.00269341e-01, -3.69848311e-01, 2.69160509e-01, + 4.79451895e-01, -4.60972786e-01, -7.58304596e-02, + -3.81032884e-01, 4.82586861e-01, -5.19946694e-01, + -7.94385672e-02, -3.97843361e-01 ] + - [ -1., -7.19048858e-01, -9.75869417e-01, -5.65122008e-01, + -6.59737468e-01, -8.61166596e-01, -9.88480926e-01, + -6.39941394e-01, -6.21207952e-01, -8.98418665e-01, + -9.87499952e-01, -6.28220320e-01, -6.10723019e-01, + -9.60077107e-01, -9.95312452e-01, -5.68400383e-01, + -6.12988472e-01, -9.59959865e-01, -1., -6.40521646e-01, + -8.26771677e-01, -3.62784386e-01, -4.85614300e-01, + -7.43990183e-01, -8.47398877e-01, -2.89978027e-01, + -6.01600051e-01, -8.15260947e-01, -8.35616469e-01, + -5.26895702e-01, -5.51958561e-01, -9.34168458e-01, + -8.40795994e-01, -5.47862530e-01, -5.72381377e-01, + -9.36098456e-01 ] + - [ -6.05012417e-01, -2.07400382e-01, -2.70404577e-01, + 2.33652234e-01, -7.53470123e-01, -2.63607085e-01, + -2.88696885e-01, 2.48849392e-01, -7.43071556e-01, + -3.06414664e-01, -1.90624952e-01, 9.93484259e-02, + -6.60575867e-01, -5.86068273e-01, -1.79687440e-01, + 4.40368652e-02, -6.55179262e-01, -6.19535625e-01, + 2.93658018e-01, 1.02012157e-01, 3.16085458e-01, 4.58031893e-02, + -3.99419546e-01, 9.81205702e-02, 3.17918897e-01, + -9.92775559e-02, -3.29756618e-01, -3.49876881e-02, + 3.42465758e-01, 1.63154006e-01, -2.58580387e-01, + -1.88426375e-01, 3.80596876e-01, -2.52737522e-01, + -1.68770850e-01, -3.36882532e-01 ] + - [ -8.89602304e-01, -4.02398348e-01, -6.33782804e-01, + -4.67360198e-01, -5.49849927e-01, -5.34425735e-01, + -6.83225334e-01, -1.29781485e-01, -6.32253468e-01, + -3.97843480e-01, -5.37500024e-01, -6.84163094e-01, + -5.32439232e-01, -8.03794265e-01, -5.50000012e-01, + -5.58912992e-01, -5.50028622e-01, -7.92427063e-01, + -5.43131948e-01, -1.46211982e-01, -1.56355441e-01, + -3.29656720e-01, -2.38490820e-01, -1.64507508e-01, + -2.16185093e-01, 6.32489920e-02, -3.63837540e-01, + 9.32887793e-02, 4.35866117e-02, -9.82074559e-01, + -1.55805767e-01, -7.32279897e-01, 4.97508049e-03, + -8.23705554e-01, -2.06514060e-01, -6.82882547e-01 ] + - [ -8.20836782e-01, -3.76183212e-01, -5.37260413e-01, + -2.84064293e-01, -6.45195186e-01, -5.01337647e-01, + -5.78113675e-01, 4.63529825e-02, -6.99447036e-01, + -3.60121548e-01, -4.24999952e-01, -3.63013804e-01, + -6.21617615e-01, -7.46393204e-01, -4.29687500e-01, + -3.36733580e-01, -6.18416309e-01, -7.51318038e-01, + -2.79831767e-01, 2.80617476e-02, 1.46232843e-02, + -2.01915681e-01, -2.29799151e-01, 4.19335365e-02, + -2.42775679e-02, 9.41504240e-02, -2.71184802e-01, + 3.08971286e-01, 2.30386019e-01, -6.20880246e-01, + -1.40953958e-01, -5.38748384e-01, 2.38805890e-01, + -7.37263739e-01, -1.24989450e-01, -5.62402248e-01 ] + - [ -5.64415932e-01, -3.60401452e-01, -2.94535160e-01, + -2.37555504e-02, -7.92619348e-01, -5.46879292e-01, + -3.01655889e-01, 2.98107266e-01, -8.49434257e-01, + -4.94360149e-01, -2.15624928e-01, -2.00928748e-01, + -7.21889198e-01, -7.75102258e-01, -2.17187524e-01, + 1.09684229e-01, -7.67701387e-01, -7.29020715e-01, + 1.81244373e-01, -1.87442720e-01, 1.68728828e-02, + 1.12293720e-01, -6.07841492e-01, -2.12638319e-01, + 1.21387243e-01, 1.64608359e-01, -6.48186624e-01, + -3.06513488e-01, 2.97633886e-01, -2.55186379e-01, + -5.09146571e-01, -6.72086239e-01, 2.53731132e-01, + -1.35696232e-01, -5.30997097e-01, -6.30381167e-01 ] + - [ -9.62924600e-01, -5.86239100e-01, -8.67991507e-01, + -2.52270758e-01, -7.62120306e-01, -6.55199528e-01, + -8.67530584e-01, -3.46683860e-01, -7.24659264e-01, + -7.28104234e-01, -8.28125000e-01, -3.31856966e-01, + -7.22139418e-01, -8.73570740e-01, -8.34375024e-01, + -3.12542737e-01, -7.17034996e-01, -8.79111588e-01, + -8.37691605e-01, -4.59253728e-01, -5.72553396e-01, + -4.59758043e-02, -6.33274794e-01, -4.66710329e-01, + -5.60693622e-01, -3.55037570e-01, -4.53556895e-01, + -6.09804869e-01, -5.01868010e-01, -3.74426842e-01, + -5.62012136e-01, -8.20305705e-01, -5.02487540e-01, + -5.71166754e-01, -5.22686839e-01, -8.53071570e-01 ] + - [ -9.64788735e-01, -6.60398483e-01, -8.45280349e-01, + -4.74960804e-01, -7.15559542e-01, -7.81264186e-01, + -8.61771047e-01, -4.51320648e-01, -7.17602372e-01, + -7.93809414e-01, -8.18749964e-01, -5.32712460e-01, + -6.85931444e-01, -9.12369192e-01, -8.24999988e-01, + -4.84547198e-01, -6.87557101e-01, -9.14231837e-01, + -8.67147565e-01, -4.50753212e-01, -5.86051702e-01, + -1.36249483e-01, -5.72202384e-01, -4.85692322e-01, + -5.93063593e-01, -1.45584404e-01, -5.51590085e-01, + -5.20408452e-01, -5.19302607e-01, -4.21728432e-01, + -5.21991909e-01, -8.14367771e-01, -5.14925361e-01, + -5.43023288e-01, -5.11059761e-01, -8.37715507e-01 ] + - [ -9.77216244e-01, -5.86935163e-01, -8.99219275e-01, + -4.11209285e-01, -6.18224919e-01, -6.29056811e-01, + -8.77609789e-01, -6.85290694e-01, -5.44766545e-01, + -7.96906650e-01, -8.62500012e-01, -7.00191736e-01, + -5.48303843e-01, -8.99805605e-01, -8.68749976e-01, + -6.26471400e-01, -5.54799736e-01, -8.97256911e-01, + -9.03817236e-01, -4.15836334e-01, -6.58042729e-01, + -1.18381321e-01, -4.37838197e-01, -2.68658400e-01, + -6.30057812e-01, -5.59698522e-01, -2.45223999e-01, + -6.26353621e-01, -5.79078555e-01, -8.32751513e-01, + -2.90194631e-01, -8.54008436e-01, -5.87064624e-01, + -8.37663829e-01, -3.06195498e-01, -8.45870972e-01 ] + - [ -9.26470578e-01, -4.83002543e-01, -7.24627376e-01, + -4.05018568e-01, -6.46190822e-01, -6.17588937e-01, + -7.63858855e-01, -2.84325659e-01, -6.41297460e-01, + -5.52239060e-01, -6.64062500e-01, -5.46527803e-01, + -6.09899163e-01, -8.33549917e-01, -6.68749988e-01, + -5.08196592e-01, -6.08233213e-01, -8.36938143e-01, + -6.25488520e-01, -2.82061815e-01, -3.13835740e-01, + -1.31606579e-01, -4.53791320e-01, -2.56267369e-01, + -3.10982645e-01, -1.42499745e-01, -4.09141064e-01, + -2.60355651e-01, -1.18306279e-01, -7.00816154e-01, + -3.62312198e-01, -7.69163251e-01, -1.19403005e-01, + -8.04753184e-01, -3.51249814e-01, -7.83570409e-01 ] + - [ -7.13545978e-01, -2.03576505e-01, -3.64087999e-01, + 4.04397249e-01, -7.72111297e-01, -1.25262022e-01, + -3.53491664e-01, -8.77909660e-02, -6.63572967e-01, + -4.22983170e-01, -2.71874964e-01, -2.42248237e-01, + -5.93773484e-01, -6.60596967e-01, -2.82812476e-01, + -2.20350862e-01, -5.88038504e-01, -6.64169729e-01, + -1.45175934e-01, -2.70717740e-02, 5.06186485e-02, + 2.86723018e-01, -5.44698954e-01, 1.46297455e-01, + 8.67052078e-02, -4.32049215e-01, -2.60001242e-01, + -3.18745017e-01, 1.80572867e-01, -4.87707317e-01, + -2.36311674e-01, -5.52695096e-01, 1.76616907e-01, + -5.73094726e-01, -2.23177493e-01, -5.65921307e-01 ] + - [ -9.56503749e-01, -5.97888172e-01, -8.23988616e-01, + -5.22223115e-01, -6.28361702e-01, -7.16902673e-01, + -8.28653693e-01, -6.13440931e-01, -5.65919340e-01, + -7.42037833e-01, -7.85937428e-01, -6.72836065e-01, + -5.87218761e-01, -8.88227999e-01, -7.87499964e-01, + -6.98713839e-01, -5.59924245e-01, -8.97642374e-01, + -7.95010567e-01, -4.06265140e-01, -4.62317228e-01, + -3.28419447e-01, -4.18489099e-01, -4.75181341e-01, + -4.89017367e-01, -2.92291403e-01, -3.88374031e-01, + -4.41523552e-01, -3.82316411e-01, -6.20857596e-01, + -4.27159607e-01, -8.11965466e-01, -3.93034816e-01, + -6.75585985e-01, -4.13606882e-01, -8.08618307e-01 ] + - [ -8.14623058e-01, -4.21575785e-01, -5.59971631e-01, + -1.29980683e-01, -7.65863299e-01, -5.65209031e-01, + -5.88192940e-01, 2.49431610e-01, -8.40068161e-01, + -4.65509474e-01, -5.31250000e-01, -2.09974349e-01, + -7.02658176e-01, -7.74124146e-01, -5.45312464e-01, + -1.04799867e-02, -7.33585119e-01, -7.43471980e-01, + -3.31529915e-01, -2.47729719e-01, -1.42857194e-01, + -1.52386665e-01, -5.29534698e-01, -3.85897040e-01, + -1.42196596e-01, 1.37679696e-01, -6.39297068e-01, + -3.16069961e-01, -1.03362381e-01, -3.29340219e-01, + -4.31139350e-01, -6.59262657e-01, -1.11940265e-01, + -2.93277800e-01, -4.53117490e-01, -6.46720827e-01 ] + - [ -9.27091956e-01, -5.21930575e-01, -7.67210782e-01, + -3.40017021e-01, -6.27749085e-01, -5.40058255e-01, + -7.32181430e-01, -6.18929148e-01, -5.59653878e-01, + -7.06421494e-01, -6.79687500e-01, -6.67192757e-01, + -5.64955473e-01, -8.46640289e-01, -6.84375048e-01, + -6.29045308e-01, -5.62491298e-01, -8.50737333e-01, + -6.68770671e-01, -2.49610960e-01, -3.49831164e-01, + -1.35465384e-01, -3.43455255e-01, -8.78545046e-02, + -2.92485595e-01, -5.18944979e-01, -2.15117753e-01, + -4.24680829e-01, -1.80572867e-01, -7.06715167e-01, + -2.86226153e-01, -7.28526890e-01, -1.89054728e-01, + -7.75503397e-01, -2.79933512e-01, -7.34789133e-01 ] + - [ -9.60024834e-01, -6.22483373e-01, -8.16891432e-01, + -5.63922703e-01, -6.30902767e-01, -7.50003278e-01, + -8.34413230e-01, -5.40110826e-01, -6.32389188e-01, + -7.57841051e-01, -7.87499964e-01, -6.72993422e-01, + -6.09495819e-01, -9.01714623e-01, -7.93749988e-01, + -6.24669194e-01, -6.08247757e-01, -9.03200030e-01, + -7.98016250e-01, -4.44723308e-01, -4.89313841e-01, + -2.04143226e-01, -5.19266188e-01, -4.72521663e-01, + -5.02890229e-01, -1.80158615e-01, -5.24440765e-01, + -5.02874255e-01, -3.84806991e-01, -5.41522443e-01, + -5.17115414e-01, -8.39019775e-01, -3.78109455e-01, + -6.38248920e-01, -5.09380579e-01, -8.51559162e-01 ] + - [ -9.66031492e-01, -5.85710466e-01, -8.36763620e-01, + -5.56676209e-01, -5.98255157e-01, -7.18120813e-01, + -8.63210917e-01, -4.78561699e-01, -6.10429764e-01, + -6.99119568e-01, -8.14062476e-01, -6.54416323e-01, + -5.75150132e-01, -8.83080602e-01, -8.20312500e-01, + -6.02551043e-01, -5.75902939e-01, -8.84572208e-01, + -8.40096176e-01, -4.08591390e-01, -5.54555655e-01, + -2.37344325e-01, -4.45933580e-01, -4.24144387e-01, + -5.63005805e-01, -1.76061630e-01, -4.52386439e-01, + -4.09245968e-01, -4.54545498e-01, -5.91378927e-01, + -4.38627660e-01, -8.18444967e-01, -4.55223858e-01, + -6.40804052e-01, -4.48005617e-01, -8.25971484e-01 ] + - [ -9.60024834e-01, -6.22483373e-01, -8.16891432e-01, + -5.63922703e-01, -6.30902767e-01, -7.50003278e-01, + -8.34413230e-01, -5.40110826e-01, -6.32389188e-01, + -7.57841051e-01, -7.87499964e-01, -6.72993422e-01, + -6.09495819e-01, -9.01714623e-01, -7.93749988e-01, + -6.24669194e-01, -6.08247757e-01, -9.03200030e-01, + -7.98016250e-01, -4.44723308e-01, -4.89313841e-01, + -2.04143226e-01, -5.19266188e-01, -4.72521663e-01, + -5.02890229e-01, -1.80158615e-01, -5.24440765e-01, + -5.02874255e-01, -3.84806991e-01, -5.41522443e-01, + -5.17115414e-01, -8.39019775e-01, -3.78109455e-01, + -6.38248920e-01, -5.09380579e-01, -8.51559162e-01 ] + - [ -9.84051347e-01, -6.75492287e-01, -8.99219275e-01, + -6.35431170e-01, -5.98736286e-01, -8.12780499e-01, + -9.23686087e-01, -5.15826643e-01, -6.65848136e-01, + -8.09679925e-01, -8.96874964e-01, -6.40942752e-01, + -6.24854326e-01, -9.33154225e-01, -9.04687464e-01, + -5.70026338e-01, -6.23872399e-01, -9.28180218e-01, + -9.24857259e-01, -5.31100988e-01, -6.89538777e-01, + -2.24441886e-01, -5.25056243e-01, -5.56353986e-01, + -6.85549140e-01, -2.50559092e-01, -5.09115219e-01, + -6.07068539e-01, -6.26401067e-01, -5.50128222e-01, + -5.31290948e-01, -8.86138022e-01, -6.34328365e-01, + -6.26019299e-01, -4.92612839e-01, -8.77215385e-01 ] + - [ -5.15741587e-01, -8.29320550e-02, -1.58268332e-01, + 2.81823158e-01, -7.04865158e-01, -1.30436778e-01, + -1.67746603e-01, 6.52151585e-01, -7.58268356e-01, + -5.59186935e-03, -4.21874523e-02, 6.20050430e-02, + -5.88493824e-01, -5.12324691e-01, -4.21874523e-02, + -6.63465261e-03, -5.73610187e-01, -5.43782353e-01, + 4.47550297e-01, 2.63820171e-01, 4.84814405e-01, + -6.90563917e-02, -2.59704292e-01, 1.98733568e-01, + 4.17340994e-01, 2.68437743e-01, -3.11592340e-01, + 4.75929379e-01, 5.59153080e-01, -2.61529446e-01, + -1.16270185e-02, -1.97723210e-01, 5.72139144e-01, + -5.03171802e-01, 3.63698006e-02, -2.80894637e-01 ] + - [ -5.70008278e-01, -1.79196179e-01, -2.26401687e-01, + 2.39993691e-01, -7.51993656e-01, -2.60522068e-01, + -2.41180718e-01, 2.74641156e-01, -7.42576838e-01, + -2.89654136e-01, -1.93749905e-01, 9.34658051e-02, + -6.27986312e-01, -5.47899783e-01, -1.78124964e-01, + 7.66346455e-02, -6.31928384e-01, -5.76595426e-01, + 3.21911693e-01, 9.72579718e-02, 3.13835740e-01, 5.30958176e-04, + -3.79294753e-01, 7.51612186e-02, 3.27167511e-01, + -1.13683283e-01, -3.30261707e-01, -5.21605015e-02, + 3.52428317e-01, 1.64507151e-01, -2.56358147e-01, + -1.84925735e-01, 4.02985096e-01, -2.63931572e-01, + -1.72997534e-01, -3.46346676e-01 ] + - [ -6.66321456e-01, -2.20825553e-01, -3.44215751e-01, + 1.20091677e-01, -7.42072523e-01, -3.31747949e-01, + -3.46292257e-01, 2.30034828e-01, -7.35182703e-01, + -2.99258828e-01, -2.79687464e-01, -1.14680588e-01, + -6.21885419e-01, -6.36844516e-01, -2.96875000e-01, + -7.12500215e-02, -6.14453077e-01, -6.27210200e-01, + -6.31201267e-03, 3.60059738e-03, 1.83352113e-01, + -2.46233642e-01, -3.66030753e-01, -2.13458538e-01, + 1.49132967e-01, 1.84093714e-02, -4.10595894e-01, + -3.77756953e-02, 2.47820616e-01, -3.42567444e-01, + -2.38565505e-01, -4.74526405e-01, 1.56716347e-01, + -7.26569891e-02, -2.92062640e-01, -3.64107251e-01 ] + - [ -8.14001679e-01, -2.80212045e-01, -5.07452130e-01, + 1.08389735e-01, -7.02741742e-01, -2.40598023e-01, + -5.30597568e-01, 3.18411589e-02, -6.91608548e-01, + -3.64009500e-01, -4.09374952e-01, -2.80106306e-01, + -5.97159624e-01, -6.88236237e-01, -4.15624976e-01, + -2.38452077e-01, -5.96658468e-01, -6.88919306e-01, + -3.54974508e-01, 1.44406676e-01, 4.83690500e-02, + -2.48119235e-02, -2.02229798e-01, 3.50961804e-01, + 6.12715483e-02, -1.65521681e-01, -2.12069094e-01, + 5.67407608e-02, 1.13325000e-01, -5.32563567e-01, + 3.34872007e-02, -3.56046200e-01, 9.95024443e-02, + -5.88898182e-01, 3.67048979e-02, -3.66535008e-01 ] + - [ -9.21706736e-01, -5.88227510e-01, -7.27466285e-01, + -4.42935765e-01, -6.90947890e-01, -7.04090953e-01, + -7.43700504e-01, -3.96947205e-01, -7.01946616e-01, + -7.15157151e-01, -6.57812476e-01, -5.72524428e-01, + -6.64402902e-01, -8.79983604e-01, -6.64062500e-01, + -5.17233849e-01, -6.65836573e-01, -8.80113184e-01, + -6.30898714e-01, -3.56366336e-01, -3.16085458e-01, + -1.44262433e-01, -5.17295003e-01, -3.73116612e-01, + -3.15607011e-01, -9.47023630e-02, -5.34695268e-01, + -3.99068534e-01, -1.28268957e-01, -5.61442912e-01, + -4.88783598e-01, -8.01731706e-01, -1.31840825e-01, + -6.01687431e-01, -4.91031229e-01, -8.02811205e-01 ] + - [ -7.05260992e-01, -2.83119798e-01, -4.54932570e-01, + 7.51854181e-02, -7.27706194e-01, -3.29969764e-01, + -4.62922931e-01, 1.19584084e-01, -7.26403356e-01, + -3.60444009e-01, -3.90625000e-01, -2.35060811e-01, + -6.12785339e-01, -6.83884382e-01, -3.92187476e-01, + -3.57647240e-01, -5.79080105e-01, -7.20240593e-01, + 6.64261580e-02, -3.21364403e-02, 1.22609735e-01, + 2.40054131e-02, -4.61434782e-01, -4.64645028e-02, + 6.82079792e-02, -6.78610206e-02, -3.85498583e-01, + -1.01581216e-01, 1.93026185e-01, -3.13741624e-01, + -2.69448042e-01, -4.90105212e-01, 2.26368189e-01, + -5.35411119e-01, -2.44223118e-01, -5.61456203e-01 ] + - [ -9.79701757e-01, -5.34993291e-01, -9.02058184e-01, + -2.99822748e-01, -6.60983801e-01, -5.62208772e-01, + -8.94888401e-01, -4.45918560e-01, -6.38720095e-01, + -7.15487838e-01, -8.78124952e-01, -4.70031440e-01, + -6.08185768e-01, -8.57200861e-01, -8.84374976e-01, + -4.24953520e-01, -6.06677353e-01, -8.57904196e-01, + -9.21851516e-01, -3.07986736e-01, -6.87289119e-01, + -1.43300295e-02, -4.46681499e-01, -1.14191592e-01, + -6.69364214e-01, -2.84463167e-01, -3.83116901e-01, + -4.84751284e-01, -6.26401067e-01, -5.33532500e-01, + -3.71876299e-01, -7.85546184e-01, -6.31840825e-01, + -5.66525221e-01, -3.72253239e-01, -7.82182753e-01 ] + - [ -9.90886509e-01, -7.17558742e-01, -9.16252613e-01, + -6.48846030e-01, -6.50685012e-01, -8.73920321e-01, + -9.38084960e-01, -6.08135343e-01, -6.48073435e-01, + -8.63933921e-01, -9.31249976e-01, -6.69176757e-01, + -6.20827556e-01, -9.51457322e-01, -9.35937464e-01, + -6.17625833e-01, -6.20052099e-01, -9.51482654e-01, + -9.52509761e-01, -5.79261065e-01, -7.14285731e-01, + -2.59651363e-01, -5.85529268e-01, -6.83490217e-01, + -7.20231235e-01, -2.84890056e-01, -5.15056491e-01, + -6.63889289e-01, -6.98630095e-01, -5.63744128e-01, + -5.22693634e-01, -9.00489271e-01, -6.99005008e-01, + -6.54460907e-01, -5.08285046e-01, -9.07619655e-01 ] + - [ -5.74979305e-01, 1.22317672e-01, -1.54009938e-01, + -6.14174068e-01, -2.99295366e-01, -2.91635633e-01, + -1.61987007e-01, -5.79676569e-01, -3.04739714e-01, + -2.96342969e-01, -1.57812417e-01, -2.35252738e-01, + -2.87150979e-01, -3.19623709e-01, -1.65625036e-01, + -1.74758077e-01, -3.00524354e-01, -3.24885666e-01, + 2.96663642e-01, 1.62267685e-03, 3.47581506e-01, + -2.73707390e-01, -4.13872182e-01, -3.05231273e-01, + 3.94219518e-01, -3.12535048e-01, -4.01621819e-01, + -3.64959896e-01, 4.27148223e-01, 1.06967568e-01, + -4.11812901e-01, -3.93056989e-01, 4.32835698e-01, + 1.61758661e-02, -4.05543089e-01, -4.26084757e-01 ] + - [ -3.94366264e-01, 7.02243686e-01, 1.19943261e-01, + -5.54526985e-01, 3.10461044e-01, 5.91362834e-01, + 1.27429843e-01, -6.53823018e-01, 3.46575499e-01, + 4.88886595e-01, 1.29687548e-01, -3.57095957e-01, + 4.30995584e-01, 4.22528505e-01, 1.25000119e-01, + -3.24725926e-01, 4.28716302e-01, 4.06538844e-01, + 5.74992537e-01, 7.14014649e-01, 7.05286860e-01, + -4.37112451e-01, 3.61546159e-01, 6.84435606e-01, + 7.50288963e-01, -7.13230669e-01, 4.72879529e-01, + 4.02912617e-01, 7.45952725e-01, -9.78795290e-02, + 5.19379735e-01, 4.75302815e-01, 7.53731370e-01, + -8.41907263e-02, 4.79058504e-01, 4.56609845e-01 ] + - [ -5.20091176e-01, 2.88349986e-01, -5.60681224e-02, + -4.13685977e-01, -2.27860630e-01, -6.28769398e-03, + -5.83152175e-02, -4.21129942e-01, -2.17590809e-01, + -4.16419506e-02, -4.21874523e-02, -1.87165380e-01, + -1.57167315e-01, -1.37851834e-01, -4.68749404e-02, + -1.77276790e-01, -1.53530300e-01, -1.54961348e-01, + 3.20108175e-01, 2.22863674e-01, 4.39820051e-01, + -3.32549691e-01, -2.13408172e-01, -6.48716688e-02, + 4.58959460e-01, -3.61976981e-01, -1.87067986e-01, + -1.06094003e-01, 4.94395971e-01, 7.00154305e-02, + -1.75549388e-01, -1.55156493e-01, 4.87562299e-01, + -5.64792752e-02, -1.50090814e-01, -1.97623134e-01 ] + - [ 1., 9.94790316e-01, 9.78708267e-01, -9.95977819e-01, + 9.89872336e-01, 9.88604188e-01, 9.76961970e-01, + -9.78070438e-01, 9.89091277e-01, 1., 9.89062548e-01, + -4.83053505e-01, 9.89990830e-01, 9.96112347e-01, + 9.79687452e-01, -4.43482399e-01, 9.93149877e-01, + 9.86756921e-01, 8.37691665e-01, 9.93937492e-01, 9.48256493e-01, + -9.73185122e-01, 9.85790253e-01, 7.56471157e-01, + 9.86127019e-01, -9.58619177e-01, 9.62677002e-01, + 7.33296037e-01, 9.57658529e-01, -5.05876541e-02, + 9.42809820e-01, 9.81771469e-01, 9.55223918e-01, + -1.14515066e-01, 9.29674864e-01, 9.19620633e-01 ] + - [ -5.00621378e-01, 1.88227892e-02, -7.87793398e-02, + -3.46211135e-01, -4.86473143e-01, -3.12091649e-01, + -9.71922278e-02, -2.02921391e-01, -5.15916467e-01, + -2.84298360e-01, -4.53124642e-02, -2.54181206e-01, + -4.23274517e-01, -4.73911583e-01, -5.46874404e-02, + -2.22342014e-02, -4.66205359e-01, -4.25406039e-01, + 3.96453261e-01, -1.61164999e-03, 2.62092233e-01, + -4.10841703e-02, -4.48644042e-01, -1.02177560e-01, + 3.91907454e-01, -2.37116814e-02, -4.92248297e-01, + -2.19263494e-01, 5.39227962e-01, -1.58586025e-01, + -3.84801090e-01, -5.03744483e-01, 5.09950161e-01, + -1.13425910e-01, -3.94291878e-01, -4.79328811e-01 ] + - [ -4.89850938e-01, 2.64842510e-01, -5.74875474e-02, + -2.27620780e-01, -2.81927168e-01, 1.02878571e-01, + -1.65587068e-02, -4.76204276e-01, -2.36918807e-01, + -1.14064276e-01, -4.68742847e-03, -3.22202384e-01, + -1.59715474e-01, -2.21284032e-01, -1.56250000e-02, + -1.33872807e-01, -1.95837498e-01, -1.74380183e-01, + 4.77006316e-01, 2.69483566e-01, 4.93813396e-01, 1.09794140e-02, + -2.70115137e-01, 2.90375948e-01, 6.16184831e-01, + -5.41215599e-01, -1.13529861e-01, -1.83272541e-01, + 6.46326184e-01, -1.67111456e-01, -8.11907053e-02, + -2.04046428e-01, 6.21890426e-01, -1.13268316e-01, + -1.00190282e-01, -1.77390695e-01 ] + - [ -3.02402675e-01, 7.84287810e-01, 2.16465592e-01, + -8.01233411e-01, 5.02290606e-01, 5.56757450e-01, + 2.09503293e-01, -7.72720337e-01, 5.02110720e-01, + 5.65596581e-01, 2.15625048e-01, -3.92493486e-01, + 5.48002362e-01, 5.32550693e-01, 2.09375024e-01, + -3.59456122e-01, 5.52739143e-01, 5.23507953e-01, + 6.08656406e-01, 7.71600485e-01, 7.63779521e-01, + -7.06507981e-01, 5.32863736e-01, 5.31141162e-01, + 7.66473889e-01, -6.62973523e-01, 5.38556814e-01, + 5.62237740e-01, 7.73349881e-01, -5.61847687e-02, + 5.68790317e-01, 5.64720511e-01, 7.86069751e-01, + -1.38412714e-02, 5.33328414e-01, 5.73776126e-01 ] + - [ -5.43703437e-01, 3.11288834e-02, -1.46912694e-01, + -1.44598305e-01, -5.35296023e-01, -2.12747633e-01, + -1.61987007e-01, -3.20731997e-02, -5.47852099e-01, + -1.94531024e-01, -1.31249964e-01, -8.00057054e-02, + -4.30177569e-01, -3.95296574e-01, -1.34374976e-01, + -7.21251965e-02, -4.28833425e-01, -4.10846829e-01, + 2.74421453e-01, 3.01618576e-02, 2.77840257e-01, + -6.95978403e-02, -4.57252502e-01, -1.50793254e-01, + 3.24855447e-01, -3.32146287e-02, -4.73756611e-01, + -1.99787676e-01, 3.47447038e-01, 2.09854841e-02, + -3.54082823e-01, -3.80901396e-01, 3.48258853e-01, + -6.68382645e-03, -3.62731040e-01, -3.94787908e-01 ] + - [ -4.19428349e-01, 6.54870152e-01, 8.87154341e-02, + -6.81144655e-01, 3.01228881e-01, 4.27549362e-01, + 7.70338774e-02, -6.30645216e-01, 2.97421336e-01, + 4.45697665e-01, 8.12500715e-02, -3.49529147e-01, + 3.72459412e-01, 3.58899236e-01, 8.28125477e-02, + -2.84892499e-01, 3.58481169e-01, 3.56101990e-01, + 6.68169498e-01, 6.62116647e-01, 7.54780769e-01, + -4.30737793e-01, 2.93887615e-01, 5.95205784e-01, + 7.59537458e-01, -4.80300844e-01, 3.39776874e-01, + 5.34626961e-01, 7.95765877e-01, -1.38168275e-01, + 4.58346367e-01, 3.79055977e-01, 7.73631930e-01, + -1.82299912e-01, 4.61763024e-01, 3.61317039e-01 ] + - [ -4.42212164e-01, 2.82552958e-01, 4.04541492e-02, + -5.42379975e-01, -2.20384657e-01, -1.13794088e-01, + 3.23975086e-02, -5.27471423e-01, -2.18100429e-01, + -1.30248487e-01, 4.21875715e-02, -2.86567926e-01, + -1.68911397e-01, -2.07875013e-01, 3.90625000e-02, + -2.48171747e-01, -1.71778917e-01, -2.15497911e-01, + 3.93447518e-01, 1.96271062e-01, 5.11811018e-01, + -3.92224371e-01, -2.29458928e-01, -1.52808309e-01, + 5.30635715e-01, -4.45010960e-01, -2.17841923e-01, + -2.30988741e-01, 5.76587796e-01, -1.35069489e-02, + -2.19469726e-01, -2.53833294e-01, 5.69651842e-01, + -7.74739385e-02, -2.10577130e-01, -2.71286428e-01 ] + - [ -5.45360446e-01, 2.74785757e-02, -1.36976659e-01, + -1.48419261e-01, -5.37047029e-01, -2.19183028e-01, + -1.40388727e-01, -1.79262042e-01, -5.16468406e-01, + -2.66458869e-01, -1.03124976e-01, -6.91615939e-02, + -4.46438015e-01, -4.07814682e-01, -1.15625024e-01, + -1.03272438e-01, -4.29067075e-01, -4.27319050e-01, + 1.46979094e-01, 3.28812599e-02, 2.48593926e-01, + -1.96247578e-01, -4.11950707e-01, -2.23554313e-01, + 2.60115504e-01, -2.39729047e-01, -3.69827032e-01, + -2.56030381e-01, 3.02615166e-01, 1.55851841e-02, + -3.40903461e-01, -3.71071517e-01, 3.03482652e-01, + -1.00005567e-01, -3.22672069e-01, -4.05859828e-01 ] + - [ -4.97514546e-01, 4.74797845e-01, -9.22638178e-03, + -6.24661922e-01, 5.39990664e-02, 1.60686255e-01, + -3.59964371e-03, -6.81931853e-01, 7.89319277e-02, + 1.06901646e-01, -3.12495232e-03, -3.27757299e-01, + 1.04521513e-01, 6.77890778e-02, -9.37497616e-03, + -3.10283542e-01, 1.12996578e-01, 5.56932688e-02, + 4.64983463e-01, 4.17399764e-01, 5.59055209e-01, + -3.74979258e-01, 9.34982300e-03, 2.26022840e-01, + 6.13872766e-01, -5.62742352e-01, 8.84661674e-02, + 6.13691807e-02, 6.46326184e-01, -3.85217071e-02, + 6.56366348e-02, 3.43825817e-02, 6.49253607e-01, + -1.29072309e-01, 7.44991302e-02, -6.21157885e-03 ] + - [ -4.92957771e-01, -9.94431973e-03, -1.32718265e-01, + 5.08933067e-02, -5.90582132e-01, -1.27863228e-01, + -1.25989914e-01, -2.39057422e-01, -5.12479424e-01, + -3.07644069e-01, -3.74999642e-02, -2.93170154e-01, + -4.50344503e-01, -5.21368980e-01, -6.09374642e-02, + -2.36614764e-01, -4.45235968e-01, -5.11277020e-01, + 4.86624599e-01, 3.73102427e-02, 3.43082070e-01, 1.38425231e-01, + -4.72021222e-01, 8.14940929e-02, 4.12716627e-01, + -9.87443328e-02, -4.03834820e-01, -1.51511788e-01, + 6.11456990e-01, -3.69132459e-01, -2.76879311e-01, + -5.05378962e-01, 5.97014785e-01, -3.54031384e-01, + -2.84512043e-01, -4.90332305e-01 ] + - [ -4.94614780e-01, -3.32144499e-02, -9.29737687e-02, + -2.84065902e-01, -5.44247150e-01, -3.45717907e-01, + -1.46148205e-01, -4.45019603e-02, -5.76090455e-01, + -2.51747012e-01, -7.81249404e-02, -2.51678467e-01, + -4.56957281e-01, -5.10574579e-01, -8.28124881e-02, + -3.41317654e-02, -4.97542381e-01, -4.69035208e-01, + 4.70994830e-01, -3.10742855e-03, 3.43082070e-01, + -1.33481681e-01, -4.39365387e-01, -1.92233145e-01, + 3.94219518e-01, 7.61413574e-02, -5.09242296e-01, + -1.42600179e-01, 5.06849289e-01, -2.01682448e-01, + -3.44077706e-01, -4.87179399e-01, 5.32338381e-01, + -2.02740908e-01, -3.60151172e-01, -4.89349246e-01 ] + - [ 4.43247676e-01, 9.06053543e-01, 5.71327090e-01, + -9.27218437e-01, 7.83630490e-01, 7.89343357e-01, + 5.59395194e-01, -9.26438391e-01, 7.91278720e-01, + 7.85937428e-01, 5.73437452e-01, -4.74499047e-01, + 8.12611461e-01, 7.84906507e-01, 5.64062476e-01, + -4.23216701e-01, 8.08298588e-01, 7.77953863e-01, + 9.62128043e-01, 9.01220798e-01, 9.52755809e-01, + -8.70526373e-01, 8.16582561e-01, 6.93069458e-01, + 9.93063569e-01, -5.97620904e-01, 6.74366713e-01, + 8.72742176e-01, 9.72602606e-01, -1.34160161e-01, + 8.41944456e-01, 7.95486331e-01, 9.80099440e-01, + -2.11212099e-01, 8.45097184e-01, 7.45118380e-01 ] + - [ -4.63960290e-01, 3.04329515e-01, -1.06458664e-02, + -6.47526979e-02, -3.23911071e-01, 2.07481861e-01, + -1.94383860e-02, -4.92866039e-02, -3.10168445e-01, + 1.72369599e-01, 3.12507153e-03, -1.14461899e-01, + -1.54823244e-01, -8.72110724e-02, 6.25002384e-03, + -9.17686224e-02, -1.59279108e-01, -1.04106247e-01, + 6.08055353e-01, 4.27189589e-01, 6.15298033e-01, + -4.87822294e-03, -1.23292506e-01, 5.36619544e-01, + 6.32369876e-01, -7.42302537e-02, -8.70277286e-02, + 4.13950562e-01, 7.11083412e-01, -2.45279729e-01, + 1.59197569e-01, -1.18513703e-02, 7.13930368e-01, + -2.85631180e-01, 1.57435894e-01, -2.46264935e-02 ] + - [ -4.76180673e-01, 5.99450827e-01, 3.05180550e-02, + -8.08049798e-01, 2.79885769e-01, 2.52600193e-01, + 2.23183632e-02, -8.01861405e-01, 2.86353707e-01, + 2.47472048e-01, 2.34376192e-02, -3.59487891e-01, + 2.97609687e-01, 2.62944102e-01, 1.25000477e-02, + -3.05659294e-01, 2.95827508e-01, 2.64378667e-01, + 4.65584517e-01, 4.78933811e-01, 5.88301539e-01, + -5.91370106e-01, 1.66715145e-01, 1.67391539e-01, + 6.16184831e-01, -6.51777864e-01, 1.85317159e-01, + 8.48997831e-02, 6.23910308e-01, 6.30962849e-02, 1.41158938e-01, + 1.91075921e-01, 6.16915345e-01, 8.30698013e-03, 1.48431301e-01, + 1.68201804e-01 ] + - [ -4.83430028e-01, 1.63600326e-01, -8.72959495e-02, + -1.82503581e-01, -3.75018597e-01, 4.78672981e-03, + -8.13534260e-02, -3.96010876e-01, -3.13060284e-01, + -1.51450455e-01, -2.34375000e-02, -3.54501963e-01, + -2.59199619e-01, -3.48270535e-01, -3.59374881e-02, + -2.86871552e-01, -2.60844648e-01, -3.39141130e-01, + 5.69582224e-01, 1.67798162e-01, 4.64566946e-01, + -7.83795118e-03, -3.22476447e-01, 1.69083357e-01, + 5.37572145e-01, -2.05053985e-01, -2.68764675e-01, + -4.83946800e-02, 6.96139336e-01, -3.18876565e-01, + -1.58487499e-01, -3.67051601e-01, 6.71641827e-01, + -3.13709915e-01, -1.61222041e-01, -3.52310359e-01 ] + - [ -4.79080379e-01, 2.95535326e-02, -6.60042763e-02, + 4.28755283e-01, -6.90092564e-01, 3.26400995e-02, + -6.83945417e-02, 4.01728272e-01, -6.67929769e-01, + -4.52256203e-02, -2.18750238e-02, 2.22349167e-03, + -4.75659132e-01, -4.03575897e-01, -2.96874642e-02, + -2.57365704e-02, -4.62459505e-01, -4.22283888e-01, + 5.14277101e-01, 2.96050906e-01, 4.98312712e-01, 1.40661240e-01, + -2.67727971e-01, 4.82866406e-01, 5.12138724e-01, + -1.56862140e-02, -2.08387554e-01, 2.80164838e-01, + 6.16438270e-01, -3.56175721e-01, 4.71913815e-02, + -1.98334455e-01, 6.36815906e-01, -3.99873972e-01, + 2.73166895e-02, -2.25231409e-01 ] + - [ 1., 9.94457126e-01, 9.65933204e-01, -1., 9.93205309e-01, + 9.86997366e-01, 9.69762564e-01, -9.83627975e-01, + 9.87233996e-01, 9.90891457e-01, 9.73437548e-01, + -4.76930320e-01, 9.89320874e-01, 1., 9.71875191e-01, + -4.58880723e-01, 9.98749137e-01, 9.79413509e-01, 1., + 9.87383246e-01, 1., -9.81846273e-01, 9.85774279e-01, + 7.50755787e-01, 1., -6.78797126e-01, 8.49282503e-01, 1., 1., + -1.12338960e-01, 9.73213792e-01, 9.57475781e-01, 1., + -1.42652392e-01, 9.57111120e-01, 9.24884200e-01 ] + - [ -4.50082839e-01, 6.78485394e-01, 7.45209455e-02, + -5.43723285e-01, 2.59418726e-01, 5.31753302e-01, + 8.27933550e-02, -8.35815847e-01, 3.69200826e-01, + 3.20662141e-01, 7.96874762e-02, -4.01812851e-01, + 3.93440843e-01, 3.42196584e-01, 7.81250000e-02, + -3.82502317e-01, 4.01377082e-01, 3.26905608e-01, + 5.52750230e-01, 6.54679179e-01, 7.07536578e-01, + -3.01283121e-01, 2.11724997e-01, 6.60281897e-01, + 7.52601027e-01, -9.14528906e-01, 4.70026493e-01, + 1.45201921e-01, 7.58405924e-01, -1.98739588e-01, + 4.38553452e-01, 3.08655739e-01, 7.46268630e-01, + -2.43555784e-01, 4.47056770e-01, 2.98009396e-01 ] + - [ -5.21126807e-01, 2.17633963e-01, -4.04542685e-02, + -5.61519265e-01, -2.66891181e-01, -1.96467638e-01, + -5.39957285e-02, -5.22225142e-01, -2.61740685e-01, + -1.87585473e-01, -4.68749404e-02, -1.89491868e-01, + -2.33603001e-01, -2.27088034e-01, -4.84374166e-02, + -1.88339412e-01, -2.31395364e-01, -2.49806285e-01, + 2.21520901e-01, 5.94123602e-02, 3.79077554e-01, + -3.27989757e-01, -3.87533545e-01, -3.21053088e-01, + 3.45664620e-01, -2.15499222e-01, -3.88176143e-01, + -2.53081262e-01, 4.07222867e-01, 1.63435936e-01, + -3.84045184e-01, -3.29685152e-01, 4.10447836e-01, + 5.31828403e-03, -3.54532778e-01, -3.78318310e-01 ] + - [ 1., 9.95014787e-01, 9.68772054e-01, -9.95581031e-01, + 9.92106557e-01, 9.91265774e-01, 9.66882586e-01, + -9.98177826e-01, 9.98067498e-01, 9.87366557e-01, + 9.75000143e-01, -5.01023054e-01, 1., 9.91765499e-01, + 9.74999905e-01, -4.42543328e-01, 9.91620183e-01, + 9.85675573e-01, 9.30868626e-01, 9.88911629e-01, 9.64004397e-01, + -6.96689010e-01, 8.38364005e-01, 1., 9.83814836e-01, -1., 1., + 7.20947504e-01, 9.82565403e-01, -1.35777295e-01, + 9.80995297e-01, 9.43203688e-01, 9.60198879e-01, + -2.04534471e-01, 1., 9.13147211e-01 ] + - [ 1., 9.70505476e-01, 7.82824755e-01, -9.72959638e-01, + 9.23152089e-01, 9.21952128e-01, 8.01295877e-01, + -9.65643883e-01, 9.18933749e-01, 9.16658640e-01, + 7.93750048e-01, -4.95449781e-01, 9.34217215e-01, + 9.14894938e-01, 7.81250238e-01, -4.20365930e-01, + 9.24321532e-01, 9.21314240e-01, 8.20859551e-01, 9.68497396e-01, + 9.30258632e-01, -9.33297217e-01, 9.22291160e-01, + 7.32935667e-01, 9.67629910e-01, -9.57329631e-01, + 9.27067518e-01, 6.87002182e-01, 9.42714810e-01, + -3.91308665e-02, 8.97035122e-01, 9.42145109e-01, + 9.35323358e-01, -5.74010611e-02, 8.87648463e-01, + 9.25477266e-01 ] + - [ -4.38898146e-01, 6.16393685e-01, 8.44570398e-02, + -7.24002957e-01, 2.45416164e-01, 3.07432413e-01, + 7.70338774e-02, -7.51968503e-01, 2.72065043e-01, + 2.86504269e-01, 8.28125477e-02, -3.14589798e-01, + 2.83634543e-01, 2.84789443e-01, 7.65625238e-02, + -2.90112853e-01, 2.88790226e-01, 2.72774100e-01, + 4.31319475e-01, 5.05671620e-01, 5.99550128e-01, + -5.13646722e-01, 1.32947087e-01, 2.24575281e-01, + 6.18496895e-01, -5.41991413e-01, 1.52308226e-01, + 1.73796535e-01, 6.41344786e-01, 5.16102314e-02, 1.56567335e-01, + 1.99607253e-01, 6.26865745e-01, 1.22015715e-01, 1.17987394e-01, + 2.18927383e-01 ] + - [ -4.52361286e-01, 6.24524593e-01, 6.03264570e-02, + -6.36287570e-01, 2.37876058e-01, 3.93828392e-01, + 6.11951351e-02, -6.10829473e-01, 2.27404952e-01, + 3.74093652e-01, 7.03125000e-02, -3.31023932e-01, + 3.01471710e-01, 2.91911840e-01, 6.25000000e-02, + -2.83640981e-01, 3.05137277e-01, 2.95346022e-01, + 5.73790193e-01, 6.00653887e-01, 7.34533191e-01, + -6.00273848e-01, 2.66263247e-01, 3.09392571e-01, + 7.29479671e-01, -4.56867158e-01, 2.21879959e-01, + 3.91894102e-01, 7.63387203e-01, -6.21897578e-02, + 3.22072268e-01, 2.93891311e-01, 7.16418028e-01, + -2.59828568e-02, 3.16824198e-01, 3.27107430e-01 ] + - [ -4.48011637e-01, 3.83342266e-01, -2.12919712e-03, + -3.85765851e-01, -9.76043344e-02, 2.09163666e-01, + -7.19904900e-04, -4.85205293e-01, -7.34933019e-02, + 9.73056555e-02, 1.87500715e-02, -3.53552699e-01, + 1.34526491e-02, -4.92332578e-02, 2.03125477e-02, + -2.71229148e-01, -3.59743834e-03, -4.47323918e-02, + 5.75593591e-01, 3.27230811e-01, 5.18560171e-01, + -1.38716578e-01, -1.22425795e-01, 3.39816093e-01, + 6.16184831e-01, -3.11373889e-01, -9.25585032e-02, + 1.02149010e-01, 6.76214218e-01, -2.93073952e-01, + 4.38067913e-02, -1.58881009e-01, 6.59204125e-01, + -2.57988930e-01, 2.98681259e-02, -1.35002077e-01 ] + - [ -4.65617239e-01, 6.11695886e-01, 5.89070320e-02, + -6.99583650e-01, 2.31981158e-01, 3.14871073e-01, + 4.82362509e-02, -6.95499539e-01, 2.40076423e-01, + 3.01201224e-01, 5.31250238e-02, -3.29607248e-01, + 2.84993887e-01, 2.73199916e-01, 4.37500477e-02, + -2.96581805e-01, 2.86942482e-01, 2.63579965e-01, + 4.66185808e-01, 5.44419885e-01, 6.31046176e-01, + -5.94295979e-01, 2.13726640e-01, 2.33219385e-01, + 6.64739847e-01, -6.15198433e-01, 2.24411249e-01, + 1.86417818e-01, 6.68742180e-01, 5.63888550e-02, 2.13984966e-01, + 2.67244220e-01, 6.74129248e-01, -1.38747096e-02, + 2.10608721e-01, 2.20429659e-01 ] + - [ -2.17067122e-01, 8.06351304e-01, 2.67565608e-01, + -8.21802318e-01, 5.48576713e-01, 5.95657825e-01, + 2.67098665e-01, -8.17676127e-01, 5.51102757e-01, + 5.83252549e-01, 2.65625119e-01, -4.07292366e-01, + 5.92642426e-01, 5.74281096e-01, 2.64062405e-01, + -3.90092134e-01, 5.98116994e-01, 5.52744150e-01, + 6.75984383e-01, 7.71505475e-01, 7.99775004e-01, + -7.05534101e-01, 5.45304894e-01, 5.54173589e-01, + 8.38150144e-01, -7.38036573e-01, 5.49047589e-01, + 4.81841922e-01, 8.08219075e-01, 8.39247704e-02, 5.35957813e-01, + 6.51584744e-01, 8.30845833e-01, -4.35336232e-02, + 5.43482780e-01, 5.61147690e-01 ] + - [ -4.83844280e-01, 1.66458368e-01, -9.58126187e-02, + -1.57535315e-01, -3.74509990e-01, 3.08516026e-02, + -7.84736872e-02, -2.72123516e-01, -3.58750224e-01, + -1.09211802e-01, -3.43749523e-02, -3.44539344e-01, + -2.49153912e-01, -3.32679212e-01, -3.90624404e-02, + -2.20352292e-01, -2.68705666e-01, -3.09815288e-01, + 4.65584517e-01, 1.57457352e-01, 3.65579247e-01, 1.33241415e-02, + -3.03884029e-01, 2.30386496e-01, 4.77456570e-01, + -2.27158964e-01, -2.66159177e-01, -7.23500252e-02, + 5.99003673e-01, -3.86836708e-01, -1.25731945e-01, + -3.78367841e-01, 5.57214022e-01, -2.94263005e-01, + -1.54537082e-01, -3.39462936e-01 ] + - [ -5.16984224e-01, 2.08624482e-01, -8.30376148e-02, + -3.41381073e-01, -3.19054544e-01, -6.66418076e-02, + -1.00071967e-01, -2.33100832e-01, -3.35230470e-01, + -4.02099490e-02, -7.18749166e-02, -1.48952484e-01, + -2.40740836e-01, -2.11995482e-01, -7.65624642e-02, + -1.33558869e-01, -2.37267733e-01, -2.24249542e-01, + 3.33333373e-01, 1.39081836e-01, 3.72328520e-01, + -1.42823100e-01, -3.51921916e-01, -5.73104620e-02, + 4.12716627e-01, -1.22721493e-01, -3.59737515e-01, + -1.06319487e-01, 4.37110782e-01, 5.30153513e-02, + -2.60543168e-01, -2.59662807e-01, 4.37810779e-01, + 7.05838203e-03, -2.61121988e-01, -2.77575910e-01 ] + - [ -4.35584128e-01, 7.19334245e-01, 9.01348591e-02, + -6.99052513e-01, 3.85887861e-01, 5.16386986e-01, + 8.99927616e-02, -7.79405951e-01, 4.15050983e-01, + 4.37025666e-01, 9.37500000e-02, -4.25806642e-01, + 4.70285177e-01, 4.10335183e-01, 8.28125477e-02, + -3.15831840e-01, 4.51270580e-01, 4.36292887e-01, + 5.81604958e-01, 7.08307385e-01, 7.18785167e-01, + -5.27112722e-01, 3.97516489e-01, 6.01560235e-01, + 7.73410320e-01, -7.62636840e-01, 4.80980277e-01, + 3.51544023e-01, 7.68368483e-01, -9.48553085e-02, + 5.01817465e-01, 4.59807396e-01, 7.56218791e-01, + -6.31073117e-02, 4.67851758e-01, 4.61659551e-01 ] + - [ 1., 1., 9.57416534e-01, -9.87720549e-01, 9.85221386e-01, + 9.91780758e-01, 9.61123228e-01, -9.83930349e-01, + 9.91574287e-01, 9.95401621e-01, 9.62500095e-01, + -4.90639567e-01, 9.94468451e-01, 9.93836999e-01, + 9.48437452e-01, -4.35872376e-01, 9.96802688e-01, + 9.96434450e-01, 8.63540769e-01, 1., 9.55005646e-01, + -9.55066383e-01, 9.78340983e-01, 7.75943398e-01, + 9.90751266e-01, -9.62630510e-01, 9.80592608e-01, + 7.51117468e-01, 9.72602606e-01, -9.40873623e-02, + 9.63848948e-01, 9.63771462e-01, 9.55223918e-01, + -1.08252347e-01, 9.57871437e-01, 9.55663681e-01 ] + - [ 1., 9.78763223e-01, 7.85663605e-01, -9.84951913e-01, + 9.34648871e-01, 9.21599865e-01, 7.86897063e-01, + -9.75663006e-01, 9.35500741e-01, 9.24658656e-01, + 7.89062500e-01, -4.56021309e-01, 9.29939389e-01, + 9.43149328e-01, 7.84374952e-01, -4.58290100e-01, + 9.44409609e-01, 9.11252022e-01, 8.22061896e-01, 9.67205644e-01, + 9.34758067e-01, -9.37967420e-01, 9.13730621e-01, + 7.15267897e-01, 9.53757048e-01, -9.51332748e-01, + 9.24912453e-01, 6.90827012e-01, 9.27770734e-01, + -2.10748911e-02, 8.97851586e-01, 9.59768653e-01, + 9.27860618e-01, -8.85136724e-02, 8.94483089e-01, + 9.04472470e-01 ] + - [ -5.06006598e-01, 2.97384024e-01, -4.04542685e-02, + -3.02975059e-01, -2.59000659e-01, 6.00912571e-02, + -6.11951351e-02, -1.94706380e-01, -2.66216040e-01, + 9.94689465e-02, -2.96874642e-02, -1.53092384e-01, + -1.54254794e-01, -1.12407148e-01, -3.43749523e-02, + -9.65618491e-02, -1.59697771e-01, -1.09187365e-01, + 3.60985875e-01, 3.38224888e-01, 4.73565817e-01, + -2.53517568e-01, -1.35166347e-01, 1.58532262e-01, + 4.82080936e-01, -9.84250903e-02, -1.70256376e-01, + 2.36530066e-01, 5.44209123e-01, -3.54413986e-02, + -2.42342353e-02, -6.17516637e-02, 5.37313461e-01, + -1.25350952e-02, -4.61729765e-02, -5.81235886e-02 ] + - [ -2.00704217e-01, 7.31739163e-01, 2.77501702e-01, + -7.53973544e-01, 4.33524132e-01, 5.30073643e-01, + 2.68538475e-01, -6.62241697e-01, 4.14074898e-01, + 5.78514218e-01, 2.90624976e-01, -3.81720424e-01, + 4.85383511e-01, 4.74621773e-01, 2.78125048e-01, + -3.49564493e-01, 4.86262441e-01, 4.60896850e-01, + 6.69972897e-01, 7.18476892e-01, 7.77277946e-01, + -6.22598648e-01, 4.38400030e-01, 5.24466515e-01, + 7.59537458e-01, -4.44549263e-01, 3.92793894e-01, + 6.63424730e-01, 8.10709715e-01, -5.32749295e-02, + 5.02438426e-01, 4.96506095e-01, 7.96019912e-01, + -1.68099642e-01, 5.40444970e-01, 4.55438733e-01 ] + - [ -4.53396857e-01, 2.08724260e-01, -5.60681224e-02, + 1.98527813e-01, -4.38585460e-01, 2.98880458e-01, + 1.22389793e-02, -6.11733496e-01, -2.52330244e-01, + -2.43760288e-01, 3.75000238e-02, -5.00036120e-01, + -1.87708497e-01, -3.48822951e-01, 3.28125954e-02, + -3.07655573e-01, -2.29039848e-01, -3.13154399e-01, + 5.46738863e-01, 1.60802484e-01, 4.89313841e-01, 6.39335155e-01, + -5.64564943e-01, 5.77615976e-01, 5.67630053e-01, + -6.38297558e-01, -1.64827406e-01, -3.47330868e-01, + 6.86176777e-01, -6.11244321e-01, -8.68703723e-02, + -4.59925711e-01, 6.79104328e-01, -5.34105420e-01, + -1.28048182e-01, -4.37452137e-01 ] + - [ -4.27920520e-01, 7.65403152e-01, 1.12846017e-01, + -7.90046036e-01, 4.71327543e-01, 5.20135880e-01, + 1.04391694e-01, -7.85334527e-01, 4.83806968e-01, + 5.17923594e-01, 1.07812524e-01, -3.83435726e-01, + 5.21557093e-01, 5.02584219e-01, 1.00000024e-01, + -3.51123691e-01, 5.23012400e-01, 4.89358068e-01, + 5.55154800e-01, 7.63492703e-01, 7.52530932e-01, + -7.42670476e-01, 5.34927368e-01, 4.79639530e-01, + 7.41040349e-01, -6.46262407e-01, 5.12590647e-01, + 5.46780109e-01, 7.63387203e-01, -9.22715664e-02, + 5.72281122e-01, 5.37166476e-01, 7.68656611e-01, + -9.03273225e-02, 5.45406580e-01, 5.23012042e-01 ] + - [ -3.38442445e-01, 8.01584721e-01, 1.98012710e-01, + -8.15974832e-01, 5.52686810e-01, 6.00778103e-01, + 1.96544290e-01, -8.03182423e-01, 5.45600891e-01, + 5.85376143e-01, 1.98437452e-01, -4.42571342e-01, + 6.05578542e-01, 5.55861354e-01, 1.92187428e-01, + -3.87638748e-01, 6.02853537e-01, 5.55222869e-01, + 6.21881604e-01, 8.00054550e-01, 7.93025851e-01, + -7.92472661e-01, 6.11333966e-01, 5.15013695e-01, + 8.15028787e-01, -7.20633149e-01, 5.87953210e-01, + 5.55071592e-01, 8.20672393e-01, -8.35992098e-02, + 6.19209647e-01, 5.96777081e-01, 8.13432693e-01, + -4.87726927e-03, 5.82157135e-01, 6.35308146e-01 ] + - [ -4.65617239e-01, 4.59460855e-01, 7.80689716e-03, + -5.02514184e-01, 4.19211388e-03, 2.26052165e-01, + 2.08783150e-02, -5.03671825e-01, 2.38752365e-02, + 2.11450100e-01, 3.28125954e-02, -3.25729609e-01, + 7.56889582e-02, 3.92247438e-02, 3.75000238e-02, + -3.72864366e-01, 9.84263420e-02, -6.72399998e-04, + 6.73579812e-01, 4.43970442e-01, 6.76040530e-01, + -3.37801754e-01, 2.79198885e-02, 3.13933134e-01, + 6.92485452e-01, -3.84575427e-01, 9.55860615e-02, + 2.97677994e-01, 7.80821919e-01, -1.72057867e-01, + 1.59862638e-01, 4.23545837e-02, 7.73631930e-01, + -3.02697361e-01, 1.85799956e-01, -5.61124086e-03 ] + - [ 1., 9.93027210e-01, 9.67352748e-01, -9.90167320e-01, + 9.86249447e-01, 9.90622282e-01, 9.62562919e-01, + -9.90365863e-01, 9.94288325e-01, 9.91431832e-01, + 9.84375000e-01, -4.87857580e-01, 9.83616590e-01, + 9.84631062e-01, 9.65624928e-01, -4.18098271e-01, + 9.77823377e-01, 9.90982294e-01, 8.43101859e-01, 9.93513465e-01, + 9.57255483e-01, -9.71878529e-01, 9.69636083e-01, + 7.38973379e-01, 9.74566340e-01, -9.91596460e-01, + 9.87447262e-01, 7.15768576e-01, 9.35242772e-01, + -7.83981681e-02, 9.67076302e-01, 9.81071115e-01, + 9.27860618e-01, -2.97825336e-02, 9.32808042e-01, 1. ] + - [ 1., 9.96204138e-01, 9.75869298e-01, -9.86127913e-01, + 9.87274647e-01, 9.97386336e-01, 9.72642303e-01, -1., 1., + 9.87994552e-01, 9.70312595e-01, -4.89046335e-01, + 9.97003675e-01, 9.98350859e-01, 9.73437548e-01, + -4.45162475e-01, 9.93026972e-01, 9.84933853e-01, + 8.74361277e-01, 9.95082736e-01, 9.52755809e-01, + -9.63872612e-01, 9.97335792e-01, 7.86591053e-01, + 9.81502891e-01, -9.73580480e-01, 9.89748001e-01, + 7.45661616e-01, 9.62640166e-01, -5.72590232e-02, + 9.63882685e-01, 9.98568773e-01, 9.60198879e-01, + -6.58912659e-02, 9.25670981e-01, 9.59709406e-01 ] + - [ -4.91507888e-01, 1.01641655e-01, -9.15543437e-02, + -9.14036632e-02, -4.81270492e-01, -7.67253637e-02, + -7.70337582e-02, -1.26474023e-01, -4.45838988e-01, + -1.13658547e-01, -1.87499523e-02, -1.92090750e-01, + -3.62983704e-01, -3.74279320e-01, -1.87499523e-02, + -3.22085261e-01, -3.23302686e-01, -4.23749149e-01, + 3.54373217e-01, 1.24444604e-01, 3.58830214e-01, + -4.00543213e-04, -3.80698919e-01, 7.20865726e-02, + 3.24855447e-01, -1.18159115e-01, -2.81144321e-01, + 2.22686529e-02, 4.62017417e-01, -1.97433293e-01, + -1.79948151e-01, -3.27169061e-01, 5.17412901e-01, + -4.23245549e-01, -1.58226609e-01, -4.14407730e-01 ] + - [ 3.10683250e-03, 8.50395083e-01, 4.12349105e-01, + -8.39218020e-01, 6.51747584e-01, 7.17633724e-01, + 4.11087155e-01, -8.50028038e-01, 6.64015651e-01, + 7.01336503e-01, 4.14062500e-01, -4.19308245e-01, + 6.97384357e-01, 6.91724300e-01, 4.10937667e-01, + -3.69885445e-01, 6.93108916e-01, 6.85153008e-01, + 8.79170418e-01, 8.62721443e-01, 9.19010043e-01, + -7.77450562e-01, 7.16152191e-01, 6.95250392e-01, + 9.49132800e-01, -5.33767581e-01, 5.93487382e-01, + 8.46386790e-01, 9.47696090e-01, -9.79135633e-02, + 7.64036417e-01, 7.43770242e-01, 9.42786098e-01, + -1.75362110e-01, 7.60316968e-01, 6.85429811e-01 ] + - [ -5.05592406e-01, 1.47632003e-01, -7.59403706e-02, + -6.03460073e-02, -4.73960578e-01, -3.50701809e-02, + -9.71922278e-02, 8.67520571e-02, -4.77908373e-01, + 2.70831585e-02, -7.18749166e-02, -1.68242216e-01, + -3.13156724e-01, -3.06637347e-01, -7.18750358e-02, + -4.93156314e-02, -3.38938415e-01, -2.91166186e-01, + 5.12473702e-01, 2.78440833e-01, 5.16310573e-01, + -1.23899341e-01, -2.01379836e-01, 2.26052046e-01, + 5.00577927e-01, 4.88219261e-02, -2.44217277e-01, + 3.01551580e-01, 6.16438270e-01, -2.11480558e-01, + -3.30393910e-02, -1.84790432e-01, 6.44278646e-01, + -2.91695237e-01, -3.71589661e-02, -2.21810281e-01 ] + - [ -4.14043069e-01, 2.76169896e-01, 3.54862213e-03, + -1.67186737e-01, -2.85751998e-01, 1.59646630e-01, + -1.22389793e-02, -2.17742145e-01, -2.19553590e-01, + 1.47609830e-01, 7.18749762e-02, -4.86955106e-01, + -1.02537036e-01, -2.51701713e-01, 6.40624762e-02, + -3.08969080e-01, -1.37393415e-01, -2.13441193e-01, + 7.41508842e-01, 2.84377098e-01, 5.74803114e-01, + -1.10770166e-01, -1.68398261e-01, 3.02613616e-01, + 5.02890110e-01, 1.47533417e-02, -1.26978338e-01, + 4.63621616e-01, 8.20672393e-01, -6.96012020e-01, + 9.67952013e-02, -3.44520330e-01, 8.15920353e-01, + -5.90271950e-01, 4.43491936e-02, -3.10541153e-01 ] + - [ 1., 9.90784407e-01, 9.41802740e-01, -9.81577933e-01, + 9.79580641e-01, 9.91450310e-01, 9.42404628e-01, + -9.77336287e-01, 9.77194667e-01, 9.84104037e-01, + 9.51562643e-01, -4.75256443e-01, 9.80190277e-01, + 9.90245342e-01, 9.49999928e-01, -4.33745027e-01, + 9.76090431e-01, 9.74834085e-01, 8.39495063e-01, 9.90456939e-01, + 9.48256493e-01, -1., 9.95083690e-01, 7.27072835e-01, + 9.53757048e-01, -9.36215162e-01, 9.65834618e-01, + 7.65220165e-01, 9.52677369e-01, -4.59166169e-02, + 9.38776612e-01, 9.81677294e-01, 9.47761178e-01, + -1.07752800e-01, 9.38613653e-01, 9.35166478e-01 ] + - [ -4.67274308e-01, 2.01040983e-01, -3.76152992e-02, + -5.17795086e-02, -4.30503607e-01, 4.47267294e-02, + -6.98343515e-02, 2.24745393e-01, -4.65715945e-01, + 1.80821776e-01, 0., -7.41651654e-02, -2.84772336e-01, + -2.16509521e-01, -1.09374523e-02, -1.76580131e-01, + -2.49075115e-01, -2.60975540e-01, 5.08265734e-01, + 3.43415618e-01, 5.38807631e-01, -2.27807224e-01, + -1.26079321e-01, 2.11389899e-01, 4.70520258e-01, + 1.19489431e-01, -1.86845183e-01, 5.02829671e-01, + 6.33872986e-01, -2.13283122e-01, 5.20768166e-02, + -1.00355029e-01, 6.59204125e-01, -3.99574816e-01, + 7.72582293e-02, -1.77105725e-01 ] + - [ -2.33222902e-01, 7.48151660e-01, 2.61887908e-01, + -6.90105081e-01, 4.32702541e-01, 6.02500081e-01, + 2.57019520e-01, -6.95580840e-01, 4.45582390e-01, + 5.82096457e-01, 2.62499928e-01, -3.69097769e-01, + 5.07268310e-01, 5.07769823e-01, 2.62500048e-01, + -3.82207215e-01, 5.23466945e-01, 4.75571275e-01, + 7.12653995e-01, 7.76986361e-01, 7.86276698e-01, + -5.54079533e-01, 5.05722642e-01, 7.26365209e-01, + 8.35837960e-01, -6.53658688e-01, 5.38858056e-01, + 5.83727598e-01, 8.55541706e-01, -1.23828232e-01, + 6.25541806e-01, 5.69979310e-01, 8.48258734e-01, + -1.54987991e-01, 6.08129501e-01, 5.38928866e-01 ] + - [ -1.39188051e-01, 8.11719537e-01, 3.47054601e-01, + -8.47706437e-01, 5.91683149e-01, 6.26442432e-01, + 3.40532780e-01, -8.63300920e-01, 6.07566714e-01, + 6.10330462e-01, 3.46875072e-01, -4.47208881e-01, + 6.32221699e-01, 5.91727853e-01, 3.39062572e-01, + -4.05152500e-01, 6.31805301e-01, 5.82695961e-01, + 7.88397908e-01, 7.96442032e-01, 8.62767220e-01, + -7.20873475e-01, 5.92413664e-01, 6.03950620e-01, + 8.75144482e-01, -5.29913843e-01, 5.04140973e-01, + 7.14599609e-01, 8.87920141e-01, -1.68025732e-01, + 6.73897505e-01, 5.84396601e-01, 8.78109336e-01, + -2.20704734e-01, 6.81465030e-01, 5.62693596e-01 ] + - [ -2.91632175e-01, 7.03758955e-01, 2.16465592e-01, + -7.39518881e-01, 3.98936510e-01, 4.97425079e-01, + 2.13822842e-01, -7.71040380e-01, 4.18884873e-01, + 4.63163137e-01, 2.20312595e-01, -4.33076501e-01, + 4.68961000e-01, 4.12249923e-01, 2.20312476e-01, + -3.39806437e-01, 4.43108320e-01, 4.16720629e-01, + 6.90411687e-01, 6.60743594e-01, 7.45781779e-01, + -5.73067069e-01, 3.75933647e-01, 5.04584193e-01, + 7.66473889e-01, -4.82009232e-01, 3.34013224e-01, + 5.24493098e-01, 8.10709715e-01, -2.15490878e-01, + 4.79518652e-01, 3.39686751e-01, 8.00994873e-01, + -1.74384058e-01, 4.52751756e-01, 3.58999252e-01 ] + - [ 1., 9.95694876e-01, 9.88644361e-01, -9.97738779e-01, + 9.90092278e-01, 9.87289667e-01, 9.79841709e-01, + -9.98430490e-01, 9.98569012e-01, 9.88459468e-01, + 9.90625143e-01, -4.95330691e-01, 9.93552804e-01, + 9.89823103e-01, 9.79687452e-01, -4.16286588e-01, + 9.83412862e-01, 9.99411345e-01, 8.43101859e-01, 9.95751858e-01, + 9.43757057e-01, -9.70322371e-01, 9.85160351e-01, + 7.59409904e-01, 9.69942212e-01, -9.70266819e-01, + 9.88913655e-01, 7.47717142e-01, 9.55168128e-01, + -3.02091241e-02, 9.41744804e-01, 1., 9.50248480e-01, + -9.22977924e-02, 9.37833786e-01, 9.48489308e-01 ] + - [ 1., 9.36520457e-01, 6.80624485e-01, -9.21807170e-01, + 8.37761164e-01, 8.71454000e-01, 6.81785464e-01, + -9.23356056e-01, 8.45386624e-01, 8.65583062e-01, + 6.85937524e-01, -4.54421580e-01, 8.61877799e-01, + 8.62679243e-01, 6.85937524e-01, -4.26410258e-01, + 8.59122753e-01, 8.38262558e-01, 7.81785250e-01, 9.39345360e-01, + 8.98762703e-01, -8.19989800e-01, 8.25196266e-01, + 7.75251150e-01, 9.21387196e-01, -9.05356586e-01, + 8.70045185e-01, 6.81357145e-01, 9.07845378e-01, + -8.35801363e-02, 8.68707061e-01, 8.68669271e-01, + 8.98009896e-01, -1.40346169e-01, 8.67535710e-01, + 8.28159809e-01 ] + - [ -5.20505428e-01, 6.60959482e-02, -8.44570994e-02, + -6.90047741e-02, -5.43258846e-01, -1.59139335e-01, + -1.08711302e-01, 7.11559057e-02, -5.48753381e-01, + -1.09291077e-01, -5.78125119e-02, -7.08127022e-02, + -4.21930611e-01, -3.78644705e-01, -6.56250119e-02, + -5.52509427e-02, -4.18343306e-01, -3.87366772e-01, + 2.43763089e-01, 1.53914213e-01, 3.63329649e-01, + -2.07487345e-01, -3.18144560e-01, -8.12135935e-02, + 2.80924797e-01, 9.07684565e-02, -3.65833700e-01, + 1.34077191e-01, 4.42092061e-01, -1.53273165e-01, + -2.06347406e-01, -3.27982485e-01, 4.30348396e-01, + -1.22952759e-01, -2.25392580e-01, -3.16512406e-01 ] + - [ -5.03935397e-01, 2.91906476e-01, -3.47764492e-02, + -4.91194844e-01, -1.96428418e-01, -3.76729369e-02, + -4.10366654e-02, -5.25197268e-01, -1.75646424e-01, + -7.72495270e-02, -3.59374285e-02, -1.55535281e-01, + -1.50173962e-01, -1.09462678e-01, -4.21874523e-02, + -1.56129241e-01, -1.43689692e-01, -1.29880488e-01, + 3.13495636e-01, 1.74713016e-01, 4.21822309e-01, + -2.20728397e-01, -3.07247579e-01, -7.65897632e-02, + 4.54335213e-01, -2.88051724e-01, -2.72355318e-01, + -1.49875283e-01, 4.54545379e-01, 1.84098721e-01, + -2.68919945e-01, -1.85663283e-01, 4.60198998e-01, + 1.36733055e-01, -2.66058624e-01, -2.04217374e-01 ] + - [ -4.42212164e-01, 3.50121498e-01, 7.09652901e-04, + 9.62535143e-02, -3.03481340e-01, 4.22337532e-01, + 7.12742805e-02, -6.13242745e-01, -1.21122181e-01, + -7.64327645e-02, 6.87500238e-02, -3.83319139e-01, + -5.09182811e-02, -1.35450602e-01, 7.03125000e-02, + -2.86471486e-01, -7.13388920e-02, -1.26934528e-01, + 6.21280432e-01, 4.07138586e-01, 6.01799846e-01, 3.05132508e-01, + -2.44647920e-01, 7.83064127e-01, 7.15606928e-01, + -8.69731903e-01, 1.72794223e-01, -1.60517573e-01, + 7.40971327e-01, -4.48158920e-01, 1.97767019e-01, + -1.09505415e-01, 7.63681531e-01, -4.22614515e-01, + 1.57314062e-01, -1.11110628e-01 ] + - [ 1., 9.93859649e-01, 1., -9.83115196e-01, 9.80627418e-01, + 9.94257808e-01, 1., -9.87986565e-01, 9.89826202e-01, + 9.90828514e-01, 1., -4.88081694e-01, 9.96246696e-01, + 9.99349833e-01, 1., -4.07553613e-01, 9.76655960e-01, 1., + 9.38082218e-01, 9.90908265e-01, 9.77502823e-01, + -9.88086224e-01, 1., 7.56161690e-01, 9.95375514e-01, + -7.27625072e-01, 8.72741103e-01, 9.57366228e-01, + 9.77583885e-01, -1.48443162e-01, 1., 9.51452017e-01, + 9.57711220e-01, -1.75810575e-01, 9.98149633e-01, + 9.37161803e-01 ] + - [ 1., 9.97304201e-01, 9.70191598e-01, -9.97731805e-01, 1., + 9.98449564e-01, 9.78401780e-01, -9.90927398e-01, + 9.99937773e-01, 9.98688579e-01, 9.89062548e-01, + -4.90161598e-01, 9.96961355e-01, 9.98019099e-01, + 9.90624905e-01, -4.37744260e-01, 9.88577604e-01, + 9.86946940e-01, 8.35286975e-01, 9.99868393e-01, 9.59505081e-01, + -9.95339990e-01, 9.96331215e-01, 7.37554431e-01, + 9.81502891e-01, -9.78324234e-01, 9.86144543e-01, + 7.34214544e-01, 9.40224051e-01, -8.12388659e-02, + 9.72872019e-01, 9.84803557e-01, 9.45273399e-01, + -7.68705606e-02, 9.44246888e-01, 9.69433308e-01 ] + - [ -4.86951113e-01, -5.43962121e-02, -1.41234934e-01, + 7.13795781e-01, -7.67288923e-01, 1.53977394e-01, + -4.96760607e-02, -4.74146903e-01, -5.30308187e-01, + -4.97782528e-01, 1.09375715e-02, -5.69772363e-01, + -4.47923779e-01, -6.37079954e-01, 1.09375715e-02, + -3.08710277e-01, -4.94328082e-01, -5.92940331e-01, + 4.41538811e-01, 9.90176201e-03, 3.92575979e-01, 8.99058342e-01, + -7.40635753e-01, 4.80666637e-01, 4.42774534e-01, + -5.96109986e-01, -3.01768541e-01, -4.84735191e-01, + 6.11456990e-01, -7.95185685e-01, -2.01567113e-01, + -6.39753222e-01, 5.99502444e-01, -7.22188354e-01, + -2.35808909e-01, -6.16593242e-01 ] + - [ 1., 9.83244419e-01, 7.20368981e-01, -9.74076092e-01, + 9.31378961e-01, 9.26266074e-01, 7.27861762e-01, + -9.52652395e-01, 9.25861597e-01, 9.35071468e-01, + 7.34375119e-01, -4.95002270e-01, 9.44874167e-01, + 9.24747467e-01, 7.29687691e-01, -4.48595285e-01, + 9.41687226e-01, 9.14206982e-01, 8.23264122e-01, 9.85479474e-01, + 9.43757057e-01, -9.40404952e-01, 9.43718553e-01, + 7.51904249e-01, 9.72254157e-01, -9.60536063e-01, + 9.59985256e-01, 7.25117564e-01, 9.45205331e-01, + -7.27916956e-02, 9.34474707e-01, 9.51253414e-01, + 9.20397878e-01, -1.05045855e-01, 9.48862195e-01, + 9.47887659e-01 ] + - [ -6.31731153e-02, 8.26896429e-01, 3.83960247e-01, + -8.40884507e-01, 6.14465594e-01, 6.66313767e-01, + 3.69330525e-01, -8.00514042e-01, 6.13635778e-01, + 6.89770341e-01, 3.89062643e-01, -5.04132509e-01, + 6.85564756e-01, 6.08228087e-01, 3.76562476e-01, + -3.96564543e-01, 6.62533760e-01, 6.26441002e-01, + 7.54734039e-01, 7.98377872e-01, 8.35770607e-01, + -7.39601970e-01, 6.02227449e-01, 5.86231947e-01, + 8.40462446e-01, -5.93559623e-01, 5.61904788e-01, + 7.02088714e-01, 8.72976303e-01, -1.41684413e-01, + 6.53706551e-01, 5.85153341e-01, 8.73134375e-01, + -1.39793217e-01, 6.38287425e-01, 5.84119797e-01 ] + - [ -4.32684362e-01, 5.90505719e-01, 5.46487570e-02, + -6.11027896e-01, 2.10338950e-01, 3.85869384e-01, + 5.25557995e-02, -6.93167925e-01, 2.49731183e-01, + 3.16244364e-01, 6.25000000e-02, -3.64425898e-01, + 2.81173229e-01, 2.43603230e-01, 5.62499762e-02, + -3.47246647e-01, 2.90157676e-01, 2.29358077e-01, + 6.55545592e-01, 5.60453057e-01, 6.89538836e-01, + -4.12113190e-01, 2.00403571e-01, 4.74826813e-01, + 7.22543240e-01, -4.27251875e-01, 2.04279542e-01, + 4.04901147e-01, 7.65877843e-01, -2.18018651e-01, + 3.26405525e-01, 1.78927898e-01, 7.66169190e-01, + -2.28501916e-01, 3.11180472e-01, 1.71348810e-01 ] + - [ -4.91715014e-01, 2.99164534e-01, -4.18736935e-02, + -2.73805380e-01, -2.60294497e-01, 8.79666805e-02, + -5.39957285e-02, -1.64135993e-01, -2.62449145e-01, + 1.34906650e-01, -3.59374285e-02, -2.09629118e-01, + -1.33682191e-01, -1.24803483e-01, -4.21874523e-02, + -1.17025912e-01, -1.51949525e-01, -1.13885105e-01, + 5.34114838e-01, 3.68120193e-01, 5.74803114e-01, + -2.03055561e-01, -9.52860713e-02, 2.97404647e-01, + 5.51445007e-01, -7.22617507e-02, -1.14786744e-01, + 3.66792083e-01, 6.51307464e-01, -2.06378758e-01, + 7.25326538e-02, -7.45447874e-02, 6.64179087e-01, + -2.50355721e-01, 6.08159304e-02, -9.93171334e-02 ] + - [ -5.08077860e-01, -3.21213007e-02, -1.10007048e-01, + -1.77386403e-02, -6.16814613e-01, -2.38036692e-01, + -4.39164042e-02, -5.08915961e-01, -5.03474116e-01, + -4.86266315e-01, -8.43749642e-02, 1.81445003e-01, + -5.46820760e-01, -3.99476349e-01, -7.96874762e-02, + -4.11186278e-01, -4.16333079e-01, -5.65797567e-01, + 2.20919728e-01, -7.81379342e-02, 2.37345338e-01, + 1.26924992e-01, -6.08076990e-01, -1.98837221e-01, + 2.48554826e-01, -5.26172459e-01, -3.82615209e-01, + -5.40276289e-01, 3.07596564e-01, 3.37660313e-02, + -4.65781450e-01, -4.92888272e-01, 3.50746155e-01, + -1.98001742e-01, -4.32442069e-01, -5.61700225e-01 ] + - [ -3.35749805e-01, 7.45469213e-01, 1.79559946e-01, + -7.76915789e-01, 4.65471625e-01, 5.35205841e-01, + 1.69186354e-01, -7.04783916e-01, 4.50164318e-01, + 5.70551038e-01, 1.76562548e-01, -4.04132128e-01, + 5.23460865e-01, 4.93000031e-01, 1.70312524e-01, + -3.16703022e-01, 5.02136469e-01, 4.98971343e-01, + 7.20468760e-01, 7.54220724e-01, 8.08773875e-01, + -5.21423578e-01, 4.48263049e-01, 6.94320083e-01, + 8.08092356e-01, -6.18012786e-01, 5.11046410e-01, + 5.91913581e-01, 8.48069668e-01, -1.31872475e-01, + 5.93905926e-01, 5.29276848e-01, 8.33333254e-01, + -2.03337133e-01, 6.00669026e-01, 4.91239309e-01 ] + - [ 1., 9.77606773e-01, 8.39602470e-01, -9.70326424e-01, + 9.39880252e-01, 9.49715018e-01, 8.47372293e-01, + -9.63264585e-01, 9.41854239e-01, 9.50701952e-01, + 8.53124976e-01, -4.74708080e-01, 9.49044466e-01, + 9.51605082e-01, 8.45312476e-01, -4.33360457e-01, + 9.50293303e-01, 9.42018986e-01, 8.41899633e-01, 9.83640432e-01, + 9.50506330e-01, -9.42214072e-01, 9.40017462e-01, + 7.45272756e-01, 9.81502891e-01, -9.45522845e-01, + 9.48917150e-01, 7.33859062e-01, 9.45205331e-01, + -6.00225925e-02, 9.32726264e-01, 9.61449742e-01, + 9.45273399e-01, -1.17338955e-01, 9.36275959e-01, + 9.23862815e-01 ] + - [ -4.85915542e-01, 5.13054967e-01, 2.90986300e-02, + -7.28949904e-01, 1.16809368e-01, 1.35053873e-01, + 1.94383860e-02, -7.05786824e-01, 1.22730017e-01, + 1.40842199e-01, 2.81250477e-02, -3.04124415e-01, + 1.42062306e-01, 1.28547311e-01, 1.56251192e-02, + -2.98960984e-01, 1.54322147e-01, 1.11396790e-01, + 4.15689707e-01, 3.88793588e-01, 5.72553396e-01, + -5.55902958e-01, 1.14749670e-02, -2.18403339e-03, + 5.88439226e-01, -5.13603806e-01, 9.64045525e-03, + 9.10818577e-03, 6.18929029e-01, 1.08284950e-01, + -8.28534365e-03, 5.84031343e-02, 6.14427924e-01, + -7.70890713e-03, 1.11026764e-02, 8.23116302e-03 ] + - [ -4.50497150e-01, 3.95426154e-01, 2.20013857e-02, + -4.00244355e-01, -1.19930744e-01, 1.62727594e-01, + 9.35924053e-03, -3.82615924e-01, -1.07209384e-01, + 1.50213599e-01, 1.56251192e-02, -1.49645030e-01, + -1.71256661e-02, 5.22376299e-02, 1.87500715e-02, + -1.53778672e-01, -1.66881680e-02, 2.06285715e-02, + 5.77998161e-01, 3.71183038e-01, 5.83801985e-01, + -2.49642611e-01, -7.95982480e-02, 2.59264350e-01, + 6.09248519e-01, -3.31176162e-01, -4.53545451e-02, + 1.48526907e-01, 6.26400948e-01, 2.15610504e-01, + -2.11697817e-02, 1.22451663e-01, 6.66666508e-01, + -1.31315351e-01, 5.28231859e-02, -2.96645164e-02 ] + - [ -4.42833543e-01, 7.29283214e-01, 1.00070953e-01, + -8.48004401e-01, 4.47609544e-01, 4.21829581e-01, + 8.56730938e-02, -8.24588418e-01, 4.46364045e-01, + 4.26895380e-01, 9.21875238e-02, -3.81781280e-01, + 4.62464452e-01, 4.36100125e-01, 8.90625715e-02, + -3.83257866e-01, 4.76297736e-01, 4.10122037e-01, + 5.40727258e-01, 6.77029610e-01, 7.21034884e-01, + -7.46377468e-01, 4.28853035e-01, 3.28396320e-01, + 7.50288963e-01, -7.49644518e-01, 4.29292798e-01, + 2.98142314e-01, 7.48443365e-01, 1.36618614e-02, 4.05754924e-01, + 4.45624828e-01, 7.28855848e-01, -2.41902471e-02, + 4.09806252e-01, 4.29566979e-01 ] + - [ -5.02485514e-01, 3.53709817e-01, -1.77430511e-02, + -3.81395936e-01, -1.87457621e-01, 8.47164392e-02, + -3.38372588e-02, -2.95015514e-01, -1.88522279e-01, + 1.17936254e-01, -1.40624046e-02, -1.94779992e-01, + -8.80694985e-02, -6.18823767e-02, -1.56250000e-02, + -1.52148545e-01, -9.25242305e-02, -6.73158169e-02, + 3.67598414e-01, 3.49688411e-01, 5.32058477e-01, + -3.62267971e-01, -9.73204374e-02, 7.95692205e-02, + 4.63583708e-01, -1.30667448e-01, -1.32211566e-01, + 2.56773353e-01, 5.89041114e-01, -1.01280272e-01, + -3.34423780e-03, -8.33743215e-02, 5.84576964e-01, + -6.94473982e-02, -2.94533372e-02, -7.68569708e-02 ] + - [ -3.77796233e-01, 6.36402726e-01, 1.42654300e-01, + -8.02864075e-01, 3.04718614e-01, 3.01106095e-01, + 1.24550104e-01, -6.99863970e-01, 2.78236032e-01, + 3.52142930e-01, 1.26562595e-01, -3.97473812e-01, + 3.38598371e-01, 2.87614703e-01, 1.17187619e-01, + -2.83727169e-01, 3.18597913e-01, 3.13904524e-01, + 6.23684883e-01, 5.59648871e-01, 6.73790812e-01, + -6.30391598e-01, 2.79727221e-01, 2.80334592e-01, + 7.29479671e-01, -5.36602080e-01, 2.21197248e-01, + 2.87232757e-01, 7.31008649e-01, -9.81754065e-03, + 2.61999369e-01, 2.69299746e-01, 7.33830810e-01, + -3.90054584e-02, 2.48689651e-01, 2.44084954e-01 ] + - [ -4.44697618e-01, 3.58773470e-01, -7.09772110e-04, + -1.60877764e-01, -2.11081445e-01, 2.84280300e-01, + -9.35924053e-03, -1.53262794e-01, -2.04858541e-01, + 2.33965158e-01, 3.75000238e-02, -2.21579552e-01, + -6.66683912e-02, -5.23781776e-02, 2.96875238e-02, + -2.86250114e-01, -3.70854735e-02, -9.12558436e-02, + 5.38923979e-01, 4.69287038e-01, 5.74803114e-01, + -1.05189383e-01, -5.81175089e-03, 5.92073441e-01, + 6.23121262e-01, -2.96738386e-01, 4.42742109e-02, + 3.29177976e-01, 6.96139336e-01, -2.32163668e-01, + 2.06378460e-01, 4.41031456e-02, 7.06467628e-01, + -2.74063766e-01, 1.97454810e-01, 2.25772858e-02 ] + - [ -3.19801211e-01, 7.38378763e-01, 2.12207198e-01, + -7.18249440e-01, 4.25273418e-01, 5.55684686e-01, + 2.05183625e-01, -8.66016090e-01, 4.95165944e-01, + 4.56013680e-01, 2.15625048e-01, -4.86428380e-01, + 5.22572875e-01, 4.30215478e-01, 2.03125119e-01, + -4.07264769e-01, 5.14786005e-01, 4.41916585e-01, + 6.05650663e-01, 6.79426312e-01, 7.23284721e-01, + -4.49805439e-01, 3.33746672e-01, 6.24208808e-01, + 7.57225275e-01, -8.45820308e-01, 4.98509884e-01, + 2.65348792e-01, 7.60896564e-01, -1.83783472e-01, + 4.99178410e-01, 3.83579373e-01, 7.63681531e-01, + -1.54225051e-01, 4.50571418e-01, 3.71175170e-01 ] + - [ -4.43869114e-01, 6.10448122e-01, 7.31014013e-02, + -5.76337576e-01, 1.86539173e-01, 3.95053744e-01, + 6.40748739e-02, -6.61917686e-01, 2.33348131e-01, + 3.28719616e-01, 6.87500238e-02, -3.03446531e-01, + 2.79090762e-01, 2.87117124e-01, 6.40624762e-02, + -2.68038452e-01, 2.79547095e-01, 2.78521299e-01, + 4.76405144e-01, 5.54203749e-01, 6.40045047e-01, + -3.22497725e-01, 1.04215384e-01, 4.52576756e-01, + 6.57803297e-01, -6.22980893e-01, 2.45516539e-01, + 2.04329729e-01, 6.73723459e-01, 6.37941360e-02, 2.15619564e-01, + 2.74968743e-01, 6.79104328e-01, -9.49110985e-02, + 2.50235677e-01, 2.02841759e-01 ] + - [ -5.68351328e-01, -1.99104369e-01, -1.62526608e-01, + -2.57203162e-01, -6.91621900e-01, -5.45944333e-01, + -1.79265559e-01, -1.59495115e-01, -6.93817973e-01, + -5.23475885e-01, -1.56249940e-01, 3.73730659e-02, + -6.56676888e-01, -6.08402908e-01, -1.57812417e-01, + -3.47203016e-02, -6.41249120e-01, -6.37294650e-01, + -4.41840291e-02, -2.90690064e-01, 2.81214714e-02, + -6.59203529e-02, -7.01619387e-01, -5.68434477e-01, + -1.73410773e-02, 1.20144606e-01, -7.16826677e-01, + -4.78877306e-01, 5.85304499e-02, 2.08808064e-01, + -6.77362680e-01, -6.40839517e-01, 6.46766424e-02, + -1.85137987e-03, -6.37514055e-01, -6.82437420e-01 ] + - [ -4.38691020e-01, 1.58673286e-01, -4.18736935e-02, + 4.71653342e-01, -5.75935602e-01, 3.28165054e-01, + 6.69547319e-02, -4.97842014e-01, -3.53789389e-01, + -2.81600952e-01, 7.03125000e-02, -3.80396605e-01, + -2.71793664e-01, -3.70551050e-01, 6.25000000e-02, + -2.63248146e-01, -2.91924298e-01, -3.54745030e-01, + 5.07063389e-01, 2.63704658e-01, 4.96062994e-01, 5.61401367e-01, + -4.62715983e-01, 7.11306810e-01, 5.86127043e-01, + -8.40445697e-01, 3.01412344e-02, -3.09049189e-01, + 6.28891587e-01, -5.77884734e-01, 7.02563524e-02, + -3.11016738e-01, 6.56716347e-01, -4.82222378e-01, + 7.58755207e-03, -2.90426314e-01 ] + - [ 1., 9.77896333e-01, 7.88502455e-01, -9.63996172e-01, + 9.26139235e-01, 9.37078118e-01, 7.96976328e-01, + -9.75384295e-01, 9.32681441e-01, 9.22192335e-01, + 8.04687500e-01, -4.80333090e-01, 9.37786698e-01, + 9.32135820e-01, 7.95312405e-01, -4.07808721e-01, + 9.28372860e-01, 9.37403560e-01, 8.50315571e-01, 9.75412250e-01, + 9.39257741e-01, -9.28068817e-01, 9.43581104e-01, + 7.70200729e-01, 9.74566340e-01, -9.48493659e-01, + 9.36571836e-01, 7.12761879e-01, 9.57658529e-01, + -6.91086054e-02, 9.25874710e-01, 9.45732951e-01, + 9.37810659e-01, -8.80190730e-02, 9.14038420e-01, + 9.26328897e-01 ] + - [ -5.07042289e-01, -2.95134783e-02, -9.43931937e-02, + -2.68283546e-01, -5.65987945e-01, -3.65457416e-01, + -1.10151112e-01, -2.47724652e-01, -5.60862660e-01, + -3.84996891e-01, -7.34375119e-02, -1.64795041e-01, + -4.92960632e-01, -5.08473575e-01, -7.81249404e-02, + -1.60729170e-01, -4.87818301e-01, -5.21056354e-01, + 1.71024919e-01, -9.17258263e-02, 2.10348725e-01, + -1.51464283e-01, -5.29890358e-01, -3.64578485e-01, + 2.16184974e-01, -2.21870422e-01, -5.07869780e-01, + -4.44247305e-01, 2.80199170e-01, -3.99739146e-02, + -4.68338251e-01, -5.34076571e-01, 2.78607130e-01, + -1.01184130e-01, -4.68250811e-01, -5.52795053e-01 ] + - [ -4.36619759e-01, 6.53067827e-01, 8.72960091e-02, + -4.64989662e-01, 1.97449088e-01, 5.40736198e-01, + 9.71921682e-02, -7.76397109e-01, 3.13744307e-01, + 3.15312266e-01, 8.75000954e-02, -4.26283896e-01, + 3.71040106e-01, 2.99308062e-01, 8.12500715e-02, + -3.41555655e-01, 3.59027028e-01, 3.12109232e-01, + 6.00841641e-01, 6.67302847e-01, 7.23284721e-01, + -2.27022171e-01, 2.08166838e-01, 7.71842360e-01, + 7.50288963e-01, -8.85802925e-01, 5.03477573e-01, + 2.20603108e-01, 7.68368483e-01, -2.66141355e-01, + 5.05334973e-01, 3.24078560e-01, 7.68656611e-01, + -2.56413341e-01, 4.81492043e-01, 3.24205279e-01 ] + - [ 1., 9.82812047e-01, 8.05535674e-01, -9.61126208e-01, + 9.35359359e-01, 9.53217030e-01, 8.08495283e-01, + -9.90468204e-01, 9.51850653e-01, 9.29293633e-01, + 8.12500000e-01, -4.88707781e-01, 9.57154155e-01, + 9.47344303e-01, 8.06249857e-01, -4.23057258e-01, + 9.49676633e-01, 9.48751569e-01, 8.35286975e-01, 9.86364841e-01, + 9.39257741e-01, -9.83003914e-01, 9.85153794e-01, + 7.39107370e-01, 9.72254157e-01, -9.66940641e-01, + 9.59309578e-01, 7.15050101e-01, 9.50186849e-01, + -9.04198885e-02, 9.47968245e-01, 9.49368834e-01, + 9.30348277e-01, -6.59778714e-02, 9.14297342e-01, + 9.46515441e-01 ] + - [ -4.97100234e-01, 4.52244282e-03, -1.00071013e-01, + -2.68186331e-01, -5.07085204e-01, -2.77211726e-01, + -6.26348853e-02, -3.69515538e-01, -4.91796196e-01, + -3.75057936e-01, -2.81249285e-02, -1.99445426e-01, + -4.56348717e-01, -4.82815981e-01, -3.43749523e-02, + -1.63472235e-01, -4.58304942e-01, -4.88329113e-01, + 3.83829236e-01, -2.69873142e-02, 2.91338563e-01, + 6.93624020e-02, -5.30643821e-01, -1.17784560e-01, + 3.87283206e-01, -2.12657571e-01, -4.52465296e-01, + -3.44552815e-01, 5.29265285e-01, -1.21900856e-01, + -4.21846449e-01, -5.22081375e-01, 5.19900560e-01, + -1.65986717e-01, -4.20433760e-01, -5.30304193e-01 ] + - [ -5.89270949e-01, 1.04528666e-02, -1.86657190e-01, + -5.46612740e-01, -4.21342671e-01, -3.91659200e-01, + -1.96544290e-01, -5.24507403e-01, -4.21657026e-01, + -4.02899563e-01, -1.84374988e-01, -1.86950684e-01, + -4.10259664e-01, -4.31499898e-01, -1.95312500e-01, + -1.43407583e-01, -4.16500866e-01, -4.38015819e-01, + 2.92455673e-01, -9.04731750e-02, 3.29583883e-01, + -2.13174701e-01, -5.10401011e-01, -3.90799582e-01, + 3.64161849e-01, -2.20896959e-01, -5.03969550e-01, + -4.29568172e-01, 4.17185545e-01, 1.33331895e-01, + -5.05985737e-01, -4.82890189e-01, 4.10447836e-01, + 2.52746344e-02, -4.94191945e-01, -5.15577257e-01 ] + - [ -3.40720832e-01, 8.41659427e-01, 1.99432254e-01, + -8.75865996e-01, 6.30387306e-01, 6.25851512e-01, + 1.90784812e-01, -8.40735197e-01, 6.18864059e-01, + 6.34154916e-01, 1.96875095e-01, -4.43634748e-01, + 6.64155245e-01, 6.20513320e-01, 1.90625072e-01, + -3.62745941e-01, 6.50356889e-01, 6.29461408e-01, + 6.39915824e-01, 8.49371791e-01, 8.31270933e-01, + -8.19161952e-01, 6.78742409e-01, 5.70675969e-01, + 8.38150144e-01, -7.69042611e-01, 6.69428110e-01, + 5.99726081e-01, 8.28144431e-01, -9.12665725e-02, + 7.08401203e-01, 6.86197281e-01, 8.40795994e-01, + -6.95213675e-02, 6.74576044e-01, 6.81329131e-01 ] + - [ -5.06006598e-01, 1.89158440e-01, -5.60681224e-02, + -4.74557579e-01, -2.97964394e-01, -1.60575926e-01, + -6.55146241e-02, -3.52138281e-01, -3.28075290e-01, + -1.34219825e-01, -3.90624404e-02, -2.83884287e-01, + -2.44073391e-01, -2.93417811e-01, -4.68749404e-02, + -9.64817405e-02, -2.80732512e-01, -2.50548065e-01, + 4.44544673e-01, 1.33906722e-01, 3.90326262e-01, + -1.71282530e-01, -3.02075207e-01, -9.42784548e-03, + 5.05202293e-01, -1.48320436e-01, -3.54391813e-01, + -1.21977806e-01, 5.99003673e-01, -1.40255988e-01, + -2.48763204e-01, -3.57903123e-01, 5.79601884e-01, + -7.49386549e-02, -2.70357966e-01, -3.31433594e-01 ] + - [ -5.61516166e-01, -1.25614107e-01, -1.82398856e-01, + -1.39220536e-01, -6.52244329e-01, -3.96837711e-01, + -1.83585227e-01, -1.94570780e-01, -6.29486024e-01, + -4.49268103e-01, -1.73437417e-01, 6.29081726e-02, + -5.94871879e-01, -5.21077871e-01, -1.75000012e-01, + 4.27377224e-03, -5.77285051e-01, -5.45550942e-01, + 1.66816831e-01, -1.26574516e-01, 1.65354371e-01, + 6.37352467e-02, -6.17764115e-01, -2.88255990e-01, + 1.95375681e-01, -3.52175832e-02, -5.74584484e-01, + -3.74027371e-01, 2.50311375e-01, 1.93133354e-01, + -5.51378608e-01, -5.03915548e-01, 2.51243830e-01, + 1.57056570e-01, -5.48210680e-01, -5.10970175e-01 ] + - [ -4.38069642e-01, 6.67862296e-01, 8.58764648e-02, + -6.42698228e-01, 2.86604762e-01, 4.52593684e-01, + 8.42332840e-02, -7.28556871e-01, 3.24832320e-01, + 3.77402902e-01, 8.12500715e-02, -4.10362422e-01, + 3.91505122e-01, 3.33619118e-01, 8.43750238e-02, + -3.41222584e-01, 3.74894500e-01, 3.30304980e-01, + 5.43131948e-01, 6.28704906e-01, 6.82789683e-01, + -4.83297467e-01, 2.69795537e-01, 4.74593401e-01, + 6.97109699e-01, -6.90777540e-01, 3.78136396e-01, + 2.99921870e-01, 7.33499289e-01, -9.99630690e-02, + 3.75623226e-01, 3.20242643e-01, 7.18905449e-01, + -1.52960122e-01, 3.84670258e-01, 3.01712513e-01 ] + - [ 1., 9.97390151e-01, 9.67352748e-01, -9.98267353e-01, + 9.87456918e-01, 9.82121468e-01, 9.66882586e-01, + -9.86840606e-01, 9.91471529e-01, 9.92264152e-01, + 9.73437548e-01, -4.86830473e-01, 9.92788792e-01, + 9.95547891e-01, 9.71875191e-01, -4.21276808e-01, + 9.80277061e-01, 9.91217136e-01, 8.01622987e-01, 9.90986824e-01, + 9.30258632e-01, -9.66860950e-01, 9.74267721e-01, + 7.48626471e-01, 9.44508553e-01, -9.70464766e-01, + 9.77218270e-01, 7.28765845e-01, 9.45205331e-01, + -1.25991702e-02, 9.10070062e-01, 9.81715441e-01, + 9.25372958e-01, -1.09597087e-01, 9.48789358e-01, + 9.43789244e-01 ] + - [ -4.78044748e-01, 3.86221766e-01, -1.20653510e-02, + -1.12632513e-02, -2.63794422e-01, 3.67359757e-01, + 5.03957272e-03, -2.56138384e-01, -1.82110965e-01, + 1.65903091e-01, 1.40625238e-02, -2.24858224e-01, + -3.42550278e-02, -1.84723735e-02, 4.68754768e-03, + -1.61133170e-01, -4.25590277e-02, -1.49415135e-02, + 4.34325218e-01, 4.65405345e-01, 5.14060736e-01, + -1.35240316e-01, -1.92677975e-02, 5.20611644e-01, + 5.74566364e-01, -5.07170081e-01, 1.08023763e-01, + 1.50914192e-01, 6.28891587e-01, -1.47809982e-01, + 1.67870998e-01, 6.27481937e-02, 6.09452605e-01, + -1.48323894e-01, 1.62000656e-01, 6.99108839e-02 ] + - [ -4.71831024e-01, 6.46868229e-01, 5.03903627e-02, + -7.61173725e-01, 3.06498885e-01, 3.39603305e-01, + 4.67963219e-02, -7.26316988e-01, 2.97896266e-01, + 3.42039585e-01, 4.99999523e-02, -4.00304973e-01, + 3.55313897e-01, 2.98618317e-01, 3.59375477e-02, + -2.75870442e-01, 3.31647754e-01, 3.29731226e-01, + 5.29906750e-01, 5.92964888e-01, 6.49043798e-01, + -5.83380580e-01, 2.86006093e-01, 3.51243854e-01, + 7.22543240e-01, -6.20033383e-01, 2.77008891e-01, + 2.57554770e-01, 7.28518009e-01, -1.31358504e-02, + 2.89236188e-01, 2.96213984e-01, 7.03980207e-01, + -6.58418536e-02, 3.00384283e-01, 2.78598309e-01 ] + - [ -4.65617239e-01, 2.49074936e-01, -1.49042010e-02, + -5.01283884e-01, -2.26551116e-01, -8.68778229e-02, + -5.54354787e-02, -3.59114528e-01, -2.39936471e-01, + -1.63194537e-02, -2.03124285e-02, -2.68849432e-01, + -1.65557265e-01, -1.96646929e-01, -2.49999762e-02, + -1.58688486e-01, -1.84273720e-01, -1.77138567e-01, + 5.49143434e-01, 2.09313154e-01, 5.02812147e-01, + -3.27912033e-01, -1.97480917e-01, -3.08226347e-02, + 5.39884329e-01, -1.84688866e-01, -2.53188848e-01, + -7.08401203e-04, 6.28891587e-01, -1.57718360e-01, + -1.40708208e-01, -2.58759260e-01, 6.41790867e-01, + -1.33511424e-01, -1.65269077e-01, -2.55692422e-01 ] + - [ -3.48591566e-01, 7.80034184e-01, 1.89496160e-01, + -8.30097616e-01, 4.94919538e-01, 5.11048675e-01, + 1.77825809e-01, -8.43531609e-01, 5.18752933e-01, + 5.05981684e-01, 1.79687500e-01, -4.19563115e-01, + 5.45217991e-01, 5.05375743e-01, 1.73437476e-01, + -3.83894145e-01, 5.47913790e-01, 4.95599985e-01, + 6.16471291e-01, 7.28636026e-01, 7.70528674e-01, + -7.17492700e-01, 4.78864670e-01, 4.42305565e-01, + 7.84970999e-01, -7.06365585e-01, 4.85605597e-01, + 4.33266044e-01, 7.85803199e-01, 1.31369829e-02, 4.94336843e-01, + 5.43370724e-01, 7.91044831e-01, 6.66630268e-03, 4.61571336e-01, + 5.12310147e-01 ] + - [ -3.03852558e-01, 7.61575460e-01, 2.30659962e-01, + -8.50816131e-01, 5.00786066e-01, 4.98646855e-01, + 2.16702700e-01, -8.20796251e-01, 5.01326919e-01, + 5.13062358e-01, 2.25000143e-01, -4.14609253e-01, + 5.28418899e-01, 4.93489146e-01, 2.17187524e-01, + -3.55227292e-01, 5.24902344e-01, 4.96159673e-01, + 5.70183277e-01, 6.91022873e-01, 7.30033755e-01, + -6.87357306e-01, 4.25837278e-01, 4.08029079e-01, + 7.50288963e-01, -6.66689813e-01, 4.21274304e-01, + 3.95426512e-01, 7.60896564e-01, 5.98720312e-02, 4.12120819e-01, + 4.91602898e-01, 7.33830810e-01, -2.70257592e-02, + 4.38250542e-01, 4.58271623e-01 ] + - [ -3.44034851e-01, 7.28548050e-01, 1.73882127e-01, + -7.43897855e-01, 4.30393100e-01, 5.28761029e-01, + 1.69186354e-01, -7.96063185e-01, 4.60125208e-01, + 4.83683944e-01, 1.71875000e-01, -4.30781484e-01, + 5.04860044e-01, 4.50782299e-01, 1.68749928e-01, + -3.84498537e-01, 5.03369093e-01, 4.45121646e-01, + 6.97625518e-01, 7.04873204e-01, 7.52530932e-01, + -6.12605512e-01, 4.43857431e-01, 5.44175506e-01, + 7.94219375e-01, -5.06539702e-01, 3.96278024e-01, + 5.83492041e-01, 8.25653672e-01, -1.48919344e-01, + 5.19728303e-01, 4.35929298e-01, 8.03482652e-01, + -1.77897334e-01, 5.16484737e-01, 4.22822595e-01 ] + - [ 1., 9.96958137e-01, 9.77288842e-01, -9.93098140e-01, + 9.93602633e-01, 9.96690035e-01, 9.85601187e-01, + -9.89783823e-01, 9.92243171e-01, 9.90924358e-01, + 9.92187500e-01, -4.79283333e-01, 9.88587737e-01, + 9.97817159e-01, 9.81249809e-01, -4.31758046e-01, + 9.92580295e-01, 9.96387482e-01, 8.13645959e-01, 9.94765282e-01, + 9.25759315e-01, -9.50990319e-01, 9.72727656e-01, + 7.70584345e-01, 9.56069231e-01, -9.62782085e-01, + 9.80024815e-01, 7.45172024e-01, 9.30261493e-01, + -5.72785735e-02, 9.50219393e-01, 9.82735634e-01, + 9.42786098e-01, -1.25935256e-01, 9.55507517e-01, + 9.36612129e-01 ] + - [ -4.68102753e-01, 6.72186613e-02, -5.18098474e-02, + -1.09615922e-02, -5.50910473e-01, -1.20063424e-01, + -5.68754673e-02, 3.77353430e-02, -5.48197865e-01, + -1.39582336e-01, -6.56250119e-02, 1.67533159e-02, + -3.99332702e-01, -3.03326964e-01, -6.24999404e-02, + 6.22105598e-02, -4.16741431e-01, -3.19299757e-01, + 4.72798228e-01, 1.78819299e-01, 4.37570333e-01, + -9.49521065e-02, -2.87599623e-01, 1.14450812e-01, + 4.40462351e-01, -1.96946263e-01, -2.40521908e-01, + -1.58190727e-04, 4.79451895e-01, 1.86212897e-01, + -2.01619089e-01, -1.07106745e-01, 5.32338381e-01, + -2.05291986e-01, -1.26954675e-01, -2.62598395e-01 ] + - [ -4.16114330e-01, 7.32181787e-01, 1.05748773e-01, + -7.68863797e-01, 4.36313748e-01, 5.00161409e-01, + 1.02951884e-01, -7.46257961e-01, 4.43541765e-01, + 5.10048628e-01, 1.12500072e-01, -4.04735923e-01, + 4.85026121e-01, 4.44804311e-01, 1.01562500e-01, + -3.80149484e-01, 4.89210010e-01, 4.27945852e-01, + 6.71175122e-01, 7.41140366e-01, 7.72778511e-01, + -7.10866570e-01, 5.26906490e-01, 5.17696142e-01, + 7.94219375e-01, -6.55053377e-01, 5.31064749e-01, + 5.66273093e-01, 8.15691113e-01, -1.97883070e-01, + 5.94926715e-01, 4.73752022e-01, 8.38308334e-01, + -2.17417419e-01, 5.64262629e-01, 4.42353249e-01 ] + - [ -2.83968508e-01, 7.50315547e-01, 2.17885017e-01, + -7.67593920e-01, 4.51057911e-01, 5.31466365e-01, + 2.12383032e-01, -7.63742089e-01, 4.60130215e-01, + 5.22711992e-01, 2.17187643e-01, -3.41573775e-01, + 4.92185831e-01, 5.09781599e-01, 2.14062572e-01, + -3.35736096e-01, 4.99100804e-01, 4.82721090e-01, + 6.60955787e-01, 7.04828978e-01, 7.61529922e-01, + -6.28549993e-01, 4.24064398e-01, 4.93777514e-01, + 7.84970999e-01, -6.52942777e-01, 4.34884906e-01, + 4.36165810e-01, 7.90784478e-01, 8.79323483e-02, 4.31629300e-01, + 5.37693262e-01, 7.96019912e-01, -7.07254410e-02, + 4.68051672e-01, 4.56762910e-01 ] + - [ -5.28997540e-01, 1.60564184e-02, -1.29879296e-01, + -2.07712054e-02, -5.81189752e-01, -1.77865803e-01, + -1.44708395e-01, 1.55849695e-01, -6.02648675e-01, + -1.28786743e-01, -9.68749523e-02, -2.90966630e-02, + -4.65542436e-01, -4.09188151e-01, -1.04687452e-01, + 7.22682476e-03, -4.63994265e-01, -4.08087254e-01, + 2.41959691e-01, 1.66471243e-01, 3.25084329e-01, + -1.29020333e-01, -3.24349344e-01, 3.81720066e-03, + 3.08670521e-01, 4.71968651e-02, -3.52216005e-01, + 1.03832126e-01, 3.97260189e-01, -6.44183755e-02, + -1.92153990e-01, -2.61147678e-01, 3.88059616e-01, + -3.72839570e-02, -2.16945946e-01, -2.58447111e-01 ] + - [ -4.98135924e-01, -3.19444537e-02, -1.54009938e-01, + 6.22099638e-01, -7.43494391e-01, 1.21705890e-01, + -3.09575200e-02, -5.32027662e-01, -5.04859686e-01, + -5.02455115e-01, -1.71874762e-02, -2.99549699e-01, + -4.71198201e-01, -5.45521796e-01, -2.96874642e-02, + -3.44892740e-01, -4.51054811e-01, -5.67104697e-01, + 2.84039736e-01, 3.58843803e-02, 2.98087835e-01, 7.20698714e-01, + -6.80519581e-01, 4.13003445e-01, 3.73410344e-01, + -7.84593225e-01, -2.09608972e-01, -5.44565558e-01, + 4.64508057e-01, -4.72941101e-01, -2.22443700e-01, + -5.15985668e-01, 4.42786098e-01, -5.62669277e-01, + -2.09325373e-01, -5.32342255e-01 ] + - [ -4.76387799e-01, 3.55975151e-01, -1.06458664e-02, + -2.07860351e-01, -2.24252105e-01, 2.12432265e-01, + -5.03957272e-03, -4.86880362e-01, -1.21923149e-01, + 3.05364132e-02, 2.03125477e-02, -3.01069975e-01, + -6.06828928e-02, -9.74969864e-02, 9.37509537e-03, + -2.56796062e-01, -6.14826679e-02, -1.00151420e-01, + 4.75202799e-01, 3.24599504e-01, 5.25309443e-01, 1.53779984e-04, + -2.29342461e-01, 3.49819779e-01, 5.37572145e-01, + -4.96464491e-01, -1.12679601e-02, -4.64606285e-03, + 6.46326184e-01, -2.53178775e-01, 1.56309605e-02, + -1.62100852e-01, 6.44278646e-01, -3.16800892e-01, + 2.38181353e-02, -1.77997828e-01 ] + - [ -5.21333933e-01, -7.76398182e-03, -1.31298840e-01, + 3.17867279e-01, -6.84616387e-01, -5.61475158e-02, + -1.01511896e-01, -9.74727273e-02, -5.82107902e-01, + -3.04406047e-01, -7.34375119e-02, -1.97064281e-02, + -4.99149144e-01, -4.44081426e-01, -7.34375119e-02, + 7.96711445e-03, -5.00689983e-01, -4.50820565e-01, + 2.96663642e-01, 1.20053768e-01, 3.31833482e-01, 2.86507130e-01, + -4.96630609e-01, 2.32297897e-01, 4.03468132e-01, + -3.79967272e-01, -2.73603082e-01, -2.51497746e-01, + 4.47073460e-01, -1.38198733e-02, -2.66050041e-01, + -3.06075037e-01, 4.75124478e-01, -2.16908157e-01, + -2.33603776e-01, -3.75940800e-01 ] + - [ -4.24399376e-01, 3.97495031e-01, 3.33569050e-02, + -3.35022986e-01, -1.35875285e-01, 2.09115744e-01, + 1.22389793e-02, -1.11610830e-01, -1.73508167e-01, + 3.25176239e-01, 5.78124523e-02, -1.61784053e-01, + -3.07100415e-02, 2.96756029e-02, 5.93750477e-02, + -2.16454923e-01, -9.45800543e-03, -1.22547150e-02, + 5.45536518e-01, 4.44196224e-01, 6.19797587e-01, + -3.31830323e-01, 3.03494930e-03, 2.79638648e-01, + 5.35260081e-01, -1.55586004e-02, -4.86378074e-02, + 5.58908463e-01, 6.76214218e-01, -1.57307386e-01, + 1.58615112e-01, 4.80380058e-02, 6.94029808e-01, + -3.16365063e-01, 1.84821248e-01, -1.88687444e-02 ] + - [ -3.99337232e-01, 1.36810899e-01, -2.34208703e-02, + 4.08455133e-02, -4.67742383e-01, 7.39796162e-02, + -3.52771878e-02, -5.17932177e-02, -3.94366741e-01, + 3.46331596e-02, 9.21875238e-02, -5.33278465e-01, + -2.50968337e-01, -4.26386297e-01, 9.37500000e-02, + -3.25881481e-01, -2.95997739e-01, -3.91471744e-01, + 7.28283644e-01, 2.01676011e-01, 5.25309443e-01, + -3.12439799e-02, -2.58888900e-01, 2.52610803e-01, + 4.47398663e-01, 6.91063404e-02, -2.05110252e-01, + 3.98641229e-01, 8.43088388e-01, -8.34944725e-01, + 2.60056257e-02, -4.73554730e-01, 8.30845833e-01, + -6.66471243e-01, -3.84815335e-02, -4.21019733e-01 ] + - [ 1., 9.79812145e-01, 7.99857974e-01, -9.75689530e-01, + 9.33219194e-01, 9.32208896e-01, 7.94096470e-01, + -9.62986708e-01, 9.41601038e-01, 9.47221398e-01, + 8.01562548e-01, -4.78162527e-01, 9.53862786e-01, + 9.52103734e-01, 7.93750048e-01, -4.26341116e-01, + 9.47726250e-01, 9.43167806e-01, 8.11241269e-01, 9.86089587e-01, + 9.28009152e-01, -9.50332761e-01, 9.62184191e-01, + 7.58227825e-01, 9.39884305e-01, -9.59634364e-01, + 9.66193318e-01, 7.29656100e-01, 9.45205331e-01, + -1.25702560e-01, 9.50577736e-01, 9.18788910e-01, + 9.42786098e-01, -9.53487754e-02, 9.25006986e-01, + 9.31647539e-01 ] + - [ 1., 9.69443202e-01, 7.58694053e-01, -9.49611127e-01, + 8.90056133e-01, 9.07954216e-01, 7.52339959e-01, + -9.67025518e-01, 9.08410788e-01, 8.98774862e-01, + 7.59375095e-01, -4.84353483e-01, 9.13443208e-01, + 8.99256825e-01, 7.54687428e-01, -4.45291638e-01, + 9.16840911e-01, 8.90156984e-01, 8.13645959e-01, 9.72693324e-01, + 9.30258632e-01, -9.60996747e-01, 9.37232852e-01, + 7.09797144e-01, 9.39884305e-01, -9.55599427e-01, + 9.48417902e-01, 7.12748885e-01, 9.35242772e-01, + -5.02233505e-02, 8.98548722e-01, 9.33136940e-01, + 9.25372958e-01, -6.85276389e-02, 8.99569035e-01, + 9.28061604e-01 ] + - [ -2.27009118e-01, 8.25725198e-01, 2.81760097e-01, + -7.63257205e-01, 5.67951322e-01, 6.91657543e-01, + 2.72858143e-01, -8.26978326e-01, 6.05833054e-01, + 6.41844630e-01, 2.81250119e-01, -4.11465228e-01, + 6.39995098e-01, 6.25420809e-01, 2.73437500e-01, + -3.79365683e-01, 6.38734221e-01, 6.07823849e-01, + 6.72377467e-01, 8.32378507e-01, 7.99775004e-01, + -6.45196557e-01, 6.09068394e-01, 7.35359550e-01, + 8.47398639e-01, -8.39918792e-01, 6.85505509e-01, + 5.23799539e-01, 8.20672393e-01, -5.81761003e-02, + 6.86481357e-01, 6.91788197e-01, 8.25870514e-01, + -9.23477411e-02, 6.77433372e-01, 6.64454699e-01 ] + - [ -5.11599064e-01, 2.47917414e-01, -6.74237013e-02, + -8.29125643e-02, -3.70662868e-01, 1.13192916e-01, + -5.68754673e-02, -3.52933824e-01, -2.84570694e-01, + -7.35480189e-02, -4.06249166e-02, -1.21040106e-01, + -2.21827805e-01, -1.71739519e-01, -4.68749404e-02, + -1.13256812e-01, -2.13971376e-01, -1.83550656e-01, + 3.80222321e-01, 2.57276177e-01, 4.37570333e-01, 1.17991328e-01, + -3.36393058e-01, 3.16876054e-01, 5.12138724e-01, + -4.36261535e-01, -1.40319586e-01, -1.17220104e-01, + 5.49190402e-01, 3.31686735e-02, -1.37670934e-01, + -1.37127995e-01, 5.62189102e-01, -1.57314539e-01, + -1.00391030e-01, -2.06255853e-01 ] + - [ -4.63131726e-01, 6.39616132e-01, 4.89709377e-02, + -6.07653499e-01, 2.45536923e-01, 4.35954094e-01, + 4.67963219e-02, -7.24252880e-01, 2.91417599e-01, + 3.36053252e-01, 5.15625477e-02, -4.00748193e-01, + 3.49499106e-01, 2.91932583e-01, 4.68750000e-02, + -2.77308702e-01, 3.18692684e-01, 3.14627290e-01, + 5.24496436e-01, 6.24242425e-01, 6.46794081e-01, + -4.35518324e-01, 2.69936562e-01, 5.42064428e-01, + 7.08670378e-01, -7.41949260e-01, 3.72292280e-01, + 2.28850007e-01, 7.38480687e-01, -1.06036842e-01, + 3.66446018e-01, 3.05854797e-01, 7.03980207e-01, + -7.67786503e-02, 3.51739168e-01, 3.25065494e-01 ] + - [ -4.64581668e-01, 6.87032700e-01, 6.74237013e-02, + -7.23810077e-01, 3.34543467e-01, 4.19280648e-01, + 6.11951351e-02, -6.81124926e-01, 3.31828117e-01, + 4.34410214e-01, 5.93750477e-02, -3.66358995e-01, + 3.99524212e-01, 3.74892116e-01, 5.78124523e-02, + -2.97602236e-01, 3.80018234e-01, 3.68734002e-01, + 5.08866787e-01, 6.67690754e-01, 7.03037143e-01, + -6.43116832e-01, 3.66179705e-01, 3.85359764e-01, + 6.90173268e-01, -5.43864489e-01, 3.53994489e-01, + 4.60723996e-01, 7.38480687e-01, -9.34821367e-02, + 4.25193429e-01, 3.78299236e-01, 7.21393108e-01, + -2.45929360e-02, 3.85769367e-01, 4.02997732e-01 ] + - [ -4.76594865e-01, 5.17162204e-01, 2.90986300e-02, + -6.06122494e-01, 8.77442360e-02, 2.27622271e-01, + 4.10368443e-02, -7.49317288e-01, 1.33474588e-01, + 1.14496708e-01, 3.43750715e-02, -2.26267397e-01, + 1.29339218e-01, 1.70018792e-01, 2.81250477e-02, + -3.79453480e-01, 1.84911370e-01, 8.79347324e-02, + 4.64382291e-01, 4.37200427e-01, 6.04049444e-01, + -4.49822485e-01, 3.51594687e-02, 1.68508291e-01, + 6.23121262e-01, -7.63411522e-01, 1.70123696e-01, + -6.13127351e-02, 6.46326184e-01, 5.00358343e-02, + 6.68914318e-02, 9.97648239e-02, 6.64179087e-01, + -6.35796785e-02, 7.78306723e-02, 4.23073769e-02 ] + - [ -4.88401055e-01, 3.68319750e-01, -1.91625953e-02, + -3.77007008e-01, -1.57312989e-01, 1.32360816e-01, + -1.51187181e-02, -3.20956230e-01, -1.64661825e-01, + 1.27736330e-01, 7.81261921e-03, -2.41987467e-01, + -5.58578968e-02, -5.47094941e-02, 4.68754768e-03, + -1.81944013e-01, -5.93495369e-02, -4.83300090e-02, + 4.74000573e-01, 3.49507809e-01, 5.95050573e-01, + -3.99419129e-01, -7.75988698e-02, 6.67934418e-02, + 5.60693502e-01, -1.95257425e-01, -1.12835467e-01, + 2.10183144e-01, 6.53798223e-01, -1.30177617e-01, + 1.52467489e-02, -8.15932751e-02, 5.92039704e-01, + 2.77404785e-02, -2.31524706e-02, -5.13190031e-03 ] + - [ -3.32435846e-01, 6.86766982e-01, 1.79559946e-01, + -6.18516207e-01, 3.17311764e-01, 5.28565645e-01, + 1.79265738e-01, -6.36417270e-01, 3.32450032e-01, + 4.93387938e-01, 1.82812452e-01, -3.38719785e-01, + 4.09146547e-01, 4.15252090e-01, 1.79687619e-01, + -2.86138415e-01, 3.97271514e-01, 4.05018330e-01, + 7.01833487e-01, 7.04117894e-01, 7.72778511e-01, + -4.92924392e-01, 3.76895666e-01, 6.28141999e-01, + 8.10404658e-01, -3.36199820e-01, 3.00893903e-01, + 6.84306502e-01, 8.13200355e-01, -1.75627947e-01, + 5.34695387e-01, 4.29248452e-01, 8.18407774e-01, + -2.08950639e-01, 5.21280169e-01, 4.03829932e-01 ] + - [ 1., 9.80197310e-01, 8.26827526e-01, -9.89940345e-01, + 9.51032400e-01, 9.38491702e-01, 8.37293148e-01, + -9.84846652e-01, 9.52108026e-01, 9.37973380e-01, + 8.39062572e-01, -4.88459647e-01, 9.54671264e-01, + 9.45816278e-01, 8.28125119e-01, -4.25830722e-01, + 9.54637766e-01, 9.52829242e-01, 8.41899633e-01, 9.79125738e-01, + 9.34758067e-01, -9.46954012e-01, 9.51450825e-01, + 7.50512481e-01, 9.65317726e-01, -9.35570478e-01, + 9.51909542e-01, 7.49825597e-01, 9.50186849e-01, + -2.50344276e-02, 9.05073166e-01, 9.64500785e-01, + 9.42786098e-01, -8.39545727e-02, 9.07667279e-01, + 9.23264265e-01 ] + - [ -4.67481375e-01, 3.09066057e-01, -2.20014453e-02, + -3.32596481e-01, -2.15348780e-01, 9.43275690e-02, + -1.07990503e-02, -3.66427422e-01, -1.76731050e-01, + 6.73424006e-02, 2.96876431e-02, -2.75344312e-01, + -1.24960661e-01, -1.52720571e-01, 2.34376192e-02, + -3.43871772e-01, -9.24942493e-02, -1.88659847e-01, + 5.54553509e-01, 3.00958633e-01, 5.63554525e-01, + -1.61326468e-01, -1.84399664e-01, 2.06016541e-01, + 5.44508696e-01, -2.59740651e-01, -8.72505903e-02, + 1.68559670e-01, 6.68742180e-01, -1.63381815e-01, + -1.82943344e-02, -1.37319505e-01, 6.99004889e-01, + -3.91789079e-01, 2.13155746e-02, -2.23306656e-01 ] + - [ -3.87738228e-01, 6.98599458e-01, 1.36976600e-01, + -7.18473077e-01, 3.54041457e-01, 4.57100034e-01, + 1.23110175e-01, -6.83393419e-01, 3.62567544e-01, + 4.77195144e-01, 1.35937572e-01, -3.64518344e-01, + 4.19455290e-01, 4.04089332e-01, 1.34375095e-01, + -3.31257105e-01, 4.19656157e-01, 3.91749263e-01, + 5.52750230e-01, 6.80798173e-01, 7.00787306e-01, + -6.41544402e-01, 4.01203871e-01, 4.35938597e-01, + 7.22543240e-01, -5.04629791e-01, 3.40250611e-01, + 4.98170733e-01, 7.45952725e-01, 4.37253714e-02, 4.03758645e-01, + 4.68469501e-01, 7.28855848e-01, -2.61868834e-02, + 4.09145355e-01, 4.27251816e-01 ] + - [ -3.18972707e-01, 8.00100684e-01, 2.12207198e-01, + -8.09058487e-01, 5.36375165e-01, 5.89980960e-01, + 2.09503293e-01, -8.38865936e-01, 5.52202702e-01, + 5.55695772e-01, 2.10937500e-01, -4.19111013e-01, + 5.89500427e-01, 5.57655334e-01, 2.01562524e-01, + -3.65528882e-01, 5.86264014e-01, 5.55671215e-01, + 6.48331881e-01, 7.75471926e-01, 7.81777263e-01, + -6.40682817e-01, 5.18967509e-01, 6.12091660e-01, + 8.24277282e-01, -7.80044317e-01, 5.73728800e-01, + 4.56202626e-01, 8.13200355e-01, -1.00501180e-02, + 5.68024397e-01, 6.04893208e-01, 8.08457613e-01, + -6.12678528e-02, 5.67768216e-01, 5.72158337e-01 ] + - [ -4.93993402e-01, 1.83712959e-01, -6.03265166e-02, + -4.17437911e-01, -3.06513131e-01, -1.20049655e-01, + -2.95175314e-02, -5.22393703e-01, -2.88185954e-01, + -2.20511794e-01, -1.40624046e-02, -2.62393832e-01, + -2.59978771e-01, -2.97569811e-01, -2.65624523e-02, + -2.24205971e-01, -2.58558214e-01, -3.00253153e-01, + 4.95641708e-01, 1.31520987e-01, 4.37570333e-01, + -9.16685462e-02, -3.56057942e-01, 1.09148026e-03, + 5.39884329e-01, -3.50639164e-01, -2.81356812e-01, + -2.22710669e-01, 6.48816824e-01, -1.05565608e-01, + -2.69222200e-01, -3.57712567e-01, 6.34328127e-01, + -1.46814883e-01, -2.68409491e-01, -3.67582202e-01 ] + - [ -4.67067122e-01, 3.00906062e-01, -3.61958742e-02, + 5.95170259e-02, -3.37936699e-01, 3.22309136e-01, + 4.24766541e-02, -6.64522529e-01, -1.60192788e-01, + -1.70335054e-01, 5.31250238e-02, -3.52184653e-01, + -1.29256070e-01, -2.02640295e-01, 3.90625000e-02, + -3.52141440e-01, -1.13940775e-01, -2.15763032e-01, + 5.18485069e-01, 2.81027079e-01, 5.16310573e-01, 3.30262184e-01, + -3.81103694e-01, 5.35552382e-01, 6.50866866e-01, + -8.27000558e-01, -4.86606359e-03, -3.28264713e-01, + 7.13574052e-01, -3.19576740e-01, -2.49190927e-02, + -2.40143239e-01, 6.89054728e-01, -4.32144880e-01, + -3.57967615e-03, -2.70481110e-01 ] + - [ -4.25435007e-01, 7.21232176e-01, 1.08587623e-01, + -7.94188678e-01, 4.20305610e-01, 4.50868130e-01, + 1.08711362e-01, -7.86669135e-01, 4.13855672e-01, + 4.29835200e-01, 1.12500072e-01, -3.79734516e-01, + 4.51990247e-01, 4.27358747e-01, 1.01562500e-01, + -3.56547534e-01, 4.56519485e-01, 4.10560846e-01, + 5.44334173e-01, 6.74390912e-01, 7.18785167e-01, + -6.75671816e-01, 3.95365596e-01, 3.81520391e-01, + 7.50288963e-01, -7.09458709e-01, 4.07555819e-01, + 3.21216702e-01, 7.31008649e-01, -4.69481945e-03, + 4.14480448e-01, 4.39522505e-01, 7.31343150e-01, + -5.15263081e-02, 4.13046479e-01, 4.11316633e-01 ] + - [ -4.05550957e-01, 7.90369272e-01, 1.41234875e-01, + -7.27609813e-01, 4.77663040e-01, 6.05716825e-01, + 1.34629250e-01, -8.77684236e-01, 5.51903009e-01, + 5.04478455e-01, 1.35937572e-01, -4.48372841e-01, + 5.78290939e-01, 5.16003966e-01, 1.26562595e-01, + -4.04988170e-01, 5.79664946e-01, 5.10039926e-01, + 6.20078206e-01, 7.92713284e-01, 7.86276698e-01, + -5.74337363e-01, 5.01433372e-01, 6.88648462e-01, + 8.26589465e-01, -9.09345865e-01, 6.45750523e-01, + 3.77521753e-01, 8.10709715e-01, -1.57946944e-01, + 6.47768140e-01, 5.62709570e-01, 7.93532133e-01, + -2.07325816e-01, 6.49964571e-01, 5.37797451e-01 ] + - [ 3.14830542e-02, 8.15505385e-01, 4.18026805e-01, + -8.11893404e-01, 5.78747511e-01, 6.58384800e-01, + 4.11087155e-01, -7.64950991e-01, 5.72827101e-01, + 6.80726051e-01, 4.18750048e-01, -4.28942323e-01, + 6.33991599e-01, 6.12402678e-01, 4.15624976e-01, + -4.03190851e-01, 6.42109036e-01, 6.00239158e-01, + 7.25879073e-01, 8.05900216e-01, 8.31270933e-01, + -7.18978405e-01, 5.87527752e-01, 5.96241355e-01, + 8.45086694e-01, -5.70329309e-01, 5.34690142e-01, + 6.97304845e-01, 8.40597749e-01, -2.86331177e-02, + 6.36951685e-01, 6.64657831e-01, 8.65671635e-01, + -1.74855709e-01, 6.51338577e-01, 5.68615198e-01 ] + - [ -2.88111091e-01, 7.02596188e-01, 2.09368348e-01, + -6.14426374e-01, 3.37924600e-01, 5.62905908e-01, + 2.06623435e-01, -6.39075696e-01, 3.61542821e-01, + 5.30602455e-01, 2.15625048e-01, -4.08707857e-01, + 4.53012228e-01, 4.12847400e-01, 2.10937619e-01, + -3.25567245e-01, 4.38608766e-01, 4.22387958e-01, + 6.86203718e-01, 7.33210087e-01, 7.66029358e-01, + -4.85404849e-01, 4.20085907e-01, 7.03830719e-01, + 8.15028787e-01, -6.06714010e-01, 4.61439967e-01, + 5.38984776e-01, 8.18181753e-01, -1.36059046e-01, + 5.55725217e-01, 4.84316707e-01, 8.18407774e-01, + -1.89026892e-01, 5.63573718e-01, 4.63597775e-01 ] + - [ -4.37241077e-01, 7.51759887e-01, 1.00070953e-01, + -8.14444959e-01, 4.67286587e-01, 4.84951019e-01, + 9.86322165e-02, -8.16562533e-01, 4.72064734e-01, + 4.68665600e-01, 8.90625715e-02, -4.52548146e-01, + 5.34270167e-01, 4.59923506e-01, 8.43750238e-02, + -3.40268612e-01, 5.04528999e-01, 4.76394296e-01, + 5.74391365e-01, 7.22295403e-01, 7.16535449e-01, + -6.55469596e-01, 4.67772126e-01, 5.10316491e-01, + 7.75722384e-01, -7.56479383e-01, 4.97376561e-01, + 3.81301045e-01, 7.80821919e-01, -3.36540937e-02, + 4.87030506e-01, 4.95536685e-01, 7.71144271e-01, + -6.67873025e-02, 4.78474379e-01, 4.70494390e-01 ] + - [ -3.82560074e-01, 6.60678148e-01, 1.36976600e-01, + -7.48231411e-01, 3.28021884e-01, 3.90088439e-01, + 1.30309582e-01, -7.17315435e-01, 3.25533390e-01, + 3.94496083e-01, 1.35937572e-01, -3.48257184e-01, + 3.64602208e-01, 3.54517698e-01, 1.23437524e-01, + -3.21173728e-01, 3.78395319e-01, 3.52602482e-01, + 5.07063389e-01, 5.60616851e-01, 6.37795210e-01, + -5.41994214e-01, 2.11750746e-01, 3.02380562e-01, + 6.53179169e-01, -5.11871874e-01, 2.08336353e-01, + 2.93432236e-01, 6.76214218e-01, 3.54170799e-03, 2.59058714e-01, + 2.75319219e-01, 6.66666508e-01, -2.16283202e-02, + 2.54703045e-01, 2.62138367e-01 ] + - [ -4.90886509e-01, 9.37826633e-02, -9.01347995e-02, + 1.91199780e-03, -5.08966148e-01, -3.31609249e-02, + -3.23972702e-02, -3.48660290e-01, -4.40696001e-01, + -2.87891448e-01, -1.09374523e-02, -2.78258681e-01, + -3.56107473e-01, -4.11554456e-01, -2.18750238e-02, + -4.49630618e-02, -3.98272693e-01, -3.57042253e-01, + 4.21701193e-01, 1.29086971e-01, 3.94825697e-01, 1.85849547e-01, + -4.47224319e-01, 1.93403602e-01, 5.32947779e-01, + -4.76487935e-01, -2.65560091e-01, -3.25189054e-01, + 5.81569076e-01, -2.16992676e-01, -2.25824654e-01, + -3.78834844e-01, 5.52238703e-01, -1.05054259e-01, + -2.58969307e-01, -3.37176204e-01 ] + - [ -4.28541899e-01, 7.21338749e-01, 1.05748773e-01, + -7.14685738e-01, 3.79156947e-01, 4.90814686e-01, + 1.02951884e-01, -7.61657715e-01, 4.08018589e-01, + 4.48671818e-01, 1.03125095e-01, -3.99667084e-01, + 4.54284668e-01, 4.13636208e-01, 9.84375477e-02, + -3.51038575e-01, 4.53249335e-01, 4.11112070e-01, + 5.95431328e-01, 6.94952607e-01, 7.43532062e-01, + -5.89051902e-01, 3.99327993e-01, 5.14443874e-01, + 7.57225275e-01, -7.07555294e-01, 4.49527502e-01, + 3.80185246e-01, 7.80821919e-01, -1.24586821e-01, + 4.85105872e-01, 4.17859793e-01, 7.76119351e-01, + -1.54129446e-01, 4.67691898e-01, 3.89603496e-01 ] + - [ -4.89229560e-01, 3.47174406e-02, -1.00071013e-01, + 3.17063451e-01, -6.43860340e-01, 2.51907110e-02, + -6.55146241e-02, -2.22446203e-01, -5.04751205e-01, + -2.82698512e-01, -7.81250000e-03, -2.64702201e-01, + -4.22654271e-01, -4.76843178e-01, -1.71874762e-02, + -2.07020223e-01, -4.26150024e-01, -4.74236906e-01, + 3.58581185e-01, 9.98226404e-02, 3.29583883e-01, 2.75554538e-01, + -4.86673474e-01, 2.38357067e-01, 3.66473913e-01, + -3.81959975e-01, -2.43656576e-01, -2.15044796e-01, + 5.19302607e-01, -3.73556793e-01, -2.02696383e-01, + -4.44735706e-01, 5.14925241e-01, -4.63836789e-01, + -1.89648151e-01, -4.63369131e-01 ] + - [ -4.56918001e-01, 6.98560357e-01, 6.60041571e-02, + -7.77900457e-01, 3.85873556e-01, 4.21772480e-01, + 6.55148029e-02, -8.12362075e-01, 4.08397317e-01, + 3.90901446e-01, 6.40624762e-02, -3.81047130e-01, + 4.26894426e-01, 3.94577026e-01, 5.31250238e-02, + -3.54573965e-01, 4.37094331e-01, 3.86809468e-01, + 5.33513665e-01, 6.67500138e-01, 6.94038272e-01, + -6.17594242e-01, 3.67183805e-01, 4.21983600e-01, + 7.22543240e-01, -7.20123768e-01, 4.38609362e-01, + 3.44984174e-01, 7.38480687e-01, -3.75913978e-02, + 4.10541177e-01, 4.08241987e-01, 7.18905449e-01, + -7.85223842e-02, 4.13772941e-01, 3.90365362e-01 ] + - [ -3.06959450e-01, 7.42272973e-01, 2.34918356e-01, + -8.74553382e-01, 4.32019949e-01, 3.87926340e-01, + 2.31101632e-01, -8.83279443e-01, 4.41218734e-01, + 3.75325918e-01, 2.21875072e-01, -4.50970292e-01, + 4.60205674e-01, 3.88932228e-01, 2.14062572e-01, + -4.25009906e-01, 4.68417764e-01, 3.77450466e-01, + 6.74782038e-01, 7.14619994e-01, 8.06524277e-01, + -7.96752036e-01, 5.07183909e-01, 3.72957706e-01, + 8.15028787e-01, -7.82103240e-01, 5.02942801e-01, + 3.59984040e-01, 8.28144431e-01, -4.10015583e-02, + 4.78736758e-01, 4.81584787e-01, 8.28358173e-01, + -8.62265229e-02, 4.74762559e-01, 4.52378988e-01 ] + - [ -2.41715014e-01, 7.40968347e-01, 2.61887908e-01, + -7.52889872e-01, 4.48461533e-01, 5.49135327e-01, + 2.44060516e-01, -7.05729425e-01, 4.56470251e-01, + 5.83986163e-01, 2.65625119e-01, -4.68186975e-01, + 5.35156250e-01, 4.61724043e-01, 2.60937452e-01, + -3.76547277e-01, 5.13910294e-01, 4.69331861e-01, + 6.92215204e-01, 7.01289535e-01, 7.63779521e-01, + -6.14230990e-01, 4.33580041e-01, 5.28438568e-01, + 7.50288963e-01, -4.54403758e-01, 4.07180548e-01, + 6.69726968e-01, 8.48069668e-01, -2.31094897e-01, + 5.27259707e-01, 3.77835751e-01, 8.18407774e-01, + -1.94891632e-01, 5.07859111e-01, 4.00949955e-01 ] + - [ 2.44614840e-01, 9.07952428e-01, 5.06032586e-01, + -8.71938527e-01, 7.58635759e-01, 8.20184469e-01, + 5.04679680e-01, -9.09708977e-01, 7.78435469e-01, + 7.84444571e-01, 5.15625119e-01, -4.45415556e-01, + 7.94050336e-01, 7.85142183e-01, 5.03124952e-01, + -4.09791291e-01, 7.98116684e-01, 7.74829507e-01, + 7.69161344e-01, 9.17175889e-01, 9.01012301e-01, + -8.08385909e-01, 7.80271292e-01, 7.32697725e-01, + 9.07514215e-01, -9.08732772e-01, 8.38903189e-01, + 6.34469271e-01, 9.00373459e-01, -5.66369891e-02, + 8.18276405e-01, 8.38650823e-01, 8.98009896e-01, + -1.19314492e-01, 8.26180339e-01, 8.02606225e-01 ] + - [ -4.97514546e-01, 2.50519037e-01, -3.33570242e-02, + -3.41765106e-01, -2.90308714e-01, -2.42127776e-02, + -6.47938251e-03, -6.45803690e-01, -2.02057242e-01, + -2.10156858e-01, -2.49999762e-02, -4.32371497e-02, + -2.30118752e-01, -1.32737696e-01, -2.18750238e-02, + -4.04384673e-01, -1.34265840e-01, -2.72455812e-01, + 3.91042948e-01, 1.60517812e-01, 4.69066381e-01, + -1.37877345e-01, -3.53784084e-01, -5.05967140e-02, + 4.82080936e-01, -6.46455824e-01, -1.54096305e-01, + -3.50461125e-01, 5.44209123e-01, 4.15328741e-02, + -2.50998974e-01, -2.54527688e-01, 5.54726362e-01, + -1.16109490e-01, -2.28697062e-01, -3.12488258e-01 ] + - [ -5.02485514e-01, 8.69081020e-02, -1.04329348e-01, + 2.10753798e-01, -5.70880532e-01, 6.43981695e-02, + -1.17350519e-01, 2.16784835e-01, -5.63689411e-01, + -3.95643711e-03, -4.99998927e-02, -1.58762753e-01, + -3.81031156e-01, -3.78068864e-01, -5.00000119e-02, + -2.36763299e-01, -3.53919268e-01, -4.12670076e-01, + 3.56777787e-01, 2.69756079e-01, 3.81327391e-01, 9.37614441e-02, + -2.48458207e-01, 4.50856805e-01, 4.26589608e-01, + -1.28751636e-01, -2.03461945e-01, 1.40809894e-01, + 5.14321208e-01, -2.78009295e-01, -1.58996582e-02, + -2.14301109e-01, 5.02487421e-01, -3.83607090e-01, + 1.06506348e-02, -2.37615347e-01 ] + - [ -2.97845960e-01, 8.45073462e-01, 2.30659962e-01, + -8.37218165e-01, 6.06689453e-01, 6.46411180e-01, + 2.25341916e-01, -8.82516682e-01, 6.37622118e-01, + 6.14457130e-01, 2.25000143e-01, -4.48536873e-01, + 6.70765162e-01, 6.25927210e-01, 2.18750119e-01, + -3.87520671e-01, 6.63666129e-01, 6.25326276e-01, + 6.38112426e-01, 8.38233352e-01, 8.02024841e-01, + -7.54452705e-01, 6.41426206e-01, 6.13169909e-01, + 8.15028787e-01, -8.52147579e-01, 7.08245397e-01, + 5.31965852e-01, 8.25653672e-01, -3.03635597e-02, + 6.61587477e-01, 6.89639449e-01, 8.08457613e-01, + -9.14781690e-02, 6.74373865e-01, 6.61417246e-01 ] + - [ -3.21043968e-01, 7.08419204e-01, 1.99432254e-01, + -8.07067633e-01, 3.97389174e-01, 4.17020917e-01, + 1.89344883e-01, -7.79759407e-01, 4.02258396e-01, + 4.30889130e-01, 1.76562548e-01, -4.00277913e-01, + 4.46287513e-01, 4.09287214e-01, 1.84374928e-01, + -3.54572475e-01, 4.36875343e-01, 3.95828724e-01, + 6.83799267e-01, 6.43622398e-01, 7.39032626e-01, + -6.54487967e-01, 3.81185412e-01, 3.94257545e-01, + 7.82658935e-01, -6.36881709e-01, 3.66641760e-01, + 3.64096999e-01, 7.95765877e-01, -1.98873878e-02, + 3.74463439e-01, 3.84979367e-01, 7.48756051e-01, + -9.49931145e-03, 3.74800205e-01, 4.03634071e-01 ] + - [ 1., 9.83561516e-01, 9.27608252e-01, -9.65385258e-01, + 9.51857209e-01, 9.76169229e-01, 9.40964699e-01, + -9.80706990e-01, 9.59753990e-01, 9.58606601e-01, + 9.31250095e-01, -4.77115452e-01, 9.65378404e-01, + 9.71073985e-01, 9.35937643e-01, -4.30701375e-01, + 9.65502620e-01, 9.64960814e-01, 8.79771590e-01, 9.79875922e-01, + 9.64004397e-01, -9.65979278e-01, 9.66381192e-01, + 7.44852781e-01, 9.79190588e-01, -9.15676355e-01, + 9.31344271e-01, 7.53983140e-01, 9.62640166e-01, + -5.44670224e-02, 9.28193450e-01, 9.62244749e-01, + 9.65173960e-01, -9.05410647e-02, 9.13161397e-01, + 9.23825383e-01 ] + - [ 1., 9.96557236e-01, 9.70191598e-01, -9.83905077e-01, + 9.87433553e-01, 1., 9.75522041e-01, -9.91294265e-01, + 9.99954939e-01, 9.98118877e-01, 9.92187500e-01, + -4.85359848e-01, 9.90819097e-01, 9.95209575e-01, + 9.76562738e-01, -4.54339862e-01, 1., 9.84947920e-01, + 7.96212792e-01, 9.94311094e-01, 9.25759315e-01, + -9.35208380e-01, 9.56252933e-01, 7.73679376e-01, + 9.49132800e-01, -9.85023439e-01, 9.81784701e-01, + 7.14277148e-01, 9.35242772e-01, -8.70890021e-02, + 9.59439278e-01, 9.64504123e-01, 9.35323358e-01, + -1.05418086e-01, 9.41903114e-01, 9.40481424e-01 ] + - [ -4.87365425e-01, 2.41612434e-01, -5.32292724e-02, + 2.41928935e-01, -4.76424158e-01, 2.75185704e-01, + -2.95175314e-02, -5.06955981e-02, -3.87779593e-01, + 4.61506844e-02, -1.56250000e-02, -2.08841681e-01, + -2.04011679e-01, -2.03590214e-01, -2.49999762e-02, + -1.23768270e-01, -2.14106679e-01, -1.89458013e-01, + 4.14487600e-01, 3.93541932e-01, 4.60067511e-01, + -6.58708215e-02, -1.06655419e-01, 4.71468568e-01, + 5.16762972e-01, -4.85690773e-01, 4.44041491e-02, + 8.27300549e-02, 5.81569076e-01, -1.75756872e-01, + 9.29534435e-02, -3.56084108e-02, 5.77114582e-01, + -1.76572859e-01, 8.07886124e-02, -3.39899659e-02 ] + - [ -3.57290804e-01, 6.10495329e-01, 1.71043277e-01, + -7.88995445e-01, 2.29372621e-01, 2.25590944e-01, + 1.63426876e-01, -7.73125350e-01, 2.29068756e-01, + 2.20568895e-01, 1.59374952e-01, -3.92836809e-01, + 2.57616401e-01, 2.02930450e-01, 1.53124928e-01, + -3.58069301e-01, 2.58208036e-01, 1.92405701e-01, + 5.71986675e-01, 5.47724962e-01, 7.14285731e-01, + -6.69436693e-01, 2.39538312e-01, 1.78368211e-01, + 7.29479671e-01, -7.03931212e-01, 2.64124155e-01, + 1.38044715e-01, 7.35990047e-01, -4.11509871e-02, + 2.33878970e-01, 2.14852333e-01, 7.31343150e-01, + -7.48499632e-02, 2.31575489e-01, 1.99198484e-01 ] + - [ -4.10936236e-01, 7.29527473e-01, 1.19943261e-01, + -8.47430587e-01, 4.64049697e-01, 4.45052981e-01, + 1.07271314e-01, -8.53357196e-01, 4.73794341e-01, + 4.32313323e-01, 1.07812524e-01, -3.96659613e-01, + 4.90964532e-01, 4.57524896e-01, 1.01562500e-01, + -3.53629053e-01, 4.89818096e-01, 4.50184107e-01, + 5.65975308e-01, 6.38138056e-01, 6.94038272e-01, + -7.05807447e-01, 3.93405914e-01, 3.33713174e-01, + 7.04046130e-01, -7.21795321e-01, 4.04770970e-01, + 2.96021104e-01, 7.26027369e-01, 3.88098955e-02, 3.58283877e-01, + 4.13696527e-01, 7.11442709e-01, 3.26225758e-02, 3.54537606e-01, + 4.14200425e-01 ] + - [ -4.05550957e-01, 7.46270657e-01, 1.34137630e-01, + -6.34892344e-01, 3.84076595e-01, 5.94508767e-01, + 1.30309582e-01, -8.22674036e-01, 4.66959953e-01, + 4.59427357e-01, 1.34375095e-01, -4.38392997e-01, + 5.06501675e-01, 4.43888068e-01, 1.28125072e-01, + -3.70485187e-01, 5.00701189e-01, 4.50576544e-01, + 6.26089573e-01, 7.62873530e-01, 7.72778511e-01, + -4.43521738e-01, 4.18798923e-01, 7.68146515e-01, + 8.01155925e-01, -8.92035484e-01, 6.22247338e-01, + 3.67155552e-01, 7.98256516e-01, -2.03471482e-01, + 6.22681141e-01, 4.97253537e-01, 7.96019912e-01, + -2.57343113e-01, 6.27592325e-01, 4.73982811e-01 ] + - [ -4.88193870e-01, 1.48588419e-01, -6.60042763e-02, + -1.54184043e-01, -4.39237595e-01, -6.93399906e-02, + -5.11158109e-02, -8.99680853e-02, -4.37500894e-01, + -6.88210130e-02, -4.68742847e-03, -1.80721879e-01, + -3.18013608e-01, -3.16624701e-01, -2.49999762e-02, + -9.48163867e-02, -3.17682743e-01, -2.91626632e-01, + 4.21100020e-01, 1.87512159e-01, 4.89313841e-01, + -3.04557920e-01, -2.46855497e-01, -7.85970688e-02, + 4.42774534e-01, -5.02594113e-02, -2.90028393e-01, + 9.45206881e-02, 5.74097157e-01, -2.03945100e-01, + -1.43048823e-01, -2.90611684e-01, 4.70149159e-01, + 1.15058422e-02, -1.83652461e-01, -1.91390038e-01 ] + - [ -3.82560074e-01, 6.54584050e-01, 1.34137630e-01, + -5.92937708e-01, 2.75378942e-01, 4.99286532e-01, + 1.31749511e-01, -8.45199168e-01, 3.72486591e-01, + 3.20609450e-01, 1.42187476e-01, -4.88295674e-01, + 4.01077509e-01, 2.90105939e-01, 1.28125072e-01, + -3.61519992e-01, 3.81060839e-01, 3.24389815e-01, + 6.02043748e-01, 5.71504474e-01, 6.73790812e-01, + -2.31531680e-01, 1.24079943e-01, 6.22703195e-01, + 7.15606928e-01, -7.94727683e-01, 3.46455932e-01, + 1.32313490e-01, 7.26027369e-01, -2.50561953e-01, + 3.66493583e-01, 1.93531752e-01, 7.18905449e-01, + -2.16827989e-01, 3.33083034e-01, 2.00481176e-01 ] + - [ -4.50290024e-01, 7.16851830e-01, 8.44570398e-02, + -7.70930529e-01, 3.98874879e-01, 4.48212743e-01, + 8.13536644e-02, -8.23841929e-01, 4.23087478e-01, + 3.98650050e-01, 8.43750238e-02, -3.53662372e-01, + 4.37040687e-01, 4.29028273e-01, 7.34374523e-02, + -4.14712250e-01, 4.76664901e-01, 3.83980155e-01, + 5.55154800e-01, 6.74563766e-01, 7.34533191e-01, + -6.81220710e-01, 3.99494290e-01, 3.81256819e-01, + 7.41040349e-01, -7.97371864e-01, 4.55944538e-01, + 2.70586610e-01, 7.48443365e-01, 5.12611866e-03, 4.10152197e-01, + 4.43353891e-01, 7.38805890e-01, -5.89273572e-02, + 4.22745466e-01, 4.16054606e-01 ] + - [ 1., 9.82658029e-01, 7.67210722e-01, -9.88349617e-01, + 9.36839223e-01, 9.18812990e-01, 7.79697657e-01, + -9.60185766e-01, 9.29494023e-01, 9.34498787e-01, + 7.85937548e-01, -4.66827273e-01, 9.30413604e-01, + 9.34409499e-01, 7.74999857e-01, -4.08365548e-01, + 9.27147150e-01, 9.34716344e-01, 7.86594510e-01, 9.78867412e-01, + 9.01012301e-01, -9.55681801e-01, 9.52174544e-01, + 7.32826948e-01, 9.49132800e-01, -9.62439775e-01, + 9.46865916e-01, 7.02296019e-01, 9.25280333e-01, + -9.09943581e-02, 9.35191393e-01, 9.34231162e-01, + 9.12935138e-01, -9.96194482e-02, 9.18226242e-01, + 9.19605613e-01 ] + - [ -7.23487973e-01, -8.39577794e-01, -5.82682729e-01, + 1.37553334e-01, -9.96247530e-01, -9.09216166e-01, + -5.27717829e-01, 6.65014982e-02, -9.89640594e-01, + -9.34762836e-01, -5.37500024e-01, 4.57875729e-01, + -9.88960922e-01, -9.41745520e-01, -5.00000000e-01, + 3.32540870e-01, -9.83419716e-01, -9.57652628e-01, + -2.26330101e-01, -6.41727448e-01, -2.30596185e-01, + 5.16015053e-01, -9.70714450e-01, -6.88885272e-01, + -1.86127245e-01, 1.57134652e-01, -9.11007345e-01, + -8.18038225e-01, -2.12951481e-01, 3.66589189e-01, + -9.05444384e-01, -8.54495287e-01, -2.06467748e-01, + -7.34862685e-02, -8.47100019e-01, -9.09842014e-01 ] + - [ -6.40016556e-01, -6.76595151e-01, -3.95315826e-01, + 3.55539799e-01, -9.84241307e-01, -7.71120429e-01, + -3.88048947e-01, 3.91163826e-01, -9.82526302e-01, + -7.97361374e-01, -3.04687500e-01, 5.65445423e-01, + -9.64991868e-01, -8.68802190e-01, -3.10937524e-01, + 5.90686679e-01, -9.65352535e-01, -8.67677987e-01, + 8.32581520e-02, -3.85652900e-01, 5.51180840e-02, + 5.46427011e-01, -8.71605456e-01, -3.45284104e-01, + 6.12715483e-02, 3.83291602e-01, -8.36324215e-01, + -4.91743207e-01, 2.30386019e-01, 6.16121292e-03, + -7.15991378e-01, -7.63684869e-01, 2.06467628e-01, + 4.35328484e-03, -7.14626431e-01, -7.54995942e-01 ] + - [ -7.20588207e-01, -9.12176013e-01, -5.72746634e-01, + 7.48157501e-03, -9.98252869e-01, -9.60970461e-01, + -5.73794007e-01, 6.96498156e-02, -9.98010993e-01, + -9.63209689e-01, -5.40624976e-01, 4.54711914e-01, + -9.98151839e-01, -9.70397770e-01, -5.26562452e-01, + 4.61672902e-01, -9.98027086e-01, -9.72300589e-01, + -3.15900207e-01, -7.51348019e-01, -2.05849290e-01, + 5.01127720e-01, -9.91028666e-01, -8.07108283e-01, + -2.06936479e-01, 5.33776522e-01, -9.87754464e-01, + -8.17978561e-01, -1.78082287e-01, 6.57593608e-01, + -9.74431276e-01, -8.83585095e-01, -1.84079647e-01, + 5.71943760e-01, -9.70591009e-01, -8.96350861e-01 ] + - [ -5.76636314e-01, -2.67782092e-01, -3.08729649e-01, + 2.37035871e-01, -7.99365342e-01, -3.55191052e-01, + -2.90136755e-01, 2.76251078e-01, -7.90461779e-01, + -3.82775903e-01, -2.18750000e-01, -7.33584166e-03, + -6.80021048e-01, -6.56320095e-01, -2.18750000e-01, + -1.77589834e-01, -6.42327070e-01, -6.99673414e-01, + 1.04899168e-01, -7.73963332e-02, 1.04611874e-01, + 1.24214053e-01, -5.49376369e-01, -8.49560499e-02, + 6.82079792e-02, 3.51693630e-02, -4.77506995e-01, + -1.36888981e-01, 2.02988744e-01, -2.85938442e-01, + -3.28470290e-01, -5.28444290e-01, 2.33830810e-01, + -5.21489382e-01, -2.98609495e-01, -5.99002600e-01 ] + - [ -9.11143303e-01, -9.94755924e-01, -8.31085861e-01, + -2.05644727e-01, -9.98658538e-01, -9.96715486e-01, + -8.48812103e-01, -1.58219814e-01, -9.98714983e-01, + -9.98032212e-01, -7.51562476e-01, 1.54878378e-01, + -9.98762727e-01, -9.99055505e-01, -7.50000000e-01, + 1.85267687e-01, -9.98912871e-01, -9.99274492e-01, + -7.27081478e-01, -9.40276802e-01, -5.63554525e-01, + 2.14062214e-01, -9.99594748e-01, -9.78191018e-01, + -5.81502914e-01, 2.38117933e-01, -9.98548210e-01, + -9.81068730e-01, -5.11830688e-01, 4.04214978e-01, + -9.98758495e-01, -9.87453520e-01, -4.92537320e-01, + 3.78174186e-01, -9.98684287e-01, -9.88446236e-01 ] + - [ -7.22452402e-01, -8.76188517e-01, -5.13129890e-01, + 6.93516731e-02, -9.97904658e-01, -9.45395350e-01, + -5.30597568e-01, 1.59256101e-01, -9.98226047e-01, + -9.44712400e-01, -4.62499917e-01, 5.23783803e-01, + -9.97671247e-01, -9.59971130e-01, -4.81249988e-01, + 5.52653432e-01, -9.97862041e-01, -9.58846509e-01, + -1.75233006e-01, -6.77203059e-01, -5.51180840e-02, + 5.23542643e-01, -9.82028842e-01, -7.55830228e-01, + -4.50868011e-02, 5.95066309e-01, -9.81172621e-01, + -7.60805964e-01, 1.24526024e-03, 5.22130847e-01, + -9.47807848e-01, -8.74733210e-01, 3.48258018e-02, + 5.70369482e-01, -9.54652846e-01, -8.71775270e-01 ] + - [ -4.42626357e-01, -4.90035474e-01, -1.18523836e-01, + 5.02307296e-01, -9.56350446e-01, -6.06342793e-01, + -1.57667279e-01, 4.55776811e-01, -9.32749391e-01, + -6.19363070e-01, 2.81250477e-02, 4.33715105e-01, + -8.99458945e-01, -7.93957353e-01, -1.56247616e-03, + 5.04209161e-01, -9.00501847e-01, -7.79987991e-01, + 6.36910081e-01, -1.49529636e-01, 3.99325013e-01, + 3.29574227e-01, -7.03956962e-01, -1.75374448e-01, + 2.90173411e-01, 5.09613633e-01, -6.92656159e-01, + -2.86984444e-02, 7.26027369e-01, -5.62539577e-01, + -4.44544554e-01, -7.24127889e-01, 6.51741385e-01, + -2.77747095e-01, -5.06343722e-01, -6.56009078e-01 ] + - [ -4.52775478e-01, -3.86295378e-01, -6.88431263e-02, + 5.89872479e-01, -9.43876982e-01, -5.08374214e-01, + -1.18790448e-01, 8.60636592e-01, -9.56620097e-01, + -4.52139437e-01, 9.37509537e-03, 6.85525894e-01, + -8.82753432e-01, -6.77847743e-01, 1.56259537e-03, + 5.72144866e-01, -8.69543791e-01, -7.03561425e-01, + 5.93026757e-01, 4.94980812e-02, 5.16310573e-01, 2.99781561e-01, + -5.94616115e-01, 2.87553072e-02, 4.47398663e-01, + 6.54816389e-01, -6.48978829e-01, 2.46039867e-01, + 6.21419668e-01, -7.59913325e-02, -3.40271056e-01, + -4.14430797e-01, 6.46766305e-01, -3.37576509e-01, + -2.93175578e-01, -4.88546431e-01 ] + - [ -5.22162437e-01, -3.86237800e-01, -1.89496160e-01, + 6.27253413e-01, -9.39469218e-01, -4.46303427e-01, + -1.43268466e-01, 3.47598791e-01, -8.97242546e-01, + -5.89554489e-01, -1.06249928e-01, 3.54716063e-01, + -8.33334506e-01, -7.15741992e-01, -1.07812524e-01, + 3.22978973e-01, -8.28043222e-01, -7.29357004e-01, + 2.87045360e-01, -7.82111883e-02, 2.77840257e-01, + 5.47542095e-01, -7.25363314e-01, 4.68049049e-02, + 3.61849546e-01, -2.68316865e-02, -5.68490565e-01, + -3.51460874e-01, 3.87297511e-01, 2.01385021e-02, + -4.72874820e-01, -5.05904198e-01, 4.07960176e-01, + -2.35650241e-01, -4.24911439e-01, -5.70191145e-01 ] + - [ -7.62634635e-01, -9.96104002e-01, -5.35840988e-01, + -2.35338926e-01, -9.98358607e-01, -9.99153137e-01, + -6.14110887e-01, -1.74634278e-01, -9.98457372e-01, + -9.99068320e-01, -3.62500012e-01, 1.27505541e-01, + -9.98787999e-01, -1., -4.01562452e-01, 1.60961270e-01, + -9.98732388e-01, -9.99915898e-01, -4.95040655e-01, + -9.90180910e-01, -6.44544482e-01, 1.04780436e-01, + -9.99348998e-01, -9.98450279e-01, -7.54913330e-01, + 1.60443068e-01, -9.99056756e-01, -9.96914804e-01, + -2.80199170e-01, 2.54235029e-01, -9.99198496e-01, + -9.99654591e-01, -3.03482592e-01, 2.36683249e-01, + -9.99231994e-01, -9.99544144e-01 ] + - [ -7.06503749e-01, -9.90328014e-01, -5.04613280e-01, + -2.28535235e-01, -9.98457968e-01, -9.98858929e-01, + -5.06119490e-01, -1.75075769e-01, -9.98383939e-01, + -9.98992205e-01, -3.70312512e-01, 1.40890002e-01, + -9.98587191e-01, -9.99359131e-01, -3.89062464e-01, + 1.73754692e-01, -9.98560905e-01, -9.99283612e-01, + -5.06462336e-01, -9.89590406e-01, -6.67041659e-01, + 1.19717836e-01, -9.99488711e-01, -9.96637523e-01, + -6.50867105e-01, 1.74014807e-01, -9.99645829e-01, + -9.97723222e-01, -4.17185605e-01, 2.98783541e-01, + -9.99627709e-01, -9.98470545e-01, -3.93034816e-01, + 2.79219270e-01, -9.99673724e-01, -9.98566091e-01 ] + - [ -7.40265131e-01, -8.02417636e-01, -5.69907665e-01, + 9.37095881e-02, -9.89174724e-01, -8.94620717e-01, + -5.85313141e-01, 1.74634695e-01, -9.88354981e-01, + -8.92066956e-01, -5.78124940e-01, 4.04500127e-01, + -9.77907479e-01, -9.26316738e-01, -5.71874976e-01, + 3.58730793e-01, -9.74956810e-01, -9.36116815e-01, + -3.86835039e-01, -6.39405489e-01, -3.72328401e-01, + 2.48825073e-01, -9.27371860e-01, -7.44194865e-01, + -4.12716806e-01, 3.57693911e-01, -9.26056087e-01, + -7.07077444e-01, -4.22166944e-01, 2.54876852e-01, + -8.69652271e-01, -8.45412970e-01, -4.12935317e-01, + 4.04886007e-02, -8.39398265e-01, -8.77034724e-01 ] + - [ -5.12841761e-01, -3.83761048e-01, -1.32718265e-01, + 4.92924213e-01, -9.26033258e-01, -5.07451296e-01, + -1.70626342e-01, 7.07188129e-01, -9.37003911e-01, + -4.72154558e-01, -9.53124762e-02, 4.01133895e-01, + -8.42453659e-01, -7.12682247e-01, -9.84374285e-02, + 4.81407881e-01, -8.51442397e-01, -7.05327749e-01, + 4.55966353e-01, 1.45695210e-02, 3.99325013e-01, 2.14049339e-01, + -5.52870750e-01, 1.43625736e-02, 3.96531701e-01, + 4.79062319e-01, -6.19607270e-01, 9.94495153e-02, + 5.16811967e-01, -2.23473489e-01, -3.35259259e-01, + -4.89553690e-01, 5.34825802e-01, -2.74213552e-01, + -3.35468709e-01, -5.00719547e-01 ] + - [ -6.02734029e-01, -5.68141580e-01, -3.11568499e-01, + 7.00241208e-01, -9.90068018e-01, -6.15272045e-01, + -2.18142509e-01, 1.90223932e-01, -9.43228364e-01, + -7.80523062e-01, -1.51562393e-01, 3.55687737e-01, + -9.20159042e-01, -8.46941829e-01, -1.64062440e-01, + 5.17860651e-01, -9.32442367e-01, -8.27774584e-01, + 3.70002985e-01, -2.56457031e-01, 3.04836869e-01, + 9.78078365e-01, -9.03053284e-01, 5.76114655e-03, + 3.73410344e-01, -1.41970932e-01, -6.62867546e-01, + -5.99093497e-01, 5.31755924e-01, -5.09312987e-01, + -5.33487380e-01, -7.79381812e-01, 5.44776201e-01, + -3.13012481e-01, -5.87194920e-01, -7.42759347e-01 ] + - [ -6.94697618e-01, -7.27313042e-01, -4.63449240e-01, + 2.30844140e-01, -9.84423220e-01, -8.26276124e-01, + -4.84521210e-01, 3.83721590e-01, -9.89690304e-01, + -8.22586894e-01, -3.84374976e-01, 5.92447162e-01, + -9.77576971e-01, -8.88277173e-01, -3.79687488e-01, + 5.21591663e-01, -9.72754300e-01, -8.99503052e-01, + 1.77335739e-02, -4.05060410e-01, -3.71202826e-02, + 3.82653475e-01, -8.43612909e-01, -4.29094136e-01, + -7.05202818e-02, 4.13796425e-01, -8.35223317e-01, + -4.52014446e-01, 9.58904028e-02, -4.88542914e-02, + -6.98939085e-01, -7.69957304e-01, 7.96018839e-02, + -2.50120997e-01, -6.67978644e-01, -8.03249538e-01 ] + - [ -6.37323976e-01, -8.57388020e-01, -3.95315826e-01, + 1.62637234e-01, -9.99505997e-01, -9.37026739e-01, + -3.34773242e-01, 1.79472327e-01, -9.98445213e-01, + -9.48416173e-01, -2.49999940e-01, 5.69458246e-01, + -9.97975945e-01, -9.59016442e-01, -2.79687464e-01, + 6.08867168e-01, -9.98385131e-01, -9.57210183e-01, + 5.96633673e-01, -5.96084356e-01, 4.24072027e-01, + 7.79657006e-01, -9.88635421e-01, -6.55554295e-01, + 5.74566364e-01, 5.00244975e-01, -9.64097261e-01, + -7.77416468e-01, 7.45952725e-01, 5.49280047e-01, + -9.40043867e-01, -8.64161074e-01, 7.28855848e-01, + 6.58884048e-01, -9.49498653e-01, -8.50517750e-01 ] + - [ -7.17274249e-01, -9.98995185e-01, -5.65649390e-01, + -2.14469135e-01, -9.99119580e-01, -9.99043047e-01, + -5.69474459e-01, -1.60428047e-01, -9.99163449e-01, + -9.99406338e-01, -4.34374988e-01, 1.63193583e-01, + -9.99277353e-01, -9.99504387e-01, -4.23437476e-01, + 1.90326810e-01, -9.99321759e-01, -9.99698937e-01, + -4.28313851e-01, -9.74724650e-01, -4.98312652e-01, + 1.61698818e-01, -9.99736130e-01, -9.92248476e-01, + -4.91329491e-01, 2.13686347e-01, -9.99759793e-01, + -9.93572116e-01, -3.42465758e-01, 3.66855621e-01, + -9.99779284e-01, -9.95074272e-01, -3.53233814e-01, + 3.45592976e-01, -9.99752581e-01, -9.95203137e-01 ] + - [ -4.94200528e-01, -3.63380194e-01, -1.17104411e-01, + 7.33276248e-01, -9.50106323e-01, -4.20604944e-01, + -7.99134970e-02, 6.69229984e-01, -9.32783186e-01, + -4.95672286e-01, -2.18750238e-02, 5.91957688e-01, + -8.62127602e-01, -6.75132513e-01, -3.74999642e-02, + 5.88201165e-01, -8.57382655e-01, -6.75310850e-01, + 3.92846465e-01, 5.15557528e-02, 3.90326262e-01, 5.51804900e-01, + -6.55822992e-01, 2.23261356e-01, 4.65895891e-01, + 2.40889311e-01, -5.65732121e-01, -6.80045485e-02, + 4.96886611e-01, -1.46584809e-01, -3.22924376e-01, + -4.38091874e-01, 4.90049601e-01, -1.50658786e-01, + -3.31305921e-01, -4.36072171e-01 ] + - [ -6.79991722e-01, -8.69228959e-01, -4.94677067e-01, + 1.21632695e-01, -9.99322832e-01, -9.41855431e-01, + -5.03239751e-01, 1.98802948e-01, -9.99235451e-01, + -9.43160295e-01, -4.37499940e-01, 5.71734905e-01, + -9.98389006e-01, -9.56453383e-01, -4.40625012e-01, + 5.84349990e-01, -9.98332381e-01, -9.57028151e-01, + 2.67207623e-01, -6.23388410e-01, 2.05849290e-01, + 6.41189098e-01, -9.84973133e-01, -7.12563217e-01, + 2.43930459e-01, 6.87248349e-01, -9.82448816e-01, + -7.30382919e-01, 3.15068483e-01, 6.84430003e-01, + -9.51486707e-01, -8.41466129e-01, 3.10945153e-01, + 6.77734137e-01, -9.52180564e-01, -8.43543530e-01 ] + - [ -5.00414252e-01, -5.51838219e-01, -1.29879296e-01, + 6.32429361e-01, -9.86597359e-01, -6.64024293e-01, + -1.44708395e-01, 7.19176173e-01, -9.85703647e-01, + -6.77421927e-01, 0., 8.87451291e-01, -9.62706506e-01, + -7.82569408e-01, -7.81250000e-03, 8.92425895e-01, + -9.62754369e-01, -7.83876181e-01, 6.36309028e-01, + -1.01932585e-01, 5.65804243e-01, 7.64750361e-01, + -8.12477291e-01, 3.44766378e-02, 5.79190731e-01, + 7.19747782e-01, -7.91273236e-01, -7.29997754e-02, + 6.43835664e-01, 1.47495031e-01, -5.57265580e-01, + -5.31154871e-01, 6.74129248e-01, 1.22457266e-01, + -5.68800211e-01, -5.47879219e-01 ] + - [ -5.93206286e-01, -6.19144559e-01, -2.88857400e-01, + 4.63155389e-01, -9.84153390e-01, -7.26359129e-01, + -2.69978404e-01, 4.54765201e-01, -9.78738904e-01, + -7.63597727e-01, -1.78124964e-01, 5.93579292e-01, + -9.55763221e-01, -8.45546842e-01, -1.90624952e-01, + 6.63951039e-01, -9.59385157e-01, -8.38051498e-01, + 2.26329923e-01, -2.96438992e-01, 2.01349735e-01, + 5.76924562e-01, -8.40377986e-01, -2.33550012e-01, + 2.16184974e-01, 3.11298013e-01, -7.79309332e-01, + -4.33170021e-01, 3.67372394e-01, -1.14654422e-01, + -6.33726954e-01, -7.26919174e-01, 3.15920472e-01, + 3.63504887e-03, -6.56523108e-01, -6.95008457e-01 ] + - [ -6.57000840e-01, -8.28758121e-01, -4.50674236e-01, + 1.94547415e-01, -9.98658657e-01, -9.16306078e-01, + -4.61483061e-01, 2.76808619e-01, -9.98556972e-01, + -9.17866945e-01, -3.78125012e-01, 6.28738284e-01, + -9.96397495e-01, -9.38854635e-01, -3.79687488e-01, + 6.35850906e-01, -9.96222556e-01, -9.39897001e-01, + 2.89449930e-01, -5.59738517e-01, 2.26096749e-01, + 6.41716957e-01, -9.71887946e-01, -6.43760562e-01, + 2.57803440e-01, 6.85735583e-01, -9.68503118e-01, + -6.65056229e-01, 3.02615166e-01, 5.81179857e-01, + -9.16189611e-01, -8.10424089e-01, 2.88557172e-01, + 5.62808514e-01, -9.15743470e-01, -8.13119709e-01 ] + - [ -6.28210425e-01, -4.23435867e-01, -3.15826833e-01, + 3.34446073e-01, -9.10455167e-01, -5.48891068e-01, + -3.10295165e-01, 4.42053795e-01, -9.07487392e-01, + -5.38823366e-01, -2.59374917e-01, 1.85750961e-01, + -8.14312041e-01, -7.48666167e-01, -2.98437476e-01, + 2.41638541e-01, -8.09353948e-01, -7.32147813e-01, + 8.02524090e-02, -1.23552442e-01, 2.14848161e-01, + -2.60169506e-02, -5.67572951e-01, -2.94772923e-01, + 1.65317893e-01, 2.54330873e-01, -6.13320827e-01, + -1.41224921e-01, 2.82689810e-01, -3.11456740e-01, + -3.89641285e-01, -5.91971397e-01, 1.84079528e-01, + -8.97732973e-02, -4.27923858e-01, -5.09862542e-01 ] + - [ -7.00289965e-01, -9.95115101e-01, -3.92476916e-01, + -2.44339049e-01, -9.98198211e-01, -9.99456465e-01, + -4.88840878e-01, -1.78106308e-01, -9.98630285e-01, + -9.99548078e-01, -2.79687464e-01, 1.32523894e-01, + -9.98759687e-01, -9.99808311e-01, -2.68750012e-01, + 1.61111236e-01, -9.98837829e-01, -1., -5.34114838e-01, + -9.97190058e-01, -6.42294705e-01, 9.67779160e-02, + -9.99509752e-01, -1., -7.73410439e-01, 1.57034874e-01, + -9.99341369e-01, -9.98269856e-01, -3.32503140e-01, + 2.54875183e-01, -9.99489248e-01, -1., -3.50746274e-01, + 2.29247332e-01, -9.99407411e-01, -1. ] + - [ -6.77920461e-01, -8.28080654e-01, -4.49254811e-01, + 2.18849659e-01, -9.99575913e-01, -9.17707026e-01, + -4.91720617e-01, 3.28263402e-01, -9.99768496e-01, + -9.12501633e-01, -4.01562452e-01, 7.21723318e-01, + -9.99011040e-01, -9.35061038e-01, -3.98437500e-01, + 7.20164537e-01, -9.98832643e-01, -9.36974108e-01, + 4.57168579e-01, -5.00098526e-01, 4.30821061e-01, + 7.55349636e-01, -9.73191559e-01, -5.78175366e-01, + 3.80346775e-01, 9.81776118e-01, -9.83877897e-01, + -5.40338516e-01, 6.31382346e-01, 9.18533444e-01, + -9.41351771e-01, -7.53065288e-01, 6.16915345e-01, + 8.50075722e-01, -9.36684966e-01, -7.67060280e-01 ] + - [ -5.39768040e-01, -7.13965356e-01, -2.06529438e-01, + 3.21002364e-01, -9.90513027e-01, -8.35432649e-01, + -2.10943103e-01, 4.32413220e-01, -9.92123187e-01, + -8.39574516e-01, -1.60937488e-01, 7.20009327e-01, + -9.82083142e-01, -8.77582312e-01, -1.29687488e-01, + 6.61550164e-01, -9.80064750e-01, -8.90674293e-01, + 6.65163755e-01, -3.57276559e-01, 5.38807631e-01, + 7.23741412e-01, -9.22752440e-01, -3.91110837e-01, + 5.28323650e-01, 7.15044975e-01, -9.09229279e-01, + -4.37198937e-01, 5.41718483e-01, 5.84812045e-01, + -8.09654474e-01, -6.50343478e-01, 5.92039704e-01, + 2.60890722e-01, -7.69986510e-01, -7.20982432e-01 ] + - [ -7.29908824e-01, -7.11264729e-01, -4.67707634e-01, + 2.59640098e-01, -9.85469818e-01, -8.16361845e-01, + -5.16198695e-01, 4.45202708e-01, -9.90773916e-01, + -7.95270205e-01, -4.57812488e-01, 5.08391738e-01, + -9.66120481e-01, -8.80478501e-01, -4.51562464e-01, + 6.39932752e-01, -9.74897265e-01, -8.70294333e-01, + -2.20919788e-01, -4.53234613e-01, -1.47356570e-01, + 2.93776870e-01, -8.48027349e-01, -5.21155536e-01, + -1.16762996e-01, 5.24605870e-01, -8.88171196e-01, + -4.84296203e-01, -1.03362381e-01, 8.07785988e-03, + -7.19492674e-01, -7.73271441e-01, -7.21393228e-02, + 4.32401896e-02, -7.39580572e-01, -7.70561516e-01 ] + - [ -7.03811049e-01, -6.77715600e-01, -5.27324319e-01, + 3.66072059e-01, -9.84161437e-01, -7.43400216e-01, + -4.61483061e-01, 7.68494606e-03, -9.45268750e-01, + -8.52878213e-01, -5.09374976e-01, 5.40267944e-01, + -9.53002512e-01, -8.40948999e-01, -5.03124952e-01, + 3.67343426e-03, -8.96064222e-01, -9.14084435e-01, + -2.04087794e-01, -4.77377295e-01, -2.01349795e-01, + 4.50486064e-01, -8.96738768e-01, -4.90560472e-01, + -1.97687924e-01, -1.73449934e-01, -7.31100440e-01, + -7.45418668e-01, -2.00498223e-01, 1.87488556e-01, + -7.66748548e-01, -7.52820671e-01, -1.66666687e-01, + -3.35312665e-01, -6.73975170e-01, -8.45990479e-01 ] + - [ -5.37075400e-01, -5.50753117e-01, -2.30660081e-01, + 5.68038225e-01, -9.78756487e-01, -6.45780563e-01, + -1.66306674e-01, 4.48506832e-01, -9.63863075e-01, + -7.20344424e-01, -1.14062428e-01, 6.10938430e-01, + -9.35034335e-01, -8.00028086e-01, -1.09375000e-01, + 5.70257187e-01, -9.31434572e-01, -8.11480582e-01, + 3.12894464e-01, -2.01854289e-01, 2.91338563e-01, + 7.00788617e-01, -8.42535675e-01, -1.06823504e-01, + 3.73410344e-01, 2.60723233e-01, -7.42624879e-01, + -4.05421376e-01, 3.94769549e-01, 1.64501548e-01, + -6.24538064e-01, -5.99783301e-01, 4.05472755e-01, + -9.39432383e-02, -5.78521967e-01, -6.54988766e-01 ] + - [ -9.03479695e-01, -9.19660330e-01, -7.34563529e-01, + -7.50406981e-02, -9.96623516e-01, -9.67752278e-01, + -7.62418985e-01, 4.97341156e-04, -9.97469544e-01, + -9.69198525e-01, -7.40625024e-01, 3.35368156e-01, + -9.96702492e-01, -9.77618694e-01, -7.46874988e-01, + 3.57867956e-01, -9.96776640e-01, -9.78115857e-01, + -7.31289506e-01, -7.80576527e-01, -5.18560171e-01, + 3.08713555e-01, -9.79694486e-01, -8.46219420e-01, + -5.39884448e-01, 3.44575644e-01, -9.78180766e-01, + -8.60762715e-01, -5.31755984e-01, 3.26807141e-01, + -9.51416135e-01, -9.24335182e-01, -5.37313461e-01, + 2.96418190e-01, -9.51790750e-01, -9.28145409e-01 ] + - [ -7.40679383e-01, -9.51557219e-01, -6.38041139e-01, + -1.02630734e-01, -9.98343647e-01, -9.82788265e-01, + -6.31389499e-01, -4.41507697e-02, -9.98230159e-01, + -9.84130681e-01, -5.90624928e-01, 3.05177450e-01, + -9.98299718e-01, -9.87883925e-01, -5.60937464e-01, + 3.21221113e-01, -9.98301208e-01, -9.89073336e-01, + -3.92846465e-01, -8.48923385e-01, -3.72328401e-01, + 3.18482041e-01, -9.94255662e-01, -9.14494276e-01, + -3.73410404e-01, 3.53974342e-01, -9.91748691e-01, + -9.17661190e-01, -3.84806991e-01, 4.65249658e-01, + -9.85341907e-01, -9.48661745e-01, -3.68159294e-01, + 3.54181886e-01, -9.79748189e-01, -9.57314074e-01 ] + - [ -6.18682742e-01, -4.96791542e-01, -3.37118506e-01, + 3.31859231e-01, -9.39087570e-01, -6.30586028e-01, + -3.54931593e-01, 4.71028209e-01, -9.44081843e-01, + -6.21891022e-01, -3.32812488e-01, 2.98107862e-01, + -8.64563763e-01, -7.77938724e-01, -3.32812488e-01, + 2.93878794e-01, -8.61861825e-01, -7.85042703e-01, + 1.72828197e-01, -2.25341320e-01, 1.18110180e-01, + 2.25787044e-01, -7.27700233e-01, -3.31107438e-01, + 1.63005710e-01, 2.65414238e-01, -7.31437683e-01, + -3.72551203e-01, 1.80572867e-01, 5.33211231e-03, + -5.69588840e-01, -6.17528081e-01, 1.61691427e-01, + -4.30640578e-02, -5.64201236e-01, -6.24392331e-01 ] + - [ -4.70381141e-01, -5.09423733e-01, -9.86515880e-02, + 5.99807620e-01, -9.77532804e-01, -6.37860239e-01, + -1.51907802e-01, 8.04975510e-01, -9.81990635e-01, + -6.06889486e-01, 1.40625238e-02, 8.89451027e-01, + -9.49904323e-01, -7.48903334e-01, 7.81250000e-03, + 7.88532853e-01, -9.41914320e-01, -7.67067969e-01, + 6.24286175e-01, -6.03045821e-02, 5.25309443e-01, + 4.96818542e-01, -7.34336615e-01, -6.24400377e-02, + 4.72832322e-01, 8.35979581e-01, -7.78951168e-01, + 1.09988928e-01, 6.48816824e-01, 1.35236979e-01, + -5.16918242e-01, -4.92222011e-01, 6.64179087e-01, + -1.03259325e-01, -4.76101339e-01, -5.53017259e-01 ] + - [ -5.68972707e-01, -6.62006676e-01, -2.87437856e-01, + 4.44720149e-01, -9.90106106e-01, -7.68695593e-01, + -2.39740789e-01, 3.93545985e-01, -9.82478321e-01, + -8.08733642e-01, -1.73437417e-01, 6.69317126e-01, + -9.70269263e-01, -8.58352065e-01, -1.70312464e-01, + 6.34128690e-01, -9.67944145e-01, -8.66564214e-01, + 3.32131028e-01, -3.12516868e-01, 3.04836869e-01, + 7.71628141e-01, -9.09316123e-01, -2.64483511e-01, + 3.87283206e-01, 4.73351717e-01, -8.53432834e-01, + -4.72527683e-01, 4.22166824e-01, 3.48409891e-01, + -7.52276957e-01, -6.69905066e-01, 4.22885656e-01, + 1.04511619e-01, -7.14177370e-01, -7.15596437e-01 ] + - [ -6.60521984e-01, -4.62841332e-01, -3.38537931e-01, + 7.94510603e-01, -9.75686908e-01, -4.45696592e-01, + -2.38300860e-01, 2.19242573e-01, -9.09948945e-01, + -6.86516523e-01, -2.18750000e-01, 3.31051230e-01, + -8.67238998e-01, -7.72588313e-01, -2.35937476e-01, + 4.37989712e-01, -8.75719070e-01, -7.56608427e-01, + -5.07965684e-02, -1.17488623e-01, 1.56355500e-01, + 9.61985588e-01, -8.36903453e-01, 2.91073084e-01, + 2.23121405e-01, -2.90763438e-01, -4.96289253e-01, + -4.88542199e-01, 2.25404620e-01, -4.98410821e-01, + -3.38379622e-01, -6.38048112e-01, 2.31343150e-01, + -3.71728480e-01, -3.96879554e-01, -6.13870561e-01 ] + - [ -7.18309879e-01, -9.14598286e-01, -5.57132721e-01, + -1.80895925e-02, -9.98346031e-01, -9.67916310e-01, + -5.75233996e-01, 6.34179115e-02, -9.98503983e-01, + -9.67008114e-01, -5.23437500e-01, 4.09977794e-01, + -9.97887135e-01, -9.75702107e-01, -5.00000000e-01, + 4.18249369e-01, -9.97766376e-01, -9.77524281e-01, + -2.41959810e-01, -7.22943902e-01, -2.01349795e-01, + 4.12838936e-01, -9.80683982e-01, -8.10503364e-01, + -1.83815122e-01, 5.29522419e-01, -9.84940112e-01, + -8.08156669e-01, -1.50684893e-01, 5.25226116e-01, + -9.60875034e-01, -8.93386185e-01, -1.29353285e-01, + 3.81799459e-01, -9.50995386e-01, -9.10795212e-01 ] + - [ -7.47514486e-01, -9.46907818e-01, -6.40880048e-01, + -7.52513409e-02, -9.98598635e-01, -9.78720784e-01, + -6.47228241e-01, -1.36025548e-02, -9.98523176e-01, + -9.79968071e-01, -6.26562476e-01, 3.60050559e-01, + -9.98876989e-01, -9.83650625e-01, -6.03124976e-01, + 3.71502280e-01, -9.98766601e-01, -9.85034108e-01, + -3.66396189e-01, -8.17370117e-01, -2.98087776e-01, + 4.56568718e-01, -9.97349501e-01, -8.71650934e-01, + -2.99421966e-01, 5.13069868e-01, -9.96751130e-01, + -8.77922177e-01, -2.37858057e-01, 7.18282461e-01, + -9.93626177e-01, -9.19239640e-01, -2.21393049e-01, + 6.62862062e-01, -9.92430687e-01, -9.27159905e-01 ] + - [ -5.64001679e-01, -6.83049977e-01, -2.50532329e-01, + 4.86645341e-01, -9.96751070e-01, -7.99520731e-01, + -2.67098486e-01, 5.72515011e-01, -9.96294916e-01, + -8.06036592e-01, -1.25000000e-01, 8.99588823e-01, + -9.89638329e-01, -8.59858990e-01, -1.34374976e-01, + 9.09560442e-01, -9.90046084e-01, -8.60889077e-01, + 6.68169498e-01, -2.63649344e-01, 5.95050573e-01, + 8.80442619e-01, -9.14927125e-01, -2.05173492e-01, + 6.11560583e-01, 8.74533653e-01, -9.04633582e-01, + -2.81297028e-01, 7.01120853e-01, 5.22647023e-01, + -7.69201159e-01, -6.21643543e-01, 7.31343150e-01, + 4.95754123e-01, -7.73061514e-01, -6.36053801e-01 ] + - [ -6.28624678e-01, -6.42072499e-01, -3.12987924e-01, + 3.64150286e-01, -9.82321978e-01, -7.67638981e-01, + -3.30453515e-01, 4.74673986e-01, -9.81169224e-01, + -7.58163750e-01, -2.53125012e-01, 5.59055924e-01, + -9.55956817e-01, -8.53022695e-01, -2.96875000e-01, + 5.90808630e-01, -9.54084873e-01, -8.43954206e-01, + 1.42771125e-01, -3.05142760e-01, 2.12598562e-01, + 3.02782297e-01, -8.03055644e-01, -4.25070047e-01, + 1.93063617e-01, 5.83751917e-01, -8.41278315e-01, + -3.23947608e-01, 2.95143127e-01, -5.92594147e-02, + -6.37358904e-01, -7.10399508e-01, 2.21393108e-01, + 1.20508313e-01, -6.68057561e-01, -6.60786867e-01 ] + - [ -7.07953572e-01, -9.12701488e-01, -5.04613280e-01, + 2.66408920e-02, -9.99539375e-01, -9.66995239e-01, + -5.13318896e-01, 9.71568823e-02, -9.99524653e-01, + -9.68304694e-01, -4.73437488e-01, 4.78355169e-01, + -9.99281764e-01, -9.73897099e-01, -4.42187488e-01, + 4.82969642e-01, -9.99234676e-01, -9.76276934e-01, + 3.90441775e-01, -6.89077556e-01, 3.81327391e-01, + 6.05986834e-01, -9.92408812e-01, -7.94013202e-01, + 3.89595270e-01, 6.60003304e-01, -9.91170108e-01, + -8.04410398e-01, 4.54545379e-01, 8.52342367e-01, + -9.81013000e-01, -8.65987182e-01, 5.42288542e-01, + 7.47245908e-01, -9.78042185e-01, -8.85734856e-01 ] + - [ -6.93247676e-01, -8.78880024e-01, -4.83321488e-01, + 1.05423331e-01, -9.99446154e-01, -9.47985411e-01, + -4.73002076e-01, 1.64327383e-01, -9.99145806e-01, + -9.52243090e-01, -4.09374952e-01, 5.59470057e-01, + -9.99054015e-01, -9.62773502e-01, -4.32812452e-01, + 5.81853271e-01, -9.99036551e-01, -9.61504877e-01, + 3.83829236e-01, -6.46569252e-01, 3.38582754e-01, + 6.76520705e-01, -9.91039515e-01, -7.38477409e-01, + 3.47976804e-01, 6.69355869e-01, -9.86286163e-01, + -7.68253863e-01, 5.44209123e-01, 7.66655803e-01, + -9.70120013e-01, -8.62617135e-01, 4.92537379e-01, + 8.26019406e-01, -9.73405898e-01, -8.53641510e-01 ] + - [ -7.16238618e-01, -8.58976483e-01, -5.37260413e-01, + 7.60216713e-02, -9.96380568e-01, -9.33959842e-01, + -5.39236784e-01, 1.73018932e-01, -9.97198999e-01, + -9.34445739e-01, -4.96874928e-01, 4.83862400e-01, + -9.94097650e-01, -9.52664971e-01, -4.89062428e-01, + 4.86756444e-01, -9.93874848e-01, -9.55366015e-01, + -2.15509534e-01, -6.14469409e-01, -1.49606228e-01, + 4.36733603e-01, -9.55611527e-01, -7.00949430e-01, + -1.28323674e-01, 5.09717345e-01, -9.55662668e-01, + -7.08388329e-01, -1.13325059e-01, 4.16860580e-01, + -9.06047523e-01, -8.40597987e-01, -1.11940265e-01, + 2.38878727e-01, -8.86041105e-01, -8.64542365e-01 ] + - [ -6.69221222e-01, -8.03096890e-01, -5.06032705e-01, + 1.68594241e-01, -9.93205309e-01, -8.87989402e-01, + -4.81641471e-01, 2.08204985e-01, -9.91756022e-01, + -9.01067197e-01, -4.21875000e-01, 5.11545658e-01, + -9.87204731e-01, -9.30036187e-01, -4.24999952e-01, + 5.18502951e-01, -9.86962914e-01, -9.32088137e-01, + -2.18515217e-01, -5.96347094e-01, -2.73340821e-01, + 5.34512520e-01, -9.55107927e-01, -5.99448800e-01, + -2.50867128e-01, 3.90516281e-01, -9.26264822e-01, + -6.95455670e-01, -1.60647571e-01, 2.46305108e-01, + -8.74684036e-01, -8.54303837e-01, -1.86567187e-01, + 1.78987741e-01, -8.67706895e-01, -8.61255050e-01 ] + - [ -4.75559294e-01, -3.60148489e-01, -7.31015205e-02, + 7.00167298e-01, -9.44058895e-01, -4.28575933e-01, + -7.84736872e-02, 7.58558154e-01, -9.40068245e-01, + -4.61955547e-01, 3.12507153e-03, 6.02229834e-01, + -8.61635327e-01, -6.71173573e-01, -6.25002384e-03, + 6.02241278e-01, -8.60325813e-01, -6.75856948e-01, + 5.58761716e-01, 7.41208792e-02, 5.07311583e-01, 5.09633303e-01, + -6.12850368e-01, 2.62525320e-01, 5.21387100e-01, + 4.26202536e-01, -5.79431891e-01, 1.18283510e-01, + 6.01494312e-01, -1.98965251e-01, -2.74018407e-01, + -4.15137231e-01, 6.21890426e-01, -2.45350599e-01, + -2.85686612e-01, -4.36507463e-01 ] + - [ -3.81110191e-01, -2.59727240e-01, -8.87153745e-02, + 4.80428934e-01, -8.53001833e-01, -3.12069297e-01, + -1.31749332e-01, 3.07666898e-01, -7.86592305e-01, + -3.66520107e-01, 7.50000477e-02, -1.24564886e-01, + -6.87418580e-01, -7.04673052e-01, 7.81250000e-02, + 5.25386333e-02, -7.10072041e-01, -6.78627372e-01, + 6.33303165e-01, -1.33562088e-03, 4.08323884e-01, + 1.83450222e-01, -5.21886051e-01, 3.88549566e-02, + 3.15606833e-01, 2.90156126e-01, -4.76657629e-01, + 1.75791621e-01, 7.45952725e-01, -8.53325903e-01, + -2.04281926e-01, -6.58629894e-01, 7.11442709e-01, + -5.98712206e-01, -2.76925147e-01, -5.91302037e-01 ] + - [ -6.40223682e-01, -3.47361445e-01, -3.01632404e-01, + 8.86865497e-01, -9.51579511e-01, -2.51552403e-01, + -2.12382913e-01, 3.85158062e-02, -8.27284873e-01, + -6.22046709e-01, -1.98437452e-01, 7.27984905e-02, + -7.62203038e-01, -7.23386049e-01, -2.15624928e-01, + 1.89849138e-01, -7.73653328e-01, -7.05533028e-01, + -2.13406682e-02, -4.23591137e-02, 1.76602960e-01, + 8.94014120e-01, -7.72053361e-01, 4.17633772e-01, + 2.41618395e-01, -4.84260619e-01, -3.54418099e-01, + -4.71267581e-01, 2.52802014e-01, -6.02931917e-01, + -2.17373073e-01, -5.88555872e-01, 2.58706570e-01, + -4.82928634e-01, -2.79700339e-01, -5.63894749e-01 ] + - [ -5.97970128e-01, -7.01381505e-01, -3.28601897e-01, + 4.90207195e-01, -9.97499466e-01, -7.96085298e-01, + -2.02303767e-01, 3.05004954e-01, -9.86036181e-01, + -8.59660268e-01, -1.17187500e-01, 6.14809394e-01, + -9.79143739e-01, -8.95481348e-01, -1.48437440e-01, + 7.13505149e-01, -9.82932508e-01, -8.85641634e-01, + 4.51758265e-01, -3.78694594e-01, 3.38582754e-01, + 9.53268766e-01, -9.49828327e-01, -2.53776908e-01, + 4.19653058e-01, 1.44229293e-01, -8.18230629e-01, + -6.50272250e-01, 5.99003673e-01, -1.13608778e-01, + -7.25272477e-01, -8.06986749e-01, 6.01990104e-01, + 8.73486996e-02, -7.65444279e-01, -7.75159001e-01 ] + - [ -7.10024834e-01, -9.29126918e-01, -5.37260413e-01, + -7.53182173e-02, -9.97305274e-01, -9.75752056e-01, + -6.01151943e-01, 1.44821405e-02, -9.97830093e-01, + -9.72970188e-01, -5.07812500e-01, 3.71359706e-01, + -9.98082399e-01, -9.81206179e-01, -5.15625000e-01, + 3.92275691e-01, -9.98069465e-01, -9.81433749e-01, + -3.11091185e-01, -7.92587698e-01, -2.93588281e-01, + 4.07026291e-01, -9.91302073e-01, -8.57940853e-01, + -3.01734209e-01, 4.90730286e-01, -9.92573142e-01, + -8.60907197e-01, -1.90535545e-01, 5.55417180e-01, + -9.82114613e-01, -9.26485062e-01, -2.03980088e-01, + 5.39264560e-01, -9.82119620e-01, -9.27643538e-01 ] + - [ -6.24275088e-01, -6.79650307e-01, -3.37118506e-01, + 3.41275096e-01, -9.87763107e-01, -8.01840425e-01, + -3.62131000e-01, 4.53819633e-01, -9.87073183e-01, + -7.91865289e-01, -2.60937512e-01, 6.18791223e-01, + -9.70794559e-01, -8.69714558e-01, -2.73437440e-01, + 6.42641902e-01, -9.71513271e-01, -8.69267941e-01, + 1.23232603e-02, -3.41163337e-01, 1.31608605e-01, + 4.35499072e-01, -8.60902309e-01, -4.36445773e-01, + 4.27745581e-02, 6.68657184e-01, -8.75273347e-01, + -3.21900129e-01, 1.70610189e-01, 1.05178475e-01, + -7.15038598e-01, -7.25996494e-01, 1.71641707e-01, + 1.23181462e-01, -7.27831721e-01, -7.25130558e-01 ] + - [ -5.23612261e-01, -5.40942788e-01, -1.76721096e-01, + 6.25855684e-01, -9.83460307e-01, -6.43194675e-01, + -1.40388727e-01, 6.39771342e-01, -9.77953494e-01, + -6.80105984e-01, -4.53124642e-02, 7.97189593e-01, + -9.51622307e-01, -7.80634880e-01, -5.93749881e-02, + 7.85164714e-01, -9.48904216e-01, -7.81570435e-01, + 4.37932134e-01, -1.08751416e-01, 4.19572473e-01, + 7.64432192e-01, -8.19109976e-01, 3.09433937e-02, + 4.86705065e-01, 5.35434127e-01, -7.62147665e-01, + -1.85781181e-01, 5.31755924e-01, 9.33433771e-02, + -5.55907607e-01, -5.56358695e-01, 5.24875641e-01, + 7.46169090e-02, -5.56306601e-01, -5.57144225e-01 ] + - [ -6.34424210e-01, -4.28210080e-01, -3.56990755e-01, + 3.87200952e-01, -9.08638358e-01, -4.97965574e-01, + -3.40532780e-01, 2.68128872e-01, -8.86326551e-01, + -5.94923317e-01, -2.70312488e-01, 3.62679958e-02, + -7.95365334e-01, -7.77144611e-01, -2.85937428e-01, + 1.72033072e-01, -8.09749901e-01, -7.58819640e-01, + 1.24135852e-01, -1.56722903e-01, 1.24859452e-01, + 3.15654874e-01, -6.47808671e-01, -4.85361218e-02, + 1.95375681e-01, 3.96585464e-03, -5.69417417e-01, + -3.26820791e-01, 3.25031042e-01, -4.29099560e-01, + -4.06815886e-01, -6.57652020e-01, 2.76119351e-01, + -3.09230030e-01, -4.34382200e-01, -6.16841495e-01 ] + - [ -7.36122608e-01, -9.47587311e-01, -5.67068815e-01, + -9.51595902e-02, -9.98451710e-01, -9.83070910e-01, + -5.82433403e-01, -2.51786113e-02, -9.98648584e-01, + -9.83497262e-01, -4.89062428e-01, 3.30181003e-01, + -9.98813093e-01, -9.87935424e-01, -5.00000000e-01, + 3.61659765e-01, -9.98969853e-01, -9.87777829e-01, + -1.27742767e-01, -8.10769320e-01, -7.53655434e-02, + 4.56842184e-01, -9.97978449e-01, -8.92309844e-01, + -4.73989248e-02, 5.12556434e-01, -9.97273803e-01, + -8.97196412e-01, 9.09091234e-02, 6.88441515e-01, + -9.94280517e-01, -9.36953664e-01, 8.45770836e-02, + 6.94157362e-01, -9.94643092e-01, -9.36014235e-01 ] + - [ -7.31773019e-01, -8.56498480e-01, -5.24485469e-01, + 9.10971165e-02, -9.95943606e-01, -9.27763999e-01, + -5.23398101e-01, 1.47039056e-01, -9.96000946e-01, + -9.36324894e-01, -4.62499917e-01, 5.07790327e-01, + -9.94952679e-01, -9.52281415e-01, -4.98437524e-01, + 5.51657438e-01, -9.95458186e-01, -9.48783219e-01, + -1.79440975e-01, -6.30101085e-01, -1.13610804e-01, + 6.55203462e-01, -9.81878221e-01, -6.48372769e-01, + -7.05202818e-02, 4.99647379e-01, -9.62600589e-01, + -7.44313478e-01, -3.11332941e-02, 4.43527460e-01, + -9.22380567e-01, -8.57090116e-01, -5.47263026e-02, + 5.74608803e-01, -9.36677575e-01, -8.36502612e-01 ] + - [ -7.22245216e-01, -9.23721790e-01, -5.81263304e-01, + -3.92743349e-02, -9.98025417e-01, -9.70328510e-01, + -6.04031682e-01, 1.01634264e-02, -9.97129440e-01, + -9.70975876e-01, -5.81249952e-01, 3.42619896e-01, + -9.96217608e-01, -9.78188872e-01, -5.79687476e-01, + 3.63141537e-01, -9.96179640e-01, -9.78683829e-01, + -1.23234391e-02, -7.43819237e-01, -1.01237297e-02, + 4.70458150e-01, -9.90084410e-01, -8.34687889e-01, + 4.97108698e-02, 5.46461582e-01, -9.91393983e-01, + -8.47533524e-01, 8.84184837e-02, 6.20896339e-01, + -9.77524340e-01, -9.07087505e-01, 9.70149040e-02, + 5.82992315e-01, -9.75627780e-01, -9.10168290e-01 ] + - [ -6.96354628e-01, -7.98357725e-01, -4.88999307e-01, + 2.08274364e-01, -9.94384944e-01, -8.79964769e-01, + -4.68682528e-01, 2.28229642e-01, -9.92731988e-01, + -8.99422407e-01, -4.03124928e-01, 5.52365541e-01, + -9.88743126e-01, -9.26531851e-01, -4.37499940e-01, + 6.13755226e-01, -9.90198493e-01, -9.20555055e-01, + -1.48782730e-01, -5.43891311e-01, -9.33633447e-02, + 7.30011582e-01, -9.68459010e-01, -5.07690787e-01, + -5.20231128e-02, 4.30340767e-01, -9.25950229e-01, + -6.78368688e-01, -2.61518955e-02, 2.81326056e-01, + -8.58167648e-01, -8.23515177e-01, -4.97512817e-02, + 4.32203174e-01, -8.79940271e-01, -7.95843363e-01 ] + - [ -7.58906364e-01, -8.92461240e-01, -6.43718958e-01, + 1.44587755e-02, -9.96697247e-01, -9.48001564e-01, + -6.45788312e-01, 8.06676149e-02, -9.96243477e-01, + -9.49419558e-01, -6.23437524e-01, 4.05657053e-01, + -9.94300187e-01, -9.62989390e-01, -6.14062548e-01, + 4.01268125e-01, -9.93843079e-01, -9.66551840e-01, + -4.42140102e-01, -7.38738120e-01, -4.08323944e-01, + 3.18044782e-01, -9.70747352e-01, -8.17702115e-01, + -4.45086777e-01, 3.57072234e-01, -9.62373793e-01, + -8.09192061e-01, -4.74470794e-01, 3.22023630e-01, + -9.29316998e-01, -8.96892071e-01, -4.57711458e-01, + 1.63623452e-01, -9.13446426e-01, -9.16823328e-01 ] + - [ -6.77713335e-01, -8.38316798e-01, -4.86160457e-01, + 1.62044168e-01, -9.97299731e-01, -9.14658487e-01, + -4.49963987e-01, 1.15150452e-01, -9.92931306e-01, + -9.35286999e-01, -4.07812476e-01, 4.77199912e-01, + -9.91470218e-01, -9.48319435e-01, -4.12500024e-01, + 4.83990192e-01, -9.91136611e-01, -9.49871004e-01, + -5.68079948e-02, -5.79143524e-01, 1.01237297e-02, + 7.47181892e-01, -9.80779886e-01, -5.81511855e-01, + 9.36415195e-02, 3.41410518e-01, -9.33181047e-01, + -7.64100254e-01, 1.80572867e-01, 3.57968926e-01, + -8.98661792e-01, -8.51613343e-01, 1.49253607e-01, + 2.68278599e-01, -8.90176415e-01, -8.61740589e-01 ] + - [ -7.37158239e-01, -9.44409430e-01, -6.06813312e-01, + -4.15688753e-02, -9.99769747e-01, -9.79603648e-01, + -5.93952537e-01, 2.19593048e-02, -9.99777794e-01, + -9.81659651e-01, -5.42187452e-01, 3.87571692e-01, + -9.99705136e-01, -9.85477924e-01, -5.50000012e-01, + 4.10590768e-01, -9.99733865e-01, -9.85567808e-01, + 9.10729170e-02, -7.53751218e-01, 1.04611874e-01, + 4.99141335e-01, -9.93256211e-01, -8.44555438e-01, + 1.37572289e-01, 5.95441699e-01, -9.96285260e-01, + -8.60928655e-01, 2.32876658e-01, 7.51937628e-01, + -9.88969386e-01, -9.09129500e-01, 2.31343150e-01, + 7.41192460e-01, -9.88619447e-01, -9.09736991e-01 ] + - [ -4.85294163e-01, -4.33252931e-01, -1.31298840e-01, + 5.05800605e-01, -9.41267133e-01, -5.48947990e-01, + -1.46148205e-01, 4.83017921e-01, -9.23599720e-01, + -5.77537000e-01, -1.87499940e-01, 3.81697893e-01, + -8.34228635e-01, -7.05371141e-01, -1.53124988e-01, + 4.20754433e-01, -8.49407554e-01, -7.23836780e-01, + 4.96242881e-01, -6.35316968e-02, 3.74578238e-01, + 2.71522045e-01, -6.23960733e-01, -6.42356873e-02, + 3.89595270e-01, 1.94577575e-01, -5.86438179e-01, + -1.58633947e-01, 3.99750948e-01, 1.50760889e-01, + -4.33322966e-01, -3.92558992e-01, 4.52736259e-01, + -2.55845904e-01, -3.58762622e-01, -5.16377449e-01 ] + - [ -7.05468059e-01, -7.51709402e-01, -4.90418732e-01, + 2.03537345e-01, -9.88237739e-01, -8.52061033e-01, + -4.87401009e-01, 3.21454644e-01, -9.90661204e-01, + -8.53645921e-01, -4.43749964e-01, 5.20703197e-01, + -9.77237105e-01, -9.02677178e-01, -4.43749964e-01, + 5.12305498e-01, -9.76317465e-01, -9.07554567e-01, + -1.77637577e-01, -4.62048769e-01, -1.00112557e-01, + 3.48286390e-01, -8.80208492e-01, -5.54388285e-01, + -1.14450872e-01, 3.68326664e-01, -8.67633700e-01, + -5.70672035e-01, -8.84184837e-02, 1.84777975e-01, + -7.74797142e-01, -7.62068033e-01, -8.45771432e-02, + 5.47409058e-04, -7.47051477e-01, -7.93643713e-01 ] + - [ -4.60646272e-01, -5.40245712e-01, -1.28459871e-01, + 4.75206733e-01, -9.67888474e-01, -6.65896654e-01, + -1.64866686e-01, 4.79665518e-01, -9.53686953e-01, + -6.70089960e-01, 2.18751431e-02, 5.27644873e-01, + -9.28208649e-01, -8.15432131e-01, -1.56250000e-02, + 5.88983297e-01, -9.28360224e-01, -8.02385449e-01, + 6.63961530e-01, -1.90825045e-01, 4.10573721e-01, + 3.67260695e-01, -7.46525168e-01, -2.33604014e-01, + 3.01734090e-01, 5.66903710e-01, -7.43797123e-01, + -9.08134580e-02, 7.45952725e-01, -4.48415220e-01, + -5.13407230e-01, -7.36165345e-01, 6.56716347e-01, + -1.66573942e-01, -5.69763482e-01, -6.70722365e-01 ] + - [ -8.59362066e-01, -6.39526308e-01, -6.60752296e-01, + 1.91271305e-02, -9.29362655e-01, -7.60123134e-01, + -6.78905725e-01, 5.79603910e-02, -9.26453710e-01, + -7.75692940e-01, -6.49999976e-01, -6.83957338e-03, + -8.61187160e-01, -8.74121964e-01, -6.56250000e-01, + -8.32653046e-03, -8.56202662e-01, -8.80247116e-01, + -6.36309028e-01, -5.09317398e-01, -4.69066381e-01, + 8.52774382e-02, -7.95613170e-01, -6.01069450e-01, + -4.82080996e-01, 5.13046980e-02, -7.79890537e-01, + -6.60014987e-01, -4.66998756e-01, -1.27919972e-01, + -6.75873101e-01, -8.04215372e-01, -4.72636819e-01, + -1.97759211e-01, -6.72245860e-01, -8.17174435e-01 ] + - [ -5.93206286e-01, -6.15446925e-01, -2.88857400e-01, + 4.39875364e-01, -9.83774364e-01, -7.37211585e-01, + -3.01655889e-01, 5.78002691e-01, -9.85291660e-01, + -7.29640543e-01, -2.06249952e-01, 6.74570799e-01, + -9.59169865e-01, -8.29093456e-01, -2.25000024e-01, + 7.17604399e-01, -9.60873544e-01, -8.24077725e-01, + 1.89059138e-01, -2.33391702e-01, 2.28346467e-01, + 5.10479689e-01, -8.26630592e-01, -2.70600080e-01, + 2.46242762e-01, 6.66130543e-01, -8.36049080e-01, + -2.29189515e-01, 2.85180569e-01, 1.48759127e-01, + -6.43742561e-01, -6.29054308e-01, 2.81094432e-01, + 1.80305839e-01, -6.55873656e-01, -6.21175528e-01 ] + - [ -6.85584068e-01, -5.41835785e-01, -3.52732420e-01, + 5.56242943e-01, -9.75505054e-01, -6.16212785e-01, + -3.88048947e-01, 6.56985641e-01, -9.76017356e-01, + -6.24393940e-01, -3.07812452e-01, 7.37151027e-01, + -9.40951407e-01, -7.61550009e-01, -3.10937524e-01, + 7.00009704e-01, -9.34985459e-01, -7.66914427e-01, + 4.35826778e-02, -1.24937654e-01, 1.76602960e-01, + 5.17519474e-01, -7.24444509e-01, 2.18540430e-02, + 1.72254324e-01, 5.21946549e-01, -7.37986445e-01, + -1.15664184e-01, 2.27895379e-01, -7.77861476e-02, + -4.80163515e-01, -5.66219091e-01, 2.11442828e-01, + -1.02868795e-01, -4.70134914e-01, -5.57388246e-01 ] + - [ -6.74606442e-01, -8.29230726e-01, -4.62029815e-01, + 1.83943748e-01, -9.97577012e-01, -9.10756290e-01, + -4.91720617e-01, 2.62289524e-01, -9.97708142e-01, + -9.13920403e-01, -3.99999976e-01, 6.39982224e-01, + -9.96601820e-01, -9.36908126e-01, -4.09374952e-01, + 6.53164268e-01, -9.96498287e-01, -9.36762273e-01, + 1.05500340e-01, -5.76161087e-01, 1.45106912e-01, + 6.44860506e-01, -9.70287263e-01, -6.25972271e-01, + 1.46820664e-01, 6.29257441e-01, -9.63239431e-01, + -6.74129188e-01, 3.07596564e-01, 5.35003424e-01, + -9.19892848e-01, -8.30864131e-01, 2.91044831e-01, + 5.41531682e-01, -9.20809686e-01, -8.27704251e-01 ] + - [ -6.16404295e-01, -3.61186743e-01, -3.05890679e-01, + 8.93407583e-01, -9.52321708e-01, -2.47644544e-01, + -2.62778997e-01, -2.27724254e-01, -7.71414101e-01, + -6.81498945e-01, -1.89062476e-01, -3.08091879e-01, + -7.09677935e-01, -7.97023416e-01, -1.98437452e-01, + -5.46509027e-02, -7.44528234e-01, -7.61964440e-01, + 3.02675009e-01, -1.31957293e-01, 2.98087835e-01, + 9.49273586e-01, -8.31263244e-01, 2.58463264e-01, + 3.45664620e-01, -4.46684957e-01, -4.58733976e-01, + -5.59791863e-01, 5.01867890e-01, -7.84769893e-01, + -3.35429907e-01, -7.36261368e-01, 5.04975080e-01, + -6.56803012e-01, -3.80896568e-01, -7.04736471e-01 ] + - [ -6.94904685e-01, -8.84597182e-01, -4.97515917e-01, + 6.68075085e-02, -9.98865902e-01, -9.52841878e-01, + -5.04679561e-01, 1.49691343e-01, -9.98800039e-01, + -9.51975584e-01, -4.49999988e-01, 5.22493005e-01, + -9.98440683e-01, -9.64006841e-01, -4.59374964e-01, + 5.41084290e-01, -9.98455703e-01, -9.64036345e-01, + 1.43973470e-01, -6.32480681e-01, 1.54105783e-01, + 6.21018529e-01, -9.85278606e-01, -7.24231124e-01, + 2.04624295e-01, 7.32433319e-01, -9.86984730e-01, + -7.24912405e-01, 3.02615166e-01, 7.33303905e-01, + -9.60541070e-01, -8.45422745e-01, 2.91044831e-01, + 7.38706112e-01, -9.61386621e-01, -8.44763577e-01 ] + - [ -7.43371964e-01, -9.88468289e-01, -5.95457733e-01, + -2.28716671e-01, -9.97993827e-01, -9.98092115e-01, + -5.66594601e-01, -1.72695637e-01, -9.98060644e-01, + -9.98319149e-01, -4.59374964e-01, 1.37292147e-01, + -9.98247027e-01, -9.99101400e-01, -4.64062512e-01, + 1.65089607e-01, -9.98254955e-01, -9.99256074e-01, + -4.19897854e-01, -9.78304386e-01, -5.83801985e-01, + 1.29881382e-01, -9.99102652e-01, -9.93956566e-01, + -5.19075215e-01, 1.81807399e-01, -9.99291778e-01, + -9.95917499e-01, -3.05105925e-01, 3.09598804e-01, + -9.99232352e-01, -9.97241020e-01, -3.13432872e-01, + 2.86319852e-01, -9.99167800e-01, -9.97290134e-01 ] + - [ -7.96188891e-01, -9.93034124e-01, -6.46557808e-01, + -2.21653461e-01, -9.98301387e-01, -9.98009205e-01, + -6.57307386e-01, -1.68566823e-01, -9.98308539e-01, + -9.98398423e-01, -4.85937476e-01, 1.47656322e-01, + -9.98687565e-01, -9.99254942e-01, -4.65624988e-01, + 1.71568394e-01, -9.98721540e-01, -9.99564767e-01, + -2.96062529e-01, -9.58757460e-01, -3.97075355e-01, + 1.64622545e-01, -9.98944759e-01, -9.88406837e-01, + -3.94219637e-01, 2.07714438e-01, -9.98669386e-01, + -9.90146875e-01, -1.75591469e-01, 3.61049175e-01, + -9.98908162e-01, -9.93471622e-01, -1.21890545e-01, + 3.29526544e-01, -9.98807132e-01, -9.94285643e-01 ] + - [ -5.02071261e-01, 3.43885422e-02, -1.12846017e-01, + 5.02681136e-01, -7.02668548e-01, 8.73441696e-02, + -9.43124890e-02, 2.04877734e-01, -6.19269490e-01, + -1.20541930e-01, -6.71874881e-02, -1.00026906e-01, + -4.34719086e-01, -4.09339964e-01, -7.96874762e-02, + -5.23717403e-02, -4.33474898e-01, -4.03825879e-01, + 3.54974508e-01, 2.95840621e-01, 3.94825697e-01, 6.97435141e-02, + -2.49578118e-01, 4.12703037e-01, 4.61271644e-01, + -3.46001506e-01, -1.05351031e-01, 3.06656361e-02, + 5.16811967e-01, -2.44840443e-01, 5.24938107e-03, + -1.72347128e-01, 5.09950161e-01, -2.37708688e-01, + -8.57824087e-03, -1.66007221e-01 ] + - [ -6.92833424e-01, -8.66329551e-01, -5.33002138e-01, + 6.49905205e-02, -9.95958984e-01, -9.35480773e-01, + -5.49316049e-01, 1.40611291e-01, -9.96146023e-01, + -9.37527716e-01, -4.78124976e-01, 4.89550591e-01, + -9.95099366e-01, -9.55431938e-01, -4.82812464e-01, + 5.02446055e-01, -9.95003104e-01, -9.56360996e-01, + -2.85241961e-01, -6.81751728e-01, -3.02587152e-01, + 4.92569089e-01, -9.74856317e-01, -7.16835260e-01, + -2.80924916e-01, 4.61755633e-01, -9.65269983e-01, + -7.62634516e-01, -2.00498223e-01, 3.97541404e-01, + -9.32525277e-01, -8.82814646e-01, -2.16417849e-01, + 3.49804878e-01, -9.30047989e-01, -8.88437569e-01 ] + - [ -7.05260992e-01, -9.00716245e-01, -4.88999307e-01, + 4.57907915e-02, -9.99285638e-01, -9.61279750e-01, + -5.23398101e-01, 1.26591921e-01, -9.99189854e-01, + -9.59335148e-01, -4.28124964e-01, 5.02156973e-01, + -9.99158740e-01, -9.70994353e-01, -4.60937440e-01, + 5.29911637e-01, -9.99185205e-01, -9.69426036e-01, + 4.18695569e-01, -6.71920061e-01, 4.19572473e-01, + 5.76574445e-01, -9.88464117e-01, -7.87459135e-01, + 3.22543263e-01, 7.34893203e-01, -9.92230296e-01, + -7.66839743e-01, 6.61270142e-01, 8.03313255e-01, + -9.79104221e-01, -8.77354920e-01, 5.59701443e-01, + 8.81263137e-01, -9.81987894e-01, -8.64103198e-01 ] + - [ -6.86826825e-01, -6.50534868e-01, -3.88218641e-01, + 5.37979603e-01, -9.93385553e-01, -7.25603282e-01, + -3.10295165e-01, 3.22936296e-01, -9.76033330e-01, + -8.09747458e-01, -2.62499988e-01, 5.93220353e-01, + -9.62928772e-01, -8.58332813e-01, -2.84374952e-01, + 6.71250343e-01, -9.66723323e-01, -8.49282682e-01, + -1.01893663e-01, -2.88300753e-01, 1.09111428e-01, + 9.88035202e-01, -9.26758170e-01, -4.63805795e-02, + 1.88439250e-01, 1.10576987e-01, -7.50607908e-01, + -5.49372554e-01, 2.02988744e-01, -1.42341912e-01, + -6.14445567e-01, -7.24005342e-01, 1.91542268e-01, + -1.42710805e-02, -6.53494000e-01, -7.01067388e-01 ] + - [ -6.68806970e-01, -7.43080735e-01, -4.60610390e-01, + 3.08689594e-01, -9.92294312e-01, -8.27384830e-01, + -4.24046040e-01, 2.76537180e-01, -9.87222433e-01, + -8.61771882e-01, -3.62500012e-01, 5.47882438e-01, + -9.78375912e-01, -9.01846766e-01, -3.93749952e-01, + 6.29824758e-01, -9.81271744e-01, -8.92629683e-01, + -1.04899347e-01, -4.74171042e-01, -6.86163306e-02, + 7.57405639e-01, -9.50879157e-01, -3.95086646e-01, + -2.65896916e-02, 3.44884515e-01, -8.83338988e-01, + -6.33064091e-01, -6.22671843e-03, 1.39765739e-01, + -7.91895270e-01, -7.96873450e-01, -2.98507214e-02, + 3.08235884e-01, -8.21298361e-01, -7.63437629e-01 ] + - [ -6.43330574e-01, -7.05815494e-01, -3.37118506e-01, + 3.42186689e-01, -9.90431011e-01, -8.15067768e-01, + -3.13174903e-01, 3.24380875e-01, -9.85606611e-01, + -8.44481707e-01, -2.34374940e-01, 5.87332606e-01, + -9.75870907e-01, -8.90571475e-01, -2.40624964e-01, + 5.84609985e-01, -9.74728227e-01, -8.92748892e-01, + 9.70844030e-02, -3.95260394e-01, 1.15860462e-01, + 6.69479609e-01, -9.14314389e-01, -3.66833329e-01, + 1.49132967e-01, 3.14478278e-01, -8.37794304e-01, + -5.57999969e-01, 2.55292654e-01, 8.65914822e-02, + -7.51400709e-01, -7.70359159e-01, 2.66169310e-01, + 1.04242563e-02, -7.44080901e-01, -7.81485200e-01 ] + - [ -6.94697618e-01, -8.36217344e-01, -5.06032705e-01, + 1.07343078e-01, -9.94555593e-01, -9.16797042e-01, + -5.27717829e-01, 1.59991622e-01, -9.92951989e-01, + -9.18891668e-01, -4.98437405e-01, 4.58217025e-01, + -9.88649487e-01, -9.42038536e-01, -4.98437524e-01, + 4.70642447e-01, -9.88295734e-01, -9.43002820e-01, + 2.73519754e-02, -5.88613033e-01, 5.06186485e-02, + 5.39346099e-01, -9.63743329e-01, -6.70855820e-01, + 7.51445293e-02, 5.66133857e-01, -9.59025979e-01, + -6.96606457e-01, 8.34370852e-02, 4.56408024e-01, + -9.05150533e-01, -8.29625130e-01, 6.96516037e-02, + 3.97500992e-01, -8.98021102e-01, -8.34086537e-01 ] + - [ -6.64664447e-01, -8.97351384e-01, -4.49254811e-01, + 6.76325560e-02, -9.99600470e-01, -9.60081518e-01, + -4.08207357e-01, 1.07133746e-01, -9.99186933e-01, + -9.66636419e-01, -3.28125000e-01, 4.92461324e-01, + -9.99058664e-01, -9.73352134e-01, -3.53124917e-01, + 5.22845030e-01, -9.99204338e-01, -9.72457945e-01, + 5.93026757e-01, -6.68548524e-01, 4.03824568e-01, + 6.90490246e-01, -9.93979633e-01, -7.57089734e-01, + 5.69942117e-01, 5.37523866e-01, -9.82533276e-01, + -8.27717841e-01, 7.68368483e-01, 6.71247602e-01, + -9.70688343e-01, -8.90570223e-01, 7.16418028e-01, + 7.36575246e-01, -9.74432766e-01, -8.82229626e-01 ] + - [ -5.99420071e-01, -7.52427697e-01, -3.59829664e-01, + 2.06953526e-01, -9.89384472e-01, -8.66419494e-01, + -3.47732186e-01, 2.96459436e-01, -9.89925683e-01, + -8.70821595e-01, -2.74999976e-01, 4.71699834e-01, + -9.77343023e-01, -9.18532670e-01, -2.84374952e-01, + 5.82250953e-01, -9.82204556e-01, -9.10210907e-01, + 6.04147911e-02, -4.91610348e-01, -6.63666725e-02, + 4.70267057e-01, -9.07064140e-01, -5.19397736e-01, + 4.97108698e-02, 4.47910428e-01, -9.01991546e-01, + -6.04275703e-01, 1.25778317e-01, 7.97399282e-02, + -8.01735163e-01, -8.25944841e-01, 1.14427805e-01, + 2.01683760e-01, -8.23710203e-01, -8.03840697e-01 ] + - [ -5.16777158e-01, -6.09617293e-01, -1.69623911e-01, + 5.35060048e-01, -9.90716279e-01, -7.39032626e-01, + -2.19582319e-01, 7.03572631e-01, -9.92460847e-01, + -7.19957113e-01, -4.84374166e-02, 9.53094363e-01, + -9.79179859e-01, -8.10022533e-01, -5.00000119e-02, + 8.66550565e-01, -9.74113345e-01, -8.22180867e-01, + 6.38112426e-01, -1.71423793e-01, 5.32058477e-01, + 6.48156285e-01, -8.36083770e-01, -1.74029827e-01, + 4.95953679e-01, 9.68229055e-01, -8.71312737e-01, + -4.57648635e-02, 6.73723459e-01, 3.93944860e-01, + -6.77317977e-01, -5.57205439e-01, 6.76616907e-01, + 1.85903430e-01, -6.45335317e-01, -6.05767965e-01 ] + - [ -6.46437407e-01, -7.89630651e-01, -3.62668574e-01, + 2.15906739e-01, -9.95821416e-01, -8.94883633e-01, + -3.90928686e-01, 3.20700526e-01, -9.96025383e-01, + -8.90610337e-01, -2.93749928e-01, 5.98124027e-01, + -9.90412891e-01, -9.25583899e-01, -3.26562464e-01, + 6.26427889e-01, -9.90269184e-01, -9.21967745e-01, + 2.24526644e-01, -4.87763107e-01, 2.53093362e-01, + 4.86855865e-01, -9.28473890e-01, -5.99850237e-01, + 2.53179073e-01, 7.34970450e-01, -9.50414062e-01, + -5.50498962e-01, 3.34993720e-01, 3.20031404e-01, + -8.45194578e-01, -7.96043694e-01, 2.76119351e-01, + 4.48601246e-01, -8.62698436e-01, -7.71239042e-01 ] + - [ -6.74813569e-01, -5.95565557e-01, -4.05251920e-01, + 3.09481740e-01, -9.63277400e-01, -7.13077128e-01, + -4.06767368e-01, 3.78791094e-01, -9.61424291e-01, + -7.24411726e-01, -3.67187440e-01, 4.17049646e-01, + -9.21659589e-01, -8.27124417e-01, -3.74999940e-01, + 3.72172713e-01, -9.15154219e-01, -8.37715626e-01, + -1.32551908e-01, -3.13950181e-01, -4.83689904e-02, + 1.79989815e-01, -7.57131457e-01, -4.36279476e-01, + -6.12717271e-02, 1.63703561e-01, -7.27966964e-01, + -4.58789945e-01, -2.86426544e-02, 1.53268576e-02, + -6.20911002e-01, -6.70217633e-01, -2.73631811e-02, + -1.65908515e-01, -5.89394808e-01, -7.07439661e-01 ] + - [ -6.72535181e-01, -8.68172050e-01, -4.46415961e-01, + 1.18301868e-01, -9.99438167e-01, -9.46149290e-01, + -4.97480154e-01, 2.08785415e-01, -9.99430299e-01, + -9.42625225e-01, -3.96874905e-01, 5.90773463e-01, + -9.99035537e-01, -9.58226025e-01, -3.93749952e-01, + 6.03872299e-01, -9.99039471e-01, -9.59061384e-01, + 5.35918236e-01, -5.89661360e-01, 5.05061984e-01, + 6.52918935e-01, -9.81878877e-01, -7.06715882e-01, + 3.82658839e-01, 8.41792583e-01, -9.88371253e-01, + -6.76083803e-01, 6.88667536e-01, 8.48940611e-01, + -9.63655591e-01, -8.27545404e-01, 6.94029808e-01, + 8.19660306e-01, -9.61582124e-01, -8.31479371e-01 ] + - [ -5.94863296e-01, -6.72490120e-01, -3.89638066e-01, + 2.76542187e-01, -9.77871180e-01, -7.85846889e-01, + -3.27573776e-01, 2.58830905e-01, -9.72055197e-01, + -8.22782397e-01, -2.78124988e-01, 4.14488673e-01, + -9.52134609e-01, -8.82752657e-01, -2.82812476e-01, + 4.16962504e-01, -9.51383054e-01, -8.86589587e-01, + -8.08537006e-02, -4.68183041e-01, -1.76602960e-01, + 5.13700604e-01, -9.02252197e-01, -4.45412278e-01, + -1.56069398e-01, 2.77757764e-01, -8.48708868e-01, + -6.01502895e-01, -3.61145735e-02, 4.85409498e-02, + -7.73616612e-01, -8.10329974e-01, -6.46765828e-02, + -3.37296724e-02, -7.61979759e-01, -8.19167972e-01 ] + - [ -6.87862515e-01, -6.39783382e-01, -3.82540822e-01, + 5.08028865e-01, -9.91369188e-01, -7.29159713e-01, + -4.19726372e-01, 5.99969506e-01, -9.90933895e-01, + -7.33487129e-01, -3.17187428e-01, 8.40561032e-01, + -9.76835489e-01, -8.20365310e-01, -3.15624952e-01, + 8.33876371e-01, -9.75198567e-01, -8.21157813e-01, + 5.80101013e-02, -2.34398603e-01, 2.01349735e-01, + 6.72638178e-01, -8.41360033e-01, -1.24255240e-01, + 1.93063617e-01, 6.85876846e-01, -8.44273984e-01, + -2.26721525e-01, 2.50311375e-01, 1.60206676e-01, + -6.45608962e-01, -6.26209378e-01, 2.36318350e-01, + 1.78993344e-01, -6.47595525e-01, -6.12554550e-01 ] + - [ -8.90430808e-01, -8.34692657e-01, -7.09013462e-01, + 3.12926769e-02, -9.90131736e-01, -9.10308719e-01, + -7.29301691e-01, 8.64669085e-02, -9.89767909e-01, + -9.17079210e-01, -7.18750000e-01, 3.34128499e-01, + -9.81509149e-01, -9.44392264e-01, -7.25000024e-01, + 3.41775298e-01, -9.80758429e-01, -9.46680784e-01, + -7.13255227e-01, -6.67424798e-01, -5.29808760e-01, + 2.77993321e-01, -9.34116125e-01, -7.24126458e-01, + -5.46820879e-01, 2.68952131e-01, -9.25082922e-01, + -7.63419926e-01, -5.21793365e-01, 7.34689236e-02, + -8.45791936e-01, -8.83428812e-01, -5.24875641e-01, + 1.69674158e-02, -8.44070375e-01, -8.91777992e-01 ] + - [ -6.84548497e-01, -4.75980103e-01, -3.45635176e-01, + 5.45559645e-01, -9.55439806e-01, -5.37852645e-01, + -3.76529872e-01, 6.51062131e-01, -9.57353413e-01, + -5.49123049e-01, -3.14062476e-01, 6.09664917e-01, + -9.00881946e-01, -7.25515127e-01, -3.20312500e-01, + 5.55019379e-01, -8.90528798e-01, -7.34659433e-01, + 4.89929914e-02, -6.40394688e-02, 1.72103524e-01, + 4.08721685e-01, -6.38801932e-01, 9.16278362e-02, + 1.69942141e-01, 4.14365530e-01, -6.62760377e-01, + -6.19161129e-02, 2.25404620e-01, -1.81540191e-01, + -3.84434342e-01, -5.25660157e-01, 2.06467628e-01, + -2.24386752e-01, -3.69161367e-01, -5.20097136e-01 ] + - [ -7.27837622e-01, -9.72045183e-01, -5.58552206e-01, + -1.75088882e-01, -9.98097301e-01, -9.93202984e-01, + -5.57955325e-01, -1.24197841e-01, -9.97993052e-01, + -9.94116485e-01, -4.28124964e-01, 2.15213418e-01, + -9.98441160e-01, -9.95716512e-01, -4.04687524e-01, + 2.36124277e-01, -9.98469651e-01, -9.96253610e-01, + -1.51788414e-01, -8.91668379e-01, -1.72103405e-01, + 2.97209382e-01, -9.98465002e-01, -9.55043137e-01, + -1.63005888e-01, 2.98253059e-01, -9.95801210e-01, + -9.60243583e-01, -9.09091234e-02, 4.75591540e-01, + -9.95092213e-01, -9.72295046e-01, -1.74129605e-02, + 4.28335428e-01, -9.94862497e-01, -9.76550162e-01 ] + - [ -6.10811949e-01, -5.79823792e-01, -3.00212920e-01, + 4.85535622e-01, -9.75736916e-01, -6.71586871e-01, + -2.62778997e-01, 3.40399027e-01, -9.57996547e-01, + -7.47283757e-01, -1.99999928e-01, 4.71067071e-01, + -9.31531847e-01, -8.32682729e-01, -2.06249952e-01, + 4.78973746e-01, -9.30577457e-01, -8.34954083e-01, + 9.82867479e-02, -2.73657084e-01, 1.00112557e-01, + 6.24968648e-01, -8.42356026e-01, -1.69950008e-01, + 1.39884353e-01, 1.19427800e-01, -7.07660079e-01, + -4.62518215e-01, 2.35367298e-01, -1.57065988e-01, + -5.99279642e-01, -7.14984894e-01, 2.43781090e-01, + -2.45999634e-01, -5.89585960e-01, -7.29227304e-01 ] + - [ -6.92419231e-01, -2.32235849e-01, -3.62668574e-01, + 2.98469543e-01, -7.81492531e-01, -2.51010180e-01, + -3.89488816e-01, 4.27915692e-01, -8.03537488e-01, + -2.73175001e-01, -3.54687512e-01, -6.04867935e-04, + -6.33200347e-01, -6.00873709e-01, -3.51562440e-01, + -8.87788534e-02, -6.04441822e-01, -6.26300514e-01, + 3.09587717e-02, 9.75104570e-02, 1.74353242e-01, 6.55188560e-02, + -3.35061848e-01, 2.45444655e-01, 1.63005710e-01, + 4.06630039e-02, -3.87166381e-01, 3.09821367e-02, + 2.25404620e-01, -3.16352546e-01, -1.47610545e-01, + -3.78045678e-01, 2.11442828e-01, -4.02197242e-01, + -1.23499691e-01, -3.88897598e-01 ] + - [ -6.54722452e-01, -7.73424864e-01, -4.25124168e-01, + 2.82531977e-01, -9.95876610e-01, -8.64931166e-01, + -4.39884722e-01, 3.40934873e-01, -9.95100379e-01, + -8.74120295e-01, -3.32812488e-01, 6.75707936e-01, + -9.91286993e-01, -9.10950243e-01, -3.39062512e-01, + 6.96353197e-01, -9.91571844e-01, -9.10597146e-01, + 8.62638950e-02, -4.95492101e-01, 1.02362275e-01, + 6.23674035e-01, -9.39755797e-01, -5.07806778e-01, + 1.02890134e-01, 5.51376104e-01, -9.24724817e-01, + -5.92772961e-01, 2.52802014e-01, 3.10049057e-01, + -8.47692132e-01, -8.02127361e-01, 2.36318350e-01, + 3.15180302e-01, -8.48278880e-01, -7.96373010e-01 ] + - [ -6.46230340e-01, -4.31683183e-01, -3.92476916e-01, + 7.99212337e-01, -9.63134408e-01, -3.54813755e-01, + -3.03095698e-01, -1.26853228e-01, -8.32184553e-01, + -7.20185637e-01, -2.92187452e-01, 5.25001287e-02, + -7.99676478e-01, -7.77014792e-01, -3.01562428e-01, + 1.32862329e-02, -7.89468527e-01, -7.90582180e-01, + -5.71095943e-03, -1.88507140e-01, 7.76153803e-02, + 8.72092843e-01, -8.47061455e-01, 1.43243074e-01, + 1.44508600e-01, -5.04217029e-01, -4.71232772e-01, + -6.36061192e-01, 1.95516825e-01, -4.47059214e-01, + -4.22245145e-01, -6.84676528e-01, 1.74129367e-01, + -5.76771200e-01, -4.02559400e-01, -7.08018064e-01 ] + - [ -5.92377782e-01, -6.41425967e-01, -2.90276825e-01, + 4.53729391e-01, -9.87788737e-01, -7.50505209e-01, + -2.71418214e-01, 4.54359889e-01, -9.83316660e-01, + -7.83085406e-01, -1.73437417e-01, 6.33722067e-01, + -9.65031385e-01, -8.55289936e-01, -1.85937464e-01, + 6.98238134e-01, -9.68010068e-01, -8.48737776e-01, + 2.38352895e-01, -3.18538129e-01, 2.14848161e-01, + 6.08073831e-01, -8.61492276e-01, -2.65374064e-01, + 2.23121405e-01, 3.52543473e-01, -8.04646015e-01, + -4.52693164e-01, 3.72353673e-01, -4.87246513e-02, + -6.68327689e-01, -7.34848022e-01, 3.23382974e-01, + 6.69282675e-02, -6.89530671e-01, -7.04442739e-01 ] + - [ -5.71458161e-01, -3.72081876e-01, -2.24982262e-01, + 3.62863660e-01, -8.99804413e-01, -5.11459053e-01, + -2.48380184e-01, 4.99960065e-01, -8.98650527e-01, + -4.83505368e-01, -1.93749905e-01, 2.35009789e-01, + -8.02007496e-01, -7.14409351e-01, -2.01562524e-01, + 2.57346511e-01, -8.02975833e-01, -7.18214452e-01, + 7.84490108e-02, -9.07785892e-02, 1.76602960e-01, + 1.05733275e-01, -6.12457395e-01, -2.31038094e-01, + 8.43930244e-02, 3.81321669e-01, -6.39204741e-01, + -4.25637364e-02, 2.30386019e-01, -1.75478876e-01, + -4.29112792e-01, -5.64798713e-01, 2.18905449e-01, + -1.48250878e-01, -4.46584225e-01, -5.56003571e-01 ] + - [ -7.18517005e-01, -5.42287588e-01, -4.73385394e-01, + 8.98119211e-02, -9.06037569e-01, -6.84073806e-01, + -5.07559419e-01, 4.33782816e-01, -9.41603005e-01, + -6.11128330e-01, -4.92187500e-01, 8.52688551e-02, + -8.35406184e-01, -8.11239779e-01, -4.84375000e-01, + 3.24410081e-01, -8.69307756e-01, -7.81969726e-01, + -1.71025038e-01, -3.19340289e-01, -1.42857194e-01, + 6.98339939e-02, -6.82873130e-01, -4.04218614e-01, + -1.14450872e-01, 3.64181519e-01, -7.68302560e-01, + -3.38964581e-01, -6.84931278e-02, -1.84590161e-01, + -5.53239286e-01, -6.96780384e-01, -5.47263026e-02, + -1.51600301e-01, -5.77258766e-01, -6.91446185e-01 ] + - [ -6.65700078e-01, -8.29277992e-01, -4.79063213e-01, + 1.03906989e-01, -9.93524492e-01, -9.14880395e-01, + -4.75881934e-01, 1.45497561e-01, -9.91586268e-01, + -9.20611560e-01, -4.48437512e-01, 4.41225648e-01, + -9.86250877e-01, -9.40686047e-01, -4.51562464e-01, + 4.40170050e-01, -9.85885859e-01, -9.44247961e-01, + -1.37361050e-01, -6.35073185e-01, -1.33858263e-01, + 4.75329638e-01, -9.62164164e-01, -6.96842551e-01, + -1.21387362e-01, 4.67898130e-01, -9.52197790e-01, + -7.26641297e-01, -1.43213034e-01, 4.53789830e-01, + -9.06853795e-01, -8.29016685e-01, -1.56716406e-01, + 3.19297791e-01, -8.93650532e-01, -8.49787414e-01 ] + - [ -7.09403515e-01, -8.13294828e-01, -4.98935461e-01, + 1.65013313e-01, -9.95105565e-01, -8.99712026e-01, + -5.33477247e-01, 2.65904665e-01, -9.95748341e-01, + -8.97083104e-01, -4.21875000e-01, 5.82450867e-01, + -9.92543817e-01, -9.31570411e-01, -4.14062500e-01, + 5.49779654e-01, -9.90843415e-01, -9.36743379e-01, + 9.91880894e-03, -5.25920033e-01, -4.83689904e-02, + 3.79502058e-01, -9.04119670e-01, -5.95600724e-01, + -8.67052078e-02, 4.86291885e-01, -9.12481904e-01, + -5.92848241e-01, 7.34744072e-02, 1.68095946e-01, + -8.25105309e-01, -8.22584748e-01, 5.72139025e-02, + 2.55687237e-02, -8.07964027e-01, -8.42614055e-01 ] + - [ -6.68806970e-01, -7.30607390e-01, -4.37899172e-01, + 2.41279483e-01, -9.87043500e-01, -8.35139155e-01, + -4.57163393e-01, 2.86364198e-01, -9.84002888e-01, + -8.42507482e-01, -4.21875000e-01, 4.95918393e-01, + -9.69774246e-01, -8.92870307e-01, -4.24999952e-01, + 4.82138991e-01, -9.67263997e-01, -8.96396220e-01, + -5.71095943e-03, -4.63499963e-01, 3.37457657e-03, + 4.68156338e-01, -9.08406138e-01, -5.32733202e-01, + 1.96532011e-02, 4.12639499e-01, -8.86200368e-01, + -5.88665009e-01, 1.12079382e-02, 2.59791136e-01, + -7.98184037e-01, -7.59582639e-01, -7.46268034e-03, + 1.95333838e-01, -7.87342131e-01, -7.64959395e-01 ] + - [ -6.65907204e-01, -8.27627122e-01, -4.44996417e-01, + 1.81549311e-01, -9.98120546e-01, -9.16627705e-01, + -4.51403856e-01, 2.73541331e-01, -9.98028874e-01, + -9.15370286e-01, -3.74999940e-01, 6.31222248e-01, + -9.96367455e-01, -9.38362181e-01, -3.89062464e-01, + 6.50973558e-01, -9.96506691e-01, -9.37944949e-01, + 1.74030542e-01, -5.23622632e-01, 2.01349735e-01, + 6.72406793e-01, -9.67695951e-01, -5.96523881e-01, + 2.55491376e-01, 8.02149415e-01, -9.71376717e-01, + -5.93019247e-01, 3.22540522e-01, 6.31632090e-01, + -9.12565887e-01, -7.88176894e-01, 3.20895553e-01, + 6.55067086e-01, -9.16384816e-01, -7.85440266e-01 ] + - [ -6.12676024e-01, -7.59373128e-01, -3.45635176e-01, + 3.61661673e-01, -9.98885453e-01, -8.66017282e-01, + -3.56371462e-01, 4.46811795e-01, -9.98695433e-01, + -8.70220602e-01, -2.42187440e-01, 8.26701283e-01, + -9.96229053e-01, -9.02693987e-01, -2.51562417e-01, + 8.35972071e-01, -9.96410370e-01, -9.03712213e-01, + 6.39314651e-01, -3.77558827e-01, 5.68054080e-01, + 8.97766113e-01, -9.56381440e-01, -3.75723302e-01, + 5.95375538e-01, 9.16175008e-01, -9.50875878e-01, + -4.32025075e-01, 7.28518009e-01, 7.54364610e-01, + -8.73379707e-01, -6.86106384e-01, 7.48756051e-01, + 7.26293445e-01, -8.73745084e-01, -6.97846591e-01 ] + - [ -6.13711655e-01, -6.57546759e-01, -3.44215751e-01, + 3.70661974e-01, -9.86002207e-01, -7.77933121e-01, + -3.60691130e-01, 4.77409840e-01, -9.86364901e-01, + -7.77535737e-01, -2.98437476e-01, 5.86619616e-01, + -9.61464405e-01, -8.55566621e-01, -2.95312405e-01, + 5.88545203e-01, -9.60944057e-01, -8.59210968e-01, + 2.20318556e-01, -3.53044033e-01, 1.51856065e-01, + 4.49741006e-01, -8.64075720e-01, -4.32845473e-01, + 1.93063617e-01, 4.93934631e-01, -8.61974359e-01, + -4.66061771e-01, 2.05479503e-01, 1.64250731e-01, + -7.17979908e-01, -7.05168188e-01, 1.86567187e-01, + 1.27032280e-01, -7.14926243e-01, -7.09497929e-01 ] + - [ -6.67771339e-01, -5.99364877e-01, -4.30801988e-01, + 2.51594782e-01, -9.51154828e-01, -7.05183268e-01, + -4.21166301e-01, 4.89086270e-01, -9.70812380e-01, + -6.95376277e-01, -3.46874893e-01, 4.76705074e-01, + -9.30285156e-01, -8.24409366e-01, -3.45312417e-01, + 3.59764576e-01, -9.17872071e-01, -8.46320391e-01, + 4.17792797e-02, -2.73876727e-01, 7.87401199e-03, + 3.31534386e-01, -7.52972960e-01, -2.63597548e-01, + -2.42775679e-02, 3.04826975e-01, -7.23642826e-01, + -3.08535874e-01, 1.23287678e-01, -2.20620751e-01, + -5.45353293e-01, -6.96427763e-01, 1.24378085e-01, + -4.68834817e-01, -5.04676104e-01, -7.47524858e-01 ] + - [ -7.14995861e-01, -9.05018508e-01, -5.61391056e-01, + 2.24611759e-02, -9.98103321e-01, -9.56873000e-01, + -5.60835123e-01, 8.31639767e-02, -9.97770965e-01, + -9.59445059e-01, -5.24999976e-01, 4.66011763e-01, + -9.97760355e-01, -9.67544079e-01, -5.10937452e-01, + 4.72905397e-01, -9.97653127e-01, -9.69583988e-01, + -3.10490012e-01, -7.38668919e-01, -2.01349795e-01, + 5.03952980e-01, -9.89143133e-01, -7.94140816e-01, + -2.00000048e-01, 5.31241894e-01, -9.85142112e-01, + -8.06801140e-01, -1.80572867e-01, 6.34378910e-01, + -9.68621075e-01, -8.77248526e-01, -1.89054728e-01, + 5.44867158e-01, -9.64164615e-01, -8.90761614e-01 ] + - [ -7.68641233e-01, -9.99470413e-01, -6.97657943e-01, + -1.96535647e-01, -9.99295950e-01, -9.97798324e-01, + -6.83225334e-01, -1.51775002e-01, -9.99251544e-01, + -9.98914003e-01, -5.09374976e-01, 1.65418625e-01, + -9.99384224e-01, -9.99570072e-01, -5.28125048e-01, + 1.95033312e-01, -9.99367833e-01, -9.99582410e-01, + -3.80222440e-01, -9.59586024e-01, -4.82564628e-01, + 1.87668085e-01, -9.99589026e-01, -9.86298323e-01, + -4.61271703e-01, 2.40049005e-01, -9.99589026e-01, + -9.88225996e-01, -3.00124526e-01, 3.99534941e-01, + -9.99654472e-01, -9.92341042e-01, -3.18407953e-01, + 3.82384181e-01, -9.99629259e-01, -9.92238045e-01 ] + - [ -7.25144982e-01, -9.80694294e-01, -6.08232737e-01, + -1.95366383e-01, -9.98273432e-01, -9.95608628e-01, + -5.79553604e-01, -1.41878307e-01, -9.98262227e-01, + -9.96279836e-01, -4.64062512e-01, 1.76188111e-01, + -9.98390019e-01, -9.97642994e-01, -4.60937440e-01, + 2.04041600e-01, -9.98423576e-01, -9.97804165e-01, + -3.38743687e-01, -9.32625592e-01, -3.85826766e-01, + 2.25263953e-01, -9.98964727e-01, -9.74688888e-01, + -3.57225478e-01, 2.83728361e-01, -9.99037743e-01, + -9.76883292e-01, -2.45329976e-01, 4.45397496e-01, + -9.98710215e-01, -9.85004187e-01, -2.38805950e-01, + 4.20711160e-01, -9.98576880e-01, -9.85656321e-01 ] + - [ -6.70878232e-01, -5.98239839e-01, -4.33640897e-01, + 5.98666549e-01, -9.86036420e-01, -6.26864672e-01, + -3.20374310e-01, 1.49392843e-01, -9.44802880e-01, + -7.97656119e-01, -3.09374928e-01, 4.03900266e-01, + -9.26917613e-01, -8.41464698e-01, -3.15624952e-01, + 3.70647550e-01, -9.22262192e-01, -8.50540042e-01, + -4.83919978e-02, -3.01815569e-01, 4.61193323e-02, + 9.16558862e-01, -9.12968159e-01, -5.69474697e-02, + 1.19075060e-01, -2.35832632e-01, -6.49977744e-01, + -6.60917044e-01, 1.55666113e-01, -2.67972112e-01, + -5.80477357e-01, -7.44556844e-01, 1.34328365e-01, + -4.02842581e-01, -5.61114788e-01, -7.67049551e-01 ] + - [ -7.35086977e-01, -9.03229356e-01, -5.48616052e-01, + 4.27922010e-02, -9.99162853e-01, -9.58883345e-01, + -5.75233996e-01, 1.14987373e-01, -9.99130487e-01, + -9.59544778e-01, -5.29687524e-01, 5.02084613e-01, + -9.99144375e-01, -9.68659163e-01, -5.40624976e-01, + 5.26625276e-01, -9.99217927e-01, -9.68169391e-01, + -4.47851419e-02, -6.73401117e-01, 4.83690500e-02, + 6.81867480e-01, -9.95094478e-01, -7.44830668e-01, + 3.35259438e-02, 7.18794465e-01, -9.93114650e-01, + -7.61809289e-01, 1.88044786e-01, 8.58881831e-01, + -9.81590867e-01, -8.58333647e-01, 1.91542268e-01, + 9.09624338e-01, -9.84454751e-01, -8.53718817e-01 ] + - [ -4.87158298e-01, -2.42452681e-01, -9.01347995e-02, + 6.49156094e-01, -8.89455616e-01, -2.76160419e-01, + -9.57522988e-02, 6.76486850e-01, -8.80720317e-01, + -3.25727165e-01, -3.43749523e-02, 3.28006387e-01, + -7.51131594e-01, -6.07975841e-01, -4.37499881e-02, + 3.21711898e-01, -7.46852398e-01, -6.16069198e-01, + 5.28103352e-01, 1.54039264e-01, 4.87064123e-01, 3.60171318e-01, + -4.85354245e-01, 3.52662086e-01, 5.02890110e-01, + 2.53093958e-01, -4.46509719e-01, 1.83758736e-01, + 5.94022274e-01, -3.09349000e-01, -1.42089963e-01, + -3.50233376e-01, 6.14427924e-01, -3.61337006e-01, + -1.54477239e-01, -3.73843551e-01 ] + - [ -5.18434167e-01, -5.80603719e-01, -1.41234934e-01, + 5.00651360e-01, -9.83033657e-01, -7.17090070e-01, + -1.97984040e-01, 6.76849604e-01, -9.86617506e-01, + -6.98690891e-01, -6.24999404e-02, 7.66398668e-01, + -9.60298121e-01, -8.10600519e-01, -5.93749881e-02, + 7.86112070e-01, -9.61483300e-01, -8.11688304e-01, + 5.43733120e-01, -1.57133520e-01, 4.42069769e-01, + 4.67987418e-01, -7.65968621e-01, -1.71820402e-01, + 4.35837984e-01, 7.46935606e-01, -8.13791990e-01, + -9.53370333e-02, 5.64134479e-01, 5.69282770e-02, + -5.86780787e-01, -6.05794668e-01, 5.79601884e-01, + -9.28509235e-03, -5.80331981e-01, -6.18705988e-01 ] + - [ -6.38152421e-01, -7.45717406e-01, -3.39957416e-01, + 2.71675587e-01, -9.93239760e-01, -8.60590577e-01, + -3.65010738e-01, 3.78470540e-01, -9.93134201e-01, + -8.54746103e-01, -2.76562512e-01, 6.06418014e-01, + -9.83574569e-01, -9.04558480e-01, -3.10937524e-01, + 6.35827661e-01, -9.83039975e-01, -8.99202883e-01, + 2.01081991e-01, -4.27456677e-01, 2.35095620e-01, + 4.39319730e-01, -8.95916879e-01, -5.39233387e-01, + 2.36994147e-01, 7.04067469e-01, -9.24580216e-01, + -4.76218641e-01, 3.25031042e-01, 1.89753532e-01, + -7.85274386e-01, -7.69946933e-01, 2.61193871e-01, + 3.34124207e-01, -8.06988180e-01, -7.38199055e-01 ] + - [ -5.14498830e-01, -5.29434323e-01, -2.27821112e-01, + 1.74320936e-01, -9.27473545e-01, -7.05007017e-01, + -2.38300860e-01, 3.63904238e-01, -9.41968083e-01, + -6.90238714e-01, -1.57812417e-01, 1.24256253e-01, + -8.71647060e-01, -8.42536926e-01, -1.71874940e-01, + 3.77067924e-01, -8.96876633e-01, -8.11534107e-01, + 1.39164329e-01, -3.21666837e-01, -2.81215310e-02, + 2.67980576e-01, -7.58190215e-01, -3.45339179e-01, + 6.82079792e-02, 3.15840483e-01, -7.82753050e-01, + -4.30883348e-01, 2.12951303e-01, -1.75145805e-01, + -6.34684682e-01, -7.54553139e-01, 1.76616907e-01, + -2.70374417e-02, -6.64883792e-01, -7.17705607e-01 ] + - [ -4.87986803e-01, -5.76705694e-01, -1.42654359e-01, + 4.85056400e-01, -9.78128433e-01, -7.02136517e-01, + -1.40388727e-01, 5.26324749e-01, -9.72979903e-01, + -7.17169583e-01, -1.26562476e-01, 6.48589373e-01, + -9.39057767e-01, -7.96089888e-01, -9.53124762e-02, + 6.08764887e-01, -9.39261854e-01, -8.15210879e-01, + 6.17072344e-01, -1.92804158e-01, 4.53318357e-01, + 5.35724759e-01, -8.01408708e-01, -1.91429436e-01, + 4.54335213e-01, 4.88830566e-01, -7.74460912e-01, + -2.62362957e-01, 4.54545379e-01, 2.99085736e-01, + -6.11554980e-01, -5.20229101e-01, 5.09950161e-01, + -9.76983905e-02, -5.45539856e-01, -6.22184515e-01 ] + - [ -6.56379461e-01, -8.06742191e-01, -4.08090889e-01, + 1.83699131e-01, -9.96212721e-01, -9.05626774e-01, + -4.45644319e-01, 2.84051895e-01, -9.96199846e-01, + -9.00259852e-01, -3.42187464e-01, 5.96978307e-01, + -9.92763042e-01, -9.32042897e-01, -3.53124917e-01, + 6.14902258e-01, -9.92835522e-01, -9.31939363e-01, + 1.77335739e-02, -5.08481860e-01, 1.45106912e-01, + 5.45827389e-01, -9.47355270e-01, -6.09449267e-01, + 5.20231724e-02, 7.24393487e-01, -9.52612638e-01, + -5.47114611e-01, 2.02988744e-01, 4.09287572e-01, + -8.74181926e-01, -8.03070068e-01, 1.99005008e-01, + 4.17883277e-01, -8.79850566e-01, -8.04215550e-01 ] + - [ -6.57829285e-01, -8.58893752e-01, -4.62029815e-01, + 8.72633457e-02, -9.96866286e-01, -9.36897337e-01, + -4.39884722e-01, 1.61185503e-01, -9.96919692e-01, + -9.40672457e-01, -3.64062488e-01, 5.02397656e-01, + -9.95529830e-01, -9.57388282e-01, -3.76562476e-01, + 5.31907082e-01, -9.95723903e-01, -9.56331909e-01, + -9.31781530e-03, -6.32698774e-01, -7.98650384e-02, + 5.30689478e-01, -9.69566762e-01, -6.89883530e-01, + 6.12715483e-02, 4.89389896e-01, -9.60927129e-01, + -7.53160119e-01, 8.59277248e-02, 3.81286383e-01, + -9.20177400e-01, -8.73140752e-01, 9.20397043e-02, + 4.35821652e-01, -9.26915824e-01, -8.64325941e-01 ] + - [ -7.17688441e-01, -9.16440904e-01, -5.52874386e-01, + -2.57458687e-02, -9.97945011e-01, -9.67801154e-01, + -5.46436191e-01, -8.46499205e-03, -9.96299744e-01, + -9.72853422e-01, -5.17187476e-01, 3.58093023e-01, + -9.96385217e-01, -9.77581680e-01, -4.87499952e-01, + 3.52558494e-01, -9.96119857e-01, -9.80822742e-01, + -1.83047831e-01, -7.63003886e-01, -2.12598383e-01, + 4.60153580e-01, -9.91887093e-01, -8.37044418e-01, + -1.46820843e-01, 3.08137894e-01, -9.74132061e-01, + -8.85522842e-01, -1.45703673e-01, 4.78190780e-01, + -9.67646420e-01, -9.17265058e-01, -1.16915464e-01, + 2.38795161e-01, -9.51358736e-01, -9.41747665e-01 ] + - [ -7.37572491e-01, -9.99092638e-01, -6.65010691e-01, + -2.03046739e-01, -9.99234378e-01, -9.98291492e-01, + -6.16990626e-01, -1.50901854e-01, -9.99268889e-01, + -9.98978853e-01, -4.43749964e-01, 1.62598014e-01, + -9.99334812e-01, -9.99605417e-01, -4.54687536e-01, + 1.91491485e-01, -9.99325037e-01, -9.99659717e-01, + -4.44544733e-01, -9.70671833e-01, -5.50056219e-01, + 1.74228430e-01, -9.99804199e-01, -9.89709079e-01, + -4.79768813e-01, 2.23349810e-01, -9.99818206e-01, + -9.92486537e-01, -3.37484360e-01, 3.79741311e-01, + -9.99871790e-01, -9.94529963e-01, -3.03482592e-01, + 3.58953953e-01, -9.99869227e-01, -9.94903207e-01 ] + - [ -6.52858317e-01, -9.87246275e-01, -4.54932570e-01, + -2.17814505e-01, -9.98162210e-01, -9.97598827e-01, + -4.70122337e-01, -1.63394451e-01, -9.98546660e-01, + -9.98538196e-01, -2.10937500e-01, 1.51223540e-01, + -9.98694837e-01, -9.99132931e-01, -2.03125000e-01, + 1.78120375e-01, -9.98732746e-01, -9.99334514e-01, + -3.33333373e-01, -9.61785436e-01, -4.33070838e-01, + 1.76306963e-01, -9.99430001e-01, -9.88285363e-01, + -4.15028930e-01, 2.18045354e-01, -9.99247253e-01, + -9.90745842e-01, -1.98007464e-01, 3.67092609e-01, + -9.99271631e-01, -9.93931890e-01, -1.99005008e-01, + 3.46840739e-01, -9.99218941e-01, -9.93975222e-01 ] + - [ -7.86039770e-01, -9.47259068e-01, -6.15329981e-01, + -1.06280386e-01, -9.97766316e-01, -9.81746376e-01, + -6.29949570e-01, -4.59878445e-02, -9.97979045e-01, + -9.83567178e-01, -5.76562405e-01, 3.09088588e-01, + -9.98213947e-01, -9.87388849e-01, -6.01562500e-01, + 3.42206717e-01, -9.98350441e-01, -9.86818790e-01, + -2.19717503e-01, -8.05730939e-01, -1.67604029e-01, + 4.39186215e-01, -9.95762587e-01, -8.77375662e-01, + -1.58381522e-01, 4.63761091e-01, -9.94035482e-01, + -8.91391158e-01, -5.35492301e-02, 6.19315863e-01, + -9.89324987e-01, -9.32932913e-01, -1.04477644e-01, + 6.60548687e-01, -9.90979910e-01, -9.26411867e-01 ] + - [ -6.77713335e-01, -7.28029728e-01, -4.63449240e-01, + 3.79796147e-01, -9.93840516e-01, -8.01886201e-01, + -3.57811332e-01, 2.09305644e-01, -9.82214630e-01, + -8.72711539e-01, -3.29687476e-01, 5.35357118e-01, + -9.75618780e-01, -8.99321318e-01, -3.31249952e-01, + 5.19720316e-01, -9.74074781e-01, -9.04215455e-01, + -6.70274496e-02, -4.29904819e-01, 1.91226006e-02, + 8.82499814e-01, -9.56467569e-01, -3.05530190e-01, + 9.59537029e-02, 6.74895048e-02, -8.14748943e-01, + -6.97654366e-01, 1.45703554e-01, 2.50214338e-02, + -7.53873110e-01, -7.95838356e-01, 1.24378085e-01, + -1.11602187e-01, -7.35396862e-01, -8.15498471e-01 ] + - [ -7.29494631e-01, -9.82146800e-01, -5.94038308e-01, + -1.64684653e-01, -9.99163568e-01, -9.94757414e-01, + -6.22750163e-01, -1.02765620e-01, -9.99105930e-01, + -9.94562984e-01, -5.35937548e-01, 2.31042743e-01, + -9.99178648e-01, -9.96122301e-01, -5.34375012e-01, + 2.57499695e-01, -9.99202132e-01, -9.96285141e-01, + -2.23925471e-01, -8.91938746e-01, -2.46344268e-01, + 2.94573665e-01, -9.98173237e-01, -9.51922417e-01, + -2.23121405e-01, 3.26292038e-01, -9.96667862e-01, + -9.54989791e-01, -1.75591469e-01, 4.84242916e-01, + -9.95095551e-01, -9.70277786e-01, -1.69154167e-01, + 4.66193318e-01, -9.94967282e-01, -9.70738590e-01 ] + - [ -7.72783756e-01, -9.75850105e-01, -6.32363379e-01, + -1.67916596e-01, -9.98565018e-01, -9.93200183e-01, + -6.31389499e-01, -1.19917691e-01, -9.98424709e-01, + -9.94434237e-01, -5.29687524e-01, 2.11968303e-01, + -9.98654425e-01, -9.96143699e-01, -5.32812476e-01, + 2.39393830e-01, -9.98683035e-01, -9.96276915e-01, + -1.83649004e-01, -8.87441456e-01, -1.31608605e-01, + 3.07159543e-01, -9.98639166e-01, -9.54156518e-01, + -1.32948041e-01, 3.60863447e-01, -9.98529732e-01, + -9.57618713e-01, 8.71729851e-03, 5.52761912e-01, + -9.98090208e-01, -9.71981943e-01, 1.74129009e-02, + 5.36403537e-01, -9.98063147e-01, -9.72698927e-01 ] + - [ -6.29038930e-01, -7.02732086e-01, -3.48474145e-01, + 3.19165111e-01, -9.89971280e-01, -8.22149456e-01, + -3.75090003e-01, 4.28701997e-01, -9.89379525e-01, + -8.13287437e-01, -2.71874964e-01, 6.25524998e-01, + -9.76345778e-01, -8.81270111e-01, -2.82812476e-01, + 6.49081230e-01, -9.77017403e-01, -8.80957007e-01, + 1.23232603e-02, -3.67719173e-01, 1.33858323e-01, + 4.60879445e-01, -8.78940582e-01, -4.62931752e-01, + 4.50866222e-02, 6.90119624e-01, -8.92053425e-01, + -3.54837716e-01, 1.73100829e-01, 1.54044032e-01, + -7.44629502e-01, -7.38823771e-01, 1.76616907e-01, + 1.70786977e-01, -7.56402075e-01, -7.38581061e-01 ] + - [ -7.33637094e-01, -9.37556684e-01, -5.98296642e-01, + -2.31900215e-02, -9.99765635e-01, -9.76290226e-01, + -6.08351350e-01, 4.56939936e-02, -9.99736011e-01, + -9.76979613e-01, -5.65624952e-01, 4.17394757e-01, + -9.99684751e-01, -9.81827617e-01, -5.68749964e-01, + 4.38478827e-01, -9.99710917e-01, -9.82100904e-01, + 1.01292372e-01, -7.52289653e-01, 5.96176386e-02, + 5.46337843e-01, -9.96789396e-01, -8.44151556e-01, + 9.82658863e-02, 5.97797632e-01, -9.95663345e-01, + -8.52936685e-01, 2.07970142e-01, 7.65999198e-01, + -9.88994658e-01, -9.05439377e-01, 2.13930368e-01, + 7.57767916e-01, -9.89120543e-01, -9.07257080e-01 ] + - [ -7.07746506e-01, -9.44415331e-01, -5.42938232e-01, + -9.04487371e-02, -9.98462796e-01, -9.82680500e-01, + -5.56515455e-01, -1.80416107e-02, -9.98559594e-01, + -9.82417285e-01, -4.68749940e-01, 3.33687544e-01, + -9.98754859e-01, -9.87582862e-01, -4.74999964e-01, + 3.58892560e-01, -9.98731732e-01, -9.87449944e-01, + -9.58822370e-02, -8.01917136e-01, -1.18110180e-01, + 4.28988099e-01, -9.95232522e-01, -8.81609142e-01, + -2.65896916e-02, 4.65084076e-01, -9.94042993e-01, + -8.96529078e-01, 4.10958529e-02, 5.96365333e-01, + -9.88395870e-01, -9.36862469e-01, 4.22885418e-02, + 5.94526291e-01, -9.88574803e-01, -9.36080813e-01 ] + - [ -7.22866595e-01, -8.95212531e-01, -5.00354886e-01, + 4.29580212e-02, -9.98820484e-01, -9.58356321e-01, + -4.85961080e-01, 9.27659273e-02, -9.98534262e-01, + -9.63654160e-01, -4.15624976e-01, 4.72359896e-01, + -9.98409212e-01, -9.71529901e-01, -4.46874917e-01, + 4.97498512e-01, -9.98427689e-01, -9.70511556e-01, + -1.00090206e-01, -6.60259068e-01, 6.41169548e-02, + 6.74364328e-01, -9.91658926e-01, -7.21871614e-01, + 1.51445031e-01, 5.43215156e-01, -9.79926050e-01, + -7.98386216e-01, 2.27895379e-01, 6.16404533e-01, + -9.60299134e-01, -8.75756919e-01, 1.84079528e-01, + 6.72083855e-01, -9.64962244e-01, -8.67987514e-01 ] + - [ -4.98964429e-01, -4.19606149e-01, -1.28459871e-01, + 7.14618802e-01, -9.64092076e-01, -4.93909657e-01, + -8.99928212e-02, 6.76509619e-01, -9.51217234e-01, + -5.54968536e-01, -2.18750238e-02, 6.75489426e-01, + -8.97422373e-01, -7.08235204e-01, -3.59374881e-02, + 6.67114735e-01, -8.93150926e-01, -7.08829999e-01, + 4.09678340e-01, 5.72717190e-03, 4.01574850e-01, 6.25937819e-01, + -7.11232185e-01, 1.75145030e-01, 4.75144386e-01, + 3.37432504e-01, -6.31267548e-01, -9.60180759e-02, + 5.04358649e-01, -8.83455873e-02, -3.91051590e-01, + -4.75112557e-01, 4.97512341e-01, -9.37904119e-02, + -3.98028910e-01, -4.73571837e-01 ] + - [ -6.97597384e-01, -8.33746731e-01, -4.29382563e-01, + 1.46602988e-01, -9.97317374e-01, -9.23249960e-01, + -4.31245446e-01, 1.97817683e-01, -9.96663809e-01, + -9.29911435e-01, -3.57812464e-01, 5.53364158e-01, + -9.95024264e-01, -9.47443128e-01, -3.56249988e-01, + 5.62229276e-01, -9.94819820e-01, -9.48534429e-01, + 1.07905030e-01, -5.68311334e-01, 1.67604089e-01, + 6.44751430e-01, -9.71393943e-01, -6.33667111e-01, + 1.88439250e-01, 5.09975433e-01, -9.49197412e-01, + -7.07252920e-01, 3.15068483e-01, 4.56680894e-01, + -9.10689712e-01, -8.40461612e-01, 3.25870633e-01, + 4.03024077e-01, -9.07272279e-01, -8.47774446e-01 ] + - [ -6.23032331e-01, -7.81018078e-01, -3.52732420e-01, + 2.95453668e-01, -9.98031080e-01, -8.82369518e-01, + -3.43412519e-01, 3.42469931e-01, -9.97114539e-01, + -8.93580258e-01, -2.35937476e-01, 7.08872557e-01, + -9.94655252e-01, -9.20421422e-01, -2.64062464e-01, + 7.44392395e-01, -9.95214462e-01, -9.17487562e-01, + 3.68199587e-01, -4.89245057e-01, 3.47581506e-01, + 7.35575080e-01, -9.60829258e-01, -5.24302423e-01, + 3.43352556e-01, 6.12492561e-01, -9.40135598e-01, + -6.13401353e-01, 5.04358649e-01, 4.74795461e-01, + -8.81284297e-01, -7.94582903e-01, 4.55223918e-01, + 5.65227389e-01, -8.90690088e-01, -7.75805473e-01 ] + - [ -4.94200528e-01, -6.00140274e-01, -1.49751663e-01, + 4.64309573e-01, -9.81157005e-01, -7.26613522e-01, + -1.47588134e-01, 5.19745708e-01, -9.77714837e-01, + -7.39115715e-01, -1.25000000e-01, 6.76684022e-01, + -9.49706137e-01, -8.10299218e-01, -9.37500000e-02, + 6.28175735e-01, -9.48864400e-01, -8.28921556e-01, + 6.32702112e-01, -2.17773020e-01, 4.69066381e-01, + 5.75089455e-01, -8.26274157e-01, -2.19882190e-01, + 4.68207955e-01, 5.34831047e-01, -8.01535904e-01, + -2.85904288e-01, 4.66998696e-01, 3.39856386e-01, + -6.45392060e-01, -5.41443586e-01, 5.22387981e-01, + -4.99996543e-02, -5.83062649e-01, -6.39287531e-01 ] + - [ -6.95111871e-01, -7.16582417e-01, -4.05251920e-01, + 4.22266126e-01, -9.96093988e-01, -8.06026697e-01, + -3.47732186e-01, 3.05071235e-01, -9.86869812e-01, + -8.54764521e-01, -2.87499964e-01, 6.24991536e-01, + -9.80037391e-01, -8.90399456e-01, -3.14062476e-01, + 6.86884880e-01, -9.82206047e-01, -8.84110808e-01, + -1.05500519e-01, -3.64940643e-01, 9.78627205e-02, + 9.66309071e-01, -9.51339483e-01, -1.98978662e-01, + 1.88439250e-01, 2.63510108e-01, -8.32949936e-01, + -5.89306533e-01, 2.15442181e-01, 5.12508154e-02, + -7.24516749e-01, -7.55948007e-01, 1.96517348e-01, + 1.71556234e-01, -7.53201723e-01, -7.34636068e-01 ] + - [ -7.13753104e-01, -8.97804439e-01, -5.55713236e-01, + 7.68160820e-03, -9.97217298e-01, -9.56396878e-01, + -5.82433403e-01, 5.55227995e-02, -9.95937347e-01, + -9.57116127e-01, -5.57812512e-01, 3.81038308e-01, + -9.94318068e-01, -9.68336403e-01, -5.57812512e-01, + 4.00698662e-01, -9.94286895e-01, -9.68905866e-01, + 8.11529160e-03, -6.91576004e-01, 2.13723183e-02, + 5.09102106e-01, -9.84303236e-01, -7.82904387e-01, + 7.51445293e-02, 5.82896352e-01, -9.85417426e-01, + -7.97580719e-01, 1.05852962e-01, 5.96138239e-01, + -9.61809158e-01, -8.81670773e-01, 1.01989985e-01, + 5.47618628e-01, -9.58237171e-01, -8.85460496e-01 ] + - [ -7.09817767e-01, -9.73170102e-01, -5.69907665e-01, + -1.66526079e-01, -9.98660326e-01, -9.93637681e-01, + -6.12670898e-01, -9.49361920e-02, -9.98676121e-01, + -9.92528439e-01, -4.71875012e-01, 2.28974700e-01, + -9.98787522e-01, -9.95528281e-01, -4.48437512e-01, + 2.48596668e-01, -9.98727202e-01, -9.95968580e-01, + -2.86444306e-01, -8.94595325e-01, -2.53093302e-01, + 2.67765999e-01, -9.97595847e-01, -9.56870615e-01, + -2.83237040e-01, 3.56743932e-01, -9.98403490e-01, + -9.54313278e-01, -2.02988863e-01, 4.94467854e-01, + -9.96241927e-01, -9.71658409e-01, -1.54228866e-01, + 4.46991205e-01, -9.95563269e-01, -9.74945188e-01 ] + - [ -5.68765521e-01, -4.71402049e-01, -3.01632404e-01, + 5.37443042e-01, -9.51002538e-01, -5.35440028e-01, + -2.35421121e-01, 2.40995884e-01, -9.11889255e-01, + -6.79418802e-01, -2.06249952e-01, 1.98200941e-01, + -8.51483107e-01, -7.94159353e-01, -2.29687452e-01, + 3.96453023e-01, -8.70448887e-01, -7.63395429e-01, + 1.06702685e-01, -2.39809990e-01, 6.86165094e-02, + 6.46452069e-01, -8.24958861e-01, -8.33248496e-02, + 1.39884353e-01, -2.44598985e-02, -6.68711543e-01, + -5.21163344e-01, 1.68119431e-01, -2.02617764e-01, + -5.44820249e-01, -6.86576247e-01, 1.39303446e-01, + -3.24437618e-02, -5.87065279e-01, -6.43133283e-01 ] + - [ -5.78914642e-01, -7.62669563e-01, -2.59048998e-01, + 2.79565811e-01, -9.95934963e-01, -8.78947437e-01, + -3.17494571e-01, 3.78749490e-01, -9.95055079e-01, + -8.69320929e-01, -1.35937452e-01, 6.84103966e-01, + -9.91319120e-01, -9.15616512e-01, -1.84374988e-01, + 7.44589686e-01, -9.92410064e-01, -9.08511519e-01, + 7.45115757e-01, -4.38414931e-01, 5.32058477e-01, + 5.57249546e-01, -9.25121665e-01, -5.47721684e-01, + 4.28901672e-01, 8.30422282e-01, -9.43531871e-01, + -4.58347857e-01, 8.10709715e-01, 3.53145480e-01, + -8.50762069e-01, -7.94213772e-01, 6.94029808e-01, + 5.46689868e-01, -8.70409489e-01, -7.54698277e-01 ] + - [ -5.56338072e-01, -6.88891888e-01, -2.13626683e-01, + 4.09042954e-01, -9.94308531e-01, -8.19124758e-01, + -2.75737882e-01, 5.52109718e-01, -9.95454133e-01, + -8.07143033e-01, -1.21874928e-01, 8.14097404e-01, + -9.86501396e-01, -8.69907796e-01, -1.12499952e-01, + 8.16060781e-01, -9.86405551e-01, -8.72394800e-01, + 6.05650663e-01, -2.89944768e-01, 4.96062994e-01, + 5.98120809e-01, -8.72822881e-01, -3.38313103e-01, + 4.65895891e-01, 8.69515538e-01, -9.05161142e-01, + -2.73531735e-01, 6.18929029e-01, 3.55503440e-01, + -7.56808937e-01, -6.73851907e-01, 6.39303565e-01, + 2.84542680e-01, -7.49037623e-01, -6.87277138e-01 ] + - [ -5.90513647e-01, -5.02220869e-01, -2.86018431e-01, + 5.49571872e-01, -9.61073339e-01, -5.69441080e-01, + -2.48380184e-01, 3.01573753e-01, -9.28191006e-01, + -6.85709834e-01, -1.89062476e-01, 3.50897789e-01, + -8.88162494e-01, -7.98164785e-01, -1.95312500e-01, + 3.69203687e-01, -8.87743592e-01, -7.99711943e-01, + 1.11511707e-01, -2.14903057e-01, 1.04611874e-01, + 5.86971045e-01, -7.96919107e-01, -7.98367858e-02, + 1.42196536e-01, 1.73037052e-02, -6.31300926e-01, + -4.20850754e-01, 2.40348697e-01, -2.47672498e-01, + -5.22694826e-01, -6.83065176e-01, 2.48756170e-01, + -3.42776299e-01, -5.11479855e-01, -6.98961020e-01 ] + - [ -4.73488033e-01, -2.34245300e-01, -9.58126187e-02, + 4.52210784e-01, -8.59482169e-01, -3.51419449e-01, + -1.33189321e-01, 8.08943987e-01, -8.92180383e-01, + -2.50660419e-01, -4.06249166e-02, 3.13933253e-01, + -7.39639878e-01, -5.97558379e-01, -4.68749404e-02, + 1.87407970e-01, -7.17201531e-01, -6.33557796e-01, + 5.47339916e-01, 1.51429892e-01, 5.02812147e-01, 6.40234947e-02, + -4.18886662e-01, 8.60317945e-02, 4.26589608e-01, + 4.39806342e-01, -4.85986173e-01, 3.48444462e-01, + 5.99003673e-01, -2.30403364e-01, -1.68926358e-01, + -3.30561101e-01, 6.31840825e-01, -4.79300022e-01, + -1.27176762e-01, -4.10731077e-01 ] + - [ -7.10439086e-01, -9.75278199e-01, -5.78424454e-01, + -1.68191195e-01, -9.98684943e-01, -9.93848741e-01, + -5.59395194e-01, -1.16721451e-01, -9.98687863e-01, + -9.95039880e-01, -4.28124964e-01, 2.14131832e-01, + -9.98825371e-01, -9.96517122e-01, -4.34374988e-01, + 2.40591645e-01, -9.98816192e-01, -9.96619344e-01, + -1.37962162e-01, -8.94967735e-01, -1.63104653e-01, + 3.00223708e-01, -9.99030411e-01, -9.58658814e-01, + -1.53757274e-01, 3.49826455e-01, -9.98591602e-01, + -9.60717916e-01, -8.71735811e-03, 5.30849457e-01, + -9.98068690e-01, -9.74604130e-01, -1.74129605e-02, + 5.14523387e-01, -9.98008847e-01, -9.74917889e-01 ] + - [ -9.10521984e-01, -9.78856623e-01, -8.01277518e-01, + -1.76430523e-01, -9.98476624e-01, -9.92686391e-01, + -8.21454287e-01, -1.22309566e-01, -9.98628378e-01, + -9.94055092e-01, -7.68750012e-01, 2.06634521e-01, + -9.98703778e-01, -9.95953023e-01, -7.71875024e-01, + 2.35942245e-01, -9.98836994e-01, -9.96183395e-01, + -7.21671224e-01, -8.96966875e-01, -4.84814405e-01, + 2.58444190e-01, -9.97677267e-01, -9.53318596e-01, + -5.09826660e-01, 2.99922705e-01, -9.96905088e-01, + -9.56681490e-01, -4.69489455e-01, 4.48871493e-01, + -9.95284617e-01, -9.72306550e-01, -4.65174139e-01, + 4.30786967e-01, -9.95503128e-01, -9.73539233e-01 ] + - [ -6.00662827e-01, -6.53005481e-01, -3.10149074e-01, + 4.11813140e-01, -9.88282084e-01, -7.72577584e-01, + -3.20374310e-01, 5.42681456e-01, -9.89367187e-01, + -7.67020524e-01, -2.18750000e-01, 6.99573517e-01, + -9.70529020e-01, -8.49102736e-01, -2.35937476e-01, + 7.39914775e-01, -9.71909761e-01, -8.44744205e-01, + 1.94469333e-01, -2.74912357e-01, 2.35095620e-01, + 5.60716391e-01, -8.59187841e-01, -3.11981380e-01, + 2.57803440e-01, 7.16359615e-01, -8.67826819e-01, + -2.75634646e-01, 2.95143127e-01, 2.16247439e-01, + -6.92505300e-01, -6.54125571e-01, 2.91044831e-01, + 2.52042294e-01, -7.04694927e-01, -6.46586776e-01 ] + - [ -6.27589107e-01, -7.87954152e-01, -3.72604668e-01, + 2.48757958e-01, -9.96270835e-01, -8.85105550e-01, + -3.65010738e-01, 2.45386720e-01, -9.92351592e-01, + -8.97994280e-01, -3.10937524e-01, 5.97113252e-01, + -9.89144742e-01, -9.21398163e-01, -3.06249976e-01, + 5.90290785e-01, -9.88648057e-01, -9.25211370e-01, + 3.15900207e-01, -4.70652759e-01, 3.02587152e-01, + 7.72448659e-01, -9.63065863e-01, -4.97859359e-01, + 3.66473913e-01, 6.54470921e-01, -9.44175005e-01, + -5.97965777e-01, 4.42092061e-01, 6.08774304e-01, + -8.87723684e-01, -7.57924736e-01, 4.45273519e-01, + 4.39053655e-01, -8.70242655e-01, -7.86864460e-01 ] + - [ -6.37738228e-01, -6.03233397e-01, -3.98154676e-01, + 3.72962594e-01, -9.67197537e-01, -6.90039217e-01, + -3.89488816e-01, 3.45800042e-01, -9.59221184e-01, + -7.36766934e-01, -3.17187428e-01, 4.02565837e-01, + -9.26369190e-01, -8.40745568e-01, -3.35937440e-01, + 4.24688697e-01, -9.24656928e-01, -8.37919652e-01, + 8.98705721e-02, -3.21557045e-01, 4.61193323e-02, + 4.80512857e-01, -8.16677272e-01, -2.57515073e-01, + 6.12715483e-02, 2.66654491e-01, -7.65030384e-01, + -4.38754618e-01, 2.35367298e-01, -1.51664495e-01, + -6.27978027e-01, -7.39038587e-01, 2.11442828e-01, + -1.41150594e-01, -6.29760623e-01, -7.26929069e-01 ] + - [ -7.22038150e-01, -9.72497165e-01, -5.71327209e-01, + -1.63611233e-01, -9.98603344e-01, -9.93144155e-01, + -6.16990626e-01, -9.24007893e-02, -9.98673618e-01, + -9.92206812e-01, -4.56250012e-01, 2.37790108e-01, + -9.98947203e-01, -9.95385706e-01, -4.68749940e-01, + 2.65455365e-01, -9.98884737e-01, -9.95237589e-01, + -1.95671856e-01, -8.79044294e-01, -2.14848220e-01, + 3.27617049e-01, -9.98586357e-01, -9.44621146e-01, + -1.97687924e-01, 3.90063763e-01, -9.98474896e-01, + -9.46754336e-01, -6.10211492e-02, 5.62440395e-01, + -9.97520387e-01, -9.67709124e-01, -7.21393228e-02, + 5.54243922e-01, -9.97525334e-01, -9.67308879e-01 ] + - [ -5.61723292e-01, -4.40021634e-01, -2.19304502e-01, + 4.51942086e-01, -9.39331770e-01, -5.67459345e-01, + -2.33981311e-01, 6.16436481e-01, -9.44103479e-01, + -5.48067093e-01, -1.82812452e-01, 4.30451393e-01, + -8.66743326e-01, -7.37976789e-01, -1.98437452e-01, + 4.90163445e-01, -8.69673908e-01, -7.28668094e-01, + 1.76435113e-01, -8.28887224e-02, 2.21597314e-01, + 2.85160422e-01, -6.70583248e-01, -1.43105686e-01, + 2.23121405e-01, 4.36041594e-01, -6.80289268e-01, + -8.04496408e-02, 2.80199170e-01, -2.39598751e-02, + -4.60214436e-01, -5.17643332e-01, 2.76119351e-01, + 3.24058533e-03, -4.76312935e-01, -5.09986103e-01 ] + - [ -8.49834323e-01, -9.35773373e-01, -7.85663605e-01, + -2.05516815e-03, -9.99966323e-01, -9.63934064e-01, + -8.08495283e-01, 7.38722086e-02, -9.99992311e-01, + -9.63585615e-01, -7.68750012e-01, 4.41025376e-01, + -9.99932408e-01, -9.74803746e-01, -7.73437500e-01, + 4.60629106e-01, -9.99938548e-01, -9.75108743e-01, + -3.57379019e-01, -7.41002083e-01, -2.55343020e-01, + 5.64062238e-01, -9.96776521e-01, -8.06185484e-01, + -3.08670521e-01, 6.87589526e-01, -9.99233246e-01, + -8.08716416e-01, -9.58903432e-02, 8.82041931e-01, + -9.95902836e-01, -8.94223034e-01, -9.45274234e-02, + 8.71128559e-01, -9.95662570e-01, -8.96165967e-01 ] + - [ -8.44863296e-01, -9.40898597e-01, -7.77146935e-01, + -1.48026943e-02, -9.99907076e-01, -9.67482626e-01, + -7.91216671e-01, 5.60345650e-02, -9.99915361e-01, + -9.68607128e-01, -7.57812500e-01, 4.23450947e-01, + -9.99847531e-01, -9.77237582e-01, -7.64062524e-01, + 4.45303440e-01, -9.99878705e-01, -9.77386713e-01, + -3.39945972e-01, -7.53582716e-01, -2.93588281e-01, + 5.86435080e-01, -9.99207616e-01, -8.18612158e-01, + -2.71676362e-01, 6.55933261e-01, -9.98989761e-01, + -8.28328609e-01, -1.10834420e-01, 8.99218440e-01, + -9.97846544e-01, -9.00625288e-01, -1.14427924e-01, + 8.97531867e-01, -9.97939944e-01, -9.02000964e-01 ] + - [ -8.43827665e-01, -9.40819204e-01, -7.77146935e-01, + -1.43474936e-02, -9.99915361e-01, -9.67443943e-01, + -7.91216671e-01, 5.64398766e-02, -9.99921203e-01, + -9.68566239e-01, -7.56249964e-01, 4.24991965e-01, + -9.99872744e-01, -9.77249980e-01, -7.62499988e-01, + 4.45384741e-01, -9.99877989e-01, -9.77427721e-01, + -3.36940289e-01, -7.53018498e-01, -2.91338563e-01, + 5.87198734e-01, -9.99159157e-01, -8.17556977e-01, + -2.69364119e-01, 6.56666636e-01, -9.98999536e-01, + -8.28328490e-01, -1.08343780e-01, 8.99419427e-01, + -9.97828305e-01, -9.00567651e-01, -1.14427924e-01, + 8.97853732e-01, -9.97896016e-01, -9.01620626e-01 ] + - [ -6.98425889e-01, -5.09929061e-01, -4.03832495e-01, + 5.32573581e-01, -9.73229110e-01, -6.10546768e-01, + -4.21166301e-01, 6.49646282e-01, -9.73368585e-01, + -6.09311581e-01, -1.14062428e-01, 6.59372926e-01, + -9.49778676e-01, -8.16025794e-01, -1.14062428e-01, + 6.76176548e-01, -9.50422406e-01, -8.17284822e-01, + 7.06341267e-02, -1.93311512e-01, 7.76153803e-02, + 2.42894530e-01, -7.13065743e-01, -2.78760195e-01, + 9.36415195e-02, 2.73168564e-01, -7.09981561e-01, + -3.17708313e-01, 1.35740995e-01, 2.99327374e-02, + -5.57157636e-01, -5.94030499e-01, 9.70149040e-02, + 2.09259987e-03, -5.44338822e-01, -5.84875107e-01 ] + - [ -6.94697618e-01, -3.89391720e-01, -4.44996417e-01, + 1.92018270e-01, -8.58845592e-01, -5.06423533e-01, + -4.58603263e-01, 3.38384986e-01, -8.70109797e-01, + -4.92089808e-01, -4.23437476e-01, -3.60066891e-02, + -7.43893325e-01, -7.46458411e-01, -4.28124964e-01, + -3.27071548e-02, -7.38900304e-01, -7.53911436e-01, + 6.34204149e-02, -1.36954427e-01, 5.96176386e-02, + 3.09163332e-02, -5.85945487e-01, -2.66691506e-01, + 9.59537029e-02, 6.22757673e-02, -5.94846010e-01, + -3.13723445e-01, 1.30759597e-01, -8.55141878e-02, + -4.55850422e-01, -5.49241304e-01, 1.04477525e-01, + -1.15699232e-01, -4.51745570e-01, -5.49124599e-01 ] + - [ -7.90182292e-01, -8.77996922e-01, -6.93399549e-01, + 3.41926813e-02, -9.95392382e-01, -9.32102323e-01, + -6.84665203e-01, 5.68988323e-02, -9.94313061e-01, + -9.46133435e-01, -6.23437524e-01, 4.15858984e-01, + -9.94583011e-01, -9.62117732e-01, -6.28124952e-01, + 4.34637189e-01, -9.94547606e-01, -9.62633252e-01, + -2.53982663e-01, -6.50189161e-01, -1.56355441e-01, + 6.14900589e-01, -9.84402299e-01, -6.90280259e-01, + -6.82081580e-02, 5.03655434e-01, -9.73836243e-01, + -7.83908248e-01, 1.30759597e-01, 6.12371564e-01, + -9.62615490e-01, -8.79425526e-01, 1.21890545e-01, + 5.75963378e-01, -9.61052358e-01, -8.83821428e-01 ] + - [ -7.46685982e-01, -4.35001612e-01, -5.24485469e-01, + 5.26586175e-01, -9.14788425e-01, -3.52768481e-01, + -4.93160486e-01, 1.25599384e-01, -8.89941096e-01, + -6.76481247e-01, -4.10937428e-01, 8.31828117e-02, + -8.43004823e-01, -8.20416033e-01, -4.15624976e-01, + 1.33169174e-01, -8.48333061e-01, -8.21337581e-01, + -4.65885997e-02, -1.20101810e-01, 1.68728828e-02, + 6.88657641e-01, -7.46538758e-01, 2.27144480e-01, + 9.59537029e-02, -5.78266263e-01, -3.76973629e-01, + -5.92907429e-01, 1.50684953e-01, -4.70543742e-01, + -3.42556119e-01, -6.33624315e-01, 1.29353285e-01, + -5.87966561e-01, -3.19694579e-01, -6.52436852e-01 ] + - [ -7.63463140e-01, -9.53028977e-01, -6.76366210e-01, + -1.17312491e-01, -9.97641623e-01, -9.82249260e-01, + -6.64506793e-01, -5.87471724e-02, -9.97996151e-01, + -9.85112906e-01, -6.37499928e-01, 2.85158992e-01, + -9.97763932e-01, -9.87981737e-01, -6.39062524e-01, + 3.10493112e-01, -9.97823834e-01, -9.88249540e-01, + -4.25308108e-01, -8.37914944e-01, -4.33070838e-01, + 4.28536296e-01, -9.98552680e-01, -8.86445880e-01, + -3.47976923e-01, 4.56925035e-01, -9.98595357e-01, + -9.16564584e-01, -2.62764633e-01, 6.78902864e-01, + -9.97982621e-01, -9.45793033e-01, -2.68656731e-01, + 6.71380162e-01, -9.98075008e-01, -9.46418941e-01 ] + - [ -8.27671885e-01, -5.35764337e-01, -7.11852372e-01, + 1.36199951e-01, -8.59179199e-01, -4.93748903e-01, + -7.24981964e-01, -8.82338583e-01, -5.22561133e-01, + -8.28991115e-01, -7.17187464e-01, -6.39241219e-01, + -5.94540238e-01, -8.65024745e-01, -7.26562500e-01, + -5.97214699e-01, -5.90475440e-01, -8.67319286e-01, + -1.27141654e-01, -3.06859791e-01, -9.33633447e-02, + 5.24777532e-01, -8.09907019e-01, -1.64911866e-01, + -1.26011610e-01, -2.20976353e-01, -6.10319972e-01, + -6.12603724e-01, -1.36985779e-02, -7.53539801e-02, + -6.37140453e-01, -7.24920809e-01, -2.48757005e-02, + -5.60443997e-02, -6.50619864e-01, -7.19945669e-01 ] + - [ -7.26594865e-01, -3.09024930e-01, -4.50674236e-01, + 8.98135900e-01, -9.28904176e-01, -6.75529838e-02, + -4.19726372e-01, -5.21628737e-01, -6.32598519e-01, + -6.74656987e-01, -4.06250000e-01, -4.29100215e-01, + -6.00615621e-01, -7.50649154e-01, -4.20312524e-01, + -4.54408288e-01, -5.83518744e-01, -7.64696956e-01, + -6.82296753e-02, -9.27793384e-02, 4.83690500e-02, + 7.63572931e-01, -7.55176902e-01, 3.05968642e-01, + 9.36415195e-02, -7.60203719e-01, -2.67988503e-01, + -6.21909142e-01, 1.68119431e-01, -5.83914816e-01, + -2.64256060e-01, -6.22636259e-01, 1.44278646e-01, + -6.79999352e-01, -2.50780761e-01, -6.39128923e-01 ] + - [ -8.21043909e-01, -9.53444898e-01, -7.60113597e-01, + -6.21596575e-02, -9.99323666e-01, -9.75757182e-01, + -7.69618392e-01, 7.26246834e-03, -9.99431133e-01, + -9.76970136e-01, -7.34375000e-01, 3.66628766e-01, + -9.99437809e-01, -9.83201206e-01, -7.39062488e-01, + 3.89740348e-01, -9.99456465e-01, -9.83349741e-01, + -4.22903597e-01, -7.98331857e-01, -3.99325013e-01, + 5.07343769e-01, -9.99385357e-01, -8.56915295e-01, + -3.82658958e-01, 5.73216915e-01, -9.99351501e-01, + -8.67564023e-01, -2.47820735e-01, 8.03411126e-01, + -9.98844802e-01, -9.24878418e-01, -2.53731430e-01, + 7.96850681e-01, -9.98837292e-01, -9.25726414e-01 ] + - [ -7.81897306e-01, -7.70364344e-01, -6.18168950e-01, + 2.27049232e-01, -9.93488431e-01, -8.50867450e-01, + -6.24190032e-01, 2.97871113e-01, -9.92839217e-01, + -8.58308196e-01, -5.00000000e-01, 5.64311504e-01, + -9.88154233e-01, -9.18562174e-01, -5.03124952e-01, + 5.59717298e-01, -9.87108052e-01, -9.20882761e-01, + -1.10309601e-01, -4.85454559e-01, -8.66141319e-02, + 4.74481106e-01, -9.15152311e-01, -5.38761854e-01, + -4.97110486e-02, 4.92290020e-01, -9.09007192e-01, + -5.80797315e-01, 4.60772514e-02, 4.47635889e-01, + -8.69639158e-01, -7.81360328e-01, 2.48756409e-02, + 3.44145894e-01, -8.54862928e-01, -7.93514311e-01 ] + - [ -7.36951113e-01, -5.03938675e-01, -5.30163169e-01, + 1.19901896e-01, -8.88997614e-01, -6.17588520e-01, + -5.44996381e-01, 3.92262936e-02, -8.61272335e-01, + -6.67736232e-01, -5.35937548e-01, 8.55263472e-02, + -8.18522453e-01, -7.91035533e-01, -5.35937548e-01, + 1.56768560e-02, -8.01735163e-01, -8.09074998e-01, + -1.03697121e-01, -2.92933941e-01, -1.04611933e-01, + 1.73123717e-01, -7.28343368e-01, -3.81645381e-01, + -8.90174508e-02, 3.20879221e-02, -6.70692801e-01, + -4.79633510e-01, -4.60771918e-02, 1.36358023e-01, + -6.38309121e-01, -6.32313848e-01, -6.46765828e-02, + 8.99602175e-02, -6.29516840e-01, -6.36062503e-01 ] + - [ -7.31358767e-01, -5.94562471e-01, -5.18807709e-01, + 2.80510187e-01, -9.58893597e-01, -6.97999299e-01, + -5.01799822e-01, 3.36033344e-01, -9.59394991e-01, + -7.28578210e-01, -4.03124928e-01, 4.36477423e-01, + -9.40224051e-01, -8.52403641e-01, -4.15624976e-01, + 3.81465793e-01, -9.31673527e-01, -8.60407114e-01, + -6.94319606e-02, -3.21253479e-01, -5.51180840e-02, + 2.98480153e-01, -7.95543194e-01, -3.96756411e-01, + -4.97110486e-02, 1.91884518e-01, -7.52204657e-01, + -4.79726970e-01, -3.61145735e-02, 1.89234138e-01, + -6.77866340e-01, -6.51038706e-01, -5.22388220e-02, + 1.21184468e-01, -6.64388120e-01, -6.59234762e-01 ] + - [ -7.35915542e-01, -5.02320051e-01, -5.25904894e-01, + 1.29509568e-01, -8.90461981e-01, -6.14622474e-01, + -5.40676773e-01, 4.25151587e-02, -8.61902833e-01, + -6.67208016e-01, -5.34374952e-01, 9.10938978e-02, + -8.18445683e-01, -7.88883805e-01, -5.34375012e-01, + 2.05930471e-02, -8.01347136e-01, -8.06825399e-01, + -1.03095949e-01, -2.89623678e-01, -1.00112557e-01, + 1.65525675e-01, -7.24388838e-01, -3.81962240e-01, + -8.43930840e-02, 3.16692591e-02, -6.69588804e-01, + -4.78021204e-01, -4.85678315e-02, 1.28874183e-01, + -6.30812645e-01, -6.27787352e-01, -6.46765828e-02, + 8.36925507e-02, -6.22201979e-01, -6.31173015e-01 ] + - [ -7.43786216e-01, -6.73830450e-01, -4.73385394e-01, + 3.90606165e-01, -9.88343000e-01, -7.61159360e-01, + -5.03239751e-01, 4.45508838e-01, -9.87621129e-01, + -7.80139804e-01, -3.23437452e-01, 6.60882354e-01, + -9.78322804e-01, -8.75424266e-01, -3.32812488e-01, + 6.84216142e-01, -9.78775084e-01, -8.74352932e-01, + 2.56988287e-01, -3.35035205e-01, 2.93588281e-01, + 5.92763901e-01, -8.71813059e-01, -3.23030412e-01, + 2.04624295e-01, 5.95886350e-01, -8.67892981e-01, + -3.89586985e-01, 4.37110782e-01, 3.39111567e-01, + -7.85842180e-01, -7.15668082e-01, 4.20397878e-01, + 3.82472157e-01, -7.93920100e-01, -7.04802513e-01 ] + - [ -7.22452402e-01, -6.08266115e-01, -4.29382563e-01, + 4.40246820e-01, -9.80025589e-01, -6.97585821e-01, + -4.58603263e-01, 4.79216099e-01, -9.77593362e-01, + -7.22837210e-01, -2.46874988e-01, 6.25076413e-01, + -9.64165866e-01, -8.53028655e-01, -2.56249964e-01, + 6.43334866e-01, -9.64100301e-01, -8.52251232e-01, + 2.08896995e-01, -2.87852108e-01, 2.21597314e-01, + 4.50760126e-01, -8.06423008e-01, -2.80355573e-01, + 1.51445031e-01, 6.05599642e-01, -8.46752524e-01, + -3.13390553e-01, 3.49937677e-01, 1.89218879e-01, + -7.23424196e-01, -7.00442791e-01, 3.08457732e-01, + 2.37766385e-01, -7.31983423e-01, -6.84562504e-01 ] + - [ -8.50662768e-01, -9.26246047e-01, -7.58694112e-01, + 2.46835947e-02, -9.99955416e-01, -9.58342612e-01, + -7.69618392e-01, 9.05187130e-02, -9.99940276e-01, + -9.61694658e-01, -7.31249928e-01, 4.65822458e-01, + -9.99900579e-01, -9.72332776e-01, -7.40625024e-01, + 4.86524463e-01, -9.99921262e-01, -9.72264111e-01, + -2.69011199e-01, -7.20394909e-01, -1.72103405e-01, + 6.60355568e-01, -9.99354303e-01, -7.89472938e-01, + -2.02312112e-01, 7.21640944e-01, -9.99166310e-01, + -8.00659299e-01, 1.24526024e-03, 9.89081383e-01, + -9.98050988e-01, -8.83954644e-01, -1.74129605e-02, + 9.91179824e-01, -9.98049796e-01, -8.83805752e-01 ] + - [ -6.80820227e-01, -4.94913936e-01, -3.64087999e-01, + 5.86256981e-01, -9.68934774e-01, -5.61828494e-01, + -3.44852388e-01, 5.91246843e-01, -9.65668440e-01, + -6.27109885e-01, -2.96874642e-02, 6.24774456e-01, + -9.43475187e-01, -8.15538883e-01, -4.21874523e-02, + 6.73004031e-01, -9.45869327e-01, -8.10832500e-01, + 7.60443211e-02, -2.08095789e-01, 1.31608605e-01, + 3.53354692e-01, -7.09457397e-01, -1.44159734e-01, + 1.05202198e-01, 4.18588996e-01, -7.51570463e-01, + -2.58032441e-01, 2.25404620e-01, -1.33934796e-01, + -5.61982930e-01, -6.71143115e-01, 1.76616907e-01, + -2.26731896e-02, -5.83093524e-01, -6.34004831e-01 ] + - [ -6.88483834e-01, -3.09016049e-01, -4.42157567e-01, + 2.83957720e-01, -8.04874182e-01, -3.02082181e-01, + -4.39884722e-01, 7.41339922e-02, -7.58162439e-01, + -4.58395839e-01, -3.82812440e-01, -3.69284153e-01, + -6.22634172e-01, -7.46471524e-01, -3.95312428e-01, + -2.02076972e-01, -6.44616902e-01, -7.20434785e-01, + 3.75713110e-02, -7.75516033e-02, 5.96176386e-02, + 1.56823754e-01, -5.02080441e-01, 5.26647568e-02, + 1.16762996e-01, -2.09915102e-01, -3.92854691e-01, + -2.69489050e-01, 2.22913980e-01, -5.20797253e-01, + -2.75269687e-01, -5.97760558e-01, 1.84079528e-01, + -4.24771369e-01, -3.01457167e-01, -5.59088886e-01 ] + - [ -8.33885670e-01, -9.43302274e-01, -7.51596868e-01, + -3.49961519e-02, -9.99542654e-01, -9.71170783e-01, + -7.68178523e-01, 3.67540121e-02, -9.99558330e-01, + -9.71500516e-01, -7.20312476e-01, 3.98832440e-01, + -9.99548793e-01, -9.80013728e-01, -7.25000024e-01, + 4.19418693e-01, -9.99543607e-01, -9.80258465e-01, + -3.50165367e-01, -7.61453748e-01, -2.80089974e-01, + 5.63093424e-01, -9.99078572e-01, -8.32742691e-01, + -2.76300609e-01, 6.38298392e-01, -9.98870850e-01, + -8.36103678e-01, -8.34370852e-02, 8.70543003e-01, + -9.97938931e-01, -9.09595251e-01, -8.95522237e-02, + 8.66669178e-01, -9.97984111e-01, -9.10762548e-01 ] + - [ -6.89105213e-01, -1.12410843e-01, -4.15188074e-01, + 1.24150872e-01, -6.54238462e-01, -1.45486355e-01, + -4.18286502e-01, 1.78588390e-01, -6.22905850e-01, + -1.17610335e-01, -3.21874976e-01, -4.14323688e-01, + -4.97878611e-01, -6.41677797e-01, -3.31249952e-01, + -4.61849928e-01, -4.64466631e-01, -6.53590202e-01, + 1.74030542e-01, 1.50704622e-01, 2.73340821e-01, + -2.58388877e-01, -2.49478459e-01, -4.14127707e-02, + 2.50867009e-01, -9.80318785e-02, -2.45541930e-01, + 1.01687312e-01, 3.59900355e-01, -3.55597675e-01, + -1.09207928e-01, -3.57593536e-01, 3.18407893e-01, + -1.35577440e-01, -1.62652850e-01, -2.64250040e-01 ] + - [ -7.13753104e-01, -3.49319100e-01, -4.74804819e-01, + 2.15049982e-01, -8.45743418e-01, -4.52068686e-01, + -4.87401009e-01, 3.35354328e-01, -8.37497652e-01, + -4.10924733e-01, -3.62500012e-01, 1.20569825e-01, + -7.95706093e-01, -7.48394966e-01, -3.98437500e-01, + 9.26432610e-02, -7.74312794e-01, -7.45411992e-01, + 4.47850227e-02, -2.27619410e-02, 1.67604089e-01, + -1.40531242e-01, -4.39462185e-01, -2.08263099e-01, + 1.28323674e-01, 1.37632251e-01, -4.84493554e-01, + -2.69385576e-02, 2.35367298e-01, -2.99847186e-01, + -2.97263563e-01, -5.05600452e-01, 1.66666627e-01, + -5.59747815e-02, -3.45697939e-01, -4.09127772e-01 ] + - [ -7.93703377e-01, -7.41612434e-01, -6.08232737e-01, + 2.68178105e-01, -9.92322922e-01, -8.25295329e-01, + -6.18430495e-01, 3.64096880e-01, -9.91439521e-01, + -8.21177244e-01, -4.82812464e-01, 5.93544960e-01, + -9.84913647e-01, -9.03133631e-01, -4.93749976e-01, + 6.11322165e-01, -9.84792769e-01, -9.02378678e-01, + -5.19989133e-02, -3.85612845e-01, 5.06186485e-02, + 4.54895377e-01, -8.76668930e-01, -4.54922915e-01, + 1.96532011e-02, 5.41335821e-01, -8.64447117e-01, + -4.14529741e-01, 2.12951303e-01, 3.93769026e-01, + -8.18283796e-01, -7.34332204e-01, 1.46766186e-01, + 4.05295491e-01, -8.14875603e-01, -7.20335543e-01 ] + - [ -7.01532722e-01, -3.03816378e-01, -4.36479747e-01, + 1.25969887e-01, -7.88305759e-01, -4.08502042e-01, + -4.35565174e-01, 2.23583579e-01, -7.81163454e-01, + -3.86492789e-01, -3.81249964e-01, -1.63313270e-01, + -6.59907341e-01, -7.02973604e-01, -3.95312428e-01, + -1.38364136e-01, -6.48071647e-01, -6.97519064e-01, + -5.44034243e-02, -3.66010666e-02, 1.27109051e-01, + -2.59979904e-01, -3.77867877e-01, -2.51613259e-01, + 8.90172720e-02, 3.72035503e-02, -4.38549399e-01, + -6.55459762e-02, 1.98007464e-01, -3.28839362e-01, + -2.77294755e-01, -5.04919589e-01, 1.04477525e-01, + -9.66117978e-02, -3.17208171e-01, -4.05352831e-01 ] + - [ -7.74647892e-01, -7.23532856e-01, -5.88360548e-01, + 2.16421366e-01, -9.78380322e-01, -7.93115675e-01, + -5.91072679e-01, 4.77326155e-01, -9.97203588e-01, + -8.11729312e-01, -4.96874928e-01, 6.63277864e-01, + -9.84423101e-01, -8.83010507e-01, -5.07812500e-01, + 6.64438605e-01, -9.83375847e-01, -8.83374214e-01, + 1.04899168e-01, -2.87792206e-01, 2.39595056e-01, + 9.40259218e-01, -9.31247532e-01, -1.57223046e-01, + 3.08670521e-01, 8.52970839e-01, -9.16286886e-01, + -3.14139485e-01, 7.21045971e-01, 7.70179391e-01, + -8.66531849e-01, -6.68005168e-01, 7.08955288e-01, + 7.77252555e-01, -8.69724274e-01, -6.70956254e-01 ] + - [ -6.12054706e-01, 9.86802578e-03, -2.56210089e-01, + 4.95188117e-01, -6.89748108e-01, 1.41177893e-01, + -2.59899080e-01, 1.22402072e-01, -5.75129747e-01, + -9.99113917e-02, -1.71874940e-01, -3.68130803e-01, + -4.04509246e-01, -5.16438067e-01, -1.73437536e-01, + -3.54484260e-01, -3.97635400e-01, -5.26049554e-01, + 2.88247705e-01, 3.06089997e-01, 3.54330659e-01, 5.06398678e-02, + -2.22617030e-01, 4.34606314e-01, 3.96531701e-01, + -4.28605795e-01, -3.02681327e-02, 3.43279839e-02, + 4.66998696e-01, -2.57188380e-01, 3.35279703e-02, + -1.54980242e-01, 4.57711339e-01, -2.88100362e-01, + 2.91496515e-02, -1.63144052e-01 ] + - [ -6.13918781e-01, 1.49716139e-02, -2.57629514e-01, + 4.79748487e-01, -6.80786669e-01, 1.45429850e-01, + -2.58459330e-01, 1.24678612e-01, -5.70673347e-01, + -8.99239779e-02, -1.73437417e-01, -3.79390836e-01, + -3.94739807e-01, -5.12022495e-01, -1.76562488e-01, + -3.64795208e-01, -3.85892391e-01, -5.19561112e-01, + 2.80432820e-01, 3.22070241e-01, 3.52081060e-01, 2.52505541e-02, + -1.89726710e-01, 4.57151890e-01, 3.98843884e-01, + -4.00174022e-01, -3.06423306e-02, 6.82958364e-02, + 4.69489455e-01, -2.51495123e-01, 5.18361330e-02, + -1.33117259e-01, 4.60198998e-01, -2.43323326e-01, + 3.19623947e-02, -1.31598473e-01 ] + - [ -6.01284146e-01, 2.48087645e-02, -2.40596175e-01, + 4.95814204e-01, -6.83145165e-01, 1.53562069e-01, + -2.36861050e-01, 1.44528985e-01, -5.72143197e-01, + -7.60941505e-02, -1.60937488e-01, -3.77489865e-01, + -3.84448588e-01, -4.99728978e-01, -1.60937488e-01, + -3.59520257e-01, -3.79239321e-01, -5.09145498e-01, + 2.92455673e-01, 3.18660259e-01, 3.67828965e-01, 8.76855850e-03, + -1.89608455e-01, 4.32650328e-01, 4.17340994e-01, + -3.86184633e-01, -4.68846560e-02, 6.37085438e-02, + 4.81942773e-01, -2.58567691e-01, 5.02890348e-02, + -1.38742745e-01, 4.70149159e-01, -2.52139568e-01, + 3.26855183e-02, -1.36128962e-01 ] + - [ -6.01284146e-01, 1.55872107e-02, -2.42015660e-01, + 4.84249711e-01, -6.85056448e-01, 1.36562943e-01, + -2.39740789e-01, 1.64527774e-01, -5.85868239e-01, + -8.24424028e-02, -1.60937488e-01, -3.48863721e-01, + -4.01711881e-01, -5.03458858e-01, -1.60937488e-01, + -3.46180916e-01, -3.92528594e-01, -5.15932500e-01, + 2.87646651e-01, 3.07581186e-01, 3.54330659e-01, 3.06715965e-02, + -2.11522996e-01, 4.25148010e-01, 4.10404563e-01, + -3.88926148e-01, -5.69333434e-02, 4.52908278e-02, + 4.74470735e-01, -2.84967661e-01, 4.45302725e-02, + -1.62148714e-01, 4.60198998e-01, -2.75771379e-01, + 2.83279419e-02, -1.55988991e-01 ] + - [ -7.31565833e-01, -1., -5.78424454e-01, -2.24771261e-01, + -9.98972178e-01, -9.99447346e-01, -5.92512548e-01, + -1.64462149e-01, -9.99040902e-01, -9.99412179e-01, + -5.64062417e-01, 1.63294554e-01, -9.99120593e-01, + -9.99247134e-01, -5.68749964e-01, 1.92052484e-01, + -9.99109983e-01, -9.99307394e-01, -6.66967273e-01, + -9.89094794e-01, -7.52530932e-01, 1.47378683e-01, + -9.99739408e-01, -9.91634727e-01, -7.64161825e-01, + 2.05310702e-01, -9.99812365e-01, -9.92093265e-01, + -7.48443365e-01, 3.59582782e-01, -9.99829590e-01, + -9.93595123e-01, -7.51243830e-01, 3.38972211e-01, + -9.99787807e-01, -9.93697166e-01 ] + - [ -6.95111871e-01, -4.55264032e-01, -3.51312995e-01, + 5.94556928e-01, -9.65878904e-01, -5.44828773e-01, + -3.75090003e-01, 7.22437143e-01, -9.67489660e-01, + -5.44377208e-01, -3.28124762e-02, 7.75440454e-01, + -9.46015060e-01, -7.74853587e-01, -4.06249166e-02, + 6.89752579e-01, -9.38463926e-01, -7.90050387e-01, + 2.76224852e-01, -5.32926917e-02, 2.57592797e-01, + 2.60784149e-01, -6.10293031e-01, -4.29335833e-02, + 2.92485476e-01, 2.89685011e-01, -6.15620255e-01, + -1.10068977e-01, 2.85180569e-01, 2.88578749e-01, + -4.83546495e-01, -3.71741652e-01, 3.10945153e-01, + -7.84370303e-02, -4.16430891e-01, -4.88924801e-01 ] + - [ -6.25724912e-01, -2.68162370e-01, -3.03051829e-01, + 3.25874567e-01, -8.29001427e-01, -3.48667860e-01, + -3.24693978e-01, 2.92150617e-01, -7.98226595e-01, + -3.82991076e-01, -3.04687500e-01, 6.85718060e-02, + -6.75971985e-01, -6.20070457e-01, -2.85937428e-01, + 6.21803999e-02, -6.85657263e-01, -6.49687886e-01, + 2.53381371e-01, 5.72335720e-02, 2.53093362e-01, + -1.94881558e-02, -3.89212549e-01, 3.00152302e-02, + 2.60115504e-01, -1.15100622e-01, -3.47000062e-01, + -8.41328502e-02, 3.05105805e-01, 1.39352918e-01, + -2.99795330e-01, -2.50682235e-01, 3.45771074e-01, + -2.68375516e-01, -2.15851367e-01, -3.92209709e-01 ] + - [ -6.24482155e-01, -2.74621606e-01, -3.01632404e-01, + 3.19927812e-01, -8.31102014e-01, -3.59030545e-01, + -3.24693978e-01, 3.01306844e-01, -8.05171907e-01, + -3.90980065e-01, -3.06249976e-01, 6.98959827e-02, + -6.79132104e-01, -6.23392224e-01, -2.87499964e-01, + 6.93866014e-02, -6.90705895e-01, -6.52624130e-01, + 2.64803171e-01, 5.77853918e-02, 2.68841386e-01, + -2.44546533e-02, -3.83987784e-01, 3.32158804e-02, + 2.71676183e-01, -1.35162234e-01, -3.37190270e-01, + -9.08132792e-02, 3.07596564e-01, 1.15567803e-01, + -2.80512214e-01, -2.44322419e-01, 3.50746155e-01, + -2.94185758e-01, -1.98878229e-01, -3.90153348e-01 ] + - [ -7.38400996e-01, -5.85240483e-01, -4.49254811e-01, + 4.66272712e-01, -9.79845166e-01, -6.76442266e-01, + -4.57163393e-01, 5.54705739e-01, -9.79482770e-01, + -6.88896894e-01, -2.37499952e-01, 7.59337187e-01, + -9.68874872e-01, -8.26802135e-01, -2.53125012e-01, + 6.62716031e-01, -9.60997462e-01, -8.39640856e-01, + 2.41959691e-01, -1.80904508e-01, 2.44094610e-01, + 4.89729047e-01, -7.72966683e-01, -1.48979664e-01, + 2.85549045e-01, 4.99496222e-01, -7.68685937e-01, + -2.26498961e-01, 3.54919076e-01, 5.41049957e-01, + -6.97987497e-01, -5.08005381e-01, 3.68159056e-01, + 1.29069448e-01, -6.20961070e-01, -6.04344428e-01 ] + - [ -7.68019915e-01, -5.89115262e-01, -5.30163169e-01, + 5.68462372e-01, -9.86533523e-01, -6.22979164e-01, + -5.32037377e-01, 5.68150401e-01, -9.81931686e-01, + -6.76468372e-01, -3.31249952e-01, 7.46751785e-01, + -9.69896257e-01, -8.28024387e-01, -3.37499976e-01, + 7.86098957e-01, -9.71485734e-01, -8.24033737e-01, + -6.34205341e-02, -1.63256824e-01, 7.98650980e-02, + 6.88111663e-01, -7.88994431e-01, 8.25117826e-02, + 3.81501913e-02, 4.49109554e-01, -7.22241402e-01, + -1.48898244e-01, 2.17932701e-01, -3.17474604e-02, + -5.62048197e-01, -6.26150250e-01, 2.26368189e-01, + 1.24719739e-01, -6.11097217e-01, -5.96533179e-01 ] + - [ -7.86454022e-01, -9.93312299e-01, -6.97657943e-01, + -1.87088132e-01, -9.98967171e-01, -9.96062577e-01, + -6.93304539e-01, -1.27643585e-01, -9.99126434e-01, + -9.96674001e-01, -6.73437476e-01, 2.08711863e-01, + -9.99143004e-01, -9.97002482e-01, -6.81249976e-01, + 2.40438819e-01, -9.99235332e-01, -9.97008741e-01, + -6.42921567e-01, -9.49585855e-01, -6.96287990e-01, + 2.31600285e-01, -9.99756038e-01, -9.69113231e-01, + -6.64739907e-01, 2.88604140e-01, -9.99759614e-01, + -9.73154306e-01, -6.43835664e-01, 4.66946006e-01, + -9.99748111e-01, -9.81845140e-01, -6.56716406e-01, + 4.51987982e-01, -9.99753058e-01, -9.81820226e-01 ] + - [ -7.33222842e-01, -2.05968022e-01, -4.35060322e-01, + 2.56855726e-01, -7.32268631e-01, -1.66525960e-01, + -4.68682528e-01, 3.26417804e-01, -7.47370362e-01, + -2.19806433e-01, -4.09374952e-01, -2.76798666e-01, + -5.40810347e-01, -6.29751146e-01, -4.10937428e-01, + -3.09616923e-01, -5.21041572e-01, -6.45666718e-01, + -7.06342459e-02, 1.05512261e-01, 1.04611874e-01, + 3.58061790e-02, -2.91006684e-01, 2.83384204e-01, + 9.13294554e-02, -1.28534377e-01, -2.83018589e-01, + -7.11339712e-03, 1.75591469e-01, -4.28502858e-01, + -8.34303498e-02, -3.89551640e-01, 1.61691427e-01, + -4.93710339e-01, -6.30151629e-02, -3.91018510e-01 ] + - [ -7.30530262e-01, -2.04869390e-01, -4.29382563e-01, + 2.66903996e-01, -7.36682892e-01, -1.67267621e-01, + -4.61483061e-01, 3.55195522e-01, -7.55951941e-01, + -2.13585913e-01, -4.01562452e-01, -2.44740963e-01, + -5.49772382e-01, -6.23674870e-01, -4.03124928e-01, + -2.82820523e-01, -5.30620933e-01, -6.42063379e-01, + -8.38594437e-02, 1.04739666e-01, 9.56130028e-02, + -2.16954947e-03, -2.70064950e-01, 2.64810562e-01, + 8.43930244e-02, -8.79210830e-02, -3.02422106e-01, + 1.16040707e-02, 1.53175592e-01, -3.92641246e-01, + -8.73228312e-02, -3.73477638e-01, 1.44278646e-01, + -5.05718768e-01, -5.16269803e-02, -3.89459074e-01 ] + - [ -7.29080379e-01, -2.02712893e-01, -4.27963138e-01, + 2.48565316e-01, -7.29493380e-01, -1.70509517e-01, + -4.58603263e-01, 3.67743492e-01, -7.57311225e-01, + -2.05628633e-01, -3.99999976e-01, -2.51925588e-01, + -5.44908881e-01, -6.21823430e-01, -4.03124928e-01, + -2.92803586e-01, -5.24041414e-01, -6.40164971e-01, + -8.74662399e-02, 1.05673313e-01, 1.00112557e-01, + -5.72991371e-02, -2.41400480e-01, 2.34421015e-01, + 8.20808411e-02, -4.45587635e-02, -3.19878757e-01, + 3.71968746e-02, 1.50684953e-01, -3.92987013e-01, + -8.56277347e-02, -3.72358799e-01, 1.46766186e-01, + -4.91066575e-01, -5.91627955e-02, -3.87395620e-01 ] + - [ -8.07373643e-01, -9.00144815e-01, -7.54435778e-01, + 2.48845816e-02, -9.97967958e-01, -9.43117559e-01, + -7.73938060e-01, 1.14362717e-01, -9.98112857e-01, + -9.39899266e-01, -6.95312500e-01, 4.60789323e-01, + -9.97852445e-01, -9.63429987e-01, -6.96874976e-01, + 4.78178382e-01, -9.97879088e-01, -9.64306116e-01, + -4.98647451e-01, -7.36313820e-01, -4.51068580e-01, + 3.86041045e-01, -9.80063081e-01, -8.01707804e-01, + -4.61271703e-01, 4.98646617e-01, -9.81531382e-01, + -7.82436848e-01, -3.10087204e-01, 5.16832709e-01, + -9.67876792e-01, -9.04485404e-01, -3.15920413e-01, + 4.39497828e-01, -9.62674201e-01, -9.12182331e-01 ] + - [ -7.92253494e-01, -9.59448874e-01, -7.92760849e-01, + -1.08984351e-01, -9.98216510e-01, -9.79645193e-01, + -7.98416078e-01, -4.39325571e-02, -9.98177767e-01, + -9.80290711e-01, -7.48437464e-01, 2.98265815e-01, + -9.98246670e-01, -9.86629486e-01, -7.50000000e-01, + 3.22758794e-01, -9.98293936e-01, -9.86961246e-01, + -5.48542261e-01, -8.75153363e-01, -6.24296963e-01, + 2.87493706e-01, -9.95244026e-01, -9.17661250e-01, + -6.13872826e-01, 3.35735798e-01, -9.93388951e-01, + -9.19506371e-01, -5.41718602e-01, 4.68285441e-01, + -9.91245747e-01, -9.57480192e-01, -5.52238822e-01, + 4.28060770e-01, -9.89733100e-01, -9.59052503e-01 ] + - [ -7.64291644e-01, -6.15247488e-01, -5.74166059e-01, + 2.73357630e-02, -9.28631783e-01, -7.63348460e-01, + -5.91072679e-01, 1.69603944e-01, -9.32872415e-01, + -7.37048090e-01, -5.95312476e-01, 1.68824196e-01, + -8.89051974e-01, -8.51903498e-01, -5.92187524e-01, + 6.52443171e-02, -8.74396503e-01, -8.75853181e-01, + -3.53772223e-01, -5.02619922e-01, -3.45331788e-01, + 6.44510984e-02, -8.19567859e-01, -6.66887641e-01, + -3.84971201e-01, 2.44171262e-01, -8.30415726e-01, + -5.80614030e-01, -3.47447038e-01, 1.91907525e-01, + -7.74744332e-01, -7.61169910e-01, -3.43283534e-01, + -4.80401516e-02, -7.32027292e-01, -8.04666698e-01 ] + - [ -7.95774639e-01, -7.68090904e-01, -6.65010691e-01, + 1.67945623e-01, -9.90439236e-01, -8.56113791e-01, + -6.64506793e-01, 2.56781459e-01, -9.90229309e-01, + -8.57494354e-01, -5.14062524e-01, 4.61488128e-01, + -9.83822763e-01, -9.29084301e-01, -5.14062524e-01, + 4.27863836e-01, -9.81455386e-01, -9.35613096e-01, + -3.68199587e-01, -5.93773246e-01, -3.76827896e-01, + 2.24195600e-01, -9.04077649e-01, -7.05763340e-01, + -4.01156127e-01, 2.72280455e-01, -8.88428748e-01, + -6.83596611e-01, -4.09713566e-01, 2.79845357e-01, + -8.49061847e-01, -8.11475158e-01, -4.05472696e-01, + 5.05700111e-02, -8.13939631e-01, -8.49161446e-01 ] + - [ -7.71540999e-01, -6.65887833e-01, -5.94038308e-01, + 1.23611093e-01, -9.63031471e-01, -7.93102980e-01, + -6.25629902e-01, 1.43565893e-01, -9.47590947e-01, + -7.83699691e-01, -6.14062428e-01, 2.27228999e-01, + -9.24625337e-01, -8.82585049e-01, -6.10937476e-01, + 1.93230987e-01, -9.20157790e-01, -8.94464314e-01, + -3.39945972e-01, -5.23836553e-01, -3.38582635e-01, + 1.28602266e-01, -8.50604773e-01, -6.71274185e-01, + -3.78034770e-01, 2.39892125e-01, -8.42749834e-01, + -6.11442268e-01, -3.49937677e-01, 2.33577609e-01, + -7.97514677e-01, -7.69381166e-01, -3.48258734e-01, + -2.27104425e-02, -7.52769947e-01, -8.14786911e-01 ] + - [ -8.08823526e-01, -9.93012547e-01, -7.53016353e-01, + -1.62866175e-01, -9.99520361e-01, -9.94600773e-01, + -7.81137466e-01, -9.79048014e-02, -9.99539554e-01, + -9.94287372e-01, -7.51562476e-01, 2.41411567e-01, + -9.99524772e-01, -9.95505452e-01, -7.57812500e-01, + 2.69141436e-01, -9.99563515e-01, -9.95589972e-01, + -6.51938677e-01, -9.24768269e-01, -6.44544482e-01, + 2.81167388e-01, -9.99905944e-01, -9.55504656e-01, + -6.71676278e-01, 3.50211382e-01, -9.99955416e-01, + -9.54071462e-01, -6.23910308e-01, 5.41736484e-01, + -9.99960661e-01, -9.72194493e-01, -6.24378145e-01, + 5.26697397e-01, -9.99920011e-01, -9.72588837e-01 ] + - [ -8.70753944e-01, -9.84467030e-01, -1., -2.05926895e-01, + -9.94523048e-01, -9.85958397e-01, -1., -1.88264310e-01, + -9.92799520e-01, -9.92775023e-01, -1., 4.85666990e-02, + -9.89440441e-01, -9.98861790e-01, -9.84374940e-01, + 9.13130045e-02, -9.90875840e-01, -9.98732686e-01, + -8.14848185e-01, -9.80014861e-01, -1., 7.31353760e-02, + -9.91435409e-01, -9.85444784e-01, -9.86127198e-01, + 7.98383951e-02, -9.87775981e-01, -9.94295835e-01, -1., + 1.94576859e-01, -9.88579214e-01, -9.95205760e-01, -1., + 1.69350624e-01, -9.88720238e-01, -9.95447874e-01 ] + - [ -7.56835103e-01, -6.92078888e-01, -5.55713236e-01, + 5.15568376e-01, -9.99378800e-01, -7.66058803e-01, + -5.70914268e-01, 5.97718954e-01, -9.99277413e-01, + -7.81034470e-01, -4.18749928e-01, 1., -9.98373628e-01, + -8.62518907e-01, -4.24999952e-01, 1., -9.98346031e-01, + -8.63608658e-01, 4.03666973e-01, -2.32029080e-01, + 6.08548999e-01, 9.81516004e-01, -9.27701235e-01, + -1.52251661e-01, 3.91907454e-01, 1., -9.01200533e-01, + -1.11187518e-01, 8.82938862e-01, 8.58323455e-01, + -8.38825703e-01, -5.87478042e-01, 8.73134375e-01, + 8.31120610e-01, -8.36751819e-01, -5.97258329e-01 ] + - [ -5.81607342e-01, -1.34204507e-01, -2.27821112e-01, + 4.94241953e-01, -7.85390854e-01, -1.00186288e-01, + -2.54139602e-01, 4.43341136e-01, -7.60687232e-01, + -1.84999108e-01, -1.45312488e-01, -7.44051337e-02, + -5.99711478e-01, -5.90012431e-01, -1.48437440e-01, + -6.08986616e-02, -5.98104000e-01, -5.99491477e-01, + 4.03065801e-01, 2.21898913e-01, 4.19572473e-01, 2.12859631e-01, + -3.54878724e-01, 4.18564200e-01, 4.17340994e-01, + 7.82543421e-02, -3.01199973e-01, 2.36562848e-01, + 5.24283886e-01, -3.61952603e-01, -3.45290899e-02, + -2.83303499e-01, 5.42288542e-01, -4.33892608e-01, + -4.30293083e-02, -3.14625442e-01 ] + - [ -5.83471417e-01, -1.22754991e-01, -2.26401687e-01, + 5.06066561e-01, -7.81017542e-01, -7.77372122e-02, + -2.52699673e-01, 4.39395905e-01, -7.51804948e-01, + -1.68538809e-01, -1.46874964e-01, -8.72014165e-02, + -5.86925030e-01, -5.81080317e-01, -1.48437440e-01, + -7.69000053e-02, -5.84671021e-01, -5.91567397e-01, + 3.70002985e-01, 2.36447453e-01, 4.10573721e-01, 1.97838187e-01, + -3.38322341e-01, 4.30096269e-01, 4.01155949e-01, + 5.83853722e-02, -2.75972426e-01, 2.55912781e-01, + 5.06849289e-01, -3.73342812e-01, -1.27458572e-02, + -2.70798922e-01, 5.24875641e-01, -4.42337871e-01, + -2.17775702e-02, -3.00962210e-01 ] + - [ -8.65782917e-01, -9.37441468e-01, -7.98438609e-01, + -4.28318977e-03, -1., -9.63872313e-01, -8.32973361e-01, + 7.79973269e-02, -1., -9.60299611e-01, -7.90624976e-01, + 4.42558527e-01, -1., -9.74112928e-01, -7.96875000e-01, + 4.62063074e-01, -1., -9.74310637e-01, -4.52960670e-01, + -7.40870118e-01, -3.52081001e-01, 6.11332059e-01, + -9.99641299e-01, -8.02382588e-01, -3.75722647e-01, + 7.16306806e-01, -9.99684930e-01, -7.89183915e-01, + -1.95516825e-01, 9.51533198e-01, -9.98716235e-01, + -8.88818085e-01, -2.06467748e-01, 9.47041988e-01, + -9.98645127e-01, -8.89774799e-01 ] + - [ -8.79660308e-01, -2.54645109e-01, -7.09013462e-01, + -2.21580625e-01, -5.09149909e-01, -2.36279011e-01, + -7.30741501e-01, 1.85139537e-01, -5.97835183e-01, + 1.61855221e-02, -6.67187452e-01, -1., -3.00193667e-01, + -7.95280695e-01, -6.73437476e-01, -1., -2.81419218e-01, + -8.10069323e-01, -6.56747818e-01, -1.92885995e-01, + -4.28571403e-01, -7.46491075e-01, -1.49645686e-01, + -6.18553221e-01, -4.75144506e-01, -3.32608283e-01, + -2.40347207e-01, -2.92140722e-01, -4.32129562e-01, + -6.96548462e-01, -1.66570246e-01, -6.86404288e-01, + -4.32835817e-01, -6.83852553e-01, -1.96941614e-01, + -6.77671790e-01 ] + - [ -6.39602304e-01, -2.84365714e-01, -2.56210089e-01, + 7.41132140e-01, -9.41534638e-01, -3.48587275e-01, + -2.77177811e-01, 1., -9.49285924e-01, -2.77020514e-01, + 1.35937572e-01, 7.76980877e-01, -9.03830290e-01, + -6.89878821e-01, 1.26562595e-01, 7.54393458e-01, + -9.01286066e-01, -6.97796345e-01, 4.07874942e-01, + 1.88173532e-01, 4.10573721e-01, 1.16777778e-01, + -4.04243112e-01, 1.84041977e-01, 3.87283206e-01, + 4.88245726e-01, -4.70710039e-01, 4.52740312e-01, + 5.39227962e-01, -1.80540740e-01, -1.56042576e-01, + -2.90727079e-01, 5.42288542e-01, -3.69006217e-01, + -1.15606427e-01, -3.44988942e-01 ] + - [ -5.74150801e-01, -1.22724354e-01, -2.33498931e-01, + 2.52291083e-01, -7.35707045e-01, -2.13719726e-01, + -2.49819934e-01, 6.66272759e-01, -7.92670250e-01, + -6.26013875e-02, -1.39062464e-01, -7.73589015e-02, + -5.88988781e-01, -5.78828335e-01, -1.39062464e-01, + -1.81290150e-01, -5.64080715e-01, -6.15539193e-01, + 4.10279632e-01, 2.28192806e-01, 4.24072027e-01, + -1.32406890e-01, -2.51611769e-01, 1.25911236e-01, + 3.66473913e-01, 2.68042564e-01, -3.36294472e-01, + 4.27705169e-01, 5.39227962e-01, -3.29704225e-01, + -3.92968655e-02, -2.67542481e-01, 5.62189102e-01, + -5.46589017e-01, -7.92741776e-05, -3.38453412e-01 ] + - [ -5.73736548e-01, -1.10366821e-01, -2.29240656e-01, + 2.67293215e-01, -7.30512142e-01, -1.89307690e-01, + -2.45500267e-01, 6.69388056e-01, -7.86709428e-01, + -4.50915694e-02, -1.39062464e-01, -9.26529169e-02, + -5.74080944e-01, -5.68623900e-01, -1.40624940e-01, + -1.89292550e-01, -5.50205112e-01, -6.04359508e-01, + 3.67598414e-01, 2.43543029e-01, 4.08323884e-01, + -1.56999171e-01, -2.26118863e-01, 1.35326624e-01, + 3.47976804e-01, 2.29449987e-01, -3.05449665e-01, + 4.34721351e-01, 5.14321208e-01, -3.43124509e-01, + -1.53049231e-02, -2.54315317e-01, 5.37313461e-01, + -5.71886420e-01, 2.80790329e-02, -3.29443514e-01 ] + - [ -8.73239458e-01, -6.69647217e-01, -7.09013462e-01, + 1.57988906e-01, -9.62740719e-01, -7.49849796e-01, + -7.24981964e-01, 1.97985172e-01, -9.63585794e-01, + -7.81581044e-01, -5.99999905e-01, 2.76337624e-01, + -9.47752655e-01, -9.03648734e-01, -6.10937476e-01, + 2.79327154e-01, -9.45411742e-01, -9.06287730e-01, + -6.36309028e-01, -4.91094708e-01, -4.87064064e-01, + 1.09169364e-01, -7.87202716e-01, -5.59006333e-01, + -5.00578046e-01, 7.79414177e-03, -7.52826154e-01, + -6.55142784e-01, -4.89414692e-01, -7.84916878e-02, + -6.77788973e-01, -7.86767423e-01, -5.00000000e-01, + -1.54608011e-01, -6.67710900e-01, -7.98612773e-01 ] + - [ -8.61019075e-01, -6.43306971e-01, -6.91980124e-01, + 1.96550131e-01, -9.56439376e-01, -7.07498193e-01, + -7.22102165e-01, 1.65770411e-01, -9.43789542e-01, + -7.46178985e-01, -6.04687452e-01, 2.14632869e-01, + -9.22996998e-01, -8.84001255e-01, -6.04687452e-01, + 2.37080693e-01, -9.24195766e-01, -8.87533784e-01, + -5.87015390e-01, -3.77429605e-01, -4.53318357e-01, + 1.59470439e-01, -7.06802607e-01, -3.36816132e-01, + -4.61271703e-01, 3.06853056e-02, -6.70485497e-01, + -4.93704557e-01, -3.97260308e-01, -1.97661221e-01, + -5.75556993e-01, -7.44004607e-01, -3.83084595e-01, + -3.58090758e-01, -5.50329328e-01, -7.76879370e-01 ] + - [ -8.54391038e-01, -9.00411606e-01, -7.79985785e-01, + -1.44338608e-03, -9.95671451e-01, -9.37932312e-01, + -7.95536399e-01, 5.15772104e-02, -9.95511830e-01, + -9.44829106e-01, -7.42187500e-01, 3.69826913e-01, + -9.94333565e-01, -9.65528488e-01, -7.50000000e-01, + 3.87263656e-01, -9.94135439e-01, -9.66018438e-01, + -6.94619775e-01, -7.45388865e-01, -6.22047186e-01, + 3.62842798e-01, -9.68059599e-01, -7.43897080e-01, + -6.55491352e-01, 3.48169923e-01, -9.60547268e-01, + -7.87463248e-01, -5.61643898e-01, 2.82387018e-01, + -9.33567047e-01, -9.13191676e-01, -5.77114403e-01, + 2.38495469e-01, -9.29834127e-01, -9.15674210e-01 ] + - [ -8.94573331e-01, -5.97356081e-01, -7.28885710e-01, + 1.22518539e-02, -9.06232536e-01, -7.02273667e-01, + -7.53779650e-01, -5.70797920e-02, -8.76962185e-01, + -7.41624355e-01, -7.03124940e-01, -1.15431905e-01, + -8.25458050e-01, -8.73842716e-01, -7.07812488e-01, + -1.04420841e-01, -8.22537899e-01, -8.79858077e-01, + -6.94018722e-01, -4.62819278e-01, -4.93813276e-01, + -5.59697151e-02, -6.99992955e-01, -5.81191659e-01, + -5.05202353e-01, -1.11845315e-01, -6.81178451e-01, + -6.55799747e-01, -4.96886671e-01, -2.31249928e-01, + -5.86444438e-01, -7.77728081e-01, -5.04975140e-01, + -2.88863420e-01, -5.86622655e-01, -7.89115965e-01 ] + - [ -8.97680223e-01, -5.27785301e-01, -7.26046801e-01, + -1.68326080e-01, -8.08427513e-01, -6.57931268e-01, + -7.48020172e-01, -1.57933533e-01, -8.01807046e-01, + -6.85844779e-01, -7.29687452e-01, -3.30027580e-01, + -6.90873027e-01, -8.29942822e-01, -7.34375000e-01, + -3.31198752e-01, -6.82492077e-01, -8.40444386e-01, + -7.03035831e-01, -4.41401720e-01, -5.00562429e-01, + -1.46040678e-01, -6.37873471e-01, -5.81820726e-01, + -5.14450908e-01, -1.95312738e-01, -6.23259544e-01, + -6.54270053e-01, -5.11830688e-01, -2.36829996e-01, + -5.55056334e-01, -7.56902814e-01, -5.17412901e-01, + -2.99166858e-01, -5.54369569e-01, -7.70018101e-01 ] + - [ -8.28086138e-01, -9.41279352e-01, -7.57274628e-01, + -3.56280804e-02, -9.99364018e-01, -9.69753504e-01, + -7.72498190e-01, 3.59139442e-02, -9.99317646e-01, + -9.69790697e-01, -7.31249928e-01, 3.98304224e-01, + -9.99337792e-01, -9.78671432e-01, -7.39062488e-01, + 4.19725180e-01, -9.99356747e-01, -9.78850901e-01, + -3.92245352e-01, -7.56890893e-01, -3.45331788e-01, + 5.69324017e-01, -9.99044120e-01, -8.19607198e-01, + -3.38728368e-01, 6.55213237e-01, -9.99089420e-01, + -8.21868598e-01, -1.83063507e-01, 8.91688824e-01, + -9.98342514e-01, -9.02516544e-01, -1.96517467e-01, + 8.85191560e-01, -9.98255491e-01, -9.03237045e-01 ] + - [ -8.28707516e-01, -9.41302419e-01, -7.58694112e-01, + -5.73591590e-02, -9.98495758e-01, -9.70140219e-01, + -7.76817858e-01, 1.43810511e-02, -9.98494327e-01, + -9.69904721e-01, -7.35937476e-01, 3.97544622e-01, + -9.99313116e-01, -9.78512406e-01, -7.45312452e-01, + 4.20740843e-01, -9.99356031e-01, -9.78515387e-01, + -3.87436211e-01, -7.56461203e-01, -3.34083259e-01, + 5.63510418e-01, -9.98709440e-01, -8.19713950e-01, + -3.24855566e-01, 6.48235679e-01, -9.98698950e-01, + -8.21892738e-01, -1.83063507e-01, 8.92671108e-01, + -9.98344600e-01, -9.02277887e-01, -2.03980088e-01, + 8.89691830e-01, -9.98342156e-01, -9.02356267e-01 ] + - [ -6.73985124e-01, -2.60215342e-01, -3.99574220e-01, + 1.26364231e-01, -7.70236135e-01, -3.76116157e-01, + -4.01007950e-01, 3.73356223e-01, -8.00814331e-01, + -3.11154187e-01, -3.59374940e-01, -1.08784199e-01, + -6.52153432e-01, -6.70947373e-01, -3.64062488e-01, + -4.96535301e-02, -6.55404866e-01, -6.65794075e-01, + 8.92695189e-02, 5.65074682e-02, 1.63104653e-01, + -1.75241828e-02, -4.38095808e-01, -5.66509366e-02, + 1.63005710e-01, 1.52153492e-01, -4.55218971e-01, + 4.59040403e-02, 2.40348697e-01, -9.50032473e-02, + -2.85834014e-01, -3.80730391e-01, 2.26368189e-01, + -9.01049972e-02, -2.94168174e-01, -3.73923779e-01 ] + - [ -6.67978466e-01, -2.52564490e-01, -3.86799216e-01, + 1.53822303e-01, -7.75267422e-01, -3.64305735e-01, + -3.93808424e-01, 3.57717633e-01, -7.94034839e-01, + -3.10227573e-01, -3.51562440e-01, -1.05325997e-01, + -6.48665786e-01, -6.65302336e-01, -3.59374940e-01, + -4.95548844e-02, -6.49561286e-01, -6.59032702e-01, + 1.11511707e-01, 6.88164234e-02, 1.81102276e-01, + -2.94072628e-02, -4.26385403e-01, -5.04934192e-02, + 1.81502938e-01, 1.32232070e-01, -4.38570917e-01, + 5.21047115e-02, 2.60273933e-01, -9.43704844e-02, + -2.75745511e-01, -3.69439662e-01, 2.41293430e-01, + -8.10722113e-02, -2.83061326e-01, -3.56941044e-01 ] + - [ -7.65120149e-01, -9.90692437e-01, -6.59332871e-01, + -1.86961710e-01, -9.99012351e-01, -9.96326566e-01, + -6.84665203e-01, -1.23866439e-01, -9.99020040e-01, + -9.96087492e-01, -6.53124988e-01, 2.10444093e-01, + -9.99055445e-01, -9.96770978e-01, -6.53124988e-01, + 2.38585711e-01, -9.99100983e-01, -9.96908605e-01, + -6.07454181e-01, -9.40371513e-01, -6.26546621e-01, + 2.38950253e-01, -9.99606967e-01, -9.68427718e-01, + -6.46242738e-01, 3.05508614e-01, -9.99691784e-01, + -9.67977166e-01, -5.94022393e-01, 4.85777855e-01, + -9.99679863e-01, -9.79806960e-01, -5.97014904e-01, + 4.69348311e-01, -9.99671042e-01, -9.80212092e-01 ] + - [ -7.71126747e-01, -6.58510089e-01, -5.61391056e-01, + 4.23741698e-01, -9.89822567e-01, -7.31862903e-01, + -5.07559419e-01, 4.56407547e-01, -9.86000657e-01, + -7.65665531e-01, -2.92187452e-01, 6.86411500e-01, + -9.80712533e-01, -8.76879215e-01, -3.14062476e-01, + 6.39177680e-01, -9.75840211e-01, -8.79331887e-01, + 2.85241961e-01, -2.78746903e-01, 2.73340821e-01, + 5.22279382e-01, -8.39212477e-01, -2.97737837e-01, + 1.14450812e-01, 3.53743792e-01, -7.29438186e-01, + -2.76736200e-01, 4.29638743e-01, 1.57306552e-01, + -7.13463783e-01, -7.01624751e-01, 4.02985096e-01, + 1.56562924e-01, -7.08888888e-01, -6.90078378e-01 ] + - [ -8.55426669e-01, -9.19957519e-01, -7.45919108e-01, + 2.47811079e-02, -9.99733925e-01, -9.57002938e-01, + -7.76817858e-01, 1.08984470e-01, -9.99792755e-01, + -9.54445183e-01, -7.15624988e-01, 4.74971294e-01, + -9.99739230e-01, -9.70334411e-01, -7.21874952e-01, + 4.94625330e-01, -9.99733686e-01, -9.70332026e-01, + -2.91253388e-01, -7.11070299e-01, -1.83352113e-01, + 6.56866908e-01, -9.99227762e-01, -7.87733316e-01, + -1.95375800e-01, 7.57761240e-01, -9.99305248e-01, + -7.81787097e-01, 5.35492897e-02, 1., -9.98189509e-01, + -8.84593368e-01, 4.22885418e-02, 1., -9.98109818e-01, + -8.84841383e-01 ] + - [ -7.88111031e-01, -7.11115420e-01, -6.16749525e-01, + -7.75448084e-02, -9.34514642e-01, -8.30311418e-01, + -6.42908573e-01, 1.90919518e-01, -9.59331572e-01, + -7.87221730e-01, -5.81249952e-01, 2.60063052e-01, + -9.38954353e-01, -8.94884288e-01, -5.89062452e-01, + 2.80132174e-01, -9.37102675e-01, -8.94083679e-01, + 2.23925471e-01, -3.47413361e-01, 3.45331788e-01, + 6.21612906e-01, -9.03669298e-01, -4.03317869e-01, + 3.04046154e-01, 9.69940782e-01, -9.35263932e-01, + -2.76067615e-01, 7.63387203e-01, 6.45328283e-01, + -8.69017601e-01, -7.20734119e-01, 7.21393108e-01, + 6.85147762e-01, -8.71792853e-01, -7.09108353e-01 ] + - [ -8.43827665e-01, -9.93364096e-01, -7.89921939e-01, + -1.50722504e-01, -9.99695182e-01, -9.93256211e-01, + -8.28653693e-01, -8.35800767e-02, -9.99714673e-01, + -9.92533445e-01, -7.95312464e-01, 2.58034348e-01, + -9.99724090e-01, -9.94538486e-01, -8.04687500e-01, + 2.84795880e-01, -9.99746978e-01, -9.94584978e-01, + -6.56747818e-01, -9.16808009e-01, -6.04049504e-01, + 2.99389720e-01, -9.99995768e-01, -9.52540874e-01, + -6.39306366e-01, 3.69517565e-01, -1., -9.49695230e-01, + -5.74097157e-01, 5.64099908e-01, -1., -9.70365703e-01, + -5.84577143e-01, 5.51482201e-01, -9.99984384e-01, + -9.70377505e-01 ] + - [ -5.48674464e-01, -1.38533771e-01, -2.53371179e-01, + 3.35910797e-01, -7.19693899e-01, -9.59195495e-02, + -2.72858143e-01, 1.19338512e-01, -6.13483250e-01, + -1.70759857e-01, -8.59374404e-02, -6.47942424e-01, + -4.69762206e-01, -6.93245173e-01, -8.12499523e-02, + -3.69813621e-01, -5.23545623e-01, -6.52370572e-01, + 4.93237019e-01, 8.93902779e-02, 3.58830214e-01, 5.20393848e-02, + -3.58233690e-01, 1.83452368e-01, 3.04046154e-01, + 1.53981686e-01, -3.10000420e-01, 3.21414113e-01, + 7.11083412e-01, -9.78610098e-01, -4.26967144e-02, + -5.99504828e-01, 6.86567068e-01, -8.01430047e-01, + -1.02464139e-01, -5.44492245e-01 ] + - [ -6.45401835e-01, -9.93373275e-01, -2.95954585e-01, + -2.54154861e-01, -9.98080492e-01, -9.99815166e-01, + -2.97336161e-01, -1.90517843e-01, -9.98426914e-01, + -9.99870658e-01, -2.34374940e-01, 1.31335974e-01, + -9.98526633e-01, -9.99577165e-01, -2.25000024e-01, + 1.61245346e-01, -9.98598278e-01, -9.99725282e-01, + -5.10670304e-01, -1., -5.92800915e-01, 9.52889919e-02, + -9.99350190e-01, -9.99806046e-01, -5.97687840e-01, + 1.50663257e-01, -9.99437749e-01, -1., -5.74097157e-01, + 2.88194895e-01, -9.99447346e-01, -9.98454154e-01, + -5.74626863e-01, 2.66334295e-01, -9.99446213e-01, + -9.98515844e-01 ] + - [ -7.03189731e-01, -3.02554786e-01, -4.29382563e-01, + 1.76359177e-01, -8.10436130e-01, -4.13329124e-01, + -4.38444853e-01, 3.56706023e-01, -8.14373374e-01, + -3.49208772e-01, -3.98437500e-01, -1.42384887e-01, + -6.70967817e-01, -7.07102776e-01, -4.06250000e-01, + -1.05160117e-01, -6.72429562e-01, -7.09969282e-01, + -3.51669192e-02, -2.62770057e-02, 8.43644142e-02, + -9.13460255e-02, -4.69827592e-01, -2.04896986e-01, + 5.78022003e-03, 1.96784496e-01, -4.99189138e-01, + 2.06608772e-02, 1.40722275e-01, -2.17241108e-01, + -3.31977785e-01, -4.98796999e-01, 1.21890545e-01, + -1.81706250e-01, -3.50710988e-01, -4.84305561e-01 ] + - [ -7.15410113e-01, -4.05796230e-01, -4.52093720e-01, + 3.76228452e-01, -9.15748000e-01, -5.07951379e-01, + -4.62922931e-01, 5.32592893e-01, -9.16276932e-01, + -4.71352875e-01, -3.26562464e-01, 2.51194239e-01, + -8.60099554e-01, -7.87666798e-01, -3.42187464e-01, + 2.79158235e-01, -8.59583139e-01, -7.86856592e-01, + 1.95370913e-02, -5.64308167e-02, 1.06861591e-01, + 5.84703684e-02, -5.56179523e-01, -1.78987145e-01, + 7.74565935e-02, 3.46231341e-01, -5.98255694e-01, + 4.14884090e-03, 1.75591469e-01, -1.73454046e-01, + -3.79717290e-01, -5.19093633e-01, 1.74129367e-01, + -1.22333169e-01, -4.09280062e-01, -5.08314431e-01 ] + - [ -6.91176474e-01, -2.91790903e-01, -4.05251920e-01, + 1.94922805e-01, -8.12533379e-01, -4.05891776e-01, + -4.18286502e-01, 3.73875856e-01, -8.14797997e-01, + -3.39786708e-01, -3.81249964e-01, -1.39845133e-01, + -6.66636586e-01, -7.00626075e-01, -3.87499928e-01, + -9.60351229e-02, -6.70243204e-01, -7.02966809e-01, + -2.31440663e-02, -1.94348097e-02, 9.56130028e-02, + -8.23670626e-02, -4.70019579e-01, -1.94079280e-01, + 2.65895128e-02, 2.05075860e-01, -5.00872731e-01, + 2.74785757e-02, 1.65628791e-01, -2.51446009e-01, + -3.18554223e-01, -5.03278613e-01, 1.36815906e-01, + -1.89792991e-01, -3.40437949e-01, -4.78045046e-01 ] + - [ -6.86619759e-01, -2.88546443e-01, -3.98154676e-01, + 2.09367633e-01, -8.15320075e-01, -4.00895655e-01, + -4.12526965e-01, 3.70930552e-01, -8.13018739e-01, + -3.39195073e-01, -3.71874988e-01, -1.28880382e-01, + -6.69304490e-01, -6.98635697e-01, -3.78125012e-01, + -9.00930166e-02, -6.71925783e-01, -7.01902390e-01, + -1.50299072e-03, -1.32405758e-02, 1.13610864e-01, + -7.69701004e-02, -4.71115172e-01, -1.88805878e-01, + 3.58381271e-02, 2.01456308e-01, -4.97431219e-01, + 2.93309689e-02, 1.80572867e-01, -2.23757207e-01, + -3.22015107e-01, -4.90920663e-01, 1.54228926e-01, + -1.96342409e-01, -3.36959124e-01, -4.77389693e-01 ] + - [ -8.96644592e-01, -8.13380122e-01, -8.56635928e-01, + 1.52502298e-01, -9.91816998e-01, -8.20544362e-01, + -8.63210917e-01, 1.88711524e-01, -9.90702271e-01, + -8.50351751e-01, -7.53124952e-01, 3.68835688e-01, + -9.84515905e-01, -9.41648304e-01, -7.60937512e-01, + 3.92174721e-01, -9.84672666e-01, -9.41986918e-01, + -8.31680179e-01, -7.01285124e-01, -7.97525287e-01, + 6.07841015e-02, -8.47860694e-01, -7.25233555e-01, + -8.03468227e-01, -1.39052868e-02, -8.19926441e-01, + -8.04941475e-01, -8.05728555e-01, -1.20672286e-01, + -7.71936297e-01, -9.09645677e-01, -8.13432813e-01, + -1.67401552e-01, -7.69563437e-01, -9.13783550e-01 ] + - [ -6.71085358e-01, -3.94022763e-01, -3.58410180e-01, + 7.55919337e-01, -9.60767567e-01, -3.92180085e-01, + -3.46292257e-01, 3.50131869e-01, -9.01574373e-01, + -5.78930855e-01, -1.48437440e-01, 4.14617658e-01, + -8.81607771e-01, -7.67984569e-01, -1.42187417e-01, + 4.33742881e-01, -8.83757114e-01, -7.73070335e-01, + 1.87856793e-01, -3.69070768e-02, 2.21597314e-01, + 5.47158003e-01, -6.92690253e-01, 1.40200019e-01, + 2.69364119e-01, -4.99815941e-02, -5.13425589e-01, + -2.85114050e-01, 3.30012321e-01, 9.40287113e-03, + -4.30464983e-01, -4.68202770e-01, 3.33333373e-01, + -2.29081154e-01, -3.82914543e-01, -5.30320764e-01 ] + - [ -6.76677704e-01, -4.06161845e-01, -3.64087999e-01, + 7.56688237e-01, -9.65978980e-01, -4.15611088e-01, + -3.08855295e-01, 5.28184652e-01, -9.41264212e-01, + -5.83818793e-01, -4.53124642e-02, 5.77610254e-01, + -9.16849077e-01, -7.77677178e-01, -3.12500000e-02, + 6.03932261e-01, -9.20151949e-01, -7.81785250e-01, + 1.81244373e-01, -4.28574085e-02, 2.12598562e-01, + 5.41219234e-01, -6.99297547e-01, 1.15715742e-01, + 2.76300430e-01, -4.78787422e-02, -5.26838899e-01, + -3.04975629e-01, 3.05105805e-01, 5.04388809e-02, + -4.47035551e-01, -4.64184880e-01, 3.20895553e-01, + -1.85440421e-01, -3.99844170e-01, -5.25600672e-01 ] + - [ -6.42502069e-01, -1.03054881e-01, -3.08729649e-01, + 5.76221347e-01, -7.70277023e-01, 4.41998243e-02, + -3.41972649e-01, -1.82572007e-02, -6.19258285e-01, + -2.94776499e-01, -2.12499976e-01, -3.80571783e-01, + -5.21997213e-01, -6.42822504e-01, -2.23437488e-01, + -3.34025681e-01, -5.24404645e-01, -6.45969391e-01, + 2.83438444e-01, 1.47106051e-01, 3.18335295e-01, 3.32533479e-01, + -4.81316388e-01, 3.32394481e-01, 3.54913235e-01, + -3.58739078e-01, -2.40991950e-01, -1.87745810e-01, + 4.34620261e-01, -1.22666657e-01, -2.09005415e-01, + -3.12732697e-01, 4.37810779e-01, -2.76629090e-01, + -1.76812530e-01, -3.55659127e-01 ] + - [ -6.39602304e-01, -2.56848633e-01, -3.22924078e-01, + 5.83933830e-01, -8.69314909e-01, -2.21105635e-01, + -3.34773242e-01, 2.86097527e-02, -7.51476586e-01, + -4.86770988e-01, -2.56249964e-01, -5.36137223e-02, + -6.83772564e-01, -6.80431724e-01, -2.65624940e-01, + -8.34514499e-02, -6.72528148e-01, -6.95708752e-01, + 1.76435113e-01, 2.68533230e-02, 2.10348725e-01, 3.64164114e-01, + -5.80085039e-01, 1.64053798e-01, 2.94797540e-01, + -2.97647953e-01, -3.72891963e-01, -3.16750348e-01, + 3.32503080e-01, -4.71151471e-02, -3.38711858e-01, + -4.04047608e-01, 3.48258853e-01, -2.90213048e-01, + -2.91014433e-01, -4.74299133e-01 ] + - [ -8.13794494e-01, -6.84780002e-01, -6.56493962e-01, + 3.23115110e-01, -9.86374140e-01, -7.49793231e-01, + -6.45788312e-01, 3.78526688e-01, -9.84959304e-01, + -7.75285006e-01, -4.85937476e-01, 5.27300119e-01, + -9.73819613e-01, -8.91345382e-01, -4.87499952e-01, + 5.37094355e-01, -9.73838091e-01, -8.94068360e-01, + -3.09287727e-01, -3.77275586e-01, -2.41844714e-01, + 1.85240507e-01, -7.71563768e-01, -4.53697085e-01, + -2.27745771e-01, 6.37902021e-02, -7.15775907e-01, + -5.31137109e-01, -1.88044786e-01, 9.99783278e-02, + -6.95539594e-01, -7.13011920e-01, -2.13930309e-01, + -5.30556440e-02, -6.63768411e-01, -7.37520218e-01 ] + - [ -7.69676924e-01, -5.41127086e-01, -5.62810481e-01, + 3.62404704e-01, -9.55320835e-01, -6.19166017e-01, + -5.76673865e-01, 2.99403548e-01, -9.31275606e-01, + -6.55366302e-01, -4.90624905e-01, 2.64021754e-01, + -9.01702583e-01, -8.40481758e-01, -5.04687428e-01, + 2.57859826e-01, -8.97035122e-01, -8.44474971e-01, + -1.90862715e-01, -2.28997171e-01, -1.02362216e-01, + 2.31727362e-02, -6.32829130e-01, -3.62912595e-01, + -9.82660055e-02, -1.70761347e-02, -5.96461177e-01, + -4.02623594e-01, -8.59278440e-02, -5.66542149e-03, + -5.29091358e-01, -5.89254081e-01, -7.71144032e-02, + -1.28452182e-01, -5.12388706e-01, -6.21207416e-01 ] + - [ -7.50207126e-01, -3.96821797e-01, -5.15968800e-01, + 1.38636470e-01, -8.39726985e-01, -4.94839251e-01, + -5.30597568e-01, 9.73228216e-02, -8.12164187e-01, + -5.34523606e-01, -4.93749976e-01, -9.42987204e-02, + -7.26132512e-01, -7.51851499e-01, -4.98437524e-01, + -1.88263476e-01, -7.01077819e-01, -7.77688563e-01, + -1.60805643e-01, -1.71494842e-01, -5.73677421e-02, + -7.95773268e-02, -5.58692217e-01, -3.47025096e-01, + -4.73989248e-02, -8.83079171e-02, -5.29258430e-01, + -3.63702953e-01, -2.11706161e-02, -8.75619650e-02, + -4.53064322e-01, -5.53610325e-01, -2.98507214e-02, + -2.20287681e-01, -4.28766847e-01, -5.85057676e-01 ] + - [ -7.63048887e-01, -4.69238281e-01, -5.44357777e-01, + 2.72327185e-01, -9.09551919e-01, -5.50807655e-01, + -5.69474459e-01, 1.28502727e-01, -8.61338794e-01, + -6.06329799e-01, -5.26562452e-01, 6.71911240e-02, + -8.16157341e-01, -7.94690609e-01, -5.35937548e-01, + 1.01929903e-02, -8.00499439e-01, -8.09664130e-01, + -1.59002185e-01, -1.96387947e-01, -5.28683662e-02, + 2.28674412e-02, -6.22064233e-01, -3.43004882e-01, + -6.12717271e-02, -9.11847949e-02, -5.50817311e-01, + -4.01551723e-01, -3.61145735e-02, -4.87667322e-03, + -5.02187967e-01, -5.59785128e-01, -3.98010015e-02, + -1.47894621e-01, -4.76625860e-01, -5.94870090e-01 ] + - [ -7.91217923e-01, -8.41245949e-01, -6.84882879e-01, + 1.69004202e-01, -9.98762429e-01, -9.03420866e-01, + -7.00503945e-01, 2.58499146e-01, -9.98812914e-01, + -9.03509378e-01, -5.95312476e-01, 6.19726419e-01, + -9.98273075e-01, -9.40674305e-01, -5.95312476e-01, + 6.31228447e-01, -9.98275161e-01, -9.41944003e-01, + -2.83438623e-01, -5.53923070e-01, -1.67604029e-01, + 5.70489049e-01, -9.59220767e-01, -6.00566983e-01, + -1.60693645e-01, 6.42874599e-01, -9.57633376e-01, + -6.09079301e-01, 7.09837675e-02, 6.14437461e-01, + -9.31801498e-01, -8.20832133e-01, 6.46766424e-02, + 5.24002671e-01, -9.25126314e-01, -8.35712731e-01 ] + - [ -7.69883990e-01, -9.88250196e-01, -5.91199458e-01, + -2.14374542e-01, -9.98224914e-01, -9.97314334e-01, + -6.08351350e-01, -1.52552843e-01, -9.98271108e-01, + -9.97142732e-01, -5.78124940e-01, 1.79683328e-01, + -9.98484194e-01, -9.97540951e-01, -5.81249952e-01, + 2.08292961e-01, -9.98546302e-01, -9.97704327e-01, + -5.57559431e-01, -9.51168001e-01, -5.68053961e-01, + 1.95230603e-01, -9.98989940e-01, -9.78960574e-01, + -5.81502914e-01, 2.59853125e-01, -9.99007761e-01, + -9.78078723e-01, -5.39227962e-01, 4.30586576e-01, + -9.99081492e-01, -9.85218465e-01, -5.34825861e-01, + 4.10680413e-01, -9.99060154e-01, -9.85770702e-01 ] + - [ -7.83761382e-01, -9.61633384e-01, -6.83463454e-01, + -1.18893862e-01, -9.98495638e-01, -9.85362172e-01, + -7.07703352e-01, -4.86132503e-02, -9.98503745e-01, + -9.84576821e-01, -6.65624976e-01, 3.01521063e-01, + -9.98674631e-01, -9.88608778e-01, -6.65624976e-01, + 3.25856328e-01, -9.98725057e-01, -9.88943398e-01, + -4.67388093e-01, -8.53870511e-01, -4.48818862e-01, + 3.83185744e-01, -9.98943865e-01, -9.12764311e-01, + -4.72832441e-01, 4.65022445e-01, -9.98924553e-01, + -9.07302678e-01, -3.57409716e-01, 6.68869019e-01, + -9.98732269e-01, -9.48938668e-01, -3.40795994e-01, + 6.48916602e-01, -9.98586774e-01, -9.51258123e-01 ] + - [ -7.78790414e-01, -6.23721242e-01, -6.29524469e-01, + 3.48684669e-01, -9.67905104e-01, -6.57228112e-01, + -5.93952537e-01, 3.40567827e-02, -9.33227241e-01, + -8.09934855e-01, -5.59374988e-01, 5.86285353e-01, + -9.57985997e-01, -8.33461106e-01, -6.04687452e-01, + 7.51566887e-03, -8.84264529e-01, -9.03235495e-01, + -2.28734612e-01, -3.93033803e-01, -2.10348666e-01, + 3.48073363e-01, -8.27398777e-01, -4.07102525e-01, + -2.34682083e-01, -2.99443781e-01, -6.17061019e-01, + -6.94235981e-01, -2.07970083e-01, 1.57292485e-01, + -6.94639504e-01, -6.86349630e-01, -1.74129426e-01, + -3.19103420e-01, -6.05411172e-01, -7.88245142e-01 ] + - [ -7.92874932e-01, -5.25266945e-01, -6.42299533e-01, + 3.15780759e-01, -9.18665409e-01, -5.11238933e-01, + -6.35709167e-01, -2.13007987e-01, -8.19002688e-01, + -7.46949077e-01, -6.31250024e-01, 3.09947371e-01, + -8.66690278e-01, -7.68498719e-01, -6.23437524e-01, + -3.10422122e-01, -7.52807498e-01, -8.76281738e-01, + -2.58791804e-01, -3.24798107e-01, -2.28346467e-01, + 2.33892798e-01, -7.44102240e-01, -3.39737296e-01, + -2.39306450e-01, -4.53585148e-01, -4.87548292e-01, + -6.64167702e-01, -2.22914040e-01, -4.67053056e-02, + -5.65331280e-01, -6.51577175e-01, -1.94029808e-01, + -3.22869956e-01, -5.21540403e-01, -7.23393798e-01 ] + - [ -7.86661148e-01, -8.35301459e-01, -6.49396777e-01, + 1.90571427e-01, -9.99155998e-01, -9.03675854e-01, + -6.91864610e-01, 2.80218720e-01, -9.99098897e-01, + -8.99352133e-01, -5.54687440e-01, 6.46318555e-01, + -9.98698711e-01, -9.40252781e-01, -5.59374988e-01, + 6.58135653e-01, -9.98679876e-01, -9.40869153e-01, + -1.08506262e-01, -5.27422667e-01, 3.93700600e-02, + 6.49902463e-01, -9.64189053e-01, -5.80790281e-01, + -1.04046464e-02, 7.50416279e-01, -9.65113699e-01, + -5.73065639e-01, 3.92278910e-01, 6.61351204e-01, + -9.34536159e-01, -8.18268895e-01, 3.75621796e-01, + 6.29052043e-01, -9.33351755e-01, -8.24221730e-01 ] + - [ -8.75724912e-01, -9.34711754e-01, -9.63094413e-01, + -2.72648156e-01, -9.68377352e-01, -9.68728185e-01, + -9.91360664e-01, -1.41723275e-01, -9.77894783e-01, + -9.54057038e-01, -9.90624964e-01, 1.11231804e-02, + -9.62597609e-01, -9.84630287e-01, -1., 2.99339294e-02, + -9.60260451e-01, -9.85762715e-01, -6.77787781e-01, + -8.93031478e-01, -7.75028110e-01, 4.22731638e-02, + -9.63971913e-01, -9.48965907e-01, -8.10404658e-01, + 1.56075001e-01, -9.70752656e-01, -9.31704760e-01, + -8.08219194e-01, 1.93879366e-01, -9.60887074e-01, + -9.67465937e-01, -8.00994992e-01, 1.88634276e-01, + -9.64678645e-01, -9.67665792e-01 ] + - [ -7.47307360e-01, -5.57770431e-01, -5.13129890e-01, + 5.17144918e-01, -9.80699539e-01, -6.30705714e-01, + -5.29157639e-01, 5.94707251e-01, -9.78529096e-01, + -6.43147230e-01, -1.81249976e-01, 6.40112281e-01, + -9.64139819e-01, -8.51249695e-01, -1.79687440e-01, + 5.97365975e-01, -9.60781217e-01, -8.60173345e-01, + 2.37450600e-02, -1.99064612e-01, -5.62423468e-03, + 2.71413565e-01, -6.73948765e-01, -1.54184580e-01, + -4.04624343e-02, 2.62048960e-01, -6.45803332e-01, + -1.91248536e-01, 1.35740995e-01, -3.12071562e-01, + -4.66247857e-01, -6.66249633e-01, 1.21890545e-01, + -5.56263447e-01, -4.16415572e-01, -7.13725865e-01 ] + - [ -7.35915542e-01, -4.41979289e-01, -5.15968800e-01, + 3.67937922e-01, -9.13862824e-01, -4.92974043e-01, + -5.47876179e-01, 3.12201738e-01, -8.81991744e-01, + -5.23818970e-01, -3.76562476e-01, 1.38417721e-01, + -8.52839351e-01, -8.14811945e-01, -4.09374952e-01, + 2.97620296e-02, -8.28810096e-01, -8.31677735e-01, + 5.19987345e-02, -1.18449807e-01, 4.83690500e-02, + 2.25318909e-01, -6.07192397e-01, -7.15269446e-02, + 8.09240341e-03, 1.58916950e-01, -5.45877457e-01, + -1.16238832e-01, 1.65628791e-01, -3.96417975e-01, + -3.55539143e-01, -6.08873606e-01, 1.64179087e-01, + -5.48382521e-01, -3.34049940e-01, -6.43981218e-01 ] + - [ -7.81690121e-01, -8.24021757e-01, -6.46557808e-01, + 2.21850872e-01, -9.99176264e-01, -8.91490281e-01, + -6.71706200e-01, 2.99836040e-01, -9.99091327e-01, + -8.94652963e-01, -5.37500024e-01, 6.73315167e-01, + -9.98652756e-01, -9.35434639e-01, -5.42187512e-01, + 6.84763074e-01, -9.98649120e-01, -9.36083734e-01, + -4.71897721e-02, -5.00927925e-01, 7.98650980e-02, + 7.26841807e-01, -9.65695739e-01, -5.24649918e-01, + 5.89594841e-02, 7.39458561e-01, -9.58677351e-01, + -5.61519086e-01, 4.69489455e-01, 6.65863514e-01, + -9.25957859e-01, -8.03065896e-01, 4.42786098e-01, + 6.24210954e-01, -9.23565865e-01, -8.10034990e-01 ] + - [ -8.82352948e-01, -4.05852973e-01, -7.35982955e-01, + 4.02548194e-01, -8.11949372e-01, -5.34630418e-02, + -7.46580243e-01, -4.56861913e-01, -5.61956882e-01, + -5.92080235e-01, -7.04687476e-01, -8.74433219e-01, + -4.61441100e-01, -8.57980728e-01, -7.06250012e-01, + -8.09722722e-01, -4.70646799e-01, -8.61057639e-01, + -7.20468879e-01, -3.58497620e-01, -5.52305937e-01, + 5.64750433e-02, -5.85884333e-01, -2.40777254e-01, + -5.53757250e-01, -7.04517126e-01, -2.34724343e-01, + -7.15773463e-01, -5.26774645e-01, -6.69667065e-01, + -2.80787289e-01, -7.68110931e-01, -5.29850721e-01, + -7.79996514e-01, -2.65859365e-01, -7.87194908e-01 ] + - [ -8.60604823e-01, -5.70753455e-01, -7.81405210e-01, + -1.29164934e-01, -7.72678494e-01, -5.58385849e-01, + -7.91216671e-01, -8.21355760e-01, -5.03623962e-01, + -8.06688309e-01, -7.85937428e-01, -5.58325887e-01, + -5.97285032e-01, -8.55286539e-01, -7.87499964e-01, + -4.64561462e-01, -6.16928637e-01, -8.51981401e-01, + -3.58581364e-01, -3.36789310e-01, -2.75590479e-01, + 2.93055654e-01, -7.32440591e-01, -2.35639811e-01, + -3.41040432e-01, -2.14197934e-01, -5.54796457e-01, + -5.53796709e-01, -2.25404799e-01, 4.86850739e-03, + -6.45231366e-01, -7.05456674e-01, -2.43781149e-01, + -6.85201287e-02, -6.32713318e-01, -7.15703249e-01 ] + - [ -7.14374483e-01, -1.79782569e-01, -3.59829664e-01, + 9.46238160e-01, -8.83838177e-01, 1.21455193e-01, + -3.44852388e-01, -4.16351140e-01, -5.78796506e-01, + -5.36260128e-01, -3.15624952e-01, -4.78487670e-01, + -5.04780769e-01, -6.74992085e-01, -3.23437452e-01, + -3.47202659e-01, -5.23373306e-01, -6.57614648e-01, + -8.38594437e-02, 8.15420151e-02, 1.42857194e-01, + 6.99128985e-01, -6.17910266e-01, 5.87778211e-01, + 1.81502938e-01, -8.32626104e-01, -5.47528267e-02, + -4.51957524e-01, 2.25404620e-01, -6.85239196e-01, + -2.45729685e-02, -4.80591893e-01, 2.31343150e-01, + -6.39988661e-01, -7.19716549e-02, -4.72643614e-01 ] + - [ -8.14001679e-01, -5.95684350e-01, -6.45138383e-01, + 5.68221927e-01, -9.85082746e-01, -5.65639496e-01, + -5.32037377e-01, 3.71528506e-01, -9.76140261e-01, + -7.63098717e-01, -3.84374976e-01, 5.46971917e-01, + -9.61227059e-01, -8.62589538e-01, -3.96875024e-01, + 5.75114727e-01, -9.61552143e-01, -8.60319674e-01, + -2.26931214e-01, -2.07180202e-01, -3.71202826e-02, + 7.53689051e-01, -8.23434889e-01, 8.96965265e-02, + -6.35837913e-02, -1.91734850e-01, -5.53800166e-01, + -5.02611160e-01, -3.86051536e-02, -2.97891319e-01, + -4.72998679e-01, -6.75632477e-01, -1.99004412e-02, + -2.40622640e-01, -5.09684801e-01, -6.67200565e-01 ] + - [ -7.98467278e-01, -7.81684160e-01, -6.56493962e-01, + 3.22956085e-01, -9.98585820e-01, -8.35038185e-01, + -6.02591753e-01, 3.37568521e-01, -9.98173654e-01, + -8.80449533e-01, -5.09374976e-01, 7.40746856e-01, + -9.97689784e-01, -9.16240096e-01, -5.18749952e-01, + 7.53594160e-01, -9.97712851e-01, -9.16056812e-01, + -1.77637577e-01, -4.08680856e-01, 1.01237297e-02, + 9.63531733e-01, -9.66859221e-01, -2.72414207e-01, + 1.58381343e-01, 6.24965549e-01, -9.26717579e-01, + -5.44017076e-01, 4.14694905e-01, 6.17709756e-01, + -8.90437543e-01, -7.58551598e-01, 4.10447836e-01, + 6.60372257e-01, -8.97836685e-01, -7.54249275e-01 ] + - [ -7.89768040e-01, -8.02787483e-01, -6.13910556e-01, + 2.14020729e-01, -9.96446252e-01, -8.76086414e-01, + -6.50107980e-01, 3.39788556e-01, -9.97773170e-01, + -8.68988454e-01, -5.34374952e-01, 6.79080486e-01, + -9.96396482e-01, -9.21429157e-01, -5.46875000e-01, + 6.99188352e-01, -9.96585071e-01, -9.20630217e-01, + -2.66005456e-01, -5.35623729e-01, -9.78627205e-02, + 6.22717738e-01, -9.58447874e-01, -5.59953094e-01, + -7.97688365e-02, 7.57221103e-01, -9.65424061e-01, + -5.58672428e-01, 1.40722275e-01, 5.88063121e-01, + -9.20460761e-01, -8.11859727e-01, 1.44278646e-01, + 6.34363770e-01, -9.27750170e-01, -8.07510436e-01 ] + - [ -7.86868274e-01, -6.02729440e-01, -5.34421563e-01, + 4.04859304e-01, -9.78105664e-01, -6.88665867e-01, + -5.85313141e-01, 5.87681293e-01, -9.81265306e-01, + -6.45417929e-01, -3.59374940e-01, 5.80550909e-01, + -9.58749473e-01, -8.48822713e-01, -3.64062488e-01, + 6.47609949e-01, -9.62615788e-01, -8.42802405e-01, + -4.03666973e-01, -3.49856675e-01, -2.62092233e-01, + 1.57578468e-01, -7.31338620e-01, -3.99438739e-01, + -2.48555005e-01, 4.01837826e-01, -7.91330397e-01, + -3.39612067e-01, -2.40348697e-01, -1.96629703e-01, + -5.58776855e-01, -7.17091203e-01, -2.36318409e-01, + -1.39594018e-01, -5.83916485e-01, -7.01017976e-01 ] + - [ -8.31400156e-01, -8.90806317e-01, -7.18949556e-01, + 5.58673143e-02, -9.98087108e-01, -9.36751306e-01, + -7.26421833e-01, 1.32872939e-01, -9.98360157e-01, + -9.40257728e-01, -6.71875000e-01, 4.93162751e-01, + -9.98144090e-01, -9.60123420e-01, -6.79687500e-01, + 5.16323447e-01, -9.98280764e-01, -9.60072458e-01, + -3.86233926e-01, -6.99100256e-01, -2.71091104e-01, + 5.09860873e-01, -9.83188927e-01, -7.48738647e-01, + -2.20809281e-01, 5.65049171e-01, -9.83151197e-01, + -7.73915827e-01, -9.58903432e-02, 6.11031532e-01, + -9.68559146e-01, -8.86308670e-01, -1.01989985e-01, + 5.90988517e-01, -9.67929900e-01, -8.88282895e-01 ] + - [ -7.90389419e-01, -5.01924276e-01, -5.85521698e-01, + -2.44955420e-02, -8.42805803e-01, -6.20213151e-01, + -6.09791160e-01, 3.84976149e-01, -9.07298923e-01, + -5.19043326e-01, -5.85937500e-01, -1.38462901e-01, + -7.55924761e-01, -8.04767072e-01, -5.92187524e-01, + 1.11696005e-01, -7.98246861e-01, -7.69684911e-01, + -3.87436211e-01, -2.99086154e-01, -2.59842515e-01, + -7.18380213e-02, -5.79731047e-01, -3.84227276e-01, + -2.55491316e-01, 2.10016847e-01, -6.81968093e-01, + -3.15661013e-01, -1.98007464e-01, -2.88047791e-01, + -4.69368637e-01, -6.79421008e-01, -2.03980088e-01, + -2.51139462e-01, -4.90236998e-01, -6.65881038e-01 ] + - [ -7.96188891e-01, -4.98150051e-01, -5.89779973e-01, + -4.30853963e-02, -8.34946275e-01, -6.18779957e-01, + -6.12670898e-01, 3.87206197e-01, -9.05728340e-01, + -5.12010157e-01, -5.92187405e-01, -1.50190294e-01, + -7.48424888e-01, -8.01835299e-01, -5.98437428e-01, + 9.09109116e-02, -7.89813459e-01, -7.68115163e-01, + -4.00060177e-01, -3.00908744e-01, -2.71091104e-01, + -8.79175067e-02, -5.70791364e-01, -3.88785779e-01, + -2.64739871e-01, 2.02900767e-01, -6.79258108e-01, + -3.18031311e-01, -2.00498223e-01, -2.87853181e-01, + -4.73630488e-01, -6.83118820e-01, -2.11442828e-01, + -2.65179098e-01, -4.86016572e-01, -6.69245839e-01 ] + - [ -8.14208746e-01, -8.99750113e-01, -7.33144104e-01, + 2.57399082e-02, -9.97334182e-01, -9.41199899e-01, + -7.14902759e-01, 8.58173370e-02, -9.97661352e-01, + -9.50805962e-01, -6.65624976e-01, 4.54873443e-01, + -9.97664511e-01, -9.64791715e-01, -6.74999952e-01, + 4.77303743e-01, -9.97736216e-01, -9.64699090e-01, + -3.65795076e-01, -7.05661893e-01, -3.54330719e-01, + 5.78323007e-01, -9.90293980e-01, -7.26458311e-01, + -2.69364119e-01, 5.44159651e-01, -9.84909594e-01, + -7.91287839e-01, -1.30759597e-01, 6.54334307e-01, + -9.74363029e-01, -8.85960400e-01, -1.51741326e-01, + 6.57264113e-01, -9.74929094e-01, -8.84259105e-01 ] + - [ -7.78997540e-01, -7.94170380e-01, -6.26685619e-01, + 2.16766834e-01, -9.94959295e-01, -8.63190114e-01, + -6.06911421e-01, 2.74012923e-01, -9.95581686e-01, + -8.85845661e-01, -5.00000000e-01, 6.15505338e-01, + -9.93668854e-01, -9.25510883e-01, -5.12500048e-01, + 6.36889577e-01, -9.93834794e-01, -9.24693704e-01, + -1.52389586e-01, -5.05693495e-01, -1.02362216e-01, + 6.85818911e-01, -9.51764882e-01, -4.67536509e-01, + -8.09252262e-03, 5.67841768e-01, -9.38904524e-01, + -6.17145538e-01, 2.40348697e-01, 5.76217294e-01, + -9.11881506e-01, -8.03847551e-01, 2.21393108e-01, + 6.29892826e-01, -9.18384075e-01, -7.94718325e-01 ] + - [ -7.58906364e-01, -6.82863355e-01, -6.02554977e-01, + 1.89010978e-01, -9.67126846e-01, -7.66828716e-01, + -6.09791160e-01, 7.65157938e-02, -9.51464593e-01, + -8.28388155e-01, -5.50000012e-01, 3.08019638e-01, + -9.48063433e-01, -8.96982074e-01, -5.53124964e-01, + 3.49567175e-01, -9.49558973e-01, -8.95255685e-01, + 4.11782265e-02, -3.69146109e-01, -1.46231055e-02, + 5.68992019e-01, -8.68807137e-01, -3.01852405e-01, + 5.66473007e-02, 2.63988137e-01, -8.24006021e-01, + -5.66431642e-01, 2.12951303e-01, 2.45115042e-01, + -7.81629980e-01, -7.45780647e-01, 2.06467628e-01, + 2.80562878e-01, -7.91171908e-01, -7.38163114e-01 ] + - [ -7.23695159e-01, -5.17873764e-01, -5.11710465e-01, + 6.27859354e-01, -9.78761673e-01, -5.37585616e-01, + -3.98128092e-01, 5.13964176e-01, -9.71591771e-01, + -6.88026667e-01, -1.43749893e-01, 5.92980504e-01, + -9.52012897e-01, -8.38898063e-01, -1.67187512e-01, + 6.61619782e-01, -9.55427170e-01, -8.30741167e-01, + 4.53861952e-02, -1.99587822e-01, 5.28683662e-02, + 6.02035284e-01, -7.93809533e-01, -4.30631638e-02, + 9.82658863e-02, -5.41487336e-02, -6.33341074e-01, + -4.90772486e-01, 1.25778317e-01, -1.92729831e-01, + -5.12749076e-01, -6.54896557e-01, 9.45273638e-02, + 4.65253592e-02, -5.70515037e-01, -5.91055989e-01 ] + - [ -7.12096095e-01, -3.67597699e-01, -4.63449240e-01, + 5.23873925e-01, -9.01112914e-01, -3.32792997e-01, + -4.62922931e-01, -5.85014224e-02, -7.87194550e-01, + -6.02763355e-01, -4.54687417e-01, -2.00929582e-01, + -7.00649023e-01, -7.63835073e-01, -4.74999964e-01, + 7.50269890e-02, -7.42188454e-01, -7.15241909e-01, + 3.15599442e-02, -1.35567248e-01, 2.81214714e-02, + 4.89779353e-01, -7.10479796e-01, 4.09584045e-02, + 9.13294554e-02, -2.94492900e-01, -4.90936339e-01, + -4.94433582e-01, 1.35740995e-01, -2.68886030e-01, + -4.15778100e-01, -6.02182329e-01, 9.95024443e-02, + -1.38400733e-01, -4.50056255e-01, -5.58877468e-01 ] + - [ -7.72162378e-01, -8.54272604e-01, -6.65010691e-01, + 1.21610045e-01, -9.97228384e-01, -9.12902415e-01, + -6.80345535e-01, 2.08265424e-01, -9.97661352e-01, + -9.15157259e-01, -5.78124940e-01, 5.73790789e-01, + -9.97459292e-01, -9.46268559e-01, -5.85937500e-01, + 5.89164257e-01, -9.97482717e-01, -9.46690321e-01, + -3.21911693e-01, -6.37645066e-01, -2.84589410e-01, + 5.91262817e-01, -9.79509592e-01, -6.60902739e-01, + -2.55491316e-01, 5.99221230e-01, -9.72740293e-01, + -6.96338058e-01, -5.35492301e-02, 5.82046151e-01, + -9.52459872e-01, -8.64546657e-01, -6.21890426e-02, + 5.71568370e-01, -9.53594804e-01, -8.67226601e-01 ] + - [ -7.87903905e-01, -9.53272223e-01, -6.90560699e-01, + -1.11368001e-01, -9.97646570e-01, -9.80865359e-01, + -7.22102165e-01, -3.12609076e-02, -9.98262107e-01, + -9.80345488e-01, -6.67187452e-01, 3.20018291e-01, + -9.98408735e-01, -9.85873163e-01, -6.71875000e-01, + 3.43361497e-01, -9.98395920e-01, -9.86030221e-01, + -4.71596062e-01, -8.39305699e-01, -4.87064064e-01, + 4.20957327e-01, -9.98686671e-01, -8.86345506e-01, + -4.77456689e-01, 4.83386517e-01, -9.98602927e-01, + -8.94344270e-01, -3.62391114e-01, 6.95347428e-01, + -9.98340309e-01, -9.40898538e-01, -3.70646775e-01, + 6.85346246e-01, -9.98315692e-01, -9.41436291e-01 ] + - [ -7.71126747e-01, -8.62960279e-01, -6.59332871e-01, + 9.55827236e-02, -9.97414291e-01, -9.24333453e-01, + -6.99064076e-01, 1.95688248e-01, -9.97714937e-01, + -9.17860687e-01, -5.90624928e-01, 5.51864386e-01, + -9.97585118e-01, -9.50438619e-01, -5.96874952e-01, + 5.67999721e-01, -9.97595251e-01, -9.50833261e-01, + -3.19507122e-01, -6.57290459e-01, -2.64341891e-01, + 5.08285999e-01, -9.77250934e-01, -7.20885515e-01, + -2.94797719e-01, 6.27405167e-01, -9.79558170e-01, + -7.02237368e-01, -5.35492301e-02, 5.92361093e-01, + -9.60135818e-01, -8.75919938e-01, -6.71641231e-02, + 5.81520081e-01, -9.60450113e-01, -8.77106190e-01 ] + - [ -7.05468059e-01, -5.21953583e-01, -5.18807709e-01, + 1.19300961e-01, -8.95148993e-01, -6.33819103e-01, + -4.81641471e-01, 2.07080364e-01, -9.16571021e-01, + -6.88740373e-01, -3.39062452e-01, 1.22450948e-01, + -8.85226011e-01, -8.60546052e-01, -3.51562440e-01, + 7.21822977e-02, -8.75059187e-01, -8.71139646e-01, + 4.11782265e-02, -3.06089818e-01, -5.28683662e-02, + 3.97718906e-01, -7.94884920e-01, -2.84398079e-01, + -1.15603209e-03, 1.39845133e-01, -7.30062962e-01, + -4.85540509e-01, 1.50684953e-01, -6.19087219e-02, + -6.54838502e-01, -7.31590867e-01, 1.29353285e-01, + -1.49643779e-01, -6.40834391e-01, -7.42586672e-01 ] + - [ -6.90969348e-01, -4.31532025e-01, -4.86160457e-01, + 1.23380065e-01, -8.43017459e-01, -5.19092560e-01, + -4.62922931e-01, 9.14084911e-03, -8.21736693e-01, + -6.18901789e-01, -3.90625000e-01, -1.75830841e-01, + -7.63004065e-01, -8.14973652e-01, -3.95312428e-01, + -1.64675415e-01, -7.60081053e-01, -8.21782112e-01, + 2.25427151e-02, -2.68303633e-01, -7.08661675e-02, + 3.38623524e-01, -7.46845424e-01, -2.33813822e-01, + -2.42775679e-02, 1.58325434e-02, -6.58402145e-01, + -4.72268462e-01, 1.18306279e-01, -1.50613725e-01, + -5.92326045e-01, -7.09788978e-01, 8.70646238e-02, + -2.23533452e-01, -5.79423666e-01, -7.17182755e-01 ] + - [ -6.68599844e-01, -9.99837041e-01, -4.40738142e-01, + -2.34897017e-01, -9.98931766e-01, -1., -4.32685316e-01, + -1.76511765e-01, -9.98980105e-01, -1., -3.93749952e-01, + 1.52155519e-01, -9.99061227e-01, -9.99576449e-01, + -3.99999976e-01, 1.80850029e-01, -9.99050856e-01, + -9.99651194e-01, -6.17673635e-01, -9.97310102e-01, + -7.36782908e-01, 1.29912615e-01, -9.99823987e-01, + -9.95926917e-01, -7.06358433e-01, 1.77811027e-01, + -9.99728620e-01, -9.97187316e-01, -7.06102133e-01, + 3.32946181e-01, -9.99900699e-01, -9.96432543e-01, + -7.16417909e-01, 3.12293172e-01, -9.99867618e-01, + -9.96418595e-01 ] + - [ -8.46727431e-01, -9.32448864e-01, -7.58694112e-01, + -7.72070885e-03, -9.99712110e-01, -9.65036631e-01, + -7.94096470e-01, 7.89687634e-02, -9.99752820e-01, + -9.60908830e-01, -7.35937476e-01, 4.37611103e-01, + -9.99689758e-01, -9.74912941e-01, -7.42187500e-01, + 4.57953811e-01, -9.99702096e-01, -9.75099385e-01, + -3.42350483e-01, -7.33007550e-01, -2.62092233e-01, + 6.09516978e-01, -9.99377787e-01, -8.11239958e-01, + -2.57803440e-01, 7.24192500e-01, -9.99484777e-01, + -7.98078537e-01, -8.84184837e-02, 9.57180619e-01, + -9.98592913e-01, -8.92299831e-01, -9.20398831e-02, + 9.54300642e-01, -9.98534858e-01, -8.93388093e-01 ] + - [ -7.72162378e-01, -5.86960793e-01, -5.08871555e-01, + 4.54203367e-01, -9.81714368e-01, -6.80073261e-01, + -5.52195787e-01, 6.05939746e-01, -9.82289195e-01, + -6.48998260e-01, -3.21874976e-01, 6.67346954e-01, + -9.64342237e-01, -8.38131785e-01, -3.29687476e-01, + 6.53344989e-01, -9.62236047e-01, -8.41881394e-01, + 2.73219109e-01, -1.71615958e-01, 2.41844773e-01, + 4.96058583e-01, -7.61047661e-01, -1.09484434e-01, + 2.83236861e-01, 4.41790104e-01, -7.30092287e-01, + -1.94267392e-01, 3.22540522e-01, 1.70181036e-01, + -6.05822921e-01, -5.76585174e-01, 3.28358293e-01, + 6.18827343e-02, -5.88233471e-01, -5.99221587e-01 ] + - [ -6.17854238e-01, -2.35796928e-01, -3.00212920e-01, + 2.83779025e-01, -8.02029371e-01, -3.22133839e-01, + -3.20374310e-01, 5.45291066e-01, -8.33670139e-01, + -2.61917591e-01, -2.40624964e-01, -5.37687540e-02, + -6.79121852e-01, -6.74789846e-01, -2.39062488e-01, + -6.50155544e-03, -6.83659971e-01, -6.75811291e-01, + 3.57980132e-01, 1.11680150e-01, 3.34083200e-01, + -7.27236271e-04, -3.46174479e-01, 1.33753657e-01, + 3.36416125e-01, 2.43521810e-01, -4.41870570e-01, + 1.84980154e-01, 4.62017417e-01, -3.62690270e-01, + -1.65226698e-01, -4.07529533e-01, 4.90049601e-01, + -4.09593403e-01, -1.72403812e-01, -4.21287000e-01 ] + - [ -7.99088657e-01, -9.92581964e-01, -7.43080258e-01, + -1.65930092e-01, -9.99449909e-01, -9.94818091e-01, + -7.40820706e-01, -1.01596653e-01, -9.99553442e-01, + -9.95120049e-01, -7.18750000e-01, 2.36405849e-01, + -9.99496937e-01, -9.95949805e-01, -7.26562500e-01, + 2.63665199e-01, -9.99514997e-01, -9.96014416e-01, + -6.32702172e-01, -9.29434299e-01, -6.31046116e-01, + 2.76109576e-01, -1., -9.59923506e-01, -6.18497133e-01, + 3.37826848e-01, -9.99984026e-01, -9.62342143e-01, + -5.79078555e-01, 5.28428793e-01, -9.99979198e-01, + -9.75871086e-01, -5.92039824e-01, 5.15696406e-01, -1., + -9.75978017e-01 ] + - [ -7.44614720e-01, -7.05860615e-01, -5.20227134e-01, + 4.24484968e-01, -9.93688226e-01, -7.66820550e-01, + -4.37004983e-01, 3.04018497e-01, -9.87101972e-01, + -8.49426210e-01, -2.95312405e-01, 5.97691298e-01, + -9.81458724e-01, -9.00289297e-01, -3.03125024e-01, + 6.19509459e-01, -9.81627047e-01, -8.99553657e-01, + 1.44574642e-01, -3.68971050e-01, 1.63104653e-01, + 7.94766784e-01, -9.11155403e-01, -2.23998666e-01, + 1.37572289e-01, 2.36677408e-01, -8.23308706e-01, + -5.89005709e-01, 3.82316232e-01, 7.76991844e-02, + -7.62115359e-01, -7.83342242e-01, 3.70646715e-01, + 1.01046205e-01, -7.69659281e-01, -7.76550770e-01 ] + - [ -7.80654550e-01, -5.52439690e-01, -6.29524469e-01, + 1.80220842e-01, -8.74623299e-01, -5.15531242e-01, + -6.19870365e-01, -4.52719510e-01, -7.36397266e-01, + -7.74395823e-01, -5.59374988e-01, -6.25146031e-01, + -6.73767567e-01, -8.88190508e-01, -5.65624952e-01, + -5.73455453e-01, -6.72278047e-01, -8.87891054e-01, + 2.28133440e-01, -2.99569249e-01, 1.51856065e-01, + 6.53638124e-01, -8.38419914e-01, -1.30547523e-01, + 1.16762996e-01, 8.52196217e-02, -7.31702566e-01, + -5.36428690e-01, 3.17559004e-01, -1.66487992e-01, + -6.50656700e-01, -7.62763858e-01, 3.33333373e-01, + -1.52254283e-01, -6.63489699e-01, -7.59085536e-01 ] + - [ -7.02982605e-01, -4.91275907e-01, -4.39318717e-01, + 7.85500526e-01, -9.79811490e-01, -4.43569541e-01, + -3.00215900e-01, 2.72752404e-01, -9.42509353e-01, + -7.34346986e-01, -1.04687452e-01, 4.55858827e-01, + -9.29463744e-01, -8.35474074e-01, -1.12499952e-01, + 5.08145213e-01, -9.31505084e-01, -8.30176651e-01, + 1.96272850e-01, -1.62015200e-01, 2.35095620e-01, + 9.09397244e-01, -8.36625695e-01, 1.96170688e-01, + 2.64739752e-01, -2.99515128e-01, -5.28126359e-01, + -5.36694765e-01, 4.14694905e-01, -6.32814765e-01, + -4.06814933e-01, -7.34825373e-01, 4.05472755e-01, + -5.01124263e-01, -4.46105301e-01, -7.00325012e-01 ] + - [ -6.68806970e-01, -2.65159011e-01, -3.22924078e-01, + 9.86250997e-01, -9.21418369e-01, -6.11376762e-03, + -3.05975437e-01, -5.43398499e-01, -6.12775147e-01, + -6.55438542e-01, -2.35937476e-01, -7.29092538e-01, + -5.39651871e-01, -7.90426373e-01, -2.34374940e-01, + -4.51766193e-01, -5.88687301e-01, -7.53518820e-01, + 2.37150550e-01, -4.47229743e-02, 3.00337434e-01, + 9.39261079e-01, -7.70141602e-01, 4.63002801e-01, + 3.27167511e-01, -6.37929678e-01, -3.01125586e-01, + -5.29975474e-01, 4.86923933e-01, -9.17048097e-01, + -1.99625134e-01, -6.95782185e-01, 4.67661738e-01, + -8.59241486e-01, -2.26259649e-01, -6.73130035e-01 ] + - [ -6.59072042e-01, -2.64965713e-01, -3.21504653e-01, 1., + -9.23929572e-01, -3.26365232e-03, -3.05975437e-01, + -5.39320290e-01, -6.14713252e-01, -6.55346751e-01, + -2.37499952e-01, -7.15211093e-01, -5.45411289e-01, + -7.90473104e-01, -2.37499952e-01, -4.34195936e-01, + -5.93545318e-01, -7.51626492e-01, 2.07694650e-01, + -7.10706115e-02, 2.64341950e-01, 9.14303541e-01, + -7.79838681e-01, 3.99904370e-01, 2.99421906e-01, + -6.23790801e-01, -3.25375438e-01, -5.48602819e-01, + 4.57036018e-01, -8.93893898e-01, -2.31370449e-01, + -7.09870577e-01, 4.42786098e-01, -8.30431521e-01, + -2.56063104e-01, -6.84254348e-01 ] + - [ -7.95981765e-01, -9.53692555e-01, -7.20369101e-01, + -8.94319415e-02, -9.98551965e-01, -9.79224920e-01, + -7.14902759e-01, -1.96853876e-02, -9.98797297e-01, + -9.80658174e-01, -6.74999952e-01, 3.31131220e-01, + -9.98765767e-01, -9.85725045e-01, -6.82812452e-01, + 3.56203556e-01, -9.98798251e-01, -9.85754728e-01, + -4.23504710e-01, -8.21981251e-01, -4.15073156e-01, + 4.50339079e-01, -9.98798251e-01, -8.79269898e-01, + -3.82658958e-01, 5.21303773e-01, -9.99126256e-01, + -8.90780389e-01, -2.52802014e-01, 7.33769178e-01, + -9.98546302e-01, -9.38076973e-01, -2.66169190e-01, + 7.30081916e-01, -9.98574138e-01, -9.37732875e-01 ] + - [ -6.83305740e-01, -4.47697937e-01, -4.63449240e-01, + -2.92154551e-02, -8.24235260e-01, -5.99027455e-01, + -4.64362800e-01, 2.75373101e-01, -8.76201630e-01, + -5.51300168e-01, -3.82812440e-01, -2.41696775e-01, + -7.56148577e-01, -8.28716040e-01, -3.98437500e-01, + 9.57554579e-02, -8.06294978e-01, -7.82826424e-01, + 1.59301758e-02, -2.26254702e-01, -8.88638496e-02, + 1.11082554e-01, -6.20717525e-01, -2.37690389e-01, + -1.15603209e-03, 2.36596823e-01, -6.77818298e-01, + -2.86687493e-01, 1.60647631e-01, -2.73889482e-01, + -5.23431122e-01, -6.97930872e-01, 1.11940265e-01, + -1.29748702e-01, -5.50621092e-01, -6.50858998e-01 ] + - [ -6.76263452e-01, -4.78322744e-01, -4.57771420e-01, + -8.12867880e-02, -8.34779561e-01, -6.54651403e-01, + -4.48524117e-01, 4.40854430e-01, -9.28080022e-01, + -5.76371014e-01, -3.35937440e-01, -1.65043175e-01, + -8.09071422e-01, -8.55862796e-01, -3.45312417e-01, + 1.64942980e-01, -8.54454637e-01, -8.18386137e-01, + 8.80672932e-02, -2.50087559e-01, -5.06187081e-02, + 1.41352773e-01, -6.59106731e-01, -2.78217316e-01, + 3.35259438e-02, 2.95354724e-01, -7.25801587e-01, + -3.25895369e-01, 2.07970142e-01, -2.22973049e-01, + -5.68509817e-01, -7.14585066e-01, 1.61691427e-01, + -1.08205974e-01, -5.88813186e-01, -6.76615417e-01 ] + - [ -6.61971807e-01, -4.36108172e-01, -4.39318717e-01, + -4.04636860e-02, -8.18201542e-01, -5.97493708e-01, + -4.38444853e-01, 2.76629448e-01, -8.74244153e-01, + -5.49530625e-01, -3.51562440e-01, -2.47614861e-01, + -7.53836751e-01, -8.26939940e-01, -3.65624964e-01, + 6.04004860e-02, -7.98949003e-01, -7.86245704e-01, + 7.00329542e-02, -2.34365642e-01, -6.63666725e-02, + 1.34619594e-01, -6.39541149e-01, -2.46783257e-01, + 2.89015770e-02, 1.92303181e-01, -6.79882765e-01, + -3.38182509e-01, 1.98007464e-01, -2.53901839e-01, + -5.39986610e-01, -7.02482224e-01, 1.54228926e-01, + -1.66637897e-01, -5.54299176e-01, -6.68725967e-01 ] + - [ -6.58864975e-01, -4.30956960e-01, -4.32221413e-01, + -3.76976728e-02, -8.16998839e-01, -5.93760312e-01, + -4.32685316e-01, 2.79894829e-01, -8.73025715e-01, + -5.45205712e-01, -3.43749940e-01, -2.49867022e-01, + -7.51593053e-01, -8.25149775e-01, -3.59374940e-01, + 6.39539957e-02, -7.97194123e-01, -7.82833040e-01, + 8.62638950e-02, -2.28793919e-01, -5.96175790e-02, + 1.23741627e-01, -6.30984902e-01, -2.43036330e-01, + 4.04623747e-02, 1.90698624e-01, -6.77447200e-01, + -3.35260093e-01, 2.17932701e-01, -2.55681872e-01, + -5.36707759e-01, -6.99564993e-01, 1.61691427e-01, + -1.55894458e-01, -5.51639795e-01, -6.61450684e-01 ] + - [ -7.84589887e-01, -9.83730078e-01, -7.18949556e-01, + -1.90903664e-01, -9.98138130e-01, -9.94390428e-01, + -8.67530584e-01, -9.30294991e-02, -9.98397887e-01, + -9.88335252e-01, -7.49999940e-01, 2.19188929e-01, + -9.98520017e-01, -9.94742811e-01, -7.54687488e-01, + 2.43030190e-01, -9.98450816e-01, -9.94944274e-01, + -7.44514585e-01, -9.69966173e-01, -8.31271052e-01, + 1.26320481e-01, -9.97043312e-01, -9.83787835e-01, -1., + 2.59741545e-01, -9.99525130e-01, -9.53831315e-01, + -8.82938981e-01, 3.30357075e-01, -9.96822953e-01, + -9.87504959e-01, -8.88059676e-01, 3.03745508e-01, + -9.96535540e-01, -9.87997651e-01 ] + - [ -7.66570032e-01, -9.98048663e-01, -6.40880048e-01, + -2.09533274e-01, -9.98971760e-01, -9.98294592e-01, + -7.30741501e-01, -1.34966373e-01, -9.99128640e-01, + -9.97196257e-01, -6.49999976e-01, 1.90580130e-01, + -9.99196589e-01, -9.98122096e-01, -6.60937488e-01, + 2.17455864e-01, -9.99178648e-01, -9.98212576e-01, + -6.49534166e-01, -9.72666085e-01, -6.78290188e-01, + 1.67416930e-01, -9.99598265e-01, -9.87512589e-01, + -7.98843980e-01, 2.47811794e-01, -9.99752700e-01, + -9.79758859e-01, -7.11083531e-01, 3.98302555e-01, + -9.99723136e-01, -9.89430189e-01, -7.18905449e-01, + 3.80685925e-01, -9.99704897e-01, -9.89424825e-01 ] + - [ -7.43371964e-01, -4.00101662e-01, -5.20227134e-01, + 2.94392705e-01, -8.51437569e-01, -3.85879815e-01, + -5.59395194e-01, -9.02498364e-02, -7.47055769e-01, + -5.54487467e-01, -4.67187464e-01, -2.98676848e-01, + -6.88841105e-01, -7.88758993e-01, -4.87499952e-01, + -2.93113470e-01, -6.69097304e-01, -7.85932899e-01, + -8.80674124e-02, -1.90561593e-01, -5.28683662e-02, + 1.88680172e-01, -6.05296135e-01, -1.10271096e-01, + -4.50868011e-02, -1.43112540e-02, -5.44299066e-01, + -3.10459256e-01, 1.05852962e-01, -4.89043176e-01, + -3.86060357e-01, -6.79583013e-01, 9.70149040e-02, + -4.33593631e-01, -4.06621039e-01, -6.56804800e-01 ] + - [ -7.44614720e-01, -4.12230849e-01, -5.25904894e-01, + 2.83931255e-01, -8.56099904e-01, -4.05577660e-01, + -5.63714862e-01, -3.82177830e-02, -7.73075044e-01, + -5.59851170e-01, -4.74999964e-01, -2.52286971e-01, + -7.08900392e-01, -7.91914165e-01, -4.92187500e-01, + -2.35446513e-01, -6.94902897e-01, -7.88973927e-01, + -1.04899347e-01, -1.97151065e-01, -6.41169548e-02, + 1.96780920e-01, -6.09524608e-01, -1.07979000e-01, + -5.89596033e-02, -1.15840435e-02, -5.50158203e-01, + -3.17928195e-01, 9.58904028e-02, -4.66918051e-01, + -4.00271773e-01, -6.81859374e-01, 8.20896626e-02, + -4.33854222e-01, -4.10139441e-01, -6.60731614e-01 ] + - [ -7.37158239e-01, -5.28887153e-01, -5.07452130e-01, + 4.88198400e-01, -9.58847821e-01, -5.53492546e-01, + -4.78761673e-01, 4.78702664e-01, -9.60026264e-01, + -6.50443792e-01, -3.06249976e-01, 4.44986224e-01, + -9.27986562e-01, -8.31270337e-01, -3.15624952e-01, + 4.74506855e-01, -9.28348064e-01, -8.29488397e-01, + -9.52810645e-02, -2.75002122e-01, -5.73677421e-02, + 2.96782613e-01, -7.25490570e-01, -2.35481203e-01, + -7.28324056e-02, 3.77972484e-01, -7.57663012e-01, + -3.02768886e-01, 8.84184837e-02, -2.07587242e-01, + -5.74354529e-01, -7.18112290e-01, 5.22388220e-02, + -1.88700616e-01, -5.74655294e-01, -7.00255156e-01 ] + - [ -8.34299922e-01, -9.30633068e-01, -7.98438609e-01, + -2.38223672e-02, -9.98276651e-01, -9.56815660e-01, + -8.11375082e-01, 4.65128422e-02, -9.98302877e-01, + -9.58329916e-01, -7.71874964e-01, 4.13550377e-01, + -9.98545408e-01, -9.71192658e-01, -7.70312488e-01, + 4.27756071e-01, -9.98387754e-01, -9.72124279e-01, + -5.94229102e-01, -7.87487984e-01, -5.36557913e-01, + 4.75610256e-01, -9.94705498e-01, -8.05391729e-01, + -5.56069434e-01, 5.57092786e-01, -9.95469987e-01, + -8.09282422e-01, -4.57036197e-01, 6.96320534e-01, + -9.89078104e-01, -8.98372591e-01, -4.55223858e-01, + 6.67116404e-01, -9.88299370e-01, -9.02942836e-01 ] + - [ -8.00124288e-01, -8.65656495e-01, -7.13271856e-01, + 1.18032932e-01, -9.97954488e-01, -9.13314164e-01, + -7.24981964e-01, 1.94521308e-01, -9.97860372e-01, + -9.16197240e-01, -6.57812476e-01, 5.71832418e-01, + -9.97774482e-01, -9.43985224e-01, -6.54687464e-01, + 5.80355644e-01, -9.97665107e-01, -9.45822835e-01, + -4.12684143e-01, -6.75387144e-01, -3.13835740e-01, + 5.70705533e-01, -9.84782279e-01, -7.03664780e-01, + -3.17919075e-01, 6.35936856e-01, -9.83425438e-01, + -7.13055730e-01, -1.63138211e-01, 7.31181502e-01, + -9.68766809e-01, -8.48791718e-01, -1.74129426e-01, + 6.36483431e-01, -9.61975634e-01, -8.61205041e-01 ] + - [ -7.29701757e-01, -7.25414574e-01, -5.17388225e-01, + 2.20912695e-01, -9.86994445e-01, -8.35715353e-01, + -5.04679561e-01, 2.95433521e-01, -9.86699820e-01, + -8.45004559e-01, -3.45312417e-01, 5.11625171e-01, + -9.79111135e-01, -9.12311673e-01, -3.60937536e-01, + 4.88369346e-01, -9.76752162e-01, -9.16396320e-01, + -8.74662399e-02, -5.29709935e-01, -1.27109110e-01, + 3.57599974e-01, -9.07550812e-01, -6.18332624e-01, + -1.09826684e-01, 3.50881457e-01, -8.96705151e-01, + -6.57177329e-01, -1.03362381e-01, 3.57601523e-01, + -8.43389392e-01, -7.77306080e-01, -1.19403005e-01, + 2.16934085e-01, -8.25741887e-01, -8.01320970e-01 ] + - [ -7.35708356e-01, -7.07150578e-01, -5.48616052e-01, + 9.24643278e-02, -9.69427586e-01, -8.33111882e-01, + -5.50755918e-01, 1.69494033e-01, -9.69742894e-01, + -8.37663531e-01, -5.48437476e-01, 2.92115331e-01, + -9.46979940e-01, -8.99395227e-01, -5.59374988e-01, + 2.41925359e-01, -9.39991593e-01, -9.08696234e-01, + -8.68651271e-02, -5.17110229e-01, -1.63104653e-01, + 2.61837721e-01, -8.76997888e-01, -6.20390534e-01, + -1.46820843e-01, 2.30867863e-01, -8.59402478e-01, + -6.62911236e-01, -1.13325059e-01, 2.98508406e-01, + -8.18149567e-01, -7.68236041e-01, -1.21890545e-01, + 1.37467861e-01, -7.95871615e-01, -7.95940340e-01 ] + - [ -7.40265131e-01, -7.09125876e-01, -5.55713236e-01, + 9.15971994e-02, -9.69772637e-01, -8.33847344e-01, + -5.56515455e-01, 1.66078210e-01, -9.69651997e-01, + -8.38411629e-01, -5.60937464e-01, 2.92989135e-01, + -9.46991086e-01, -8.98939610e-01, -5.70312440e-01, + 2.35108495e-01, -9.39385295e-01, -9.09480989e-01, + -1.01893663e-01, -5.21875262e-01, -1.72103405e-01, + 2.66129136e-01, -8.78831029e-01, -6.20553911e-01, + -1.58381522e-01, 2.37515092e-01, -8.61453533e-01, + -6.61802530e-01, -1.28268957e-01, 3.06106806e-01, + -8.20675433e-01, -7.68281817e-01, -1.36815846e-01, + 1.36979461e-01, -7.97215700e-01, -7.97697425e-01 ] + - [ -7.96810269e-01, -8.64118814e-01, -6.79205060e-01, + 1.17724776e-01, -9.98454511e-01, -9.21496153e-01, + -7.16342688e-01, 2.05001950e-01, -9.98494625e-01, + -9.18314636e-01, -6.14062428e-01, 5.67845225e-01, + -9.98288572e-01, -9.49936152e-01, -6.20312452e-01, + 5.84764957e-01, -9.98322368e-01, -9.50215936e-01, + -3.09287727e-01, -6.23075008e-01, -1.78852618e-01, + 5.69929123e-01, -9.74611044e-01, -6.70062900e-01, + -1.88439369e-01, 6.54562116e-01, -9.77636099e-01, + -6.86888039e-01, 5.10584116e-02, 6.02665424e-01, + -9.53336656e-01, -8.62750947e-01, 3.98010015e-02, + 5.94531417e-01, -9.53556240e-01, -8.63262177e-01 ] + - [ -7.37572491e-01, -3.73889625e-01, -4.87579882e-01, + 3.40975523e-01, -8.57055426e-01, -3.66553843e-01, + -5.03239751e-01, 1.28068328e-01, -8.24793696e-01, + -5.40017366e-01, -4.26562428e-01, -9.56056714e-02, + -7.49567866e-01, -7.74961472e-01, -4.43749964e-01, + -5.09014726e-02, -7.48145461e-01, -7.71518528e-01, + -1.12714231e-01, -1.11857057e-01, -2.58716941e-02, + 2.89814353e-01, -6.05425239e-01, 2.32770443e-02, + -1.73410773e-02, -2.23551452e-01, -4.14269328e-01, + -3.26960146e-01, 9.83810425e-02, -4.05725360e-01, + -3.49154770e-01, -6.12257779e-01, 9.70149040e-02, + -4.48778987e-01, -3.51186574e-01, -6.17870092e-01 ] + - [ -7.39229441e-01, -4.27434921e-01, -4.69127059e-01, + 4.83941555e-01, -9.21893358e-01, -4.34286475e-01, + -4.39884722e-01, 4.20753121e-01, -9.27405238e-01, + -5.89402914e-01, -2.92187452e-01, 2.34335423e-01, + -8.71904075e-01, -8.09972823e-01, -2.98437476e-01, + 2.75333762e-01, -8.74121547e-01, -8.08988869e-01, + -8.38594437e-02, -1.16263330e-01, 2.58718729e-02, + 4.21999693e-01, -6.70879006e-01, 4.80359793e-02, + 4.97108698e-02, -1.57158256e-01, -4.73886847e-01, + -3.41951489e-01, 1.43212914e-01, -3.62124741e-01, + -3.79376054e-01, -6.14283323e-01, 1.34328365e-01, + -4.35655892e-01, -3.67445409e-01, -6.23015761e-01 ] + - [ -7.40058005e-01, -5.13973117e-01, -4.79063213e-01, + 6.00961924e-01, -9.74777460e-01, -5.48144579e-01, + -4.35565174e-01, 5.60063004e-01, -9.71926510e-01, + -6.55767322e-01, -1.20312452e-01, 5.95252991e-01, + -9.51798081e-01, -8.38515162e-01, -1.26562476e-01, + 6.09246373e-01, -9.51799870e-01, -8.39516997e-01, + -5.01954556e-02, -1.76985919e-01, 1.91226006e-02, + 4.37225223e-01, -7.21518576e-01, -5.67589402e-02, + 1.96532011e-02, -1.67014003e-02, -5.71970403e-01, + -3.56979072e-01, 1.13325000e-01, -2.87945628e-01, + -4.63865101e-01, -6.54623985e-01, 1.09452724e-01, + -3.39639187e-01, -4.62945044e-01, -6.62745953e-01 ] + - [ -7.15410113e-01, -4.01919663e-01, -4.49254811e-01, + 4.31569815e-01, -8.98540974e-01, -4.11635876e-01, + -4.21166301e-01, 4.11864400e-01, -9.14021552e-01, + -5.60322881e-01, -3.01562428e-01, 1.41420960e-01, + -8.40236604e-01, -7.97616661e-01, -3.10937524e-01, + 2.13505030e-01, -8.46654356e-01, -7.92160153e-01, + -5.98136783e-02, -1.01592898e-01, 3.93700600e-02, + 4.13708448e-01, -6.55807495e-01, 7.16965199e-02, + 5.66473007e-02, -1.35726392e-01, -4.73121583e-01, + -3.18258107e-01, 1.60647631e-01, -3.57118845e-01, + -3.71112466e-01, -6.03801966e-01, 1.51741385e-01, + -4.30808187e-01, -3.60322952e-01, -6.13803744e-01 ] + decision_functions: + - + sv_count: 774 + rho: -1.4963506109127357e+02 + alpha: [ -1024., -1024., 1024., 1024., 1024., 1024., -1024., + -1024., -1024., -9.0608407934024945e+02, + 3.0314084464718235e+02, -1024., 1024., 1024., -1024., + -1024., -1024., 1024., -1024., 1024., 1024., 1024., 1024., + 1024., -1024., -1024., 1024., -1024., 1024., 1024., 1024., + 5.9025689541824875e+01, -1024., 1024., 1024., -1024., 1024., + -1024., -1024., 1024., -3.8582569564151481e+02, -1024., + -1024., -1024., -1024., -1024., -1024., -1024., 1024., + 1024., -1024., -1024., 1024., 1024., 1024., 1024., 1024., + 1024., -1024., -1024., -1024., 3.4026186270772018e+02, + -1024., -1024., 1024., -1024., -1024., + -4.7518227433716498e+02, -7.5842988411897693e+02, -1024., + 1024., 1024., -1024., 1024., 1024., 1024., -1024., -1024., + 1024., 1024., -1024., -1024., -1024., 1024., 1024., 1024., + -1024., 1024., -1024., 1024., -1024., -1024., -1024., + -1024., -1024., -1024., -1024., 1024., 1024., -1024., + -1024., -1024., -1024., 1024., 1024., + 1.2081089651635729e+02, -1024., -1024., 1024., -1024., + 1024., 1024., -1024., -1024., -1024., -1024., -1024., 1024., + 1024., -1024., 1024., 1024., -1024., 1024., -1024., -1024., + 1024., -1024., 1024., 1024., 1024., 1024., -1024., -1024., + -1024., -1024., 4.2101597755578176e+01, 1024., -1024., + 1024., -1024., 1024., -1024., -1024., -1024., 1024., 1024., + 1024., -1024., -1024., -1024., -1024., -1024., -1024., + 1024., -1024., 1024., -1024., -1024., + 5.5213881569142654e+02, 1024., -1024., 1024., + -2.4894534912901264e+02, 1024., -1024., 1024., 1024., 1024., + 1024., -1024., 1024., -1024., -1024., 1024., 1024., 1024., + -1024., 4.5105906000249337e+02, 1024., 1024., -1024., + -1024., 1024., -1024., 1024., -1024., 1024., 1024., 1024., + -1024., -1024., 1024., -1024., 1024., -1024., -1024., 1024., + 5.5578906629278674e+02, -1024., 1024., -1024., -1024., + -1024., -1024., -1024., -1024., -5.4716468978054843e+02, + 1024., 1024., -1024., 1024., 1024., -1024., -1024., -1024., + 1024., -1024., -1024., 1024., -1024., -1024., -1024., + -1024., -1024., -6.5836040721836321e+02, 1024., -1024., + -1024., 1024., 1024., -1024., 1024., -1024., 1024., + -5.7377245668692876e+02, -1024., -1024., -1024., + -8.0122499228434560e+02, 1024., -1024., + 3.1603855315808414e+02, 1024., -1024., -1024., 1024., 1024., + 1024., 1024., -1024., 1024., -1024., -1024., 1024., 1024., + -1024., 1024., 1024., -8.2466731926834552e+02, -1024., + 1024., 1024., -1024., -1024., -1024., 1024., -1024., -1024., + -1024., 1024., -1024., -1024., 1024., 1024., 1024., -1024., + -1024., 1024., -1024., 1024., 1024., 1024., 1024., -1024., + -1024., -1024., -5.3959978935828769e+02, 1024., 1024., + 1024., 1024., -1024., 1024., 1024., 1024., + -3.1347040959926687e+02, 7.6616439923852101e+02, 1024., + 1024., -1024., -1024., -1024., -1024., 1024., + 1.2232635549632882e+01, 1024., 1024., + -1.9897152547033389e+02, 1024., -1024., 1024., + 4.6099048210814112e+02, 1024., -1024., -1024., 1024., + -1024., 1024., -1024., 1024., 1024., 1024., 1024., -1024., + 1024., -1024., 1024., 1024., 1024., -1024., -1024., + 1.2442262761937528e+02, 1024., 1024., + -3.5785419567347185e+02, -1024., 1024., 1024., -1024., + 9.9813861980238369e+02, -1024., 1024., 1024., 1024., + 1.9059449884389801e+02, -1024., -1024., -1024., 1024., + -2.6930480111078543e+02, -1024., 1024., -1024., 1024., + -2.9244091202497106e+02, 1024., -2.1753468896683447e+02, + -1024., 1024., -1024., 1024., 1024., + -1.8669740708452628e+02, 1.4949088272096142e+02, -1024., + -1024., 1024., 7.1469220490740838e+02, 1024., 1024., 1024., + 7.7029396705838303e+02, -1024., -1024., -1024., + 1.4501222722475867e+02, 1.9272041135097032e+02, + -3.4852570292734640e+02, 1024., 1024., -1024., -1024., + 1024., -1024., -1024., 1024., 7.6782572603641643e+02, 1024., + 1024., 1024., -9.6790907083457262e+02, 1024., -1024., 1024., + -1.0077520815711885e+03, -1024., -1024., -1024., 1024., + -1024., 1024., -1024., 7.6142561897567703e+02, 1024., + -9.5292785905734922e+02, 1024., -1024., -1024., + -2.2161609145578910e+02, -1024., 4.1619756346085796e+02, + 1024., -1.1843805548619852e+02, 1024., -1024., 1024., + 4.0105610317314824e+02, -1024., 1024., -1024., -1024., + -1024., 1024., -1024., -1024., 1024., -1024., 1024., 1024., + 3.0455949066918146e+02, 1024., 1024., 1024., 1024., 1024., + 1024., 4.2418615890743075e+02, -1024., -1024., + 9.9053948534575920e+02, 1024., -1024., -1024., + -6.0373751155373714e+02, 1024., -1024., 1024., 1024., + -1024., -1024., 8.8347102797301247e+00, 1024., -1024., + -8.9496368172884888e+02, -1024., -1024., -1024., -1024., + 1024., 1024., -3.9222831802221418e+02, -1024., 1024., + -4.1523052035479668e+02, -4.6810888142120524e+02, -1024., + -1024., 1024., 1024., 4.5530077312815570e+02, -1024., 1024., + 1024., -1024., -1024., 1024., 1024., -1024., + -1.0357011908607899e+02, -1024., 1024., -1024., -1024., + 3.6372714230950390e+02, 7.1429781448668791e+02, 1024., + 1024., -1024., -1024., 1024., -1024., 1024., -1024., -1024., + -6.1529234823604520e+02, -1024., -1024., -1024., 1024., + -1024., 1024., -1024., 1024., 1024., -1024., + 6.3377350932662665e+01, 1024., -1024., 1024., + -7.0802670266711698e+02, 1024., -4.4782288416973643e+02, + -9.5583384501196167e+02, 1024., -1024., -1024., -1024., + 1024., -6.1124368121157568e+02, 1024., -1024., -1024., + -1024., -8.0888234395002530e+02, -1024., -1024., + 6.5159251028543997e+02, -1024., 1024., -1024., 1024., 1024., + 4.5202678273988062e+02, -1024., -1024., 1024., + -9.0316302577902593e+02, 1024., 1024., -1024., 1024., + -1024., 1024., 1024., 1024., -1024., 3.5748267386291559e+02, + 1024., 1024., -1024., 1024., 1024., 1024., -1024., -1024., + 1024., -1024., -1024., -1024., -9.6208892910428096e+02, + -1024., -1024., 3.4160661733309787e+01, -1024., + 6.4476862295804574e+02, -1024., 1024., 1024., 1024., 1024., + -1024., -3.3069394764490625e+02, -1024., -1024., + 6.8700342296245560e+02, 1024., 1024., 1024., 1024., 1024., + -1024., 1024., -1024., 1024., 8.8855535355423427e+01, + -1024., 1024., -1024., 1024., -1024., -1024., 1024., + 6.0025061351596491e+02, 1024., -7.0814571498968769e+02, + 1024., -1024., -1024., 6.2439085173495801e+02, 1024., 1024., + 1024., 1024., -1024., 1024., 1024., -1024., -1024., + 8.0621950706978680e+02, 1024., 1024., 1024., 1024., -1024., + 1.6280109271528985e+02, 1024., -1024., 1024., -1024., 1024., + 1024., -1024., 1024., -1024., 1024., 1024., -1024., -1024., + 1024., 1024., -1024., -1024., -1024., 1024., -1024., 1024., + 1024., -1024., -1024., -1024., -1024., 1024., -1024., 1024., + 1024., 1024., 1024., -1024., 1024., 1024., 1024., 1024., + -8.6903282736594576e+02, -1024., 6.1611090655742407e+02, + -1024., 1024., 1024., -1024., 1024., 1024., 1024., -1024., + 2.4164372362794660e+02, -1024., 1024., 1024., 1024., -1024., + -1024., -1024., 1024., -1024., -1024., -1024., + 8.6233126757588002e+02, -8.9313895724685665e+02, -1024., + -1024., 1024., 1024., -4.9135622464436983e+02, -1024., + 9.0470220753510489e+02, 1024., 1024., 1024., -1024., 1024., + 1024., -1024., 1024., -1024., 1024., + -7.2859884461208151e+02, -1024., -3.8174590483235653e+02, + 1024., -1024., 1024., 1024., 1024., 1.0491225606965803e+02, + 1024., 1024., 1024., 2.5380531987570777e+02, 1024., -1024., + 1024., 1024., 1024., 1024., -1024., 1024., 1024., 1024., + 1024., -1024., 1024., -1024., 1024., -1024., 1024., 1024., + 1024., -1.0010868349856861e+03, -1024., 1024., -1024., + 1024., -1024., 1024., -1024., -1024., + 3.3613558601031635e+01, -1024., -2.1967311278608616e+02, + -1024., -1024., -1024., 1024., 1024., 1024., 1024., 1024., + -1024., 1024., 1024., 1024., -1024., 1024., -1024., -1024., + -9.8091279767319907e+02, -1024., -1024., -1024., 1024., + 1024., -1024., -1024., -5.6384109771512931e+02, -1024., + -1024., -1024., -1024., -1024., 1024., 1024., -1024., 1024., + 1024. ] diff --git a/test/OpenCvSharp.Tests/_data/text/brisque_range_live.yml b/test/OpenCvSharp.Tests/_data/text/brisque_range_live.yml new file mode 100644 index 000000000..6fec55252 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/text/brisque_range_live.yml @@ -0,0 +1,25 @@ +%YAML:1.0 +--- +range: !!opencv-matrix + rows: 2 + cols: 36 + dt: f + data: [ 3.44000012e-01, 1.92631185e-02, 2.31999993e-01, + -1.25608176e-01, 1.54766443e-04, 5.36677078e-04, 2.47999996e-01, + -1.25662684e-01, 1.56631286e-04, 5.32896898e-04, 2.64999986e-01, + -1.37013525e-01, 1.69135848e-04, 3.88529879e-04, 2.68999994e-01, + -1.45002097e-01, 1.74277433e-04, 4.11326590e-04, 4.09000009e-01, + 1.65343825e-02, 2.17999995e-01, -2.00738415e-01, 1.03299266e-04, + 8.17875145e-04, 2.28000000e-01, -1.98958635e-01, 1.15834941e-04, + 8.49922828e-04, 2.46000007e-01, -1.55001476e-01, 1.20401361e-04, + 3.38587241e-04, 2.47999996e-01, -1.48134664e-01, 1.16321200e-04, + 3.34327371e-04, 10., 8.07274520e-01, 1.64100003e+00, + 2.02751741e-01, 7.14265108e-01, 4.68011886e-01, 1.63699996e+00, + 1.79955900e-01, 7.12509930e-01, 4.68246639e-01, 1.54499996e+00, + 1.01060480e-01, 6.86503410e-01, 5.31757474e-01, 1.54900002e+00, + 1.00678936e-01, 6.87403798e-01, 5.33775926e-01, 3.73600006e+00, + 8.01105976e-01, 1.10699999e+00, 1.75127238e-01, 7.52403796e-01, + 4.00098890e-01, 1.09300005e+00, 1.56139076e-01, 7.52328634e-01, + 4.06460851e-01, 1.04900002e+00, 9.35277343e-02, 6.23002231e-01, + 5.31899512e-01, 1.05200005e+00, 9.37106311e-02, 6.25087202e-01, + 5.38609207e-01 ] diff --git a/test/OpenCvSharp.Tests/_data/text/bvlc_googlenet.prototxt b/test/OpenCvSharp.Tests/_data/text/bvlc_googlenet.prototxt new file mode 100644 index 000000000..4648bf26e --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/text/bvlc_googlenet.prototxt @@ -0,0 +1,2156 @@ +name: "GoogleNet" +input: "data" +input_dim: 10 +input_dim: 3 +input_dim: 224 +input_dim: 224 +layer { + name: "conv1/7x7_s2" + type: "Convolution" + bottom: "data" + top: "conv1/7x7_s2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + pad: 3 + kernel_size: 7 + stride: 2 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "conv1/relu_7x7" + type: "ReLU" + bottom: "conv1/7x7_s2" + top: "conv1/7x7_s2" +} +layer { + name: "pool1/3x3_s2" + type: "Pooling" + bottom: "conv1/7x7_s2" + top: "pool1/3x3_s2" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 2 + } +} +layer { + name: "pool1/norm1" + type: "LRN" + bottom: "pool1/3x3_s2" + top: "pool1/norm1" + lrn_param { + local_size: 5 + alpha: 0.0001 + beta: 0.75 + } +} +layer { + name: "conv2/3x3_reduce" + type: "Convolution" + bottom: "pool1/norm1" + top: "conv2/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "conv2/relu_3x3_reduce" + type: "ReLU" + bottom: "conv2/3x3_reduce" + top: "conv2/3x3_reduce" +} +layer { + name: "conv2/3x3" + type: "Convolution" + bottom: "conv2/3x3_reduce" + top: "conv2/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 192 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "conv2/relu_3x3" + type: "ReLU" + bottom: "conv2/3x3" + top: "conv2/3x3" +} +layer { + name: "conv2/norm2" + type: "LRN" + bottom: "conv2/3x3" + top: "conv2/norm2" + lrn_param { + local_size: 5 + alpha: 0.0001 + beta: 0.75 + } +} +layer { + name: "pool2/3x3_s2" + type: "Pooling" + bottom: "conv2/norm2" + top: "pool2/3x3_s2" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 2 + } +} +layer { + name: "inception_3a/1x1" + type: "Convolution" + bottom: "pool2/3x3_s2" + top: "inception_3a/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3a/relu_1x1" + type: "ReLU" + bottom: "inception_3a/1x1" + top: "inception_3a/1x1" +} +layer { + name: "inception_3a/3x3_reduce" + type: "Convolution" + bottom: "pool2/3x3_s2" + top: "inception_3a/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 96 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3a/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_3a/3x3_reduce" + top: "inception_3a/3x3_reduce" +} +layer { + name: "inception_3a/3x3" + type: "Convolution" + bottom: "inception_3a/3x3_reduce" + top: "inception_3a/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3a/relu_3x3" + type: "ReLU" + bottom: "inception_3a/3x3" + top: "inception_3a/3x3" +} +layer { + name: "inception_3a/5x5_reduce" + type: "Convolution" + bottom: "pool2/3x3_s2" + top: "inception_3a/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 16 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3a/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_3a/5x5_reduce" + top: "inception_3a/5x5_reduce" +} +layer { + name: "inception_3a/5x5" + type: "Convolution" + bottom: "inception_3a/5x5_reduce" + top: "inception_3a/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3a/relu_5x5" + type: "ReLU" + bottom: "inception_3a/5x5" + top: "inception_3a/5x5" +} +layer { + name: "inception_3a/pool" + type: "Pooling" + bottom: "pool2/3x3_s2" + top: "inception_3a/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_3a/pool_proj" + type: "Convolution" + bottom: "inception_3a/pool" + top: "inception_3a/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 32 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3a/relu_pool_proj" + type: "ReLU" + bottom: "inception_3a/pool_proj" + top: "inception_3a/pool_proj" +} +layer { + name: "inception_3a/output" + type: "Concat" + bottom: "inception_3a/1x1" + bottom: "inception_3a/3x3" + bottom: "inception_3a/5x5" + bottom: "inception_3a/pool_proj" + top: "inception_3a/output" +} +layer { + name: "inception_3b/1x1" + type: "Convolution" + bottom: "inception_3a/output" + top: "inception_3b/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3b/relu_1x1" + type: "ReLU" + bottom: "inception_3b/1x1" + top: "inception_3b/1x1" +} +layer { + name: "inception_3b/3x3_reduce" + type: "Convolution" + bottom: "inception_3a/output" + top: "inception_3b/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3b/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_3b/3x3_reduce" + top: "inception_3b/3x3_reduce" +} +layer { + name: "inception_3b/3x3" + type: "Convolution" + bottom: "inception_3b/3x3_reduce" + top: "inception_3b/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 192 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3b/relu_3x3" + type: "ReLU" + bottom: "inception_3b/3x3" + top: "inception_3b/3x3" +} +layer { + name: "inception_3b/5x5_reduce" + type: "Convolution" + bottom: "inception_3a/output" + top: "inception_3b/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 32 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3b/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_3b/5x5_reduce" + top: "inception_3b/5x5_reduce" +} +layer { + name: "inception_3b/5x5" + type: "Convolution" + bottom: "inception_3b/5x5_reduce" + top: "inception_3b/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 96 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3b/relu_5x5" + type: "ReLU" + bottom: "inception_3b/5x5" + top: "inception_3b/5x5" +} +layer { + name: "inception_3b/pool" + type: "Pooling" + bottom: "inception_3a/output" + top: "inception_3b/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_3b/pool_proj" + type: "Convolution" + bottom: "inception_3b/pool" + top: "inception_3b/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_3b/relu_pool_proj" + type: "ReLU" + bottom: "inception_3b/pool_proj" + top: "inception_3b/pool_proj" +} +layer { + name: "inception_3b/output" + type: "Concat" + bottom: "inception_3b/1x1" + bottom: "inception_3b/3x3" + bottom: "inception_3b/5x5" + bottom: "inception_3b/pool_proj" + top: "inception_3b/output" +} +layer { + name: "pool3/3x3_s2" + type: "Pooling" + bottom: "inception_3b/output" + top: "pool3/3x3_s2" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 2 + } +} +layer { + name: "inception_4a/1x1" + type: "Convolution" + bottom: "pool3/3x3_s2" + top: "inception_4a/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 192 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4a/relu_1x1" + type: "ReLU" + bottom: "inception_4a/1x1" + top: "inception_4a/1x1" +} +layer { + name: "inception_4a/3x3_reduce" + type: "Convolution" + bottom: "pool3/3x3_s2" + top: "inception_4a/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 96 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4a/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_4a/3x3_reduce" + top: "inception_4a/3x3_reduce" +} +layer { + name: "inception_4a/3x3" + type: "Convolution" + bottom: "inception_4a/3x3_reduce" + top: "inception_4a/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 208 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4a/relu_3x3" + type: "ReLU" + bottom: "inception_4a/3x3" + top: "inception_4a/3x3" +} +layer { + name: "inception_4a/5x5_reduce" + type: "Convolution" + bottom: "pool3/3x3_s2" + top: "inception_4a/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 16 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4a/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_4a/5x5_reduce" + top: "inception_4a/5x5_reduce" +} +layer { + name: "inception_4a/5x5" + type: "Convolution" + bottom: "inception_4a/5x5_reduce" + top: "inception_4a/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 48 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4a/relu_5x5" + type: "ReLU" + bottom: "inception_4a/5x5" + top: "inception_4a/5x5" +} +layer { + name: "inception_4a/pool" + type: "Pooling" + bottom: "pool3/3x3_s2" + top: "inception_4a/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_4a/pool_proj" + type: "Convolution" + bottom: "inception_4a/pool" + top: "inception_4a/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4a/relu_pool_proj" + type: "ReLU" + bottom: "inception_4a/pool_proj" + top: "inception_4a/pool_proj" +} +layer { + name: "inception_4a/output" + type: "Concat" + bottom: "inception_4a/1x1" + bottom: "inception_4a/3x3" + bottom: "inception_4a/5x5" + bottom: "inception_4a/pool_proj" + top: "inception_4a/output" +} +layer { + name: "inception_4b/1x1" + type: "Convolution" + bottom: "inception_4a/output" + top: "inception_4b/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 160 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4b/relu_1x1" + type: "ReLU" + bottom: "inception_4b/1x1" + top: "inception_4b/1x1" +} +layer { + name: "inception_4b/3x3_reduce" + type: "Convolution" + bottom: "inception_4a/output" + top: "inception_4b/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 112 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4b/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_4b/3x3_reduce" + top: "inception_4b/3x3_reduce" +} +layer { + name: "inception_4b/3x3" + type: "Convolution" + bottom: "inception_4b/3x3_reduce" + top: "inception_4b/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 224 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4b/relu_3x3" + type: "ReLU" + bottom: "inception_4b/3x3" + top: "inception_4b/3x3" +} +layer { + name: "inception_4b/5x5_reduce" + type: "Convolution" + bottom: "inception_4a/output" + top: "inception_4b/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 24 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4b/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_4b/5x5_reduce" + top: "inception_4b/5x5_reduce" +} +layer { + name: "inception_4b/5x5" + type: "Convolution" + bottom: "inception_4b/5x5_reduce" + top: "inception_4b/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4b/relu_5x5" + type: "ReLU" + bottom: "inception_4b/5x5" + top: "inception_4b/5x5" +} +layer { + name: "inception_4b/pool" + type: "Pooling" + bottom: "inception_4a/output" + top: "inception_4b/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_4b/pool_proj" + type: "Convolution" + bottom: "inception_4b/pool" + top: "inception_4b/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4b/relu_pool_proj" + type: "ReLU" + bottom: "inception_4b/pool_proj" + top: "inception_4b/pool_proj" +} +layer { + name: "inception_4b/output" + type: "Concat" + bottom: "inception_4b/1x1" + bottom: "inception_4b/3x3" + bottom: "inception_4b/5x5" + bottom: "inception_4b/pool_proj" + top: "inception_4b/output" +} +layer { + name: "inception_4c/1x1" + type: "Convolution" + bottom: "inception_4b/output" + top: "inception_4c/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4c/relu_1x1" + type: "ReLU" + bottom: "inception_4c/1x1" + top: "inception_4c/1x1" +} +layer { + name: "inception_4c/3x3_reduce" + type: "Convolution" + bottom: "inception_4b/output" + top: "inception_4c/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4c/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_4c/3x3_reduce" + top: "inception_4c/3x3_reduce" +} +layer { + name: "inception_4c/3x3" + type: "Convolution" + bottom: "inception_4c/3x3_reduce" + top: "inception_4c/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4c/relu_3x3" + type: "ReLU" + bottom: "inception_4c/3x3" + top: "inception_4c/3x3" +} +layer { + name: "inception_4c/5x5_reduce" + type: "Convolution" + bottom: "inception_4b/output" + top: "inception_4c/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 24 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4c/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_4c/5x5_reduce" + top: "inception_4c/5x5_reduce" +} +layer { + name: "inception_4c/5x5" + type: "Convolution" + bottom: "inception_4c/5x5_reduce" + top: "inception_4c/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4c/relu_5x5" + type: "ReLU" + bottom: "inception_4c/5x5" + top: "inception_4c/5x5" +} +layer { + name: "inception_4c/pool" + type: "Pooling" + bottom: "inception_4b/output" + top: "inception_4c/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_4c/pool_proj" + type: "Convolution" + bottom: "inception_4c/pool" + top: "inception_4c/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4c/relu_pool_proj" + type: "ReLU" + bottom: "inception_4c/pool_proj" + top: "inception_4c/pool_proj" +} +layer { + name: "inception_4c/output" + type: "Concat" + bottom: "inception_4c/1x1" + bottom: "inception_4c/3x3" + bottom: "inception_4c/5x5" + bottom: "inception_4c/pool_proj" + top: "inception_4c/output" +} +layer { + name: "inception_4d/1x1" + type: "Convolution" + bottom: "inception_4c/output" + top: "inception_4d/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 112 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4d/relu_1x1" + type: "ReLU" + bottom: "inception_4d/1x1" + top: "inception_4d/1x1" +} +layer { + name: "inception_4d/3x3_reduce" + type: "Convolution" + bottom: "inception_4c/output" + top: "inception_4d/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 144 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4d/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_4d/3x3_reduce" + top: "inception_4d/3x3_reduce" +} +layer { + name: "inception_4d/3x3" + type: "Convolution" + bottom: "inception_4d/3x3_reduce" + top: "inception_4d/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 288 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4d/relu_3x3" + type: "ReLU" + bottom: "inception_4d/3x3" + top: "inception_4d/3x3" +} +layer { + name: "inception_4d/5x5_reduce" + type: "Convolution" + bottom: "inception_4c/output" + top: "inception_4d/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 32 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4d/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_4d/5x5_reduce" + top: "inception_4d/5x5_reduce" +} +layer { + name: "inception_4d/5x5" + type: "Convolution" + bottom: "inception_4d/5x5_reduce" + top: "inception_4d/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4d/relu_5x5" + type: "ReLU" + bottom: "inception_4d/5x5" + top: "inception_4d/5x5" +} +layer { + name: "inception_4d/pool" + type: "Pooling" + bottom: "inception_4c/output" + top: "inception_4d/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_4d/pool_proj" + type: "Convolution" + bottom: "inception_4d/pool" + top: "inception_4d/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 64 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4d/relu_pool_proj" + type: "ReLU" + bottom: "inception_4d/pool_proj" + top: "inception_4d/pool_proj" +} +layer { + name: "inception_4d/output" + type: "Concat" + bottom: "inception_4d/1x1" + bottom: "inception_4d/3x3" + bottom: "inception_4d/5x5" + bottom: "inception_4d/pool_proj" + top: "inception_4d/output" +} +layer { + name: "inception_4e/1x1" + type: "Convolution" + bottom: "inception_4d/output" + top: "inception_4e/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4e/relu_1x1" + type: "ReLU" + bottom: "inception_4e/1x1" + top: "inception_4e/1x1" +} +layer { + name: "inception_4e/3x3_reduce" + type: "Convolution" + bottom: "inception_4d/output" + top: "inception_4e/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 160 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4e/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_4e/3x3_reduce" + top: "inception_4e/3x3_reduce" +} +layer { + name: "inception_4e/3x3" + type: "Convolution" + bottom: "inception_4e/3x3_reduce" + top: "inception_4e/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 320 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4e/relu_3x3" + type: "ReLU" + bottom: "inception_4e/3x3" + top: "inception_4e/3x3" +} +layer { + name: "inception_4e/5x5_reduce" + type: "Convolution" + bottom: "inception_4d/output" + top: "inception_4e/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 32 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4e/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_4e/5x5_reduce" + top: "inception_4e/5x5_reduce" +} +layer { + name: "inception_4e/5x5" + type: "Convolution" + bottom: "inception_4e/5x5_reduce" + top: "inception_4e/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4e/relu_5x5" + type: "ReLU" + bottom: "inception_4e/5x5" + top: "inception_4e/5x5" +} +layer { + name: "inception_4e/pool" + type: "Pooling" + bottom: "inception_4d/output" + top: "inception_4e/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_4e/pool_proj" + type: "Convolution" + bottom: "inception_4e/pool" + top: "inception_4e/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_4e/relu_pool_proj" + type: "ReLU" + bottom: "inception_4e/pool_proj" + top: "inception_4e/pool_proj" +} +layer { + name: "inception_4e/output" + type: "Concat" + bottom: "inception_4e/1x1" + bottom: "inception_4e/3x3" + bottom: "inception_4e/5x5" + bottom: "inception_4e/pool_proj" + top: "inception_4e/output" +} +layer { + name: "pool4/3x3_s2" + type: "Pooling" + bottom: "inception_4e/output" + top: "pool4/3x3_s2" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 2 + } +} +layer { + name: "inception_5a/1x1" + type: "Convolution" + bottom: "pool4/3x3_s2" + top: "inception_5a/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5a/relu_1x1" + type: "ReLU" + bottom: "inception_5a/1x1" + top: "inception_5a/1x1" +} +layer { + name: "inception_5a/3x3_reduce" + type: "Convolution" + bottom: "pool4/3x3_s2" + top: "inception_5a/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 160 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5a/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_5a/3x3_reduce" + top: "inception_5a/3x3_reduce" +} +layer { + name: "inception_5a/3x3" + type: "Convolution" + bottom: "inception_5a/3x3_reduce" + top: "inception_5a/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 320 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5a/relu_3x3" + type: "ReLU" + bottom: "inception_5a/3x3" + top: "inception_5a/3x3" +} +layer { + name: "inception_5a/5x5_reduce" + type: "Convolution" + bottom: "pool4/3x3_s2" + top: "inception_5a/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 32 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5a/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_5a/5x5_reduce" + top: "inception_5a/5x5_reduce" +} +layer { + name: "inception_5a/5x5" + type: "Convolution" + bottom: "inception_5a/5x5_reduce" + top: "inception_5a/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5a/relu_5x5" + type: "ReLU" + bottom: "inception_5a/5x5" + top: "inception_5a/5x5" +} +layer { + name: "inception_5a/pool" + type: "Pooling" + bottom: "pool4/3x3_s2" + top: "inception_5a/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_5a/pool_proj" + type: "Convolution" + bottom: "inception_5a/pool" + top: "inception_5a/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5a/relu_pool_proj" + type: "ReLU" + bottom: "inception_5a/pool_proj" + top: "inception_5a/pool_proj" +} +layer { + name: "inception_5a/output" + type: "Concat" + bottom: "inception_5a/1x1" + bottom: "inception_5a/3x3" + bottom: "inception_5a/5x5" + bottom: "inception_5a/pool_proj" + top: "inception_5a/output" +} +layer { + name: "inception_5b/1x1" + type: "Convolution" + bottom: "inception_5a/output" + top: "inception_5b/1x1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 384 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5b/relu_1x1" + type: "ReLU" + bottom: "inception_5b/1x1" + top: "inception_5b/1x1" +} +layer { + name: "inception_5b/3x3_reduce" + type: "Convolution" + bottom: "inception_5a/output" + top: "inception_5b/3x3_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 192 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.09 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5b/relu_3x3_reduce" + type: "ReLU" + bottom: "inception_5b/3x3_reduce" + top: "inception_5b/3x3_reduce" +} +layer { + name: "inception_5b/3x3" + type: "Convolution" + bottom: "inception_5b/3x3_reduce" + top: "inception_5b/3x3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 384 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5b/relu_3x3" + type: "ReLU" + bottom: "inception_5b/3x3" + top: "inception_5b/3x3" +} +layer { + name: "inception_5b/5x5_reduce" + type: "Convolution" + bottom: "inception_5a/output" + top: "inception_5b/5x5_reduce" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 48 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.2 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5b/relu_5x5_reduce" + type: "ReLU" + bottom: "inception_5b/5x5_reduce" + top: "inception_5b/5x5_reduce" +} +layer { + name: "inception_5b/5x5" + type: "Convolution" + bottom: "inception_5b/5x5_reduce" + top: "inception_5b/5x5" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 2 + kernel_size: 5 + weight_filler { + type: "xavier" + std: 0.03 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5b/relu_5x5" + type: "ReLU" + bottom: "inception_5b/5x5" + top: "inception_5b/5x5" +} +layer { + name: "inception_5b/pool" + type: "Pooling" + bottom: "inception_5a/output" + top: "inception_5b/pool" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "inception_5b/pool_proj" + type: "Convolution" + bottom: "inception_5b/pool" + top: "inception_5b/pool_proj" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + kernel_size: 1 + weight_filler { + type: "xavier" + std: 0.1 + } + bias_filler { + type: "constant" + value: 0.2 + } + } +} +layer { + name: "inception_5b/relu_pool_proj" + type: "ReLU" + bottom: "inception_5b/pool_proj" + top: "inception_5b/pool_proj" +} +layer { + name: "inception_5b/output" + type: "Concat" + bottom: "inception_5b/1x1" + bottom: "inception_5b/3x3" + bottom: "inception_5b/5x5" + bottom: "inception_5b/pool_proj" + top: "inception_5b/output" +} +layer { + name: "pool5/7x7_s1" + type: "Pooling" + bottom: "inception_5b/output" + top: "pool5/7x7_s1" + pooling_param { + pool: AVE + kernel_size: 7 + stride: 1 + } +} +layer { + name: "pool5/drop_7x7_s1" + type: "Dropout" + bottom: "pool5/7x7_s1" + top: "pool5/7x7_s1" + dropout_param { + dropout_ratio: 0.4 + } +} +layer { + name: "loss3/classifier" + type: "InnerProduct" + bottom: "pool5/7x7_s1" + top: "loss3/classifier" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + inner_product_param { + num_output: 1000 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "prob" + type: "Softmax" + bottom: "loss3/classifier" + top: "prob" +} diff --git a/test/OpenCvSharp.Tests/_data/text/synset_words.txt b/test/OpenCvSharp.Tests/_data/text/synset_words.txt new file mode 100644 index 000000000..a9e8c7f50 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/text/synset_words.txt @@ -0,0 +1,1000 @@ +n01440764 tench, Tinca tinca +n01443537 goldfish, Carassius auratus +n01484850 great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias +n01491361 tiger shark, Galeocerdo cuvieri +n01494475 hammerhead, hammerhead shark +n01496331 electric ray, crampfish, numbfish, torpedo +n01498041 stingray +n01514668 cock +n01514859 hen +n01518878 ostrich, Struthio camelus +n01530575 brambling, Fringilla montifringilla +n01531178 goldfinch, Carduelis carduelis +n01532829 house finch, linnet, Carpodacus mexicanus +n01534433 junco, snowbird +n01537544 indigo bunting, indigo finch, indigo bird, Passerina cyanea +n01558993 robin, American robin, Turdus migratorius +n01560419 bulbul +n01580077 jay +n01582220 magpie +n01592084 chickadee +n01601694 water ouzel, dipper +n01608432 kite +n01614925 bald eagle, American eagle, Haliaeetus leucocephalus +n01616318 vulture +n01622779 great grey owl, great gray owl, Strix nebulosa +n01629819 European fire salamander, Salamandra salamandra +n01630670 common newt, Triturus vulgaris +n01631663 eft +n01632458 spotted salamander, Ambystoma maculatum +n01632777 axolotl, mud puppy, Ambystoma mexicanum +n01641577 bullfrog, Rana catesbeiana +n01644373 tree frog, tree-frog +n01644900 tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui +n01664065 loggerhead, loggerhead turtle, Caretta caretta +n01665541 leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea +n01667114 mud turtle +n01667778 terrapin +n01669191 box turtle, box tortoise +n01675722 banded gecko +n01677366 common iguana, iguana, Iguana iguana +n01682714 American chameleon, anole, Anolis carolinensis +n01685808 whiptail, whiptail lizard +n01687978 agama +n01688243 frilled lizard, Chlamydosaurus kingi +n01689811 alligator lizard +n01692333 Gila monster, Heloderma suspectum +n01693334 green lizard, Lacerta viridis +n01694178 African chameleon, Chamaeleo chamaeleon +n01695060 Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis +n01697457 African crocodile, Nile crocodile, Crocodylus niloticus +n01698640 American alligator, Alligator mississipiensis +n01704323 triceratops +n01728572 thunder snake, worm snake, Carphophis amoenus +n01728920 ringneck snake, ring-necked snake, ring snake +n01729322 hognose snake, puff adder, sand viper +n01729977 green snake, grass snake +n01734418 king snake, kingsnake +n01735189 garter snake, grass snake +n01737021 water snake +n01739381 vine snake +n01740131 night snake, Hypsiglena torquata +n01742172 boa constrictor, Constrictor constrictor +n01744401 rock python, rock snake, Python sebae +n01748264 Indian cobra, Naja naja +n01749939 green mamba +n01751748 sea snake +n01753488 horned viper, cerastes, sand viper, horned asp, Cerastes cornutus +n01755581 diamondback, diamondback rattlesnake, Crotalus adamanteus +n01756291 sidewinder, horned rattlesnake, Crotalus cerastes +n01768244 trilobite +n01770081 harvestman, daddy longlegs, Phalangium opilio +n01770393 scorpion +n01773157 black and gold garden spider, Argiope aurantia +n01773549 barn spider, Araneus cavaticus +n01773797 garden spider, Aranea diademata +n01774384 black widow, Latrodectus mactans +n01774750 tarantula +n01775062 wolf spider, hunting spider +n01776313 tick +n01784675 centipede +n01795545 black grouse +n01796340 ptarmigan +n01797886 ruffed grouse, partridge, Bonasa umbellus +n01798484 prairie chicken, prairie grouse, prairie fowl +n01806143 peacock +n01806567 quail +n01807496 partridge +n01817953 African grey, African gray, Psittacus erithacus +n01818515 macaw +n01819313 sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita +n01820546 lorikeet +n01824575 coucal +n01828970 bee eater +n01829413 hornbill +n01833805 hummingbird +n01843065 jacamar +n01843383 toucan +n01847000 drake +n01855032 red-breasted merganser, Mergus serrator +n01855672 goose +n01860187 black swan, Cygnus atratus +n01871265 tusker +n01872401 echidna, spiny anteater, anteater +n01873310 platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus +n01877812 wallaby, brush kangaroo +n01882714 koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus +n01883070 wombat +n01910747 jellyfish +n01914609 sea anemone, anemone +n01917289 brain coral +n01924916 flatworm, platyhelminth +n01930112 nematode, nematode worm, roundworm +n01943899 conch +n01944390 snail +n01945685 slug +n01950731 sea slug, nudibranch +n01955084 chiton, coat-of-mail shell, sea cradle, polyplacophore +n01968897 chambered nautilus, pearly nautilus, nautilus +n01978287 Dungeness crab, Cancer magister +n01978455 rock crab, Cancer irroratus +n01980166 fiddler crab +n01981276 king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica +n01983481 American lobster, Northern lobster, Maine lobster, Homarus americanus +n01984695 spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish +n01985128 crayfish, crawfish, crawdad, crawdaddy +n01986214 hermit crab +n01990800 isopod +n02002556 white stork, Ciconia ciconia +n02002724 black stork, Ciconia nigra +n02006656 spoonbill +n02007558 flamingo +n02009229 little blue heron, Egretta caerulea +n02009912 American egret, great white heron, Egretta albus +n02011460 bittern +n02012849 crane +n02013706 limpkin, Aramus pictus +n02017213 European gallinule, Porphyrio porphyrio +n02018207 American coot, marsh hen, mud hen, water hen, Fulica americana +n02018795 bustard +n02025239 ruddy turnstone, Arenaria interpres +n02027492 red-backed sandpiper, dunlin, Erolia alpina +n02028035 redshank, Tringa totanus +n02033041 dowitcher +n02037110 oystercatcher, oyster catcher +n02051845 pelican +n02056570 king penguin, Aptenodytes patagonica +n02058221 albatross, mollymawk +n02066245 grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus +n02071294 killer whale, killer, orca, grampus, sea wolf, Orcinus orca +n02074367 dugong, Dugong dugon +n02077923 sea lion +n02085620 Chihuahua +n02085782 Japanese spaniel +n02085936 Maltese dog, Maltese terrier, Maltese +n02086079 Pekinese, Pekingese, Peke +n02086240 Shih-Tzu +n02086646 Blenheim spaniel +n02086910 papillon +n02087046 toy terrier +n02087394 Rhodesian ridgeback +n02088094 Afghan hound, Afghan +n02088238 basset, basset hound +n02088364 beagle +n02088466 bloodhound, sleuthhound +n02088632 bluetick +n02089078 black-and-tan coonhound +n02089867 Walker hound, Walker foxhound +n02089973 English foxhound +n02090379 redbone +n02090622 borzoi, Russian wolfhound +n02090721 Irish wolfhound +n02091032 Italian greyhound +n02091134 whippet +n02091244 Ibizan hound, Ibizan Podenco +n02091467 Norwegian elkhound, elkhound +n02091635 otterhound, otter hound +n02091831 Saluki, gazelle hound +n02092002 Scottish deerhound, deerhound +n02092339 Weimaraner +n02093256 Staffordshire bullterrier, Staffordshire bull terrier +n02093428 American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier +n02093647 Bedlington terrier +n02093754 Border terrier +n02093859 Kerry blue terrier +n02093991 Irish terrier +n02094114 Norfolk terrier +n02094258 Norwich terrier +n02094433 Yorkshire terrier +n02095314 wire-haired fox terrier +n02095570 Lakeland terrier +n02095889 Sealyham terrier, Sealyham +n02096051 Airedale, Airedale terrier +n02096177 cairn, cairn terrier +n02096294 Australian terrier +n02096437 Dandie Dinmont, Dandie Dinmont terrier +n02096585 Boston bull, Boston terrier +n02097047 miniature schnauzer +n02097130 giant schnauzer +n02097209 standard schnauzer +n02097298 Scotch terrier, Scottish terrier, Scottie +n02097474 Tibetan terrier, chrysanthemum dog +n02097658 silky terrier, Sydney silky +n02098105 soft-coated wheaten terrier +n02098286 West Highland white terrier +n02098413 Lhasa, Lhasa apso +n02099267 flat-coated retriever +n02099429 curly-coated retriever +n02099601 golden retriever +n02099712 Labrador retriever +n02099849 Chesapeake Bay retriever +n02100236 German short-haired pointer +n02100583 vizsla, Hungarian pointer +n02100735 English setter +n02100877 Irish setter, red setter +n02101006 Gordon setter +n02101388 Brittany spaniel +n02101556 clumber, clumber spaniel +n02102040 English springer, English springer spaniel +n02102177 Welsh springer spaniel +n02102318 cocker spaniel, English cocker spaniel, cocker +n02102480 Sussex spaniel +n02102973 Irish water spaniel +n02104029 kuvasz +n02104365 schipperke +n02105056 groenendael +n02105162 malinois +n02105251 briard +n02105412 kelpie +n02105505 komondor +n02105641 Old English sheepdog, bobtail +n02105855 Shetland sheepdog, Shetland sheep dog, Shetland +n02106030 collie +n02106166 Border collie +n02106382 Bouvier des Flandres, Bouviers des Flandres +n02106550 Rottweiler +n02106662 German shepherd, German shepherd dog, German police dog, alsatian +n02107142 Doberman, Doberman pinscher +n02107312 miniature pinscher +n02107574 Greater Swiss Mountain dog +n02107683 Bernese mountain dog +n02107908 Appenzeller +n02108000 EntleBucher +n02108089 boxer +n02108422 bull mastiff +n02108551 Tibetan mastiff +n02108915 French bulldog +n02109047 Great Dane +n02109525 Saint Bernard, St Bernard +n02109961 Eskimo dog, husky +n02110063 malamute, malemute, Alaskan malamute +n02110185 Siberian husky +n02110341 dalmatian, coach dog, carriage dog +n02110627 affenpinscher, monkey pinscher, monkey dog +n02110806 basenji +n02110958 pug, pug-dog +n02111129 Leonberg +n02111277 Newfoundland, Newfoundland dog +n02111500 Great Pyrenees +n02111889 Samoyed, Samoyede +n02112018 Pomeranian +n02112137 chow, chow chow +n02112350 keeshond +n02112706 Brabancon griffon +n02113023 Pembroke, Pembroke Welsh corgi +n02113186 Cardigan, Cardigan Welsh corgi +n02113624 toy poodle +n02113712 miniature poodle +n02113799 standard poodle +n02113978 Mexican hairless +n02114367 timber wolf, grey wolf, gray wolf, Canis lupus +n02114548 white wolf, Arctic wolf, Canis lupus tundrarum +n02114712 red wolf, maned wolf, Canis rufus, Canis niger +n02114855 coyote, prairie wolf, brush wolf, Canis latrans +n02115641 dingo, warrigal, warragal, Canis dingo +n02115913 dhole, Cuon alpinus +n02116738 African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus +n02117135 hyena, hyaena +n02119022 red fox, Vulpes vulpes +n02119789 kit fox, Vulpes macrotis +n02120079 Arctic fox, white fox, Alopex lagopus +n02120505 grey fox, gray fox, Urocyon cinereoargenteus +n02123045 tabby, tabby cat +n02123159 tiger cat +n02123394 Persian cat +n02123597 Siamese cat, Siamese +n02124075 Egyptian cat +n02125311 cougar, puma, catamount, mountain lion, painter, panther, Felis concolor +n02127052 lynx, catamount +n02128385 leopard, Panthera pardus +n02128757 snow leopard, ounce, Panthera uncia +n02128925 jaguar, panther, Panthera onca, Felis onca +n02129165 lion, king of beasts, Panthera leo +n02129604 tiger, Panthera tigris +n02130308 cheetah, chetah, Acinonyx jubatus +n02132136 brown bear, bruin, Ursus arctos +n02133161 American black bear, black bear, Ursus americanus, Euarctos americanus +n02134084 ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus +n02134418 sloth bear, Melursus ursinus, Ursus ursinus +n02137549 mongoose +n02138441 meerkat, mierkat +n02165105 tiger beetle +n02165456 ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle +n02167151 ground beetle, carabid beetle +n02168699 long-horned beetle, longicorn, longicorn beetle +n02169497 leaf beetle, chrysomelid +n02172182 dung beetle +n02174001 rhinoceros beetle +n02177972 weevil +n02190166 fly +n02206856 bee +n02219486 ant, emmet, pismire +n02226429 grasshopper, hopper +n02229544 cricket +n02231487 walking stick, walkingstick, stick insect +n02233338 cockroach, roach +n02236044 mantis, mantid +n02256656 cicada, cicala +n02259212 leafhopper +n02264363 lacewing, lacewing fly +n02268443 dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk +n02268853 damselfly +n02276258 admiral +n02277742 ringlet, ringlet butterfly +n02279972 monarch, monarch butterfly, milkweed butterfly, Danaus plexippus +n02280649 cabbage butterfly +n02281406 sulphur butterfly, sulfur butterfly +n02281787 lycaenid, lycaenid butterfly +n02317335 starfish, sea star +n02319095 sea urchin +n02321529 sea cucumber, holothurian +n02325366 wood rabbit, cottontail, cottontail rabbit +n02326432 hare +n02328150 Angora, Angora rabbit +n02342885 hamster +n02346627 porcupine, hedgehog +n02356798 fox squirrel, eastern fox squirrel, Sciurus niger +n02361337 marmot +n02363005 beaver +n02364673 guinea pig, Cavia cobaya +n02389026 sorrel +n02391049 zebra +n02395406 hog, pig, grunter, squealer, Sus scrofa +n02396427 wild boar, boar, Sus scrofa +n02397096 warthog +n02398521 hippopotamus, hippo, river horse, Hippopotamus amphibius +n02403003 ox +n02408429 water buffalo, water ox, Asiatic buffalo, Bubalus bubalis +n02410509 bison +n02412080 ram, tup +n02415577 bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis +n02417914 ibex, Capra ibex +n02422106 hartebeest +n02422699 impala, Aepyceros melampus +n02423022 gazelle +n02437312 Arabian camel, dromedary, Camelus dromedarius +n02437616 llama +n02441942 weasel +n02442845 mink +n02443114 polecat, fitch, foulmart, foumart, Mustela putorius +n02443484 black-footed ferret, ferret, Mustela nigripes +n02444819 otter +n02445715 skunk, polecat, wood pussy +n02447366 badger +n02454379 armadillo +n02457408 three-toed sloth, ai, Bradypus tridactylus +n02480495 orangutan, orang, orangutang, Pongo pygmaeus +n02480855 gorilla, Gorilla gorilla +n02481823 chimpanzee, chimp, Pan troglodytes +n02483362 gibbon, Hylobates lar +n02483708 siamang, Hylobates syndactylus, Symphalangus syndactylus +n02484975 guenon, guenon monkey +n02486261 patas, hussar monkey, Erythrocebus patas +n02486410 baboon +n02487347 macaque +n02488291 langur +n02488702 colobus, colobus monkey +n02489166 proboscis monkey, Nasalis larvatus +n02490219 marmoset +n02492035 capuchin, ringtail, Cebus capucinus +n02492660 howler monkey, howler +n02493509 titi, titi monkey +n02493793 spider monkey, Ateles geoffroyi +n02494079 squirrel monkey, Saimiri sciureus +n02497673 Madagascar cat, ring-tailed lemur, Lemur catta +n02500267 indri, indris, Indri indri, Indri brevicaudatus +n02504013 Indian elephant, Elephas maximus +n02504458 African elephant, Loxodonta africana +n02509815 lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens +n02510455 giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca +n02514041 barracouta, snoek +n02526121 eel +n02536864 coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch +n02606052 rock beauty, Holocanthus tricolor +n02607072 anemone fish +n02640242 sturgeon +n02641379 gar, garfish, garpike, billfish, Lepisosteus osseus +n02643566 lionfish +n02655020 puffer, pufferfish, blowfish, globefish +n02666196 abacus +n02667093 abaya +n02669723 academic gown, academic robe, judge's robe +n02672831 accordion, piano accordion, squeeze box +n02676566 acoustic guitar +n02687172 aircraft carrier, carrier, flattop, attack aircraft carrier +n02690373 airliner +n02692877 airship, dirigible +n02699494 altar +n02701002 ambulance +n02704792 amphibian, amphibious vehicle +n02708093 analog clock +n02727426 apiary, bee house +n02730930 apron +n02747177 ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin +n02749479 assault rifle, assault gun +n02769748 backpack, back pack, knapsack, packsack, rucksack, haversack +n02776631 bakery, bakeshop, bakehouse +n02777292 balance beam, beam +n02782093 balloon +n02783161 ballpoint, ballpoint pen, ballpen, Biro +n02786058 Band Aid +n02787622 banjo +n02788148 bannister, banister, balustrade, balusters, handrail +n02790996 barbell +n02791124 barber chair +n02791270 barbershop +n02793495 barn +n02794156 barometer +n02795169 barrel, cask +n02797295 barrow, garden cart, lawn cart, wheelbarrow +n02799071 baseball +n02802426 basketball +n02804414 bassinet +n02804610 bassoon +n02807133 bathing cap, swimming cap +n02808304 bath towel +n02808440 bathtub, bathing tub, bath, tub +n02814533 beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon +n02814860 beacon, lighthouse, beacon light, pharos +n02815834 beaker +n02817516 bearskin, busby, shako +n02823428 beer bottle +n02823750 beer glass +n02825657 bell cote, bell cot +n02834397 bib +n02835271 bicycle-built-for-two, tandem bicycle, tandem +n02837789 bikini, two-piece +n02840245 binder, ring-binder +n02841315 binoculars, field glasses, opera glasses +n02843684 birdhouse +n02859443 boathouse +n02860847 bobsled, bobsleigh, bob +n02865351 bolo tie, bolo, bola tie, bola +n02869837 bonnet, poke bonnet +n02870880 bookcase +n02871525 bookshop, bookstore, bookstall +n02877765 bottlecap +n02879718 bow +n02883205 bow tie, bow-tie, bowtie +n02892201 brass, memorial tablet, plaque +n02892767 brassiere, bra, bandeau +n02894605 breakwater, groin, groyne, mole, bulwark, seawall, jetty +n02895154 breastplate, aegis, egis +n02906734 broom +n02909870 bucket, pail +n02910353 buckle +n02916936 bulletproof vest +n02917067 bullet train, bullet +n02927161 butcher shop, meat market +n02930766 cab, hack, taxi, taxicab +n02939185 caldron, cauldron +n02948072 candle, taper, wax light +n02950826 cannon +n02951358 canoe +n02951585 can opener, tin opener +n02963159 cardigan +n02965783 car mirror +n02966193 carousel, carrousel, merry-go-round, roundabout, whirligig +n02966687 carpenter's kit, tool kit +n02971356 carton +n02974003 car wheel +n02977058 cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM +n02978881 cassette +n02979186 cassette player +n02980441 castle +n02981792 catamaran +n02988304 CD player +n02992211 cello, violoncello +n02992529 cellular telephone, cellular phone, cellphone, cell, mobile phone +n02999410 chain +n03000134 chainlink fence +n03000247 chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour +n03000684 chain saw, chainsaw +n03014705 chest +n03016953 chiffonier, commode +n03017168 chime, bell, gong +n03018349 china cabinet, china closet +n03026506 Christmas stocking +n03028079 church, church building +n03032252 cinema, movie theater, movie theatre, movie house, picture palace +n03041632 cleaver, meat cleaver, chopper +n03042490 cliff dwelling +n03045698 cloak +n03047690 clog, geta, patten, sabot +n03062245 cocktail shaker +n03063599 coffee mug +n03063689 coffeepot +n03065424 coil, spiral, volute, whorl, helix +n03075370 combination lock +n03085013 computer keyboard, keypad +n03089624 confectionery, confectionary, candy store +n03095699 container ship, containership, container vessel +n03100240 convertible +n03109150 corkscrew, bottle screw +n03110669 cornet, horn, trumpet, trump +n03124043 cowboy boot +n03124170 cowboy hat, ten-gallon hat +n03125729 cradle +n03126707 crane +n03127747 crash helmet +n03127925 crate +n03131574 crib, cot +n03133878 Crock Pot +n03134739 croquet ball +n03141823 crutch +n03146219 cuirass +n03160309 dam, dike, dyke +n03179701 desk +n03180011 desktop computer +n03187595 dial telephone, dial phone +n03188531 diaper, nappy, napkin +n03196217 digital clock +n03197337 digital watch +n03201208 dining table, board +n03207743 dishrag, dishcloth +n03207941 dishwasher, dish washer, dishwashing machine +n03208938 disk brake, disc brake +n03216828 dock, dockage, docking facility +n03218198 dogsled, dog sled, dog sleigh +n03220513 dome +n03223299 doormat, welcome mat +n03240683 drilling platform, offshore rig +n03249569 drum, membranophone, tympan +n03250847 drumstick +n03255030 dumbbell +n03259280 Dutch oven +n03271574 electric fan, blower +n03272010 electric guitar +n03272562 electric locomotive +n03290653 entertainment center +n03291819 envelope +n03297495 espresso maker +n03314780 face powder +n03325584 feather boa, boa +n03337140 file, file cabinet, filing cabinet +n03344393 fireboat +n03345487 fire engine, fire truck +n03347037 fire screen, fireguard +n03355925 flagpole, flagstaff +n03372029 flute, transverse flute +n03376595 folding chair +n03379051 football helmet +n03384352 forklift +n03388043 fountain +n03388183 fountain pen +n03388549 four-poster +n03393912 freight car +n03394916 French horn, horn +n03400231 frying pan, frypan, skillet +n03404251 fur coat +n03417042 garbage truck, dustcart +n03424325 gasmask, respirator, gas helmet +n03425413 gas pump, gasoline pump, petrol pump, island dispenser +n03443371 goblet +n03444034 go-kart +n03445777 golf ball +n03445924 golfcart, golf cart +n03447447 gondola +n03447721 gong, tam-tam +n03450230 gown +n03452741 grand piano, grand +n03457902 greenhouse, nursery, glasshouse +n03459775 grille, radiator grille +n03461385 grocery store, grocery, food market, market +n03467068 guillotine +n03476684 hair slide +n03476991 hair spray +n03478589 half track +n03481172 hammer +n03482405 hamper +n03483316 hand blower, blow dryer, blow drier, hair dryer, hair drier +n03485407 hand-held computer, hand-held microcomputer +n03485794 handkerchief, hankie, hanky, hankey +n03492542 hard disc, hard disk, fixed disk +n03494278 harmonica, mouth organ, harp, mouth harp +n03495258 harp +n03496892 harvester, reaper +n03498962 hatchet +n03527444 holster +n03529860 home theater, home theatre +n03530642 honeycomb +n03532672 hook, claw +n03534580 hoopskirt, crinoline +n03535780 horizontal bar, high bar +n03538406 horse cart, horse-cart +n03544143 hourglass +n03584254 iPod +n03584829 iron, smoothing iron +n03590841 jack-o'-lantern +n03594734 jean, blue jean, denim +n03594945 jeep, landrover +n03595614 jersey, T-shirt, tee shirt +n03598930 jigsaw puzzle +n03599486 jinrikisha, ricksha, rickshaw +n03602883 joystick +n03617480 kimono +n03623198 knee pad +n03627232 knot +n03630383 lab coat, laboratory coat +n03633091 ladle +n03637318 lampshade, lamp shade +n03642806 laptop, laptop computer +n03649909 lawn mower, mower +n03657121 lens cap, lens cover +n03658185 letter opener, paper knife, paperknife +n03661043 library +n03662601 lifeboat +n03666591 lighter, light, igniter, ignitor +n03670208 limousine, limo +n03673027 liner, ocean liner +n03676483 lipstick, lip rouge +n03680355 Loafer +n03690938 lotion +n03691459 loudspeaker, speaker, speaker unit, loudspeaker system, speaker system +n03692522 loupe, jeweler's loupe +n03697007 lumbermill, sawmill +n03706229 magnetic compass +n03709823 mailbag, postbag +n03710193 mailbox, letter box +n03710637 maillot +n03710721 maillot, tank suit +n03717622 manhole cover +n03720891 maraca +n03721384 marimba, xylophone +n03724870 mask +n03729826 matchstick +n03733131 maypole +n03733281 maze, labyrinth +n03733805 measuring cup +n03742115 medicine chest, medicine cabinet +n03743016 megalith, megalithic structure +n03759954 microphone, mike +n03761084 microwave, microwave oven +n03763968 military uniform +n03764736 milk can +n03769881 minibus +n03770439 miniskirt, mini +n03770679 minivan +n03773504 missile +n03775071 mitten +n03775546 mixing bowl +n03776460 mobile home, manufactured home +n03777568 Model T +n03777754 modem +n03781244 monastery +n03782006 monitor +n03785016 moped +n03786901 mortar +n03787032 mortarboard +n03788195 mosque +n03788365 mosquito net +n03791053 motor scooter, scooter +n03792782 mountain bike, all-terrain bike, off-roader +n03792972 mountain tent +n03793489 mouse, computer mouse +n03794056 mousetrap +n03796401 moving van +n03803284 muzzle +n03804744 nail +n03814639 neck brace +n03814906 necklace +n03825788 nipple +n03832673 notebook, notebook computer +n03837869 obelisk +n03838899 oboe, hautboy, hautbois +n03840681 ocarina, sweet potato +n03841143 odometer, hodometer, mileometer, milometer +n03843555 oil filter +n03854065 organ, pipe organ +n03857828 oscilloscope, scope, cathode-ray oscilloscope, CRO +n03866082 overskirt +n03868242 oxcart +n03868863 oxygen mask +n03871628 packet +n03873416 paddle, boat paddle +n03874293 paddlewheel, paddle wheel +n03874599 padlock +n03876231 paintbrush +n03877472 pajama, pyjama, pj's, jammies +n03877845 palace +n03884397 panpipe, pandean pipe, syrinx +n03887697 paper towel +n03888257 parachute, chute +n03888605 parallel bars, bars +n03891251 park bench +n03891332 parking meter +n03895866 passenger car, coach, carriage +n03899768 patio, terrace +n03902125 pay-phone, pay-station +n03903868 pedestal, plinth, footstall +n03908618 pencil box, pencil case +n03908714 pencil sharpener +n03916031 perfume, essence +n03920288 Petri dish +n03924679 photocopier +n03929660 pick, plectrum, plectron +n03929855 pickelhaube +n03930313 picket fence, paling +n03930630 pickup, pickup truck +n03933933 pier +n03935335 piggy bank, penny bank +n03937543 pill bottle +n03938244 pillow +n03942813 ping-pong ball +n03944341 pinwheel +n03947888 pirate, pirate ship +n03950228 pitcher, ewer +n03954731 plane, carpenter's plane, woodworking plane +n03956157 planetarium +n03958227 plastic bag +n03961711 plate rack +n03967562 plow, plough +n03970156 plunger, plumber's helper +n03976467 Polaroid camera, Polaroid Land camera +n03976657 pole +n03977966 police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria +n03980874 poncho +n03982430 pool table, billiard table, snooker table +n03983396 pop bottle, soda bottle +n03991062 pot, flowerpot +n03992509 potter's wheel +n03995372 power drill +n03998194 prayer rug, prayer mat +n04004767 printer +n04005630 prison, prison house +n04008634 projectile, missile +n04009552 projector +n04019541 puck, hockey puck +n04023962 punching bag, punch bag, punching ball, punchball +n04026417 purse +n04033901 quill, quill pen +n04033995 quilt, comforter, comfort, puff +n04037443 racer, race car, racing car +n04039381 racket, racquet +n04040759 radiator +n04041544 radio, wireless +n04044716 radio telescope, radio reflector +n04049303 rain barrel +n04065272 recreational vehicle, RV, R.V. +n04067472 reel +n04069434 reflex camera +n04070727 refrigerator, icebox +n04074963 remote control, remote +n04081281 restaurant, eating house, eating place, eatery +n04086273 revolver, six-gun, six-shooter +n04090263 rifle +n04099969 rocking chair, rocker +n04111531 rotisserie +n04116512 rubber eraser, rubber, pencil eraser +n04118538 rugby ball +n04118776 rule, ruler +n04120489 running shoe +n04125021 safe +n04127249 safety pin +n04131690 saltshaker, salt shaker +n04133789 sandal +n04136333 sarong +n04141076 sax, saxophone +n04141327 scabbard +n04141975 scale, weighing machine +n04146614 school bus +n04147183 schooner +n04149813 scoreboard +n04152593 screen, CRT screen +n04153751 screw +n04154565 screwdriver +n04162706 seat belt, seatbelt +n04179913 sewing machine +n04192698 shield, buckler +n04200800 shoe shop, shoe-shop, shoe store +n04201297 shoji +n04204238 shopping basket +n04204347 shopping cart +n04208210 shovel +n04209133 shower cap +n04209239 shower curtain +n04228054 ski +n04229816 ski mask +n04235860 sleeping bag +n04238763 slide rule, slipstick +n04239074 sliding door +n04243546 slot, one-armed bandit +n04251144 snorkel +n04252077 snowmobile +n04252225 snowplow, snowplough +n04254120 soap dispenser +n04254680 soccer ball +n04254777 sock +n04258138 solar dish, solar collector, solar furnace +n04259630 sombrero +n04263257 soup bowl +n04264628 space bar +n04265275 space heater +n04266014 space shuttle +n04270147 spatula +n04273569 speedboat +n04275548 spider web, spider's web +n04277352 spindle +n04285008 sports car, sport car +n04286575 spotlight, spot +n04296562 stage +n04310018 steam locomotive +n04311004 steel arch bridge +n04311174 steel drum +n04317175 stethoscope +n04325704 stole +n04326547 stone wall +n04328186 stopwatch, stop watch +n04330267 stove +n04332243 strainer +n04335435 streetcar, tram, tramcar, trolley, trolley car +n04336792 stretcher +n04344873 studio couch, day bed +n04346328 stupa, tope +n04347754 submarine, pigboat, sub, U-boat +n04350905 suit, suit of clothes +n04355338 sundial +n04355933 sunglass +n04356056 sunglasses, dark glasses, shades +n04357314 sunscreen, sunblock, sun blocker +n04366367 suspension bridge +n04367480 swab, swob, mop +n04370456 sweatshirt +n04371430 swimming trunks, bathing trunks +n04371774 swing +n04372370 switch, electric switch, electrical switch +n04376876 syringe +n04380533 table lamp +n04389033 tank, army tank, armored combat vehicle, armoured combat vehicle +n04392985 tape player +n04398044 teapot +n04399382 teddy, teddy bear +n04404412 television, television system +n04409515 tennis ball +n04417672 thatch, thatched roof +n04418357 theater curtain, theatre curtain +n04423845 thimble +n04428191 thresher, thrasher, threshing machine +n04429376 throne +n04435653 tile roof +n04442312 toaster +n04443257 tobacco shop, tobacconist shop, tobacconist +n04447861 toilet seat +n04456115 torch +n04458633 totem pole +n04461696 tow truck, tow car, wrecker +n04462240 toyshop +n04465501 tractor +n04467665 trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi +n04476259 tray +n04479046 trench coat +n04482393 tricycle, trike, velocipede +n04483307 trimaran +n04485082 tripod +n04486054 triumphal arch +n04487081 trolleybus, trolley coach, trackless trolley +n04487394 trombone +n04493381 tub, vat +n04501370 turnstile +n04505470 typewriter keyboard +n04507155 umbrella +n04509417 unicycle, monocycle +n04515003 upright, upright piano +n04517823 vacuum, vacuum cleaner +n04522168 vase +n04523525 vault +n04525038 velvet +n04525305 vending machine +n04532106 vestment +n04532670 viaduct +n04536866 violin, fiddle +n04540053 volleyball +n04542943 waffle iron +n04548280 wall clock +n04548362 wallet, billfold, notecase, pocketbook +n04550184 wardrobe, closet, press +n04552348 warplane, military plane +n04553703 washbasin, handbasin, washbowl, lavabo, wash-hand basin +n04554684 washer, automatic washer, washing machine +n04557648 water bottle +n04560804 water jug +n04562935 water tower +n04579145 whiskey jug +n04579432 whistle +n04584207 wig +n04589890 window screen +n04590129 window shade +n04591157 Windsor tie +n04591713 wine bottle +n04592741 wing +n04596742 wok +n04597913 wooden spoon +n04599235 wool, woolen, woollen +n04604644 worm fence, snake fence, snake-rail fence, Virginia fence +n04606251 wreck +n04612504 yawl +n04613696 yurt +n06359193 web site, website, internet site, site +n06596364 comic book +n06785654 crossword puzzle, crossword +n06794110 street sign +n06874185 traffic light, traffic signal, stoplight +n07248320 book jacket, dust cover, dust jacket, dust wrapper +n07565083 menu +n07579787 plate +n07583066 guacamole +n07584110 consomme +n07590611 hot pot, hotpot +n07613480 trifle +n07614500 ice cream, icecream +n07615774 ice lolly, lolly, lollipop, popsicle +n07684084 French loaf +n07693725 bagel, beigel +n07695742 pretzel +n07697313 cheeseburger +n07697537 hotdog, hot dog, red hot +n07711569 mashed potato +n07714571 head cabbage +n07714990 broccoli +n07715103 cauliflower +n07716358 zucchini, courgette +n07716906 spaghetti squash +n07717410 acorn squash +n07717556 butternut squash +n07718472 cucumber, cuke +n07718747 artichoke, globe artichoke +n07720875 bell pepper +n07730033 cardoon +n07734744 mushroom +n07742313 Granny Smith +n07745940 strawberry +n07747607 orange +n07749582 lemon +n07753113 fig +n07753275 pineapple, ananas +n07753592 banana +n07754684 jackfruit, jak, jack +n07760859 custard apple +n07768694 pomegranate +n07802026 hay +n07831146 carbonara +n07836838 chocolate sauce, chocolate syrup +n07860988 dough +n07871810 meat loaf, meatloaf +n07873807 pizza, pizza pie +n07875152 potpie +n07880968 burrito +n07892512 red wine +n07920052 espresso +n07930864 cup +n07932039 eggnog +n09193705 alp +n09229709 bubble +n09246464 cliff, drop, drop-off +n09256479 coral reef +n09288635 geyser +n09332890 lakeside, lakeshore +n09399592 promontory, headland, head, foreland +n09421951 sandbar, sand bar +n09428293 seashore, coast, seacoast, sea-coast +n09468604 valley, vale +n09472597 volcano +n09835506 ballplayer, baseball player +n10148035 groom, bridegroom +n10565667 scuba diver +n11879895 rapeseed +n11939491 daisy +n12057211 yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum +n12144580 corn +n12267677 acorn +n12620546 hip, rose hip, rosehip +n12768682 buckeye, horse chestnut, conker +n12985857 coral fungus +n12998815 agaric +n13037406 gyromitra +n13040303 stinkhorn, carrion fungus +n13044778 earthstar +n13052670 hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa +n13054560 bolete +n13133613 ear, spike, capitulum +n15075141 toilet tissue, toilet paper, bathroom tissue diff --git a/test/OpenCvSharp.Tests/_data/text/textbox.prototxt b/test/OpenCvSharp.Tests/_data/text/textbox.prototxt new file mode 100644 index 000000000..26fa447b2 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/text/textbox.prototxt @@ -0,0 +1,1629 @@ +name: "VGG_text_longer_conv_300x300_deploy" +input: "data" +input_shape { + dim: 1 + dim: 3 + dim: 700 + dim: 700 +} +layer { + name: "conv1_1" + type: "Convolution" + bottom: "data" + top: "conv1_1" + param { + lr_mult: 0 + decay_mult: 0 + } + param { + lr_mult: 0 + decay_mult: 0 + } + convolution_param { + num_output: 64 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu1_1" + type: "ReLU" + bottom: "conv1_1" + top: "conv1_1" +} +layer { + name: "conv1_2" + type: "Convolution" + bottom: "conv1_1" + top: "conv1_2" + param { + lr_mult: 0 + decay_mult: 0 + } + param { + lr_mult: 0 + decay_mult: 0 + } + convolution_param { + num_output: 64 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu1_2" + type: "ReLU" + bottom: "conv1_2" + top: "conv1_2" +} +layer { + name: "pool1" + type: "Pooling" + bottom: "conv1_2" + top: "pool1" + pooling_param { + pool: MAX + kernel_size: 2 + stride: 2 + } +} +layer { + name: "conv2_1" + type: "Convolution" + bottom: "pool1" + top: "conv2_1" + param { + lr_mult: 0 + decay_mult: 0 + } + param { + lr_mult: 0 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu2_1" + type: "ReLU" + bottom: "conv2_1" + top: "conv2_1" +} +layer { + name: "conv2_2" + type: "Convolution" + bottom: "conv2_1" + top: "conv2_2" + param { + lr_mult: 0 + decay_mult: 0 + } + param { + lr_mult: 0 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu2_2" + type: "ReLU" + bottom: "conv2_2" + top: "conv2_2" +} +layer { + name: "pool2" + type: "Pooling" + bottom: "conv2_2" + top: "pool2" + pooling_param { + pool: MAX + kernel_size: 2 + stride: 2 + } +} +layer { + name: "conv3_1" + type: "Convolution" + bottom: "pool2" + top: "conv3_1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu3_1" + type: "ReLU" + bottom: "conv3_1" + top: "conv3_1" +} +layer { + name: "conv3_2" + type: "Convolution" + bottom: "conv3_1" + top: "conv3_2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu3_2" + type: "ReLU" + bottom: "conv3_2" + top: "conv3_2" +} +layer { + name: "conv3_3" + type: "Convolution" + bottom: "conv3_2" + top: "conv3_3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu3_3" + type: "ReLU" + bottom: "conv3_3" + top: "conv3_3" +} +layer { + name: "pool3" + type: "Pooling" + bottom: "conv3_3" + top: "pool3" + pooling_param { + pool: MAX + kernel_size: 2 + stride: 2 + } +} +layer { + name: "conv4_1" + type: "Convolution" + bottom: "pool3" + top: "conv4_1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu4_1" + type: "ReLU" + bottom: "conv4_1" + top: "conv4_1" +} +layer { + name: "conv4_2" + type: "Convolution" + bottom: "conv4_1" + top: "conv4_2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu4_2" + type: "ReLU" + bottom: "conv4_2" + top: "conv4_2" +} +layer { + name: "conv4_3" + type: "Convolution" + bottom: "conv4_2" + top: "conv4_3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu4_3" + type: "ReLU" + bottom: "conv4_3" + top: "conv4_3" +} +layer { + name: "pool4" + type: "Pooling" + bottom: "conv4_3" + top: "pool4" + pooling_param { + pool: MAX + kernel_size: 2 + stride: 2 + } +} +layer { + name: "conv5_1" + type: "Convolution" + bottom: "pool4" + top: "conv5_1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu5_1" + type: "ReLU" + bottom: "conv5_1" + top: "conv5_1" +} +layer { + name: "conv5_2" + type: "Convolution" + bottom: "conv5_1" + top: "conv5_2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu5_2" + type: "ReLU" + bottom: "conv5_2" + top: "conv5_2" +} +layer { + name: "conv5_3" + type: "Convolution" + bottom: "conv5_2" + top: "conv5_3" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu5_3" + type: "ReLU" + bottom: "conv5_3" + top: "conv5_3" +} +layer { + name: "pool5" + type: "Pooling" + bottom: "conv5_3" + top: "pool5" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 1 + pad: 1 + } +} +layer { + name: "fc6" + type: "Convolution" + bottom: "pool5" + top: "fc6" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 1024 + pad: 6 + kernel_size: 3 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + dilation: 6 + } +} +layer { + name: "relu6" + type: "ReLU" + bottom: "fc6" + top: "fc6" +} +layer { + name: "fc7" + type: "Convolution" + bottom: "fc6" + top: "fc7" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 1024 + kernel_size: 1 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "relu7" + type: "ReLU" + bottom: "fc7" + top: "fc7" +} +layer { + name: "conv6_1" + type: "Convolution" + bottom: "fc7" + top: "conv6_1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 0 + kernel_size: 1 + stride: 1 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "conv6_1_relu" + type: "ReLU" + bottom: "conv6_1" + top: "conv6_1" +} +layer { + name: "conv6_2" + type: "Convolution" + bottom: "conv6_1" + top: "conv6_2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 512 + pad: 1 + kernel_size: 3 + stride: 2 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "conv6_2_relu" + type: "ReLU" + bottom: "conv6_2" + top: "conv6_2" +} +layer { + name: "conv7_1" + type: "Convolution" + bottom: "conv6_2" + top: "conv7_1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + stride: 1 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "conv7_1_relu" + type: "ReLU" + bottom: "conv7_1" + top: "conv7_1" +} +layer { + name: "conv7_2" + type: "Convolution" + bottom: "conv7_1" + top: "conv7_2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 1 + kernel_size: 3 + stride: 2 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "conv7_2_relu" + type: "ReLU" + bottom: "conv7_2" + top: "conv7_2" +} +layer { + name: "conv8_1" + type: "Convolution" + bottom: "conv7_2" + top: "conv8_1" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + stride: 1 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "conv8_1_relu" + type: "ReLU" + bottom: "conv8_1" + top: "conv8_1" +} +layer { + name: "conv8_2" + type: "Convolution" + bottom: "conv8_1" + top: "conv8_2" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 256 + pad: 1 + kernel_size: 3 + stride: 2 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + } +} +layer { + name: "conv8_2_relu" + type: "ReLU" + bottom: "conv8_2" + top: "conv8_2" +} +layer { + name: "pool6" + type: "Pooling" + bottom: "conv8_2" + top: "pool6" + pooling_param { + pool: AVE + global_pooling: true + } +} +layer { + name: "conv4_3_norm" + type: "Normalize" + bottom: "conv4_3" + top: "conv4_3_norm" + norm_param { + across_spatial: false + scale_filler { + type: "constant" + value: 20 + } + channel_shared: false + } +} +layer { + name: "conv4_3_norm_mbox_loc" + type: "Convolution" + bottom: "conv4_3_norm" + top: "conv4_3_norm_mbox_loc" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 48 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv4_3_norm_mbox_loc_perm" + type: "Permute" + bottom: "conv4_3_norm_mbox_loc" + top: "conv4_3_norm_mbox_loc_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv4_3_norm_mbox_loc_flat" + type: "Flatten" + bottom: "conv4_3_norm_mbox_loc_perm" + top: "conv4_3_norm_mbox_loc_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv4_3_norm_mbox_conf" + type: "Convolution" + bottom: "conv4_3_norm" + top: "conv4_3_norm_mbox_conf" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 24 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv4_3_norm_mbox_conf_perm" + type: "Permute" + bottom: "conv4_3_norm_mbox_conf" + top: "conv4_3_norm_mbox_conf_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv4_3_norm_mbox_conf_flat" + type: "Flatten" + bottom: "conv4_3_norm_mbox_conf_perm" + top: "conv4_3_norm_mbox_conf_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv4_3_norm_mbox_priorbox" + type: "PriorBox" + bottom: "conv4_3_norm" + bottom: "data" + top: "conv4_3_norm_mbox_priorbox" + prior_box_param { + min_size: 30.0 + aspect_ratio: 2 + aspect_ratio: 3 + aspect_ratio: 5 + aspect_ratio: 7 + aspect_ratio: 10 + flip: false + clip: true + variance: 0.1 + variance: 0.1 + variance: 0.2 + variance: 0.2 + offset_h: 0.5 + offset_w: 0.5 + offset_h: 1.0 + offset_w: 0.5 + } +} +layer { + name: "fc7_mbox_loc" + type: "Convolution" + bottom: "fc7" + top: "fc7_mbox_loc" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 56 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "fc7_mbox_loc_perm" + type: "Permute" + bottom: "fc7_mbox_loc" + top: "fc7_mbox_loc_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "fc7_mbox_loc_flat" + type: "Flatten" + bottom: "fc7_mbox_loc_perm" + top: "fc7_mbox_loc_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "fc7_mbox_conf" + type: "Convolution" + bottom: "fc7" + top: "fc7_mbox_conf" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 28 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "fc7_mbox_conf_perm" + type: "Permute" + bottom: "fc7_mbox_conf" + top: "fc7_mbox_conf_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "fc7_mbox_conf_flat" + type: "Flatten" + bottom: "fc7_mbox_conf_perm" + top: "fc7_mbox_conf_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "fc7_mbox_priorbox" + type: "PriorBox" + bottom: "fc7" + bottom: "data" + top: "fc7_mbox_priorbox" + prior_box_param { + min_size: 60.0 + max_size: 114.0 + aspect_ratio: 2 + aspect_ratio: 3 + aspect_ratio: 5 + aspect_ratio: 7 + aspect_ratio: 10 + flip: false + clip: true + variance: 0.1 + variance: 0.1 + variance: 0.2 + variance: 0.2 + offset_h: 0.5 + offset_w: 0.5 + offset_h: 1.0 + offset_w: 0.5 + } +} +layer { + name: "conv6_2_mbox_loc" + type: "Convolution" + bottom: "conv6_2" + top: "conv6_2_mbox_loc" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 56 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv6_2_mbox_loc_perm" + type: "Permute" + bottom: "conv6_2_mbox_loc" + top: "conv6_2_mbox_loc_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv6_2_mbox_loc_flat" + type: "Flatten" + bottom: "conv6_2_mbox_loc_perm" + top: "conv6_2_mbox_loc_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv6_2_mbox_conf" + type: "Convolution" + bottom: "conv6_2" + top: "conv6_2_mbox_conf" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 28 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv6_2_mbox_conf_perm" + type: "Permute" + bottom: "conv6_2_mbox_conf" + top: "conv6_2_mbox_conf_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv6_2_mbox_conf_flat" + type: "Flatten" + bottom: "conv6_2_mbox_conf_perm" + top: "conv6_2_mbox_conf_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv6_2_mbox_priorbox" + type: "PriorBox" + bottom: "conv6_2" + bottom: "data" + top: "conv6_2_mbox_priorbox" + prior_box_param { + min_size: 114.0 + max_size: 168.0 + aspect_ratio: 2 + aspect_ratio: 3 + aspect_ratio: 5 + aspect_ratio: 7 + aspect_ratio: 10 + flip: false + clip: true + variance: 0.1 + variance: 0.1 + variance: 0.2 + variance: 0.2 + offset_h: 0.5 + offset_w: 0.5 + offset_h: 1.0 + offset_w: 0.5 + } +} +layer { + name: "conv7_2_mbox_loc" + type: "Convolution" + bottom: "conv7_2" + top: "conv7_2_mbox_loc" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 56 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv7_2_mbox_loc_perm" + type: "Permute" + bottom: "conv7_2_mbox_loc" + top: "conv7_2_mbox_loc_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv7_2_mbox_loc_flat" + type: "Flatten" + bottom: "conv7_2_mbox_loc_perm" + top: "conv7_2_mbox_loc_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv7_2_mbox_conf" + type: "Convolution" + bottom: "conv7_2" + top: "conv7_2_mbox_conf" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 28 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv7_2_mbox_conf_perm" + type: "Permute" + bottom: "conv7_2_mbox_conf" + top: "conv7_2_mbox_conf_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv7_2_mbox_conf_flat" + type: "Flatten" + bottom: "conv7_2_mbox_conf_perm" + top: "conv7_2_mbox_conf_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv7_2_mbox_priorbox" + type: "PriorBox" + bottom: "conv7_2" + bottom: "data" + top: "conv7_2_mbox_priorbox" + prior_box_param { + min_size: 168.0 + max_size: 222.0 + aspect_ratio: 2 + aspect_ratio: 3 + aspect_ratio: 5 + aspect_ratio: 7 + aspect_ratio: 10 + flip: false + clip: true + variance: 0.1 + variance: 0.1 + variance: 0.2 + variance: 0.2 + offset_h: 0.5 + offset_w: 0.5 + offset_h: 1.0 + offset_w: 0.5 + } +} +layer { + name: "conv8_2_mbox_loc" + type: "Convolution" + bottom: "conv8_2" + top: "conv8_2_mbox_loc" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 56 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv8_2_mbox_loc_perm" + type: "Permute" + bottom: "conv8_2_mbox_loc" + top: "conv8_2_mbox_loc_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv8_2_mbox_loc_flat" + type: "Flatten" + bottom: "conv8_2_mbox_loc_perm" + top: "conv8_2_mbox_loc_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv8_2_mbox_conf" + type: "Convolution" + bottom: "conv8_2" + top: "conv8_2_mbox_conf" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 28 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "conv8_2_mbox_conf_perm" + type: "Permute" + bottom: "conv8_2_mbox_conf" + top: "conv8_2_mbox_conf_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "conv8_2_mbox_conf_flat" + type: "Flatten" + bottom: "conv8_2_mbox_conf_perm" + top: "conv8_2_mbox_conf_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "conv8_2_mbox_priorbox" + type: "PriorBox" + bottom: "conv8_2" + bottom: "data" + top: "conv8_2_mbox_priorbox" + prior_box_param { + min_size: 222.0 + max_size: 276.0 + aspect_ratio: 2 + aspect_ratio: 3 + aspect_ratio: 5 + aspect_ratio: 7 + aspect_ratio: 10 + flip: false + clip: true + variance: 0.1 + variance: 0.1 + variance: 0.2 + variance: 0.2 + offset_h: 0.5 + offset_w: 0.5 + offset_h: 1.0 + offset_w: 0.5 + } +} +layer { + name: "pool6_mbox_loc" + type: "Convolution" + bottom: "pool6" + top: "pool6_mbox_loc" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 56 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "pool6_mbox_loc_perm" + type: "Permute" + bottom: "pool6_mbox_loc" + top: "pool6_mbox_loc_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "pool6_mbox_loc_flat" + type: "Flatten" + bottom: "pool6_mbox_loc_perm" + top: "pool6_mbox_loc_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "pool6_mbox_conf" + type: "Convolution" + bottom: "pool6" + top: "pool6_mbox_conf" + param { + lr_mult: 1 + decay_mult: 1 + } + param { + lr_mult: 2 + decay_mult: 0 + } + convolution_param { + num_output: 28 + weight_filler { + type: "xavier" + } + bias_filler { + type: "constant" + value: 0 + } + pad_h: 0 + pad_w: 2 + kernel_h: 1 + kernel_w: 5 + stride_h: 1 + stride_w: 1 + } +} +layer { + name: "pool6_mbox_conf_perm" + type: "Permute" + bottom: "pool6_mbox_conf" + top: "pool6_mbox_conf_perm" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "pool6_mbox_conf_flat" + type: "Flatten" + bottom: "pool6_mbox_conf_perm" + top: "pool6_mbox_conf_flat" + flatten_param { + axis: 1 + } +} +layer { + name: "pool6_mbox_priorbox" + type: "PriorBox" + bottom: "pool6" + bottom: "data" + top: "pool6_mbox_priorbox" + prior_box_param { + min_size: 276.0 + max_size: 330.0 + aspect_ratio: 2 + aspect_ratio: 3 + aspect_ratio: 5 + aspect_ratio: 7 + aspect_ratio: 10 + flip: false + clip: true + variance: 0.1 + variance: 0.1 + variance: 0.2 + variance: 0.2 + offset_h: 0.5 + offset_w: 0.5 + offset_h: 1.0 + offset_w: 0.5 + } +} +layer { + name: "mbox_loc" + type: "Concat" + bottom: "conv4_3_norm_mbox_loc_flat" + bottom: "fc7_mbox_loc_flat" + bottom: "conv6_2_mbox_loc_flat" + bottom: "conv7_2_mbox_loc_flat" + bottom: "conv8_2_mbox_loc_flat" + bottom: "pool6_mbox_loc_flat" + top: "mbox_loc" + concat_param { + axis: 1 + } +} +layer { + name: "mbox_conf" + type: "Concat" + bottom: "conv4_3_norm_mbox_conf_flat" + bottom: "fc7_mbox_conf_flat" + bottom: "conv6_2_mbox_conf_flat" + bottom: "conv7_2_mbox_conf_flat" + bottom: "conv8_2_mbox_conf_flat" + bottom: "pool6_mbox_conf_flat" + top: "mbox_conf" + concat_param { + axis: 1 + } +} +layer { + name: "mbox_priorbox" + type: "Concat" + bottom: "conv4_3_norm_mbox_priorbox" + bottom: "fc7_mbox_priorbox" + bottom: "conv6_2_mbox_priorbox" + bottom: "conv7_2_mbox_priorbox" + bottom: "conv8_2_mbox_priorbox" + bottom: "pool6_mbox_priorbox" + top: "mbox_priorbox" + concat_param { + axis: 2 + } +} +layer { + name: "mbox_conf_reshape" + type: "Reshape" + bottom: "mbox_conf" + top: "mbox_conf_reshape" + reshape_param { + shape { + dim: 0 + dim: -1 + dim: 2 + } + } +} +layer { + name: "mbox_conf_softmax" + type: "Softmax" + bottom: "mbox_conf_reshape" + top: "mbox_conf_softmax" + softmax_param { + axis: 2 + } +} +layer { + name: "mbox_conf_flatten" + type: "Flatten" + bottom: "mbox_conf_softmax" + top: "mbox_conf_flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "detection_out" + type: "DetectionOutput" + bottom: "mbox_loc" + bottom: "mbox_conf_flatten" + bottom: "mbox_priorbox" + top: "detection_out" + include { + phase: TEST + } + detection_output_param { + num_classes: 2 + share_location: true + background_label_id: 0 + nms_param { + nms_threshold: 0.45 + top_k: 400 + } + code_type: CENTER_SIZE + keep_top_k: 200 + confidence_threshold: 0.01 + } +} \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/_data/wechat_qrcode/detect.caffemodel b/test/OpenCvSharp.Tests/_data/wechat_qrcode/detect.caffemodel new file mode 100644 index 000000000..453126c7b Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/wechat_qrcode/detect.caffemodel differ diff --git a/test/OpenCvSharp.Tests/_data/wechat_qrcode/detect.prototxt b/test/OpenCvSharp.Tests/_data/wechat_qrcode/detect.prototxt new file mode 100644 index 000000000..bd2417c96 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/wechat_qrcode/detect.prototxt @@ -0,0 +1,2716 @@ +layer { + name: "data" + type: "Input" + top: "data" + input_param { + shape { + dim: 1 + dim: 1 + dim: 384 + dim: 384 + } + } +} +layer { + name: "data/bn" + type: "BatchNorm" + bottom: "data" + top: "data" + param { + lr_mult: 0.0 + decay_mult: 0.0 + } + param { + lr_mult: 0.0 + decay_mult: 0.0 + } + param { + lr_mult: 0.0 + decay_mult: 0.0 + } +} +layer { + name: "data/bn/scale" + type: "Scale" + bottom: "data" + top: "data" + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + scale_param { + filler { + type: "constant" + value: 1.0 + } + bias_term: true + bias_filler { + type: "constant" + value: 0.0 + } + } +} +layer { + name: "stage1" + type: "Convolution" + bottom: "data" + top: "stage1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 24 + bias_term: true + pad: 1 + kernel_size: 3 + group: 1 + stride: 2 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage1/bn" + type: "BatchNorm" + bottom: "stage1" + top: "stage1" + param { + lr_mult: 0.0 + decay_mult: 0.0 + } + param { + lr_mult: 0.0 + decay_mult: 0.0 + } + param { + lr_mult: 0.0 + decay_mult: 0.0 + } +} +layer { + name: "stage1/bn/scale" + type: "Scale" + bottom: "stage1" + top: "stage1" + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + scale_param { + filler { + type: "constant" + value: 1.0 + } + bias_term: true + bias_filler { + type: "constant" + value: 0.0 + } + } +} +layer { + name: "stage1/relu" + type: "ReLU" + bottom: "stage1" + top: "stage1" +} +layer { + name: "stage2" + type: "Pooling" + bottom: "stage1" + top: "stage2" + pooling_param { + pool: MAX + kernel_size: 3 + stride: 2 + pad: 0 + } +} +layer { + name: "stage3_1/conv1" + type: "Convolution" + bottom: "stage2" + top: "stage3_1/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_1/conv1/relu" + type: "ReLU" + bottom: "stage3_1/conv1" + top: "stage3_1/conv1" +} +layer { + name: "stage3_1/conv2" + type: "Convolution" + bottom: "stage3_1/conv1" + top: "stage3_1/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 1 + kernel_size: 3 + group: 16 + stride: 2 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_1/conv3" + type: "Convolution" + bottom: "stage3_1/conv2" + top: "stage3_1/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 64 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_1/relu" + type: "ReLU" + bottom: "stage3_1/conv3" + top: "stage3_1/conv3" +} +layer { + name: "stage3_2/conv1" + type: "Convolution" + bottom: "stage3_1/conv3" + top: "stage3_2/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_2/conv1/relu" + type: "ReLU" + bottom: "stage3_2/conv1" + top: "stage3_2/conv1" +} +layer { + name: "stage3_2/conv2" + type: "Convolution" + bottom: "stage3_2/conv1" + top: "stage3_2/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 1 + kernel_size: 3 + group: 16 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_2/conv3" + type: "Convolution" + bottom: "stage3_2/conv2" + top: "stage3_2/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 64 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_2/sum" + type: "Eltwise" + bottom: "stage3_1/conv3" + bottom: "stage3_2/conv3" + top: "stage3_2/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage3_2/relu" + type: "ReLU" + bottom: "stage3_2/sum" + top: "stage3_2/sum" +} +layer { + name: "stage3_3/conv1" + type: "Convolution" + bottom: "stage3_2/sum" + top: "stage3_3/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_3/conv1/relu" + type: "ReLU" + bottom: "stage3_3/conv1" + top: "stage3_3/conv1" +} +layer { + name: "stage3_3/conv2" + type: "Convolution" + bottom: "stage3_3/conv1" + top: "stage3_3/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 1 + kernel_size: 3 + group: 16 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_3/conv3" + type: "Convolution" + bottom: "stage3_3/conv2" + top: "stage3_3/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 64 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_3/sum" + type: "Eltwise" + bottom: "stage3_2/sum" + bottom: "stage3_3/conv3" + top: "stage3_3/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage3_3/relu" + type: "ReLU" + bottom: "stage3_3/sum" + top: "stage3_3/sum" +} +layer { + name: "stage3_4/conv1" + type: "Convolution" + bottom: "stage3_3/sum" + top: "stage3_4/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_4/conv1/relu" + type: "ReLU" + bottom: "stage3_4/conv1" + top: "stage3_4/conv1" +} +layer { + name: "stage3_4/conv2" + type: "Convolution" + bottom: "stage3_4/conv1" + top: "stage3_4/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 16 + pad: 1 + kernel_size: 3 + group: 16 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_4/conv3" + type: "Convolution" + bottom: "stage3_4/conv2" + top: "stage3_4/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 64 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage3_4/sum" + type: "Eltwise" + bottom: "stage3_3/sum" + bottom: "stage3_4/conv3" + top: "stage3_4/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage3_4/relu" + type: "ReLU" + bottom: "stage3_4/sum" + top: "stage3_4/sum" +} +layer { + name: "stage4_1/conv1" + type: "Convolution" + bottom: "stage3_4/sum" + top: "stage4_1/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_1/conv1/relu" + type: "ReLU" + bottom: "stage4_1/conv1" + top: "stage4_1/conv1" +} +layer { + name: "stage4_1/conv2" + type: "Convolution" + bottom: "stage4_1/conv1" + top: "stage4_1/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 2 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_1/conv3" + type: "Convolution" + bottom: "stage4_1/conv2" + top: "stage4_1/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_1/relu" + type: "ReLU" + bottom: "stage4_1/conv3" + top: "stage4_1/conv3" +} +layer { + name: "stage4_2/conv1" + type: "Convolution" + bottom: "stage4_1/conv3" + top: "stage4_2/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_2/conv1/relu" + type: "ReLU" + bottom: "stage4_2/conv1" + top: "stage4_2/conv1" +} +layer { + name: "stage4_2/conv2" + type: "Convolution" + bottom: "stage4_2/conv1" + top: "stage4_2/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_2/conv3" + type: "Convolution" + bottom: "stage4_2/conv2" + top: "stage4_2/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_2/sum" + type: "Eltwise" + bottom: "stage4_1/conv3" + bottom: "stage4_2/conv3" + top: "stage4_2/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_2/relu" + type: "ReLU" + bottom: "stage4_2/sum" + top: "stage4_2/sum" +} +layer { + name: "stage4_3/conv1" + type: "Convolution" + bottom: "stage4_2/sum" + top: "stage4_3/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_3/conv1/relu" + type: "ReLU" + bottom: "stage4_3/conv1" + top: "stage4_3/conv1" +} +layer { + name: "stage4_3/conv2" + type: "Convolution" + bottom: "stage4_3/conv1" + top: "stage4_3/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_3/conv3" + type: "Convolution" + bottom: "stage4_3/conv2" + top: "stage4_3/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_3/sum" + type: "Eltwise" + bottom: "stage4_2/sum" + bottom: "stage4_3/conv3" + top: "stage4_3/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_3/relu" + type: "ReLU" + bottom: "stage4_3/sum" + top: "stage4_3/sum" +} +layer { + name: "stage4_4/conv1" + type: "Convolution" + bottom: "stage4_3/sum" + top: "stage4_4/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_4/conv1/relu" + type: "ReLU" + bottom: "stage4_4/conv1" + top: "stage4_4/conv1" +} +layer { + name: "stage4_4/conv2" + type: "Convolution" + bottom: "stage4_4/conv1" + top: "stage4_4/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_4/conv3" + type: "Convolution" + bottom: "stage4_4/conv2" + top: "stage4_4/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_4/sum" + type: "Eltwise" + bottom: "stage4_3/sum" + bottom: "stage4_4/conv3" + top: "stage4_4/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_4/relu" + type: "ReLU" + bottom: "stage4_4/sum" + top: "stage4_4/sum" +} +layer { + name: "stage4_5/conv1" + type: "Convolution" + bottom: "stage4_4/sum" + top: "stage4_5/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_5/conv1/relu" + type: "ReLU" + bottom: "stage4_5/conv1" + top: "stage4_5/conv1" +} +layer { + name: "stage4_5/conv2" + type: "Convolution" + bottom: "stage4_5/conv1" + top: "stage4_5/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_5/conv3" + type: "Convolution" + bottom: "stage4_5/conv2" + top: "stage4_5/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_5/sum" + type: "Eltwise" + bottom: "stage4_4/sum" + bottom: "stage4_5/conv3" + top: "stage4_5/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_5/relu" + type: "ReLU" + bottom: "stage4_5/sum" + top: "stage4_5/sum" +} +layer { + name: "stage4_6/conv1" + type: "Convolution" + bottom: "stage4_5/sum" + top: "stage4_6/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_6/conv1/relu" + type: "ReLU" + bottom: "stage4_6/conv1" + top: "stage4_6/conv1" +} +layer { + name: "stage4_6/conv2" + type: "Convolution" + bottom: "stage4_6/conv1" + top: "stage4_6/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_6/conv3" + type: "Convolution" + bottom: "stage4_6/conv2" + top: "stage4_6/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_6/sum" + type: "Eltwise" + bottom: "stage4_5/sum" + bottom: "stage4_6/conv3" + top: "stage4_6/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_6/relu" + type: "ReLU" + bottom: "stage4_6/sum" + top: "stage4_6/sum" +} +layer { + name: "stage4_7/conv1" + type: "Convolution" + bottom: "stage4_6/sum" + top: "stage4_7/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_7/conv1/relu" + type: "ReLU" + bottom: "stage4_7/conv1" + top: "stage4_7/conv1" +} +layer { + name: "stage4_7/conv2" + type: "Convolution" + bottom: "stage4_7/conv1" + top: "stage4_7/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_7/conv3" + type: "Convolution" + bottom: "stage4_7/conv2" + top: "stage4_7/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_7/sum" + type: "Eltwise" + bottom: "stage4_6/sum" + bottom: "stage4_7/conv3" + top: "stage4_7/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_7/relu" + type: "ReLU" + bottom: "stage4_7/sum" + top: "stage4_7/sum" +} +layer { + name: "stage4_8/conv1" + type: "Convolution" + bottom: "stage4_7/sum" + top: "stage4_8/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_8/conv1/relu" + type: "ReLU" + bottom: "stage4_8/conv1" + top: "stage4_8/conv1" +} +layer { + name: "stage4_8/conv2" + type: "Convolution" + bottom: "stage4_8/conv1" + top: "stage4_8/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 1 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_8/conv3" + type: "Convolution" + bottom: "stage4_8/conv2" + top: "stage4_8/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage4_8/sum" + type: "Eltwise" + bottom: "stage4_7/sum" + bottom: "stage4_8/conv3" + top: "stage4_8/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage4_8/relu" + type: "ReLU" + bottom: "stage4_8/sum" + top: "stage4_8/sum" +} +layer { + name: "stage5_1/conv1" + type: "Convolution" + bottom: "stage4_8/sum" + top: "stage5_1/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_1/conv1/relu" + type: "ReLU" + bottom: "stage5_1/conv1" + top: "stage5_1/conv1" +} +layer { + name: "stage5_1/conv2" + type: "Convolution" + bottom: "stage5_1/conv1" + top: "stage5_1/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 2 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage5_1/conv3" + type: "Convolution" + bottom: "stage5_1/conv2" + top: "stage5_1/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_1/relu" + type: "ReLU" + bottom: "stage5_1/conv3" + top: "stage5_1/conv3" +} +layer { + name: "stage5_2/conv1" + type: "Convolution" + bottom: "stage5_1/conv3" + top: "stage5_2/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_2/conv1/relu" + type: "ReLU" + bottom: "stage5_2/conv1" + top: "stage5_2/conv1" +} +layer { + name: "stage5_2/conv2" + type: "Convolution" + bottom: "stage5_2/conv1" + top: "stage5_2/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage5_2/conv3" + type: "Convolution" + bottom: "stage5_2/conv2" + top: "stage5_2/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_2/sum" + type: "Eltwise" + bottom: "stage5_1/conv3" + bottom: "stage5_2/conv3" + top: "stage5_2/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage5_2/relu" + type: "ReLU" + bottom: "stage5_2/sum" + top: "stage5_2/sum" +} +layer { + name: "stage5_3/conv1" + type: "Convolution" + bottom: "stage5_2/sum" + top: "stage5_3/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_3/conv1/relu" + type: "ReLU" + bottom: "stage5_3/conv1" + top: "stage5_3/conv1" +} +layer { + name: "stage5_3/conv2" + type: "Convolution" + bottom: "stage5_3/conv1" + top: "stage5_3/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage5_3/conv3" + type: "Convolution" + bottom: "stage5_3/conv2" + top: "stage5_3/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_3/sum" + type: "Eltwise" + bottom: "stage5_2/sum" + bottom: "stage5_3/conv3" + top: "stage5_3/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage5_3/relu" + type: "ReLU" + bottom: "stage5_3/sum" + top: "stage5_3/sum" +} +layer { + name: "stage5_4/conv1" + type: "Convolution" + bottom: "stage5_3/sum" + top: "stage5_4/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_4/conv1/relu" + type: "ReLU" + bottom: "stage5_4/conv1" + top: "stage5_4/conv1" +} +layer { + name: "stage5_4/conv2" + type: "Convolution" + bottom: "stage5_4/conv1" + top: "stage5_4/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage5_4/conv3" + type: "Convolution" + bottom: "stage5_4/conv2" + top: "stage5_4/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage5_4/sum" + type: "Eltwise" + bottom: "stage5_3/sum" + bottom: "stage5_4/conv3" + top: "stage5_4/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage5_4/relu" + type: "ReLU" + bottom: "stage5_4/sum" + top: "stage5_4/sum" +} +layer { + name: "stage6_1/conv4" + type: "Convolution" + bottom: "stage5_4/sum" + top: "stage6_1/conv4" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage6_1/conv1" + type: "Convolution" + bottom: "stage5_4/sum" + top: "stage6_1/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage6_1/conv1/relu" + type: "ReLU" + bottom: "stage6_1/conv1" + top: "stage6_1/conv1" +} +layer { + name: "stage6_1/conv2" + type: "Convolution" + bottom: "stage6_1/conv1" + top: "stage6_1/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage6_1/conv3" + type: "Convolution" + bottom: "stage6_1/conv2" + top: "stage6_1/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage6_1/sum" + type: "Eltwise" + bottom: "stage6_1/conv4" + bottom: "stage6_1/conv3" + top: "stage6_1/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage6_1/relu" + type: "ReLU" + bottom: "stage6_1/sum" + top: "stage6_1/sum" +} +layer { + name: "stage6_2/conv1" + type: "Convolution" + bottom: "stage6_1/sum" + top: "stage6_2/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage6_2/conv1/relu" + type: "ReLU" + bottom: "stage6_2/conv1" + top: "stage6_2/conv1" +} +layer { + name: "stage6_2/conv2" + type: "Convolution" + bottom: "stage6_2/conv1" + top: "stage6_2/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage6_2/conv3" + type: "Convolution" + bottom: "stage6_2/conv2" + top: "stage6_2/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage6_2/sum" + type: "Eltwise" + bottom: "stage6_1/sum" + bottom: "stage6_2/conv3" + top: "stage6_2/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage6_2/relu" + type: "ReLU" + bottom: "stage6_2/sum" + top: "stage6_2/sum" +} +layer { + name: "stage7_1/conv4" + type: "Convolution" + bottom: "stage6_2/sum" + top: "stage7_1/conv4" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage7_1/conv1" + type: "Convolution" + bottom: "stage6_2/sum" + top: "stage7_1/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage7_1/conv1/relu" + type: "ReLU" + bottom: "stage7_1/conv1" + top: "stage7_1/conv1" +} +layer { + name: "stage7_1/conv2" + type: "Convolution" + bottom: "stage7_1/conv1" + top: "stage7_1/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage7_1/conv3" + type: "Convolution" + bottom: "stage7_1/conv2" + top: "stage7_1/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage7_1/sum" + type: "Eltwise" + bottom: "stage7_1/conv4" + bottom: "stage7_1/conv3" + top: "stage7_1/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage7_1/relu" + type: "ReLU" + bottom: "stage7_1/sum" + top: "stage7_1/sum" +} +layer { + name: "stage7_2/conv1" + type: "Convolution" + bottom: "stage7_1/sum" + top: "stage7_2/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage7_2/conv1/relu" + type: "ReLU" + bottom: "stage7_2/conv1" + top: "stage7_2/conv1" +} +layer { + name: "stage7_2/conv2" + type: "Convolution" + bottom: "stage7_2/conv1" + top: "stage7_2/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage7_2/conv3" + type: "Convolution" + bottom: "stage7_2/conv2" + top: "stage7_2/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage7_2/sum" + type: "Eltwise" + bottom: "stage7_1/sum" + bottom: "stage7_2/conv3" + top: "stage7_2/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage7_2/relu" + type: "ReLU" + bottom: "stage7_2/sum" + top: "stage7_2/sum" +} +layer { + name: "stage8_1/conv4" + type: "Convolution" + bottom: "stage7_2/sum" + top: "stage8_1/conv4" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage8_1/conv1" + type: "Convolution" + bottom: "stage7_2/sum" + top: "stage8_1/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage8_1/conv1/relu" + type: "ReLU" + bottom: "stage8_1/conv1" + top: "stage8_1/conv1" +} +layer { + name: "stage8_1/conv2" + type: "Convolution" + bottom: "stage8_1/conv1" + top: "stage8_1/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage8_1/conv3" + type: "Convolution" + bottom: "stage8_1/conv2" + top: "stage8_1/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage8_1/sum" + type: "Eltwise" + bottom: "stage8_1/conv4" + bottom: "stage8_1/conv3" + top: "stage8_1/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage8_1/relu" + type: "ReLU" + bottom: "stage8_1/sum" + top: "stage8_1/sum" +} +layer { + name: "stage8_2/conv1" + type: "Convolution" + bottom: "stage8_1/sum" + top: "stage8_2/conv1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage8_2/conv1/relu" + type: "ReLU" + bottom: "stage8_2/conv1" + top: "stage8_2/conv1" +} +layer { + name: "stage8_2/conv2" + type: "Convolution" + bottom: "stage8_2/conv1" + top: "stage8_2/conv2" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 32 + pad: 2 + kernel_size: 3 + group: 32 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 2 + } +} +layer { + name: "stage8_2/conv3" + type: "Convolution" + bottom: "stage8_2/conv2" + top: "stage8_2/conv3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + convolution_param { + num_output: 128 + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "stage8_2/sum" + type: "Eltwise" + bottom: "stage8_1/sum" + bottom: "stage8_2/conv3" + top: "stage8_2/sum" + eltwise_param { + operation: SUM + } +} +layer { + name: "stage8_2/relu" + type: "ReLU" + bottom: "stage8_2/sum" + top: "stage8_2/sum" +} +layer { + name: "cls1/conv" + type: "Convolution" + bottom: "stage4_8/sum" + top: "cls1/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 12 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "cls1/permute" + type: "Permute" + bottom: "cls1/conv" + top: "cls1/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "cls1/flatten" + type: "Flatten" + bottom: "cls1/permute" + top: "cls1/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "loc1/conv" + type: "Convolution" + bottom: "stage4_8/sum" + top: "loc1/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 24 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "loc1/permute" + type: "Permute" + bottom: "loc1/conv" + top: "loc1/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "loc1/flatten" + type: "Flatten" + bottom: "loc1/permute" + top: "loc1/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "stage4_8/sum/prior_box" + type: "PriorBox" + bottom: "stage4_8/sum" + bottom: "data" + top: "stage4_8/sum/prior_box" + prior_box_param { + min_size: 50.0 + max_size: 100.0 + aspect_ratio: 2.0 + aspect_ratio: 0.5 + aspect_ratio: 3.0 + aspect_ratio: 0.3333333432674408 + flip: false + clip: false + variance: 0.10000000149011612 + variance: 0.10000000149011612 + variance: 0.20000000298023224 + variance: 0.20000000298023224 + step: 16.0 + } +} +layer { + name: "cls2/conv" + type: "Convolution" + bottom: "stage5_4/sum" + top: "cls2/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 12 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "cls2/permute" + type: "Permute" + bottom: "cls2/conv" + top: "cls2/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "cls2/flatten" + type: "Flatten" + bottom: "cls2/permute" + top: "cls2/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "loc2/conv" + type: "Convolution" + bottom: "stage5_4/sum" + top: "loc2/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 24 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "loc2/permute" + type: "Permute" + bottom: "loc2/conv" + top: "loc2/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "loc2/flatten" + type: "Flatten" + bottom: "loc2/permute" + top: "loc2/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "stage5_4/sum/prior_box" + type: "PriorBox" + bottom: "stage5_4/sum" + bottom: "data" + top: "stage5_4/sum/prior_box" + prior_box_param { + min_size: 100.0 + max_size: 150.0 + aspect_ratio: 2.0 + aspect_ratio: 0.5 + aspect_ratio: 3.0 + aspect_ratio: 0.3333333432674408 + flip: false + clip: false + variance: 0.10000000149011612 + variance: 0.10000000149011612 + variance: 0.20000000298023224 + variance: 0.20000000298023224 + step: 32.0 + } +} +layer { + name: "cls3/conv" + type: "Convolution" + bottom: "stage6_2/sum" + top: "cls3/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 12 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "cls3/permute" + type: "Permute" + bottom: "cls3/conv" + top: "cls3/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "cls3/flatten" + type: "Flatten" + bottom: "cls3/permute" + top: "cls3/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "loc3/conv" + type: "Convolution" + bottom: "stage6_2/sum" + top: "loc3/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 24 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "loc3/permute" + type: "Permute" + bottom: "loc3/conv" + top: "loc3/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "loc3/flatten" + type: "Flatten" + bottom: "loc3/permute" + top: "loc3/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "stage6_2/sum/prior_box" + type: "PriorBox" + bottom: "stage6_2/sum" + bottom: "data" + top: "stage6_2/sum/prior_box" + prior_box_param { + min_size: 150.0 + max_size: 200.0 + aspect_ratio: 2.0 + aspect_ratio: 0.5 + aspect_ratio: 3.0 + aspect_ratio: 0.3333333432674408 + flip: false + clip: false + variance: 0.10000000149011612 + variance: 0.10000000149011612 + variance: 0.20000000298023224 + variance: 0.20000000298023224 + step: 32.0 + } +} +layer { + name: "cls4/conv" + type: "Convolution" + bottom: "stage7_2/sum" + top: "cls4/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 12 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "cls4/permute" + type: "Permute" + bottom: "cls4/conv" + top: "cls4/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "cls4/flatten" + type: "Flatten" + bottom: "cls4/permute" + top: "cls4/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "loc4/conv" + type: "Convolution" + bottom: "stage7_2/sum" + top: "loc4/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 24 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "loc4/permute" + type: "Permute" + bottom: "loc4/conv" + top: "loc4/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "loc4/flatten" + type: "Flatten" + bottom: "loc4/permute" + top: "loc4/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "stage7_2/sum/prior_box" + type: "PriorBox" + bottom: "stage7_2/sum" + bottom: "data" + top: "stage7_2/sum/prior_box" + prior_box_param { + min_size: 200.0 + max_size: 300.0 + aspect_ratio: 2.0 + aspect_ratio: 0.5 + aspect_ratio: 3.0 + aspect_ratio: 0.3333333432674408 + flip: false + clip: false + variance: 0.10000000149011612 + variance: 0.10000000149011612 + variance: 0.20000000298023224 + variance: 0.20000000298023224 + step: 32.0 + } +} +layer { + name: "cls5/conv" + type: "Convolution" + bottom: "stage8_2/sum" + top: "cls5/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 12 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "cls5/permute" + type: "Permute" + bottom: "cls5/conv" + top: "cls5/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "cls5/flatten" + type: "Flatten" + bottom: "cls5/permute" + top: "cls5/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "loc5/conv" + type: "Convolution" + bottom: "stage8_2/sum" + top: "loc5/conv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 24 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + dilation: 1 + } +} +layer { + name: "loc5/permute" + type: "Permute" + bottom: "loc5/conv" + top: "loc5/permute" + permute_param { + order: 0 + order: 2 + order: 3 + order: 1 + } +} +layer { + name: "loc5/flatten" + type: "Flatten" + bottom: "loc5/permute" + top: "loc5/flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "stage8_2/sum/prior_box" + type: "PriorBox" + bottom: "stage8_2/sum" + bottom: "data" + top: "stage8_2/sum/prior_box" + prior_box_param { + min_size: 300.0 + max_size: 400.0 + aspect_ratio: 2.0 + aspect_ratio: 0.5 + aspect_ratio: 3.0 + aspect_ratio: 0.3333333432674408 + flip: false + clip: false + variance: 0.10000000149011612 + variance: 0.10000000149011612 + variance: 0.20000000298023224 + variance: 0.20000000298023224 + step: 32.0 + } +} +layer { + name: "mbox_conf" + type: "Concat" + bottom: "cls1/flatten" + bottom: "cls2/flatten" + bottom: "cls3/flatten" + bottom: "cls4/flatten" + bottom: "cls5/flatten" + top: "mbox_conf" + concat_param { + axis: 1 + } +} +layer { + name: "mbox_loc" + type: "Concat" + bottom: "loc1/flatten" + bottom: "loc2/flatten" + bottom: "loc3/flatten" + bottom: "loc4/flatten" + bottom: "loc5/flatten" + top: "mbox_loc" + concat_param { + axis: 1 + } +} +layer { + name: "mbox_priorbox" + type: "Concat" + bottom: "stage4_8/sum/prior_box" + bottom: "stage5_4/sum/prior_box" + bottom: "stage6_2/sum/prior_box" + bottom: "stage7_2/sum/prior_box" + bottom: "stage8_2/sum/prior_box" + top: "mbox_priorbox" + concat_param { + axis: 2 + } +} +layer { + name: "mbox_conf_reshape" + type: "Reshape" + bottom: "mbox_conf" + top: "mbox_conf_reshape" + reshape_param { + shape { + dim: 0 + dim: -1 + dim: 2 + } + } +} +layer { + name: "mbox_conf_softmax" + type: "Softmax" + bottom: "mbox_conf_reshape" + top: "mbox_conf_softmax" + softmax_param { + axis: 2 + } +} +layer { + name: "mbox_conf_flatten" + type: "Flatten" + bottom: "mbox_conf_softmax" + top: "mbox_conf_flatten" + flatten_param { + axis: 1 + } +} +layer { + name: "detection_output" + type: "DetectionOutput" + bottom: "mbox_loc" + bottom: "mbox_conf_flatten" + bottom: "mbox_priorbox" + top: "detection_output" + detection_output_param { + num_classes: 2 + share_location: true + background_label_id: 0 + nms_param { + nms_threshold: 0.44999998807907104 + top_k: 100 + } + code_type: CENTER_SIZE + keep_top_k: 100 + confidence_threshold: 0.20000000298023224 + } +} diff --git a/test/OpenCvSharp.Tests/_data/wechat_qrcode/sr.caffemodel b/test/OpenCvSharp.Tests/_data/wechat_qrcode/sr.caffemodel new file mode 100644 index 000000000..168b54d43 Binary files /dev/null and b/test/OpenCvSharp.Tests/_data/wechat_qrcode/sr.caffemodel differ diff --git a/test/OpenCvSharp.Tests/_data/wechat_qrcode/sr.prototxt b/test/OpenCvSharp.Tests/_data/wechat_qrcode/sr.prototxt new file mode 100644 index 000000000..e85caa177 --- /dev/null +++ b/test/OpenCvSharp.Tests/_data/wechat_qrcode/sr.prototxt @@ -0,0 +1,403 @@ +layer { + name: "data" + type: "Input" + top: "data" + input_param { + shape { + dim: 1 + dim: 1 + dim: 224 + dim: 224 + } + } +} +layer { + name: "conv0" + type: "Convolution" + bottom: "data" + top: "conv0" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 32 + bias_term: true + pad: 1 + kernel_size: 3 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "conv0/lrelu" + type: "ReLU" + bottom: "conv0" + top: "conv0" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db1/reduce" + type: "Convolution" + bottom: "conv0" + top: "db1/reduce" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 8 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "db1/reduce/lrelu" + type: "ReLU" + bottom: "db1/reduce" + top: "db1/reduce" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db1/3x3" + type: "Convolution" + bottom: "db1/reduce" + top: "db1/3x3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 8 + bias_term: true + pad: 1 + kernel_size: 3 + group: 8 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "db1/3x3/lrelu" + type: "ReLU" + bottom: "db1/3x3" + top: "db1/3x3" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db1/1x1" + type: "Convolution" + bottom: "db1/3x3" + top: "db1/1x1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 32 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "db1/1x1/lrelu" + type: "ReLU" + bottom: "db1/1x1" + top: "db1/1x1" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db1/concat" + type: "Concat" + bottom: "conv0" + bottom: "db1/1x1" + top: "db1/concat" + concat_param { + axis: 1 + } +} +layer { + name: "db2/reduce" + type: "Convolution" + bottom: "db1/concat" + top: "db2/reduce" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 8 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "db2/reduce/lrelu" + type: "ReLU" + bottom: "db2/reduce" + top: "db2/reduce" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db2/3x3" + type: "Convolution" + bottom: "db2/reduce" + top: "db2/3x3" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 8 + bias_term: true + pad: 1 + kernel_size: 3 + group: 8 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "db2/3x3/lrelu" + type: "ReLU" + bottom: "db2/3x3" + top: "db2/3x3" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db2/1x1" + type: "Convolution" + bottom: "db2/3x3" + top: "db2/1x1" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 32 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "db2/1x1/lrelu" + type: "ReLU" + bottom: "db2/1x1" + top: "db2/1x1" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "db2/concat" + type: "Concat" + bottom: "db1/concat" + bottom: "db2/1x1" + top: "db2/concat" + concat_param { + axis: 1 + } +} +layer { + name: "upsample/reduce" + type: "Convolution" + bottom: "db2/concat" + top: "upsample/reduce" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 32 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "upsample/reduce/lrelu" + type: "ReLU" + bottom: "upsample/reduce" + top: "upsample/reduce" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "upsample/deconv" + type: "Deconvolution" + bottom: "upsample/reduce" + top: "upsample/deconv" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 32 + bias_term: true + pad: 1 + kernel_size: 3 + group: 32 + stride: 2 + weight_filler { + type: "msra" + } + } +} +layer { + name: "upsample/lrelu" + type: "ReLU" + bottom: "upsample/deconv" + top: "upsample/deconv" + relu_param { + negative_slope: 0.05000000074505806 + } +} +layer { + name: "upsample/rec" + type: "Convolution" + bottom: "upsample/deconv" + top: "upsample/rec" + param { + lr_mult: 1.0 + decay_mult: 1.0 + } + param { + lr_mult: 1.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 1 + bias_term: true + pad: 0 + kernel_size: 1 + group: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "nearest" + type: "Deconvolution" + bottom: "data" + top: "nearest" + param { + lr_mult: 0.0 + decay_mult: 0.0 + } + convolution_param { + num_output: 1 + bias_term: false + pad: 0 + kernel_size: 2 + group: 1 + stride: 2 + weight_filler { + type: "constant" + value: 1.0 + } + } +} +layer { + name: "Crop1" + type: "Crop" + bottom: "nearest" + bottom: "upsample/rec" + top: "Crop1" +} +layer { + name: "fc" + type: "Eltwise" + bottom: "Crop1" + bottom: "upsample/rec" + top: "fc" + eltwise_param { + operation: SUM + } +} diff --git a/test/OpenCvSharp.Tests/aruco/ArucoTest.cs b/test/OpenCvSharp.Tests/aruco/ArucoTest.cs new file mode 100644 index 000000000..660161667 --- /dev/null +++ b/test/OpenCvSharp.Tests/aruco/ArucoTest.cs @@ -0,0 +1,147 @@ +using System.Diagnostics; +using OpenCvSharp.Aruco; +using Xunit; + +namespace OpenCvSharp.Tests.Aruco; + +// ReSharper disable once InconsistentNaming +public class ArucoTest : TestBase +{ + [Fact] + public void CreateDetectorParameters() + { + var param = new DetectorParameters(); + Assert.Equal(3, param.AdaptiveThreshWinSizeMin); + Assert.Equal(23, param.AdaptiveThreshWinSizeMax); + Assert.Equal(10, param.AdaptiveThreshWinSizeStep); + Assert.Equal(7, param.AdaptiveThreshConstant); + Assert.Equal(0.03, param.MinMarkerPerimeterRate, 3); + Assert.Equal(4, param.MaxMarkerPerimeterRate, 3); + Assert.Equal(0.03, param.PolygonalApproxAccuracyRate, 3); + Assert.Equal(0.05, param.MinCornerDistanceRate, 3); + Assert.Equal(3, param.MinDistanceToBorder); + Assert.Equal(0.05, param.MinMarkerDistanceRate, 3); + Assert.Equal(CornerRefineMethod.None, param.CornerRefinementMethod); + Assert.Equal(5, param.CornerRefinementWinSize); + Assert.Equal(30, param.CornerRefinementMaxIterations); + Assert.Equal(0.1, param.CornerRefinementMinAccuracy, 3); + Assert.Equal(1, param.MarkerBorderBits); + Assert.Equal(4, param.PerspectiveRemovePixelPerCell); + Assert.Equal(0.13, param.PerspectiveRemoveIgnoredMarginPerCell, 3); + Assert.Equal(0.35, param.MaxErroneousBitsInBorderRate, 3); + Assert.Equal(5.0, param.MinOtsuStdDev, 3); + Assert.Equal(0.6, param.ErrorCorrectionRate, 3); + Assert.Equal(0f, param.AprilTagQuadDecimate, 1e-3); + Assert.Equal(0f, param.AprilTagQuadSigma, 1e-3); + Assert.Equal(5, param.AprilTagMinClusterPixels); + Assert.Equal(10, param.AprilTagMaxNmaxima); + Assert.Equal(0.175f, param.AprilTagCriticalRad, 1e-3); + Assert.Equal(10f, param.AprilTagMaxLineFitMse, 1e-3); + Assert.Equal(0, param.AprilTagDeglitch); + Assert.Equal(5, param.AprilTagMinWhiteBlackDiff); + Assert.False(param.DetectInvertedMarker); + Assert.False(param.UseAruco3Detection); + Assert.Equal(32, param.MinSideLengthCanonicalImg); + Assert.Equal(0, param.MinMarkerLengthRatioOriginalImg); + } + + [Fact] + public void GetPredefinedDictionary() + { +#pragma warning disable CS8605 + foreach (PredefinedDictionaryName val in Enum.GetValues(typeof(PredefinedDictionaryName))) +#pragma warning restore CS8605 + { + var dict = CvAruco.GetPredefinedDictionary(val); + dict.Dispose(); + } + } + + [Fact] + public void ReadDictionaryFromFile() + { + var dictionaryFile = Path.Combine("_data", "aruco", "Dict6X6_1000.yaml"); + var toCompareWith = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_1000); + var dict = CvAruco.ReadDictionary(dictionaryFile); + + Assert.Equal(toCompareWith.BytesList.Rows, dict.BytesList.Rows); + Assert.Equal(toCompareWith.BytesList.Cols, dict.BytesList.Cols); + Assert.Equal(toCompareWith.MarkerSize, dict.MarkerSize); + Assert.Equal(toCompareWith.MaxCorrectionBits, dict.MaxCorrectionBits); + + var dictData = dict.BytesList.ToBytes(); + var refData = toCompareWith.BytesList.ToBytes(); + + for (int idx = 0; idx < dictData.Length; idx++) + Assert.Equal(refData[idx], dictData[idx]); + + toCompareWith.Dispose(); + dict.Dispose(); + } + + [Fact] + public void DetectMarkers() + { + using var image = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale); + using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250); + + var param = new DetectorParameters(); + CvAruco.DetectMarkers(image, dict, out _, out _, param, out _); + } + + [Fact] + public void DictionaryProperties() + { + var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250); + Assert.Equal(250, dict.BytesList.Rows); + Assert.Equal(5, dict.BytesList.Cols); // (6*6 + 7)/8 + Assert.Equal(6, dict.MarkerSize); + Assert.Equal(5, dict.MaxCorrectionBits); + + dict.MarkerSize = 4; + dict.MaxCorrectionBits = 50; + Assert.Equal(4, dict.MarkerSize); + Assert.Equal(50, dict.MaxCorrectionBits); + } + + [Fact] + public void DrawDetectedMarker() + { + using var image = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale); + using var outputImage = image.CvtColor(ColorConversionCodes.GRAY2RGB); + using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250); + var param = new DetectorParameters(); + CvAruco.DetectMarkers(image, dict, out var corners, out var ids, param, out var rejectedImgPoints); + + CvAruco.DrawDetectedMarkers(outputImage, corners, ids, new Scalar(255, 0, 0)); + CvAruco.DrawDetectedMarkers(outputImage, rejectedImgPoints, null, new Scalar(0, 0, 255)); + + if (Debugger.IsAttached) + { + // If you want to save markers image, you must change the following values. + const string path = "C:\\detected_markers_6x6_250.png"; + Cv2.ImWrite(path, outputImage); + Process.Start(path); + } + } + + [Fact] + public void EstimatePoseSingleMarkers() + { + using var image = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale); + using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250); + var param = new DetectorParameters(); + CvAruco.DetectMarkers(image, dict, out var corners, out _, param, out _); + + using var cameraMatrix = Mat.Eye(3, 3, MatType.CV_64FC1); + using var distCoeffs = Mat.Zeros(4, 1, MatType.CV_64FC1); + using var rvec = new Mat(); + using var tvec = new Mat(); + using var objPoints = new Mat(); + CvAruco.EstimatePoseSingleMarkers(corners, 6, cameraMatrix, distCoeffs, rvec, tvec, objPoints); + + Assert.Equal(20, rvec.Total()); + Assert.Equal(20, tvec.Total()); + Assert.Equal(4, objPoints.Total()); + } +} diff --git a/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs b/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs new file mode 100644 index 000000000..d7e04fe8a --- /dev/null +++ b/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs @@ -0,0 +1,521 @@ +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using Xunit; +using Xunit.Abstractions; + +// ReSharper disable UnusedVariable +// ReSharper disable RedundantArgumentDefaultValue +// ReSharper disable JoinDeclarationAndInitializer + +namespace OpenCvSharp.Tests.Calib3D; + +public class Calib3DTest(ITestOutputHelper output) : TestBase +{ + [Fact] + public void Rodrigues() + { + const double angle = 45; + var cos = Math.Cos(angle * Math.PI / 180); + var sin = Math.Sin(angle * Math.PI / 180); + var matrix = new double[3, 3] + { + {cos, -sin, 0}, + {sin, cos, 0}, + {0, 0, 1} + }; + + Cv2.Rodrigues(matrix, out var vector, out var jacobian); + + Assert.NotNull(vector); + Assert.Equal(3, vector.Length); + Assert.Equal(0, vector[0], 3); + Assert.Equal(0, vector[1], 3); + Assert.Equal(0.785, vector[2], 3); + Assert.NotNull(jacobian); + Assert.Equal(9, jacobian.GetLength(0)); + Assert.Equal(3, jacobian.GetLength(1)); + + Cv2.Rodrigues(vector, out var matrix2, out var jacobian2); + + Assert.NotNull(matrix2); + Assert.NotNull(jacobian2); + Assert.Equal(3, matrix2.GetLength(0)); + Assert.Equal(3, matrix2.GetLength(1)); + for (var i = 0; i < matrix2.GetLength(0); i++) + for (var j = 0; j < matrix2.GetLength(1); j++) + Assert.Equal(matrix[i, j], matrix2[i, j], 3); + } + + [Fact] + public void CheckChessboard() + { + var patternSize = new Size(10, 7); + + using var image1 = LoadImage("calibration/00.jpg", ImreadModes.Grayscale); + using var image2 = LoadImage("lenna.png", ImreadModes.Grayscale); + Assert.True(Cv2.CheckChessboard(image1, patternSize)); + Assert.False(Cv2.CheckChessboard(image2, patternSize)); + } + + [Fact] + public void FindChessboardCorners() + { + var patternSize = new Size(10, 7); + + using var image = LoadImage("calibration/00.jpg"); + using var corners = new Mat(); + var found = Cv2.FindChessboardCorners(image, patternSize, corners); + + if (Debugger.IsAttached) + { + Cv2.DrawChessboardCorners(image, patternSize, corners, found); + Window.ShowImages(image); + } + + Assert.True(found); + Assert.Equal(70, corners.Total()); + Assert.Equal(MatType.CV_32FC2, corners.Type()); + } + + [Fact] + public void FindChessboardCornersSB() + { + var patternSize = new Size(10, 7); + + using var image = LoadImage("calibration/00.jpg"); + using var corners = new Mat(); + var found = Cv2.FindChessboardCornersSB(image, patternSize, corners); + + if (Debugger.IsAttached) + { + Cv2.DrawChessboardCorners(image, patternSize, corners, found); + Window.ShowImages(image); + } + + // TODO fail on appveyor + //Assert.True(found); + if (found) + { + Assert.Equal(70, corners.Total()); + Assert.Equal(MatType.CV_32FC2, corners.Type()); + } + else + { + output.WriteLine(@"!!! [FindChessboardCornersSB] chessboard not found"); + } + } + + [Fact] + public void CalibrateCameraByArray() + { + var patternSize = new Size(10, 7); + + using var image = LoadImage("calibration/00.jpg"); + using var corners = new Mat(); + Cv2.FindChessboardCorners(image, patternSize, corners); + + var objectPoints = Create3DChessboardCorners(patternSize, 1.0f); + var imagePoints = corners.ToArray(); + var cameraMatrix = new double[,] { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; + var distCoeffs = new double[5]; + + var rms = Cv2.CalibrateCamera([objectPoints], [imagePoints], image.Size(), cameraMatrix, + distCoeffs, out var rotationVectors, out var translationVectors, + CalibrationFlags.UseIntrinsicGuess | CalibrationFlags.FixK5); + + Assert.Equal(6.16, rms, 2); + Assert.Contains(distCoeffs, d => Math.Abs(d) > 1e-20); + } + + [Fact] + public void CalibrateCameraByMat() + { + var patternSize = new Size(10, 7); + + using var image = LoadImage("calibration/00.jpg"); + using var corners = new Mat(); + Cv2.FindChessboardCorners(image, patternSize, corners); + + var objectPointsArray = Create3DChessboardCorners(patternSize, 1.0f).ToArray(); + var imagePointsArray = corners.ToArray(); + + using var objectPoints = Mat.FromArray(objectPointsArray); + using var imagePoints = Mat.FromArray(imagePointsArray); + using var cameraMatrix = new Mat(Mat.Eye(3, 3, MatType.CV_64FC1)); + using var distCoeffs = new Mat(); + var rms = Cv2.CalibrateCamera([objectPoints], [imagePoints], image.Size(), cameraMatrix, + distCoeffs, out var rotationVectors, out var translationVectors, + CalibrationFlags.UseIntrinsicGuess | CalibrationFlags.FixK5); + + var distCoeffValues = distCoeffs.ToArray(); + Assert.Equal(6.16, rms, 2); + Assert.Contains(distCoeffValues, d => Math.Abs(d) > 1e-20); + } + + [Fact] + public void FishEyeCalibrate() + { + var patternSize = new Size(10, 7); + + using var image = LoadImage("calibration/00.jpg"); + using var corners = new Mat(); + Cv2.FindChessboardCorners(image, patternSize, corners); + + var objectPointsArray = Create3DChessboardCorners(patternSize, 1.0f).ToArray(); + var imagePointsArray = corners.ToArray(); + + using var objectPoints = Mat.FromArray(objectPointsArray); + using var imagePoints = Mat.FromArray(imagePointsArray); + using var cameraMatrix = new Mat(Mat.Eye(3, 3, MatType.CV_64FC1)); + using var distCoeffs = new Mat(); + var rms = Cv2.FishEye.Calibrate([objectPoints], [imagePoints], image.Size(), cameraMatrix, + distCoeffs, out var rotationVectors, out var translationVectors); + + var distCoeffValues = distCoeffs.ToArray(); + //Assert.Equal(109.35, rms, 2); + Assert.True(rms > 10, $"rms = {rms}"); + Assert.Contains(distCoeffValues, d => Math.Abs(d) > 1e-20); + Assert.NotEmpty(rotationVectors); + Assert.NotEmpty(translationVectors); + } + + /// + /// https://stackoverflow.com/questions/25244603/opencvs-projectpoints-function + /// + [Fact] + [SuppressMessage("ReSharper", "RedundantTypeArgumentsOfMethod")] + public void ProjectPoints() + { + var objectPointsArray = Generate3DPoints().ToArray(); + using var objectPoints = Mat.FromPixelData(objectPointsArray.Length, 1, MatType.CV_64FC3, objectPointsArray); + + using var intrinsicMat = new Mat(3, 3, MatType.CV_64FC1); + intrinsicMat.Set(0, 0, 1.6415318549788924e+003); + intrinsicMat.Set(1, 0, 0); + intrinsicMat.Set(2, 0, 0); + intrinsicMat.Set(0, 1, 0); + intrinsicMat.Set(1, 1, 1.7067753507885654e+003); + intrinsicMat.Set(2, 1, 0); + intrinsicMat.Set(0, 2, 5.3262822453148601e+002); + intrinsicMat.Set(1, 2, 3.8095355839052968e+002); + intrinsicMat.Set(2, 2, 1); + + using var rVec = new Mat(3, 1, MatType.CV_64FC1); + rVec.Set(0, -3.9277902400761393e-002); + rVec.Set(1, 3.7803824407602084e-002); + rVec.Set(2, 2.6445674487856268e-002); + + using var tVec = new Mat(3, 1, MatType.CV_64FC1); + tVec.Set(0, 2.1158489381208221e+000); + tVec.Set(1, -7.6847683212704716e+000); + tVec.Set(2, 2.6169795190294256e+001); + + using var distCoeffs = new Mat(4, 1, MatType.CV_64FC1); + distCoeffs.Set(0, 0); + distCoeffs.Set(1, 0); + distCoeffs.Set(2, 0); + distCoeffs.Set(3, 0); + + // without jacobian + using var imagePoints = new Mat(); + Cv2.ProjectPoints(objectPoints, rVec, tVec, intrinsicMat, distCoeffs, imagePoints); + + // with jacobian + using var jacobian = new Mat(); + Cv2.ProjectPoints(objectPoints, rVec, tVec, intrinsicMat, distCoeffs, imagePoints, jacobian); + } + + /// + /// https://stackoverflow.com/questions/25244603/opencvs-projectpoints-function + /// + [Fact] + [SuppressMessage("ReSharper", "RedundantTypeArgumentsOfMethod")] + public void FishEyeProjectPoints() + { + var objectPointsArray = Generate3DPoints().ToArray(); + using var objectPoints = Mat.FromPixelData(objectPointsArray.Length, 1, MatType.CV_64FC3, objectPointsArray); + + using var intrisicMat = new Mat(3, 3, MatType.CV_64FC1); + intrisicMat.Set(0, 0, 1.6415318549788924e+003); + intrisicMat.Set(1, 0, 0); + intrisicMat.Set(2, 0, 0); + intrisicMat.Set(0, 1, 0); + intrisicMat.Set(1, 1, 1.7067753507885654e+003); + intrisicMat.Set(2, 1, 0); + intrisicMat.Set(0, 2, 5.3262822453148601e+002); + intrisicMat.Set(1, 2, 3.8095355839052968e+002); + intrisicMat.Set(2, 2, 1); + + using var rVec = new Mat(3, 1, MatType.CV_64FC1); + rVec.Set(0, -3.9277902400761393e-002); + rVec.Set(1, 3.7803824407602084e-002); + rVec.Set(2, 2.6445674487856268e-002); + + using var tVec = new Mat(3, 1, MatType.CV_64FC1); + tVec.Set(0, 2.1158489381208221e+000); + tVec.Set(1, -7.6847683212704716e+000); + tVec.Set(2, 2.6169795190294256e+001); + + using var distCoeffs = new Mat(4, 1, MatType.CV_64FC1); + distCoeffs.Set(0, 0); + distCoeffs.Set(1, 0); + distCoeffs.Set(2, 0); + distCoeffs.Set(3, 0); + + // without jacobian + using var imagePoints = new Mat(); + Cv2.FishEye.ProjectPoints(objectPoints, imagePoints, rVec, tVec, intrisicMat, distCoeffs, 0); + + // with jacobian + using var jacobian = new Mat(); + Cv2.FishEye.ProjectPoints(objectPoints, imagePoints, rVec, tVec, intrisicMat, distCoeffs, 0, jacobian); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void SolvePnPTestByArray(bool useExtrinsicGuess) + { + var rvec = new double[] { 3, 0, 0 }; + var tvec = new double[] { 0, 0, -10 }; + var cameraMatrix = new double[,] + { + { 1, 0, 0 }, + { 0, 1, 0 }, + { 0, 0, 1 } + }; + var dist = new double[] { 0, 0, 0, 0, 0 }; + + var objPts = new[] + { + new Point3f(0,0,1), + new Point3f(1,0,1), + new Point3f(0,1,1), + new Point3f(1,1,1), + new Point3f(1,0,2), + new Point3f(0,1,2) + }; + + Cv2.ProjectPoints(objPts, rvec, tvec, cameraMatrix, dist, out var imgPts, out var jacobian); + + Cv2.SolvePnP(objPts, imgPts, cameraMatrix, dist, ref rvec, ref tvec, useExtrinsicGuess: useExtrinsicGuess); + } + + [Fact] + public void SolvePnPTestByMat() + { + var rvec = new double[] { 0, 0, 0 }; + var tvec = new double[] { 0, 0, 0 }; + var cameraMatrix = new double[,] + { + { 1, 0, 0 }, + { 0, 1, 0 }, + { 0, 0, 1 } + }; + var dist = new double[] { 0, 0, 0, 0, 0 }; + + var objPts = new[] + { + new Point3f(0,0,1), + new Point3f(1,0,1), + new Point3f(0,1,1), + new Point3f(1,1,1), + new Point3f(1,0,2), + new Point3f(0,1,2) + }; + + Cv2.ProjectPoints(objPts, rvec, tvec, cameraMatrix, dist, out var imgPts, out var jacobian); + + using var objPtsMat = Mat.FromPixelData(objPts.Length, 1, MatType.CV_32FC3, objPts); + using var imgPtsMat = Mat.FromPixelData(imgPts.Length, 1, MatType.CV_32FC2, imgPts); + using var cameraMatrixMat = Mat.Eye(3, 3, MatType.CV_64FC1); + using var distMat = Mat.Zeros(5, 0, MatType.CV_64FC1); + using var rvecMat = new Mat(); + using var tvecMat = new Mat(); + Cv2.SolvePnP(objPtsMat, imgPtsMat, cameraMatrixMat, distMat, rvecMat, tvecMat); + } + + [Fact] + public void FindFundamentalMat() + { + var imgPt1 = new[] + { + new Point2d(1017.0883, 848.23529), + new Point2d(1637, 848.23529), + new Point2d(1637, 1648.7059), + new Point2d(1017.0883, 1648.7059), + new Point2d(2282.2144, 772), + new Point2d(3034.9644, 772), + new Point2d(3034.9644, 1744), + new Point2d(2282.2144, 1744), + }; + var imgPt2 = new[] + { + new Point2d(414.88824, 848.23529), + new Point2d(1034.8, 848.23529), + new Point2d(1034.8, 1648.7059), + new Point2d(414.88824, 1648.7059), + new Point2d(1550.9714, 772), + new Point2d(2303.7214, 772), + new Point2d(2303.7214, 1744), + new Point2d(1550.9714, 1744), + }; + + using var f = Cv2.FindFundamentalMat(imgPt1, imgPt2, FundamentalMatMethods.Point8); + Assert.True(f.Empty()); // TODO + } + + // https://github.com/shimat/opencvsharp/issues/1069 + [Fact] + public void RecoverPose() + { + var essentialData = new double[,] + { + {1.503247056657373e-16, -7.074103796034695e-16, -7.781514175638166e-16}, + {6.720398606232961e-16, -6.189840821530359e-17, -0.7071067811865476}, + {7.781514175638166e-16, 0.7071067811865475, -2.033804841359975e-16} + }; + using var essential = Mat.FromArray(essentialData); + + var p1Data = new[] + { + new Point2d(1017.0883, 848.23529), + new Point2d(1637, 848.23529), + new Point2d(1637, 1648.7059), + new Point2d(1017.0883, 1648.7059), + new Point2d(2282.2144, 772), + new Point2d(3034.9644, 772), + new Point2d(3034.9644, 1744), + new Point2d(2282.2144, 1744) + }; + var p2Data = new[] + { + new Point2d(414.88824, 848.23529), + new Point2d(1034.8, 848.23529), + new Point2d(1034.8, 1648.7059), + new Point2d(414.88824, 1648.7059), + new Point2d(1550.9714, 772), + new Point2d(2303.7214, 772), + new Point2d(2303.7214, 1744), + new Point2d(1550.9714, 1744) + }; + using var p1 = Mat.FromArray(p1Data); + using var p2 = Mat.FromArray(p2Data); + + var kData = new double[,] + { + {3011, 0, 1637}, + {0, 3024, 1204}, + {0, 0, 1} + }; + using var k = Mat.FromArray(kData); + + using var r = new Mat(); + using var t = new Mat(); + Cv2.RecoverPose(essential, p1, p2, k, r, t); + + Assert.False(r.Empty()); + Assert.False(t.Empty()); + } + + [Fact] + public void FindHomography() + { + var points1 = new Point2f[] + { + new(10, 20), + new(20, 30), + new(30, 40), + new(40, 50), + new(50, 60), + }; + var points2 = new Point2f[] + { + new(11, 22), + new(22, 33), + new(33, 44), + new(44, 55), + new(55, 66), + }; + + using var m1 = Mat.FromArray(points1); + using var m2 = Mat.FromArray(points2); + + using var dst = Cv2.FindHomography(m1, m2); + + Assert.False(dst.Empty()); + Assert.Equal(3, dst.Rows); + Assert.Equal(3, dst.Cols); + Assert.True(dst.GetArray(out double[] dstArray)); + Assert.Equal(9, dstArray.Length); + Assert.All(dstArray, d => + { + Assert.False(double.IsNaN(d)); + Assert.False(double.IsInfinity(d)); + }); + } + + [Fact] + public void FindHomographyUsac() + { + var points1 = Enumerable.Range(1, 5).Select(i => new Point2f(i * 10, i * 20)).ToArray(); + var points2 = points1.Select(p => new Point2f(p.X + p.X / 10, p.Y + p.Y / 10)).ToArray(); + + using var m1 = Mat.FromArray(points1); + using var m2 = Mat.FromArray(points2); + using var mask = new Mat(); + var usacParams = new UsacParams(); + + using var dst = Cv2.FindHomography(m1, m2, mask, usacParams); + + // TODO + /* + Assert.False(dst.Empty()); + Assert.Equal(3, dst.Rows); + Assert.Equal(3, dst.Cols); + Assert.True(dst.GetArray(out double[] dstArray)); + Assert.Equal(9, dstArray.Length); + Assert.All(dstArray, d => + { + Assert.False(double.IsNaN(d)); + Assert.False(double.IsInfinity(d)); + });*/ + } + + private static IEnumerable Create3DChessboardCorners(Size boardSize, float squareSize) + { + for (var y = 0; y < boardSize.Height; y++) + { + for (var x = 0; x < boardSize.Width; x++) + { + yield return new Point3f(x * squareSize, y * squareSize, 0); + } + } + } + + private static IEnumerable Generate3DPoints() + { + double x, y, z; + + x = .5; y = .5; z = -.5; + yield return new Point3d(x, y, z); + + x = .5; y = .5; z = .5; + yield return new Point3d(x, y, z); + + x = -.5; y = .5; z = .5; + yield return new Point3d(x, y, z); + + x = -.5; y = .5; z = -.5; + yield return new Point3d(x, y, z); + + x = .5; y = -.5; z = -.5; + yield return new Point3d(x, y, z); + + x = -.5; y = -.5; z = -.5; + yield return new Point3d(x, y, z); + + x = -.5; y = -.5; z = .5; + yield return new Point3d(x, y, z); + } +} diff --git a/test/OpenCvSharp.Tests/calib3d/StereoBMTest.cs b/test/OpenCvSharp.Tests/calib3d/StereoBMTest.cs index c159e7aaf..b77d1de63 100644 --- a/test/OpenCvSharp.Tests/calib3d/StereoBMTest.cs +++ b/test/OpenCvSharp.Tests/calib3d/StereoBMTest.cs @@ -1,32 +1,27 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NUnit.Framework; +using System.Diagnostics; +using Xunit; -namespace OpenCvSharp.Tests.Calib3D +namespace OpenCvSharp.Tests.Calib3D; + +public class StereoBMTest : TestBase { - [TestFixture] - public class StereoBMTest : TestBase + [Fact] + public void SimpleCompute() { - [Test] - public void SimpleCompute() - { - var left = Image("tsukuba_left.png", ImreadModes.GrayScale); - var right = Image("tsukuba_right.png", ImreadModes.GrayScale); + var left = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + var right = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); - var sbm = StereoBM.Create(); - var disparity = new Mat(); - sbm.Compute(left, right, disparity); + using var sbm = StereoBM.Create(); + var disparity = new Mat(); + sbm.Compute(left, right, disparity); - /* - double min, max; - Cv2.MinMaxLoc(disparity, out min, out max); + if (Debugger.IsAttached) + { + Cv2.MinMaxLoc(disparity, out double min, out double max); var disparityU8 = new Mat(); disparity.ConvertTo(disparityU8, MatType.CV_8UC1, 255 / (max - min), -255 * min / (max - min)); Window.ShowImages(disparityU8); - //*/ } } } - diff --git a/test/OpenCvSharp.Tests/calib3d/StereoSGBMTest.cs b/test/OpenCvSharp.Tests/calib3d/StereoSGBMTest.cs index 8517c6992..f2d4edeed 100644 --- a/test/OpenCvSharp.Tests/calib3d/StereoSGBMTest.cs +++ b/test/OpenCvSharp.Tests/calib3d/StereoSGBMTest.cs @@ -1,32 +1,27 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NUnit.Framework; +using System.Diagnostics; +using Xunit; -namespace OpenCvSharp.Tests.Calib3D +namespace OpenCvSharp.Tests.Calib3D; + +public class StereoSGBMTest : TestBase { - [TestFixture] - public class StereoSGBMTest : TestBase + [Fact] + public void SimpleCompute() { - [Test] - public void SimpleCompute() - { - var left = Image("tsukuba_left.png", ImreadModes.GrayScale); - var right = Image("tsukuba_right.png", ImreadModes.GrayScale); + var left = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + var right = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); - var sbm = StereoSGBM.Create(0, 32, 5); - var disparity = new Mat(); - sbm.Compute(left, right, disparity); + using var sbm = StereoSGBM.Create(0, 32, 5); + var disparity = new Mat(); + sbm.Compute(left, right, disparity); - /* - double min, max; - Cv2.MinMaxLoc(disparity, out min, out max); + if (Debugger.IsAttached) + { + Cv2.MinMaxLoc(disparity, out var min, out double max); var disparityU8 = new Mat(); disparity.ConvertTo(disparityU8, MatType.CV_8UC1, 255 / (max - min), -255 * min / (max - min)); Window.ShowImages(disparityU8); - //*/ } } } - diff --git a/test/OpenCvSharp.Tests/core/AlgorithmTest.cs b/test/OpenCvSharp.Tests/core/AlgorithmTest.cs index ab1b3c4e5..06c45b027 100644 --- a/test/OpenCvSharp.Tests/core/AlgorithmTest.cs +++ b/test/OpenCvSharp.Tests/core/AlgorithmTest.cs @@ -1,21 +1,16 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using OpenCvSharp.ML; +using OpenCvSharp.ML; +using Xunit; -namespace OpenCvSharp.Tests.Core +namespace OpenCvSharp.Tests.Core; + +public class AlgorithmTest : TestBase { - [TestFixture] - public class AlgorithmTest : TestBase + [Fact] + public void GetDefaultName() { - [Test] - public void GetDefaultName() + using (var model = SVM.Create()) { - using (var model = SVM.Create()) - { - Assert.AreEqual("opencv_ml_svm", model.GetDefaultName()); - } + Assert.Equal("opencv_ml_svm", model.GetDefaultName()); } } } - diff --git a/test/OpenCvSharp.Tests/core/CoreTest.cs b/test/OpenCvSharp.Tests/core/CoreTest.cs index 1d65186d9..b87e3d3e8 100644 --- a/test/OpenCvSharp.Tests/core/CoreTest.cs +++ b/test/OpenCvSharp.Tests/core/CoreTest.cs @@ -1,21 +1,470 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using System.Diagnostics; +using Xunit; -namespace OpenCvSharp.Tests.Core +#pragma warning disable CA5394 // Do not use insecure randomness +// ReSharper disable RedundantArgumentDefaultValue + +namespace OpenCvSharp.Tests.Core; + +public class CoreTest : TestBase { - [TestFixture] - public class CoreTest : TestBase + [Fact] + public void Add() + { + using var src1 = Mat.FromPixelData(2, 2, MatType.CV_8UC1, new byte[] { 1, 2, 3, 4 }); + using var src2 = Mat.FromPixelData(2, 2, MatType.CV_8UC1, new byte[] { 1, 2, 3, 4 }); + using var dst = new Mat(); + Cv2.Add(src1, src2, dst); + + Assert.Equal(MatType.CV_8UC1, dst.Type()); + Assert.Equal(2, dst.Rows); + Assert.Equal(2, dst.Cols); + + Assert.Equal(2, dst.At(0, 0)); + Assert.Equal(4, dst.At(0, 1)); + Assert.Equal(6, dst.At(1, 0)); + Assert.Equal(8, dst.At(1, 1)); + } + + [Fact] + public void AddScalar() + { + using var src = Mat.FromPixelData(2, 2, MatType.CV_8UC1, new byte[] { 1, 2, 3, 4 }); + using var dst = new Mat(); + Cv2.Add(new Scalar(10), src, dst); + + Assert.Equal(MatType.CV_8UC1, dst.Type()); + Assert.Equal(2, dst.Rows); + Assert.Equal(2, dst.Cols); + + Assert.Equal(11, dst.At(0, 0)); + Assert.Equal(12, dst.At(0, 1)); + Assert.Equal(13, dst.At(1, 0)); + Assert.Equal(14, dst.At(1, 1)); + + Cv2.Add(src, new Scalar(10), dst); + Assert.Equal(11, dst.At(0, 0)); + Assert.Equal(12, dst.At(0, 1)); + Assert.Equal(13, dst.At(1, 0)); + Assert.Equal(14, dst.At(1, 1)); + + using var inputArray = InputArray.Create(10.0); + Cv2.Add(src, inputArray, dst); + Assert.Equal(11, dst.At(0, 0)); + Assert.Equal(12, dst.At(0, 1)); + Assert.Equal(13, dst.At(1, 0)); + Assert.Equal(14, dst.At(1, 1)); + } + + [Fact] + public void Subtract() + { + using Mat image = LoadImage("lenna.png"); + using Mat dst1 = new (); + using Mat dst2 = new Scalar(255) - image; + Cv2.Subtract(new Scalar(255), image, dst1); + + ShowImagesWhenDebugMode(image, dst1, dst2); + + ImageEquals(dst1, dst2); + } + + [Fact] + public void SubtractScalar() + { + using var src = Mat.FromPixelData(3, 1, MatType.CV_16SC1, new short[]{1, 2, 3}); + using var dst = new Mat(); + Cv2.Subtract(src, 1, dst); + Assert.Equal(0, dst.Get(0)); + Assert.Equal(1, dst.Get(1)); + Assert.Equal(2, dst.Get(2)); + + Cv2.Subtract(1, src, dst); + Assert.Equal(0, dst.Get(0)); + Assert.Equal(-1, dst.Get(1)); + Assert.Equal(-2, dst.Get(2)); + } + + [Fact] + public void ScalarOperations() + { + var values = new[] { -1f }; + using var mat = Mat.FromPixelData(1, 1, MatType.CV_32FC1, values); + Assert.Equal(values[0], mat.Get(0, 0)); + + Cv2.Subtract(mat, 1, mat); + Assert.Equal(-2, mat.Get(0, 0)); + + Cv2.Multiply(mat, 2.0, mat); + Assert.Equal(-4, mat.Get(0, 0)); + + Cv2.Divide(mat, 2.0, mat); + Assert.Equal(-2, mat.Get(0, 0)); + + Cv2.Add(mat, 1, mat); + Assert.Equal(-1, mat.Get(0, 0)); + } + + [Fact] + public void MatExprSubtractWithScalar() + { + // MatExpr - Scalar + using (var src = Mat.FromPixelData(3, 1, MatType.CV_16SC1, new short[] { 1, 2, 3 })) + { + using MatExpr srcExpr = src; + using MatExpr dstExpr = srcExpr - new Scalar(1); + using Mat dst = dstExpr; + Assert.Equal(0, dst.Get(0)); + Assert.Equal(1, dst.Get(1)); + Assert.Equal(2, dst.Get(2)); + } + + // Scalar - MatExpr + using (var src = Mat.FromPixelData(3, 1, MatType.CV_16SC1, new short[] { 1, 2, 3 })) + { + using MatExpr srcExpr = src; + using MatExpr dstExpr = new Scalar(1) - srcExpr; + using Mat dst = dstExpr; + Assert.Equal(0, dst.Get(0)); + Assert.Equal(-1, dst.Get(1)); + Assert.Equal(-2, dst.Get(2)); + } + } + + [Fact] + public void Sum() + { + using Mat ones = Mat.Ones(10, 10, MatType.CV_8UC1); + Scalar sum = Cv2.Sum(ones); + Assert.Equal(100, (int)sum.Val0); + } + + [Fact] + public void Divide() + { + using var mat1 = Mat.FromPixelData(3, 1, MatType.CV_8UC1, new byte[] { 64, 128, 192 }); + using var mat2 = Mat.FromPixelData(3, 1, MatType.CV_8UC1, new byte[] { 2, 4, 8 }); + using var dst = new Mat(); + // default + Cv2.Divide(mat1, mat2, dst, 1, -1); + Assert.Equal(MatType.CV_8UC1, dst.Type()); + Assert.Equal(3, dst.Total()); + Assert.Equal(32, dst.Get(0)); + Assert.Equal(32, dst.Get(1)); + Assert.Equal(24, dst.Get(2)); + + // scale + Cv2.Divide(mat1, mat2, dst, 2, -1); + Assert.Equal(MatType.CV_8UC1, dst.Type()); + Assert.Equal(3, dst.Total()); + Assert.Equal(64, dst.Get(0)); + Assert.Equal(64, dst.Get(1)); + Assert.Equal(48, dst.Get(2)); + + // scale & dtype + Cv2.Divide(mat1, mat2, dst, 2, MatType.CV_32SC1); + Assert.Equal(MatType.CV_32SC1, dst.Type()); + Assert.Equal(3, dst.Total()); + Assert.Equal(64, dst.Get(0)); + Assert.Equal(64, dst.Get(1)); + Assert.Equal(48, dst.Get(2)); + } + + [Fact] + public void BorderInterpolate() { - [Test] - public void Sum() + Assert.Equal(3, Cv2.BorderInterpolate(3, 10, BorderTypes.Reflect)); + Assert.Equal(3, Cv2.BorderInterpolate(3, 10, BorderTypes.Replicate)); + Assert.Equal(3, Cv2.BorderInterpolate(3, 10, BorderTypes.Constant)); + + Assert.Equal(2, Cv2.BorderInterpolate(-3, 10, BorderTypes.Reflect)); + Assert.Equal(0, Cv2.BorderInterpolate(-3, 10, BorderTypes.Replicate)); + Assert.Equal(-1, Cv2.BorderInterpolate(-3, 10, BorderTypes.Constant)); + + Assert.Equal(6, Cv2.BorderInterpolate(13, 10, BorderTypes.Reflect)); + Assert.Equal(9, Cv2.BorderInterpolate(13, 10, BorderTypes.Replicate)); + Assert.Equal(-1, Cv2.BorderInterpolate(13, 10, BorderTypes.Constant)); + } + + [Fact] + public void CopyMakeBorder() + { + using var src = new Mat(10, 10, MatType.CV_8UC1, Scalar.All(0)); + using var dst = new Mat(); + const int top = 1, bottom = 2, left = 3, right = 4; + Cv2.CopyMakeBorder(src, dst, top, bottom, left, right, BorderTypes.Constant, Scalar.All(255)); + + using var expected = new Mat(src.Rows + top + bottom, src.Cols + left + right, src.Type(), Scalar.All(0)); + Cv2.Rectangle(expected, new Point(0, 0), new Point(expected.Cols, top - 1), Scalar.All(255), -1); + Cv2.Rectangle(expected, new Point(0, expected.Rows - bottom), new Point(expected.Cols, expected.Rows), Scalar.All(255), -1); + Cv2.Rectangle(expected, new Point(0, 0), new Point(left - 1, expected.Rows), Scalar.All(255), -1); + Cv2.Rectangle(expected, new Point(expected.Cols - right, 0), new Point(expected.Cols, expected.Rows), Scalar.All(255), -1); + + if (Debugger.IsAttached) { - using (Mat ones = Mat.Ones(10, 10, MatType.CV_8UC1)) + Window.ShowImages(dst, expected); + } + + ImageEquals(dst, expected); + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void PSNR() + { + using var img1 = LoadImage("lenna.png"); + using var img2 = new Mat(); + Cv2.GaussianBlur(img1, img2, new Size(5, 5), 10); + + var psnr = Cv2.PSNR(img1, img2); + + Assert.Equal(29, psnr, 0); + } + + [Fact] + public void MinMaxLoc() + { + using Mat ones = Mat.Ones(10, 10, MatType.CV_8UC1); + ones.Set(1, 2, 0); + ones.Set(3, 4, 2); + + Cv2.MinMaxLoc(ones, out var minVal, out var maxVal, out var minLoc, out var maxLoc); + + Assert.Equal(0, minVal); + Assert.Equal(2, maxVal); + Assert.Equal(new Point(2, 1), minLoc); + Assert.Equal(new Point(4, 3), maxLoc); + } + + [Fact] + public void MinMaxIdx() + { + using Mat ones = Mat.Ones(10, 10, MatType.CV_8UC1); + ones.Set(1, 2, 0); + ones.Set(3, 4, 2); + + int[] minIdx = new int[2]; + int[] maxIdx = new int[2]; + Cv2.MinMaxIdx(ones, out var minVal, out var maxVal, minIdx, maxIdx); + + Assert.Equal(0, minVal); + Assert.Equal(2, maxVal); + Assert.Equal(new[] { 1, 2 }, minIdx); + Assert.Equal(new[] { 3, 4 }, maxIdx); + } + + [Fact] + public void MergeAndSplit() + { + using var img = LoadImage("lenna.png"); + + Mat[]? planes = null; + try + { + Cv2.Split(img, out planes); + Assert.Equal(3, planes.Length); + + using var dst = new Mat(); + Cv2.Merge(planes, dst); + + ImageEquals(img, dst); + } + finally + { + if (planes is not null) { - Scalar sum = Cv2.Sum(ones); - Assert.AreEqual(100, (int)sum.Val0); + foreach (var plane in planes) + { + plane.Dispose(); + } } } } -} + [Fact] + public void Compare() + { + var bytes = new byte[] { 1, 2, 3, 4, 5, 6 }; + using var src = Mat.FromPixelData(bytes.Length, 1, MatType.CV_8UC1, bytes); + using var dst = new Mat(); + + Cv2.Compare(src, 3, dst, CmpType.LE); + Assert.Equal(255, dst.Get(0)); + Assert.Equal(255, dst.Get(1)); + Assert.Equal(255, dst.Get(2)); + Assert.Equal(0, dst.Get(3)); + Assert.Equal(0, dst.Get(4)); + Assert.Equal(0, dst.Get(5)); + } + + [Fact] + public void Rotate() + { + using var src = LoadImage("lenna.png"); + + using var img90 = new Mat(); + Cv2.Rotate(src, img90, RotateFlags.Rotate90Clockwise); + Assert.Equal(src.Width, img90.Height); + Assert.Equal(src.Height, img90.Width); + + using var img180 = new Mat(); + Cv2.Rotate(src, img180, RotateFlags.Rotate180); + Assert.Equal(src.Width, img180.Width); + Assert.Equal(src.Height, img180.Height); + + Cv2.Rotate(img90, img90, RotateFlags.Rotate90Clockwise); + ImageEquals(img90, img180); + } + + [Fact] + public void Concat() + { + using var src = LoadImage("lenna.png"); + using var hconcat = new Mat(); + using var vconcat = new Mat(); + + Cv2.HConcat([src, src, src], hconcat); + Cv2.VConcat([src, src, src], vconcat); + + Assert.Equal(src.Cols * 3, hconcat.Cols); + Assert.Equal(src.Rows, hconcat.Rows); + + Assert.Equal(src.Cols, vconcat.Cols); + Assert.Equal(src.Rows * 3, vconcat.Rows); + } + + [Fact] + public void Bitwise() + { + const int count = 256; + var random = new Random(0); + var array1 = Enumerable.Range(0, count).Select(i => (byte)i).OrderBy(_ => random.Next()).ToArray(); + var array2 = Enumerable.Range(0, count).Select(i => (byte)i).OrderBy(_ => random.Next()).ToArray(); + + using var mat1 = Mat.FromPixelData(count, 1, MatType.CV_8UC1, array1); + using var mat2 = Mat.FromPixelData(count, 1, MatType.CV_8UC1, array2); + using var and = new Mat(); + using var or = new Mat(); + using var xor = new Mat(); + using var not = new Mat(); + Cv2.BitwiseAnd(mat1, mat2, and); + Cv2.BitwiseOr(mat1, mat2, or); + Cv2.BitwiseXor(mat1, mat2, xor); + Cv2.BitwiseNot(mat1, not); + + for (int i = 0; i < count; i++) + { + Assert.Equal((byte)(array1[i] & array2[i]), and.Get(i)); + Assert.Equal((byte)(array1[i] | array2[i]), or.Get(i)); + Assert.Equal((byte)(array1[i] ^ array2[i]), xor.Get(i)); + Assert.Equal((byte)(~array1[i]), not.Get(i)); + } + } + + [Fact] + public void CopyTo() + { + using var src = LoadImage("lenna.png"); + var dst = new Mat(); + + Cv2.CopyTo(src, dst); + ImageEquals(src, dst); + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void SolveLP() + { + // https://qiita.com/peisuke/items/4cbc0d0bf388492ad2a5 + + using var a = Mat.FromPixelData(3, 1, MatType.CV_64FC1, new double[] { 3, 1, 2 }); + using var b = Mat.FromPixelData(3, 4, MatType.CV_64FC1, new double[] { 1, 1, 3, 30, 2, 2, 5, 24, 4, 1, 2, 36 }); + using var z = new Mat(); + Cv2.SolveLP(a, b, z); + + Assert.Equal(MatType.CV_64FC1, z.Type()); + Assert.Equal(3, z.Total()); + Assert.Equal(8, z.Get(0)); + Assert.Equal(4, z.Get(1)); + Assert.Equal(0, z.Get(2)); + } + + [Fact] + public void Partition() + { + var array = new[] {1, 3, 8, 8, 1, 3, 3, }; + + int nClasses = Cv2.Partition(array, out var labels, (a, b) => a == b); + + Assert.Equal(3, nClasses); + Assert.Equal(new[] { 0, 1, 2, 2, 0, 1, 1 }, labels); + } + + [Fact] + public void Norm() + { + using var mat = new Mat(3, 1, MatType.CV_8UC1); + mat.Set(0, (byte)10); + mat.Set(1, (byte)20); + mat.Set(2, (byte)30); + var norm = Cv2.Norm(mat, NormTypes.L1); + Assert.Equal(60, norm); + } + + [Fact] + public void NormVecb() + { + var vec = new Vec3b(10, 20, 30); + using var ia = InputArray.Create(vec); + var norm = Cv2.Norm(ia, NormTypes.L1); + Assert.Equal(60, norm); + } + + [Fact] + public void NormVeci() + { + var vec = new Vec4i(10000, 20000, 30000, 40000); + var norm = Cv2.Norm(vec, NormTypes.L1); + Assert.Equal(100000, norm); + } + + [Fact] + public void NormVecd() + { + var vec = new Vec2d(1.1111, 2.2222); + var norm = Cv2.Norm(vec, NormTypes.L1); + Assert.Equal(3.3333, norm, 9); + } + + [Fact] + public void ReduceArgMax() + { + using var src = Mat.FromPixelData(2, 2, MatType.CV_8UC1, new byte[] { 1, 2, 1, 4 }); + using var dst = new Mat(); + + Cv2.ReduceArgMax(src, dst, axis: 0, lastIndex: true); + + Assert.Equal(MatType.CV_32SC1, dst.Type()); + Assert.Equal(1, dst.Rows); + Assert.Equal(2, dst.Cols); + + Assert.Equal(1, dst.At(0, 0)); // max along 1st column [1; 1], taking the last occurence + Assert.Equal(1, dst.At(0, 1)); // max along 2nd column [2; 4] + } + + [Fact] + public void ReduceArgMin() + { + using var src = Mat.FromPixelData(2, 2, MatType.CV_8UC1, new byte[] { 2, 1, 4, 4 }); + using var dst = new Mat(); + + Cv2.ReduceArgMin(src, dst, axis: 1, lastIndex: false); + + Assert.Equal(MatType.CV_32SC1, dst.Type()); + Assert.Equal(2, dst.Rows); + Assert.Equal(1, dst.Cols); + + Assert.Equal(1, dst.At(0, 0)); // min along 1st row [2, 1] + Assert.Equal(0, dst.At(1, 0)); // min along 2nd row [4, 4], taking the first occurence + } +} diff --git a/test/OpenCvSharp.Tests/core/FileStorageTest.cs b/test/OpenCvSharp.Tests/core/FileStorageTest.cs new file mode 100644 index 000000000..8d26e70fb --- /dev/null +++ b/test/OpenCvSharp.Tests/core/FileStorageTest.cs @@ -0,0 +1,342 @@ +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Core; + +public class FileStorageTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public FileStorageTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + /// + /// https://github.com/shimat/opencvsharp/issues/403 + /// https://docs.opencv.org/2.4/modules/core/doc/xml_yaml_persistence.html + /// + [Fact] + public void ReadAndWrite() + { + const string fileName = "fs.yml"; + + var sequence = new[] {"image1.jpg", "myfi.png", "../data/baboon.jpg"}; + var map = new {@int = 12345, @double = 3.14159, @string = "foo"}; + var mapSequence = new { + vec2b = new Vec2b(255, 128), + rect = new Rect(1, 2, 3, 4), + size = new Size(10, 20), + point = new Point(300, 400) + }; + + // write + using (var fs = new FileStorage(fileName, FileStorage.Modes.Write)) + { + fs.Add("sequence").Add("["); + foreach (var s in sequence) + { + fs.Add(s); + } + fs.Add("]"); + + fs.Add("empty_sequence").Add("[").Add("]"); + + fs.Add("map").Add("{") + .Add("int").Add(map.@int) + .Add("double").Add(map.@double) + .Add("string").Add(map.@string) + .Add("}"); + + fs.Add("map_sequence").Add("[") + .Add("{") + .Add("vec2b").Add(mapSequence.vec2b) + .Add("rect").Add(mapSequence.rect) + .Add("}").Add("{") + .Add("size").Add(mapSequence.size) + .Add("point").Add(mapSequence.point) + .Add("}") + .Add("]"); + + using (Mat r = Mat.Eye(3, 3, MatType.CV_64FC1)) + using (Mat t = Mat.Ones(3, 1, MatType.CV_64FC1)) + using (Mat lenna = LoadImage("lenna.png")) + { + fs.Write("R", r); + fs.Write("T", t); + fs.Write("lenna", lenna); + } + } + + Assert.True(File.Exists(fileName)); + + // read + using (var fs = new FileStorage(fileName, FileStorage.Modes.Read)) + { + Assert.True(fs.IsOpened()); + + // sequence + using (var node = fs["sequence"]) + { + Assert.NotNull(node); +#pragma warning disable CS8602 + + Assert.Equal(FileNode.Types.Seq, node.Type); + + // C++ style sequence reading + FileNodeIterator it = node.Begin(), end = node.End(); + for (int i = 0; + !it.Equals(end); + it.MoveNext(), i++) + { + var s = it.Current.ReadString(); + Assert.Equal(sequence[i], s); + } + + // C# style + int j = 0; + foreach (var n in node) + { + var s = n.ReadString(); + Assert.Equal(sequence[j++], s); + } + } + + // empty_sequence + using (var node = fs["empty_sequence"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Seq, node.Type); + + var children = node.ToArray(); + Assert.Empty(children); + } + + // map + using (var node = fs["map"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Map, node.Type); + + Assert.Equal(map.@int, node["int"].ReadInt()); + Assert.Equal(map.@double, node["double"].ReadDouble()); + Assert.Equal(map.@string, node["string"].ReadString()); + } + + // map_sequence + using (var node = fs["map_sequence"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Seq, node.Type); + + using (var elem0 = node.ElementAt(0)) + using (var elem1 = node.ElementAt(1)) + { + Assert.Equal(mapSequence.vec2b, elem0["vec2b"].ReadVec2b()); + Assert.Equal(mapSequence.rect, elem0["rect"].ReadRect()); + Assert.Equal(mapSequence.size, elem1["size"].ReadSize()); + Assert.Equal(mapSequence.point, elem1["point"].ReadPoint()); + } + } + + // mat + using (var r = fs["R"]?.ReadMat()) + using (var t = fs["T"]?.ReadMat()) + { + testOutputHelper.WriteLine("R = {0}", r); + testOutputHelper.WriteLine("T = {0}", t); + + Assert.Equal(1.0, r.Get(0, 0)); + Assert.Equal(0.0, r.Get(0, 1)); + Assert.Equal(0.0, r.Get(0, 2)); + Assert.Equal(0.0, r.Get(1, 0)); + Assert.Equal(1.0, r.Get(1, 1)); + Assert.Equal(0.0, r.Get(1, 2)); + Assert.Equal(0.0, r.Get(2, 0)); + Assert.Equal(0.0, r.Get(2, 1)); + Assert.Equal(1.0, r.Get(2, 2)); + + Assert.Equal(1.0, t.Get(0)); + Assert.Equal(1.0, t.Get(1)); + Assert.Equal(1.0, t.Get(2)); + } + + using (var storedLenna = fs["lenna"]?.ReadMat()) + using (var lenna = LoadImage("lenna.png")) + { + Assert.NotNull(storedLenna); +#pragma warning disable CS8604 + ImageEquals(storedLenna, lenna); +#pragma warning restore CS8604 + } + +#pragma warning restore CS8602 + } + } + + /// + /// https://github.com/shimat/opencvsharp/issues/403 + /// https://docs.opencv.org/2.4/modules/core/doc/xml_yaml_persistence.html + /// + [Fact] + public void ReadAndWriteInMemory() + { + var sequence = new[] { "image1.jpg", "myfi.png", "../data/baboon.jpg" }; + var map = new { @int = 12345, @double = 3.14159, @string = "foo" }; + var mapSequence = new + { + vec2b = new Vec2b(255, 128), + rect = new Rect(1, 2, 3, 4), + size = new Size(10, 20), + point = new Point(300, 400) + }; + + // write + string yaml; + using (var fs = new FileStorage("yml", FileStorage.Modes.Write | FileStorage.Modes.Memory)) + { + fs.Add("sequence").Add("["); + foreach (var s in sequence) + { + fs.Add(s); + } + fs.Add("]"); + + fs.Add("empty_sequence").Add("[").Add("]"); + + fs.Add("map").Add("{") + .Add("int").Add(map.@int) + .Add("double").Add(map.@double) + .Add("string").Add(map.@string) + .Add("}"); + + fs.Add("map_sequence").Add("[") + .Add("{") + .Add("vec2b").Add(mapSequence.vec2b) + .Add("rect").Add(mapSequence.rect) + .Add("}").Add("{") + .Add("size").Add(mapSequence.size) + .Add("point").Add(mapSequence.point) + .Add("}") + .Add("]"); + + using (Mat r = Mat.Eye(3, 3, MatType.CV_64FC1)) + using (Mat t = Mat.Ones(3, 1, MatType.CV_64FC1)) + using (Mat lenna = LoadImage("lenna.png")) + { + fs.Write("R", r); + fs.Write("T", t); + fs.Write("lenna", lenna); + } + + yaml = fs.ReleaseAndGetString(); + } + + // check truncation because of StringBuilder capacity + Assert.EndsWith("]", yaml.TrimEnd(), StringComparison.Ordinal); + +#pragma warning disable CS8602 +#pragma warning disable CS8604 + // read + using (var fs = new FileStorage(yaml, FileStorage.Modes.Read | FileStorage.Modes.Memory)) + { + Assert.True(fs.IsOpened()); + + // sequence + using (FileNode? node = fs["sequence"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Seq, node.Type); + + // C++ style sequence reading + FileNodeIterator it = node.Begin(), end = node.End(); + for (int i = 0; + !it.Equals(end); + it.MoveNext(), i++) + { + var s = it.Current.ReadString(); + Assert.Equal(sequence[i], s); + } + + // C# style + int j = 0; + foreach (var n in node) + { + var s = n.ReadString(); + Assert.Equal(sequence[j++], s); + } + } + + // empty_sequence + using (FileNode? node = fs["empty_sequence"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Seq, node.Type); + + var children = node.ToArray(); + Assert.Empty(children); + } + + // map + using (FileNode? node = fs["map"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Map, node.Type); + + Assert.Equal(map.@int, node["int"]?.ReadInt()); + Assert.Equal(map.@double, node["double"]?.ReadDouble()); + Assert.Equal(map.@string, node["string"]?.ReadString()); + } + + // map_sequence + using (FileNode? node = fs["map_sequence"]) + { + Assert.NotNull(node); + Assert.Equal(FileNode.Types.Seq, node.Type); + + using (var elem0 = node.ElementAt(0)) + using (var elem1 = node.ElementAt(1)) + { + Assert.Equal(mapSequence.vec2b, elem0["vec2b"]?.ReadVec2b()); + Assert.Equal(mapSequence.rect, elem0["rect"]?.ReadRect()); + Assert.Equal(mapSequence.size, elem1["size"]?.ReadSize()); + Assert.Equal(mapSequence.point, elem1["point"]?.ReadPoint()); + } + } + + // mat + using (var r = fs["R"]?.ReadMat()) + using (var t = fs["T"]?.ReadMat()) + { + Assert.NotNull(r); + Assert.NotNull(t); + + testOutputHelper.WriteLine("R = {0}", r); + testOutputHelper.WriteLine("T = {0}", t); + + Assert.Equal(1.0, r.Get(0, 0)); + Assert.Equal(0.0, r.Get(0, 1)); + Assert.Equal(0.0, r.Get(0, 2)); + Assert.Equal(0.0, r.Get(1, 0)); + Assert.Equal(1.0, r.Get(1, 1)); + Assert.Equal(0.0, r.Get(1, 2)); + Assert.Equal(0.0, r.Get(2, 0)); + Assert.Equal(0.0, r.Get(2, 1)); + Assert.Equal(1.0, r.Get(2, 2)); + + Assert.Equal(1.0, t.Get(0)); + Assert.Equal(1.0, t.Get(1)); + Assert.Equal(1.0, t.Get(2)); + } + + using (var storedLenna = fs["lenna"]?.ReadMat()) + using (var lenna = LoadImage("lenna.png")) + { + Assert.NotNull(storedLenna); + ImageEquals(storedLenna, lenna); + } + } +#pragma warning restore CS8602 +#pragma warning restore CS8604 + } +} diff --git a/test/OpenCvSharp.Tests/core/LDATest.cs b/test/OpenCvSharp.Tests/core/LDATest.cs new file mode 100644 index 000000000..fb0bacabf --- /dev/null +++ b/test/OpenCvSharp.Tests/core/LDATest.cs @@ -0,0 +1,59 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +// ReSharper disable once InconsistentNaming +public class LDATest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var lda = new LDA()) + { + GC.KeepAlive(lda); + } + } + + // https://blog.csdn.net/kekong0713/article/details/53606880 + [Fact] + // ReSharper disable once InconsistentNaming + public void LDASample() + { + double[,] d = {{2.95,6.63},{2.53,7.79},{3.57,5.65},{3.16,5.47},{2.58,4.46},{2.16,6.22},{3.27,3.52}}; + int[] c = [0, 0, 0, 0, 1, 1, 1]; + + using (var data = Mat.FromPixelData(d.GetLength(0), d.GetLength(1), MatType.CV_64FC1, d)) + using (var classes = Mat.FromPixelData(c.Length, 1, MatType.CV_32SC1, c)) + using (var lda = new LDA(data, classes)) + { + using (var eigenvectors = lda.Eigenvectors()) + { + Assert.Equal(2, eigenvectors.Rows); + Assert.Equal(1, eigenvectors.Cols); + Assert.Equal(-1.5836, eigenvectors.Get(0), 4); + Assert.Equal(-0.659729, eigenvectors.Get(1), 4); + } + + using (var eigenvalues = lda.Eigenvalues()) + { + Assert.Equal(1, eigenvalues.Rows); + Assert.Equal(1, eigenvalues.Cols); + Assert.Equal(3.1447, eigenvalues.Get(0), 4); + } + + using (var project = lda.Project(data)) + { + Assert.Equal(d.GetLength(0), project.Rows); + Assert.Equal(1, project.Cols); + + Assert.Equal(-9.04562, project.Get(0), 5); + Assert.Equal(-9.14579, project.Get(1), 5); + Assert.Equal(-9.38091, project.Get(2), 5); + Assert.Equal(-8.61289, project.Get(3), 5); + Assert.Equal(-7.02807, project.Get(4), 5); + Assert.Equal(-7.52409, project.Get(5), 5); + Assert.Equal(-7.50061, project.Get(6), 5); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/core/MatExprTest.cs b/test/OpenCvSharp.Tests/core/MatExprTest.cs new file mode 100644 index 000000000..5ba23415c --- /dev/null +++ b/test/OpenCvSharp.Tests/core/MatExprTest.cs @@ -0,0 +1,45 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class MatExprTest +{ + [Fact] + public void Size() + { + using var matExpr = Mat.Eye(3, 5, MatType.CV_8UC1); + var size = matExpr.Size(); + Assert.Equal(3, size.Height); + Assert.Equal(5, size.Width); + } + + [Fact] + public void Type() + { + using var matExpr = Mat.Ones(3, 5, MatType.CV_32FC4); + Assert.Equal(MatType.CV_32FC4, matExpr.Type()); + } + + [Fact] + public void GetSubMat() + { + using var matExpr = Mat.Eye(10, 10, MatType.CV_8UC1); + + var rect = new Rect(2, 2, 5, 5); + using var sub = matExpr.SubMat(rect); + Assert.Equal(rect.Width, sub.Size().Width); + Assert.Equal(rect.Height, sub.Size().Height); + + using var subMat = sub.ToMat(); + Assert.Equal(rect.Width, subMat.Rows); + Assert.Equal(rect.Height, subMat.Cols); + + for (int r = 0; r < subMat.Rows; r++) + { + for (int c = 0; c < subMat.Cols; c++) + { + Assert.Equal(r == c ? 1 : 0, subMat.Get(r, c)); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/core/MatTest.cs b/test/OpenCvSharp.Tests/core/MatTest.cs index 3268768ab..584d10d78 100644 --- a/test/OpenCvSharp.Tests/core/MatTest.cs +++ b/test/OpenCvSharp.Tests/core/MatTest.cs @@ -1,249 +1,1264 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; -namespace OpenCvSharp.Tests.Core +// ReSharper disable ReturnValueOfPureMethodIsNotUsed + +namespace OpenCvSharp.Tests.Core; + +public class MatTest : TestBase { - [TestFixture] - public class MatTest : TestBase + private readonly ITestOutputHelper testOutputHelper; + + public MatTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void MatOfTDispose() + { +#pragma warning disable CA2000 + var sourceMat = new Mat(10, 20, MatType.CV_64FC1); +#pragma warning restore CA2000 + var doubleMat = new Mat(sourceMat); + // ReSharper disable once RedundantAssignment + sourceMat = null!; + GC.Collect(); + doubleMat.Dispose(); // after it when GC will working program broken + } + + [Fact] + public void MatIndexerByte() + { + byte value = 123; + using var img = new Mat(new Size(10, 10), MatType.CV_8UC1, Scalar.All(value)); + using var imgB = new Mat(img); + var indexer = imgB.GetIndexer(); + var genericIndexer = img.GetGenericIndexer(); + var unsafeGenericIndexer = img.GetUnsafeGenericIndexer(); + + Assert.Equal(value, indexer[0, 0]); + Assert.Equal(value, genericIndexer[0, 0]); + Assert.Equal(value, unsafeGenericIndexer[0, 0]); + + Assert.Equal(value, indexer[5, 7]); + Assert.Equal(value, genericIndexer[5, 7]); + Assert.Equal(value, unsafeGenericIndexer[5, 7]); + + indexer[3, 4] = 1; + Assert.Equal(1, img.Get(3, 4)); + genericIndexer[3, 4] = 2; + Assert.Equal(2, img.Get(3, 4)); + unsafeGenericIndexer[3, 4] = 3; + Assert.Equal(3, img.Get(3, 4)); + } + + [Fact] + public void MatIndexerVec3d() + { + var scalarValue = new Scalar(1, 2, 3); + var expectedValue = new Vec3d(scalarValue[0], scalarValue[1], scalarValue[2]); + + using var img = new Mat(new Size(10, 10), MatType.CV_64FC3, scalarValue); + using var imgB = new Mat(img); + var indexer = imgB.GetIndexer(); + var genericIndexer = img.GetGenericIndexer(); + var unsafeGenericIndexer = img.GetUnsafeGenericIndexer(); + + Assert.Equal(expectedValue, indexer[0, 0]); + Assert.Equal(expectedValue, genericIndexer[0, 0]); + Assert.Equal(expectedValue, unsafeGenericIndexer[0, 0]); + + Assert.Equal(expectedValue, indexer[5, 7]); + Assert.Equal(expectedValue, genericIndexer[5, 7]); + Assert.Equal(expectedValue, unsafeGenericIndexer[5, 7]); + + indexer[3, 4] = new Vec3d(2, 3, 4); + Assert.Equal(new Vec3d(2, 3, 4), img.Get(3, 4)); + + genericIndexer[3, 4] = new Vec3d(3, 4, 5); + Assert.Equal(new Vec3d(3, 4, 5), img.Get(3, 4)); + + unsafeGenericIndexer[3, 4] = new Vec3d(4, 5, 6); + Assert.Equal(new Vec3d(4, 5, 6), img.Get(3, 4)); + } + + [Fact] + public void GetSet() { - [Test] - public void SetTo() + using var mat8UC1 = new Mat(3, 3, MatType.CV_8UC1, new Scalar(33)); + Assert.Equal(33, mat8UC1.Get(0, 0)); + Assert.Equal(33, mat8UC1.Get(1, 1)); + Assert.Equal(33, mat8UC1.Get(2, 2)); + mat8UC1.Set(0, 1, 55); + mat8UC1.Set(1, 2, 55); + mat8UC1.Set(2, 0, 55); + Assert.Equal(55, mat8UC1.Get(0, 1)); + Assert.Equal(55, mat8UC1.Get(1, 2)); + Assert.Equal(55, mat8UC1.Get(2, 0)); + + using var mat8UC3 = new Mat(3, 3, MatType.CV_8UC3, new Scalar(33, 44, 55)); + Assert.Equal(new Vec3b(33, 44, 55), mat8UC3.Get(0, 0)); + Assert.Equal(new Vec3b(33, 44, 55), mat8UC3.Get(1, 1)); + Assert.Equal(new Vec3b(33, 44, 55), mat8UC3.Get(2, 2)); + mat8UC3.Set(0, 1, new Vec3b(64, 128, 192)); + mat8UC3.Set(1, 2, new Vec3b(64, 128, 192)); + mat8UC3.Set(2, 0, new Vec3b(64, 128, 192)); + Assert.Equal(new Vec3b(64, 128, 192), mat8UC3.Get(0, 1)); + Assert.Equal(new Vec3b(64, 128, 192), mat8UC3.Get(1, 2)); + Assert.Equal(new Vec3b(64, 128, 192), mat8UC3.Get(2, 0)); + + using var mat32FC1 = new Mat(3, 3, MatType.CV_32FC1, new Scalar(3.14159)); + Assert.Equal(3.14159f, mat32FC1.Get(0, 0), 1e-6); + Assert.Equal(3.14159f, mat32FC1.Get(1, 1), 1e-6); + Assert.Equal(3.14159f, mat32FC1.Get(2, 2), 1e-6); + mat32FC1.Set(0, 1, 55.5555f); + mat32FC1.Set(1, 2, 55.5555f); + mat32FC1.Set(2, 0, 55.5555f); + Assert.Equal(55.5555f, mat32FC1.Get(0, 1)); + Assert.Equal(55.5555f, mat32FC1.Get(1, 2)); + Assert.Equal(55.5555f, mat32FC1.Get(2, 0)); + } + + [Fact] + public void At() + { + using var mat8UC1 = new Mat(3, 3, MatType.CV_8UC1, new Scalar(33)); + Assert.Equal(33, mat8UC1.At(0, 0)); + Assert.Equal(33, mat8UC1.At(1, 1)); + Assert.Equal(33, mat8UC1.At(2, 2)); + mat8UC1.At(0, 1) = 33; + mat8UC1.At(1, 2) = 44; + mat8UC1.At(2, 0) = 55; + Assert.Equal(33, mat8UC1.At(0, 1)); + Assert.Equal(44, mat8UC1.At(1, 2)); + Assert.Equal(55, mat8UC1.At(2, 0)); + + using var mat8UC3 = new Mat(3, 3, MatType.CV_8UC3, new Scalar(33, 44, 55)); + Assert.Equal(new Vec3b(33, 44, 55), mat8UC3.At(0, 0)); + Assert.Equal(new Vec3b(33, 44, 55), mat8UC3.At(1, 1)); + Assert.Equal(new Vec3b(33, 44, 55), mat8UC3.At(2, 2)); + mat8UC3.At(0, 1) = new Vec3b(1, 2, 3); + mat8UC3.At(1, 2) = new Vec3b(4, 5, 6); + mat8UC3.At(2, 0) = new Vec3b(7, 8, 9); + Assert.Equal(new Vec3b(1, 2, 3), mat8UC3.At(0, 1)); + Assert.Equal(new Vec3b(4, 5, 6), mat8UC3.At(1, 2)); + Assert.Equal(new Vec3b(7, 8, 9), mat8UC3.At(2, 0)); + + using var mat32FC1 = new Mat(3, 3, MatType.CV_32FC1, new Scalar(3.14159)); + Assert.Equal(3.14159f, mat32FC1.At(0, 0), 1e-6); + Assert.Equal(3.14159f, mat32FC1.At(1, 1), 1e-6); + Assert.Equal(3.14159f, mat32FC1.At(2, 2), 1e-6); + mat32FC1.At(0, 1) = 33.3333f; + mat32FC1.At(1, 2) = 44.4444f; + mat32FC1.At(2, 0) = 55.5555f; + Assert.Equal(33.3333f, mat32FC1.At(0, 1)); + Assert.Equal(44.4444f, mat32FC1.At(1, 2)); + Assert.Equal(55.5555f, mat32FC1.At(2, 0)); + } + + [Fact] + public void Diag() + { + var data = new byte[] { 1, 10, 100 }; + using var mat = Mat.FromPixelData(3, 1, MatType.CV_8UC1, data); + using var diag = Mat.Diag(mat); + Assert.Equal(3, diag.Rows); + Assert.Equal(3, diag.Cols); + Assert.Equal(MatType.CV_8UC1, diag.Type()); + + Assert.Equal(1, diag.Get(0, 0)); + Assert.Equal(0, diag.Get(0, 1)); + Assert.Equal(0, diag.Get(0, 2)); + Assert.Equal(0, diag.Get(1, 0)); + Assert.Equal(10, diag.Get(1, 1)); + Assert.Equal(0, diag.Get(1, 2)); + Assert.Equal(0, diag.Get(2, 0)); + Assert.Equal(0, diag.Get(2, 1)); + Assert.Equal(100, diag.Get(2, 2)); + } + + [Fact] + public void CopyTo() + { + using var src = LoadImage("mandrill.png", ImreadModes.Grayscale); + using var dst = new Mat(); + using var mask = src.GreaterThan(128); + src.CopyTo(dst, mask); + ShowImagesWhenDebugMode(dst); + src.CopyTo(dst, null); + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void SetTo() + { + using var graySrc = LoadImage("mandrill.png", ImreadModes.Grayscale); + using var resultImage = graySrc.Clone(); + using var mask = graySrc.InRange(100, 200); + var ret = resultImage.SetTo(0, mask); + ShowImagesWhenDebugMode(resultImage); + Assert.True(ReferenceEquals(resultImage, ret)); + + ret = resultImage.SetTo(0, null); + ShowImagesWhenDebugMode(resultImage); + Assert.True(ReferenceEquals(resultImage, ret)); + } + +#if NET5_0_OR_GREATER + [Fact] + public void RowRange() + { + var values = new byte[,] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}}; + using var mat = Mat.FromArray(values); + Assert.Equal(new Size(3, 3), mat.Size()); + + // OK + using var subMat = mat.RowRange(1..); + Assert.Equal(new Size(3, 2), subMat.Size()); + Assert.True(subMat.GetArray(out byte[] subMatArray)); + Assert.Equal([4, 5, 6, 7, 8, 9], subMatArray); + + // out of range + Assert.Throws(() => { - using (Mat graySrc = Image("lenna.png", ImreadModes.GrayScale)) - using (Mat resultImage = graySrc.Clone()) - using (Mat mask = graySrc.InRange(100, 200)) - { - Assert.DoesNotThrow(() => { resultImage.SetTo(0, mask); }); - //Window.ShowImages(resultImage); - Assert.DoesNotThrow(() => { resultImage.SetTo(0, null); }); - //Window.ShowImages(resultImage); - } + using (mat.RowRange(0..10)) { } + }); + Assert.Throws(() => + { + using (mat.RowRange(10..20)) { } + }); + } + + [Fact] + public void ColRange() + { + var values = new byte[,] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}}; + using var mat = Mat.FromArray(values); + Assert.Equal(new Size(3, 3), mat.Size()); + + // OK + using var subMat = mat.ColRange(..2); + Assert.Equal(new Size(2, 3), subMat.Size()); + Assert.True(subMat.GetArray(out byte[] subMatArray)); + Assert.Equal([1, 2, 4, 5, 7, 8], subMatArray); + + // out of range + Assert.Throws(() => + { + using (mat.ColRange(0..10)) { } + }); + Assert.Throws(() => + { + using (mat.ColRange(10..20)) { } + }); + } + + [Fact] + public void SubMatRange() + { + var values = new byte[,] { + {1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10,11,12}}; + using var mat = Mat.FromArray(values); + Assert.Equal(new Size(4, 3), mat.Size()); + + // OK + using var subMat1 = mat.SubMat(0..2, 1..4); + Assert.Equal(new Size(3, 2), subMat1.Size()); + Assert.True(subMat1.GetArray(out byte[] subMat1Array)); + Assert.Equal([2, 3,4, 6,7,8], subMat1Array); + + using var subMat2 = mat[1..2, ..]; + Assert.Equal(new Size(4, 1), subMat2.Size()); + Assert.True(subMat2.GetArray(out byte[] subMat2Array)); + Assert.Equal([5, 6,7,8], subMat2Array); + + // out of range + Assert.Throws(() => + { + using (mat.SubMat(0..10, ..)) { } + }); + Assert.Throws(() => + { + using (mat.SubMat(10..20, ..)) { } + }); + Assert.Throws(() => + { + using (mat.SubMat(.., 0..10)) { } + }); + Assert.Throws(() => + { + using (mat.SubMat(.., 10..20)) { } + }); + } +#endif + + [Fact] + public void T() + { + var data = new byte[] { 1, 10, 100 }; + using var mat = Mat.FromPixelData(3, 1, MatType.CV_8UC1, data); + using var tExpr = mat.T(); + using var t = tExpr.ToMat(); + + Assert.Equal(1, t.Rows); + Assert.Equal(3, t.Cols); + Assert.Equal(MatType.CV_8UC1, t.Type()); + + Assert.Equal(1, t.Get(0, 0)); + Assert.Equal(10, t.Get(0, 1)); + Assert.Equal(100, t.Get(0, 2)); + } + + [Fact] + public void Inv() + { + var data = new double[] { 1, 2, 3, 4 }; + using var mat = Mat.FromPixelData(2, 2, MatType.CV_64FC1, data); + using var invExpr = mat.Inv(); + using var inv = invExpr.ToMat(); + + Assert.Equal(2, inv.Rows); + Assert.Equal(2, inv.Cols); + Assert.Equal(MatType.CV_64FC1, inv.Type()); + + Assert.Equal(-2.0, inv.Get(0, 0), 3); + Assert.Equal(+1.0, inv.Get(0, 1), 3); + Assert.Equal(+1.5, inv.Get(1, 0), 3); + Assert.Equal(-0.5, inv.Get(1, 1), 3); + } + + [Fact] + public void Dot() + { + var data1 = new double[] { 1, 2 }; + var data2 = new double[] { 3, 4 }; + using var mat1 = Mat.FromPixelData(2, 1, MatType.CV_64FC1, data1); + using var mat2 = Mat.FromPixelData(2, 1, MatType.CV_64FC1, data2); + var dot = mat1.Dot(mat2); + + Assert.Equal(data1[0] * data2[0] + data1[1] * data2[1], dot); + } + + [Fact] + public void Reserve() + { + using var mat = new Mat(1, 1, MatType.CV_8UC1); + mat.Reserve(10); + mat.ReserveBuffer(100); + } + + [Fact] + public void Resize() + { + using var mat = new Mat(1, 1, MatType.CV_8UC1); + mat.Resize(10); + Assert.Equal(10, mat.Rows); + } + + [Fact] + public void Reshape() + { + { + using var src = new Mat(2, 2, MatType.CV_8UC1); + using var dst = src.Reshape(0, 4); + Assert.Equal(new Size(1, 4), dst.Size()); + Assert.Equal(MatType.CV_8UC1, dst.Type()); + } + { + using var src = new Mat(2, 2, MatType.CV_8UC3); + using var dst = src.Reshape(1, 0); + Assert.Equal(new Size(6, 2), dst.Size()); + Assert.Equal(MatType.CV_8UC1, dst.Type()); } + } + + [Fact] + public void PushBack() + { + using var m = new Mat(); + m.PushBack(1.2); + m.PushBack(3.4); + m.PushBack(5.6); + + Assert.Equal(1.2, m.Get(0), 6); + Assert.Equal(3.4, m.Get(1), 6); + Assert.Equal(5.6, m.Get(2), 6); + } + + [Fact] + public void IsContinuousAndSubmatrix() + { + using var m1 = new Mat(10, 10, MatType.CV_8UC1); + Assert.True(m1.IsContinuous()); + Assert.False(m1.IsSubmatrix()); + + using var m2 = new Mat(m1, new Rect(2, 3, 4, 5)); + Assert.False(m2.IsContinuous()); + Assert.True(m2.IsSubmatrix()); + } + + [Fact] + public void Type() + { + using var m1 = new Mat(1, 1, MatType.CV_8UC1); + Assert.Equal(MatType.CV_8UC1, m1.Type()); + + using var m2 = new Mat(1, 1, MatType.CV_32FC4); + Assert.Equal(MatType.CV_32FC4, m2.Type()); + } + + [Fact] + public void Depth() + { + using var m1 = new Mat(1, 1, MatType.CV_8UC1); + Assert.Equal(MatType.CV_8U, m1.Depth()); + + using var m2 = new Mat(1, 1, MatType.CV_32FC4); + Assert.Equal(MatType.CV_32F, m2.Depth()); + } + + [Fact] + public void Channels() + { + using var m1 = new Mat(1, 1, MatType.CV_8UC1); + Assert.Equal(1, m1.Channels()); + + using var m2 = new Mat(1, 1, MatType.CV_32FC4); + Assert.Equal(4, m2.Channels()); + } + + [Fact] + public void MatOfDoubleFromArray() + { + var array = new double[] { 7, 8, 9 }; + using var m = Mat.FromArray(array); - [Test] - public void CopyTo() + var indexer = m.GetIndexer(); + for (int i = 0; i < array.Length; i++) { - using (Mat src = Image("lenna.png", ImreadModes.GrayScale)) - using (Mat dst = new Mat()) - using (Mat mask = src.GreaterThan(128)) + Assert.Equal(array[i], m.Get(i), 6); + Assert.Equal(array[i], indexer[i], 6); + } + } + + [Fact] + public void MatOfDoubleFromRectangularArray() + { + var array = new double[,] { { 1, 2 }, { 3, 4 } }; + using var m = Mat.FromArray(array); + + var indexer = m.GetIndexer(); + for (int i = 0; i < array.GetLength(0); i++) + { + for (int j = 0; j < array.GetLength(1); j++) { - Assert.DoesNotThrow(() => { src.CopyTo(dst, mask); }); - //Window.ShowImages(dst); - Assert.DoesNotThrow(() => { src.CopyTo(dst, null); }); - //Window.ShowImages(dst); + Assert.Equal(array[i, j], m.Get(i, j), 6); + Assert.Equal(array[i, j], indexer[i, j], 6); } } + } + + [Fact] + public void MatOfFloatFromArray() + { + var array = new float[] { 7, 8, 9 }; + using var m = Mat.FromArray(array); - [Test] - public void Diag() + var indexer = m.GetIndexer(); + for (int i = 0; i < array.Length; i++) { - var data = new byte[] {1, 10, 100}; - using (var mat = new Mat(3, 1, MatType.CV_8UC1, data)) - using (var diag = Mat.Diag(mat)) - { - Assert.AreEqual(3, diag.Rows); - Assert.AreEqual(3, diag.Cols); - Assert.AreEqual(MatType.CV_8UC1, diag.Type()); + Assert.Equal(array[i], m.Get(i), 1e-6); + Assert.Equal(array[i], indexer[i], 1e-6); + } + } - Assert.AreEqual(1, diag.Get(0, 0)); - Assert.AreEqual(0, diag.Get(0, 1)); - Assert.AreEqual(0, diag.Get(0, 2)); - Assert.AreEqual(0, diag.Get(1, 0)); - Assert.AreEqual(10, diag.Get(1, 1)); - Assert.AreEqual(0, diag.Get(1, 2)); - Assert.AreEqual(0, diag.Get(2, 0)); - Assert.AreEqual(0, diag.Get(2, 1)); - Assert.AreEqual(100, diag.Get(2, 2)); + [Fact] + public void MatOfFloatFromRectangularArray() + { + var array = new float[,] { { 1, 2 }, { 3, 4 } }; + using var m = Mat.FromArray(array); + + var indexer = m.GetIndexer(); + for (int i = 0; i < array.GetLength(0); i++) + { + for (int j = 0; j < array.GetLength(1); j++) + { + Assert.Equal(array[i, j], m.Get(i, j), 1e-6); + Assert.Equal(array[i, j], indexer[i, j], 1e-6); } } + } + [Fact] + public void MatOfIntFromArray() + { + var array = new[] { 7, 8, 9 }; + var m = Mat.FromArray(array); - [Test] - public void MatOfDoubleFromArray() + var indexer = m.GetIndexer(); + for (int i = 0; i < array.Length; i++) { - var array = new double[] {7, 8, 9}; - var m = MatOfDouble.FromArray(array); + Assert.Equal(array[i], m.Get(i)); + Assert.Equal(array[i], indexer[i]); + } + } - var indexer = m.GetIndexer(); - for (int i = 0; i < array.Length; i++) + [Fact] + public void MatOfIntFromRectangularArray() + { + var array = new[,] { { 1, 2 }, { 3, 4 },{ 5,6} }; + using var m = Mat.FromArray(array); + + var indexer = m.GetIndexer(); + for (int i = 0; i < array.GetLength(0); i++) + { + for (int j = 0; j < array.GetLength(1); j++) { - Assert.That(m.Get(i), Is.EqualTo(array[i]).Within(1e-6)); - Assert.That(indexer[i], Is.EqualTo(array[i]).Within(1e-6)); + Assert.Equal(array[i, j], m.Get(i, j)); + Assert.Equal(array[i, j], indexer[i, j]); } } + } + + [Fact] + public void MatOfUShortFromArray() + { + var array = new ushort[] { 7, 8, 9 }; + using var m = Mat.FromArray(array); - [Test] - public void MatOfDoubleFromRectangularArray() + var indexer = m.GetIndexer(); + for (int i = 0; i < array.Length; i++) { - var array = new double[,] {{1, 2}, {3, 4}}; - var m = MatOfDouble.FromArray(array); + Assert.Equal(array[i], m.Get(i)); + Assert.Equal(array[i], indexer[i]); + } + } + + [Fact] + public void MatOfUShortFromRectangularArray() + { + var array = new ushort[,] { { 1, 2 }, { 3, 4 } }; + using var m = Mat.FromArray(array); - var indexer = m.GetIndexer(); - for (int i = 0; i < array.GetLength(0); i++) + var indexer = m.GetIndexer(); + for (int i = 0; i < array.GetLength(0); i++) + { + for (int j = 0; j < array.GetLength(1); j++) { - for (int j = 0; j < array.GetLength(1); j++) - { - Assert.That(m.Get(i, j), Is.EqualTo(array[i, j]).Within(1e-6)); - Assert.That(indexer[i, j], Is.EqualTo(array[i, j]).Within(1e-6)); - } + Assert.Equal(array[i, j], m.Get(i, j)); + Assert.Equal(array[i, j], indexer[i, j]); } } + } - [Test] - public void MatOfFloatFromArray() + [Fact] + public void MatOfShortFromArray() + { + var array = new short[] { 7, 8, 9 }; + using var m = Mat.FromArray(array); + + var indexer = m.GetIndexer(); + for (int i = 0; i < array.Length; i++) { - var array = new float[] { 7, 8, 9 }; - var m = MatOfFloat.FromArray(array); + Assert.Equal(array[i], m.Get(i)); + Assert.Equal(array[i], indexer[i]); + } + } - var indexer = m.GetIndexer(); - for (int i = 0; i < array.Length; i++) + [Fact] + public void MatOfShortFromRectangularArray() + { + var array = new short[,] { { 1, 2 }, { 3, 4 } }; + using var m = Mat.FromArray(array); + + var indexer = m.GetIndexer(); + for (int i = 0; i < array.GetLength(0); i++) + { + for (int j = 0; j < array.GetLength(1); j++) { - Assert.That(m.Get(i), Is.EqualTo(array[i]).Within(1e-6)); - Assert.That(indexer[i], Is.EqualTo(array[i]).Within(1e-6)); + Assert.Equal(array[i, j], m.Get(i, j)); + Assert.Equal(array[i, j], indexer[i, j]); } } + } + + [Fact] + public void MatOfByteFromArray() + { + var array = new byte[] { 7, 8, 9 }; + var m = Mat.FromArray(array); - [Test] - public void MatOfFloatFromRectangularArray() + var indexer = m.GetIndexer(); + for (int i = 0; i < array.Length; i++) { - var array = new float[,] { { 1, 2 }, { 3, 4 } }; - var m = MatOfFloat.FromArray(array); + Assert.Equal(array[i], m.Get(i)); + Assert.Equal(array[i], indexer[i]); + } + } - var indexer = m.GetIndexer(); - for (int i = 0; i < array.GetLength(0); i++) + [Fact] + public void MatOfByteFromRectangularArray() + { + var array = new byte[,] { { 1, 2 }, { 3, 4 } }; + using var m = Mat.FromArray(array); + + var indexer = m.GetIndexer(); + for (int i = 0; i < array.GetLength(0); i++) + { + for (int j = 0; j < array.GetLength(1); j++) { - for (int j = 0; j < array.GetLength(1); j++) - { - Assert.That(m.Get(i, j), Is.EqualTo(array[i, j]).Within(1e-6)); - Assert.That(indexer[i, j], Is.EqualTo(array[i, j]).Within(1e-6)); - } + Assert.Equal(array[i, j], m.Get(i, j)); + Assert.Equal(array[i, j], indexer[i, j]); } } + } - [Test] - public void MatOfIntFromArray() + [Fact] + public void GetArrayByte() + { + var data = new byte[] { 0, 128, 255, 1 }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8UC1, data); + bool success = mat.GetArray(out byte[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayFailure() + { + var data = new byte[] { 0, 128, 255, 1 }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_64FC4, data); + Assert.Throws(() => + { + mat.GetArray(out byte[] _); + }); + } + + [Fact] + public void GetRectangularArrayByte() + { + var data = new byte[,] { - var array = new int[] { 7, 8, 9 }; - var m = MatOfInt.FromArray(array); + {0, 128}, + {255, 1} + }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8UC1, data); + bool success = mat.GetRectangularArray(out byte[,] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayInt16() + { + var data = new short[] { 3, short.MaxValue, short.MinValue, 10000 }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_16SC1, data); + bool success = mat.GetArray(out short[] data2); - var indexer = m.GetIndexer(); - for (int i = 0; i < array.Length; i++) + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayInt32() + { + // ReSharper disable once RedundantExplicitArrayCreation + var data = new int[] { 3, int.MaxValue, int.MinValue, 65536 }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_32SC1, data); + bool success = mat.GetArray(out int[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArraySingle() + { + // ReSharper disable once RedundantExplicitArrayCreation + var data = new float[] { 3.14f, float.MaxValue, float.MinValue, 12345.6789f }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_32FC1, data); + bool success = mat.GetArray(out float[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayDouble() + { + // ReSharper disable once RedundantExplicitArrayCreation + var data = new double[] { 3.14, double.MaxValue, double.MinValue, double.Epsilon }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_64FC1, data); + bool success = mat.GetArray(out double[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayPoint() + { + var data = new[] + { + new Point(1, 2), + new Point(3, 4), + new Point(5, 6), + new Point(7, 8), + }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_32SC2, data); + bool success = mat.GetArray(out Point[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayRect() + { + var data = new[] + { + new Rect(1, 2, 3, 4), + new Rect(5, 6, 7, 8), + new Rect(9, 10, 11, 12), + new Rect(13, 14, 15, 16), + }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_32SC4, data); + bool success = mat.GetArray(out Rect[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetArrayVec2b() + { + var expectedData = new Vec2b[2 * 2]; + + using var mat = new Mat(2, 2, MatType.CV_8UC2); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < 2; c++) { - Assert.That(m.Get(i), Is.EqualTo(array[i])); - Assert.That(indexer[i], Is.EqualTo(array[i])); + var value = new Vec2b((byte)r, (byte)c); + mat.Set(r, c, value); + expectedData[r * 2 + c] = value; } } - [Test] - public void MatOfIntFromRectangularArray() - { - var array = new int[,] { { 1, 2 }, { 3, 4 } }; - var m = MatOfInt.FromArray(array); + bool success = mat.GetArray(out Vec2b[] data2); + + Assert.True(success); + Assert.Equal(expectedData, data2); + } - var indexer = m.GetIndexer(); - for (int i = 0; i < array.GetLength(0); i++) + [Fact] + public void GetRectangularArrayVec2b() + { + var expectedData = new Vec2b[2, 2]; + + using var mat = new Mat(2, 2, MatType.CV_8UC2); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < 2; c++) { - for (int j = 0; j < array.GetLength(1); j++) - { - Assert.That(m.Get(i, j), Is.EqualTo(array[i, j])); - Assert.That(indexer[i, j], Is.EqualTo(array[i, j])); - } + var value = new Vec2b((byte)r, (byte)c); + mat.Set(r, c, value); + expectedData[r, c] = value; } } - [Test] - public void MatOfUShortFromArray() + bool success = mat.GetRectangularArray(out Vec2b[,] data2); + + Assert.True(success); + Assert.Equal(expectedData, data2); + } + + [Fact] + public void GetArrayVec3b() + { + var data = new[] { - var array = new ushort[] { 7, 8, 9 }; - var m = MatOfUShort.FromArray(array); + new Vec3b(1, 2, 3), + new Vec3b(4, 5, 6), + new Vec3b(7, 8, 9), + new Vec3b(10, 11, 12), + }; + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8UC3, data); + bool success = mat.GetArray(out Vec3b[] data2); + + Assert.True(success); + Assert.Equal(data, data2); + } + + [Fact] + public void GetRectangularArrayVec3b() + { + var expectedData = new Vec3b[2, 2]; - var indexer = m.GetIndexer(); - for (int i = 0; i < array.Length; i++) + using var mat = new Mat(2, 2, MatType.CV_8UC3); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < 2; c++) { - Assert.That(m.Get(i), Is.EqualTo(array[i])); - Assert.That(indexer[i], Is.EqualTo(array[i])); + var value = new Vec3b((byte)r, (byte)c, (byte)(r * c)); + mat.Set(r, c, value); + expectedData[r, c] = value; } } - [Test] - public void MatOfUShortFromRectangularArray() + bool success = mat.GetRectangularArray(out Vec3b[,] data2); + + Assert.True(success); + Assert.Equal(expectedData, data2); + } + + [Fact] + public void SetArrayByte() + { + using var mat = new Mat(2, 2, MatType.CV_8UC1); + + var data = new byte[] { 64, 128, 255, 1 }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetArrayByteFailure() + { + using var mat = new Mat(2, 2, MatType.CV_64FC3); + + var data = new byte[] { 64, 128, 255, 1 }; + Assert.Throws(() => + { + mat.SetArray(data); + }); + } + + [Fact] + public void SetRectangularArrayByte() + { + using var mat = new Mat(2, 2, MatType.CV_8UC1); + + var data = new byte[,] + { + {64, 128}, + {255, 1} + }; + mat.SetRectangularArray(data); + + Assert.Equal(data[0, 0], mat.Get(0, 0)); + Assert.Equal(data[0, 1], mat.Get(0, 1)); + Assert.Equal(data[1, 0], mat.Get(1, 0)); + Assert.Equal(data[1, 1], mat.Get(1, 1)); + } + + [Fact] + public void SetArrayInt16() + { + using var mat = new Mat(2, 2, MatType.CV_16SC1); + + var data = new short[] { 123, short.MinValue, short.MaxValue, 1 }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetArrayInt32() + { + using var mat = new Mat(2, 2, MatType.CV_32SC1); + + // ReSharper disable once RedundantExplicitArrayCreation + var data = new int[] { 12345678, int.MinValue, int.MaxValue, 1 }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetArraySingle() + { + using var mat = new Mat(2, 2, MatType.CV_32FC1); + + // ReSharper disable once RedundantExplicitArrayCreation + var data = new float[] { float.Epsilon, float.MinValue, float.MaxValue, 1 }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetArrayDouble() + { + using var mat = new Mat(2, 2, MatType.CV_64FC1); + + // ReSharper disable once RedundantExplicitArrayCreation + var data = new double[] { double.Epsilon, double.MinValue, double.MaxValue, 1 }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetArrayPoint() + { + using var mat = new Mat(2, 2, MatType.CV_32SC2); + + // ReSharper disable once RedundantExplicitArrayCreation + var data = new[] + { + new Point(1, 2), + new Point(3, 4), + new Point(5, 6), + new Point(7, 8), + }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetArrayRect() + { + using var mat = new Mat(2, 2, MatType.CV_32SC4); + + // ReSharper disable once RedundantExplicitArrayCreation + var data = new[] + { + new Rect(1, 2, 3, 4), + new Rect(3, 4, 7, 8), + new Rect(9, 10, 11, 12), + new Rect(13, 14, 15, 16), + }; + mat.SetArray(data); + + Assert.Equal(data[0], mat.Get(0, 0)); + Assert.Equal(data[1], mat.Get(0, 1)); + Assert.Equal(data[2], mat.Get(1, 0)); + Assert.Equal(data[3], mat.Get(1, 1)); + } + + [Fact] + public void SetRectangularArrayRect() + { + using var mat = new Mat(2, 2, MatType.CV_32SC4); + + // ReSharper disable once RedundantExplicitArrayCreation + var data = new[,] { - var array = new ushort[,] { { 1, 2 }, { 3, 4 } }; - var m = MatOfUShort.FromArray(array); + {new Rect(1, 2, 3, 4), new Rect(3, 4, 7, 8),}, + {new Rect(9, 10, 11, 12), new Rect(13, 14, 15, 16),} + }; + mat.SetRectangularArray(data); - var indexer = m.GetIndexer(); - for (int i = 0; i < array.GetLength(0); i++) + Assert.Equal(data[0, 0], mat.Get(0, 0)); + Assert.Equal(data[0, 1], mat.Get(0, 1)); + Assert.Equal(data[1, 0], mat.Get(1, 0)); + Assert.Equal(data[1, 1], mat.Get(1, 1)); + } + + [Fact] + public void GetSubMat() + { + const byte expectedValue = 128; + + using var mat = new Mat(10, 10, MatType.CV_8UC1, Scalar.All(0)); + + var rect = new Rect(2, 2, 7, 5); + mat.Rectangle(rect, new Scalar(expectedValue), -1); + + using var subMat = mat.SubMat(rect); + Assert.Equal(rect.Width, subMat.Cols); + Assert.Equal(rect.Height, subMat.Rows); + + for (int r = 0; r < subMat.Rows; r++) + { + for (int c = 0; c < subMat.Cols; c++) { - for (int j = 0; j < array.GetLength(1); j++) - { - Assert.That(m.Get(i, j), Is.EqualTo(array[i, j])); - Assert.That(indexer[i, j], Is.EqualTo(array[i, j])); - } + Assert.Equal(expectedValue, subMat.Get(r, c)); } } + } + + [Fact] + public void GetSubMatByIndexer() + { + const byte expectedValue = 128; + + using var mat = new Mat(10, 10, MatType.CV_8UC1, Scalar.All(0)); + + var rect = new Rect(2, 2, 7, 5); + mat.Rectangle(rect, new Scalar(expectedValue), -1); - [Test] - public void MatOfShortFromArray() + using var subMat = mat[rect]; + Assert.Equal(rect.Width, subMat.Cols); + Assert.Equal(rect.Height, subMat.Rows); + + for (int r = 0; r < subMat.Rows; r++) { - var array = new short[] { 7, 8, 9 }; - var m = MatOfShort.FromArray(array); + for (int c = 0; c < subMat.Cols; c++) + { + Assert.Equal(expectedValue, subMat.Get(r, c)); + } + } + } + + [Fact] + public void SetSubMat() + { + const byte expectedValue = 128; + + using var mat = new Mat(10, 10, MatType.CV_8UC1, Scalar.All(0)); + + var rect = new Rect(2, 2, 7, 5); + mat[rect].SetTo(expectedValue); - var indexer = m.GetIndexer(); - for (int i = 0; i < array.Length; i++) + for (int r = rect.Top; r < rect.Bottom; r++) + { + for (int c = rect.Left; c < rect.Right; c++) { - Assert.That(m.Get(i), Is.EqualTo(array[i])); - Assert.That(indexer[i], Is.EqualTo(array[i])); + Assert.Equal(expectedValue, mat.Get(r, c)); } } + } + + [Fact] + public void RowMat() + { + const byte expectedValue = 128; + + using var mat = new Mat(10, 10, MatType.CV_8UC1, Scalar.All(0)); + + mat.Row(5).SetTo(expectedValue); - [Test] - public void MatOfShortFromRectangularArray() + for (int r = 0; r < mat.Rows; r++) { - var array = new short[,] { { 1, 2 }, { 3, 4 } }; - var m = MatOfShort.FromArray(array); + for (int c = 0; c < mat.Cols; c++) + { + var exp = (r == 5) ? expectedValue : 0; + Assert.Equal(exp, mat.Get(r, c)); + } + } + } + + [Fact] + public void RowMatCopyTo() + { + using var lenna = LoadImage("lenna.png", ImreadModes.Grayscale); + using var mat = new Mat(lenna.Rows, lenna.Cols, MatType.CV_8UC1, Scalar.All(0)); + + using var lenna10 = lenna.Row(10); + using var mat10 = mat.Row(10); + /* + testOutputHelper.WriteLine("Data={0}, DataStart={1}, DataEnd={2}", lenna.Data, lenna.DataStart, lenna.DataEnd); + testOutputHelper.WriteLine("Data={0}, DataStart={1}, DataEnd={2}", lenna10.Data, lenna10.DataStart, lenna10.DataEnd); + testOutputHelper.WriteLine("Data={0}, DataStart={1}, DataEnd={2}", mat.Data, mat.DataStart, mat.DataEnd); + testOutputHelper.WriteLine("Data={0}, DataStart={1}, DataEnd={2}", mat10.Data, mat10.DataStart, mat10.DataEnd); + //*/ + lenna10.CopyTo(mat10); - var indexer = m.GetIndexer(); - for (int i = 0; i < array.GetLength(0); i++) + for (int r = 0; r < mat.Rows; r++) + { + for (int c = 0; c < mat.Cols; c++) { - for (int j = 0; j < array.GetLength(1); j++) - { - Assert.That(m.Get(i, j), Is.EqualTo(array[i, j])); - Assert.That(indexer[i, j], Is.EqualTo(array[i, j])); - } + var exp = (r == 10) ? lenna.Get(r, c) : 0; + Assert.Equal(exp, mat.Get(r, c)); } } + } + + [Fact(Skip = "heavy")] + public void Issue349() + { + var array = new float[8, 8]; + var handle = + System.Runtime.InteropServices.GCHandle.Alloc(array, + System.Runtime.InteropServices.GCHandleType.Pinned); + var ptr = handle.AddrOfPinnedObject(); + using var mat1 = Mat.FromPixelData(8, 8, MatType.CV_32FC1, ptr); + for (long i = 0; i < 1000000; i++) + { + using var mat2 = mat1.Idct(); + GC.KeepAlive(mat2); + } + + handle.Free(); + } + + /// + /// https://github.com/shimat/opencvsharp/issues/684 + /// + [Fact] + public void TestStreamWriting() + { + using var m = new Mat(new Size(87, 92), MatType.CV_8UC1); + m.Randn(Scalar.RandomColor(), new Scalar(7)); + + using var stream = new System.IO.MemoryStream(); + stream.Write([1, 2, 3, 4], 0, 4); + m.WriteToStream(stream); + + stream.Position = 4; + using var m2 = Mat.FromStream(stream, ImreadModes.Unchanged); + Assert.Equal(m.Size(), m2.Size()); + } + + /// + /// https://github.com/shimat/opencvsharp/issues/1288 + /// + [Theory] + [InlineData(0)] + [InlineData(1)] + public void TypeOfMatByteClone(int size) + { + { + using var expected = new Mat(size, size, MatType.CV_8U); + using var actual = expected.Clone(); + Assert.Equal(expected.Type(), actual.Type()); + } + { + using var expected = new Mat(size, size); + using var actual = expected.Clone(); + Assert.Equal(expected.Type(), actual.Type()); + } + } - [Test] - public void MatOfByteFromArray() + /// + /// https://github.com/shimat/opencvsharp/issues/1288 + /// + [Theory] + [InlineData(0)] + [InlineData(1)] + public void TypeOfMatIntClone(int size) + { + { + using var expected = new Mat(size, size, MatType.CV_32S); + using var actual = expected.Clone(); + Assert.Equal(expected.Type(), actual.Type()); + } { - var array = new byte[] { 7, 8, 9 }; - var m = MatOfByte.FromArray(array); + using var expected = new Mat(size, size); + using var actual = expected.Clone(); + Assert.Equal(expected.Type(), actual.Type()); + } + } - var indexer = m.GetIndexer(); - for (int i = 0; i < array.Length; i++) + /// + /// https://github.com/shimat/opencvsharp/issues/1288 + /// + [Theory] + [InlineData(0)] + [InlineData(1)] + public void TypeOfMatDoubleClone(int size) + { + { + using var expected = new Mat(size, size, MatType.CV_64F); + using var actual = expected.Clone(); + Assert.Equal(expected.Type(), actual.Type()); + } + { + using var expected = new Mat(size, size); + using var actual = expected.Clone(); + Assert.Equal(expected.Type(), actual.Type()); + } + } + + /// + /// https://github.com/shimat/opencvsharp/issues/1312 + /// + [Fact] + public void CreateMultiDimensional() + { + using var m = new Mat([10, 20, 30], MatType.CV_8UC1); + + Assert.False(m.Empty()); + Assert.Equal(3, m.Dims); + Assert.Equal(-1, m.Rows); + Assert.Equal(-1, m.Cols); + Assert.Equal(new Size(20, 10), m.Size()); + Assert.Equal(10, m.Size(0)); + Assert.Equal(20, m.Size(1)); + Assert.Equal(30, m.Size(2)); + } + + /// + /// https://github.com/shimat/opencvsharp/issues/1312 + /// + [Fact] + public void SubmatOfMultiDimensionalMat() + { + using var m = new Mat([5, 6, 7], MatType.CV_8UC1); + for (int i = 0; i < 5; i++) + { + for (int j = 0; j < 6; j++) { - Assert.That(m.Get(i), Is.EqualTo(array[i])); - Assert.That(indexer[i], Is.EqualTo(array[i])); + for (int k = 0; k < 7; k++) + { + m.At(i, j, k) = (byte)(i + j + k); + } } } - [Test] - public void MatOfByteFromRectangularArray() + for (int i = 0; i < 5; i++) { - var array = new byte[,] { { 1, 2 }, { 3, 4 } }; - var m = MatOfByte.FromArray(array); + using var mi_3d = m.SubMat(new Range(i, i + 1), Range.All, Range.All); + Assert.Equal(3, mi_3d.Dims); + Assert.Equal(1, mi_3d.Size(0)); + Assert.Equal(6, mi_3d.Size(1)); + Assert.Equal(7, mi_3d.Size(2)); - var indexer = m.GetIndexer(); - for (int i = 0; i < array.GetLength(0); i++) + using var mi = mi_3d.Reshape(0, mi_3d.Size(1), mi_3d.Size(2)); + Assert.Equal(2, mi.Dims); + Assert.Equal(6, mi.Size(0)); + Assert.Equal(7, mi.Size(1)); + + for (int j = 0; j < 6; j++) { - for (int j = 0; j < array.GetLength(1); j++) + for (int k = 0; k < 7; k++) { - Assert.That(m.Get(i, j), Is.EqualTo(array[i, j])); - Assert.That(indexer[i, j], Is.EqualTo(array[i, j])); + Assert.Equal((byte)(i + j + k), mi.At(j, k)); } } } } } - diff --git a/test/OpenCvSharp.Tests/core/MatTypeTest.cs b/test/OpenCvSharp.Tests/core/MatTypeTest.cs new file mode 100644 index 000000000..4c62535ee --- /dev/null +++ b/test/OpenCvSharp.Tests/core/MatTypeTest.cs @@ -0,0 +1,98 @@ +using Xunit; + +// ReSharper disable ReturnValueOfPureMethodIsNotUsed + +namespace OpenCvSharp.Tests.Core; + +public class MatTypeTest : TestBase +{ + [Fact] + public void CreateByChannels() + { + Assert.Equal(MatType.CV_8UC1, MatType.CV_8UC(1)); + Assert.Equal(MatType.CV_8UC2, MatType.CV_8UC(2)); + Assert.Equal(MatType.CV_8UC3, MatType.CV_8UC(3)); + Assert.Equal(MatType.CV_8UC4, MatType.CV_8UC(4)); + Assert.Equal(MatType.CV_8SC1, MatType.CV_8SC(1)); + Assert.Equal(MatType.CV_8SC2, MatType.CV_8SC(2)); + Assert.Equal(MatType.CV_8SC3, MatType.CV_8SC(3)); + Assert.Equal(MatType.CV_8SC4, MatType.CV_8SC(4)); + Assert.Equal(MatType.CV_16UC1, MatType.CV_16UC(1)); + Assert.Equal(MatType.CV_16UC2, MatType.CV_16UC(2)); + Assert.Equal(MatType.CV_16UC3, MatType.CV_16UC(3)); + Assert.Equal(MatType.CV_16UC4, MatType.CV_16UC(4)); + Assert.Equal(MatType.CV_16SC1, MatType.CV_16SC(1)); + Assert.Equal(MatType.CV_16SC2, MatType.CV_16SC(2)); + Assert.Equal(MatType.CV_16SC3, MatType.CV_16SC(3)); + Assert.Equal(MatType.CV_16SC4, MatType.CV_16SC(4)); + Assert.Equal(MatType.CV_32SC1, MatType.CV_32SC(1)); + Assert.Equal(MatType.CV_32SC2, MatType.CV_32SC(2)); + Assert.Equal(MatType.CV_32SC3, MatType.CV_32SC(3)); + Assert.Equal(MatType.CV_32SC4, MatType.CV_32SC(4)); + Assert.Equal(MatType.CV_32FC1, MatType.CV_32FC(1)); + Assert.Equal(MatType.CV_32FC2, MatType.CV_32FC(2)); + Assert.Equal(MatType.CV_32FC3, MatType.CV_32FC(3)); + Assert.Equal(MatType.CV_32FC4, MatType.CV_32FC(4)); + Assert.Equal(MatType.CV_64FC1, MatType.CV_64FC(1)); + Assert.Equal(MatType.CV_64FC2, MatType.CV_64FC(2)); + Assert.Equal(MatType.CV_64FC3, MatType.CV_64FC(3)); + Assert.Equal(MatType.CV_64FC4, MatType.CV_64FC(4)); + } + + [Fact] + public void MakeType() + { + Assert.Equal(MatType.CV_8UC(1), MatType.MakeType(MatType.CV_8U, 1)); + Assert.Equal(MatType.CV_8UC(2), MatType.MakeType(MatType.CV_8U, 2)); + Assert.Equal(MatType.CV_8UC(3), MatType.MakeType(MatType.CV_8U, 3)); + Assert.Equal(MatType.CV_8UC(4), MatType.MakeType(MatType.CV_8U, 4)); + Assert.Equal(MatType.CV_8UC(5), MatType.MakeType(MatType.CV_8U, 5)); + Assert.Equal(MatType.CV_8UC(6), MatType.MakeType(MatType.CV_8U, 6)); + Assert.Equal(MatType.CV_8SC(1), MatType.MakeType(MatType.CV_8S, 1)); + Assert.Equal(MatType.CV_8SC(2), MatType.MakeType(MatType.CV_8S, 2)); + Assert.Equal(MatType.CV_8SC(3), MatType.MakeType(MatType.CV_8S, 3)); + Assert.Equal(MatType.CV_8SC(4), MatType.MakeType(MatType.CV_8S, 4)); + Assert.Equal(MatType.CV_8SC(5), MatType.MakeType(MatType.CV_8S, 5)); + Assert.Equal(MatType.CV_8SC(6), MatType.MakeType(MatType.CV_8S, 6)); + Assert.Equal(MatType.CV_16UC(1), MatType.MakeType(MatType.CV_16U, 1)); + Assert.Equal(MatType.CV_16UC(2), MatType.MakeType(MatType.CV_16U, 2)); + Assert.Equal(MatType.CV_16UC(3), MatType.MakeType(MatType.CV_16U, 3)); + Assert.Equal(MatType.CV_16UC(4), MatType.MakeType(MatType.CV_16U, 4)); + Assert.Equal(MatType.CV_16UC(5), MatType.MakeType(MatType.CV_16U, 5)); + Assert.Equal(MatType.CV_16UC(6), MatType.MakeType(MatType.CV_16U, 6)); + Assert.Equal(MatType.CV_16SC(1), MatType.MakeType(MatType.CV_16S, 1)); + Assert.Equal(MatType.CV_16SC(2), MatType.MakeType(MatType.CV_16S, 2)); + Assert.Equal(MatType.CV_16SC(3), MatType.MakeType(MatType.CV_16S, 3)); + Assert.Equal(MatType.CV_16SC(4), MatType.MakeType(MatType.CV_16S, 4)); + Assert.Equal(MatType.CV_16SC(5), MatType.MakeType(MatType.CV_16S, 5)); + Assert.Equal(MatType.CV_16SC(6), MatType.MakeType(MatType.CV_16S, 6)); + Assert.Equal(MatType.CV_32SC(1), MatType.MakeType(MatType.CV_32S, 1)); + Assert.Equal(MatType.CV_32SC(2), MatType.MakeType(MatType.CV_32S, 2)); + Assert.Equal(MatType.CV_32SC(3), MatType.MakeType(MatType.CV_32S, 3)); + Assert.Equal(MatType.CV_32SC(4), MatType.MakeType(MatType.CV_32S, 4)); + Assert.Equal(MatType.CV_32SC(5), MatType.MakeType(MatType.CV_32S, 5)); + Assert.Equal(MatType.CV_32SC(6), MatType.MakeType(MatType.CV_32S, 6)); + Assert.Equal(MatType.CV_32FC(1), MatType.MakeType(MatType.CV_32F, 1)); + Assert.Equal(MatType.CV_32FC(2), MatType.MakeType(MatType.CV_32F, 2)); + Assert.Equal(MatType.CV_32FC(3), MatType.MakeType(MatType.CV_32F, 3)); + Assert.Equal(MatType.CV_32FC(4), MatType.MakeType(MatType.CV_32F, 4)); + Assert.Equal(MatType.CV_32FC(5), MatType.MakeType(MatType.CV_32F, 5)); + Assert.Equal(MatType.CV_32FC(6), MatType.MakeType(MatType.CV_32F, 6)); + Assert.Equal(MatType.CV_64FC(1), MatType.MakeType(MatType.CV_64F, 1)); + Assert.Equal(MatType.CV_64FC(2), MatType.MakeType(MatType.CV_64F, 2)); + Assert.Equal(MatType.CV_64FC(3), MatType.MakeType(MatType.CV_64F, 3)); + Assert.Equal(MatType.CV_64FC(4), MatType.MakeType(MatType.CV_64F, 4)); + Assert.Equal(MatType.CV_64FC(5), MatType.MakeType(MatType.CV_64F, 5)); + Assert.Equal(MatType.CV_64FC(6), MatType.MakeType(MatType.CV_64F, 6)); + } + + // TODO + /*[Fact] + public void DoNotCrash16F() + { + var matType = MatType.MakeType(7, 3); + using var src = new Mat(4, 3, matType); + using var dst = new Mat(); + Cv2.Compare(src, src, dst, CmpTypes.EQ); + }*/ +} diff --git a/test/OpenCvSharp.Tests/core/RNGTest.cs b/test/OpenCvSharp.Tests/core/RNGTest.cs index 75794e954..34addbf49 100644 --- a/test/OpenCvSharp.Tests/core/RNGTest.cs +++ b/test/OpenCvSharp.Tests/core/RNGTest.cs @@ -1,32 +1,45 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; +using Xunit; -namespace OpenCvSharp.Tests.Core +namespace OpenCvSharp.Tests.Core; + +public class RNGTest : TestBase { - [TestFixture] - public class RNGTest : TestBase + [Fact] + public void Next() + { + var rng = new RNG(0xffffffff); + + Assert.Equal(130063606U, rng.Next()); + Assert.Equal(3003295397U, rng.Next()); + Assert.Equal(3870020839U, rng.Next()); + } + + [Fact] + public void Uniform() { - [Test] - public void Next() - { - var rng = new RNG(0xffffffff); - - Assert.AreEqual(130063606, rng.Next()); - Assert.AreEqual(3003295397, rng.Next()); - Assert.AreEqual(3870020839, rng.Next()); - } - - [Test] - public void Uniform() - { - var rng = new RNG(1234); - - Assert.AreEqual(4, rng.Uniform(0, 10)); - Assert.AreEqual(6, rng.Uniform(0, 10)); - Assert.AreEqual(9, rng.Uniform(0, 10)); - } + var rng = new RNG(1234); + + Assert.Equal(4, rng.Uniform(0, 10)); + Assert.Equal(6, rng.Uniform(0, 10)); + Assert.Equal(9, rng.Uniform(0, 10)); + } + + [Fact] + public void GetTheRNG() + { + var rng1 = Cv2.GetTheRNG(); + var rng2 = Cv2.GetTheRNG(); + + Assert.Equal(rng1.State, rng2.State); + } + + [Fact] + public void SetTheRNG() + { + Cv2.SetTheRNG(12345UL); + + var rng = Cv2.GetTheRNG(); + + Assert.Equal(12345UL, rng.State); } } diff --git a/test/OpenCvSharp.Tests/core/RNG_MT19937Test.cs b/test/OpenCvSharp.Tests/core/RNG_MT19937Test.cs index d85334e09..fc0297939 100644 --- a/test/OpenCvSharp.Tests/core/RNG_MT19937Test.cs +++ b/test/OpenCvSharp.Tests/core/RNG_MT19937Test.cs @@ -1,33 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; +using Xunit; -namespace OpenCvSharp.Tests.Core +namespace OpenCvSharp.Tests.Core; +#pragma warning disable CA1707 + +// ReSharper disable once InconsistentNaming +public class RNG_MT19937Test : TestBase { - [TestFixture] - // ReSharper disable once InconsistentNaming - public class RNG_MT19937Test : TestBase + [Fact] + public void Next() { - [Test] - public void Next() - { - var rng = new RNG_MT19937(0xffffffff); + var rng = new RNG_MT19937(0xffffffff); - Assert.AreEqual(419326371, rng.Next()); - Assert.AreEqual(479346978, rng.Next()); - Assert.AreEqual(3918654476, rng.Next()); - } + Assert.Equal(419326371U, rng.Next()); + Assert.Equal(479346978U, rng.Next()); + Assert.Equal(3918654476U, rng.Next()); + } - [Test] - public void Uniform() - { - var rng = new RNG_MT19937(1234); + [Fact] + public void Uniform() + { + var rng = new RNG_MT19937(1234); - Assert.AreEqual(5, rng.Uniform(0, 10)); - Assert.AreEqual(1, rng.Uniform(0, 10)); - Assert.AreEqual(6, rng.Uniform(0, 10)); - } + Assert.Equal(5, rng.Uniform(0, 10)); + Assert.Equal(1, rng.Uniform(0, 10)); + Assert.Equal(6, rng.Uniform(0, 10)); } } diff --git a/test/OpenCvSharp.Tests/core/Rect2dTest.cs b/test/OpenCvSharp.Tests/core/Rect2dTest.cs new file mode 100644 index 000000000..4d6200eb7 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/Rect2dTest.cs @@ -0,0 +1,128 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class Rect2dTest +{ + [Fact] + public void TopLeft() + { + var rect = new Rect2d(10, 10, 100, 100); + + Assert.Equal(10, rect.Top); + Assert.Equal(10, rect.Left); + Assert.Equal(new Point2d(10, 10), rect.TopLeft); + } + + [Fact] + public void BottomRight() + { + var rect = new Rect2d(10, 10, 100, 100); + + Assert.Equal(110, rect.Bottom); + Assert.Equal(110, rect.Right); + Assert.Equal(new Point2d(110, 110), rect.BottomRight); + } + + [Fact] + public void Contains() + { + var rect = new Rect2d(new Point2d(0, 0), new Size2d(3,3)); + + // OpenCV typically assumes that the top and left boundary of the rectangle are inclusive, + // while the right and bottom boundaries are not. https://docs.opencv.org/2.4/modules/core/doc/basic_structures.html?highlight=rect + + Assert.False(rect.Contains(0, -1)); + Assert.False(rect.Contains(-1, 0)); + Assert.False(rect.Contains(-1, -1)); + + Assert.True(rect.Contains(0, 0)); + Assert.True(rect.Contains(0, 1)); + Assert.True(rect.Contains(1, 0)); + Assert.True(rect.Contains(1, 1)); + + Assert.True(rect.Contains(2, 0)); + Assert.True(rect.Contains(2, 1)); + Assert.True(rect.Contains(2, 2)); + Assert.True(rect.Contains(0, 2)); + Assert.True(rect.Contains(1, 2)); + Assert.True(rect.Contains(2, 2)); + + Assert.False(rect.Contains(0, 3)); + Assert.False(rect.Contains(1, 3)); + Assert.False(rect.Contains(2, 3)); + Assert.False(rect.Contains(3, 3)); + Assert.False(rect.Contains(3, 0)); + Assert.False(rect.Contains(3, 1)); + Assert.False(rect.Contains(3, 2)); + Assert.False(rect.Contains(3, 3)); + } + + // https://github.com/shimat/opencvsharp/issues/74 + // https://github.com/shimat/opencvsharp/issues/75 + [Fact] + public void ContainsTopLeft() + { + var rect = new Rect2d(10, 10, 100, 100); + + Assert.True(rect.Contains(rect.TopLeft)); + Assert.True(rect.Contains(rect.Left, rect.Top)); + } + + [Fact] + public void DoNotContainsBottomRight() + { + var rect = new Rect2d(10, 10, 100, 100); + + Assert.False(rect.Contains(rect.BottomRight)); + Assert.False(rect.Contains(rect.Right, rect.Bottom)); + } + + [Fact] + public void ContainsRect() + { + var rect = new Rect2d(10, 10, 100, 100); + + Assert.True(rect.Contains(rect)); + } + + [Fact] + public void IntersectsWith() + { + var rect1 = new Rect2d(0, 0, 100, 100); + var rect2 = new Rect2d(0, 0, 100, 100); + Assert.True(rect1.IntersectsWith(rect2)); + + rect2 = new Rect2d(50, 0, 100, 100); + Assert.True(rect1.IntersectsWith(rect2)); + + rect2 = new Rect2d(100, 0, 100, 100); + Assert.False(rect1.IntersectsWith(rect2)); + } + + [Fact] + public void Intersect() + { + var rect1 = new Rect2d(0, 0, 100, 100); + var rect2 = new Rect2d(0, 0, 100, 100); + + var intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect2d(0, 0, 100, 100), intersect); + + rect2 = new Rect2d(50, 0, 100, 100); + intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect2d(50, 0, 50, 100), intersect); + + rect2 = new Rect2d(100, 0, 100, 100); + intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect2d(100, 0, 0, 100), intersect); + } + + [Fact] + public void FromLTRB() + { + var rect = Rect2d.FromLTRB(1, 2, 3, 4); + + Assert.Equal(new Rect2d(1, 2, 2, 2), rect); + } +} diff --git a/test/OpenCvSharp.Tests/core/Rect2fTest.cs b/test/OpenCvSharp.Tests/core/Rect2fTest.cs new file mode 100644 index 000000000..cb223f91e --- /dev/null +++ b/test/OpenCvSharp.Tests/core/Rect2fTest.cs @@ -0,0 +1,129 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +// ReSharper disable once InconsistentNaming +public class Rect2fTest +{ + [Fact] + public void TopLeft() + { + var rect = new Rect2f(10, 10, 100, 100); + + Assert.Equal(10, rect.Top); + Assert.Equal(10, rect.Left); + Assert.Equal(new Point2f(10, 10), rect.TopLeft); + } + + [Fact] + public void BottomRight() + { + var rect = new Rect2f(10, 10, 100, 100); + + Assert.Equal(110, rect.Bottom); + Assert.Equal(110, rect.Right); + Assert.Equal(new Point2f(110, 110), rect.BottomRight); + } + + [Fact] + public void Contains() + { + var rect = new Rect2f(new Point2f(0, 0), new Size2f(3,3)); + + // OpenCV typically assumes that the top and left boundary of the rectangle are inclusive, + // while the right and bottom boundaries are not. https://docs.opencv.org/2.4/modules/core/doc/basic_structures.html?highlight=rect + + Assert.False(rect.Contains(0, -1)); + Assert.False(rect.Contains(-1, 0)); + Assert.False(rect.Contains(-1, -1)); + + Assert.True(rect.Contains(0, 0)); + Assert.True(rect.Contains(0, 1)); + Assert.True(rect.Contains(1, 0)); + Assert.True(rect.Contains(1, 1)); + + Assert.True(rect.Contains(2, 0)); + Assert.True(rect.Contains(2, 1)); + Assert.True(rect.Contains(2, 2)); + Assert.True(rect.Contains(0, 2)); + Assert.True(rect.Contains(1, 2)); + Assert.True(rect.Contains(2, 2)); + + Assert.False(rect.Contains(0, 3)); + Assert.False(rect.Contains(1, 3)); + Assert.False(rect.Contains(2, 3)); + Assert.False(rect.Contains(3, 3)); + Assert.False(rect.Contains(3, 0)); + Assert.False(rect.Contains(3, 1)); + Assert.False(rect.Contains(3, 2)); + Assert.False(rect.Contains(3, 3)); + } + + // https://github.com/shimat/opencvsharp/issues/74 + // https://github.com/shimat/opencvsharp/issues/75 + [Fact] + public void ContainsTopLeft() + { + var rect = new Rect2f(10, 10, 100, 100); + + Assert.True(rect.Contains(rect.TopLeft)); + Assert.True(rect.Contains(rect.Left, rect.Top)); + } + + [Fact] + public void DoNotContainsBottomRight() + { + var rect = new Rect2f(10, 10, 100, 100); + + Assert.False(rect.Contains(rect.BottomRight)); + Assert.False(rect.Contains(rect.Right, rect.Bottom)); + } + + [Fact] + public void ContainsRect() + { + var rect = new Rect2f(10, 10, 100, 100); + + Assert.True(rect.Contains(rect)); + } + + [Fact] + public void IntersectsWith() + { + var rect1 = new Rect2f(0, 0, 100, 100); + var rect2 = new Rect2f(0, 0, 100, 100); + Assert.True(rect1.IntersectsWith(rect2)); + + rect2 = new Rect2f(50, 0, 100, 100); + Assert.True(rect1.IntersectsWith(rect2)); + + rect2 = new Rect2f(100, 0, 100, 100); + Assert.False(rect1.IntersectsWith(rect2)); + } + + [Fact] + public void Intersect() + { + var rect1 = new Rect2f(0, 0, 100, 100); + var rect2 = new Rect2f(0, 0, 100, 100); + + var intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect2f(0, 0, 100, 100), intersect); + + rect2 = new Rect2f(50, 0, 100, 100); + intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect2f(50, 0, 50, 100), intersect); + + rect2 = new Rect2f(100, 0, 100, 100); + intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect2f(100, 0, 0, 100), intersect); + } + + [Fact] + public void FromLTRB() + { + var rect = Rect2f.FromLTRB(1, 2, 3, 4); + + Assert.Equal(new Rect2f(1, 2, 2, 2), rect); + } +} diff --git a/test/OpenCvSharp.Tests/core/RectTest.cs b/test/OpenCvSharp.Tests/core/RectTest.cs new file mode 100644 index 000000000..b545197c1 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/RectTest.cs @@ -0,0 +1,152 @@ +using System.Runtime.InteropServices; +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class RectTest +{ + [Fact] + public void SizeOf() + { + Assert.Equal(sizeof(int)*4, Marshal.SizeOf()); + } + + [Fact] + public void TopLeft() + { + var rect = new Rect(10, 10, 100, 100); + + Assert.Equal(10, rect.Top); + Assert.Equal(10, rect.Left); + Assert.Equal(new Point(10, 10), rect.TopLeft); + } + + [Fact] + public void BottomRight() + { + var rect = new Rect(10, 10, 100, 100); + + Assert.Equal(110, rect.Bottom); + Assert.Equal(110, rect.Right); + Assert.Equal(new Point(110, 110), rect.BottomRight); + } + + [Fact] + public void Contains() + { + var rect = new Rect(new Point(0, 0), new Size(3,3)); + + // OpenCV typically assumes that the top and left boundary of the rectangle are inclusive, + // while the right and bottom boundaries are not. https://docs.opencv.org/2.4/modules/core/doc/basic_structures.html?highlight=rect + + Assert.False(rect.Contains(0, -1)); + Assert.False(rect.Contains(-1, 0)); + Assert.False(rect.Contains(-1, -1)); + + Assert.True(rect.Contains(0, 0)); + Assert.True(rect.Contains(0, 1)); + Assert.True(rect.Contains(1, 0)); + Assert.True(rect.Contains(1, 1)); + + Assert.True(rect.Contains(2, 0)); + Assert.True(rect.Contains(2, 1)); + Assert.True(rect.Contains(2, 2)); + Assert.True(rect.Contains(0, 2)); + Assert.True(rect.Contains(1, 2)); + Assert.True(rect.Contains(2, 2)); + + Assert.False(rect.Contains(0, 3)); + Assert.False(rect.Contains(1, 3)); + Assert.False(rect.Contains(2, 3)); + Assert.False(rect.Contains(3, 3)); + Assert.False(rect.Contains(3, 0)); + Assert.False(rect.Contains(3, 1)); + Assert.False(rect.Contains(3, 2)); + Assert.False(rect.Contains(3, 3)); + } + + // https://github.com/shimat/opencvsharp/issues/74 + // https://github.com/shimat/opencvsharp/issues/75 + [Fact] + public void ContainsTopLeft() + { + var rect = new Rect(10, 10, 100, 100); + + Assert.True(rect.Contains(rect.TopLeft)); + Assert.True(rect.Contains(rect.Left, rect.Top)); + } + + [Fact] + public void DoNotContainsBottomRight() + { + var rect = new Rect(10, 10, 100, 100); + + Assert.False(rect.Contains(rect.BottomRight)); + Assert.False(rect.Contains(rect.Right, rect.Bottom)); + } + + [Fact] + public void ContainsRect() + { + var rect = new Rect(10, 10, 100, 100); + + Assert.True(rect.Contains(rect)); + } + + [Fact] + public void IntersectsWith() + { + var rect1 = new Rect(0, 0, 100, 100); + var rect2 = new Rect(0, 0, 100, 100); + Assert.True(rect1.IntersectsWith(rect2)); + + rect2 = new Rect(50, 0, 100, 100); + Assert.True(rect1.IntersectsWith(rect2)); + + rect2 = new Rect(100, 0, 100, 100); + Assert.False(rect1.IntersectsWith(rect2)); + } + + [Fact] + public void Intersect() + { + var rect1 = new Rect(0, 0, 100, 100); + var rect2 = new Rect(0, 0, 100, 100); + + var intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect(0, 0, 100, 100), intersect); + + rect2 = new Rect(50, 0, 100, 100); + intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect(50, 0, 50, 100), intersect); + + rect2 = new Rect(100, 0, 100, 100); + intersect = rect1.Intersect(rect2); + Assert.Equal(new Rect(100, 0, 0, 100), intersect); + } + + [Fact] + public void FromLTRB() + { + Rect source = Rect.FromLTRB(1, 2, 3, 4); + + var rect = Rect.FromLTRB(source.Left, source.Top, source.Right, source.Bottom); + + Assert.Equal(source, rect); + } + + [Fact] + public void FromLTRBTestCoordinates() + { + var left = 10; + var top = 20; + var right = 30; + var bottom = 40; + var rect = Rect.FromLTRB(left, top, right, bottom); + + Assert.Equal(left, rect.Left); + Assert.Equal(top, rect.Top); + Assert.Equal(right, rect.Right); + Assert.Equal(bottom, rect.Bottom); + } +} diff --git a/test/OpenCvSharp.Tests/core/RotatedRectTest.cs b/test/OpenCvSharp.Tests/core/RotatedRectTest.cs new file mode 100644 index 000000000..ebc56b50a --- /dev/null +++ b/test/OpenCvSharp.Tests/core/RotatedRectTest.cs @@ -0,0 +1,47 @@ +using System.Globalization; +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class RotatedRectTest +{ + [Fact] + public void FromThreeVertexPoints() + { + for (int angle = -360; angle <= +360; angle++) + { + var rt1 = new RotatedRect( + center: new(50.5f, 50.5f), + size: new(100.5f, 100.5f), + angle: angle); + var p = rt1.Points(); + var rt2 = new RotatedRect(p[0], p[1], p[2]); + + var rt2Native = RotatedRect.FromThreeVertexPoints(p[0], p[1], p[2]); + + // same as native result + Assert.Equal(rt2.Angle, rt2Native.Angle, 1e-4); + Assert.Equal(rt2.Center.X, rt2Native.Center.X, 1e-4); + Assert.Equal(rt2.Center.Y, rt2Native.Center.Y, 1e-4); + Assert.Equal(rt2.Size.Width, rt2Native.Size.Width, 1e-4); + Assert.Equal(rt2.Size.Height, rt2Native.Size.Height, 1e-4); + + const double tolerance = 0.0001; + var angleDiff = Math.Abs(rt2.Angle - rt1.Angle) % 90; + Assert.True( + (angleDiff < tolerance || angleDiff > 90 - tolerance) + && Math.Abs(rt2.Center.X - rt1.Center.X) < tolerance + && Math.Abs(rt2.Center.Y - rt1.Center.Y) < tolerance + && Math.Abs(rt2.Size.Width - rt1.Size.Width) < tolerance + && Math.Abs(rt2.Size.Height - rt1.Size.Height) < tolerance, + string.Format( + CultureInfo.InvariantCulture, + $"angle={angle}\n" + + $"angleDiff = {angleDiff}" + + "1 rtAngle={0} rtCenterX={1} rtCenterY={2} rtWidth={3} rtHeight={4}\n" + + "2 rtAngle={5} rtCenterX={6} rtCenterY={7} rtWidth={8} rtHeight={9}\n", + rt1.Angle, rt1.Center.X, rt1.Center.Y, rt1.Size.Width, rt1.Size.Height, + rt2.Angle, rt2.Center.X, rt2.Center.Y, rt2.Size.Width, rt2.Size.Height)); + } + } +} diff --git a/test/OpenCvSharp.Tests/core/ScalarTest.cs b/test/OpenCvSharp.Tests/core/ScalarTest.cs new file mode 100644 index 000000000..a681aa67c --- /dev/null +++ b/test/OpenCvSharp.Tests/core/ScalarTest.cs @@ -0,0 +1,13 @@ +using System.Runtime.InteropServices; +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class ScalarTest +{ + [Fact] + public void SizeOf() + { + Assert.Equal(sizeof(double)*4, Marshal.SizeOf()); + } +} diff --git a/test/OpenCvSharp.Tests/core/SizeTest.cs b/test/OpenCvSharp.Tests/core/SizeTest.cs new file mode 100644 index 000000000..5d6effb13 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/SizeTest.cs @@ -0,0 +1,19 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class SizeTest +{ + [Fact] + // ReSharper disable once InconsistentNaming + public void Size2f() + { + var obj = new Size2f(0.5, 0.5); + Assert.Equal(0.5, obj.Width, 6); + Assert.Equal(0.5, obj.Height, 6); + + obj = new Size2f(0.5f, 0.5f); + Assert.Equal(0.5f, obj.Width, 1e-6); + Assert.Equal(0.5f, obj.Height, 1e-6); + } +} diff --git a/test/OpenCvSharp.Tests/core/SolveEquationTest.cs b/test/OpenCvSharp.Tests/core/SolveEquationTest.cs index b816d40f6..ec59047e7 100644 --- a/test/OpenCvSharp.Tests/core/SolveEquationTest.cs +++ b/test/OpenCvSharp.Tests/core/SolveEquationTest.cs @@ -1,56 +1,63 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; -namespace OpenCvSharp.Tests.Core +// ReSharper disable RedundantArgumentDefaultValue + +namespace OpenCvSharp.Tests.Core; + +public class SolveEquationTest : TestBase { - [TestFixture] - public class SolveEquationTest : TestBase + private readonly ITestOutputHelper testOutputHelper; + + public SolveEquationTest(ITestOutputHelper testOutputHelper) { - [Test] - public void ByMat() - { - // x + y = 10 - // 2x + 3y = 26 - // (x=4, y=6) - - double[,] av = {{1, 1}, - {2, 3}}; - double[] yv = { 10, 26 }; - - Mat a = new Mat(2, 2, MatType.CV_64FC1, av); - Mat y = new Mat(2, 1, MatType.CV_64FC1, yv); - Mat x = new Mat(); - - Cv2.Solve(a, y, x, DecompTypes.LU); - - Console.WriteLine("X1 = {0}, X2 = {1}", x.At(0), x.At(1)); - Assert.That(x.At(0), Is.EqualTo(4).Within(1e-6)); - Assert.That(x.At(1), Is.EqualTo(6).Within(1e-6)); - } - - [Test] - public void ByNormalArray() - { - // x + y = 10 - // 2x + 3y = 26 - // (x=4, y=6) - - double[,] a = {{1, 1}, - {2, 3}}; - double[] y = { 10, 26 }; - - List x = new List(); - - Cv2.Solve( - InputArray.Create(a), InputArray.Create(y), - OutputArray.Create(x), - DecompTypes.LU); - - Console.WriteLine("X1 = {0}, X2 = {1}", x[0], x[1]); - Assert.That(x[0], Is.EqualTo(4).Within(1e-6)); - Assert.That(x[1], Is.EqualTo(6).Within(1e-6)); - } + this.testOutputHelper = testOutputHelper; } -} + [Fact] + public void ByMat() + { + // x + y = 10 + // 2x + 3y = 26 + // (x=4, y=6) + + double[,] av = { + {1, 1}, + {2, 3}}; + double[] yv = [10, 26]; + + using var a = Mat.FromPixelData(2, 2, MatType.CV_64FC1, av); + using var y = Mat.FromPixelData(2, 1, MatType.CV_64FC1, yv); + using var x = new Mat(); + + Cv2.Solve(a, y, x, DecompTypes.LU); + + testOutputHelper.WriteLine("X1 = {0}, X2 = {1}", x.At(0), x.At(1)); + Assert.Equal(4, x.At(0), 6); + Assert.Equal(6, x.At(1), 6); + } + + [Fact] + public void ByNormalArray() + { + // x + y = 10 + // 2x + 3y = 26 + // (x=4, y=6) + + double[,] a = { + {1, 1}, + {2, 3}}; + double[] y = [10, 26]; + + var x = new List(); + + using var ia = InputArray.Create(a); + using var iy = InputArray.Create(y); + using var ox = OutputArray.Create(x); + Cv2.Solve(ia, iy, ox, DecompTypes.LU); + + testOutputHelper.WriteLine("X1 = {0}, X2 = {1}", x[0], x[1]); + Assert.Equal(4, x[0], 6); + Assert.Equal(6, x[1], 6); + } +} diff --git a/test/OpenCvSharp.Tests/core/SparseMatTest.cs b/test/OpenCvSharp.Tests/core/SparseMatTest.cs new file mode 100644 index 000000000..39bfe00d0 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/SparseMatTest.cs @@ -0,0 +1,49 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class SparseMatTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var sm = new SparseMat([10, 20], MatType.CV_64FC1)) + { + GC.KeepAlive(sm); + } + } + + [Fact] + public void Dims() + { + using (var sm = new SparseMat([10, 20], MatType.CV_16SC1)) + { + Assert.Equal(2, sm.Dims()); + } + } + + [Fact] + public void Channels() + { + using (var sm = new SparseMat([10, 20], MatType.CV_32FC4)) + { + Assert.Equal(4, sm.Channels()); + } + using (var sm = new SparseMat([10, 20], MatType.CV_16SC2)) + { + Assert.Equal(2, sm.Channels()); + } + } + + [Fact] + public void ConvertToMat() + { + using (var sm = new SparseMat([10, 20], MatType.CV_8UC1)) + using (var m = new Mat()) + { + sm.ConvertTo(m, MatType.CV_8UC1); + Assert.Equal(10, m.Rows); + Assert.Equal(20, m.Cols); + } + } +} diff --git a/test/OpenCvSharp.Tests/core/UMatTest.cs b/test/OpenCvSharp.Tests/core/UMatTest.cs new file mode 100644 index 000000000..d205ebb76 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/UMatTest.cs @@ -0,0 +1,291 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Core; + +public class UMatTest +{ + [Fact] + public void NewAndDispose() + { + using var umat = new UMat(); + } + + [Fact] + public void Empty() + { + using var umat1 = new UMat(); + Assert.True(umat1.Empty()); + + using var umat2 = new UMat(1, 2, MatType.CV_32FC1); + Assert.False(umat2.Empty()); + } + + [Fact] + public void Size() + { + using var umat = new UMat(new Size(3,4), MatType.CV_8UC1); + Assert.Equal(new Size(3, 4), umat.Size()); + Assert.Equal(4, umat.Rows); + Assert.Equal(3, umat.Cols); + } + + [Fact] + public void Total() + { + using var umat = new UMat(new Size(3, 4), MatType.CV_8UC1); + Assert.Equal(3 * 4, umat.Total()); + } + + [Fact] + public void Dims() + { + using var umat = new UMat(new Size(1, 1), MatType.CV_16UC1); + Assert.Equal(2, umat.Dims); + } + + [Fact] + public void Step() + { + using var umat1 = new UMat(new Size(3, 3), MatType.CV_8UC1); + Assert.Equal(3 * 1 * sizeof(byte), umat1.Step()); + Assert.Equal(3 * 1, umat1.Step1()); + + using var umat2 = new UMat(new Size(3, 3), MatType.CV_8UC3); + Assert.Equal(3 * 3 * sizeof(byte), umat2.Step()); + Assert.Equal(3 * 3, umat2.Step1()); + + using var umat3 = new UMat(new Size(3, 3), MatType.CV_32SC1); + Assert.Equal(3 * 1 * sizeof(int), umat3.Step()); + Assert.Equal(3 * 1, umat3.Step1()); + + using var umat4 = new UMat(new Size(3, 3), MatType.CV_32SC3); + Assert.Equal(3 * 3 * sizeof(int), umat4.Step()); + Assert.Equal(3 * 3, umat4.Step1()); + } + + [Fact] + public void Type() + { + using var umat = new UMat(1, 2, MatType.CV_8UC1); + Assert.Equal(MatType.CV_8UC1, umat.Type()); + Assert.Equal(1, umat.Channels()); + Assert.Equal(MatType.CV_8U, umat.Depth()); + } + + [Fact] + public void ElemSize() + { + foreach (var (matTypeFunction, elemSize1) in GetInputs()) + { + for (int ch = 1; ch <= 6; ch++) + { + using var umat = new UMat(1, 1, matTypeFunction(ch)); + Assert.Equal(elemSize1, umat.ElemSize1()); + Assert.Equal(elemSize1 * ch, umat.ElemSize()); + } + } + + static IEnumerable<(Func MatTypeFunction, int elemSize1)> GetInputs() + { + yield return (MatType.CV_8UC, 1); + yield return (MatType.CV_16SC, 2); + yield return (MatType.CV_32SC, 4); + yield return (MatType.CV_32FC, 4); + yield return (MatType.CV_64FC, 8); + } + } + + [Fact] + public void GetMat() + { + using var umat = new UMat(1, 1, MatType.CV_8UC3, new Scalar(1, 2, 3)); + using var mat = umat.GetMat(AccessFlag.READ); + + Assert.Equal(umat.Size(), mat.Size()); + Assert.Equal(umat.Type(), mat.Type()); + Assert.Equal(new Vec3b(1, 2, 3), mat.Get(0, 0)); + } + + [Fact] + public void CastToInputArray() + { + using var src = new UMat(1, 1, MatType.CV_8UC1, new Scalar(64)); + using var dst = new UMat(); + + Cv2.BitwiseNot(src, dst); + + AssertEquals(dst, MatType.CV_8UC1, new byte[,] {{255 - 64}}); + } + + [Fact] + public void Diag() + { + using var main = new UMat(3, 1, MatType.CV_32FC1, new Scalar(3)); + using var diag = UMat.Diag(main); + + AssertEquals(diag, MatType.CV_32FC1, new float[,] + { + { 3, 0, 0 }, + { 0, 3, 0 }, + { 0, 0, 3 } + }); + } + + [Fact] + public void CopyToClone() + { + var values = new double[,] { { 1, 2 }, { 3, 4 } }; + using var srcMat = Mat.FromArray(values); + + using var srcUMat = new UMat(); + srcMat.CopyTo(srcUMat); + + var dstUMat = srcUMat.Clone(); + + AssertEquals(dstUMat, MatType.CV_64FC1, values); + } + + [Fact] + public void AssignTo() + { + using var srcUMat = new UMat(2, 2, MatType.CV_32SC1, Scalar.All(1234)); + + using var dstUMat = new UMat(); + srcUMat.AssignTo(dstUMat); + + AssertEquals(dstUMat, MatType.CV_32SC1, new [,] + { + { 1234, 1234 }, { 1234, 1234 } + }); + } + + [Fact] + public void SetTo() + { + using var umat = new UMat(2, 2, MatType.CV_16SC1); + umat.SetTo(Scalar.All(-5)); + + AssertEquals(umat, MatType.CV_16SC1, new short[,] + { + { -5, -5 }, { -5, -5 } + }); + } + + [Fact] + public void Dot() + { + using var mat1 = Mat.FromPixelData(2, 1, MatType.CV_32SC1, new[] { 1, 2 }); + using var mat2 = Mat.FromPixelData(2, 1, MatType.CV_32SC1, new[] { 3, 4 }); + + using var umat1 = new UMat(2, 1, MatType.CV_32SC1); + using var umat2 = new UMat(2, 1, MatType.CV_32SC1); + mat1.CopyTo(umat1); + mat2.CopyTo(umat2); + + Assert.Equal(1 * 3 + 2 * 4, umat1.Dot(umat2), 6); + } + + [Fact] + public void Zeros() + { + using var umat = UMat.Zeros(2, 3, MatType.CV_16SC1); + + AssertEquals(umat, MatType.CV_16SC1, new short[,] + { + { 0, 0, 0 }, { 0, 0, 0 } + }); + } + + [Fact] + public void Ones() + { + using var umat = UMat.Ones(2, 3, MatType.CV_8UC1); + + AssertEquals(umat, MatType.CV_8UC1, new byte[,] + { + { 1, 1, 1 }, { 1, 1, 1 } + }); + } + + [Fact] + public void Eye() + { + using var umat = UMat.Eye(3, 3, MatType.CV_32FC1); + + AssertEquals(umat, MatType.CV_32FC1, new float[,] + { + { 1, 0, 0 }, + { 0, 1, 0 }, + { 0, 0, 1 } + }); + } + + [Fact] + public void SubmatByRect() + { + var values = new double[,] + { + { 1, 2, 3, 4 }, + { 5, 6, 7, 8 }, + { 9, 10, 11, 12 }, + { 13, 14, 15, 16 } + }; + using var srcMat = Mat.FromArray(values); + using var srcUMat = new UMat(); + srcMat.CopyTo(srcUMat); + + Assert.True(srcUMat.IsContinuous()); + Assert.False(srcUMat.IsSubmatrix()); + + var subUMat = srcUMat[new Rect(1, 2, 2, 2)]; + AssertEquals(subUMat, MatType.CV_64FC1, new double[,] + { + {10, 11}, + {14, 15} + }); + Assert.False(subUMat.IsContinuous()); + Assert.True(subUMat.IsSubmatrix()); + } + + [Fact] + public void SubmatByRange() + { + var values = new double[,] + { + { 1, 2, 3, 4 }, + { 5, 6, 7, 8 }, + { 9, 10, 11, 12 }, + { 13, 14, 15, 16 } + }; + using var srcMat = Mat.FromArray(values); + using var srcUMat = new UMat(); + srcMat.CopyTo(srcUMat); + + Assert.True(srcUMat.IsContinuous()); + Assert.False(srcUMat.IsSubmatrix()); + + var subUMat = srcUMat[new Range(2, 4), new Range(1, 3)]; + AssertEquals(subUMat, MatType.CV_64FC1, new double[,] + { + {10, 11}, + {14, 15} + }); + Assert.False(subUMat.IsContinuous()); + Assert.True(subUMat.IsSubmatrix()); + } + + private static void AssertEquals(UMat umat, MatType expectedType, T[,] expectedValues) + where T : unmanaged + { + int rows = expectedValues.GetLength(0); + int cols = expectedValues.GetLength(1); + Assert.False(umat.Empty()); + Assert.Equal(rows, umat.Rows); + Assert.Equal(cols, umat.Cols); + Assert.Equal(expectedType, umat.Type()); + + using var mat = umat.GetMat(AccessFlag.READ); + Assert.True(mat.GetRectangularArray(out T[,] matValues)); + Assert.Equal(expectedValues, matValues); + } +} diff --git a/test/OpenCvSharp.Tests/core/UtilityTest.cs b/test/OpenCvSharp.Tests/core/UtilityTest.cs new file mode 100644 index 000000000..f28c8d8c5 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/UtilityTest.cs @@ -0,0 +1,132 @@ +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Core; + +public class UtilityTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public UtilityTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void GetAndSetNumThreads() + { + // GCD framework on Apple platforms causes different behaviour of SetNumThreads + // https://docs.opencv.org/3.4/db/de0/group__core__utils.html#gae78625c3c2aa9e0b83ed31b73c6549c0 + if(!System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) + { + var threads = Cv2.GetNumThreads(); + + Cv2.SetNumThreads(threads + 1); + Assert.Equal(threads + 1, Cv2.GetNumThreads()); + + Cv2.SetNumThreads(threads); + Assert.Equal(threads, Cv2.GetNumThreads()); + } + } + + [Fact] + public void GetThreadNum() => testOutputHelper.WriteLine("GetThreadNum: {0}", Cv2.GetThreadNum()); + + [Fact] + public void GetBuildInformation() + { + Assert.NotEmpty(Cv2.GetBuildInformation()); + testOutputHelper.WriteLine("GetBuildInformation: {0}", Cv2.GetBuildInformation()); + } + + [Fact] + public void GetVersionString() + { + var v = Cv2.GetVersionString(); + Assert.NotNull(v); + Assert.NotEmpty(v); + testOutputHelper.WriteLine("GetVersionString: {0}", v); + } + + [Fact] + public void GetVersionMajor() + => testOutputHelper.WriteLine("GetVersionMajor: {0}", Cv2.GetVersionMajor()); + + [Fact] + public void GetVersionMinor() + => testOutputHelper.WriteLine("GetVersionMinor: {0}", Cv2.GetVersionMinor()); + + [Fact] + public void GetVersionRevision() + => testOutputHelper.WriteLine("GetVersionRevision: {0}", Cv2.GetVersionRevision()); + + [Fact] + public void GetTickCount() + => testOutputHelper.WriteLine("GetTickCount: {0}", Cv2.GetTickCount()); + + [Fact] + public void GetTickFrequency() + => testOutputHelper.WriteLine("GetTickFrequency: {0}", Cv2.GetTickFrequency()); + + [Fact] + public void GetCpuTickCount() + => testOutputHelper.WriteLine("GetCpuTickCount: {0}", Cv2.GetCpuTickCount()); + + [Fact] + public void CheckHardwareSupport() + { + var features = (CpuFeatures[])Enum.GetValues(typeof(CpuFeatures)); + + foreach (var feature in features) + { + testOutputHelper.WriteLine("CPU Feature '{0}': {1}", feature, Cv2.CheckHardwareSupport(feature)); + } + } + + [Fact] + public void GetHardwareFeatureName() => testOutputHelper.WriteLine(Cv2.GetHardwareFeatureName(0)); + + [Fact] + public void GetCpuFeaturesLine() + { + Assert.NotEmpty(Cv2.GetCpuFeaturesLine()); + testOutputHelper.WriteLine("GetCpuFeaturesLine: {0}", Cv2.GetCpuFeaturesLine()); + } + + [Fact] + // ReSharper disable once IdentifierTypo + public void GetNumberOfCpus() => Assert.True(1 <= Cv2.GetNumberOfCpus()); + + [Theory] + [InlineData(FormatType.Default)] + [InlineData(FormatType.MATLAB)] + [InlineData(FormatType.CSV)] + [InlineData(FormatType.Python)] + [InlineData(FormatType.NumPy)] + [InlineData(FormatType.C)] + public void Format(FormatType format) + { + using var mat = Mat.FromPixelData(3, 3, MatType.CV_8UC1, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); + var result = Cv2.Format(mat, format); + Assert.NotEmpty(result); + testOutputHelper.WriteLine("Format: {0}", format); + testOutputHelper.WriteLine(result); + } + + [Theory] + [InlineData(FormatType.Default)] + [InlineData(FormatType.MATLAB)] + [InlineData(FormatType.CSV)] + [InlineData(FormatType.Python)] + [InlineData(FormatType.NumPy)] + [InlineData(FormatType.C)] + public void Dump(FormatType format) + { + using var mat = Mat.FromPixelData(3, 3, MatType.CV_8UC1, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); + var result = mat.Dump(format); + Assert.NotEmpty(result); + Assert.Equal(Cv2.Format(mat, format), result); + testOutputHelper.WriteLine("Dump: {0}", format); + testOutputHelper.WriteLine(result); + } +} diff --git a/test/OpenCvSharp.Tests/core/VecTest.cs b/test/OpenCvSharp.Tests/core/VecTest.cs new file mode 100644 index 000000000..794cf6e44 --- /dev/null +++ b/test/OpenCvSharp.Tests/core/VecTest.cs @@ -0,0 +1,212 @@ +using System.Reflection; +using Xunit; + +#pragma warning disable CA5394 // Do not use insecure randomness + +namespace OpenCvSharp.Tests.Core; + +public class VecTest +{ + [Fact] + public void Vec2b() + { + Assert.Equal( + new Vec2b(4, 6), + new Vec2b(1, 2) + new Vec2b(3, 4)); + Assert.Equal( + new Vec2b(255, 255), + new Vec2b(100, 200) + new Vec2b(200, 200)); + + Assert.Equal( + new Vec2b(9, 8), + new Vec2b(10, 10) - new Vec2b(1, 2)); + Assert.Equal( + new Vec2b(0, 0), + new Vec2b(10, 20) - new Vec2b(100, 200)); + + Assert.Equal( + new Vec2b(2, 4), + new Vec2b(1, 2) * 2); + Assert.Equal( + new Vec2b(5, 10), + new Vec2b(2, 4) * 2.5); + Assert.Equal( + new Vec2b(255, 255), + new Vec2b(1, 2) * 10000); + Assert.Equal( + new Vec2b(0, 0), + new Vec2b(1, 2) * -10000); + } + + [Fact] + public void Vec3b() + { + Assert.Equal( + new Vec3b(6, 9, 12), + new Vec3b(1, 2, 3) + new Vec3b(2, 3, 4) + new Vec3b(3, 4, 5)); + Assert.Equal( + new Vec3b(200, 255, 255), + new Vec3b(100, 150, 200) + new Vec3b(100, 150, 200)); + + Assert.Equal( + new Vec3b(9, 8, 7), + new Vec3b(10, 10, 10) - new Vec3b(1, 2, 3)); + Assert.Equal( + new Vec3b(0, 0, 0), + new Vec3b(1, 2, 3) - new Vec3b(10, 20, 30)); + + Assert.Equal( + new Vec3b(2, 4, 6), + new Vec3b(1, 2, 3) * 2); + Assert.Equal( + new Vec3b(5, 10, 15), + new Vec3b(2, 4, 6) * 2.5); + Assert.Equal( + new Vec3b(255, 255, 255), + new Vec3b(1, 2, 3) * 10000); + Assert.Equal( + new Vec3b(0, 0, 0), + new Vec3b(1, 2, 3) * -10000); + + Assert.Equal( + new Vec3b(2, 1, 0), + new Vec3b(3, 2, 1) / 2); + } + + [Fact] + public void ConversionVec2b() + { + var v = new Vec2b(1, 2); + + Assert.Equal(new Vec2s(1, 2), v.ToVec2s()); + Assert.Equal(new Vec2w(1, 2), v.ToVec2w()); + Assert.Equal(new Vec2i(1, 2), v.ToVec2i()); + Assert.Equal(new Vec2f(1, 2), v.ToVec2f()); + Assert.Equal(new Vec2d(1, 2), v.ToVec2d()); + } + + [Fact] + public void ConversionVec3b() + { + var v = new Vec3b(1, 2, 3); + + Assert.Equal(new Vec3s(1, 2, 3), v.ToVec3s()); + Assert.Equal(new Vec3w(1, 2, 3), v.ToVec3w()); + Assert.Equal(new Vec3i(1, 2, 3), v.ToVec3i()); + Assert.Equal(new Vec3f(1, 2, 3), v.ToVec3f()); + Assert.Equal(new Vec3d(1, 2, 3), v.ToVec3d()); + } + + [Fact] + public void ConversionVec4b() + { + var v = new Vec4b(1, 2, 3, 4); + + Assert.Equal(new Vec4s(1, 2, 3, 4), v.ToVec4s()); + Assert.Equal(new Vec4w(1, 2, 3, 4), v.ToVec4w()); + Assert.Equal(new Vec4i(1, 2, 3, 4), v.ToVec4i()); + Assert.Equal(new Vec4f(1, 2, 3, 4), v.ToVec4f()); + Assert.Equal(new Vec4d(1, 2, 3, 4), v.ToVec4d()); + } + + [Fact] + public void ConversionVec6b() + { + var v = new Vec6b(1, 2, 3, 4, 5, 6); + + Assert.Equal(new Vec6s(1, 2, 3, 4, 5, 6), v.ToVec6s()); + Assert.Equal(new Vec6w(1, 2, 3, 4, 5, 6), v.ToVec6w()); + Assert.Equal(new Vec6i(1, 2, 3, 4, 5, 6), v.ToVec6i()); + Assert.Equal(new Vec6f(1, 2, 3, 4, 5, 6), v.ToVec6f()); + Assert.Equal(new Vec6d(1, 2, 3, 4, 5, 6), v.ToVec6d()); + } + + + [Fact] + public void ReflectionCheck() + { + foreach (var channels in new[] {2, 3, 4, 6}) + { + CheckByType(channels); + CheckByType(channels); + CheckByType(channels); + CheckByType(channels); + CheckByType(channels); + CheckByType(channels); + } + + static void CheckByType(int channels) + where T : unmanaged + { + var depth = GetTypeString(); + var typeName = $"OpenCvSharp.Vec{channels}{depth},OpenCvSharp"; + var type = Type.GetType(typeName); + + var rand = new Random(123); + + // ItemX + var obj = Activator.CreateInstance(type!); + for (int i = 0; i < channels; i++) + { + var field = type!.GetField($"Item{i}"); + Assert.False(field!.IsInitOnly); + + var value = GetRandomValue(rand); + + field.SetValue(obj, value); + Assert.Equal(value, (T) field.GetValue(obj)!); + } + + // Indexer + obj = Activator.CreateInstance(type!); + for (int i = 0; i < channels; i++) + { + var pi = type!.GetProperties(BindingFlags.Public | BindingFlags.Instance) + .First(pp => + pp.GetIndexParameters() + .Select(pr => pr.ParameterType) + .SequenceEqual([typeof(int)])); + + var value = GetRandomValue(rand); + pi.SetValue(obj, value, [i]); + Assert.Equal(value, (T)pi.GetValue(obj, new object[]{i})!); + } + } + + static string GetTypeString() + where T : unmanaged + { + if (typeof(T) == typeof(byte)) + return "b"; + if (typeof(T) == typeof(short)) + return "s"; + if (typeof(T) == typeof(ushort)) + return "w"; + if (typeof(T) == typeof(int)) + return "i"; + if (typeof(T) == typeof(float)) + return "f"; + if (typeof(T) == typeof(double)) + return "d"; + throw new NotSupportedException("Invalid type"); + } + + static T GetRandomValue(Random random) + where T : unmanaged + { + if (typeof(T) == typeof(byte)) + return (T)(object)(byte)random.Next(byte.MinValue, byte.MaxValue); + if (typeof(T) == typeof(short)) + return (T)(object)(short)random.Next(short.MinValue, short.MaxValue); + if (typeof(T) == typeof(ushort)) + return (T)(object)(ushort)random.Next(ushort.MinValue, ushort.MaxValue); + if (typeof(T) == typeof(int)) + return (T)(object)random.Next(); + if (typeof(T) == typeof(float)) + return (T)(object)(float)random.NextDouble(); + if (typeof(T) == typeof(double)) + return (T)(object)random.NextDouble(); + throw new NotSupportedException("Invalid type"); + } + } +} diff --git a/test/OpenCvSharp.Tests/dll/x64/dummy.txt b/test/OpenCvSharp.Tests/dll/x64/dummy.txt new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/test/OpenCvSharp.Tests/dll/x64/dummy.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/dll/x64/opencv_ffmpeg320_64.dll b/test/OpenCvSharp.Tests/dll/x64/opencv_ffmpeg320_64.dll deleted file mode 100644 index 8a26deb91..000000000 Binary files a/test/OpenCvSharp.Tests/dll/x64/opencv_ffmpeg320_64.dll and /dev/null differ diff --git a/test/OpenCvSharp.Tests/dll/x86/dummy.txt b/test/OpenCvSharp.Tests/dll/x86/dummy.txt new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/test/OpenCvSharp.Tests/dll/x86/dummy.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/dll/x86/opencv_ffmpeg320.dll b/test/OpenCvSharp.Tests/dll/x86/opencv_ffmpeg320.dll deleted file mode 100644 index a58c86f85..000000000 Binary files a/test/OpenCvSharp.Tests/dll/x86/opencv_ffmpeg320.dll and /dev/null differ diff --git a/test/OpenCvSharp.Tests/dnn/CaffeTest.cs b/test/OpenCvSharp.Tests/dnn/CaffeTest.cs new file mode 100644 index 000000000..3c9275316 --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/CaffeTest.cs @@ -0,0 +1,78 @@ +using OpenCvSharp.Dnn; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Dnn; + +public class CaffeTest : TestBase, IClassFixture +{ + private readonly object lockObj = new object(); + + private readonly ITestOutputHelper testOutputHelper; + private readonly CaffeData caffe; + + public CaffeTest(ITestOutputHelper testOutputHelper, DnnDataFixture fixture) + { + if (fixture is null) + throw new ArgumentNullException(nameof(fixture)); + this.testOutputHelper = testOutputHelper; + caffe = fixture.Caffe.Value; + } + + // https://docs.opencv.org/3.3.0/d5/de7/tutorial_dnn_googlenet.html + [ExplicitFact] + public void LoadCaffeModel() + { + var net = caffe.Net; + var classNames = caffe.ClassNames; + + //testOutputHelper.WriteLine($"Layer names: {string.Join(", ", net.GetLayerNames())}"); + var layerName = net.GetLayerNames()[0]; + Assert.NotNull(layerName); + Assert.Equal(1, net.GetLayerId(layerName!)); + + // Convert Mat to batch of images + using var img = LoadImage(@"space_shuttle.jpg"); + using var inputBlob = CvDnn.BlobFromImage(img, 1, new Size(224, 224), new Scalar(104, 117, 123)); + net.SetInput(inputBlob, "data"); + using var prob = net.Forward("prob"); + // find the best class + GetMaxClass(prob, out int classId, out double classProb); + testOutputHelper.WriteLine("Best class: #{0} '{1}'", classId, classNames[classId]); + testOutputHelper.WriteLine("Probability: {0:P2}", classProb); + //Pause(); + + Assert.Equal(812, classId); + } + + /// + /// Download model file + /// + /// + /// + private void PrepareModel(Uri uri, string fileName) + { + lock (lockObj) + { + if (File.Exists(fileName)) + return; + + var contents = FileDownloader.DownloadData(uri); + File.WriteAllBytes(fileName, contents); + } + } + + /// + /// Find best class for the blob (i. e. class with maximal probability) + /// + /// + /// + /// + private static void GetMaxClass(Mat probBlob, out int classId, out double classProb) + { + // reshape the blob to 1x1000 matrix + using var probMat = probBlob.Reshape(1, 1); + Cv2.MinMaxLoc(probMat, out _, out classProb, out _, out var classNumber); + classId = classNumber.X; + } +} diff --git a/test/OpenCvSharp.Tests/dnn/DnnDataFixture.cs b/test/OpenCvSharp.Tests/dnn/DnnDataFixture.cs new file mode 100644 index 000000000..0d52c7642 --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/DnnDataFixture.cs @@ -0,0 +1,51 @@ +using OpenCvSharp.Dnn; +using Xunit; + +namespace OpenCvSharp.Tests.Dnn; + +public class CaffeData +{ + public Net Net { get; } + public IReadOnlyList ClassNames { get; } + + public CaffeData(Net net, IReadOnlyList classNames) + { + Net = net; + ClassNames = classNames; + } +} + +public sealed class DnnDataFixture : IDisposable +{ + public Lazy Caffe { get; } + + public DnnDataFixture() + { + Caffe = new Lazy(LoadCaffeModel); + } + + public void Dispose() + { + if (Caffe.IsValueCreated) + { + Caffe.Value.Net.Dispose(); + } + } + + private CaffeData LoadCaffeModel() + { + const string protoTxt = @"_data/text/bvlc_googlenet.prototxt"; + const string caffeModelUrl = "https://drive.google.com/uc?id=1RUsoiLiXrKBQu9ibwsMqR3n_UkhnZLRR"; //"http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel"; + const string caffeModel = "_data/model/bvlc_googlenet.caffemodel"; + const string synsetWords = @"_data/text/synset_words.txt"; + var classNames = File.ReadAllLines(synsetWords) + .Select(line => line.Split(' ').Last()) + .ToArray(); + + ModelDownloader.DownloadAndSave(new Uri(caffeModelUrl), caffeModel); + + var net = CvDnn.ReadNetFromCaffe(protoTxt, caffeModel); + Assert.NotNull(net); + return new CaffeData(net!, classNames); + } +} diff --git a/test/OpenCvSharp.Tests/dnn/DnnTest.cs b/test/OpenCvSharp.Tests/dnn/DnnTest.cs new file mode 100644 index 000000000..1e78dee36 --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/DnnTest.cs @@ -0,0 +1,26 @@ +using OpenCvSharp.Dnn; +using Xunit; + +namespace OpenCvSharp.Tests.Dnn; + +public class DnnTest : TestBase +{ + [Fact] + public void NMSBoxes() + { + var bboxes = new[] { + new Rect(10, 10, 20, 20), + new Rect(100, 100, 20, 20), + new Rect(1000, 1000, 20, 20) + }; + var scores = new [] { 1.0f, 0.1f, 0.6f }; + float scoreThreshold = 0.5f; + float nmsThreshold = 0.4f; + + CvDnn.NMSBoxes(bboxes, scores, scoreThreshold, nmsThreshold, out var indices); + + Assert.Equal(2, indices.Length); + Assert.Equal(0, indices[0]); + Assert.Equal(2, indices[1]); + } +} diff --git a/test/OpenCvSharp.Tests/dnn/EastTextDetectionTest.cs b/test/OpenCvSharp.Tests/dnn/EastTextDetectionTest.cs new file mode 100644 index 000000000..fc0206d93 --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/EastTextDetectionTest.cs @@ -0,0 +1,233 @@ +using System.Runtime.InteropServices; +using System.Text; +using ICSharpCode.SharpZipLib.GZip; +using ICSharpCode.SharpZipLib.Tar; +using OpenCvSharp.Dnn; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Dnn; + +/// +/// https://github.com/opencv/opencv/blob/master/samples/dnn/text_detection.cpp +/// +/// +/// +public class EastTextDetectionTest : TestBase +{ + // https://github.com/opencv/opencv_extra/blob/322b475403899abc2411c4fbf68318afa77d3191/testdata/dnn/download_models.py#L302 + const string ModelUrl = "https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1"; + const string LocalRawModelPath = "_data/model/frozen_east_text_detection.tar.gz"; + const string LocalModelPath = "_data/model/frozen_east_text_detection.pb"; + + private readonly object lockObj = new object(); + + private readonly ITestOutputHelper testOutputHelper; + + /// + /// Download model file + /// + /// + public EastTextDetectionTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper ?? throw new ArgumentNullException(nameof(testOutputHelper)); + + testOutputHelper.WriteLine("Downloading EAST Model..."); + PrepareModel(new Uri(ModelUrl), LocalRawModelPath); + testOutputHelper.WriteLine("Done"); + Assert.True(File.Exists(LocalRawModelPath), $"'{LocalRawModelPath}' not found"); + + if (!File.Exists(LocalModelPath)) + { + var modelDirectory = Path.GetDirectoryName(LocalRawModelPath)!; + ExtractTarGz(LocalRawModelPath, modelDirectory); + } + + var fileInfo = new FileInfo(LocalModelPath); + Assert.True(fileInfo.Exists, $"'{LocalModelPath}' not found"); + Assert.True(fileInfo.Length > 90 * 1024 * 1024, $"Too small data ('{fileInfo.Length}' bytes)"); + } + + /// + /// Download model file if it does not exist on local disk + /// + /// + /// + private void PrepareModel(Uri uri, string fileName) + { + lock (lockObj) + { + if (File.Exists(fileName)) + return; + + var contents = FileDownloader.DownloadData(uri); + File.WriteAllBytes(fileName, contents); + } + } + + /// + /// Simple full extract from a TGZ + /// https://github.com/icsharpcode/SharpZipLib/wiki/GZip-and-Tar-Samples + /// + /// + /// + private static void ExtractTarGz(string inputFile, string dstFolder) + { + using var inputStream = new FileStream(inputFile, FileMode.Open, FileAccess.Read); + using var gzipStream = new GZipInputStream(inputStream); + using var tarArchive = TarArchive.CreateInputTarArchive(gzipStream, Encoding.UTF8); + tarArchive.ExtractContents(dstFolder); + } + + [ExplicitFact] + public void Load() + { + Assert.True(File.Exists(LocalModelPath), $"'{LocalModelPath}' not found"); + + using var net = CvDnn.ReadNet(LocalModelPath); + } + + [ExplicitFact] + public void NotSupportedUnicodeFileName() + { + Assert.True(File.Exists(LocalModelPath), $"'{LocalModelPath}' not found"); + + var unicodeFileName = Path.Combine(Path.GetDirectoryName(LocalModelPath)!, "🤣🍀.pb"); + if (!File.Exists(unicodeFileName)) + { + File.Copy(LocalModelPath, unicodeFileName, true); + } + + // Check that ArgumentException(unicode unmappable char) does not occur. + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var ex = Assert.Throws(() => + { + using var net = CvDnn.ReadNet(unicodeFileName); + }); + Assert.StartsWith("FAILED: fs.is_open(). Can't open", ex.Message, StringComparison.InvariantCulture); + Assert.Equal("cv::dnn::ReadProtoFromBinaryFile", ex.FuncName); + } + else + { + // No error + } + } + + /// + /// detect text from image. + /// + /// + /// Name of the image file. + /// Scanned text. + [ExplicitTheory] + [InlineData("_data/image/abbey_road.jpg")] + public void DetectAllText(string fileName) + { + const int InputWidth = 320; + const int InputHeight = 320; + const float ConfThreshold = 0.5f; + const float NmsThreshold = 0.4f; + + // Load network. + using (Net net = CvDnn.ReadNet(Path.GetFullPath(LocalModelPath))) + using (Mat img = new Mat(fileName)) + + // Prepare input image + using (var blob = CvDnn.BlobFromImage(img, 1.0, new Size(InputWidth, InputHeight), new Scalar(123.68, 116.78, 103.94), true, false)) + { + // Forward Pass + // Now that we have prepared the input, we will pass it through the network. There are two outputs of the network. + // One specifies the geometry of the Text-box and the other specifies the confidence score of the detected box. + // These are given by the layers : + // feature_fusion/concat_3 + // feature_fusion/Conv_7/Sigmoid + var outputBlobNames = new string[] { "feature_fusion/Conv_7/Sigmoid", "feature_fusion/concat_3" }; + var outputBlobs = outputBlobNames.Select(_ => new Mat()).ToArray(); + + net.SetInput(blob); + net.Forward(outputBlobs, outputBlobNames); + Mat scores = outputBlobs[0]; + Mat geometry = outputBlobs[1]; + + // Decode predicted bounding boxes (decode the positions of the text boxes along with their orientation) + Decode(scores, geometry, ConfThreshold, out var boxes, out var confidences); + + // Apply non-maximum suppression procedure for filtering out the false positives and get the final predictions + CvDnn.NMSBoxes(boxes, confidences, ConfThreshold, NmsThreshold, out var indices); + + // Render detections. + Point2f ratio = new Point2f((float)img.Cols / InputWidth, (float)img.Rows / InputHeight); + for (var i = 0; i < indices.Length; ++i) + { + RotatedRect box = boxes[indices[i]]; + + Point2f[] vertices = box.Points(); + + for (int j = 0; j < 4; ++j) + { + vertices[j].X *= ratio.X; + vertices[j].Y *= ratio.Y; + } + + for (int j = 0; j < 4; ++j) + { + Cv2.Line(img, (int)vertices[j].X, (int)vertices[j].Y, (int)vertices[(j + 1) % 4].X, (int)vertices[(j + 1) % 4].Y, new Scalar(0, 255, 0), 3); + } + } + + ShowImagesWhenDebugMode(img); + } + } + + private static unsafe void Decode(Mat scores, Mat geometry, float confThreshold, out IList boxes, out IList confidences) + { + boxes = new List(); + confidences = new List(); + + if ((scores is null || scores.Dims != 4 || scores.Size(0) != 1 || scores.Size(1) != 1) || + (geometry is null || geometry.Dims != 4 || geometry.Size(0) != 1 || geometry.Size(1) != 5) || + (scores.Size(2) != geometry.Size(2) || scores.Size(3) != geometry.Size(3))) + { + return; + } + + int height = scores.Size(2); + int width = scores.Size(3); + + for (int y = 0; y < height; ++y) + { + var scoresData = new ReadOnlySpan((void*)scores.Ptr(0, 0, y), height); + var x0Data = new ReadOnlySpan((void*)geometry.Ptr(0, 0, y), height); + var x1Data = new ReadOnlySpan((void*)geometry.Ptr(0, 1, y), height); + var x2Data = new ReadOnlySpan((void*)geometry.Ptr(0, 2, y), height); + var x3Data = new ReadOnlySpan((void*)geometry.Ptr(0, 3, y), height); + var anglesData = new ReadOnlySpan((void*)geometry.Ptr(0, 4, y), height); + + for (int x = 0; x < width; ++x) + { + var score = scoresData[x]; + if (score >= confThreshold) + { + float offsetX = x * 4.0f; + float offsetY = y * 4.0f; + float angle = anglesData[x]; + float cosA = (float)Math.Cos(angle); + float sinA = (float)Math.Sin(angle); + float x0 = x0Data[x]; + float x1 = x1Data[x]; + float x2 = x2Data[x]; + float x3 = x3Data[x]; + float h = x0 + x2; + float w = x1 + x3; + Point2f offset = new Point2f(offsetX + (cosA * x1) + (sinA * x2), offsetY - (sinA * x1) + (cosA * x2)); + Point2f p1 = new Point2f((-sinA * h) + offset.X, (-cosA * h) + offset.Y); + Point2f p3 = new Point2f((-cosA * w) + offset.X, (sinA * w) + offset.Y); + RotatedRect r = new RotatedRect(new Point2f(0.5f * (p1.X + p3.X), 0.5f * (p1.Y + p3.Y)), new Size2f(w, h), (float)(-angle * 180.0f / Math.PI)); + boxes.Add(r); + confidences.Add(score); + } + } + } + } +} diff --git a/test/OpenCvSharp.Tests/dnn/ModelDownloader.cs b/test/OpenCvSharp.Tests/dnn/ModelDownloader.cs new file mode 100644 index 000000000..4b300f644 --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/ModelDownloader.cs @@ -0,0 +1,18 @@ +namespace OpenCvSharp.Tests.Dnn; + +internal static class ModelDownloader +{ + /// + /// Download model file + /// + /// + /// + public static void DownloadAndSave(Uri uri, string fileName) + { + if (File.Exists(fileName)) + return; + + var bytes = FileDownloader.DownloadData(uri); + File.WriteAllBytes(fileName, bytes); + } +} diff --git a/test/OpenCvSharp.Tests/dnn/NetTest.cs b/test/OpenCvSharp.Tests/dnn/NetTest.cs new file mode 100644 index 000000000..76d47762e --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/NetTest.cs @@ -0,0 +1,41 @@ +using OpenCvSharp.Dnn; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Dnn; + +public class NetTest : TestBase, IClassFixture +{ + private readonly ITestOutputHelper testOutputHelper; + private readonly CaffeData caffeData; + + public NetTest(ITestOutputHelper testOutputHelper, DnnDataFixture fixture) + { + if (fixture is null) + throw new ArgumentNullException(nameof(fixture)); + this.testOutputHelper = testOutputHelper; + caffeData = fixture.Caffe.Value; + } + + [Fact] + public void Empty() + { + using var net = new Net(); + Assert.True(net.Empty()); + } + + [Fact] + public void GetLayerNames() + { + using var net = new Net(); + Assert.Empty(net.GetLayerNames()); + } + + [ExplicitFact] + public void Dump() + { + var net = caffeData.Net; + var dump = net.Dump(); + Assert.NotEmpty(dump); + } +} diff --git a/test/OpenCvSharp.Tests/dnn/TensorflowTest.cs b/test/OpenCvSharp.Tests/dnn/TensorflowTest.cs new file mode 100644 index 000000000..d68279d7f --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/TensorflowTest.cs @@ -0,0 +1,70 @@ +using OpenCvSharp.Dnn; +using Xunit; + +#pragma warning disable CA1707 + +namespace OpenCvSharp.Tests.Dnn; + +public class TensorflowTest : TestBase +{ + [PlatformSpecificFact("Windows", "Linux")] + // ReSharper disable once IdentifierTypo + public void LoadMnistTrainingDataFromFile_NetRecognizesAnImageOfA9Correctly() + { + using var imgOf9 = LoadImage(Path.Combine("Dnn","MNIST_9.png"), ImreadModes.Grayscale); + + var img9DataBlob = CvDnn.BlobFromImage(imgOf9, 1f / 255.0f); + var modelPath = Path.Combine("_data", "model", "MNISTTest_tensorflow.pb"); + var res = -1; + + using (var tfGraph = CvDnn.ReadNetFromTensorflow(modelPath)) + { + Assert.NotNull(tfGraph); + tfGraph!.SetInput(img9DataBlob); + + using (var prob = tfGraph.Forward()) + res = GetResultClass(prob); + } + + Assert.Equal(9, res); + } + + [PlatformSpecificFact("Windows", "Linux")] + // ReSharper disable once IdentifierTypo + public void LoadMnistTrainingDataFromStream_NetRecognizesAnImageOfA5Correctly() + { + using var imgOf5 = LoadImage(Path.Combine("Dnn", "MNIST_5.png"), ImreadModes.Grayscale); + + var img5DataBlob = CvDnn.BlobFromImage(imgOf5, 1f / 255.0f); + var modelPath = Path.Combine("_data", "model", "MNISTTest_tensorflow.pb"); + var res = -1; + + using (var stream = new FileStream(modelPath, FileMode.Open)) + { + using (var tfGraph = CvDnn.ReadNetFromTensorflow(stream)) + { + Assert.NotNull(tfGraph); + tfGraph!.SetInput(img5DataBlob); + + using (var prob = tfGraph.Forward()) + res = GetResultClass(prob); + } + } + + Assert.Equal(5, res); + } + + private static int GetResultClass(Mat prob) + { + var dims = prob.Dims; + var imgCnt = prob.Size(0); + var channels = prob.Size(1); + Mat strip = prob.Reshape(1, channels); + + var minIdx = new[] {-1}; + var maxIdx = new[] { -1 }; + strip.MinMaxIdx(minIdx,maxIdx); + + return maxIdx[0]; + } +} diff --git a/test/OpenCvSharp.Tests/dnn/YoloTest.cs b/test/OpenCvSharp.Tests/dnn/YoloTest.cs new file mode 100644 index 000000000..fc95d882b --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn/YoloTest.cs @@ -0,0 +1,128 @@ +using OpenCvSharp.Dnn; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Dnn; + +[Collection(nameof(YoloTest))] +public class YoloTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public YoloTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + // https://github.com/opencv/opencv/blob/24bed38c2b2c71d35f2e92aa66648f8485a70892/samples/dnn/yolo_object_detection.cpp + [ExplicitFact] + public void LoadYoloV2Model() + { + RunGC(); + + const string cfgFile = @"_data/model/yolov2.cfg"; + const string cfgFileUrl = "https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov2.cfg"; + const string darknetModel = "_data/model/yolov2.weights"; + const string darknetModelUrl = "https://pjreddie.com/media/files/yolov2.weights"; + + testOutputHelper.WriteLine("Downloading YoloV2 Model..."); + PrepareFile(new Uri(cfgFileUrl), cfgFile); + PrepareFile(new Uri(darknetModelUrl), darknetModel); + testOutputHelper.WriteLine("Done"); + + RunGC(); + + using var net = CvDnn.ReadNetFromDarknet(cfgFile, darknetModel); + Assert.NotNull(net); + Assert.False(net!.Empty()); + + // Convert Mat to batch of images + using var img = LoadImage(@"space_shuttle.jpg"); + using var inputBlob = CvDnn.BlobFromImage(img, 1, new Size(224, 224), new Scalar(104, 117, 123)); + // Set input blob + net.SetInput(inputBlob, "data"); + + // Make forward pass + using var detectionMat = net.Forward("detection_out"); + // TODO + GC.KeepAlive(detectionMat); + } + + // https://github.com/opencv/opencv/blob/24bed38c2b2c71d35f2e92aa66648f8485a70892/samples/dnn/yolo_object_detection.cpp + [ExplicitFact] + public void LoadYoloV3Model() + { + RunGC(); + + const string cfgFile = @"_data/model/yolov3.cfg"; + const string cfgFileUrl = "https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3.cfg"; + const string darknetModel = "_data/model/yolov3.weights"; + const string darknetModelUrl = "https://pjreddie.com/media/files/yolov3.weights"; + + testOutputHelper.WriteLine("Downloading YoloV3 Model..."); + PrepareFile(new Uri(cfgFileUrl), cfgFile); + PrepareFile(new Uri(darknetModelUrl), darknetModel); + testOutputHelper.WriteLine("Done"); + + RunGC(); + + using (var net = CvDnn.ReadNetFromDarknet(cfgFile, darknetModel)) + using (var img = LoadImage(@"space_shuttle.jpg")) + { + Assert.NotNull(net); + Assert.False(net!.Empty()); + + var outNames = net.GetUnconnectedOutLayersNames(); + Assert.NotEmpty(outNames); + Assert.DoesNotContain(outNames, elem => elem is null); + testOutputHelper.WriteLine("UnconnectedOutLayersNames: {0}", string.Join(",", outNames)); + + // Convert Mat to batch of images + using (var inputBlob = CvDnn.BlobFromImage(img, 1, new Size(224, 224), new Scalar(104, 117, 123))) + { + // Set input blob + net.SetInput(inputBlob, "data"); + + // Make forward pass + using (var detection82 = net.Forward("yolo_82")) + using (var detection94 = net.Forward("yolo_94")) + using (var detection106 = net.Forward("yolo_106")) + { + // TODO + Assert.False(detection82.Empty()); + Assert.False(detection94.Empty()); + Assert.False(detection106.Empty()); + } + + Mat[] outs = outNames.Select(_ => new Mat()).ToArray(); + net.Forward(outs, outNames!); + + foreach (var m in outs) + { + Assert.False(m.Empty()); + m.Dispose(); + } + } + } + } + + private void PrepareFile(Uri uri, string fileName) + { + lock (lockObj) + { + if (File.Exists(fileName)) + return; + + var contents = FileDownloader.DownloadData(uri); + File.WriteAllBytes(fileName, contents); + } + } + private readonly object lockObj = new object(); + + private static void RunGC() + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + } +} diff --git a/test/OpenCvSharp.Tests/dnn_superres/DnnSuperResImplTest.cs b/test/OpenCvSharp.Tests/dnn_superres/DnnSuperResImplTest.cs new file mode 100644 index 000000000..6d38edbb7 --- /dev/null +++ b/test/OpenCvSharp.Tests/dnn_superres/DnnSuperResImplTest.cs @@ -0,0 +1,55 @@ +using OpenCvSharp.DnnSuperres; +using Xunit; + +namespace OpenCvSharp.Tests.DnnSuperres; + +public class DnnSuperResImplTest : TestBase +{ + // https://github.com/opencv/opencv_contrib/tree/master/modules/dnn_superres#models + // https://github.com/Saafke/FSRCNN_Tensorflow/tree/master/models + private const string ModelFileName = "_data/model/FSRCNN_x4.pb"; + + [Fact] + public void New() + { + using var dnn = new DnnSuperResImpl(); + } + + [Fact] + public void Upsample() + { + using var dnn = new DnnSuperResImpl("fsrcnn", 4); + dnn.ReadModel(ModelFileName); + + using var src = new Mat("_data/image/mandrill.png"); + using var dst = new Mat(); + dnn.Upsample(src, dst); + + Assert.False(dst.Empty()); + Assert.True(src.Rows < dst.Rows); + Assert.True(src.Cols < dst.Cols); + + ShowImagesWhenDebugMode(src, dst); + } + + [Theory] + [InlineData("edsr")] + [InlineData("espcn")] + [InlineData("fsrcnn")] + [InlineData("lapsrn")] + public void GetAlgorithm(string algorithm) + { + using var dnn = new DnnSuperResImpl(algorithm, 2); + Assert.Equal(algorithm, dnn.GetAlgorithm()); + } + + [Theory] + [InlineData(2)] + [InlineData(3)] + [InlineData(4)] + public void GetScale(int scale) + { + using var dnn = new DnnSuperResImpl("edsr", scale); + Assert.Equal(scale, dnn.GetScale()); + } +} diff --git a/test/OpenCvSharp.Tests/extensions/BitmapSourceConverterTest.cs b/test/OpenCvSharp.Tests/extensions/BitmapSourceConverterTest.cs deleted file mode 100644 index 0af623200..000000000 --- a/test/OpenCvSharp.Tests/extensions/BitmapSourceConverterTest.cs +++ /dev/null @@ -1,157 +0,0 @@ -#if net46 -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Threading; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Threading; -using NUnit.Framework; - -namespace OpenCvSharp.Tests.Extensions -{ - [TestFixture] - public class BitmapSourceConverterTest : TestBase - { - [Test] - public void BitmapSource8Bit() - { - Scalar blueColor8 = new Scalar(200, 0, 0); - Scalar greenColor8 = new Scalar(0, 200, 0); - Scalar redColor8 = new Scalar(0, 0, 200); - - using (var mat = new Mat(1, 1, MatType.CV_8UC3, blueColor8)) - { - var bs = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); // PixelFormats.Bgr24 - AssertPixelValue(blueColor8, bs); - } - using (var mat = new Mat(1, 1, MatType.CV_8UC3, greenColor8)) - { - var bs = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); - AssertPixelValue(greenColor8, bs); - } - using (var mat = new Mat(1, 1, MatType.CV_8UC3, redColor8)) - { - var bs = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); - AssertPixelValue(redColor8, bs); - } - } - - [Test] - public void BitmapSource16Bit() - { - Scalar blueColor16 = new Scalar(32767, 0, 0); - Scalar greenColor16 = new Scalar(0, 32767, 0); - Scalar redColor16 = new Scalar(0, 0, 32767); - - using (var mat = new Mat(1, 1, MatType.CV_16UC3, blueColor16)) - { - var bs = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); // PixelFormats.Rgb48 - AssertPixelValue(redColor16, bs); // B is swapped for R - } - using (var mat = new Mat(1, 1, MatType.CV_16UC3, greenColor16)) - { - var bs = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); - AssertPixelValue(greenColor16, bs); - } - using (var mat = new Mat(1, 1, MatType.CV_16UC3, redColor16)) - { - var bs = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); - AssertPixelValue(blueColor16, bs); // R is swapped for B - } - } - - /// - /// https://github.com/shimat/opencvsharp/issues/304 - /// - [Test] - //[Explicit] - [Ignore("sample")] - [Apartment(ApartmentState.STA)] - public void BitmapSourceSample() - { - const int size = 250; - - BitmapSource bs8, bs16; - - Scalar blueColor8 = new Scalar(128, 0, 0); - Scalar greenColor8 = new Scalar(0, 128, 0); - Scalar redColor8 = new Scalar(0, 0, 128); - Scalar whiteColor8 = new Scalar(255, 255, 255); - using (var mat = new Mat(size, size, MatType.CV_8UC3, new Scalar(128, 128, 128))) - { - mat.Rectangle(new OpenCvSharp.Rect(15, 10, 100, 100), blueColor8, -1); - mat.PutText("B", new OpenCvSharp.Point(50, 70), HersheyFonts.HersheyComplex, 1, whiteColor8); - - mat.Rectangle(new OpenCvSharp.Rect(130, 10, 100, 100), greenColor8, -1); - mat.PutText("G", new OpenCvSharp.Point(165, 70), HersheyFonts.HersheyComplex, 1, whiteColor8); - - mat.Rectangle(new OpenCvSharp.Rect(75, 130, 100, 100), redColor8, -1); - mat.PutText("R", new OpenCvSharp.Point(110, 190), HersheyFonts.HersheyComplex, 1, whiteColor8); - - bs8 = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); - } - - Scalar blueColor16 = new Scalar(32767, 0, 0); - Scalar greenColor16 = new Scalar(0, 32767, 0); - Scalar redColor16 = new Scalar(0, 0, 32767); - Scalar whiteColor16 = new Scalar(65535, 65535, 65535); - using (var mat = new Mat(size, size, MatType.CV_16UC3, new Scalar(32767, 32767, 32767))) - { - mat.Rectangle(new OpenCvSharp.Rect(15, 10, 100, 100), blueColor16, -1); - mat.PutText("B", new OpenCvSharp.Point(50, 70), HersheyFonts.HersheyComplex, 1, whiteColor16); - - mat.Rectangle(new OpenCvSharp.Rect(130, 10, 100, 100), greenColor16, -1); - mat.PutText("G", new OpenCvSharp.Point(165, 70), HersheyFonts.HersheyComplex, 1, whiteColor16); - - mat.Rectangle(new OpenCvSharp.Rect(75, 130, 100, 100), redColor16, -1); - mat.PutText("R", new OpenCvSharp.Point(110, 190), HersheyFonts.HersheyComplex, 1, whiteColor16); - - bs16 = OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(mat); - } - - var image8 = new System.Windows.Controls.Image { Source = bs8 }; - var image16 = new System.Windows.Controls.Image { Source = bs16 }; - var grid = new System.Windows.Controls.Grid(); - grid.ColumnDefinitions.Add(new ColumnDefinition()); - grid.ColumnDefinitions.Add(new ColumnDefinition()); - grid.RowDefinitions.Add(new RowDefinition()); - Grid.SetRow(image8, 0); - Grid.SetColumn(image8, 0); - grid.Children.Add(image8); - Grid.SetRow(image16, 0); - Grid.SetColumn(image16, 1); - grid.Children.Add(image16); - var window = new System.Windows.Window - { - Title = "Left:8bit Right:16bit", - Width = size * 2, - Height = size, - Content = grid - }; - - var app = new System.Windows.Application(); - app.Run(window); - } - - private void AssertPixelValue(Scalar expectedValue, BitmapSource bs) - where T : struct - { - if (bs.PixelWidth != 1 || bs.PixelHeight != 1) - Assert.Inconclusive(); - - var pixels = new T[3]; - int stride = 4 * Marshal.SizeOf(); - bs.CopyPixels(Int32Rect.Empty, pixels, stride, 0); - - Console.WriteLine("Expected: ({0},{1},{2})", expectedValue.Val0, expectedValue.Val1, expectedValue.Val2); - Console.WriteLine("Actual: ({0},{1},{2})", pixels[0], pixels[1], pixels[2]); - Assert.That(pixels[0], Is.EqualTo(expectedValue.Val0).Within(1e-9)); - Assert.That(pixels[1], Is.EqualTo(expectedValue.Val1).Within(1e-9)); - Assert.That(pixels[2], Is.EqualTo(expectedValue.Val2).Within(1e-9)); - } - } -} -#endif \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/face/FacemarkAAMTest.cs b/test/OpenCvSharp.Tests/face/FacemarkAAMTest.cs new file mode 100644 index 000000000..b31e9e8f8 --- /dev/null +++ b/test/OpenCvSharp.Tests/face/FacemarkAAMTest.cs @@ -0,0 +1,144 @@ +using OpenCvSharp.Face; +using Xunit; + +namespace OpenCvSharp.Tests.Face; + +// ReSharper disable once InconsistentNaming +public class FacemarkAAMTest : TestBase +{ + //private const string CascadeFile = "_data/text/haarcascade_frontalface_default.xml"; + + [Fact] + public void CreateAndDispose() + { + using (var facemark = FacemarkAAM.Create()) + { + GC.KeepAlive(facemark); + } + } + + [Fact] + public void CreateAndDisposeWithParameter() + { + using (var parameter = new FacemarkAAM.Params()) + using (var facemark = FacemarkAAM.Create(parameter)) + { + GC.KeepAlive(facemark); + } + } + + /* + /// + /// https://docs.opencv.org/trunk/d5/dd8/tutorial_facemark_aam.html + /// + [Fact] + public void GetFaces() + { + using (var parameter = new FacemarkAAM.Params()) + { + parameter.ModelFilename = CascadeFile; + parameter.Scales = new float[] {2, 4}; + + using (var facemark = FacemarkAAM.Create(parameter)) + using (var img = LoadImage("lenna.png")) + { + bool ret = facemark.GetFaces(img, out var faces); + Assert.True(ret); + Assert.NotEmpty(faces); + + if (Debugger.IsAttached) + { + foreach (var face in faces) + { + img.Rectangle(face, Scalar.Red, 2); + } + Window.ShowImages(img); + } + } + } + }*/ + + [Fact] + public void ParameterModelFilename() + { + const string value = "foo"; + + using (var parameter = new FacemarkAAM.Params()) + { + parameter.ModelFilename = value; + Assert.Equal(value, parameter.ModelFilename); + } + } + + [Fact] + public void ParameterM() + { + const int value = 12345; + + using (var parameter = new FacemarkAAM.Params()) + { + parameter.M = value; + Assert.Equal(value, parameter.M); + } + } + + [Fact] + public void ParameterN() + { + const int value = 12345; + + using (var parameter = new FacemarkAAM.Params()) + { + parameter.N = value; + Assert.Equal(value, parameter.N); + } + } + + [Fact] + public void ParameterNIter() + { + const int value = 12345; + + using (var parameter = new FacemarkAAM.Params()) + { + parameter.NIter = value; + Assert.Equal(value, parameter.NIter); + } + } + + [Fact] + public void ParameterScales() + { + float[] value = [1, 2, 3]; + + using (var parameter = new FacemarkAAM.Params()) + { + parameter.Scales = value; + Assert.Equal(value, parameter.Scales); + } + } + + [Fact] + public void ParameterSaveModel() + { + using (var parameter = new FacemarkAAM.Params()) + { + parameter.SaveModel = true; + Assert.True(parameter.SaveModel); + parameter.SaveModel = false; + Assert.False(parameter.SaveModel); + } + } + + [Fact] + public void ParameterVerbose() + { + using (var parameter = new FacemarkAAM.Params()) + { + parameter.Verbose = true; + Assert.True(parameter.Verbose); + parameter.Verbose = false; + Assert.False(parameter.Verbose); + } + } +} diff --git a/test/OpenCvSharp.Tests/face/FacemarkLBFTest.cs b/test/OpenCvSharp.Tests/face/FacemarkLBFTest.cs new file mode 100644 index 000000000..97c64911c --- /dev/null +++ b/test/OpenCvSharp.Tests/face/FacemarkLBFTest.cs @@ -0,0 +1,232 @@ +using OpenCvSharp.Face; +using Xunit; + +namespace OpenCvSharp.Tests.Face; + +// ReSharper disable once InconsistentNaming +public class FacemarkLBFTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var facemark = FacemarkLBF.Create()) + { + GC.KeepAlive(facemark); + } + } + + [Fact] + public void CreateAndDisposeWithParameter() + { + using (var parameter = new FacemarkLBF.Params()) + using (var facemark = FacemarkLBF.Create(parameter)) + { + GC.KeepAlive(facemark); + } + } + + [Fact] + public void ParameterBaggingOverlap() + { + const double value = 3.14; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.BaggingOverlap = value; + Assert.Equal(value, parameter.BaggingOverlap); + } + } + + [Fact] + public void ParameterCascadeFace() + { + const string value = "foo"; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.CascadeFace = value; + Assert.Equal(value, parameter.CascadeFace); + } + } + + [Fact] + // ReSharper disable once InconsistentNaming + public void ParameterDetectROI() + { + var value = new Rect(1, 2, 3, 4); + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.DetectROI = value; + Assert.Equal(value, parameter.DetectROI); + } + } + + [Fact] + public void ParameterFeatsM() + { + int[] value = [9, 8, 7, 6, 5]; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.FeatsM = value; + Assert.Equal(value, parameter.FeatsM); + } + } + + [Fact] + public void ParameterInitShapeN() + { + const int value = 12345; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.InitShapeN = value; + Assert.Equal(value, parameter.InitShapeN); + } + } + + [Fact] + public void ParameterModelFilename() + { + const string value = "foo"; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.ModelFilename = value; + Assert.Equal(value, parameter.ModelFilename); + } + } + + [Fact] + public void ParameterNLandmarks() + { + const int value = 12345; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.NLandmarks = value; + Assert.Equal(value, parameter.NLandmarks); + } + } + + [Fact] + public void ParameterPupils0() + { + int[] value = [9, 8, 7, 6, 5]; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.Pupils0 = value; + Assert.Equal(value, parameter.Pupils0); + } + } + + [Fact] + public void ParameterPupils1() + { + int[] value = [9, 8, 7, 6, 5]; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.Pupils1 = value; + Assert.Equal(value, parameter.Pupils1); + } + } + + [Fact] + public void ParameterRadiusM() + { + double[] value = [1, 2, 3]; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.RadiusM = value; + Assert.Equal(value, parameter.RadiusM); + } + } + + [Fact] + public void ParameterSaveModel() + { + using (var parameter = new FacemarkLBF.Params()) + { + parameter.SaveModel = true; + Assert.True(parameter.SaveModel); + parameter.SaveModel = false; + Assert.False(parameter.SaveModel); + } + } + + [Fact] + public void ParameterSeed() + { + const uint value = uint.MaxValue; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.Seed = value; + Assert.Equal(value, parameter.Seed); + } + } + + [Fact] + public void ParameterShapeOffset() + { + const double value = 3.14; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.ShapeOffset = value; + Assert.Equal(value, parameter.ShapeOffset); + } + } + + [Fact] + public void ParameterStagesN() + { + const int value = 12345; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.StagesN = value; + Assert.Equal(value, parameter.StagesN); + } + } + + [Fact] + public void ParameterTreeDepth() + { + const int value = 12345; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.TreeDepth = value; + Assert.Equal(value, parameter.TreeDepth); + } + } + + [Fact] + public void ParameterTreeN() + { + const int value = 12345; + + using (var parameter = new FacemarkLBF.Params()) + { + parameter.TreeN = value; + Assert.Equal(value, parameter.TreeN); + } + } + + [Fact] + public void ParameterVerbose() + { + using (var parameter = new FacemarkLBF.Params()) + { + parameter.Verbose = true; + Assert.True(parameter.Verbose); + parameter.Verbose = false; + Assert.False(parameter.Verbose); + } + } +} diff --git a/test/OpenCvSharp.Tests/face/LBPHFaceRecognizerTest.cs b/test/OpenCvSharp.Tests/face/LBPHFaceRecognizerTest.cs index 7c3562de7..488d40ef6 100644 --- a/test/OpenCvSharp.Tests/face/LBPHFaceRecognizerTest.cs +++ b/test/OpenCvSharp.Tests/face/LBPHFaceRecognizerTest.cs @@ -1,44 +1,50 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using OpenCvSharp.Face; +using Xunit; +using Xunit.Abstractions; -namespace OpenCvSharp.Tests.Face +namespace OpenCvSharp.Tests.Face; + +// ReSharper disable once InconsistentNaming +public class LBPHFaceRecognizerTest : TestBase { - // ReSharper disable once InconsistentNaming + private readonly ITestOutputHelper testOutputHelper; - [TestFixture] - public class LBPHFaceRecognizerTest : TestBase + public LBPHFaceRecognizerTest(ITestOutputHelper testOutputHelper) { - [Test] - public void CreateAndDispose() - { - var recognizer = OpenCvSharp.Face.FaceRecognizer.CreateLBPHFaceRecognizer(1, 8, 8, 8, 123); - recognizer.Dispose(); - } + this.testOutputHelper = testOutputHelper; + } - [Test, Ignore("not implemented")] - public void TrainAndPredict() - { - var image = new Mat("Data/Image/Lenna.png"); + [Fact] + public void CreateAndDispose() + { + var recognizer = LBPHFaceRecognizer.Create(1, 8, 8, 8, 123); + recognizer.Dispose(); + } - var model = Cv2.CreateLBPHFaceRecognizer(); + [Fact] + public void TrainAndPredict() + { + using var image = LoadImage("lenna.png"); + using var grayImage = image.CvtColor(ColorConversionCodes.BGR2GRAY); + using var model = LBPHFaceRecognizer.Create(); + using var cascade = new CascadeClassifier("_data/text/haarcascade_frontalface_default.xml"); + + var rects = cascade.DetectMultiScale(image); - var cascade = new CascadeClassifier("../haarcascade_frontalface_default.xml"); - var rects = cascade.DetectMultiScale(image); + model.Train([grayImage], [1]); - foreach (Rect rect in rects) + foreach (Rect rect in rects) + { + using (Mat face = grayImage[rect].Clone()) { - using (Mat face = image[rect].Clone()) - { - Cv2.Resize(face, face, new Size(256, 256)); - - int label; - double confidence; - model.Predict(face, out label, out confidence); - Console.WriteLine($"{label} ({confidence})"); - } + Cv2.Resize(face, face, new Size(256, 256)); + + model.Predict(face, out int label, out double confidence); + + testOutputHelper.WriteLine($"{label} ({confidence})"); + Assert.Equal(1, label); + Assert.NotEqual(0, confidence, 9); } } } } - diff --git a/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs b/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs index e3ccb5748..8a44fb602 100644 --- a/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs +++ b/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs @@ -1,124 +1,122 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using System.Globalization; +using OpenCvSharp.Features2D; using OpenCvSharp.Flann; using OpenCvSharp.XFeatures2D; +using Xunit; +using Xunit.Abstractions; -namespace OpenCvSharp.Tests.Features2D -{ - [TestFixture] - public class BOWImgDescriptorExtractorTest : TestBase - { - [OneTimeSetUp] - public void OneTimeSetUp() - { - } +// ReSharper disable RedundantArgumentDefaultValue - [Test] - public void New1() - { - using (var descriptorMatcher = new BFMatcher()) - using (new BOWImgDescriptorExtractor(descriptorMatcher)) { } - } +namespace OpenCvSharp.Tests.Features2D; - [Test] - public void New2BF() - { - using (var descriptorExtractor = SURF.Create(100)) - using (var descriptorMatcher = new BFMatcher()) - { - using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } - using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } - } - } +public class BOWImgDescriptorExtractorTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; - [Test] - public void New2Flann() - { - using (var descriptorExtractor = SURF.Create(100)) - using (var descriptorMatcher = new FlannBasedMatcher()) - { - using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } - using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } - } - } + public BOWImgDescriptorExtractorTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } - [Test] - public void New3() - { - using (var descriptorExtractor = KAZE.Create()) - using (var descriptorMatcher = new BFMatcher()) - using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } - } + [Fact] + public void New1() + { + using (var descriptorMatcher = new BFMatcher()) + using (new BOWImgDescriptorExtractor(descriptorMatcher)) { } + } - [Test] - public void New4() + [Fact] + public void New2BF() + { + using (var descriptorExtractor = SURF.Create(100)) + using (var descriptorMatcher = new BFMatcher()) { - using (var ip = new LinearIndexParams()) - using (var sp = new SearchParams()) - using (var descriptorExtractor = SURF.Create(100)) - using (var descriptorMatcher = new FlannBasedMatcher(ip, sp)) + using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } } + } - [Test] - public void New5() + [Fact] + public void New2Flann() + { + using (var descriptorExtractor = SURF.Create(100)) + using (var descriptorMatcher = new FlannBasedMatcher()) { - var ip = new LinearIndexParams(); - var sp = new SearchParams(); - using (var descriptorExtractor = KAZE.Create()) - using (var descriptorMatcher = new FlannBasedMatcher(ip, sp)) + using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } } + } + + [Fact] + public void New3() + { + using (var descriptorExtractor = KAZE.Create()) + using (var descriptorMatcher = new BFMatcher()) + using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } + } + + [Fact] + public void New4() + { + using (var ip = new LinearIndexParams()) + using (var sp = new SearchParams()) + using (var descriptorExtractor = SURF.Create(100)) + using (var descriptorMatcher = new FlannBasedMatcher(ip, sp)) + using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } + } - [Test] - public void RunTest() + [Fact] + public void New5() + { + using var ip = new LinearIndexParams(); + using var sp = new SearchParams(); + using (var descriptorExtractor = KAZE.Create()) + using (var descriptorMatcher = new FlannBasedMatcher(ip, sp)) + using (new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) { } + } + + [Fact] + public void RunTest() + { + using var descriptorExtractor = SIFT.Create(500); + using var descriptorMatcher = new BFMatcher(); + using var img = LoadImage("lenna.png"); + KeyPoint[] keypoints; + Mat dictionary; + var tc = new TermCriteria(CriteriaTypes.MaxIter, 100, 0.001d); + using (var bowTrainer = new BOWKMeansTrainer(200, tc, 1, KMeansFlags.PpCenters)) { - LinearIndexParams ip = new LinearIndexParams(); - SearchParams sp = new SearchParams(); - using (var descriptorExtractor = SIFT.Create(500)) - //using (var descriptorMatcher = new FlannBasedMatcher(ip, sp)) - using (var descriptorMatcher = new BFMatcher()) - using (var img = Image("lenna.png")) - { - KeyPoint[] keypoints; - Mat dictionary; - var tc = new TermCriteria(CriteriaType.MaxIter, 100, 0.001d); - using (var bowTrainer = new BOWKMeansTrainer(200, tc, 1, KMeansFlags.PpCenters)) - { - var descriptors = new Mat(); - descriptorExtractor.DetectAndCompute(img, null, out keypoints, descriptors); + var descriptors = new Mat(); + descriptorExtractor.DetectAndCompute(img, null, out keypoints, descriptors); - Mat featuresUnclustered = new Mat(); - featuresUnclustered.PushBack(descriptors); - featuresUnclustered.ConvertTo(featuresUnclustered, MatType.CV_32F); - dictionary = bowTrainer.Cluster(featuresUnclustered); - } + using var featuresUnclustered = new Mat(); + featuresUnclustered.PushBack(descriptors); + featuresUnclustered.ConvertTo(featuresUnclustered, MatType.CV_32F); + dictionary = bowTrainer.Cluster(featuresUnclustered); + } - using (var bowDE = new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) - { - bowDE.SetVocabulary(dictionary); + using (var bowDe = new BOWImgDescriptorExtractor(descriptorExtractor, descriptorMatcher)) + { + bowDe.SetVocabulary(dictionary); - try - { - int[][] arr; - Mat descriptors = new Mat(); - descriptorExtractor.Compute(img, ref keypoints, descriptors); - descriptors.ConvertTo(descriptors, MatType.CV_32F); - bowDE.Compute(descriptors, ref keypoints, descriptors, out arr); - Console.WriteLine(arr.Length); - Console.WriteLine(arr[0].Length); - } - catch (OpenCVException ex) - { - Console.WriteLine(ex.FileName); - Console.WriteLine(ex.FuncName); - Console.WriteLine(ex.Line); - throw; - } - } + try + { + using var descriptors = new Mat(); + descriptorExtractor.Compute(img, ref keypoints, descriptors); + descriptors.ConvertTo(descriptors, MatType.CV_32F); + bowDe.Compute(img, ref keypoints, descriptors, out var arr); + testOutputHelper.WriteLine(arr.Length.ToString(CultureInfo.InvariantCulture)); + testOutputHelper.WriteLine(arr[0].Length.ToString(CultureInfo.InvariantCulture)); + } + catch (OpenCVException ex) + { + testOutputHelper.WriteLine(ex.FileName); + testOutputHelper.WriteLine(ex.FuncName); + testOutputHelper.WriteLine(ex.Line.ToString(CultureInfo.InvariantCulture)); + throw; } } + + dictionary.Dispose(); } } - diff --git a/test/OpenCvSharp.Tests/features2d/BOWKMeansTrainerTest.cs b/test/OpenCvSharp.Tests/features2d/BOWKMeansTrainerTest.cs index fcccde6ae..d1dc894b5 100644 --- a/test/OpenCvSharp.Tests/features2d/BOWKMeansTrainerTest.cs +++ b/test/OpenCvSharp.Tests/features2d/BOWKMeansTrainerTest.cs @@ -1,18 +1,13 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using Xunit; -namespace OpenCvSharp.Tests.Features2D +namespace OpenCvSharp.Tests.Features2D; + +public class BOWKMeansTrainerTest : TestBase { - [TestFixture] - public class BOWKMeansTrainerTest : TestBase + [Fact] + public void New() { - [Test] - public void New() - { - var bow = new BOWKMeansTrainer(100); - bow.Dispose(); - } + var bow = new BOWKMeansTrainer(100); + bow.Dispose(); } } - diff --git a/test/OpenCvSharp.Tests/features2d/FastFeatureDetectorTest.cs b/test/OpenCvSharp.Tests/features2d/FastFeatureDetectorTest.cs new file mode 100644 index 000000000..161aaa19b --- /dev/null +++ b/test/OpenCvSharp.Tests/features2d/FastFeatureDetectorTest.cs @@ -0,0 +1,33 @@ +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Features2D; + +// ReSharper disable once InconsistentNaming +public class FastFeatureDetectorTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public FastFeatureDetectorTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void CreateAndDispose() + { + var surf = FastFeatureDetector.Create(); + surf.Dispose(); + } + + [Fact] + public void Detect() + { + KeyPoint[] keyPoints; + using (var gray = LoadImage("lenna.png", 0)) + using (var orb = FastFeatureDetector.Create()) + keyPoints = orb.Detect(gray); + + testOutputHelper.WriteLine($"KeyPoint has {keyPoints.Length} items."); + } +} diff --git a/test/OpenCvSharp.Tests/features2d/FlannBasedMatcherTest.cs b/test/OpenCvSharp.Tests/features2d/FlannBasedMatcherTest.cs index 7eaf676aa..abaaa4367 100644 --- a/test/OpenCvSharp.Tests/features2d/FlannBasedMatcherTest.cs +++ b/test/OpenCvSharp.Tests/features2d/FlannBasedMatcherTest.cs @@ -1,46 +1,108 @@ -using System; -using NUnit.Framework; -using OpenCvSharp.Flann; -using OpenCvSharp.XFeatures2D; +using OpenCvSharp.Flann; +using Xunit; -namespace OpenCvSharp.Tests.Features2D +namespace OpenCvSharp.Tests.Features2D; + +// ReSharper disable once InconsistentNaming +public class FlannBasedMatcherTest : TestBase { - // ReSharper disable once InconsistentNaming + [Fact] + public void Mathing() + { + using var img1 = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + using var img2 = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); + using var orb = ORB.Create(500); + using var descriptor1 = new Mat(); + using var descriptor2 = new Mat(); + orb.DetectAndCompute(img1, null, out _, descriptor1); + orb.DetectAndCompute(img2, null, out _, descriptor2); + + // Flann needs the descriptors to be of type CV_32F + Assert.Equal(MatType.CV_8UC1, descriptor1.Type()); + Assert.Equal(MatType.CV_8UC1, descriptor2.Type()); + descriptor1.ConvertTo(descriptor1, MatType.CV_32F); + descriptor2.ConvertTo(descriptor2, MatType.CV_32F); + + using var matcher = new FlannBasedMatcher(); + var matches = matcher.Match(descriptor1, descriptor2); + + Assert.NotEmpty(matches); + + /* + using (var view = new Mat()) + using (var window = new Window()) + { + Cv2.DrawMatches(img1, keyPoints1, img2, keyPoints2, matches, view); + window.ShowImage(view); + Cv2.WaitKey(); + }*/ + } + + [Fact] + public void MathingWithKDTreeIndexParams() + { + using var img1 = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + using var img2 = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); + using var orb = ORB.Create(500); + using var descriptor1 = new Mat(); + using var descriptor2 = new Mat(); + orb.DetectAndCompute(img1, null, out _, descriptor1); + orb.DetectAndCompute(img2, null, out _, descriptor2); + + using var indexParams = new KDTreeIndexParams(); - [TestFixture] - public class FlannBasedMatcherTest : TestBase + // Flann needs the descriptors to be of type CV_32F + Assert.Equal(MatType.CV_8UC1, descriptor1.Type()); + Assert.Equal(MatType.CV_8UC1, descriptor2.Type()); + descriptor1.ConvertTo(descriptor1, MatType.CV_32F); + descriptor2.ConvertTo(descriptor2, MatType.CV_32F); + + using var matcher = new FlannBasedMatcher(indexParams); + DMatch[] matches = matcher.Match(descriptor1, descriptor2); + + Assert.NotEmpty(matches); + + /* + using (var view = new Mat()) + using (var window = new Window()) + { + Cv2.DrawMatches(img1, keyPoints1, img2, keyPoints2, matches, view); + window.ShowImage(view); + Cv2.WaitKey(); + }*/ + } + + [Fact] + public void MathingWithLshIndexParams() { - [Test] - public void Mathing() - { - using (var img1 = Image("tsukuba_left.png", ImreadModes.GrayScale)) - using (var img2 = Image("tsukuba_right.png", ImreadModes.GrayScale)) - using (var orb = ORB.Create(500)) - using (var descriptor1 = new Mat()) - using (var descriptor2 = new Mat()) + using var img1 = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + using var img2 = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); + using var orb = ORB.Create(500); + using var descriptor1 = new Mat(); + using var descriptor2 = new Mat(); + orb.DetectAndCompute(img1, null, out _, descriptor1); + orb.DetectAndCompute(img2, null, out _, descriptor2); + + using var indexParams = new LshIndexParams(12, 20, 2); + + Assert.Equal(MatType.CV_8UC1, descriptor1.Type()); + Assert.Equal(MatType.CV_8UC1, descriptor2.Type()); + + // LshIndexParams requires Binary descriptor, so it must NOT convert to CV_32F. + //descriptor1.ConvertTo(descriptor1, MatType.CV_32F); + //descriptor2.ConvertTo(descriptor2, MatType.CV_32F); + + using var matcher = new FlannBasedMatcher(indexParams); + DMatch[] matches = matcher.Match(descriptor1, descriptor2); + + Assert.NotEmpty(matches); + /* + using (var view = new Mat()) + using (var window = new Window()) { - KeyPoint[] keyPoints1, keyPoints2; - orb.DetectAndCompute(img1, null, out keyPoints1, descriptor1); - orb.DetectAndCompute(img2, null, out keyPoints2, descriptor2); - - // Flann needs the descriptors to be of type CV_32F - Assert.AreEqual(MatType.CV_8UC1, descriptor1.Type()); - Assert.AreEqual(MatType.CV_8UC1, descriptor2.Type()); - descriptor1.ConvertTo(descriptor1, MatType.CV_32F); - descriptor2.ConvertTo(descriptor2, MatType.CV_32F); - - var matcher = new FlannBasedMatcher(); - DMatch[] matches = matcher.Match(descriptor1, descriptor2); - - /* - using (var view = new Mat()) - using (var window = new Window()) - { - Cv2.DrawMatches(img1, keyPoints1, img2, keyPoints2, matches, view); - window.ShowImage(view); - Cv2.WaitKey(); - }*/ - } - } + Cv2.DrawMatches(img1, keyPoints1, img2, keyPoints2, matches, view); + window.ShowImage(view); + Cv2.WaitKey(); + }*/ } } diff --git a/test/OpenCvSharp.Tests/features2d/ORBTest.cs b/test/OpenCvSharp.Tests/features2d/ORBTest.cs index 484f1611d..c325c5fb7 100644 --- a/test/OpenCvSharp.Tests/features2d/ORBTest.cs +++ b/test/OpenCvSharp.Tests/features2d/ORBTest.cs @@ -1,47 +1,47 @@ -using System; -using NUnit.Framework; -using OpenCvSharp.Flann; -using OpenCvSharp.XFeatures2D; +using Xunit; +using Xunit.Abstractions; -namespace OpenCvSharp.Tests.Features2D +namespace OpenCvSharp.Tests.Features2D; + +// ReSharper disable once InconsistentNaming +public class ORBTest : TestBase { - // ReSharper disable once InconsistentNaming + private readonly ITestOutputHelper testOutputHelper; - [TestFixture] - public class ORBTest : TestBase + public ORBTest(ITestOutputHelper testOutputHelper) { - [Test] - public void CreateAndDispose() - { - var surf = ORB.Create(400); - surf.Dispose(); - } + this.testOutputHelper = testOutputHelper; + } - [Test] - public void Detect() - { - // This parameter should introduce same result of http://opencv.jp/wordpress/wp-content/uploads/lenna_SURF-150x150.png - KeyPoint[] keyPoints = null; - using (var gray = Image("lenna.png", 0)) - using (var orb = ORB.Create(500)) - keyPoints = orb.Detect(gray); + [Fact] + public void CreateAndDispose() + { + var surf = ORB.Create(400); + surf.Dispose(); + } - Console.WriteLine($"KeyPoint has {keyPoints.Length} items."); - } + [Fact] + public void Detect() + { + // This parameter should introduce same result of http://opencv.jp/wordpress/wp-content/uploads/lenna_SURF-150x150.png + using var gray = LoadImage("lenna.png", 0); + using var orb = ORB.Create(500); + var keyPoints = orb.Detect(gray); + + testOutputHelper.WriteLine($"KeyPoint has {keyPoints.Length} items."); + } - [Test] - public void DetectAndCompute() + [Fact] + public void DetectAndCompute() + { + using (var gray = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var orb = ORB.Create(500)) + using (Mat descriptor = new Mat()) { - using (var gray = Image("lenna.png", ImreadModes.GrayScale)) - using (var orb = ORB.Create(500)) - using (Mat descriptor = new Mat()) - { - KeyPoint[] keyPoints; - orb.DetectAndCompute(gray, null, out keyPoints, descriptor); - - Console.WriteLine($"keyPoints has {keyPoints.Length} items."); - Console.WriteLine($"descriptor has {descriptor.Rows} items."); - } + orb.DetectAndCompute(gray, null, out var keyPoints, descriptor); + + testOutputHelper.WriteLine($"keyPoints has {keyPoints.Length} items."); + testOutputHelper.WriteLine($"descriptor has {descriptor.Rows} items."); } } } diff --git a/test/OpenCvSharp.Tests/features2d/SIFTTest.cs b/test/OpenCvSharp.Tests/features2d/SIFTTest.cs new file mode 100644 index 000000000..a1e3865e1 --- /dev/null +++ b/test/OpenCvSharp.Tests/features2d/SIFTTest.cs @@ -0,0 +1,64 @@ +using OpenCvSharp.Features2D; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Features2D; + +// ReSharper disable once InconsistentNaming +public class SIFTTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public SIFTTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void CreateAndDispose() + { + var surf = SIFT.Create(400); + surf.Dispose(); + } + + [Fact] + public void Detect() + { + KeyPoint[] keyPoints; + using (var gray = LoadImage("lenna.png", 0)) + using (var alg = SIFT.Create(500)) + keyPoints = alg.Detect(gray); + + testOutputHelper.WriteLine($"KeyPoint has {keyPoints.Length} items."); + } + + [Fact] + public void DescriptorSize() + { + using (var alg = SIFT.Create()) + { + var sz = alg.DescriptorSize; + Assert.Equal(128, sz); + } + } + + [Fact] + public void DescriptorType() + { + using (var alg = SIFT.Create()) + { + var dtype = alg.DescriptorType; + Assert.Equal(MatType.CV_32F, dtype); + } + } + + [Fact] + public void DefaultNorm() + { + using (var alg = SIFT.Create()) + { + var defnorm = alg.DefaultNorm; + Assert.Equal(4, defnorm); + } + } +} diff --git a/test/OpenCvSharp.Tests/highgui/HighGuiTest.cs b/test/OpenCvSharp.Tests/highgui/HighGuiTest.cs new file mode 100644 index 000000000..58607672f --- /dev/null +++ b/test/OpenCvSharp.Tests/highgui/HighGuiTest.cs @@ -0,0 +1,39 @@ +using Xunit; + +namespace OpenCvSharp.Tests.HighGui; + +public class HighGuiTest : TestBase +{ + [Fact] + public void WaitKey() + { + int val = Cv2.WaitKey(1); + Assert.Equal(-1, val); + } + + [Fact] + public void WaitKeyEx() + { + int val = Cv2.WaitKeyEx(1); + Assert.Equal(-1, val); + } + + [ExplicitFact] + public void Window() + { + using var img = new Mat("_data/image/mandrill.png"); + + using (var window = new Window("window01")) + { + window.ShowImage(img); + Assert.NotEqual(IntPtr.Zero, window.GetHandle()); + Cv2.WaitKey(); + } + using (var window = new Window("window02")) + { + Cv2.CvtColor(img, img, ColorConversionCodes.BGR2GRAY); + window.ShowImage(img); + Cv2.WaitKey(); + } + } +} diff --git a/test/OpenCvSharp.Tests/highgui/TrackbarTest.cs b/test/OpenCvSharp.Tests/highgui/TrackbarTest.cs new file mode 100644 index 000000000..b0815dd21 --- /dev/null +++ b/test/OpenCvSharp.Tests/highgui/TrackbarTest.cs @@ -0,0 +1,98 @@ +using Xunit; + +namespace OpenCvSharp.Tests.HighGui; + +public class TrackbarTest : TestBase +{ + /// + /// https://github.com/VahidN/OpenCVSharp-Samples/blob/master/OpenCVSharpSample08/Program.cs + /// + [Fact(Skip = "GUI Test")] + //[Apartment(ApartmentState.STA)] + public void RunTest() + { + using var src = LoadImage(@"lenna.png", ImreadModes.AnyDepth | ImreadModes.AnyColor); + using var dst = new Mat(); + src.CopyTo(dst); + + var elementShape = MorphShapes.Rect; + var maxIterations = 10; + + var openCloseWindow = new Window("Open/Close", image: dst); + var openCloseTrackbar = openCloseWindow.CreateTrackbar( + trackbarName: "Iterations", initialPos: 0, max: maxIterations * 2 + 1, + callback: pos => + { + var n = pos - maxIterations; + var an = n > 0 ? n : -n; + var element = Cv2.GetStructuringElement( + elementShape, + new Size(an * 2 + 1, an * 2 + 1), + new Point(an, an)); + + Cv2.MorphologyEx(src, dst, n < 0 ? MorphTypes.Open : MorphTypes.Close, element); + + Cv2.PutText(dst, (n < 0) + ? $"Open/Erosion followed by Dilation[{elementShape}]" + : $"Close/Dilation followed by Erosion[{elementShape}]", + new Point(10, 15), HersheyFonts.HersheyPlain, 1, Scalar.Black); + openCloseWindow.Image = dst; + }); + + + var erodeDilateWindow = new Window("Erode/Dilate", image: dst); + var erodeDilateTrackbar = erodeDilateWindow.CreateTrackbar( + trackbarName: "Iterations", initialPos: 0, max: maxIterations * 2 + 1, + callback: pos => + { + var n = pos - maxIterations; + var an = n > 0 ? n : -n; + var element = Cv2.GetStructuringElement( + elementShape, + new Size(an * 2 + 1, an * 2 + 1), + new Point(an, an)); + if (n < 0) + { + Cv2.Erode(src, dst, element); + } + else + { + Cv2.Dilate(src, dst, element); + } + + Cv2.PutText(dst, (n < 0) + ? $"Erode[{elementShape}]" + : $"Dilate[{elementShape}]", + new Point(10, 15), HersheyFonts.HersheyPlain, 1, Scalar.Black); + erodeDilateWindow.Image = dst; + }); + + + for (;;) + { + openCloseTrackbar.Callback.DynamicInvoke(0, null); + erodeDilateTrackbar.Callback.DynamicInvoke(0, null); + + var key = Cv2.WaitKey(); + + if ((char)key == 27) // ESC + break; + + switch ((char)key) + { + case 'e': + elementShape = MorphShapes.Ellipse; + break; + case 'r': + elementShape = MorphShapes.Rect; + break; + case 'c': + elementShape = MorphShapes.Cross; + break; + } + } + + openCloseWindow.Dispose(); + erodeDilateWindow.Dispose(); + } +} diff --git a/test/OpenCvSharp.Tests/hiighgui/TrackbarTest.cs b/test/OpenCvSharp.Tests/hiighgui/TrackbarTest.cs deleted file mode 100644 index e564e314c..000000000 --- a/test/OpenCvSharp.Tests/hiighgui/TrackbarTest.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using NUnit.Framework; -using OpenCvSharp; -using OpenCvSharp.ML; - -namespace OpenCvSharp.Tests.HighGui -{ - [TestFixture] - public class TrackbarTest : TestBase - { - /// - /// https://github.com/VahidN/OpenCVSharp-Samples/blob/master/OpenCVSharpSample08/Program.cs - /// - [Test] - [Ignore("GUI Test")] - //[Apartment(ApartmentState.STA)] - public void RunTest() - { - using (var src = Image(@"lenna.png", ImreadModes.AnyDepth | ImreadModes.AnyColor)) - using (var dst = new Mat()) - { - src.CopyTo(dst); - - var elementShape = MorphShapes.Rect; - var maxIterations = 10; - - var openCloseWindow = new Window("Open/Close", image: dst); - var openCloseTrackbar = openCloseWindow.CreateTrackbar( - name: "Iterations", value: 0, max: maxIterations * 2 + 1, - callback: (pos, obj) => - { - var n = pos - maxIterations; - var an = n > 0 ? n : -n; - var element = Cv2.GetStructuringElement( - elementShape, - new Size(an * 2 + 1, an * 2 + 1), - new Point(an, an)); - - if (n < 0) - { - Cv2.MorphologyEx(src, dst, MorphTypes.Open, element); - } - else - { - Cv2.MorphologyEx(src, dst, MorphTypes.Close, element); - } - - Cv2.PutText(dst, (n < 0) ? - string.Format("Open/Erosion followed by Dilation[{0}]", elementShape) - : string.Format("Close/Dilation followed by Erosion[{0}]", elementShape), - new Point(10, 15), HersheyFonts.HersheyPlain, 1, Scalar.Black); - openCloseWindow.Image = dst; - }); - - - var erodeDilateWindow = new Window("Erode/Dilate", image: dst); - var erodeDilateTrackbar = erodeDilateWindow.CreateTrackbar( - name: "Iterations", value: 0, max: maxIterations * 2 + 1, - callback: (pos, obj) => - { - var n = pos - maxIterations; - var an = n > 0 ? n : -n; - var element = Cv2.GetStructuringElement( - elementShape, - new Size(an * 2 + 1, an * 2 + 1), - new Point(an, an)); - if (n < 0) - { - Cv2.Erode(src, dst, element); - } - else - { - Cv2.Dilate(src, dst, element); - } - - Cv2.PutText(dst, (n < 0) ? - string.Format("Erode[{0}]", elementShape) : - string.Format("Dilate[{0}]", elementShape), - new Point(10, 15), HersheyFonts.HersheyPlain, 1, Scalar.Black); - erodeDilateWindow.Image = dst; - }); - - - for (;;) - { - openCloseTrackbar.Callback.DynamicInvoke(0, null); - erodeDilateTrackbar.Callback.DynamicInvoke(0, null); - - var key = Cv2.WaitKey(); - - if ((char)key == 27) // ESC - break; - - switch ((char)key) - { - case 'e': - elementShape = MorphShapes.Ellipse; - break; - case 'r': - elementShape = MorphShapes.Rect; - break; - case 'c': - elementShape = MorphShapes.Cross; - break; - } - } - - openCloseWindow.Dispose(); - erodeDilateWindow.Dispose(); - } - } - } -} - diff --git a/test/OpenCvSharp.Tests/img_hash/AverageHashTest.cs b/test/OpenCvSharp.Tests/img_hash/AverageHashTest.cs new file mode 100644 index 000000000..f6bde51a9 --- /dev/null +++ b/test/OpenCvSharp.Tests/img_hash/AverageHashTest.cs @@ -0,0 +1,68 @@ +using OpenCvSharp.ImgHash; +using Xunit; + +namespace OpenCvSharp.Tests.ImgHash; + +public class AverageHashTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var model = AverageHash.Create()) + { + GC.KeepAlive(model); + } + } + + [Fact] + public void Compute() + { + using (var model = AverageHash.Create()) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(8, hash.Cols); + Assert.Equal(MatType.CV_8UC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal(101, hashArray[0]); + Assert.Equal(121, hashArray[1]); + Assert.Equal(185, hashArray[2]); + Assert.Equal(149, hashArray[3]); + Assert.Equal(205, hashArray[4]); + Assert.Equal(209, hashArray[5]); + Assert.Equal(213, hashArray[6]); + Assert.Equal(112, hashArray[7]); + } + } + + [Fact] + public void CompareSameImage() + { + using (var model = AverageHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + { + double hash = model.Compare(img1, img1); + Assert.Equal(0, hash, 6); + } + } + + [Fact] + public void CompareDifferentImage() + { + using (var model = AverageHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var img2 = LoadImage("building.jpg", ImreadModes.Grayscale)) + { + var size = new Size(256, 256); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img2.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(264411, hash, 6); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/img_hash/BlockMeanHashTest.cs b/test/OpenCvSharp.Tests/img_hash/BlockMeanHashTest.cs new file mode 100644 index 000000000..da77c69d5 --- /dev/null +++ b/test/OpenCvSharp.Tests/img_hash/BlockMeanHashTest.cs @@ -0,0 +1,97 @@ +using OpenCvSharp.ImgHash; +using Xunit; + +namespace OpenCvSharp.Tests.ImgHash; + +public class BlockMeanHashTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var model = BlockMeanHash.Create(BlockMeanHashMode.Mode0)) + { + GC.KeepAlive(model); + } + using (var model = BlockMeanHash.Create(BlockMeanHashMode.Mode1)) + { + GC.KeepAlive(model); + } + } + + [Fact] + public void ComputeMode0() + { + using (var model = BlockMeanHash.Create(BlockMeanHashMode.Mode0)) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(32, hash.Cols); + Assert.Equal(MatType.CV_8UC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal( + [243, 61, 243, 61, 195, 63, 226, 151, 226, 159, 250, 223, 50, 206, 18, 231, 130, 226, 130, 227, 130, 243, 130, 243, 2, 243, 2, 87, 2, 127, 2, 47], + hashArray); + } + } + + [Fact] + public void ComputeMode1() + { + using (var model = BlockMeanHash.Create(BlockMeanHashMode.Mode1)) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(121, hash.Cols); + Assert.Equal(MatType.CV_8UC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal( + [ + 135, 255, 243, 135, 131, 255, 249, 199, 193, 255, 252, 227, 224, 127, 254, 113, 128, 127, 127, + 48, 192, 191, 25, 24, 240, 255, 4, 13, 248, 127, 135, 134, 252, 255, 99, 67, 254, 255, 184, 113, + 255, 127, 220, 240, 195, 31, 111, 120, 224, 135, 55, 12, 248, 192, 27, 6, 126, 240, 13, 128, 63, + 248, 6, 64, 14, 126, 3, 48, 7, 191, 3, 248, 131, 159, 1, 248, 193, 207, 0, 252, 240, 103, 0, + 126, 248, 59, 0, 63, 254, 29, 0, 15, 255, 14, 0, 135, 127, 6, 128, 131, 63, 3, 224, 103, 206, 0, + 240, 247, 99, 0, 248, 255, 49, 0, 252, 255, 24, 0, 254, 49, 0 + ], + hashArray); + } + } + + [Theory] + [InlineData(BlockMeanHashMode.Mode0)] + [InlineData(BlockMeanHashMode.Mode1)] + public void CompareSameImage(BlockMeanHashMode mode) + { + using (var model = BlockMeanHash.Create(mode)) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + { + double hash = model.Compare(img1, img1); + Assert.Equal(0, hash, 6); + } + } + + [Theory] + [InlineData(BlockMeanHashMode.Mode0)] + [InlineData(BlockMeanHashMode.Mode1)] + public void CompareDifferentImage(BlockMeanHashMode mode) + { + using (var model = BlockMeanHash.Create(mode)) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var img2 = LoadImage("building.jpg", ImreadModes.Grayscale)) + { + var size = new Size(256, 256); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img2.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(264411, hash, 6); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/img_hash/ColorMomentHashTest.cs b/test/OpenCvSharp.Tests/img_hash/ColorMomentHashTest.cs new file mode 100644 index 000000000..985c7b778 --- /dev/null +++ b/test/OpenCvSharp.Tests/img_hash/ColorMomentHashTest.cs @@ -0,0 +1,75 @@ +using OpenCvSharp.ImgHash; +using Xunit; + +namespace OpenCvSharp.Tests.ImgHash; + +public class ColorMomentHashTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var model = ColorMomentHash.Create()) + { + GC.KeepAlive(model); + } + } + + [Fact] + public void Compute() + { + using (var model = ColorMomentHash.Create()) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(42, hash.Cols); + Assert.Equal(MatType.CV_64FC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal( + [ + 0.00168799895166844, 9.73548985026306E-09, 7.12008515499876E-12, 1.58206172228354E-10, + 5.28813826840171E-21, 1.29337857065483E-14, 4.79075399951684E-22, 0.00128609224067447, + 9.52599959124291E-10, 3.93698021400622E-12, 7.14400696815386E-12, 3.78255159833954E-23, + 1.97733914733847E-16, 2.16399836659832E-24, 0.000922260536104536, 3.65830493343832E-09, + 7.661707706699E-13, 1.19445875901408E-12, -1.12767845932483E-24, -5.93217692337658E-17, + -1.84467412783745E-25, 0.00132500752122349, 9.11756797244743E-09, 3.34535518270916E-12, + 9.874171040899E-12, 1.58987320234562E-25, -9.15629498603106E-16, 5.67505900918754E-23, + 0.000996616840904085, 1.90986702741479E-10, 1.81929041195046E-13, 1.60689960736751E-13, + -2.7254690880086E-26, 1.04487497633728E-18, -3.47059704207128E-27, 0.00139981947147226, + 2.27201044977745E-09, 4.41887540236722E-13, 7.28673251542401E-13, -4.09431968883588E-25, + 3.10909057900972E-17, -5.77204894690052E-26 + ], + hashArray, new DoubleEqualityComparer(1E-12)); + } + } + + [Fact] + public void CompareSameImage() + { + using (var model = ColorMomentHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + { + double hash = model.Compare(img1, img1); + Assert.Equal(0, hash, 6); + } + } + + [Fact] + public void CompareDifferentImage() + { + using (var model = ColorMomentHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var img2 = LoadImage("building.jpg", ImreadModes.Grayscale)) + { + var size = new Size(256, 256); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img2.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(236458999.828723, hash, 6); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/img_hash/MarrHildrethHashTest.cs b/test/OpenCvSharp.Tests/img_hash/MarrHildrethHashTest.cs new file mode 100644 index 000000000..4ee2d7f07 --- /dev/null +++ b/test/OpenCvSharp.Tests/img_hash/MarrHildrethHashTest.cs @@ -0,0 +1,65 @@ +using OpenCvSharp.ImgHash; +using Xunit; + +namespace OpenCvSharp.Tests.ImgHash; + +public class MarrHildrethHashTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var model = MarrHildrethHash.Create()) + { + GC.KeepAlive(model); + } + } + + [Fact] + public void Compute() + { + using (var model = MarrHildrethHash.Create()) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(72, hash.Cols); + Assert.Equal(MatType.CV_8UC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal( + [ 208, 54, 63, 31, 143, 199, 227, 241, 192, 124, 126, 39, 3, 205, 192, 124, 126, 63, 228, 150, 199, 194, + 242, 254, 208, 143, 201, 105, 118, 57, 5, 191, 3, 99, 177, 224, 15, 137, 153, 58, 5, 129, 63, 193, 216, 228, + 112, 100, 129, 176, 248, 255, 110, 7, 230, 16, 193, 231, 207, 135, 0, 150, 120, 5, 191, 60, 18, 114, 119, 131, 150, 31 ], + hashArray); + } + } + + [Fact] + public void CompareSameImage() + { + using (var model = MarrHildrethHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + { + double hash = model.Compare(img1, img1); + Assert.Equal(0, hash, 6); + } + } + + [Fact] + public void CompareDifferentImage() + { + using (var model = MarrHildrethHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var img2 = LoadImage("building.jpg", ImreadModes.Grayscale)) + { + var size = new Size(256, 256); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img2.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(264411, hash, 6); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/img_hash/PHashTest.cs b/test/OpenCvSharp.Tests/img_hash/PHashTest.cs new file mode 100644 index 000000000..a8abc7f48 --- /dev/null +++ b/test/OpenCvSharp.Tests/img_hash/PHashTest.cs @@ -0,0 +1,68 @@ +using OpenCvSharp.ImgHash; +using Xunit; + +namespace OpenCvSharp.Tests.ImgHash; + +public class PHashTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var model = PHash.Create()) + { + GC.KeepAlive(model); + } + } + + [Fact] + public void Compute() + { + using (var model = PHash.Create()) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(8, hash.Cols); + Assert.Equal(MatType.CV_8UC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal(152, hashArray[0]); + Assert.Equal(99, hashArray[1]); + Assert.Equal(42, hashArray[2]); + Assert.Equal(180, hashArray[3]); + Assert.Equal(206, hashArray[4]); + Assert.Equal(197, hashArray[5]); + Assert.Equal(97, hashArray[6]); + Assert.Equal(25, hashArray[7]); + } + } + + [Fact] + public void CompareSameImage() + { + using (var model = PHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + { + double hash = model.Compare(img1, img1); + Assert.Equal(0, hash, 6); + } + } + + [Fact] + public void CompareDifferentImage() + { + using (var model = PHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var img2 = LoadImage("building.jpg", ImreadModes.Grayscale)) + { + var size = new Size(256, 256); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img2.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(264411, hash, 6); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/img_hash/RadialVarianceHashTest.cs b/test/OpenCvSharp.Tests/img_hash/RadialVarianceHashTest.cs new file mode 100644 index 000000000..17513c086 --- /dev/null +++ b/test/OpenCvSharp.Tests/img_hash/RadialVarianceHashTest.cs @@ -0,0 +1,69 @@ +using OpenCvSharp.ImgHash; +using Xunit; + +namespace OpenCvSharp.Tests.ImgHash; + +public class RadialVarianceHashTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + using (var model = RadialVarianceHash.Create()) + { + GC.KeepAlive(model); + } + } + + [Fact] + public void Compute() + { + using (var model = RadialVarianceHash.Create()) + using (var img = LoadImage("lenna.png")) + using (var hash = new Mat()) + { + model.Compute(img, hash); + Assert.Equal(1, hash.Rows); + Assert.Equal(40, hash.Cols); + Assert.Equal(MatType.CV_8UC1, hash.Type()); + + var hashArray = hash.ToArray(); + Assert.Equal( + [ 142, 0, 209, 255, 100, 131, 131, 190, 107, 68, 192, 159, 136, 135, 131, 159, 129, 184, 140, 134, + 145, 120, 162, 157, 136, 142, 139, 134, 149, 146, 134, 151, 137, 139, 148, 144, 140, 135, 144, 144 ], + hashArray); + } + } + + [Fact] + public void CompareSameImage() + { + using (var model = RadialVarianceHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + { + var size = new Size(40, 40); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img1.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(1, hash, 6); + } + } + } + + [Fact] + public void CompareDifferentImage() + { + using (var model = RadialVarianceHash.Create()) + using (var img1 = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var img2 = LoadImage("building.jpg", ImreadModes.Grayscale)) + { + var size = new Size(40, 40); + using (var scaledImg1 = img1.Resize(size)) + using (var scaledImg2 = img2.Resize(size)) + { + double hash = model.Compare(scaledImg1, scaledImg2); + Assert.Equal(0.085777, hash, 6); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/imgcodecs/ImgCodecsTest.cs b/test/OpenCvSharp.Tests/imgcodecs/ImgCodecsTest.cs new file mode 100644 index 000000000..0a1e4e5ce --- /dev/null +++ b/test/OpenCvSharp.Tests/imgcodecs/ImgCodecsTest.cs @@ -0,0 +1,512 @@ +using System.Runtime.InteropServices; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Drawing.Processing; +using SixLabors.ImageSharp.Formats; +using SixLabors.ImageSharp.Formats.Bmp; +using SixLabors.ImageSharp.Formats.Jpeg; +using SixLabors.ImageSharp.Formats.Png; +using SixLabors.ImageSharp.Formats.Tiff; +using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; +using Xunit; +using Xunit.Abstractions; +using Color = SixLabors.ImageSharp.Color; +using Image = SixLabors.ImageSharp.Image; + +#pragma warning disable CA1031 + +namespace OpenCvSharp.Tests.ImgCodecs; + +public class ImgCodecsTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public ImgCodecsTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Theory] + [InlineData("building.jpg")] + [InlineData("lenna.png")] + [InlineData("building_mask.bmp")] + public void ImReadSuccess(string fileName) + { + using (var image = LoadImage(fileName, ImreadModes.Grayscale)) + { + Assert.False(image.Empty()); + } + // ReSharper disable once RedundantArgumentDefaultValue + using (var image = LoadImage(fileName, ImreadModes.Color)) + { + Assert.False(image.Empty()); + } + using (var image = LoadImage(fileName, ImreadModes.AnyColor | ImreadModes.AnyDepth)) + { + Assert.False(image.Empty()); + } + } + + [Fact] + public void ImReadFailure() + { + using var image = Cv2.ImRead("not_exist.png", ImreadModes.Grayscale); + Assert.NotNull(image); + Assert.True(image.Empty()); + } + + [Fact] + public void ImReadDoesNotSupportGif() + { + using var image = Cv2.ImRead("_data/image/empty.gif", ImreadModes.Grayscale); + Assert.NotNull(image); + Assert.True(image.Empty()); + } + + //[LinuxOnlyFact] + [Fact] + public void ImReadJapaneseFileName() + { + // https://github.com/opencv/opencv/issues/4242 + // TODO: Fails on AppVeyor (probably this test succeeds only on Japanese Windows) + + testOutputHelper.WriteLine($"CurrentCulture: {Thread.CurrentThread.CurrentCulture.Name}"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + Thread.CurrentThread.CurrentCulture.Name != "ja-JP") + { + testOutputHelper.WriteLine($"Skip {nameof(ImReadJapaneseFileName)}"); + return; + } + + const string fileName = "_data/image/imread_にほんご日本語.png"; + + // Create test data + { + using var image = new Image(10, 10); + image.Mutate(x => + { + x.Fill(Color.Red); + }); + image.SaveAsPng(fileName); + } + + Assert.True(File.Exists(fileName), $"File '{fileName}' not found"); + + using var mat = Cv2.ImRead(fileName); + Assert.NotNull(mat); + Assert.False(mat.Empty()); + } + + // TODO Windows not supported? + // https://github.com/opencv/opencv/issues/4242 + //[PlatformSpecificFact("Linux")] + [Fact] + public void ImReadUnicodeFileName() + { + const string fileName = "_data/image/imread♥♡😀😄.png"; + + CreateDummyImageFile(fileName); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // TODO + // Cannot marshal: Encountered unmappable character. + // at System.Runtime.InteropServices.Marshal.StringToAnsiString(String s, Byte * buffer, Int32 bufferLength, Boolean bestFit, Boolean throwOnUnmappableChar) + Assert.Throws(() => + { + using var image = Cv2.ImRead(fileName); + //Assert.NotNull(image); + //Assert.False(image.Empty()); + }); + } + else + { + using var image = Cv2.ImRead(fileName); + Assert.NotNull(image); + Assert.False(image.Empty()); + } + } + + [Theory] + [InlineData(".jpg")] + [InlineData(".png")] + [InlineData(".bmp")] + [InlineData(".tif")] + public void ImWrite(string ext) + { + var fileName = $"test_imwrite{ext}"; + + using (var mat = new Mat(10, 20, MatType.CV_8UC3, Scalar.Blue)) + { + Cv2.ImWrite(fileName, mat); + } + + var imageInfo = Image.Identify(fileName); + Assert.Equal(10, imageInfo.Height); + Assert.Equal(20, imageInfo.Width); + } + + //[LinuxOnlyFact] + [Fact] + public void ImWriteJapaneseFileName() + { + // TODO: Fails on AppVeyor (probably this test succeeds only on Japanese Windows) + testOutputHelper.WriteLine($"CurrentCulture: {Thread.CurrentThread.CurrentCulture.Name}"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + Thread.CurrentThread.CurrentCulture.Name != "ja-JP") + { + testOutputHelper.WriteLine($"Skip {nameof(ImWriteJapaneseFileName)}"); + return; + } + + const string fileName = "_data/image/imwrite_にほんご日本語.png"; + + using (var mat = new Mat(10, 20, MatType.CV_8UC3, Scalar.Blue)) + { + Cv2.ImWrite(fileName, mat); + } + + Assert.True(File.Exists(fileName), $"File '{fileName}' not found"); + + var imageInfo = Image.Identify(fileName); + Assert.Equal(10, imageInfo.Height); + Assert.Equal(20, imageInfo.Width); + } + + // TODO + // https://github.com/opencv/opencv/issues/4242 + //[PlatformSpecificFact("Linux")] + [Fact] + public void ImWriteUnicodeFileName() + { + const string fileName = "_data/image/imwrite♥♡😀😄.png"; + + // Check whether the path is valid + // ReSharper disable once ReturnValueOfPureMethodIsNotUsed + Path.GetFullPath(fileName); + + using (var mat = new Mat(10, 20, MatType.CV_8UC3, Scalar.Blue)) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // TODO + // Cannot marshal: Encountered unmappable character. + // at System.Runtime.InteropServices.Marshal.StringToAnsiString(String s, Byte * buffer, Int32 bufferLength, Boolean bestFit, Boolean throwOnUnmappableChar) + Assert.Throws(() => { Cv2.ImWrite(fileName, mat); }); + return; + } + else + { + Cv2.ImWrite(fileName, mat); + } + } + + var file = new FileInfo(fileName); + Assert.True(file.Exists, $"File '{fileName}' not found"); + Assert.True(file.Length > 0, $"File size of '{fileName}' == 0"); + + const string asciiFileName = "_data/image/imwrite_unicode_test.png"; + File.Move(fileName, asciiFileName); + var imageInfo = Image.Identify(asciiFileName); + + Assert.Equal(10, imageInfo.Height); + Assert.Equal(20, imageInfo.Width); + } + + // TODO AccessViolationException + //[PlatformSpecificTheory("Windows")] + [Theory] + [InlineData("foo.png")] + [InlineData("bar.jpg")] + [InlineData("baz.bmp")] + public void HaveImageReader(string fileName) + { + var path = Path.Combine("_data", "image", "haveImageReader_" + fileName); + + try + { + // Create a file for test + using (var mat = new Mat(10, 20, MatType.CV_8UC3, Scalar.Blue)) + { + Cv2.ImWrite(path, mat); + } + Assert.True(File.Exists(path), $"File '{path}' not found"); + + //Assert.True(Cv2.HaveImageReader(path)); + } + finally + { + try + { + File.Delete(path); + } + catch (Exception ex) + { + testOutputHelper.WriteLine(ex.ToString()); + } + } + } + + // TODO + [Fact(Skip = "AccessViolationException")] + //[PlatformSpecificFact("Windows")] + public void HaveImageReaderJapanese() + { + testOutputHelper.WriteLine($"CurrentCulture: {Thread.CurrentThread.CurrentCulture.Name}"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + Thread.CurrentThread.CurrentCulture.Name != "ja-JP") + { + testOutputHelper.WriteLine($"Skip {nameof(ImWriteJapaneseFileName)}"); + return; + } + + var path = Path.Combine("_data", "image", "haveImageReader_にほんご日本語.png"); + + try + { + CreateDummyImageFile(path); + Assert.True(Cv2.HaveImageReader(path)); + } + finally + { + try + { + File.Delete(path); + } + catch (Exception ex) + { + testOutputHelper.WriteLine(ex.ToString()); + } + } + } + + [PlatformSpecificFact("Windows")] + public void HaveImageReaderUnicode() + { + var path = Path.Combine("_data", "image", "haveImageReader_♥♡😀😄.png"); + + try + { + CreateDummyImageFile(path); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // TODO + // Cannot marshal: Encountered unmappable character. + // at System.Runtime.InteropServices.Marshal.StringToAnsiString(String s, Byte * buffer, Int32 bufferLength, Boolean bestFit, Boolean throwOnUnmappableChar) + Assert.Throws(() => { Cv2.HaveImageReader(path); }); + } + else + { + Assert.True(Cv2.HaveImageReader(path)); + } + } + finally + { + try + { + File.Delete(path); + } + catch (Exception ex) + { + testOutputHelper.WriteLine(ex.ToString()); + } + } + } + + // TODO + //[PlatformSpecificTheory("Windows")] + [Theory] + [InlineData("foo.png")] + [InlineData("bar.jpg")] + [InlineData("baz.bmp")] + public void HaveImageWriter(string fileName) + => Assert.True(Cv2.HaveImageWriter(fileName)); + + // TODO + [Fact(Skip = "AccessViolationException")] + public void HaveImageWriterJapanese() + { + // TODO: Fails on AppVeyor (probably this test succeeds only on Japanese Windows) + testOutputHelper.WriteLine($"CurrentCulture: {Thread.CurrentThread.CurrentCulture.Name}"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + Thread.CurrentThread.CurrentCulture.Name != "ja-JP") + { + testOutputHelper.WriteLine($"Skip {nameof(ImWriteJapaneseFileName)}"); + return; + } + + // This file does not have to exist + const string fileName = "にほんご日本語.png"; + + Assert.True(Cv2.HaveImageWriter(fileName)); + } + + // TODO + [PlatformSpecificFact("Windows")] + public void HaveImageWriterUnicode() + { + // This file does not have to exist + const string fileName = "♥♡😀😄.png"; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // TODO + // Cannot marshal: Encountered unmappable character. + // at System.Runtime.InteropServices.Marshal.StringToAnsiString(String s, Byte * buffer, Int32 bufferLength, Boolean bestFit, Boolean throwOnUnmappableChar) + Assert.Throws(() => + { + Cv2.HaveImageWriter(fileName); + }); + } + else + { + Assert.True(Cv2.HaveImageWriter(fileName)); + } + } + + [Theory] + [InlineData(".png")] + [InlineData(".jpg")] + [InlineData(".tif")] + [InlineData(".bmp")] + public void ImEncode(string ext) + { + using var mat = LoadImage("lenna.png", ImreadModes.Grayscale); + Assert.False(mat.Empty()); + + Cv2.ImEncode(ext, mat, out var imageData); + Assert.NotNull(imageData); + + // Can ImageSharp decode the imageData? + using var image = Image.Load(imageData); + Assert.Equal(mat.Rows, image.Height); + Assert.Equal(mat.Cols, image.Width); + } + + [Theory] + [InlineData("Png")] + [InlineData("Jpeg")] + [InlineData("Tiff")] + [InlineData("Bmp")] + public void ImDecode(string imageFormatName) + { + IImageEncoder encoder = imageFormatName switch + { + "Png" => new PngEncoder(), + "Jpeg" => new JpegEncoder(), + "Tiff" => new TiffEncoder(), + "Bmp" => new BmpEncoder(), + _ => throw new ArgumentOutOfRangeException(nameof(imageFormatName), imageFormatName, null) + }; + + using var image = Image.Load("_data/image/mandrill.png"); + using var stream = new MemoryStream(); + image.Save(stream, encoder); + var imageData = stream.ToArray(); + Assert.NotNull(imageData); + + using var mat = Cv2.ImDecode(imageData, ImreadModes.Color); + Assert.NotNull(mat); + Assert.False(mat.Empty()); + Assert.Equal(image.Width, mat.Cols); + Assert.Equal(image.Height, mat.Rows); + + ShowImagesWhenDebugMode(mat); + } + + [Fact] + public void ImDecodeSpan() + { + var imageBytes = File.ReadAllBytes("_data/image/mandrill.png"); + Assert.NotEmpty(imageBytes); + + // whole range + { + var span = imageBytes.AsSpan(); + using var mat = Cv2.ImDecode(span, ImreadModes.Color); + Assert.NotNull(mat); + Assert.False(mat.Empty()); + ShowImagesWhenDebugMode(mat); + } + + // slice + { + var dummyBytes = Enumerable.Repeat((byte)123, 100).ToArray(); + var imageBytesWithDummy = dummyBytes.Concat(imageBytes).Concat(dummyBytes).ToArray(); + +#if NET48 + var span = imageBytesWithDummy.AsSpan(100, imageBytes.Length); +#else + var span = imageBytesWithDummy.AsSpan()[100..^100]; +#endif + using var mat = Cv2.ImDecode(span, ImreadModes.Color); + Assert.NotNull(mat); + Assert.False(mat.Empty()); + ShowImagesWhenDebugMode(mat); + } + } + + [Fact] + public void WriteMultiPagesTiff() + { + string[] files = [ + "multipage_p1.tif", + "multipage_p2.tif", + ]; + + Mat[]? pages = null; + Mat[]? readPages = null; + try + { + pages = files.Select(f => LoadImage(f)).ToArray(); + + Assert.True(Cv2.ImWrite("multi.tiff", pages), "imwrite failed"); + Assert.True(Cv2.ImReadMulti("multi.tiff", out readPages), "imreadmulti failed"); + Assert.NotEmpty(readPages); + Assert.Equal(pages.Length, readPages.Length); + + for (var i = 0; i < pages.Length; i++) + { + ImageEquals(pages[i], readPages[i]); + } + + } + finally + { + if (pages is not null) + foreach (var page in pages) + page.Dispose(); + if (readPages is not null) + foreach (var page in readPages) + page.Dispose(); + } + } + + private static void CreateDummyImageFile(string path) + { + _ = Path.GetFullPath(path); + + var tempFileName = Path.GetTempFileName(); + { + + using var image = new Image(10, 10); + image.Mutate(x => + { + x.Fill(Color.Red); + }); + image.SaveAsPng(tempFileName); + } + +#if NET48 + if (File.Exists(path)) + { + File.Delete(path); + } + File.Move(tempFileName, path); +#else + File.Move(tempFileName, path, true); +#endif + Assert.True(File.Exists(path), $"File '{path}' not found"); + } +} diff --git a/test/OpenCvSharp.Tests/imgproc/CLAHETest.cs b/test/OpenCvSharp.Tests/imgproc/CLAHETest.cs new file mode 100644 index 000000000..c8baf4865 --- /dev/null +++ b/test/OpenCvSharp.Tests/imgproc/CLAHETest.cs @@ -0,0 +1,36 @@ +using Xunit; + +namespace OpenCvSharp.Tests.ImgProc; + +// ReSharper disable once InconsistentNaming +public class CLAHETest : TestBase +{ + [Fact] + public void Run() + { + using var src = LoadImage("lenna.png", ImreadModes.Grayscale); + using var dst = new Mat(); + using var clahe = Cv2.CreateCLAHE(); + clahe.Apply(src, dst); + } + + [Fact] + public void ClipLimit() + { + const double value = 3.14; + + using var clahe = Cv2.CreateCLAHE(); + clahe.ClipLimit = value; + Assert.Equal(value, clahe.ClipLimit); + } + + [Fact] + public void TilesGridSize() + { + var value = new Size(1, 2); + + using var clahe = Cv2.CreateCLAHE(); + clahe.TilesGridSize = value; + Assert.Equal(value, clahe.TilesGridSize); + } +} diff --git a/test/OpenCvSharp.Tests/imgproc/ConnectedComponentsTest.cs b/test/OpenCvSharp.Tests/imgproc/ConnectedComponentsTest.cs new file mode 100644 index 000000000..03c41f44f --- /dev/null +++ b/test/OpenCvSharp.Tests/imgproc/ConnectedComponentsTest.cs @@ -0,0 +1,69 @@ +using Xunit; + +namespace OpenCvSharp.Tests.ImgProc; + +public class ConnectedComponentsTest : TestBase +{ + [Theory] + [InlineData(PixelConnectivity.Connectivity4, ConnectedComponentsAlgorithmsTypes.Default)] + [InlineData(PixelConnectivity.Connectivity4, ConnectedComponentsAlgorithmsTypes.GRANA)] + [InlineData(PixelConnectivity.Connectivity8, ConnectedComponentsAlgorithmsTypes.Default)] + [InlineData(PixelConnectivity.Connectivity8, ConnectedComponentsAlgorithmsTypes.GRANA)] + public void Run(PixelConnectivity connectivity, ConnectedComponentsAlgorithmsTypes algorithmType) + { + using var src = LoadImage("alphabet.png", ImreadModes.Grayscale); + using var binary = new Mat(); + Cv2.Threshold(src, binary, 128, 255, ThresholdTypes.BinaryInv); + ShowImagesWhenDebugMode(src, binary); + + var cc = Cv2.ConnectedComponentsEx(binary, connectivity, algorithmType); + + Assert.Equal(27, cc.LabelCount); + Assert.NotEmpty(cc.Labels.GetBuffer()); + Assert.Equal(src.Rows, cc.Labels.GetLength(0)); + Assert.Equal(src.Cols, cc.Labels.GetLength(1)); + + using var render = new Mat(); + cc.RenderBlobs(render); + ShowImagesWhenDebugMode(render); + } + + [Fact] + public void GetLargestBlob() + { + using var src = new Mat(100, 100, MatType.CV_8UC1, Scalar.Black); + Cv2.Rectangle(src, new Rect(10, 20, 10, 20), Scalar.White, -1); + Cv2.Rectangle(src, new Rect(50, 60, 20, 30), Scalar.White, -1); // greater + ShowImagesWhenDebugMode(src); + + var cc = Cv2.ConnectedComponentsEx(src, PixelConnectivity.Connectivity8, ConnectedComponentsAlgorithmsTypes.Default); + + var largestBlob = cc.GetLargestBlob(); + Assert.Equal(50, largestBlob.Left); + Assert.Equal(60, largestBlob.Top); + Assert.Equal(20, largestBlob.Width); + Assert.Equal(30, largestBlob.Height); + Assert.Equal(new Rect(50, 60, 20, 30), largestBlob.Rect); + Assert.Equal(20 * 30, largestBlob.Area); + Assert.Equal(new Point2d(59.5, 74.5), largestBlob.Centroid); + } + + [Fact] + public void FilterByLabel() + { + using var src = new Mat(100, 100, MatType.CV_8UC1, Scalar.Black); + Cv2.Rectangle(src, new Rect(10, 20, 10, 20), Scalar.White, -1); + Cv2.Rectangle(src, new Rect(50, 60, 20, 30), Scalar.White, -1); // greater + + var cc = Cv2.ConnectedComponentsEx(src, PixelConnectivity.Connectivity8, ConnectedComponentsAlgorithmsTypes.Default); + + using var dst = new Mat(); + cc.FilterByLabel(src, dst, 1); + + using var expected = new Mat(100, 100, MatType.CV_8UC1, Scalar.Black); + Cv2.Rectangle(expected, new Rect(10, 20, 10, 20), Scalar.White, -1); + ShowImagesWhenDebugMode(src, dst, expected); + + ImageEquals(dst, expected); + } +} diff --git a/test/OpenCvSharp.Tests/imgproc/ImgProcTest.cs b/test/OpenCvSharp.Tests/imgproc/ImgProcTest.cs new file mode 100644 index 000000000..1ddfdd1ad --- /dev/null +++ b/test/OpenCvSharp.Tests/imgproc/ImgProcTest.cs @@ -0,0 +1,823 @@ +using System.Diagnostics; +using System.Globalization; +using OpenCvSharp.Internal.Vectors; +using Xunit; + +namespace OpenCvSharp.Tests.ImgProc; + +public class ImgProcTest : TestBase +{ + [Fact] + public void BuildPyramidTest() + { + using var src = LoadImage("lenna.png"); + using var dst = new VectorOfMat(); + Cv2.BuildPyramid(src, dst, 2); + Assert.Equal(3, dst.Size); + } + + [Fact] + public void MorphologyExDilate() + { + using var src = new Mat(100, 100, MatType.CV_8UC1, Scalar.All(255)); + using var dst = new Mat(); + Cv2.Rectangle(src, new Rect(30, 30, 40, 40), Scalar.Black, 1); + Cv2.MorphologyEx(src, dst, MorphTypes.Dilate, null); + + ShowImagesWhenDebugMode(src, dst); + + Assert.Equal(src.Rows * src.Cols, Cv2.CountNonZero(dst)); + } + + [Fact] + public void MorphologyExErode() + { + using var src = Mat.Zeros(100, 100, MatType.CV_8UC1); + using var dst = new Mat(); + Cv2.Rectangle(src, new Rect(30, 30, 40, 40), Scalar.White, 1); + Cv2.MorphologyEx(src, dst, MorphTypes.Erode, null); + + ShowImagesWhenDebugMode(src, dst); + + Assert.Equal(0, Cv2.CountNonZero(dst)); + } + + [Fact] + public void WarpAffine() + { + using var src = new Mat(new Size(1024, 768), MatType.CV_8UC4); + + using var matrix = new Mat(new Size(3, 2), MatType.CV_64FC1); + matrix.Set(0, 0, 1); + matrix.Set(1, 1, 1); + + using var dst = new Mat(); + Cv2.WarpAffine(src, dst, matrix, src.Size()); + } + + // TODO + [Fact(Skip = "fails with exception")] + public void WarpAffineBigImage() + { + using var src = new Mat(new Size(8192, 10), MatType.CV_8UC4); + + using var matrix = new Mat(new Size(3, 2), MatType.CV_64FC1); + matrix.Set(0, 0, 1); + matrix.Set(1, 1, 1); + + using var dst = new Mat(); + Cv2.WarpAffine(src, dst, matrix, src.Size()); // fails with exception + } + + [Fact] + public void BlendLinear() + { + using var src1 = LoadImage("tsukuba_left.png"); + using var src2 = LoadImage("tsukuba_right.png"); + using var weights = new Mat(src1.Size(), MatType.CV_32FC1, Scalar.All(0.5)); + using var dst = new Mat(); + + Assert.Equal(src1.Size(), src2.Size()); + + Cv2.BlendLinear(src1, src2, weights, weights, dst); + + ShowImagesWhenDebugMode(src1, src2, dst); + } + + [Fact] + public void Demosaicing() + { + using var src = LoadImage("lenna.png", ImreadModes.Grayscale); + using var dst = new Mat(); + Cv2.Demosaicing(src, dst, ColorConversionCodes.BayerBG2GRAY); + + ShowImagesWhenDebugMode(src, dst); + } + + [Fact] + public void ArcLength() + { + var arc = new[] { new Point2f(0, 0), new Point2f(10, 0), new Point2f(10, 10), new Point2f(0, 10), }; + var length1 = Cv2.ArcLength(arc, true); + Assert.Equal(40, length1); + + var length2 = Cv2.ArcLength(arc, false); + Assert.Equal(30, length2); + } + + [Fact] + public void BoundingRect() + { + var points = new[] { new Point(0, 0), new Point(10, 10), new Point(5, 5), }; + var rect1 = Cv2.BoundingRect(points); + Assert.Equal(new Rect(0, 0, 11, 11), rect1); + + var floatPoints = new[] { new Point2f(0, 0), new Point2f(10, 10), new Point2f(5, 5), }; + var rect2 = Cv2.BoundingRect(floatPoints); + Assert.Equal(new Rect(0, 0, 11, 11), rect2); + } + + [Fact] + public void ContourArea() + { + var contour = new[] { new Point2f(0, 0), new Point2f(10, 0), new Point2f(10, 10), new Point2f(0, 10), }; + var area = Cv2.ContourArea(contour); + Assert.Equal(100, area); + } + + [Fact] + public void BoxPoints() + { + var rotatedRect = new RotatedRect(new Point2f(10, 10), new Size2f(10, 10), (float)(Math.PI / 4)); + var points = Cv2.BoxPoints(rotatedRect); + + Assert.Equal(4, points.Length); + Assert.Equal(4.932f, points[0].X, 1e-3); + Assert.Equal(14.931f, points[0].Y, 1e-3); + Assert.Equal(5.069f, points[1].X, 1e-3); + Assert.Equal(4.932f, points[1].Y, 1e-3); + Assert.Equal(15.068f, points[2].X, 1e-3); + Assert.Equal(5.069f, points[2].Y, 1e-3); + Assert.Equal(14.931f, points[3].X, 1e-3); + Assert.Equal(15.068f, points[3].Y, 1e-3); + } + + [Fact] + public void MinEnclosingCircle() + { + var points = new[] { new Point2f(0, 0), new Point2f(10, 0), new Point2f(10, 10), new Point2f(0, 10), }; + Cv2.MinEnclosingCircle(points, out var center, out var radius); + + Assert.Equal(5f, center.X, 1e-3); + Assert.Equal(5f, center.Y, 1e-3); + Assert.Equal(5 * Math.Sqrt(2), radius, 3); + } + + [Fact] + public void MinEnclosingTriangle() + { + var points = new[] { new Point2f(0, 0), new Point2f(10, 0), new Point2f(10, 10), new Point2f(0, 10), }; + var area = Cv2.MinEnclosingTriangle(points, out var triangle); + + Assert.Equal(3, triangle.Length); + Assert.Equal(0f, triangle[0].X, 1e-3); + Assert.Equal(-10f, triangle[0].Y, 1e-3); + Assert.Equal(0f, triangle[1].X, 1e-3); + Assert.Equal(10f, triangle[1].Y, 1e-3); + Assert.Equal(20f, triangle[2].X, 1e-3); + Assert.Equal(10f, triangle[2].Y, 1e-3); + + Assert.Equal(200f, area, 3); + } + + [Fact] + public void ConvexHull() + { + var contour = new[] + { + // + new Point(0, 0), + new Point(0, 10), + new Point(3, 10), + new Point(3, 5), + new Point(6, 5), + new Point(6, 10), + new Point(10, 10), + new Point(10, 0), + }; + var hull = Cv2.ConvexHull(contour); + + Assert.Equal(4, hull.Length); + Assert.Equal(new Point(10, 0), hull[0]); + Assert.Equal(new Point(10, 10), hull[1]); + Assert.Equal(new Point(0, 10), hull[2]); + Assert.Equal(new Point(0, 0), hull[3]); + } + + [Fact] + public void ConvexHullIndices() + { + var contour = new[] + { + // + new Point(0, 0), + new Point(0, 10), + new Point(3, 10), + new Point(3, 5), + new Point(6, 5), + new Point(6, 10), + new Point(10, 10), + new Point(10, 0), + }; + var hull = Cv2.ConvexHullIndices(contour); + + Assert.Equal(4, hull.Length); + Assert.Equal(new[] { 7, 6, 1, 0 }, hull); + } + + [Fact] + public void ConvexityDefects() + { + var contour = new[] + { + // + new Point(0, 0), + new Point(0, 10), + new Point(3, 10), + new Point(3, 5), + new Point(6, 5), + new Point(6, 10), + new Point(10, 10), + new Point(10, 0), + }; + var convexHull = Cv2.ConvexHullIndices(contour); + Assert.Equal(4, convexHull.Length); + + // Note: ConvexityDefects does not support Point2f contour + var convexityDefects = Cv2.ConvexityDefects(contour, convexHull); + + Assert.Single(convexityDefects); + Assert.Equal(new Vec4i(1, 6, 3, 1280), convexityDefects[0]); + } + + [Fact] + public void IsContourConvex() + { + var contour1 = new[] + { + // + new Point(0, 0), + new Point(0, 10), + new Point(3, 10), + new Point(3, 5), + new Point(6, 5), + new Point(6, 10), + new Point(10, 10), + new Point(10, 0), + }; + Assert.False(Cv2.IsContourConvex(contour1)); + + var contour2 = new[] + { + new Point2f(0, 0), + new Point2f(10, 0), + new Point2f(10, 10), + new Point2f(0, 10), + }; + Assert.True(Cv2.IsContourConvex(contour2)); + } + + [Fact] + public void FitEllipse() + { + var contour = new[] + { + new Point2f(0, 0), + new Point2f(10, 0), + new Point2f(10, 10), + new Point2f(5, 15), + new Point2f(0, 10), + }; + var ellipse = new[] + { + Cv2.FitEllipse(contour), + Cv2.FitEllipseAMS(contour), + Cv2.FitEllipseDirect(contour) + }; + + foreach (var e in ellipse) + { + Assert.Equal(5f, e.Center.X, 1e-3); + Assert.Equal(5f, e.Center.Y, 1e-3); + Assert.Equal(11.547f, e.Size.Width, 1e-3); + Assert.Equal(20f, e.Size.Height, 1e-3); + Assert.Equal(0f, e.Angle, 1e-3); + } + } + + [Fact] + public void FitLineByPoint2f() + { + var contour = new[] + { + new Point2f(0, 0), + new Point2f(10, 10), + new Point2f(5, 5), + }; + var line = Cv2.FitLine(contour, DistanceTypes.L2, 0, 0, 0.01); + + Assert.Equal(5.0, line.X1, 3); + Assert.Equal(5.0, line.Y1, 3); + Assert.Equal(Math.Sqrt(2) / 2, line.Vx, 3); + Assert.Equal(Math.Sqrt(2) / 2, line.Vy, 3); + } + + [Fact] + public void FitLineByPoints() + { + var contour = new[] + { + new Point(0, 0), + new Point(10, 10), + new Point(5, 5), + }; + var line = Cv2.FitLine(contour, DistanceTypes.L2, 0, 0, 0.01); + + Assert.Equal(5.0, line.X1, 3); + Assert.Equal(5.0, line.Y1, 3); + Assert.Equal(Math.Sqrt(2) / 2, line.Vx, 3); + Assert.Equal(Math.Sqrt(2) / 2, line.Vy, 3); + } + + [Fact] + public void FitLineByMat() + { + var matTypes = new[] + { + (MatType.CV_32SC1, 2), + (MatType.CV_32SC2, 1) + }; + foreach (var (matType, cols) in matTypes) + { + var contour = new[] + { + new Point(0, 0), + new Point(10, 10), + new Point(5, 5), + }; + using var src = Mat.FromPixelData(contour.Length, cols, matType, contour); + using var dst = new Mat(); + Cv2.FitLine(src, dst, DistanceTypes.L2, 0, 0, 0.01); + + Assert.False(dst.Empty()); + Assert.Equal(MatType.CV_32FC1, dst.Type()); + Assert.Equal(new Size(1, 4), dst.Size()); + + Assert.Equal(Math.Sqrt(2) / 2, dst.Get(0), 3); + Assert.Equal(Math.Sqrt(2) / 2, dst.Get(1), 3); + Assert.Equal(5, dst.Get(2), 1e-3); + Assert.Equal(5, dst.Get(3), 1e-3); + } + } + + [Fact] + public void PointPolygonTest() + { + var contour = new[] + { + new Point2f(0, 0), + new Point2f(10, 0), + new Point2f(10, 10), + new Point2f(0, 10), + }; + var dist = Cv2.PointPolygonTest(contour, new Point2f(5, 5), false); + Assert.Equal(1, dist, 3); + + dist = Cv2.PointPolygonTest(contour, new Point2f(0, 5), false); + Assert.Equal(0, dist, 3); + + dist = Cv2.PointPolygonTest(contour, new Point2f(100, 100), false); + Assert.Equal(-1, dist, 3); + + dist = Cv2.PointPolygonTest(contour, new Point2f(5, 5), true); + Assert.Equal(5, dist, 3); + } + + [Fact] + public void RotatedRectangleIntersectionOutputArray() + { + var rr1 = new RotatedRect(new Point2f(10, 10), new Size2f(10, 10), 45); + var rr2 = new RotatedRect(new Point2f(15, 10), new Size2f(10, 10), 0); + using var intersectingRegion = new Mat(); + Cv2.RotatedRectangleIntersection(rr1, rr2, intersectingRegion); + Assert.Equal(5, intersectingRegion.Rows); + Assert.Equal(1, intersectingRegion.Cols); + Assert.Equal(MatType.CV_32FC2, intersectingRegion.Type()); + } + + [Fact] + public void RotatedRectangleIntersectionVector() + { + var rr1 = new RotatedRect(new Point2f(100, 100), new Size2f(100, 100), 45); + var rr2 = new RotatedRect(new Point2f(130, 100), new Size2f(100, 100), 0); + + Cv2.RotatedRectangleIntersection(rr1, rr2, out var intersectingRegion); + + if (Debugger.IsAttached) + { + static Point[] ToPoints(IEnumerable enumerable) + { + return enumerable.Select(p => new Point(p.X, p.Y)).ToArray(); + } + + using var img = new Mat(200, 200, MatType.CV_8UC3, new Scalar(0)); + img.Polylines([ToPoints(rr1.Points())], true, Scalar.Red); + img.Polylines([ToPoints(rr2.Points())], true, Scalar.Green); + img.Polylines([ToPoints(intersectingRegion)], true, Scalar.White); + + Window.ShowImages(img); + } + } + + [Fact] + public void Rectangle() + { + var color = Scalar.Red; + + using Mat img1 = Mat.Zeros(100, 100, MatType.CV_8UC3); + using Mat img2 = img1.Clone(); + using Mat img3 = img1.Clone(); + using Mat img4 = img1.Clone(); + using InputOutputArray ioa3 = InputOutputArray.Create(img3); + using InputOutputArray ioa4 = InputOutputArray.Create(img4); + + Cv2.Rectangle(img1, new Rect(10, 10, 80, 80), color, 1); + Cv2.Rectangle(img2, new Point(10, 10), new Point(89, 89), color, 1); + Cv2.Rectangle(ioa3, new Rect(10, 10, 80, 80), color, 1); + Cv2.Rectangle(ioa4, new Point(10, 10), new Point(89, 89), color, 1); + + ShowImagesWhenDebugMode(img1, img2); + + var colorVec = color.ToVec3b(); + var expected = new Vec3b[100, 100]; + for (int x = 10; x <= 89; x++) + { + expected[10, x] = colorVec; + expected[89, x] = colorVec; + } + for (int y = 10; y <= 89; y++) + { + expected[y, 10] = colorVec; + expected[y, 89] = colorVec; + } + + TestImage(img1, expected); + TestImage(img2, expected); + TestImage(img3, expected); + TestImage(img4, expected); + } + + [Fact] + public void RectangleShift() + { + using var mat = new Mat(300, 300, MatType.CV_8UC3, Scalar.All(0)); + Cv2.Rectangle(mat, new Rect(10, 20, 100, 200), Scalar.Red, -1, LineTypes.Link8, 0); + Cv2.Rectangle(mat, new Rect(10, 20, 100, 200), Scalar.Green, -1, LineTypes.Link8, 1); + Cv2.Rectangle(mat, new Rect(10, 20, 100, 200), Scalar.Blue, -1, LineTypes.Link8, 2); + + ShowImagesWhenDebugMode(mat); + } + + [Fact] + public void RectangleFilled() + { + var color = Scalar.Red; + + using Mat img = Mat.Zeros(100, 100, MatType.CV_8UC3); + img.Rectangle(new Rect(10, 10, 80, 80), color, Cv2.FILLED/*-1*/); + + if (Debugger.IsAttached) + { + Window.ShowImages(img); + } + + var colorVec = color.ToVec3b(); + var expected = new Vec3b[100, 100]; + for (var y = 10; y < 90; y++) + { + for (var x = 10; x < 90; x++) + { + expected[y, x] = colorVec; + } + } + + TestImage(img, expected); + } + + private static void TestImage(Mat img, Vec3b[,] expected) + { + if (img is null) + throw new ArgumentNullException(nameof(img)); + if (expected is null) + throw new ArgumentNullException(nameof(expected)); + + if (img.Type() != MatType.CV_8UC3) + throw new ArgumentException("Mat.Type() != 8UC3", nameof(img)); + + var height = img.Rows; + var width = img.Cols; + if (height != expected.GetLength(0) || width != expected.GetLength(1)) + throw new ArgumentException("size mismatch"); + + var indexer = img.GetGenericIndexer(); + for (var y = 0; y < height; y++) + { + for (var x = 0; x < width; x++) + { + var expectedValue = expected[y, x]; + var actualValue = indexer[y, x]; + Assert.True( + expectedValue == actualValue, + // ReSharper disable once UseStringInterpolation + string.Format(CultureInfo.InvariantCulture, "difference at (x:{0}, y:{1})\nexpected:\t{2}\nactual:\t{3}\n", + x, + y, + $"(B:{expectedValue.Item0} G:{expectedValue.Item1} R:{expectedValue.Item2})", + $"(B:{actualValue.Item0} G:{actualValue.Item1} R:{actualValue.Item2})")); + } + } + } + + [Fact] + public void ApplyColorMap() + { + using var src = LoadImage("building.jpg", ImreadModes.Color); + using var dst = new Mat(); + Cv2.ApplyColorMap(src, dst, ColormapTypes.Cool); + + ShowImagesWhenDebugMode(src, dst); + + using var userColor = new Mat(256, 1, MatType.CV_8UC3, Scalar.All(128)); + Cv2.ApplyColorMap(src, dst, userColor); + + ShowImagesWhenDebugMode(src, dst); + } + + [Fact] + public void CornerHarris() + { + using var src = LoadImage("building.jpg", ImreadModes.Grayscale); + using var corners = new Mat(); + using var dst = new Mat(); + Cv2.CornerHarris(src, corners, 2, 3, 0.04); + + if (Debugger.IsAttached) + { + Cv2.Normalize(corners, corners, 0, 255, NormTypes.MinMax); + Cv2.Threshold(corners, dst, 180, 255, ThresholdTypes.Binary); + Window.ShowImages(src, corners, dst); + } + } + + [Fact] + public void CornerMinEigenVal() + { + using var src = LoadImage("building.jpg", ImreadModes.Grayscale); + using var corners = new Mat(); + using var dst = new Mat(); + Cv2.CornerMinEigenVal(src, corners, 2, 3, BorderTypes.Reflect); + + if (Debugger.IsAttached) + { + Cv2.Normalize(corners, corners, 0, 255, NormTypes.MinMax); + Cv2.Threshold(corners, dst, 180, 255, ThresholdTypes.Binary); + Window.ShowImages(src, corners, dst); + } + } + + [Fact] + public void FindContours() + { + using var src = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale); + Cv2.BitwiseNot(src, src); + Cv2.FindContours( + src, + out var contours, + out var hierarchy, + RetrievalModes.External, + ContourApproximationModes.ApproxSimple); + + Assert.NotEmpty(contours); + Assert.NotEmpty(hierarchy); + + Assert.All(contours, contour => + { + Assert.Equal(4, contour.Length); + }); + + if (Debugger.IsAttached) + { + using var view = new Mat(src.Size(), MatType.CV_8UC3, Scalar.All(0)); + Cv2.DrawContours(view, contours, -1, Scalar.Red); + Window.ShowImages(src, view); + } + } + + [Fact] + public void CalcHist() + { + using var src = new Mat(@"_data/image/mandrill.png", ImreadModes.Grayscale); + + using var hist = new Mat(); + Cv2.CalcHist( + images: [src], + channels: [0], + mask: null, + hist: hist, + dims: 1, + histSize: [256], + ranges: new[] { new Rangef(0, 256) }); + + if (Debugger.IsAttached) + { + const int histW = 512; + const int histH = 400; + var binW = Math.Round((double)histW / 256); + using var histImage = new Mat(histH, histW, MatType.CV_8UC3, Scalar.All(0)); + Cv2.Normalize(hist, hist, 0, histImage.Rows, NormTypes.MinMax, -1); + + for (var i = 0; i < 256; i++) + { + var pt1 = new Point2d(binW * (i - 1), histH - Math.Round(hist.At(i - 1))); + var pt2 = new Point2d(binW * (i), histH - Math.Round(hist.At(i))); + Cv2.Line( + histImage, (Point)pt1, (Point)pt2, + Scalar.Red, 1, LineTypes.Link8); + } + + Window.ShowImages(src, histImage); + } + } + + [Fact] + public void MatchTemplate() + { + using var src = new Mat("_data/image/qr_multi.png", ImreadModes.Grayscale); + using var template = src[new Rect(33, 33, 235, 235)]; + + using var result = new Mat(); + Cv2.MatchTemplate(src, template, result, TemplateMatchModes.CCoeffNormed); + + Assert.False(result.Empty()); + Assert.Equal(MatType.CV_32FC1, result.Type()); + Assert.Equal(src.Rows - template.Rows + 1, result.Rows); + Assert.Equal(src.Cols - template.Cols + 1, result.Cols); + + Cv2.MinMaxLoc(result, out _, out Point maxLoc); + Assert.Equal(new Point(33, 33), maxLoc); + + if (Debugger.IsAttached) + { + using var view = new Mat(); + Cv2.CvtColor(src, view, ColorConversionCodes.GRAY2BGR); + Cv2.Rectangle(view, new Rect(maxLoc, template.Size()), Scalar.Red, 2); + + Window.ShowImages(view, result); + } + } + + [Fact] + public void HoughLinesP() + { + using var src = new Mat("_data/image/houghp.png", ImreadModes.Grayscale); + + using var binary = new Mat(); + Cv2.Threshold(src, binary, 0, 255, ThresholdTypes.Otsu); + + var lines = Cv2.HoughLinesP(binary, 1, Cv2.PI / 180f, 50, 50, 10); + Assert.NotEmpty(lines); + + if (Debugger.IsAttached) + { + using var view = new Mat(); + Cv2.CvtColor(src, view, ColorConversionCodes.GRAY2BGR); + foreach (var line in lines) + { + Cv2.Line(view, line.P1, line.P2, Scalar.Red); + } + + Window.ShowImages([src, binary, view], ["src", "binary", "lines"]); + } + } + + [Fact] + public void HoughLinesPointSet() + { + Vec2f[] points = + [ + new(0.0f, 369.0f), + new(10.0f, 364.0f), + new(20.0f, 358.0f), + new(30.0f, 352.0f), + new(40.0f, 346.0f), + new(50.0f, 341.0f), + new(60.0f, 335.0f), + new(70.0f, 329.0f), + new(80.0f, 323.0f), + new(90.0f, 318.0f), + new(100.0f, 312.0f), + new(110.0f, 306.0f), + new(120.0f, 300.0f), + new(130.0f, 295.0f), + new(140.0f, 289.0f), + new(150.0f, 284.0f), + new(160.0f, 277.0f), + new(170.0f, 271.0f), + new(180.0f, 266.0f), + new(190.0f, 260.0f) + ]; + + const int + linesMax = 20, + threshold = 1; + const double + rhoMin = 0.0f, + rhoMax = 360.0f, + rhoStep = 1, + thetaMin = 0.0f, + thetaMax = Cv2.PI / 2.0f, + thetaStep = Cv2.PI / 180.0f; + + using var pointsMat = new Mat(points.Length, 1, MatType.CV_32FC2); + pointsMat.SetArray(points); + using var linesMat = new Mat(); + Cv2.HoughLinesPointSet(pointsMat, linesMat, linesMax, threshold, rhoMin, rhoMax, rhoStep, thetaMin, thetaMax, thetaStep); + + Assert.False(linesMat.Empty()); + Assert.Equal(MatType.CV_64FC3, linesMat.Type()); + + Assert.True(linesMat.GetArray(out Vec3d[] lines)); + Assert.NotEmpty(lines); + + var (votes, rho, theta) = lines[0]; + Assert.True(votes > 10); + Assert.Equal(320, rho, 6); + Assert.Equal(1.0471975803375244, theta, 6); + } + + [Fact] + public void Integral() + { + using var ones = Mat.Ones(3, 3, MatType.CV_8UC1); + using var sum = new Mat(); + + Cv2.Integral(ones, sum); + + Assert.Equal(9, sum.At(3, 3)); + Assert.Equal(9, (int)Cv2.Sum(ones)); + } + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + [InlineData(InterpolationFlags.Linear)] + [InlineData(InterpolationFlags.Cubic)] + [InlineData(InterpolationFlags.Lanczos4)] + public void ResizeByteMat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + [InlineData(InterpolationFlags.Linear)] + [InlineData(InterpolationFlags.Cubic)] + [InlineData(InterpolationFlags.Lanczos4)] + public void ResizeFloatMat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + //[InlineData(InterpolationFlags.Linear)] + //[InlineData(InterpolationFlags.Cubic)] + //[InlineData(InterpolationFlags.Lanczos4)] + public void ResizeInt32Mat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + [InlineData(InterpolationFlags.Linear)] + [InlineData(InterpolationFlags.Cubic)] + [InlineData(InterpolationFlags.Lanczos4)] + public void ResizeUShortMat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + [InlineData(InterpolationFlags.Linear)] + [InlineData(InterpolationFlags.Cubic)] + [InlineData(InterpolationFlags.Lanczos4)] + public void ResizeDoubleMat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + [InlineData(InterpolationFlags.Linear)] + [InlineData(InterpolationFlags.Cubic)] + [InlineData(InterpolationFlags.Lanczos4)] + public void ResizeVec3bMat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + //[InlineData(InterpolationFlags.Linear)] + //[InlineData(InterpolationFlags.Cubic)] + //[InlineData(InterpolationFlags.Lanczos4)] + public void ResizeVec4iMat(InterpolationFlags flags) => ResizeCore(flags); + + [Theory] + [InlineData(InterpolationFlags.Nearest)] + [InlineData(InterpolationFlags.Linear)] + [InlineData(InterpolationFlags.Cubic)] + [InlineData(InterpolationFlags.Lanczos4)] + public void ResizeVec6dMat(InterpolationFlags flags) => ResizeCore(flags); + + private static void ResizeCore(InterpolationFlags flags) + where T : unmanaged + { + using var src = new Mat(10, 10); + using var dst = src.Resize(default, 0.5, 0.5, flags); + Assert.Equal(new Size(5, 5), dst.Size()); + } +} diff --git a/test/OpenCvSharp.Tests/imgproc/IntelligentScissorsMBTest.cs b/test/OpenCvSharp.Tests/imgproc/IntelligentScissorsMBTest.cs new file mode 100644 index 000000000..272d4f311 --- /dev/null +++ b/test/OpenCvSharp.Tests/imgproc/IntelligentScissorsMBTest.cs @@ -0,0 +1,44 @@ +using OpenCvSharp.Segmentation; +using Xunit; + +namespace OpenCvSharp.Tests.ImgProc; + +// ReSharper disable once InconsistentNaming +public class IntelligentScissorsMBTest : TestBase +{ + [Fact] + public void NewAndDispose() + { + using var tool = new IntelligentScissorsMB(); + GC.KeepAlive(tool); + } + + /// + /// https://github.com/opencv/opencv/blob/68d15fc62edad980f1ffa15ee478438335f39cc3/samples/cpp/tutorial_code/snippets/imgproc_segmentation.cpp + /// + [Fact] + public void Run() + { + using var image = new Mat(new Size(1920, 1080), MatType.CV_8UC3, Scalar.All(128)); + + using var tool = new IntelligentScissorsMB(); + tool.SetEdgeFeatureCannyParameters(16, 100) // using Canny() as edge feature extractor + .SetGradientMagnitudeMaxLimit(200); + + // calculate image features + tool.ApplyImage(image); + + // calculate map for specified source point + var sourcePoint = new Point(200, 100); + tool.BuildMap(sourcePoint); + + // fast fetching of contours + // for specified target point and the pre-calculated map (stored internally) + var targetPoint = new Point(400, 300); + using var ptsMat = new Mat(); + tool.GetContour(targetPoint, ptsMat); + + var pts = ptsMat.ToArray(); + Assert.Equal(201, pts.Length); + } +} diff --git a/test/OpenCvSharp.Tests/imgproc/LineIteratorTest.cs b/test/OpenCvSharp.Tests/imgproc/LineIteratorTest.cs new file mode 100644 index 000000000..9cf418e3a --- /dev/null +++ b/test/OpenCvSharp.Tests/imgproc/LineIteratorTest.cs @@ -0,0 +1,53 @@ +using Xunit; + +namespace OpenCvSharp.Tests.ImgProc; + +public class LineIteratorTest : TestBase +{ + [Fact] + public void CountPixels() + { + var p1 = new Point(0, 0); + var p2 = new Point(9, 9); + + using (var mat = Mat.Zeros(10, 10, MatType.CV_8UC1)) + using (var lineIterator = new LineIterator(mat, p1, p2)) + { +#pragma warning disable CA1829 + var count = lineIterator.Count(); +#pragma warning restore CA1829 + Assert.Equal(10, count); + } + } + + [Fact] + public void SumPixelsByte() + { + var p1 = new Point(0, 0); + var p2 = new Point(9, 9); + + using var mat = new Mat(10, 10, MatType.CV_8UC1, new Scalar(2)); + using var lineIterator = new LineIterator(mat, p1, p2); + var sum = lineIterator.Sum(pixel => pixel.GetValue()); + Assert.Equal(10 * 2, sum); + } + + [Fact] + public void SumPixelsVec3b() + { + var p1 = new Point(0, 0); + var p2 = new Point(9, 9); + + using var mat = new Mat(10, 10, MatType.CV_8UC3, new Scalar(1, 2, 3)); + using var lineIterator = new LineIterator(mat, p1, p2); + int b = 0, g = 0, r = 0; + foreach (var pixel in lineIterator) + { + var value = pixel.GetValue(); + (b, g, r) = (b + value.Item0, g + value.Item1, r + value.Item2); + } + Assert.Equal(10, b); + Assert.Equal(20, g); + Assert.Equal(30, r); + } +} diff --git a/test/OpenCvSharp.Tests/imgproc/Subdiv2DTest.cs b/test/OpenCvSharp.Tests/imgproc/Subdiv2DTest.cs new file mode 100644 index 000000000..a66a5273f --- /dev/null +++ b/test/OpenCvSharp.Tests/imgproc/Subdiv2DTest.cs @@ -0,0 +1,63 @@ +using Xunit; + +namespace OpenCvSharp.Tests.ImgProc; + +public class Subdiv2DTest +{ + [Fact] + public void Create() + { + using var subdiv = new Subdiv2D(); + } + + [Fact] + public void CreateWithRect() + { + using var subdiv = new Subdiv2D(new Rect(0, 0, 500, 500)); + } + + [Fact] + public void InitDelaunay() + { + using var subdiv = new Subdiv2D(); + subdiv.InitDelaunay(new Rect(0, 0, 800, 600)); + } + + [Fact] + public void GetTriangleList() + { + using var subdiv = new Subdiv2D(new Rect(0, 0, 500, 500)); + + var points = new[] {new Point2f(300, 100), new Point2f(200, 300), new Point2f(400, 300)}; + subdiv.Insert(points[0]); + subdiv.Insert(points[1]); + subdiv.Insert(points[2]); + + var triangles = subdiv.GetTriangleList(); + Assert.Single(triangles); + + var triangleVertices = new[] + { + triangles[0].Item0, triangles[0].Item1, triangles[0].Item2, triangles[0].Item3, triangles[0].Item4, triangles[0].Item5, + }; + foreach (var point in points) + { + Assert.Contains(point.X, triangleVertices); + Assert.Contains(point.Y, triangleVertices); + } + } + + [Fact] + public void GetVoronoiFacetList() + { + using var subdiv = new Subdiv2D(new Rect(0, 0, 500, 500)); + + var points = new[] {new Point2f(300, 100), new Point2f(200, 300), new Point2f(400, 300)}; + subdiv.Insert(points); + + subdiv.GetVoronoiFacetList(null, out var facetList, out var facetCenters); + Assert.Equal(3, facetList.Length); + Assert.Equal(3, facetCenters.Length); + Assert.Equal(4, facetList[0].Length); + } +} diff --git a/test/OpenCvSharp.Tests/line_descriptor/LSDDetectorTest.cs b/test/OpenCvSharp.Tests/line_descriptor/LSDDetectorTest.cs new file mode 100644 index 000000000..83eae30ea --- /dev/null +++ b/test/OpenCvSharp.Tests/line_descriptor/LSDDetectorTest.cs @@ -0,0 +1,50 @@ +#if false + +namespace OpenCvSharp.Tests.LineDescriptor +{ + // ReSharper disable once InconsistentNaming + public class LSDDetectorTest + { + [Fact] + public void New() + { + using var lsd = new LSDDetector(); + GC.KeepAlive(lsd); + } + + [Fact] + public void NewWithParam() + { + var lsdParam = new LSDParam(); + using var lsd = new LSDDetector(lsdParam); + GC.KeepAlive(lsd); + } + + [Fact] + public void Detect() + { + using var src = new Mat("_data/image/building.jpg", ImreadModes.Color); + using var gray = new Mat(); + Cv2.CvtColor(src, gray, ColorConversionCodes.BGR2GRAY); + + using var lsd = new LSDDetector(); + var keyLines = lsd.Detect(gray, 2, 1); + Assert.NotEmpty(keyLines); + + if (Debugger.IsAttached) + { + var random = new Random(); + + foreach (var kl in keyLines) + { + var color = new Scalar(random.Next(256), random.Next(256), random.Next(256)); + + Cv2.Line(src, (Point)kl.GetStartPoint(), (Point)kl.GetEndPoint(), color, 3); + } + + Window.ShowImages(src); + } + } + } +} +#endif diff --git a/test/OpenCvSharp.Tests/ml/ANN_MLPTest.cs b/test/OpenCvSharp.Tests/ml/ANN_MLPTest.cs new file mode 100644 index 000000000..7ef5eb492 --- /dev/null +++ b/test/OpenCvSharp.Tests/ml/ANN_MLPTest.cs @@ -0,0 +1,57 @@ +using OpenCvSharp.ML; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.ML; +// ReSharper disable once InconsistentNaming +#pragma warning disable CA1707 +public class ANN_MLPTest : TestBase +#pragma warning restore CA1707 +{ + private readonly ITestOutputHelper testOutputHelper; + + public ANN_MLPTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void RunTest() + { + float[,] trainFeaturesData = + { + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + using var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); + + float[] trainLabelsData = [1, 0, 1, 0]; + using var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32F, trainLabelsData); + + using var model = ANN_MLP.Create(); + model.SetActivationFunction(ANN_MLP.ActivationFunctions.SigmoidSym, 0.1, 0.1); + model.SetTrainMethod(ANN_MLP.TrainingMethods.BackProp, 0.1, 0.1); + //model.TermCriteria = new TermCriteria(CriteriaType.MaxIter | CriteriaType.Eps, 10000, 0.0001); + + using var layerSize = new Mat(3, 1, MatType.CV_32SC1); + layerSize.Set(0, 2); + layerSize.Set(1, 10); + layerSize.Set(2, 1); + model.SetLayerSizes(layerSize); + + bool trainSuccess = model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + Assert.True(trainSuccess); + Assert.True(model.IsTrained()); + + float[] testFeatureData = [0, 0]; + using var testFeature = Mat.FromPixelData(1, 2, MatType.CV_32F, testFeatureData); + + using var result = new Mat(); + var detectedClass = model.Predict(testFeature, result); + + // TODO + //Assert.Equal(-1, detectedClass); + } +} diff --git a/test/OpenCvSharp.Tests/ml/BoostTest.cs b/test/OpenCvSharp.Tests/ml/BoostTest.cs index 65a9fe86d..ba10366f4 100644 --- a/test/OpenCvSharp.Tests/ml/BoostTest.cs +++ b/test/OpenCvSharp.Tests/ml/BoostTest.cs @@ -1,85 +1,78 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NUnit.Framework; -using OpenCvSharp; -using OpenCvSharp.ML; +using OpenCvSharp.ML; +using Xunit; -namespace OpenCvSharp.Tests.ML +namespace OpenCvSharp.Tests.ML; + +public class BoostTest : TestBase { - [TestFixture] - public class BoostTest : TestBase + [Fact] + public void RunTest() { - [Test] - public void RunTest() + float[,] trainFeaturesData = { - float[,] trainFeaturesData = - { - {0, 0}, - {0, 100}, - {100, 0}, - {100, 100}, - }; - var trainFeatures = new Mat(4, 2, MatType.CV_32F, trainFeaturesData); + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); - int[] trainLabelsData = { +1, -1, +1, -1 }; - var trainLabels = new Mat(4, 1, MatType.CV_32S, trainLabelsData); + int[] trainLabelsData = [+1, -1, +1, -1]; + var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32S, trainLabelsData); - var model = Boost.Create(); - model.MaxDepth = 1; - model.UseSurrogates = false; - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + using var model = Boost.Create(); + model.MaxDepth = 1; + model.UseSurrogates = false; + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - float[] testFeatureData = { 90, 90 }; - var testFeature = new Mat(1, 2, MatType.CV_32F, testFeatureData); + float[] testFeatureData = [90, 90]; + var testFeature = Mat.FromPixelData(1, 2, MatType.CV_32F, testFeatureData); - var detectedClass = (int)model.Predict(testFeature); + var detectedClass = (int)model.Predict(testFeature); - Assert.AreEqual(-1, detectedClass); - } + Assert.Equal(-1, detectedClass); + } - [Test] - public void SaveLoadTest() + [Fact] + public void SaveLoadTest() + { + float[,] trainFeaturesData = { - float[,] trainFeaturesData = - { - {0, 0}, - {0, 100}, - {100, 0}, - {100, 100}, - }; - var trainFeatures = new Mat(4, 2, MatType.CV_32F, trainFeaturesData); + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); - int[] trainLabelsData = { +1, -1, +1, -1 }; - var trainLabels = new Mat(4, 1, MatType.CV_32S, trainLabelsData); + int[] trainLabelsData = [+1, -1, +1, -1]; + var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32S, trainLabelsData); - const string fileName = "boost.yml"; - if (File.Exists(fileName)) - File.Delete(fileName); + const string fileName = "boost.yml"; + if (File.Exists(fileName)) + File.Delete(fileName); - using (var model = Boost.Create()) - { - model.MaxDepth = 1; - model.UseSurrogates = false; - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + using (var model = Boost.Create()) + { + model.MaxDepth = 1; + model.UseSurrogates = false; + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - model.Save(fileName); - } + model.Save(fileName); + } - FileAssert.Exists(fileName); + Assert.True(File.Exists(fileName)); - string content = File.ReadAllText(fileName); - //Console.WriteLine(content); + string content = File.ReadAllText(fileName); - Assert.DoesNotThrow(() => - { - using (var model2 = Boost.Load(fileName)) { } - }); - Assert.DoesNotThrow(() => - { - using (var model2 = Boost.LoadFromString(content)) { } - }); + // does not throw + using (var model2 = Boost.Load(fileName)) + { + GC.KeepAlive(model2); + } + using (var model2 = Boost.LoadFromString(content)) + { + GC.KeepAlive(model2); } } } - diff --git a/test/OpenCvSharp.Tests/ml/EMTest.cs b/test/OpenCvSharp.Tests/ml/EMTest.cs new file mode 100644 index 000000000..86a3d2fed --- /dev/null +++ b/test/OpenCvSharp.Tests/ml/EMTest.cs @@ -0,0 +1,14 @@ +using Xunit; + +namespace OpenCvSharp.Tests.ML; + +public class EMTest : TestBase +{ + [Fact] + public void TestEMCreate() + { + using var em = EM.Create(); + var name = em.GetDefaultName(); + Assert.Equal("opencv_ml_em", name); + } +} diff --git a/test/OpenCvSharp.Tests/ml/KNearestTest.cs b/test/OpenCvSharp.Tests/ml/KNearestTest.cs index 407b81c49..959a9393f 100644 --- a/test/OpenCvSharp.Tests/ml/KNearestTest.cs +++ b/test/OpenCvSharp.Tests/ml/KNearestTest.cs @@ -1,89 +1,82 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NUnit.Framework; -using OpenCvSharp; -using OpenCvSharp.ML; +using OpenCvSharp.ML; +using Xunit; -namespace OpenCvSharp.Tests.ML +namespace OpenCvSharp.Tests.ML; + +public class KNearestTest : TestBase { - [TestFixture] - public class KNearestTest : TestBase + [Fact] + public void RunTest() { - [Test] - public void RunTest() - { - float[] trainFeaturesData = - { - 2,2,2,2, - 3,3,3,3, - 4,4,4,4, - 5,5,5,5, - 6,6,6,6, - 7,7,7,7 - }; - var trainFeatures = new Mat(6, 4, MatType.CV_32F, trainFeaturesData); + float[] trainFeaturesData = + [ + 2,2,2,2, + 3,3,3,3, + 4,4,4,4, + 5,5,5,5, + 6,6,6,6, + 7,7,7,7 + ]; + var trainFeatures = Mat.FromPixelData(6, 4, MatType.CV_32F, trainFeaturesData); - int[] trainLabelsData = { 2, 3, 4, 5, 6, 7 }; - var trainLabels = new Mat(1, 6, MatType.CV_32S, trainLabelsData); + int[] trainLabelsData = [2, 3, 4, 5, 6, 7]; + var trainLabels = Mat.FromPixelData(1, 6, MatType.CV_32S, trainLabelsData); - var kNearest = KNearest.Create(); - kNearest.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + using var kNearest = KNearest.Create(); + kNearest.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - float[] testFeatureData = { 3, 3, 3, 3 }; - var testFeature = new Mat(1, 4, MatType.CV_32F, testFeatureData); + float[] testFeatureData = [3, 3, 3, 3]; + var testFeature = Mat.FromPixelData(1, 4, MatType.CV_32F, testFeatureData); - const int k = 1; - var results = new Mat(); - var neighborResponses = new Mat(); - var dists = new Mat(); - var detectedClass = (int)kNearest.FindNearest(testFeature, k, results, neighborResponses, dists); + const int k = 1; + var results = new Mat(); + var neighborResponses = new Mat(); + var dists = new Mat(); + var detectedClass = (int)kNearest.FindNearest(testFeature, k, results, neighborResponses, dists); - Assert.AreEqual(3, detectedClass); - } + Assert.Equal(3, detectedClass); + } - [Test] - public void SaveLoadTest() - { - float[] trainFeaturesData = - { - 2,2,2,2, - 3,3,3,3, - 4,4,4,4, - 5,5,5,5, - 6,6,6,6, - 7,7,7,7 - }; - var trainFeatures = new Mat(6, 4, MatType.CV_32F, trainFeaturesData); + [Fact] + public void SaveLoadTest() + { + float[] trainFeaturesData = + [ + 2,2,2,2, + 3,3,3,3, + 4,4,4,4, + 5,5,5,5, + 6,6,6,6, + 7,7,7,7 + ]; + var trainFeatures = Mat.FromPixelData(6, 4, MatType.CV_32F, trainFeaturesData); - int[] trainLabelsData = { 2, 3, 4, 5, 6, 7 }; - var trainLabels = new Mat(1, 6, MatType.CV_32S, trainLabelsData); + int[] trainLabelsData = [2, 3, 4, 5, 6, 7]; + var trainLabels = Mat.FromPixelData(1, 6, MatType.CV_32S, trainLabelsData); - const string fileName = "knearest.yml"; - if (File.Exists(fileName)) - File.Delete(fileName); + const string fileName = "knearest.yml"; + if (File.Exists(fileName)) + File.Delete(fileName); - using (var model = KNearest.Create()) - { - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + using (var model = KNearest.Create()) + { + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - model.Save(fileName); - } + model.Save(fileName); + } - FileAssert.Exists(fileName); + Assert.True(File.Exists(fileName)); - string content = File.ReadAllText(fileName); - //Console.WriteLine(content); + string content = File.ReadAllText(fileName); - Assert.DoesNotThrow(() => - { - using (var model2 = KNearest.Load(fileName)) { } - }); - Assert.DoesNotThrow(() => - { - using (var model2 = KNearest.LoadFromString(content)) { } - }); + // Assert.DoesNotThrow + using (var model2 = KNearest.Load(fileName)) + { + GC.KeepAlive(model2); + } + using (var model2 = KNearest.LoadFromString(content)) + { + GC.KeepAlive(model2); } } } - diff --git a/test/OpenCvSharp.Tests/ml/RTreesTest.cs b/test/OpenCvSharp.Tests/ml/RTreesTest.cs index c60ef9ed1..b2235185f 100644 --- a/test/OpenCvSharp.Tests/ml/RTreesTest.cs +++ b/test/OpenCvSharp.Tests/ml/RTreesTest.cs @@ -1,81 +1,74 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NUnit.Framework; -using OpenCvSharp; -using OpenCvSharp.ML; +using OpenCvSharp.ML; +using Xunit; -namespace OpenCvSharp.Tests.ML +namespace OpenCvSharp.Tests.ML; + +public class RTreesTest : TestBase { - [TestFixture] - public class RTreesTest : TestBase + [Fact] + public void RunTest() { - [Test] - public void RunTest() + float[,] trainFeaturesData = { - float[,] trainFeaturesData = - { - {0, 0}, - {0, 100}, - {100, 0}, - {100, 100}, - }; - var trainFeatures = new Mat(4, 2, MatType.CV_32F, trainFeaturesData); + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); - int[] trainLabelsData = { 1, -1, 1, -1 }; - var trainLabels = new Mat(4, 1, MatType.CV_32S, trainLabelsData); + int[] trainLabelsData = [1, -1, 1, -1]; + var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32S, trainLabelsData); - var model = RTrees.Create(); - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + using var model = RTrees.Create(); + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - float[] testFeatureData = { 90, 90 }; - var testFeature = new Mat(1, 2, MatType.CV_32F, testFeatureData); + float[] testFeatureData = [99, 99]; + var testFeature = Mat.FromPixelData(1, 2, MatType.CV_32F, testFeatureData); - var detectedClass = (int)model.Predict(testFeature); + var detectedClass = (int)model.Predict(testFeature); - Assert.AreEqual(-1, detectedClass); - } + Assert.Equal(1, Math.Abs(detectedClass)); // result rarely becomes +1 + } - [Test] - public void SaveLoadTest() + [Fact] + public void SaveLoadTest() + { + float[,] trainFeaturesData = { - float[,] trainFeaturesData = - { - {0, 0}, - {0, 100}, - {100, 0}, - {100, 100}, - }; - var trainFeatures = new Mat(4, 2, MatType.CV_32F, trainFeaturesData); + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); - int[] trainLabelsData = { 1, -1, 1, -1 }; - var trainLabels = new Mat(4, 1, MatType.CV_32S, trainLabelsData); + int[] trainLabelsData = [1, -1, 1, -1]; + var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32S, trainLabelsData); - const string fileName = "rtrees.yml"; - if (File.Exists(fileName)) - File.Delete(fileName); + const string fileName = "rtrees.yml"; + if (File.Exists(fileName)) + File.Delete(fileName); - using (var model = RTrees.Create()) - { - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + using (var model = RTrees.Create()) + { + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - model.Save(fileName); - } + model.Save(fileName); + } - FileAssert.Exists(fileName); + Assert.True(File.Exists(fileName)); - string content = File.ReadAllText(fileName); - //Console.WriteLine(content); + string content = File.ReadAllText(fileName); - Assert.DoesNotThrow(() => - { - using (var model2 = RTrees.Load(fileName)) { } - }); - Assert.DoesNotThrow(() => - { - using (var model2 = RTrees.LoadFromString(content)) { } - }); + // Assert.DoesNotThrow + using (var model2 = RTrees.Load(fileName)) + { + GC.KeepAlive(model2); + } + using (var model2 = RTrees.LoadFromString(content)) + { + GC.KeepAlive(model2); } } } - diff --git a/test/OpenCvSharp.Tests/ml/SVMTest.cs b/test/OpenCvSharp.Tests/ml/SVMTest.cs index 3582db155..443299673 100644 --- a/test/OpenCvSharp.Tests/ml/SVMTest.cs +++ b/test/OpenCvSharp.Tests/ml/SVMTest.cs @@ -1,99 +1,93 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NUnit.Framework; -using OpenCvSharp; -using OpenCvSharp.ML; - -namespace OpenCvSharp.Tests.ML +using OpenCvSharp.ML; +using Xunit; + +namespace OpenCvSharp.Tests.ML; + +// ReSharper disable once InconsistentNaming +public class SVMTest : TestBase { - [TestFixture] - // ReSharper disable once InconsistentNaming - public class SVMTest : TestBase + [Fact] + public void RunTest() + { + float[,] trainFeaturesData = + { + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); + + int[] trainLabelsData = [+1, -1, +1, -1]; + var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32S, trainLabelsData); + + using (var model = SVM.Create()) + { + model.Type = SVM.Types.CSvc; + model.KernelType = SVM.KernelTypes.Linear; + model.TermCriteria = new TermCriteria(CriteriaTypes.MaxIter, 100, 1e-6); + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + + float[] testFeatureData = [90, 90]; + var testFeature = Mat.FromPixelData(1, 2, MatType.CV_32F, testFeatureData); + + var detectedClass = (int) model.Predict(testFeature); + + Assert.Equal(-1, detectedClass); + } + } + + [Fact] + public void SaveLoadTest() { - [Test] - public void RunTest() + float[,] trainFeaturesData = + { + {0, 0}, + {0, 100}, + {100, 0}, + {100, 100}, + }; + var trainFeatures = Mat.FromPixelData(4, 2, MatType.CV_32F, trainFeaturesData); + + int[] trainLabelsData = [+1, -1, +1, -1]; + var trainLabels = Mat.FromPixelData(4, 1, MatType.CV_32S, trainLabelsData); + + const string fileName = "svm.yml"; + if (File.Exists(fileName)) + File.Delete(fileName); + + using (var model = SVM.Create()) + { + model.Type = SVM.Types.CSvc; + model.KernelType = SVM.KernelTypes.Linear; + model.TermCriteria = new TermCriteria(CriteriaTypes.MaxIter, 100, 1e-6); + model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); + + model.Save(fileName); + } + + Assert.True(File.Exists(fileName)); + + string content = File.ReadAllText(fileName); + + //Assert.DoesNotThrow + using (var model2 = SVM.Load(fileName)) + { + GC.KeepAlive(model2); + } + using (var model2 = SVM.LoadFromString(content)) { - float[,] trainFeaturesData = - { - {0, 0}, - {0, 100}, - {100, 0}, - {100, 100}, - }; - var trainFeatures = new Mat(4, 2, MatType.CV_32F, trainFeaturesData); - - int[] trainLabelsData = { +1, -1, +1, -1 }; - var trainLabels = new Mat(4, 1, MatType.CV_32S, trainLabelsData); - - using (var model = SVM.Create()) - { - model.Type = SVM.Types.CSvc; - model.KernelType = SVM.KernelTypes.Linear; - model.TermCriteria = new TermCriteria(CriteriaType.MaxIter, 100, 1e-6); - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - - float[] testFeatureData = {90, 90}; - var testFeature = new Mat(1, 2, MatType.CV_32F, testFeatureData); - - var detectedClass = (int) model.Predict(testFeature); - - Assert.AreEqual(-1, detectedClass); - } + GC.KeepAlive(model2); } - [Test] - public void SaveLoadTest() + using (var fs = new FileStorage(fileName, FileStorage.Modes.Read)) + using (var model2 = SVM.Create()) { - float[,] trainFeaturesData = - { - {0, 0}, - {0, 100}, - {100, 0}, - {100, 100}, - }; - var trainFeatures = new Mat(4, 2, MatType.CV_32F, trainFeaturesData); - - int[] trainLabelsData = { +1, -1, +1, -1 }; - var trainLabels = new Mat(4, 1, MatType.CV_32S, trainLabelsData); - - const string fileName = "svm.yml"; - if (File.Exists(fileName)) - File.Delete(fileName); - - using (var model = SVM.Create()) - { - model.Type = SVM.Types.CSvc; - model.KernelType = SVM.KernelTypes.Linear; - model.TermCriteria = new TermCriteria(CriteriaType.MaxIter, 100, 1e-6); - model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); - - model.Save(fileName); - } - - FileAssert.Exists(fileName); - - string content = File.ReadAllText(fileName); - //Console.WriteLine(content); - - Assert.DoesNotThrow(() => - { - using (var model2 = SVM.Load(fileName)) { } - }); - Assert.DoesNotThrow(() => - { - using (var model2 = SVM.LoadFromString(content)) { } - }); - - Assert.DoesNotThrow(() => - { - using (var fs = new FileStorage(fileName, FileStorage.Mode.Read)) - using (var model2 = SVM.Create()) - { - var node = fs["opencv_ml_svm"]; - model2.Read(node); - } - }); + var node = fs["opencv_ml_svm"]; + Assert.NotNull(node); +#pragma warning disable CS8604 + model2.Read(node); +#pragma warning restore CS8604 } } } diff --git a/test/OpenCvSharp.Tests/objdetect/HOGDescriptorTest.cs b/test/OpenCvSharp.Tests/objdetect/HOGDescriptorTest.cs new file mode 100644 index 000000000..c29e71e83 --- /dev/null +++ b/test/OpenCvSharp.Tests/objdetect/HOGDescriptorTest.cs @@ -0,0 +1,26 @@ +using Xunit; + +#pragma warning disable 162 + +namespace OpenCvSharp.Tests.ObjDetect; + +public class HOGDescriptorTest : TestBase +{ + [Fact] + public void PropertyCellSize() + { + using var obj = new HOGDescriptor(); + Size value = new Size(123, 789); + obj.CellSize = value; + Assert.Equal(value, obj.CellSize); + } + + [Fact] + public void PropertyWinSize() + { + using var obj = new HOGDescriptor(); + Size value = new Size(123, 789); + obj.WinSize = value; + Assert.Equal(value, obj.WinSize); + } +} diff --git a/test/OpenCvSharp.Tests/objdetect/QRCodeDetectorTest.cs b/test/OpenCvSharp.Tests/objdetect/QRCodeDetectorTest.cs new file mode 100644 index 000000000..cd54255b0 --- /dev/null +++ b/test/OpenCvSharp.Tests/objdetect/QRCodeDetectorTest.cs @@ -0,0 +1,202 @@ +using Xunit; + +#pragma warning disable 162 + +// ReSharper disable UnusedVariable +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Tests.ObjDetect; + +public class QRCodeDetectorTest : TestBase +{ + [Fact] + public void ExplicitlyDetectAndDecode() + { + using var obj = new QRCodeDetector(); + const int x = 100; + const int y = 200; + + using var withQr = ImageWithQrCode(x, y, out var w, out var h); + using var pointsMat = new Mat(); + ShowImagesWhenDebugMode(withQr); + + bool detected = obj.Detect(withQr, out var points); + Assert.True(detected); + Assert.Equal(4, points.Length); + Assert.Equal(102, points[0].X, 1e-6); + Assert.Equal(201, points[0].Y, 1e-6); + Assert.Equal(199, points[1].X, 1e-6); + Assert.Equal(201, points[1].Y, 1e-6); + Assert.Equal(199, points[2].X, 1e-6); + Assert.Equal(299, points[2].Y, 1e-6); + Assert.Equal(102, points[3].X, 1e-6); + Assert.Equal(299, points[3].Y, 1e-6); + + using var straightQrCode = new Mat(); + obj.Decode(withQr, points); + var decodedString = obj.Decode(withQr, points, straightQrCode); + Assert.False(straightQrCode.Empty()); + Assert.Equal("https://github.com/opencv/opencv", decodedString); + } + + [Fact] + public void DetectAndDecode() + { + using var obj = new QRCodeDetector(); + const int x = 100; + const int y = 200; + + using var withQr = ImageWithQrCode(x, y, out var w, out var h); + ShowImagesWhenDebugMode(withQr); + + using var straightQrCode = new Mat(); + var decodedString = obj.DetectAndDecode(withQr, out var points, straightQrCode); + Assert.Equal(4, points.Length); + Assert.Equal(102, points[0].X, 1e-6); + Assert.Equal(201, points[0].Y, 1e-6); + Assert.Equal(199, points[1].X, 1e-6); + Assert.Equal(201, points[1].Y, 1e-6); + Assert.Equal(199, points[2].X, 1e-6); + Assert.Equal(299, points[2].Y, 1e-6); + Assert.Equal(102, points[3].X, 1e-6); + Assert.Equal(299, points[3].Y, 1e-6); + + Assert.False(straightQrCode.Empty()); + Assert.Equal("https://github.com/opencv/opencv", decodedString); + } + + [Fact] + public void DecodeSinglebyteString() + { + using var obj = new QRCodeDetector(); + using var withQr = LoadImage("qr_singlebyte_letters.png"); + + var decodedString = obj.DetectAndDecode(withQr, out var points); + + Assert.Equal(4, points.Length); + Assert.Equal("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[]^_`{|}", decodedString); + } + + [Fact] + public void DecodeMultibyteString() + { + using var obj = new QRCodeDetector(); + using var withQr = LoadImage("qr_multibyte_letters.png"); + + var decodedString = obj.DetectAndDecode(withQr, out var points); + + Assert.Equal(4, points.Length); + Assert.Equal("Helloこんにちは你好안녕하세요", decodedString); + } + + [Fact] + public void ExplicitlyDetectMulti() + { + using var obj = new QRCodeDetector(); + + using var withQr = LoadImage("qr_multi.png"); + using var pointsMat = new Mat(); + ShowImagesWhenDebugMode(withQr); + + bool detected = obj.DetectMulti(withQr, out var points); + Assert.True(detected); + Assert.Equal(8, points.Length); + + var expectedPoints = new[] + { + new Point2f(39, 39), + new Point2f(260, 39), + new Point2f(260, 260), + new Point2f(39, 260), + + new Point2f(334, 334), + new Point2f(565, 334), + new Point2f(565, 565), + new Point2f(334, 565), + }; + AreEquivalent(expectedPoints, points); + } + + [Fact] + public void ExplicitlyDecodeMulti() + { + var expectedDecodedStrings = new[] + { + "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[]^_`{|}", + "Helloこんにちは你好안녕하세요" + }; + + using var obj = new QRCodeDetector(); + + using var withQr = LoadImage("qr_multi.png"); + using var pointsMat = new Mat(); + ShowImagesWhenDebugMode(withQr); + + bool detected = obj.DetectMulti(withQr, out var points); + Assert.True(detected); + Assert.Equal(8, points.Length); + + bool decoded = obj.DecodeMulti(withQr, points, out var decodedStrings, out var straightQrCode); + Assert.True(decoded); + Assert.Equal(2, decodedStrings.Length); + AreEquivalent(expectedDecodedStrings, decodedStrings); + + foreach (var mat in straightQrCode) + { + ShowImagesWhenDebugMode(mat); + } + + bool decodedWithoutStraightQrCode = obj.DecodeMulti(withQr, points, out decodedStrings); + Assert.True(decodedWithoutStraightQrCode); + Assert.Equal(2, decodedStrings.Length); + AreEquivalent(expectedDecodedStrings, decodedStrings); + } + + [Fact] + public void EmptyDetectMulti() + { + var lenna = LoadImage("lenna.png"); + + using var obj = new QRCodeDetector(); + + bool detected = obj.DetectMulti(lenna, out var points); + Assert.False(detected); + Assert.Empty(points); + } + + private static Mat ImageWithQrCode(int x, int y, out int qrWidth, out int qrHeight) + { + var lenna = LoadImage("lenna.png"); + using var qr = LoadImage("qr.png"); + Assert.False(qr.Empty(), "Mat qr is empty."); + qrWidth = qr.Width; + qrHeight = qr.Height; + + var roi = new Rect(x, y, qr.Width, qr.Height); + using var part = lenna[roi]; + qr.CopyTo(part); + + return lenna; + } + + // ReSharper disable ParameterOnlyUsedForPreconditionCheck.Local + + private static void AreEquivalent(IEnumerable expectedPoints, IEnumerable actualPoints) + { + var orderedExpectedPoints = expectedPoints.OrderBy(p => p.X * 1000 + p.Y).ToArray(); + var orderedActualPoints = actualPoints.OrderBy(p => p.X * 1000 + p.Y).ToArray(); + + Assert.Equal(orderedExpectedPoints.Length, orderedActualPoints.Length); + + foreach (var (p1, p2) in orderedExpectedPoints.Zip(orderedActualPoints, Tuple.Create)) + { + Assert.Equal(p1.X, p2.X, 1e-6); + Assert.Equal(p1.Y, p2.Y, 1e-6); + } + } + + private static void AreEquivalent(IEnumerable expected, IEnumerable actual) + { + Assert.Equal(expected.OrderBy(_ => _), actual.OrderBy(_ => _)); + } +} diff --git a/test/OpenCvSharp.Tests/photo/PhotoTest.cs b/test/OpenCvSharp.Tests/photo/PhotoTest.cs new file mode 100644 index 000000000..d91bb5729 --- /dev/null +++ b/test/OpenCvSharp.Tests/photo/PhotoTest.cs @@ -0,0 +1,48 @@ +using System.Diagnostics; +using Xunit; + +namespace OpenCvSharp.Tests.Photo; + +public class PhotoTest +{ + [Fact] + public void Inpaint() + { + using var src = new Mat("_data/image/mandrill.png", ImreadModes.Color); + using var dst = new Mat(); + using var mask = new Mat(src.Size(), MatType.CV_8UC1, Scalar.All(0)); + + mask.Rectangle(new Rect(65, 15, 130, 30), Scalar.All(255), -1); + + Cv2.Inpaint(src, mask, dst, 2, InpaintMethod.Telea); + + if (Debugger.IsAttached) + Window.ShowImages(src, mask, dst); + } + + [Fact] + public void FastNlMeansDenoising() + { + using var src = new Mat("_data/image/multipage_p1.tif", ImreadModes.Grayscale); + using var dst = new Mat(); + + Cv2.FastNlMeansDenoising(src, dst, 3, 3, 7); + + if (Debugger.IsAttached) + Window.ShowImages(src, dst); + } + + [Fact] + public void FastNlMeansDenoisingMulti() + { + using var src1 = new Mat("_data/image/tsukuba_left.png", ImreadModes.Grayscale); + using var src2 = new Mat("_data/image/tsukuba_right.png", ImreadModes.Grayscale); + using var src3 = new Mat("_data/image/tsukuba_right.png", ImreadModes.Grayscale); + using var dst = new Mat(); + + Cv2.FastNlMeansDenoisingMulti(new[] { src1, src2, src3 }, dst, 1, 3, 3, 3, 7); + + if (Debugger.IsAttached) + Window.ShowImages(src1, src2, dst); + } +} diff --git a/test/OpenCvSharp.Tests/photo/TonemapDragoTest.cs b/test/OpenCvSharp.Tests/photo/TonemapDragoTest.cs new file mode 100644 index 000000000..597a5585e --- /dev/null +++ b/test/OpenCvSharp.Tests/photo/TonemapDragoTest.cs @@ -0,0 +1,35 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Photo; + +public class TonemapDragoTest : TestBase +{ + [Fact] + public void Process() + { + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + using var tonemap = TonemapDrago.Create(); + + // 8UC3 -> 32FC3 + using var src32f = new Mat(); + src.ConvertTo(src32f, MatType.CV_32FC3); + + tonemap.Process(src32f, dst); + + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void Properties() + { + using var tonemap = TonemapDrago.Create(2.2f, 1.5f, 0.95f); + Assert.Equal(1.5f, tonemap.Saturation, 1e-3); + Assert.Equal(0.95f, tonemap.Bias, 1e-3); + + tonemap.Saturation = 5.8f; + tonemap.Bias = 0.5f; + Assert.Equal(5.8f, tonemap.Saturation, 1e-3); + Assert.Equal(0.5f, tonemap.Bias, 1e-3); + } +} diff --git a/test/OpenCvSharp.Tests/photo/TonemapMantiukTest.cs b/test/OpenCvSharp.Tests/photo/TonemapMantiukTest.cs new file mode 100644 index 000000000..fa5f63984 --- /dev/null +++ b/test/OpenCvSharp.Tests/photo/TonemapMantiukTest.cs @@ -0,0 +1,35 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Photo; + +public class TonemapMantiukTest : TestBase +{ + [Fact] + public void Process() + { + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + using var tonemap = TonemapMantiuk.Create(); + + // 8UC3 -> 32FC3 + using var src32f = new Mat(); + src.ConvertTo(src32f, MatType.CV_32FC3); + + tonemap.Process(src32f, dst); + + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void Properties() + { + using var tonemap = TonemapMantiuk.Create(2.2f, 1.5f, 1.8f); + Assert.Equal(1.5f, tonemap.Scale, 1e-3); + Assert.Equal(1.8f, tonemap.Saturation, 1e-3); + + tonemap.Scale = 0.5f; + tonemap.Saturation = 0.8f; + Assert.Equal(0.5f, tonemap.Scale, 1e-3); + Assert.Equal(0.8f, tonemap.Saturation, 1e-3); + } +} diff --git a/test/OpenCvSharp.Tests/photo/TonemapReinhardTest.cs b/test/OpenCvSharp.Tests/photo/TonemapReinhardTest.cs new file mode 100644 index 000000000..ac1599f11 --- /dev/null +++ b/test/OpenCvSharp.Tests/photo/TonemapReinhardTest.cs @@ -0,0 +1,38 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Photo; + +public class TonemapReinhardTest : TestBase +{ + [Fact] + public void Process() + { + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + using var tonemap = TonemapReinhard.Create(); + + // 8UC3 -> 32FC3 + using var src32f = new Mat(); + src.ConvertTo(src32f, MatType.CV_32FC3); + + tonemap.Process(src32f, dst); + + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void Properties() + { + using var tonemap = TonemapReinhard.Create(2.2f, 1.1f, 0.8f, 0.7f); + Assert.Equal(1.1f, tonemap.Intensity, 1e-3); + Assert.Equal(0.8f, tonemap.LightAdaptation, 1e-3); + Assert.Equal(0.7f, tonemap.ColorAdaptation, 1e-3); + + tonemap.Intensity = 1.8f; + tonemap.LightAdaptation = 0.5f; + tonemap.ColorAdaptation = 0.4f; + Assert.Equal(1.8f, tonemap.Intensity, 1e-3); + Assert.Equal(0.5f, tonemap.LightAdaptation, 1e-3); + Assert.Equal(0.4f, tonemap.ColorAdaptation, 1e-3); + } +} diff --git a/test/OpenCvSharp.Tests/photo/TonemapTest.cs b/test/OpenCvSharp.Tests/photo/TonemapTest.cs new file mode 100644 index 000000000..34b7b23f9 --- /dev/null +++ b/test/OpenCvSharp.Tests/photo/TonemapTest.cs @@ -0,0 +1,32 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Photo; + +public class TonemapTest : TestBase +{ + [Fact] + public void Process() + { + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + using var tonemap = Tonemap.Create(2.2f); + + // 8UC3 -> 32FC3 + using var src32f = new Mat(); + src.ConvertTo(src32f, MatType.CV_32FC3); + + tonemap.Process(src32f, dst); + + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void Properties() + { + using var tonemap = Tonemap.Create(2.2f); + Assert.Equal(2.2f, tonemap.Gamma, 1e-3); + + tonemap.Gamma = 0.5f; + Assert.Equal(0.5f, tonemap.Gamma, 1e-3); + } +} diff --git a/test/OpenCvSharp.Tests/project.json b/test/OpenCvSharp.Tests/project.json deleted file mode 100644 index 8e90c1ded..000000000 --- a/test/OpenCvSharp.Tests/project.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "OpenCvSharp": "1.0.0-*", - "OpenCvSharp.Blob": "1.0.0-*", - "dotnet-test-nunit": "3.4.0-beta-3", - "NUnit": "3.6.0" - }, - - "testRunner": "nunit", - - "runtimes": { - "win10-x64": {}, - "win7-x64": {} - }, - - "frameworks": { - "netcoreapp1.0": { - "imports": "dnxcore50", - "dependencies": { - "NETStandard.Library": "1.6.1", - "Microsoft.NETCore.App": "1.1.0" - } - }, - "net461": { - "dependencies": { - "OpenCvSharp.Extensions": "1.0.0-*" - }, - "frameworkAssemblies": { - }, - "buildOptions": { - "define": [ "DOTNET_FRAMEWORK", "net46" ] - } - } - }, - - "buildOptions": { - "optimize": false, - "allowUnsafe": true, - "emitEntryPoint": false, - "copyToOutput": { - "include": [ "dll/**/*.dll", "_data" ] - } - }, - - "publishOptions": { - "include": [ "dll/**/*.dll", "_data" ] - } -} diff --git a/test/OpenCvSharp.Tests/project.lock.json b/test/OpenCvSharp.Tests/project.lock.json deleted file mode 100644 index 48687463e..000000000 --- a/test/OpenCvSharp.Tests/project.lock.json +++ /dev/null @@ -1,15555 +0,0 @@ -{ - "locked": false, - "version": 2, - "targets": { - ".NETCoreApp,Version=v1.0": { - "dotnet-test-nunit/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121", - "Microsoft.NETCore.App": "1.0.0", - "NUnit.Portable.Agent": "3.4.0-beta-3" - }, - "compile": { - "lib/netcoreapp1.0/dotnet-test-nunit.dll": {} - }, - "runtime": { - "lib/netcoreapp1.0/dotnet-test-nunit.dll": {} - } - }, - "Libuv/1.9.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1" - }, - "runtimeTargets": { - "runtimes/debian-x64/native/libuv.so": { - "assetType": "native", - "rid": "debian-x64" - }, - "runtimes/fedora-x64/native/libuv.so": { - "assetType": "native", - "rid": "fedora-x64" - }, - "runtimes/opensuse-x64/native/libuv.so": { - "assetType": "native", - "rid": "opensuse-x64" - }, - "runtimes/osx/native/libuv.dylib": { - "assetType": "native", - "rid": "osx" - }, - "runtimes/rhel-x64/native/libuv.so": { - "assetType": "native", - "rid": "rhel-x64" - }, - "runtimes/win7-arm/native/libuv.dll": { - "assetType": "native", - "rid": "win7-arm" - }, - "runtimes/win7-x64/native/libuv.dll": { - "assetType": "native", - "rid": "win7-x64" - }, - "runtimes/win7-x86/native/libuv.dll": { - "assetType": "native", - "rid": "win7-x86" - } - } - }, - "Microsoft.CodeAnalysis.Analyzers/1.1.0": { - "type": "package" - }, - "Microsoft.CodeAnalysis.Common/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "1.1.0", - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Collections.Immutable": "1.2.0", - "System.Console": "4.0.0", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.FileVersionInfo": "4.0.0", - "System.Diagnostics.StackTrace": "4.0.1", - "System.Diagnostics.Tools": "4.0.1", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.CodePages": "4.0.1", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath.XDocument": "4.0.1", - "System.Xml.XmlDocument": "4.0.1" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.dll": {} - } - }, - "Microsoft.CodeAnalysis.CSharp/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "[1.3.0]" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.dll": {} - } - }, - "Microsoft.CodeAnalysis.VisualBasic/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "1.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.dll": {} - } - }, - "Microsoft.CSharp/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.0/Microsoft.CSharp.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CSharp.dll": {} - } - }, - "Microsoft.DiaSymReader/1.0.8": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "lib/netstandard1.1/Microsoft.DiaSymReader.dll": {} - }, - "runtime": { - "lib/netstandard1.1/Microsoft.DiaSymReader.dll": {} - } - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "type": "package", - "runtimeTargets": { - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll": { - "assetType": "native", - "rid": "win-x64" - }, - "runtimes/win-x86/native/Microsoft.DiaSymReader.Native.x86.dll": { - "assetType": "native", - "rid": "win-x86" - }, - "runtimes/win/native/Microsoft.DiaSymReader.Native.amd64.dll": { - "assetType": "native", - "rid": "win" - }, - "runtimes/win/native/Microsoft.DiaSymReader.Native.arm.dll": { - "assetType": "native", - "rid": "win" - }, - "runtimes/win/native/Microsoft.DiaSymReader.Native.x86.dll": { - "assetType": "native", - "rid": "win" - }, - "runtimes/win8-arm/native/Microsoft.DiaSymReader.Native.arm.dll": { - "assetType": "native", - "rid": "win8-arm" - } - } - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "type": "package", - "dependencies": { - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.0.0" - }, - "compile": { - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {} - } - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "NuGet.Packaging": "3.5.0-beta2-1484", - "NuGet.RuntimeModel": "3.5.0-beta2-1484", - "System.Dynamic.Runtime": "4.0.11", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime.Loader": "4.0.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Threading.Thread": "4.0.0", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll": {} - } - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0" - }, - "compile": { - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll": {} - } - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "type": "package", - "dependencies": { - "Microsoft.DiaSymReader": "1.0.8", - "Microsoft.DiaSymReader.Native": "1.4.0-rc2", - "Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121", - "Newtonsoft.Json": "9.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1" - }, - "compile": { - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll": {} - } - }, - "Microsoft.NETCore.App/1.1.0": { - "type": "package", - "dependencies": { - "Libuv": "1.9.1", - "Microsoft.CSharp": "4.0.1", - "Microsoft.CodeAnalysis.CSharp": "1.3.0", - "Microsoft.CodeAnalysis.VisualBasic": "1.3.0", - "Microsoft.NETCore.DotNetHostPolicy": "1.0.1", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.4", - "Microsoft.VisualBasic": "10.0.1", - "NETStandard.Library": "1.6.0", - "System.Buffers": "4.0.0", - "System.Collections.Immutable": "1.2.0", - "System.ComponentModel": "4.0.1", - "System.ComponentModel.Annotations": "4.1.0", - "System.Diagnostics.DiagnosticSource": "4.0.0", - "System.Diagnostics.Process": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO.FileSystem.Watcher": "4.0.0", - "System.IO.MemoryMappedFiles": "4.0.0", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Linq.Expressions": "4.1.0", - "System.Linq.Parallel": "4.0.1", - "System.Linq.Queryable": "4.0.1", - "System.Net.NameResolution": "4.0.0", - "System.Net.Requests": "4.0.11", - "System.Net.Security": "4.0.0", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Numerics.Vectors": "4.1.1", - "System.Reflection.DispatchProxy": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.Reader": "4.0.0", - "System.Runtime.Loader": "4.0.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Threading.Tasks.Dataflow": "4.6.0", - "System.Threading.Tasks.Extensions": "4.0.0", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10" - }, - "compile": { - "lib/netcoreapp1.0/_._": {} - }, - "runtime": { - "lib/netcoreapp1.0/_._": {} - } - }, - "Microsoft.NETCore.DotNetHost/1.0.1": { - "type": "package" - }, - "Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHostResolver": "1.0.1" - } - }, - "Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHost": "1.0.1" - } - }, - "Microsoft.NETCore.Jit/1.0.4": { - "type": "package" - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Jit": "1.0.4", - "Microsoft.NETCore.Windows.ApiSets": "1.0.1" - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "type": "package" - }, - "Microsoft.VisualBasic/10.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/Microsoft.VisualBasic.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.VisualBasic.dll": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "Microsoft.Win32.Registry/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/Microsoft.Win32.Registry.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - } - }, - "NuGet.Common/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Diagnostics.Process": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Threading.Thread": "4.0.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Common.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Common.dll": {} - } - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core": "3.5.0-beta2-1484", - "System.IO.Compression": "4.1.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.dll": {} - } - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core.Types": "3.5.0-beta2-1484", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.Core.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.Core.dll": {} - } - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll": {} - } - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "Newtonsoft.Json": "6.0.4", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484", - "System.Dynamic.Runtime": "4.0.11", - "System.ObjectModel": "4.0.12" - }, - "compile": { - "lib/netstandard1.3/NuGet.RuntimeModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.RuntimeModel.dll": {} - } - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "compile": { - "lib/netstandard1.0/NuGet.Versioning.dll": {} - }, - "runtime": { - "lib/netstandard1.0/NuGet.Versioning.dll": {} - } - }, - "NUnit/3.6.0": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Loader": "4.0.0" - }, - "compile": { - "lib/netstandard1.6/nunit.framework.dll": {} - }, - "runtime": { - "lib/netstandard1.6/nunit.framework.dll": {} - } - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.Linq": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/NUnit.Portable.Agent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NUnit.Portable.Agent.dll": {} - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "debian.8-x64" - } - } - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.23-x64" - } - } - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.24-x64" - } - } - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Security/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.13.2-x64" - } - } - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.42.1-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "rhel.7-x64" - } - } - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.14.04-x64" - } - } - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.04-x64" - } - } - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.10-x64" - } - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/System.Buffers.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - } - }, - "System.ComponentModel/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.ComponentModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ComponentModel.dll": {} - } - }, - "System.ComponentModel.Annotations/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.ComponentModel": "4.0.1", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.4/System.ComponentModel.Annotations.dll": {} - }, - "runtime": { - "lib/netstandard1.4/System.ComponentModel.Annotations.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.FileVersionInfo/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Diagnostics.Process/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "Microsoft.Win32.Registry": "4.0.0", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.4/System.Diagnostics.Process.dll": {} - }, - "runtimeTargets": { - "runtimes/linux/lib/netstandard1.4/System.Diagnostics.Process.dll": { - "assetType": "runtime", - "rid": "linux" - }, - "runtimes/osx/lib/netstandard1.4/System.Diagnostics.Process.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Diagnostics.StackTrace/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.StackTrace.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Dynamic.Runtime/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Dynamic.Runtime.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Dynamic.Runtime.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Extensions.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.IO.FileSystem.Watcher/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Overlapped": "4.0.1", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Watcher.dll": {} - }, - "runtimeTargets": { - "runtimes/linux/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll": { - "assetType": "runtime", - "rid": "linux" - }, - "runtimes/osx/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.MemoryMappedFiles/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.MemoryMappedFiles.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.UnmanagedMemoryStream/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Linq.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Linq.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Linq.Parallel.dll": {} - } - }, - "System.Linq.Queryable/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Linq.Queryable.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Linq.Queryable.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.NameResolution/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Principal.Windows": "4.0.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.NameResolution.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Net.NameResolution.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.NameResolution.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Requests/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Net.Http": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Net.Requests.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Net.Requests.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Requests.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Security/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Claims": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.OpenSsl": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Security.Principal": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0", - "runtime.native.System.Net.Security": "4.0.1", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Security.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Security.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Security.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.Net.WebHeaderCollection/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - } - }, - "System.Numerics.Vectors/4.1.1": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Numerics.Vectors.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.DispatchProxy/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Immutable": "1.2.0", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.Reader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Loader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Loader.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Runtime.Loader.dll": {} - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - } - }, - "System.Security.Claims/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Security.Principal": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Claims.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Principal/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Security.Principal.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Security.Principal.dll": {} - } - }, - "System.Security.Principal.Windows/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Claims": "4.0.1", - "System.Security.Principal": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Principal.Windows.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.CodePages/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Overlapped/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Threading.Overlapped.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Threading.Overlapped.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Tasks.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll": {} - } - }, - "System.Threading.Thread/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Thread.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Thread.dll": {} - } - }, - "System.Threading.ThreadPool/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/System.Threading.ThreadPool.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.ThreadPool.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "System.Xml.XmlDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XmlDocument.dll": {} - } - }, - "System.Xml.XPath/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XPath.dll": {} - } - }, - "System.Xml.XPath.XDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XPath.XDocument.dll": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.Blob.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.Blob.dll": {} - } - } - }, - ".NETCoreApp,Version=v1.0/win10-x64": { - "dotnet-test-nunit/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121", - "Microsoft.NETCore.App": "1.0.0", - "NUnit.Portable.Agent": "3.4.0-beta-3" - }, - "compile": { - "lib/netcoreapp1.0/dotnet-test-nunit.dll": {} - }, - "runtime": { - "lib/netcoreapp1.0/dotnet-test-nunit.dll": {} - } - }, - "Libuv/1.9.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1" - }, - "native": { - "runtimes/win7-x64/native/libuv.dll": {} - } - }, - "Microsoft.CodeAnalysis.Analyzers/1.1.0": { - "type": "package" - }, - "Microsoft.CodeAnalysis.Common/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "1.1.0", - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Collections.Immutable": "1.2.0", - "System.Console": "4.0.0", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.FileVersionInfo": "4.0.0", - "System.Diagnostics.StackTrace": "4.0.1", - "System.Diagnostics.Tools": "4.0.1", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.CodePages": "4.0.1", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath.XDocument": "4.0.1", - "System.Xml.XmlDocument": "4.0.1" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.dll": {} - } - }, - "Microsoft.CodeAnalysis.CSharp/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "[1.3.0]" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.dll": {} - } - }, - "Microsoft.CodeAnalysis.VisualBasic/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "1.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.dll": {} - } - }, - "Microsoft.CSharp/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.0/Microsoft.CSharp.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CSharp.dll": {} - } - }, - "Microsoft.DiaSymReader/1.0.8": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "lib/netstandard1.1/Microsoft.DiaSymReader.dll": {} - }, - "runtime": { - "lib/netstandard1.1/Microsoft.DiaSymReader.dll": {} - } - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "type": "package", - "native": { - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll": {} - } - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "type": "package", - "dependencies": { - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.0.0" - }, - "compile": { - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {} - } - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "NuGet.Packaging": "3.5.0-beta2-1484", - "NuGet.RuntimeModel": "3.5.0-beta2-1484", - "System.Dynamic.Runtime": "4.0.11", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime.Loader": "4.0.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Threading.Thread": "4.0.0", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll": {} - } - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0" - }, - "compile": { - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll": {} - } - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "type": "package", - "dependencies": { - "Microsoft.DiaSymReader": "1.0.8", - "Microsoft.DiaSymReader.Native": "1.4.0-rc2", - "Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121", - "Newtonsoft.Json": "9.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1" - }, - "compile": { - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll": {} - } - }, - "Microsoft.NETCore.App/1.1.0": { - "type": "package", - "dependencies": { - "Libuv": "1.9.1", - "Microsoft.CSharp": "4.0.1", - "Microsoft.CodeAnalysis.CSharp": "1.3.0", - "Microsoft.CodeAnalysis.VisualBasic": "1.3.0", - "Microsoft.NETCore.DotNetHostPolicy": "1.0.1", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.4", - "Microsoft.VisualBasic": "10.0.1", - "NETStandard.Library": "1.6.0", - "System.Buffers": "4.0.0", - "System.Collections.Immutable": "1.2.0", - "System.ComponentModel": "4.0.1", - "System.ComponentModel.Annotations": "4.1.0", - "System.Diagnostics.DiagnosticSource": "4.0.0", - "System.Diagnostics.Process": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO.FileSystem.Watcher": "4.0.0", - "System.IO.MemoryMappedFiles": "4.0.0", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Linq.Expressions": "4.1.0", - "System.Linq.Parallel": "4.0.1", - "System.Linq.Queryable": "4.0.1", - "System.Net.NameResolution": "4.0.0", - "System.Net.Requests": "4.0.11", - "System.Net.Security": "4.0.0", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Numerics.Vectors": "4.1.1", - "System.Reflection.DispatchProxy": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.Reader": "4.0.0", - "System.Runtime.Loader": "4.0.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Threading.Tasks.Dataflow": "4.6.0", - "System.Threading.Tasks.Extensions": "4.0.0", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10" - }, - "compile": { - "lib/netcoreapp1.0/_._": {} - }, - "runtime": { - "lib/netcoreapp1.0/_._": {} - } - }, - "Microsoft.NETCore.DotNetHost/1.0.1": { - "type": "package", - "dependencies": { - "runtime.win7-x64.Microsoft.NETCore.DotNetHost": "1.0.1" - } - }, - "Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHostResolver": "1.0.1", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy": "1.0.1" - } - }, - "Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHost": "1.0.1", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver": "1.0.1" - } - }, - "Microsoft.NETCore.Jit/1.0.4": { - "type": "package", - "dependencies": { - "runtime.win7-x64.Microsoft.NETCore.Jit": "1.0.4" - } - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Jit": "1.0.4", - "Microsoft.NETCore.Windows.ApiSets": "1.0.1", - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR": "1.0.4" - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "type": "package" - }, - "Microsoft.VisualBasic/10.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/Microsoft.VisualBasic.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.VisualBasic.dll": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.win.Microsoft.Win32.Primitives": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "Microsoft.Win32.Registry/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - } - }, - "NuGet.Common/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Diagnostics.Process": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Threading.Thread": "4.0.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Common.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Common.dll": {} - } - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core": "3.5.0-beta2-1484", - "System.IO.Compression": "4.1.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.dll": {} - } - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core.Types": "3.5.0-beta2-1484", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.Core.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.Core.dll": {} - } - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll": {} - } - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "Newtonsoft.Json": "6.0.4", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484", - "System.Dynamic.Runtime": "4.0.11", - "System.ObjectModel": "4.0.12" - }, - "compile": { - "lib/netstandard1.3/NuGet.RuntimeModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.RuntimeModel.dll": {} - } - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "compile": { - "lib/netstandard1.0/NuGet.Versioning.dll": {} - }, - "runtime": { - "lib/netstandard1.0/NuGet.Versioning.dll": {} - } - }, - "NUnit/3.6.0": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Loader": "4.0.0" - }, - "compile": { - "lib/netstandard1.6/nunit.framework.dll": {} - }, - "runtime": { - "lib/netstandard1.6/nunit.framework.dll": {} - } - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.Linq": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/NUnit.Portable.Agent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NUnit.Portable.Agent.dll": {} - } - }, - "runtime.any.System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.dll": {} - } - }, - "runtime.any.System.Diagnostics.Tools/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.Tools.dll": {} - } - }, - "runtime.any.System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "runtime.any.System.Globalization/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Globalization.dll": {} - } - }, - "runtime.any.System.Globalization.Calendars/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "runtime.any.System.IO/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.IO.dll": {} - } - }, - "runtime.any.System.Reflection/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.dll": {} - } - }, - "runtime.any.System.Reflection.Extensions/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Extensions.dll": {} - } - }, - "runtime.any.System.Reflection.Primitives/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Primitives.dll": {} - } - }, - "runtime.any.System.Resources.ResourceManager/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Resources.ResourceManager.dll": {} - } - }, - "runtime.any.System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "System.Private.Uri": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Runtime.dll": {} - } - }, - "runtime.any.System.Runtime.Handles/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "runtime.any.System.Runtime.InteropServices/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Runtime.InteropServices.dll": {} - } - }, - "runtime.any.System.Text.Encoding/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "runtime.any.System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "runtime.any.System.Threading.Tasks/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "runtime.any.System.Threading.Timer/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Timer.dll": {} - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "runtime.win7-x64.runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Security/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.win.Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "runtime.win.System.Console/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Console.dll": {} - } - }, - "runtime.win.System.Diagnostics.Debug/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "runtime.win.System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Overlapped": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "runtime.win.System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.Win32.Primitives": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "runtime.win.System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Net.NameResolution": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Principal.Windows": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Overlapped": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "runtime.win.System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Private.Uri": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHost/1.0.1": { - "type": "package", - "native": { - "runtimes/win7-x64/native/dotnet.exe": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHostResolver": "1.0.1" - }, - "native": { - "runtimes/win7-x64/native/hostpolicy.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHost": "1.0.1" - }, - "native": { - "runtimes/win7-x64/native/hostfxr.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.Jit/1.0.4": { - "type": "package", - "native": { - "runtimes/win7-x64/native/clrjit.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "type": "package", - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "runtimes/win7-x64/lib/netstandard1.0/System.Private.CoreLib.dll": {}, - "runtimes/win7-x64/lib/netstandard1.0/mscorlib.dll": {} - }, - "native": { - "runtimes/win7-x64/native/System.Private.CoreLib.ni.dll": {}, - "runtimes/win7-x64/native/clretwrc.dll": {}, - "runtimes/win7-x64/native/coreclr.dll": {}, - "runtimes/win7-x64/native/dbgshim.dll": {}, - "runtimes/win7-x64/native/mscordaccore.dll": {}, - "runtimes/win7-x64/native/mscordbi.dll": {}, - "runtimes/win7-x64/native/mscorlib.ni.dll": {}, - "runtimes/win7-x64/native/mscorrc.debug.dll": {}, - "runtimes/win7-x64/native/mscorrc.dll": {}, - "runtimes/win7-x64/native/sos.dll": {} - } - }, - "runtime.win7-x64.runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "native": { - "runtimes/win7-x64/native/clrcompression.dll": {} - } - }, - "runtime.win7.System.Private.Uri/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.0/System.Private.Uri.dll": {} - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/System.Buffers.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Collections": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - } - }, - "System.ComponentModel/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.ComponentModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ComponentModel.dll": {} - } - }, - "System.ComponentModel.Annotations/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.ComponentModel": "4.0.1", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.4/System.ComponentModel.Annotations.dll": {} - }, - "runtime": { - "lib/netstandard1.4/System.ComponentModel.Annotations.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.win.System.Console": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.win.System.Diagnostics.Debug": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.FileVersionInfo/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll": {} - } - }, - "System.Diagnostics.Process/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "Microsoft.Win32.Registry": "4.0.0", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.4/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll": {} - } - }, - "System.Diagnostics.StackTrace/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.StackTrace.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Diagnostics.Tools": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Diagnostics.Tracing": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Dynamic.Runtime/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Dynamic.Runtime.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Dynamic.Runtime.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Globalization": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Globalization.Calendars": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Extensions.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": {} - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.any.System.IO": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": {} - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.win.System.IO.FileSystem": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.IO.FileSystem.Watcher/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Overlapped": "4.0.1", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Watcher.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll": {} - } - }, - "System.IO.MemoryMappedFiles/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.MemoryMappedFiles.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll": {} - } - }, - "System.IO.UnmanagedMemoryStream/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Linq.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Linq.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Linq.Parallel.dll": {} - } - }, - "System.Linq.Queryable/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Linq.Queryable.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Linq.Queryable.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": {} - } - }, - "System.Net.NameResolution/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Principal.Windows": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.NameResolution.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.NameResolution.dll": {} - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "runtime.win.System.Net.Primitives": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Requests/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Net.Http": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Net.Requests.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Requests.dll": {} - } - }, - "System.Net.Security/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Claims": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.OpenSsl": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Security.Principal": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0", - "runtime.native.System.Net.Security": "4.0.1", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Security.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Security.dll": {} - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.win.System.Net.Sockets": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.Net.WebHeaderCollection/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - } - }, - "System.Numerics.Vectors/4.1.1": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Numerics.Vectors.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Private.Uri/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "runtime.win7.System.Private.Uri": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Reflection": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.DispatchProxy/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Reflection.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Immutable": "1.2.0", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Reflection.Primitives": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.Reader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Resources.ResourceManager": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "runtime.any.System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.win.System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "runtime.any.System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - } - }, - "System.Runtime.Loader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Loader.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Runtime.Loader.dll": {} - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - } - }, - "System.Security.Claims/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Security.Principal": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Claims.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Claims.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": {} - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": {} - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": {} - } - }, - "System.Security.Principal/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Security.Principal.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Security.Principal.dll": {} - } - }, - "System.Security.Principal.Windows/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Claims": "4.3.0", - "System.Security.Principal": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Principal.Windows.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll": {} - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.CodePages/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.any.System.Text.Encoding.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Overlapped/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Overlapped.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Threading.Overlapped.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Tasks.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll": {} - } - }, - "System.Threading.Thread/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Thread.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Thread.dll": {} - } - }, - "System.Threading.ThreadPool/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/System.Threading.ThreadPool.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.ThreadPool.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Threading.Timer": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "System.Xml.XmlDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XmlDocument.dll": {} - } - }, - "System.Xml.XPath/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XPath.dll": {} - } - }, - "System.Xml.XPath.XDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XPath.XDocument.dll": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.Blob.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.Blob.dll": {} - } - } - }, - ".NETCoreApp,Version=v1.0/win7-x64": { - "dotnet-test-nunit/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121", - "Microsoft.NETCore.App": "1.0.0", - "NUnit.Portable.Agent": "3.4.0-beta-3" - }, - "compile": { - "lib/netcoreapp1.0/dotnet-test-nunit.dll": {} - }, - "runtime": { - "lib/netcoreapp1.0/dotnet-test-nunit.dll": {} - } - }, - "Libuv/1.9.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1" - }, - "native": { - "runtimes/win7-x64/native/libuv.dll": {} - } - }, - "Microsoft.CodeAnalysis.Analyzers/1.1.0": { - "type": "package" - }, - "Microsoft.CodeAnalysis.Common/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "1.1.0", - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Collections.Immutable": "1.2.0", - "System.Console": "4.0.0", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.FileVersionInfo": "4.0.0", - "System.Diagnostics.StackTrace": "4.0.1", - "System.Diagnostics.Tools": "4.0.1", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.Numerics": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.CodePages": "4.0.1", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath.XDocument": "4.0.1", - "System.Xml.XmlDocument": "4.0.1" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.dll": {} - } - }, - "Microsoft.CodeAnalysis.CSharp/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "[1.3.0]" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.dll": {} - } - }, - "Microsoft.CodeAnalysis.VisualBasic/1.3.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Common": "1.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.dll": {} - } - }, - "Microsoft.CSharp/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.0/Microsoft.CSharp.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.CSharp.dll": {} - } - }, - "Microsoft.DiaSymReader/1.0.8": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "lib/netstandard1.1/Microsoft.DiaSymReader.dll": {} - }, - "runtime": { - "lib/netstandard1.1/Microsoft.DiaSymReader.dll": {} - } - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "type": "package", - "native": { - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll": {} - } - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "type": "package", - "dependencies": { - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.0.0" - }, - "compile": { - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {} - } - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "NuGet.Packaging": "3.5.0-beta2-1484", - "NuGet.RuntimeModel": "3.5.0-beta2-1484", - "System.Dynamic.Runtime": "4.0.11", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime.Loader": "4.0.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Threading.Thread": "4.0.0", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll": {} - } - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0" - }, - "compile": { - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll": {} - } - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "type": "package", - "dependencies": { - "Microsoft.DiaSymReader": "1.0.8", - "Microsoft.DiaSymReader.Native": "1.4.0-rc2", - "Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121", - "Newtonsoft.Json": "9.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1" - }, - "compile": { - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll": {} - } - }, - "Microsoft.NETCore.App/1.1.0": { - "type": "package", - "dependencies": { - "Libuv": "1.9.1", - "Microsoft.CSharp": "4.0.1", - "Microsoft.CodeAnalysis.CSharp": "1.3.0", - "Microsoft.CodeAnalysis.VisualBasic": "1.3.0", - "Microsoft.NETCore.DotNetHostPolicy": "1.0.1", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.4", - "Microsoft.VisualBasic": "10.0.1", - "NETStandard.Library": "1.6.0", - "System.Buffers": "4.0.0", - "System.Collections.Immutable": "1.2.0", - "System.ComponentModel": "4.0.1", - "System.ComponentModel.Annotations": "4.1.0", - "System.Diagnostics.DiagnosticSource": "4.0.0", - "System.Diagnostics.Process": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO.FileSystem.Watcher": "4.0.0", - "System.IO.MemoryMappedFiles": "4.0.0", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Linq.Expressions": "4.1.0", - "System.Linq.Parallel": "4.0.1", - "System.Linq.Queryable": "4.0.1", - "System.Net.NameResolution": "4.0.0", - "System.Net.Requests": "4.0.11", - "System.Net.Security": "4.0.0", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Numerics.Vectors": "4.1.1", - "System.Reflection.DispatchProxy": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.Reader": "4.0.0", - "System.Runtime.Loader": "4.0.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Threading.Tasks.Dataflow": "4.6.0", - "System.Threading.Tasks.Extensions": "4.0.0", - "System.Threading.Tasks.Parallel": "4.0.1", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10" - }, - "compile": { - "lib/netcoreapp1.0/_._": {} - }, - "runtime": { - "lib/netcoreapp1.0/_._": {} - } - }, - "Microsoft.NETCore.DotNetHost/1.0.1": { - "type": "package", - "dependencies": { - "runtime.win7-x64.Microsoft.NETCore.DotNetHost": "1.0.1" - } - }, - "Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHostResolver": "1.0.1", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy": "1.0.1" - } - }, - "Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHost": "1.0.1", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver": "1.0.1" - } - }, - "Microsoft.NETCore.Jit/1.0.4": { - "type": "package", - "dependencies": { - "runtime.win7-x64.Microsoft.NETCore.Jit": "1.0.4" - } - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Jit": "1.0.4", - "Microsoft.NETCore.Windows.ApiSets": "1.0.1", - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR": "1.0.4" - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "type": "package", - "dependencies": { - "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets": "1.0.1" - } - }, - "Microsoft.VisualBasic/10.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/Microsoft.VisualBasic.dll": {} - }, - "runtime": { - "lib/netstandard1.3/Microsoft.VisualBasic.dll": {} - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.win.Microsoft.Win32.Primitives": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "Microsoft.Win32.Registry/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/netstandard1.0/Newtonsoft.Json.dll": {} - } - }, - "NuGet.Common/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Diagnostics.Process": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Threading.Thread": "4.0.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Common.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Common.dll": {} - } - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core": "3.5.0-beta2-1484", - "System.IO.Compression": "4.1.0" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.dll": {} - } - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core.Types": "3.5.0-beta2-1484", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.Core.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.Core.dll": {} - } - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll": {} - } - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "Newtonsoft.Json": "6.0.4", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484", - "System.Dynamic.Runtime": "4.0.11", - "System.ObjectModel": "4.0.12" - }, - "compile": { - "lib/netstandard1.3/NuGet.RuntimeModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NuGet.RuntimeModel.dll": {} - } - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "compile": { - "lib/netstandard1.0/NuGet.Versioning.dll": {} - }, - "runtime": { - "lib/netstandard1.0/NuGet.Versioning.dll": {} - } - }, - "NUnit/3.6.0": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Loader": "4.0.0" - }, - "compile": { - "lib/netstandard1.6/nunit.framework.dll": {} - }, - "runtime": { - "lib/netstandard1.6/nunit.framework.dll": {} - } - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.Linq": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.XDocument": "4.0.11" - }, - "compile": { - "lib/netstandard1.3/NUnit.Portable.Agent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/NUnit.Portable.Agent.dll": {} - } - }, - "runtime.any.System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.dll": {} - } - }, - "runtime.any.System.Diagnostics.Tools/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.Tools.dll": {} - } - }, - "runtime.any.System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "runtime.any.System.Globalization/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Globalization.dll": {} - } - }, - "runtime.any.System.Globalization.Calendars/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "runtime.any.System.IO/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.IO.dll": {} - } - }, - "runtime.any.System.Reflection/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.dll": {} - } - }, - "runtime.any.System.Reflection.Extensions/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Extensions.dll": {} - } - }, - "runtime.any.System.Reflection.Primitives/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Primitives.dll": {} - } - }, - "runtime.any.System.Resources.ResourceManager/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Resources.ResourceManager.dll": {} - } - }, - "runtime.any.System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "System.Private.Uri": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.5/System.Runtime.dll": {} - } - }, - "runtime.any.System.Runtime.Handles/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "runtime.any.System.Runtime.InteropServices/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Runtime.InteropServices.dll": {} - } - }, - "runtime.any.System.Text.Encoding/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "runtime.any.System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "runtime.any.System.Threading.Tasks/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "runtime.any.System.Threading.Timer/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Timer.dll": {} - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "runtime.win7-x64.runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Security/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package" - }, - "runtime.win.Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Primitives.dll": {} - } - }, - "runtime.win.System.Console/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Console.dll": {} - } - }, - "runtime.win.System.Diagnostics.Debug/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "runtime.win.System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Overlapped": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "runtime.win.System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.Win32.Primitives": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "runtime.win.System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Net.NameResolution": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Principal.Windows": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Overlapped": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "runtime.win.System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Private.Uri": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHost/1.0.1": { - "type": "package", - "native": { - "runtimes/win7-x64/native/dotnet.exe": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHostResolver": "1.0.1" - }, - "native": { - "runtimes/win7-x64/native/hostpolicy.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.DotNetHost": "1.0.1" - }, - "native": { - "runtimes/win7-x64/native/hostfxr.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.Jit/1.0.4": { - "type": "package", - "native": { - "runtimes/win7-x64/native/clrjit.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "type": "package", - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "runtimes/win7-x64/lib/netstandard1.0/System.Private.CoreLib.dll": {}, - "runtimes/win7-x64/lib/netstandard1.0/mscorlib.dll": {} - }, - "native": { - "runtimes/win7-x64/native/System.Private.CoreLib.ni.dll": {}, - "runtimes/win7-x64/native/clretwrc.dll": {}, - "runtimes/win7-x64/native/coreclr.dll": {}, - "runtimes/win7-x64/native/dbgshim.dll": {}, - "runtimes/win7-x64/native/mscordaccore.dll": {}, - "runtimes/win7-x64/native/mscordbi.dll": {}, - "runtimes/win7-x64/native/mscorlib.ni.dll": {}, - "runtimes/win7-x64/native/mscorrc.debug.dll": {}, - "runtimes/win7-x64/native/mscorrc.dll": {}, - "runtimes/win7-x64/native/sos.dll": {} - } - }, - "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "type": "package", - "native": { - "runtimes/win7-x64/native/API-MS-Win-Base-Util-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-Kernel32-Private-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-Kernel32-Private-L1-1-1.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-Kernel32-Private-L1-1-2.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-PrivateProfile-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-ProcessTopology-Obsolete-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-String-L2-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Core-StringAnsi-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-EventLog-Legacy-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Eventing-ClassicProvider-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Eventing-Consumer-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Eventing-Controller-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Eventing-Legacy-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Eventing-Provider-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-Security-LsaPolicy-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-devices-config-L1-1-0.dll": {}, - "runtimes/win7-x64/native/API-MS-Win-devices-config-L1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-com-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-com-private-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-comm-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-console-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-console-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-datetime-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-datetime-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-debug-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-debug-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-delayload-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-errorhandling-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-errorhandling-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-fibers-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-fibers-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-file-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-file-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-file-l1-2-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-file-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-file-l2-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-handle-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-heap-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-heap-obsolete-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-interlocked-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-io-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-io-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-kernel32-legacy-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-kernel32-legacy-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-kernel32-legacy-l1-1-2.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-libraryloader-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-libraryloader-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-localization-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-localization-l1-2-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-localization-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-localization-obsolete-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-2.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-3.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-namedpipe-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-namedpipe-l1-2-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-normalization-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-privateprofile-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-processenvironment-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-processenvironment-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-processsecurity-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-processthreads-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-processthreads-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-processthreads-l1-1-2.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-profile-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-psapi-ansi-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-psapi-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-psapi-obsolete-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-realtime-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-registry-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-registry-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-rtlsupport-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-shlwapi-legacy-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-shlwapi-obsolete-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-shutdown-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-shutdown-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-string-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-string-obsolete-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-string-obsolete-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-stringloader-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-stringloader-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-synch-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-synch-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-2.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-3.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-threadpool-l1-2-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-threadpool-legacy-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-threadpool-private-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-timezone-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-url-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-util-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-version-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-error-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-error-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-registration-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-robuffer-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-roparameterizediid-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-winrt-string-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-wow64-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-xstate-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-core-xstate-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-ro-typeresolution-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-base-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-cpwl-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-cryptoapi-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-lsalookup-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-lsalookup-l2-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-provider-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-security-sddl-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-core-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-core-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-management-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-management-l2-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-private-l1-1-0.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-private-l1-1-1.dll": {}, - "runtimes/win7-x64/native/api-ms-win-service-winsvc-l1-1-0.dll": {}, - "runtimes/win7-x64/native/ext-ms-win-advapi32-encryptedfile-l1-1-0.dll": {}, - "runtimes/win7-x64/native/ext-ms-win-ntuser-keyboard-l1-2-1.dll": {} - } - }, - "runtime.win7-x64.runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "native": { - "runtimes/win7-x64/native/clrcompression.dll": {} - } - }, - "runtime.win7.System.Private.Uri/4.3.0": { - "type": "package", - "compile": { - "ref/netstandard/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.0/System.Private.Uri.dll": {} - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.AppContext.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/System.Buffers.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Collections": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": {} - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Collections.Immutable.dll": {} - } - }, - "System.ComponentModel/4.0.1": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.ComponentModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ComponentModel.dll": {} - } - }, - "System.ComponentModel.Annotations/4.1.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.ComponentModel": "4.0.1", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.4/System.ComponentModel.Annotations.dll": {} - }, - "runtime": { - "lib/netstandard1.4/System.ComponentModel.Annotations.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.win.System.Console": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Console.dll": {} - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.win.System.Diagnostics.Debug": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": {} - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": {} - } - }, - "System.Diagnostics.FileVersionInfo/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll": {} - } - }, - "System.Diagnostics.Process/4.1.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "Microsoft.Win32.Registry": "4.0.0", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.4/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll": {} - } - }, - "System.Diagnostics.StackTrace/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection": "4.1.0", - "System.Reflection.Metadata": "1.3.0", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.StackTrace.dll": {} - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Diagnostics.Tools": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": {} - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Diagnostics.Tracing": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": {} - } - }, - "System.Dynamic.Runtime/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Dynamic.Runtime.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Dynamic.Runtime.dll": {} - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Globalization": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": {} - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Globalization.Calendars": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Calendars.dll": {} - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.Extensions.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": {} - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.any.System.IO": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": {} - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.win.System.IO.FileSystem": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.dll": {} - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.IO.FileSystem.Watcher/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Overlapped": "4.0.1", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Thread": "4.0.0", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.FileSystem.Watcher.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll": {} - } - }, - "System.IO.MemoryMappedFiles/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.IO.UnmanagedMemoryStream": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "runtime.native.System": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.IO.MemoryMappedFiles.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll": {} - } - }, - "System.IO.UnmanagedMemoryStream/4.0.1": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.IO.UnmanagedMemoryStream.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Linq.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Linq.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Linq.Parallel.dll": {} - } - }, - "System.Linq.Queryable/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Linq.Queryable.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Linq.Queryable.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Http.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": {} - } - }, - "System.Net.NameResolution/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Principal.Windows": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.NameResolution.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.NameResolution.dll": {} - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "runtime.win.System.Net.Primitives": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Primitives.dll": {} - } - }, - "System.Net.Requests/4.0.11": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Net.Http": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Net.WebHeaderCollection": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Net.Requests.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Requests.dll": {} - } - }, - "System.Net.Security/4.0.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.1", - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Tracing": "4.1.0", - "System.Globalization": "4.0.11", - "System.Globalization.Extensions": "4.0.1", - "System.IO": "4.1.0", - "System.Net.Primitives": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Security.Claims": "4.0.1", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Security.Cryptography.Encoding": "4.0.0", - "System.Security.Cryptography.OpenSsl": "4.0.0", - "System.Security.Cryptography.Primitives": "4.0.0", - "System.Security.Cryptography.X509Certificates": "4.1.0", - "System.Security.Principal": "4.0.1", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Threading.ThreadPool": "4.0.10", - "runtime.native.System": "4.0.0", - "runtime.native.System.Net.Security": "4.0.1", - "runtime.native.System.Security.Cryptography": "4.0.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Security.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Net.Security.dll": {} - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.win.System.Net.Sockets": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.Sockets.dll": {} - } - }, - "System.Net.WebHeaderCollection/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Net.WebHeaderCollection.dll": {} - } - }, - "System.Numerics.Vectors/4.1.1": { - "type": "package", - "dependencies": { - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0" - }, - "compile": { - "ref/netstandard1.0/System.Numerics.Vectors.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Numerics.Vectors.dll": {} - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Private.Uri/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "runtime.win7.System.Private.Uri": "4.3.0" - }, - "compile": { - "ref/netstandard/_._": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Reflection": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.DispatchProxy/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.DispatchProxy.dll": {} - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Reflection.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Immutable": "1.2.0", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Reflection.Metadata.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Reflection.Primitives": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.Reader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Resources.Reader.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Resources.ResourceManager": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "runtime.any.System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.win.System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": {} - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Handles.dll": {} - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "runtime.any.System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.InteropServices.dll": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - } - }, - "System.Runtime.Loader/4.0.0": { - "type": "package", - "dependencies": { - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Loader.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Runtime.Loader.dll": {} - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Runtime.Numerics.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "type": "package", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {} - } - }, - "System.Security.Claims/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Security.Principal": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Claims.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Claims.dll": {} - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": {} - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll": {} - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": {} - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": {} - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": {} - } - }, - "System.Security.Principal/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Security.Principal.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Security.Principal.dll": {} - } - }, - "System.Security.Principal.Windows/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Claims": "4.3.0", - "System.Security.Principal": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Security.Principal.Windows.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll": {} - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Text.Encoding.CodePages/4.0.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Handles": "4.0.1", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll": {} - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.any.System.Text.Encoding.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Text.RegularExpressions.dll": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Overlapped/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Overlapped.dll": {} - }, - "runtime": { - "runtimes/win/lib/netstandard1.3/System.Threading.Overlapped.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - }, - "runtime": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": {} - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": {} - } - }, - "System.Threading.Tasks.Parallel/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll": {} - } - }, - "System.Threading.Thread/4.0.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Thread.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.Thread.dll": {} - } - }, - "System.Threading.ThreadPool/4.0.10": { - "type": "package", - "dependencies": { - "System.Runtime": "4.1.0", - "System.Runtime.Handles": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/System.Threading.ThreadPool.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Threading.ThreadPool.dll": {} - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "runtime.any.System.Threading.Timer": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/System.Threading.Timer.dll": {} - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.ReaderWriter.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Xml.XDocument.dll": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "System.Xml.XmlDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XmlDocument.dll": {} - } - }, - "System.Xml.XPath/4.0.1": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XPath.dll": {} - } - }, - "System.Xml.XPath.XDocument/4.0.1": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11", - "System.Xml.XPath": "4.0.1" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XPath.XDocument.dll": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v1.0", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "compile": { - "netcoreapp1.0/OpenCvSharp.Blob.dll": {} - }, - "runtime": { - "netcoreapp1.0/OpenCvSharp.Blob.dll": {} - } - } - }, - ".NETFramework,Version=v4.6.1": { - "dotnet-test-nunit/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121", - "Microsoft.NETCore.Platforms": "1.0.1", - "NUnit.Portable.Agent": "3.4.0-beta-3" - }, - "compile": { - "lib/net451/dotnet-test-nunit.exe": {} - }, - "runtime": { - "lib/net451/dotnet-test-nunit.exe": {} - } - }, - "Microsoft.DiaSymReader/1.0.8": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "lib/net20/Microsoft.DiaSymReader.dll": {} - }, - "runtime": { - "lib/net20/Microsoft.DiaSymReader.dll": {} - } - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "type": "package", - "runtimeTargets": { - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll": { - "assetType": "native", - "rid": "win-x64" - }, - "runtimes/win-x86/native/Microsoft.DiaSymReader.Native.x86.dll": { - "assetType": "native", - "rid": "win-x86" - }, - "runtimes/win/native/Microsoft.DiaSymReader.Native.amd64.dll": { - "assetType": "native", - "rid": "win" - }, - "runtimes/win/native/Microsoft.DiaSymReader.Native.arm.dll": { - "assetType": "native", - "rid": "win" - }, - "runtimes/win/native/Microsoft.DiaSymReader.Native.x86.dll": { - "assetType": "native", - "rid": "win" - }, - "runtimes/win8-arm/native/Microsoft.DiaSymReader.Native.arm.dll": { - "assetType": "native", - "rid": "win8-arm" - } - } - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "type": "package", - "compile": { - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll": {} - } - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "NuGet.Packaging": "3.5.0-beta2-1484", - "NuGet.RuntimeModel": "3.5.0-beta2-1484", - "System.Reflection.Metadata": "1.3.0" - }, - "compile": { - "lib/net451/Microsoft.DotNet.ProjectModel.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.DotNet.ProjectModel.dll": {} - } - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Newtonsoft.Json": "9.0.1" - }, - "compile": { - "lib/net451/Microsoft.Extensions.DependencyModel.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.Extensions.DependencyModel.dll": {} - } - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "type": "package", - "dependencies": { - "Microsoft.DiaSymReader": "1.0.8", - "Microsoft.DiaSymReader.Native": "1.4.0-rc2", - "Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121", - "Newtonsoft.Json": "9.0.1" - }, - "compile": { - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll": {} - } - }, - "Microsoft.NETCore.Platforms/1.0.1": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "compile": { - "lib/net45/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/net45/Newtonsoft.Json.dll": {} - } - }, - "NuGet.Common/3.5.0-beta2-1484": { - "type": "package", - "frameworkAssemblies": [ - "Microsoft.CSharp", - "System", - "System.Core", - "System.IO.Compression" - ], - "compile": { - "lib/net45/NuGet.Common.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Common.dll": {} - } - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "type": "package", - "compile": { - "lib/net45/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core": "3.5.0-beta2-1484" - }, - "frameworkAssemblies": [ - "System.IO.Compression", - "System.Xml", - "System.Xml.Linq" - ], - "compile": { - "lib/net45/NuGet.Packaging.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.dll": {} - } - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core.Types": "3.5.0-beta2-1484" - }, - "frameworkAssemblies": [ - "System.IO.Compression", - "System.Xml", - "System.Xml.Linq" - ], - "compile": { - "lib/net45/NuGet.Packaging.Core.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.Core.dll": {} - } - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/net45/NuGet.Packaging.Core.Types.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.Core.Types.dll": {} - } - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "Newtonsoft.Json": "6.0.4", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/net45/NuGet.RuntimeModel.dll": {} - }, - "runtime": { - "lib/net45/NuGet.RuntimeModel.dll": {} - } - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "type": "package", - "compile": { - "lib/net45/NuGet.Versioning.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Versioning.dll": {} - } - }, - "NUnit/3.6.0": { - "type": "package", - "compile": { - "lib/net45/nunit.framework.dll": {} - }, - "runtime": { - "lib/net45/nunit.framework.dll": {} - } - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "type": "package", - "frameworkAssemblies": [ - "System.Globalization", - "System.Linq", - "System.ObjectModel", - "System.Reflection", - "System.Reflection.Extensions", - "System.Runtime", - "System.Runtime.Extensions", - "System.Runtime.Serialization.Primitives", - "System.Text.RegularExpressions", - "System.Threading", - "System.Xml", - "System.Xml.Linq", - "System.Xml.XDocument" - ], - "compile": { - "lib/net45/NUnit.Portable.Agent.dll": {} - }, - "runtime": { - "lib/net45/NUnit.Portable.Agent.dll": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "compile": { - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} - } - }, - "System.Diagnostics.Debug/4.0.11": { - "type": "package", - "frameworkAssemblies": [ - "System" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0" - }, - "compile": { - "lib/portable-net45+win8/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/portable-net45+win8/System.Reflection.Metadata.dll": {} - } - }, - "System.Runtime/4.1.0": { - "type": "package", - "frameworkAssemblies": [ - "System", - "System.ComponentModel.Composition", - "System.Core" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "System.Runtime.InteropServices/4.1.0": { - "type": "package", - "frameworkAssemblies": [ - "System", - "System.Core" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net46/OpenCvSharp.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "compile": { - "net46/OpenCvSharp.Blob.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Blob.dll": {} - } - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "frameworkAssemblies": [ - "PresentationCore", - "PresentationFramework", - "System.Drawing", - "System.Runtime", - "System.Windows.Forms", - "System.Xaml", - "WindowsBase" - ], - "compile": { - "net46/OpenCvSharp.Extensions.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Extensions.dll": {} - } - } - }, - ".NETFramework,Version=v4.6.1/win10-x64": { - "dotnet-test-nunit/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121", - "Microsoft.NETCore.Platforms": "1.0.1", - "NUnit.Portable.Agent": "3.4.0-beta-3" - }, - "compile": { - "lib/net451/dotnet-test-nunit.exe": {} - }, - "runtime": { - "lib/net451/dotnet-test-nunit.exe": {} - } - }, - "Microsoft.DiaSymReader/1.0.8": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "lib/net20/Microsoft.DiaSymReader.dll": {} - }, - "runtime": { - "lib/net20/Microsoft.DiaSymReader.dll": {} - } - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "type": "package", - "native": { - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll": {} - } - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "type": "package", - "compile": { - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll": {} - } - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "NuGet.Packaging": "3.5.0-beta2-1484", - "NuGet.RuntimeModel": "3.5.0-beta2-1484", - "System.Reflection.Metadata": "1.3.0" - }, - "compile": { - "lib/net451/Microsoft.DotNet.ProjectModel.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.DotNet.ProjectModel.dll": {} - } - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Newtonsoft.Json": "9.0.1" - }, - "compile": { - "lib/net451/Microsoft.Extensions.DependencyModel.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.Extensions.DependencyModel.dll": {} - } - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "type": "package", - "dependencies": { - "Microsoft.DiaSymReader": "1.0.8", - "Microsoft.DiaSymReader.Native": "1.4.0-rc2", - "Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121", - "Newtonsoft.Json": "9.0.1" - }, - "compile": { - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll": {} - } - }, - "Microsoft.NETCore.Platforms/1.0.1": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "compile": { - "lib/net45/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/net45/Newtonsoft.Json.dll": {} - } - }, - "NuGet.Common/3.5.0-beta2-1484": { - "type": "package", - "frameworkAssemblies": [ - "Microsoft.CSharp", - "System", - "System.Core", - "System.IO.Compression" - ], - "compile": { - "lib/net45/NuGet.Common.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Common.dll": {} - } - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "type": "package", - "compile": { - "lib/net45/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core": "3.5.0-beta2-1484" - }, - "frameworkAssemblies": [ - "System.IO.Compression", - "System.Xml", - "System.Xml.Linq" - ], - "compile": { - "lib/net45/NuGet.Packaging.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.dll": {} - } - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core.Types": "3.5.0-beta2-1484" - }, - "frameworkAssemblies": [ - "System.IO.Compression", - "System.Xml", - "System.Xml.Linq" - ], - "compile": { - "lib/net45/NuGet.Packaging.Core.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.Core.dll": {} - } - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/net45/NuGet.Packaging.Core.Types.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.Core.Types.dll": {} - } - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "Newtonsoft.Json": "6.0.4", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/net45/NuGet.RuntimeModel.dll": {} - }, - "runtime": { - "lib/net45/NuGet.RuntimeModel.dll": {} - } - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "type": "package", - "compile": { - "lib/net45/NuGet.Versioning.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Versioning.dll": {} - } - }, - "NUnit/3.6.0": { - "type": "package", - "compile": { - "lib/net45/nunit.framework.dll": {} - }, - "runtime": { - "lib/net45/nunit.framework.dll": {} - } - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "type": "package", - "frameworkAssemblies": [ - "System.Globalization", - "System.Linq", - "System.ObjectModel", - "System.Reflection", - "System.Reflection.Extensions", - "System.Runtime", - "System.Runtime.Extensions", - "System.Runtime.Serialization.Primitives", - "System.Text.RegularExpressions", - "System.Threading", - "System.Xml", - "System.Xml.Linq", - "System.Xml.XDocument" - ], - "compile": { - "lib/net45/NUnit.Portable.Agent.dll": {} - }, - "runtime": { - "lib/net45/NUnit.Portable.Agent.dll": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "compile": { - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} - } - }, - "System.Diagnostics.Debug/4.0.11": { - "type": "package", - "frameworkAssemblies": [ - "System" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0" - }, - "compile": { - "lib/portable-net45+win8/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/portable-net45+win8/System.Reflection.Metadata.dll": {} - } - }, - "System.Runtime/4.1.0": { - "type": "package", - "frameworkAssemblies": [ - "System", - "System.ComponentModel.Composition", - "System.Core" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "System.Runtime.InteropServices/4.1.0": { - "type": "package", - "frameworkAssemblies": [ - "System", - "System.Core" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net46/OpenCvSharp.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "compile": { - "net46/OpenCvSharp.Blob.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Blob.dll": {} - } - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "frameworkAssemblies": [ - "PresentationCore", - "PresentationFramework", - "System.Drawing", - "System.Runtime", - "System.Windows.Forms", - "System.Xaml", - "WindowsBase" - ], - "compile": { - "net46/OpenCvSharp.Extensions.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Extensions.dll": {} - } - } - }, - ".NETFramework,Version=v4.6.1/win7-x64": { - "dotnet-test-nunit/3.4.0-beta-3": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Microsoft.Extensions.Testing.Abstractions": "1.0.0-preview2-003121", - "Microsoft.NETCore.Platforms": "1.0.1", - "NUnit.Portable.Agent": "3.4.0-beta-3" - }, - "compile": { - "lib/net451/dotnet-test-nunit.exe": {} - }, - "runtime": { - "lib/net451/dotnet-test-nunit.exe": {} - } - }, - "Microsoft.DiaSymReader/1.0.8": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.0.11", - "System.Runtime": "4.1.0", - "System.Runtime.InteropServices": "4.1.0" - }, - "compile": { - "lib/net20/Microsoft.DiaSymReader.dll": {} - }, - "runtime": { - "lib/net20/Microsoft.DiaSymReader.dll": {} - } - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "type": "package", - "native": { - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll": {} - } - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "type": "package", - "compile": { - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll": {} - } - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "type": "package", - "dependencies": { - "Microsoft.Extensions.DependencyModel": "1.0.0", - "Newtonsoft.Json": "9.0.1", - "NuGet.Packaging": "3.5.0-beta2-1484", - "NuGet.RuntimeModel": "3.5.0-beta2-1484", - "System.Reflection.Metadata": "1.3.0" - }, - "compile": { - "lib/net451/Microsoft.DotNet.ProjectModel.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.DotNet.ProjectModel.dll": {} - } - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "type": "package", - "dependencies": { - "Microsoft.DotNet.InternalAbstractions": "1.0.0", - "Newtonsoft.Json": "9.0.1" - }, - "compile": { - "lib/net451/Microsoft.Extensions.DependencyModel.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.Extensions.DependencyModel.dll": {} - } - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "type": "package", - "dependencies": { - "Microsoft.DiaSymReader": "1.0.8", - "Microsoft.DiaSymReader.Native": "1.4.0-rc2", - "Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121", - "Newtonsoft.Json": "9.0.1" - }, - "compile": { - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll": {} - }, - "runtime": { - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll": {} - } - }, - "Microsoft.NETCore.Platforms/1.0.1": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Newtonsoft.Json/9.0.1": { - "type": "package", - "compile": { - "lib/net45/Newtonsoft.Json.dll": {} - }, - "runtime": { - "lib/net45/Newtonsoft.Json.dll": {} - } - }, - "NuGet.Common/3.5.0-beta2-1484": { - "type": "package", - "frameworkAssemblies": [ - "Microsoft.CSharp", - "System", - "System.Core", - "System.IO.Compression" - ], - "compile": { - "lib/net45/NuGet.Common.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Common.dll": {} - } - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "type": "package", - "compile": { - "lib/net45/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core": "3.5.0-beta2-1484" - }, - "frameworkAssemblies": [ - "System.IO.Compression", - "System.Xml", - "System.Xml.Linq" - ], - "compile": { - "lib/net45/NuGet.Packaging.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.dll": {} - } - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Common": "3.5.0-beta2-1484", - "NuGet.Packaging.Core.Types": "3.5.0-beta2-1484" - }, - "frameworkAssemblies": [ - "System.IO.Compression", - "System.Xml", - "System.Xml.Linq" - ], - "compile": { - "lib/net45/NuGet.Packaging.Core.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.Core.dll": {} - } - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/net45/NuGet.Packaging.Core.Types.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Packaging.Core.Types.dll": {} - } - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "type": "package", - "dependencies": { - "Newtonsoft.Json": "6.0.4", - "NuGet.Frameworks": "3.5.0-beta2-1484", - "NuGet.Versioning": "3.5.0-beta2-1484" - }, - "compile": { - "lib/net45/NuGet.RuntimeModel.dll": {} - }, - "runtime": { - "lib/net45/NuGet.RuntimeModel.dll": {} - } - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "type": "package", - "compile": { - "lib/net45/NuGet.Versioning.dll": {} - }, - "runtime": { - "lib/net45/NuGet.Versioning.dll": {} - } - }, - "NUnit/3.6.0": { - "type": "package", - "compile": { - "lib/net45/nunit.framework.dll": {} - }, - "runtime": { - "lib/net45/nunit.framework.dll": {} - } - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "type": "package", - "frameworkAssemblies": [ - "System.Globalization", - "System.Linq", - "System.ObjectModel", - "System.Reflection", - "System.Reflection.Extensions", - "System.Runtime", - "System.Runtime.Extensions", - "System.Runtime.Serialization.Primitives", - "System.Text.RegularExpressions", - "System.Threading", - "System.Xml", - "System.Xml.Linq", - "System.Xml.XDocument" - ], - "compile": { - "lib/net45/NUnit.Portable.Agent.dll": {} - }, - "runtime": { - "lib/net45/NUnit.Portable.Agent.dll": {} - } - }, - "System.Collections.Immutable/1.2.0": { - "type": "package", - "compile": { - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} - }, - "runtime": { - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} - } - }, - "System.Diagnostics.Debug/4.0.11": { - "type": "package", - "frameworkAssemblies": [ - "System" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "System.Reflection.Metadata/1.3.0": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "1.2.0" - }, - "compile": { - "lib/portable-net45+win8/System.Reflection.Metadata.dll": {} - }, - "runtime": { - "lib/portable-net45+win8/System.Reflection.Metadata.dll": {} - } - }, - "System.Runtime/4.1.0": { - "type": "package", - "frameworkAssemblies": [ - "System", - "System.ComponentModel.Composition", - "System.Core" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "System.Runtime.InteropServices/4.1.0": { - "type": "package", - "frameworkAssemblies": [ - "System", - "System.Core" - ], - "compile": { - "ref/net45/_._": {} - }, - "runtime": { - "lib/net45/_._": {} - } - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "frameworkAssemblies": [ - "System.Security", - "System.Web" - ], - "compile": { - "net46/OpenCvSharp.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.dll": {} - } - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "compile": { - "net46/OpenCvSharp.Blob.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Blob.dll": {} - } - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "framework": ".NETFramework,Version=v4.6", - "dependencies": { - "OpenCvSharp": "1.0.0" - }, - "frameworkAssemblies": [ - "PresentationCore", - "PresentationFramework", - "System.Drawing", - "System.Runtime", - "System.Windows.Forms", - "System.Xaml", - "WindowsBase" - ], - "compile": { - "net46/OpenCvSharp.Extensions.dll": {} - }, - "runtime": { - "net46/OpenCvSharp.Extensions.dll": {} - } - } - } - }, - "libraries": { - "dotnet-test-nunit/3.4.0-beta-3": { - "sha512": "TCprFJd60JQrNSygKAinVFBF2zQK3V2BRm1jeBvAGKF/6omeMrjO1tBD3UKlZSGvHFNyiocPn7bgU68cNz94ug==", - "type": "package", - "path": "dotnet-test-nunit/3.4.0-beta-3", - "files": [ - "dotnet-test-nunit.3.4.0-beta-3.nupkg.sha512", - "dotnet-test-nunit.nuspec", - "lib/net451/dotnet-test-nunit.exe", - "lib/netcoreapp1.0/dotnet-test-nunit.dll", - "lib/netcoreapp1.0/dotnet-test-nunit.runtimeconfig.json" - ] - }, - "Libuv/1.9.1": { - "sha512": "uqX2Frwf9PW8MaY7PRNY6HM5BpW1D8oj1EdqzrmbEFD5nH63Yat3aEjN/tws6Tw6Fk7LwmLBvtUh32tTeTaHiA==", - "type": "package", - "path": "Libuv/1.9.1", - "files": [ - "Libuv.1.9.1.nupkg.sha512", - "Libuv.nuspec", - "License.txt", - "runtimes/debian-x64/native/libuv.so", - "runtimes/fedora-x64/native/libuv.so", - "runtimes/opensuse-x64/native/libuv.so", - "runtimes/osx/native/libuv.dylib", - "runtimes/rhel-x64/native/libuv.so", - "runtimes/win7-arm/native/libuv.dll", - "runtimes/win7-x64/native/libuv.dll", - "runtimes/win7-x86/native/libuv.dll" - ] - }, - "Microsoft.CodeAnalysis.Analyzers/1.1.0": { - "sha512": "HS3iRWZKcUw/8eZ/08GXKY2Bn7xNzQPzf8gRPHGSowX7u7XXu9i9YEaBeBNKUXWfI7qjvT2zXtLUvbN0hds8vg==", - "type": "package", - "path": "Microsoft.CodeAnalysis.Analyzers/1.1.0", - "files": [ - "Microsoft.CodeAnalysis.Analyzers.1.1.0.nupkg.sha512", - "Microsoft.CodeAnalysis.Analyzers.nuspec", - "ThirdPartyNotices.rtf", - "analyzers/dotnet/cs/Microsoft.CodeAnalysis.Analyzers.dll", - "analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.Analyzers.dll", - "analyzers/dotnet/vb/Microsoft.CodeAnalysis.Analyzers.dll", - "analyzers/dotnet/vb/Microsoft.CodeAnalysis.VisualBasic.Analyzers.dll", - "tools/install.ps1", - "tools/uninstall.ps1" - ] - }, - "Microsoft.CodeAnalysis.Common/1.3.0": { - "sha512": "V09G35cs0CT1C4Dr1IEOh8IGfnWALEVAOO5JXsqagxXwmYR012TlorQ+vx2eXxfZRKs3gAS/r92gN9kRBLba5A==", - "type": "package", - "path": "Microsoft.CodeAnalysis.Common/1.3.0", - "files": [ - "Microsoft.CodeAnalysis.Common.1.3.0.nupkg.sha512", - "Microsoft.CodeAnalysis.Common.nuspec", - "ThirdPartyNotices.rtf", - "lib/net45/Microsoft.CodeAnalysis.dll", - "lib/net45/Microsoft.CodeAnalysis.xml", - "lib/netstandard1.3/Microsoft.CodeAnalysis.dll", - "lib/netstandard1.3/Microsoft.CodeAnalysis.xml", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.dll", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.xml" - ] - }, - "Microsoft.CodeAnalysis.CSharp/1.3.0": { - "sha512": "BgWDIAbSFsHuGeLSn/rljLi51nXqkSo4DZ0qEIrHyPVasrhxEVq7aV8KKZ3HEfSFB+GIhBmOogE+mlOLYg19eg==", - "type": "package", - "path": "Microsoft.CodeAnalysis.CSharp/1.3.0", - "files": [ - "Microsoft.CodeAnalysis.CSharp.1.3.0.nupkg.sha512", - "Microsoft.CodeAnalysis.CSharp.nuspec", - "ThirdPartyNotices.rtf", - "lib/net45/Microsoft.CodeAnalysis.CSharp.dll", - "lib/net45/Microsoft.CodeAnalysis.CSharp.xml", - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.dll", - "lib/netstandard1.3/Microsoft.CodeAnalysis.CSharp.xml", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.CSharp.dll", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.CSharp.xml" - ] - }, - "Microsoft.CodeAnalysis.VisualBasic/1.3.0": { - "sha512": "Sf3k8PkTkWqBmXnnblJbvb7ewO6mJzX6WO2t7m04BmOY5qBq6yhhyXnn/BMM+QCec3Arw3X35Zd8f9eBql0qgg==", - "type": "package", - "path": "Microsoft.CodeAnalysis.VisualBasic/1.3.0", - "files": [ - "Microsoft.CodeAnalysis.VisualBasic.1.3.0.nupkg.sha512", - "Microsoft.CodeAnalysis.VisualBasic.nuspec", - "ThirdPartyNotices.rtf", - "lib/net45/Microsoft.CodeAnalysis.VisualBasic.dll", - "lib/net45/Microsoft.CodeAnalysis.VisualBasic.xml", - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.dll", - "lib/netstandard1.3/Microsoft.CodeAnalysis.VisualBasic.xml", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.VisualBasic.dll", - "lib/portable-net45+win8/Microsoft.CodeAnalysis.VisualBasic.xml" - ] - }, - "Microsoft.CSharp/4.0.1": { - "sha512": "17h8b5mXa87XYKrrVqdgZ38JefSUqLChUQpXgSnpzsM0nDOhE40FTeNWOJ/YmySGV6tG6T8+hjz6vxbknHJr6A==", - "type": "package", - "path": "Microsoft.CSharp/4.0.1", - "files": [ - "Microsoft.CSharp.4.0.1.nupkg.sha512", - "Microsoft.CSharp.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/Microsoft.CSharp.dll", - "lib/netstandard1.3/Microsoft.CSharp.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/Microsoft.CSharp.dll", - "ref/netcore50/Microsoft.CSharp.xml", - "ref/netcore50/de/Microsoft.CSharp.xml", - "ref/netcore50/es/Microsoft.CSharp.xml", - "ref/netcore50/fr/Microsoft.CSharp.xml", - "ref/netcore50/it/Microsoft.CSharp.xml", - "ref/netcore50/ja/Microsoft.CSharp.xml", - "ref/netcore50/ko/Microsoft.CSharp.xml", - "ref/netcore50/ru/Microsoft.CSharp.xml", - "ref/netcore50/zh-hans/Microsoft.CSharp.xml", - "ref/netcore50/zh-hant/Microsoft.CSharp.xml", - "ref/netstandard1.0/Microsoft.CSharp.dll", - "ref/netstandard1.0/Microsoft.CSharp.xml", - "ref/netstandard1.0/de/Microsoft.CSharp.xml", - "ref/netstandard1.0/es/Microsoft.CSharp.xml", - "ref/netstandard1.0/fr/Microsoft.CSharp.xml", - "ref/netstandard1.0/it/Microsoft.CSharp.xml", - "ref/netstandard1.0/ja/Microsoft.CSharp.xml", - "ref/netstandard1.0/ko/Microsoft.CSharp.xml", - "ref/netstandard1.0/ru/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "Microsoft.DiaSymReader/1.0.8": { - "sha512": "HAhTmRgU+nnDVYxMZFAS1iwqg6CudbsSMZfSY9UJj4AJO4L69xZCtTOPKC5rW8+egNBWjDb0iBZV4ZdNI6dZnA==", - "type": "package", - "path": "Microsoft.DiaSymReader/1.0.8", - "files": [ - "Microsoft.DiaSymReader.1.0.8.nupkg.sha512", - "Microsoft.DiaSymReader.nuspec", - "lib/net20/Microsoft.DiaSymReader.dll", - "lib/net20/Microsoft.DiaSymReader.xml", - "lib/netstandard1.1/Microsoft.DiaSymReader.dll", - "lib/netstandard1.1/Microsoft.DiaSymReader.xml", - "lib/portable-net45+win8/Microsoft.DiaSymReader.dll", - "lib/portable-net45+win8/Microsoft.DiaSymReader.xml" - ] - }, - "Microsoft.DiaSymReader.Native/1.4.0-rc2": { - "sha512": "KIQOG+U6btTHL5KkXYofMpyCzVx+6EcDPS9GBRGGhlrTjJqcqAM6a6a0D0Dur/HPnAdmGLtSHVjCDZijGJFCAA==", - "type": "package", - "path": "Microsoft.DiaSymReader.Native/1.4.0-rc2", - "files": [ - "Microsoft.DiaSymReader.Native.1.4.0-rc2.nupkg.sha512", - "Microsoft.DiaSymReader.Native.nuspec", - "build/Microsoft.DiaSymReader.Native.props", - "runtimes/win-x64/native/Microsoft.DiaSymReader.Native.amd64.dll", - "runtimes/win-x86/native/Microsoft.DiaSymReader.Native.x86.dll", - "runtimes/win/native/Microsoft.DiaSymReader.Native.amd64.dll", - "runtimes/win/native/Microsoft.DiaSymReader.Native.arm.dll", - "runtimes/win/native/Microsoft.DiaSymReader.Native.x86.dll", - "runtimes/win8-arm/native/Microsoft.DiaSymReader.Native.arm.dll" - ] - }, - "Microsoft.DotNet.InternalAbstractions/1.0.0": { - "sha512": "AAguUq7YyKk3yDWPoWA8DrLZvURxB/LrDdTn1h5lmPeznkFUpfC3p459w5mQYQE0qpquf/CkSQZ0etiV5vRHFA==", - "type": "package", - "path": "Microsoft.DotNet.InternalAbstractions/1.0.0", - "files": [ - "Microsoft.DotNet.InternalAbstractions.1.0.0.nupkg.sha512", - "Microsoft.DotNet.InternalAbstractions.nuspec", - "lib/net451/Microsoft.DotNet.InternalAbstractions.dll", - "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll" - ] - }, - "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121": { - "sha512": "wnWw5KsKinG2wWxdoQIJXZlMFvPNhL7WmIyW9q6xrZFUi/uld5PC3ksq2QDZepF148FUjCIyTP+TnRwU3RJqUg==", - "type": "package", - "path": "Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121", - "files": [ - "Microsoft.DotNet.ProjectModel.1.0.0-rc3-003121.nupkg.sha512", - "Microsoft.DotNet.ProjectModel.nuspec", - "lib/net451/Microsoft.DotNet.ProjectModel.dll", - "lib/netstandard1.6/Microsoft.DotNet.ProjectModel.dll" - ] - }, - "Microsoft.Extensions.DependencyModel/1.0.0": { - "sha512": "n55Y2T4qMgCNMrJaqAN+nlG2EH4XL+e9uxIg4vdFsQeF+L8UKxRdD3C35Bt+xk3vO3Zwp3g+6KFq2VPH2COSmg==", - "type": "package", - "path": "Microsoft.Extensions.DependencyModel/1.0.0", - "files": [ - "Microsoft.Extensions.DependencyModel.1.0.0.nupkg.sha512", - "Microsoft.Extensions.DependencyModel.nuspec", - "lib/net451/Microsoft.Extensions.DependencyModel.dll", - "lib/netstandard1.6/Microsoft.Extensions.DependencyModel.dll" - ] - }, - "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121": { - "sha512": "q3Uq07d6LbYr0NiX5Dz9GCbXJv4vkmSbUvFEmov3Vo4prZWjhFzF+byk2tWAEEqtZ6ereMYXBUt99wCTtANk6Q==", - "type": "package", - "path": "Microsoft.Extensions.Testing.Abstractions/1.0.0-preview2-003121", - "files": [ - "Microsoft.Extensions.Testing.Abstractions.1.0.0-preview2-003121.nupkg.sha512", - "Microsoft.Extensions.Testing.Abstractions.nuspec", - "lib/net451/Microsoft.Extensions.Testing.Abstractions.dll", - "lib/netstandard1.6/Microsoft.Extensions.Testing.Abstractions.dll" - ] - }, - "Microsoft.NETCore.App/1.1.0": { - "sha512": "DFec+OUojDVocn1GxAL9uJg4qwsgkvKiQpv6BKd9ljGezvc9p6GpFv51IIakiujkVW/wBtQ0xlfjVSgS1UG/uw==", - "type": "package", - "path": "Microsoft.NETCore.App/1.1.0", - "files": [ - "Microsoft.NETCore.App.1.1.0.nupkg.sha512", - "Microsoft.NETCore.App.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netcoreapp1.0/_._" - ] - }, - "Microsoft.NETCore.DotNetHost/1.0.1": { - "sha512": "uaMgykq6AckP3hZW4dsD6zjocxyXPz0tcTl8OX7mlSUWsyFXdtf45sjdwI0JIHxt3gnI6GihAlOAwYK8HE4niQ==", - "type": "package", - "path": "Microsoft.NETCore.DotNetHost/1.0.1", - "files": [ - "Microsoft.NETCore.DotNetHost.1.0.1.nupkg.sha512", - "Microsoft.NETCore.DotNetHost.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "sha512": "d8AQ+ZVj2iK9sbgl3IEsshCSaumhM1PNTPHxldZAQLOoI1BKF8QZ1zPCNqwBGisPiWOE3f/1SHDbQi1BTRBxuA==", - "type": "package", - "path": "Microsoft.NETCore.DotNetHostPolicy/1.0.1", - "files": [ - "Microsoft.NETCore.DotNetHostPolicy.1.0.1.nupkg.sha512", - "Microsoft.NETCore.DotNetHostPolicy.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "sha512": "GEXgpAHB9E0OhfcmNJ664Xcd2bJkz2qkGIAFmCgEI5ANlQy4qEEmBVfUqA+Z9HB85ZwWxZc1eIJ6fxdxcjrctg==", - "type": "package", - "path": "Microsoft.NETCore.DotNetHostResolver/1.0.1", - "files": [ - "Microsoft.NETCore.DotNetHostResolver.1.0.1.nupkg.sha512", - "Microsoft.NETCore.DotNetHostResolver.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.Jit/1.0.4": { - "sha512": "IcHTGj+vTFcOu7/flwNg+CWIfTsxqHWgj08MKOtYwS5k0EuLvx6PrYsn7vHCV0SUTk1zbQ1l0EJj1UdxTMyx4w==", - "type": "package", - "path": "Microsoft.NETCore.Jit/1.0.4", - "files": [ - "Microsoft.NETCore.Jit.1.0.4.nupkg.sha512", - "Microsoft.NETCore.Jit.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.Platforms/1.0.1": { - "sha512": "2G6OjjJzwBfNOO8myRV/nFrbTw5iA+DEm0N+qUqhrOmaVtn4pC77h38I1jsXGw5VH55+dPfQsqHD0We9sCl9FQ==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.0.1", - "files": [ - "Microsoft.NETCore.Platforms.1.0.1.nupkg.sha512", - "Microsoft.NETCore.Platforms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "type": "package", - "path": "Microsoft.NETCore.Platforms/1.1.0", - "files": [ - "Microsoft.NETCore.Platforms.1.1.0.nupkg.sha512", - "Microsoft.NETCore.Platforms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "sha512": "r4/aP7VYcJ+W/rJVFU+jAdjF4KrsHRDYQJ+p8weUP5n65yLzWXlQTVY6OsR560aV5EF7jc65dqsNXIryUCrEkQ==", - "type": "package", - "path": "Microsoft.NETCore.Runtime.CoreCLR/1.0.4", - "files": [ - "Microsoft.NETCore.Runtime.CoreCLR.1.0.4.nupkg.sha512", - "Microsoft.NETCore.Runtime.CoreCLR.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets/1.1.0": { - "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", - "type": "package", - "path": "Microsoft.NETCore.Targets/1.1.0", - "files": [ - "Microsoft.NETCore.Targets.1.1.0.nupkg.sha512", - "Microsoft.NETCore.Targets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.json" - ] - }, - "Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "sha512": "SaToCvvsGMxTgtLv/BrFQ5IFMPRE1zpWbnqbpwykJa8W5XiX82CXI6K2o7yf5xS7EP6t/JzFLV0SIDuWpvBZVw==", - "type": "package", - "path": "Microsoft.NETCore.Windows.ApiSets/1.0.1", - "files": [ - "Microsoft.NETCore.Windows.ApiSets.1.0.1.nupkg.sha512", - "Microsoft.NETCore.Windows.ApiSets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.json" - ] - }, - "Microsoft.VisualBasic/10.0.1": { - "sha512": "HpNyOf/4Tp2lh4FyywB55VITk0SqVxEjDzsVDDyF1yafDN6Bq18xcHowzCPINyYHUTgGcEtmpYiRsFdSo0KKdQ==", - "type": "package", - "path": "Microsoft.VisualBasic/10.0.1", - "files": [ - "Microsoft.VisualBasic.10.0.1.nupkg.sha512", - "Microsoft.VisualBasic.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net45/_._", - "lib/netcore50/Microsoft.VisualBasic.dll", - "lib/netstandard1.3/Microsoft.VisualBasic.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "ref/net45/_._", - "ref/netcore50/Microsoft.VisualBasic.dll", - "ref/netcore50/Microsoft.VisualBasic.xml", - "ref/netcore50/de/Microsoft.VisualBasic.xml", - "ref/netcore50/es/Microsoft.VisualBasic.xml", - "ref/netcore50/fr/Microsoft.VisualBasic.xml", - "ref/netcore50/it/Microsoft.VisualBasic.xml", - "ref/netcore50/ja/Microsoft.VisualBasic.xml", - "ref/netcore50/ko/Microsoft.VisualBasic.xml", - "ref/netcore50/ru/Microsoft.VisualBasic.xml", - "ref/netcore50/zh-hans/Microsoft.VisualBasic.xml", - "ref/netcore50/zh-hant/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/Microsoft.VisualBasic.dll", - "ref/netstandard1.1/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/de/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/es/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/fr/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/it/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/ja/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/ko/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/ru/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/zh-hans/Microsoft.VisualBasic.xml", - "ref/netstandard1.1/zh-hant/Microsoft.VisualBasic.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._" - ] - }, - "Microsoft.Win32.Primitives/4.3.0": { - "sha512": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "type": "package", - "path": "Microsoft.Win32.Primitives/4.3.0", - "files": [ - "Microsoft.Win32.Primitives.4.3.0.nupkg.sha512", - "Microsoft.Win32.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "Microsoft.Win32.Registry/4.0.0": { - "sha512": "q+eLtROUAQ3OxYA5mpQrgyFgzLQxIyrfT2eLpYX5IEPlHmIio2nh4F5bgOaQoGOV865kFKZZso9Oq9RlazvXtg==", - "type": "package", - "path": "Microsoft.Win32.Registry/4.0.0", - "files": [ - "Microsoft.Win32.Registry.4.0.0.nupkg.sha512", - "Microsoft.Win32.Registry.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/Microsoft.Win32.Registry.dll", - "ref/net46/Microsoft.Win32.Registry.dll", - "ref/netstandard1.3/Microsoft.Win32.Registry.dll", - "ref/netstandard1.3/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Registry.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Registry.xml", - "runtimes/unix/lib/netstandard1.3/Microsoft.Win32.Registry.dll", - "runtimes/win/lib/net46/Microsoft.Win32.Registry.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Registry.dll" - ] - }, - "NETStandard.Library/1.6.1": { - "sha512": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "type": "package", - "path": "NETStandard.Library/1.6.1", - "files": [ - "NETStandard.Library.1.6.1.nupkg.sha512", - "NETStandard.Library.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt" - ] - }, - "Newtonsoft.Json/9.0.1": { - "sha512": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", - "type": "package", - "path": "Newtonsoft.Json/9.0.1", - "files": [ - "Newtonsoft.Json.9.0.1.nupkg.sha512", - "Newtonsoft.Json.nuspec", - "lib/net20/Newtonsoft.Json.dll", - "lib/net20/Newtonsoft.Json.xml", - "lib/net35/Newtonsoft.Json.dll", - "lib/net35/Newtonsoft.Json.xml", - "lib/net40/Newtonsoft.Json.dll", - "lib/net40/Newtonsoft.Json.xml", - "lib/net45/Newtonsoft.Json.dll", - "lib/net45/Newtonsoft.Json.xml", - "lib/netstandard1.0/Newtonsoft.Json.dll", - "lib/netstandard1.0/Newtonsoft.Json.xml", - "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll", - "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml", - "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll", - "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.xml", - "tools/install.ps1" - ] - }, - "NuGet.Common/3.5.0-beta2-1484": { - "sha512": "rLBmcZOPVF7Mne/LumDNACZZyI5B67hjylt+Z/WSEUQ/IXE9nLv8IVL0+T9xljIaSSQCjO8cOtmJ6ztqrsQKcQ==", - "type": "package", - "path": "NuGet.Common/3.5.0-beta2-1484", - "files": [ - "NuGet.Common.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.Common.nuspec", - "lib/net45/NuGet.Common.dll", - "lib/net45/NuGet.Common.xml", - "lib/netstandard1.3/NuGet.Common.dll", - "lib/netstandard1.3/NuGet.Common.xml" - ] - }, - "NuGet.Frameworks/3.5.0-beta2-1484": { - "sha512": "AZoX0c05qgSfx0IOGTbLXa2fD7eM2WUqKP3osMMvSxK+tOGmctHuFlvjXxMHBv9yg0/13KdH0osV/zI7+SjzOA==", - "type": "package", - "path": "NuGet.Frameworks/3.5.0-beta2-1484", - "files": [ - "NuGet.Frameworks.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.Frameworks.nuspec", - "lib/net40-client/NuGet.Frameworks.dll", - "lib/net40-client/NuGet.Frameworks.xml", - "lib/net45/NuGet.Frameworks.dll", - "lib/net45/NuGet.Frameworks.xml", - "lib/netstandard1.3/NuGet.Frameworks.dll", - "lib/netstandard1.3/NuGet.Frameworks.xml" - ] - }, - "NuGet.Packaging/3.5.0-beta2-1484": { - "sha512": "/+7d3vvCel4KhJo6AyOneg07fbAkUsy/ORgIaxW3nNdJubCXSrAdg1wfQpwzBygmErjrPcdYzzk2y2Sc6m7hwQ==", - "type": "package", - "path": "NuGet.Packaging/3.5.0-beta2-1484", - "files": [ - "NuGet.Packaging.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.Packaging.nuspec", - "lib/net45/NuGet.Packaging.dll", - "lib/net45/NuGet.Packaging.xml", - "lib/netstandard1.3/NuGet.Packaging.dll", - "lib/netstandard1.3/NuGet.Packaging.xml" - ] - }, - "NuGet.Packaging.Core/3.5.0-beta2-1484": { - "sha512": "Lsz2lgYH0mdOvuL8C3G4XLm9EaAheBOqrgLgnBNxCeLGLU+n+Zu8Lt6K1bpzgkeKyTyAhJdWbv/3lS4w7s04gw==", - "type": "package", - "path": "NuGet.Packaging.Core/3.5.0-beta2-1484", - "files": [ - "NuGet.Packaging.Core.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.Packaging.Core.nuspec", - "lib/net45/NuGet.Packaging.Core.dll", - "lib/net45/NuGet.Packaging.Core.xml", - "lib/netstandard1.3/NuGet.Packaging.Core.dll", - "lib/netstandard1.3/NuGet.Packaging.Core.xml" - ] - }, - "NuGet.Packaging.Core.Types/3.5.0-beta2-1484": { - "sha512": "4mEXZBoe/RKTDVQGwdrl/f5gqolU2d1JWjpbGdQv5EG/xQCC8IQ8FTNYzk0+ydV/vuRM1yaNe+6UQ90nGE+1kQ==", - "type": "package", - "path": "NuGet.Packaging.Core.Types/3.5.0-beta2-1484", - "files": [ - "NuGet.Packaging.Core.Types.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.Packaging.Core.Types.nuspec", - "lib/net45/NuGet.Packaging.Core.Types.dll", - "lib/net45/NuGet.Packaging.Core.Types.xml", - "lib/netstandard1.3/NuGet.Packaging.Core.Types.dll", - "lib/netstandard1.3/NuGet.Packaging.Core.Types.xml" - ] - }, - "NuGet.RuntimeModel/3.5.0-beta2-1484": { - "sha512": "vg29WbKcExD9AJrKMr7NB9pnp+0MTAcDHB6gFHCqRynSo6jgjC8q+ZPAlxC115rQiO8fqzOEP59Q8hx20anUtA==", - "type": "package", - "path": "NuGet.RuntimeModel/3.5.0-beta2-1484", - "files": [ - "NuGet.RuntimeModel.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.RuntimeModel.nuspec", - "lib/net45/NuGet.RuntimeModel.dll", - "lib/net45/NuGet.RuntimeModel.xml", - "lib/netstandard1.3/NuGet.RuntimeModel.dll", - "lib/netstandard1.3/NuGet.RuntimeModel.xml" - ] - }, - "NuGet.Versioning/3.5.0-beta2-1484": { - "sha512": "Stok+SI5lWxOkTgZZM7jT4xuAZogm5+j85mKJeHSXb8o0OAbB+qDX9jkdM2wIEnjoR8R29J0nQYwk2Kl2lWFpA==", - "type": "package", - "path": "NuGet.Versioning/3.5.0-beta2-1484", - "files": [ - "NuGet.Versioning.3.5.0-beta2-1484.nupkg.sha512", - "NuGet.Versioning.nuspec", - "lib/net45/NuGet.Versioning.dll", - "lib/net45/NuGet.Versioning.xml", - "lib/netstandard1.0/NuGet.Versioning.dll", - "lib/netstandard1.0/NuGet.Versioning.xml" - ] - }, - "NUnit/3.6.0": { - "sha512": "mqJP3DI3mE9YSx0o7R5loyIm0NnLJLSl2lmXn84gSkOmLWzlbrxS0oW/cCZF25tB+6Anday/mbkRUXmdvEvSCg==", - "type": "package", - "path": "NUnit/3.6.0", - "files": [ - "CHANGES.txt", - "LICENSE.txt", - "NOTICES.txt", - "lib/MonoAndroid/nunit.framework.dll", - "lib/MonoAndroid/nunit.framework.xml", - "lib/Xamarin.iOS10/nunit.framework.dll", - "lib/Xamarin.iOS10/nunit.framework.xml", - "lib/net20/NUnit.System.Linq.dll", - "lib/net20/nunit.framework.dll", - "lib/net20/nunit.framework.xml", - "lib/net35/nunit.framework.dll", - "lib/net35/nunit.framework.xml", - "lib/net40/nunit.framework.dll", - "lib/net40/nunit.framework.xml", - "lib/net45/nunit.framework.dll", - "lib/net45/nunit.framework.xml", - "lib/netstandard1.6/nunit.framework.dll", - "lib/netstandard1.6/nunit.framework.xml", - "lib/portable-net45+win8+wp8+wpa81/nunit.framework.dll", - "lib/portable-net45+win8+wp8+wpa81/nunit.framework.xml", - "nunit.3.6.0.nupkg.sha512", - "nunit.nuspec" - ] - }, - "NUnit.Portable.Agent/3.4.0-beta-3": { - "sha512": "BcgxOFtivkK8+eu5krwxxTWw6RtASfp7q/nQ18Z5a2rEvDHZz9h+U2fJjIrw4P9CtqbzZwNuGHprUnhoVqlZrw==", - "type": "package", - "path": "NUnit.Portable.Agent/3.4.0-beta-3", - "files": [ - "NUnit.Portable.Agent.3.4.0-beta-3.nupkg.sha512", - "NUnit.Portable.Agent.nuspec", - "lib/net45/NUnit.Portable.Agent.dll", - "lib/netstandard1.3/NUnit.Portable.Agent.dll" - ] - }, - "runtime.any.System.Collections/4.3.0": { - "sha512": "23g6rqftKmovn2cLeGsuHUYm0FD7pdutb0uQMJpZ3qTvq+zHkgmt6J65VtRry4WDGYlmkMa4xDACtaQ94alNag==", - "type": "package", - "path": "runtime.any.System.Collections/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Collections.dll", - "lib/netstandard1.3/System.Collections.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Collections.4.3.0.nupkg.sha512", - "runtime.any.System.Collections.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Diagnostics.Tools/4.3.0": { - "sha512": "S/GPBmfPBB48ZghLxdDR7kDAJVAqgAuThyDJho3OLP5OS4tWD2ydyL8LKm8lhiBxce10OKe9X2zZ6DUjAqEbPg==", - "type": "package", - "path": "runtime.any.System.Diagnostics.Tools/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Diagnostics.Tools.dll", - "lib/netstandard1.3/System.Diagnostics.Tools.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Diagnostics.Tools.4.3.0.nupkg.sha512", - "runtime.any.System.Diagnostics.Tools.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Diagnostics.Tracing/4.3.0": { - "sha512": "1lpifymjGDzoYIaam6/Hyqf8GhBI3xXYLK2TgEvTtuZMorG3Kb9QnMTIKhLjJYXIiu1JvxjngHvtVFQQlpQ3HQ==", - "type": "package", - "path": "runtime.any.System.Diagnostics.Tracing/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Diagnostics.Tracing.dll", - "lib/netstandard1.5/System.Diagnostics.Tracing.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Diagnostics.Tracing.4.3.0.nupkg.sha512", - "runtime.any.System.Diagnostics.Tracing.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Globalization/4.3.0": { - "sha512": "sMDBnad4rp4t7GY442Jux0MCUuKL4otn5BK6Ni0ARTXTSpRNBzZ7hpMfKSvnVSED5kYJm96YOWsqV0JH0d2uuw==", - "type": "package", - "path": "runtime.any.System.Globalization/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Globalization.dll", - "lib/netstandard1.3/System.Globalization.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Globalization.4.3.0.nupkg.sha512", - "runtime.any.System.Globalization.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Globalization.Calendars/4.3.0": { - "sha512": "M1r+760j1CNA6M/ZaW6KX8gOS8nxPRqloqDcJYVidRG566Ykwcs29AweZs2JF+nMOCgWDiMfPSTMfvwOI9F77w==", - "type": "package", - "path": "runtime.any.System.Globalization.Calendars/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net/_._", - "lib/netcore50/System.Globalization.Calendars.dll", - "lib/netstandard1.3/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Globalization.Calendars.4.3.0.nupkg.sha512", - "runtime.any.System.Globalization.Calendars.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.IO/4.3.0": { - "sha512": "SDZ5AD1DtyRoxYtEcqQ3HDlcrorMYXZeCt7ZhG9US9I5Vva+gpIWDGMkcwa5XiKL0ceQKRZIX2x0XEjLX7PDzQ==", - "type": "package", - "path": "runtime.any.System.IO/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.IO.dll", - "lib/netstandard1.5/System.IO.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.IO.4.3.0.nupkg.sha512", - "runtime.any.System.IO.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Reflection/4.3.0": { - "sha512": "hLC3A3rI8jipR5d9k7+f0MgRCW6texsAp0MWkN/ci18FMtQ9KH7E2vDn/DH2LkxsszlpJpOn9qy6Z6/69rH6eQ==", - "type": "package", - "path": "runtime.any.System.Reflection/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.dll", - "lib/netstandard1.5/System.Reflection.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Reflection.4.3.0.nupkg.sha512", - "runtime.any.System.Reflection.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Reflection.Extensions/4.3.0": { - "sha512": "cPhT+Vqu52+cQQrDai/V91gubXUnDKNRvlBnH+hOgtGyHdC17aQIU64EaehwAQymd7kJA5rSrVRNfDYrbhnzyA==", - "type": "package", - "path": "runtime.any.System.Reflection.Extensions/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Extensions.dll", - "lib/netstandard1.3/System.Reflection.Extensions.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Reflection.Extensions.4.3.0.nupkg.sha512", - "runtime.any.System.Reflection.Extensions.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Reflection.Primitives/4.3.0": { - "sha512": "Nrm1p3armp6TTf2xuvaa+jGTTmncALWFq22CpmwRvhDf6dE9ZmH40EbOswD4GnFLrMRS0Ki6Kx5aUPmKK/hZBg==", - "type": "package", - "path": "runtime.any.System.Reflection.Primitives/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Primitives.dll", - "lib/netstandard1.3/System.Reflection.Primitives.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Reflection.Primitives.4.3.0.nupkg.sha512", - "runtime.any.System.Reflection.Primitives.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Resources.ResourceManager/4.3.0": { - "sha512": "Lxb89SMvf8w9p9+keBLyL6H6x/TEmc6QVsIIA0T36IuyOY3kNvIdyGddA2qt35cRamzxF8K5p0Opq4G4HjNbhQ==", - "type": "package", - "path": "runtime.any.System.Resources.ResourceManager/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Resources.ResourceManager.dll", - "lib/netstandard1.3/System.Resources.ResourceManager.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Resources.ResourceManager.4.3.0.nupkg.sha512", - "runtime.any.System.Resources.ResourceManager.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Runtime/4.3.0": { - "sha512": "fRS7zJgaG9NkifaAxGGclDDoRn9HC7hXACl52Or06a/fxdzDajWb5wov3c6a+gVSlekRoexfjwQSK9sh5um5LQ==", - "type": "package", - "path": "runtime.any.System.Runtime/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.dll", - "lib/netstandard1.5/System.Runtime.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Runtime.4.3.0.nupkg.sha512", - "runtime.any.System.Runtime.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Runtime.Handles/4.3.0": { - "sha512": "GG84X6vufoEzqx8PbeBKheE4srOhimv+yLtGb/JkR3Y2FmoqmueLNFU4Xx8Y67plFpltQSdK74x0qlEhIpv/CQ==", - "type": "package", - "path": "runtime.any.System.Runtime.Handles/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netstandard1.3/System.Runtime.Handles.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Runtime.Handles.4.3.0.nupkg.sha512", - "runtime.any.System.Runtime.Handles.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Runtime.InteropServices/4.3.0": { - "sha512": "lBoFeQfxe/4eqjPi46E0LU/YaCMdNkQ8B4MZu/mkzdIAZh8RQ1NYZSj0egrQKdgdvlPFtP4STtob40r4o2DBAw==", - "type": "package", - "path": "runtime.any.System.Runtime.InteropServices/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.InteropServices.dll", - "lib/netstandard1.5/System.Runtime.InteropServices.dll", - "lib/netstandard1.6/System.Runtime.InteropServices.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Runtime.InteropServices.4.3.0.nupkg.sha512", - "runtime.any.System.Runtime.InteropServices.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Text.Encoding/4.3.0": { - "sha512": "+ihI5VaXFCMVPJNstG4O4eo1CfbrByLxRrQQTqOTp1ttK0kUKDqOdBSTaCB2IBk/QtjDrs6+x4xuezyMXdm0HQ==", - "type": "package", - "path": "runtime.any.System.Text.Encoding/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Text.Encoding.dll", - "lib/netstandard1.3/System.Text.Encoding.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Text.Encoding.4.3.0.nupkg.sha512", - "runtime.any.System.Text.Encoding.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Text.Encoding.Extensions/4.3.0": { - "sha512": "NLrxmLsfRrOuVqPWG+2lrQZnE53MLVeo+w9c54EV+TUo4c8rILpsDXfY8pPiOy9kHpUHHP07ugKmtsU3vVW5Jg==", - "type": "package", - "path": "runtime.any.System.Text.Encoding.Extensions/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Text.Encoding.Extensions.dll", - "lib/netstandard1.3/System.Text.Encoding.Extensions.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Text.Encoding.Extensions.4.3.0.nupkg.sha512", - "runtime.any.System.Text.Encoding.Extensions.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Threading.Tasks/4.3.0": { - "sha512": "OhBAVBQG5kFj1S+hCEQ3TUHBAEtZ3fbEMgZMRNdN8A0Pj4x+5nTELEqL59DU0TjKVE6II3dqKw4Dklb3szT65w==", - "type": "package", - "path": "runtime.any.System.Threading.Tasks/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.Tasks.dll", - "lib/netstandard1.3/System.Threading.Tasks.dll", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Threading.Tasks.4.3.0.nupkg.sha512", - "runtime.any.System.Threading.Tasks.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.any.System.Threading.Timer/4.3.0": { - "sha512": "w4ehZJ+AwXYmGwYu+rMvym6RvMaRiUEQR1u6dwcyuKHxz8Heu/mO9AG1MquEgTyucnhv3M43X0iKpDOoN17C0w==", - "type": "package", - "path": "runtime.any.System.Threading.Timer/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.Timer.dll", - "lib/netstandard1.3/System.Threading.Timer.dll", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/netstandard/_._", - "runtime.any.System.Threading.Timer.4.3.0.nupkg.sha512", - "runtime.any.System.Threading.Timer.nuspec", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", - "type": "package", - "path": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", - "type": "package", - "path": "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", - "type": "package", - "path": "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.native.System/4.3.0": { - "sha512": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "type": "package", - "path": "runtime.native.System/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.4.3.0.nupkg.sha512", - "runtime.native.System.nuspec" - ] - }, - "runtime.native.System.IO.Compression/4.3.0": { - "sha512": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "type": "package", - "path": "runtime.native.System.IO.Compression/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.IO.Compression.4.3.0.nupkg.sha512", - "runtime.native.System.IO.Compression.nuspec" - ] - }, - "runtime.native.System.Net.Http/4.3.0": { - "sha512": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "type": "package", - "path": "runtime.native.System.Net.Http/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Net.Http.4.3.0.nupkg.sha512", - "runtime.native.System.Net.Http.nuspec" - ] - }, - "runtime.native.System.Net.Security/4.0.1": { - "sha512": "Az6Ff6rZFb8nYGAaejFR6jr8ktt9f3e1Q/yKdw0pwHNTLaO/1eCAC9vzBoR9YAb0QeZD6fZXl1A9tRB5stpzXA==", - "type": "package", - "path": "runtime.native.System.Net.Security/4.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Net.Security.4.0.1.nupkg.sha512", - "runtime.native.System.Net.Security.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography/4.0.0": { - "sha512": "2CQK0jmO6Eu7ZeMgD+LOFbNJSXHFVQbCJJkEyEwowh1SCgYnrn9W9RykMfpeeVGw7h4IBvYikzpGUlmZTUafJw==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography/4.0.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.4.0.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography.Apple/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.Apple.4.3.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.Apple.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "type": "package", - "path": "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.native.System.Security.Cryptography.OpenSsl.nuspec" - ] - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", - "type": "package", - "path": "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", - "type": "package", - "path": "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib" - ] - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", - "type": "package", - "path": "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", - "type": "package", - "path": "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", - "type": "package", - "path": "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", - "type": "package", - "path": "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl.nuspec", - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.win.Microsoft.Win32.Primitives/4.3.0": { - "sha512": "NU51SEt/ZaD2MF48sJ17BIqx7rjeNNLXUevfMOjqQIetdndXwYjZfZsT6jD+rSWp/FYxjesdK4xUSl4OTEI0jw==", - "type": "package", - "path": "runtime.win.Microsoft.Win32.Primitives/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.Microsoft.Win32.Primitives.4.3.0.nupkg.sha512", - "runtime.win.Microsoft.Win32.Primitives.nuspec", - "runtimes/win/lib/net/_._", - "runtimes/win/lib/netstandard1.3/Microsoft.Win32.Primitives.dll" - ] - }, - "runtime.win.System.Console/4.3.0": { - "sha512": "RRACWygml5dnmfgC1SW6tLGsFgwsUAKFtvhdyHnIEz4EhWyrd7pacDdY95CacQJy7BMXRDRCejC9aCRC0Y1sQA==", - "type": "package", - "path": "runtime.win.System.Console/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.System.Console.4.3.0.nupkg.sha512", - "runtime.win.System.Console.nuspec", - "runtimes/win/lib/net/_._", - "runtimes/win/lib/netcore50/System.Console.dll", - "runtimes/win/lib/netstandard1.3/System.Console.dll" - ] - }, - "runtime.win.System.Diagnostics.Debug/4.3.0": { - "sha512": "hHHP0WCStene2jjeYcuDkETozUYF/3sHVRHAEOgS3L15hlip24ssqCTnJC28Z03Wpo078oMcJd0H4egD2aJI8g==", - "type": "package", - "path": "runtime.win.System.Diagnostics.Debug/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.System.Diagnostics.Debug.4.3.0.nupkg.sha512", - "runtime.win.System.Diagnostics.Debug.nuspec", - "runtimes/aot/lib/netcore50/System.Diagnostics.Debug.dll", - "runtimes/win/lib/net45/_._", - "runtimes/win/lib/netcore50/System.Diagnostics.Debug.dll", - "runtimes/win/lib/netstandard1.3/System.Diagnostics.Debug.dll", - "runtimes/win/lib/win8/_._", - "runtimes/win/lib/wp80/_._", - "runtimes/win/lib/wpa81/_._" - ] - }, - "runtime.win.System.IO.FileSystem/4.3.0": { - "sha512": "Z37zcSCpXuGCYtFbqYO0TwOVXxS2d+BXgSoDFZmRg8BC4Cuy54edjyIvhhcfCrDQA9nl+EPFTgHN54dRAK7mNA==", - "type": "package", - "path": "runtime.win.System.IO.FileSystem/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.System.IO.FileSystem.4.3.0.nupkg.sha512", - "runtime.win.System.IO.FileSystem.nuspec", - "runtimes/win/lib/net/_._", - "runtimes/win/lib/netcore50/System.IO.FileSystem.dll", - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.dll", - "runtimes/win/lib/win8/_._", - "runtimes/win/lib/wp8/_._", - "runtimes/win/lib/wpa81/_._" - ] - }, - "runtime.win.System.Net.Primitives/4.3.0": { - "sha512": "lkXXykakvXUU+Zq2j0pC6EO20lEhijjqMc01XXpp1CJN+DeCwl3nsj4t5Xbpz3kA7yQyTqw6d9SyIzsyLsV3zA==", - "type": "package", - "path": "runtime.win.System.Net.Primitives/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.System.Net.Primitives.4.3.0.nupkg.sha512", - "runtime.win.System.Net.Primitives.nuspec", - "runtimes/win/lib/net/_._", - "runtimes/win/lib/netcore50/System.Net.Primitives.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Primitives.dll" - ] - }, - "runtime.win.System.Net.Sockets/4.3.0": { - "sha512": "FK/2gX6MmuLIKNCGsV59Fe4IYrLrI5n9pQ1jh477wiivEM/NCXDT2dRetH5FSfY0bQ+VgTLcS3zcmjQ8my3nxQ==", - "type": "package", - "path": "runtime.win.System.Net.Sockets/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.System.Net.Sockets.4.3.0.nupkg.sha512", - "runtime.win.System.Net.Sockets.nuspec", - "runtimes/win/lib/net/_._", - "runtimes/win/lib/netcore50/System.Net.Sockets.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Sockets.dll" - ] - }, - "runtime.win.System.Runtime.Extensions/4.3.0": { - "sha512": "RkgHVhUPvzZxuUubiZe8yr/6CypRVXj0VBzaR8hsqQ8f+rUo7e4PWrHTLOCjd8fBMGWCrY//fi7Ku3qXD7oHRw==", - "type": "package", - "path": "runtime.win.System.Runtime.Extensions/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win.System.Runtime.Extensions.4.3.0.nupkg.sha512", - "runtime.win.System.Runtime.Extensions.nuspec", - "runtimes/aot/lib/netcore50/System.Runtime.Extensions.dll", - "runtimes/win/lib/net/_._", - "runtimes/win/lib/netcore50/System.Runtime.Extensions.dll", - "runtimes/win/lib/netstandard1.5/System.Runtime.Extensions.dll" - ] - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHost/1.0.1": { - "sha512": "Uey9m9vV2yOdZ7Gs+Lzxuy9+N7iv2gMlt2aG3HLS1FeWqhw+CTuOyKnOn3hqZ4M9YNsseSq2h7HC+6RZuh/42w==", - "type": "package", - "path": "runtime.win7-x64.Microsoft.NETCore.DotNetHost/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.win7-x64.Microsoft.NETCore.DotNetHost.1.0.1.nupkg.sha512", - "runtime.win7-x64.Microsoft.NETCore.DotNetHost.nuspec", - "runtimes/win7-x64/native/dotnet.exe", - "version.txt" - ] - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy/1.0.1": { - "sha512": "kRifi+XIuUv5DZwIphXJTzMY6rXKbv5RmAXNNLF/97Is77eW3foMRdZ6wViw22YRdzZ8g4rAYXxl8nTMrfKh/A==", - "type": "package", - "path": "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy.1.0.1.nupkg.sha512", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostPolicy.nuspec", - "runtimes/win7-x64/native/hostpolicy.dll", - "version.txt" - ] - }, - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver/1.0.1": { - "sha512": "pMi8x4uTaFCXTO33c8yF5OJSkAV5FZZylYVoSBvWaLuKe8tqLxME1G8W+1Jw6ZHIl3k4+vGMMvZt1YpJbpJaMg==", - "type": "package", - "path": "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver.1.0.1.nupkg.sha512", - "runtime.win7-x64.Microsoft.NETCore.DotNetHostResolver.nuspec", - "runtimes/win7-x64/native/hostfxr.dll", - "version.txt" - ] - }, - "runtime.win7-x64.Microsoft.NETCore.Jit/1.0.4": { - "sha512": "x5CokVDl/gul8A3mfzyvJr+YvDNByTn/XTh3V4QT46EXjFfF45jDBrwRdRCLyIIp05Or5w9GkU+yjXRFnPO85w==", - "type": "package", - "path": "runtime.win7-x64.Microsoft.NETCore.Jit/1.0.4", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.win7-x64.Microsoft.NETCore.Jit.1.0.4.nupkg.sha512", - "runtime.win7-x64.Microsoft.NETCore.Jit.nuspec", - "runtimes/win7-x64-aot/native/_._", - "runtimes/win7-x64/native/clrjit.dll" - ] - }, - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR/1.0.4": { - "sha512": "xk70lt1wyb5Elwc+BaOVWfcFms4W8njKwUIDCeOC3xGPFVdEdME4F1cl5u/XZUrKqxamgQCAEjo+VypNQWnQ9A==", - "type": "package", - "path": "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR/1.0.4", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard1.0/_._", - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR.1.0.4.nupkg.sha512", - "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR.nuspec", - "runtimes/win7-x64-aot/lib/netstandard1.0/_._", - "runtimes/win7-x64-aot/native/_._", - "runtimes/win7-x64/lib/netstandard1.0/System.Private.CoreLib.dll", - "runtimes/win7-x64/lib/netstandard1.0/mscorlib.dll", - "runtimes/win7-x64/native/System.Private.CoreLib.ni.dll", - "runtimes/win7-x64/native/clretwrc.dll", - "runtimes/win7-x64/native/coreclr.dll", - "runtimes/win7-x64/native/dbgshim.dll", - "runtimes/win7-x64/native/mscordaccore.dll", - "runtimes/win7-x64/native/mscordbi.dll", - "runtimes/win7-x64/native/mscorlib.ni.dll", - "runtimes/win7-x64/native/mscorrc.debug.dll", - "runtimes/win7-x64/native/mscorrc.dll", - "runtimes/win7-x64/native/sos.dll", - "tools/crossgen.exe" - ] - }, - "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets/1.0.1": { - "sha512": "jlT1ClqaOhEfpLpPU3iNpbmHnoPBe+T01509Q+tlxnax7ZXUsY6L22Vow6jj2koYY9u1GR6g6/UJXZRQihDAvw==", - "type": "package", - "path": "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets/1.0.1", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets.1.0.1.nupkg.sha512", - "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets.nuspec", - "runtimes/win7-x64/native/API-MS-Win-Base-Util-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-Kernel32-Private-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-Kernel32-Private-L1-1-1.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-Kernel32-Private-L1-1-2.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-PrivateProfile-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-ProcessTopology-Obsolete-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-String-L2-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Core-StringAnsi-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-EventLog-Legacy-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Eventing-ClassicProvider-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Eventing-Consumer-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Eventing-Controller-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Eventing-Legacy-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Eventing-Provider-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-Security-LsaPolicy-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-devices-config-L1-1-0.dll", - "runtimes/win7-x64/native/API-MS-Win-devices-config-L1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-com-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-com-private-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-comm-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-console-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-console-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-datetime-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-datetime-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-debug-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-debug-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-delayload-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-errorhandling-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-errorhandling-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-fibers-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-fibers-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-file-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-file-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-file-l1-2-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-file-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-file-l2-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-handle-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-heap-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-heap-obsolete-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-interlocked-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-io-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-io-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-kernel32-legacy-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-kernel32-legacy-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-kernel32-legacy-l1-1-2.dll", - "runtimes/win7-x64/native/api-ms-win-core-libraryloader-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-libraryloader-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-localization-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-localization-l1-2-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-localization-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-localization-obsolete-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-2.dll", - "runtimes/win7-x64/native/api-ms-win-core-memory-l1-1-3.dll", - "runtimes/win7-x64/native/api-ms-win-core-namedpipe-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-namedpipe-l1-2-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-normalization-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-privateprofile-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-processenvironment-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-processenvironment-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-processsecurity-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-processthreads-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-processthreads-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-processthreads-l1-1-2.dll", - "runtimes/win7-x64/native/api-ms-win-core-profile-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-psapi-ansi-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-psapi-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-psapi-obsolete-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-realtime-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-registry-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-registry-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-rtlsupport-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-shlwapi-legacy-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-shlwapi-obsolete-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-shutdown-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-shutdown-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-string-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-string-obsolete-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-string-obsolete-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-stringloader-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-stringloader-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-synch-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-synch-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-2.dll", - "runtimes/win7-x64/native/api-ms-win-core-sysinfo-l1-2-3.dll", - "runtimes/win7-x64/native/api-ms-win-core-threadpool-l1-2-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-threadpool-legacy-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-threadpool-private-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-timezone-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-url-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-util-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-version-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-error-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-error-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-registration-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-robuffer-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-roparameterizediid-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-winrt-string-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-wow64-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-xstate-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-core-xstate-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-ro-typeresolution-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-security-base-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-security-cpwl-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-security-cryptoapi-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-security-lsalookup-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-security-lsalookup-l2-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-security-provider-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-security-sddl-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-service-core-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-service-core-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-service-management-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-service-management-l2-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-service-private-l1-1-0.dll", - "runtimes/win7-x64/native/api-ms-win-service-private-l1-1-1.dll", - "runtimes/win7-x64/native/api-ms-win-service-winsvc-l1-1-0.dll", - "runtimes/win7-x64/native/ext-ms-win-advapi32-encryptedfile-l1-1-0.dll", - "runtimes/win7-x64/native/ext-ms-win-ntuser-keyboard-l1-2-1.dll" - ] - }, - "runtime.win7-x64.runtime.native.System.IO.Compression/4.3.0": { - "sha512": "UamDlgSO/nIzc96M+g3wbvAGbAuXjvRYR5Ttm/FVJgt2iva8ouOqSJ0j6eGI7pZDLvD/ZISl9XRZOajE/Xvizg==", - "type": "package", - "path": "runtime.win7-x64.runtime.native.System.IO.Compression/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.win7-x64.runtime.native.System.IO.Compression.4.3.0.nupkg.sha512", - "runtime.win7-x64.runtime.native.System.IO.Compression.nuspec", - "runtimes/win7-x64/native/clrcompression.dll" - ] - }, - "runtime.win7.System.Private.Uri/4.3.0": { - "sha512": "Q+IBgaPYicSQs2tBlmXqbS25c/JLIthWrgrpMwxKSOobW/OqIMVFruUGfuaz4QABVzV8iKdCAbN7APY7Tclbnw==", - "type": "package", - "path": "runtime.win7.System.Private.Uri/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._", - "runtime.win7.System.Private.Uri.4.3.0.nupkg.sha512", - "runtime.win7.System.Private.Uri.nuspec", - "runtimes/aot/lib/netcore50/System.Private.Uri.dll", - "runtimes/win/lib/netcore50/System.Private.Uri.dll", - "runtimes/win/lib/netstandard1.0/System.Private.Uri.dll" - ] - }, - "System.AppContext/4.3.0": { - "sha512": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "type": "package", - "path": "System.AppContext/4.3.0", - "files": [ - "System.AppContext.4.3.0.nupkg.sha512", - "System.AppContext.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/net463/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/netstandard1.6/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.AppContext.dll", - "ref/net463/System.AppContext.dll", - "ref/netstandard/_._", - "ref/netstandard1.3/System.AppContext.dll", - "ref/netstandard1.3/System.AppContext.xml", - "ref/netstandard1.3/de/System.AppContext.xml", - "ref/netstandard1.3/es/System.AppContext.xml", - "ref/netstandard1.3/fr/System.AppContext.xml", - "ref/netstandard1.3/it/System.AppContext.xml", - "ref/netstandard1.3/ja/System.AppContext.xml", - "ref/netstandard1.3/ko/System.AppContext.xml", - "ref/netstandard1.3/ru/System.AppContext.xml", - "ref/netstandard1.3/zh-hans/System.AppContext.xml", - "ref/netstandard1.3/zh-hant/System.AppContext.xml", - "ref/netstandard1.6/System.AppContext.dll", - "ref/netstandard1.6/System.AppContext.xml", - "ref/netstandard1.6/de/System.AppContext.xml", - "ref/netstandard1.6/es/System.AppContext.xml", - "ref/netstandard1.6/fr/System.AppContext.xml", - "ref/netstandard1.6/it/System.AppContext.xml", - "ref/netstandard1.6/ja/System.AppContext.xml", - "ref/netstandard1.6/ko/System.AppContext.xml", - "ref/netstandard1.6/ru/System.AppContext.xml", - "ref/netstandard1.6/zh-hans/System.AppContext.xml", - "ref/netstandard1.6/zh-hant/System.AppContext.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.AppContext.dll" - ] - }, - "System.Buffers/4.3.0": { - "sha512": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "type": "package", - "path": "System.Buffers/4.3.0", - "files": [ - "System.Buffers.4.3.0.nupkg.sha512", - "System.Buffers.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/.xml", - "lib/netstandard1.1/System.Buffers.dll" - ] - }, - "System.Collections/4.3.0": { - "sha512": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "type": "package", - "path": "System.Collections/4.3.0", - "files": [ - "System.Collections.4.3.0.nupkg.sha512", - "System.Collections.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.dll", - "ref/netcore50/System.Collections.xml", - "ref/netcore50/de/System.Collections.xml", - "ref/netcore50/es/System.Collections.xml", - "ref/netcore50/fr/System.Collections.xml", - "ref/netcore50/it/System.Collections.xml", - "ref/netcore50/ja/System.Collections.xml", - "ref/netcore50/ko/System.Collections.xml", - "ref/netcore50/ru/System.Collections.xml", - "ref/netcore50/zh-hans/System.Collections.xml", - "ref/netcore50/zh-hant/System.Collections.xml", - "ref/netstandard1.0/System.Collections.dll", - "ref/netstandard1.0/System.Collections.xml", - "ref/netstandard1.0/de/System.Collections.xml", - "ref/netstandard1.0/es/System.Collections.xml", - "ref/netstandard1.0/fr/System.Collections.xml", - "ref/netstandard1.0/it/System.Collections.xml", - "ref/netstandard1.0/ja/System.Collections.xml", - "ref/netstandard1.0/ko/System.Collections.xml", - "ref/netstandard1.0/ru/System.Collections.xml", - "ref/netstandard1.0/zh-hans/System.Collections.xml", - "ref/netstandard1.0/zh-hant/System.Collections.xml", - "ref/netstandard1.3/System.Collections.dll", - "ref/netstandard1.3/System.Collections.xml", - "ref/netstandard1.3/de/System.Collections.xml", - "ref/netstandard1.3/es/System.Collections.xml", - "ref/netstandard1.3/fr/System.Collections.xml", - "ref/netstandard1.3/it/System.Collections.xml", - "ref/netstandard1.3/ja/System.Collections.xml", - "ref/netstandard1.3/ko/System.Collections.xml", - "ref/netstandard1.3/ru/System.Collections.xml", - "ref/netstandard1.3/zh-hans/System.Collections.xml", - "ref/netstandard1.3/zh-hant/System.Collections.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Concurrent/4.3.0": { - "sha512": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "type": "package", - "path": "System.Collections.Concurrent/4.3.0", - "files": [ - "System.Collections.Concurrent.4.3.0.nupkg.sha512", - "System.Collections.Concurrent.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Collections.Concurrent.dll", - "lib/netstandard1.3/System.Collections.Concurrent.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.Concurrent.dll", - "ref/netcore50/System.Collections.Concurrent.xml", - "ref/netcore50/de/System.Collections.Concurrent.xml", - "ref/netcore50/es/System.Collections.Concurrent.xml", - "ref/netcore50/fr/System.Collections.Concurrent.xml", - "ref/netcore50/it/System.Collections.Concurrent.xml", - "ref/netcore50/ja/System.Collections.Concurrent.xml", - "ref/netcore50/ko/System.Collections.Concurrent.xml", - "ref/netcore50/ru/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hans/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.1/System.Collections.Concurrent.dll", - "ref/netstandard1.1/System.Collections.Concurrent.xml", - "ref/netstandard1.1/de/System.Collections.Concurrent.xml", - "ref/netstandard1.1/es/System.Collections.Concurrent.xml", - "ref/netstandard1.1/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.1/it/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.3/System.Collections.Concurrent.dll", - "ref/netstandard1.3/System.Collections.Concurrent.xml", - "ref/netstandard1.3/de/System.Collections.Concurrent.xml", - "ref/netstandard1.3/es/System.Collections.Concurrent.xml", - "ref/netstandard1.3/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.3/it/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hant/System.Collections.Concurrent.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Collections.Immutable/1.2.0": { - "sha512": "Cma8cBW6di16ZLibL8LYQ+cLjGzoKxpOTu/faZfDcx94ZjAGq6Nv5RO7+T1YZXqEXTZP9rt1wLVEONVpURtUqw==", - "type": "package", - "path": "System.Collections.Immutable/1.2.0", - "files": [ - "System.Collections.Immutable.1.2.0.nupkg.sha512", - "System.Collections.Immutable.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Collections.Immutable.dll", - "lib/netstandard1.0/System.Collections.Immutable.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" - ] - }, - "System.ComponentModel/4.0.1": { - "sha512": "oBZFnm7seFiVfugsIyOvQCWobNZs7FzqDV/B7tx20Ep/l3UUFCPDkdTnCNaJZTU27zjeODmy2C/cP60u3D4c9w==", - "type": "package", - "path": "System.ComponentModel/4.0.1", - "files": [ - "System.ComponentModel.4.0.1.nupkg.sha512", - "System.ComponentModel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ComponentModel.dll", - "lib/netstandard1.3/System.ComponentModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ComponentModel.dll", - "ref/netcore50/System.ComponentModel.xml", - "ref/netcore50/de/System.ComponentModel.xml", - "ref/netcore50/es/System.ComponentModel.xml", - "ref/netcore50/fr/System.ComponentModel.xml", - "ref/netcore50/it/System.ComponentModel.xml", - "ref/netcore50/ja/System.ComponentModel.xml", - "ref/netcore50/ko/System.ComponentModel.xml", - "ref/netcore50/ru/System.ComponentModel.xml", - "ref/netcore50/zh-hans/System.ComponentModel.xml", - "ref/netcore50/zh-hant/System.ComponentModel.xml", - "ref/netstandard1.0/System.ComponentModel.dll", - "ref/netstandard1.0/System.ComponentModel.xml", - "ref/netstandard1.0/de/System.ComponentModel.xml", - "ref/netstandard1.0/es/System.ComponentModel.xml", - "ref/netstandard1.0/fr/System.ComponentModel.xml", - "ref/netstandard1.0/it/System.ComponentModel.xml", - "ref/netstandard1.0/ja/System.ComponentModel.xml", - "ref/netstandard1.0/ko/System.ComponentModel.xml", - "ref/netstandard1.0/ru/System.ComponentModel.xml", - "ref/netstandard1.0/zh-hans/System.ComponentModel.xml", - "ref/netstandard1.0/zh-hant/System.ComponentModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.ComponentModel.Annotations/4.1.0": { - "sha512": "rhnz80h8NnHJzoi0nbQJLRR2cJznyqG168q1bgoSpe5qpaME2SguXzuEzpY68nFCi2kBgHpbU4bRN2cP3unYRA==", - "type": "package", - "path": "System.ComponentModel.Annotations/4.1.0", - "files": [ - "System.ComponentModel.Annotations.4.1.0.nupkg.sha512", - "System.ComponentModel.Annotations.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net461/System.ComponentModel.Annotations.dll", - "lib/netcore50/System.ComponentModel.Annotations.dll", - "lib/netstandard1.4/System.ComponentModel.Annotations.dll", - "lib/portable-net45+win8/_._", - "lib/win8/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net461/System.ComponentModel.Annotations.dll", - "ref/netcore50/System.ComponentModel.Annotations.dll", - "ref/netcore50/System.ComponentModel.Annotations.xml", - "ref/netcore50/de/System.ComponentModel.Annotations.xml", - "ref/netcore50/es/System.ComponentModel.Annotations.xml", - "ref/netcore50/fr/System.ComponentModel.Annotations.xml", - "ref/netcore50/it/System.ComponentModel.Annotations.xml", - "ref/netcore50/ja/System.ComponentModel.Annotations.xml", - "ref/netcore50/ko/System.ComponentModel.Annotations.xml", - "ref/netcore50/ru/System.ComponentModel.Annotations.xml", - "ref/netcore50/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netcore50/zh-hant/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/System.ComponentModel.Annotations.dll", - "ref/netstandard1.1/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/de/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/es/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/fr/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/it/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/ja/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/ko/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/ru/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netstandard1.1/zh-hant/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/System.ComponentModel.Annotations.dll", - "ref/netstandard1.3/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/de/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/es/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/fr/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/it/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/ja/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/ko/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/ru/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netstandard1.3/zh-hant/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/System.ComponentModel.Annotations.dll", - "ref/netstandard1.4/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/de/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/es/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/fr/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/it/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/ja/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/ko/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/ru/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/zh-hans/System.ComponentModel.Annotations.xml", - "ref/netstandard1.4/zh-hant/System.ComponentModel.Annotations.xml", - "ref/portable-net45+win8/_._", - "ref/win8/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Console/4.3.0": { - "sha512": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "type": "package", - "path": "System.Console/4.3.0", - "files": [ - "System.Console.4.3.0.nupkg.sha512", - "System.Console.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Console.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Console.dll", - "ref/netstandard1.3/System.Console.dll", - "ref/netstandard1.3/System.Console.xml", - "ref/netstandard1.3/de/System.Console.xml", - "ref/netstandard1.3/es/System.Console.xml", - "ref/netstandard1.3/fr/System.Console.xml", - "ref/netstandard1.3/it/System.Console.xml", - "ref/netstandard1.3/ja/System.Console.xml", - "ref/netstandard1.3/ko/System.Console.xml", - "ref/netstandard1.3/ru/System.Console.xml", - "ref/netstandard1.3/zh-hans/System.Console.xml", - "ref/netstandard1.3/zh-hant/System.Console.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Debug/4.0.11": { - "sha512": "w5U95fVKHY4G8ASs/K5iK3J5LY+/dLFd4vKejsnI/ZhBsWS9hQakfx3Zr7lRWKg4tAw9r4iktyvsTagWkqYCiw==", - "type": "package", - "path": "System.Diagnostics.Debug/4.0.11", - "files": [ - "System.Diagnostics.Debug.4.0.11.nupkg.sha512", - "System.Diagnostics.Debug.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Debug.dll", - "ref/netcore50/System.Diagnostics.Debug.xml", - "ref/netcore50/de/System.Diagnostics.Debug.xml", - "ref/netcore50/es/System.Diagnostics.Debug.xml", - "ref/netcore50/fr/System.Diagnostics.Debug.xml", - "ref/netcore50/it/System.Diagnostics.Debug.xml", - "ref/netcore50/ja/System.Diagnostics.Debug.xml", - "ref/netcore50/ko/System.Diagnostics.Debug.xml", - "ref/netcore50/ru/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/System.Diagnostics.Debug.dll", - "ref/netstandard1.0/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/System.Diagnostics.Debug.dll", - "ref/netstandard1.3/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Debug/4.3.0": { - "sha512": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "type": "package", - "path": "System.Diagnostics.Debug/4.3.0", - "files": [ - "System.Diagnostics.Debug.4.3.0.nupkg.sha512", - "System.Diagnostics.Debug.nuspec", - "ThirdPartyNotices.txt", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Debug.dll", - "ref/netcore50/System.Diagnostics.Debug.xml", - "ref/netcore50/de/System.Diagnostics.Debug.xml", - "ref/netcore50/es/System.Diagnostics.Debug.xml", - "ref/netcore50/fr/System.Diagnostics.Debug.xml", - "ref/netcore50/it/System.Diagnostics.Debug.xml", - "ref/netcore50/ja/System.Diagnostics.Debug.xml", - "ref/netcore50/ko/System.Diagnostics.Debug.xml", - "ref/netcore50/ru/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/System.Diagnostics.Debug.dll", - "ref/netstandard1.0/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/System.Diagnostics.Debug.dll", - "ref/netstandard1.3/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "sha512": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", - "type": "package", - "path": "System.Diagnostics.DiagnosticSource/4.3.0", - "files": [ - "System.Diagnostics.DiagnosticSource.4.3.0.nupkg.sha512", - "System.Diagnostics.DiagnosticSource.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Diagnostics.DiagnosticSource.dll", - "lib/net46/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.xml", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.dll", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.xml" - ] - }, - "System.Diagnostics.FileVersionInfo/4.0.0": { - "sha512": "qjF74OTAU+mRhLaL4YSfiWy3vj6T3AOz8AW37l5zCwfbBfj0k7E94XnEsRaf2TnhE/7QaV6Hvqakoy2LoV8MVg==", - "type": "package", - "path": "System.Diagnostics.FileVersionInfo/4.0.0", - "files": [ - "System.Diagnostics.FileVersionInfo.4.0.0.nupkg.sha512", - "System.Diagnostics.FileVersionInfo.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.FileVersionInfo.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Diagnostics.FileVersionInfo.dll", - "ref/netstandard1.3/System.Diagnostics.FileVersionInfo.dll", - "ref/netstandard1.3/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/de/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/es/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/fr/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/it/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/ja/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/ko/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/ru/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.FileVersionInfo.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.FileVersionInfo.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll", - "runtimes/win/lib/net46/System.Diagnostics.FileVersionInfo.dll", - "runtimes/win/lib/netcore50/System.Diagnostics.FileVersionInfo.dll", - "runtimes/win/lib/netstandard1.3/System.Diagnostics.FileVersionInfo.dll" - ] - }, - "System.Diagnostics.Process/4.1.0": { - "sha512": "mpVZ5bnlSs3tTeJ6jYyDJEIa6tavhAd88lxq1zbYhkkCu0Pno2+gHXcvZcoygq2d8JxW3gojXqNJMTAshduqZA==", - "type": "package", - "path": "System.Diagnostics.Process/4.1.0", - "files": [ - "System.Diagnostics.Process.4.1.0.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/netstandard1.3/System.Diagnostics.Process.dll", - "ref/netstandard1.3/System.Diagnostics.Process.xml", - "ref/netstandard1.3/de/System.Diagnostics.Process.xml", - "ref/netstandard1.3/es/System.Diagnostics.Process.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Process.xml", - "ref/netstandard1.3/it/System.Diagnostics.Process.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Process.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Process.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Process.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Process.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Process.xml", - "ref/netstandard1.4/System.Diagnostics.Process.dll", - "ref/netstandard1.4/System.Diagnostics.Process.xml", - "ref/netstandard1.4/de/System.Diagnostics.Process.xml", - "ref/netstandard1.4/es/System.Diagnostics.Process.xml", - "ref/netstandard1.4/fr/System.Diagnostics.Process.xml", - "ref/netstandard1.4/it/System.Diagnostics.Process.xml", - "ref/netstandard1.4/ja/System.Diagnostics.Process.xml", - "ref/netstandard1.4/ko/System.Diagnostics.Process.xml", - "ref/netstandard1.4/ru/System.Diagnostics.Process.xml", - "ref/netstandard1.4/zh-hans/System.Diagnostics.Process.xml", - "ref/netstandard1.4/zh-hant/System.Diagnostics.Process.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/linux/lib/netstandard1.4/System.Diagnostics.Process.dll", - "runtimes/osx/lib/netstandard1.4/System.Diagnostics.Process.dll", - "runtimes/win/lib/net46/System.Diagnostics.Process.dll", - "runtimes/win/lib/net461/System.Diagnostics.Process.dll", - "runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll", - "runtimes/win7/lib/netcore50/_._" - ] - }, - "System.Diagnostics.StackTrace/4.0.1": { - "sha512": "6i2EbRq0lgGfiZ+FDf0gVaw9qeEU+7IS2+wbZJmFVpvVzVOgZEt0ScZtyenuBvs6iDYbGiF51bMAa0oDP/tujQ==", - "type": "package", - "path": "System.Diagnostics.StackTrace/4.0.1", - "files": [ - "System.Diagnostics.StackTrace.4.0.1.nupkg.sha512", - "System.Diagnostics.StackTrace.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.StackTrace.dll", - "lib/netstandard1.3/System.Diagnostics.StackTrace.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Diagnostics.StackTrace.dll", - "ref/netstandard1.3/System.Diagnostics.StackTrace.dll", - "ref/netstandard1.3/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/de/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/es/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/fr/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/it/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/ja/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/ko/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/ru/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.StackTrace.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.StackTrace.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Diagnostics.StackTrace.dll" - ] - }, - "System.Diagnostics.Tools/4.3.0": { - "sha512": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "type": "package", - "path": "System.Diagnostics.Tools/4.3.0", - "files": [ - "System.Diagnostics.Tools.4.3.0.nupkg.sha512", - "System.Diagnostics.Tools.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/netcore50/de/System.Diagnostics.Tools.xml", - "ref/netcore50/es/System.Diagnostics.Tools.xml", - "ref/netcore50/fr/System.Diagnostics.Tools.xml", - "ref/netcore50/it/System.Diagnostics.Tools.xml", - "ref/netcore50/ja/System.Diagnostics.Tools.xml", - "ref/netcore50/ko/System.Diagnostics.Tools.xml", - "ref/netcore50/ru/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/System.Diagnostics.Tools.dll", - "ref/netstandard1.0/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/de/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/es/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/it/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Tools.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Diagnostics.Tracing/4.3.0": { - "sha512": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "type": "package", - "path": "System.Diagnostics.Tracing/4.3.0", - "files": [ - "System.Diagnostics.Tracing.4.3.0.nupkg.sha512", - "System.Diagnostics.Tracing.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Diagnostics.Tracing.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.xml", - "ref/netcore50/de/System.Diagnostics.Tracing.xml", - "ref/netcore50/es/System.Diagnostics.Tracing.xml", - "ref/netcore50/fr/System.Diagnostics.Tracing.xml", - "ref/netcore50/it/System.Diagnostics.Tracing.xml", - "ref/netcore50/ja/System.Diagnostics.Tracing.xml", - "ref/netcore50/ko/System.Diagnostics.Tracing.xml", - "ref/netcore50/ru/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/System.Diagnostics.Tracing.dll", - "ref/netstandard1.1/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/System.Diagnostics.Tracing.dll", - "ref/netstandard1.2/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/System.Diagnostics.Tracing.dll", - "ref/netstandard1.3/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/System.Diagnostics.Tracing.dll", - "ref/netstandard1.5/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hant/System.Diagnostics.Tracing.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Dynamic.Runtime/4.0.11": { - "sha512": "db34f6LHYM0U0JpE+sOmjar27BnqTVkbLJhgfwMpTdgTigG/Hna3m2MYVwnFzGGKnEJk2UXFuoVTr8WUbU91/A==", - "type": "package", - "path": "System.Dynamic.Runtime/4.0.11", - "files": [ - "System.Dynamic.Runtime.4.0.11.nupkg.sha512", - "System.Dynamic.Runtime.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Dynamic.Runtime.dll", - "lib/netstandard1.3/System.Dynamic.Runtime.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Dynamic.Runtime.dll", - "ref/netcore50/System.Dynamic.Runtime.xml", - "ref/netcore50/de/System.Dynamic.Runtime.xml", - "ref/netcore50/es/System.Dynamic.Runtime.xml", - "ref/netcore50/fr/System.Dynamic.Runtime.xml", - "ref/netcore50/it/System.Dynamic.Runtime.xml", - "ref/netcore50/ja/System.Dynamic.Runtime.xml", - "ref/netcore50/ko/System.Dynamic.Runtime.xml", - "ref/netcore50/ru/System.Dynamic.Runtime.xml", - "ref/netcore50/zh-hans/System.Dynamic.Runtime.xml", - "ref/netcore50/zh-hant/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/System.Dynamic.Runtime.dll", - "ref/netstandard1.0/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/de/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/es/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/fr/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/it/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ja/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ko/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ru/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/System.Dynamic.Runtime.dll", - "ref/netstandard1.3/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/de/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/es/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/fr/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/it/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ja/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ko/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ru/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Dynamic.Runtime.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Dynamic.Runtime.dll" - ] - }, - "System.Globalization/4.3.0": { - "sha512": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "type": "package", - "path": "System.Globalization/4.3.0", - "files": [ - "System.Globalization.4.3.0.nupkg.sha512", - "System.Globalization.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Globalization.dll", - "ref/netcore50/System.Globalization.xml", - "ref/netcore50/de/System.Globalization.xml", - "ref/netcore50/es/System.Globalization.xml", - "ref/netcore50/fr/System.Globalization.xml", - "ref/netcore50/it/System.Globalization.xml", - "ref/netcore50/ja/System.Globalization.xml", - "ref/netcore50/ko/System.Globalization.xml", - "ref/netcore50/ru/System.Globalization.xml", - "ref/netcore50/zh-hans/System.Globalization.xml", - "ref/netcore50/zh-hant/System.Globalization.xml", - "ref/netstandard1.0/System.Globalization.dll", - "ref/netstandard1.0/System.Globalization.xml", - "ref/netstandard1.0/de/System.Globalization.xml", - "ref/netstandard1.0/es/System.Globalization.xml", - "ref/netstandard1.0/fr/System.Globalization.xml", - "ref/netstandard1.0/it/System.Globalization.xml", - "ref/netstandard1.0/ja/System.Globalization.xml", - "ref/netstandard1.0/ko/System.Globalization.xml", - "ref/netstandard1.0/ru/System.Globalization.xml", - "ref/netstandard1.0/zh-hans/System.Globalization.xml", - "ref/netstandard1.0/zh-hant/System.Globalization.xml", - "ref/netstandard1.3/System.Globalization.dll", - "ref/netstandard1.3/System.Globalization.xml", - "ref/netstandard1.3/de/System.Globalization.xml", - "ref/netstandard1.3/es/System.Globalization.xml", - "ref/netstandard1.3/fr/System.Globalization.xml", - "ref/netstandard1.3/it/System.Globalization.xml", - "ref/netstandard1.3/ja/System.Globalization.xml", - "ref/netstandard1.3/ko/System.Globalization.xml", - "ref/netstandard1.3/ru/System.Globalization.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Calendars/4.3.0": { - "sha512": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "type": "package", - "path": "System.Globalization.Calendars/4.3.0", - "files": [ - "System.Globalization.Calendars.4.3.0.nupkg.sha512", - "System.Globalization.Calendars.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.xml", - "ref/netstandard1.3/de/System.Globalization.Calendars.xml", - "ref/netstandard1.3/es/System.Globalization.Calendars.xml", - "ref/netstandard1.3/fr/System.Globalization.Calendars.xml", - "ref/netstandard1.3/it/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ja/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ko/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ru/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Calendars.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Globalization.Extensions/4.3.0": { - "sha512": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "type": "package", - "path": "System.Globalization.Extensions/4.3.0", - "files": [ - "System.Globalization.Extensions.4.3.0.nupkg.sha512", - "System.Globalization.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.xml", - "ref/netstandard1.3/de/System.Globalization.Extensions.xml", - "ref/netstandard1.3/es/System.Globalization.Extensions.xml", - "ref/netstandard1.3/fr/System.Globalization.Extensions.xml", - "ref/netstandard1.3/it/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ja/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ko/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ru/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Extensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll", - "runtimes/win/lib/net46/System.Globalization.Extensions.dll", - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll" - ] - }, - "System.IO/4.3.0": { - "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "type": "package", - "path": "System.IO/4.3.0", - "files": [ - "System.IO.4.3.0.nupkg.sha512", - "System.IO.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.IO.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.IO.dll", - "ref/netcore50/System.IO.dll", - "ref/netcore50/System.IO.xml", - "ref/netcore50/de/System.IO.xml", - "ref/netcore50/es/System.IO.xml", - "ref/netcore50/fr/System.IO.xml", - "ref/netcore50/it/System.IO.xml", - "ref/netcore50/ja/System.IO.xml", - "ref/netcore50/ko/System.IO.xml", - "ref/netcore50/ru/System.IO.xml", - "ref/netcore50/zh-hans/System.IO.xml", - "ref/netcore50/zh-hant/System.IO.xml", - "ref/netstandard1.0/System.IO.dll", - "ref/netstandard1.0/System.IO.xml", - "ref/netstandard1.0/de/System.IO.xml", - "ref/netstandard1.0/es/System.IO.xml", - "ref/netstandard1.0/fr/System.IO.xml", - "ref/netstandard1.0/it/System.IO.xml", - "ref/netstandard1.0/ja/System.IO.xml", - "ref/netstandard1.0/ko/System.IO.xml", - "ref/netstandard1.0/ru/System.IO.xml", - "ref/netstandard1.0/zh-hans/System.IO.xml", - "ref/netstandard1.0/zh-hant/System.IO.xml", - "ref/netstandard1.3/System.IO.dll", - "ref/netstandard1.3/System.IO.xml", - "ref/netstandard1.3/de/System.IO.xml", - "ref/netstandard1.3/es/System.IO.xml", - "ref/netstandard1.3/fr/System.IO.xml", - "ref/netstandard1.3/it/System.IO.xml", - "ref/netstandard1.3/ja/System.IO.xml", - "ref/netstandard1.3/ko/System.IO.xml", - "ref/netstandard1.3/ru/System.IO.xml", - "ref/netstandard1.3/zh-hans/System.IO.xml", - "ref/netstandard1.3/zh-hant/System.IO.xml", - "ref/netstandard1.5/System.IO.dll", - "ref/netstandard1.5/System.IO.xml", - "ref/netstandard1.5/de/System.IO.xml", - "ref/netstandard1.5/es/System.IO.xml", - "ref/netstandard1.5/fr/System.IO.xml", - "ref/netstandard1.5/it/System.IO.xml", - "ref/netstandard1.5/ja/System.IO.xml", - "ref/netstandard1.5/ko/System.IO.xml", - "ref/netstandard1.5/ru/System.IO.xml", - "ref/netstandard1.5/zh-hans/System.IO.xml", - "ref/netstandard1.5/zh-hant/System.IO.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.Compression/4.3.0": { - "sha512": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "type": "package", - "path": "System.IO.Compression/4.3.0", - "files": [ - "System.IO.Compression.4.3.0.nupkg.sha512", - "System.IO.Compression.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.IO.Compression.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/netcore50/de/System.IO.Compression.xml", - "ref/netcore50/es/System.IO.Compression.xml", - "ref/netcore50/fr/System.IO.Compression.xml", - "ref/netcore50/it/System.IO.Compression.xml", - "ref/netcore50/ja/System.IO.Compression.xml", - "ref/netcore50/ko/System.IO.Compression.xml", - "ref/netcore50/ru/System.IO.Compression.xml", - "ref/netcore50/zh-hans/System.IO.Compression.xml", - "ref/netcore50/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.1/System.IO.Compression.dll", - "ref/netstandard1.1/System.IO.Compression.xml", - "ref/netstandard1.1/de/System.IO.Compression.xml", - "ref/netstandard1.1/es/System.IO.Compression.xml", - "ref/netstandard1.1/fr/System.IO.Compression.xml", - "ref/netstandard1.1/it/System.IO.Compression.xml", - "ref/netstandard1.1/ja/System.IO.Compression.xml", - "ref/netstandard1.1/ko/System.IO.Compression.xml", - "ref/netstandard1.1/ru/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.3/System.IO.Compression.dll", - "ref/netstandard1.3/System.IO.Compression.xml", - "ref/netstandard1.3/de/System.IO.Compression.xml", - "ref/netstandard1.3/es/System.IO.Compression.xml", - "ref/netstandard1.3/fr/System.IO.Compression.xml", - "ref/netstandard1.3/it/System.IO.Compression.xml", - "ref/netstandard1.3/ja/System.IO.Compression.xml", - "ref/netstandard1.3/ko/System.IO.Compression.xml", - "ref/netstandard1.3/ru/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll", - "runtimes/win/lib/net46/System.IO.Compression.dll", - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll" - ] - }, - "System.IO.Compression.ZipFile/4.3.0": { - "sha512": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "type": "package", - "path": "System.IO.Compression.ZipFile/4.3.0", - "files": [ - "System.IO.Compression.ZipFile.4.3.0.nupkg.sha512", - "System.IO.Compression.ZipFile.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/de/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/es/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/fr/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/it/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ja/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ko/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ru/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem/4.3.0": { - "sha512": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "type": "package", - "path": "System.IO.FileSystem/4.3.0", - "files": [ - "System.IO.FileSystem.4.3.0.nupkg.sha512", - "System.IO.FileSystem.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "sha512": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "type": "package", - "path": "System.IO.FileSystem.Primitives/4.3.0", - "files": [ - "System.IO.FileSystem.Primitives.4.3.0.nupkg.sha512", - "System.IO.FileSystem.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.IO.FileSystem.Watcher/4.0.0": { - "sha512": "qM4Wr3La+RYb/03B0mZZjbA7tHsGzDffnuXP8Sl48HW2JwCjn3kfD5qdw0sqyNNowUipcJMi9/q6sMUrOIJ6UQ==", - "type": "package", - "path": "System.IO.FileSystem.Watcher/4.0.0", - "files": [ - "System.IO.FileSystem.Watcher.4.0.0.nupkg.sha512", - "System.IO.FileSystem.Watcher.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Watcher.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Watcher.dll", - "ref/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "ref/netstandard1.3/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Watcher.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Watcher.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/linux/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "runtimes/osx/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "runtimes/win/lib/net46/System.IO.FileSystem.Watcher.dll", - "runtimes/win/lib/netstandard1.3/System.IO.FileSystem.Watcher.dll", - "runtimes/win7/lib/netcore50/_._" - ] - }, - "System.IO.MemoryMappedFiles/4.0.0": { - "sha512": "Xqj4xaFAnLVpss9ZSUIvB/VdJAA7GxZDnFGDKJfiGAnZ5VnFROn6eOHWepFpujCYTsh6wlZ3B33bqYkF0QJ7Eg==", - "type": "package", - "path": "System.IO.MemoryMappedFiles/4.0.0", - "files": [ - "System.IO.MemoryMappedFiles.4.0.0.nupkg.sha512", - "System.IO.MemoryMappedFiles.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.MemoryMappedFiles.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.MemoryMappedFiles.dll", - "ref/netstandard1.3/System.IO.MemoryMappedFiles.dll", - "ref/netstandard1.3/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/de/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/es/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/fr/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/it/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/ja/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/ko/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/ru/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/zh-hans/System.IO.MemoryMappedFiles.xml", - "ref/netstandard1.3/zh-hant/System.IO.MemoryMappedFiles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll", - "runtimes/win/lib/net46/System.IO.MemoryMappedFiles.dll", - "runtimes/win/lib/netcore50/System.IO.MemoryMappedFiles.dll", - "runtimes/win/lib/netstandard1.3/System.IO.MemoryMappedFiles.dll" - ] - }, - "System.IO.UnmanagedMemoryStream/4.0.1": { - "sha512": "wcq0kXcpfJwdl1Y4/ZjDk7Dhx5HdLyRYYWYmD8Nn8skoGYYQd2BQWbXwjWSczip8AL4Z57o2dWWXAl4aABAKiQ==", - "type": "package", - "path": "System.IO.UnmanagedMemoryStream/4.0.1", - "files": [ - "System.IO.UnmanagedMemoryStream.4.0.1.nupkg.sha512", - "System.IO.UnmanagedMemoryStream.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.UnmanagedMemoryStream.dll", - "lib/netstandard1.3/System.IO.UnmanagedMemoryStream.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.UnmanagedMemoryStream.dll", - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.dll", - "ref/netstandard1.3/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/de/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/es/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/fr/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/it/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/ja/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/ko/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/ru/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/zh-hans/System.IO.UnmanagedMemoryStream.xml", - "ref/netstandard1.3/zh-hant/System.IO.UnmanagedMemoryStream.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq/4.3.0": { - "sha512": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "type": "package", - "path": "System.Linq/4.3.0", - "files": [ - "System.Linq.4.3.0.nupkg.sha512", - "System.Linq.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.dll", - "lib/netcore50/System.Linq.dll", - "lib/netstandard1.6/System.Linq.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.dll", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/netcore50/de/System.Linq.xml", - "ref/netcore50/es/System.Linq.xml", - "ref/netcore50/fr/System.Linq.xml", - "ref/netcore50/it/System.Linq.xml", - "ref/netcore50/ja/System.Linq.xml", - "ref/netcore50/ko/System.Linq.xml", - "ref/netcore50/ru/System.Linq.xml", - "ref/netcore50/zh-hans/System.Linq.xml", - "ref/netcore50/zh-hant/System.Linq.xml", - "ref/netstandard1.0/System.Linq.dll", - "ref/netstandard1.0/System.Linq.xml", - "ref/netstandard1.0/de/System.Linq.xml", - "ref/netstandard1.0/es/System.Linq.xml", - "ref/netstandard1.0/fr/System.Linq.xml", - "ref/netstandard1.0/it/System.Linq.xml", - "ref/netstandard1.0/ja/System.Linq.xml", - "ref/netstandard1.0/ko/System.Linq.xml", - "ref/netstandard1.0/ru/System.Linq.xml", - "ref/netstandard1.0/zh-hans/System.Linq.xml", - "ref/netstandard1.0/zh-hant/System.Linq.xml", - "ref/netstandard1.6/System.Linq.dll", - "ref/netstandard1.6/System.Linq.xml", - "ref/netstandard1.6/de/System.Linq.xml", - "ref/netstandard1.6/es/System.Linq.xml", - "ref/netstandard1.6/fr/System.Linq.xml", - "ref/netstandard1.6/it/System.Linq.xml", - "ref/netstandard1.6/ja/System.Linq.xml", - "ref/netstandard1.6/ko/System.Linq.xml", - "ref/netstandard1.6/ru/System.Linq.xml", - "ref/netstandard1.6/zh-hans/System.Linq.xml", - "ref/netstandard1.6/zh-hant/System.Linq.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq.Expressions/4.3.0": { - "sha512": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "type": "package", - "path": "System.Linq.Expressions/4.3.0", - "files": [ - "System.Linq.Expressions.4.3.0.nupkg.sha512", - "System.Linq.Expressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.Expressions.dll", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/netstandard1.6/System.Linq.Expressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.xml", - "ref/netcore50/de/System.Linq.Expressions.xml", - "ref/netcore50/es/System.Linq.Expressions.xml", - "ref/netcore50/fr/System.Linq.Expressions.xml", - "ref/netcore50/it/System.Linq.Expressions.xml", - "ref/netcore50/ja/System.Linq.Expressions.xml", - "ref/netcore50/ko/System.Linq.Expressions.xml", - "ref/netcore50/ru/System.Linq.Expressions.xml", - "ref/netcore50/zh-hans/System.Linq.Expressions.xml", - "ref/netcore50/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.0/System.Linq.Expressions.dll", - "ref/netstandard1.0/System.Linq.Expressions.xml", - "ref/netstandard1.0/de/System.Linq.Expressions.xml", - "ref/netstandard1.0/es/System.Linq.Expressions.xml", - "ref/netstandard1.0/fr/System.Linq.Expressions.xml", - "ref/netstandard1.0/it/System.Linq.Expressions.xml", - "ref/netstandard1.0/ja/System.Linq.Expressions.xml", - "ref/netstandard1.0/ko/System.Linq.Expressions.xml", - "ref/netstandard1.0/ru/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.3/System.Linq.Expressions.dll", - "ref/netstandard1.3/System.Linq.Expressions.xml", - "ref/netstandard1.3/de/System.Linq.Expressions.xml", - "ref/netstandard1.3/es/System.Linq.Expressions.xml", - "ref/netstandard1.3/fr/System.Linq.Expressions.xml", - "ref/netstandard1.3/it/System.Linq.Expressions.xml", - "ref/netstandard1.3/ja/System.Linq.Expressions.xml", - "ref/netstandard1.3/ko/System.Linq.Expressions.xml", - "ref/netstandard1.3/ru/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.6/System.Linq.Expressions.dll", - "ref/netstandard1.6/System.Linq.Expressions.xml", - "ref/netstandard1.6/de/System.Linq.Expressions.xml", - "ref/netstandard1.6/es/System.Linq.Expressions.xml", - "ref/netstandard1.6/fr/System.Linq.Expressions.xml", - "ref/netstandard1.6/it/System.Linq.Expressions.xml", - "ref/netstandard1.6/ja/System.Linq.Expressions.xml", - "ref/netstandard1.6/ko/System.Linq.Expressions.xml", - "ref/netstandard1.6/ru/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hant/System.Linq.Expressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Linq.Expressions.dll" - ] - }, - "System.Linq.Parallel/4.0.1": { - "sha512": "J7XCa7n2cFn32uLbtceXfBFhgCk5M++50lylHKNbqTiJkw5y4Tglpi6amuJNPCvj9bLzNSI7rs1fi4joLMNRgg==", - "type": "package", - "path": "System.Linq.Parallel/4.0.1", - "files": [ - "System.Linq.Parallel.4.0.1.nupkg.sha512", - "System.Linq.Parallel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Linq.Parallel.dll", - "lib/netstandard1.3/System.Linq.Parallel.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Linq.Parallel.dll", - "ref/netcore50/System.Linq.Parallel.xml", - "ref/netcore50/de/System.Linq.Parallel.xml", - "ref/netcore50/es/System.Linq.Parallel.xml", - "ref/netcore50/fr/System.Linq.Parallel.xml", - "ref/netcore50/it/System.Linq.Parallel.xml", - "ref/netcore50/ja/System.Linq.Parallel.xml", - "ref/netcore50/ko/System.Linq.Parallel.xml", - "ref/netcore50/ru/System.Linq.Parallel.xml", - "ref/netcore50/zh-hans/System.Linq.Parallel.xml", - "ref/netcore50/zh-hant/System.Linq.Parallel.xml", - "ref/netstandard1.1/System.Linq.Parallel.dll", - "ref/netstandard1.1/System.Linq.Parallel.xml", - "ref/netstandard1.1/de/System.Linq.Parallel.xml", - "ref/netstandard1.1/es/System.Linq.Parallel.xml", - "ref/netstandard1.1/fr/System.Linq.Parallel.xml", - "ref/netstandard1.1/it/System.Linq.Parallel.xml", - "ref/netstandard1.1/ja/System.Linq.Parallel.xml", - "ref/netstandard1.1/ko/System.Linq.Parallel.xml", - "ref/netstandard1.1/ru/System.Linq.Parallel.xml", - "ref/netstandard1.1/zh-hans/System.Linq.Parallel.xml", - "ref/netstandard1.1/zh-hant/System.Linq.Parallel.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Linq.Queryable/4.0.1": { - "sha512": "Yn/WfYe9RoRfmSLvUt2JerP0BTGGykCZkQPgojaxgzF2N0oPo+/AhB8TXOpdCcNlrG3VRtsamtK2uzsp3cqRVw==", - "type": "package", - "path": "System.Linq.Queryable/4.0.1", - "files": [ - "System.Linq.Queryable.4.0.1.nupkg.sha512", - "System.Linq.Queryable.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Linq.Queryable.dll", - "lib/netstandard1.3/System.Linq.Queryable.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Linq.Queryable.dll", - "ref/netcore50/System.Linq.Queryable.xml", - "ref/netcore50/de/System.Linq.Queryable.xml", - "ref/netcore50/es/System.Linq.Queryable.xml", - "ref/netcore50/fr/System.Linq.Queryable.xml", - "ref/netcore50/it/System.Linq.Queryable.xml", - "ref/netcore50/ja/System.Linq.Queryable.xml", - "ref/netcore50/ko/System.Linq.Queryable.xml", - "ref/netcore50/ru/System.Linq.Queryable.xml", - "ref/netcore50/zh-hans/System.Linq.Queryable.xml", - "ref/netcore50/zh-hant/System.Linq.Queryable.xml", - "ref/netstandard1.0/System.Linq.Queryable.dll", - "ref/netstandard1.0/System.Linq.Queryable.xml", - "ref/netstandard1.0/de/System.Linq.Queryable.xml", - "ref/netstandard1.0/es/System.Linq.Queryable.xml", - "ref/netstandard1.0/fr/System.Linq.Queryable.xml", - "ref/netstandard1.0/it/System.Linq.Queryable.xml", - "ref/netstandard1.0/ja/System.Linq.Queryable.xml", - "ref/netstandard1.0/ko/System.Linq.Queryable.xml", - "ref/netstandard1.0/ru/System.Linq.Queryable.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Queryable.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Queryable.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.Http/4.3.0": { - "sha512": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "type": "package", - "path": "System.Net.Http/4.3.0", - "files": [ - "System.Net.Http.4.3.0.nupkg.sha512", - "System.Net.Http.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/Xamarinmac20/_._", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/net46/System.Net.Http.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/Xamarinmac20/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/net46/System.Net.Http.dll", - "ref/net46/System.Net.Http.xml", - "ref/net46/de/System.Net.Http.xml", - "ref/net46/es/System.Net.Http.xml", - "ref/net46/fr/System.Net.Http.xml", - "ref/net46/it/System.Net.Http.xml", - "ref/net46/ja/System.Net.Http.xml", - "ref/net46/ko/System.Net.Http.xml", - "ref/net46/ru/System.Net.Http.xml", - "ref/net46/zh-hans/System.Net.Http.xml", - "ref/net46/zh-hant/System.Net.Http.xml", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/netcore50/de/System.Net.Http.xml", - "ref/netcore50/es/System.Net.Http.xml", - "ref/netcore50/fr/System.Net.Http.xml", - "ref/netcore50/it/System.Net.Http.xml", - "ref/netcore50/ja/System.Net.Http.xml", - "ref/netcore50/ko/System.Net.Http.xml", - "ref/netcore50/ru/System.Net.Http.xml", - "ref/netcore50/zh-hans/System.Net.Http.xml", - "ref/netcore50/zh-hant/System.Net.Http.xml", - "ref/netstandard1.1/System.Net.Http.dll", - "ref/netstandard1.1/System.Net.Http.xml", - "ref/netstandard1.1/de/System.Net.Http.xml", - "ref/netstandard1.1/es/System.Net.Http.xml", - "ref/netstandard1.1/fr/System.Net.Http.xml", - "ref/netstandard1.1/it/System.Net.Http.xml", - "ref/netstandard1.1/ja/System.Net.Http.xml", - "ref/netstandard1.1/ko/System.Net.Http.xml", - "ref/netstandard1.1/ru/System.Net.Http.xml", - "ref/netstandard1.1/zh-hans/System.Net.Http.xml", - "ref/netstandard1.1/zh-hant/System.Net.Http.xml", - "ref/netstandard1.3/System.Net.Http.dll", - "ref/netstandard1.3/System.Net.Http.xml", - "ref/netstandard1.3/de/System.Net.Http.xml", - "ref/netstandard1.3/es/System.Net.Http.xml", - "ref/netstandard1.3/fr/System.Net.Http.xml", - "ref/netstandard1.3/it/System.Net.Http.xml", - "ref/netstandard1.3/ja/System.Net.Http.xml", - "ref/netstandard1.3/ko/System.Net.Http.xml", - "ref/netstandard1.3/ru/System.Net.Http.xml", - "ref/netstandard1.3/zh-hans/System.Net.Http.xml", - "ref/netstandard1.3/zh-hant/System.Net.Http.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll", - "runtimes/win/lib/net46/System.Net.Http.dll", - "runtimes/win/lib/netcore50/System.Net.Http.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll" - ] - }, - "System.Net.NameResolution/4.0.0": { - "sha512": "JdqRdM1Qym3YehqdKIi5LHrpypP4JMfxKQSNCJ2z4WawkG0il+N3XfNeJOxll2XrTnG7WgYYPoeiu/KOwg0DQw==", - "type": "package", - "path": "System.Net.NameResolution/4.0.0", - "files": [ - "System.Net.NameResolution.4.0.0.nupkg.sha512", - "System.Net.NameResolution.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.NameResolution.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.NameResolution.dll", - "ref/netstandard1.3/System.Net.NameResolution.dll", - "ref/netstandard1.3/System.Net.NameResolution.xml", - "ref/netstandard1.3/de/System.Net.NameResolution.xml", - "ref/netstandard1.3/es/System.Net.NameResolution.xml", - "ref/netstandard1.3/fr/System.Net.NameResolution.xml", - "ref/netstandard1.3/it/System.Net.NameResolution.xml", - "ref/netstandard1.3/ja/System.Net.NameResolution.xml", - "ref/netstandard1.3/ko/System.Net.NameResolution.xml", - "ref/netstandard1.3/ru/System.Net.NameResolution.xml", - "ref/netstandard1.3/zh-hans/System.Net.NameResolution.xml", - "ref/netstandard1.3/zh-hant/System.Net.NameResolution.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Net.NameResolution.dll", - "runtimes/win/lib/net46/System.Net.NameResolution.dll", - "runtimes/win/lib/netcore50/System.Net.NameResolution.dll", - "runtimes/win/lib/netstandard1.3/System.Net.NameResolution.dll" - ] - }, - "System.Net.NameResolution/4.3.0": { - "sha512": "AFYl08R7MrsrEjqpQWTZWBadqXyTzNDaWpMqyxhb0d6sGhV6xMDKueuBXlLL30gz+DIRY6MpdgnHWlCh5wmq9w==", - "type": "package", - "path": "System.Net.NameResolution/4.3.0", - "files": [ - "System.Net.NameResolution.4.3.0.nupkg.sha512", - "System.Net.NameResolution.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.NameResolution.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.NameResolution.dll", - "ref/netstandard1.3/System.Net.NameResolution.dll", - "ref/netstandard1.3/System.Net.NameResolution.xml", - "ref/netstandard1.3/de/System.Net.NameResolution.xml", - "ref/netstandard1.3/es/System.Net.NameResolution.xml", - "ref/netstandard1.3/fr/System.Net.NameResolution.xml", - "ref/netstandard1.3/it/System.Net.NameResolution.xml", - "ref/netstandard1.3/ja/System.Net.NameResolution.xml", - "ref/netstandard1.3/ko/System.Net.NameResolution.xml", - "ref/netstandard1.3/ru/System.Net.NameResolution.xml", - "ref/netstandard1.3/zh-hans/System.Net.NameResolution.xml", - "ref/netstandard1.3/zh-hant/System.Net.NameResolution.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Net.NameResolution.dll", - "runtimes/win/lib/net46/System.Net.NameResolution.dll", - "runtimes/win/lib/netcore50/System.Net.NameResolution.dll", - "runtimes/win/lib/netstandard1.3/System.Net.NameResolution.dll" - ] - }, - "System.Net.Primitives/4.3.0": { - "sha512": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "type": "package", - "path": "System.Net.Primitives/4.3.0", - "files": [ - "System.Net.Primitives.4.3.0.nupkg.sha512", - "System.Net.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Net.Primitives.dll", - "ref/netcore50/System.Net.Primitives.xml", - "ref/netcore50/de/System.Net.Primitives.xml", - "ref/netcore50/es/System.Net.Primitives.xml", - "ref/netcore50/fr/System.Net.Primitives.xml", - "ref/netcore50/it/System.Net.Primitives.xml", - "ref/netcore50/ja/System.Net.Primitives.xml", - "ref/netcore50/ko/System.Net.Primitives.xml", - "ref/netcore50/ru/System.Net.Primitives.xml", - "ref/netcore50/zh-hans/System.Net.Primitives.xml", - "ref/netcore50/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.0/System.Net.Primitives.dll", - "ref/netstandard1.0/System.Net.Primitives.xml", - "ref/netstandard1.0/de/System.Net.Primitives.xml", - "ref/netstandard1.0/es/System.Net.Primitives.xml", - "ref/netstandard1.0/fr/System.Net.Primitives.xml", - "ref/netstandard1.0/it/System.Net.Primitives.xml", - "ref/netstandard1.0/ja/System.Net.Primitives.xml", - "ref/netstandard1.0/ko/System.Net.Primitives.xml", - "ref/netstandard1.0/ru/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.1/System.Net.Primitives.dll", - "ref/netstandard1.1/System.Net.Primitives.xml", - "ref/netstandard1.1/de/System.Net.Primitives.xml", - "ref/netstandard1.1/es/System.Net.Primitives.xml", - "ref/netstandard1.1/fr/System.Net.Primitives.xml", - "ref/netstandard1.1/it/System.Net.Primitives.xml", - "ref/netstandard1.1/ja/System.Net.Primitives.xml", - "ref/netstandard1.1/ko/System.Net.Primitives.xml", - "ref/netstandard1.1/ru/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.3/System.Net.Primitives.dll", - "ref/netstandard1.3/System.Net.Primitives.xml", - "ref/netstandard1.3/de/System.Net.Primitives.xml", - "ref/netstandard1.3/es/System.Net.Primitives.xml", - "ref/netstandard1.3/fr/System.Net.Primitives.xml", - "ref/netstandard1.3/it/System.Net.Primitives.xml", - "ref/netstandard1.3/ja/System.Net.Primitives.xml", - "ref/netstandard1.3/ko/System.Net.Primitives.xml", - "ref/netstandard1.3/ru/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Net.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.Requests/4.0.11": { - "sha512": "vxGt7C0cZixN+VqoSW4Yakc1Y9WknmxauDqzxgpw/FnBdz4kQNN51l4wxdXX5VY1xjqy//+G+4CvJWp1+f+y6Q==", - "type": "package", - "path": "System.Net.Requests/4.0.11", - "files": [ - "System.Net.Requests.4.0.11.nupkg.sha512", - "System.Net.Requests.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/_._", - "ref/netcore50/System.Net.Requests.dll", - "ref/netcore50/System.Net.Requests.xml", - "ref/netcore50/de/System.Net.Requests.xml", - "ref/netcore50/es/System.Net.Requests.xml", - "ref/netcore50/fr/System.Net.Requests.xml", - "ref/netcore50/it/System.Net.Requests.xml", - "ref/netcore50/ja/System.Net.Requests.xml", - "ref/netcore50/ko/System.Net.Requests.xml", - "ref/netcore50/ru/System.Net.Requests.xml", - "ref/netcore50/zh-hans/System.Net.Requests.xml", - "ref/netcore50/zh-hant/System.Net.Requests.xml", - "ref/netstandard1.0/System.Net.Requests.dll", - "ref/netstandard1.0/System.Net.Requests.xml", - "ref/netstandard1.0/de/System.Net.Requests.xml", - "ref/netstandard1.0/es/System.Net.Requests.xml", - "ref/netstandard1.0/fr/System.Net.Requests.xml", - "ref/netstandard1.0/it/System.Net.Requests.xml", - "ref/netstandard1.0/ja/System.Net.Requests.xml", - "ref/netstandard1.0/ko/System.Net.Requests.xml", - "ref/netstandard1.0/ru/System.Net.Requests.xml", - "ref/netstandard1.0/zh-hans/System.Net.Requests.xml", - "ref/netstandard1.0/zh-hant/System.Net.Requests.xml", - "ref/netstandard1.1/System.Net.Requests.dll", - "ref/netstandard1.1/System.Net.Requests.xml", - "ref/netstandard1.1/de/System.Net.Requests.xml", - "ref/netstandard1.1/es/System.Net.Requests.xml", - "ref/netstandard1.1/fr/System.Net.Requests.xml", - "ref/netstandard1.1/it/System.Net.Requests.xml", - "ref/netstandard1.1/ja/System.Net.Requests.xml", - "ref/netstandard1.1/ko/System.Net.Requests.xml", - "ref/netstandard1.1/ru/System.Net.Requests.xml", - "ref/netstandard1.1/zh-hans/System.Net.Requests.xml", - "ref/netstandard1.1/zh-hant/System.Net.Requests.xml", - "ref/netstandard1.3/System.Net.Requests.dll", - "ref/netstandard1.3/System.Net.Requests.xml", - "ref/netstandard1.3/de/System.Net.Requests.xml", - "ref/netstandard1.3/es/System.Net.Requests.xml", - "ref/netstandard1.3/fr/System.Net.Requests.xml", - "ref/netstandard1.3/it/System.Net.Requests.xml", - "ref/netstandard1.3/ja/System.Net.Requests.xml", - "ref/netstandard1.3/ko/System.Net.Requests.xml", - "ref/netstandard1.3/ru/System.Net.Requests.xml", - "ref/netstandard1.3/zh-hans/System.Net.Requests.xml", - "ref/netstandard1.3/zh-hant/System.Net.Requests.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Net.Requests.dll", - "runtimes/win/lib/net46/_._", - "runtimes/win/lib/netstandard1.3/System.Net.Requests.dll" - ] - }, - "System.Net.Security/4.0.0": { - "sha512": "uM1JaYJciCc2w7efD6du0EpQ1n5ZQqE6/P43/aI4H5E59qvP+wt3l70KIUF/Ha7NaeXGoGNFPVO0MB80pVHk2g==", - "type": "package", - "path": "System.Net.Security/4.0.0", - "files": [ - "System.Net.Security.4.0.0.nupkg.sha512", - "System.Net.Security.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Security.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Security.dll", - "ref/netstandard1.3/System.Net.Security.dll", - "ref/netstandard1.3/System.Net.Security.xml", - "ref/netstandard1.3/de/System.Net.Security.xml", - "ref/netstandard1.3/es/System.Net.Security.xml", - "ref/netstandard1.3/fr/System.Net.Security.xml", - "ref/netstandard1.3/it/System.Net.Security.xml", - "ref/netstandard1.3/ja/System.Net.Security.xml", - "ref/netstandard1.3/ko/System.Net.Security.xml", - "ref/netstandard1.3/ru/System.Net.Security.xml", - "ref/netstandard1.3/zh-hans/System.Net.Security.xml", - "ref/netstandard1.3/zh-hant/System.Net.Security.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Security.dll", - "runtimes/win/lib/net46/System.Net.Security.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Security.dll", - "runtimes/win7/lib/netcore50/_._" - ] - }, - "System.Net.Sockets/4.3.0": { - "sha512": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "type": "package", - "path": "System.Net.Sockets/4.3.0", - "files": [ - "System.Net.Sockets.4.3.0.nupkg.sha512", - "System.Net.Sockets.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.xml", - "ref/netstandard1.3/de/System.Net.Sockets.xml", - "ref/netstandard1.3/es/System.Net.Sockets.xml", - "ref/netstandard1.3/fr/System.Net.Sockets.xml", - "ref/netstandard1.3/it/System.Net.Sockets.xml", - "ref/netstandard1.3/ja/System.Net.Sockets.xml", - "ref/netstandard1.3/ko/System.Net.Sockets.xml", - "ref/netstandard1.3/ru/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hans/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hant/System.Net.Sockets.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Net.WebHeaderCollection/4.0.1": { - "sha512": "XX2TIAN+wBSAIV51BU2FvvXMdstUa8b0FBSZmDWjZdwUMmggQSifpTOZ5fNH20z9ZCg2fkV1L5SsZnpO2RQDRQ==", - "type": "package", - "path": "System.Net.WebHeaderCollection/4.0.1", - "files": [ - "System.Net.WebHeaderCollection.4.0.1.nupkg.sha512", - "System.Net.WebHeaderCollection.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/netstandard1.3/System.Net.WebHeaderCollection.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Net.WebHeaderCollection.dll", - "ref/netstandard1.3/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/de/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/es/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/fr/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/it/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/ja/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/ko/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/ru/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/zh-hans/System.Net.WebHeaderCollection.xml", - "ref/netstandard1.3/zh-hant/System.Net.WebHeaderCollection.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Numerics.Vectors/4.1.1": { - "sha512": "Ex1NSKycC2wi5XBMWUGWPc3lumh6OQWFFmmpZFZz0oLht5lQ+wWPHVZumOrMJuckfUiVMd4p67BrkBos8lcF+Q==", - "type": "package", - "path": "System.Numerics.Vectors/4.1.1", - "files": [ - "System.Numerics.Vectors.4.1.1.nupkg.sha512", - "System.Numerics.Vectors.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Numerics.Vectors.dll", - "lib/net46/System.Numerics.Vectors.xml", - "lib/netstandard1.0/System.Numerics.Vectors.dll", - "lib/netstandard1.0/System.Numerics.Vectors.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Numerics.Vectors.xml", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Numerics.Vectors.dll", - "ref/net46/System.Numerics.Vectors.xml", - "ref/netstandard1.0/System.Numerics.Vectors.dll", - "ref/netstandard1.0/System.Numerics.Vectors.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.ObjectModel/4.3.0": { - "sha512": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "type": "package", - "path": "System.ObjectModel/4.3.0", - "files": [ - "System.ObjectModel.4.3.0.nupkg.sha512", - "System.ObjectModel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ObjectModel.dll", - "lib/netstandard1.3/System.ObjectModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ObjectModel.dll", - "ref/netcore50/System.ObjectModel.xml", - "ref/netcore50/de/System.ObjectModel.xml", - "ref/netcore50/es/System.ObjectModel.xml", - "ref/netcore50/fr/System.ObjectModel.xml", - "ref/netcore50/it/System.ObjectModel.xml", - "ref/netcore50/ja/System.ObjectModel.xml", - "ref/netcore50/ko/System.ObjectModel.xml", - "ref/netcore50/ru/System.ObjectModel.xml", - "ref/netcore50/zh-hans/System.ObjectModel.xml", - "ref/netcore50/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.0/System.ObjectModel.dll", - "ref/netstandard1.0/System.ObjectModel.xml", - "ref/netstandard1.0/de/System.ObjectModel.xml", - "ref/netstandard1.0/es/System.ObjectModel.xml", - "ref/netstandard1.0/fr/System.ObjectModel.xml", - "ref/netstandard1.0/it/System.ObjectModel.xml", - "ref/netstandard1.0/ja/System.ObjectModel.xml", - "ref/netstandard1.0/ko/System.ObjectModel.xml", - "ref/netstandard1.0/ru/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.3/System.ObjectModel.dll", - "ref/netstandard1.3/System.ObjectModel.xml", - "ref/netstandard1.3/de/System.ObjectModel.xml", - "ref/netstandard1.3/es/System.ObjectModel.xml", - "ref/netstandard1.3/fr/System.ObjectModel.xml", - "ref/netstandard1.3/it/System.ObjectModel.xml", - "ref/netstandard1.3/ja/System.ObjectModel.xml", - "ref/netstandard1.3/ko/System.ObjectModel.xml", - "ref/netstandard1.3/ru/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hant/System.ObjectModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Private.Uri/4.3.0": { - "sha512": "I4SwANiUGho1esj4V4oSlPllXjzCZDE+5XXso2P03LW2vOda2Enzh8DWOxwN6hnrJyp314c7KuVu31QYhRzOGg==", - "type": "package", - "path": "System.Private.Uri/4.3.0", - "files": [ - "System.Private.Uri.4.3.0.nupkg.sha512", - "System.Private.Uri.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "ref/netstandard/_._" - ] - }, - "System.Reflection/4.3.0": { - "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "type": "package", - "path": "System.Reflection/4.3.0", - "files": [ - "System.Reflection.4.3.0.nupkg.sha512", - "System.Reflection.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Reflection.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Reflection.dll", - "ref/netcore50/System.Reflection.dll", - "ref/netcore50/System.Reflection.xml", - "ref/netcore50/de/System.Reflection.xml", - "ref/netcore50/es/System.Reflection.xml", - "ref/netcore50/fr/System.Reflection.xml", - "ref/netcore50/it/System.Reflection.xml", - "ref/netcore50/ja/System.Reflection.xml", - "ref/netcore50/ko/System.Reflection.xml", - "ref/netcore50/ru/System.Reflection.xml", - "ref/netcore50/zh-hans/System.Reflection.xml", - "ref/netcore50/zh-hant/System.Reflection.xml", - "ref/netstandard1.0/System.Reflection.dll", - "ref/netstandard1.0/System.Reflection.xml", - "ref/netstandard1.0/de/System.Reflection.xml", - "ref/netstandard1.0/es/System.Reflection.xml", - "ref/netstandard1.0/fr/System.Reflection.xml", - "ref/netstandard1.0/it/System.Reflection.xml", - "ref/netstandard1.0/ja/System.Reflection.xml", - "ref/netstandard1.0/ko/System.Reflection.xml", - "ref/netstandard1.0/ru/System.Reflection.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.xml", - "ref/netstandard1.3/System.Reflection.dll", - "ref/netstandard1.3/System.Reflection.xml", - "ref/netstandard1.3/de/System.Reflection.xml", - "ref/netstandard1.3/es/System.Reflection.xml", - "ref/netstandard1.3/fr/System.Reflection.xml", - "ref/netstandard1.3/it/System.Reflection.xml", - "ref/netstandard1.3/ja/System.Reflection.xml", - "ref/netstandard1.3/ko/System.Reflection.xml", - "ref/netstandard1.3/ru/System.Reflection.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.xml", - "ref/netstandard1.5/System.Reflection.dll", - "ref/netstandard1.5/System.Reflection.xml", - "ref/netstandard1.5/de/System.Reflection.xml", - "ref/netstandard1.5/es/System.Reflection.xml", - "ref/netstandard1.5/fr/System.Reflection.xml", - "ref/netstandard1.5/it/System.Reflection.xml", - "ref/netstandard1.5/ja/System.Reflection.xml", - "ref/netstandard1.5/ko/System.Reflection.xml", - "ref/netstandard1.5/ru/System.Reflection.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.DispatchProxy/4.0.1": { - "sha512": "GPPgWoSxQEU3aCKSOvsAc1dhTTi4iq92PUVEVfnGPGwqCf6synaAJGYLKMs5E3CuRfel8ufACWUijXqDpOlGrA==", - "type": "package", - "path": "System.Reflection.DispatchProxy/4.0.1", - "files": [ - "System.Reflection.DispatchProxy.4.0.1.nupkg.sha512", - "System.Reflection.DispatchProxy.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/netstandard1.3/System.Reflection.DispatchProxy.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.3/System.Reflection.DispatchProxy.dll", - "ref/netstandard1.3/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/de/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/es/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/fr/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/it/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/ja/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/ko/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/ru/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.DispatchProxy.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.DispatchProxy.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.DispatchProxy.dll" - ] - }, - "System.Reflection.Emit/4.3.0": { - "sha512": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "type": "package", - "path": "System.Reflection.Emit/4.3.0", - "files": [ - "System.Reflection.Emit.4.3.0.nupkg.sha512", - "System.Reflection.Emit.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.dll", - "lib/netstandard1.3/System.Reflection.Emit.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/net45/_._", - "ref/netstandard1.1/System.Reflection.Emit.dll", - "ref/netstandard1.1/System.Reflection.Emit.xml", - "ref/netstandard1.1/de/System.Reflection.Emit.xml", - "ref/netstandard1.1/es/System.Reflection.Emit.xml", - "ref/netstandard1.1/fr/System.Reflection.Emit.xml", - "ref/netstandard1.1/it/System.Reflection.Emit.xml", - "ref/netstandard1.1/ja/System.Reflection.Emit.xml", - "ref/netstandard1.1/ko/System.Reflection.Emit.xml", - "ref/netstandard1.1/ru/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", - "ref/xamarinmac20/_._" - ] - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "sha512": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "type": "package", - "path": "System.Reflection.Emit.ILGeneration/4.3.0", - "files": [ - "System.Reflection.Emit.ILGeneration.4.3.0.nupkg.sha512", - "System.Reflection.Emit.ILGeneration.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.ILGeneration.dll", - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.ILGeneration.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "sha512": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "type": "package", - "path": "System.Reflection.Emit.Lightweight/4.3.0", - "files": [ - "System.Reflection.Emit.Lightweight.4.3.0.nupkg.sha512", - "System.Reflection.Emit.Lightweight.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.Lightweight.dll", - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._" - ] - }, - "System.Reflection.Extensions/4.3.0": { - "sha512": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "type": "package", - "path": "System.Reflection.Extensions/4.3.0", - "files": [ - "System.Reflection.Extensions.4.3.0.nupkg.sha512", - "System.Reflection.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/netcore50/de/System.Reflection.Extensions.xml", - "ref/netcore50/es/System.Reflection.Extensions.xml", - "ref/netcore50/fr/System.Reflection.Extensions.xml", - "ref/netcore50/it/System.Reflection.Extensions.xml", - "ref/netcore50/ja/System.Reflection.Extensions.xml", - "ref/netcore50/ko/System.Reflection.Extensions.xml", - "ref/netcore50/ru/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hans/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hant/System.Reflection.Extensions.xml", - "ref/netstandard1.0/System.Reflection.Extensions.dll", - "ref/netstandard1.0/System.Reflection.Extensions.xml", - "ref/netstandard1.0/de/System.Reflection.Extensions.xml", - "ref/netstandard1.0/es/System.Reflection.Extensions.xml", - "ref/netstandard1.0/fr/System.Reflection.Extensions.xml", - "ref/netstandard1.0/it/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ja/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ko/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ru/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.Metadata/1.3.0": { - "sha512": "jMSCxA4LSyKBGRDm/WtfkO03FkcgRzHxwvQRib1bm2GZ8ifKM1MX1al6breGCEQK280mdl9uQS7JNPXRYk90jw==", - "type": "package", - "path": "System.Reflection.Metadata/1.3.0", - "files": [ - "System.Reflection.Metadata.1.3.0.nupkg.sha512", - "System.Reflection.Metadata.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/System.Reflection.Metadata.dll", - "lib/netstandard1.1/System.Reflection.Metadata.xml", - "lib/portable-net45+win8/System.Reflection.Metadata.dll", - "lib/portable-net45+win8/System.Reflection.Metadata.xml" - ] - }, - "System.Reflection.Primitives/4.3.0": { - "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "type": "package", - "path": "System.Reflection.Primitives/4.3.0", - "files": [ - "System.Reflection.Primitives.4.3.0.nupkg.sha512", - "System.Reflection.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/netcore50/de/System.Reflection.Primitives.xml", - "ref/netcore50/es/System.Reflection.Primitives.xml", - "ref/netcore50/fr/System.Reflection.Primitives.xml", - "ref/netcore50/it/System.Reflection.Primitives.xml", - "ref/netcore50/ja/System.Reflection.Primitives.xml", - "ref/netcore50/ko/System.Reflection.Primitives.xml", - "ref/netcore50/ru/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", - "ref/netstandard1.0/System.Reflection.Primitives.dll", - "ref/netstandard1.0/System.Reflection.Primitives.xml", - "ref/netstandard1.0/de/System.Reflection.Primitives.xml", - "ref/netstandard1.0/es/System.Reflection.Primitives.xml", - "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", - "ref/netstandard1.0/it/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Reflection.TypeExtensions/4.3.0": { - "sha512": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "type": "package", - "path": "System.Reflection.TypeExtensions/4.3.0", - "files": [ - "System.Reflection.TypeExtensions.4.3.0.nupkg.sha512", - "System.Reflection.TypeExtensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/net462/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/net462/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.5/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.TypeExtensions.dll" - ] - }, - "System.Resources.Reader/4.0.0": { - "sha512": "VX1iHAoHxgrLZv+nq/9drCZI6Q4SSCzSVyUm1e0U60sqWdj6XhY7wvKmy3RvsSal9h+/vqSWwxxJsm0J4vn/jA==", - "type": "package", - "path": "System.Resources.Reader/4.0.0", - "files": [ - "System.Resources.Reader.4.0.0.nupkg.sha512", - "System.Resources.Reader.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Resources.Reader.dll" - ] - }, - "System.Resources.ResourceManager/4.3.0": { - "sha512": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "type": "package", - "path": "System.Resources.ResourceManager/4.3.0", - "files": [ - "System.Resources.ResourceManager.4.3.0.nupkg.sha512", - "System.Resources.ResourceManager.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/netcore50/de/System.Resources.ResourceManager.xml", - "ref/netcore50/es/System.Resources.ResourceManager.xml", - "ref/netcore50/fr/System.Resources.ResourceManager.xml", - "ref/netcore50/it/System.Resources.ResourceManager.xml", - "ref/netcore50/ja/System.Resources.ResourceManager.xml", - "ref/netcore50/ko/System.Resources.ResourceManager.xml", - "ref/netcore50/ru/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/System.Resources.ResourceManager.dll", - "ref/netstandard1.0/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime/4.1.0": { - "sha512": "v6c/4Yaa9uWsq+JMhnOFewrYkgdNHNG2eMKuNqRn8P733rNXeRCGvV5FkkjBXn2dbVkPXOsO0xjsEeM1q2zC0g==", - "type": "package", - "path": "System.Runtime/4.1.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.4.1.0.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Runtime/4.3.0": { - "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "type": "package", - "path": "System.Runtime/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.4.3.0.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Runtime.Extensions/4.3.0": { - "sha512": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "type": "package", - "path": "System.Runtime.Extensions/4.3.0", - "files": [ - "System.Runtime.Extensions.4.3.0.nupkg.sha512", - "System.Runtime.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.xml", - "ref/netcore50/de/System.Runtime.Extensions.xml", - "ref/netcore50/es/System.Runtime.Extensions.xml", - "ref/netcore50/fr/System.Runtime.Extensions.xml", - "ref/netcore50/it/System.Runtime.Extensions.xml", - "ref/netcore50/ja/System.Runtime.Extensions.xml", - "ref/netcore50/ko/System.Runtime.Extensions.xml", - "ref/netcore50/ru/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hans/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.0/System.Runtime.Extensions.dll", - "ref/netstandard1.0/System.Runtime.Extensions.xml", - "ref/netstandard1.0/de/System.Runtime.Extensions.xml", - "ref/netstandard1.0/es/System.Runtime.Extensions.xml", - "ref/netstandard1.0/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.0/it/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.3/System.Runtime.Extensions.dll", - "ref/netstandard1.3/System.Runtime.Extensions.xml", - "ref/netstandard1.3/de/System.Runtime.Extensions.xml", - "ref/netstandard1.3/es/System.Runtime.Extensions.xml", - "ref/netstandard1.3/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.3/it/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.5/System.Runtime.Extensions.dll", - "ref/netstandard1.5/System.Runtime.Extensions.xml", - "ref/netstandard1.5/de/System.Runtime.Extensions.xml", - "ref/netstandard1.5/es/System.Runtime.Extensions.xml", - "ref/netstandard1.5/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.5/it/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Handles/4.3.0": { - "sha512": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "type": "package", - "path": "System.Runtime.Handles/4.3.0", - "files": [ - "System.Runtime.Handles.4.3.0.nupkg.sha512", - "System.Runtime.Handles.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Runtime.Handles.dll", - "ref/netstandard1.3/System.Runtime.Handles.xml", - "ref/netstandard1.3/de/System.Runtime.Handles.xml", - "ref/netstandard1.3/es/System.Runtime.Handles.xml", - "ref/netstandard1.3/fr/System.Runtime.Handles.xml", - "ref/netstandard1.3/it/System.Runtime.Handles.xml", - "ref/netstandard1.3/ja/System.Runtime.Handles.xml", - "ref/netstandard1.3/ko/System.Runtime.Handles.xml", - "ref/netstandard1.3/ru/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Handles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices/4.1.0": { - "sha512": "16eu3kjHS633yYdkjwShDHZLRNMKVi/s0bY8ODiqJ2RfMhDMAwxZaUaWVnZ2P71kr/or+X9o/xFWtNqz8ivieQ==", - "type": "package", - "path": "System.Runtime.InteropServices/4.1.0", - "files": [ - "System.Runtime.InteropServices.4.1.0.nupkg.sha512", - "System.Runtime.InteropServices.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.InteropServices.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.xml", - "ref/netcore50/de/System.Runtime.InteropServices.xml", - "ref/netcore50/es/System.Runtime.InteropServices.xml", - "ref/netcore50/fr/System.Runtime.InteropServices.xml", - "ref/netcore50/it/System.Runtime.InteropServices.xml", - "ref/netcore50/ja/System.Runtime.InteropServices.xml", - "ref/netcore50/ko/System.Runtime.InteropServices.xml", - "ref/netcore50/ru/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hans/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/System.Runtime.InteropServices.dll", - "ref/netstandard1.2/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/System.Runtime.InteropServices.dll", - "ref/netstandard1.3/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/System.Runtime.InteropServices.dll", - "ref/netstandard1.5/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.InteropServices.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices/4.3.0": { - "sha512": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "type": "package", - "path": "System.Runtime.InteropServices/4.3.0", - "files": [ - "System.Runtime.InteropServices.4.3.0.nupkg.sha512", - "System.Runtime.InteropServices.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.InteropServices.dll", - "lib/net463/System.Runtime.InteropServices.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.InteropServices.dll", - "ref/net463/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.xml", - "ref/netcore50/de/System.Runtime.InteropServices.xml", - "ref/netcore50/es/System.Runtime.InteropServices.xml", - "ref/netcore50/fr/System.Runtime.InteropServices.xml", - "ref/netcore50/it/System.Runtime.InteropServices.xml", - "ref/netcore50/ja/System.Runtime.InteropServices.xml", - "ref/netcore50/ko/System.Runtime.InteropServices.xml", - "ref/netcore50/ru/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hans/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hant/System.Runtime.InteropServices.xml", - "ref/netcoreapp1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/System.Runtime.InteropServices.dll", - "ref/netstandard1.2/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/System.Runtime.InteropServices.dll", - "ref/netstandard1.3/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/System.Runtime.InteropServices.dll", - "ref/netstandard1.5/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.InteropServices.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "sha512": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "type": "package", - "path": "System.Runtime.InteropServices.RuntimeInformation/4.3.0", - "files": [ - "System.Runtime.InteropServices.RuntimeInformation.4.3.0.nupkg.sha512", - "System.Runtime.InteropServices.RuntimeInformation.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/win8/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/wpa81/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll" - ] - }, - "System.Runtime.Loader/4.0.0": { - "sha512": "4UN78GOVU/mbDFcXkEWtetJT/sJ0yic2gGk1HSlSpWI0TDf421xnrZTDZnwNBapk1GQeYN7U1lTj/aQB1by6ow==", - "type": "package", - "path": "System.Runtime.Loader/4.0.0", - "files": [ - "System.Runtime.Loader.4.0.0.nupkg.sha512", - "System.Runtime.Loader.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net462/_._", - "lib/netstandard1.5/System.Runtime.Loader.dll", - "ref/netstandard1.5/System.Runtime.Loader.dll", - "ref/netstandard1.5/System.Runtime.Loader.xml", - "ref/netstandard1.5/de/System.Runtime.Loader.xml", - "ref/netstandard1.5/es/System.Runtime.Loader.xml", - "ref/netstandard1.5/fr/System.Runtime.Loader.xml", - "ref/netstandard1.5/it/System.Runtime.Loader.xml", - "ref/netstandard1.5/ja/System.Runtime.Loader.xml", - "ref/netstandard1.5/ko/System.Runtime.Loader.xml", - "ref/netstandard1.5/ru/System.Runtime.Loader.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Loader.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Loader.xml" - ] - }, - "System.Runtime.Numerics/4.3.0": { - "sha512": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "type": "package", - "path": "System.Runtime.Numerics/4.3.0", - "files": [ - "System.Runtime.Numerics.4.3.0.nupkg.sha512", - "System.Runtime.Numerics.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/netstandard1.3/System.Runtime.Numerics.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/netcore50/de/System.Runtime.Numerics.xml", - "ref/netcore50/es/System.Runtime.Numerics.xml", - "ref/netcore50/fr/System.Runtime.Numerics.xml", - "ref/netcore50/it/System.Runtime.Numerics.xml", - "ref/netcore50/ja/System.Runtime.Numerics.xml", - "ref/netcore50/ko/System.Runtime.Numerics.xml", - "ref/netcore50/ru/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hans/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hant/System.Runtime.Numerics.xml", - "ref/netstandard1.1/System.Runtime.Numerics.dll", - "ref/netstandard1.1/System.Runtime.Numerics.xml", - "ref/netstandard1.1/de/System.Runtime.Numerics.xml", - "ref/netstandard1.1/es/System.Runtime.Numerics.xml", - "ref/netstandard1.1/fr/System.Runtime.Numerics.xml", - "ref/netstandard1.1/it/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ja/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ko/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ru/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.Numerics.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Runtime.Serialization.Primitives/4.1.1": { - "sha512": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", - "type": "package", - "path": "System.Runtime.Serialization.Primitives/4.1.1", - "files": [ - "System.Runtime.Serialization.Primitives.4.1.1.nupkg.sha512", - "System.Runtime.Serialization.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Runtime.Serialization.Primitives.dll", - "lib/netcore50/System.Runtime.Serialization.Primitives.dll", - "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.dll", - "ref/netcore50/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/de/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/es/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/it/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netcore50/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/System.Runtime.Serialization.Primitives.dll", - "ref/netstandard1.0/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/de/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/es/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/it/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.dll", - "ref/netstandard1.3/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/de/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/es/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/fr/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/it/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/ja/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/ko/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/ru/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Serialization.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Serialization.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.Serialization.Primitives.dll" - ] - }, - "System.Security.Claims/4.0.1": { - "sha512": "4Jlp0OgJLS/Voj1kyFP6MJlIYp3crgfH8kNQk2p7+4JYfc1aAmh9PZyAMMbDhuoolGNtux9HqSOazsioRiDvCw==", - "type": "package", - "path": "System.Security.Claims/4.0.1", - "files": [ - "System.Security.Claims.4.0.1.nupkg.sha512", - "System.Security.Claims.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Claims.dll", - "lib/netstandard1.3/System.Security.Claims.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Claims.dll", - "ref/netstandard1.3/System.Security.Claims.dll", - "ref/netstandard1.3/System.Security.Claims.xml", - "ref/netstandard1.3/de/System.Security.Claims.xml", - "ref/netstandard1.3/es/System.Security.Claims.xml", - "ref/netstandard1.3/fr/System.Security.Claims.xml", - "ref/netstandard1.3/it/System.Security.Claims.xml", - "ref/netstandard1.3/ja/System.Security.Claims.xml", - "ref/netstandard1.3/ko/System.Security.Claims.xml", - "ref/netstandard1.3/ru/System.Security.Claims.xml", - "ref/netstandard1.3/zh-hans/System.Security.Claims.xml", - "ref/netstandard1.3/zh-hant/System.Security.Claims.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Claims/4.3.0": { - "sha512": "P/+BR/2lnc4PNDHt/TPBAWHVMLMRHsyYZbU1NphW4HIWzCggz8mJbTQQ3MKljFE7LS3WagmVFuBgoLcFzYXlkA==", - "type": "package", - "path": "System.Security.Claims/4.3.0", - "files": [ - "System.Security.Claims.4.3.0.nupkg.sha512", - "System.Security.Claims.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Claims.dll", - "lib/netstandard1.3/System.Security.Claims.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Claims.dll", - "ref/netstandard1.3/System.Security.Claims.dll", - "ref/netstandard1.3/System.Security.Claims.xml", - "ref/netstandard1.3/de/System.Security.Claims.xml", - "ref/netstandard1.3/es/System.Security.Claims.xml", - "ref/netstandard1.3/fr/System.Security.Claims.xml", - "ref/netstandard1.3/it/System.Security.Claims.xml", - "ref/netstandard1.3/ja/System.Security.Claims.xml", - "ref/netstandard1.3/ko/System.Security.Claims.xml", - "ref/netstandard1.3/ru/System.Security.Claims.xml", - "ref/netstandard1.3/zh-hans/System.Security.Claims.xml", - "ref/netstandard1.3/zh-hant/System.Security.Claims.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "sha512": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "type": "package", - "path": "System.Security.Cryptography.Algorithms/4.3.0", - "files": [ - "System.Security.Cryptography.Algorithms.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Algorithms.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Algorithms.dll", - "lib/net461/System.Security.Cryptography.Algorithms.dll", - "lib/net463/System.Security.Cryptography.Algorithms.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Algorithms.dll", - "ref/net461/System.Security.Cryptography.Algorithms.dll", - "ref/net463/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.3/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.4/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll" - ] - }, - "System.Security.Cryptography.Cng/4.3.0": { - "sha512": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "type": "package", - "path": "System.Security.Cryptography.Cng/4.3.0", - "files": [ - "System.Security.Cryptography.Cng.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Cng.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Cryptography.Cng.dll", - "lib/net461/System.Security.Cryptography.Cng.dll", - "lib/net463/System.Security.Cryptography.Cng.dll", - "ref/net46/System.Security.Cryptography.Cng.dll", - "ref/net461/System.Security.Cryptography.Cng.dll", - "ref/net463/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.3/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.4/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.4/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll" - ] - }, - "System.Security.Cryptography.Csp/4.3.0": { - "sha512": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "type": "package", - "path": "System.Security.Cryptography.Csp/4.3.0", - "files": [ - "System.Security.Cryptography.Csp.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Csp.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Csp.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Csp.dll", - "ref/netstandard1.3/System.Security.Cryptography.Csp.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll" - ] - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "sha512": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "type": "package", - "path": "System.Security.Cryptography.Encoding/4.3.0", - "files": [ - "System.Security.Cryptography.Encoding.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Encoding.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.Encoding.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll" - ] - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "type": "package", - "path": "System.Security.Cryptography.OpenSsl/4.3.0", - "files": [ - "System.Security.Cryptography.OpenSsl.4.3.0.nupkg.sha512", - "System.Security.Cryptography.OpenSsl.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "ref/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll" - ] - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "sha512": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "type": "package", - "path": "System.Security.Cryptography.Primitives/4.3.0", - "files": [ - "System.Security.Cryptography.Primitives.4.3.0.nupkg.sha512", - "System.Security.Cryptography.Primitives.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Primitives.dll", - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Primitives.dll", - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "sha512": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "type": "package", - "path": "System.Security.Cryptography.X509Certificates/4.3.0", - "files": [ - "System.Security.Cryptography.X509Certificates.4.3.0.nupkg.sha512", - "System.Security.Cryptography.X509Certificates.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.X509Certificates.dll", - "lib/net461/System.Security.Cryptography.X509Certificates.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.X509Certificates.dll", - "ref/net461/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll" - ] - }, - "System.Security.Principal/4.0.1": { - "sha512": "On+SKhXY5rzxh/S8wlH1Rm0ogBlu7zyHNxeNBiXauNrhHRXAe9EuX8Yl5IOzLPGU5Z4kLWHMvORDOCG8iu9hww==", - "type": "package", - "path": "System.Security.Principal/4.0.1", - "files": [ - "System.Security.Principal.4.0.1.nupkg.sha512", - "System.Security.Principal.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Security.Principal.dll", - "lib/netstandard1.0/System.Security.Principal.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Security.Principal.dll", - "ref/netcore50/System.Security.Principal.xml", - "ref/netcore50/de/System.Security.Principal.xml", - "ref/netcore50/es/System.Security.Principal.xml", - "ref/netcore50/fr/System.Security.Principal.xml", - "ref/netcore50/it/System.Security.Principal.xml", - "ref/netcore50/ja/System.Security.Principal.xml", - "ref/netcore50/ko/System.Security.Principal.xml", - "ref/netcore50/ru/System.Security.Principal.xml", - "ref/netcore50/zh-hans/System.Security.Principal.xml", - "ref/netcore50/zh-hant/System.Security.Principal.xml", - "ref/netstandard1.0/System.Security.Principal.dll", - "ref/netstandard1.0/System.Security.Principal.xml", - "ref/netstandard1.0/de/System.Security.Principal.xml", - "ref/netstandard1.0/es/System.Security.Principal.xml", - "ref/netstandard1.0/fr/System.Security.Principal.xml", - "ref/netstandard1.0/it/System.Security.Principal.xml", - "ref/netstandard1.0/ja/System.Security.Principal.xml", - "ref/netstandard1.0/ko/System.Security.Principal.xml", - "ref/netstandard1.0/ru/System.Security.Principal.xml", - "ref/netstandard1.0/zh-hans/System.Security.Principal.xml", - "ref/netstandard1.0/zh-hant/System.Security.Principal.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Principal/4.3.0": { - "sha512": "I1tkfQlAoMM2URscUtpcRo/hX0jinXx6a/KUtEQoz3owaYwl3qwsO8cbzYVVnjxrzxjHo3nJC+62uolgeGIS9A==", - "type": "package", - "path": "System.Security.Principal/4.3.0", - "files": [ - "System.Security.Principal.4.3.0.nupkg.sha512", - "System.Security.Principal.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Security.Principal.dll", - "lib/netstandard1.0/System.Security.Principal.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Security.Principal.dll", - "ref/netcore50/System.Security.Principal.xml", - "ref/netcore50/de/System.Security.Principal.xml", - "ref/netcore50/es/System.Security.Principal.xml", - "ref/netcore50/fr/System.Security.Principal.xml", - "ref/netcore50/it/System.Security.Principal.xml", - "ref/netcore50/ja/System.Security.Principal.xml", - "ref/netcore50/ko/System.Security.Principal.xml", - "ref/netcore50/ru/System.Security.Principal.xml", - "ref/netcore50/zh-hans/System.Security.Principal.xml", - "ref/netcore50/zh-hant/System.Security.Principal.xml", - "ref/netstandard1.0/System.Security.Principal.dll", - "ref/netstandard1.0/System.Security.Principal.xml", - "ref/netstandard1.0/de/System.Security.Principal.xml", - "ref/netstandard1.0/es/System.Security.Principal.xml", - "ref/netstandard1.0/fr/System.Security.Principal.xml", - "ref/netstandard1.0/it/System.Security.Principal.xml", - "ref/netstandard1.0/ja/System.Security.Principal.xml", - "ref/netstandard1.0/ko/System.Security.Principal.xml", - "ref/netstandard1.0/ru/System.Security.Principal.xml", - "ref/netstandard1.0/zh-hans/System.Security.Principal.xml", - "ref/netstandard1.0/zh-hant/System.Security.Principal.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Security.Principal.Windows/4.0.0": { - "sha512": "iFx15AF3RMEPZn3COh8+Bb2Thv2zsmLd93RchS1b8Mj5SNYeGqbYNCSn5AES1+gq56p4ujGZPrl0xN7ngkXOHg==", - "type": "package", - "path": "System.Security.Principal.Windows/4.0.0", - "files": [ - "System.Security.Principal.Windows.4.0.0.nupkg.sha512", - "System.Security.Principal.Windows.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Principal.Windows.dll", - "ref/net46/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/de/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/es/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/fr/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/it/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ja/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ko/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ru/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hans/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hant/System.Security.Principal.Windows.xml", - "runtimes/unix/lib/netstandard1.3/System.Security.Principal.Windows.dll", - "runtimes/win/lib/net46/System.Security.Principal.Windows.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll" - ] - }, - "System.Security.Principal.Windows/4.3.0": { - "sha512": "HVL1rvqYtnRCxFsYag/2le/ZfKLK4yMw79+s6FmKXbSCNN0JeAhrYxnRAHFoWRa0dEojsDcbBSpH3l22QxAVyw==", - "type": "package", - "path": "System.Security.Principal.Windows/4.3.0", - "files": [ - "System.Security.Principal.Windows.4.3.0.nupkg.sha512", - "System.Security.Principal.Windows.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Security.Principal.Windows.dll", - "ref/net46/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/de/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/es/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/fr/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/it/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ja/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ko/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ru/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hans/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hant/System.Security.Principal.Windows.xml", - "runtimes/unix/lib/netstandard1.3/System.Security.Principal.Windows.dll", - "runtimes/win/lib/net46/System.Security.Principal.Windows.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll" - ] - }, - "System.Text.Encoding/4.3.0": { - "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "type": "package", - "path": "System.Text.Encoding/4.3.0", - "files": [ - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.dll", - "ref/netcore50/System.Text.Encoding.xml", - "ref/netcore50/de/System.Text.Encoding.xml", - "ref/netcore50/es/System.Text.Encoding.xml", - "ref/netcore50/fr/System.Text.Encoding.xml", - "ref/netcore50/it/System.Text.Encoding.xml", - "ref/netcore50/ja/System.Text.Encoding.xml", - "ref/netcore50/ko/System.Text.Encoding.xml", - "ref/netcore50/ru/System.Text.Encoding.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.0/System.Text.Encoding.dll", - "ref/netstandard1.0/System.Text.Encoding.xml", - "ref/netstandard1.0/de/System.Text.Encoding.xml", - "ref/netstandard1.0/es/System.Text.Encoding.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.xml", - "ref/netstandard1.0/it/System.Text.Encoding.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.3/System.Text.Encoding.dll", - "ref/netstandard1.3/System.Text.Encoding.xml", - "ref/netstandard1.3/de/System.Text.Encoding.xml", - "ref/netstandard1.3/es/System.Text.Encoding.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.xml", - "ref/netstandard1.3/it/System.Text.Encoding.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.text.encoding.4.3.0.nupkg.sha512", - "system.text.encoding.nuspec" - ] - }, - "System.Text.Encoding.CodePages/4.0.1": { - "sha512": "h4z6rrA/hxWf4655D18IIZ0eaLRa3tQC/j+e26W+VinIHY0l07iEXaAvO0YSYq3MvCjMYy8Zs5AdC1sxNQOB7Q==", - "type": "package", - "path": "System.Text.Encoding.CodePages/4.0.1", - "files": [ - "System.Text.Encoding.CodePages.4.0.1.nupkg.sha512", - "System.Text.Encoding.CodePages.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Text.Encoding.CodePages.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.3/System.Text.Encoding.CodePages.dll", - "ref/netstandard1.3/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/de/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/es/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/it/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.CodePages.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.CodePages.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll", - "runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll" - ] - }, - "System.Text.Encoding.Extensions/4.3.0": { - "sha512": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "type": "package", - "path": "System.Text.Encoding.Extensions/4.3.0", - "files": [ - "System.Text.Encoding.Extensions.4.3.0.nupkg.sha512", - "System.Text.Encoding.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.Extensions.dll", - "ref/netcore50/System.Text.Encoding.Extensions.xml", - "ref/netcore50/de/System.Text.Encoding.Extensions.xml", - "ref/netcore50/es/System.Text.Encoding.Extensions.xml", - "ref/netcore50/fr/System.Text.Encoding.Extensions.xml", - "ref/netcore50/it/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ja/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ko/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ru/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.0/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.3/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Text.RegularExpressions/4.3.0": { - "sha512": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "type": "package", - "path": "System.Text.RegularExpressions/4.3.0", - "files": [ - "System.Text.RegularExpressions.4.3.0.nupkg.sha512", - "System.Text.RegularExpressions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Text.RegularExpressions.dll", - "lib/netcore50/System.Text.RegularExpressions.dll", - "lib/netstandard1.6/System.Text.RegularExpressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.xml", - "ref/netcore50/de/System.Text.RegularExpressions.xml", - "ref/netcore50/es/System.Text.RegularExpressions.xml", - "ref/netcore50/fr/System.Text.RegularExpressions.xml", - "ref/netcore50/it/System.Text.RegularExpressions.xml", - "ref/netcore50/ja/System.Text.RegularExpressions.xml", - "ref/netcore50/ko/System.Text.RegularExpressions.xml", - "ref/netcore50/ru/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hans/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hant/System.Text.RegularExpressions.xml", - "ref/netcoreapp1.1/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/System.Text.RegularExpressions.dll", - "ref/netstandard1.3/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/System.Text.RegularExpressions.dll", - "ref/netstandard1.6/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hant/System.Text.RegularExpressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading/4.3.0": { - "sha512": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "type": "package", - "path": "System.Threading/4.3.0", - "files": [ - "System.Threading.4.3.0.nupkg.sha512", - "System.Threading.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.dll", - "lib/netstandard1.3/System.Threading.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.dll", - "ref/netcore50/System.Threading.xml", - "ref/netcore50/de/System.Threading.xml", - "ref/netcore50/es/System.Threading.xml", - "ref/netcore50/fr/System.Threading.xml", - "ref/netcore50/it/System.Threading.xml", - "ref/netcore50/ja/System.Threading.xml", - "ref/netcore50/ko/System.Threading.xml", - "ref/netcore50/ru/System.Threading.xml", - "ref/netcore50/zh-hans/System.Threading.xml", - "ref/netcore50/zh-hant/System.Threading.xml", - "ref/netstandard1.0/System.Threading.dll", - "ref/netstandard1.0/System.Threading.xml", - "ref/netstandard1.0/de/System.Threading.xml", - "ref/netstandard1.0/es/System.Threading.xml", - "ref/netstandard1.0/fr/System.Threading.xml", - "ref/netstandard1.0/it/System.Threading.xml", - "ref/netstandard1.0/ja/System.Threading.xml", - "ref/netstandard1.0/ko/System.Threading.xml", - "ref/netstandard1.0/ru/System.Threading.xml", - "ref/netstandard1.0/zh-hans/System.Threading.xml", - "ref/netstandard1.0/zh-hant/System.Threading.xml", - "ref/netstandard1.3/System.Threading.dll", - "ref/netstandard1.3/System.Threading.xml", - "ref/netstandard1.3/de/System.Threading.xml", - "ref/netstandard1.3/es/System.Threading.xml", - "ref/netstandard1.3/fr/System.Threading.xml", - "ref/netstandard1.3/it/System.Threading.xml", - "ref/netstandard1.3/ja/System.Threading.xml", - "ref/netstandard1.3/ko/System.Threading.xml", - "ref/netstandard1.3/ru/System.Threading.xml", - "ref/netstandard1.3/zh-hans/System.Threading.xml", - "ref/netstandard1.3/zh-hant/System.Threading.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Threading.dll" - ] - }, - "System.Threading.Overlapped/4.0.1": { - "sha512": "f7aLuLkBoCQM2kng7zqLFBXz9Gk48gDK8lk1ih9rH/1arJJzZK9gJwNvPDhL6Ps/l6rwOr8jw+4FCHL0KKWiEg==", - "type": "package", - "path": "System.Threading.Overlapped/4.0.1", - "files": [ - "System.Threading.Overlapped.4.0.1.nupkg.sha512", - "System.Threading.Overlapped.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Threading.Overlapped.dll", - "ref/net46/System.Threading.Overlapped.dll", - "ref/netstandard1.3/System.Threading.Overlapped.dll", - "ref/netstandard1.3/System.Threading.Overlapped.xml", - "ref/netstandard1.3/de/System.Threading.Overlapped.xml", - "ref/netstandard1.3/es/System.Threading.Overlapped.xml", - "ref/netstandard1.3/fr/System.Threading.Overlapped.xml", - "ref/netstandard1.3/it/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ja/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ko/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ru/System.Threading.Overlapped.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Overlapped.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Overlapped.xml", - "runtimes/unix/lib/netstandard1.3/System.Threading.Overlapped.dll", - "runtimes/win/lib/net46/System.Threading.Overlapped.dll", - "runtimes/win/lib/netcore50/System.Threading.Overlapped.dll", - "runtimes/win/lib/netstandard1.3/System.Threading.Overlapped.dll" - ] - }, - "System.Threading.Overlapped/4.3.0": { - "sha512": "m3HQ2dPiX/DSTpf+yJt8B0c+SRvzfqAJKx+QDWi+VLhz8svLT23MVjEOHPF/KiSLeArKU/iHescrbLd3yVgyNg==", - "type": "package", - "path": "System.Threading.Overlapped/4.3.0", - "files": [ - "System.Threading.Overlapped.4.3.0.nupkg.sha512", - "System.Threading.Overlapped.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Threading.Overlapped.dll", - "ref/net46/System.Threading.Overlapped.dll", - "ref/netstandard1.3/System.Threading.Overlapped.dll", - "ref/netstandard1.3/System.Threading.Overlapped.xml", - "ref/netstandard1.3/de/System.Threading.Overlapped.xml", - "ref/netstandard1.3/es/System.Threading.Overlapped.xml", - "ref/netstandard1.3/fr/System.Threading.Overlapped.xml", - "ref/netstandard1.3/it/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ja/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ko/System.Threading.Overlapped.xml", - "ref/netstandard1.3/ru/System.Threading.Overlapped.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Overlapped.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Overlapped.xml", - "runtimes/unix/lib/netstandard1.3/System.Threading.Overlapped.dll", - "runtimes/win/lib/net46/System.Threading.Overlapped.dll", - "runtimes/win/lib/netcore50/System.Threading.Overlapped.dll", - "runtimes/win/lib/netstandard1.3/System.Threading.Overlapped.dll" - ] - }, - "System.Threading.Tasks/4.3.0": { - "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "type": "package", - "path": "System.Threading.Tasks/4.3.0", - "files": [ - "System.Threading.Tasks.4.3.0.nupkg.sha512", - "System.Threading.Tasks.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.dll", - "ref/netcore50/System.Threading.Tasks.xml", - "ref/netcore50/de/System.Threading.Tasks.xml", - "ref/netcore50/es/System.Threading.Tasks.xml", - "ref/netcore50/fr/System.Threading.Tasks.xml", - "ref/netcore50/it/System.Threading.Tasks.xml", - "ref/netcore50/ja/System.Threading.Tasks.xml", - "ref/netcore50/ko/System.Threading.Tasks.xml", - "ref/netcore50/ru/System.Threading.Tasks.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.0/System.Threading.Tasks.dll", - "ref/netstandard1.0/System.Threading.Tasks.xml", - "ref/netstandard1.0/de/System.Threading.Tasks.xml", - "ref/netstandard1.0/es/System.Threading.Tasks.xml", - "ref/netstandard1.0/fr/System.Threading.Tasks.xml", - "ref/netstandard1.0/it/System.Threading.Tasks.xml", - "ref/netstandard1.0/ja/System.Threading.Tasks.xml", - "ref/netstandard1.0/ko/System.Threading.Tasks.xml", - "ref/netstandard1.0/ru/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.3/System.Threading.Tasks.dll", - "ref/netstandard1.3/System.Threading.Tasks.xml", - "ref/netstandard1.3/de/System.Threading.Tasks.xml", - "ref/netstandard1.3/es/System.Threading.Tasks.xml", - "ref/netstandard1.3/fr/System.Threading.Tasks.xml", - "ref/netstandard1.3/it/System.Threading.Tasks.xml", - "ref/netstandard1.3/ja/System.Threading.Tasks.xml", - "ref/netstandard1.3/ko/System.Threading.Tasks.xml", - "ref/netstandard1.3/ru/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "sha512": "2hRjGu2r2jxRZ55wmcHO/WbdX+YAOz9x6FE8xqkHZgPaoFMKQZRe9dk8xTZIas8fRjxRmzawnTEWIrhlM+Un7w==", - "type": "package", - "path": "System.Threading.Tasks.Dataflow/4.6.0", - "files": [ - "System.Threading.Tasks.Dataflow.4.6.0.nupkg.sha512", - "System.Threading.Tasks.Dataflow.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Dataflow.XML", - "lib/netstandard1.0/System.Threading.Tasks.Dataflow.dll", - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.XML", - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll" - ] - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "sha512": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", - "type": "package", - "path": "System.Threading.Tasks.Extensions/4.3.0", - "files": [ - "System.Threading.Tasks.Extensions.4.3.0.nupkg.sha512", - "System.Threading.Tasks.Extensions.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml" - ] - }, - "System.Threading.Tasks.Parallel/4.0.1": { - "sha512": "7Pc9t25bcynT9FpMvkUw4ZjYwUiGup/5cJFW72/5MgCG+np2cfVUMdh29u8d7onxX7d8PS3J+wL73zQRqkdrSA==", - "type": "package", - "path": "System.Threading.Tasks.Parallel/4.0.1", - "files": [ - "System.Threading.Tasks.Parallel.4.0.1.nupkg.sha512", - "System.Threading.Tasks.Parallel.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.Tasks.Parallel.dll", - "lib/netstandard1.3/System.Threading.Tasks.Parallel.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.Parallel.dll", - "ref/netcore50/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/de/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/es/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/fr/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/it/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/ja/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/ko/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/ru/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.Parallel.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/System.Threading.Tasks.Parallel.dll", - "ref/netstandard1.1/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/de/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/es/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/fr/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/it/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/ja/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/ko/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/ru/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/zh-hans/System.Threading.Tasks.Parallel.xml", - "ref/netstandard1.1/zh-hant/System.Threading.Tasks.Parallel.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Thread/4.0.0": { - "sha512": "gIdJqDXlOr5W9zeqFErLw3dsOsiShSCYtF9SEHitACycmvNvY8odf9kiKvp6V7aibc8C4HzzNBkWXjyfn7plbQ==", - "type": "package", - "path": "System.Threading.Thread/4.0.0", - "files": [ - "System.Threading.Thread.4.0.0.nupkg.sha512", - "System.Threading.Thread.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Threading.Thread.dll", - "lib/netcore50/_._", - "lib/netstandard1.3/System.Threading.Thread.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Threading.Thread.dll", - "ref/netstandard1.3/System.Threading.Thread.dll", - "ref/netstandard1.3/System.Threading.Thread.xml", - "ref/netstandard1.3/de/System.Threading.Thread.xml", - "ref/netstandard1.3/es/System.Threading.Thread.xml", - "ref/netstandard1.3/fr/System.Threading.Thread.xml", - "ref/netstandard1.3/it/System.Threading.Thread.xml", - "ref/netstandard1.3/ja/System.Threading.Thread.xml", - "ref/netstandard1.3/ko/System.Threading.Thread.xml", - "ref/netstandard1.3/ru/System.Threading.Thread.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Thread.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Thread.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.ThreadPool/4.0.10": { - "sha512": "IMXgB5Vf/5Qw1kpoVgJMOvUO1l32aC+qC3OaIZjWJOjvcxuxNWOK2ZTWWYXfij22NHxT2j1yWX5vlAeQWld9vA==", - "type": "package", - "path": "System.Threading.ThreadPool/4.0.10", - "files": [ - "System.Threading.ThreadPool.4.0.10.nupkg.sha512", - "System.Threading.ThreadPool.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Threading.ThreadPool.dll", - "lib/netcore50/_._", - "lib/netstandard1.3/System.Threading.ThreadPool.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Threading.ThreadPool.dll", - "ref/netstandard1.3/System.Threading.ThreadPool.dll", - "ref/netstandard1.3/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/de/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/es/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/fr/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/it/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/ja/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/ko/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/ru/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/zh-hans/System.Threading.ThreadPool.xml", - "ref/netstandard1.3/zh-hant/System.Threading.ThreadPool.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Threading.Timer/4.3.0": { - "sha512": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "type": "package", - "path": "System.Threading.Timer/4.3.0", - "files": [ - "System.Threading.Timer.4.3.0.nupkg.sha512", - "System.Threading.Timer.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net451/_._", - "lib/portable-net451+win81+wpa81/_._", - "lib/win81/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/netcore50/de/System.Threading.Timer.xml", - "ref/netcore50/es/System.Threading.Timer.xml", - "ref/netcore50/fr/System.Threading.Timer.xml", - "ref/netcore50/it/System.Threading.Timer.xml", - "ref/netcore50/ja/System.Threading.Timer.xml", - "ref/netcore50/ko/System.Threading.Timer.xml", - "ref/netcore50/ru/System.Threading.Timer.xml", - "ref/netcore50/zh-hans/System.Threading.Timer.xml", - "ref/netcore50/zh-hant/System.Threading.Timer.xml", - "ref/netstandard1.2/System.Threading.Timer.dll", - "ref/netstandard1.2/System.Threading.Timer.xml", - "ref/netstandard1.2/de/System.Threading.Timer.xml", - "ref/netstandard1.2/es/System.Threading.Timer.xml", - "ref/netstandard1.2/fr/System.Threading.Timer.xml", - "ref/netstandard1.2/it/System.Threading.Timer.xml", - "ref/netstandard1.2/ja/System.Threading.Timer.xml", - "ref/netstandard1.2/ko/System.Threading.Timer.xml", - "ref/netstandard1.2/ru/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hans/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hant/System.Threading.Timer.xml", - "ref/portable-net451+win81+wpa81/_._", - "ref/win81/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.ReaderWriter/4.3.0": { - "sha512": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "type": "package", - "path": "System.Xml.ReaderWriter/4.3.0", - "files": [ - "System.Xml.ReaderWriter.4.3.0.nupkg.sha512", - "System.Xml.ReaderWriter.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Xml.ReaderWriter.dll", - "lib/netcore50/System.Xml.ReaderWriter.dll", - "lib/netstandard1.3/System.Xml.ReaderWriter.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.xml", - "ref/netcore50/de/System.Xml.ReaderWriter.xml", - "ref/netcore50/es/System.Xml.ReaderWriter.xml", - "ref/netcore50/fr/System.Xml.ReaderWriter.xml", - "ref/netcore50/it/System.Xml.ReaderWriter.xml", - "ref/netcore50/ja/System.Xml.ReaderWriter.xml", - "ref/netcore50/ko/System.Xml.ReaderWriter.xml", - "ref/netcore50/ru/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/System.Xml.ReaderWriter.dll", - "ref/netstandard1.0/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/System.Xml.ReaderWriter.dll", - "ref/netstandard1.3/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hant/System.Xml.ReaderWriter.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XDocument/4.3.0": { - "sha512": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "type": "package", - "path": "System.Xml.XDocument/4.3.0", - "files": [ - "System.Xml.XDocument.4.3.0.nupkg.sha512", - "System.Xml.XDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Xml.XDocument.dll", - "lib/netstandard1.3/System.Xml.XDocument.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Xml.XDocument.dll", - "ref/netcore50/System.Xml.XDocument.xml", - "ref/netcore50/de/System.Xml.XDocument.xml", - "ref/netcore50/es/System.Xml.XDocument.xml", - "ref/netcore50/fr/System.Xml.XDocument.xml", - "ref/netcore50/it/System.Xml.XDocument.xml", - "ref/netcore50/ja/System.Xml.XDocument.xml", - "ref/netcore50/ko/System.Xml.XDocument.xml", - "ref/netcore50/ru/System.Xml.XDocument.xml", - "ref/netcore50/zh-hans/System.Xml.XDocument.xml", - "ref/netcore50/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.0/System.Xml.XDocument.dll", - "ref/netstandard1.0/System.Xml.XDocument.xml", - "ref/netstandard1.0/de/System.Xml.XDocument.xml", - "ref/netstandard1.0/es/System.Xml.XDocument.xml", - "ref/netstandard1.0/fr/System.Xml.XDocument.xml", - "ref/netstandard1.0/it/System.Xml.XDocument.xml", - "ref/netstandard1.0/ja/System.Xml.XDocument.xml", - "ref/netstandard1.0/ko/System.Xml.XDocument.xml", - "ref/netstandard1.0/ru/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.3/System.Xml.XDocument.dll", - "ref/netstandard1.3/System.Xml.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XDocument.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XmlDocument/4.0.1": { - "sha512": "2eZu6IP+etFVBBFUFzw2w6J21DqIN5eL9Y8r8JfJWUmV28Z5P0SNU01oCisVHQgHsDhHPnmq2s1hJrJCFZWloQ==", - "type": "package", - "path": "System.Xml.XmlDocument/4.0.1", - "files": [ - "System.Xml.XmlDocument.4.0.1.nupkg.sha512", - "System.Xml.XmlDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Xml.XmlDocument.dll", - "lib/netstandard1.3/System.Xml.XmlDocument.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Xml.XmlDocument.dll", - "ref/netstandard1.3/System.Xml.XmlDocument.dll", - "ref/netstandard1.3/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/de/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/es/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/it/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XmlDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XmlDocument.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XPath/4.0.1": { - "sha512": "UWd1H+1IJ9Wlq5nognZ/XJdyj8qPE4XufBUkAW59ijsCPjZkZe0MUzKKJFBr+ZWBe5Wq1u1d5f2CYgE93uH7DA==", - "type": "package", - "path": "System.Xml.XPath/4.0.1", - "files": [ - "System.Xml.XPath.4.0.1.nupkg.sha512", - "System.Xml.XPath.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Xml.XPath.dll", - "lib/netstandard1.3/System.Xml.XPath.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Xml.XPath.dll", - "ref/netstandard1.3/System.Xml.XPath.dll", - "ref/netstandard1.3/System.Xml.XPath.xml", - "ref/netstandard1.3/de/System.Xml.XPath.xml", - "ref/netstandard1.3/es/System.Xml.XPath.xml", - "ref/netstandard1.3/fr/System.Xml.XPath.xml", - "ref/netstandard1.3/it/System.Xml.XPath.xml", - "ref/netstandard1.3/ja/System.Xml.XPath.xml", - "ref/netstandard1.3/ko/System.Xml.XPath.xml", - "ref/netstandard1.3/ru/System.Xml.XPath.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XPath.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XPath.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "System.Xml.XPath.XDocument/4.0.1": { - "sha512": "FLhdYJx4331oGovQypQ8JIw2kEmNzCsjVOVYY/16kZTUoquZG85oVn7yUhBE2OZt1yGPSXAL0HTEfzjlbNpM7Q==", - "type": "package", - "path": "System.Xml.XPath.XDocument/4.0.1", - "files": [ - "System.Xml.XPath.XDocument.4.0.1.nupkg.sha512", - "System.Xml.XPath.XDocument.nuspec", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Xml.XPath.XDocument.dll", - "lib/netstandard1.3/System.Xml.XPath.XDocument.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Xml.XPath.XDocument.dll", - "ref/netstandard1.3/System.Xml.XPath.XDocument.dll", - "ref/netstandard1.3/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XPath.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XPath.XDocument.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "OpenCvSharp/1.0.0": { - "type": "project", - "path": "../../src/OpenCvSharp/project.json", - "msbuildProject": "../../src/OpenCvSharp/OpenCvSharp.xproj" - }, - "OpenCvSharp.Blob/1.0.0": { - "type": "project", - "path": "../../src/OpenCvSharp.Blob/project.json", - "msbuildProject": "../../src/OpenCvSharp.Blob/OpenCvSharp.Blob.xproj" - }, - "OpenCvSharp.Extensions/1.0.0": { - "type": "project", - "path": "../../src/OpenCvSharp.Extensions/project.json", - "msbuildProject": "../../src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.xproj" - } - }, - "projectFileDependencyGroups": { - "": [ - "NUnit >= 3.6.0", - "OpenCvSharp >= 1.0.0-*", - "OpenCvSharp.Blob >= 1.0.0-*", - "dotnet-test-nunit >= 3.4.0-beta-3" - ], - ".NETCoreApp,Version=v1.0": [ - "Microsoft.NETCore.App >= 1.1.0", - "NETStandard.Library >= 1.6.1" - ], - ".NETFramework,Version=v4.6.1": [ - "OpenCvSharp.Extensions >= 1.0.0-*" - ] - }, - "tools": {}, - "projectFileToolGroups": {} -} \ No newline at end of file diff --git a/test/OpenCvSharp.Tests/quality/QualityBRISQUETest.cs b/test/OpenCvSharp.Tests/quality/QualityBRISQUETest.cs new file mode 100644 index 000000000..a1ba294e3 --- /dev/null +++ b/test/OpenCvSharp.Tests/quality/QualityBRISQUETest.cs @@ -0,0 +1,53 @@ +using OpenCvSharp.Quality; +using Xunit; + +namespace OpenCvSharp.Tests.Quality; + +public class QualityBRISQUETest : TestBase +{ + // https://github.com/opencv/opencv_contrib/blob/master/modules/quality/samples/brisque_model_live.yml + // https://github.com/opencv/opencv_contrib/blob/master/modules/quality/samples/brisque_range_live.yml + private const string ModelFile = "_data/text/brisque_model_live.yml"; + private const string RangeFile = "_data/text/brisque_range_live.yml"; + + [Fact] + public void Compute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + using (var psnr = QualityBRISQUE.Create(ModelFile, RangeFile)) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = psnr.Compute(refImage); + Assert.Equal(0, value[0], 2); + Assert.Equal(0, value[1], 2); + Assert.Equal(0, value[2], 2); + + value = psnr.Compute(targetImage); + Assert.Equal(57.3, value[0], 1); + Assert.Equal(0, value[1], 2); + Assert.Equal(0, value[2], 2); + } + } + + [Fact] + public void StaticCompute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = QualityBRISQUE.Compute(refImage, ModelFile, RangeFile); + Assert.Equal(0, value[0], 2); + Assert.Equal(0, value[1], 2); + Assert.Equal(0, value[2], 2); + + value = QualityBRISQUE.Compute(targetImage, ModelFile, RangeFile); + Assert.Equal(57.3, value[0], 1); + Assert.Equal(0, value[1], 2); + Assert.Equal(0, value[2], 2); + } + } +} diff --git a/test/OpenCvSharp.Tests/quality/QualityGMSDTest.cs b/test/OpenCvSharp.Tests/quality/QualityGMSDTest.cs new file mode 100644 index 000000000..3511bf818 --- /dev/null +++ b/test/OpenCvSharp.Tests/quality/QualityGMSDTest.cs @@ -0,0 +1,38 @@ +using OpenCvSharp.Quality; +using Xunit; + +namespace OpenCvSharp.Tests.Quality; + +public class QualityGMSDTest : TestBase +{ + [Fact] + public void Compute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + using (var psnr = QualityGMSD.Create(refImage)) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = psnr.Compute(targetImage); + Assert.Equal(0.0616, value[0], 4); + Assert.Equal(0.0711, value[1], 4); + Assert.Equal(0.05983, value[2], 5); + } + } + + [Fact] + public void StaticCompute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = QualityGMSD.Compute(refImage, targetImage, null); + Assert.Equal(0.0616, value[0], 4); + Assert.Equal(0.0711, value[1], 4); + Assert.Equal(0.05983, value[2], 5); + } + } +} diff --git a/test/OpenCvSharp.Tests/quality/QualityMSETest.cs b/test/OpenCvSharp.Tests/quality/QualityMSETest.cs new file mode 100644 index 000000000..f4f80fb77 --- /dev/null +++ b/test/OpenCvSharp.Tests/quality/QualityMSETest.cs @@ -0,0 +1,38 @@ +using OpenCvSharp.Quality; +using Xunit; + +namespace OpenCvSharp.Tests.Quality; + +public class QualityMSETest : TestBase +{ + [Fact] + public void Compute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + using (var psnr = QualityMSE.Create(refImage)) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = psnr.Compute(targetImage); + Assert.Equal(83.89224, value[0], 6); + Assert.Equal(96.848604, value[1], 6); + Assert.Equal(50.611845, value[2], 6); + } + } + + [Fact] + public void StaticCompute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = QualityMSE.Compute(refImage, targetImage, null); + Assert.Equal(83.89224, value[0], 6); + Assert.Equal(96.848604, value[1], 6); + Assert.Equal(50.611845, value[2], 6); + } + } +} diff --git a/test/OpenCvSharp.Tests/quality/QualityPSNRTest.cs b/test/OpenCvSharp.Tests/quality/QualityPSNRTest.cs new file mode 100644 index 000000000..d5e3ef86c --- /dev/null +++ b/test/OpenCvSharp.Tests/quality/QualityPSNRTest.cs @@ -0,0 +1,55 @@ +using OpenCvSharp.Quality; +using Xunit; + +#pragma warning disable 162 + +namespace OpenCvSharp.Tests.Quality; + +// ReSharper disable once InconsistentNaming +public class QualityPSNRTest : TestBase +{ + [Fact] + public void Compute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + using (var psnr = QualityPSNR.Create(refImage)) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = psnr.Compute(targetImage); + Assert.Equal(28.893586, value[0], 6); + Assert.Equal(28.26987, value[1], 6); + Assert.Equal(31.088282, value[2], 6); + } + } + + [Fact] + public void StaticCompute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = QualityPSNR.Compute(refImage, targetImage, null); + Assert.Equal(28.893586, value[0], 6); + Assert.Equal(28.26987, value[1], 6); + Assert.Equal(31.088282, value[2], 6); + } + } + + [Fact] + public void PropertyMaxPixelValue() + { + using (var refImage = LoadImage("lenna.png")) + using (var psnr = QualityPSNR.Create(refImage)) + { + const double value = 123.456; + psnr.MaxPixelValue = value; + Assert.Equal(value, psnr.MaxPixelValue, 6); + } + } +} + +// ReSharper disable once InconsistentNaming diff --git a/test/OpenCvSharp.Tests/quality/QualitySSIMTest.cs b/test/OpenCvSharp.Tests/quality/QualitySSIMTest.cs new file mode 100644 index 000000000..a9cee82c2 --- /dev/null +++ b/test/OpenCvSharp.Tests/quality/QualitySSIMTest.cs @@ -0,0 +1,38 @@ +using OpenCvSharp.Quality; +using Xunit; + +namespace OpenCvSharp.Tests.Quality; + +public class QualitySSIMTest : TestBase +{ + [Fact] + public void Compute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + using (var psnr = QualitySSIM.Create(refImage)) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = psnr.Compute(targetImage); + Assert.Equal(0.72, value[0], 3); + Assert.Equal(0.793, value[1], 3); + Assert.Equal(0.863, value[2], 3); + } + } + + [Fact] + public void StaticCompute() + { + using (var refImage = LoadImage("lenna.png")) + using (var targetImage = new Mat()) + { + Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); + + var value = QualitySSIM.Compute(refImage, targetImage, null); + Assert.Equal(0.72, value[0], 3); + Assert.Equal(0.793, value[1], 3); + Assert.Equal(0.863, value[2], 3); + } + } +} diff --git a/test/OpenCvSharp.Tests/stitching/CvDetailTest.cs b/test/OpenCvSharp.Tests/stitching/CvDetailTest.cs new file mode 100644 index 000000000..83ed3cef7 --- /dev/null +++ b/test/OpenCvSharp.Tests/stitching/CvDetailTest.cs @@ -0,0 +1,59 @@ +using OpenCvSharp.Detail; +using Xunit; + +namespace OpenCvSharp.Tests.Stitching; + +public class CvDetailTest: TestBase +{ + //[Fact] // TODO mac test fails + [PlatformSpecificFact("Windows", "Linux")] + public void ComputeImageFeaturesTest() + { + using var featuresFinder = AKAZE.Create(); + using var image = LoadImage("abbey_road.jpg", ImreadModes.Grayscale); + + using var features = CvDetail.ComputeImageFeatures(featuresFinder, image); + Assert.NotNull(features); + Assert.NotEqual(0, features.ImgIdx); + Assert.Equal(image.Size(), features.ImgSize); + Assert.NotEmpty(features.Keypoints); + Assert.NotNull(features.Descriptors); + Assert.False(features.Descriptors.Empty()); + } + + [Fact] + public void BestOf2NearestMatcherTest() + { + using var featuresFinder = AKAZE.Create(); + using var image1 = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + using var image2 = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); + + using var features1 = CvDetail.ComputeImageFeatures(featuresFinder, image1); + using var features2 = CvDetail.ComputeImageFeatures(featuresFinder, image2); + + using var matcher = new BestOf2NearestMatcher(); + using var matchesInfo = matcher.Apply(features1, features2); + Assert.NotEmpty(matchesInfo.Matches); + Assert.NotEmpty(matchesInfo.InliersMask); + Assert.False(matchesInfo.H.Empty()); + Assert.True(matchesInfo.Confidence > 0); + } + + [Fact] + public void AffineBestOf2NearestMatcherTest() + { + using var featuresFinder = AKAZE.Create(); + using var image1 = LoadImage("tsukuba_left.png", ImreadModes.Grayscale); + using var image2 = LoadImage("tsukuba_right.png", ImreadModes.Grayscale); + + using var features1 = CvDetail.ComputeImageFeatures(featuresFinder, image1); + using var features2 = CvDetail.ComputeImageFeatures(featuresFinder, image2); + + using var matcher = new AffineBestOf2NearestMatcher(); + using var matchesInfo = matcher.Apply(features1, features2); + Assert.NotEmpty(matchesInfo.Matches); + Assert.NotEmpty(matchesInfo.InliersMask); + Assert.False(matchesInfo.H.Empty()); + Assert.True(matchesInfo.Confidence > 0); + } +} diff --git a/test/OpenCvSharp.Tests/stitching/StitchingTest.cs b/test/OpenCvSharp.Tests/stitching/StitchingTest.cs index ed0d152d9..b16796d4f 100644 --- a/test/OpenCvSharp.Tests/stitching/StitchingTest.cs +++ b/test/OpenCvSharp.Tests/stitching/StitchingTest.cs @@ -1,76 +1,121 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using OpenCvSharp.Detail; +using Xunit; +using Xunit.Abstractions; -#pragma warning disable 162 +#pragma warning disable CA5394 // Do not use insecure randomness -namespace OpenCvSharp.Tests.Stitching +namespace OpenCvSharp.Tests.Stitching; + +public class StitchingTest : TestBase { - [TestFixture] - public class StitchingTest : TestBase + private readonly ITestOutputHelper testOutputHelper; + + public StitchingTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void Run() { - [Test] - public void Run() + Mat[] images = SelectStitchingImages(200, 200, 12); + + using (var stitcher = Stitcher.Create(Stitcher.Mode.Scans)) + using (var pano = new Mat()) + { + testOutputHelper.WriteLine("Stitching start..."); + var status = stitcher.Stitch(images, pano); + testOutputHelper.WriteLine("finish (status:{0})", status); + Assert.Equal(Stitcher.Status.OK, status); + + ShowImagesWhenDebugMode(pano); + } + + foreach (Mat image in images) { - const bool debugMode = false; - - Mat[] images = SelectStitchingImages(200, 200, 40, show: debugMode); - - using (var stitcher = Stitcher.Create(false)) - using (var pano = new Mat()) - { - Console.Write("Stitching start..."); - var status = stitcher.Stitch(images, pano); - Console.WriteLine(" finish (status:{0})", status); - Assert.That(status, Is.EqualTo(Stitcher.Status.OK)); - - // ReSharper disable ConditionIsAlwaysTrueOrFalse - if (debugMode) - Window.ShowImages(pano); - } - - foreach (Mat image in images) - { - image.Dispose(); - } + image.Dispose(); } + } - private Mat[] SelectStitchingImages(int width, int height, int count, bool show = false) + private static Mat[] SelectStitchingImages(int width, int height, int count) + { + var mats = new List(); + + using var source = LoadImage(@"lenna.png"); + using var result = source.Clone(); + var rand = new Random(123); // constant seed for test + for (int i = 0; i < count; i++) { - var mats = new List(); - - using (Mat source = Image(@"lenna.png", ImreadModes.Color)) - using (Mat result = source.Clone()) - { - var rand = new Random(123); // constant seed for test - for (int i = 0; i < count; i++) - { - int x1 = rand.Next(source.Cols - width); - int y1 = rand.Next(source.Rows - height); - int x2 = x1 + width; - int y2 = y1 + height; - - result.Line(new Point(x1, y1), new Point(x1, y2), new Scalar(0, 0, 255)); - result.Line(new Point(x1, y2), new Point(x2, y2), new Scalar(0, 0, 255)); - result.Line(new Point(x2, y2), new Point(x2, y1), new Scalar(0, 0, 255)); - result.Line(new Point(x2, y1), new Point(x1, y1), new Scalar(0, 0, 255)); - - Mat m = source[new Rect(x1, y1, width, height)]; - mats.Add(m.Clone()); - } - - if (show) - { - using (new Window(result)) - { - Cv2.WaitKey(); - } - } - } - - return mats.ToArray(); + int x1 = rand.Next(source.Cols - width); + int y1 = rand.Next(source.Rows - height); + int x2 = x1 + width; + int y2 = y1 + height; + + result.Line(new Point(x1, y1), new Point(x1, y2), new Scalar(0, 0, 255)); + result.Line(new Point(x1, y2), new Point(x2, y2), new Scalar(0, 0, 255)); + result.Line(new Point(x2, y2), new Point(x2, y1), new Scalar(0, 0, 255)); + result.Line(new Point(x2, y1), new Point(x1, y1), new Scalar(0, 0, 255)); + + Mat m = source[new Rect(x1, y1, width, height)]; + mats.Add(m.Clone()); } + ShowImagesWhenDebugMode(result); + + return mats.ToArray(); } -} + [Fact] + public void PropertyRegistrationResol() + { + using var stitcher = Stitcher.Create(); + const double value = 3.14159; + stitcher.RegistrationResol = value; + Assert.Equal(value, stitcher.RegistrationResol, 6); + } + + [Fact] + public void PropertySeamEstimationResol() + { + using var stitcher = Stitcher.Create(); + const double value = 3.14159; + stitcher.SeamEstimationResol = value; + Assert.Equal(value, stitcher.SeamEstimationResol, 6); + } + + [Fact] + public void PropertyRCompositingResol() + { + using var stitcher = Stitcher.Create(); + const double value = 3.14159; + stitcher.CompositingResol = value; + Assert.Equal(value, stitcher.CompositingResol, 6); + } + + [Fact] + public void PropertyPanoConfidenceThresh() + { + using var stitcher = Stitcher.Create(); + const double value = 3.14159; + stitcher.PanoConfidenceThresh = value; + Assert.Equal(value, stitcher.PanoConfidenceThresh, 6); + } + + [Fact] + public void PropertyWaveCorrection() + { + using var stitcher = Stitcher.Create(); + const bool value = true; + stitcher.WaveCorrection = value; + Assert.Equal(value, stitcher.WaveCorrection); + } + + [Fact] + public void PropertyWaveCorrectKind() + { + using var stitcher = Stitcher.Create(); + const WaveCorrectKind value = WaveCorrectKind.Vertical; + stitcher.WaveCorrectKind = value; + Assert.Equal(value, stitcher.WaveCorrectKind); + } +} diff --git a/test/OpenCvSharp.Tests/system/AppDomainTest.cs b/test/OpenCvSharp.Tests/system/AppDomainTest.cs new file mode 100644 index 000000000..f2ee4db65 --- /dev/null +++ b/test/OpenCvSharp.Tests/system/AppDomainTest.cs @@ -0,0 +1,94 @@ +#if NET48 +using System.Globalization; +using System.Security.Policy; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests; + +public class MarshalByRefAction : MarshalByRefObject +{ + public Action? Action { get; set; } + public void Run() => Action?.Invoke(); +} + +[Collection(nameof(AppDomainTest))] // should not be run test in parallel +[Serializable] +public class AppDomainTest : TestBase +{ + // https://github.com/shimat/opencvsharp/issues/389 + // http://urasandesu.blogspot.com/2012/02/appdomain-how-to-use-unmanaged-code-as.html + + private readonly ITestOutputHelper testOutputHelper; + + public AppDomainTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [ExplicitFact] + public void Test() + { + using (var mat1 = new Mat(@"_data\image\lenna.png")) + { + Assert.Throws(() => + { + Cv2.MedianBlur(mat1, mat1, 2 /*even*/); + }); + } + + for (int i = 0; i < 100; i++) + { + RunAtIsolatedDomain(AppDomain.CurrentDomain, () => + { + // ITestOutputHelper cannot be serialized + // ReSharper disable once Xunit.XunitTestWithConsoleOutput + testOutputHelper.WriteLine(Cv2.GetTickCount().ToString(CultureInfo.InvariantCulture)); + using var mat2 = new Mat(@"_data\image\lenna.png"); + try + { + Cv2.MedianBlur(mat2, mat2, 2 /*even*/); + } + catch (OpenCVException ex) + { + // OK + GC.KeepAlive(ex); + } + }); + } + + // avoid AppDomainUnloadedException on subsequent tests https://codeday.me/jp/qa/20190609/973822.html + Thread.Sleep(TimeSpan.FromSeconds(2)); + } + + private static void RunAtIsolatedDomain(Evidence securityInfo, AppDomainSetup info, Action action) + { + //if (!action.Method.IsStatic) + // throw new ArgumentException("", nameof(action)); + + AppDomain? domain = null; + try + { + domain = AppDomain.CreateDomain("MyDomain " + action.Method, securityInfo, info); + var type = typeof(MarshalByRefAction); + Assert.NotNull(type.FullName); + var runner = (MarshalByRefAction)domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName); + runner.Action = action; + runner.Run(); + } + finally + { + if (domain is not null) + AppDomain.Unload(domain); + } + } + + private static void RunAtIsolatedDomain(AppDomain source, Action action) + { + if (source is null) + throw new ArgumentNullException(nameof(source)); + RunAtIsolatedDomain(source.Evidence, source.SetupInformation, action); + } +} + +#endif diff --git a/test/OpenCvSharp.Tests/system/ExceptionTest.cs b/test/OpenCvSharp.Tests/system/ExceptionTest.cs new file mode 100644 index 000000000..1a27d4111 --- /dev/null +++ b/test/OpenCvSharp.Tests/system/ExceptionTest.cs @@ -0,0 +1,105 @@ +using Xunit; + +namespace OpenCvSharp.Tests; + +/// +/// RedirectError tests +/// +public class ExceptionTest : TestBase +{ + private const int TrialCount = 10; + + [Fact] + public void MatRow() + { + for (int i = 0; i < TrialCount; i++) + { + using var mat = new Mat(1, 1, MatType.CV_8UC1); + var ex = Assert.Throws(() => + { + using var row = mat.Row(100); + GC.KeepAlive(row); + }); + + Assert.StartsWith("0 <= _rowRange", ex.ErrMsg, StringComparison.Ordinal); + Assert.NotEmpty(ex.FileName); + Assert.NotEmpty(ex.FuncName); + Assert.True(ex.Line > 0); + Assert.Equal(ErrorCode.StsAssert, ex.Status); + } + } + + [Fact] + public void MatInv() + { + for (int i = 0; i < TrialCount; i++) + { + var data = new byte[] {1, 10, 100}; + using var mat = Mat.FromPixelData(3, 1, MatType.CV_8UC1, data); + var ex = Assert.Throws(() => + { + using var expr = mat.Inv(); + using var evaluated = expr.ToMat(); + GC.KeepAlive(evaluated); + }); + + Assert.StartsWith("type == CV_32F", ex.ErrMsg, StringComparison.Ordinal); + Assert.NotEmpty(ex.FileName); + Assert.NotEmpty(ex.FuncName); + Assert.True(ex.Line > 0); + Assert.Equal(ErrorCode.StsAssert, ex.Status); + } + } + + [Fact] + public void GaussianBlur() + { + for (int i = 0; i < TrialCount; i++) + { + using var img = new Mat(3, 3, MatType.CV_8UC1); + var ex = Assert.Throws( + () => { Cv2.GaussianBlur(img, img, new Size(2, 2), 1); }); + + Assert.StartsWith("ksize.width > 0", ex.ErrMsg, StringComparison.Ordinal); + Assert.NotEmpty(ex.FileName); + Assert.NotEmpty(ex.FuncName); + Assert.True(ex.Line > 0); + Assert.Equal(ErrorCode.StsAssert, ex.Status); + } + } + + [Fact] + public void MedianBlur() + { + for (int i = 0; i < TrialCount; i++) + { + using var img = new Mat(3, 3, MatType.CV_8UC1); + var ex = Assert.Throws( + () => { Cv2.MedianBlur(img, img, 2); }); + + Assert.StartsWith("(ksize % 2 == 1", ex.ErrMsg, StringComparison.Ordinal); + Assert.NotEmpty(ex.FileName); + Assert.NotEmpty(ex.FuncName); + Assert.True(ex.Line > 0); + Assert.Equal(ErrorCode.StsAssert, ex.Status); + } + } + + [Fact] + public void ArucoDetectMarkers() + { + using var image = new Mat(); + using var dict = OpenCvSharp.Aruco.CvAruco.GetPredefinedDictionary(OpenCvSharp.Aruco.PredefinedDictionaryName.Dict6X6_250); + + var param = new OpenCvSharp.Aruco.DetectorParameters(); + + var ex = Assert.Throws( + () => { OpenCvSharp.Aruco.CvAruco.DetectMarkers(image, dict, out _, out _, param, out _); }); + + Assert.StartsWith("!_image.empty()", ex.ErrMsg, StringComparison.Ordinal); + Assert.NotEmpty(ex.FileName); + Assert.NotEmpty(ex.FuncName); + Assert.True(ex.Line > 0); + Assert.Equal(ErrorCode.StsAssert, ex.Status); + } +} diff --git a/test/OpenCvSharp.Tests/system/SaturateCastTest.cs b/test/OpenCvSharp.Tests/system/SaturateCastTest.cs new file mode 100644 index 000000000..3188dcc1f --- /dev/null +++ b/test/OpenCvSharp.Tests/system/SaturateCastTest.cs @@ -0,0 +1,25 @@ +using OpenCvSharp.Internal.Util; +using Xunit; + +namespace OpenCvSharp.Tests; + +public class SaturateCastTest +{ + [Theory] + [InlineData(10, 10)] + [InlineData(-1, 0)] + [InlineData(256, 255)] + public void ToByteFromInt(int from, byte to) + { + Assert.Equal(to, SaturateCast.ToByte(from)); + } + + [Theory] + [InlineData(1.2345, 1)] + [InlineData(-10000.98765, 0)] + [InlineData(10000.12345, 255)] + public void ToByteFromDouble(double from, byte to) + { + Assert.Equal(to, SaturateCast.ToByte(from)); + } +} diff --git a/test/OpenCvSharp.Tests/system/StdStringTest.cs b/test/OpenCvSharp.Tests/system/StdStringTest.cs new file mode 100644 index 000000000..72056f050 --- /dev/null +++ b/test/OpenCvSharp.Tests/system/StdStringTest.cs @@ -0,0 +1,31 @@ +using OpenCvSharp.Internal; +using Xunit; + +namespace OpenCvSharp.Tests; + +// ReSharper disable InconsistentNaming +public class StdStringTest : TestBase +{ + [Fact] + public void SimpleNew() + { + using var s = new StdString(); + GC.KeepAlive(s); + } + + [Fact] + public void ToStringSinglebyte() + { + const string value = "https://www.amazon.co.jp/"; + using var s = new StdString(value); + Assert.Equal(value, s.ToString()); + } + + [Fact] + public void ToStringMultibyte() + { + const string value = "OpenCV"; + using var s = new StdString(value); + Assert.Equal(value, s.ToString()); + } +} diff --git a/test/OpenCvSharp.Tests/system/VectorTest.cs b/test/OpenCvSharp.Tests/system/VectorTest.cs new file mode 100644 index 000000000..d846cfa9e --- /dev/null +++ b/test/OpenCvSharp.Tests/system/VectorTest.cs @@ -0,0 +1,48 @@ +using OpenCvSharp.Internal.Vectors; +using Xunit; + +namespace OpenCvSharp.Tests; + +// ReSharper disable InconsistentNaming +public class VectorTest : TestBase +{ + [Fact] + public void VectorOfMat() + { + var mats = new Mat[] + { + Mat.Eye(2, 2, MatType.CV_8UC1), + Mat.Ones(2, 2, MatType.CV_64FC1), + }; + + using (var vec = new VectorOfMat(mats)) + { + Assert.Equal(2, vec.Size); + var dst = vec.ToArray(); + Assert.Equal(2, dst.Length); + + var eye = dst[0]; + var one = dst[1]; + + Assert.Equal(1, eye.Get(0, 0)); + Assert.Equal(0, eye.Get(0, 1)); + Assert.Equal(0, eye.Get(1, 0)); + Assert.Equal(1, eye.Get(1, 1)); + + Assert.Equal(1, one.Get(0, 0), 6); + Assert.Equal(1, one.Get(0, 1), 6); + Assert.Equal(1, one.Get(1, 0), 6); + Assert.Equal(1, one.Get(1, 1), 6); + + foreach (var d in dst) + { + d.Dispose(); + } + } + + foreach (var mat in mats) + { + mat.Dispose(); + } + } +} diff --git a/test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs b/test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs new file mode 100644 index 000000000..5d33bc2b6 --- /dev/null +++ b/test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs @@ -0,0 +1,19 @@ +using OpenCvSharp.Internal; +using Xunit; + +namespace OpenCvSharp.Tests; + +public class WindowsLibraryLoaderTest +{ + [Fact] + public void IsDotNetCore() + { +#if NET48 + Assert.False(WindowsLibraryLoader.IsDotNetCore()); +#elif NETCOREAPP3_1_OR_GREATER + Assert.True(WindowsLibraryLoader.IsDotNetCore()); +#else + throw new OpenCvSharpException("Unexpected environment."); +#endif + } +} diff --git a/test/OpenCvSharp.Tests/text/DetectTextSWTTest.cs b/test/OpenCvSharp.Tests/text/DetectTextSWTTest.cs new file mode 100644 index 000000000..bf9d54abf --- /dev/null +++ b/test/OpenCvSharp.Tests/text/DetectTextSWTTest.cs @@ -0,0 +1,19 @@ +using OpenCvSharp.Text; +using Xunit; + +namespace OpenCvSharp.Tests.Text; + +public class DetectTextSWTTest : TestBase +{ + [Fact] + public void Test() + { + using var src = new Mat("_data/image/imageText.png"); + using var draw = new Mat(); + + var rects = CvText.DetectTextSWT(src, true, draw); + Assert.NotEmpty(rects); + + ShowImagesWhenDebugMode(src, draw); + } +} diff --git a/test/OpenCvSharp.Tests/text/OCRTesseractTest.cs b/test/OpenCvSharp.Tests/text/OCRTesseractTest.cs new file mode 100644 index 000000000..4cb590b9b --- /dev/null +++ b/test/OpenCvSharp.Tests/text/OCRTesseractTest.cs @@ -0,0 +1,42 @@ +using OpenCvSharp.Text; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.Text; + +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedVariable +public class OCRTesseractTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public OCRTesseractTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + private const string TessData = @"_data/tessdata/"; + + [Fact] + public void Create() + { + using (var tesseract = OCRTesseract.Create(TessData)) + { + GC.KeepAlive(tesseract); + } + } + + [Fact] + public void Run() + { + using (var image = LoadImage("alphabet.png")) + using (var tesseract = OCRTesseract.Create(TessData, "eng")) + { + tesseract.Run(image, + out var outputText, out var componentRects, out var componentTexts, out var componentConfidences); + + testOutputHelper.WriteLine(outputText); + Assert.NotEmpty(outputText); + } + } +} diff --git a/test/OpenCvSharp.Tests/text/TextDetectorTest.cs b/test/OpenCvSharp.Tests/text/TextDetectorTest.cs new file mode 100644 index 000000000..ee9703aff --- /dev/null +++ b/test/OpenCvSharp.Tests/text/TextDetectorTest.cs @@ -0,0 +1,62 @@ +using System.Diagnostics; +using System.Net.Http; +using Xunit; + +namespace OpenCvSharp.Tests.Text; + +public class TextDetectorTest : TestBase +{ + private const string ModelArch = "_data/text/textbox.prototxt"; + private const string ModelWeights = "_data/model/TextBoxes_icdar13.caffemodel"; + private const string ModelWeightsUrl = "https://drive.google.com/uc?id=10rqbOxZphuwk0TaWCaixIhheIBnxoaxv&export=download"; + + public TextDetectorTest() + { + if (!File.Exists(ModelWeights)) + { + using var handler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true + }; + using var client = new HttpClient(handler); + var data = client.GetByteArrayAsync(new Uri(ModelWeightsUrl)).GetAwaiter().GetResult(); + File.WriteAllBytes(ModelWeights, data); + } + } + + [Fact] + public void Create() + { + Assert.True(File.Exists(ModelArch), $"modelArch '{ModelArch}' not found"); + Assert.True(File.Exists(ModelWeights), $"modelWeights '{ModelWeights}' not found"); + + var modelWeightsFileInfo = new FileInfo(ModelWeights); + Assert.True(modelWeightsFileInfo.Length > 10_000_000, $"{Path.GetFullPath(ModelWeights)}: {modelWeightsFileInfo.Length} bytes"); + + using (var detector = TextDetectorCNN.Create(ModelArch, ModelWeights)) + { + GC.KeepAlive(detector); + } + } + + [Fact] + public void Detect() + { + using var detector = TextDetectorCNN.Create(ModelArch, ModelWeights); + using var image = LoadImage("imageTextR.png", ImreadModes.Color); + detector.Detect(image, out var boxes, out var confidences); + + Assert.NotEmpty(boxes); + Assert.NotEmpty(confidences); + Assert.Equal(boxes.Length, confidences.Length); + + if (Debugger.IsAttached) + { + foreach (var box in boxes) + { + image.Rectangle(box, Scalar.Red, 2); + } + Window.ShowImages(image); + } + } +} diff --git a/test/OpenCvSharp.Tests/tracking/TrackerCSRTTest.cs b/test/OpenCvSharp.Tests/tracking/TrackerCSRTTest.cs new file mode 100644 index 000000000..d97459d68 --- /dev/null +++ b/test/OpenCvSharp.Tests/tracking/TrackerCSRTTest.cs @@ -0,0 +1,23 @@ +using OpenCvSharp.Tracking; +using Xunit; + +namespace OpenCvSharp.Tests.Tracking; + +// ReSharper disable once InconsistentNaming +// ReSharper disable once IdentifierTypo +public class TrackerCSRTTest : TrackerTestBase +{ + [Fact] + public void Init() + { + using var tracker = TrackerCSRT.Create(); + InitBase(tracker); + } + + [Fact] + public void Update() + { + using var tracker = TrackerCSRT.Create(); + UpdateBase(tracker); + } +} diff --git a/test/OpenCvSharp.Tests/tracking/TrackerGOTURNTest.cs b/test/OpenCvSharp.Tests/tracking/TrackerGOTURNTest.cs new file mode 100644 index 000000000..1641d5a0d --- /dev/null +++ b/test/OpenCvSharp.Tests/tracking/TrackerGOTURNTest.cs @@ -0,0 +1,21 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Tracking; + +// ReSharper disable once InconsistentNaming +public class TrackerGOTURNTest : TrackerTestBase +{ + [Fact(Skip = "fs.is_open(). Can't open \"goturn.prototxt\"")] + public void Init() + { + using var tracker = TrackerGOTURN.Create(); + InitBase(tracker); + } + + [Fact(Skip = "fs.is_open(). Can't open \"goturn.prototxt\"")] + public void Update() + { + using var tracker = TrackerGOTURN.Create(); + UpdateBase(tracker); + } +} diff --git a/test/OpenCvSharp.Tests/tracking/TrackerKCFTest.cs b/test/OpenCvSharp.Tests/tracking/TrackerKCFTest.cs new file mode 100644 index 000000000..c80a3c4dc --- /dev/null +++ b/test/OpenCvSharp.Tests/tracking/TrackerKCFTest.cs @@ -0,0 +1,39 @@ +using OpenCvSharp.Tracking; +using Xunit; + +namespace OpenCvSharp.Tests.Tracking; + +// ReSharper disable once InconsistentNaming +public class TrackerKCFTest : TrackerTestBase +{ + [Fact] + public void Init() + { + using var tracker = TrackerKCF.Create(); + InitBase(tracker); + } + + // https://github.com/shimat/opencvsharp/issues/459 + [Fact] + public void Issue459() + { + var paras = new TrackerKCF.Params + { + CompressFeature = true, + CompressedSize = 1, + Resize = true, + DescNpca = 1, + DescPca = 1 + }; + + using var tracker = TrackerKCF.Create(paras); + GC.KeepAlive(tracker); + } + + [Fact] + public void Update() + { + using var tracker = TrackerKCF.Create(); + UpdateBase(tracker); + } +} diff --git a/test/OpenCvSharp.Tests/tracking/TrackerMILTest.cs b/test/OpenCvSharp.Tests/tracking/TrackerMILTest.cs new file mode 100644 index 000000000..a99faef51 --- /dev/null +++ b/test/OpenCvSharp.Tests/tracking/TrackerMILTest.cs @@ -0,0 +1,21 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Tracking; + +// ReSharper disable once InconsistentNaming +public class TrackerMILTest : TrackerTestBase +{ + [Fact] + public void Init() + { + using var tracker = TrackerMIL.Create(); + InitBase(tracker); + } + + [Fact] + public void Update() + { + using var tracker = TrackerMIL.Create(); + UpdateBase(tracker); + } +} diff --git a/test/OpenCvSharp.Tests/tracking/TrackerTestBase.cs b/test/OpenCvSharp.Tests/tracking/TrackerTestBase.cs new file mode 100644 index 000000000..e397b8136 --- /dev/null +++ b/test/OpenCvSharp.Tests/tracking/TrackerTestBase.cs @@ -0,0 +1,58 @@ +using System.Diagnostics; + +namespace OpenCvSharp.Tests.Tracking; + +public abstract class TrackerTestBase : TestBase +{ + protected static void InitBase(Tracker tracker) + { + if (tracker is null) + throw new ArgumentNullException(nameof(tracker)); + + using var vc = LoadImage("lenna.png"); + tracker.Init(vc, new Rect(220, 60, 200, 220)); + } + + protected static void UpdateBase(Tracker tracker) + { + if (tracker is null) + throw new System.ArgumentNullException(nameof(tracker)); + + // ETHZ dataset + // ETHZ is Eidgenössische Technische Hochschule Zürich, in Deutsch + // https://data.vision.ee.ethz.ch/cvl/aess/cvpr2008/seq03-img-left.tar.gz + // This video could be research data and it may not allow to use commercial use. + // This test can not track person perfectly but it is enough to test whether unit test works. + + // This rect indicates person who be captured in first frame + var bb = new Rect(286, 146, 70, 180); + + // If you want to save markers image, you must change the following values. + const string path = @"_data/image/ETHZ/seq03-img-left"; + + foreach (var i in Enumerable.Range(0, 21)) + { + var file = $"image_{i:D8}_0.png"; + + using var mat = new Mat(Path.Combine(path, file)); + if (i == 0) + { + tracker.Init(mat, bb); + } + else + { + tracker.Update(mat, ref bb); + } + + if (Debugger.IsAttached) + { + Directory.CreateDirectory(path); + mat.Rectangle( + new Point((int) bb.X, (int) bb.Y), + new Point((int) (bb.X + bb.Width), (int) (bb.Y + bb.Height)), + new Scalar(0, 0, 255)); + Cv2.ImWrite(Path.Combine(path, file), mat); + } + } + } +} diff --git a/test/OpenCvSharp.Tests/video/BackgroundSubtractorKNNTest.cs b/test/OpenCvSharp.Tests/video/BackgroundSubtractorKNNTest.cs new file mode 100644 index 000000000..c3b7ea2ad --- /dev/null +++ b/test/OpenCvSharp.Tests/video/BackgroundSubtractorKNNTest.cs @@ -0,0 +1,33 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Video; + +// ReSharper disable InconsistentNaming +public class BackgroundSubtractorKNNTest : TestBase +{ + [Fact] + public void CheckProperties() + { + using (var knn = BackgroundSubtractorKNN.Create()) + { + knn.DetectShadows = knn.DetectShadows; + knn.History = knn.History; + knn.ShadowThreshold = knn.ShadowThreshold; + knn.ShadowValue = knn.ShadowValue; + knn.Dist2Threshold = knn.Dist2Threshold; + knn.KNNSamples = knn.KNNSamples; + knn.NSamples = knn.NSamples; + } + } + + [Fact] + public void Apply() + { + using (var knn = BackgroundSubtractorKNN.Create()) + using (var src = LoadImage("lenna.png")) + using (var dst = new Mat()) + { + knn.Apply(src, dst); + } + } +} diff --git a/test/OpenCvSharp.Tests/video/BackgroundSubtractorMOG2Test.cs b/test/OpenCvSharp.Tests/video/BackgroundSubtractorMOG2Test.cs new file mode 100644 index 000000000..1b7e578f4 --- /dev/null +++ b/test/OpenCvSharp.Tests/video/BackgroundSubtractorMOG2Test.cs @@ -0,0 +1,38 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Video; + +// ReSharper disable InconsistentNaming +public class BackgroundSubtractorMOG2Test : TestBase +{ + [Fact] + public void CheckProperties() + { + using (var mog = BackgroundSubtractorMOG2.Create()) + { + mog.BackgroundRatio = mog.BackgroundRatio; + mog.ComplexityReductionThreshold = mog.ComplexityReductionThreshold; + mog.DetectShadows = mog.DetectShadows; + mog.History = mog.History; + mog.NMixtures = mog.NMixtures; + mog.ShadowThreshold = mog.ShadowThreshold; + mog.ShadowValue = mog.ShadowValue; + mog.VarInit = mog.VarInit; + mog.VarMax = mog.VarMax; + mog.VarMin = mog.VarMin; + mog.VarThreshold = mog.VarThreshold; + mog.VarThresholdGen = mog.BackgroundRatio; + } + } + + [Fact] + public void Apply() + { + using (var mog = BackgroundSubtractorMOG2.Create()) + using (var src = LoadImage("lenna.png")) + using (var dst = new Mat()) + { + mog.Apply(src, dst); + } + } +} diff --git a/test/OpenCvSharp.Tests/video/KalmanTest.cs b/test/OpenCvSharp.Tests/video/KalmanTest.cs new file mode 100644 index 000000000..545e51e75 --- /dev/null +++ b/test/OpenCvSharp.Tests/video/KalmanTest.cs @@ -0,0 +1,186 @@ +using Xunit; + +namespace OpenCvSharp.Tests.Video; + +public class KalmanTest : TestBase +{ + [Fact] + public void StatePre() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.StatePre; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.StatePre = mat; + IsDataEqual(mat, kalman.StatePre); + } + + [Fact] + public void StatePost() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.StatePost; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.StatePost = mat; + IsDataEqual(mat, kalman.StatePost); + } + + [Fact] + public void TransitionMatrix() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.TransitionMatrix; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.TransitionMatrix = mat; + IsDataEqual(mat, kalman.TransitionMatrix); + } + + [Fact] + public void ControlMatrix() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.ControlMatrix; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.ControlMatrix = mat; + IsDataEqual(mat, kalman.ControlMatrix); + } + + [Fact] + public void MeasurementMatrix() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.MeasurementMatrix; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.MeasurementMatrix = mat; + IsDataEqual(mat, kalman.MeasurementMatrix); + } + + [Fact] + public void ProcessNoiseCov() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.ProcessNoiseCov; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.ProcessNoiseCov = mat; + IsDataEqual(mat, kalman.ProcessNoiseCov); + } + + [Fact] + public void MeasurementNoiseCov() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.MeasurementNoiseCov; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.MeasurementNoiseCov = mat; + IsDataEqual(mat, kalman.MeasurementNoiseCov); + } + + [Fact] + public void ErrorCovPre() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.ErrorCovPre; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.ErrorCovPre = mat; + IsDataEqual(mat, kalman.ErrorCovPre); + } + + [Fact] + public void Gain() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.Gain; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.Gain = mat; + IsDataEqual(mat, kalman.Gain); + } + + [Fact] + public void ErrorCovPost() + { + using var kalman = new KalmanFilter(); + using var propValue = kalman.ErrorCovPost; + Assert.NotNull(propValue); + Assert.True(propValue.Empty()); + + using var mat = Mat.FromPixelData(2, 2, MatType.CV_8U, new byte[,] + { + { 1, 1 }, + { 0, 1 } + }); + kalman.ErrorCovPost = mat; + IsDataEqual(mat, kalman.ErrorCovPost); + } + + private static void IsDataEqual(Mat lhs, Mat rhs) + { + Assert.Equal(lhs.Size(), rhs.Size()); + Assert.Equal(lhs.Type(), rhs.Type()); + Assert.Equal(lhs.Sum(), rhs.Sum()); + + using var diff = lhs - rhs; + Assert.Equal(Scalar.Black, Cv2.Sum(diff)); + } +} diff --git a/test/OpenCvSharp.Tests/videoio/VideoCaptureTest.cs b/test/OpenCvSharp.Tests/videoio/VideoCaptureTest.cs new file mode 100644 index 000000000..dfdb2c11e --- /dev/null +++ b/test/OpenCvSharp.Tests/videoio/VideoCaptureTest.cs @@ -0,0 +1,128 @@ +using System.Diagnostics; +using Xunit; + +namespace OpenCvSharp.Tests.VideoIO; +#if NETFRAMEWORK + public class VideoCaptureTest : TestBase + { + [Fact] + public void ReadImageSequence() + { + using var capture = new VideoCapture("_data/image/blob/shapes%d.png"); + using var image1 = new Mat("_data/image/blob/shapes1.png", ImreadModes.Color); + using var image2 = new Mat("_data/image/blob/shapes2.png", ImreadModes.Color); + using var image3 = new Mat("_data/image/blob/shapes3.png", ImreadModes.Color); + + Assert.True(capture.IsOpened()); + Assert.Equal("CV_IMAGES", capture.GetBackendName()); + Assert.Equal(3, capture.FrameCount); + + using var frame1 = new Mat(); + using var frame2 = new Mat(); + using var frame3 = new Mat(); + using var frame4 = new Mat(); + Assert.True(capture.Read(frame1)); + Assert.True(capture.Read(frame2)); + Assert.True(capture.Read(frame3)); + Assert.False(capture.Read(frame4)); + Assert.False(frame1.Empty()); + Assert.False(frame2.Empty()); + Assert.False(frame3.Empty()); + Assert.True(frame4.Empty()); + + Cv2.CvtColor(frame1, frame1, ColorConversionCodes.BGRA2BGR); + Cv2.CvtColor(frame2, frame2, ColorConversionCodes.BGRA2BGR); + Cv2.CvtColor(frame3, frame3, ColorConversionCodes.BGRA2BGR); + ImageEquals(image1, frame1); + ImageEquals(image2, frame2); + ImageEquals(image3, frame3); + + if (Debugger.IsAttached) + { + Window.ShowImages(frame1, frame2, frame3, frame4); + } + } + + [Fact] + public void GrabAndRetrieveImageSequence() + { + using var capture = new VideoCapture("_data/image/blob/shapes%d.png"); + using var image1 = new Mat("_data/image/blob/shapes1.png", ImreadModes.Color); + using var image2 = new Mat("_data/image/blob/shapes2.png", ImreadModes.Color); + using var image3 = new Mat("_data/image/blob/shapes3.png", ImreadModes.Color); + + Assert.True(capture.IsOpened()); + Assert.Equal("CV_IMAGES", capture.GetBackendName()); + Assert.Equal(3, capture.FrameCount); + + using var frame1 = new Mat(); + using var frame2 = new Mat(); + using var frame3 = new Mat(); + using var frame4 = new Mat(); + Assert.True(capture.Grab()); + Assert.True(capture.Retrieve(frame1)); + Assert.True(capture.Grab()); + Assert.True(capture.Retrieve(frame2)); + Assert.True(capture.Grab()); + Assert.True(capture.Retrieve(frame3)); + Assert.False(capture.Grab()); + Assert.False(capture.Retrieve(frame4)); + + Assert.False(frame1.Empty()); + Assert.False(frame2.Empty()); + Assert.False(frame3.Empty()); + Assert.True(frame4.Empty()); + + Cv2.CvtColor(frame1, frame1, ColorConversionCodes.BGRA2BGR); + Cv2.CvtColor(frame2, frame2, ColorConversionCodes.BGRA2BGR); + Cv2.CvtColor(frame3, frame3, ColorConversionCodes.BGRA2BGR); + ImageEquals(image1, frame1); + ImageEquals(image2, frame2); + ImageEquals(image3, frame3); + + if (Debugger.IsAttached) + { + Window.ShowImages(frame1, frame2, frame3, frame4); + } + } + + [Fact] + public void GetSetExceptionMode() + { + using var capture = new VideoCapture(); + + capture.SetExceptionMode(false); + Assert.False(capture.GetExceptionMode()); + + capture.SetExceptionMode(true); + Assert.True(capture.GetExceptionMode()); + } + + [PlatformSpecificFact("Windows")] + public void WaitAnyWindows() + { + using var capture = new VideoCapture("_data/image/blob/shapes%d.png"); + Assert.True(capture.IsOpened()); + + var ex = Assert.Throws(() => + { + var result = VideoCapture.WaitAny(new[] {capture}, out var readyIndex, 0); + }); + Assert.Equal("VideoCapture::waitAny() is supported by V4L backend only", ex.ErrMsg); + } + + [PlatformSpecificFact("Linux")] + public void WaitAnyLinux() + { + using var capture = new VideoCapture("_data/image/blob/shapes%d.png", VideoCaptureAPIs.V4L2); + Assert.True(capture.IsOpened()); + + var result = VideoCapture.WaitAny(new[] {capture}, out var readyIndex, 0); + Assert.True(result); + Assert.Equal(new[]{0}, readyIndex); + + Assert.True(capture.IsOpened()); + Assert.True(capture.Grab()); + } + } +#endif diff --git a/test/OpenCvSharp.Tests/videoio/VideoWriterTest.cs b/test/OpenCvSharp.Tests/videoio/VideoWriterTest.cs new file mode 100644 index 000000000..fea0d4280 --- /dev/null +++ b/test/OpenCvSharp.Tests/videoio/VideoWriterTest.cs @@ -0,0 +1,206 @@ +using System.Runtime.CompilerServices; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.VideoIO; +#if NETFRAMEWORK +public class VideoWriterTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public VideoWriterTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void WriteAndCapture() + { + const string fileName = "dummy1.avi"; + try + { + using var image = LoadImage("lenna.png"); + + { + using var writer = new VideoWriter(fileName, VideoCaptureAPIs.OPENCV_MJPEG, FourCC.MJPG, 10, image.Size()); + Assert.True(writer.IsOpened()); + writer.Write(image); + writer.Write(image); + writer.Write(image); + } + + using var capture = new VideoCapture(fileName); + Assert.True(capture.IsOpened()); + + var backendName = capture.GetBackendName(); + testOutputHelper.WriteLine($"[{nameof(WriteAndCapture)}] BackendName: {backendName}"); + Assert.True(backendName == "MSMF" || backendName == "CV_MJPEG" || backendName == "FFMPEG", + $"Unexpected VideoWriter backend: {backendName}"); + + Assert.Equal(3, capture.FrameCount); + + using var frame1 = new Mat(); + using var frame2 = new Mat(); + using var frame3 = new Mat(); + using var frame4 = new Mat(); + Assert.True(capture.Read(frame1)); + Assert.True(capture.Read(frame2)); + Assert.True(capture.Read(frame3)); + Assert.False(capture.Read(frame4)); + Assert.False(frame1.Empty()); + Assert.False(frame2.Empty()); + Assert.False(frame3.Empty()); + Assert.True(frame4.Empty()); + + Assert.Equal(image.Size(), frame1.Size()); + } + finally + { + DeleteFile(fileName); + } + } + + [Fact] + public void GetSetOption() + { + const string fileName = "dummy2.avi"; + try + { + using var writer = new VideoWriter(fileName, VideoCaptureAPIs.OPENCV_MJPEG, FourCC.MJPG, 10, new Size(640, 480)); + Assert.True(writer.IsOpened()); + Assert.Equal("CV_MJPEG", writer.GetBackendName()); + + Assert.True(writer.Set(VideoWriterProperties.Quality, 50), "VideoWriter.Set failed"); + Assert.Equal(50, writer.Get(VideoWriterProperties.Quality), 3); + } + finally + { + DeleteFile(fileName); + } + } + + [Fact] + public void XVID() + { + const string fileName = "temp_XVID.mp4"; + try + { + using var writer = new VideoWriter(); + var success = writer.Open( + fileName, + VideoCaptureAPIs.ANY, + FourCC.XVID, + 15, + new Size(1920, 1440)); + Assert.True(success); + } + finally + { + DeleteFile(fileName); + } + } + + [Fact] + public void DIVX() + { + const string fileName = "temp_DIVX.mp4"; + try + { + using var writer = new VideoWriter(); + var success = writer.Open( + fileName, + VideoCaptureAPIs.ANY, + FourCC.DIVX, + 15, + new Size(1920, 1440)); + Assert.True(success); + } + finally + { + DeleteFile(fileName); + } + } + + [ExplicitFact] + public void MP4V() + { + const string fileName = "temp_MP4V.mp4"; + try + { + using var writer = new VideoWriter(); + var success = writer.Open( + fileName, + VideoCaptureAPIs.ANY, + FourCC.MP4V, + 15, + new Size(1920, 1440)); + Assert.True(success); + } + finally + { + DeleteFile(fileName); + } + } + + [ExplicitFact] + public void WMV3() + { + const string fileName = "temp_WMV3.mp4"; + try + { + using var writer = new VideoWriter(); + var success = writer.Open( + fileName, + VideoCaptureAPIs.ANY, + FourCC.WMV3, + 15, + new Size(1920, 1440)); + Assert.True(success); + } + finally + { + DeleteFile(fileName); + } + } + + [ExplicitFact] + public void X264() + { + const string fileName = "temp_X264.mp4"; + try + { + using var writer = new VideoWriter(); + var success = writer.Open( + fileName, + VideoCaptureAPIs.ANY, + FourCC.X264, + 15, + new Size(1920, 1440)); + Assert.True(success); + } + finally + { + DeleteFile(fileName); + } + } + + private void DeleteFile(string fileName, [CallerMemberName] string callerMemberName = "") + { + try + { + if (File.Exists(fileName)) + { + File.Delete(fileName); + } + } + catch (IOException ex) + { + testOutputHelper.WriteLine("[{0}]: {1}", callerMemberName, ex); + } + catch (UnauthorizedAccessException ex) + { + testOutputHelper.WriteLine("[{0}]: {1}", callerMemberName, ex); + } + } +} +#endif diff --git a/test/OpenCvSharp.Tests/wechat_qrcode/WeChatQRCodeTest.cs b/test/OpenCvSharp.Tests/wechat_qrcode/WeChatQRCodeTest.cs new file mode 100644 index 000000000..fe4e94981 --- /dev/null +++ b/test/OpenCvSharp.Tests/wechat_qrcode/WeChatQRCodeTest.cs @@ -0,0 +1,35 @@ +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.WeChatQRCode; + +public class WeChatQRCodeTest(ITestOutputHelper testOutputHelper) : TestBase +{ + private const string WechatQcodeDetectorPrototxtPath = "_data/wechat_qrcode/detect.prototxt"; + private const string WechatQcodeDetectorCaffeModelPath = "_data/wechat_qrcode/detect.caffemodel"; + private const string WechatQcodeSuperResolutionPrototxtPath = "_data/wechat_qrcode/sr.prototxt"; + private const string WechatQcodeSuperResolutionCaffeModelPath = "_data/wechat_qrcode/sr.caffemodel"; + + [Fact] + public void WechatQrcodeDecodeRun() + { + Assert.True(File.Exists(WechatQcodeDetectorPrototxtPath), $"DetectorPrototxt '{WechatQcodeDetectorPrototxtPath}' not found"); + Assert.True(File.Exists(WechatQcodeDetectorCaffeModelPath), $"DetectorcaffeModel '{WechatQcodeDetectorCaffeModelPath}' not found"); + Assert.True(File.Exists(WechatQcodeSuperResolutionPrototxtPath), $"SuperResolutionprototxt '{WechatQcodeSuperResolutionPrototxtPath}' not found"); + Assert.True(File.Exists(WechatQcodeSuperResolutionCaffeModelPath), $"SuperResolutionCaffe_model '{WechatQcodeSuperResolutionCaffeModelPath}' not found"); + + using var wechatQrcode = OpenCvSharp.WeChatQRCode.Create( + WechatQcodeDetectorPrototxtPath, WechatQcodeDetectorCaffeModelPath, + WechatQcodeSuperResolutionPrototxtPath, WechatQcodeSuperResolutionCaffeModelPath); + using var src = Cv2.ImRead(@"_data/image/qr_multi.png", ImreadModes.Grayscale); + + wechatQrcode.DetectAndDecode(src, out var rects, out var texts); + Assert.NotEmpty(texts); + Assert.Equal(2, texts.Length); + foreach (var item in texts) + { + testOutputHelper.WriteLine(item); + Assert.NotEmpty(item); + } + } +} diff --git a/test/OpenCvSharp.Tests/xfeatures2d/LATCHTest.cs b/test/OpenCvSharp.Tests/xfeatures2d/LATCHTest.cs new file mode 100644 index 000000000..1f46fdc39 --- /dev/null +++ b/test/OpenCvSharp.Tests/xfeatures2d/LATCHTest.cs @@ -0,0 +1,49 @@ +using OpenCvSharp.XFeatures2D; +using Xunit; + +namespace OpenCvSharp.Tests.XFeatures2D; + +// ReSharper disable once InconsistentNaming +public class LATCHTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + var surf = LATCH.Create(); + surf.Dispose(); + } + + [Fact] + public void Compute() + { + using (var color = LoadImage("lenna.png", ImreadModes.Color)) + using (var gray = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var descriptors = new Mat()) + using (var latch = LATCH.Create()) + using (var surf = SURF.Create(500)) + { + var keypoints = surf.Detect(gray); + latch.Compute(color, ref keypoints, descriptors); + } + } + + [Fact] + public void DescriptorSize() + { + using (var alg = LATCH.Create()) + { + var sz = alg.DescriptorSize; + Assert.Equal(32, sz); + } + } + + [Fact] + public void DefaultNorm() + { + using (var alg = LATCH.Create()) + { + var defnorm = alg.DefaultNorm; + Assert.Equal(6, defnorm); + } + } +} diff --git a/test/OpenCvSharp.Tests/xfeatures2d/LUCIDTest.cs b/test/OpenCvSharp.Tests/xfeatures2d/LUCIDTest.cs new file mode 100644 index 000000000..e56f73566 --- /dev/null +++ b/test/OpenCvSharp.Tests/xfeatures2d/LUCIDTest.cs @@ -0,0 +1,49 @@ +using OpenCvSharp.XFeatures2D; +using Xunit; + +namespace OpenCvSharp.Tests.XFeatures2D; + +// ReSharper disable once InconsistentNaming +public class LUCIDTest : TestBase +{ + [Fact] + public void CreateAndDispose() + { + var surf = LUCID.Create(); + surf.Dispose(); + } + + [Fact] + public void Compute() + { + using (var color = LoadImage("lenna.png", ImreadModes.Color)) + using (var gray = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var descriptors = new Mat()) + using (var lucid = LUCID.Create()) + using (var surf = SURF.Create(500)) + { + var keypoints = surf.Detect(gray); + lucid.Compute(color, ref keypoints, descriptors); + } + } + + [Fact] + public void DescriptorSize() + { + using (var alg = LUCID.Create()) + { + var sz = alg.DescriptorSize; + Assert.Equal(27, sz); + } + } + + [Fact] + public void DefaultNorm() + { + using (var alg = LUCID.Create()) + { + var defnorm = alg.DefaultNorm; + Assert.Equal(6, defnorm); + } + } +} diff --git a/test/OpenCvSharp.Tests/xfeatures2d/SIFTTest.cs b/test/OpenCvSharp.Tests/xfeatures2d/SIFTTest.cs deleted file mode 100644 index 3b015d3c3..000000000 --- a/test/OpenCvSharp.Tests/xfeatures2d/SIFTTest.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using NUnit.Framework; -using OpenCvSharp.XFeatures2D; - -namespace OpenCvSharp.Tests.XFeatures2D -{ - // ReSharper disable once InconsistentNaming - - [TestFixture] - public class SIFTTest : TestBase - { - [Test] - public void CreateAndDispose() - { - var surf = SIFT.Create(400); - surf.Dispose(); - } - - [Test] - public void Detect() - { - KeyPoint[] keyPoints = null; - using (var gray = Image("lenna.png", 0)) - using (var surf = SIFT.Create(500)) - keyPoints = surf.Detect(gray); - - Console.WriteLine($"KeyPoint has {keyPoints.Length} items."); - } - } -} diff --git a/test/OpenCvSharp.Tests/xfeatures2d/SURFTest.cs b/test/OpenCvSharp.Tests/xfeatures2d/SURFTest.cs index 1f99389f3..010bf4676 100644 --- a/test/OpenCvSharp.Tests/xfeatures2d/SURFTest.cs +++ b/test/OpenCvSharp.Tests/xfeatures2d/SURFTest.cs @@ -1,46 +1,96 @@ -using System; -using NUnit.Framework; -using OpenCvSharp.XFeatures2D; +using OpenCvSharp.XFeatures2D; +using Xunit; +using Xunit.Abstractions; -namespace OpenCvSharp.Tests.XFeatures2D +namespace OpenCvSharp.Tests.XFeatures2D; + +// ReSharper disable once InconsistentNaming +public class SURFTest : TestBase { - // ReSharper disable once InconsistentNaming + private readonly ITestOutputHelper testOutputHelper; + + public SURFTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void CreateAndDispose() + { + var surf = SURF.Create(400); + surf.Dispose(); + } - [TestFixture] - public class SURFTest : TestBase + [Fact] + public void Detect() { - [Test] - public void CreateAndDispose() + // This parameter should introduce same result of http://opencv.jp/wordpress/wp-content/uploads/lenna_SURF-150x150.png + using var gray = LoadImage("lenna.png", 0); + using var surf = SURF.Create(500, 4, 2, true); + var keyPoints = surf.Detect(gray); + + testOutputHelper.WriteLine($"KeyPoint has {keyPoints.Length} items."); + } + + [Fact] + public void DetectAndCompute() + { + using (var gray = LoadImage("lenna.png", ImreadModes.Grayscale)) + using (var surf = SURF.Create(500)) + using (Mat descriptor = new Mat()) { - var surf = SURF.Create(400); - surf.Dispose(); + surf.DetectAndCompute(gray, null, out var keyPoints, descriptor); + + testOutputHelper.WriteLine($"keyPoints has {keyPoints.Length} items."); + testOutputHelper.WriteLine($"descriptor has {descriptor.Rows} items."); } + } - [Test] - public void Detect() + [Fact] + public void DescriptorSize() + { + using (var alg = SURF.Create(300)) { - // This parameter should introduce same result of http://opencv.jp/wordpress/wp-content/uploads/lenna_SURF-150x150.png - KeyPoint[] keyPoints = null; - using (var gray = Image("lenna.png", 0)) - using (var surf = SURF.Create(500, 4, 2, true)) - keyPoints = surf.Detect(gray); + var ext = alg.Extended; + var sz = alg.DescriptorSize; + Assert.Equal(ext ? 128 : 64, sz); + alg.Extended = !ext; - Console.WriteLine($"KeyPoint has {keyPoints.Length} items."); + var ext2 = alg.Extended; + Assert.NotEqual(ext, ext2); + + var sz2 = alg.DescriptorSize; + Assert.Equal(ext2 ? 128 : 64, sz2); } + } + + [Fact] + public void DescriptorType() + { + using (var alg = OpenCvSharp.XFeatures2D.SURF.Create(300)) + { + var dtype = alg.DescriptorType; + Assert.Equal(MatType.CV_32F, dtype); + } + } - [Test] - public void DetectAndCompute() + [Fact] + public void DefaultNorm() + { + using (var alg = OpenCvSharp.XFeatures2D.SURF.Create(300)) + { + var defnorm = alg.DefaultNorm; + Assert.Equal(4, defnorm); + } + } + + [Fact] + public void Empty() + { + using (var alg = OpenCvSharp.XFeatures2D.SURF.Create(300)) { - using (var gray = Image("lenna.png", ImreadModes.GrayScale)) - using (var surf = SURF.Create(500)) - using (Mat descriptor = new Mat()) - { - KeyPoint[] keyPoints; - surf.DetectAndCompute(gray, null, out keyPoints, descriptor); - - Console.WriteLine($"keyPoints has {keyPoints.Length} items."); - Console.WriteLine($"descriptor has {descriptor.Rows} items."); - } + var empty = alg.Empty(); + Assert.True(empty); } } } diff --git a/test/OpenCvSharp.Tests/ximgproc/EdgeBoxesTest.cs b/test/OpenCvSharp.Tests/ximgproc/EdgeBoxesTest.cs new file mode 100644 index 000000000..84d30f000 --- /dev/null +++ b/test/OpenCvSharp.Tests/ximgproc/EdgeBoxesTest.cs @@ -0,0 +1,25 @@ +using OpenCvSharp.XImgProc; +using Xunit; + +namespace OpenCvSharp.Tests.XImgProc; + +public class EdgeBoxesTest : TestBase +{ + [Fact] + public void CreateAndDispose1() + { + using (var eb = EdgeBoxes.Create()) + { + GC.KeepAlive(eb); + } + } + + [Fact] + public void CreateAndDispose2() + { + using (var eb = CvXImgProc.CreateEdgeBoxes()) + { + GC.KeepAlive(eb); + } + } +} diff --git a/test/OpenCvSharp.Tests/ximgproc/EdgeFilterTest.cs b/test/OpenCvSharp.Tests/ximgproc/EdgeFilterTest.cs new file mode 100644 index 000000000..d3c9a317e --- /dev/null +++ b/test/OpenCvSharp.Tests/ximgproc/EdgeFilterTest.cs @@ -0,0 +1,25 @@ +using System.Diagnostics; +using OpenCvSharp.XImgProc; +using Xunit; + +namespace OpenCvSharp.Tests.XImgProc; + +public class EdgeFilterTest : TestBase +{ + [Fact] + public void EnhanceByGuidedFilter() + { + using var image = LoadImage("lenna.png", ImreadModes.Color); + image.ConvertTo(image, MatType.CV_32F, 1.0 / 255.0); + + using var gf = GuidedFilter.Create(image, 16, 0.01); + using var dst = new Mat(); + gf.Filter(image, dst); + + if (Debugger.IsAttached) + { + using var view = (image - dst) * 5 + dst; + Window.ShowImages(image, dst, view); + } + } +} diff --git a/test/OpenCvSharp.Tests/ximgproc/FastHoughTransformTest.cs b/test/OpenCvSharp.Tests/ximgproc/FastHoughTransformTest.cs index 587777fea..61a5e7835 100644 --- a/test/OpenCvSharp.Tests/ximgproc/FastHoughTransformTest.cs +++ b/test/OpenCvSharp.Tests/ximgproc/FastHoughTransformTest.cs @@ -1,45 +1,139 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using OpenCvSharp.XImgProc; +using OpenCvSharp.XImgProc; +using Xunit; -namespace OpenCvSharp.Tests.XImgProc +// ReSharper disable RedundantArgumentDefaultValue +// ReSharper disable InconsistentNaming + +namespace OpenCvSharp.Tests.XImgProc; + +public class FastHoughTransformTest : TestBase { - [TestFixture] - public class FastHoughTransformTest : TestBase + /// + /// https://github.com/opencv/opencv_contrib/blob/master/modules/ximgproc/samples/fast_hough_transform.cpp#L271 + /// + [Fact] + public void FastHoughTransform() { - /// - /// https://github.com/opencv/opencv_contrib/blob/master/modules/ximgproc/samples/fast_hough_transform.cpp#L271 - /// - [Test] - public void FastHoughTransform() + using (var image = LoadImage("building.jpg", ImreadModes.Grayscale)) + using (var fht = new Mat()) { - using (var image = Image("building.jpg", ImreadModes.GrayScale)) - using (var fht = new Mat()) - { - Cv2.FastHoughTransform(image, fht, MatType.CV_32SC1); + CvXImgProc.FastHoughTransform(image, fht, MatType.CV_32SC1); - double minv, maxv; - Cv2.MinMaxLoc(fht, out minv, out maxv); + Cv2.MinMaxLoc(fht, out var minv, out double maxv); - Mat ucharFht = new Mat(); - fht.ConvertTo(ucharFht, MatType.CV_8UC1, - 255.0 / (maxv + minv), minv / (maxv + minv)); - Rescale(ucharFht, ucharFht); + Mat ucharFht = new Mat(); + fht.ConvertTo(ucharFht, MatType.CV_8UC1, + 255.0 / (maxv + minv), minv / (maxv + minv)); + Rescale(ucharFht, ucharFht); - //Cv2.ImShow("fast hough transform", ucharFht); - //Cv2.WaitKey(); - } + //Cv2.ImShow("fast hough transform", ucharFht); + //Cv2.WaitKey(); } - private static void Rescale(Mat src, Mat dst, - int maxHeight = 500, - int maxWidth = 1000) + static void Rescale(Mat src, Mat dst, + int maxHeight = 500, + int maxWidth = 1000) { double scale = Math.Min(Math.Min((double)maxWidth / src.Cols, - (double)maxHeight / src.Rows), 1.0); + (double)maxHeight / src.Rows), 1.0); Cv2.Resize(src, dst, new Size(), scale, scale, InterpolationFlags.Linear); } } -} + /// + /// https://github.com/opencv/opencv_contrib/blob/master/modules/ximgproc/samples/fast_hough_transform.cpp + /// + [Fact] + public void FHTSample() + { + const string imPath = @"_data/image/building.jpg"; + using (var image = new Mat(imPath, ImreadModes.Grayscale)) + using (var hough = new Mat()) + using (var canny = new Mat()) + { + Cv2.Canny(image, canny, 50, 200, 3); + + CvXImgProc.FastHoughTransform(canny, hough, MatType.CV_32S/*C1*/, AngleRangeOption.ARO_315_135, HoughOP.FHT_ADD, HoughDeskewOption.DESKEW); + + var lines = new List(); + GetLocalExtr(lines, canny, hough, 255f * 0.3f * Math.Min(canny.Rows, canny.Cols), 50); + + var cannyColor = new Mat(); + Cv2.CvtColor(canny, cannyColor, ColorConversionCodes.GRAY2BGR); + foreach (var line in lines) + { + Cv2.Line(cannyColor, new Point(line.Item0, line.Item1), new Point(line.Item2, line.Item3), Scalar.Red); + } + //cannyColor.SaveImage("cannycolor.png"); + + ShowImagesWhenDebugMode(image, canny, cannyColor); + } + + void GetLocalExtr(List lines, Mat src, Mat fht, float minWeight, int maxCount) + { + const int maxLen = 10_000; + var weightedPoints = new List>(); + + for (var y = 0; y < fht.Rows; ++y) + { + if (weightedPoints.Count > maxLen) + break; + + using var fhtMat = new Mat(fht); + var fhtIndexer = fhtMat.GetIndexer(); + + var pLineY = Math.Max(y - 1, 0); + var cLineY = y; + var nLineY = Math.Min(y + 1, fht.Rows - 1); + + for (var x = 0; x < fht.Cols; ++x) + { + if (weightedPoints.Count > maxLen) + break; + + var value = fhtIndexer[cLineY, x]; + if (value >= minWeight) + { + var isLocalMax = 0; + var start = Math.Max(x - 1, 0); + var end = Math.Min(x + 1, fht.Cols - 1); + for (var xx = start; xx < end; ++xx) + { + var pLine = fhtIndexer[pLineY, xx]; + var cLine = fhtIndexer[cLineY, xx]; + var nLine = fhtIndexer[nLineY, xx]; + if (!IncIfGreater(value, pLine, ref isLocalMax) || + !IncIfGreater(value, cLine, ref isLocalMax) || + !IncIfGreater(value, nLine, ref isLocalMax)) + { + isLocalMax = 0; + break; + } + } + if (isLocalMax > 0) + weightedPoints.Add(new KeyValuePair(value, new Point(x, y))); + } + } + } + + if (weightedPoints.Count == 0) + return; + + // Sort WeightedPoints + weightedPoints = weightedPoints.OrderByDescending(x => x.Key).ToList(); + weightedPoints = weightedPoints.Take(maxCount).ToList(); + + foreach (var t in weightedPoints) + lines.Add(CvXImgProc.HoughPoint2Line(t.Value, src)); + } + + bool IncIfGreater(int a, int b, ref int value) + { + if (/*value == 0 || */a < b) + return false; + if (a > b) + ++(value); + return true; + } + } +} diff --git a/test/OpenCvSharp.Tests/ximgproc/FastLineDetectorTest.cs b/test/OpenCvSharp.Tests/ximgproc/FastLineDetectorTest.cs index 029d93b90..19840b22e 100644 --- a/test/OpenCvSharp.Tests/ximgproc/FastLineDetectorTest.cs +++ b/test/OpenCvSharp.Tests/ximgproc/FastLineDetectorTest.cs @@ -1,78 +1,66 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using OpenCvSharp.XImgProc; +using OpenCvSharp.XImgProc; +using Xunit; -namespace OpenCvSharp.Tests.XImgProc +namespace OpenCvSharp.Tests.XImgProc; + +public class FastLineDetectorTest : TestBase { - [TestFixture] - public class FastLineDetectorTest : TestBase + [Fact] + public void New1() { - [Test] - public void New1() - { - var fld = FastLineDetector.Create(); - fld.Dispose(); - } + var fld = FastLineDetector.Create(); + fld.Dispose(); + } - [Test] - public void New2() - { - var fld = Cv2.CreateFastLineDetector(); - fld.Dispose(); - } + [Fact] + public void New2() + { + var fld = CvXImgProc.CreateFastLineDetector(); + fld.Dispose(); + } - [Test] - public void DetectUsingOutputArray() - { - using (var fld = FastLineDetector.Create()) - using (var image = Image("building.jpg", ImreadModes.GrayScale)) - using (var lines = new Mat()) - { - fld.Detect(image, lines); - Assert.That(lines.Empty, Is.False); - Assert.That(lines.Type(), Is.EqualTo(MatType.CV_32FC4)); - Assert.That(lines.Rows, Is.GreaterThan(0)); - } - } + [Fact] + public void DetectUsingOutputArray() + { + using var fld = FastLineDetector.Create(); + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var lines = new Mat(); + fld.Detect(image, lines); + Assert.False(lines.Empty()); + Assert.Equal(MatType.CV_32FC4, lines.Type()); + Assert.True(lines.Rows > 0); + } - [Test] - public void DetectUsingVector() - { - using (var fld = FastLineDetector.Create()) - using (var image = Image("building.jpg", ImreadModes.GrayScale)) - { - Vec4f[] lines = fld.Detect(image); - Assert.That(lines, Is.Not.Null.And.Length.GreaterThan(0)); - } - } + [Fact] + public void DetectUsingVector() + { + using var fld = FastLineDetector.Create(); + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + Vec4f[] lines = fld.Detect(image); + Assert.NotNull(lines); + Assert.True(lines.Length > 0); + } - [Test] - public void DrawSegmentsUsingInputArray() - { - using (var fld = FastLineDetector.Create()) - using (var image = Image("building.jpg", ImreadModes.GrayScale)) - using (var view = image.Clone()) - using (var lines = new Mat()) - { - fld.Detect(image, lines); - fld.DrawSegments(view, lines, true); - //Window.ShowImages(view); - } - } + [Fact] + public void DrawSegmentsUsingInputArray() + { + using var fld = FastLineDetector.Create(); + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var view = image.Clone(); + using var lines = new Mat(); + fld.Detect(image, lines); + fld.DrawSegments(view, lines, true); + ShowImagesWhenDebugMode(view); + } - [Test] - public void DrawSegmentsUsingVector() - { - using (var fld = FastLineDetector.Create()) - using (var image = Image("building.jpg", ImreadModes.GrayScale)) - using (var view = image.Clone()) - { - Vec4f[] lines = fld.Detect(image); - fld.DrawSegments(view, lines, true); - //Window.ShowImages(view); - } - } + [Fact] + public void DrawSegmentsUsingVector() + { + using var fld = FastLineDetector.Create(); + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var view = image.Clone(); + Vec4f[] lines = fld.Detect(image); + fld.DrawSegments(view, lines, true); + ShowImagesWhenDebugMode(view); } } - diff --git a/test/OpenCvSharp.Tests/ximgproc/RidgeDetectionFilterTest.cs b/test/OpenCvSharp.Tests/ximgproc/RidgeDetectionFilterTest.cs new file mode 100644 index 000000000..8d20ea4ca --- /dev/null +++ b/test/OpenCvSharp.Tests/ximgproc/RidgeDetectionFilterTest.cs @@ -0,0 +1,21 @@ +using System.Diagnostics; +using Xunit; + +namespace OpenCvSharp.Tests.XImgProc; + +public class RidgeDetectionFilterTest +{ + [Fact] + public void Test() + { + using var filter = RidgeDetectionFilter.Create(); + using var src = new Mat("_data/image/mandrill.png"); + using var dst = new Mat(); + filter.GetRidgeFilteredImage(src, dst); + + if (Debugger.IsAttached) + { + Window.ShowImages(src, dst); + } + } +} diff --git a/test/OpenCvSharp.Tests/ximgproc/StructuredEdgeDetectionTest.cs b/test/OpenCvSharp.Tests/ximgproc/StructuredEdgeDetectionTest.cs new file mode 100644 index 000000000..448e1be65 --- /dev/null +++ b/test/OpenCvSharp.Tests/ximgproc/StructuredEdgeDetectionTest.cs @@ -0,0 +1,109 @@ +using System.IO.Compression; +using OpenCvSharp.XImgProc; +using Xunit; + +// ReSharper disable RedundantArgumentDefaultValue + +namespace OpenCvSharp.Tests.XImgProc; + +public class StructuredEdgeDetectionTest : TestBase +{ + private const string ModelUrl = "https://github.com/opencv/opencv_extra/raw/master/testdata/cv/ximgproc/model.yml.gz"; + private const string Model = "model_structured_edge_detection.yml"; + + [Fact] + public void CreateAndDispose1() + { + PrepareModel(Model); + Assert.True(File.Exists(Model), $"Failed to download {ModelUrl}"); + + using (var obj = StructuredEdgeDetection.Create(Model)) + { + GC.KeepAlive(obj); + } + } + + [Fact] + public void CreateAndDispose2() + { + PrepareModel(Model); + Assert.True(File.Exists(Model), $"Failed to download {ModelUrl}"); + + using (var rf = RFFeatureGetter.Create()) + using (var obj = StructuredEdgeDetection.Create(Model, rf)) + { + GC.KeepAlive(obj); + } + } + + [Fact] + public void DetectEdges() + { + PrepareModel(Model); + Assert.True(File.Exists(Model), $"Failed to download {ModelUrl}"); + + using (var obj = StructuredEdgeDetection.Create(Model)) + using (var image = LoadImage("blob/shapes1.png", ImreadModes.Color)) + using (var image32F = new Mat()) + using (var edges = new Mat()) + using (var orientation = new Mat()) + using (var edgesNms = new Mat()) + { + image.ConvertTo(image32F, MatType.CV_32FC3, 1.0 / 255); + obj.DetectEdges(image32F, edges); + obj.ComputeOrientation(edges, orientation); + obj.EdgesNms(edges, orientation, edgesNms); + + ShowImagesWhenDebugMode(image32F, edges, orientation, edgesNms); + } + } + + [Fact] + public void GetBoundingBoxes() + { + PrepareModel(Model); + Assert.True(File.Exists(Model), $"Failed to download {ModelUrl}"); + + using (var obj = StructuredEdgeDetection.Create(Model)) + using (var image = LoadImage("blob/shapes1.png", ImreadModes.Color)) + using (var image32F = new Mat()) + using (var edges = new Mat()) + using (var orientation = new Mat()) + using (var edgesNms = new Mat()) + { + image.ConvertTo(image32F, MatType.CV_32FC3, 1.0 / 255); + obj.DetectEdges(image32F, edges); + obj.ComputeOrientation(edges, orientation); + obj.EdgesNms(edges, orientation, edgesNms); + + using (var eb = EdgeBoxes.Create(maxBoxes: 5)) + { + eb.GetBoundingBoxes(edgesNms, orientation, out var boxes); + Assert.NotEmpty(boxes); + foreach (var box in boxes) + { + image.Rectangle(box, Scalar.Red, 2); + } + ShowImagesWhenDebugMode(image32F, edges, orientation, edgesNms, image); + //Window.ShowImages(image, edgesNms); + } + } + } + + private static void PrepareModel(string fileName) + { + lock (lockObj) + { + if (!File.Exists(fileName)) + { + var contents = FileDownloader.DownloadData(new Uri(ModelUrl)); + using var srcStream = new MemoryStream(contents); + using var gzipStream = new GZipStream(srcStream, CompressionMode.Decompress); + using var dstStream = new MemoryStream(); + gzipStream.CopyTo(dstStream); + File.WriteAllBytes(fileName, dstStream.ToArray()); + } + } + } + private static readonly object lockObj = new object(); +} diff --git a/test/OpenCvSharp.Tests/ximgproc/SuperpixelTest.cs b/test/OpenCvSharp.Tests/ximgproc/SuperpixelTest.cs new file mode 100644 index 000000000..cc2b99ce4 --- /dev/null +++ b/test/OpenCvSharp.Tests/ximgproc/SuperpixelTest.cs @@ -0,0 +1,123 @@ +using OpenCvSharp.XImgProc; +using Xunit; + +namespace OpenCvSharp.Tests.XImgProc; + +public class SuperpixelTest : TestBase +{ + [Fact] + public void LscNew() + { + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var lsc = SuperpixelLSC.Create(image); + GC.KeepAlive(lsc); + } + + [Fact] + public void SlicNew() + { + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var slic = SuperpixelSLIC.Create(image); + GC.KeepAlive(slic); + } + + [Fact] + public void SeedsNew() + { + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var seeds = SuperpixelSEEDS.Create( + image.Width, + image.Height, + image.Channels(), + image.Width * image.Height, + 3); + GC.KeepAlive(seeds); + } + + [Fact] + public void LscSimple() + { + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var lsc = SuperpixelLSC.Create(image); + + lsc.Iterate(10); + + var superpixels = lsc.GetNumberOfSuperpixels(); + Assert.True(superpixels > 0, $"GetNumberOfSuperpixels() => {superpixels}"); + + using var labels = new Mat(); + lsc.GetLabels(labels); + Assert.False(labels.Empty()); + Assert.Equal(image.Size(), labels.Size()); + Assert.Equal(MatType.CV_32SC1, labels.Type()); + + using var labelContourMask1 = new Mat(); + using var labelContourMask2 = new Mat(); + lsc.GetLabelContourMask(labelContourMask1, true); + lsc.GetLabelContourMask(labelContourMask2, false); + Assert.False(labelContourMask1.Empty()); + Assert.False(labelContourMask2.Empty()); + + lsc.EnforceLabelConnectivity(); + } + + [Fact] + public void SlicSimple() + { + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var slic = SuperpixelSLIC.Create(image); + + slic.Iterate(10); + + var superpixels = slic.GetNumberOfSuperpixels(); + Assert.True(superpixels > 0, $"GetNumberOfSuperpixels() => {superpixels}"); + + using var labels = new Mat(); + slic.GetLabels(labels); + Assert.False(labels.Empty()); + Assert.Equal(image.Size(), labels.Size()); + Assert.Equal(MatType.CV_32SC1, labels.Type()); + + using var labelContourMask1 = new Mat(); + using var labelContourMask2 = new Mat(); + slic.GetLabelContourMask(labelContourMask1, true); + slic.GetLabelContourMask(labelContourMask2, false); + Assert.False(labelContourMask1.Empty()); + Assert.False(labelContourMask2.Empty()); + + slic.EnforceLabelConnectivity(); + } + + // TODO + // [ WARN:0] global /home/runner/work/opencvsharp/opencvsharp/opencv-4.3.0/modules/core/src/matrix_expressions.cpp (1334) + // assign OpenCV/MatExpr: processing of multi-channel arrays might be changed in the future: https://github.com/opencv/opencv/issues/16739 + [PlatformSpecificFact("Windows")] + public void SeedsSimple() + { + using var image = LoadImage("building.jpg", ImreadModes.Grayscale); + using var seeds = SuperpixelSEEDS.Create( + image.Width, + image.Height, + image.Channels(), + image.Width * image.Height, + 3); + + seeds.Iterate(image, 10); + + var superpixels = seeds.GetNumberOfSuperpixels(); + Assert.True(superpixels > 0, $"GetNumberOfSuperpixels() => {superpixels}"); + + using var labels = new Mat(); + seeds.GetLabels(labels); + Assert.False(labels.Empty()); + Assert.Equal(image.Size(), labels.Size()); + Assert.Equal(MatType.CV_32SC1, labels.Type()); + + using var labelContourMask1 = new Mat(); + using var labelContourMask2 = new Mat(); + seeds.GetLabelContourMask(labelContourMask1, true); + seeds.GetLabelContourMask(labelContourMask2, false); + Assert.False(labelContourMask1.Empty()); + Assert.False(labelContourMask2.Empty()); + } +} diff --git a/test/OpenCvSharp.Tests/ximgproc/XimgProcTest.cs b/test/OpenCvSharp.Tests/ximgproc/XimgProcTest.cs index cb667644a..094a6a758 100644 --- a/test/OpenCvSharp.Tests/ximgproc/XimgProcTest.cs +++ b/test/OpenCvSharp.Tests/ximgproc/XimgProcTest.cs @@ -1,60 +1,215 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; +using System.Diagnostics; using OpenCvSharp.XImgProc; +using Xunit; -namespace OpenCvSharp.Tests.XImgProc +// ReSharper disable RedundantArgumentDefaultValue + +namespace OpenCvSharp.Tests.XImgProc; + +public class XImgProcTest : TestBase { - [TestFixture] - public class XImgProcTest : TestBase + [Theory] + [InlineData(LocalBinarizationMethods.Niblack)] + [InlineData(LocalBinarizationMethods.Sauvola)] + [InlineData(LocalBinarizationMethods.Wolf)] + [InlineData(LocalBinarizationMethods.Nick)] + public void Niblack(LocalBinarizationMethods method) { - [Test] - public void Thinning() - { - using (var src = Image("blob/shapes2.png", ImreadModes.GrayScale)) - using (var dst = new Mat()) - { - Cv2.Thinning(src, dst, ThinningTypes.ZHANGSUEN); - //Window.ShowImages(dst); - } - } + using var src = LoadImage("mandrill.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXImgProc.NiblackThreshold(src, dst, 255, ThresholdTypes.Binary, 5, 0.5, method); + ShowImagesWhenDebugMode(dst); + } - [Test] - public void Niblack() + [Fact] + public void Sauvola() + { + foreach (var r in new double[]{16, 32, 64, 128}) { - using (var src = Image("lenna.png", ImreadModes.GrayScale)) - using (var dst = new Mat()) - { - Cv2.NiblackThreshold(src, dst, 255, ThresholdTypes.Binary, 5, 0.5); - //Window.ShowImages(dst); - } + using var src = LoadImage("mandrill.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXImgProc.NiblackThreshold( + src, dst, + 255, + ThresholdTypes.Binary, + 5, 0.5, + LocalBinarizationMethods.Sauvola, + r); + ShowImagesWhenDebugMode([dst], [$"r={r}"]); } + } + + [Fact] + public void Thinning() + { + using var src = LoadImage("blob/shapes2.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXImgProc.Thinning(src, dst, ThinningTypes.ZHANGSUEN); + ShowImagesWhenDebugMode(src, dst); + } + + [Fact] + public void AnisotropicDiffusion() + { + using var src = LoadImage("blob/shapes2.png", ImreadModes.Color); + using var dst = new Mat(); + CvXImgProc.AnisotropicDiffusion(src, dst, 1, 1, 1); + ShowImagesWhenDebugMode(src, dst); + } + + [Fact] + public void WeightedMedianFilter() + { + using var src = LoadImage("lenna.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXImgProc.WeightedMedianFilter(src, src, dst, 7); + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void CovarianceEstimation() + { + const int windowSize = 7; + using var src = LoadImage("lenna.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXImgProc.CovarianceEstimation(src, dst, windowSize, windowSize); + // TODO + Assert.Equal(windowSize * windowSize, dst.Rows); + Assert.Equal(windowSize * windowSize, dst.Cols); + Assert.Equal(MatType.CV_32FC2, dst.Type()); + } + + // brightedges.hpp + + [Fact] + public void BrightEdges() + { + using var src = LoadImage("lenna.png", ImreadModes.Color); + using var dst = new Mat(); + CvXImgProc.BrightEdges(src, dst); + ShowImagesWhenDebugMode(src, dst); + } + + // color_match.hpp - [Test] - public void WeightedMedianFilter() + [Fact] + public void ColorMatchTemplate() + { + using var src = LoadImage("lenna.png", ImreadModes.Color); + using var template = src[new Rect(200, 230, 150, 150)]; + using var dst = new Mat(); + + CvXImgProc.ColorMatchTemplate(src, template, dst); + Assert.False(dst.Empty()); + Assert.Equal(MatType.CV_64FC1, dst.Type()); + + dst.MinMaxLoc(out var minVal, out var maxVal, out var minLoc, out var maxLoc); + + using var view = src.Clone(); + view.Rectangle(maxLoc, new Point(maxLoc.X + template.Width, maxLoc.Y + template.Height), Scalar.Red, 3); + ShowImagesWhenDebugMode(view, template); + } + + // deriche_filter.hpp + + [Fact] + public void GradientDeriche() + { + using var src = LoadImage("lenna.png", ImreadModes.Color); + using var dstX = new Mat(); + using var dstY = new Mat(); + CvXImgProc.GradientDericheX(src, dstX, 10.0, 10.0); + CvXImgProc.GradientDericheX(src, dstY, 10.0, 10.0); + ShowImagesWhenDebugMode(src, dstX, dstY); + } + + // edgepreserving_filter.hpp + + [Fact] + public void EdgePreservingFilter() + { + using var src = LoadImage("lenna.png", ImreadModes.Color); + using var dst = new Mat(); + CvXImgProc.EdgePreservingFilter(src, dst, 7, 10.0); + ShowImagesWhenDebugMode(src, dst); + } + + // run_length_morphology.hpp + + [Fact] + public void RLThreshold() + { + using var src = LoadImage("mandrill.png", ImreadModes.Grayscale); + using var dst = new Mat(); + + CvXImgProc.RL.Threshold(src, dst, 128, ThresholdTypes.Binary); + + Assert.False(dst.Empty()); + Assert.Equal(MatType.CV_32SC3, dst.Type()); + } + + [Fact] + public void RLGetStructuringElement() + { + using var se = CvXImgProc.RL.GetStructuringElement(MorphShapes.Cross, new Size(3, 3)); + + Assert.False(se.Empty()); + Assert.Equal(new Size(1, 4), se.Size()); + Assert.Equal(MatType.CV_32SC3, se.Type()); + } + + [Fact] + public void RLDilateErode() + { + using var src = LoadImage("mandrill.png", ImreadModes.Grayscale); + using var binary = new Mat(); + using var dilate = new Mat(); + using var erode = new Mat(); + + CvXImgProc.RL.Threshold(src, binary, 128, ThresholdTypes.Binary); + + using var se = CvXImgProc.RL.GetStructuringElement(MorphShapes.Rect, new Size(3, 3)); + CvXImgProc.RL.Dilate(binary, dilate, se); + CvXImgProc.RL.Erode(binary, erode, se); + + Assert.False(dilate.Empty()); + Assert.Equal(new Size(1, 1785), dilate.Size()); + Assert.Equal(MatType.CV_32SC3, dilate.Type()); + + Assert.False(erode.Empty()); + Assert.Equal(new Size(1, 1799), erode.Size()); + Assert.Equal(MatType.CV_32SC3, erode.Type()); + } + + // peilin.hpp + + [Fact] + public void PeiLinNormalization() + { + using var src = LoadImage("peilin_plane.png", ImreadModes.Grayscale); + using var tMat = src.Clone(); + CvXImgProc.PeiLinNormalization(src, tMat); + var tArray = CvXImgProc.PeiLinNormalization(src); + + Assert.Equal(MatType.CV_64FC1, tMat.Type()); + Assert.Equal(2, tMat.Rows); + Assert.Equal(3, tMat.Cols); + Assert.Equal(2, tArray.GetLength(0)); + Assert.Equal(3, tArray.GetLength(1)); + + for (int r = 0; r < 2; r++) { - using (var src = Image("lenna.png", ImreadModes.GrayScale)) - using (var dst = new Mat()) + for (int c = 0; c < 3; c++) { - Cv2.WeightedMedianFilter(src, src, dst, 7); - //Window.ShowImages(dst); + Assert.Equal(tArray[r, c], tMat.At(r, c)); } } - [Test] - public void CovarianceEstimation() + if (Debugger.IsAttached) { - const int windowSize = 7; - using (var src = Image("lenna.png", ImreadModes.GrayScale)) - using (var dst = new Mat()) - { - Cv2.CovarianceEstimation(src, dst, windowSize, windowSize); - // TODO - Assert.That(dst.Rows, Is.EqualTo(windowSize * windowSize)); - Assert.That(dst.Cols, Is.EqualTo(windowSize * windowSize)); - Assert.That(dst.Type(), Is.EqualTo(MatType.CV_32FC2)); - } + using var warped = new Mat(); + Cv2.WarpAffine(src, warped, tMat, src.Size()); + Window.ShowImages(src, warped); } } } - diff --git a/test/OpenCvSharp.Tests/xphoto/TonemapDurandTest.cs b/test/OpenCvSharp.Tests/xphoto/TonemapDurandTest.cs new file mode 100644 index 000000000..6216186d8 --- /dev/null +++ b/test/OpenCvSharp.Tests/xphoto/TonemapDurandTest.cs @@ -0,0 +1,44 @@ +using OpenCvSharp.XPhoto; +using Xunit; + +namespace OpenCvSharp.Tests.XPhoto; + +public class TonemapDurandTest : TestBase +{ + [Fact] + public void Process() + { + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + using var tonemap = TonemapDurand.Create(); + + // 8UC3 -> 32FC3 + using var src32f = new Mat(); + src.ConvertTo(src32f, MatType.CV_32FC3); + + tonemap.Process(src32f, dst); + + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void Properties() + { + using var tonemap = TonemapDurand.Create(1.2f, 3.0f, 1.5f, 2.2f, 1.3f); + Assert.Equal(3.0f, tonemap.Contrast, 1e-3); + Assert.Equal(1.5f, tonemap.Saturation, 1e-3); + + // TODO OpenCV bug https://github.com/opencv/opencv_contrib/pull/2398 + //Assert.Equal(2.2f, tonemap.SigmaSpace, 3); + //Assert.Equal(1.3f, tonemap.SigmaColor, 3); + + tonemap.Contrast = 3.5f; + tonemap.Saturation = 2.0f; + tonemap.SigmaSpace = 2.5f; + tonemap.SigmaColor = 2.5f; + Assert.Equal(3.5f, tonemap.Contrast, 1e-3); + Assert.Equal(2.0f, tonemap.Saturation, 1e-3); + //Assert.Equal(2.5f, tonemap.SigmaSpace, 3); + //Assert.Equal(2.5f, tonemap.SigmaColor, 3); + } +} diff --git a/test/OpenCvSharp.Tests/xphoto/XPhotoTest.cs b/test/OpenCvSharp.Tests/xphoto/XPhotoTest.cs new file mode 100644 index 000000000..1f0962b05 --- /dev/null +++ b/test/OpenCvSharp.Tests/xphoto/XPhotoTest.cs @@ -0,0 +1,320 @@ +using System.Diagnostics; +using OpenCvSharp.XPhoto; +using Xunit; +using Xunit.Abstractions; + +namespace OpenCvSharp.Tests.XPhoto; + +// ReSharper disable InconsistentNaming +public class XPhotoTest : TestBase +{ + private readonly ITestOutputHelper testOutputHelper; + + public XPhotoTest(ITestOutputHelper testOutputHelper) + { + this.testOutputHelper = testOutputHelper; + } + + [Fact] + public void ApplyChannelGains() + { + using var src = LoadImage("lenna.png"); + using var b = new Mat(src.Rows, src.Cols, src.Type()); + using var g = new Mat(src.Rows, src.Cols, src.Type()); + using var r = new Mat(src.Rows, src.Cols, src.Type()); + CvXPhoto.ApplyChannelGains(src, b, 2, 1, 1); + CvXPhoto.ApplyChannelGains(src, g, 1, 2, 1); + CvXPhoto.ApplyChannelGains(src, r, 1, 1, 2); + + if (Debugger.IsAttached) + { + using var combined = new Mat(src.Rows * 2, src.Cols * 2, src.Type()); + using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); + using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); + using var roi3 = new Mat(combined, new Rect(0, src.Rows, src.Cols, src.Rows)); + using var roi4 = new Mat(combined, new Rect(src.Cols, src.Rows, src.Cols, src.Rows)); + src.CopyTo(roi1); + b.CopyTo(roi2); + g.CopyTo(roi3); + r.CopyTo(roi4); + Window.ShowImages(combined); + } + } + + [Fact] + public void GrayworldWBBalanceWhite() + { + using var wb = CvXPhoto.CreateGrayworldWB(); + using var src = LoadImage("lenna.png"); + using var dst = new Mat(src.Rows, src.Cols, src.Type()); + wb.BalanceWhite(src, dst); + + if (Debugger.IsAttached) + { + using var combined = new Mat(src.Rows, src.Cols * 2, src.Type()); + using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); + using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); + src.CopyTo(roi1); + dst.CopyTo(roi2); + Window.ShowImages(combined); + } + } + + [Fact] + public void GrayworldWBProperties() + { + using var wb = CvXPhoto.CreateGrayworldWB(); + var saturationThreshold = wb.SaturationThreshold; + + const float val = 100f; + wb.SaturationThreshold = val; + + Assert.Equal(val, wb.SaturationThreshold); + Assert.NotEqual(saturationThreshold, wb.SaturationThreshold); + } + + [Fact] + public void Inpaint() + { + using var src = LoadImage("building.jpg"); + using var mask = LoadImage("building_mask.bmp", ImreadModes.Grayscale); + using var dst = new Mat(src.Size(), src.Type()); + CvXPhoto.Inpaint(src, mask, dst, InpaintTypes.SHIFTMAP); + ShowImagesWhenDebugMode(src); + ShowImagesWhenDebugMode(dst); + } + + [Fact] + public void LearningBasedWBBalanceWhite() + { + using var wb = CvXPhoto.CreateLearningBasedWB(null); + using var src = LoadImage("lenna.png"); + using var dst = new Mat(src.Rows, src.Cols, src.Type()); + wb.BalanceWhite(src, dst); + + if (Debugger.IsAttached) + { + using var combined = new Mat(src.Rows, src.Cols * 2, src.Type()); + using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); + using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); + src.CopyTo(roi1); + dst.CopyTo(roi2); + Window.ShowImages(combined); + } + } + + [Fact] + public void LearningBasedWBExtractSimpleFeatures() + { + using var wb = LearningBasedWB.Create(null); + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + wb.ExtractSimpleFeatures(src, dst); + + unsafe + { + // 1. Chromaticity of an average (R,G,B) tuple + // 2. Chromaticity of the brightest (R,G,B) tuple (while ignoring saturated pixels) + // 3. Chromaticity of the dominant (R,G,B) tuple (the one that has the highest value + // in the RGB histogram) + // 4. Mode of the chromaticity palette, that is constructed by taking 300 most common + // colors according to the RGB histogram and projecting them on the chromaticity plane. + // Mode is the most high-density point of the palette, which is computed by a straightforward + // fixed-bandwidth kernel density estimator with a Epanechnikov kernel function. + testOutputHelper.WriteLine($"{dst.DataPointer[0]}"); + testOutputHelper.WriteLine($"{dst.DataPointer[1]}"); + testOutputHelper.WriteLine($"{dst.DataPointer[2]}"); + testOutputHelper.WriteLine($"{dst.DataPointer[3]}"); + } + } + + [Fact] + public void LearningBasedWBBalanceWhiteWithModel() + { + // About model file + // http://docs.opencv.org/trunk/dc/dcb/tutorial_xphoto_training_white_balance.html + using var wb = CvXPhoto.CreateLearningBasedWB(""); + using var src = LoadImage("lenna.png"); + using var dst = new Mat(src.Rows, src.Cols, src.Type()); + wb.BalanceWhite(src, dst); + + if (Debugger.IsAttached) + { + using var combined = new Mat(src.Rows, src.Cols * 2, src.Type()); + using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); + using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); + src.CopyTo(roi1); + dst.CopyTo(roi2); + Window.ShowImages(combined); + } + } + + [Fact] + public void LearningBasedWBProperties() + { + using var wb = LearningBasedWB.Create(null); + var histBinNum = wb.HistBinNum; + var rangeMaxVal = wb.RangeMaxVal; + var saturationThreshold = wb.SaturationThreshold; + + const int ival = 100; + const float fval = 100f; + wb.HistBinNum = ival; + wb.RangeMaxVal = ival; + wb.SaturationThreshold = fval; + + Assert.Equal(ival, wb.HistBinNum); + Assert.Equal(ival, wb.RangeMaxVal); + Assert.Equal(fval, wb.SaturationThreshold); + + Assert.NotEqual(histBinNum, wb.HistBinNum); + Assert.NotEqual(rangeMaxVal, wb.RangeMaxVal); + Assert.NotEqual(saturationThreshold, wb.SaturationThreshold); + } + + [Fact] + public void SimpleWBBalanceWhite() + { + using var wb = CvXPhoto.CreateSimpleWB(); + using var src = LoadImage("lenna.png"); + using var dst = new Mat(src.Rows, src.Cols, src.Type()); + wb.BalanceWhite(src, dst); + + if (Debugger.IsAttached) + { + using var combined = new Mat(src.Rows, src.Cols * 2, src.Type()); + using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); + using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); + src.CopyTo(roi1); + dst.CopyTo(roi2); + Window.ShowImages(combined); + } + } + + [Fact] + public void SimpleWBProperties() + { + using var wb = SimpleWB.Create(); + var inputMax = wb.InputMax; + var inputMin = wb.InputMin; + var outputMax = wb.OutputMax; + var outputMin = wb.OutputMin; + var p = wb.P; + + const float val = 100f; + wb.InputMax = val; + wb.InputMin = val; + wb.OutputMax = val; + wb.OutputMin = val; + wb.P = val; + + Assert.Equal(val, wb.InputMax); + Assert.Equal(val, wb.InputMin); + Assert.Equal(val, wb.OutputMax); + Assert.Equal(val, wb.OutputMin); + Assert.Equal(val, wb.P); + + Assert.NotEqual(inputMax, wb.InputMax); + Assert.NotEqual(inputMin, wb.InputMin); + Assert.NotEqual(outputMax, wb.OutputMax); + Assert.NotEqual(outputMin, wb.OutputMin); + Assert.NotEqual(p, wb.P); + } + + [Fact] + public void DctDenoising() + { + using var src = LoadImage("lenna.png"); + using var dst = new Mat(); + CvXPhoto.DctDenoising(src, dst, 1); + + if (Debugger.IsAttached) + { + Window.ShowImages(src, dst); + } + } + + [Fact] + public void Bm3dDenoising() + { + using var src = LoadImage("lenna.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXPhoto.Bm3dDenoising(src, dst); + + if (Debugger.IsAttached) + { + Window.ShowImages(src, dst); + } + } + + [Fact] + public void OilPainting() + { + using var src = LoadImage("lenna.png", ImreadModes.Grayscale); + using var dst = new Mat(); + CvXPhoto.OilPainting(src, dst, 5, 10); + + if (Debugger.IsAttached) + { + Window.ShowImages(src, dst); + } + } + +#if NET48 + [ExplicitStaFact] + public void Sample() + { + if (!Debugger.IsAttached) + return; + + string[] files; + using (var dialog = new System.Windows.Forms.OpenFileDialog + { + RestoreDirectory = true, + Multiselect = true, + Filter = "LoadImage Files(*.png;*.jpg;*.jpeg;*.bmp)|*.png;*.jpg;*.jpeg;*.bmp" + }) + { + if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) + return; + files = dialog.FileNames; + } + + var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + var dstDir = System.IO.Path.Combine(desktop, "WB"); + System.IO.Directory.CreateDirectory(dstDir); + + using var simpleWB = SimpleWB.Create(); + using var learningWB = LearningBasedWB.Create(""); + using var grayworldWB = GrayworldWB.Create(); + + foreach (var file in files) + { + testOutputHelper.WriteLine(System.IO.Path.GetFileNameWithoutExtension(file)); + + using var src = new Mat(file); + using var dstSimple = new Mat(); + using var dstLearning = new Mat(); + using var dstGrayworld = new Mat(); + simpleWB.BalanceWhite(src, dstSimple); + learningWB.BalanceWhite(src, dstLearning); + grayworldWB.BalanceWhite(src, dstGrayworld); + + using var temp1 = new Mat(); + using var temp2 = new Mat(); + using var dst = new Mat(); + Cv2.HConcat(src, dstSimple, temp1); + Cv2.HConcat(dstLearning, dstGrayworld, temp2); + Cv2.VConcat(temp1, temp2, dst); + + /* + using (new Window("src", src)) + using (new Window("dst", dst)) + { + Cv2.WaitKey(); + }*/ + dst.SaveImage(System.IO.Path.Combine(dstDir, $"{System.IO.Path.GetFileNameWithoutExtension(file)}.png")); + } + } +#endif +} diff --git a/tool/OpenCvSharp.NupkgBetaRemover/App.config b/tool/OpenCvSharp.NupkgBetaRemover/App.config new file mode 100644 index 000000000..56efbc7b5 --- /dev/null +++ b/tool/OpenCvSharp.NupkgBetaRemover/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tool/OpenCvSharp.NupkgBetaRemover/OpenCvSharp.NupkgBetaRemover.csproj b/tool/OpenCvSharp.NupkgBetaRemover/OpenCvSharp.NupkgBetaRemover.csproj new file mode 100644 index 000000000..4ace23539 --- /dev/null +++ b/tool/OpenCvSharp.NupkgBetaRemover/OpenCvSharp.NupkgBetaRemover.csproj @@ -0,0 +1,16 @@ + + + net6.0 + Exe + OpenCvSharp.NupkgBetaRemover + false + false + false + false + false + false + + + + + \ No newline at end of file diff --git a/tool/OpenCvSharp.NupkgBetaRemover/Program.cs b/tool/OpenCvSharp.NupkgBetaRemover/Program.cs new file mode 100644 index 000000000..aaf803797 --- /dev/null +++ b/tool/OpenCvSharp.NupkgBetaRemover/Program.cs @@ -0,0 +1,66 @@ +using System; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; + +namespace OpenCvSharp.NupkgBetaRemover; + +class Program +{ + private static void Main(string[] args) + { + if (args.Length == 0) + return; + + foreach (var nupkgFile in args) + { + if (!nupkgFile.Contains("-beta")) + continue; + var fileNameMatch = Regex.Match(nupkgFile, @"OpenCvSharp4\..*(?\d{8})(?-beta\d*)\.s?nupkg"); + if (!fileNameMatch.Success) + throw new Exception($"Unexpected .nupkg/.snupkg file name ({nupkgFile})"); + var dateString = fileNameMatch.Groups["date"].Value; + var date = new DateTime( + year: int.Parse(dateString.Substring(0, 4)), + month: int.Parse(dateString.Substring(4, 2)), + day: int.Parse(dateString.Substring(6, 2))); + + using (var zipArchive = ZipFile.Open(nupkgFile, ZipArchiveMode.Update)) + { + var nuspecEntry = zipArchive.Entries.FirstOrDefault(e => e.FullName.EndsWith(".nuspec")); + if (nuspecEntry is null) + continue; + + string nuspecContent; + using (var nuspecContentStream = nuspecEntry.Open()) + using (var nuspecContentStreamReader = new StreamReader(nuspecContentStream, Encoding.UTF8)) + { + nuspecContent = nuspecContentStreamReader.ReadToEnd(); + } + + if (nupkgFile.Contains("ubuntu")) + { + nuspecContent = Regex.Replace(nuspecContent, @"-\d+", $".{date:yyyyMMdd}"); + } + else + { + nuspecContent = Regex.Replace(nuspecContent, @"-beta-?\d*", ""); + nuspecContent = Regex.Replace(nuspecContent, @"(?<=\d{1,2}\.\d{1,2}\.\d{1,2}\.\d{8})(?-beta-?\d*)", + match => match.Groups["version"].Value); + } + nuspecContent += new string(' ', 1000); + + using (var nuspecContentStream = nuspecEntry.Open()) + using (var nuspecContentStreamWriter = new StreamWriter(nuspecContentStream, Encoding.UTF8)) + { + nuspecContentStreamWriter.Write(nuspecContent); + } + } + + var newFileName = Regex.Replace(nupkgFile, @"-beta-?\d*", ""); + File.Move(nupkgFile, newFileName); + } + } +} diff --git a/tool/OpenCvSharp.NupkgBetaRemover/Properties/AssemblyInfo.cs b/tool/OpenCvSharp.NupkgBetaRemover/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..bad527688 --- /dev/null +++ b/tool/OpenCvSharp.NupkgBetaRemover/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 +// アセンブリに関連付けられている情報を変更するには、 +// これらの属性値を変更してください。 +[assembly: AssemblyTitle("OpenCvSharp.NupkgBetaRemover")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenCvSharp.NupkgBetaRemover")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから +// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 +// その型の ComVisible 属性を true に設定してください。 +[assembly: ComVisible(false)] + +// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります +[assembly: Guid("cc19f9a5-01a7-4bdf-b34c-cf56f46a474a")] + +// アセンブリのバージョン情報は次の 4 つの値で構成されています: +// +// メジャー バージョン +// マイナー バージョン +// ビルド番号 +// Revision +// +// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます +// 既定値にすることができます: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tool/OpenCvSharp.ReleaseMaker/OpenCvSharp.ReleaseMaker.csproj b/tool/OpenCvSharp.ReleaseMaker/OpenCvSharp.ReleaseMaker.csproj new file mode 100644 index 000000000..41f1d5ad4 --- /dev/null +++ b/tool/OpenCvSharp.ReleaseMaker/OpenCvSharp.ReleaseMaker.csproj @@ -0,0 +1,8 @@ + + + + Exe + net6.0 + + + diff --git a/tool/OpenCvSharp.ReleaseMaker/Packer.cs b/tool/OpenCvSharp.ReleaseMaker/Packer.cs new file mode 100644 index 000000000..2726467bf --- /dev/null +++ b/tool/OpenCvSharp.ReleaseMaker/Packer.cs @@ -0,0 +1,292 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; + +namespace OpenCvSharp.ReleaseMaker; + +public static class Packer +{ + private static readonly IReadOnlyDictionary dllFiles = new Dictionary + { + ["net48"] = new[] + { + @"OpenCvSharp\bin\Release\net48\OpenCvSharp.dll", + @"OpenCvSharp\bin\Release\net48\OpenCvSharp.dll.config", + @"OpenCvSharp\bin\Release\net48\OpenCvSharp.pdb", + @"OpenCvSharp.Extensions\bin\Release\net48\OpenCvSharp.Extensions.dll", + @"OpenCvSharp.Extensions\bin\Release\net48\OpenCvSharp.Extensions.pdb", + @"OpenCvSharp.WpfExtensions\bin\Release\net48\OpenCvSharp.WpfExtensions.dll", + @"OpenCvSharp.WpfExtensions\bin\Release\net48\OpenCvSharp.WpfExtensions.pdb", + }, + ["netstandard2.0"] = new[] + { + @"OpenCvSharp\bin\Release\netstandard2.0\OpenCvSharp.dll", + @"OpenCvSharp\bin\Release\netstandard2.0\OpenCvSharp.dll.config", + @"OpenCvSharp\bin\Release\netstandard2.0\OpenCvSharp.pdb", + @"OpenCvSharp.Extensions\bin\Release\netstandard2.0\OpenCvSharp.Extensions.dll", + @"OpenCvSharp.Extensions\bin\Release\netstandard2.0\OpenCvSharp.Extensions.pdb", + }, + ["netstandard2.1"] = new[] + { + @"OpenCvSharp\bin\Release\netstandard2.1\OpenCvSharp.dll", + @"OpenCvSharp\bin\Release\netstandard2.1\OpenCvSharp.dll.config", + @"OpenCvSharp\bin\Release\netstandard2.1\OpenCvSharp.pdb", + @"OpenCvSharp.Extensions\bin\Release\netstandard2.1\OpenCvSharp.Extensions.dll", + @"OpenCvSharp.Extensions\bin\Release\netstandard2.1\OpenCvSharp.Extensions.pdb", + }, + ["net6.0"] = new[] + { + @"OpenCvSharp\bin\Release\net6.0\OpenCvSharp.dll", + @"OpenCvSharp\bin\Release\net6.0\OpenCvSharp.dll.config", + @"OpenCvSharp\bin\Release\net6.0\OpenCvSharp.pdb", + @"OpenCvSharp.Extensions\bin\Release\net6.0\OpenCvSharp.Extensions.dll", + @"OpenCvSharp.Extensions\bin\Release\net6.0\OpenCvSharp.Extensions.pdb", + @"OpenCvSharp.WpfExtensions\bin\Release\net6.0-windows\OpenCvSharp.WpfExtensions.dll", + @"OpenCvSharp.WpfExtensions\bin\Release\net6.0-windows\OpenCvSharp.WpfExtensions.pdb", + }, + }; + + private const string DebuggerVisualizerPath = @"OpenCvSharp.DebuggerVisualizers\bin\Release\OpenCvSharp.DebuggerVisualizers.dll"; + + private static readonly string[] xmlFiles = { + @"OpenCvSharp\bin\Release\net48\OpenCvSharp.xml", + @"OpenCvSharp.Extensions\bin\Release\net48\OpenCvSharp.Extensions.xml", + @"OpenCvSharp.WpfExtensions\OpenCvSharp.WpfExtensions.xml", + }; + + private static readonly IReadOnlyDictionary architectures = new Dictionary + { + ["win"] = new[] { "x86", "x64" }, + //["uwp"] = new[] { "x86", "x64", "ARM" }, + }; + + private static readonly IReadOnlySet ignoredExt = new[]{ + ".bak", + ".user", + ".suo", + ".git", + ".gitignore", + }.ToHashSet(); + private static readonly IReadOnlySet ignoredDir = new[]{ + ".git", + "bin", + "obj", + ".vs", + ".nuget", + "packages", + }.ToHashSet(); + + private static IReadOnlyDictionary UwpNativeDllDirectories(string version) + { + version = version.Replace(".", ""); + return new Dictionary + { + ["x86"] = @$"opencv_files\opencv{version}_uwp_x86\x86\vc17\bin", + ["x64"] = @$"opencv_files\opencv{version}_uwp_x64\x64\vc17\bin", + ["ARM"] = @$"opencv_files\opencv{version}_uwp_ARM\x86\vc17\bin", + }; + } + + private static IReadOnlyList UwpNativeDlls(string version) + { + version = version.Replace(".", ""); + return new[] + { + $"opencv_world{version}.dll", + $"opencv_img_hash{version}.dll" + }; + } + + /// + /// Make + /// + /// + /// + /// e.g. 4.5.1 + public static void Pack(string srcDir, string dstDir, string opencvVersion) + { + MakeBinaryPackage(srcDir, dstDir, opencvVersion); + MakeSamplePackage(srcDir, dstDir, opencvVersion); + } + + /// + /// Create a zip package that contains DLL files + /// + /// + /// + /// + private static void MakeBinaryPackage(string dir, string dirDst, string opencvVersion) + { + var dirSrc = Path.Combine(dir, "src"); + + var dstFileName = Path.Combine(dirDst, GetBinaryDstDirName(opencvVersion)) + ".zip"; + using var zipStream = File.OpenWrite(dstFileName); + using var zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Create, false); + + // net48, net6.0といったplatformごとにDLLを選択 + foreach (var (frameworkName, dllFileNames) in dllFiles) + { + foreach (var dllFileName in dllFileNames) + { + var dllPath = Path.Combine(dirSrc, dllFileName); + zipArchive.CreateEntryFromFile( + dllPath, + Path.Combine("ManagedLib", frameworkName, Path.GetFileName(dllPath)), + CompressionLevel.Optimal); + } + } + + // XMLドキュメントコメントを選択 + foreach (var f in xmlFiles) + { + var xmlPath = Path.Combine(dirSrc, f); + if (!File.Exists(xmlPath)) + continue; + zipArchive.CreateEntryFromFile( + xmlPath, + Path.Combine("XmlDoc", Path.GetFileName(xmlPath)), + CompressionLevel.Optimal); + } + + + // OpenCvSharpExtern.dllを、Windows用とUWP用それぞれで、x86/x64それぞれを入れる + foreach (var p in architectures) + { + foreach (var arch in p.Value) + { + var externDir = Path.Combine(dirSrc, "Release"); + if (p.Key == "uwp") + externDir = Path.Combine(externDir, "uwpOpenCvSharpExtern"); + var pfExtern = (arch == "x86") ? "Win32" : "x64"; + externDir = Path.Combine(externDir, pfExtern); + + foreach (var ext in new[] { "dll", "pdb" }) + { + var dstDirectory = Path.Combine("NativeLib", p.Key, arch); + + zipArchive.CreateEntryFromFile( + Path.Combine(externDir, $"OpenCvSharpExtern.{ext}"), + Path.Combine(dstDirectory, $"OpenCvSharpExtern.{ext}")); + } + + // UWPはopencv_world.dll等も入れる + if (p.Key == "uwp") + { + var uwpNativeDllDir = UwpNativeDllDirectories(opencvVersion)[arch]; + uwpNativeDllDir = Path.Combine(dir, uwpNativeDllDir); + foreach (var dllName in UwpNativeDlls(opencvVersion)) + { + var uwpNativeDll = Path.Combine(uwpNativeDllDir, dllName); + var dstDirectory = Path.Combine("NativeLib", "uwp", arch); + zipArchive.CreateEntryFromFile( + uwpNativeDll, + Path.Combine(dstDirectory, dllName)); + } + } + } + } + + // Debugger Visualizerを選択 + { + var dllFileName = Path.Combine(dirSrc, DebuggerVisualizerPath); + var zipFileName = Path.Combine( + "DebuggerVisualizers", Path.GetFileName(DebuggerVisualizerPath)); + zipArchive.CreateEntryFromFile( + dllFileName, + zipFileName); + } + + // テキストを選択 + { + zipArchive.CreateEntryFromFile( + Path.Combine(dir, "LICENSE"), + Path.GetFileName("LICENSE")); + zipArchive.CreateEntryFromFile( + Path.Combine(dir, "README.md"), + Path.GetFileName("README.md")); + } + } + + /// + /// Create a zip package that contains code samples + /// + /// + /// + /// + private static void MakeSamplePackage(string dirSrc, string dirDst, string version) + { + dirSrc = Path.Combine(dirSrc, "samples"); + dirDst = Path.Combine(dirDst, GetSampleDstDirName(version)); + + CopyDirectory(dirSrc, dirDst); + + var dstFileName = dirDst + ".zip"; + File.Delete(dstFileName); + + ZipFile.CreateFromDirectory( + dirDst, + dstFileName, + CompressionLevel.Optimal, + false); + + Directory.Delete(dirDst, true); + } + + private static string GetBinaryDstDirName(string version) + { + var date = DateTime.Now.ToString("yyyyMMdd"); + return $"OpenCvSharp-{version}-{date}"; + } + + private static string GetSampleDstDirName(string version) + { + var date = DateTime.Now.ToString("yyyyMMdd"); + return $"Sample-{version}-{date}"; + } + + /// + /// ディレクトリをコピーする。 + /// .svn bin obj は除外。 + /// + /// コピーするディレクトリ + /// コピー先のディレクトリ + /// http://dobon.net/vb/dotnet/file/copyfolder.html から拝借 + private static void CopyDirectory( + string sourceDirName, string destDirName) + { + // コピー先のディレクトリがあれば削除 + if (Directory.Exists(destDirName)) + { + Directory.Delete(destDirName, true); + } + + // コピー先のディレクトリを作る + Directory.CreateDirectory(destDirName); + File.SetAttributes(destDirName, File.GetAttributes(sourceDirName)); + + // コピー先のディレクトリ名の末尾に"\"をつける + if (destDirName[^1] != Path.DirectorySeparatorChar) + { + destDirName += Path.DirectorySeparatorChar; + } + + // コピー元のディレクトリにあるファイルをコピー + var files = Directory.EnumerateFiles(sourceDirName) + .Where(f => !ignoredExt.Contains(Path.GetExtension(f)?.ToLower())) + .Where(f => Path.GetFileName(f) != "OpenCvSharp.DebuggerVisualizers.dll"); + foreach (var file in files) + { + File.Copy(file, destDirName + Path.GetFileName(file), true); + } + + // コピー元のディレクトリにあるディレクトリについて、再帰的に呼び出す + var dirs = Directory.EnumerateDirectories(sourceDirName) + .Where(d => !ignoredDir.Contains(Path.GetFileName(d))); + foreach (var dir in dirs) + { + CopyDirectory(dir, destDirName + Path.GetFileName(dir)); + } + } +} diff --git a/tool/OpenCvSharp.ReleaseMaker/Program.cs b/tool/OpenCvSharp.ReleaseMaker/Program.cs new file mode 100644 index 000000000..d95a8a393 --- /dev/null +++ b/tool/OpenCvSharp.ReleaseMaker/Program.cs @@ -0,0 +1,16 @@ +namespace OpenCvSharp.ReleaseMaker; + +internal class Program +{ + private static void Main(string[] args) + { + if (args.Length != 3) + return; + + var srcDir = args[0]; + var dstDir = args[1]; + var version = args[2]; + + Packer.Pack(srcDir, dstDir, version); + } +}