# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dotnet-grabcut.luxoriasoft.bluepelicansoft.com/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
