ID photo shooting method, device and computer-readable storage medium
By combining depth images and color images to recognize and adjust face postures and generate prompt information, the problem that traditional ID photos cannot accurately adjust face postures is solved, and the shooting effect and user experience are improved.
Patent Information
- Application Number
- CN202210326516.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-03-30
AI Technical Summary
Traditional document photo shooting methods cannot accurately realize prompt adjustments based on facial posture, resulting in poor shooting results and insufficient user experience.
By obtaining a preview image containing a face, combining depth images and color images to detect face key points, obtain depth information of face key points, and generate prompt information to assist users in adjusting face posture based on multi-view angle calculation and adjustment methods.
A more user-friendly document photo shooting solution has been realized, improving the shooting effect and user experience.
Smart Images

Figure CN114727017B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mobile communications, and in particular to a method and device for photographing a certificate photo, and a computer-readable storage medium. Background Art
[0002] In the prior art, with the continuous development of smart terminal devices, the shooting application functions based on the device side are becoming more and more abundant. In particular, based on the existing camera solutions, face shooting functions such as ID photo shooting have been derived. In the traditional ID photo shooting method, generally only a prompt box is provided to prompt the photographer to place the face in a specified position on the screen, such as the middle position, left and right adjustment, etc. In order to obtain a good shooting effect, when the user places the face in the specified position of the screen, it is often necessary to further adjust the distance between the face and the terminal device, as well as the face posture, etc. However, the traditional ID photo shooting cannot accurately realize the prompt adjustment based on the face posture, which leads to the final shooting effect of the ID photo is often unsatisfactory, and the user's shooting experience needs to be improved. Summary of the invention
[0003] In order to solve the above technical defects in the prior art, the present invention proposes a method for taking a certificate photo, which comprises:
[0004] A preview image containing a human face is obtained, wherein the preview image includes a depth image and a color image corresponding to the depth image.
[0005] Facial key points are detected according to the color image, and depth information of the facial key points is acquired according to the depth image.
[0006] A preset face posture closest to the current face posture is obtained, and an adjustment method of the current face posture is calculated based on multiple viewing angles.
[0007] Prompt information of the adjustment method is generated to assist the user in adjusting the facial posture.
[0008] Optionally, the obtaining of the preview image containing the face, wherein the preview image includes a depth image and a color image corresponding to the depth image, comprises:
[0009] Preset N types of face poses that can be used for ID photo shooting ,in, ,The face posture includes front face posture and side face posture, where:
[0010] .
[0011] The face pose is a list of 3D face key points containing a predetermined number M and sorted according to a predetermined rule; wherein M is a predetermined parameter:
[0012] .
[0013] .
[0014] Among them, x i ,y i Keypoint i The horizontal and vertical coordinates in the image, z i Keypoint i Depth information in an image.
[0015] Optionally, the acquiring of a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image, comprises:
[0016] Get preview color image And the depth image pre_imag_d based on the ToF depth camera.
[0017] The depth image pre_imag_d is obtained by comparing it with the preview color image. Registered depth image.
[0018] Optionally, the detecting facial key points according to the color image and acquiring depth information of the facial key points according to the depth image include:
[0019] Perform the facial key point detection based on the color image to obtain a previewed facial key point list:
[0020] .
[0021] .
[0022] Among them, X i ,y i Keypoint i The horizontal and vertical coordinates in the image.
[0023] Optionally, the detecting facial key points according to the color image, and acquiring depth information of the facial key points according to the depth image, further includes:
[0024] Based on the ToF depth image, obtaining depth information corresponding to the facial key points in the current facial key point list includes:
[0025] Get And the resolution of the depth image pre_imag_d:
[0026] .
[0027] .
[0028] For the preview of the face key points list Each of the facial keypoints i , calculate its mapping coordinates of pre_imag_d in the depth image:
[0029] .
[0030] Get the location mappoint in the depth image pre_imag_d i The depth information at the position is used as the keypoint of the face i The depth information d i :
[0031] .
[0032] .
[0033] Optionally, the acquiring a preset facial posture closest to the current facial posture, and calculating an adjustment method of the current facial posture based on multiple perspectives, includes:
[0034] In the preset face posture list REC_Posture, obtain the preset face posture rec_posture closest to the current face posture i ,include:
[0035] The preset face posture with the smallest average Euclidean distance is obtained as the face posture mindiss_rec_posture closest to the preview face posture.
[0036] Optionally, the acquiring of a preset facial posture closest to the current facial posture, and calculating an adjustment method of the current facial posture based on multiple perspectives, further includes:
[0037] Based on multiple perspectives, for the previewed face key point list pre_posture, the closest recommended face posture mindiss_rec_posture is used to calculate the face adjustment method, including:
[0038] According to the preset priority order, each view vs in the preset multi-view Mul_VS i Perform constraint check. If the current viewing angle meets the constraint conditions, check whether the next viewing angle meets the constraint conditions. If the current viewing angle does not meet the constraint conditions, then adjust the zoom scale according to the zoom factor.i and the rotation angle θ i Prompt the user to adjust their posture.
[0039] Optionally, the preset priority order is used to select each view vs in the preset multi-view Mul_VS. i Perform constraint checking, including:
[0040] Get the current highest priority perspective vs i And its corresponding scaling scale i and the rotation angle θ i .
[0041] According to the preset thresholds S_TH and θ_TH, it is determined whether the constraint conditions are met, wherein the constraint conditions are: .
[0042] .
[0043] The present invention also proposes a device for taking ID photos, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method for taking ID photos as described in any one of the above items when executed by the processor.
[0044] The present invention also proposes a computer-readable storage medium on which a program for photographing an ID photo is stored. When the program for photographing an ID photo is executed by a processor, the steps of the method for photographing an ID photo as described in any one of the above items are implemented.
[0045] The ID photo shooting method, device and computer-readable storage medium of the present invention are implemented by obtaining a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image; detecting key points of the face according to the color image, and obtaining depth information of the key points of the face according to the depth image; obtaining a preset face posture closest to the current face posture, and calculating the adjustment method of the current face posture based on multiple perspectives. A more humane ID photo shooting solution is realized, which improves the ID photo shooting effect by identifying and adjusting the face posture in combination with the depth image, and enhances the user experience of the ID photo shooting function. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0047] Figure 1 It is a hardware structure diagram of a mobile terminal involved in the present invention;
[0048] Figure 2is a communication network system architecture diagram provided by an embodiment of the present invention;
[0049] Figure 3 It is a flow chart of the first embodiment of the ID photo shooting method of the present invention. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0051] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0052] The terminal may be implemented in various forms. For example, the terminal described in the present invention may include mobile terminals such as mobile phones, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as fixed terminals such as digital TVs and desktop computers.
[0053] The following description will be made by taking a mobile terminal as an example, and those skilled in the art will appreciate that, in addition to components specifically used for mobile purposes, the configuration according to the embodiments of the present invention can also be applied to fixed-type terminals.
[0054] See also Figure 1 , which is a schematic diagram of the hardware structure of a mobile terminal for implementing various embodiments of the present invention, the mobile terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103, A / V (audio / video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111 and other components. Those skilled in the art can understand that Figure 1 The structure of the mobile terminal shown in the figure does not constitute a limitation on the mobile terminal. The mobile terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0055] Combine the following Figure 1 The following is a detailed introduction to the various components of the mobile terminal:
[0056] The radio frequency unit 101 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving the downlink information of the base station, it is sent to the processor 110 for processing; in addition, the uplink data is sent to the base station. Generally, the radio frequency unit 101 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 101 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communications may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division Duplexing- Long Term Evolution) and TDD-LTE (Time Division Duplexing- Long Term Evolution), etc.
[0057] WiFi is a short-range wireless transmission technology. Mobile terminals can help users send and receive emails, browse web pages, and access streaming media through WiFi module 102. It provides users with wireless broadband Internet access. Figure 1 The WiFi module 102 is shown, but it is understandable that it is not an essential component of the mobile terminal and can be omitted as needed without changing the essence of the invention.
[0058] The audio output unit 103 can convert the audio data received by the RF unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output it as sound when the mobile terminal 100 is in a call signal reception mode, a talk mode, a recording mode, a voice recognition mode, a broadcast reception mode, etc. Moreover, the audio output unit 103 can also provide audio output related to a specific function performed by the mobile terminal 100 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, etc.
[0059] The A / V input unit 104 is used to receive audio or video signals. The A / V input unit 104 may include a graphics processor (GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 106. The image frame processed by the graphics processor 1041 can be stored in the memory 109 (or other storage medium) or sent via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 can receive sound (audio data) via the microphone 1042 in a telephone call mode, a recording mode, a voice recognition mode, and the like, and can process such sound into audio data. The processed audio (voice) data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 101 in the case of a telephone call mode. The microphone 1042 can implement various types of noise elimination (or suppression) algorithms to eliminate (or suppress) noise or interference generated in the process of receiving and sending audio signals.
[0060] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1061 and / or the backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can also be configured on the mobile phone, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0061] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0062] The user input unit 107 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch panel 1071), and drive corresponding connection devices according to a pre-set program. The touch panel 1071 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact point coordinates, and then sends it to the processor 110, and can receive and execute commands sent by the processor 110. In addition, the touch panel 1071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1071, the user input unit 107 may also include other input devices 1072. Specifically, the other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, etc., which are not specifically limited here.
[0063] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of the touch event. Then, the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Figure 1 In the figure, the touch panel 1071 and the display panel 1061 are used as two independent components to implement the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to implement the input and output functions of the mobile terminal, which is not limited here.
[0064] The interface unit 108 serves as an interface through which at least one external device can be connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and an external device.
[0065] The memory 109 can be used to store software programs and various data. The memory 109 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 109 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0066] The processor 110 is the control center of the mobile terminal. It uses various interfaces and lines to connect various parts of the entire mobile terminal. It executes various functions of the mobile terminal and processes data by running or executing software programs and / or modules stored in the memory 109, and calling data stored in the memory 109, so as to monitor the mobile terminal as a whole. The processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 110.
[0067] The mobile terminal 100 may further include a power supply 111 (such as a battery) for supplying power to various components. Preferably, the power supply 111 may be logically connected to the processor 110 via a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0068] although Figure 1 Not shown, the mobile terminal 100 may further include a Bluetooth module, etc., which will not be described in detail here.
[0069] To facilitate understanding of the embodiments of the present invention, the communication network system on which the mobile terminal of the present invention is based is described below.
[0070] See also Figure 2 , Figure 2 A communication network system architecture diagram is provided for an embodiment of the present invention. The communication network system is an LTE system of universal mobile communication technology. The LTE system includes a UE (User Equipment) 201, an E-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an EPC (Evolved Packet Core) 203 and an operator's IP service 204, which are sequentially connected for communication.
[0071] Specifically, UE201 may be the above-mentioned terminal 100, which will not be described in detail here.
[0072] E-UTRAN 202 includes eNodeB 2021 and other eNodeBs 2022 , etc. Among them, eNodeB 2021 can be connected to other eNodeBs 2022 through a backhaul (eg, an X2 interface), and eNodeB 2021 is connected to EPC 203 , and eNodeB 2021 can provide UE 201 with access to EPC 203 .
[0073] EPC203 may include MME (Mobility Management Entity) 2031, HSS (Home Subscriber Server) 2032, other MMEs 2033, SGW (Serving GateWay) 2034, PGW (PDN Gate Way) 2035 and PCRF (Policy and Charging Rules Function) 2036, etc. Among them, MME2031 is a control node that processes signaling between UE201 and EPC203, and provides bearer and connection management. HSS2032 is used to provide some registers to manage functions such as home location register (not shown in the figure), and saves some user-specific information such as service features and data rates. All user data can be sent through SGW2034. PGW2035 can provide IP address allocation and other functions for UE 201. PCRF2036 is the policy and charging control policy decision point for service data flow and IP bearer resources. It selects and provides available policy and charging control decisions for the policy and charging execution function unit (not shown in the figure).
[0074] The IP service 204 may include the Internet, an intranet, an IMS (IP Multimedia Subsystem) or other IP services.
[0075] Although the above introduction takes the LTE system as an example, those skilled in the art should know that the present invention is not only applicable to the LTE system, but also to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA and future new network systems, etc., which are not limited here.
[0076] Based on the above mobile terminal hardware structure and communication network system, various embodiments of the method of the present invention are proposed.
[0077] Embodiment 1
[0078] Figure 3 1 is a flow chart of a first embodiment of a method for photographing a certificate photo of the present invention. A method for photographing a certificate photo, the method comprising:
[0079] S1. Obtain a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image.
[0080] S2. Detect facial key points according to the color image, and obtain depth information of the facial key points according to the depth image.
[0081] S3. Obtain a preset facial posture that is closest to the current facial posture, and calculate an adjustment method for the current facial posture based on multiple perspectives.
[0082] S4. Generate prompt information of the adjustment method to assist the user in adjusting the facial posture.
[0083] In this embodiment, by presetting a plurality of face postures and estimating the face posture based on the depth image of the ToF depth camera, the subject is reminded to adjust the face posture when taking pictures, for example, tuck in the chin or tilt the face to the left, so that the user can get guidance similar to that of a professional photographer and obtain better shooting effects.
[0084] In this embodiment, specifically, first, a preview image containing a face is obtained, wherein the preview image includes a depth image and a color image corresponding to the depth image; then, facial key points are detected based on the color image, and depth information of the facial key points is obtained based on the depth image; finally, a preset facial posture closest to the current facial posture is obtained, and an adjustment method of the current facial posture is calculated based on multiple perspectives, and prompt information of the adjustment method is generated to assist the user in adjusting the facial posture.
[0085] The beneficial effect of this embodiment is that by obtaining a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image; performing facial key point detection based on the color image, and obtaining depth information of the facial key points based on the depth image; obtaining a preset facial posture closest to the current facial posture, and calculating the adjustment method of the current facial posture based on multiple perspectives. A more humane ID photo shooting solution is realized, which improves the ID photo shooting effect and enhances the user experience of the ID photo shooting function by identifying and adjusting the facial posture in combination with the depth image.
[0086] Embodiment 2
[0087] Based on the above embodiment, in this embodiment, first, a list of N facial postures REC_Posture that can be used for ID photo shooting is preset, where N≥1; the facial postures include but are not limited to frontal face, side face, etc., wherein the facial posture list is expressed as:
[0088] .
[0089] In this embodiment, the face pose is a list of 3D face key points that includes a predetermined number M and is sorted according to a predetermined rule. Wherein, M is a predetermined parameter, for example, M=128. The face pose is expressed as:
[0090] .
[0091] .
[0092] Among them, X i ,y i Keypoint i The horizontal and vertical coordinates in the image, z i Keypoint i Depth information in an image.
[0093] In this embodiment, a preview color image is obtained. And the depth image pre_imag_d based on ToF; the depth image pre_imag_d must be a color image A registered depth image; optionally, the depth image pre_imag_d may be a depth image that has undergone super-resolution calculation, etc.
[0094] In this embodiment, facial key point detection is performed based on the color image to obtain a preview of the facial key point list, which is expressed as:
[0095] .
[0096] .
[0097] Among them, X i ,y i Keypoint i The horizontal and vertical coordinates in the image.
[0098] In this embodiment, based on the ToF depth image, the depth information corresponding to the facial key points in the current facial key point list is obtained, specifically, including the following three steps:
[0099] First, obtain And the resolution of the depth image pre_imag_d:
[0100] .
[0101] .
[0102] Second, for the preview of the face key points list Each face keypoint in i, Calculate its mapping coordinates of pre_imag_d in the depth image:
[0103] .
[0104] Third, get the location point mappoint in the depth image pre_imag_d i The depth information at the point is used as the keypoint of the face i The depth information d i .
[0105] .
[0106] .
[0107] In this embodiment, in the preset face posture list Get the preset face posture rec_posture that is closest to the current face posture i, The specific steps include the following six steps:
[0108] First, when N==1 (only one recommended face pose is preset), the current preset face pose is directly used as the preset face pose closest to the preview face pose;
[0109] Second, when == 2, for the current preview face key point list , calculate its difference with the preset face pose list A list of facial key points for each preset face pose in rec_posture i The homography matrix H i :
[0110] .
[0111] Third, select M2 predetermined image calibration key points (such as the image origin, the image center, the lower left point of the image, the lower right point of the image, the upper right point of the image, etc.), M2≥2.
[0112] .
[0113] Fourth, for Each keypoint in i, According to the preview face key point list With the preset face pose list A list of facial key points for each preset face pose in rec_posture i The homography matrix H i, Find its transformed coordinate position:
[0114] .
[0115] in:
[0116] .
[0117] Fifth, for each , seek and The average Euclidean distance of:
[0118] .
[0119] in:
[0120] .
[0121] .
[0122] .
[0123] .
[0124] .
[0125] .
[0126] Sixth, obtain the preset face posture with the smallest average Euclidean distance as the face posture mindiss_rec_posture closest to the preview face posture.
[0127] In this embodiment, for the current preview face posture , and the recommended face posture mindiss_rec_posture closest to it, based on multi-view calculation face adjustment method, specifically including the following four steps:
[0128] First, obtain a preset multi-view Mul_VS; the multi-view includes multiple feature point pairs, such as (left eye outer corner, right eye outer corner), (forehead midpoint, chin midpoint), etc.; the feature point pairs under different viewing angles can describe the current face posture features, and each viewing angle in the multi-view is arranged according to a predetermined priority:
[0129] .
[0130] .
[0131] Second, for multi-view Various perspectives in vs i , get the face pose in preview The corresponding key points in and the corresponding key points in the recommended mindiss_rec_posture face posture:
[0132] .
[0133] .
[0134] in, The three-dimensional vector composed of the key point pairs in ( ) is expressed as:
[0135] .
[0136] .
[0137] .
[0138] .
[0139] Similarly, The three-dimensional vector composed of the key point pairs in ( ) is expressed as:
[0140] .
[0141] .
[0142] .
[0143] .
[0144] Third, calculate the scaling :
[0145] .
[0146] Fourth, calculate the rotation angle θ i :
[0147] .
[0148] In this embodiment, a predetermined zoom scale threshold S_TH and a rotation angle threshold θ_TH are obtained.
[0149] In this embodiment, according to the established priority order, the multi-view Various perspectives in The constraint check consists of the following two steps:
[0150] First, get the current highest priority perspective and its corresponding scaling and the rotation angle θ i .
[0151] Second, according to the predetermined thresholds S_TH and θ_TH, determine whether the constraint conditions are met; the constraint conditions are:
[0152] .
[0153] .
[0154] In this embodiment, if the current viewing angle satisfies the constraint condition, it is checked whether the next viewing angle satisfies the constraint condition; if the current viewing angle does not satisfy the constraint condition, the user is prompted to adjust the posture according to the zoom scale and the rotation angle.
[0155] The beneficial effect of this embodiment is that by obtaining a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image; performing facial key point detection based on the color image, and obtaining depth information of the facial key points based on the depth image; obtaining a preset facial posture closest to the current facial posture, and calculating the adjustment method of the current facial posture based on multiple perspectives. A more humane ID photo shooting solution is realized, which improves the ID photo shooting effect and enhances the user experience of the ID photo shooting function by identifying and adjusting the facial posture in combination with the depth image.
[0156] Embodiment 3
[0157] Based on the above embodiments, the present invention also proposes a device for taking ID photos, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for taking ID photos as described in any one of the above items.
[0158] It should be noted that the above-mentioned device embodiment and method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the device embodiment, which will not be repeated here.
[0159] Embodiment 4
[0160] Based on the above embodiments, the present invention further proposes a computer-readable storage medium, on which a program for taking ID photos is stored. When the program for taking ID photos is executed by a processor, the steps of the method for taking ID photos as described in any one of the above items are implemented.
[0161] It should be noted that the above-mentioned medium embodiment and method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the medium embodiment, which will not be repeated here.
[0162] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0163] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0165] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A method for taking a ID photo, characterized in that: The method comprises: Acquire a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image; Performing facial key point detection according to the color image, and acquiring depth information of the facial key points according to the depth image; Acquire a preset face posture closest to the current face posture, and calculate an adjustment method of the current face posture based on multiple viewing angles; Generating prompt information of the adjustment method to assist the user in adjusting the facial posture; The obtaining of a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image, comprises: A list of N face postures REC_Posture that can be used for ID photo shooting is preset, where N ≥ 1, and the face postures include frontal face posture and side face posture, where: REC_Posture={rec_posture1,……,rec_posture N }; The face pose is a list of 3D face key points containing a predetermined number M and sorted according to a predetermined rule; wherein M is a predetermined parameter: rec_posture i ={keypoint1,keypoint2,……,keypoint M }; keypoint i ={x i ,y i ,d i }; Among them, x i ,y i Keypoint i The horizontal and vertical coordinates in the image, z i Keypoint i Depth information in images; The method of obtaining a preset face posture closest to the current face posture and calculating an adjustment method of the current face posture based on multiple perspectives includes: In the preset face posture list REC_Posture, obtain the preset face posture rec_posture closest to the current face posture i ,include: Obtain the preset face posture with the smallest average Euclidean distance as the face posture mindiss_rec_posture closest to the preview face posture; Based on multiple perspectives, for the previewed facial key point list pre_posture, the closest recommended facial posture mindiss_rec_posture is used to calculate the facial adjustment method, including: According to the preset priority order, each view vs in the preset multi-view Mul_VS i Perform constraint check. If the current viewing angle meets the constraint conditions, check whether the next viewing angle meets the constraint conditions. If the current viewing angle does not meet the constraint conditions, then adjust the zoom scale according to the zoom factor. i and the rotation angle θ i Prompt the user to adjust their posture; The preset priority order is used to select each view vs in the preset multi-view Mul_VS. i Perform constraint checking, including: Get the current highest priority perspective vs i And its corresponding scaling scale i and the rotation angle θ i ; According to the preset thresholds S_TH and θ_TH, it is determined whether the constraint conditions are met, wherein the constraint conditions are: scale i ≤S_TH; i i ≤θ_TH.
2. The ID photo shooting method according to claim 1, characterized in that: The obtaining of a preview image containing a face, wherein the preview image includes a depth image and a color image corresponding to the depth image, comprises: Get the preview color image pre_image_rgb and the depth image pre_imag_d based on the ToF depth camera; The depth image pre_imag_d is a depth image that has been registered with the preview color image pre_image_rgb.
3. The ID photo shooting method according to claim 2, characterized in that: The detecting of facial key points according to the color image and acquiring depth information of the facial key points according to the depth image include: Perform the facial key point detection based on the color image to obtain a previewed facial key point list: pre_posture={keypoint1,keypoint2,……,keypoint M }; keypoint i ={x i ,y i }; Among them, x i ,y i Keypoint i The horizontal and vertical coordinates in the image.
4. The ID photo shooting method according to claim 3, characterized in that: The detecting of facial key points according to the color image and acquiring depth information of the facial key points according to the depth image further includes: Based on the ToF depth image, obtaining depth information corresponding to the facial key points in the current facial key point list includes: Get the resolution of pre_image_rgb and depth image pre_imag_d: shape_rgb = {h_rgb, w_rgb}; shape_d = {h_d, w_d}; For each of the facial keypoints in the previewed facial keypoint list pre_posture i , calculate its mapping coordinates of pre_imag_d in the depth image: Get the location mappoint in the depth image pre_imag_d i The depth information at the position is used as the keypoint of the face i The depth information d i : keypoint i ={x i ,y i ,d i }; d i =pre_imag_d(mappoint i )。 5. A device for taking ID photos, characterized in that: The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the ID photo shooting method as described in any one of claims 1 to 4 are implemented.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an ID photo shooting program, and when the ID photo shooting program is executed by the processor, the steps of the ID photo shooting method according to any one of claims 1 to 4 are implemented.
