takuya-takeuchi / FaceRecognitionDotNet

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

Write FaceEncodings element in MS SQL #58

Closed NickPlehanov closed 4 years ago

NickPlehanov commented 5 years ago

Summary of your issue

Environment

Write your environment.

What did you do when you faced the problem?

Hi. I need to write in database(MS SQL) element, for next to use get picture an webcam

Example code:

FaceRecognitionDotNet.Image image1 = FaceRecognition.LoadImageFile(@"C:\test\test.bmp");
            try {
                encoding1 = fr.FaceEncodings(image1, null, 1).First();
            }
            catch { encoding1 = null; }
            diff =  FaceRecognition.FaceDistance(encoding1,Clients_Image.lst_clnt_img[i].faceEncoding);

Output:

paste your output

What did you intend to be?

takuya-takeuchi commented 5 years ago

you can serialize FaceEncoding object and save it to where you want to.

pierresa commented 4 years ago

Sorry, but how do I serialize FaceEncoding, if I try I get the following error InvalidOperationException: FaceRecognitionDotNet.FaceEncoding cannot be serialized because it does not have a parameterless constructor.

takuya-takeuchi commented 4 years ago

@pierresa No. FaceEncoding has Serializable attribution. You can refer this test code.

https://github.com/takuya-takeuchi/FaceRecognitionDotNet/blob/523039304ba29f2c2dde111c9ec94aae1e47edae/test/FaceRecognitionDotNet.Tests/FaceRecognitionTest.cs#L390

takuya-takeuchi commented 4 years ago

No Response