diff --git a/.github/workflows/ubuntu-slim.yml b/.github/workflows/ubuntu-slim.yml index 840ece6a5..638869551 100644 --- a/.github/workflows/ubuntu-slim.yml +++ b/.github/workflows/ubuntu-slim.yml @@ -183,6 +183,18 @@ jobs: package_project="OpenCvSharp4.official.runtime.ubuntu.${{ matrix.ubuntu }}-x64.slim.csproj" dotnet pack "nuget/${package_project}" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version + - name: Create linux-x64 NuGet package (slim) + if: matrix.ubuntu == '22.04' + env: + BETA: "-beta" + run: | + yyyymmdd=`date '+%Y%m%d'` + version="${OPENCV_VERSION}.${yyyymmdd}${BETA}" + echo "Package version: $version" + + cd ${GITHUB_WORKSPACE}/opencvsharp + dotnet pack "nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version + - uses: actions/upload-artifact@v6 with: name: artifacts_ubuntu_slim_${{ matrix.ubuntu }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 35e86c822..f367faaf7 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -184,6 +184,20 @@ jobs: ls ${GITHUB_WORKSPACE}/artifacts + - name: Create linux-x64 NuGet package + if: matrix.ubuntu == '22.04' + env: + BETA: "-beta" + run: | + yyyymmdd=`date '+%Y%m%d'` + version="${OPENCV_VERSION}.${yyyymmdd}${BETA}" + echo "Package version: $version" + + cd ${GITHUB_WORKSPACE}/opencvsharp + dotnet pack "nuget/OpenCvSharp4.official.runtime.linux-x64.csproj" -o ${GITHUB_WORKSPACE}/artifacts -p:Version=$version + + ls ${GITHUB_WORKSPACE}/artifacts + - uses: actions/upload-artifact@v6 with: name: artifacts_ubuntu_${{ matrix.ubuntu }} diff --git a/README.md b/README.md index 1c5a3c54f..fe5210aaa 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ dotnet add package OpenCvSharp4.Windows ### Linux / Ubuntu ```bash dotnet add package OpenCvSharp4 -dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64 +dotnet add package OpenCvSharp4.official.runtime.linux-x64 # optional slim profile (smaller native dependency surface) -# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim +# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim ``` For more installation options, see the [Installation](#installation) section below. @@ -54,21 +54,20 @@ For a smaller feature profile, pair `OpenCvSharp4` with `OpenCvSharp4.runtime.wi ### 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 24.04 -Add `OpenCvSharp4` and `OpenCvSharp4.official.runtime.ubuntu.24.04-x64` NuGet packages to your project. +### Linux (Ubuntu and other distributions) +Add `OpenCvSharp4` and `OpenCvSharp4.official.runtime.linux-x64` NuGet packages to your project. This package uses the portable `linux-x64` RID and works with .NET 8+ publish/deploy workflows out of the box. ```bash dotnet new console -n ConsoleApp01 cd ConsoleApp01 dotnet add package OpenCvSharp4 -dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64 +dotnet add package OpenCvSharp4.official.runtime.linux-x64 # or slim profile: -# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim +# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim # -- edit Program.cs --- # dotnet run ``` -### Other Linux distributions -Add `OpenCvSharp4` and the appropriate Ubuntu runtime package (for example `OpenCvSharp4.official.runtime.ubuntu.24.04-x64`) to your project. The Ubuntu runtime packages are built on the specified Ubuntu releases and may work on similar distributions. +Distro-specific packages (`OpenCvSharp4.official.runtime.ubuntu.24.04-x64`, `OpenCvSharp4.official.runtime.ubuntu.22.04-x64`) are also available but use distro-specific RIDs that are [no longer resolved automatically by .NET 8+](https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph). The `linux-x64` package is recommended for most users. ### Slim profile module coverage @@ -82,6 +81,7 @@ This profile is used by: - `OpenCvSharp4.runtime.win.slim` - `OpenCvSharp4.Windows.Slim` +- `OpenCvSharp4.official.runtime.linux-x64.slim` - `OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim` - `OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim` @@ -167,6 +167,8 @@ http://shimat.github.io/opencvsharp/api/OpenCvSharp.html |**[OpenCvSharp4.runtime.win](https://www.nuget.org/packages/OpenCvSharp4.runtime.win/)**| Native bindings for Windows x64/x86 (except UWP) | |**[OpenCvSharp4.runtime.win.slim](https://www.nuget.org/packages/OpenCvSharp4.runtime.win.slim/)**| Slim native bindings for Windows x64/x86 (except UWP), with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled | |**[OpenCvSharp4.runtime.uwp](https://www.nuget.org/packages/OpenCvSharp4.runtime.uwp/)**| Native bindings for UWP (Universal Windows Platform) x64/x86/ARM | +|**[OpenCvSharp4.official.runtime.linux-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.linux-x64/)**| Native bindings for Linux x64 (portable RID, recommended) | +|**[OpenCvSharp4.official.runtime.linux-x64.slim](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.linux-x64.slim/)**| Slim native bindings for Linux x64 (portable RID), with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled | |**[OpenCvSharp4.official.runtime.ubuntu.22.04-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.22.04-x64/)**| Native bindings for Ubuntu 22.04 x64 | |**[OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim/)**| Slim native bindings for Ubuntu 22.04 x64, with `core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo` enabled | |**[OpenCvSharp4.official.runtime.ubuntu.24.04-x64](https://www.nuget.org/packages/OpenCvSharp4.official.runtime.ubuntu.24.04-x64/)**| Native bindings for Ubuntu 24.04 x64 | @@ -238,7 +240,7 @@ dotnet run ``` ## Customizing OpenCV and OpenCvSharp for embedded (ARM) Platforms -If you want to use OpenCV and OpenCvSharp on an embedded platform like a Raspberry Pi with a 64-bit OS, you have to build both libraries manually, and it's easiest to build it right on your target hardware to avoid cross-compiler toolchain challenges. [The instructions for this build and install are here](embedded-builds.md). +If you want to use OpenCV and OpenCvSharp on an embedded platform like a Raspberry Pi with a 64-bit OS, you have to build both libraries manually, and it's easiest to build it right on your target hardware to avoid cross-compiler toolchain challenges. [The instructions for this build and install are here](docs/embedded-builds.md). ## 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/embedded-builds.md b/docs/embedded-builds.md similarity index 100% rename from embedded-builds.md rename to docs/embedded-builds.md diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj new file mode 100644 index 000000000..2c3300227 --- /dev/null +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.csproj @@ -0,0 +1,27 @@ + + + netstandard2.0;netstandard2.1;net8.0 + true + false + + + OpenCvSharp4.official.runtime.linux-x64 + OpenCvSharp native bindings for Linux x64 + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + opencvsharp.png + Internal implementation package for OpenCvSharp to work on Linux x64 (portable RID) + Image Processing OpenCV Wrapper FFI opencvsharp linux + Copyright 2008-2026 + + https://github.com/shimat/opencvsharp.git + git + false + + + + + + + diff --git a/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj new file mode 100644 index 000000000..f19da17ee --- /dev/null +++ b/nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj @@ -0,0 +1,26 @@ + + + netstandard2.0;netstandard2.1;net8.0 + true + false + + OpenCvSharp4.official.runtime.linux-x64.slim + OpenCvSharp native bindings for Linux x64 (Slim) + shimat + Apache-2.0 + https://github.com/shimat/opencvsharp + opencvsharp.png + Slim native bindings package for OpenCvSharp on Linux x64 (portable RID). Enabled modules: core,imgproc,imgcodecs,calib3d,features2d,flann,objdetect,photo. Disabled modules: contrib,dnn,ml,video,videoio,highgui,stitching,barcode. + Image Processing OpenCV Wrapper FFI opencvsharp linux slim + Copyright 2008-2026 + + https://github.com/shimat/opencvsharp.git + git + false + + + + + + + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj index 86dd78d26..8f9a22a84 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -21,7 +21,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj index ebafae3aa..afca64f78 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -20,7 +20,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj index 4e99d88ba..31b849ee8 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -21,7 +21,7 @@ - + diff --git a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj index a51f46230..dffa3a171 100644 --- a/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj +++ b/nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;net8.0; + netstandard2.0;netstandard2.1;net8.0 true false @@ -20,7 +20,7 @@ - + diff --git a/nuget/OpenCvSharp4.runtime.linux-arm.csproj b/nuget/OpenCvSharp4.runtime.linux-arm.csproj index 5a2f64921..4aa93ae8e 100644 --- a/nuget/OpenCvSharp4.runtime.linux-arm.csproj +++ b/nuget/OpenCvSharp4.runtime.linux-arm.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netstandard2.1;netcoreapp3.1; + netstandard2.0;netstandard2.1;netcoreapp3.1 true false @@ -21,7 +21,7 @@ - +