Development of Visitor-to-Visitor System Based on Face Recognition Technology

Recently, a community has used Hongsoft face recognition, the effect is good. There is another project to compare visitors with their ID cards and share the project, hoping to help them in need.

The address of the project should be added before the codeword. https://gitee.com/panmingzhi/IdCardFaceIdentifier

First of all, we use Huashi CVR 100U. The company has been using this model for 6 years. The data of the previous card are recorded with it, except for the ugly, quality bars. Most people's ID cards were handled many years ago, and the similarity of all the comparisons is not too high.

Video capture or Aforge, using NewFrame, on the one hand, to display real-time images, on the other hand, to asynchronously compare with the documents currently read. Please do not attempt to display the pictureBox directly in the NewFrame callback event. Please use the following method. It's not a good idea.

private void VideoCaptureDevice_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
        {
            Bitmap newFrame = (Bitmap)eventArgs.Frame.Clone();
            //If you use a video file, please comment on the following line of code to indicate that the image is not flipped horizontally.
            newFrame.RotateFlip(RotateFlipType.Rotate180FlipY);
            lock (sync)
            {
                if (currentFrame != null)
                {
                    currentFrame.Dispose();
                    currentFrame = null;
                }
                currentFrame = newFrame;
                skinPictureBox2.Invalidate();
            }
        }
  /**
         * Drawing the current frame to control must mutually exclusive with acquiring the current frame
         */
        private void skinPictureBox2_Paint(object sender, PaintEventArgs e)
        {
            lock (synCurrentMat)
            {
                Bitmap bitmap = GetCurrentFrame();
                if (bitmap != null)
                {
                    e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, skinPictureBox2.Width, skinPictureBox2.Height), new Rectangle(0, 0, bitmap.Width, bitmap.Height), GraphicsUnit.Pixel);
                }
            }
        }
//Using this method to obtain real-time screenshots for asynchronous evidence comparison
        public Bitmap GetCurrentFrame()
        {
            if (captureToken.Token.IsCancellationRequested) return null;
            lock (sync)
            {
                return (currentFrame == null || currentFrame.Width == 0 || currentFrame.Height == 0) ? null : AForge.Imaging.Image.Clone(currentFrame);
            }
        }

The reading frequency of the second generation ID card is once every 1 second. After reading the ID card, it will be the time of identification comparison within 10 seconds, which will not be read for 10 seconds. The comparison is successful within 10 seconds and the successful prompt is displayed for 2-3 seconds, then the reading is resumed. When reading the certificate, if the certificate is correctly read, it is necessary to reopen and place the certificate. This product description of Huashi and SDK both indicate that other manufacturers, such as Dingxin, are the same. wz.txt and wz.bmp are stored in SDK directory by default. When comparing with wz.bmp, memory errors are often reported. After that, I convert BMP to jpg to save it once and then compare the identity cards. It seems that there is no problem.

Document comparison time is still a continuation of the previous way, first parse the document picture into FaceModel, and then compare the current video screenshots with some FaceModel successively, and update the FaceModel every time you read the document.

     /**
         * Drawing the current frame to control must mutually exclusive with acquiring the current frame
         */
        private void skinPictureBox2_Paint(object sender, PaintEventArgs e)
        {
            lock (synCurrentMat)
            {
                Bitmap bitmap = GetCurrentFrame();
                if (bitmap != null)
                {
                    e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, skinPictureBox2.Width, skinPictureBox2.Height), new Rectangle(0, 0, bitmap.Width, bitmap.Height), GraphicsUnit.Pixel);
                }
            }
        }
//Using this method to obtain real-time screenshots for asynchronous evidence comparison
        public Bitmap GetCurrentFrame()
        {
            if (captureToken.Token.IsCancellationRequested) return null;
            lock (sync)
            {
                return (currentFrame == null || currentFrame.Width == 0 || currentFrame.Height == 0) ? null : AForge.Imaging.Image.Clone(currentFrame);
            }
        }

At this time screenshots: (I do not like, ghost painting peach walnut will be on for a while)

1. Prompt Letter of Credit 2. Immediately after reading the certificate 3. Return to the first step after comparing the display results If you have any questions, please communicate more. Original publishment http://ai.arcsoft.com.cn/bbs/forum.php?mod=viewthread&tid=939&_dsign=fb054263

Keywords: SDK PHP

Added by RJDavison on Thu, 16 May 2019 11:06:15 +0300