This package provides a .NET wrapper for the GrabCut algorithm, implemeted in native C++ with OpenCV.
- .NET Version:
net8.0
or compatible. - Native Dependencies: OpenCV 4.10.0 libraries are embedded within the native implementation.
The precompiled native libraries are built from the source code available at LuxoriaSoft/grabcut_oc4100_dllcore
You can install the package via NuGet Package Manager or the .NET CLI
:
Search for Luxoria.Algorithm.GrabCut
in the NuGet Package Manager and install it.
Run the following command:
dotnet add package Luxoria.Algorithm.GrabCut --version 1.0.1
using Luxoria.Algorithm.GrabCut;
class Program
{
static void Main()
{
GrabCut grabCut = new GrabCut();
grabCut.Exec("image.jpg", "output.jpg", 678, 499, 1653, 1493, 5);
// Where :
// "image.jpg" is the input image path,
// "output.jpg" is the output image path,
// 678, 499, 1653, 1493 are the rectangle coordinates (x, y, width, height),
// 5 is the margin from (0 to 100) (default set to 0)
// Custom foreground & background masks
GrabCut grabCut = new GrabCut();
grabCut.Exec("image.jpg", "output.jpg", 678, 499, 1653, 1493, 5, false, Color.White, Color.Black);
// Where :
// "image.jpg" is the input image path,
// "output.jpg" is the output image path,
// 678, 499, 1653, 1493 are the rectangle coordinates (x, y, width, height),
// 5 is the margin from (0 to 100) (default set to 0),
// false is being used to indicate that custom colors are provided,
// Color.White is the foreground color,
// Color.Black is the background color
}
}
Luxoria.Algorithm.BrisqueScore is licensed under the Apache 2.0 License. See LICENSE for more information.
LuxoriaSoft