Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ubuntu-slim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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`

Expand Down Expand Up @@ -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 |
Comment on lines +170 to +171
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

NuGet links will 404 until the first publish

The package links in the table point to packages that won't exist on nuget.org until this PR is merged and a publish workflow runs. Consider using placeholder text or a note until the packages are live, or ensure the publish workflow is part of this PR / triggered immediately after merge.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 170 - 171, Update the README.md table entries for
OpenCvSharp4.official.runtime.linux-x64 and
OpenCvSharp4.official.runtime.linux-x64.slim so the links won't 404 before first
publish: either replace the nuget.org anchors with placeholder text (e.g.,
"nuget link (pending publish)"), remove the hyperlink and keep package names as
plain text, or add a parenthetical note like "(NuGet package will 404 until
first publish)" next to the package names; ensure the change is applied to the
two symbols OpenCvSharp4.official.runtime.linux-x64 and
OpenCvSharp4.official.runtime.linux-x64.slim in README.md.

|**[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 |
Expand Down Expand Up @@ -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.
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions nuget/OpenCvSharp4.official.runtime.linux-x64.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

<!-- NuGet Package Metadata -->
<PackageId>OpenCvSharp4.official.runtime.linux-x64</PackageId>
<Title>OpenCvSharp native bindings for Linux x64</Title>
<Authors>shimat</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/shimat/opencvsharp</PackageProjectUrl>
<PackageIcon>opencvsharp.png</PackageIcon>
<Description>Internal implementation package for OpenCvSharp to work on Linux x64 (portable RID)</Description>
<PackageTags>Image Processing OpenCV Wrapper FFI opencvsharp linux</PackageTags>
<Copyright>Copyright 2008-2026</Copyright>
<PackageReleaseNotes></PackageReleaseNotes>
<RepositoryUrl>https://github.com/shimat/opencvsharp.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/linux-x64/native/" />
<None Include="icon/opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
26 changes: 26 additions & 0 deletions nuget/OpenCvSharp4.official.runtime.linux-x64.slim.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

<PackageId>OpenCvSharp4.official.runtime.linux-x64.slim</PackageId>
<Title>OpenCvSharp native bindings for Linux x64 (Slim)</Title>
<Authors>shimat</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/shimat/opencvsharp</PackageProjectUrl>
<PackageIcon>opencvsharp.png</PackageIcon>
<Description>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.</Description>
<PackageTags>Image Processing OpenCV Wrapper FFI opencvsharp linux slim</PackageTags>
<Copyright>Copyright 2008-2026</Copyright>
<PackageReleaseNotes></PackageReleaseNotes>
<RepositoryUrl>https://github.com/shimat/opencvsharp.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/linux-x64/native/" />
<None Include="icon/opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

Expand All @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native" />
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native/" />
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

Expand All @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native" />
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.22.04-x64/native/" />
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

Expand All @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native" />
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native/" />
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

Expand All @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native" />
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/ubuntu.24.04-x64/native/" />
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions nuget/OpenCvSharp4.runtime.linux-arm.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>

Expand All @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/linux-arm/native" />
<None Include="libOpenCvSharpExtern.so" Pack="true" PackagePath="runtimes/linux-arm/native/" />
<None Include="icon\opencvsharp.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
Loading