If you want to register the image directly as a device, please enter the code below.


If the image refers to the "jpg" type and if the image's status is blurry, there may be a problem with authentication. In that case, please register directly on the device.


  

If you can't register, you should probably change the status of the picture. Please refer to the below.

https://support.supremainc.com/a/solutions/articles/24000072538?lang=en 


Console.WriteLine("Do you want to register from image? [y/n]");

                    Console.Write(">> ");

                    if (Util.IsYes())

                    {

                        Console.WriteLine("Enter the face image path and name:");

                        Console.Write(">> ");

                        string imagePath = Console.ReadLine();



                        if (!File.Exists(imagePath))

                        {

                            Console.WriteLine("Invalid file path");

                            return;

                        }



                        Image faceImage = Image.FromFile(imagePath);

                        if (!faceImage.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))

                        {

                            Console.WriteLine("Invalid image file format");

                            return;

                        }

                        

                        IntPtr imageData = IntPtr.Zero;

                        UInt32 imageLen = 0;

                        if (Util.LoadBinary(imagePath, out imageData, out imageLen))

                        {

                            if (0 == imageLen)

                            {

                                Console.WriteLine("Empty image file");

                                return;

                            }



                            int structHeaderSize = Marshal.SizeOf(typeof(BS2FaceExUnwarped));

                            int totalSize = structHeaderSize + (int)imageLen;

                            userBlob[0].faceExObjs = Marshal.AllocHGlobal(totalSize);

                            IntPtr curFaceExObjs = userBlob[0].faceExObjs;



                            BS2FaceExUnwarped unwarped = Util.AllocateStructure<BS2FaceExUnwarped>();

                            unwarped.flag = 0;

                            unwarped.imageLen = imageLen;



                            Marshal.StructureToPtr(unwarped, curFaceExObjs, false);

                            curFaceExObjs += structHeaderSize;



                            CopyMemory(curFaceExObjs, imageData, imageLen);



                            userBlob[0].user.numFaces = 1;

                            unwarpedMemory = true;

                        }

                    }