takuya-takeuchi / FaceRecognitionDotNet

The world's simplest facial recognition api for .NET on Windows, MacOS and Linux
MIT License
1.27k stars 308 forks source link

Capture Face #149

Closed CodrTks closed 3 years ago

CodrTks commented 3 years ago

Hello. Can I get the detected face image as a bitmap?

byte[] bytesFaces1 = ConvertImageToBinary(bitm);
            var mat1 = Cv2.ImDecode(bytesFaces1, OpenCvSharp.ImreadModes.Color);
            var bytes1 = new byte[mat1.Rows * mat1.Cols * mat1.ElemSize()];
            Marshal.Copy(mat1.Data, bytes1, 0, bytes1.Length);
            var unknownImage = FaceRecognition.LoadImage(bytes1, mat1.Rows, mat1.Cols, mat1.ElemSize() * mat1.Cols, Mode.Rgb);
            var faceLocations = _FaceRecognition.FaceLocations(unknownImage, 0, model).ToArray();
            using (var g = Graphics.FromImage(bitm))
            {
                foreach (var l in faceLocations)
                    g.DrawRectangle(Pens.Yellow, l.Left, l.Top, l.Right - l.Left, l.Bottom - l.Top);
            }
            this.pictureBox1.Image = bitm;
takuya-takeuchi commented 3 years ago

@CodrTks no function. however, it is interested.

takuya-takeuchi commented 3 years ago

@CodrTks you can get location of face and crop it from source image.

CodrTks commented 3 years ago

@takuya-takeuchi Thank you I would be glad if you update on this subject

takuya-takeuchi commented 3 years ago

Implement Image.ToBitmap

takuya-takeuchi commented 3 years ago

We have to fix https://github.com/takuya-takeuchi/DlibDotNet/issues/245 at first

CodrTks commented 3 years ago

Does the latest update support mkl?

takuya-takeuchi commented 3 years ago

support 2020.0

CodrTks commented 3 years ago

you are great thanks