public DroidCvPattern(Stream Stream, bool MakeMask)
        {
            var buffer = new byte[Stream.Length];

            using var ms = new MemoryStream(buffer);
            Stream.CopyTo(ms);

            using var raw = new DisposableMat(new MatOfByte(buffer));

            if (MakeMask)
            {
                using var rgbaMat = new DisposableMat(Imgcodecs.Imdecode(raw.Mat, Imgcodecs.CvLoadImageUnchanged));

                Mat = new Mat();
                Imgproc.CvtColor(rgbaMat.Mat, Mat, Imgproc.ColorRgba2gray);

                Mask = new Mat();
                // Extract alpha channel
                Core.ExtractChannel(rgbaMat.Mat, Mask, 3);
                // Mask containing 0 or 255
                Imgproc.Threshold(Mask, Mask, 0, 255, Imgproc.ThreshBinary);
            }
            else
            {
                Mat = Imgcodecs.Imdecode(raw.Mat, Imgcodecs.CvLoadImageGrayscale);
            }
        }
        public DroidCvPattern(Stream Stream)
        {
            var buffer = new byte[Stream.Length];

            using var ms = new MemoryStream(buffer);
            Stream.CopyTo(ms);

            using var raw = new DisposableMat(new MatOfByte(buffer));

            Mat = Imgcodecs.Imdecode(raw.Mat, Imgcodecs.CvLoadImageGrayscale);
        }