Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MatRoi.cs « EmguCV « UVtools.Core - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6bd5b3f68fc580a76f619b7b70fc81f186546e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 *                     GNU AFFERO GENERAL PUBLIC LICENSE
 *                       Version 3, 19 November 2007
 *  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 *  Everyone is permitted to copy and distribute verbatim copies
 *  of this license document, but changing it is not allowed.
 */


using System;
using System.Drawing;
using Emgu.CV;
using UVtools.Core.Extensions;

namespace UVtools.Core.EmguCV;

/// <summary>
/// A disposable Mat with associated ROI Mat
/// </summary>
public class MatRoi : IDisposable
{
    #region Properties
    public Mat SourceMat { get; }
    public Rectangle Roi { get; }
    public Mat RoiMat { get; }

    public Point RoiLocation => Roi.Location;
    public Size RoiSize => Roi.Size;

    #endregion

    #region Constructor

    public MatRoi(Mat sourceMat, Rectangle roi)
    {
        SourceMat = sourceMat;
        Roi = roi;
        RoiMat = sourceMat.Roi(roi);
    }

    #endregion


    public void Dispose()
    {
        SourceMat.Dispose();
        RoiMat.Dispose();
    }
}