> For the complete documentation index, see [llms.txt](https://dotnet-grabcut.luxoriasoft.bluepelicansoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dotnet-grabcut.luxoriasoft.bluepelicansoft.com/readme.md).

# GrabCut Implementation in .NET

## OpenCV GrabCut Algorithm

This package provides a .NET wrapper for the GrabCut algorithm, implemeted in native C++ with OpenCV.

[Online Documentation](https://dotnet-grabcut.luxoriasoft.bluepelicansoft.com/)

[Check it out on Nuget.org](https://www.nuget.org/packages/Luxoria.Algorithm.GrabCut)

## Requirements

* **.NET Version**: `net8.0` or compatible.
* **Native Dependencies**: OpenCV 4.10.0 libraries are embedded within the native implementation.

## Source Code

The precompiled native libraries are built from the source code available at [LuxoriaSoft/grabcut\_oc4100\_dllcore](https://github.com/LuxoriaSoft/grabcut_oc4100_dllcore)

[![codecov](https://codecov.io/gh/LuxoriaSoft/grabcut_oc4100_dllcore/branch/main/graph/badge.svg)](https://codecov.io/gh/LuxoriaSoft/grabcut_oc4100_dllcore)

## Installation

You can install the package via NuGet Package Manager or the `.NET CLI`:

### Using NuGet Package Manager

Search for `Luxoria.Algorithm.GrabCut` in the NuGet Package Manager and install it.

### Using .NET CLI

Run the following command:

```bash
dotnet add package Luxoria.Algorithm.GrabCut --version 1.0.1
```

### Usage

```csharp
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

    }
}
```

### License

Luxoria.Algorithm.BrisqueScore is licensed under the Apache 2.0 License. See [LICENSE](https://github.com/LuxoriaSoft/grabcut_oc4100_dllcore/blob/main/LICENSE/README.md) for more information.

LuxoriaSoft
