A method for converting a human face 32-bit depth map to 8-bit for liveness detection

By expanding the face detection bounding box and calculating the mean boundary value of the 32-bit depth map, the 32-bit depth map is converted into an 8-bit depth map, which solves the problems of information loss and image distortion, and improves the accuracy and efficiency of face liveness detection.

CN116994302BActive Publication Date: 2026-08-04INGENIC SEMICON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INGENIC SEMICON CO LTD
Filing Date
2022-04-26
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing technologies suffer from information loss and image distortion when converting high-bit image data to low-bit image data, especially in face liveness recognition systems, where the processing speed is slow and the operation is cumbersome.

Method used

Face detection is performed on 8-bit near-infrared images, the face detection bounding box is expanded, and the facial information from 32-bit depth images is used to calculate the mean boundary value. The 32-bit depth images are then converted into 8-bit depth images, and the face bounding boxes are cropped to retain important pixel information and reduce the influence of other pixels.

Benefits of technology

It achieves the preservation of important pixel information in face liveness detection, reduces image distortion, and improves processing speed and algorithm efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116994302B_ABST
    Figure CN116994302B_ABST
Patent Text Reader

Abstract

The application provides a method for converting a 32-bit face depth map into an 8-bit depth map for live body detection, and the method comprises the following steps: S1, collecting a TOF near-infrared image and a depth map; and processing the 8-bit near-infrared image through S2 and the 32-bit depth map through S4; S2, performing face detection on the near-infrared image; S3, expanding the face detection frame; S4, converting the 32-bit depth map into an 8-bit depth map; and S5, performing face frame cropping. According to the method, the pixel information of the face in the 32-bit depth map can be obtained through face detection on the original 8-bit near-infrared image and the position of the face frame, the pixels of the face are reserved by operating the pixels, the 8-bit depth map of the face is finally converted, the important pixel information is not lost in the depth map, and the color depth difference is maximized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for converting a 32-bit depth map of a face into an 8-bit image for liveness detection. Background Technology

[0002] With the development of technology, in current facial liveness recognition systems, most depth maps acquired by Time of Flight (TOF) sensors are stored in 32-bit data. This is because 32 bits can store 2^32 colors, resulting in better color transitions, more delicate images, and richer color information. However, 32-bit images require more information to process, making the processing speed slower. Therefore, converting them to low-bit data is more convenient for use.

[0003] There are many methods to convert high-bit image data to low-bit image data. For example, OpenCV uses bitmap principles to perform a linear transformation on the data at the original depth, so that the minimum and maximum values ​​at the original depth correspond to the minimum and maximum values ​​at the converted bit depth, thus achieving color depth conversion. Some image processing software, such as Photoshop, can also achieve this operation by modifying the number of channels.

[0004] However, current methods for converting high-resolution image data to low-resolution image data are all conversions from high precision to low precision, which inevitably leads to information loss. This is unavoidable and results in image distortion. Furthermore, using image processing software to handle batch data becomes cumbersome and complicated.

[0005] In addition, the following are commonly used terms in the prior art:

[0006] Time-of-Flight (TOF): This method involves emitting modulated infrared light pulses from an infrared emitter, which continuously strike the surface of an object. The pulses are reflected and received by a receiver. The time difference is calculated by analyzing the phase changes, and then combined with the speed of light, the depth information of the object is determined.

[0007] Depth map: also called distance image, refers to an image that uses the distance (depth) from the image acquisition device to each point in the scene as pixel values.

[0008] Face detection refers to using a certain strategy to search for any given image to determine whether it contains a human face, and if so, returning the position, size, and pose of the face.

[0009] 8-bit and 32-bit depth maps: 8-bit and 32-bit refer to color depth, which measures how much color information in an image is available for display or printing pixels. Its unit is "bit," so color depth is sometimes also called bit depth. An 8-bit depth map supports a maximum of 2^8 colors, while a 32-bit depth map supports 2^32 colors. It adds 8 bits of transparency information to the 24-bit map, supporting different levels of translucency. A larger color depth (more bits of information per pixel) means that the digital image has more usable colors and a more accurate color representation. Summary of the Invention

[0010] To address the problems in the prior art, the purpose of this application is to: perform face detection on the original 8-bit near-infrared image, obtain the pixel information of the face in the 32-bit depth image by the location of the face bounding box, retain the pixels of the face by manipulating these pixels, and finally convert them into an 8-bit depth image of the face. This depth image will not lose important pixel information and will maximize the color depth difference.

[0011] Specifically, the present invention provides a method for converting a 32-bit depth map of a face into an 8-bit image for liveness detection, the method comprising the following steps:

[0012] S1. Acquire TOF near-infrared and depth maps:

[0013] When using a Time-of-Flight (TOF) device to collect facial data, the device simultaneously acquires an 8-bit near-infrared image and a 32-bit depth image; subsequently, step S2 processes the 8-bit near-infrared image and step S4 processes the 32-bit depth image respectively.

[0014] S2. Perform face detection on the near-infrared image:

[0015] The acquired 8-bit near-infrared images are used to perform face detection using a face detection model to determine the position of the face bounding box. This operation will filter out non-faces and incomplete face images.

[0016] S3. Expand the face detection bounding box:

[0017] The face detection box is obtained by face detection. The face detection box is expanded vertically and horizontally so that the entire face is in the center of the cropping box, so that the cropped face information is more complete.

[0018] S4. Convert the 32-bit depth map to an 8-bit depth map:

[0019] The acquired 32-bit depth map is read and processed. The 32-bit binary depth map file is converted into an unsigned integer for calculation. First, a maximum and minimum boundary value is set for all pixels in the 32-bit depth map. Based on the pixels at the location of the expanded face box obtained in step S3, the mean value of the depth map region corresponding to the expanded face box is calculated. Since the facial depth information is the most obvious, the mean value is used as the core. The boundary value corresponding to the location of the expanded face box is found through testing. The pixels corresponding to the expanded face box are mapped to this interval. Finally, these pixel values ​​are converted to an 8-bit data range.

[0020] S5. Perform face frame cropping:

[0021] Face bounding boxes are cropped after expanding the 8-bit depth map.

[0022] In step S1, when acquiring TOF near-infrared and depth maps, the distance between the device and the face is between 30 and 80 centimeters. If the distance exceeds this range, the depth information will be affected.

[0023] In step S2, the face detection model only takes the detected qualified face boxes. The face detection score threshold is 0.25. A score greater than 0.25 is considered a qualified complete face, and a score less than 0.25 is considered an unqualified face. Unqualified faces are non-faces or incomplete faces, and unqualified faces will be filtered out.

[0024] In step S3, the detection frame expansion further includes:

[0025] S3.1, Face detection bounding box: set height H, width W;

[0026] The top-left corner of the face detection bounding box is (x1, y1).

[0027] The coordinates of the bottom right corner of the face detection bounding box are (x2, y2).

[0028] W = x2-x1

[0029] H = y2-y1;

[0030] S3.2 Calculate the center coordinates (center_x, center_y) of the detection box.

[0031] The center coordinates of the detection frame are:

[0032] center_x = (x1+x2) / 2

[0033] center_y = (y1+y2) / 2

[0034] S3.3, Calculate the cutting length radius,Max(H,W) / 2

[0035] radius = max(H,W) / 2

[0036] S3.4, Expand the clipping frame:

[0037] Top left point x:center_x-radius

[0038] Lower left point y:center_y-radius

[0039] bottom right point x: center_x+radius

[0040] The bottom right point is y: center_y+radius;

[0041] S3.5, Clipping Depth Map.

[0042] In step S4, the 32-bit to 8-bit depth map conversion further includes:

[0043] S4.1, obtains a 32-bit depth map using a TOF camera;

[0044] S4.2 sets the maximum and minimum boundary values ​​of pixels in the 32-bit depth map through testing:

[0045]

[0046] ;

[0047] This step is to keep all pixels in the 32-bit depth map within a uniform range, avoiding the influence of overly bright or dark pixels;

[0048] S4.3, controls each pixel within the boundary range;

[0049] Iterate through each pixel value in the 32-bit depth map. If the pixel value is less than Min_v, modify the pixel to Min_v. If the pixel value is greater than Max_v, modify the pixel to Max_v. If the pixel value is within the boundary range, the pixel value remains unchanged.

[0050] Let the original depth map be src, and i be the index of each pixel.

[0051] src[i] = src[i] >Max_v? Max_v:src[i]

[0052] src[i] = src[i] <Min_v?Min_v:src[i];

[0053] S4.4, Calculate the average depth within the detection box;

[0054] Iterate through each pixel in the region corresponding to the detection box in the 32-bit depth map, sum all pixel values, and divide by the corresponding number of pixels to obtain the average depth value in the region of the detection box.

[0055] Let the original depth map be src, and let i be the index of each pixel in the detection box.

[0056] Sum of pixel values: sum += src[i]

[0057] Calculate the mean ;

[0058] S4.5, Test to find the boundary value of the mean:

[0059]

[0060] ;

[0061] This step is to keep all pixels in the region corresponding to the face detection box in the 32-bit depth map within a uniform range. Through multiple tests, the depth effect produced by using this boundary value is more obvious.

[0062] S4.6, controls each pixel within the mean boundary range;

[0063] Iterate through each pixel value in the 32-bit depth map. If the pixel value is less than Min_1, modify the pixel to Min_1. If the pixel value is greater than Max_1, modify the pixel to Max_1. If the pixel value is within the boundary range, the pixel value remains unchanged.

[0064] Let the original depth map be src, and i be the index of each pixel.

[0065] src[i] = src[i] >Max_1? Max_1:src[i]

[0066] src[i] = src[i] <Min_1?Min_1:src[i];

[0067] S4.7 converts each pixel to an 8-bit range, pixel value / 2^15;

[0068] Let the original depth map be src, the 8-bit depth map be dst, and i be the index of each pixel in the detection box.

[0069] src[i] = src[i] - Min_1

[0070] src[i] = src[i] / 2^15

[0071] dst[i] = (uint8_t)(src[i]);

[0072] S4.8 yields an 8-bit depth map.

[0073] In step S5, the 8-bit depth map is calculated based on the facial information. To prevent the influence of other pixels, the depth map is cropped according to the expanded face frame to obtain a clearer depth map of the face.

[0074] The method further includes step S6: liveness detection, which involves applying the obtained cropped image to the liveness detection model to perform liveness detection.

[0075] Therefore, the advantage of this application is:

[0076] 1. Expand the face detection bounding box around the face to make the facial depth information more obvious.

[0077] 2. Using the face detection bounding box as the core, the pixels of the entire image are controlled within the average range of the detection bounding box, which largely preserves the important pixel information of the face and maximizes the pixel differences within this range.

[0078] 3. The converted 8-bit depth map is cropped with a face bounding box. This reduces the influence of other irrelevant pixels, which plays an important role in the liveness detection model. At the same time, it also reduces the image resolution and improves the efficiency of the algorithm. Attached Figure Description

[0079] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.

[0080] Figure 1 This is a flowchart of the method of the present invention.

[0081] Figure 2 (1) is a near-infrared image of the near-infrared and color point cloud results collected in the embodiment of the present invention.

[0082] Figure 2 (2) is a color point cloud diagram of the near-infrared and color point cloud results collected in the embodiment of the present invention.

[0083] Figure 3 This is a schematic diagram of the detection frame expansion process in the method of the present invention.

[0084] Figure 4 This is an 8-bit depth map effect diagram in an embodiment of the method of the present invention.

[0085] Figure 5 This is a schematic diagram of the conversion process from a 32-bit depth map to an 8-bit depth map in an embodiment of the method of the present invention. Detailed Implementation

[0086] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.

[0087] The present invention relates to a method for converting a 32-bit depth map of a face into an 8-bit image for liveness detection, such as... Figure 1 The diagram shows the flowchart of this method. The specific implementation steps of this method are described below:

[0088] S1. Acquire TOF near-infrared and depth maps:

[0089] When using a TOF device to collect facial data, the device will simultaneously collect an 8-bit near-infrared image and a 32-bit depth image; and then process the 8-bit near-infrared image in step S2 and the 32-bit depth image in step S4 respectively.

[0090] When collecting TOF near-infrared and depth maps, the distance between the device and the face is between 30 and 80 centimeters. This distance will determine the quality of the final facial depth. If the distance exceeds the range, the depth information will be affected, as shown in Figures 2(1) and (2).

[0091] S2. Perform face detection on the near-infrared image:

[0092] The acquired 8-bit near-infrared images are used to perform face detection using a face detection model to determine the location of face bounding boxes. This operation filters out non-faces and incomplete face images. The face detection model only takes the detected qualified face bounding boxes. The face detection score threshold is 0.25. A score greater than 0.25 is considered a qualified complete face, while a score less than 0.25 is considered an unqualified face. Unqualified faces are either non-faces or incomplete faces, and unqualified faces will be filtered out.

[0093] Face detection is performed only on the 8-bit near-infrared image, rather than directly on the 32-bit depth image. This is because using the 8-bit near-infrared image is simpler and more efficient.

[0094] S3. Expand the face detection bounding box:

[0095] A face detection bounding box is obtained through face detection. This bounding box is then expanded vertically and horizontally to center the entire face within the cropping box. This ensures more complete facial information is captured. The face bounding box expansion is shown in the attached figure. Figure 3 As shown, expanding the face detection bounding box is to more fully display the facial depth information, because the detection box size varies depending on the location of the face, thus adding spatial information to the smaller face detection box; for example... Figure 3 As shown, the detection frame is expanded:

[0096] S3.1, Face detection bounding box: set height H, width W;

[0097] The top-left corner of the face detection bounding box is (x1, y1).

[0098] The coordinates of the bottom right corner of the face detection bounding box are (x2, y2).

[0099] W = x2-x1

[0100] H = y2-y1

[0101] S3.2 Calculate the center coordinates (center_x, center_y) of the detection box.

[0102] The center coordinates of the detection frame are:

[0103] center_x = (x1+x2) / 2

[0104] center_y = (y1+y2) / 2

[0105] S3.3, calculate the cutting length radius,Max(H,W) / 2.

[0106] radius = max(H,W) / 2;

[0107] S3.4, Expand the clipping frame:

[0108] Top left point x:center_x-radius

[0109] Lower left point y:center_y-radius

[0110] bottom right point x: center_x+radius

[0111] The bottom right point is y: center_y+radius;

[0112] S3.5, Clipping Depth Map.

[0113] S4. Convert the 32-bit depth map to an 8-bit depth map:

[0114] First, irrelevant pixels are filtered out. Using the face detection bounding box as the core, the region containing the pixel is calculated based on the mean value, highlighting the depth information of the face and making the intermediate information more accurate. The effect is as follows: Figure 4 As shown;

[0115] The acquired 32-bit depth map is read and processed. The 32-bit binary depth map file is converted into an unsigned integer for calculation. First, a maximum and minimum boundary value is set for all pixels in the 32-bit depth map. Based on the pixels at the location of the face box obtained in step S3, the mean value of the depth map region corresponding to the face box is calculated. Since the facial depth information is the most obvious, the mean value is used as the core. The boundary value corresponding to the face box is found through testing, and the pixels corresponding to the face box are mapped to this interval. Finally, these pixel values ​​are converted to an 8-bit data range.

[0116] Here, the face bounding box obtained in step S3 from the near-infrared image is applied to the corresponding position in the 32-bit depth map. The 32-bit to 8-bit depth map conversion process is as follows: Figure 5 As shown:

[0117] S4.1, obtains a 32-bit depth map using a TOF camera;

[0118] S4.2 sets the maximum and minimum boundary values ​​of pixels in the 32-bit depth map through testing:

[0119]

[0120] ;

[0121] This step is to keep all pixels in the 32-bit depth map within a uniform range, avoiding the influence of overly bright or dark pixels;

[0122] S4.3, controls each pixel within the boundary range;

[0123] Iterate through each pixel value in the 32-bit depth map. If the pixel value is less than Min_v, modify the pixel to Min_v. If the pixel value is greater than Max_v, modify the pixel to Max_v. If the pixel value is within the boundary range, the pixel value remains unchanged.

[0124] Let the original depth map be src, and i be the index of each pixel.

[0125] src[i] = src[i] >Max_v? Max_v:src[i]

[0126] src[i] = src[i] <Min_v?Min_v:src[i];

[0127] S4.4, Calculate the average depth within the detection box;

[0128] Iterate through each pixel in the region corresponding to the detection box in the 32-bit depth map, sum all pixel values, and divide by the corresponding number of pixels to obtain the average depth of the detection box region. The calculated average value is generally around 800, which translates to 80cm in actual distance.

[0129] Let the original depth map be src, and i be the index of each pixel in the detection box.

[0130] Sum of pixel values: sum += src[i]

[0131] Calculate the mean ;

[0132] S4.5, Test to find the boundary value of the mean:

[0133]

[0134] ;

[0135] This step is to keep all pixels in the region corresponding to the face detection box in the 32-bit depth map within a uniform range. Through multiple tests, the depth effect produced by using this boundary value is more obvious.

[0136] S4.6, controls each pixel within the mean boundary range;

[0137] Iterate through each pixel value in the 32-bit depth map. If the pixel value is less than Min_1, modify the pixel to Min_1. If the pixel value is greater than Max_1, modify the pixel to Max_1. If the pixel value is within the boundary range, the pixel value remains unchanged.

[0138] Let the original depth map be src, and i be the index of each pixel.

[0139] src[i] = src[i] >Max_1? Max_1:src[i]

[0140] src[i] = src[i] <Min_1?Min_1:src[i];

[0141] S4.7 converts each pixel to an 8-bit range, pixel value / 2^15;

[0142] Let the original depth map be src, the 8-bit depth map be dst, and i be the index of each pixel in the detection box.

[0143] src[i] = src[i] - Min_1

[0144] src[i] = src[i] / 2^15

[0145] dst[i] = (uint8_t)(src[i]);

[0146] S4.8 yields an 8-bit depth map.

[0147] S5. Perform face frame cropping:

[0148] Cropping the 8-bit depth map to the face bounding box improves the accuracy of liveness detection and increases the efficiency of the algorithm. The 8-bit depth map is calculated based on facial information, resulting in more accurate facial pixels. To prevent the influence of other pixels, the depth map is cropped according to the expanded face bounding box, resulting in a clearer and more detailed depth map of the face. This cropped image is then applied to the liveness detection model for liveness detection.

[0149] The method may further include step S6: liveness detection, which involves applying the obtained cropping image to the liveness detection model to perform liveness detection.

[0150] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for converting a 32-bit facial depth map into an 8-bit image for liveness detection, characterized in that, The method includes the following steps: S1. Acquire TOF near-infrared and depth maps: When using a Time-of-Flight (TOF) device to collect facial data, the device simultaneously acquires an 8-bit near-infrared image and a 32-bit depth image; subsequently, step S2 processes the 8-bit near-infrared image and step S4 processes the 32-bit depth image respectively. S2. Perform face detection on the near-infrared image: The acquired 8-bit near-infrared images are used to perform face detection using a face detection model to determine the position of the face bounding box. This operation will filter out non-faces and incomplete face images. S3. Expand the face detection bounding box: The face detection box is obtained by face detection. The face detection box is expanded vertically and horizontally so that the entire face is in the center of the cropping box, so that the cropped face information is more complete. S4. Convert the 32-bit depth map to an 8-bit depth map: The acquired 32-bit depth map is read and processed. The 32-bit binary depth map file is converted into an unsigned integer for calculation. First, a maximum and minimum boundary value is set for all pixels in the 32-bit depth map. Based on the pixels at the location of the expanded face box obtained in step S3, the mean value of the depth map region corresponding to the expanded face box is calculated. Since the facial depth information is the most obvious, the mean value is used as the core. The boundary value corresponding to the location of the expanded face box is found through testing. The pixels corresponding to the expanded face box are mapped to this interval. Finally, these pixel values ​​are converted to an 8-bit data range. S5. Perform face frame cropping: Face bounding boxes are cropped after expanding the 8-bit depth map.

2. The method for converting a 32-bit face depth map to 8-bit for liveness detection according to claim 1, characterized in that, In step S1, when acquiring TOF near-infrared and depth maps, the distance between the device and the face is between 30 and 80 centimeters. If the distance exceeds this range, the depth information will be affected.

3. The method for converting a 32-bit depth map of a face into an 8-bit image for liveness detection according to claim 1, characterized in that, In step S2, the face detection model only takes the detected qualified face boxes. The face detection score threshold is 0.

25. A score greater than 0.25 is considered a qualified complete face, and a score less than 0.25 is considered an unqualified face. Unqualified faces are non-faces or incomplete faces, and unqualified faces will be filtered out.

4. The method for converting a 32-bit face depth map to 8-bit for liveness detection according to claim 1, characterized in that, In step S3, the detection frame expansion further includes: S3.1, Face detection bounding box: set height H, width W; The top-left corner of the face detection bounding box is (x1, y1). The coordinates of the bottom right corner of the face detection bounding box are (x2, y2). W = x2-x1 H = y2-y1; S3.2 Calculate the center coordinates (center_x, center_y) of the detection box. The center coordinates of the detection frame are: center_x = (x1+x2) / 2 center_y = (y1+y2) / 2 S3.3, Calculate the cutting length radius radius = max(H,W) / 2 S3.4, Expand the clipping frame: Top left point x:center_x-radius Lower left point y:center_y-radius bottom right point x: center_x+radius The bottom right point is y: center_y+radius; S3.5, Clipping Depth Map.

5. The method for converting a 32-bit face depth map to 8-bit for liveness detection according to claim 1, characterized in that, In step S4, the 32-bit to 8-bit depth map conversion further includes: S4.1, obtains a 32-bit depth map using a TOF camera; S4.2 sets the maximum and minimum boundary values ​​of pixels in the 32-bit depth map through testing: ; ; This step is to keep all pixels in the 32-bit depth map within a uniform range, avoiding the influence of overly bright or dark pixels; S4.3, controls each pixel within the boundary range; Iterate through each pixel value in the 32-bit depth map. If the pixel value is less than Min_v, modify the pixel to Min_v. If the pixel value is greater than Max_v, modify the pixel to Max_v. If the pixel value is within the boundary range, the pixel value remains unchanged. S4.4, Calculate the average depth within the detection box; Iterate through each pixel in the region corresponding to the detection box in the 32-bit depth map, sum all pixel values, and divide by the corresponding number of pixels to obtain the mean depth value in the region of the detection box. S4.5, Test to find the boundary value of the mean: ; ; This step is to keep all pixels in the region corresponding to the face detection box in the 32-bit depth map within a uniform range. Through multiple tests, the depth effect produced by using this boundary value is more obvious. S4.6, controls each pixel within the mean boundary range; Iterate through each pixel value in the 32-bit depth map. If the pixel value is less than Min_1, modify the pixel to Min_1. If the pixel value is greater than Max_1, modify the pixel to Max_1. If the pixel value is within the boundary range, the pixel value remains unchanged. S4.7 converts each pixel to an 8-bit range, pixel value / 2^15; S4.8 yields an 8-bit depth map.

6. The method for converting a 32-bit face depth map to 8-bit for liveness detection according to claim 1, characterized in that, In step S5, the 8-bit depth map is calculated based on the facial information. To prevent the influence of other pixels, the depth map is cropped according to the expanded face frame to obtain a clearer depth map of the face.

7. The method for converting a 32-bit depth map of a face into an 8-bit image for liveness detection according to claim 1, characterized in that, The method further includes step S6: liveness detection, which involves applying the obtained cropped image to the liveness detection model to perform liveness detection.