diff --git a/.editorconfig b/.editorconfig index e93910b48..dab07df1f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,63 @@ -[*.cs] +# 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 @@ -15,3 +74,10 @@ 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/workflows/docfx.yml b/.github/workflows/docfx.yml index ca8d6d4e2..3035fc5c6 100644 --- a/.github/workflows/docfx.yml +++ b/.github/workflows/docfx.yml @@ -3,19 +3,28 @@ name: DocFX on: push: branches: - - master + - main + workflow_dispatch: jobs: build: - runs-on: windows-2019 + runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + 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: | @@ -23,13 +32,25 @@ jobs: docfx docfx\docfx.json - name: Upload DocFX packages - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: docfx_site path: ${{ github.workspace }}\docfx\_site - - name: Publish Documentation on GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + - uses: actions/upload-pages-artifact@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docfx/_site + 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-amazonlinux.yml b/.github/workflows/docker-amazonlinux.yml deleted file mode 100644 index 53d5e429a..000000000 --- a/.github/workflows/docker-amazonlinux.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Docker public.ecr.aws/lambda/dotnet:5.0 - -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/al2-dotnet5-opencv4.5.1 - docker build -t shimat/al2-dotnet5-opencv4.5.1 . 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 b/.github/workflows/macos10.yml.disabled similarity index 81% rename from .github/workflows/macos10.yml rename to .github/workflows/macos10.yml.disabled index 34fc6376a..6335c77ca 100644 --- a/.github/workflows/macos10.yml +++ b/.github/workflows/macos10.yml.disabled @@ -5,29 +5,29 @@ on: types: [synchronize, opened] push: branches: - - master + - main env: DEBIAN_FRONTEND: noninteractive - OPENCV_VERSION: 4.5.1 + OPENCV_VERSION: 4.8.0 jobs: build: - runs-on: macos-10.15 + runs-on: macos-11 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 1 - name: Install build dependencies run: | - brew install wget pkg-config mono-libgdiplus gtk+ ffmpeg glog yasm harfbuzz jpeg libpng libtiff openexr openjpeg metis openblas opencore-amr protobuf tbb webp + 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@v2 +# uses: actions/cache@v3 # with: # path: ${{ github.workspace }}/opencv_macos/ # key: opencv-${{ env.OPENCV_VERSION }}-macos-rev1 @@ -53,24 +53,30 @@ jobs: -DBUILD_opencv_python_tests=OFF \ -DBUILD_opencv_ts=OFF \ -DBUILD_opencv_js=OFF \ - -DBUILD_opencv_app=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=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 @@ -95,8 +101,13 @@ jobs: 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 - + LD_LIBRARY_PATH=. ./test + + - name: Install .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' + - name: Create NuGet package env: BETA: "" @@ -108,7 +119,7 @@ jobs: 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@v1 + - uses: actions/upload-artifact@v3 with: name: artifacts_macos_10 path: artifacts_macos @@ -116,15 +127,15 @@ jobs: - name: Test run: | cd ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests - ls - dotnet build -c Release -f netcoreapp3.1 - cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/netcoreapp3.1/ + # 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/netcoreapp3.1/ - ls + # 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 netcoreapp3.1 --runtime osx-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + dotnet test OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime osx-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null ls ls TestResults diff --git a/.github/workflows/publish_nuget.yml b/.github/workflows/publish_nuget.yml index 02493185d..21e0878ea 100644 --- a/.github/workflows/publish_nuget.yml +++ b/.github/workflows/publish_nuget.yml @@ -5,39 +5,53 @@ on: jobs: Publish: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Download windows artifact - uses: dawidd6/action-download-artifact@v2 + 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@v2 + uses: dawidd6/action-download-artifact@v8 with: github_token: ${{secrets.GITHUB_TOKEN}} - workflow: ubuntu18.yml - name: artifacts_ubuntu_18 + workflow: ubuntu22.yml + name: artifacts_ubuntu_22 - - name: Download macos artifact - uses: dawidd6/action-download-artifact@v2 + - name: Download ubuntu arm artifact + uses: dawidd6/action-download-artifact@v8 with: github_token: ${{secrets.GITHUB_TOKEN}} - workflow: macos10.yml - name: artifacts_macos_10 + 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@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1.x' + dotnet-version: 8.0.x - name: Rename run: | diff --git a/.github/workflows/ubuntu18.yml b/.github/workflows/ubuntu22.yml similarity index 53% rename from .github/workflows/ubuntu18.yml rename to .github/workflows/ubuntu22.yml index cfeee5fd9..cc61be85b 100644 --- a/.github/workflows/ubuntu18.yml +++ b/.github/workflows/ubuntu22.yml @@ -1,48 +1,44 @@ -name: Ubuntu 18.04 +name: Ubuntu 22.04 on: pull_request: types: [synchronize, opened] push: branches: - - master + - main env: DEBIAN_FRONTEND: noninteractive - OPENCV_VERSION: 4.5.1 + OPENCV_VERSION: 4.11.0 + OPENCV_CACHE_VERSION: 1 jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: - fetch-depth: 1 + path: opencvsharp - 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 \ - build-essential \ + g++ \ + make \ cmake \ - git \ libtbb-dev \ libatlas-base-dev \ libgtk2.0-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ - libdc1394-22-dev \ + libdc1394-dev \ libxine2-dev \ libv4l-dev \ libtheora-dev \ @@ -50,26 +46,40 @@ jobs: libxvidcore-dev \ libopencore-amrnb-dev \ libopencore-amrwb-dev \ - libavresample-dev \ x264 \ libtesseract-dev - name: Cache OpenCV id: opencv-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: - path: ${{ github.workspace }}/opencv_ubuntu/ - key: opencv-${{ env.OPENCV_VERSION }}-rev1 - + 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: | - 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 + mkdir opencv/build && cd opencv/build cmake \ + -S . \ + -B build \ -D CMAKE_BUILD_TYPE=Release \ - -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \ + -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ -D BUILD_SHARED_LIBS=OFF \ -D ENABLE_CXX11=ON \ -D BUILD_EXAMPLES=OFF \ @@ -77,52 +87,52 @@ jobs: -D BUILD_PERF_TESTS=OFF \ -D BUILD_TESTS=OFF \ -D BUILD_JAVA=OFF \ - -D BUILD_opencv_app=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=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_ubuntu .. - make -j2 - make install + -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/opencv_artifacts .. + cmake --build build + cmake --install build sudo ldconfig cd ${GITHUB_WORKSPACE} ls - name: Build OpenCvSharpExtern - run: | - ls ${GITHUB_WORKSPACE}/opencv_ubuntu - echo "-----" - ls ${GITHUB_WORKSPACE}/opencv_ubuntu/lib - echo "-----" - mkdir src/build && cd $_ - cmake -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/opencv_ubuntu .. - make -j2 + 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}/nuget/ - ldd OpenCvSharpExtern/libOpenCvSharpExtern.so + cp OpenCvSharpExtern/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/opencvsharp/nuget/ - name: Check OpenCvSharpExtern run: | - cd ${GITHUB_WORKSPACE}/nuget/ + 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 @@ -130,9 +140,9 @@ jobs: LD_LIBRARY_PATH=. ./test - name: Install .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1.x' + dotnet-version: '8.0.x' - name: Create NuGet package env: @@ -140,25 +150,24 @@ jobs: 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.ubuntu.18.04-x64.nuspec - cat ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.18.04-x64.nuspec - dotnet pack ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.18.04-x64.csproj -o ${GITHUB_WORKSPACE}/artifacts_ubuntu + 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@v1 + - uses: actions/upload-artifact@v4 with: - name: artifacts_ubuntu_18 + name: artifacts_ubuntu_22 path: artifacts_ubuntu - name: Test run: | - cd ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests - dotnet build -c Release -f netcoreapp3.1 - cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/netcoreapp3.1/ - cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/ - sudo cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so /usr/lib/ - ls ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/netcoreapp3.1/ - ls - LD_LIBRARY_PATH=. dotnet test OpenCvSharp.Tests.csproj -c Release -f netcoreapp3.1 --runtime ubuntu.18.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null - ls - ls TestResults + 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 index 4079e8ad8..082b09b7a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,23 +1,25 @@ -name: Windows Server 2019 +name: Windows Server 2022 on: pull_request: types: [synchronize, opened] push: branches: - - master + - main env: - OPENCV_VERSION: 4.5.1 + OPENCV_VERSION: "4.11.0" + OPENCV_FILES_TAG: "4.11.0.20250505" + TESSERACT_RELEASE_VERSION: "2024.08.19" jobs: build: - runs-on: windows-2019 + runs-on: windows-2022 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 submodules: true @@ -30,44 +32,60 @@ jobs: # restore-keys: | # ${{ runner.os }}-nuget- - - name: NuGet restore - shell: cmd - run: | - nuget restore - - - name: Install Server-Media-Foundation - shell: powershell - run: | - Install-WindowsFeature Server-Media-Foundation - - name: Cache OpenCV binaries id: cache_opencv - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ github.workspace }}/opencv_files - key: opencv-${{ env.OPENCV_VERSION }}-rev2 + key: opencv-${{ env.OPENCV_VERSION }}-rev1 - - name: Download OpenCV binaries + - name: Download OpenCV binaries if: steps.cache_opencv.outputs.cache-hit != 'true' shell: powershell + env: + GH_TOKEN: ${{ github.token }} run: | - . ".\download_opencv_windows.ps1" + 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@v2 + uses: actions/cache@v4 with: path: ${{ github.workspace }}/tesseract_files - key: tesseract-rev2 + key: tesseract-41-rev2 - - name: Download Tesseract binaries + - 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: | - . ".\download_tesseract_windows.ps1" + Install-WindowsFeature Server-Media-Foundation - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v2 - name: Build x64 shell: cmd @@ -77,13 +95,27 @@ jobs: shell: cmd run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=x86 -maxcpucount - - name: Build ARM + #- 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: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=ARM -maxcpucount + 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}" @@ -95,25 +127,32 @@ jobs: } $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, $wpfExtensionsNuspec) + $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){ - Write-Host "before: " $dependency.GetAttribute("id") "=" $dependency.GetAttribute("version") - $dependency.SetAttribute("version", $version) - Write-Host "after: " $dependency.GetAttribute("id") "=" $dependency.GetAttribute("version") - $xml.Save($nuspecFile) + $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 - nuget pack nuget/OpenCvSharp4.runtime.uwp.nuspec -OutputDirectory artifacts - name: Test shell: powershell @@ -121,6 +160,12 @@ jobs: 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: | @@ -128,7 +173,7 @@ jobs: 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@v2 + uses: actions/upload-artifact@v4 with: name: packages_windows path: ${{ github.workspace }}\artifacts diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 89b11df44..000000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -services: - - docker - -before_install: - - cd docker/ubuntu.18.04-x64 - - docker build -t shimat/opencvsharp-docker . - -script: - - echo "script" - -notifications: - email: - - schimatk@gmail.com diff --git a/LICENSE b/LICENSE index 261eeb9e9..434e92781 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + 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. diff --git a/OpenCvSharp.sln b/OpenCvSharp.sln index 7a4498284..73ba676ab 100644 --- a/OpenCvSharp.sln +++ b/OpenCvSharp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29503.13 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E048D213-B3B9-453F-9A41-29FDEB0D496B}" EndProject @@ -24,8 +24,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tool", "tool", "{A6E578C0-A EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.NupkgBetaRemover", "tool\OpenCvSharp.NupkgBetaRemover\OpenCvSharp.NupkgBetaRemover.csproj", "{CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uwpOpenCvSharpExtern", "src\uwpOpenCvSharpExtern\uwpOpenCvSharpExtern.vcxproj", "{BD5471E5-7B55-5192-8DA4-042B66AF71AE}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.WpfExtensions", "src\OpenCvSharp.WpfExtensions\OpenCvSharp.WpfExtensions.csproj", "{01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCvSharp.ReleaseMaker", "tool\OpenCvSharp.ReleaseMaker\OpenCvSharp.ReleaseMaker.csproj", "{1C399497-5240-439A-879A-4ACB34C409AE}" @@ -35,6 +33,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject +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 @@ -140,19 +142,6 @@ Global {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 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|ARM.ActiveCfg = Debug|ARM - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|x64.ActiveCfg = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|x64.Build.0 = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|x86.ActiveCfg = Release|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|x86.Build.0 = Release|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|Any CPU.ActiveCfg = Release|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|ARM.ActiveCfg = Release|ARM - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|ARM.Build.0 = Release|ARM - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x64.ActiveCfg = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x64.Build.0 = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x86.ActiveCfg = Release|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x86.Build.0 = Release|Win32 {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 @@ -185,6 +174,38 @@ Global {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 @@ -196,9 +217,10 @@ Global {8E7279F8-F801-4672-B42F-1ED2C68B16A4} = {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} - {BD5471E5-7B55-5192-8DA4-042B66AF71AE} = {E048D213-B3B9-453F-9A41-29FDEB0D496B} {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} diff --git a/OpenCvSharp.sln.DotSettings b/OpenCvSharp.sln.DotSettings index 9ff420506..63d9a7751 100644 --- a/OpenCvSharp.sln.DotSettings +++ b/OpenCvSharp.sln.DotSettings @@ -1,8 +1,10 @@  <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 @@ -10,6 +12,13 @@ <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 @@ -64,7 +73,9 @@ True True + True True + True True True True @@ -88,6 +99,7 @@ True True True + True True True True @@ -100,6 +112,7 @@ True True True + True True True True @@ -134,9 +147,11 @@ True True True + True True True True + True True True diff --git a/README.md b/README.md index 69e408cf9..0ebba09c2 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,35 @@ -# OpenCvSharp -[![Github Actions Windows Status](https://github.com/shimat/opencvsharp/workflows/Windows%20Server%202019/badge.svg)](https://github.com/shimat/opencvsharp/actions) [![Github Actions Ubuntu Status](https://github.com/shimat/opencvsharp/workflows/Ubuntu%2018.04/badge.svg)](https://github.com/shimat/opencvsharp/actions) [![Github Actions MacOS Status](https://github.com/shimat/opencvsharp/workflows/macOS%2010.15/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) +![opencvsharp](https://socialify.git.ci/shimat/opencvsharp/image?description=1&forks=1&language=1&owner=1&pattern=Plus&stargazers=1&theme=Light) -Wrapper of OpenCV for .NET +[![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.runtime.ubuntu.18.04-x64**| Native bindings for Ubuntu 18.04 x64 | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.runtime.ubuntu.18.04-x64.svg)](https://badge.fury.io/nu/OpenCvSharp4.runtime.ubuntu.18.04-x64) | -|**OpenCvSharp4.runtime.osx.10.15-x64**| Native bindings for macOS 10.15 x64 | [![NuGet version](https://badge.fury.io/nu/OpenCvSharp4.runtime.osx.10.15-x64.svg)](https://www.nuget.org/packages/OpenCvSharp4.runtime.osx.10.15-x64/) | +|**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, Ubuntu 18.04 and macOS are released. +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://hub.docker.com/u/shimat -- Ubuntu 18.04 (.NET Core 3.1): [shimat/ubuntu18-dotnetcore3.1-opencv4.5.0](https://hub.docker.com/r/shimat/ubuntu18-dotnetcore3.1-opencv4.5.0) -- For Google App Engine Flexible (.NET Core 3.1): [shimat/appengine-aspnetcore3.1-opencv4.5.0](https://hub.docker.com/r/shimat/appengine-aspnetcore3.1-opencv4.5.0) -- For AWS Lambda (.NET 5): [shimat/al2-dotnet5-opencv4.5.0](https://hub.docker.com/r/shimat/al2-dotnet5-opencv4.5.0) - - Code sample: https://github.com/shimat/opencvsharp_AWSLambdaSample +https://github.com/shimat?tab=packages ## Installation @@ -37,47 +39,31 @@ Add `OpenCvSharp4` and `OpenCvSharp4.runtime.win` NuGet packages to your project ### 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 18.04 -Add `OpenCvSharp4` and `OpenCvSharp4.runtime.ubuntu.18.04.x64` NuGet packages to your project. +### 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.18.04-x64 +dotnet add package OpenCvSharp4_.runtime.ubuntu.22.04-x64 # -- edit Program.cs --- # dotnet run ``` -### Google AppEngine Flexible (Ubuntu 16.04) -Some Docker images are provided to use OpenCvSharp with AppEngine Flexible. The native binding (libOpenCvSharpExtern) is already built in the docker image and you don't need to worry about it. -``` -FROM shimat/appengine-aspnetcore3.1-opencv4.5.0:20201030 - -ADD ./ /app -ENV ASPNETCORE_URLS=http://*:${PORT} - -WORKDIR /app -ENTRYPOINT [ "dotnet", "YourAspNetCoreProject.dll" ] -``` - -### Ubuntu 18.04 Docker image -You can use the `shimat/ubuntu18-dotnetcore3.1-opencv4.5.0` docker image. -This issue may be helpful: https://github.com/shimat/opencvsharp/issues/920 - ### Downloads If you do not use NuGet, get DLL files from the [release page](https://github.com/shimat/opencvsharp/releases). ## Target OpenCV -* [OpenCV 4.5.1](http://opencv.org/) with [opencv_contrib](https://github.com/opencv/opencv_contrib) +* [OpenCV 4.10.0](http://opencv.org/) with [opencv_contrib](https://github.com/opencv/opencv_contrib) ## Requirements -* [.NET Framework 4.6.1](http://www.microsoft.com/ja-jp/download/details.aspx?id=1639) / [.NET Core 2.0](https://www.microsoft.com/net/download) / [Mono](http://www.mono-project.com/Main_Page) -* (Windows) [Visual C++ 2019 Redistributable Package](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) +* [.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, Mac) 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. +* (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/ @@ -147,14 +133,14 @@ using (var t = new ResourcesTracker()) ## Code samples https://github.com/shimat/opencvsharp_samples/ -## Documents +## API Documents http://shimat.github.io/opencvsharp/api/OpenCvSharp.html ## OpenCvSharp Build Instructions ### Windows -- Install Visual Studio 2019 or later +- 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 AppVeyor CI. +- 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 ``` @@ -168,10 +154,10 @@ If you want to use some OpenCV features that are not provided by default in Open - Edit `build_windows.ps1` or `build_uwp.ps1` to customize the CMake parameters . - Run the PowerShell script. -### Ubuntu 18.04 +### Ubuntu - Build OpenCV with opencv_contrib. - https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/ -- Install .NET Core SDK. https://docs.microsoft.com/ja-jp/dotnet/core/install/linux-package-manager-ubuntu-1804 +- 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 @@ -202,9 +188,6 @@ dotnet add package OpenCvSharp4 dotnet run ``` -### Older Ubuntu -Refer to the [Dockerfile](https://github.com/shimat/opencvsharp/blob/master/docker/google-appengine-ubuntu.16.04-x64/Dockerfile) and [Wiki pages](https://github.com/shimat/opencvsharp/wiki). - ## Donations If you find the OpenCvSharp library useful and would like to show your gratitude by donating, here are some donation options. Thank you. diff --git a/docfx/docfx.json b/docfx/docfx.json index d9df6a2b0..490f358a0 100644 --- a/docfx/docfx.json +++ b/docfx/docfx.json @@ -12,7 +12,7 @@ "disableGitFeatures": false, "disableDefaultFilter": false, "properties": { - "TargetFramework": "net48" + "TargetFramework": "net6" } } ], diff --git a/docker/al2-dotnet5-opencv4.5.1/Dockerfile b/docker/al2-dotnet5-opencv4.6.0/Dockerfile similarity index 89% rename from docker/al2-dotnet5-opencv4.5.1/Dockerfile rename to docker/al2-dotnet5-opencv4.6.0/Dockerfile index 2f0e1ed59..ba2eddd39 100644 --- a/docker/al2-dotnet5-opencv4.5.1/Dockerfile +++ b/docker/al2-dotnet5-opencv4.6.0/Dockerfile @@ -1,6 +1,6 @@ FROM public.ecr.aws/lambda/dotnet:5.0 -ENV OPENCV_VERSION=4.5.1 +ENV OPENCV_VERSION=4.6.0 WORKDIR / @@ -32,11 +32,13 @@ RUN cd opencv && mkdir build && cd build && \ -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_js=OFF \ -D BUILD_opencv_bioinspired=OFF \ -D BUILD_opencv_ccalib=OFF \ -D BUILD_opencv_datasets=OFF \ @@ -46,21 +48,23 @@ RUN cd opencv && mkdir build && cd build && \ -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 WITH_GSTREAMER=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D WITH_GSTREAMER=OFF \ -D OPENCV_ENABLE_NONFREE=ON \ - .. && make -j8 && make install + .. && 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 + cd opencvsharp # Install the Extern lib. RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ diff --git a/docker/ubuntu18-dotnetcore3.1-opencv4.5.1/Dockerfile b/docker/ubuntu20-dotnet6-opencv4.6.0/Dockerfile similarity index 69% rename from docker/ubuntu18-dotnetcore3.1-opencv4.5.1/Dockerfile rename to docker/ubuntu20-dotnet6-opencv4.6.0/Dockerfile index b2ea62ca4..705a5f3ee 100644 --- a/docker/ubuntu18-dotnetcore3.1-opencv4.5.1/Dockerfile +++ b/docker/ubuntu20-dotnet6-opencv4.6.0/Dockerfile @@ -1,6 +1,7 @@ -FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as builder -ENV OPENCV_VERSION=4.5.1 +ENV DEBIAN_FRONTEND=noninteractive +ENV OPENCV_VERSION=4.6.0 WORKDIR / @@ -58,7 +59,9 @@ RUN cd opencv && mkdir build && cd build && \ -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 \ @@ -72,15 +75,18 @@ RUN cd opencv && mkdir build && cd build && \ -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 -j6 && make install && ldconfig + .. && make -j$(nproc) && make install && ldconfig # Download OpenCvSharp RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp @@ -88,15 +94,22 @@ 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 && \ + make -j$(nproc) && make install && \ rm -rf /opencv && \ rm -rf /opencv_contrib && \ - mkdir /artifacts && \ - cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /artifacts/ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ -# Test OpenCvSharpExtern -RUN cp artifacts/libOpenCvSharpExtern.so /usr/lib/ && \ - echo "\n\ + +########## 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\ @@ -105,27 +118,24 @@ int main(){ \n\ return 0; \n\ }" > /test.c && \ gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \ - LD_LIBRARY_PATH=. ./test && \ - rm -f /test* + LD_LIBRARY_PATH=. ./test -# Install Build the C# part of OpenCvSharp -#RUN cd /opencvsharp/src/OpenCvSharp && \ -# dotnet build -c Release -f netstandard2.1 && \ -# cd /opencvsharp/src/OpenCvSharp.Blob && \ -# dotnet build -c Release -f netstandard2.1 && \ -# cd /opencvsharp/src/OpenCvSharp.Extensions && \ -# dotnet build -c Release -f netstandard2.1 && \ -# cp /opencvsharp/src/OpenCvSharp/bin/Release/netstandard2.1/* /artifacts/ && \ -# cp /opencvsharp/src/OpenCvSharp.Blob/bin/Release/netstandard2.1/* /artifacts/ && \ -# cp /opencvsharp/src/OpenCvSharp.Extensions/bin/Release/netstandard2.1/* /artifacts/ -# Test OpenCvSharp -#RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f netcoreapp3.1 --runtime ubuntu.18.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null +########## Test .NET class libraries ########## -RUN rm -rf /opencvsharp +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 netcoreapp3.1 -o "ConsoleApp01" && cd /ConsoleApp01 && \ +# RUN dotnet new console -f net6.0 -o "ConsoleApp01" && cd /ConsoleApp01 && \ # echo "\n\ #using System; \n\ #using OpenCvSharp; \n\ @@ -141,3 +151,10 @@ RUN rm -rf /opencvsharp # 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 index d1b4e7cbf..1efcabe2e 100644 --- a/download_opencv_windows.ps1 +++ b/download_opencv_windows.ps1 @@ -1,11 +1,7 @@ -$tag = "4.5.1.20201228" -$version = "451" -$uriArray =@( - "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv${version}_win_x64.zip" - "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv${version}_win_x86.zip" - "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv${version}_uwp_x64.zip" - "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv${version}_uwp_x86.zip" - "https://github.com/shimat/opencv_files/releases/download/${tag}/opencv${version}_uwp_ARM.zip" +$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) { @@ -18,9 +14,9 @@ function Download($uri, $outFile) { 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) +[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12) -foreach($uri in $uriArray){ +foreach ($uri in $uriArray) { $outFile = [System.IO.Path]::GetFileName($uri) $outFileWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($uri) Download $uri $outFile diff --git a/download_tesseract_windows.ps1 b/download_tesseract_windows.ps1 index 038e8676e..515a685a1 100644 --- a/download_tesseract_windows.ps1 +++ b/download_tesseract_windows.ps1 @@ -1,5 +1,5 @@ -$uriArray =@( - "https://github.com/shimat/tesseract_vcpkg/releases/download/2020.12.29/tesseract_vcpkg.0.0.6-beta.zip" +$uriArray = @( + "https://github.com/shimat/tesseract_vcpkg/releases/download/2023.07.06/tesseract_vcpkg.0.0.8-beta.nupkg" ) function Download($uri, $outFile) { @@ -12,9 +12,9 @@ function Download($uri, $outFile) { mkdir tesseract_files -Force -ErrorAction Stop | Out-Null cd tesseract_files -[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls,[Net.SecurityProtocolType]::Tls11,[Net.SecurityProtocolType]::Tls12) +[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12) -foreach($uri in $uriArray){ +foreach ($uri in $uriArray) { $outFile = "tesseract_vcpkg.zip" $outFileWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($outFile) Download $uri $outFile 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 index a9247cbaa..7218edb0c 100644 --- a/nuget/OpenCvSharp4.Windows.nuspec +++ b/nuget/OpenCvSharp4.Windows.nuspec @@ -2,7 +2,7 @@ OpenCvSharp4.Windows - 4.3.0.20190901 + 4.6.0.20220607 OpenCvSharp NuGet package for x64/x86 Windows (same as OpenCvSharp3-AnyCPU) shimat Apache-2.0 @@ -16,25 +16,25 @@ Image Processing OpenCV Wrapper FFI opencvsharp - + - + - - + - + + - + diff --git a/nuget/OpenCvSharp4.WpfExtensions.nuspec b/nuget/OpenCvSharp4.WpfExtensions.nuspec index c4442b0b4..f4c0d2deb 100644 --- a/nuget/OpenCvSharp4.WpfExtensions.nuspec +++ b/nuget/OpenCvSharp4.WpfExtensions.nuspec @@ -2,7 +2,7 @@ OpenCvSharp4.WpfExtensions - 4.3.0.20190901 + 4.6.0.20220607 OpenCvSharp WPF extension library. shimat Apache-2.0 @@ -16,29 +16,31 @@ Image Processing OpenCV Wrapper FFI opencvsharp - + + - + + - - - - - - + + + + + + - - - + + + - - - + + + - \ No newline at end of file + diff --git a/nuget/OpenCvSharp4.nuspec b/nuget/OpenCvSharp4.nuspec index 33613dccc..36593351c 100644 --- a/nuget/OpenCvSharp4.nuspec +++ b/nuget/OpenCvSharp4.nuspec @@ -2,7 +2,7 @@ OpenCvSharp4 - 4.3.0.20190901 + 4.6.0.20220607 OpenCvSharp core library. A package of separate native bindings for your OS is required. shimat Apache-2.0 @@ -16,62 +16,42 @@ Image Processing OpenCV Wrapper FFI opencvsharp - - - - - + + + - - - + - - - + + - - - - + + - - - - + + + - - - - - - + + + - - - - - - - - - - - - + + + diff --git a/nuget/OpenCvSharp4.runtime.ubuntu.18.04-x64.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj similarity index 68% rename from nuget/OpenCvSharp4.runtime.ubuntu.18.04-x64.csproj rename to nuget/OpenCvSharp4.official.runtime.linux-x64.csproj index 62c35a53c..a3a5cda26 100644 --- a/nuget/OpenCvSharp4.runtime.ubuntu.18.04-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj @@ -1,9 +1,9 @@ - netstandard2.0;netstandard2.1;netcoreapp2.1; + netstandard2.0;netstandard2.1;net6.0; true false - OpenCvSharp4.runtime.ubuntu.18.04-x64.nuspec + OpenCvSharp4.official.runtime.linux-x64.nuspec 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 - Internal implementation package for OpenCvSharp to work on Ubuntu 18.04 + 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 @@ -19,12 +19,12 @@ - + - + \ No newline at end of file diff --git a/nuget/OpenCvSharp4.runtime.ubuntu.16.04-x64.csproj b/nuget/OpenCvSharp4.runtime.linux-arm.csproj similarity index 83% rename from nuget/OpenCvSharp4.runtime.ubuntu.16.04-x64.csproj rename to nuget/OpenCvSharp4.runtime.linux-arm.csproj index 89ce989d2..6b5b9573d 100644 --- a/nuget/OpenCvSharp4.runtime.ubuntu.16.04-x64.csproj +++ b/nuget/OpenCvSharp4.runtime.linux-arm.csproj @@ -3,10 +3,10 @@ netstandard2.0;netstandard2.1;netcoreapp2.1; true false - OpenCvSharp4.runtime.ubuntu.16.04-x64.nuspec + OpenCvSharp4.runtime.linux-arm.nuspec - + diff --git a/nuget/OpenCvSharp4.runtime.ubuntu.16.04-x64.nuspec b/nuget/OpenCvSharp4.runtime.linux-arm.nuspec similarity index 71% rename from nuget/OpenCvSharp4.runtime.ubuntu.16.04-x64.nuspec rename to nuget/OpenCvSharp4.runtime.linux-arm.nuspec index 635cb4318..1f50b4061 100644 --- a/nuget/OpenCvSharp4.runtime.ubuntu.16.04-x64.nuspec +++ b/nuget/OpenCvSharp4.runtime.linux-arm.nuspec @@ -1,17 +1,17 @@ - + - OpenCvSharp4.runtime.ubuntu.16.04-x64 - 4.3.0.20191030-beta1 - OpenCvSharp native bindings for ubuntu.16.04-x64 + 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 16.04 - Internal implementation package for OpenCvSharp to work on Ubuntu 16.04 + 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 @@ -19,12 +19,12 @@ - + - + - \ No newline at end of file + diff --git a/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec b/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec index e0053e494..5319b3cfb 100644 --- a/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec +++ b/nuget/OpenCvSharp4.runtime.osx.10.15-x64.nuspec @@ -19,7 +19,7 @@ - + diff --git a/nuget/OpenCvSharp4.runtime.uwp.nuspec b/nuget/OpenCvSharp4.runtime.uwp.nuspec index 065795c1f..88eafec93 100644 --- a/nuget/OpenCvSharp4.runtime.uwp.nuspec +++ b/nuget/OpenCvSharp4.runtime.uwp.nuspec @@ -2,7 +2,7 @@ OpenCvSharp4.runtime.uwp - 4.3.0.20190901 + 4.6.0.20220607 OpenCvSharp4 native bindings for UWP x64/x86/ARM shimat Apache-2.0 @@ -16,7 +16,6 @@ Image Processing OpenCV Wrapper FFI opencvsharp - @@ -27,11 +26,11 @@ - - - - - - + + + + + + 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 index d1985928f..07ae74dfb 100644 --- a/nuget/OpenCvSharp4.runtime.win.nuspec +++ b/nuget/OpenCvSharp4.runtime.win.nuspec @@ -2,7 +2,7 @@ OpenCvSharp4.runtime.win - 4.3.0.20190901 + 4.6.0.20220607 OpenCvSharp4 native bindings for Windows x64/x86 (except UWP) shimat Apache-2.0 @@ -17,10 +17,9 @@ - - + @@ -28,10 +27,11 @@ - - - + + + + diff --git a/nuget/OpenCvSharp4.runtime.win.props b/nuget/OpenCvSharp4.runtime.win.props index ffff885c8..af4e6a20e 100644 --- a/nuget/OpenCvSharp4.runtime.win.props +++ b/nuget/OpenCvSharp4.runtime.win.props @@ -1,24 +1,24 @@  - $(MSBuildThisFileDirectory)..\..\runtimes + $(MSBuildThisFileDirectory)..\..\runtimes - - + + dll\x86\OpenCvSharpExtern.dll PreserveNewest - - dll\x86\opencv_videoio_ffmpeg451.dll + + dll\x86\opencv_videoio_ffmpeg4110.dll PreserveNewest - - + + dll\x64\OpenCvSharpExtern.dll PreserveNewest - - dll\x64\opencv_videoio_ffmpeg451_64.dll + + dll\x64\opencv_videoio_ffmpeg4110_64.dll PreserveNewest diff --git a/nuget/nuget.exe b/nuget/nuget.exe deleted file mode 100644 index 81367115d..000000000 Binary files a/nuget/nuget.exe and /dev/null differ diff --git a/samples b/samples index 7139d74d6..42322d297 160000 --- a/samples +++ b/samples @@ -1 +1 @@ -Subproject commit 7139d74d655e9cc25ec70e552a6fc4077a0793a5 +Subproject commit 42322d297b313d9f115cba80773f2496a8c9cd9f diff --git a/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs index 8dc8087a2..4f7833ffd 100644 --- a/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs +++ b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.cs @@ -4,40 +4,46 @@ 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); - SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); + var ratio = SetClientSize(new System.Drawing.Size(bitmap.Width, bitmap.Height)); + DisplayRatio(ratio); + pictureBox.Image = bitmap; } @@ -45,22 +51,33 @@ protected override void OnLoad(EventArgs e) /// ClientSizeを画面からはみ出ない大きさに調整して設定する. /// /// - private void SetClientSize(System.Drawing.Size size) + private double 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); - } + 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 index 2074dd920..331890f0d 100644 --- a/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.designer.cs +++ b/src/OpenCvSharp.DebuggerVisualizers/ImageViewer.designer.cs @@ -13,9 +13,10 @@ partial class ImageViewer /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing) { - components.Dispose(); + components?.Dispose(); + DisposeBitmap(); } base.Dispose(disposing); } @@ -28,35 +29,32 @@ protected override void Dispose(bool disposing) /// 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(); + 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); } @@ -66,4 +64,4 @@ private void InitializeComponent() } -} \ No newline at end of file +} 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 index f2b57b3ba..26833207d 100644 --- a/src/OpenCvSharp.DebuggerVisualizers/MatDebuggerVisualizer.cs +++ b/src/OpenCvSharp.DebuggerVisualizers/MatDebuggerVisualizer.cs @@ -11,18 +11,17 @@ public class MatDebuggerVisualizer : DialogDebuggerVisualizer protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { // MatProxyが送られてくるはず - using (var proxy = objectProvider.GetObject() as MatProxy) + var proxy = objectProvider.GetObject() as MatProxy; + if (proxy is null) { - if (proxy == null) - { - throw new ArgumentException(); - } - // Formに表示 - using (var form = new ImageViewer(proxy)) - { - windowService.ShowDialog(form); - } - } + 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 index f8ae2e238..160921786 100644 --- a/src/OpenCvSharp.DebuggerVisualizers/MatObjectSource.cs +++ b/src/OpenCvSharp.DebuggerVisualizers/MatObjectSource.cs @@ -15,4 +15,4 @@ public override void GetData(object target, Stream outgoingData) bf.Serialize(outgoingData, new MatProxy((Mat)target)); } } -} \ No newline at end of file +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs b/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs index 433dd93be..c4109308f 100644 --- a/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs +++ b/src/OpenCvSharp.DebuggerVisualizers/MatProxy.cs @@ -9,24 +9,19 @@ namespace OpenCvSharp.DebuggerVisualizers /// 送る際に、このProxyに表示に必要なシリアライズ可能なデータを詰めて送り、受信側で復元する。 /// [Serializable] - public class MatProxy : IDisposable + public class MatProxy { public byte[] ImageData { get; private set; } public MatProxy(Mat image) { - ImageData = image.ToBytes(".png"); - } - - public void Dispose() - { - ImageData = null; + ImageData = image.ToBytes(); } public Bitmap CreateBitmap() { - if (ImageData == null) - throw new Exception("ImageData == null"); + if (ImageData is null) + throw new Exception("ImageData is null"); using (var stream = new MemoryStream(ImageData)) { @@ -34,4 +29,4 @@ public Bitmap CreateBitmap() } } } -} \ No newline at end of file +} diff --git a/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj b/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj index 1385eea97..f632b1b3c 100644 --- a/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj +++ b/src/OpenCvSharp.DebuggerVisualizers/OpenCvSharp.DebuggerVisualizers.csproj @@ -9,7 +9,7 @@ Properties OpenCvSharp.DebuggerVisualizers OpenCvSharp.DebuggerVisualizers - v4.6.1 + v4.8 512 @@ -73,6 +73,11 @@ + + + ImageViewer.cs + +